diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..6b719a63 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + build + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/Makefile.full b/Makefile.full new file mode 100644 index 00000000..bb5620fe --- /dev/null +++ b/Makefile.full @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile.full +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBMAKES = Makefile.twlSDK Makefile.nitroSystem.LTD Makefile.nitroSystem.HYB Makefile + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/Makefile.nitroSystem.HYB b/Makefile.nitroSystem.HYB new file mode 100644 index 00000000..31a71621 --- /dev/null +++ b/Makefile.nitroSystem.HYB @@ -0,0 +1,36 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile.nitroSystem +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- +# 何故かよくわからないが、TARGET_ARCHGEN=ALLではダメ。TWL_ARCHGEN=HYBLIDでもダメ。。。 +export TARGET_ARCHGEN = HYBLID +export TARGET_CODEGEN = ALL +export NITRO_WITHOUT_DEMOS = TRUE + +SUBDIRS = $(NITROSYSTEM_ROOT) + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/Makefile.nitroSystem.LTD b/Makefile.nitroSystem.LTD new file mode 100644 index 00000000..d2a6b868 --- /dev/null +++ b/Makefile.nitroSystem.LTD @@ -0,0 +1,36 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile.nitroSystem +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- +# 何故かよくわからないが、TARGET_ARCHGEN=ALLではダメ。TWL_ARCHGEN=ALL, TARGET_ARCHGEN=LIMITEDでもダメ。。。 +export TWL_ARCHGEN = LIMITED +export TARGET_CODEGEN = ALL +export NITRO_WITHOUT_DEMOS = TRUE + +SUBDIRS = $(NITROSYSTEM_ROOT) + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/Makefile.sysmenu b/Makefile.sysmenu new file mode 100644 index 00000000..6e26a5e6 --- /dev/null +++ b/Makefile.sysmenu @@ -0,0 +1,38 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile.sysmenu +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + build/tools \ + build/libraries_sysmenu \ + build/components \ + build/systemmenu_RED + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/Makefile.twlSDK b/Makefile.twlSDK new file mode 100644 index 00000000..1efe62c5 --- /dev/null +++ b/Makefile.twlSDK @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile.twlSDK +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- +export TARGET_ARCHGEN = ALL +export TARGET_CODEGEN = ALL + +SUBDIRS = \ + $(ROOT)/build/libraries/reboot \ + $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/RomHeader/001A/libsyscall.a b/RomHeader/001A/libsyscall.a new file mode 100644 index 00000000..f29bcb90 Binary files /dev/null and b/RomHeader/001A/libsyscall.a differ diff --git a/RomHeader/001A/libsyscall_c.bin b/RomHeader/001A/libsyscall_c.bin new file mode 100644 index 00000000..36c7cea1 Binary files /dev/null and b/RomHeader/001A/libsyscall_c.bin differ diff --git a/RomHeader/001A/rom_header_001a.template.sbin b/RomHeader/001A/rom_header_001a.template.sbin new file mode 100644 index 00000000..b13f092f Binary files /dev/null and b/RomHeader/001A/rom_header_001a.template.sbin differ diff --git a/RomHeader/012A/libsyscall.a b/RomHeader/012A/libsyscall.a new file mode 100644 index 00000000..a269a6fb Binary files /dev/null and b/RomHeader/012A/libsyscall.a differ diff --git a/RomHeader/012A/rom_header_012a.template.sbin b/RomHeader/012A/rom_header_012a.template.sbin new file mode 100644 index 00000000..fc33e8ce Binary files /dev/null and b/RomHeader/012A/rom_header_012a.template.sbin differ diff --git a/RomHeader/020A/libsyscall.a b/RomHeader/020A/libsyscall.a new file mode 100644 index 00000000..299be774 Binary files /dev/null and b/RomHeader/020A/libsyscall.a differ diff --git a/RomHeader/020A/libsyscall_c.bin b/RomHeader/020A/libsyscall_c.bin new file mode 100644 index 00000000..3314c0ac Binary files /dev/null and b/RomHeader/020A/libsyscall_c.bin differ diff --git a/RomHeader/020A/rom_header_020a.template.sbin b/RomHeader/020A/rom_header_020a.template.sbin new file mode 100644 index 00000000..2f96f580 Binary files /dev/null and b/RomHeader/020A/rom_header_020a.template.sbin differ diff --git a/RomHeader/021A/libsyscall.a b/RomHeader/021A/libsyscall.a new file mode 100644 index 00000000..c07da91f Binary files /dev/null and b/RomHeader/021A/libsyscall.a differ diff --git a/RomHeader/021A/libsyscall_c.bin b/RomHeader/021A/libsyscall_c.bin new file mode 100644 index 00000000..0fef1d04 Binary files /dev/null and b/RomHeader/021A/libsyscall_c.bin differ diff --git a/RomHeader/021A/rom_header_021a.template.sbin b/RomHeader/021A/rom_header_021a.template.sbin new file mode 100644 index 00000000..3f4e3aa3 Binary files /dev/null and b/RomHeader/021A/rom_header_021a.template.sbin differ diff --git a/RomHeader/022A/libsyscall.a b/RomHeader/022A/libsyscall.a new file mode 100644 index 00000000..feda5fb4 Binary files /dev/null and b/RomHeader/022A/libsyscall.a differ diff --git a/RomHeader/022A/libsyscall_c.bin b/RomHeader/022A/libsyscall_c.bin new file mode 100644 index 00000000..2db919cc Binary files /dev/null and b/RomHeader/022A/libsyscall_c.bin differ diff --git a/RomHeader/022A/rom_header_022a.template.sbin b/RomHeader/022A/rom_header_022a.template.sbin new file mode 100644 index 00000000..77217e6d Binary files /dev/null and b/RomHeader/022A/rom_header_022a.template.sbin differ diff --git a/RomHeader/023A/libsyscall.a b/RomHeader/023A/libsyscall.a new file mode 100644 index 00000000..b7a4514f Binary files /dev/null and b/RomHeader/023A/libsyscall.a differ diff --git a/RomHeader/023A/libsyscall_c.bin b/RomHeader/023A/libsyscall_c.bin new file mode 100644 index 00000000..43fc442c Binary files /dev/null and b/RomHeader/023A/libsyscall_c.bin differ diff --git a/RomHeader/023A/rom_header_023a.template.sbin b/RomHeader/023A/rom_header_023a.template.sbin new file mode 100644 index 00000000..bbe3a80c Binary files /dev/null and b/RomHeader/023A/rom_header_023a.template.sbin differ diff --git a/RomHeader/024A/libsyscall.a b/RomHeader/024A/libsyscall.a new file mode 100644 index 00000000..e3794afe Binary files /dev/null and b/RomHeader/024A/libsyscall.a differ diff --git a/RomHeader/024A/libsyscall_c.bin b/RomHeader/024A/libsyscall_c.bin new file mode 100644 index 00000000..ee68c8ea Binary files /dev/null and b/RomHeader/024A/libsyscall_c.bin differ diff --git a/RomHeader/024A/rom_header_024a.template.sbin b/RomHeader/024A/rom_header_024a.template.sbin new file mode 100644 index 00000000..a2cac848 Binary files /dev/null and b/RomHeader/024A/rom_header_024a.template.sbin differ diff --git a/RomHeader/025A/libsyscall.a b/RomHeader/025A/libsyscall.a new file mode 100644 index 00000000..8bcb6c8a Binary files /dev/null and b/RomHeader/025A/libsyscall.a differ diff --git a/RomHeader/025A/libsyscall_c.bin b/RomHeader/025A/libsyscall_c.bin new file mode 100644 index 00000000..462f6a91 Binary files /dev/null and b/RomHeader/025A/libsyscall_c.bin differ diff --git a/RomHeader/025A/rom_header_025a.template.sbin b/RomHeader/025A/rom_header_025a.template.sbin new file mode 100644 index 00000000..43cc1f7c Binary files /dev/null and b/RomHeader/025A/rom_header_025a.template.sbin differ diff --git a/RomHeader/0B0A/libsyscall.a b/RomHeader/0B0A/libsyscall.a new file mode 100644 index 00000000..38d8bba6 Binary files /dev/null and b/RomHeader/0B0A/libsyscall.a differ diff --git a/RomHeader/0B0A/libsyscall_c.bin b/RomHeader/0B0A/libsyscall_c.bin new file mode 100644 index 00000000..5f572b84 Binary files /dev/null and b/RomHeader/0B0A/libsyscall_c.bin differ diff --git a/RomHeader/0B0A/rom_header_0b0a.template.sbin b/RomHeader/0B0A/rom_header_0b0a.template.sbin new file mode 100644 index 00000000..4aa79a55 Binary files /dev/null and b/RomHeader/0B0A/rom_header_0b0a.template.sbin differ diff --git a/RomHeader/0B1A/libsyscall.a b/RomHeader/0B1A/libsyscall.a new file mode 100644 index 00000000..9635cf6a Binary files /dev/null and b/RomHeader/0B1A/libsyscall.a differ diff --git a/RomHeader/0B1A/libsyscall_c.bin b/RomHeader/0B1A/libsyscall_c.bin new file mode 100644 index 00000000..9c2df973 Binary files /dev/null and b/RomHeader/0B1A/libsyscall_c.bin differ diff --git a/RomHeader/0B1A/rom_header_0b1a.template.sbin b/RomHeader/0B1A/rom_header_0b1a.template.sbin new file mode 100644 index 00000000..2a1e13b3 Binary files /dev/null and b/RomHeader/0B1A/rom_header_0b1a.template.sbin differ diff --git a/RomHeader/0B2A/libsyscall.a b/RomHeader/0B2A/libsyscall.a new file mode 100644 index 00000000..2984fa4c Binary files /dev/null and b/RomHeader/0B2A/libsyscall.a differ diff --git a/RomHeader/0B2A/libsyscall_c.bin b/RomHeader/0B2A/libsyscall_c.bin new file mode 100644 index 00000000..36c95de4 Binary files /dev/null and b/RomHeader/0B2A/libsyscall_c.bin differ diff --git a/RomHeader/0B2A/rom_header_0b2a.template.sbin b/RomHeader/0B2A/rom_header_0b2a.template.sbin new file mode 100644 index 00000000..d2b92735 Binary files /dev/null and b/RomHeader/0B2A/rom_header_0b2a.template.sbin differ diff --git a/RomHeader/0B3A/libsyscall.a b/RomHeader/0B3A/libsyscall.a new file mode 100644 index 00000000..301ad815 Binary files /dev/null and b/RomHeader/0B3A/libsyscall.a differ diff --git a/RomHeader/0B3A/libsyscall_c.bin b/RomHeader/0B3A/libsyscall_c.bin new file mode 100644 index 00000000..3b632abf Binary files /dev/null and b/RomHeader/0B3A/libsyscall_c.bin differ diff --git a/RomHeader/0B3A/rom_header_0b3a.template.sbin b/RomHeader/0B3A/rom_header_0b3a.template.sbin new file mode 100644 index 00000000..b02be2d5 Binary files /dev/null and b/RomHeader/0B3A/rom_header_0b3a.template.sbin differ diff --git a/RomHeader/0B4A/libsyscall.a b/RomHeader/0B4A/libsyscall.a new file mode 100644 index 00000000..261b9899 Binary files /dev/null and b/RomHeader/0B4A/libsyscall.a differ diff --git a/RomHeader/0B4A/rom_header_0b4a.template.sbin b/RomHeader/0B4A/rom_header_0b4a.template.sbin new file mode 100644 index 00000000..86197c1e Binary files /dev/null and b/RomHeader/0B4A/rom_header_0b4a.template.sbin differ diff --git a/RomHeader/0B5A/libsyscall.a b/RomHeader/0B5A/libsyscall.a new file mode 100644 index 00000000..208efae6 Binary files /dev/null and b/RomHeader/0B5A/libsyscall.a differ diff --git a/RomHeader/0B5A/libsyscall_c.bin b/RomHeader/0B5A/libsyscall_c.bin new file mode 100644 index 00000000..40c44a99 Binary files /dev/null and b/RomHeader/0B5A/libsyscall_c.bin differ diff --git a/RomHeader/0B5A/rom_header_0b5a.template.sbin b/RomHeader/0B5A/rom_header_0b5a.template.sbin new file mode 100644 index 00000000..ee01b5a8 Binary files /dev/null and b/RomHeader/0B5A/rom_header_0b5a.template.sbin differ diff --git a/RomHeader/0B6A/libsyscall.a b/RomHeader/0B6A/libsyscall.a new file mode 100644 index 00000000..3c9f98e0 Binary files /dev/null and b/RomHeader/0B6A/libsyscall.a differ diff --git a/RomHeader/0B6A/libsyscall_c.bin b/RomHeader/0B6A/libsyscall_c.bin new file mode 100644 index 00000000..061fc4ef Binary files /dev/null and b/RomHeader/0B6A/libsyscall_c.bin differ diff --git a/RomHeader/0B6A/rom_header_0b6a.template.sbin b/RomHeader/0B6A/rom_header_0b6a.template.sbin new file mode 100644 index 00000000..3f95b5b0 Binary files /dev/null and b/RomHeader/0B6A/rom_header_0b6a.template.sbin differ diff --git a/RomHeader/0B7A/libsyscall.a b/RomHeader/0B7A/libsyscall.a new file mode 100644 index 00000000..7f2f63ff Binary files /dev/null and b/RomHeader/0B7A/libsyscall.a differ diff --git a/RomHeader/0B7A/libsyscall_c.bin b/RomHeader/0B7A/libsyscall_c.bin new file mode 100644 index 00000000..2c5575f2 Binary files /dev/null and b/RomHeader/0B7A/libsyscall_c.bin differ diff --git a/RomHeader/0B7A/rom_header_0b7a.template.sbin b/RomHeader/0B7A/rom_header_0b7a.template.sbin new file mode 100644 index 00000000..494b4e5a Binary files /dev/null and b/RomHeader/0B7A/rom_header_0b7a.template.sbin differ diff --git a/RomHeader/0B8A/libsyscall.a b/RomHeader/0B8A/libsyscall.a new file mode 100644 index 00000000..2e284d2f Binary files /dev/null and b/RomHeader/0B8A/libsyscall.a differ diff --git a/RomHeader/0B8A/libsyscall_c.bin b/RomHeader/0B8A/libsyscall_c.bin new file mode 100644 index 00000000..7100fc6c Binary files /dev/null and b/RomHeader/0B8A/libsyscall_c.bin differ diff --git a/RomHeader/0B8A/rom_header_0b8a.template.sbin b/RomHeader/0B8A/rom_header_0b8a.template.sbin new file mode 100644 index 00000000..450718c2 Binary files /dev/null and b/RomHeader/0B8A/rom_header_0b8a.template.sbin differ diff --git a/RomHeader/0B9A/libsyscall.a b/RomHeader/0B9A/libsyscall.a new file mode 100644 index 00000000..13dd1fce Binary files /dev/null and b/RomHeader/0B9A/libsyscall.a differ diff --git a/RomHeader/0B9A/libsyscall_c.bin b/RomHeader/0B9A/libsyscall_c.bin new file mode 100644 index 00000000..7c20ee1c Binary files /dev/null and b/RomHeader/0B9A/libsyscall_c.bin differ diff --git a/RomHeader/0B9A/rom_header_0b9a.template.sbin b/RomHeader/0B9A/rom_header_0b9a.template.sbin new file mode 100644 index 00000000..a589bb05 Binary files /dev/null and b/RomHeader/0B9A/rom_header_0b9a.template.sbin differ diff --git a/RomHeader/0BAA/libsyscall.a b/RomHeader/0BAA/libsyscall.a new file mode 100644 index 00000000..58524b37 Binary files /dev/null and b/RomHeader/0BAA/libsyscall.a differ diff --git a/RomHeader/0BAA/libsyscall_c.bin b/RomHeader/0BAA/libsyscall_c.bin new file mode 100644 index 00000000..838e1f81 Binary files /dev/null and b/RomHeader/0BAA/libsyscall_c.bin differ diff --git a/RomHeader/0BAA/rom_header_0baa.template.sbin b/RomHeader/0BAA/rom_header_0baa.template.sbin new file mode 100644 index 00000000..d0aa7302 Binary files /dev/null and b/RomHeader/0BAA/rom_header_0baa.template.sbin differ diff --git a/RomHeader/0BBA/libsyscall.a b/RomHeader/0BBA/libsyscall.a new file mode 100644 index 00000000..618371df Binary files /dev/null and b/RomHeader/0BBA/libsyscall.a differ diff --git a/RomHeader/0BBA/libsyscall_c.bin b/RomHeader/0BBA/libsyscall_c.bin new file mode 100644 index 00000000..fa119ae9 Binary files /dev/null and b/RomHeader/0BBA/libsyscall_c.bin differ diff --git a/RomHeader/0BBA/rom_header_0bba.template.sbin b/RomHeader/0BBA/rom_header_0bba.template.sbin new file mode 100644 index 00000000..ff286c53 Binary files /dev/null and b/RomHeader/0BBA/rom_header_0bba.template.sbin differ diff --git a/RomHeader/0D0A/libsyscall.a b/RomHeader/0D0A/libsyscall.a new file mode 100644 index 00000000..237b50dd Binary files /dev/null and b/RomHeader/0D0A/libsyscall.a differ diff --git a/RomHeader/0D0A/libsyscall_c.bin b/RomHeader/0D0A/libsyscall_c.bin new file mode 100644 index 00000000..5a8cf9d8 Binary files /dev/null and b/RomHeader/0D0A/libsyscall_c.bin differ diff --git a/RomHeader/0D0A/rom_header_0d0a.template.sbin b/RomHeader/0D0A/rom_header_0d0a.template.sbin new file mode 100644 index 00000000..c91573c9 Binary files /dev/null and b/RomHeader/0D0A/rom_header_0d0a.template.sbin differ diff --git a/RomHeader/0D1A/libsyscall.a b/RomHeader/0D1A/libsyscall.a new file mode 100644 index 00000000..c41f9f17 Binary files /dev/null and b/RomHeader/0D1A/libsyscall.a differ diff --git a/RomHeader/0D1A/libsyscall_c.bin b/RomHeader/0D1A/libsyscall_c.bin new file mode 100644 index 00000000..b1b34582 Binary files /dev/null and b/RomHeader/0D1A/libsyscall_c.bin differ diff --git a/RomHeader/0D1A/rom_header_0d1a.template.sbin b/RomHeader/0D1A/rom_header_0d1a.template.sbin new file mode 100644 index 00000000..0f3122f6 Binary files /dev/null and b/RomHeader/0D1A/rom_header_0d1a.template.sbin differ diff --git a/RomHeader/0D2A/libsyscall.a b/RomHeader/0D2A/libsyscall.a new file mode 100644 index 00000000..9759e4f7 Binary files /dev/null and b/RomHeader/0D2A/libsyscall.a differ diff --git a/RomHeader/0D2A/libsyscall_c.bin b/RomHeader/0D2A/libsyscall_c.bin new file mode 100644 index 00000000..b69e9655 Binary files /dev/null and b/RomHeader/0D2A/libsyscall_c.bin differ diff --git a/RomHeader/0D2A/rom_header_0d2a.template.sbin b/RomHeader/0D2A/rom_header_0d2a.template.sbin new file mode 100644 index 00000000..4cc90a9f Binary files /dev/null and b/RomHeader/0D2A/rom_header_0d2a.template.sbin differ diff --git a/RomHeader/0D3A/libsyscall.a b/RomHeader/0D3A/libsyscall.a new file mode 100644 index 00000000..4fee38a0 Binary files /dev/null and b/RomHeader/0D3A/libsyscall.a differ diff --git a/RomHeader/0D3A/libsyscall_c.bin b/RomHeader/0D3A/libsyscall_c.bin new file mode 100644 index 00000000..72ac8b05 Binary files /dev/null and b/RomHeader/0D3A/libsyscall_c.bin differ diff --git a/RomHeader/0D3A/rom_header_0d3a.template.sbin b/RomHeader/0D3A/rom_header_0d3a.template.sbin new file mode 100644 index 00000000..5776c17b Binary files /dev/null and b/RomHeader/0D3A/rom_header_0d3a.template.sbin differ diff --git a/RomHeader/0D4A/libsyscall.a b/RomHeader/0D4A/libsyscall.a new file mode 100644 index 00000000..1b9652db Binary files /dev/null and b/RomHeader/0D4A/libsyscall.a differ diff --git a/RomHeader/0D4A/libsyscall_c.bin b/RomHeader/0D4A/libsyscall_c.bin new file mode 100644 index 00000000..c2f1766b Binary files /dev/null and b/RomHeader/0D4A/libsyscall_c.bin differ diff --git a/RomHeader/0D4A/rom_header_0d4a.template.sbin b/RomHeader/0D4A/rom_header_0d4a.template.sbin new file mode 100644 index 00000000..7c9528b3 Binary files /dev/null and b/RomHeader/0D4A/rom_header_0d4a.template.sbin differ diff --git a/RomHeader/0D5A/libsyscall.a b/RomHeader/0D5A/libsyscall.a new file mode 100644 index 00000000..58e3ef01 Binary files /dev/null and b/RomHeader/0D5A/libsyscall.a differ diff --git a/RomHeader/0D5A/libsyscall_c.bin b/RomHeader/0D5A/libsyscall_c.bin new file mode 100644 index 00000000..77fbd2eb Binary files /dev/null and b/RomHeader/0D5A/libsyscall_c.bin differ diff --git a/RomHeader/0D5A/rom_header_0d5a.template.sbin b/RomHeader/0D5A/rom_header_0d5a.template.sbin new file mode 100644 index 00000000..d428aba8 Binary files /dev/null and b/RomHeader/0D5A/rom_header_0d5a.template.sbin differ diff --git a/RomHeader/0D6A/libsyscall.a b/RomHeader/0D6A/libsyscall.a new file mode 100644 index 00000000..609c56cd Binary files /dev/null and b/RomHeader/0D6A/libsyscall.a differ diff --git a/RomHeader/0D6A/libsyscall_c.bin b/RomHeader/0D6A/libsyscall_c.bin new file mode 100644 index 00000000..1e84604b Binary files /dev/null and b/RomHeader/0D6A/libsyscall_c.bin differ diff --git a/RomHeader/0D6A/rom_header_0d6a.template.sbin b/RomHeader/0D6A/rom_header_0d6a.template.sbin new file mode 100644 index 00000000..d5b24ea9 Binary files /dev/null and b/RomHeader/0D6A/rom_header_0d6a.template.sbin differ diff --git a/RomHeader/0D7A/libsyscall.a b/RomHeader/0D7A/libsyscall.a new file mode 100644 index 00000000..a6e93de6 Binary files /dev/null and b/RomHeader/0D7A/libsyscall.a differ diff --git a/RomHeader/0D7A/libsyscall_c.bin b/RomHeader/0D7A/libsyscall_c.bin new file mode 100644 index 00000000..149d9271 Binary files /dev/null and b/RomHeader/0D7A/libsyscall_c.bin differ diff --git a/RomHeader/0D7A/rom_header_0d7a.template.sbin b/RomHeader/0D7A/rom_header_0d7a.template.sbin new file mode 100644 index 00000000..dca67e43 Binary files /dev/null and b/RomHeader/0D7A/rom_header_0d7a.template.sbin differ diff --git a/RomHeader/0D8A/libsyscall.a b/RomHeader/0D8A/libsyscall.a new file mode 100644 index 00000000..ac1e8d4f Binary files /dev/null and b/RomHeader/0D8A/libsyscall.a differ diff --git a/RomHeader/0D8A/libsyscall_c.bin b/RomHeader/0D8A/libsyscall_c.bin new file mode 100644 index 00000000..46cd298d Binary files /dev/null and b/RomHeader/0D8A/libsyscall_c.bin differ diff --git a/RomHeader/0D8A/rom_header_0d8a.template.sbin b/RomHeader/0D8A/rom_header_0d8a.template.sbin new file mode 100644 index 00000000..98376d77 Binary files /dev/null and b/RomHeader/0D8A/rom_header_0d8a.template.sbin differ diff --git a/RomHeader/0D9A/libsyscall.a b/RomHeader/0D9A/libsyscall.a new file mode 100644 index 00000000..0685416e Binary files /dev/null and b/RomHeader/0D9A/libsyscall.a differ diff --git a/RomHeader/0D9A/libsyscall_c.bin b/RomHeader/0D9A/libsyscall_c.bin new file mode 100644 index 00000000..9c2e5fc8 Binary files /dev/null and b/RomHeader/0D9A/libsyscall_c.bin differ diff --git a/RomHeader/0D9A/rom_header_0d9a.template.sbin b/RomHeader/0D9A/rom_header_0d9a.template.sbin new file mode 100644 index 00000000..b93ee94e Binary files /dev/null and b/RomHeader/0D9A/rom_header_0d9a.template.sbin differ diff --git a/RomHeader/0DAA/libsyscall.a b/RomHeader/0DAA/libsyscall.a new file mode 100644 index 00000000..b4edbf55 Binary files /dev/null and b/RomHeader/0DAA/libsyscall.a differ diff --git a/RomHeader/0DAA/libsyscall_c.bin b/RomHeader/0DAA/libsyscall_c.bin new file mode 100644 index 00000000..bc05e27a Binary files /dev/null and b/RomHeader/0DAA/libsyscall_c.bin differ diff --git a/RomHeader/0DAA/rom_header_0daa.template.sbin b/RomHeader/0DAA/rom_header_0daa.template.sbin new file mode 100644 index 00000000..1818992e Binary files /dev/null and b/RomHeader/0DAA/rom_header_0daa.template.sbin differ diff --git a/RomHeader/0DBA/libsyscall.a b/RomHeader/0DBA/libsyscall.a new file mode 100644 index 00000000..29d5d42e Binary files /dev/null and b/RomHeader/0DBA/libsyscall.a differ diff --git a/RomHeader/0DBA/libsyscall_c.bin b/RomHeader/0DBA/libsyscall_c.bin new file mode 100644 index 00000000..078ac7c1 Binary files /dev/null and b/RomHeader/0DBA/libsyscall_c.bin differ diff --git a/RomHeader/0DBA/rom_header_0dba.template.sbin b/RomHeader/0DBA/rom_header_0dba.template.sbin new file mode 100644 index 00000000..430d8de4 Binary files /dev/null and b/RomHeader/0DBA/rom_header_0dba.template.sbin differ diff --git a/RomHeader/0DCA/libsyscall.a b/RomHeader/0DCA/libsyscall.a new file mode 100644 index 00000000..19300415 Binary files /dev/null and b/RomHeader/0DCA/libsyscall.a differ diff --git a/RomHeader/0DCA/libsyscall_c.bin b/RomHeader/0DCA/libsyscall_c.bin new file mode 100644 index 00000000..c7fbbecd Binary files /dev/null and b/RomHeader/0DCA/libsyscall_c.bin differ diff --git a/RomHeader/0DCA/rom_header_0dca.template.sbin b/RomHeader/0DCA/rom_header_0dca.template.sbin new file mode 100644 index 00000000..11f6fb6c Binary files /dev/null and b/RomHeader/0DCA/rom_header_0dca.template.sbin differ diff --git a/RomHeader/0DDA/libsyscall.a b/RomHeader/0DDA/libsyscall.a new file mode 100644 index 00000000..5a1e27ac Binary files /dev/null and b/RomHeader/0DDA/libsyscall.a differ diff --git a/RomHeader/0DDA/libsyscall_c.bin b/RomHeader/0DDA/libsyscall_c.bin new file mode 100644 index 00000000..ad754709 Binary files /dev/null and b/RomHeader/0DDA/libsyscall_c.bin differ diff --git a/RomHeader/0DDA/rom_header_0dda.template.sbin b/RomHeader/0DDA/rom_header_0dda.template.sbin new file mode 100644 index 00000000..5a367ac7 Binary files /dev/null and b/RomHeader/0DDA/rom_header_0dda.template.sbin differ diff --git a/RomHeader/0DEA/libsyscall.a b/RomHeader/0DEA/libsyscall.a new file mode 100644 index 00000000..915b9a28 Binary files /dev/null and b/RomHeader/0DEA/libsyscall.a differ diff --git a/RomHeader/0DEA/libsyscall_c.bin b/RomHeader/0DEA/libsyscall_c.bin new file mode 100644 index 00000000..f0c3f939 Binary files /dev/null and b/RomHeader/0DEA/libsyscall_c.bin differ diff --git a/RomHeader/0DEA/rom_header_0dea.template.sbin b/RomHeader/0DEA/rom_header_0dea.template.sbin new file mode 100644 index 00000000..e457b743 Binary files /dev/null and b/RomHeader/0DEA/rom_header_0dea.template.sbin differ diff --git a/RomHeader/0DTA/libsyscall.a b/RomHeader/0DTA/libsyscall.a new file mode 100644 index 00000000..11de5155 Binary files /dev/null and b/RomHeader/0DTA/libsyscall.a differ diff --git a/RomHeader/0DTA/libsyscall_c.bin b/RomHeader/0DTA/libsyscall_c.bin new file mode 100644 index 00000000..b9e55bc1 Binary files /dev/null and b/RomHeader/0DTA/libsyscall_c.bin differ diff --git a/RomHeader/0DTA/rom_header_0dta.template.sbin b/RomHeader/0DTA/rom_header_0dta.template.sbin new file mode 100644 index 00000000..245475a6 Binary files /dev/null and b/RomHeader/0DTA/rom_header_0dta.template.sbin differ diff --git a/RomHeader/0E0A/libsyscall.a b/RomHeader/0E0A/libsyscall.a new file mode 100644 index 00000000..1fbe7be4 Binary files /dev/null and b/RomHeader/0E0A/libsyscall.a differ diff --git a/RomHeader/0E0A/libsyscall_c.bin b/RomHeader/0E0A/libsyscall_c.bin new file mode 100644 index 00000000..6a9181ef Binary files /dev/null and b/RomHeader/0E0A/libsyscall_c.bin differ diff --git a/RomHeader/0E0A/rom_header_0e0a.template.sbin b/RomHeader/0E0A/rom_header_0e0a.template.sbin new file mode 100644 index 00000000..f8c023cf Binary files /dev/null and b/RomHeader/0E0A/rom_header_0e0a.template.sbin differ diff --git a/RomHeader/0E1A/libsyscall.a b/RomHeader/0E1A/libsyscall.a new file mode 100644 index 00000000..7ac79aa6 Binary files /dev/null and b/RomHeader/0E1A/libsyscall.a differ diff --git a/RomHeader/0E1A/libsyscall_c.bin b/RomHeader/0E1A/libsyscall_c.bin new file mode 100644 index 00000000..8b7ebfb2 Binary files /dev/null and b/RomHeader/0E1A/libsyscall_c.bin differ diff --git a/RomHeader/0E1A/rom_header_0e1a.template.sbin b/RomHeader/0E1A/rom_header_0e1a.template.sbin new file mode 100644 index 00000000..9a901db3 Binary files /dev/null and b/RomHeader/0E1A/rom_header_0e1a.template.sbin differ diff --git a/RomHeader/0E2A/libsyscall.a b/RomHeader/0E2A/libsyscall.a new file mode 100644 index 00000000..046471b1 Binary files /dev/null and b/RomHeader/0E2A/libsyscall.a differ diff --git a/RomHeader/0E2A/libsyscall_c.bin b/RomHeader/0E2A/libsyscall_c.bin new file mode 100644 index 00000000..b99cb3f5 Binary files /dev/null and b/RomHeader/0E2A/libsyscall_c.bin differ diff --git a/RomHeader/0E2A/rom_header_0e2a.template.sbin b/RomHeader/0E2A/rom_header_0e2a.template.sbin new file mode 100644 index 00000000..271ae091 Binary files /dev/null and b/RomHeader/0E2A/rom_header_0e2a.template.sbin differ diff --git a/RomHeader/0E3A/libsyscall.a b/RomHeader/0E3A/libsyscall.a new file mode 100644 index 00000000..a5a63a3e Binary files /dev/null and b/RomHeader/0E3A/libsyscall.a differ diff --git a/RomHeader/0E3A/libsyscall_c.bin b/RomHeader/0E3A/libsyscall_c.bin new file mode 100644 index 00000000..a3263cd3 Binary files /dev/null and b/RomHeader/0E3A/libsyscall_c.bin differ diff --git a/RomHeader/0E3A/rom_header_0e3a.template.sbin b/RomHeader/0E3A/rom_header_0e3a.template.sbin new file mode 100644 index 00000000..55525d15 Binary files /dev/null and b/RomHeader/0E3A/rom_header_0e3a.template.sbin differ diff --git a/RomHeader/0E4A/libsyscall.a b/RomHeader/0E4A/libsyscall.a new file mode 100644 index 00000000..7b01b3a2 Binary files /dev/null and b/RomHeader/0E4A/libsyscall.a differ diff --git a/RomHeader/0E4A/libsyscall_c.bin b/RomHeader/0E4A/libsyscall_c.bin new file mode 100644 index 00000000..8c2507cb Binary files /dev/null and b/RomHeader/0E4A/libsyscall_c.bin differ diff --git a/RomHeader/0E4A/rom_header_0e4a.template.sbin b/RomHeader/0E4A/rom_header_0e4a.template.sbin new file mode 100644 index 00000000..e181ecf3 Binary files /dev/null and b/RomHeader/0E4A/rom_header_0e4a.template.sbin differ diff --git a/RomHeader/0E5A/libsyscall.a b/RomHeader/0E5A/libsyscall.a new file mode 100644 index 00000000..e22d47d9 Binary files /dev/null and b/RomHeader/0E5A/libsyscall.a differ diff --git a/RomHeader/0E5A/libsyscall_c.bin b/RomHeader/0E5A/libsyscall_c.bin new file mode 100644 index 00000000..bfd11447 Binary files /dev/null and b/RomHeader/0E5A/libsyscall_c.bin differ diff --git a/RomHeader/0E5A/rom_header_0e5a.template.sbin b/RomHeader/0E5A/rom_header_0e5a.template.sbin new file mode 100644 index 00000000..533686d9 Binary files /dev/null and b/RomHeader/0E5A/rom_header_0e5a.template.sbin differ diff --git a/RomHeader/0E6A/libsyscall.a b/RomHeader/0E6A/libsyscall.a new file mode 100644 index 00000000..fe3fbc9a Binary files /dev/null and b/RomHeader/0E6A/libsyscall.a differ diff --git a/RomHeader/0E6A/libsyscall_c.bin b/RomHeader/0E6A/libsyscall_c.bin new file mode 100644 index 00000000..27be48aa Binary files /dev/null and b/RomHeader/0E6A/libsyscall_c.bin differ diff --git a/RomHeader/0E6A/rom_header_0e6a.template.sbin b/RomHeader/0E6A/rom_header_0e6a.template.sbin new file mode 100644 index 00000000..f958f35e Binary files /dev/null and b/RomHeader/0E6A/rom_header_0e6a.template.sbin differ diff --git a/RomHeader/0E7A/libsyscall.a b/RomHeader/0E7A/libsyscall.a new file mode 100644 index 00000000..b2b46317 Binary files /dev/null and b/RomHeader/0E7A/libsyscall.a differ diff --git a/RomHeader/0E7A/libsyscall_c.bin b/RomHeader/0E7A/libsyscall_c.bin new file mode 100644 index 00000000..461c9c51 Binary files /dev/null and b/RomHeader/0E7A/libsyscall_c.bin differ diff --git a/RomHeader/0E7A/rom_header_0e7a.template.sbin b/RomHeader/0E7A/rom_header_0e7a.template.sbin new file mode 100644 index 00000000..aa499df0 Binary files /dev/null and b/RomHeader/0E7A/rom_header_0e7a.template.sbin differ diff --git a/RomHeader/0E8A/libsyscall.a b/RomHeader/0E8A/libsyscall.a new file mode 100644 index 00000000..4e023222 Binary files /dev/null and b/RomHeader/0E8A/libsyscall.a differ diff --git a/RomHeader/0E8A/libsyscall_c.bin b/RomHeader/0E8A/libsyscall_c.bin new file mode 100644 index 00000000..4951aec5 Binary files /dev/null and b/RomHeader/0E8A/libsyscall_c.bin differ diff --git a/RomHeader/0E8A/rom_header_0e8a.template.sbin b/RomHeader/0E8A/rom_header_0e8a.template.sbin new file mode 100644 index 00000000..ed8456b5 Binary files /dev/null and b/RomHeader/0E8A/rom_header_0e8a.template.sbin differ diff --git a/RomHeader/0E9A/libsyscall.a b/RomHeader/0E9A/libsyscall.a new file mode 100644 index 00000000..343dbcd7 Binary files /dev/null and b/RomHeader/0E9A/libsyscall.a differ diff --git a/RomHeader/0E9A/libsyscall_c.bin b/RomHeader/0E9A/libsyscall_c.bin new file mode 100644 index 00000000..04b0096d Binary files /dev/null and b/RomHeader/0E9A/libsyscall_c.bin differ diff --git a/RomHeader/0E9A/rom_header_0e9a.template.sbin b/RomHeader/0E9A/rom_header_0e9a.template.sbin new file mode 100644 index 00000000..a59e8160 Binary files /dev/null and b/RomHeader/0E9A/rom_header_0e9a.template.sbin differ diff --git a/RomHeader/0EAA/libsyscall.a b/RomHeader/0EAA/libsyscall.a new file mode 100644 index 00000000..1e9e9aab Binary files /dev/null and b/RomHeader/0EAA/libsyscall.a differ diff --git a/RomHeader/0EAA/libsyscall_c.bin b/RomHeader/0EAA/libsyscall_c.bin new file mode 100644 index 00000000..d0448b01 Binary files /dev/null and b/RomHeader/0EAA/libsyscall_c.bin differ diff --git a/RomHeader/0EAA/rom_header_0eaa.template.sbin b/RomHeader/0EAA/rom_header_0eaa.template.sbin new file mode 100644 index 00000000..55b3ddee Binary files /dev/null and b/RomHeader/0EAA/rom_header_0eaa.template.sbin differ diff --git a/RomHeader/0EBA/libsyscall.a b/RomHeader/0EBA/libsyscall.a new file mode 100644 index 00000000..4bf46170 Binary files /dev/null and b/RomHeader/0EBA/libsyscall.a differ diff --git a/RomHeader/0EBA/libsyscall_c.bin b/RomHeader/0EBA/libsyscall_c.bin new file mode 100644 index 00000000..6b97afac Binary files /dev/null and b/RomHeader/0EBA/libsyscall_c.bin differ diff --git a/RomHeader/0EBA/rom_header_0eba.template.sbin b/RomHeader/0EBA/rom_header_0eba.template.sbin new file mode 100644 index 00000000..2f44ba6c Binary files /dev/null and b/RomHeader/0EBA/rom_header_0eba.template.sbin differ diff --git a/RomHeader/0ECA/libsyscall.a b/RomHeader/0ECA/libsyscall.a new file mode 100644 index 00000000..647a0a95 Binary files /dev/null and b/RomHeader/0ECA/libsyscall.a differ diff --git a/RomHeader/0ECA/libsyscall_c.bin b/RomHeader/0ECA/libsyscall_c.bin new file mode 100644 index 00000000..1ee26603 Binary files /dev/null and b/RomHeader/0ECA/libsyscall_c.bin differ diff --git a/RomHeader/0ECA/rom_header_0eca.template.sbin b/RomHeader/0ECA/rom_header_0eca.template.sbin new file mode 100644 index 00000000..421c58ad Binary files /dev/null and b/RomHeader/0ECA/rom_header_0eca.template.sbin differ diff --git a/RomHeader/0EDA/libsyscall.a b/RomHeader/0EDA/libsyscall.a new file mode 100644 index 00000000..36c14adb Binary files /dev/null and b/RomHeader/0EDA/libsyscall.a differ diff --git a/RomHeader/0EDA/libsyscall_c.bin b/RomHeader/0EDA/libsyscall_c.bin new file mode 100644 index 00000000..bf077381 Binary files /dev/null and b/RomHeader/0EDA/libsyscall_c.bin differ diff --git a/RomHeader/0EDA/rom_header_0eda.template.sbin b/RomHeader/0EDA/rom_header_0eda.template.sbin new file mode 100644 index 00000000..d289105e Binary files /dev/null and b/RomHeader/0EDA/rom_header_0eda.template.sbin differ diff --git a/RomHeader/0EEA/libsyscall.a b/RomHeader/0EEA/libsyscall.a new file mode 100644 index 00000000..d63c7875 Binary files /dev/null and b/RomHeader/0EEA/libsyscall.a differ diff --git a/RomHeader/0EEA/libsyscall_c.bin b/RomHeader/0EEA/libsyscall_c.bin new file mode 100644 index 00000000..cd2ebbaa Binary files /dev/null and b/RomHeader/0EEA/libsyscall_c.bin differ diff --git a/RomHeader/0EEA/rom_header_0eea.template.sbin b/RomHeader/0EEA/rom_header_0eea.template.sbin new file mode 100644 index 00000000..94ecef9c Binary files /dev/null and b/RomHeader/0EEA/rom_header_0eea.template.sbin differ diff --git a/RomHeader/0EFA/libsyscall.a b/RomHeader/0EFA/libsyscall.a new file mode 100644 index 00000000..3fb021b4 Binary files /dev/null and b/RomHeader/0EFA/libsyscall.a differ diff --git a/RomHeader/0EFA/libsyscall_c.bin b/RomHeader/0EFA/libsyscall_c.bin new file mode 100644 index 00000000..dfe3410c Binary files /dev/null and b/RomHeader/0EFA/libsyscall_c.bin differ diff --git a/RomHeader/0EFA/rom_header_0efa.template.sbin b/RomHeader/0EFA/rom_header_0efa.template.sbin new file mode 100644 index 00000000..4d28b5ab Binary files /dev/null and b/RomHeader/0EFA/rom_header_0efa.template.sbin differ diff --git a/RomHeader/0EGA/libsyscall.a b/RomHeader/0EGA/libsyscall.a new file mode 100644 index 00000000..e7133ae5 Binary files /dev/null and b/RomHeader/0EGA/libsyscall.a differ diff --git a/RomHeader/0EGA/libsyscall_c.bin b/RomHeader/0EGA/libsyscall_c.bin new file mode 100644 index 00000000..79655e22 Binary files /dev/null and b/RomHeader/0EGA/libsyscall_c.bin differ diff --git a/RomHeader/0EGA/rom_header_0ega.template.sbin b/RomHeader/0EGA/rom_header_0ega.template.sbin new file mode 100644 index 00000000..27459aa8 Binary files /dev/null and b/RomHeader/0EGA/rom_header_0ega.template.sbin differ diff --git a/RomHeader/0EHA/libsyscall.a b/RomHeader/0EHA/libsyscall.a new file mode 100644 index 00000000..bae8468e Binary files /dev/null and b/RomHeader/0EHA/libsyscall.a differ diff --git a/RomHeader/0EHA/libsyscall_c.bin b/RomHeader/0EHA/libsyscall_c.bin new file mode 100644 index 00000000..c4ff3711 Binary files /dev/null and b/RomHeader/0EHA/libsyscall_c.bin differ diff --git a/RomHeader/0EHA/rom_header_0eha.template.sbin b/RomHeader/0EHA/rom_header_0eha.template.sbin new file mode 100644 index 00000000..d88ffd5a Binary files /dev/null and b/RomHeader/0EHA/rom_header_0eha.template.sbin differ diff --git a/RomHeader/0EIA/libsyscall.a b/RomHeader/0EIA/libsyscall.a new file mode 100644 index 00000000..4f67d73d Binary files /dev/null and b/RomHeader/0EIA/libsyscall.a differ diff --git a/RomHeader/0EIA/libsyscall_c.bin b/RomHeader/0EIA/libsyscall_c.bin new file mode 100644 index 00000000..fe4d2e22 Binary files /dev/null and b/RomHeader/0EIA/libsyscall_c.bin differ diff --git a/RomHeader/0EIA/rom_header_0eia.template.sbin b/RomHeader/0EIA/rom_header_0eia.template.sbin new file mode 100644 index 00000000..147cdc07 Binary files /dev/null and b/RomHeader/0EIA/rom_header_0eia.template.sbin differ diff --git a/RomHeader/0EJA/libsyscall.a b/RomHeader/0EJA/libsyscall.a new file mode 100644 index 00000000..4fb0b5e5 Binary files /dev/null and b/RomHeader/0EJA/libsyscall.a differ diff --git a/RomHeader/0EJA/libsyscall_c.bin b/RomHeader/0EJA/libsyscall_c.bin new file mode 100644 index 00000000..2b01d3fc Binary files /dev/null and b/RomHeader/0EJA/libsyscall_c.bin differ diff --git a/RomHeader/0EJA/rom_header_0eja.template.sbin b/RomHeader/0EJA/rom_header_0eja.template.sbin new file mode 100644 index 00000000..43846f05 Binary files /dev/null and b/RomHeader/0EJA/rom_header_0eja.template.sbin differ diff --git a/RomHeader/0EKA/libsyscall.a b/RomHeader/0EKA/libsyscall.a new file mode 100644 index 00000000..0ce03d03 Binary files /dev/null and b/RomHeader/0EKA/libsyscall.a differ diff --git a/RomHeader/0EKA/libsyscall_c.bin b/RomHeader/0EKA/libsyscall_c.bin new file mode 100644 index 00000000..bc455d50 Binary files /dev/null and b/RomHeader/0EKA/libsyscall_c.bin differ diff --git a/RomHeader/0EKA/rom_header_0eka.template.sbin b/RomHeader/0EKA/rom_header_0eka.template.sbin new file mode 100644 index 00000000..ec88c121 Binary files /dev/null and b/RomHeader/0EKA/rom_header_0eka.template.sbin differ diff --git a/RomHeader/0ELA/libsyscall.a b/RomHeader/0ELA/libsyscall.a new file mode 100644 index 00000000..bceab2f8 Binary files /dev/null and b/RomHeader/0ELA/libsyscall.a differ diff --git a/RomHeader/0ELA/libsyscall_c.bin b/RomHeader/0ELA/libsyscall_c.bin new file mode 100644 index 00000000..b1684977 Binary files /dev/null and b/RomHeader/0ELA/libsyscall_c.bin differ diff --git a/RomHeader/0ELA/rom_header_0ela.template.sbin b/RomHeader/0ELA/rom_header_0ela.template.sbin new file mode 100644 index 00000000..e223e8a5 Binary files /dev/null and b/RomHeader/0ELA/rom_header_0ela.template.sbin differ diff --git a/RomHeader/0EMA/libsyscall.a b/RomHeader/0EMA/libsyscall.a new file mode 100644 index 00000000..46ec4323 Binary files /dev/null and b/RomHeader/0EMA/libsyscall.a differ diff --git a/RomHeader/0EMA/libsyscall_c.bin b/RomHeader/0EMA/libsyscall_c.bin new file mode 100644 index 00000000..8f24b864 Binary files /dev/null and b/RomHeader/0EMA/libsyscall_c.bin differ diff --git a/RomHeader/0EMA/rom_header_0ema.template.sbin b/RomHeader/0EMA/rom_header_0ema.template.sbin new file mode 100644 index 00000000..f31c77e6 Binary files /dev/null and b/RomHeader/0EMA/rom_header_0ema.template.sbin differ diff --git a/RomHeader/0ENA/libsyscall.a b/RomHeader/0ENA/libsyscall.a new file mode 100644 index 00000000..f3b9e8f3 Binary files /dev/null and b/RomHeader/0ENA/libsyscall.a differ diff --git a/RomHeader/0ENA/libsyscall_c.bin b/RomHeader/0ENA/libsyscall_c.bin new file mode 100644 index 00000000..37de5ab0 Binary files /dev/null and b/RomHeader/0ENA/libsyscall_c.bin differ diff --git a/RomHeader/0ENA/rom_header_0ena.template.sbin b/RomHeader/0ENA/rom_header_0ena.template.sbin new file mode 100644 index 00000000..b24d2c99 Binary files /dev/null and b/RomHeader/0ENA/rom_header_0ena.template.sbin differ diff --git a/RomHeader/0EOA/libsyscall.a b/RomHeader/0EOA/libsyscall.a new file mode 100644 index 00000000..395a4457 Binary files /dev/null and b/RomHeader/0EOA/libsyscall.a differ diff --git a/RomHeader/0EOA/libsyscall_c.bin b/RomHeader/0EOA/libsyscall_c.bin new file mode 100644 index 00000000..513f020e Binary files /dev/null and b/RomHeader/0EOA/libsyscall_c.bin differ diff --git a/RomHeader/0EOA/rom_header_0eoa.template.sbin b/RomHeader/0EOA/rom_header_0eoa.template.sbin new file mode 100644 index 00000000..8ef7df07 Binary files /dev/null and b/RomHeader/0EOA/rom_header_0eoa.template.sbin differ diff --git a/RomHeader/0EPA/libsyscall.a b/RomHeader/0EPA/libsyscall.a new file mode 100644 index 00000000..4ee5726f Binary files /dev/null and b/RomHeader/0EPA/libsyscall.a differ diff --git a/RomHeader/0EPA/libsyscall_c.bin b/RomHeader/0EPA/libsyscall_c.bin new file mode 100644 index 00000000..26019e37 Binary files /dev/null and b/RomHeader/0EPA/libsyscall_c.bin differ diff --git a/RomHeader/0EPA/rom_header_0epa.template.sbin b/RomHeader/0EPA/rom_header_0epa.template.sbin new file mode 100644 index 00000000..3e497df2 Binary files /dev/null and b/RomHeader/0EPA/rom_header_0epa.template.sbin differ diff --git a/RomHeader/0EQA/libsyscall.a b/RomHeader/0EQA/libsyscall.a new file mode 100644 index 00000000..2892d9cb Binary files /dev/null and b/RomHeader/0EQA/libsyscall.a differ diff --git a/RomHeader/0EQA/libsyscall_c.bin b/RomHeader/0EQA/libsyscall_c.bin new file mode 100644 index 00000000..6cb7b70f Binary files /dev/null and b/RomHeader/0EQA/libsyscall_c.bin differ diff --git a/RomHeader/0EQA/rom_header_0eqa.template.sbin b/RomHeader/0EQA/rom_header_0eqa.template.sbin new file mode 100644 index 00000000..1491ee9e Binary files /dev/null and b/RomHeader/0EQA/rom_header_0eqa.template.sbin differ diff --git a/RomHeader/0ERA/libsyscall.a b/RomHeader/0ERA/libsyscall.a new file mode 100644 index 00000000..52522611 Binary files /dev/null and b/RomHeader/0ERA/libsyscall.a differ diff --git a/RomHeader/0ERA/libsyscall_c.bin b/RomHeader/0ERA/libsyscall_c.bin new file mode 100644 index 00000000..26cc7aa6 Binary files /dev/null and b/RomHeader/0ERA/libsyscall_c.bin differ diff --git a/RomHeader/0ERA/rom_header_0era.template.sbin b/RomHeader/0ERA/rom_header_0era.template.sbin new file mode 100644 index 00000000..3d8220df Binary files /dev/null and b/RomHeader/0ERA/rom_header_0era.template.sbin differ diff --git a/RomHeader/0ESA/libsyscall.a b/RomHeader/0ESA/libsyscall.a new file mode 100644 index 00000000..810f4d7c Binary files /dev/null and b/RomHeader/0ESA/libsyscall.a differ diff --git a/RomHeader/0ESA/libsyscall_c.bin b/RomHeader/0ESA/libsyscall_c.bin new file mode 100644 index 00000000..c763a7e0 Binary files /dev/null and b/RomHeader/0ESA/libsyscall_c.bin differ diff --git a/RomHeader/0ESA/rom_header_0esa.template.sbin b/RomHeader/0ESA/rom_header_0esa.template.sbin new file mode 100644 index 00000000..a809b721 Binary files /dev/null and b/RomHeader/0ESA/rom_header_0esa.template.sbin differ diff --git a/RomHeader/0ETA/libsyscall.a b/RomHeader/0ETA/libsyscall.a new file mode 100644 index 00000000..987e837c Binary files /dev/null and b/RomHeader/0ETA/libsyscall.a differ diff --git a/RomHeader/0ETA/libsyscall_c.bin b/RomHeader/0ETA/libsyscall_c.bin new file mode 100644 index 00000000..446e7d4e Binary files /dev/null and b/RomHeader/0ETA/libsyscall_c.bin differ diff --git a/RomHeader/0ETA/rom_header_0eta.template.sbin b/RomHeader/0ETA/rom_header_0eta.template.sbin new file mode 100644 index 00000000..087078a9 Binary files /dev/null and b/RomHeader/0ETA/rom_header_0eta.template.sbin differ diff --git a/RomHeader/0EUA/libsyscall.a b/RomHeader/0EUA/libsyscall.a new file mode 100644 index 00000000..d813b8de Binary files /dev/null and b/RomHeader/0EUA/libsyscall.a differ diff --git a/RomHeader/0EUA/libsyscall_c.bin b/RomHeader/0EUA/libsyscall_c.bin new file mode 100644 index 00000000..6f17c96c Binary files /dev/null and b/RomHeader/0EUA/libsyscall_c.bin differ diff --git a/RomHeader/0EUA/rom_header_0eua.template.sbin b/RomHeader/0EUA/rom_header_0eua.template.sbin new file mode 100644 index 00000000..420dcc4f Binary files /dev/null and b/RomHeader/0EUA/rom_header_0eua.template.sbin differ diff --git a/RomHeader/0EVA/libsyscall.a b/RomHeader/0EVA/libsyscall.a new file mode 100644 index 00000000..c0cbb464 Binary files /dev/null and b/RomHeader/0EVA/libsyscall.a differ diff --git a/RomHeader/0EVA/libsyscall_c.bin b/RomHeader/0EVA/libsyscall_c.bin new file mode 100644 index 00000000..d93dea2b Binary files /dev/null and b/RomHeader/0EVA/libsyscall_c.bin differ diff --git a/RomHeader/0EVA/rom_header_0eva.template.sbin b/RomHeader/0EVA/rom_header_0eva.template.sbin new file mode 100644 index 00000000..b7e2da6b Binary files /dev/null and b/RomHeader/0EVA/rom_header_0eva.template.sbin differ diff --git a/RomHeader/0EWA/libsyscall.a b/RomHeader/0EWA/libsyscall.a new file mode 100644 index 00000000..f79c5c8d Binary files /dev/null and b/RomHeader/0EWA/libsyscall.a differ diff --git a/RomHeader/0EWA/libsyscall_c.bin b/RomHeader/0EWA/libsyscall_c.bin new file mode 100644 index 00000000..949a17d7 Binary files /dev/null and b/RomHeader/0EWA/libsyscall_c.bin differ diff --git a/RomHeader/0EWA/rom_header_0ewa.template.sbin b/RomHeader/0EWA/rom_header_0ewa.template.sbin new file mode 100644 index 00000000..87bf9326 Binary files /dev/null and b/RomHeader/0EWA/rom_header_0ewa.template.sbin differ diff --git a/RomHeader/0F0A/libsyscall.a b/RomHeader/0F0A/libsyscall.a new file mode 100644 index 00000000..80f1cd6a Binary files /dev/null and b/RomHeader/0F0A/libsyscall.a differ diff --git a/RomHeader/0F0A/rom_header_0f0a.template.sbin b/RomHeader/0F0A/rom_header_0f0a.template.sbin new file mode 100644 index 00000000..d8f48581 Binary files /dev/null and b/RomHeader/0F0A/rom_header_0f0a.template.sbin differ diff --git a/RomHeader/0F1A/libsyscall.a b/RomHeader/0F1A/libsyscall.a new file mode 100644 index 00000000..e18fb6e2 Binary files /dev/null and b/RomHeader/0F1A/libsyscall.a differ diff --git a/RomHeader/0F1A/rom_header_0f1a.template.sbin b/RomHeader/0F1A/rom_header_0f1a.template.sbin new file mode 100644 index 00000000..ccf724a4 Binary files /dev/null and b/RomHeader/0F1A/rom_header_0f1a.template.sbin differ diff --git a/RomHeader/0F2A/libsyscall.a b/RomHeader/0F2A/libsyscall.a new file mode 100644 index 00000000..a78273ad Binary files /dev/null and b/RomHeader/0F2A/libsyscall.a differ diff --git a/RomHeader/0F2A/rom_header_0f2a.template.sbin b/RomHeader/0F2A/rom_header_0f2a.template.sbin new file mode 100644 index 00000000..a8ae581f Binary files /dev/null and b/RomHeader/0F2A/rom_header_0f2a.template.sbin differ diff --git a/RomHeader/0F3A/libsyscall.a b/RomHeader/0F3A/libsyscall.a new file mode 100644 index 00000000..55ba233b Binary files /dev/null and b/RomHeader/0F3A/libsyscall.a differ diff --git a/RomHeader/0F3A/rom_header_0f3a.template.sbin b/RomHeader/0F3A/rom_header_0f3a.template.sbin new file mode 100644 index 00000000..0d0ac6e9 Binary files /dev/null and b/RomHeader/0F3A/rom_header_0f3a.template.sbin differ diff --git a/RomHeader/0F4A/libsyscall.a b/RomHeader/0F4A/libsyscall.a new file mode 100644 index 00000000..22c5ccef Binary files /dev/null and b/RomHeader/0F4A/libsyscall.a differ diff --git a/RomHeader/0F4A/rom_header_0f4a.template.sbin b/RomHeader/0F4A/rom_header_0f4a.template.sbin new file mode 100644 index 00000000..ce37dc09 Binary files /dev/null and b/RomHeader/0F4A/rom_header_0f4a.template.sbin differ diff --git a/RomHeader/0F5A/libsyscall.a b/RomHeader/0F5A/libsyscall.a new file mode 100644 index 00000000..552eb718 Binary files /dev/null and b/RomHeader/0F5A/libsyscall.a differ diff --git a/RomHeader/0F5A/rom_header_0f5a.template.sbin b/RomHeader/0F5A/rom_header_0f5a.template.sbin new file mode 100644 index 00000000..ee72bb91 Binary files /dev/null and b/RomHeader/0F5A/rom_header_0f5a.template.sbin differ diff --git a/RomHeader/0F6A/libsyscall.a b/RomHeader/0F6A/libsyscall.a new file mode 100644 index 00000000..cbb901da Binary files /dev/null and b/RomHeader/0F6A/libsyscall.a differ diff --git a/RomHeader/0F6A/rom_header_0f6a.template.sbin b/RomHeader/0F6A/rom_header_0f6a.template.sbin new file mode 100644 index 00000000..ffbe3906 Binary files /dev/null and b/RomHeader/0F6A/rom_header_0f6a.template.sbin differ diff --git a/RomHeader/0F7A/libsyscall.a b/RomHeader/0F7A/libsyscall.a new file mode 100644 index 00000000..459cae4c Binary files /dev/null and b/RomHeader/0F7A/libsyscall.a differ diff --git a/RomHeader/0F7A/rom_header_0f7a.template.sbin b/RomHeader/0F7A/rom_header_0f7a.template.sbin new file mode 100644 index 00000000..4698cccb Binary files /dev/null and b/RomHeader/0F7A/rom_header_0f7a.template.sbin differ diff --git a/RomHeader/0F8A/libsyscall.a b/RomHeader/0F8A/libsyscall.a new file mode 100644 index 00000000..dea8efa5 Binary files /dev/null and b/RomHeader/0F8A/libsyscall.a differ diff --git a/RomHeader/0F8A/rom_header_0f8a.template.sbin b/RomHeader/0F8A/rom_header_0f8a.template.sbin new file mode 100644 index 00000000..2770775d Binary files /dev/null and b/RomHeader/0F8A/rom_header_0f8a.template.sbin differ diff --git a/RomHeader/0F9A/libsyscall.a b/RomHeader/0F9A/libsyscall.a new file mode 100644 index 00000000..6f695c28 Binary files /dev/null and b/RomHeader/0F9A/libsyscall.a differ diff --git a/RomHeader/0F9A/rom_header_0f9a.template.sbin b/RomHeader/0F9A/rom_header_0f9a.template.sbin new file mode 100644 index 00000000..f19ef3a7 Binary files /dev/null and b/RomHeader/0F9A/rom_header_0f9a.template.sbin differ diff --git a/RomHeader/0FAA/libsyscall.a b/RomHeader/0FAA/libsyscall.a new file mode 100644 index 00000000..3e9e07d4 Binary files /dev/null and b/RomHeader/0FAA/libsyscall.a differ diff --git a/RomHeader/0FAA/rom_header_0faa.template.sbin b/RomHeader/0FAA/rom_header_0faa.template.sbin new file mode 100644 index 00000000..92555e53 Binary files /dev/null and b/RomHeader/0FAA/rom_header_0faa.template.sbin differ diff --git a/RomHeader/0FBA/libsyscall.a b/RomHeader/0FBA/libsyscall.a new file mode 100644 index 00000000..f0e13768 Binary files /dev/null and b/RomHeader/0FBA/libsyscall.a differ diff --git a/RomHeader/0FBA/rom_header_0fba.template.sbin b/RomHeader/0FBA/rom_header_0fba.template.sbin new file mode 100644 index 00000000..de0a8c5f Binary files /dev/null and b/RomHeader/0FBA/rom_header_0fba.template.sbin differ diff --git a/RomHeader/0FCA/libsyscall.a b/RomHeader/0FCA/libsyscall.a new file mode 100644 index 00000000..5a0b0369 Binary files /dev/null and b/RomHeader/0FCA/libsyscall.a differ diff --git a/RomHeader/0FCA/rom_header_0fca.template.sbin b/RomHeader/0FCA/rom_header_0fca.template.sbin new file mode 100644 index 00000000..8d91fdbf Binary files /dev/null and b/RomHeader/0FCA/rom_header_0fca.template.sbin differ diff --git a/RomHeader/0FDA/libsyscall.a b/RomHeader/0FDA/libsyscall.a new file mode 100644 index 00000000..a1194d4f Binary files /dev/null and b/RomHeader/0FDA/libsyscall.a differ diff --git a/RomHeader/0FDA/rom_header_0fda.template.sbin b/RomHeader/0FDA/rom_header_0fda.template.sbin new file mode 100644 index 00000000..1a68c0be Binary files /dev/null and b/RomHeader/0FDA/rom_header_0fda.template.sbin differ diff --git a/RomHeader/0FEA/libsyscall.a b/RomHeader/0FEA/libsyscall.a new file mode 100644 index 00000000..d7579e50 Binary files /dev/null and b/RomHeader/0FEA/libsyscall.a differ diff --git a/RomHeader/0FEA/rom_header_0fea.template.sbin b/RomHeader/0FEA/rom_header_0fea.template.sbin new file mode 100644 index 00000000..5ea8a441 Binary files /dev/null and b/RomHeader/0FEA/rom_header_0fea.template.sbin differ diff --git a/RomHeader/0G0A/libsyscall.a b/RomHeader/0G0A/libsyscall.a new file mode 100644 index 00000000..539c6fde Binary files /dev/null and b/RomHeader/0G0A/libsyscall.a differ diff --git a/RomHeader/0G0A/libsyscall_c.bin b/RomHeader/0G0A/libsyscall_c.bin new file mode 100644 index 00000000..d11037f8 Binary files /dev/null and b/RomHeader/0G0A/libsyscall_c.bin differ diff --git a/RomHeader/0G0A/rom_header_0g0a.template.sbin b/RomHeader/0G0A/rom_header_0g0a.template.sbin new file mode 100644 index 00000000..cd83bf1c Binary files /dev/null and b/RomHeader/0G0A/rom_header_0g0a.template.sbin differ diff --git a/RomHeader/0G1A/libsyscall.a b/RomHeader/0G1A/libsyscall.a new file mode 100644 index 00000000..48781206 Binary files /dev/null and b/RomHeader/0G1A/libsyscall.a differ diff --git a/RomHeader/0G1A/libsyscall_c.bin b/RomHeader/0G1A/libsyscall_c.bin new file mode 100644 index 00000000..401fd1d4 Binary files /dev/null and b/RomHeader/0G1A/libsyscall_c.bin differ diff --git a/RomHeader/0G1A/rom_header_0g1a.template.sbin b/RomHeader/0G1A/rom_header_0g1a.template.sbin new file mode 100644 index 00000000..cadf61a5 Binary files /dev/null and b/RomHeader/0G1A/rom_header_0g1a.template.sbin differ diff --git a/RomHeader/0G2A/libsyscall.a b/RomHeader/0G2A/libsyscall.a new file mode 100644 index 00000000..8694aa5f Binary files /dev/null and b/RomHeader/0G2A/libsyscall.a differ diff --git a/RomHeader/0G2A/libsyscall_c.bin b/RomHeader/0G2A/libsyscall_c.bin new file mode 100644 index 00000000..6bb11721 Binary files /dev/null and b/RomHeader/0G2A/libsyscall_c.bin differ diff --git a/RomHeader/0G2A/rom_header_0g2a.template.sbin b/RomHeader/0G2A/rom_header_0g2a.template.sbin new file mode 100644 index 00000000..66fab243 Binary files /dev/null and b/RomHeader/0G2A/rom_header_0g2a.template.sbin differ diff --git a/RomHeader/0G3A/libsyscall.a b/RomHeader/0G3A/libsyscall.a new file mode 100644 index 00000000..ef9ae7ae Binary files /dev/null and b/RomHeader/0G3A/libsyscall.a differ diff --git a/RomHeader/0G3A/libsyscall_c.bin b/RomHeader/0G3A/libsyscall_c.bin new file mode 100644 index 00000000..b3c41e28 Binary files /dev/null and b/RomHeader/0G3A/libsyscall_c.bin differ diff --git a/RomHeader/0G3A/rom_header_0g3a.template.sbin b/RomHeader/0G3A/rom_header_0g3a.template.sbin new file mode 100644 index 00000000..c7676083 Binary files /dev/null and b/RomHeader/0G3A/rom_header_0g3a.template.sbin differ diff --git a/RomHeader/0G4A/libsyscall.a b/RomHeader/0G4A/libsyscall.a new file mode 100644 index 00000000..e3da4408 Binary files /dev/null and b/RomHeader/0G4A/libsyscall.a differ diff --git a/RomHeader/0G4A/libsyscall_c.bin b/RomHeader/0G4A/libsyscall_c.bin new file mode 100644 index 00000000..bb57d1b5 Binary files /dev/null and b/RomHeader/0G4A/libsyscall_c.bin differ diff --git a/RomHeader/0G4A/rom_header_0g4a.template.sbin b/RomHeader/0G4A/rom_header_0g4a.template.sbin new file mode 100644 index 00000000..8abbf1f2 Binary files /dev/null and b/RomHeader/0G4A/rom_header_0g4a.template.sbin differ diff --git a/RomHeader/0G5A/libsyscall.a b/RomHeader/0G5A/libsyscall.a new file mode 100644 index 00000000..46b1a46b Binary files /dev/null and b/RomHeader/0G5A/libsyscall.a differ diff --git a/RomHeader/0G5A/libsyscall_c.bin b/RomHeader/0G5A/libsyscall_c.bin new file mode 100644 index 00000000..9880bcdf Binary files /dev/null and b/RomHeader/0G5A/libsyscall_c.bin differ diff --git a/RomHeader/0G5A/rom_header_0g5a.template.sbin b/RomHeader/0G5A/rom_header_0g5a.template.sbin new file mode 100644 index 00000000..d884ac7c Binary files /dev/null and b/RomHeader/0G5A/rom_header_0g5a.template.sbin differ diff --git a/RomHeader/0GZA/libsyscall.a b/RomHeader/0GZA/libsyscall.a new file mode 100644 index 00000000..512dfaee Binary files /dev/null and b/RomHeader/0GZA/libsyscall.a differ diff --git a/RomHeader/0GZA/libsyscall_c.bin b/RomHeader/0GZA/libsyscall_c.bin new file mode 100644 index 00000000..a21cd717 Binary files /dev/null and b/RomHeader/0GZA/libsyscall_c.bin differ diff --git a/RomHeader/0GZA/rom_header_0gza.template.sbin b/RomHeader/0GZA/rom_header_0gza.template.sbin new file mode 100644 index 00000000..06d5e93e Binary files /dev/null and b/RomHeader/0GZA/rom_header_0gza.template.sbin differ diff --git a/RomHeader/0H0A/libsyscall.a b/RomHeader/0H0A/libsyscall.a new file mode 100644 index 00000000..7b6d2de8 Binary files /dev/null and b/RomHeader/0H0A/libsyscall.a differ diff --git a/RomHeader/0H0A/libsyscall_c.bin b/RomHeader/0H0A/libsyscall_c.bin new file mode 100644 index 00000000..4481331c Binary files /dev/null and b/RomHeader/0H0A/libsyscall_c.bin differ diff --git a/RomHeader/0H0A/rom_header_0h0a.template.sbin b/RomHeader/0H0A/rom_header_0h0a.template.sbin new file mode 100644 index 00000000..1b2b7e2c Binary files /dev/null and b/RomHeader/0H0A/rom_header_0h0a.template.sbin differ diff --git a/RomHeader/0H1A/libsyscall.a b/RomHeader/0H1A/libsyscall.a new file mode 100644 index 00000000..00937650 Binary files /dev/null and b/RomHeader/0H1A/libsyscall.a differ diff --git a/RomHeader/0H1A/libsyscall_c.bin b/RomHeader/0H1A/libsyscall_c.bin new file mode 100644 index 00000000..24a1c0a7 Binary files /dev/null and b/RomHeader/0H1A/libsyscall_c.bin differ diff --git a/RomHeader/0H1A/rom_header_0h1a.template.sbin b/RomHeader/0H1A/rom_header_0h1a.template.sbin new file mode 100644 index 00000000..e60327c1 Binary files /dev/null and b/RomHeader/0H1A/rom_header_0h1a.template.sbin differ diff --git a/RomHeader/0H2A/libsyscall.a b/RomHeader/0H2A/libsyscall.a new file mode 100644 index 00000000..ea94979f Binary files /dev/null and b/RomHeader/0H2A/libsyscall.a differ diff --git a/RomHeader/0H2A/libsyscall_c.bin b/RomHeader/0H2A/libsyscall_c.bin new file mode 100644 index 00000000..58525c7c Binary files /dev/null and b/RomHeader/0H2A/libsyscall_c.bin differ diff --git a/RomHeader/0H2A/rom_header_0h2a.template.sbin b/RomHeader/0H2A/rom_header_0h2a.template.sbin new file mode 100644 index 00000000..3df12926 Binary files /dev/null and b/RomHeader/0H2A/rom_header_0h2a.template.sbin differ diff --git a/RomHeader/0H3A/libsyscall.a b/RomHeader/0H3A/libsyscall.a new file mode 100644 index 00000000..6248f7db Binary files /dev/null and b/RomHeader/0H3A/libsyscall.a differ diff --git a/RomHeader/0H3A/libsyscall_c.bin b/RomHeader/0H3A/libsyscall_c.bin new file mode 100644 index 00000000..7ee47418 Binary files /dev/null and b/RomHeader/0H3A/libsyscall_c.bin differ diff --git a/RomHeader/0H3A/rom_header_0h3a.template.sbin b/RomHeader/0H3A/rom_header_0h3a.template.sbin new file mode 100644 index 00000000..35fda5e2 Binary files /dev/null and b/RomHeader/0H3A/rom_header_0h3a.template.sbin differ diff --git a/RomHeader/0H4A/libsyscall.a b/RomHeader/0H4A/libsyscall.a new file mode 100644 index 00000000..d565c32b Binary files /dev/null and b/RomHeader/0H4A/libsyscall.a differ diff --git a/RomHeader/0H4A/libsyscall_c.bin b/RomHeader/0H4A/libsyscall_c.bin new file mode 100644 index 00000000..4a5e4cff Binary files /dev/null and b/RomHeader/0H4A/libsyscall_c.bin differ diff --git a/RomHeader/0H4A/rom_header_0h4a.template.sbin b/RomHeader/0H4A/rom_header_0h4a.template.sbin new file mode 100644 index 00000000..70de8bf9 Binary files /dev/null and b/RomHeader/0H4A/rom_header_0h4a.template.sbin differ diff --git a/RomHeader/0H5A/libsyscall.a b/RomHeader/0H5A/libsyscall.a new file mode 100644 index 00000000..5c31632a Binary files /dev/null and b/RomHeader/0H5A/libsyscall.a differ diff --git a/RomHeader/0H5A/libsyscall_c.bin b/RomHeader/0H5A/libsyscall_c.bin new file mode 100644 index 00000000..32e53a6b Binary files /dev/null and b/RomHeader/0H5A/libsyscall_c.bin differ diff --git a/RomHeader/0H5A/rom_header_0h5a.template.sbin b/RomHeader/0H5A/rom_header_0h5a.template.sbin new file mode 100644 index 00000000..077754d1 Binary files /dev/null and b/RomHeader/0H5A/rom_header_0h5a.template.sbin differ diff --git a/RomHeader/0J0A/libsyscall.a b/RomHeader/0J0A/libsyscall.a new file mode 100644 index 00000000..739b7beb Binary files /dev/null and b/RomHeader/0J0A/libsyscall.a differ diff --git a/RomHeader/0J0A/rom_header_0j0a.template.sbin b/RomHeader/0J0A/rom_header_0j0a.template.sbin new file mode 100644 index 00000000..d15eb90a Binary files /dev/null and b/RomHeader/0J0A/rom_header_0j0a.template.sbin differ diff --git a/RomHeader/HNBA/libsyscall.a b/RomHeader/HNBA/libsyscall.a new file mode 100644 index 00000000..da69b392 Binary files /dev/null and b/RomHeader/HNBA/libsyscall.a differ diff --git a/RomHeader/HNBA/libsyscall_c.bin b/RomHeader/HNBA/libsyscall_c.bin new file mode 100644 index 00000000..ecc32ba9 Binary files /dev/null and b/RomHeader/HNBA/libsyscall_c.bin differ diff --git a/RomHeader/HNBA/rom_header_hnba.template.sbin b/RomHeader/HNBA/rom_header_hnba.template.sbin new file mode 100644 index 00000000..26583f33 Binary files /dev/null and b/RomHeader/HNBA/rom_header_hnba.template.sbin differ diff --git a/RomHeader/HNBE/libsyscall.a b/RomHeader/HNBE/libsyscall.a new file mode 100644 index 00000000..e2c082bc Binary files /dev/null and b/RomHeader/HNBE/libsyscall.a differ diff --git a/RomHeader/HNBE/libsyscall_c.bin b/RomHeader/HNBE/libsyscall_c.bin new file mode 100644 index 00000000..de115d12 Binary files /dev/null and b/RomHeader/HNBE/libsyscall_c.bin differ diff --git a/RomHeader/HNBE/rom_header_hnbe.template.sbin b/RomHeader/HNBE/rom_header_hnbe.template.sbin new file mode 100644 index 00000000..4337f404 Binary files /dev/null and b/RomHeader/HNBE/rom_header_hnbe.template.sbin differ diff --git a/RomHeader/HNBJ/libsyscall.a b/RomHeader/HNBJ/libsyscall.a new file mode 100644 index 00000000..85ff654b Binary files /dev/null and b/RomHeader/HNBJ/libsyscall.a differ diff --git a/RomHeader/HNBJ/libsyscall_c.bin b/RomHeader/HNBJ/libsyscall_c.bin new file mode 100644 index 00000000..535b3b36 Binary files /dev/null and b/RomHeader/HNBJ/libsyscall_c.bin differ diff --git a/RomHeader/HNBJ/rom_header_hnbj.template.sbin b/RomHeader/HNBJ/rom_header_hnbj.template.sbin new file mode 100644 index 00000000..17ac93bf Binary files /dev/null and b/RomHeader/HNBJ/rom_header_hnbj.template.sbin differ diff --git a/RomHeader/HNBP/libsyscall.a b/RomHeader/HNBP/libsyscall.a new file mode 100644 index 00000000..51dbd145 Binary files /dev/null and b/RomHeader/HNBP/libsyscall.a differ diff --git a/RomHeader/HNBP/libsyscall_c.bin b/RomHeader/HNBP/libsyscall_c.bin new file mode 100644 index 00000000..93b9ce7a Binary files /dev/null and b/RomHeader/HNBP/libsyscall_c.bin differ diff --git a/RomHeader/HNBP/rom_header_hnbp.template.sbin b/RomHeader/HNBP/rom_header_hnbp.template.sbin new file mode 100644 index 00000000..b089ba83 Binary files /dev/null and b/RomHeader/HNBP/rom_header_hnbp.template.sbin differ diff --git a/RomHeader/HNBU/libsyscall.a b/RomHeader/HNBU/libsyscall.a new file mode 100644 index 00000000..01ce21da Binary files /dev/null and b/RomHeader/HNBU/libsyscall.a differ diff --git a/RomHeader/HNBU/libsyscall_c.bin b/RomHeader/HNBU/libsyscall_c.bin new file mode 100644 index 00000000..67b6e6ae Binary files /dev/null and b/RomHeader/HNBU/libsyscall_c.bin differ diff --git a/RomHeader/HNBU/rom_header_hnbu.template.sbin b/RomHeader/HNBU/rom_header_hnbu.template.sbin new file mode 100644 index 00000000..6093b7bd Binary files /dev/null and b/RomHeader/HNBU/rom_header_hnbu.template.sbin differ diff --git a/RomHeader/HNDA/libsyscall.a b/RomHeader/HNDA/libsyscall.a new file mode 100644 index 00000000..49bcfa7f Binary files /dev/null and b/RomHeader/HNDA/libsyscall.a differ diff --git a/RomHeader/HNDA/libsyscall_c.bin b/RomHeader/HNDA/libsyscall_c.bin new file mode 100644 index 00000000..c18b7159 Binary files /dev/null and b/RomHeader/HNDA/libsyscall_c.bin differ diff --git a/RomHeader/HNDA/rom_header_hnda.template.sbin b/RomHeader/HNDA/rom_header_hnda.template.sbin new file mode 100644 index 00000000..527f03a4 Binary files /dev/null and b/RomHeader/HNDA/rom_header_hnda.template.sbin differ diff --git a/RomHeader/HNDE/libsyscall.a b/RomHeader/HNDE/libsyscall.a new file mode 100644 index 00000000..c7839174 Binary files /dev/null and b/RomHeader/HNDE/libsyscall.a differ diff --git a/RomHeader/HNDE/libsyscall_c.bin b/RomHeader/HNDE/libsyscall_c.bin new file mode 100644 index 00000000..411238b1 Binary files /dev/null and b/RomHeader/HNDE/libsyscall_c.bin differ diff --git a/RomHeader/HNDE/rom_header_hnde.template.sbin b/RomHeader/HNDE/rom_header_hnde.template.sbin new file mode 100644 index 00000000..b6f4217f Binary files /dev/null and b/RomHeader/HNDE/rom_header_hnde.template.sbin differ diff --git a/RomHeader/HNDJ/libsyscall.a b/RomHeader/HNDJ/libsyscall.a new file mode 100644 index 00000000..470f74bb Binary files /dev/null and b/RomHeader/HNDJ/libsyscall.a differ diff --git a/RomHeader/HNDJ/libsyscall_c.bin b/RomHeader/HNDJ/libsyscall_c.bin new file mode 100644 index 00000000..5f3111c0 Binary files /dev/null and b/RomHeader/HNDJ/libsyscall_c.bin differ diff --git a/RomHeader/HNDJ/rom_header_hndj.template.sbin b/RomHeader/HNDJ/rom_header_hndj.template.sbin new file mode 100644 index 00000000..db840f11 Binary files /dev/null and b/RomHeader/HNDJ/rom_header_hndj.template.sbin differ diff --git a/RomHeader/HNDP/libsyscall.a b/RomHeader/HNDP/libsyscall.a new file mode 100644 index 00000000..a4b90bce Binary files /dev/null and b/RomHeader/HNDP/libsyscall.a differ diff --git a/RomHeader/HNDP/libsyscall_c.bin b/RomHeader/HNDP/libsyscall_c.bin new file mode 100644 index 00000000..cbe45d07 Binary files /dev/null and b/RomHeader/HNDP/libsyscall_c.bin differ diff --git a/RomHeader/HNDP/rom_header_hndp.template.sbin b/RomHeader/HNDP/rom_header_hndp.template.sbin new file mode 100644 index 00000000..845ada81 Binary files /dev/null and b/RomHeader/HNDP/rom_header_hndp.template.sbin differ diff --git a/RomHeader/HNDU/libsyscall.a b/RomHeader/HNDU/libsyscall.a new file mode 100644 index 00000000..cdd83647 Binary files /dev/null and b/RomHeader/HNDU/libsyscall.a differ diff --git a/RomHeader/HNDU/libsyscall_c.bin b/RomHeader/HNDU/libsyscall_c.bin new file mode 100644 index 00000000..8915d3bf Binary files /dev/null and b/RomHeader/HNDU/libsyscall_c.bin differ diff --git a/RomHeader/HNDU/rom_header_hndu.template.sbin b/RomHeader/HNDU/rom_header_hndu.template.sbin new file mode 100644 index 00000000..62154e67 Binary files /dev/null and b/RomHeader/HNDU/rom_header_hndu.template.sbin differ diff --git a/RomHeader/HNEA/libsyscall.a b/RomHeader/HNEA/libsyscall.a new file mode 100644 index 00000000..0c1c57a8 Binary files /dev/null and b/RomHeader/HNEA/libsyscall.a differ diff --git a/RomHeader/HNEA/libsyscall_c.bin b/RomHeader/HNEA/libsyscall_c.bin new file mode 100644 index 00000000..b9e5d863 Binary files /dev/null and b/RomHeader/HNEA/libsyscall_c.bin differ diff --git a/RomHeader/HNEA/rom_header_hnea.template.sbin b/RomHeader/HNEA/rom_header_hnea.template.sbin new file mode 100644 index 00000000..541ec3d0 Binary files /dev/null and b/RomHeader/HNEA/rom_header_hnea.template.sbin differ diff --git a/RomHeader/HNEE/libsyscall.a b/RomHeader/HNEE/libsyscall.a new file mode 100644 index 00000000..ff7faf2c Binary files /dev/null and b/RomHeader/HNEE/libsyscall.a differ diff --git a/RomHeader/HNEE/libsyscall_c.bin b/RomHeader/HNEE/libsyscall_c.bin new file mode 100644 index 00000000..a8afdc77 Binary files /dev/null and b/RomHeader/HNEE/libsyscall_c.bin differ diff --git a/RomHeader/HNEE/rom_header_hnee.template.sbin b/RomHeader/HNEE/rom_header_hnee.template.sbin new file mode 100644 index 00000000..a1eca047 Binary files /dev/null and b/RomHeader/HNEE/rom_header_hnee.template.sbin differ diff --git a/RomHeader/HNEJ/libsyscall.a b/RomHeader/HNEJ/libsyscall.a new file mode 100644 index 00000000..1e80fec3 Binary files /dev/null and b/RomHeader/HNEJ/libsyscall.a differ diff --git a/RomHeader/HNEJ/libsyscall_c.bin b/RomHeader/HNEJ/libsyscall_c.bin new file mode 100644 index 00000000..fc9d84c0 Binary files /dev/null and b/RomHeader/HNEJ/libsyscall_c.bin differ diff --git a/RomHeader/HNEJ/rom_header_hnej.template.sbin b/RomHeader/HNEJ/rom_header_hnej.template.sbin new file mode 100644 index 00000000..cf5459c2 Binary files /dev/null and b/RomHeader/HNEJ/rom_header_hnej.template.sbin differ diff --git a/RomHeader/HNEP/libsyscall.a b/RomHeader/HNEP/libsyscall.a new file mode 100644 index 00000000..a67c12c7 Binary files /dev/null and b/RomHeader/HNEP/libsyscall.a differ diff --git a/RomHeader/HNEP/libsyscall_c.bin b/RomHeader/HNEP/libsyscall_c.bin new file mode 100644 index 00000000..47293586 Binary files /dev/null and b/RomHeader/HNEP/libsyscall_c.bin differ diff --git a/RomHeader/HNEP/rom_header_hnep.template.sbin b/RomHeader/HNEP/rom_header_hnep.template.sbin new file mode 100644 index 00000000..836714eb Binary files /dev/null and b/RomHeader/HNEP/rom_header_hnep.template.sbin differ diff --git a/RomHeader/HNEU/libsyscall.a b/RomHeader/HNEU/libsyscall.a new file mode 100644 index 00000000..aac73eb5 Binary files /dev/null and b/RomHeader/HNEU/libsyscall.a differ diff --git a/RomHeader/HNEU/libsyscall_c.bin b/RomHeader/HNEU/libsyscall_c.bin new file mode 100644 index 00000000..513b9e51 Binary files /dev/null and b/RomHeader/HNEU/libsyscall_c.bin differ diff --git a/RomHeader/HNEU/rom_header_hneu.template.sbin b/RomHeader/HNEU/rom_header_hneu.template.sbin new file mode 100644 index 00000000..b04ab152 Binary files /dev/null and b/RomHeader/HNEU/rom_header_hneu.template.sbin differ diff --git a/RomHeader/HNFA/libsyscall.a b/RomHeader/HNFA/libsyscall.a new file mode 100644 index 00000000..deea8d35 Binary files /dev/null and b/RomHeader/HNFA/libsyscall.a differ diff --git a/RomHeader/HNFA/libsyscall_c.bin b/RomHeader/HNFA/libsyscall_c.bin new file mode 100644 index 00000000..45587fb6 Binary files /dev/null and b/RomHeader/HNFA/libsyscall_c.bin differ diff --git a/RomHeader/HNFA/rom_header_hnfa.template.sbin b/RomHeader/HNFA/rom_header_hnfa.template.sbin new file mode 100644 index 00000000..1fd97c0d Binary files /dev/null and b/RomHeader/HNFA/rom_header_hnfa.template.sbin differ diff --git a/RomHeader/HNFE/libsyscall.a b/RomHeader/HNFE/libsyscall.a new file mode 100644 index 00000000..602c8716 Binary files /dev/null and b/RomHeader/HNFE/libsyscall.a differ diff --git a/RomHeader/HNFE/libsyscall_c.bin b/RomHeader/HNFE/libsyscall_c.bin new file mode 100644 index 00000000..3271aa95 Binary files /dev/null and b/RomHeader/HNFE/libsyscall_c.bin differ diff --git a/RomHeader/HNFE/rom_header_hnfe.template.sbin b/RomHeader/HNFE/rom_header_hnfe.template.sbin new file mode 100644 index 00000000..9e9d53c4 Binary files /dev/null and b/RomHeader/HNFE/rom_header_hnfe.template.sbin differ diff --git a/RomHeader/HNFJ/libsyscall.a b/RomHeader/HNFJ/libsyscall.a new file mode 100644 index 00000000..4f12976c Binary files /dev/null and b/RomHeader/HNFJ/libsyscall.a differ diff --git a/RomHeader/HNFJ/libsyscall_c.bin b/RomHeader/HNFJ/libsyscall_c.bin new file mode 100644 index 00000000..42af61a8 Binary files /dev/null and b/RomHeader/HNFJ/libsyscall_c.bin differ diff --git a/RomHeader/HNFJ/rom_header_hnfj.template.sbin b/RomHeader/HNFJ/rom_header_hnfj.template.sbin new file mode 100644 index 00000000..2e4979ab Binary files /dev/null and b/RomHeader/HNFJ/rom_header_hnfj.template.sbin differ diff --git a/RomHeader/HNFP/libsyscall.a b/RomHeader/HNFP/libsyscall.a new file mode 100644 index 00000000..4853dd78 Binary files /dev/null and b/RomHeader/HNFP/libsyscall.a differ diff --git a/RomHeader/HNFP/libsyscall_c.bin b/RomHeader/HNFP/libsyscall_c.bin new file mode 100644 index 00000000..c232ac3e Binary files /dev/null and b/RomHeader/HNFP/libsyscall_c.bin differ diff --git a/RomHeader/HNFP/rom_header_hnfp.template.sbin b/RomHeader/HNFP/rom_header_hnfp.template.sbin new file mode 100644 index 00000000..8ac831e9 Binary files /dev/null and b/RomHeader/HNFP/rom_header_hnfp.template.sbin differ diff --git a/RomHeader/HNFU/libsyscall.a b/RomHeader/HNFU/libsyscall.a new file mode 100644 index 00000000..6904752c Binary files /dev/null and b/RomHeader/HNFU/libsyscall.a differ diff --git a/RomHeader/HNFU/libsyscall_c.bin b/RomHeader/HNFU/libsyscall_c.bin new file mode 100644 index 00000000..1c6c5e31 Binary files /dev/null and b/RomHeader/HNFU/libsyscall_c.bin differ diff --git a/RomHeader/HNFU/rom_header_hnfu.template.sbin b/RomHeader/HNFU/rom_header_hnfu.template.sbin new file mode 100644 index 00000000..e0f6e9c0 Binary files /dev/null and b/RomHeader/HNFU/rom_header_hnfu.template.sbin differ diff --git a/RomHeader/HNGA/libsyscall.a b/RomHeader/HNGA/libsyscall.a new file mode 100644 index 00000000..bd7c97ee Binary files /dev/null and b/RomHeader/HNGA/libsyscall.a differ diff --git a/RomHeader/HNGA/libsyscall_c.bin b/RomHeader/HNGA/libsyscall_c.bin new file mode 100644 index 00000000..9d77397d Binary files /dev/null and b/RomHeader/HNGA/libsyscall_c.bin differ diff --git a/RomHeader/HNGA/rom_header_hnga.template.sbin b/RomHeader/HNGA/rom_header_hnga.template.sbin new file mode 100644 index 00000000..0592651d Binary files /dev/null and b/RomHeader/HNGA/rom_header_hnga.template.sbin differ diff --git a/RomHeader/HNGE/libsyscall.a b/RomHeader/HNGE/libsyscall.a new file mode 100644 index 00000000..7408c996 Binary files /dev/null and b/RomHeader/HNGE/libsyscall.a differ diff --git a/RomHeader/HNGE/libsyscall_c.bin b/RomHeader/HNGE/libsyscall_c.bin new file mode 100644 index 00000000..295f40a5 Binary files /dev/null and b/RomHeader/HNGE/libsyscall_c.bin differ diff --git a/RomHeader/HNGE/rom_header_hnge.template.sbin b/RomHeader/HNGE/rom_header_hnge.template.sbin new file mode 100644 index 00000000..8672ae03 Binary files /dev/null and b/RomHeader/HNGE/rom_header_hnge.template.sbin differ diff --git a/RomHeader/HNGJ/libsyscall.a b/RomHeader/HNGJ/libsyscall.a new file mode 100644 index 00000000..f0b9ce69 Binary files /dev/null and b/RomHeader/HNGJ/libsyscall.a differ diff --git a/RomHeader/HNGJ/libsyscall_c.bin b/RomHeader/HNGJ/libsyscall_c.bin new file mode 100644 index 00000000..16714d34 Binary files /dev/null and b/RomHeader/HNGJ/libsyscall_c.bin differ diff --git a/RomHeader/HNGJ/rom_header_hngj.template.sbin b/RomHeader/HNGJ/rom_header_hngj.template.sbin new file mode 100644 index 00000000..266b3d0c Binary files /dev/null and b/RomHeader/HNGJ/rom_header_hngj.template.sbin differ diff --git a/RomHeader/HNGP/libsyscall.a b/RomHeader/HNGP/libsyscall.a new file mode 100644 index 00000000..ced5a870 Binary files /dev/null and b/RomHeader/HNGP/libsyscall.a differ diff --git a/RomHeader/HNGP/libsyscall_c.bin b/RomHeader/HNGP/libsyscall_c.bin new file mode 100644 index 00000000..706f93e2 Binary files /dev/null and b/RomHeader/HNGP/libsyscall_c.bin differ diff --git a/RomHeader/HNGP/rom_header_hngp.template.sbin b/RomHeader/HNGP/rom_header_hngp.template.sbin new file mode 100644 index 00000000..484858a0 Binary files /dev/null and b/RomHeader/HNGP/rom_header_hngp.template.sbin differ diff --git a/RomHeader/HNGU/libsyscall.a b/RomHeader/HNGU/libsyscall.a new file mode 100644 index 00000000..c01ed089 Binary files /dev/null and b/RomHeader/HNGU/libsyscall.a differ diff --git a/RomHeader/HNGU/libsyscall_c.bin b/RomHeader/HNGU/libsyscall_c.bin new file mode 100644 index 00000000..532d599e Binary files /dev/null and b/RomHeader/HNGU/libsyscall_c.bin differ diff --git a/RomHeader/HNGU/rom_header_hngu.template.sbin b/RomHeader/HNGU/rom_header_hngu.template.sbin new file mode 100644 index 00000000..4eb34f7a Binary files /dev/null and b/RomHeader/HNGU/rom_header_hngu.template.sbin differ diff --git a/RomHeader/HNIA/libsyscall.a b/RomHeader/HNIA/libsyscall.a new file mode 100644 index 00000000..12dfe339 Binary files /dev/null and b/RomHeader/HNIA/libsyscall.a differ diff --git a/RomHeader/HNIA/libsyscall_c.bin b/RomHeader/HNIA/libsyscall_c.bin new file mode 100644 index 00000000..94c0afd0 Binary files /dev/null and b/RomHeader/HNIA/libsyscall_c.bin differ diff --git a/RomHeader/HNIA/rom_header_hnia.template.sbin b/RomHeader/HNIA/rom_header_hnia.template.sbin new file mode 100644 index 00000000..2f2adad6 Binary files /dev/null and b/RomHeader/HNIA/rom_header_hnia.template.sbin differ diff --git a/RomHeader/HNIE/libsyscall.a b/RomHeader/HNIE/libsyscall.a new file mode 100644 index 00000000..945a10bd Binary files /dev/null and b/RomHeader/HNIE/libsyscall.a differ diff --git a/RomHeader/HNIE/libsyscall_c.bin b/RomHeader/HNIE/libsyscall_c.bin new file mode 100644 index 00000000..4c05f8e4 Binary files /dev/null and b/RomHeader/HNIE/libsyscall_c.bin differ diff --git a/RomHeader/HNIE/rom_header_hnie.template.sbin b/RomHeader/HNIE/rom_header_hnie.template.sbin new file mode 100644 index 00000000..71c01bc0 Binary files /dev/null and b/RomHeader/HNIE/rom_header_hnie.template.sbin differ diff --git a/RomHeader/HNIJ/libsyscall.a b/RomHeader/HNIJ/libsyscall.a new file mode 100644 index 00000000..f71c4d86 Binary files /dev/null and b/RomHeader/HNIJ/libsyscall.a differ diff --git a/RomHeader/HNIJ/libsyscall_c.bin b/RomHeader/HNIJ/libsyscall_c.bin new file mode 100644 index 00000000..4eea3a9a Binary files /dev/null and b/RomHeader/HNIJ/libsyscall_c.bin differ diff --git a/RomHeader/HNIJ/rom_header_hnij.template.sbin b/RomHeader/HNIJ/rom_header_hnij.template.sbin new file mode 100644 index 00000000..ddbae4cb Binary files /dev/null and b/RomHeader/HNIJ/rom_header_hnij.template.sbin differ diff --git a/RomHeader/HNIP/libsyscall.a b/RomHeader/HNIP/libsyscall.a new file mode 100644 index 00000000..0c2584a5 Binary files /dev/null and b/RomHeader/HNIP/libsyscall.a differ diff --git a/RomHeader/HNIP/libsyscall_c.bin b/RomHeader/HNIP/libsyscall_c.bin new file mode 100644 index 00000000..051bc03c Binary files /dev/null and b/RomHeader/HNIP/libsyscall_c.bin differ diff --git a/RomHeader/HNIP/rom_header_hnip.template.sbin b/RomHeader/HNIP/rom_header_hnip.template.sbin new file mode 100644 index 00000000..eea8b90b Binary files /dev/null and b/RomHeader/HNIP/rom_header_hnip.template.sbin differ diff --git a/RomHeader/HNIU/libsyscall.a b/RomHeader/HNIU/libsyscall.a new file mode 100644 index 00000000..0c98ccc9 Binary files /dev/null and b/RomHeader/HNIU/libsyscall.a differ diff --git a/RomHeader/HNIU/libsyscall_c.bin b/RomHeader/HNIU/libsyscall_c.bin new file mode 100644 index 00000000..b1733795 Binary files /dev/null and b/RomHeader/HNIU/libsyscall_c.bin differ diff --git a/RomHeader/HNIU/rom_header_hniu.template.sbin b/RomHeader/HNIU/rom_header_hniu.template.sbin new file mode 100644 index 00000000..970f5496 Binary files /dev/null and b/RomHeader/HNIU/rom_header_hniu.template.sbin differ diff --git a/RomHeader/HNJA/libsyscall.a b/RomHeader/HNJA/libsyscall.a new file mode 100644 index 00000000..aab4e3de Binary files /dev/null and b/RomHeader/HNJA/libsyscall.a differ diff --git a/RomHeader/HNJA/libsyscall_c.bin b/RomHeader/HNJA/libsyscall_c.bin new file mode 100644 index 00000000..370ef848 Binary files /dev/null and b/RomHeader/HNJA/libsyscall_c.bin differ diff --git a/RomHeader/HNJA/rom_header_hnja.template.sbin b/RomHeader/HNJA/rom_header_hnja.template.sbin new file mode 100644 index 00000000..4f50a7c7 Binary files /dev/null and b/RomHeader/HNJA/rom_header_hnja.template.sbin differ diff --git a/RomHeader/HNJE/libsyscall.a b/RomHeader/HNJE/libsyscall.a new file mode 100644 index 00000000..2529d1ad Binary files /dev/null and b/RomHeader/HNJE/libsyscall.a differ diff --git a/RomHeader/HNJE/libsyscall_c.bin b/RomHeader/HNJE/libsyscall_c.bin new file mode 100644 index 00000000..a79e005a Binary files /dev/null and b/RomHeader/HNJE/libsyscall_c.bin differ diff --git a/RomHeader/HNJE/rom_header_hnje.template.sbin b/RomHeader/HNJE/rom_header_hnje.template.sbin new file mode 100644 index 00000000..8d08c050 Binary files /dev/null and b/RomHeader/HNJE/rom_header_hnje.template.sbin differ diff --git a/RomHeader/HNJJ/libsyscall.a b/RomHeader/HNJJ/libsyscall.a new file mode 100644 index 00000000..3ae251e8 Binary files /dev/null and b/RomHeader/HNJJ/libsyscall.a differ diff --git a/RomHeader/HNJJ/libsyscall_c.bin b/RomHeader/HNJJ/libsyscall_c.bin new file mode 100644 index 00000000..0ab36193 Binary files /dev/null and b/RomHeader/HNJJ/libsyscall_c.bin differ diff --git a/RomHeader/HNJJ/rom_header_hnjj.template.sbin b/RomHeader/HNJJ/rom_header_hnjj.template.sbin new file mode 100644 index 00000000..c2538bc7 Binary files /dev/null and b/RomHeader/HNJJ/rom_header_hnjj.template.sbin differ diff --git a/RomHeader/HNJP/libsyscall.a b/RomHeader/HNJP/libsyscall.a new file mode 100644 index 00000000..02c096cb Binary files /dev/null and b/RomHeader/HNJP/libsyscall.a differ diff --git a/RomHeader/HNJP/libsyscall_c.bin b/RomHeader/HNJP/libsyscall_c.bin new file mode 100644 index 00000000..d9b3742b Binary files /dev/null and b/RomHeader/HNJP/libsyscall_c.bin differ diff --git a/RomHeader/HNJP/rom_header_hnjp.template.sbin b/RomHeader/HNJP/rom_header_hnjp.template.sbin new file mode 100644 index 00000000..8e319b59 Binary files /dev/null and b/RomHeader/HNJP/rom_header_hnjp.template.sbin differ diff --git a/RomHeader/HNJU/libsyscall.a b/RomHeader/HNJU/libsyscall.a new file mode 100644 index 00000000..dcad69e6 Binary files /dev/null and b/RomHeader/HNJU/libsyscall.a differ diff --git a/RomHeader/HNJU/libsyscall_c.bin b/RomHeader/HNJU/libsyscall_c.bin new file mode 100644 index 00000000..697efc03 Binary files /dev/null and b/RomHeader/HNJU/libsyscall_c.bin differ diff --git a/RomHeader/HNJU/rom_header_hnju.template.sbin b/RomHeader/HNJU/rom_header_hnju.template.sbin new file mode 100644 index 00000000..f4de4333 Binary files /dev/null and b/RomHeader/HNJU/rom_header_hnju.template.sbin differ diff --git a/RomHeader/HNKA/libsyscall.a b/RomHeader/HNKA/libsyscall.a new file mode 100644 index 00000000..391a277d Binary files /dev/null and b/RomHeader/HNKA/libsyscall.a differ diff --git a/RomHeader/HNKA/libsyscall_c.bin b/RomHeader/HNKA/libsyscall_c.bin new file mode 100644 index 00000000..f3129b63 Binary files /dev/null and b/RomHeader/HNKA/libsyscall_c.bin differ diff --git a/RomHeader/HNKA/rom_header_hnka.template.sbin b/RomHeader/HNKA/rom_header_hnka.template.sbin new file mode 100644 index 00000000..d117e9a7 Binary files /dev/null and b/RomHeader/HNKA/rom_header_hnka.template.sbin differ diff --git a/RomHeader/HNKE/libsyscall.a b/RomHeader/HNKE/libsyscall.a new file mode 100644 index 00000000..e0a4178d Binary files /dev/null and b/RomHeader/HNKE/libsyscall.a differ diff --git a/RomHeader/HNKE/libsyscall_c.bin b/RomHeader/HNKE/libsyscall_c.bin new file mode 100644 index 00000000..0ab35886 Binary files /dev/null and b/RomHeader/HNKE/libsyscall_c.bin differ diff --git a/RomHeader/HNKE/rom_header_hnke.template.sbin b/RomHeader/HNKE/rom_header_hnke.template.sbin new file mode 100644 index 00000000..e610e05d Binary files /dev/null and b/RomHeader/HNKE/rom_header_hnke.template.sbin differ diff --git a/RomHeader/HNKJ/libsyscall.a b/RomHeader/HNKJ/libsyscall.a new file mode 100644 index 00000000..3309d0c7 Binary files /dev/null and b/RomHeader/HNKJ/libsyscall.a differ diff --git a/RomHeader/HNKJ/libsyscall_c.bin b/RomHeader/HNKJ/libsyscall_c.bin new file mode 100644 index 00000000..c21e6e58 Binary files /dev/null and b/RomHeader/HNKJ/libsyscall_c.bin differ diff --git a/RomHeader/HNKJ/rom_header_hnkj.template.sbin b/RomHeader/HNKJ/rom_header_hnkj.template.sbin new file mode 100644 index 00000000..41b27fec Binary files /dev/null and b/RomHeader/HNKJ/rom_header_hnkj.template.sbin differ diff --git a/RomHeader/HNKP/libsyscall.a b/RomHeader/HNKP/libsyscall.a new file mode 100644 index 00000000..404fdf44 Binary files /dev/null and b/RomHeader/HNKP/libsyscall.a differ diff --git a/RomHeader/HNKP/libsyscall_c.bin b/RomHeader/HNKP/libsyscall_c.bin new file mode 100644 index 00000000..695e089a Binary files /dev/null and b/RomHeader/HNKP/libsyscall_c.bin differ diff --git a/RomHeader/HNKP/rom_header_hnkp.template.sbin b/RomHeader/HNKP/rom_header_hnkp.template.sbin new file mode 100644 index 00000000..bf208eae Binary files /dev/null and b/RomHeader/HNKP/rom_header_hnkp.template.sbin differ diff --git a/RomHeader/HNKU/libsyscall.a b/RomHeader/HNKU/libsyscall.a new file mode 100644 index 00000000..5661d8ad Binary files /dev/null and b/RomHeader/HNKU/libsyscall.a differ diff --git a/RomHeader/HNKU/libsyscall_c.bin b/RomHeader/HNKU/libsyscall_c.bin new file mode 100644 index 00000000..2f9255d5 Binary files /dev/null and b/RomHeader/HNKU/libsyscall_c.bin differ diff --git a/RomHeader/HNKU/rom_header_hnku.template.sbin b/RomHeader/HNKU/rom_header_hnku.template.sbin new file mode 100644 index 00000000..fa6bfe68 Binary files /dev/null and b/RomHeader/HNKU/rom_header_hnku.template.sbin differ diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/NITROIPL_Gaiji.tte b/add-ins/NTR_IPL2_Gaiji_Font_PC/NITROIPL_Gaiji.tte new file mode 100644 index 00000000..cb1a20bc Binary files /dev/null and b/add-ins/NTR_IPL2_Gaiji_Font_PC/NITROIPL_Gaiji.tte differ diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeu.exe b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeu.exe new file mode 100644 index 00000000..89dea20d Binary files /dev/null and b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeu.exe differ diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.chm b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.chm new file mode 100644 index 00000000..b6b227ad Binary files /dev/null and b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.chm differ diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.exe b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.exe new file mode 100644 index 00000000..61a2e9c6 Binary files /dev/null and b/add-ins/NTR_IPL2_Gaiji_Font_PC/cpeudc.exe differ diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/install_method.txt b/add-ins/NTR_IPL2_Gaiji_Font_PC/install_method.txt new file mode 100644 index 00000000..d9c73aa2 --- /dev/null +++ b/add-ins/NTR_IPL2_Gaiji_Font_PC/install_method.txt @@ -0,0 +1,23 @@ +<外字インストール方法> + +1.PC内に外字ファイルがない場合は、\WINNT\SYSTEM32フォルダ内のeudcedit.exe +を実行して、適当な外字を追加することで\WINNT\Fonts\EUDC.TTEファイルを生成 +します。 + + +2.cpeudc.exeを実行して、「このマシンの外字ファイルを取得する」を実行。 + + +3.取得したEUDC.TTEファイルを削除して、添付のNITROIPL_Gaiji.tteをEUDC.tte +にリネームする。 + + +4.cpeudc.exeを実行して、「外字ファイルをこのマシンにインストールする」 +を実行。 + + +※既に他の外字ファイルがインストールされていた場合にこの方法でインストール +すると、その外字は消えてしまいますのでご注意下さい。 + + + diff --git a/add-ins/NTR_IPL2_Gaiji_Font_PC/readme.txt b/add-ins/NTR_IPL2_Gaiji_Font_PC/readme.txt new file mode 100644 index 00000000..51d299ab --- /dev/null +++ b/add-ins/NTR_IPL2_Gaiji_Font_PC/readme.txt @@ -0,0 +1,12 @@ +外字コピー屋さん Version 2.5 + + 外字コピー屋さんは、Windows の外字環境を別のマシンのWindowsにインストールするツールです。 + 詳しい使用方法は、ヘルプファイル(cpeudc.chm)を参照してください。 + なお、インストーラは用意しておりません。実行ファイルをお好きなフォルダにコピーしてお使いください。 + +著作権は、East Valleyにあります。 + +バグや不具合などありましたら、下記まで連絡ください。 + +http://www.eastvalley.or.jp/cpeudc/ +alioth@eastvalley.or.jp diff --git a/add-ins/NitroSystem/NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp.zip b/add-ins/NitroSystem/NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp.zip new file mode 100644 index 00000000..3c329023 Binary files /dev/null and b/add-ins/NitroSystem/NitroSystem_forTWL-080408-SDK5_0FCplus5-patch-jp.zip differ diff --git a/add-ins/NitroSystem/NitroSystem_forTWL-080408-jp.zip b/add-ins/NitroSystem/NitroSystem_forTWL-080408-jp.zip new file mode 100644 index 00000000..ce07e42d Binary files /dev/null and b/add-ins/NitroSystem/NitroSystem_forTWL-080408-jp.zip differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.srl b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.srl new file mode 100644 index 00000000..64d7021a Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.tad b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.tad new file mode 100644 index 00000000..d5f621b9 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.srl b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.srl new file mode 100644 index 00000000..c9992a47 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.tad b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.tad new file mode 100644 index 00000000..f69fb960 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppHYB_4CLA.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.srl b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.srl new file mode 100644 index 00000000..6fa8f72f Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.tad b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.tad new file mode 100644 index 00000000..60b40ba4 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.srl b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.srl new file mode 100644 index 00000000..f4940d63 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.tad b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.tad new file mode 100644 index 00000000..7a24a994 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/CloneTmpAppLTD_4CLA.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.srl b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.srl new file mode 100644 index 00000000..bcf40f41 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.tad b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.tad new file mode 100644 index 00000000..728c775d Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.srl b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.srl new file mode 100644 index 00000000..57280a6a Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.tad b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.tad new file mode 100644 index 00000000..117ee60e Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_hyb_4CLA.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd.tad b/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd.tad new file mode 100644 index 00000000..59c5ab35 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd_4CLA.tad b/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd_4CLA.tad new file mode 100644 index 00000000..eff0b8ed Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_ltd_4CLA.tad differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr.srl b/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr.srl new file mode 100644 index 00000000..95eeccf5 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr_4CLA.srl b/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr_4CLA.srl new file mode 100644 index 00000000..526a88b6 Binary files /dev/null and b/bin/ARM9-TS/Release/cloneboot/cloneboot_ntr_4CLA.srl differ diff --git a/bin/ARM9-TS/Release/cloneboot/readme.txt b/bin/ARM9-TS/Release/cloneboot/readme.txt new file mode 100644 index 00000000..facccc30 --- /dev/null +++ b/bin/ARM9-TS/Release/cloneboot/readme.txt @@ -0,0 +1,14 @@ +クローンブートデモ + +cloneboot_ntr.srl: NTRカードアプリ +cloneboot_hyb.srl: TWLカードアプリ +cloneboot_ltd.tad: TWLリミテッドNANDアプリ +cloneboot_hyb.tad: TWLハイブリッドNANDアプリ +CloneTmpAppLTD.srl: TWLリミテッドTMPジャンプカードアプリ +CloneTmpAppHYB.srl: TWLハイブリッドTMPジャンプカードアプリ +CloneTmpAppLTD.tad: TWLリミテッドTMPジャンプNANDアプリ +CloneTmpAppHYB.tad: TWLハイブリッドTMPジャンプNANDアプリ +*_4CLA.*: 上記の製品用システムコール採用版 + +NINTENDOロゴのフェードアウト後に無線通信画面になるか +赤画面になればクローンブート成功です。 diff --git a/bin/ARM9-TS/Release/forDebug/mb_card_rom.srl b/bin/ARM9-TS/Release/forDebug/mb_card_rom.srl new file mode 100644 index 00000000..2e90efc6 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/mb_card_rom.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure.srl b/bin/ARM9-TS/Release/forDebug/secure.srl new file mode 100644 index 00000000..4db531c4 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure_arm7flxberak.srl b/bin/ARM9-TS/Release/forDebug/secure_arm7flxberak.srl new file mode 100644 index 00000000..66d7d28a Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure_arm7flxberak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure_arm7ltdberak.srl b/bin/ARM9-TS/Release/forDebug/secure_arm7ltdberak.srl new file mode 100644 index 00000000..698d0568 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure_arm7ltdberak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure_arm9flxbreak.srl b/bin/ARM9-TS/Release/forDebug/secure_arm9flxbreak.srl new file mode 100644 index 00000000..2db2487f Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure_arm9flxbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure_arm9ltdberak.srl b/bin/ARM9-TS/Release/forDebug/secure_arm9ltdberak.srl new file mode 100644 index 00000000..03245789 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure_arm9ltdberak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/secure_headerbreak.srl b/bin/ARM9-TS/Release/forDebug/secure_headerbreak.srl new file mode 100644 index 00000000..5e9ae731 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/secure_headerbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system.srl b/bin/ARM9-TS/Release/forDebug/system.srl new file mode 100644 index 00000000..390185f8 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system_arm7flxbreak.srl b/bin/ARM9-TS/Release/forDebug/system_arm7flxbreak.srl new file mode 100644 index 00000000..e997f918 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system_arm7flxbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system_arm7ltdbreak.srl b/bin/ARM9-TS/Release/forDebug/system_arm7ltdbreak.srl new file mode 100644 index 00000000..83636894 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system_arm7ltdbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system_arm9flxbreak.srl b/bin/ARM9-TS/Release/forDebug/system_arm9flxbreak.srl new file mode 100644 index 00000000..b4879836 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system_arm9flxbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system_arm9ltdbreak.srl b/bin/ARM9-TS/Release/forDebug/system_arm9ltdbreak.srl new file mode 100644 index 00000000..beaf20be Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system_arm9ltdbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/system_headerbreak.srl b/bin/ARM9-TS/Release/forDebug/system_headerbreak.srl new file mode 100644 index 00000000..12214418 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/system_headerbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user.srl b/bin/ARM9-TS/Release/forDebug/user.srl new file mode 100644 index 00000000..18714459 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user_arm7flxbreak.srl b/bin/ARM9-TS/Release/forDebug/user_arm7flxbreak.srl new file mode 100644 index 00000000..38f72389 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user_arm7flxbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user_arm7ltdbreak.srl b/bin/ARM9-TS/Release/forDebug/user_arm7ltdbreak.srl new file mode 100644 index 00000000..861f7186 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user_arm7ltdbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user_arm9flxbreak.srl b/bin/ARM9-TS/Release/forDebug/user_arm9flxbreak.srl new file mode 100644 index 00000000..55997890 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user_arm9flxbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user_arm9ltdbreak.srl b/bin/ARM9-TS/Release/forDebug/user_arm9ltdbreak.srl new file mode 100644 index 00000000..a4d2a939 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user_arm9ltdbreak.srl differ diff --git a/bin/ARM9-TS/Release/forDebug/user_headerbreak.srl b/bin/ARM9-TS/Release/forDebug/user_headerbreak.srl new file mode 100644 index 00000000..564017d4 Binary files /dev/null and b/bin/ARM9-TS/Release/forDebug/user_headerbreak.srl differ diff --git a/bin/ARM9-TS/Release/istd_default.srl b/bin/ARM9-TS/Release/istd_default.srl new file mode 100644 index 00000000..c3958125 Binary files /dev/null and b/bin/ARM9-TS/Release/istd_default.srl differ diff --git a/bin/ARM9-TS/Release/wds/BACKUPDATA_FOR_RED.bin b/bin/ARM9-TS/Release/wds/BACKUPDATA_FOR_RED.bin new file mode 100644 index 00000000..bfe330c0 Binary files /dev/null and b/bin/ARM9-TS/Release/wds/BACKUPDATA_FOR_RED.bin differ diff --git a/bin/ARM9-TS/Release/wds/basestation.srl b/bin/ARM9-TS/Release/wds/basestation.srl new file mode 100644 index 00000000..d212a8c3 Binary files /dev/null and b/bin/ARM9-TS/Release/wds/basestation.srl differ diff --git a/bin/ARM9-TS/Release/wds/browser.srl b/bin/ARM9-TS/Release/wds/browser.srl new file mode 100644 index 00000000..58caa77a Binary files /dev/null and b/bin/ARM9-TS/Release/wds/browser.srl differ diff --git a/bin/ARM9-TS/Release/wds/readme.txt b/bin/ARM9-TS/Release/wds/readme.txt new file mode 100644 index 00000000..9022af34 --- /dev/null +++ b/bin/ARM9-TS/Release/wds/readme.txt @@ -0,0 +1,51 @@ +ステップ1: 親機を動作させ、ビーコンを送信する +1. 2MフラッシュサブカードのついたDSフラッシュカードを準備します +2. バックアップデバイスにBACKUPDATA_FOR_RED.binを書き込んでください +3. DSフラッシュカードにbasestation.srlを書き込んでください +4. DSフラッシュカードを通常のDSに挿し、起動してください + (IS-NITRO-DEBUGGERを使うとトラブルシュートがしやすくなります) +5. 下画面に「サーバとインターネット経由で通信中」と表示されたら正常にイ +ンターネットと通信できています +6. しばらくたつと下画面に「DSの接続を待っています」と表示されます +7. この状態で親機はAP情報ビーコンを送信しています。 + +ステップ2: WDS組み込み済み店頭ブラウザ(DS版)でビーコン送信が正常であるこ +とを確認する +1. DSフラッシュカードを準備します +2. DSフラッシュカードにbrowser.srlを書き込んでください +3. DSフラッシュカードを通常のDSに挿し、起動してください + (IS-NITRO-DEBUGGERを使うとトラブルシュートがしやすくなります) +4. DSは自動的に店頭配信サーバに接続します。体験版等をダウンロードする画 +面が表示されれば正常です。 + +ステップ3: TWL用WDSライブラリのサンプルを動作させる +1. WDS080221.zipを解凍してください +2. WDS/WDSTest/bin/ARM9-TS.HYB/Release/main.srlをTWLデバッガで動かします +3. デバッグ画面にビーコンの内容が出力され、動作の確認は終了です + +以下WDSライブラリの簡単な説明です。 + +WDSライブラリはWMライブラリのラッパーとして動作します。そのため非常にシ +ンプルな構造となっております。 + +関数のリファレンスに関してはWDS/include/WDS.hにDoxygen準拠のコメントが付 +いていますので、そちらをご覧いただければよいかと思います。 + +WDSライブラリを動作させる流れは、 + +1. WDS_Initialize関数でライブラリを初期化します +2. WDS_StartScan関数でビーコンスキャン開始、この処理は非同期処理で、完了 +時にユーザーが与えたコールバック関数が呼び出されます +3. スキャンは非常に短い時間で終了します。1回のスキャンではビーコンが取れ +ないことが多いため、ユーザーは想定するスキャン時間が過ぎるまで、スキャン +完了コールバックを受けたら、再びWDS_StartScan関数を呼び出すことを繰り返 +します +4. WDS_GetApInfoNum関数を使い、取得できたビーコンの数を得ることができま +す。これとWDS_GetApInfoAll関数を組み合わせて、受信したビーコンの情報を取 +り出してください。 +5. DSであれば、取得したビーコンをDWC_SetSpecifyAp2関数に与えて呼び出すこ +とでACの自動接続先としてビーコンに含まれている情報を設定できるのですが、 +TWLではDWCが移植されていないため、ここはコメントアウトされています。 + +というようなものです。WDS/WDSTest/src/main.cに非常にシンプルなソースがあ +りますので、確認にご利用下さい。 diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 00000000..c06c0e2a --- /dev/null +++ b/build/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - build +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +ifneq ($(TWL_KEYSDIR),) +SUBDIRS = tools +endif + +SUBDIRS += libraries_sysmenu \ + components \ + systemMenu_RED + + +ifneq ($(TWL_KEYSDIR),) +SUBDIRS += libraries \ + nandfirm \ + gcdfirm \ + systemMenu_tools +endif + +ifdef TWL_IPL_WITH_TESTS +SUBDIRS += tests +endif + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/buildtools/commondefs b/build/buildtools/commondefs new file mode 100644 index 00000000..4c7de8c4 --- /dev/null +++ b/build/buildtools/commondefs @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - commondefs - common definitions for build system +# File: commondefs +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWL_IPL_COMMONDEFS_ +TWL_IPL_COMMONDEFS_ = TRUE + +#FIRM_USE_PRODUCT_KEYS = TRUE +#SYSM_BUILD_FOR_DEBUGGER = TRUE + +# 開発機で全ホワイトリストチェックを無視する場合TRUE (デフォルトはTRUE) +SYSM_DEV_WHITELIST_CHECK_SKIP ?= TRUE + +# バナーハッシュチェックを無視する場合TRUE (デフォルトは FALSE) +#SYSM_IGNORE_DHT_PHASE_3 = TRUE + +# 新ホワイトリストでなくてもFatalにならないようにしたい場合TRUE (デフォルトはTRUE) +SYSM_IGNORE_DHT_EX_NOT_FOUND ?= TRUE + +ifeq ($(TARGET_FIRM),SYSTEMMENU) +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs.sysmenu +else +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs.firm +endif + +ifdef FIRM_USE_PRODUCT_KEYS +MACRO_FLAGS += -DFIRM_USE_PRODUCT_KEYS=$(FIRM_USE_PRODUCT_KEYS) +endif + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +TWL_KEYSDIR := $(TWL_IPL_RED_PRIVATE_ROOT)/keys +TWL_IPL_RED_PRIVATE_TOOLSDIR = $(call eupath,$(TWL_IPL_RED_PRIVATE_ROOT)/tools) +endif + +MAKEROM_FLAGS += -s + +#---------------------------------------------------------------------------- +endif # TWL_IPL_COMMONDEFS_ +#----- End of commondefs ----- diff --git a/build/buildtools/commondefs.firm b/build/buildtools/commondefs.firm new file mode 100644 index 00000000..894e01db --- /dev/null +++ b/build/buildtools/commondefs.firm @@ -0,0 +1,137 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - commondefs - common definitions for build system +# File: commondefs +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWLFIRM_COMMONDEFS_ +TWLFIRM_COMMONDEFS_ = TRUE + +EMPTY ?= +SPACE ?= $(EMPTY) $(EMPTY) + +TARGET_BIN ?= $(TARGET_FIRM_BIN) + +# +# change default variables for product +# +override TARGET_PLATFORM := TWL +override TWL_ARCHGEN := LIMITED +override TWL_CODEGEN := ARM +override TWL_MEMSIZE := 16M + +#---------------------------------------------------------------------------- +### TWL-commondefs +# +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot + +#---------------------------------------------------------------------------- +# TWL-FIRM path settings +# + +FIRM_ROOT := $(call eupath,$(TWL_IPL_RED_ROOT)) +FIRM_BUILDTOOLSDIR := $(FIRM_ROOT)/build/buildtools +FIRM_BUILDSETUPDIR := $(FIRM_ROOT)/build/buildsetup +FIRM_INCDIR := $(FIRM_ROOT)/include +FIRM_TOOLSDIR := $(FIRM_ROOT)/tools +FIRM_COMPONENTSDIR := $(FIRM_ROOT)/components +FIRM_ADDINS ?= $(FIRM_ROOT)/add-ins + +FIRM_LIBDIR = $(FIRM_ROOT)/lib/$(TWL_LIBTYPE) +FIRM_LIBSUFFIX = .firm$(ARCHGEN_TYPE)$(CODEGEN_ARCH) + +FIRM_SPECDIR := $(FIRM_INCDIR)/firm/specfiles +FIRM_LSFARCH = $(TWL_LIBARCH)-FIRM +FIRM_LCFARCH = $(FIRM_LSFARCH) +DEFAULT_FIRM_LCFILE = $(FIRM_SPECDIR)/$(FIRM_LCFARCH).lcf +DEFAULT_FIRM_LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(FIRM_LCFARCH).lcf.template +DEFAULT_FIRM_LCFILE_SPEC = $(FIRM_SPECDIR)/$(FIRM_LSFARCH).lsf +DEFAULT_FIRM_ROM_SPEC = $(FIRM_SPECDIR)/ROM-$(TWL_PLATFORM)-FIRM.rsf + +### Compiler & Linker settings + +# replace NitroSDK +DEFAULT_LCFILE_TEMPLATE = $(DEFAULT_FIRM_LCFILE_TEMPLATE) +DEFAULT_LCFILE_SPEC = $(DEFAULT_FIRM_LCFILE_SPEC) +DEFAULT_ROM_SPEC = $(DEFAULT_FIRM_ROM_SPEC) + +LDEPENDS_LCF += $(FIRM_BUILDTOOLSDIR)/commondefs +LDEPENDS_RES += $(FIRM_BUILDTOOLSDIR)/commondefs + +### SDK Library settings + +ifeq ($(CODEGEN_PROC),ARM9) + +FIRM_LIBS_BASE ?= \ + libos \ + libpxi \ + libfs \ + libfatfs \ + libmi \ + +else # ($(CODEGEN_PROC),ARM7) + +FIRM_LIBS_BASE ?= \ + libos_sp \ + libpxi_sp \ + libfs_sp \ + libaes_sp \ + libpm_sp \ + libnvram_sp \ + +endif + +FIRM_LIBS ?= $(addsuffix $(FIRM_LIBSUFFIX).a,$(FIRM_LIBS_BASE)) + +#---------------------------------------------------------------------------- +# MY BUILD TOOLS +# +MAKENORFIRM = $(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/makenorfirm.exe +MAKENANDFIRM = $(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/makenandfirm.exe +MAKEGCDFIRM = $(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/makegcdfirm.exe +NTEXCONV := $(ROOT)/tools/bin/ntexconv.exe +MAKEBANNER := $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +MAKEFIRM_FLAGS ?= + +#---------------------------------------------------------------------------- + +### Global Library resettings + +GINCLUDES := $(FIRM_INCDIR) $(GINCLUDES) +GLIBRARY_DIRS := $(FIRM_LIBDIR) $(GLIBRARY_DIRS) +GLIBRARIES := $(FIRM_LIBS) $(GLIBRARIES) + +#---------------------------------------------------------------------------- +# TWLFIRM_INSTALL_ROOT +# + +ifdef TWLFIRM_INSTALL_ROOT +TWLFIRM_INSTALL_ROOT_ := $(TWLFIRM_INSTALL_ROOT) +else +TWLFIRM_INSTALL_ROOT_ := $(TWL_IPL_RED_ROOT) +endif + +FIRM_INSTALL_ROOT := $(subst $(SPACE),\ ,$(subst \,/,$(TWLFIRM_INSTALL_ROOT_))) +FIRM_INSTALL_INCDIR := $(FIRM_INSTALL_ROOT)/include +FIRM_INSTALL_TOOLSDIR := $(FIRM_INSTALL_ROOT)/tools +FIRM_INSTALL_LIBDIR = $(FIRM_INSTALL_ROOT)/lib/$(TWL_LIBTYPE) +FIRM_INSTALL_PROMDIR := $(FIRM_INSTALL_TOOLSDIR)/prom +FIRM_INSTALL_COMPONENTSDIR := $(FIRM_INSTALL_ROOT)/components +FIRM_INSTALL_ADDINS := $(FIRM_INSTALL_ROOT)/add-ins + +#---------------------------------------------------------------------------- +endif # TWLFIRM_COMMONDEFS_ +#----- End of commondefs ----- diff --git a/build/buildtools/commondefs.sysmenu b/build/buildtools/commondefs.sysmenu new file mode 100644 index 00000000..137a1bde --- /dev/null +++ b/build/buildtools/commondefs.sysmenu @@ -0,0 +1,119 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - commondefs - common definitions for build system +# File: commondefs +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWL_SYSMENU_COMMONDEFS_ +TWL_SYSMENU_COMMONDEFS_ = TRUE + +NITRO_NO_STD_PCHDR = TRUE # プリコンパイルヘッダ抑止 + +EMPTY ?= +SPACE ?= $(EMPTY) $(EMPTY) + +define toLower +$(shell echo $(1) | tr '[A-Z]' '[a-z]' ) +endef # toLower + +# デフォルトのCODEGENを指定(他のcommondefsの前で指定しておかないとダメ) +TARGET_CODEGEN ?= THUMB + +#---------------------------------------------------------------------------- +### TWL-commondefs +# +#include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(NITROSYSTEM_ROOT)/build/buildtools/commondefs + +# TwlSDK の TWLSYSTEM_* -> NITROSYSTEM_* 変更暫定対策 +# NitroSystemパッチが更新されれば不要のはず +NITROSYSTEM_INCDIR ?= $(TWLSYSTEM_INCDIR) +NITROSYSTEM_LIBDIR ?= $(TWLSYSTEM_LIBDIR) +NITROSYSTEM_LIBS ?= $(TWLSYSTEM_LIBS) + +#---------------------------------------------------------------------------- +# TWL-SYSTEM-MENU path settings +# + +#SYSMENU_ROOT := $(subst $(SPACE),\ ,$(subst \,/,$(TWL_IPL_RED_ROOT))) +SYSMENU_ROOT := $(call eupath,$(TWL_IPL_RED_ROOT)) + +SYSMENU_BUILDTOOLSDIR := $(SYSMENU_ROOT)/build/buildtools +SYSMENU_INCDIR := $(SYSMENU_ROOT)/include \ + $(ROOT)/build/libraries/spi/ARM9/include \ + $(ROOT)/build/libraries/os/common/include \ + $(ROOT)/build/libraries/mb/common/include +SYSMENU_TOOLSDIR := $(SYSMENU_ROOT)/tools +SYSMENU_COMPONENTSDIR := $(SYSMENU_ROOT)/components + +SYSMENU_ROM_HEADER_DIR = $(SYSMENU_ROOT)/RomHeader + + +LDEPENDS_LCF += $(SYSMENU_BUILDTOOLSDIR)/commondefs.sysmenu +LDEPENDS_RES += $(SYSMENU_BUILDTOOLSDIR)/commondefs.sysmenu + + +ifneq ($(TARGET_TAD),) +TARGETS += $(TARGET_TAD) +endif + +#---------------------------------------------------------------------------- +### SYSTEM_MENU Library settings + +SYSMENU_LIBDIR := $(SYSMENU_ROOT)/lib/$(TWL_LIBTYPE) + +#---------------------------------------------------------------------------- +# MY BUILD TOOLS +# +OPENSSL := $(SYSMENU_TOOLSDIR)/openssl/openssl.exe +NTEXCONV := $(ROOT)/tools/bin/ntexconv.exe +MAKEBANNER := $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +MAKESYSMENU_RSA_PRVKEY ?= $(SYSMENU_TOOLSDIR)/openssl/rsa_private.der +MAKESYSMENU_RSA_PUBKEY ?= $(SYSMENU_TOOLSDIR)/openssl/rsa_public.der + +#---------------------------------------------------------------------------- + +### Global Library resettings + +GINCLUDES := $(SYSMENU_INCDIR) $(GINCLUDES) +ifneq ($(ES_ROOT),) +GINCLUDES += $(ES_ROOT)/twl/include +endif +GLIBRARY_DIRS := $(SYSMENU_LIBDIR) $(GLIBRARY_DIRS) + +#---------------------------------------------------------------------------- +# TWLSYSMENU_INSTALL_ROOT +# +SYSMENU_INSTALL_ROOT := $(subst $(SPACE),\ ,$(subst \,/,$(TWL_IPL_RED_ROOT))) +SYSMENU_INSTALL_INCDIR := $(SYSMENU_INSTALL_ROOT)/include +SYSMENU_INSTALL_TOOLSDIR := $(SYSMENU_INSTALL_ROOT)/tools +SYSMENU_INSTALL_LIBDIR := $(SYSMENU_INSTALL_ROOT)/lib/$(TWL_LIBTYPE) +SYSMENU_INSTALL_COMPONENTSDIR := $(SYSMENU_INSTALL_ROOT)/components +SDK_NMENU_DATADIR = $(ROOT)/build/tools/TwlNMenu/data + +#---------------------------------------------------------------------------- + +ifeq ($(SYSM_BUILD_FOR_DEBUGGER),TRUE) +MACRO_FLAGS += -DSYSM_BUILD_FOR_DEBUGGER +endif + +#---------------------------------------------------------------------------- +# ARM7コンポーネントにARMビルドを使用する + +TWL_BUILDTYPE_ARM7 := $(subst $(CODEGEN_ARCH),,$(TWL_BUILDTYPE_ARM7)) + +#---------------------------------------------------------------------------- +endif # TWL_SYSMENU_COMMONDEFS_ +#----- End of commondefs ----- diff --git a/build/buildtools/modulerules b/build/buildtools/modulerules new file mode 100644 index 00000000..3d246a4a --- /dev/null +++ b/build/buildtools/modulerules @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - modulerules - common rules for build system +# File: modulerules +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWL_IPL_MODULERULES_ + +#---------------------------------------------------------------------------- +### TWL-modulerules +# + +ifeq ($(TARGET_FIRM),SYSTEMMENU) +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules.sysmenu +else +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules.firm +endif + + +#---------------------------------------------------------------------------- +TWL_IPL_MODULERULES_ = TRUE +endif # TWL_IPL_MODULERULES_ +#----- End of modulerules ----- diff --git a/build/buildtools/modulerules.firm b/build/buildtools/modulerules.firm new file mode 100644 index 00000000..1014ed4d --- /dev/null +++ b/build/buildtools/modulerules.firm @@ -0,0 +1,92 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - modulerules - common rules for build system +# File: modulerules +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWLFIRM_MODULERULES_ + +#---------------------------------------------------------------------------- +### TWL-modulerules +# +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +# +# MAKEROM for IS-TWL-DEBUGGER +# +ifeq ($(filter $(MAKEROM_FLAGS),-F),) +MAKEROM_FLAGS += -F +endif + +# +# MAKENORFIRM / MAKENANDFIRM / MAKEGCDFIRM +# +MAKEFIRM_ARM7 ?= ARM7/bin/$(TWL_BUILDTYPE_ARM7)/main.tef +MAKEFIRM_ARM9 ?= ARM9/bin/$(TWL_BUILDTYPE_ARM9)/main.tef +MAKEFIRM_RSA_PRVKEY ?= $(TWL_KEYSDIR)/rsa/pubkey_nor.der + +MAKEFIRM_ARM7_M := $(call empath,$(MAKEFIRM_ARM7)) +MAKEFIRM_ARM9_M := $(call empath,$(MAKEFIRM_ARM9)) +MAKEFIRM_RSA_PRVKEY_M := $(call empath,$(MAKEFIRM_RSA_PRVKEY)) + +MAKEFIRM_DEFS += -DFIRM_ROOT='$(FIRM_ROOT)' \ + -DMAKEFIRM_ARM9='$(basename $(MAKEFIRM_ARM9_M))' \ + -DMAKEFIRM_ARM7='$(basename $(MAKEFIRM_ARM7_M))' \ + -DMAKEFIRM_RSA_PRVKEY='$(MAKEFIRM_RSA_PRVKEY_M)' \ + +ifdef TWL_KEYSDIR +ifeq ($(TWL_IPL_RED_PRIVATE_ROOT),) +MAKEGCDFIRM_FLAGS += -t'$(TWLSDK_ROOT)/tools/bin/rom_header.template.sbin' +else +MAKEGCDFIRM_FLAGS += -t'$(TWL_KEYSDIR)/blowfish/gcdfirm_header_twlj.template.sbin' +endif +else +MAKEGCDFIRM_FLAGS += -t'$(FIRM_ROOT)/build/tools/makegcdfirm/gcdfirm_header_twlj.template.sbin' +endif + +FIRM_SDEPENDS_BIN := \ + $(call eupath,$(MAKEFIRM_ARM9)) \ + $(call eupath,$(MAKEFIRM_ARM7)) + + +.PHONY: firmtop firmlib + +firmtop: + @$(MAKE) -C $(TWL_IPL_RED_ROOT)/build + +firmlib: + @$(MAKE) -C $(TWL_IPL_RED_ROOT)/build/libraries + +# .nor +$(BINDIR)/%.nor: $(FIRM_SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) + $(MAKENORFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@ + +# .nand +$(BINDIR)/%.nand: $(FIRM_SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) + $(MAKENANDFIRM) $(MAKEFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@ + +# .gcd +$(BINDIR)/%.gcd: $(FIRM_SDEPENDS_BIN) $(FIRM_SPEC) $(LDEPENDS_BIN) $(EDEPENDS_BIN) $(MAKEFILE) + $(MAKEGCDFIRM) $(MAKEFIRM_FLAGS) $(MAKEGCDFIRM_FLAGS) $(MAKEFIRM_DEFS) $(FIRM_SPEC) $@ + +# .rbin +$(BINDIR)/$(TARGET_BIN_BASENAME).rbin: $(OBJS) + objcopy -I elf32-little -O binary $< $@ + +#---------------------------------------------------------------------------- +TWLFIRM_MODULERULES_ = TRUE +endif # TWLFIRM_MODULERULES_ +#----- End of modulerules ----- diff --git a/build/buildtools/modulerules.sysmenu b/build/buildtools/modulerules.sysmenu new file mode 100644 index 00000000..9ee0a948 --- /dev/null +++ b/build/buildtools/modulerules.sysmenu @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - modulerules - common rules for build system +# File: modulerules +# +# Copyright 2007 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +ifndef TWL_SYSMENU_MODULERULES_ + +#---------------------------------------------------------------------------- +### TWL-modulerules +# +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(NITROSYSTEM_ROOT)/build/buildtools/modulerules + + +# .rbin +$(BINDIR)/$(TARGET_BIN_BASENAME).rbin: $(OBJS) + objcopy -I elf32-little -O binary $< $@ + +#---------------------------------------------------------------------------- +TWL_SYSMENU_MODULERULES_ = TRUE +endif # TWL_SYSMENU_MODULERULES_ +#----- End of modulerules ----- diff --git a/build/components/Makefile b/build/components/Makefile new file mode 100644 index 00000000..03299feb --- /dev/null +++ b/build/components/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - build +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + hyena.TWL \ + jackal.TWL + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/components/hyena.TWL/Makefile b/build/components/hyena.TWL/Makefile new file mode 100644 index 00000000..1e3df7e8 --- /dev/null +++ b/build/components/hyena.TWL/Makefile @@ -0,0 +1,149 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +# Main memory にコードを退避させたathdrvを使用。(for test) +TMP_WL_MAIN ?= FALSE + +TARGET_FIRM = SYSTEMMENU +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +FIRM_LIBSUFFIX = .firm$(ARCHGEN_TYPE)$(CODEGEN_ARCH) + +#---------------------------------------------------------------------------- + +SUBDIRS = $(SYSMENU_ROOT)/build/libraries/aes \ + wram_regs + +SRCS = crt0.LTD.c \ + main.c \ + initScfg.c + +TARGET_NAME = hyena + +TARGET_NEF = $(TARGET_NAME).tef + +ifeq ($(TMP_WL_MAIN), TRUE) +LCFILE_SPEC = $(TARGET_NAME)_wlmain.lsf +else +LCFILE_SPEC = $(TARGET_NAME).lsf +endif + +LCFILE_TEMPLATE = $(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/racoon.TWL/racoon.response.template + +# crt0.oは、ランチャー向けに特殊ビルドしたものを使用 +CRT0_O = $(OBJDIR)/crt0.LTD.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# crt0.o 、 libpm_sp および libnwm_sp は、ローカルでビルドしたものを使用するので、除外する。 +ifeq ($(TMP_WL_MAIN), TRUE) +GLIBRARIES := $(filter-out $(CRT0_O) libpm_sp$(TWL_LIBSUFFIX).a libnwm_sp$(TWL_LIBSUFFIX).a libathdrv_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) +else +GLIBRARIES := $(filter-out $(CRT0_O) libpm_sp$(TWL_LIBSUFFIX).a libnwm_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) +endif + +ifdef TWLSDK_NOCRYPTO +CCFLAGS += -DSDK_NOCRYPTO +endif + +ifndef TWLSDK_NOCRYPTO +MAKELCF_FLAGS += -DUSE_CRYPTO_LIBS='libsea_sp$(TWL_LIBSUFFIX).a libcrypto_sp$(TWL_LIBSUFFIX).a' +MACRO_FLAGS += -DSDK_SEA +endif + +MACRO_FLAGS += -DSDK_NOINIT \ + -DSDK_SYSMENU_BUILD +#MACRO_FLAGS += -DSDK_ARM7COMP_LTD + +ifeq ($(DEFAULT_COMP_ARM7),hyena) +MACRO_FLAGS += -DUSE_HYENA_COMPONENT +endif + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037a0000' \ + -DADDRESS_FLXMAIN='0x02280200' \ + -DADDRESS_BOOTCORE='0x0380f000' \ + -DCRT0_O='$(CRT0_O)' \ + -DFIRM_LIBSUFFIX='$(FIRM_LIBSUFFIX)' + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + + +#-------------------------------- +# install target +#-------------------------------- +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ + $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/spi/ARM7/pm/include \ + $(ROOT)/build/libraries/init/common/include \ + $(ROOT)/build/libraries/reboot/common/include \ + $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include + +SYSMENU_LIBS = \ + libsysmenu_sp$(TWL_LIBSUFFIX).a \ + libsysmmcu_sp$(TWL_LIBSUFFIX).a \ + libboot_sp$(TWL_LIBSUFFIX).a \ + libds_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libdht_sp$(TWL_LIBSUFFIX).a \ + libpm_sp.SYSMENU$(TWL_LIBSUFFIX).a + +ifeq ($(TMP_WL_MAIN), TRUE) +SYSMENU_LIBS += \ + libathdrv_sp.SYSMENU$(TWL_LIBSUFFIX).a +endif + +SDK_APPEND_LIBS = \ + libwl_sp$(TWL_LIBSUFFIX).a \ + libaes_sp$(FIRM_LIBSUFFIX).a \ + libsea_sp$(TWL_LIBSUFFIX).a \ + libreboot_sp$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +LLIBRARY_DIRS += ./ + +ifeq ($(TMP_WL_MAIN), TRUE) +LLIBRARY_DIRS += $(SYSMENU_ROOT)/lib/TwlWireless/$(TWL_LIBTYPE) +endif + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/components/hyena.TWL/hyena.lcf.template b/build/components/hyena.TWL/hyena.lcf.template new file mode 100644 index 00000000..ba69dee4 --- /dev/null +++ b/build/components/hyena.TWL/hyena.lcf.template @@ -0,0 +1,932 @@ +#--------------------------------------------------------------------------- +# Project: TwlIPL +# File: hyena.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- + +# check.XXX は、ランチャーがロード可能なサイズおよびautoload後のメモリマップに応じて制限サイズを設定する。 + +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.WORKRAM (RWX) : ORIGIN = 0x037a0000, LENGTH = 0x6a000 > workram.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.LTDMAIN (RWX) : ORIGIN = 0x02280200, LENGTH = 0xf8000 > ltdmain.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_STATIC_DATA_END =.; + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.WRAM.START = 0x037c0000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_AUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_AUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_MOUNT_INFO_TABLE = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_OVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ OTHERS ################################# + SDK_SEA_KEY_STORE = SDK_AUTOLOAD_WRAM_BSS_END; + SDK_WRAM_ARENA_LO = SDK_AUTOLOAD_WRAM_BSS_END + 0x40; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = . + SDK_AUTOLOAD_WRAM_BSS_END - SDK_AUTOLOAD.WRAM.START + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = SDK_STATIC_BSS_END; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02e80000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDAUTOLOAD__ID =; + SDK_LTDAUTOLOAD..ID =; + SDK_LTDAUTOLOAD..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDAUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDAUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_LTDAUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_LTDAUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..TEXT_SIZE = SDK_LTDAUTOLOAD..TEXT_END - SDK_LTDAUTOLOAD..TEXT_START; + SDK_LTDAUTOLOAD..DATA_SIZE = SDK_LTDAUTOLOAD..DATA_END - SDK_LTDAUTOLOAD..DATA_START; + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDOVERLAY__ID =; + SDK_LTDOVERLAY..ID =; + SDK_LTDOVERLAY..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDOVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDOVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDOVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDOVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_LTDOVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_LTDOVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_LTDOVERLAY..END =.; + + SDK_LTDOVERLAY..TEXT_SIZE = SDK_LTDOVERLAY..TEXT_END - SDK_LTDOVERLAY..TEXT_START; + SDK_LTDOVERLAY..DATA_SIZE = SDK_LTDOVERLAY..DATA_END - SDK_LTDOVERLAY..DATA_START; + SDK_LTDOVERLAY..SIZE = SDK_LTDOVERLAY..END - SDK_LTDOVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDOVERLAY..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDOVERLAY..BSS_END =.; + + SDK_LTDOVERLAY..BSS_SIZE = SDK_LTDOVERLAY..BSS_END - SDK_LTDOVERLAY..BSS_START; + + } >> + + + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW SDK_MOUNT_INFO_TABLE; # address of the FS mount information table + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + .check.LTDMAIN: + { + . = SDK_SUBPRIV_ARENA_LO; + + } > check.LTDMAIN + +} diff --git a/build/components/hyena.TWL/hyena.lsf b/build/components/hyena.TWL/hyena.lsf new file mode 100644 index 00000000..8170a79b --- /dev/null +++ b/build/components/hyena.TWL/hyena.lsf @@ -0,0 +1,227 @@ +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: hyena.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address $(ADDRESS_FLXMAIN) + Library $(CRT0_O) + Object $(OBJDIR)/initScfg.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address $(ADDRESS_LTDWRAM) + + Library libsubpsyscall.a \ + libsyscall_sp.twl.a \ + $(CW_LIBS) \ + libos_sp$(LIBSUFFIX).a \ + libmi_sp$(LIBSUFFIX).a \ + libpad_sp$(LIBSUFFIX).a \ + libpxi_sp$(LIBSUFFIX).a \ + libstd_sp$(LIBSUFFIX).a \ + libexi_sp$(LIBSUFFIX).a \ + libsnd_sp$(LIBSUFFIX).a \ + libspi_sp$(LIBSUFFIX).a \ + libpm_sp.SYSMENU$(LIBSUFFIX).a \ + libmath_sp$(LIBSUFFIX).a \ + libscfg_sp$(LIBSUFFIX).a \ + libtp_sp$(LIBSUFFIX).a \ + libmic_sp$(LIBSUFFIX).a \ + libfs_sp$(LIBSUFFIX).a \ + libcard_sp$(LIBSUFFIX).a \ + libi2c_sp$(LIBSUFFIX).a \ + libcamera_sp$(LIBSUFFIX).a \ + libcdc_sp$(LIBSUFFIX).a \ + libsndex_sp$(LIBSUFFIX).a \ + libtpex_sp$(LIBSUFFIX).a \ + libmicex_sp$(LIBSUFFIX).a \ + libmcu_sp$(LIBSUFFIX).a \ + + Library libsdio_sp$(LIBSUFFIX).a + + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + + + Object * (.etable) + Object * (.wram) + Object * (.ltdwram) + Object $(OBJDIR)/main.o + + # caches in fatfs library, that should be on WRAM. + # 2007/12/11 OBJECT() による .bss シンボルのリンクがうまくいかないので、 + # 変数定義箇所に pragma で .ltdwram セクションに含まれるように暫定対策しました。 +# Object OBJECT( FATFSi___mem_drives_structures , libfatfs_sp$(LIBSUFFIX).a) (.bss) + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp$(LIBSUFFIX).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlCmdIf.o + Object OBJECT( RequestCmdTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WStop , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp$(LIBSUFFIX).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp$(LIBSUFFIX).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + + ##### + # Sub-routines in TWL WIRELESS Driver , that should be on WRAM. + Object OBJECT( BMILZData, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( bmiBufferSend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMIWriteMemory, libathdrv_sp$(LIBSUFFIX).a ) (.text) + + Library libboot_sp$(LIBSUFFIX).a \ + libreboot_sp$(LIBSUFFIX).a \ + libhotsw_sp$(LIBSUFFIX).a \ + libreloc_info_sp$(LIBSUFFIX).a \ + libsysmenu_sp$(LIBSUFFIX).a \ + libsysmmcu_sp$(LIBSUFFIX).a \ + libds_sp$(LIBSUFFIX).a \ + libaes_sp$(FIRM_LIBSUFFIX).a \ + libsea_sp$(LIBSUFFIX).a \ + libcrypto_sp$(LIBSUFFIX).a + + + # FATFS core symbols + Object OBJECT(FATFSi_lfi2text, libfatfs_sp$(LIBSUFFIX).a) (.text) # 360 BYTEs + Object OBJECT(FATFSi_pc_findin, libfatfs_sp$(LIBSUFFIX).a) (.text) # 904 BYTEs + Object OBJECT(FATFSi_pc_patcmp_vfat, libfatfs_sp$(LIBSUFFIX).a) (.text) # 436 BYTEs + Object OBJECT(FATFSi_pc_ascii_mfile, libfatfs_sp$(LIBSUFFIX).a) (.text) # 160 BYTEs + Object OBJECT(FATFSi_map_ascii_to_unicode, libfatfs_sp$(LIBSUFFIX).a) (.text) # 48 BYTEs + Object OBJECT(SDCARD_Intr_Thread, libfatfs_sp$(LIBSUFFIX).a) (.text) # 520 BYTEs + Object OBJECT(FATFSi_unicode_cmp_to_ascii_char, libfatfs_sp$(LIBSUFFIX).a) (.text) # 40 BYTEs + Object OBJECT(FATFSi_pc_read_blk, libfatfs_sp$(LIBSUFFIX).a) (.text) # 352 BYTEs + +#RTFS + Object OBJECT(FATFSi_rtfs_memset, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x18 BYTEs + Object OBJECT(FATFSi_faxx_check_free_space, libfatfs_sp$(LIBSUFFIX).a) (.text) # 108 BYTEs + Object OBJECT(fat32_check_freespace, libfatfs_sp$(LIBSUFFIX).a) (.text) # 216 BYTEs + Object OBJECT(fat16_check_freespace, libfatfs_sp$(LIBSUFFIX).a) (.text) # 216 BYTEs + +#Driver + Object OBJECT(SDCARDi_CpuReadFifoAes, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x70 BYTEs + Object OBJECT(SDCARDi_DmaReadFifoAes, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x64 BYTEs + Object OBJECT(SDCARDi_CpuWriteFifoAes, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x94 BYTEs + Object OBJECT(SDCARDi_DmaWriteFifoAes, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x88 BYTEs + Object OBJECT(SYSFPGA_irq, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x17C BYTEs + Object OBJECT(SDCARDi_CpuRecvFast, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x40 BYTEs + Object OBJECT(SDCARDi_CpuSendFast, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x40 BYTEs + Object OBJECT(SD_OrFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x34 BYTEs + Object OBJECT(SD_AndFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x34 BYTEs + Object OBJECT(SD_SetFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x2C BYTEs + Object OBJECT(SD_GetFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x30 BYTEs + Object OBJECT(SD_CheckFPGAReg, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x10 BYTEs + Object OBJECT(NDMA_irq_Handler, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x54 BYTEs + Object OBJECT(SDCARD_irq_Handler, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0xD8 BYTEs + + Object OBJECT(SDCARDi_ReadCore, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x194 BYTEs + Object OBJECT(SDCARDi_WriteCore, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x34C BYTEs + Object OBJECT(SDCARD_TimerStart, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x64 BYTEs + Object OBJECT(SDCARD_TimerStop, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x30 BYTEs + Object OBJECT(SDCARDi_Access, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x12C BYTEs + + Object OBJECT(SD_Command, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0xF0 BYTEs + Object OBJECT(SD_SendStatus, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x40 BYTEs + Object OBJECT(SD_MultiReadBlock, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x7C BYTEs + Object OBJECT(SD_MultiWriteBlock, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x7C BYTEs + Object OBJECT(SD_TransCommand, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0xA8 BYTEs + Object OBJECT(SD_TransReadyFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x8C BYTEs + Object OBJECT(SD_TransEndFPGA, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x78 BYTEs + Object OBJECT(SD_CheckStatus, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0xC0 BYTEs + Object OBJECT(SD_EnableClock, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x18 BYTEs + Object OBJECT(SD_DisableClock, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x1C BYTEs + Object OBJECT(SD_EnableSeccnt, libfatfs_sp$(LIBSUFFIX).a) (.text) # 0x34 BYTEs + + Object * (.rsvwram) +} + +#-------- +Ltdautoload LTDMAIN +{ + After $(TARGET_NAME) + + Object * (.ltdmain) + Library libwm_sp$(LIBSUFFIX).a \ + libnwm_sp.SYSMENU$(LIBSUFFIX).a \ + libwvr_sp$(LIBSUFFIX).a \ + libwl_sp$(LIBSUFFIX).a + + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + + Library libfatfs_sp$(LIBSUFFIX).a \ + libdht_sp$(LIBSUFFIX).a \ + $(USE_CRYPTO_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) +} + +# BootROMの鍵データが0x0380c400〜にあるので、hyenaのWRAM配置の上限はその値になることに注意。 diff --git a/build/components/hyena.TWL/hyena_wlmain.lsf b/build/components/hyena.TWL/hyena_wlmain.lsf new file mode 100644 index 00000000..8bd69061 --- /dev/null +++ b/build/components/hyena.TWL/hyena_wlmain.lsf @@ -0,0 +1,185 @@ +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: hyena.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address $(ADDRESS_FLXMAIN) + Library $(CRT0_O) + Object $(OBJDIR)/initScfg.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address $(ADDRESS_LTDWRAM) + + Library libsubpsyscall.a \ + libsyscall_sp.twl.a \ + $(CW_LIBS) \ + libos_sp$(LIBSUFFIX).a \ + libmi_sp$(LIBSUFFIX).a \ + libpad_sp$(LIBSUFFIX).a \ + libpxi_sp$(LIBSUFFIX).a \ + libstd_sp$(LIBSUFFIX).a \ + libexi_sp$(LIBSUFFIX).a \ + libsnd_sp$(LIBSUFFIX).a \ + libspi_sp$(LIBSUFFIX).a \ + libpm_sp.SYSMENU$(LIBSUFFIX).a \ + libmath_sp$(LIBSUFFIX).a \ + libscfg_sp$(LIBSUFFIX).a \ + libtp_sp$(LIBSUFFIX).a \ + libmic_sp$(LIBSUFFIX).a \ + libfs_sp$(LIBSUFFIX).a \ + libcard_sp$(LIBSUFFIX).a \ + libi2c_sp$(LIBSUFFIX).a \ + libcamera_sp$(LIBSUFFIX).a \ + libcdc_sp$(LIBSUFFIX).a \ + libsndex_sp$(LIBSUFFIX).a \ + libtpex_sp$(LIBSUFFIX).a \ + libmicex_sp$(LIBSUFFIX).a \ + libmcu_sp$(LIBSUFFIX).a \ + + Library libsdio_sp$(LIBSUFFIX).a + + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + + + Object * (.etable) + Object * (.wram) + Object * (.ltdwram) + Object $(OBJDIR)/main.o + + # caches in fatfs library, that should be on WRAM. + # 2007/12/11 OBJECT() による .bss シンボルのリンクがうまくいかないので、 + # 変数定義箇所に pragma で .ltdwram セクションに含まれるように暫定対策しました。 +# Object OBJECT( FATFSi___mem_drives_structures , libfatfs_sp$(LIBSUFFIX).a) (.bss) + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp$(LIBSUFFIX).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlCmdIf.o + Object OBJECT( RequestCmdTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WStop , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp$(LIBSUFFIX).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp$(LIBSUFFIX).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + + ##### + # Sub-routines in TWL WIRELESS Driver , that should be on WRAM. + Object OBJECT( BMILZData, libathdrv_sp.SYSMENU$(LIBSUFFIX).a ) (.text) + Object OBJECT( bmiBufferSend, libathdrv_sp.SYSMENU$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMIWriteMemory, libathdrv_sp.SYSMENU$(LIBSUFFIX).a ) (.text) + + Library libboot_sp$(LIBSUFFIX).a \ + libreboot_sp$(LIBSUFFIX).a \ + libhotsw_sp$(LIBSUFFIX).a \ + libreloc_info_sp$(LIBSUFFIX).a \ + libsysmenu_sp$(LIBSUFFIX).a \ + libsysmmcu_sp$(LIBSUFFIX).a \ + libaes_sp.firm.LTD.a \ + libsea_sp$(LIBSUFFIX).a \ + libcrypto_sp$(LIBSUFFIX).a + + # FATFS core symbols + Object OBJECT(FATFSi_lfi2text, libfatfs_sp$(LIBSUFFIX).a) (.text) # 360 BYTEs + Object OBJECT(FATFSi_pc_findin, libfatfs_sp$(LIBSUFFIX).a) (.text) # 904 BYTEs + Object OBJECT(FATFSi_pc_patcmp_vfat, libfatfs_sp$(LIBSUFFIX).a) (.text) # 436 BYTEs + Object OBJECT(FATFSi_pc_ascii_mfile, libfatfs_sp$(LIBSUFFIX).a) (.text) # 160 BYTEs + Object OBJECT(FATFSi_map_ascii_to_unicode, libfatfs_sp$(LIBSUFFIX).a) (.text) # 48 BYTEs + Object OBJECT(SDCARD_Intr_Thread, libfatfs_sp$(LIBSUFFIX).a) (.text) # 520 BYTEs + Object OBJECT(FATFSi_unicode_cmp_to_ascii_char, libfatfs_sp$(LIBSUFFIX).a) (.text) # 40 BYTEs + Object OBJECT(FATFSi_pc_read_blk, libfatfs_sp$(LIBSUFFIX).a) (.text) # 352 BYTEs + + Object * (.rsvwram) +} + +#-------- +Ltdautoload LTDMAIN +{ + After $(TARGET_NAME) + + Object * (.ltdmain) + Library libwm_sp$(LIBSUFFIX).a \ + libnwm_sp$(LIBSUFFIX).a \ + libwvr_sp$(LIBSUFFIX).a \ + libwl_sp$(LIBSUFFIX).a + + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp.SYSMENU$(LIBSUFFIX).a + + Library libfatfs_sp$(LIBSUFFIX).a \ + libdht_sp$(LIBSUFFIX).a \ + $(USE_CRYPTO_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) +} + +# BootROMの鍵データが0x0380c400〜にあるので、hyenaのWRAM配置の上限はその値になることに注意。 diff --git a/build/components/hyena.TWL/src/crt0.LTD.c b/build/components/hyena.TWL/src/crt0.LTD.c new file mode 100644 index 00000000..956e1e14 --- /dev/null +++ b/build/components/hyena.TWL/src/crt0.LTD.c @@ -0,0 +1,736 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.LTD.c + + Copyright 2007 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 +#include "boot_sync.h" + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); +void INIT_InitializeScfg(void); + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* 外部関数参照定義 */ +extern void OS_IrqHandler(void); +extern void _fp_init(void); +extern void __call_static_initializers(void); + +/* 内部関数プロトタイプ定義 */ +static void INITi_DoAutoload(void); +static BOOL INITi_IsRunOnTwl( void ); +static void INITi_CopySysConfig( void ); +static void INITi_DetectMainMemorySize(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); + +#ifdef USE_HYENA_COMPONENT +void* const _start_ModuleParams[] = +{ + (void*)SDK_AUTOLOAD_LIST, + (void*)SDK_AUTOLOAD_LIST_END, + (void*)SDK_AUTOLOAD_START, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, // CompressedStaticEnd. This fixed number will be updated by compstatic tool. + (void*)0, // SDK_VERSION_ID // SDK version info /* [TODO] ビルドを通すため */ + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; +#else +void* const _start_ModuleParams[] = +{ + (void*)0, + (void*)0, + (void*)0, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, + (void*)0, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; +#endif + +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, // CompressedLtdautoloadEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + + +#ifdef DEBUG_WRAM_SETTING +u32 const wramMapping[12] = { + 0x8d898581, 0x8c888480, 0x9c989490, 0x8c888480, + 0x9c989490, 0x00000000, 0x09403900, 0x09803940, + 0x080037c0, 0x09403900, 0x09803940, 0x0000000f +}; +#endif + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +#ifdef DEBUG_WRAM_SETTING +/*---------------------------------------------------------------------------* + Name: WaitAgreement + Description: ARM9 の起動ベクタが特定の状態になるまで待つ。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - 同期用フェーズ管理変数へのポインタ。 + r1 - 待機するフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_WaitAgreement[7] = +{ + 0xe1d020b0, /* @1: ldrh r2, [r0] ; フェーズ管理変数を共有メモリから読む */ + 0xe1510002, /* cmp r1, r2 ; 待機フェーズ番号と比較 */ + 0x012fff1e, /* bxeq lr ; 一致していれば待機完了 */ + 0xe3a03010, /* mov r3, #16 ; 空ループ回数初期化 */ + 0xe2533001, /* @2: subs r3, r3, #1 ; 空ループ回数 -- */ + 0x1afffffd, /* bne @2 ; 16 回ループ */ + 0xeafffff8 /* b @1 ; 先頭に戻る */ +}; +#endif + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + r1 - 同期用フェーズ管理変数へのポインタ。 + r2 - ARM9 に伝えるフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[2] = +{ + 0xe1c120b0, /* strh r2, [r1] ; フェーズ管理変数を更新 */ + 0xe12fff10 /* bx r0 ; Main 関数へジャンプ */ +}; + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割り込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] // Use that LSB of HW_REG_BASE is 0b0 + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 +@001: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @001 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for stack check code + mov r0, #HW_PSR_SYS_MODE + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* SCFG を HW_SYS_CONF_BUF へコピー */ + bl INIT_InitializeScfg + bl INITi_CopySysConfig + + /* TWL ハードウェア上で動作しているかどうかを調査 */ + bl INITi_IsRunOnTwl + /* TWL ハードウェア上で動作していない場合は永久ループ */ +@012: bne @012 + + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + +@020: + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC ブロックの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + //---- detect main memory size + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + //---- set debug print window + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7<<8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR<<8) + strh r0, [r1, #2] +#endif + + /* 割り込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@030: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + ldr r0, [r1], #4 + str r0, [sp, #-4] + ldr r0, [r1] + str r0, [sp] + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =TwlSpMain + ldr r1, =HW_BOOT_SYNC_PHASE + mov r2, #BOOT_SYNC_PHASE_4 + ldr lr, =HW_RESET_VECTOR + sub r3, sp, #4 + bx r3 +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* + * < 二段階オートロード > + * 0x02380000 に crt0 及び一段目ロード元バイナリが配置されている。 + * NITRO と共有可能な WRAM 上に配置されるべきバイナリデータを 0x037c0000 にロードする。 + * TWL でしか動作しない WRAM 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + * 0x02400000 に ARM9 の二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f80000 - 0x02f84000 に退避する。 + * 0x02e80000 に二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f84000 - 0x02f88000 に退避する。 + * NITRO と共有可能な MAIN 上に配置されるべきバイナリデータを 0x02f88000 にロードする。 + * TWL でしか動作しない MAIN 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + */ +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + +@01_autoload: + /* WRAM 用ブロックをオートロード */ + ldr r0, =_start_ModuleParams + ldr r12, [r0] // r12 = SDK_AUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_AUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_AUTOLOAD_START +@01_segments_loop: + cmp r12, r3 + bge @02_start + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 // r0 = start address of source range of static initializers table +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = size of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} // r1 = end address of source range of the autoload segment + b @01_segments_loop + +@02_start: + + /* メインメモリ用オートロードブロックの存在を確認 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + ldr r0, [r1, #ROM_Header.s.sub_ltd_size] + cmp r0, #0 + beq @03_start + +@02_autoload: + /* メインメモリ用ブロックをオートロード */ + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_AUTOLOAD_START +@02_segments_loop: + cmp r12, r3 + bge @03_start + /* 固定セクション */ + ldr r0, [r12], #4 + ldr r2, [r12], #4 + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} + mov r1, #0 + ldr r2, [r12], #4 + bl INITi_Fill32 + ldmfd sp!, {r1} + b @02_segments_loop + +@03_start: + /* オートロード完了コールバック関数呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + + +#ifndef SDK_NOINIT +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* 退避場所先頭から空き場所を調査 */ +@001: ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 + + /* 空き場所にテーブルをコピー */ +@002: ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* テーブルに管理されているポインタを一つずつ呼び出し */ +@001: ldr r0, [r1] + cmp r0, #0 + beq @002 + stmdb sp!, {r1} + mov lr, pc + bx r0 + ldmia sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 + +@002: ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: NitroSpStartUp + Description: Hook for user start up. + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void +NitroSpStartUp(void) +{ +} + +/*---------------------------------------------------------------------------* + Name: INITi_IsRunOnTwl + + Description: check running platform + + This function is used in only Nitro-TWL hybrid mode. + (In Nitro mode and TWL limited mode, treated as constant) + + Arguments: None + + Returns: TRUE : running on TWL + FALSE : running on NITRO + *---------------------------------------------------------------------------*/ +static asm BOOL INITi_IsRunOnTwl( void ) +{ + ldr r0, =HW_PRV_WRAM_SYSRV + ldrb r0, [r0,#HWi_WSYS08_WRAMOFFSET] + and r0, r0, #HWi_WSYS08_ROM_ARM9SEC_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + moveq r0, #TRUE + movne r0, #FALSE + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INIT_InitializeScfg + + Description: ローダーが行う SCFG ブロックへの設定処理を代行する為の関数。 + 処理の実体は crt0 の外部に定義するため、弱シンボルとする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +INIT_InitializeScfg(void) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CopySysConfig + + Description: copy SCFG registers to HW_SYS_CONF_BUF and HW_PRV_WRAM_SYSRV + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static asm void INITi_CopySysConfig( void ) +{ + //---- copy scfg setting + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + + Description: detect main memory size. + result is written into (u32*)HW_MMEMCHECKER_SUB. + value is [OS_CONSOLE_SIZE_4MB|OS_CONSOLE_SIZE_8MB| + OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32MB] + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE 0x400000 +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void INITi_DetectMainMemorySize( void ) +{ + stmfd sp!, {lr} + + //---- detect memory size + mov r0, #OS_CONSOLE_SIZE_4MB + mov r1, #0 + + ldr r2, =HW_MMEMCHECKER_SUB + sub r3, r2, #OSi_IMAGE_DIFFERENCE +@1: + strh r1, [r2] + ldrh r12, [r3] + cmp r1, r12 + bne @2 + + add r1, r1, #1 + cmp r1, #2 // check 2 loop + bne @1 + + //---- 4MB + b @3 + + //---- 8MB or 16MB or 32MB +@2: + // check if running on twl/nitro + bl INITi_IsRunOnTwl + movne r0, #OS_CONSOLE_SIZE_8MB + bne @3 + + //---- 16MB or 32MB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + ldrb r2, [r3] + + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@4 subs r12, r12, #4 + bcs @4 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @3 + + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@5 subs r12, r12, #4 + bcs @5 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@3: + //---- check SMX_CNT + strb r2, [r3] + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + ldr r2, =HW_MMEMCHECKER_SUB + strh r0, [r2] + + ldmfd sp!, {lr} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 32 bit 単位でコピーを行う。スタックを 36 バイト消費するが、 + レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 32 bit 単位でバッファ内容を指定データで埋める。スタックを 36 + バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +#include diff --git a/build/components/hyena.TWL/src/initScfg.c b/build/components/hyena.TWL/src/initScfg.c new file mode 100644 index 00000000..2e57b44f --- /dev/null +++ b/build/components/hyena.TWL/src/initScfg.c @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - mongoose.TWL + File: initScfg.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:: 2008-03-03#$ + $Rev: 4466 $ + $Author: terui $ + *---------------------------------------------------------------------------*/ + +#include +#include + +extern void INIT_InitializeScfg(void); + +#include +/*---------------------------------------------------------------------------* + Name: INIT_InitializeScfg + + Description: ローダーが行う SCFG ブロックへの設定処理を代行する為の関数。 + crt0 内の弱シンボルを上書きする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +asm void +INIT_InitializeScfg(void) +{ + // SCFG enable? + ldr r2, =REG_EXT_ADDR + ldr r0, [r2] + tst r0, #REG_SCFG_EXT_CFG_MASK + beq @end + + /* NITRO 互換無線の送受信機能を動作 */ + ldr r1, =REG_WL_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_WL_OFFB_MASK + strh r0, [r1] + + /* 新規サウンドブロックへのクロック供給 */ + ldr r1, =REG_CLK_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_CLK_SNDMCLK_MASK + strh r0, [r1] + + /* ARM7 側の DMA には新 DMA 回路を採用 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + orr r0, r0, #REG_SCFG_EXT_DMAC_MASK + str r0, [r1] + + ldr r2, =HW_PRV_WRAM_SYSRV + //EXT(extentions) + ldr r3, =REG_EXT_ADDR + ldr r0, [r3] + str r0, [r2, #HWi_WSYS04_WRAMOFFSET] + //OPT(bonding option) + ldr r3, =REG_OP_ADDR + ldrb r0, [r3] + //A9ROM(ARM9 ROM) + ldr r3, =REG_A9ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A9ROM_RSEL_MASK | REG_SCFG_A9ROM_SEC_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM9RSEL_SHIFT - REG_SCFG_A9ROM_RSEL_SHIFT) + //A7ROM(ARM7 ROM) + ldr r3, =REG_A7ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A7ROM_RSEL_MASK | REG_SCFG_A7ROM_FUSE_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM7RSEL_SHIFT - REG_SCFG_A7ROM_RSEL_SHIFT) + //DS-WL(DS wireless) + ldr r3, =REG_WL_ADDR + ldrb r1, [r3] + and r12,r1, #REG_SCFG_WL_OFFB_MASK + orr r0, r0, r12, LSL #(HWi_WSYS08_WL_OFFB_SHIFT - REG_SCFG_WL_OFFB_SHIFT) + strb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + //OPT(JTAG info) + ldr r3, =REG_JTAG_ADDR + ldrh r0, [r3] + and r12,r0, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r12, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + //CLK(only wram clock) + ldr r3, =REG_CLK_ADDR + ldrh r1, [r3] + and r12,r1, #(REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS09_CLK_SD1HCLK_SHIFT - REG_SCFG_CLK_SD1HCLK_SHIFT) + and r12,r1, #(REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK) + orr r0, r0, r12, LSR #(REG_SCFG_CLK_WRAMHCLK_SHIFT - HWi_WSYS09_CLK_WRAMHCLK_SHIFT) + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] + +#if 0 + /* A7-SCFG ブロックへのアクセスを無効化 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + bic r0, r0, #REG_SCFG_EXT_CFG_MASK + str r0, [r1] +#endif + +@end: + bx lr +} +#include diff --git a/build/components/hyena.TWL/src/main.c b/build/components/hyena.TWL/src/main.c new file mode 100644 index 00000000..ecb21024 --- /dev/null +++ b/build/components/hyena.TWL/src/main.c @@ -0,0 +1,916 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - components - hyena.TWL + File: main.c + + Copyright 2007 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pm_pmic.h" +#include "internal_api.h" +#include "nvram_sp.h" +#include "twl/sea.h" + +// 未実装(現状ではデバッガ接続しないなら選択してもよい) +//#define HYENA_ROMEMU_INFO_FROM_LNCR_PARAM +//#define HYENA_RTC_DEBUG + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define WM_WL_HEAP_SIZE 0x2100 +#define ATH_DRV_HEAP_SIZE 0x5800 +#define WPA_HEAP_SIZE 0x1C00 + +#define MEM_TYPE_WRAM 0 +#define MEM_TYPE_MAIN 1 + +/* Priorities of each threads */ +#define THREAD_PRIO_MCU 1 /* ハードウェアリセット時に他のスレッドに優先して動く必要アリ */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_SYSMMCU 6 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +#define NWM_DMANO NWMSP_DMA_NOT_USE // NWMのNDMAは使用しない。 +#define THREAD_PRIO_NWM_COMMMAND 9 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_NWM_WPA 10 + +// ROM 内登録エリアの拡張言語コード +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void ResetRTC( void ); +static void ReadLauncherParameter( void ); +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(u8 memType); +static OSHeapHandle InitializeAllocateSystemCore(u8 memType); +#ifdef SDK_TWLHYB +static OSHeapHandle InitializeAllocateSystemCoreEx(u8 memType); +#endif +static void DummyThread(void* arg); +static void ReadUserInfo(void); +static void VBlankIntr(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSArenaId drvArenaId, OSHeapHandle drvHeapHandle, + OSArenaId wpaArenaId, OSHeapHandle wpaHeapHandle); +static void InitializeCdc(); +static void AdjustVolume(void); +/*---------------------------------------------------------------------------* + 外部シンボル参照 + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWLHYB +extern void SDK_LTDAUTOLOAD_LTDWRAM_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LTDMAIN_BSS_END(void); +#endif +extern void SDK_SEA_KEY_STORE(void); +extern void SDK_STATIC_BSS_END(void); + +extern BOOL sdmcGetNandLogFatal( void ); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle wramHeapHandle, mainHeapHandle; + + // SYSMワークのクリア +// MI_CpuClear32( SYSMi_GetWork(), sizeof(SYSM_work) ); // NANDファームでクリアしているので、いらない。 + // ※もしランチャー上でやるなら、crt0.o内でクリアの記述をしないとAutoloadセグメントに配置されてしまって、うまく動かない点に注意する。 + + // バックライトON + while ( (reg_GX_DISPSTAT & REG_GX_DISPSTAT_INI_MASK) == FALSE ) + { + } + PMi_SetControl( PMIC_CTL_BKLT1 | PMIC_CTL_BKLT2 ); + +#ifdef INITIAL_KEYTABLE_PRELOAD + HOTSW_CopyInitialKeyTable(); +#endif + + // OS 初期化 + OS_Init(); + PrintDebugInfo(); + + // ランチャーバージョンを格納(今のところ、最低でもマウント情報登録前には格納する必要あり) + *(u8 *)HW_TWL_RED_LAUNCHER_VER = (u8)SYSM_LAUNCHER_VER; + + // ランチャーのマウント情報登録 + SYSMi_SetLauncherMountInfo(); + + // ランチャーパラメター取得(Cold/Hotスタート判定含む) + ReadLauncherParameter(); + + // RTCリセット + ResetRTC(); // 330usくらい + + // NVRAM からユーザー情報読み出し + ReadUserInfo(); + + // NANDのFATALエラー検出 + if( sdmcGetNandLogFatal() != FALSE) { + /* 故障扱い処理 */ + SYSMi_GetWork()->flags.arm7.isNANDFatalError = TRUE; + } + + SYSMi_GetWork()->flags.arm7.isARM9Start = TRUE; + + // ヒープ領域設定 +#ifndef USE_HYENA_COMPONENT + OS_SetSubPrivArenaLo( (void*)SDK_STATIC_BSS_END ); +#endif + OS_SetSubPrivArenaHi( (void*)SYSM_OWN_ARM7_MMEM_ADDR_END ); // メモリ配置をいじっているので、アリーナHiも変更しないとダメ!! + OS_SetWramSubPrivArenaHi( (void*)(SYSM_OWN_ARM7_WRAM_ADDR_END - HW_FIRM_FROM_FIRM_BUF_SIZE) ); // この時点では鍵をつぶさないように + OS_TPrintf( "MMEM SUBPRV ARENA HI : %08x -> %08x\n", OS_GetSubPrivArenaHi(), OS_GetSubPrivArenaHi() ); + OS_TPrintf( "WRAM SUBPRV ARENA HI : %08x -> %08x\n", OS_GetWramSubPrivArenaHi(), OS_GetWramSubPrivArenaHi() ); + wramHeapHandle = InitializeAllocateSystem(MEM_TYPE_WRAM); + mainHeapHandle = InitializeAllocateSystem(MEM_TYPE_MAIN); + + // ボタン入力サーチ初期化 + (void)PAD_InitXYButton(); + + // 割り込み許可 + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // PXIコールバックの設定 + SYSM_InitPXI(THREAD_PRIO_SYSMMCU); + + // ファイルシステム初期化 + FS_Init(FS_DMA_NOT_USE); + FS_CreateReadServerThread(THREAD_PRIO_FS); + + if (OS_IsRunOnTwl() == TRUE) + { + InitializeFatfs(); // FATFS 初期化 + // NWM 初期化 + InitializeNwm(OS_ARENA_MAIN_SUBPRIV, mainHeapHandle, // heap setting for TWL wireless host driver + OS_ARENA_MAIN_SUBPRIV, mainHeapHandle // heap setting for wpa + ); +#ifndef SDK_NOCRYPTO + AES_Init(THREAD_PRIO_AES); // AES 初期化 + + { + // JPEGエンコード用の鍵セット + SYSMi_SetAESKeysForSignJPEG( (ROM_Header *)HW_TWL_ROM_HEADER_BUF, NULL, NULL ); + // NANDファームがHW_LAUNCHER_DELIVER_PARAM_BUFへのAES_SEEDセットを行ってくれるので、ISデバッガ接続に関係なくSDK_SEA_KEY_STOREへのコピーを行えばよい + MI_CpuCopyFast( (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, (void *)SDK_SEA_KEY_STORE, HW_LAUNCHER_DELIVER_PARAM_BUF_SIZE ); + } + +#ifdef SDK_SEA + SEA_Init(THREAD_PRIO_SEA); +#endif // ifdef SDK_SEA +#endif + MCU_InitIrq(THREAD_PRIO_MCU); // MCU 初期化 + + // ボリューム設定の調整 + AdjustVolume(); + } + + if (OSi_IsCodecTwlMode() == TRUE) + { + // CODEC 初期化 + // ランチャーのみCDC_InitForFirstBootで実際にCODECの初期化を行う。 + // アプリ起動時にはCODECは既に初期化されているためmongooseなどでは + // 簡易的な初期化CDC_InitLibで良い。 2008/07/14 + InitializeCdc(); + + // カメラ初期化 + CAMERA_Init(); + /* CODEC が TWL モードでないとシャッター音を強制的に鳴らす + 機能が使用できません。この為、CODEC が TWL モードの場合 + にのみカメラライブラリを使用可能な状態にします。 */ + } + + // サウンド初期化 + SND_Init(THREAD_PRIO_SND); + if (OS_IsRunOnTwl() == TRUE) + { + SNDEX_Init(THREAD_PRIO_SNDEX); + } + + // RTC 初期化 + RTC_Init(THREAD_PRIO_RTC); + + // ランチャーでは、旧無線の初期化はmain loopで行う。 + + // SPI 初期化 + // ※ARM9側のOS_Init内のPM_InitでPMのPXIコールバック待ちをしており、ここでARM9と同期が取られる。 + SPI_Init(THREAD_PRIO_SPI); + + BOOT_Init(); + + // 活栓挿抜機能初期化 + if( ( SYSM_GetLauncherParamBody()->v1.flags.isValid ) && + ( SYSM_GetLauncherParamBody()->v1.flags.bootType != LAUNCHER_BOOTTYPE_ROM ) && + ( SYSM_GetLauncherParamBody()->v1.bootTitleID ) + ) +#ifdef HYENA_ROMEMU_INFO_FROM_LNCR_PARAM + { + // ランチャーパラメータでダイレクトカードブート以外の指定がある時は、活線挿抜をOFFにする。 + SYSMi_GetWork()->flags.hotsw.isEnableHotSW = 0; + }else { + // それ以外の時は活線挿抜ON + SYSMi_GetWork()->flags.hotsw.isEnableHotSW = 1; + } +#else + { + // ランチャーパラメータでダイレクトカードブート以外の指定がある時は、ROMエミュレーション情報のみ必要。 + SYSMi_GetWork()->flags.hotsw.isLoadRomEmuOnly = 1; + }else { + // それ以外の時は普通にロード + SYSMi_GetWork()->flags.hotsw.isLoadRomEmuOnly = 0; + } + SYSMi_GetWork()->flags.hotsw.isEnableHotSW = 1; +#endif + + HOTSW_Init(THREAD_PRIO_HOTSW); + + while (TRUE) + { + OS_Halt(); + // 無線ファームのロード完了をチェック。 + if (TRUE == NWMSPi_CheckInstalledNotification()) + { + /* M&M chipでは無線ファームのDL完了 → 旧無線初期化の順序を守る必要あり。 + そのため、新無線のファームDL完了通知をmain loopでチェックし、 + 完了が通知されたら旧無線初期化を行った後、NWMに確認通知を送る。[twl-dev:0980] */ + WVR_Begin(wramHeapHandle); +#if 1 + // [TODO:] RC plus branchでは、NWMSPi_NotifyConfirmation()の返り値がないため、返り値評価を行わない。 + // 次期リリースで返り値評価を行うよう変更予定。 + NWMSPi_NotifyConfirmation(); +#else + if (FALSE == NWMSPi_NotifyConfirmation()) + { + // NWMへのConfirmation通知のためのSendMessageにENQできない状態. + // (ここに来ることはありえない筈.) + OS_Panic("ARM7: Failed to complete wireless firmare install.\n"); + } +#endif + } + BOOT_WaitStart(); + } +} + + +// RTCのリセットチェック +static void ResetRTC( void ) +{ + SYSM_work* sw = SYSMi_GetWork(); + + // ランチャーでリセットを検出するためにこの処理をしているが、RTC_Init内でも同じことをしているので、ちょっと無駄。 + RTCRawStatus1 stat1; + RTCRawStatus2 stat2; + RTC_ReadStatus1( &stat1 ); + RTC_ReadStatus2( &stat2 ); + + // リセット、電源投入、電源電圧低下、ICテストの各フラグを確認 + if ( stat1.reset || stat1.poc || stat1.bld || stat2.test ) + { + // リセット実行 + stat1.reset = 1; + RTC_WriteStatus1( &stat1 ); + sw->flags.arm7.isResetRTC = TRUE; + } + + // FOUTが32KHz出力でない場合は、32KHz出力に修正設定する。(無線で使用している) + { + RTCRawFout fout; + RTC_ReadFout(&fout); + if( fout.fout != RTC_FOUT_DUTY_32KHZ ) { + fout.fout = RTC_FOUT_DUTY_32KHZ; + RTC_WriteFout(&fout); + } + } + + // RTC初回データ読み込み + RTC_ReadDateTime(&sw->Rtc1stData); + + // NTR-IPL同様にアラーム時間をクリア + //(割り込みイネーブルでないとアクセスできない) + { + static RTCRawAlarm alarm = {0,0,0,0,0,0,0,0,0}; + + stat2.intr_mode = RTC_INTERRUPT_MODE_ALARM; // アラーム割り込みイネーブル + stat2.intr2_mode = TRUE; + RTC_WriteStatus2( &stat2 ); + + (void)RTC_WriteAlarm1( &alarm ); + (void)RTC_WriteAlarm2( &alarm ); +#ifdef HYENA_RTC_DEBUG + { + static RTCRawAlarm rd_alarm = {1,1,1,1,1,1,1,1,1}; + (void)RTC_ReadAlarm1( &rd_alarm ); + (void)RTC_ReadAlarm2( &rd_alarm ); + } +#endif + stat2.intr_mode = RTC_INTERRUPT_MODE_NONE; // アラーム割り込みディセーブル + stat2.intr2_mode = RTC_INTERRUPT_MODE_NONE; + RTC_WriteStatus2( &stat2 ); + } +} + + +// ランチャーパラメータのリードおよびHot/Coldスタート判定 +void ReadLauncherParameter( void ) +{ + BOOL hot; + SYSMi_GetWork()->flags.arm7.isValidLauncherParam = OS_ReadLauncherParameter( (LauncherParam *)&(SYSMi_GetWork()->launcherParam), &hot ); + SYSMi_GetWork()->flags.arm7.isHotStart = hot; + // メインメモリのランチャーパラメータをクリアしておく + MI_CpuClearFast( (void*)HW_PARAM_LAUNCH_PARAM, HW_PARAM_LAUNCH_PARAM_SIZE ); + // Coldスタート時はアプリパラメータもクリア + if ( ! hot ) + { + MI_CpuClearFast( (void*)HW_PARAM_DELIVER_ARG, HW_PARAM_DELIVER_ARG_SIZE ); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + if(OS_IsRunOnTwl()) + { + OS_TPrintf("ARM7: This component is running on TWL.\n"); + } + else + { + OS_TPrintf("ARM7: This component is running on NITRO.\n"); + } +#ifdef USE_HYENA_COMPONENT + OS_TPrintf("ARM7: This component is \"hyena.TWL\"\n"); +#else + OS_TPrintf("ARM7: This component is \"jackal.TWL\"\n"); +#endif +} + +#include +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} +#include + +#include +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSArenaId drvArenaId, OSHeapHandle drvHeapHandle, + OSArenaId wpaArenaId, OSHeapHandle wpaHeapHandle) +{ + NwmspInit nwmInit; + + nwmInit.dmaNo = NWM_DMANO; + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + nwmInit.drvHeap.id = drvArenaId; + nwmInit.drvHeap.handle = drvHeapHandle; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = wpaArenaId; + nwmInit.wpaHeap.handle = wpaHeapHandle; + + /* 新無線初期化(ランチャー専用) */ + NWMSP_InitForLauncher(&nwmInit); + +} +#include + +#include +/*---------------------------------------------------------------------------* + Name: InitializeCdc + Description: CDCライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCdc(void) +{ + u32 spiLockId; + + // CODECアクセス用のSPIロックIDを取得する + spiLockId = (u32)OS_GetLockID(); + if (spiLockId == OS_LOCK_ID_ERROR) + { + OS_Warning("OS_GetLockID failed.\n"); + } + + SPI_Lock(spiLockId); // CODEC用SPI排他ロック + CDC_InitForFirstBoot(); // ※ランチャー特殊処理。 + SPI_Unlock(spiLockId); // CODEC用SPI排他ロック + + OS_Sleep(50); // CDC_InitForFirstBootでのPowerOnTime+デポップ期間 + + SPI_Lock(spiLockId); // CODEC用SPI排他ロック + CDC_DisableExternalDepop(); // 外部デポップ回路を無効にします + SPI_Unlock(spiLockId); // CODEC用SPI排他ロック +} +#include + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystem(u8 memType) +{ + + OSHeapHandle hh; + +#ifdef SDK_TWLHYB + if( OS_IsRunOnTwl() == TRUE) + { + hh = InitializeAllocateSystemCoreEx(memType); /* Hybrid を TWL で動作させる */ + } + else +#endif + { + hh = InitializeAllocateSystemCore(memType); /* Hybrid を DS で動作させる or Limited */ + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystemCore + Description: メモリ割当てシステムを初期化する。 + Hybrid を DS で動作させた場合、Limited を TWL で動作させた場合に動作 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystemCore(u8 memType) +{ + OSHeapHandle hh; + + /* MAIN */ + if(memType == MEM_TYPE_MAIN) + { + { + void* lo = (void*)OS_GetSubPrivArenaLo(); + void* hi = (void*)OS_GetSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + } + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_MAIN_SUBPRIV, hh); + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + #ifdef SDK_TWLLTD + { + if ((ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE) > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE); + } + } + #endif + OS_TPrintf("ARM7: MAIN heap size is %d\n", heapSize); + } + } + + /* WRAM */ + if( memType == MEM_TYPE_WRAM) + { + { + void* lo = (void*)OS_GetWramSubPrivArenaLo(); + void* hi = (void*)OS_GetWramSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + } + + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d\n", heapSize); + } + } + return hh; +} + +#ifdef SDK_TWLHYB +#include +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystemCoreEx + Description: メモリ割当てシステムを初期化する。 + Hybrid を TWL で動作させた場合に動作 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystemCoreEx(u8 memType) +{ + OSHeapHandle hh; + + if(memType == MEM_TYPE_MAIN) + { + { + void* basicLo = (void*)OS_GetSubPrivArenaLo(); + void* basicHi = (void*)OS_GetSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDMAIN_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_MAIN_MEM_SUB, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: MAIN arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: MAIN arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: MAIN arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: MAIN arena extraHi = %p\n", extraHi); +#endif + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to create MAIN heap.\n"); + } + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + OS_TPrintf("ARM7: MAIN heap size is %d (before AddToHead)\n", heapSize); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_MAIN_SUBPRIV, hh, extraLo, extraHi); + } + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_MAIN_SUBPRIV, hh); + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + if ((ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE) > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE); + } + OS_TPrintf("ARM7: MAIN heap size is %d\n", heapSize); + } + } + + if(memType == MEM_TYPE_WRAM) + { + { + void* basicLo = (void*)OS_GetWramSubPrivArenaLo(); + void* basicHi = (void*)OS_GetWramSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDWRAM_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_WRAM_A_HYB_END, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: WRAM arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: WRAM arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: WRAM arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: WRAM arena extraHi = %p\n", extraHi); +#endif + + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d (before AddToHeap)\n", heapSize); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_WRAM_SUBPRIV, hh, extraLo, extraHi); + } + + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d\n", heapSize); + } + } + + return hh; +} +#include +#endif + +#ifdef WM_PRECALC_ALLOWEDCHANNEL +extern u16 WMSP_GetAllowedChannel(u16 bitField); +#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + // ※hyenaでは、NITRO本体設定データはリードしない。 + + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } + +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +} + +/*---------------------------------------------------------------------------* + Name: AdjustVolume + + Description: 32段階のボリュームを8段階に量子化する + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void AdjustVolume(void) +{ + u8 volume = MCU_GetVolume(); + u8 adjust; + if ( volume < 2 ) + { + adjust = 0; + } + else if ( volume < 5 ) + { + adjust = 2; + } + else if ( volume < 9 ) + { + adjust = 6; + } + else if ( volume < 14 ) + { + adjust = 11; + } + else if ( volume < 19 ) + { + adjust = 16; + } + else if ( volume < 24 ) + { + adjust = 21; + } + else if ( volume < 29 ) + { + adjust = 26; + } + else + { + adjust = 31; + } + OS_TPrintf("Current volume: %d.\n", volume); + if ( volume != adjust ) + { + OS_TPrintf("Volume adjusts to %d.\n", adjust); + MCU_SetVolume(adjust); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/components/hyena.TWL/wram_regs/Makefile b/build/components/hyena.TWL/wram_regs/Makefile new file mode 100644 index 00000000..d8f67eab --- /dev/null +++ b/build/components/hyena.TWL/wram_regs/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - nandfirm-ds-launcher +# File: Makefile +# +# Copyright 2007 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. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/components/hyena.TWL/wram_regs/wram_regs.c b/build/components/hyena.TWL/wram_regs/wram_regs.c new file mode 100644 index 00000000..37d2bf51 --- /dev/null +++ b/build/components/hyena.TWL/wram_regs/wram_regs.c @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - wram_regs + File: wram_regs.c + + Copyright 2007 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:: 2007-12-11#$ + $Rev: 2990 $ + $Author: nakasima $ + *---------------------------------------------------------------------------*/ +#include + +#define HW_HYENA_WRAM_A_OFS (HW_WRAM_A_LTD - HW_WRAM_BASE) +#define HW_HYENA_WRAM_A_OFS_END (HW_HYENA_WRAM_A_OFS + HW_WRAM_A_SIZE) +#define HW_HYENA_WRAM_B_OFS (HW_WRAM_B - HW_WRAM_BASE) +#define HW_HYENA_WRAM_B_OFS_END (HW_HYENA_WRAM_B_OFS + HW_WRAM_B_SIZE * 2) +#define HW_HYENA_WRAM_C_OFS (HW_WRAM_C - HW_WRAM_BASE) +#define HW_HYENA_WRAM_C_OFS_END (HW_HYENA_WRAM_C_OFS + HW_WRAM_C_SIZE) + +// MAP_TS_LTD for hyena +// WRAM-A Lock:ON, Master:ARM7, Enable:Slot0-3(256Kbytes), Address(7):0x037c0000-0x037fffff, Address(9):None +// WRAM-B Lock:ON, Master:ARM7, Enable:Slot4-7(128Kbytes), Address(7):0x03760000-0x0377ffff, Address(9):None +// Address(7):0x037a0000-0x037bffff, Address(9):None +// WRAM-B Lock:OFF, Master:ARM9, Enable:Slot0-3(128Kbytes), Address(7):0x03740000-0x0375ffff, Address(9):0x03740000-0x0375ffff +// Address(7):0x03780000-0x0379ffff, Address(9):0x03780000-0x0379ffff +// WRAM-C Lock:OFF, Msster:ARM9, Enable:Slot0-7(256Kbytes), Address(7):0x03700000-0x0373ffff, Address(9):0x03700000-0x0373ffff +// WRAM-0 Master:ARM9, (16Kbytes), Address(7):0x03040000-0x03043fff, Address(9):0x03040000-0x03043fff +// WRAM-1 Master:ARM9, (16Kbytes), Address(7):0x03044000-0x03047fff, Address(9):0x03044000-0x03047fff + +// MAP_TS_LTD original +// WRAM-A Lock:ON, Master:ARM7, Enable:Slot0-3(256Kbytes), Address(7):0x037c0000-0x037fffff, Address(9):None +// WRAM-B Lock:OFF, Master:ARM9, Enable:Slot0-7(256Kbytes), Address(7):0x03740000-0x037bffff, Address(9):0x03740000-0x037bffff +// WRAM-C Lock:OFF, Msster:ARM9, Enable:Slot0-7(256Kbytes), Address(7):0x03700000-0x0373ffff, Address(9):0x03700000-0x0373ffff +// WRAM-0 Master:ARM9, (16Kbytes), Address(7):0x03040000-0x03043fff, Address(9):0x03040000-0x03043fff +// WRAM-1 Master:ARM9, (16Kbytes), Address(7):0x03044000-0x03047fff, Address(9):0x03044000-0x03047fff + +u32 HYENA_WramReg[0x30/sizeof(u32)] = +{ + // ARM9 + + // WRAM-A + REG_MI_MBK1_FIELD( + TRUE, MI_WRAM_OFFSET_192KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_128KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_64KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_0KB/2, MI_WRAM_ARM7 + ), + // WRAM-B + REG_MI_MBK2_FIELD( + TRUE, MI_WRAM_OFFSET_96KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_64KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_32KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_0KB, MI_WRAM_ARM9 + ), + REG_MI_MBK3_FIELD( + TRUE, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 + ), + // WRAM-C + REG_MI_MBK4_FIELD( + TRUE, MI_WRAM_OFFSET_96KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_64KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_32KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_0KB, MI_WRAM_ARM9 + ), + REG_MI_MBK5_FIELD( + TRUE, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM9 + ), + + REG_MI_MBK6_FIELD( NULL >> 16, + MI_WRAM_IMAGE_256KB, + NULL >> 16 + ), + REG_MI_MBK7_FIELD( HW_HYENA_WRAM_B_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + HW_HYENA_WRAM_B_OFS >> 15 + ), + REG_MI_MBK8_FIELD( HW_HYENA_WRAM_C_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + HW_HYENA_WRAM_C_OFS >> 15 + ), + + // ARM7 + REG_MI_MBK6_FIELD( HW_HYENA_WRAM_A_OFS_END >> 16, + MI_WRAM_IMAGE_256KB, + HW_HYENA_WRAM_A_OFS >> 16 + ), + REG_MI_MBK7_FIELD( HW_HYENA_WRAM_B_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + HW_HYENA_WRAM_B_OFS >> 15 + ), + REG_MI_MBK8_FIELD( HW_HYENA_WRAM_C_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + HW_HYENA_WRAM_C_OFS >> 15 + ), + + // WRAM Lock + (u32)( + (0x0F << 0) | + (0xF0 << 8) | + (0x00 << 16) | + + // WRAM-0/1 + (0 << 24) | + + // VRAM-C + (7 << 26) | + // VRAM-D + (7 << 29) + ), +}; + diff --git a/build/components/jackal.TWL/Makefile b/build/components/jackal.TWL/Makefile new file mode 100644 index 00000000..d2c7b47a --- /dev/null +++ b/build/components/jackal.TWL/Makefile @@ -0,0 +1,132 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - components - jackal.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +# Main memory にコードを退避させたathdrvを使用。(for test) +TMP_WL_MAIN ?= FALSE + +TARGET_FIRM = SYSTEMMENU +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +FIRM_LIBSUFFIX = .firm$(ARCHGEN_TYPE)$(CODEGEN_ARCH) + +#---------------------------------------------------------------------------- + +SUBDIRS = $(SYSMENU_ROOT)/build/libraries/aes \ + wram_regs + +HYENA_SRCDIR = ../hyena.TWL/src +SRCS = $(HYENA_SRCDIR)/crt0.LTD.c \ + $(HYENA_SRCDIR)/main.c \ + $(HYENA_SRCDIR)/initScfg.c + +TARGET_NAME = jackal + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME)$(CODEGEN_ARCH).lsf +LCFILE_TEMPLATE = $(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/armadillo.TWL/armadillo.response.template + +CRT0_O = $(OBJDIR)/crt0.LTD.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# crt0.o 、 libpm_sp および libnwm_sp は、ローカルでビルドしたものを使用するので、除外する。 +ifeq ($(TMP_WL_MAIN), TRUE) +GLIBRARIES := $(filter-out $(CRT0_O) libpm_sp$(TWL_LIBSUFFIX).a libnwm_sp$(TWL_LIBSUFFIX).a libathdrv_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) +else +GLIBRARIES := $(filter-out $(CRT0_O) libpm_sp$(TWL_LIBSUFFIX).a libnwm_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) +endif + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA \ + -DSDK_NOINIT \ + -DSDK_SYSMENU_BUILD + +MAKELCF_FLAGS += -DADDRESS_FLXMAIN='0x02280200' \ + -DADDRESS_BOOTCORE='0x0380f000' \ + -DCRT0_O='$(CRT0_O)' \ + -DFIRM_LIBSUFFIX='$(FIRM_LIBSUFFIX)' + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +#-------------------------------- +# install target +#-------------------------------- +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ + $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/spi/ARM7/pm/include \ + $(ROOT)/build/libraries/init/common/include \ + $(ROOT)/build/libraries/reboot/common/include \ + $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include + +SYSMENU_LIBS = \ + libsysmenu_sp$(TWL_LIBSUFFIX).a \ + libsysmmcu_sp$(TWL_LIBSUFFIX).a \ + libboot_sp$(TWL_LIBSUFFIX).a \ + libds_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libdht_sp$(TWL_LIBSUFFIX).a \ + libpm_sp.SYSMENU$(TWL_LIBSUFFIX).a \ + libnwm_sp.SYSMENU$(TWL_LIBSUFFIX).a + +ifeq ($(TMP_WL_MAIN), TRUE) +SYSMENU_LIBS += \ + libathdrv_sp.SYSMENU$(TWL_LIBSUFFIX).a +endif + +SDK_APPEND_LIBS = \ + libwl_sp$(TWL_LIBSUFFIX).a \ + libaes_sp$(FIRM_LIBSUFFIX).a \ + libsea_sp$(TWL_LIBSUFFIX).a \ + libreboot_sp$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +LLIBRARY_DIRS += ./ + +ifeq ($(TMP_WL_MAIN), TRUE) +LLIBRARY_DIRS += $(SYSMENU_ROOT)/lib/TwlWireless/$(TWL_LIBTYPE) +endif + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/components/jackal.TWL/jackal.lcf.template b/build/components/jackal.TWL/jackal.lcf.template new file mode 100644 index 00000000..6ae1bd6b --- /dev/null +++ b/build/components/jackal.TWL/jackal.lcf.template @@ -0,0 +1,400 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lcf.template +# +# 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + check.WORKRAM (RWX) : ORIGIN = 0x03740000, LENGTH = 0xd0000 > workram.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + + } > binary.STATIC_FOOTER + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + } > F + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD_TOP_START = 0x02f00000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_BSS_END = 0x03740000; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..START =.; + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + SDK_LTDAUTOLOAD_BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + SDK_MOUNT_INFO_TABLE = SDK_LTDAUTOLOAD_BSS_END; + SDK_LTDAUTOLOAD_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW SDK_MOUNT_INFO_TABLE; # address of the FS mount information table + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = 0x02ffc000; # メインメモリアリーナはサイズ 0 + SDK_SEA_KEY_STORE = SDK_LTDAUTOLOAD_BSS_END; + SDK_WRAM_ARENA_LO = SDK_LTDAUTOLOAD_BSS_END + 0x40; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = SDK_WRAM_ARENA_LO + 0x80 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM +} diff --git a/build/components/jackal.TWL/jackal.lsf b/build/components/jackal.TWL/jackal.lsf new file mode 100644 index 00000000..1d87ac44 --- /dev/null +++ b/build/components/jackal.TWL/jackal.lsf @@ -0,0 +1,106 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address $(ADDRESS_FLXMAIN) + StackSize 1024 1024 + + Library $(CRT0_O) + Object $(OBJDIR)/initScfg.o +# Library libwpa_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a (.text) + Library libwm_sp$(LIBSUFFIX).a (.rodata) + Library libwm_sp$(LIBSUFFIX).a (.data) + Library libmic_sp$(LIBSUFFIX).a (.text) + Library libmic_sp$(LIBSUFFIX).a (.rodata) + Library libmic_sp$(LIBSUFFIX).a (.data) + Library libmicex_sp$(LIBSUFFIX).a (.text) + Library libmicex_sp$(LIBSUFFIX).a (.rodata) + Library libmicex_sp$(LIBSUFFIX).a (.data) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03758000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp.SYSMENU$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + Library libnwm_sp.SYSMENU$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a (.bss) + Library libmic_sp$(LIBSUFFIX).a (.bss) + Library libmicex_sp$(LIBSUFFIX).a (.bss) + + Library libboot_sp$(LIBSUFFIX).a + Library libreboot_sp$(LIBSUFFIX).a + Library libhotsw_sp$(LIBSUFFIX).a + Library libreloc_info_sp$(LIBSUFFIX).a + Library libsysmenu_sp$(LIBSUFFIX).a + Library libsysmmcu_sp$(LIBSUFFIX).a + Library libds_sp$(LIBSUFFIX).a + Library libaes_sp$(FIRM_LIBSUFFIX).a + Library libdht_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} + +# BootROMの鍵データが0x0380c400〜にあるので、jackalのWRAM配置の上限はその値になることに注意。 diff --git a/build/components/jackal.TWL/jackal.thumb.lsf b/build/components/jackal.TWL/jackal.thumb.lsf new file mode 100644 index 00000000..ba9cde6e --- /dev/null +++ b/build/components/jackal.TWL/jackal.thumb.lsf @@ -0,0 +1,107 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2008-07-24#$ +# $Rev: 1974 $ +# $Author: yosiokat $ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address $(ADDRESS_FLXMAIN) + StackSize 1024 1024 + + Library $(CRT0_O) + Object $(OBJDIR)/initScfg.o +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03758000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp.SYSMENU$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + Library libnwm_sp.SYSMENU$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a (.bss) + Library libmic_sp$(LIBSUFFIX).a (.bss) + Library libmicex_sp$(LIBSUFFIX).a (.bss) + + Library libboot_sp$(LIBSUFFIX).a + Library libreboot_sp$(LIBSUFFIX).a + Library libhotsw_sp$(LIBSUFFIX).a + Library libreloc_info_sp$(LIBSUFFIX).a + Library libsysmenu_sp$(LIBSUFFIX).a + Library libsysmmcu_sp$(LIBSUFFIX).a + Library libds_sp$(LIBSUFFIX).a + Library libaes_sp$(FIRM_LIBSUFFIX).a + Library libdht_sp$(LIBSUFFIX).a + +# Library libwpa_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a (.text) + Library libwm_sp$(LIBSUFFIX).a (.rodata) + Library libwm_sp$(LIBSUFFIX).a (.data) + Library libmic_sp$(LIBSUFFIX).a (.text) + Library libmic_sp$(LIBSUFFIX).a (.rodata) + Library libmic_sp$(LIBSUFFIX).a (.data) + Library libmicex_sp$(LIBSUFFIX).a (.text) + Library libmicex_sp$(LIBSUFFIX).a (.rodata) + Library libmicex_sp$(LIBSUFFIX).a (.data) + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} + +# BootROMの鍵データが0x0380c400〜にあるので、jackalのWRAM配置の上限はその値になることに注意。 diff --git a/build/components/jackal.TWL/wram_regs/Makefile b/build/components/jackal.TWL/wram_regs/Makefile new file mode 100644 index 00000000..d8f67eab --- /dev/null +++ b/build/components/jackal.TWL/wram_regs/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - nandfirm-ds-launcher +# File: Makefile +# +# Copyright 2007 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. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/components/jackal.TWL/wram_regs/wram_regs.c b/build/components/jackal.TWL/wram_regs/wram_regs.c new file mode 100644 index 00000000..31adc841 --- /dev/null +++ b/build/components/jackal.TWL/wram_regs/wram_regs.c @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - wram_regs + File: wram_regs.c + + Copyright 2007 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 + +#define COMPONENT_WRAM_A_OFS (HW_WRAM_A_LTD - HW_WRAM_BASE) +#define COMPONENT_WRAM_A_OFS_END (COMPONENT_WRAM_A_OFS + HW_WRAM_A_SIZE) +#define COMPONENT_WRAM_B_OFS (COMPONENT_WRAM_A_OFS - HW_WRAM_B_SIZE) +#define COMPONENT_WRAM_B_OFS_END (COMPONENT_WRAM_A_OFS) +#define COMPONENT_WRAM_C_OFS (COMPONENT_WRAM_B_OFS - HW_WRAM_C_SIZE * 2) +#define COMPONENT_WRAM_C_OFS_END (COMPONENT_WRAM_B_OFS) + +// MAP_TS_LTD for jackal +// WRAM-A Lock:ON, Master:ARM7, Enable:Slot0-3(256Kbytes), Address(7):0x037c0000-0x037fffff, Address(9):None +// WRAM-B Lock:ON, Master:ARM7, Enable:Slot5-7(256Kbytes), Address(7):0x03780000-0x037bffff, Address(9):None +// WRAM-C Lock:ON, Master:ARM7, Enable:Slot3-7(160Kbytes), Address(7):0x03758000-0x037bffff, Address(9):None +// WRAM-C Lock:OFF, Msster:ARM9, Enable:Slot0-2( 96Kbytes), Address(7):0x03700000-0x03717fff, Address(9):0x03700000-0x0317ffff +// WRAM-0 Master:ARM9, (16Kbytes), Address(7):0x03040000-0x03043fff, Address(9):0x03040000-0x03043fff +// WRAM-1 Master:ARM9, (16Kbytes), Address(7):0x03044000-0x03047fff, Address(9):0x03044000-0x03047fff + +// MAP_TS_LTD original +// WRAM-A Lock:ON, Master:ARM7, Enable:Slot0-3(256Kbytes), Address(7):0x037c0000-0x037fffff, Address(9):None +// WRAM-B Lock:OFF, Master:ARM9, Enable:Slot0-7(256Kbytes), Address(7):0x03740000-0x037bffff, Address(9):0x03740000-0x037bffff +// WRAM-C Lock:OFF, Msster:ARM9, Enable:Slot0-7(256Kbytes), Address(7):0x03700000-0x0373ffff, Address(9):0x03700000-0x0373ffff +// WRAM-0 Master:ARM9, (16Kbytes), Address(7):0x03040000-0x03043fff, Address(9):0x03040000-0x03043fff +// WRAM-1 Master:ARM9, (16Kbytes), Address(7):0x03044000-0x03047fff, Address(9):0x03044000-0x03047fff + +u32 HYENA_WramReg[0x30/sizeof(u32)] = +{ + // ARM9 + + // WRAM-A + REG_MI_MBK1_FIELD( + TRUE, MI_WRAM_OFFSET_192KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_128KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_64KB/2, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_0KB/2, MI_WRAM_ARM7 + ), + // WRAM-B + REG_MI_MBK2_FIELD( + TRUE, MI_WRAM_OFFSET_96KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_64KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_32KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_0KB, MI_WRAM_ARM7 + ), + REG_MI_MBK3_FIELD( + TRUE, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 + ), + // WRAM-C + REG_MI_MBK4_FIELD( + TRUE, MI_WRAM_OFFSET_96KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_64KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_32KB, MI_WRAM_ARM9, + TRUE, MI_WRAM_OFFSET_0KB, MI_WRAM_ARM9 + ), + REG_MI_MBK5_FIELD( + TRUE, MI_WRAM_OFFSET_224KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_192KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_160KB, MI_WRAM_ARM7, + TRUE, MI_WRAM_OFFSET_128KB, MI_WRAM_ARM7 + ), + + REG_MI_MBK6_FIELD( NULL >> 16, + MI_WRAM_IMAGE_256KB, + NULL >> 16 + ), + REG_MI_MBK7_FIELD( NULL >> 15, + MI_WRAM_IMAGE_256KB, + NULL >> 15 + ), + REG_MI_MBK8_FIELD( ( COMPONENT_WRAM_C_OFS_END + 0x18000 ) >> 15, + MI_WRAM_IMAGE_128KB, + COMPONENT_WRAM_C_OFS >> 15 + ), + + // ARM7 + REG_MI_MBK6_FIELD( COMPONENT_WRAM_A_OFS_END >> 16, + MI_WRAM_IMAGE_256KB, + COMPONENT_WRAM_A_OFS >> 16 + ), + REG_MI_MBK7_FIELD( COMPONENT_WRAM_B_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + COMPONENT_WRAM_B_OFS >> 15 + ), + REG_MI_MBK8_FIELD( COMPONENT_WRAM_C_OFS_END >> 15, + MI_WRAM_IMAGE_256KB, + COMPONENT_WRAM_C_OFS >> 15 + ), + + // WRAM Lock + (u32)( + (0x0F << 0) | + (0xFF << 8) | + (0xF8 << 16) | + + // WRAM-0/1 + (0 << 24) | + + // VRAM-C + (7 << 26) | + // VRAM-D + (7 << 29) + ), +}; + diff --git a/build/debugsoft/AppJumpChecker/Makefile b/build/debugsoft/AppJumpChecker/Makefile new file mode 100644 index 00000000..a2022b49 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/Makefile @@ -0,0 +1,80 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - debugsoft - ApplicationJump +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + +TWL_NANDAPP = TRUE +TARGET_BIN = appJumpChecker.tad + +INCDIR = ./include $(ROOT)/build/libraries/os/common/include +SRCDIR = ./src + +SRCS = main.c screen.c font.c common.c + +LLIBRARIES += libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a + +#---------------------------------- +# sea を使用 + +LLIBRARIES += libsea$(TWL_LIBSUFFIX).a + +#---------------------------------- +# nam を使用 + +LLIBRARIES += libnam$(TWL_LIBSUFFIX).a + + +ROM_SPEC = appJumpChecker.autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf + +ROM_SPEC_PARAM = MakerCode=01 \ + NANDAccess=TRUE \ + Media=NAND \ + Secure=TRUE \ + BannerFile=appjumpchecker.bnr \ + PermitLandingNormalJump=TRUE \ + WramMapping=MAP_TS_SCR + +# GameCode=456A \ + +COMPONENT_NAME = armadillo +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/$(COMPONENT_NAME)/$(TWL_BUILDTYPE_ARM7)/$(COMPONENT_NAME) +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +MAKETAD_OPTION := -s + +do-build: $(TARGETS) + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = ./roms + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/AppJumpChecker/appjumpchecker.bnr b/build/debugsoft/AppJumpChecker/appjumpchecker.bnr new file mode 100644 index 00000000..de53082b Binary files /dev/null and b/build/debugsoft/AppJumpChecker/appjumpchecker.bnr differ diff --git a/build/debugsoft/AppJumpChecker/include/common.h b/build/debugsoft/AppJumpChecker/include/common.h new file mode 100644 index 00000000..a0d79755 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/include/common.h @@ -0,0 +1,67 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 COMMON_H_ +#define COMMON_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/include/font.h b/build/debugsoft/AppJumpChecker/include/font.h new file mode 100644 index 00000000..37699026 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.h + + Copyright 2007 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/include/screen.h b/build/debugsoft/AppJumpChecker/include/screen.h new file mode 100644 index 00000000..0d08dffd --- /dev/null +++ b/build/debugsoft/AppJumpChecker/include/screen.h @@ -0,0 +1,49 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.h + + Copyright 2007 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/src/common.c b/build/debugsoft/AppJumpChecker/src/common.c new file mode 100644 index 00000000..b1883893 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/src/common.c @@ -0,0 +1,153 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitHeap(void) +{ + void* tempLo; + OSHeapHandle hh; + + // メインメモリ上のアリーナにヒープをひとつ作成 + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + // ヒープ作成に失敗した場合は異常終了 + OS_Panic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/src/font.c b/build/debugsoft/AppJumpChecker/src/font.c new file mode 100644 index 00000000..2111ca07 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005,2006 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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/src/main.c b/build/debugsoft/AppJumpChecker/src/main.c new file mode 100644 index 00000000..7a7e2578 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/src/main.c @@ -0,0 +1,493 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-2 + File: main.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 "application_jump_private.h" +#include "common.h" +#include "screen.h" + +#define DMA_NO_FS 1 +#define TITLE_NUM_CUL 18 +#define TITLE_NUM_PAGE (TITLE_NUM_CUL * 2) + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +// インストールされている NAND アプリの数 +static s32 gNandAppNum; + +// カーソル位置 +static s32 gCurPos = 0; + +static BOOL gIsExistCard = FALSE; + +// エラー表示用バッファ +static char gErrBuf[33]; + +// エラー表示時間計測用 +static OSTick gErrTick = 0; + +typedef struct DataStruct +{ + NAMTitleId id; + BOOL normaljmp_flag; +} DataStruct; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void PrintErrMsg(const char* msg); + +static BOOL GetDataStruct(DataStruct* list); +static void DrawScene(DataStruct* list); + +static void ConvertTitleIdLo(u8* code, u8* titleid_lo); +static void ConvertGameCode(u8* code, u32 game_code); +static void ConvertInitialCode(u8* code, u32 titleid_lo); + +static void* AllocForNAM(u32 size); +static void FreeForNAM(void* ptr); + +/*---------------------------------------------------------------------------*/ + +static void PrintErrMsg(const char* msg) +{ + if ( STD_StrLen(msg) > 32 ) + { + OS_Warning("err msg is too long."); + return; + } + + STD_StrCpy( gErrBuf, msg ); + gErrTick = OS_GetTick(); +} + +void TwlMain(void) +{ + DataStruct dataList[TITLE_NUM_PAGE]; + + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + FS_Init(DMA_NO_FS); + NAM_Init(AllocForNAM, FreeForNAM); + + ClearScreen(); + + // NAND にインポートされているNAND アプリの数を取得する + if ( (gNandAppNum = NAM_GetNumTitles()) < 0) + { + OS_Panic("NAM_GetNumTitles() failed."); + } + + + + // キー入力情報取得の空呼び出し(IPL での A ボタン押下対策) + ReadKey(&gKey); + + // 情報の取得 + if ( !GetDataStruct(dataList) ) + { + PrintErrMsg("Failed to get dataList."); + } + + while(TRUE) + { + // キー入力情報取得 + ReadKey(&gKey); + + // カーソルの移動 + if (gKey.trg & PAD_KEY_DOWN) + { + gCurPos++; + if ( gCurPos >= ( gNandAppNum < TITLE_NUM_PAGE ? gNandAppNum : TITLE_NUM_PAGE) ) + { + gCurPos = 0; + } + } + if (gKey.trg & PAD_KEY_UP) + { + if ( gCurPos == 0) + { + if ( gNandAppNum < TITLE_NUM_PAGE ) + { + gCurPos = gNandAppNum - 1; + } + else + { + gCurPos = TITLE_NUM_PAGE - 1; + } + } + else + { + gCurPos--; + } + } + + // 列の移動 + if ( (gKey.trg & PAD_KEY_RIGHT || gKey.trg & PAD_KEY_LEFT) && gNandAppNum >= TITLE_NUM_CUL ) + { + if ( gCurPos > TITLE_NUM_CUL ) + { + if ( gCurPos - TITLE_NUM_CUL < gNandAppNum ) + { + gCurPos -= TITLE_NUM_CUL; + } + } + else + { + if ( gCurPos + TITLE_NUM_CUL < gNandAppNum ) + { + gCurPos += TITLE_NUM_CUL; + } + } + } + + // アプリジャンプの実行 + if (gKey.trg & PAD_BUTTON_A) + { + OS_DoApplicationJump(dataList[gCurPos].id, OS_APP_JUMP_NORMAL); + // 成功時はここ以降は実行されない + PrintErrMsg("Failed to App Jump."); + } + // 内部関数を使用したアプリジャンプの実行 + if (gKey.trg & PAD_BUTTON_B) + { + LauncherBootFlags flag; + + flag.bootType = LAUNCHER_BOOTTYPE_NAND; + flag.isValid = TRUE; + flag.isLogoSkip = TRUE; + flag.isInitialShortcutSkip = FALSE; + flag.isAppLoadCompleted = FALSE; + flag.isAppRelocate = FALSE; + flag.rsv = 0; + OS_SetLauncherParamAndResetHardware(dataList[gCurPos].id, &flag); + // 成功時はここ以降は実行されない + PrintErrMsg("Failed to App Jump(force)."); + } + + // カードアプリへのアプリジャンプ試行 + if (gKey.trg & PAD_BUTTON_Y) + { + CARDRomHeader* rh; +// u64 titleId; + rh = (CARDRomHeader*)CARD_GetRomHeader(); + + // TWL アプリの場合 + if ( rh->product_id & 0x03 || rh->product_id & 0x02 ) // 刺さっているカードのロムが TWLアプリ + { + ROM_Header* rh2; + rh2 = (ROM_Header*)HW_TWL_CARD_ROM_HEADER_BUF; + + OS_DoApplicationJump( rh2->s.titleID, OS_APP_JUMP_NORMAL); + } + +// titleId = (0x00030000 << 32) | rh->game_code; + // NITRO カードアプリなら失敗(特殊なものでない限り TitleID が設定されていないため) + + PrintErrMsg("Failed to App Jump."); + } + + // エラー表示判定 + if ( OS_TicksToSeconds(OS_GetTick() - gErrTick) > 3 ) + { + PrintErrMsg(" "); + } + + // 画面描画 + DrawScene(dataList); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // 画面クリア + ClearScreen(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +static BOOL GetDataStruct(DataStruct* list) +{ + // 36個分のタイトルIDリストバッファ + NAMTitleId titleIdList[TITLE_NUM_PAGE]; + s32 i; + FSFile fp; + + if ( NAM_GetTitleList(titleIdList, TITLE_NUM_PAGE) != NAM_OK ) + { + PrintErrMsg("NAM_GetTitleList failed."); + return FALSE; + } + + // データリストの作成(1ページ分) + for ( i=0; i= gNandAppNum ) + { + break; + } + + // TitleID の格納 + list->id = titleIdList[i]; + + // ノーマルジャンプをされるのを許可するかを表すフラグの取得 + // TitleID を見て、タイトル種別がデータタイトルならば + // そもそも ROMヘッダが存在しない、アプリジャンプをする必要もない + if ( !NAM_IsDataTitle(list->id) ) + { + // アプリ本体へのパスを取得 + if ( NAM_GetTitleBootContentPath(pathbuf, list->id) != NAM_OK ) + { + PrintErrMsg("GetContentPath failed."); + return FALSE; + } + + // アプリのファイルオープン + FS_InitFile(&fp); + if ( !FS_OpenFileEx(&fp, pathbuf, FS_FILEMODE_R) ) + { + // 失敗時はエラーコード出力で終了 + PrintErrMsg("FS_OpenFileEx failed."); + return FALSE; + } + + if ( -1 == FS_ReadFile(&fp, &rh, sizeof(ROM_Header_Short) )) + { + PrintErrMsg("FS_ReadFile failed."); + return FALSE; + } + + list->normaljmp_flag = rh.permit_landing_normal_jump; + + FS_CloseFile(&fp); + } + else + { + list->normaljmp_flag = FALSE; + } + } + + PrintErrMsg(" "); + return TRUE; +} + +static void DrawScene(DataStruct* list) +{ + s32 i; + u8 init_code[5], titleid_lo[5]; + + // 上画面 + PutMainScreen( 0, 1, 0xff, " ------ App Jump Checker ------ "); + + PutMainScreen( 0, 3, 0xff, " total app : %d", gNandAppNum); + + PutMainScreen( 0, 5, 0xff, " ------------------------------ "); + + PutMainScreen( 0, 7, 0xff, " A : try App Jump (to NAND)" ); + PutMainScreen( 0, 8, 0xfe, " B : try App Jump (force) " ); + PutMainScreen( 0, 9, 0xff, " Y : try App Jump (to CARD)" ); + PutMainScreen( 0, 11, 0xff, " UP ,DOWN ,LEFT ,RIGHT KEY :" ); + PutMainScreen( 0, 12, 0xff, " move * (cursor) "); + PutMainScreen( 0, 14, 0xff, " ------------------------------ "); + + PutMainScreen( 0, 16, 0xf1, "%s", gErrBuf); + + // 下画面 + PutSubScreen( 0, 0, 0xf4, " NAND ( max 36 )"); + PutSubScreen( 0, 1, 0xff, "--- ID ---------------- ID -------"); + + + // 下画面に1行ずつ、カーソル用スペース、イニシャルコード、ノーマルジャンプ可否フラグを表示 + for ( i=0; i < TITLE_NUM_PAGE; i++, list++) + { + // そもそも NAND アプリの数が 1ページにも満たない場合は途中で終了する + if ( i >= gNandAppNum ) + { + break; + } + + ConvertInitialCode(init_code, NAM_GetTitleIdLo(list->id)); + + if ( list->normaljmp_flag ) + { + PutSubScreen( (i >= TITLE_NUM_CUL ? 18 : 0), 2 + (i >= TITLE_NUM_CUL ? i-18 : i), 0xf2, " %s : o", init_code ); + } + else + { + PutSubScreen( (i >= TITLE_NUM_CUL ? 18 : 0), 2 + (i >= TITLE_NUM_CUL ? i-18 : i), 0xff, " %s : -", init_code ); + } + } + + // カードアプリチェック + PutSubScreen( 0, 2 + TITLE_NUM_CUL + 1, 0xf4, " CARD: Init. Code, TitleID_Lo"); + { + CARDRomHeader* rh; + rh = (CARDRomHeader*)CARD_GetRomHeader(); + + if ( rh->game_code != 0 ) + { + // イニシャルコードの取得 + if ( rh->product_id & 0x03 || rh->product_id & 0x02 ) // 刺さっているカードのロムが TWLアプリ + { + ROM_Header* rh2; + rh2 = (ROM_Header*)HW_TWL_CARD_ROM_HEADER_BUF; + + // ROM ヘッダの拡張領域まで TitleID_Lo を見に行く + // ROM ヘッダ(共通部)のイニシャルコードは基本的に製品版に入れられる +// ConvertTitleIdLo(titleid_lo, rh2->s.titleID_Lo); + MI_CpuCopy8( rh2->s.titleID_Lo, titleid_lo, 4 ); + titleid_lo[4] = 0x00; + MI_CpuCopy8( rh2->s.game_code, init_code, 4 ); + } + else // 刺さっているカードのロムが NTRアプリ + { + // 未マスタリング状態のロムでは、ROM ヘッダ(共通部)のイニシャルコードへ + // 設定が反映されない + + // 特別に設定された NTRアプリなら TitleID_Lo が設定されている可能性があるので読み込んでみる + MI_CpuClear8( titleid_lo, 5 ); + MI_CpuCopy8( ((ROM_Header*)rh)->s.titleID_Lo, titleid_lo, 4 ); + titleid_lo[4] = 0x00; + ConvertGameCode(init_code, rh->game_code); + } + + // ノーマルジャンプを許可しているかどうかを取得 + if ( rh->reserved_A[8] & 0x01 ) + { + PutSubScreen( 0, 2 + TITLE_NUM_CUL + 2, 0xf2, " %s, %s : o", init_code, titleid_lo ); + } + else + { + PutSubScreen( 0, 2 + TITLE_NUM_CUL + 2, 0xff, " %s, %s : -", init_code, titleid_lo ); + } + } + else + { + PutSubScreen( 0, 2 + TITLE_NUM_CUL + 2, 0xfe, " not exist"); + } + + ConvertGameCode(init_code, rh->game_code); + } + + + // カーソル描画 + PutSubScreen( 1 + (gCurPos >= TITLE_NUM_CUL ? 18 : 0), 2 + (gCurPos >= TITLE_NUM_CUL ? gCurPos - 18 : gCurPos), 0xf4, "*"); +} + +static void ConvertTitleIdLo(u8* code, u8* titleid_lo) +{ + u8 tmp[5]; + s32 i; + +// for ( titleid_lo += 3, i=0 ; i<4; i++, code++, titleid_lo--) + for ( i=3; i>=0; i--, titleid_lo++ ) + { + tmp[i] = *titleid_lo; + *code = tmp[i]; + } + +// *code = tmp; + + // NULL 終端 + *code = 0x00; +} + +static void ConvertGameCode(u8* code, u32 game_code) +{ + u8 tmp[5]; + s32 i; + + ConvertInitialCode(tmp, game_code); + + for ( i=3; i>=0; i--, code++) + { + *code = tmp[i]; + } + + // NULL 文字終端 + *code = 0x00; +} + +static void ConvertInitialCode(u8* code, u32 titleid_lo) +{ + s32 i; + + for ( i=0; i<4; i++, code++) + { + *code = (u8)(titleid_lo >> (8 * (3-i))); + } + + // NULL文字終端 + *code = 0x00; +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグ47をセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static void* AllocForNAM(u32 size) +{ + void* ptr; + ptr = OS_AllocFromMain(size); + + if (ptr == NULL) + { + OS_Panic("alloc failed."); + } + + return ptr; + +} + +static void FreeForNAM(void* ptr) +{ + OS_FreeToMain(ptr); +} + + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/AppJumpChecker/src/screen.c b/build/debugsoft/AppJumpChecker/src/screen.c new file mode 100644 index 00000000..a9fec417 --- /dev/null +++ b/build/debugsoft/AppJumpChecker/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + Copyright 2007 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 "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall.a b/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall.a new file mode 100644 index 00000000..d8c3f61d Binary files /dev/null and b/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall.a differ diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall_c.bin b/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall_c.bin new file mode 100644 index 00000000..6ff82c68 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Card-anotherID/461A/libsyscall_c.bin differ diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/461A/rom_header_461a.template.sbin b/build/debugsoft/ApplicationJump/Card-anotherID/461A/rom_header_461a.template.sbin new file mode 100644 index 00000000..a7df6dae Binary files /dev/null and b/build/debugsoft/ApplicationJump/Card-anotherID/461A/rom_header_461a.template.sbin differ diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/Makefile b/build/debugsoft/ApplicationJump/Card-anotherID/Makefile new file mode 100644 index 00000000..547f36bc --- /dev/null +++ b/build/debugsoft/ApplicationJump/Card-anotherID/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL + +TARGET_BIN = appjumpTestForCard_AID.srl +INCDIR = ../include +SRCDIR = ./src ../src +SRCS = main.c screen.c font.c common.c + +ROM_SPEC = appjumptest_card.rsf + + + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/ApplicationJumpTest +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ./461A/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/appjumptest_card.rsf b/build/debugsoft/ApplicationJump/Card-anotherID/appjumptest_card.rsf new file mode 100644 index 00000000..19e70a3d --- /dev/null +++ b/build/debugsoft/ApplicationJump/Card-anotherID/appjumptest_card.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "AppJmpTestC" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ./461A/rom_header_461a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 461A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/banner/banner.bnr b/build/debugsoft/ApplicationJump/Card-anotherID/banner/banner.bnr new file mode 100644 index 00000000..0b405167 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Card-anotherID/banner/banner.bnr differ diff --git a/build/debugsoft/ApplicationJump/Card-anotherID/src/main.c b/build/debugsoft/ApplicationJump/Card-anotherID/src/main.c new file mode 100644 index 00000000..7db1eee4 --- /dev/null +++ b/build/debugsoft/ApplicationJump/Card-anotherID/src/main.c @@ -0,0 +1,313 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Card + File: main.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 "common.h" +#include "screen.h" + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +// アプリ間パラメータ +static AppParam gAppParam; +// アプリ間パラメータとして文字列をセットするかどうか +static BOOL gIsSetDelArg = TRUE; +// アプリ間パラメータとして引き渡された文字列を格納するバッファ(6つまで) +static char gStrAppParam[6][APPJUMP_STRING_LENGTH + 1] ATTRIBUTE_ALIGN(32); +// アプリ間パラメータとして引き渡された文字列の個数 +static int gArgc; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn); + +/*---------------------------------------------------------------------------*/ + +void TwlMain(void) +{ + OSDeliverArgInfo argInfo; + + int result; + int argSize =sizeof(u32); + + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // キー入力情報取得の空呼び出し(IPL での A ボタン押下対策) + ReadKey(&gKey); + + OS_InitDeliverArgInfo(&argInfo, sizeof(AppParam)); + OS_DecodeDeliverArg(); + + /* アプリ間パラメータ(バイナリデータの取得) */ + if ( OS_DELIVER_ARG_SUCCESS != (result = OS_GetBinaryFromDeliverArg( &gAppParam, &argSize, sizeof(AppParam))) ) + { + PutMainScreen(1, 16, 0xf1, "ERROR!: READ_ERROR (%d)", result); + + OS_WaitVBlankIntr(); + OS_Terminate(); + } + + /* アプリ間パラメータ(文字列)の取得 */ + if ((gArgc = OS_GetDeliverArgc()) > 0) + { + int i; + + OS_TPrintf("argc = %d\n", gArgc); + + for (i=0; i < gArgc-1 && i < 6; i++) + { + STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); + gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; + } + } + + while(TRUE) + { + int i; + + // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる + if (gAppParam.isAutoJump == 1) + { + OSTick tick = OS_GetTick(); + + PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); + PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); + PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); + do { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_START) + { + break; + } + + OS_WaitVBlankIntr(); + } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); + } + else + { + // キー入力情報取得 + ReadKey(&gKey); + } + + // 画面クリア + ClearScreen(); + + // メイン画面描画 + PutMainScreen(0, 2, 0xf4, " ****** This APP is CARD ****** "); + PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); + PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); + + for (i=0; i 0) + { + int i; + + OS_TPrintf("argc = %d\n", gArgc); + + for (i=0; i < gArgc-1 && i < 6; i++) + { + STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); + gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; + } + } + + while(TRUE) + { + int i; + + // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる + if (gAppParam.isAutoJump == 1) + { + OSTick tick = OS_GetTick(); + + PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); + PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); + PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); + do { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_START) + { + break; + } + + OS_WaitVBlankIntr(); + } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); + } + else + { + // キー入力情報取得 + ReadKey(&gKey); + } + + // 画面クリア + ClearScreen(); + + // メイン画面描画 + PutMainScreen(0, 2, 0xf4, " ****** This APP is CARD ****** "); + PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); + PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); + + for (i=0; i 0) + { + int i; + + OS_TPrintf("argc = %d\n", gArgc); + + for (i=0; i < gArgc-1 && i < 6; i++) + { + STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); + gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; + } + } + + while(TRUE) + { + int i; + + // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる + if (gAppParam.isAutoJump == 1) + { + OSTick tick = OS_GetTick(); + + PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); + PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); + PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); + do { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_START) + { + break; + } + + OS_WaitVBlankIntr(); + } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); + } + else + { + // キー入力情報取得 + ReadKey(&gKey); + } + + // 画面クリア + ClearScreen(); + + // メイン画面描画 + PutMainScreen(0, 2, 0xf4, " ****** This APP is CARD ****** "); + PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); + PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); + + for (i=0; i= JUMPTYPE_NUM ) + { + gJumpTypeForB = JUMPTYPE_RETURN; + } + } + + if (gKey.trg & PAD_BUTTON_START) + { + // 自動テストフラグをスイッチ + gAppParam.isAutoJump ^= 1; + } + + if (gKey.trg & PAD_BUTTON_A) + { + AddDeliverArg(&argInfo, FALSE); + // NAND-1 アプリへジャンプ + if( !OS_DoApplicationJump( NANDAPP1_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_Y) + { + AddDeliverArg(&argInfo, FALSE); + + // NAND-2 アプリへジャンプ + if ( !OS_DoApplicationJump( NANDAPP2_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_X || gAppParam.isAutoJump == 1) + { + AddDeliverArg(&argInfo, FALSE); + // 自分自身へジャンプ + if( !OS_DoApplicationJump( OS_GetTitleId(), OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_B) + { + AddDeliverArg(&argInfo, TRUE); + switch (gJumpTypeForB) + { + case JUMPTYPE_RETURN: + if ( !OS_ReturnToPrevApplication() ) + { + OS_TPrintf("Failed to Return Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Return Jump."); + } + break; + case JUMPTYPE_ANOTHER_CARD: + break; + case JUMPTYPE_SYSMENU: + OS_JumpToSystemMenu(); + break; + } + } + + if (gKey.trg & PAD_BUTTON_L || gKey.trg & PAD_BUTTON_R) + { + // アプリ間パラメータとして文字列を引き渡すかどうかのフラグを ON/OFF する + gIsSetDelArg = !gIsSetDelArg; + } + + // Vブランク待ち + OS_WaitVBlankIntr(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: AddDeliverArg + + Description: アプリジャンプ先へ引き渡すパラメータを追加。 + + Arguments: argInfo : + isReturn : ジャンプ元への復帰ならば TRUE + + Returns: None. + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn) +{ + int result; + char argument[APPJUMP_STRING_LENGTH + 1]; + gAppParam.jumpCount++; + + OS_InitDeliverArgInfo(argInfo, sizeof(AppParam)); + + // アプリジャンプ回数を +1 してセット + result = OS_SetBinaryToDeliverArg( &(gAppParam), sizeof(AppParam) ); + + if(result != OS_DELIVER_ARG_SUCCESS) + { + OS_Warning("Failed to Set DeliverArgument."); + } + + if (gIsSetDelArg) + { + int i; + + // 文字列をセット + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + if (isReturn) + { + STD_TSPrintf(argument, "Returned from CARD"); + } + else + { + STD_TSPrintf(argument, "Jumped from CARD"); + } + OS_SetStringToDeliverArg(argument); + + // 今まで引き渡されたパラメータ文字列を引き継がせる + for (i=0; i <= 4 && i < gArgc; i++) + { + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + STD_StrLCpy( argument, gStrAppParam[i], APPJUMP_STRING_LENGTH ); + result = OS_SetStringToDeliverArg(argument); + OS_TPrintf("arg = %s : result = %d\n", argument, result); + } + } + OS_EncodeDeliverArg(); +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/Makefile b/build/debugsoft/ApplicationJump/Makefile new file mode 100644 index 00000000..79900665 --- /dev/null +++ b/build/debugsoft/ApplicationJump/Makefile @@ -0,0 +1,38 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - debugsoft - ApplicationJump +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = Card \ + Nand-1 \ + Nand-2 \ + Card-fail \ + Card-anotherID + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall.a b/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall.a new file mode 100644 index 00000000..8a14b9aa Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall.a differ diff --git a/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall_c.bin b/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall_c.bin new file mode 100644 index 00000000..8b722c18 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-1/431A/libsyscall_c.bin differ diff --git a/build/debugsoft/ApplicationJump/Nand-1/431A/rom_header_431a.template.sbin b/build/debugsoft/ApplicationJump/Nand-1/431A/rom_header_431a.template.sbin new file mode 100644 index 00000000..ab3b2658 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-1/431A/rom_header_431a.template.sbin differ diff --git a/build/debugsoft/ApplicationJump/Nand-1/Makefile b/build/debugsoft/ApplicationJump/Nand-1/Makefile new file mode 100644 index 00000000..70780d21 --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-1/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Nand-1 +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL +TWL_NANDAPP := TRUE + +TARGET_BIN = appjumpTestForNand1.tad +INCDIR = ../include +SRCDIR = ./src ../src +SRCS = main.c screen.c font.c common.c + +ROM_SPEC = main_nand1.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/ApplicationJumpTest +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ./431A/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/ApplicationJump/Nand-1/banner/banner.bnr b/build/debugsoft/ApplicationJump/Nand-1/banner/banner.bnr new file mode 100644 index 00000000..0e57dc8b Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-1/banner/banner.bnr differ diff --git a/build/debugsoft/ApplicationJump/Nand-1/main_nand1.rsf b/build/debugsoft/ApplicationJump/Nand-1/main_nand1.rsf new file mode 100644 index 00000000..cd4a169a --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-1/main_nand1.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName AppJmpTestN1 + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ./431A/rom_header_431a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "./banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 431A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/ApplicationJump/Nand-1/src/main.c b/build/debugsoft/ApplicationJump/Nand-1/src/main.c new file mode 100644 index 00000000..1592d5df --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-1/src/main.c @@ -0,0 +1,368 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-1 + File: main.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 "common.h" +#include "screen.h" + +/*---------------------------------------------------------------------------* + 変数定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +// B ボタンジャンプ先の切りかえフラグ +static u8 gJumpTypeForB = JUMPTYPE_RETURN; +// アプリ間パラメータ +static AppParam gAppParam; +// アプリ間パラメータとして文字列をセットするかどうか +static BOOL gIsSetDelArg = TRUE; +// アプリ間パラメータとして引き渡された文字列を格納するバッファ(6つまで) +static char gStrAppParam[6][APPJUMP_STRING_LENGTH + 1] ATTRIBUTE_ALIGN(32); +// アプリ間パラメータとして引き渡された文字列の個数 +static int gArgc; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn); + +/*---------------------------------------------------------------------------*/ + +void TwlMain(void) +{ + OSDeliverArgInfo argInfo; + + int result; + int argSize =sizeof(u32); + + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // キー入力情報取得の空呼び出し(IPL での A ボタン押下対策) + ReadKey(&gKey); + + OS_InitDeliverArgInfo(&argInfo, sizeof(AppParam)); + OS_DecodeDeliverArg(); + + /* アプリ間パラメータ(バイナリデータの取得) */ + if ( OS_DELIVER_ARG_SUCCESS != (result = OS_GetBinaryFromDeliverArg( &gAppParam, &argSize, sizeof(AppParam))) ) + { + PutMainScreen(1, 16, 0xf1, "ERROR!: READ_ERROR (%d)", result); + + OS_WaitVBlankIntr(); + OS_Terminate(); + } + + /* アプリ間パラメータ(文字列)の取得 */ + if ((gArgc = OS_GetDeliverArgc()) > 0) + { + int i; + + OS_TPrintf("argc = %d\n", gArgc); + + for (i=0; i < gArgc-1 && i < 6; i++) + { + STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); + gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; + } + } + + while(TRUE) + { + int i; + + // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる + if (gAppParam.isAutoJump == 1) + { + OSTick tick = OS_GetTick(); + + PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); + PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); + PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); + do { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_START) + { + break; + } + + OS_WaitVBlankIntr(); + } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); + } + else + { + // キー入力情報取得 + ReadKey(&gKey); + } + + // 画面クリア + ClearScreen(); + + // メイン画面描画 + PutMainScreen(0, 2, 0xf5, " ***** This APP is NAND-1 ***** "); + PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); + PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); + + for (i=0; i= JUMPTYPE_NUM ) + { + gJumpTypeForB = JUMPTYPE_RETURN; + } + } + + if (gKey.trg & PAD_BUTTON_START) + { + // 自動テストフラグをスイッチ + gAppParam.isAutoJump ^= 1; + } + + if (gKey.trg & PAD_BUTTON_A) + { + AddDeliverArg(&argInfo, FALSE); + // カードアプリへジャンプ + if( !OS_DoApplicationJump( CARDAPP_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + + if (gKey.trg & PAD_BUTTON_Y) + { + AddDeliverArg(&argInfo, FALSE); + + // もう一方の NAND アプリへジャンプ + if ( !OS_DoApplicationJump( NANDAPP2_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_X || gAppParam.isAutoJump == 1) + { + AddDeliverArg(&argInfo, FALSE); + // 自分自身へジャンプ + if( !OS_DoApplicationJump( OS_GetTitleId(), OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_B) + { + AddDeliverArg(&argInfo, TRUE); + + switch (gJumpTypeForB) + { + case JUMPTYPE_RETURN: + if ( !OS_ReturnToPrevApplication() ) + { + OS_TPrintf("Failed to Return Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Return Jump."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + case JUMPTYPE_ANOTHER_CARD: + if ( !OS_DoApplicationJump(CARDAPP_ANO_TITLEID, OS_APP_JUMP_NORMAL) ) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump(ANO)."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + case JUMPTYPE_SYSMENU: + OS_JumpToSystemMenu(); + break; + case JUMPTYPE_FAIL_CARD: + if ( !OS_DoApplicationJump(CARDAPP_FAIL_TITLEID, OS_APP_JUMP_NORMAL) ) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump(FAIL)."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + } + } + + if (gKey.trg & PAD_BUTTON_L || gKey.trg & PAD_BUTTON_R) + { + gIsSetDelArg = !gIsSetDelArg; + } + + // Vブランク待ち + OS_WaitVBlankIntr(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: AddDeliverArg + + Description: アプリジャンプ先へ引き渡すパラメータを追加。 + + Arguments: argInfo : + isReturn : ジャンプ元への復帰ならば TRUE + + Returns: None. + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn) +{ + int result; + char argument[APPJUMP_STRING_LENGTH + 1]; + gAppParam.jumpCount++; + + OS_InitDeliverArgInfo(argInfo, sizeof(AppParam)); + + // アプリジャンプ回数を +1 してセット + result = OS_SetBinaryToDeliverArg( &(gAppParam), sizeof(AppParam) ); + + if(result != OS_DELIVER_ARG_SUCCESS) + { + OS_Warning("Failed to Set DeliverArgument."); + } + + if (gIsSetDelArg) + { + int i; + + // 文字列をセット + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + if (isReturn) + { + STD_TSPrintf(argument, "Returned from NAND-1"); + } + else + { + STD_TSPrintf(argument, "Jumped from NAND-1"); + } + OS_SetStringToDeliverArg(argument); + + // 今まで引き渡されたパラメータ文字列を引き継がせる + for (i=0; i <= 4 && i < gArgc; i++) + { + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + STD_StrLCpy( argument, gStrAppParam[i], APPJUMP_STRING_LENGTH ); + result = OS_SetStringToDeliverArg(argument); + OS_TPrintf("arg = %s : result = %d\n", argument, result); + } + } + OS_EncodeDeliverArg(); +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall.a b/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall.a new file mode 100644 index 00000000..a12fea83 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall.a differ diff --git a/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall_c.bin b/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall_c.bin new file mode 100644 index 00000000..21d02f46 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-2/432A/libsyscall_c.bin differ diff --git a/build/debugsoft/ApplicationJump/Nand-2/432A/rom_header_432a.template.sbin b/build/debugsoft/ApplicationJump/Nand-2/432A/rom_header_432a.template.sbin new file mode 100644 index 00000000..03810f85 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-2/432A/rom_header_432a.template.sbin differ diff --git a/build/debugsoft/ApplicationJump/Nand-2/Makefile b/build/debugsoft/ApplicationJump/Nand-2/Makefile new file mode 100644 index 00000000..f4ea4dde --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-2/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Nand-2 +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL +TWL_NANDAPP := TRUE + +TARGET_BIN = appjumpTestForNand2.tad +INCDIR = ../include +SRCDIR = ./src ../src +SRCS = main.c screen.c font.c common.c + +ROM_SPEC = main_nand2.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/ApplicationJumpTest +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ./431A/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/ApplicationJump/Nand-2/banner/banner.bnr b/build/debugsoft/ApplicationJump/Nand-2/banner/banner.bnr new file mode 100644 index 00000000..e6190cc3 Binary files /dev/null and b/build/debugsoft/ApplicationJump/Nand-2/banner/banner.bnr differ diff --git a/build/debugsoft/ApplicationJump/Nand-2/main_nand2.rsf b/build/debugsoft/ApplicationJump/Nand-2/main_nand2.rsf new file mode 100644 index 00000000..176c6791 --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-2/main_nand2.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName AppJmpTestN2 + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ./432A/rom_header_432a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "./banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 432A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/ApplicationJump/Nand-2/src/main.c b/build/debugsoft/ApplicationJump/Nand-2/src/main.c new file mode 100644 index 00000000..7250ecf1 --- /dev/null +++ b/build/debugsoft/ApplicationJump/Nand-2/src/main.c @@ -0,0 +1,370 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-2 + File: main.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 "common.h" +#include "screen.h" + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ + +// キー入力 +static KeyInfo gKey; + + +// B ボタンジャンプ先の切りかえフラグ +static u8 gJumpTypeForB = JUMPTYPE_RETURN; +// アプリ間パラメータ +static AppParam gAppParam; +// アプリ間パラメータとして文字列をセットするかどうか +static BOOL gIsSetDelArg = TRUE; +// アプリ間パラメータとして引き渡された文字列を格納するバッファ(6つまで) +static char gStrAppParam[6][APPJUMP_STRING_LENGTH + 1] ATTRIBUTE_ALIGN(32); +// アプリ間パラメータとして引き渡された文字列の個数 +static int gArgc; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn); + +/*---------------------------------------------------------------------------*/ + +void TwlMain(void) +{ + OSDeliverArgInfo argInfo; + + int result; + int argSize =sizeof(u32); + + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // キー入力情報取得の空呼び出し(IPL での A ボタン押下対策) + ReadKey(&gKey); + + OS_InitDeliverArgInfo(&argInfo, sizeof(AppParam)); + OS_DecodeDeliverArg(); + + /* アプリ間パラメータ(バイナリデータの取得) */ + if ( OS_DELIVER_ARG_SUCCESS != (result = OS_GetBinaryFromDeliverArg( &gAppParam, &argSize, sizeof(AppParam))) ) + { + PutMainScreen(1, 16, 0xf1, "ERROR!: READ_ERROR (%d)", result); + + OS_WaitVBlankIntr(); + OS_Terminate(); + } + + /* アプリ間パラメータ(文字列)の取得 */ + if ((gArgc = OS_GetDeliverArgc()) > 0) + { + int i; + + OS_TPrintf("argc = %d\n", gArgc); + + for (i=0; i < gArgc-1 && i < 6; i++) + { + STD_StrLCpy(gStrAppParam[i], (const char*)OS_GetDeliverArgv(i+1), APPJUMP_STRING_LENGTH); + gStrAppParam[i][APPJUMP_STRING_LENGTH] = '\0'; + } + } + + while(TRUE) + { + int i; + + // 自動テスト中に、ユーザのキー入力による終了指示を受け付けるためにウエイトを入れる + if (gAppParam.isAutoJump == 1) + { + OSTick tick = OS_GetTick(); + + PutMainScreen(1, 9, 0xf8, "executing auto app jump..."); + PutMainScreen(1, 11, 0xff, "wait 2 seconds..."); + PutMainScreen(1, 13, 0xff, "START: quit auto app jump"); + do { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_START) + { + break; + } + + OS_WaitVBlankIntr(); + } while (OS_TicksToSeconds(OS_GetTick() - tick) < 2); + } + else + { + // キー入力情報取得 + ReadKey(&gKey); + } + + // 画面クリア + ClearScreen(); + + // メイン画面描画 + PutMainScreen(0, 2, 0xf6, " ***** This APP is NAND-2 ***** "); + PutMainScreen(0, 5, 0xff, " APP JUMP : %u times ", gAppParam.jumpCount); + PutMainScreen(0, 7, 0xff, " DELIVERED PARAM (recent 6 app)"); + + for (i=0; i= JUMPTYPE_NUM ) + { + gJumpTypeForB = JUMPTYPE_RETURN; + } + } + + if (gKey.trg & PAD_BUTTON_START) + { + // 自動テストフラグをスイッチ + gAppParam.isAutoJump ^= 1; + } + + if (gKey.trg & PAD_BUTTON_A) + { + AddDeliverArg(&argInfo, FALSE); + // カードアプリへジャンプ + if( !OS_DoApplicationJump( CARDAPP_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + + if (gKey.trg & PAD_BUTTON_Y) + { + AddDeliverArg(&argInfo, FALSE); + + // もう一方の NAND アプリへジャンプ + if ( !OS_DoApplicationJump( NANDAPP1_TITLEID, OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_X || gAppParam.isAutoJump == 1) + { + AddDeliverArg(&argInfo, FALSE); + // 自分自身へジャンプ + if( !OS_DoApplicationJump( OS_GetTitleId(), OS_APP_JUMP_NORMAL )) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump."); + } + break; + } + if (gKey.trg & PAD_BUTTON_B) + { + AddDeliverArg(&argInfo, TRUE); + switch (gJumpTypeForB) + { + case JUMPTYPE_RETURN: + if ( !OS_ReturnToPrevApplication() ) + { + OS_TPrintf("Failed to Return Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Return Jump."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + case JUMPTYPE_ANOTHER_CARD: + if ( !OS_DoApplicationJump(CARDAPP_ANO_TITLEID, OS_APP_JUMP_NORMAL) ) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump(ANO)."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + case JUMPTYPE_SYSMENU: + OS_JumpToSystemMenu(); + break; + case JUMPTYPE_FAIL_CARD: + if ( !OS_DoApplicationJump(CARDAPP_FAIL_TITLEID, OS_APP_JUMP_NORMAL) ) + { + OS_TPrintf("Failed to Jump.\n"); + PutMainScreen(1, 16, 0xf1, "ERROR!: Failed to Jump(FAIL)."); + OS_WaitVBlankIntr(); + OS_Sleep(1000); + } + break; + } + } + + if (gKey.trg & PAD_BUTTON_L || gKey.trg & PAD_BUTTON_R) + { + gIsSetDelArg = !gIsSetDelArg; + } + + // Vブランク待ち + OS_WaitVBlankIntr(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: AddDeliverArg + + Description: アプリジャンプ先へ引き渡すパラメータを追加。 + + Arguments: argInfo : + isReturn : ジャンプ元への復帰ならば TRUE + + Returns: None. + *---------------------------------------------------------------------------*/ +static void AddDeliverArg(OSDeliverArgInfo *argInfo, BOOL isReturn) +{ + int result; + char argument[APPJUMP_STRING_LENGTH + 1]; + gAppParam.jumpCount++; + + OS_InitDeliverArgInfo(argInfo, sizeof(AppParam)); + + // アプリジャンプ回数を +1 してセット + result = OS_SetBinaryToDeliverArg( &(gAppParam), sizeof(AppParam) ); + + if(result != OS_DELIVER_ARG_SUCCESS) + { + OS_Warning("Failed to Set DeliverArgument."); + } + + if (gIsSetDelArg) + { + int i; + + // 文字列をセット + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + if (isReturn) + { + STD_TSPrintf(argument, "Returned from NAND-2"); + } + else + { + STD_TSPrintf(argument, "Jumped from NAND-2"); + } + + OS_SetStringToDeliverArg(argument); + + // 今まで引き渡されたパラメータ文字列を引き継がせる + for (i=0; i <= 4 && i < gArgc; i++) + { + MI_CpuClear8(argument, APPJUMP_STRING_LENGTH + 1); + STD_StrLCpy( argument, gStrAppParam[i], APPJUMP_STRING_LENGTH ); + result = OS_SetStringToDeliverArg(argument); + OS_TPrintf("arg = %s : result = %d\n", argument, result); + } + } + OS_EncodeDeliverArg(); +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/ReadMe.txt b/build/debugsoft/ApplicationJump/ReadMe.txt new file mode 100644 index 00000000..e704cd28 --- /dev/null +++ b/build/debugsoft/ApplicationJump/ReadMe.txt @@ -0,0 +1,86 @@ +appjumpTest + +アプリジャンプ機能をテストするためのアプリセットです。 +======================================================== + +<概要> =============================================== +2種類のNAND アプリと 3種類のカードアプリで構成されます。 +各アプリ間で、アプリジャンプの機能を一通り試すことができます。 +アプリ間でのパラメータの受け渡し、ジャンプ元へのリターンも可能です。 + + +3種類のカードアプリについて + +| ファイル名 | イニシャルコード | 被ノーマルジャンプ | +| appjumpTestForCard.srl | 430A |  許可 | +| appjumpTestForCard_Fail.srl | 460A | 不許可 | +| appjumpTestForCard_AID.srl | 461A |  許可 | +----------------------------------------------------------------------------- + +<使い方> ============================================= +2種類のNAND アプリを TWL にインポートした状態で、カードアプリを起動してください。 + +操作方法は、下画面下部に一覧表示されます。 +ABXY ボタンがそれぞれに対応したターゲットへのアプリジャンプを実行します。 + +L/R ボタンで、アプリ間パラメータ(文字列データ)を次のジャンプ先へ渡すかどうかを +切り替えることができます(デフォルトは ON になっています)。 + +START ボタンを押すと、現在起動中のアプリ自身へのアプリジャンプを自動で繰り返すモードに入ります。 +中断するには、起動後上画面にメッセージが出ている間(約2秒間)に START ボタンを押してください。 + +(2008/08/30 追記) +異常系チェックのために、カードアプリを2種追加しました。 + +・ひとつめ(460A)について + 被ノーマルジャンプを許可していない TWL カードアプリです。 + NAND アプリからこのアプリにジャンプしようとすると、必ずエラーが返るはずです。 + +・ふたつめ(461A)について + 被ノーマルジャンプは許可していますが、最初のカードアプリとは TitleID が別物の TWL カードアプリです。 + 最初に、もう一方のノーマルジャンプを許可しているカードアプリ[430A]をスロットに挿入した状態で + テストを開始します。そこから NAND アプリにジャンプした後、カードを[461A] に差し替えます。 + そして、NAND アプリからカードアプリへノーマルジャンプを実行した際に、ジャンプできるかどうかをチェックします。 + + +<画面の見方> ========================================== +・上画面について + 起動中のアプリが 3種類の内どれかを色と文字で表します。 + (黄:CARD、紫:NAND-1、水色:NAND-2) + + APP JUMP -> 今までのアプリジャンプ実行回数です。 + DELIVERED PARAM -> アプリ間パラメータ渡しをONにしている場合、ジャンプ元へのリターンも含めて +  これまでのジャンプ元の履歴が 6つまで表示されます。 + エラー表示 -> アプリジャンプに失敗した場合、赤字でエラーが表示されます。 +  エラー表示が出た場合、それ以上アプリの実行はできませんので再起動してください。 + +・下画面について + DELIVER ARG: (ON or OFF) -> アプリ間パラメータ渡しを有効にするかどうかのフラグの状態です。 +  L/R ボタンで ON/OFF を切り替えることができます。 + AUTO JUMP TEST: (ON or OFF) -> 自分自身へのアプリジャンプを中断するまで繰り返すテストモードかどうかを示す値です。 + 操作方法一覧 -> 各ボタンの説明を表示しています。アプリによって、ボタンに割り当てられた +  ジャンプ先が異なりますので注意してください。 +  ただし、ジャンプ元へのリターンは Bボタン、自分自身へのジャンプは Xボタン固定です。 + +(2008/09/03 追記) +上下ボタンの入力によって、Bボタンに割り当てられるジャンプ先が変化します。 +リターンジャンプ、ランチャーへのジャンプ、別のカードアプリ[460A],[461A]へのジャンプが順に変わります。 + +最初にカードアプリ[430A]を挿している状態から NAND アプリにジャンプし、 +途中でカードを挿し替えた場合、[460A], [461A] へのジャンプは必ず失敗する仕様になっています。 + + +<その他注意事項> +初回起動時(アプリジャンプを一度も実行していない状態)に、ジャンプ元へのリターンを行うと、 +必ずエラーになります。 + + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + + +<更新履歴>============================================ +2008/09/03 操作方法に追記 +2008/08/30 カードアプリ2種追加について加筆修正 +2008/07/31 新規追加 diff --git a/build/debugsoft/ApplicationJump/include/common.h b/build/debugsoft/ApplicationJump/include/common.h new file mode 100644 index 00000000..d591dc81 --- /dev/null +++ b/build/debugsoft/ApplicationJump/include/common.h @@ -0,0 +1,96 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 COMMON_H_ +#define COMMON_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/* TitleID */ +#define CARDAPP_TITLEID (u64)(0x0003000034333041) // 430A +#define CARDAPP_FAIL_TITLEID (u64)(0x0003000034363041) // 460A +#define CARDAPP_ANO_TITLEID (u64)(0x0003000034363141) // 461A + +#define NANDAPP1_TITLEID (u64)(0x0003000434333141) // 431A +#define NANDAPP2_TITLEID (u64)(0x0003000434333241) // 432A + +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/* アプリ間パラメータ関連 */ +#define APPJUMP_STRING_LENGTH 24 // 引数一つ分として受け渡しされる文字列の長さ制限 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +typedef enum JumpTypeForB +{ + JUMPTYPE_RETURN = 0, + JUMPTYPE_ANOTHER_CARD, + JUMPTYPE_SYSMENU, + JUMPTYPE_FAIL_CARD, + + JUMPTYPE_NUM +} JumpTypeForB; + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +// アプリ間でバイナリデータとして引き渡す構造体 +typedef struct AppParam +{ + u32 jumpCount; // アプリジャンプの実行回数 + u8 isAutoJump; // 一定間隔で自動的にアプリジャンプを実行するかどうかのフラグ + u8 rsv[3]; // 4バイトアラインメントのため +} AppParam; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/include/font.h b/build/debugsoft/ApplicationJump/include/font.h new file mode 100644 index 00000000..37699026 --- /dev/null +++ b/build/debugsoft/ApplicationJump/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.h + + Copyright 2007 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/include/screen.h b/build/debugsoft/ApplicationJump/include/screen.h new file mode 100644 index 00000000..0d08dffd --- /dev/null +++ b/build/debugsoft/ApplicationJump/include/screen.h @@ -0,0 +1,49 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.h + + Copyright 2007 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/src/common.c b/build/debugsoft/ApplicationJump/src/common.c new file mode 100644 index 00000000..b1883893 --- /dev/null +++ b/build/debugsoft/ApplicationJump/src/common.c @@ -0,0 +1,153 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitHeap(void) +{ + void* tempLo; + OSHeapHandle hh; + + // メインメモリ上のアリーナにヒープをひとつ作成 + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + // ヒープ作成に失敗した場合は異常終了 + OS_Panic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/src/font.c b/build/debugsoft/ApplicationJump/src/font.c new file mode 100644 index 00000000..2111ca07 --- /dev/null +++ b/build/debugsoft/ApplicationJump/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005,2006 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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/ApplicationJump/src/screen.c b/build/debugsoft/ApplicationJump/src/screen.c new file mode 100644 index 00000000..a9fec417 --- /dev/null +++ b/build/debugsoft/ApplicationJump/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + Copyright 2007 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 "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/CardRomHeaderChecker/Card/Makefile b/build/debugsoft/CardRomHeaderChecker/Card/Makefile new file mode 100644 index 00000000..15279b58 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Card/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL + +SUBDIRS = ../common/banner \ + $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +TARGET_BIN = CardRomHeaderChecker.srl +#INCDIR = ../common/include +SRCDIR = ../common/src +SRCS = main.c + +ROM_SPEC = ./ROM-TS.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/CardRomHeaderChecker +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ../common/0CZA/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/Card/ROM-TS.rsf b/build/debugsoft/CardRomHeaderChecker/Card/ROM-TS.rsf new file mode 100644 index 00000000..17cc8900 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Card/ROM-TS.rsf @@ -0,0 +1,196 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "CardRH Check" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../common/0CZA/rom_header_0cza.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../common/banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/CardRomHeaderChecker/ForDLPlay/Makefile b/build/debugsoft/CardRomHeaderChecker/ForDLPlay/Makefile new file mode 100644 index 00000000..f66190df --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/ForDLPlay/Makefile @@ -0,0 +1,44 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL +TWL_NANDAPP := TRUE +override TWL_ARCHGEN = HYBRID + +SUBDIRS = ../common/banner \ + $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +TARGET_BIN = CardRomHeaderChecker.tad +#INCDIR = ../common/include +SRCDIR = ../common/src +SRCS = main.c + +ROM_SPEC = ./ROM-TS_nand.HYB.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/ForDLPlay/ROM-TS_nand.HYB.rsf b/build/debugsoft/CardRomHeaderChecker/ForDLPlay/ROM-TS_nand.HYB.rsf new file mode 100644 index 00000000..14f382f1 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/ForDLPlay/ROM-TS_nand.HYB.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "CardRH Check" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../common/0CZA/rom_header_0cza.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../common/banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/CardRomHeaderChecker/Makefile b/build/debugsoft/CardRomHeaderChecker/Makefile new file mode 100644 index 00000000..d5d8dc26 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - debugsoft - ApplicationJump +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = Card \ + Nand + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/CardRomHeaderChecker/Nand/Makefile b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile new file mode 100644 index 00000000..6b1cd5d0 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile @@ -0,0 +1,29 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +SUBMAKES = ./Makefile.HYB ./Makefile.LTD + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.HYB b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.HYB new file mode 100644 index 00000000..f0168cf3 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.HYB @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL +TWL_NANDAPP := TRUE +override TWL_ARCHGEN = HYBRID + +SUBDIRS = ../common/banner \ + $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +TARGET_BIN = CardRomHeaderChecker.tad +#INCDIR = ../common/include +SRCDIR = ../common/src +SRCS = main.c + +ROM_SPEC = ./ROM-TS_nand.HYB.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/CardRomHeaderChecker +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ../common/0CZA/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.LTD b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.LTD new file mode 100644 index 00000000..b666973f --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Nand/Makefile.LTD @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL +TWL_NANDAPP := TRUE +override TWL_ARCHGEN = LIMITED + +SUBDIRS = ../common/banner2 \ + $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +TARGET_BIN = CardRomHeaderChecker.tad +#INCDIR = ../common/include +SRCDIR = ../common/src +SRCS = main.c + +ROM_SPEC = ./ROM-TS_nand.LTD.rsf + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/CardRomHeaderChecker +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +LIBSYSCALL = ../common/0CYA/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.HYB.rsf b/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.HYB.rsf new file mode 100644 index 00000000..14f382f1 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.HYB.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "CardRH Check" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../common/0CZA/rom_header_0cza.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../common/banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.LTD.rsf b/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.LTD.rsf new file mode 100644 index 00000000..ef72b3f6 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/Nand/ROM-TS_nand.LTD.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "CardRH Check" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../common/0CYA/rom_header_0cya.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../common/banner2/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile new file mode 100644 index 00000000..6b1cd5d0 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile @@ -0,0 +1,29 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - appjumpTest - Card +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +SUBMAKES = ./Makefile.HYB ./Makefile.LTD + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.HYB b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.HYB new file mode 100644 index 00000000..a2de77ad --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.HYB @@ -0,0 +1,71 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos.TWL - nandApp - ExecTmpApp +# File: Makefile +# +# Copyright 2007-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$ +#---------------------------------------------------------------------------- + +MISC_DIR = $(ROOT)/build/demos.TWL/nandApp/launcher_param/misc +DATA_DIR = $(ROOT)/build/demos.TWL/nandApp/launcher_param/data + +SUBDIRS = banner + +#------------------------- +#-- NAND アプリのビルドを指定します。 + +TWL_NANDAPP = TRUE + + +#---------------------------------------------------------------------------- + +TARGET_PLATFORM = TWL +override TWL_ARCHGEN = HYBRID + +LINCLUDES = $(MISC_DIR) \ + $(DATA_DIR) + +SRCS = main.c ExecTmpApp.c \ + $(MISC_DIR)/misc_simple.c \ + $(DATA_DIR)/data.c + +TARGET_BIN = ExecTmpCardRomHeaderChecker.tad + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = demo.autogen.hyb.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_nand.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + InitialCode=0CXA \ + BannerFile="banner/banner.bnr" \ + RomHeaderTemplate="../common/0CXA/rom_header_0cxa.template.sbin" + +MAKEROM_ROMROOT = ./../Nand/bin/$(TWL_BUILDTYPE_ARM9) +MAKEROM_ROMFILES = CardRomHeaderChecker.nand.srl + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +LIBSYSCALL = ../common/0CXA/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.LTD b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.LTD new file mode 100644 index 00000000..e45ea2cb --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/Makefile.LTD @@ -0,0 +1,72 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos.TWL - nandApp - ExecTmpApp +# File: Makefile +# +# Copyright 2007-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$ +#---------------------------------------------------------------------------- + +MISC_DIR = $(ROOT)/build/demos.TWL/nandApp/launcher_param/misc +DATA_DIR = $(ROOT)/build/demos.TWL/nandApp/launcher_param/data + +SUBDIRS = banner2 + +#------------------------- +#-- NAND アプリのビルドを指定します。 + +TWL_NANDAPP = TRUE + + +#---------------------------------------------------------------------------- + +TARGET_PLATFORM = TWL +override TWL_ARCHGEN = LIMITED + +LINCLUDES = $(MISC_DIR) \ + $(DATA_DIR) + +SRCS = main.c ExecTmpApp.c \ + $(MISC_DIR)/misc_simple.c \ + $(DATA_DIR)/data.c + +TARGET_BIN = ExecTmpCardRomHeaderChecker.tad + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = demo.autogen.ltd.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_nand.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + InitialCode=0CWA \ + BannerFile="banner2/banner.bnr" \ + RomHeaderTemplate="../common/0CWA/rom_header_0cwa.template.sbin" + +MAKEROM_ROMROOT = ./../Nand/bin/$(TWL_BUILDTYPE_ARM9) +MAKEROM_ROMFILES = CardRomHeaderChecker.nand.srl + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +LIBSYSCALL = ../common/0CWA/libsyscall.a + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/Makefile b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/Makefile new file mode 100644 index 00000000..1054d389 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - nandApp - demos - launcher_param - ExecTmpApp +# File: Makefile +# +# Copyright 2007-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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/banner_v3.bsf b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/banner_v3.bsf new file mode 100644 index 00000000..71aae09c Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/banner_v3.bsf differ diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/icon/gameIcon.bmp b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..588fc8cd Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner/icon/gameIcon.bmp differ diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/Makefile b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/Makefile new file mode 100644 index 00000000..1054d389 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - nandApp - demos - launcher_param - ExecTmpApp +# File: Makefile +# +# Copyright 2007-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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/banner_v3.bsf b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/banner_v3.bsf new file mode 100644 index 00000000..42d0860b Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/banner_v3.bsf differ diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/icon/gameIcon.bmp b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/icon/gameIcon.bmp new file mode 100644 index 00000000..588fc8cd Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/TmpJump/banner2/icon/gameIcon.bmp differ diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.c b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.c new file mode 100644 index 00000000..2d6b2ec4 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.c @@ -0,0 +1,169 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandApp - demos - launcher_param - ExecTmpApp + File: ExecTmpApp.c + + Copyright 2007-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 "misc_simple.h" +#include "ExecTmpApp.h" + +// define data------------------------------------------ + +#define COPB_MENU_ELEMENT_NUM 2 // メニューの項目数 + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +static void MenuScene( void ); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static u16 s_csr = 0; +static void(*s_pNowProcess)(void); + +// const data ----------------------------------------- +static const char *s_pStrMenu[ COPB_MENU_ELEMENT_NUM ] = +{ + "save app to tmp and restart", + "return to launcher", +}; + +static MenuPos s_menuPos[] = { + { TRUE, 3, 6 }, + { TRUE, 3, 8 }, +}; + +static const MenuParam s_menuParam = { + COPB_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_menuPos[ 0 ], + (const char **)&s_pStrMenu, +}; + +//====================================================== +// アプリ連携テストプログラムB +//====================================================== + +static void DrawMenuScene( void ) +{ + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "ExecTmpCardRomHeaderChecker"); + // メニュー項目 + myDp_DrawMenu( s_csr, MAIN_SCREEN, &s_menuParam ); +} + +static void MenuInit( void ) +{ + FS_Init(3); + GX_DispOff(); + GXS_DispOff(); + + myDp_Printf( 1, 0, TXT_COLOR_BLUE, MAIN_SCREEN, "ExecTmpCardRomHeaderChecker"); + + s_pNowProcess = MenuScene; + + DrawMenuScene(); + + GX_DispOn(); + GXS_DispOn(); +} + +static void MenuScene(void) +{ + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( MYPAD_IS_TRIG(PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++s_csr == COPB_MENU_ELEMENT_NUM ) { + s_csr=0; + } + } + if( MYPAD_IS_TRIG(PAD_KEY_UP) ){ + if( --s_csr & 0x80 ) { + s_csr=COPB_MENU_ELEMENT_NUM - 1; + } + } + + DrawMenuScene(); + + if( MYPAD_IS_TRIG(PAD_BUTTON_A) ) { // メニュー項目への分岐 + if( s_menuPos[ s_csr ].enable ) { + u64 targetApp = 0x00030004534d504c;// SMPL + s32 len = 0; + s32 llen; + BOOL success = TRUE; + FSFile src,dest; + void *buf; + switch( s_csr ) { + case 0: + + // tmpに保存 + FS_DeleteFile(OS_TMP_APP_PATH); + FS_CreateFile(OS_TMP_APP_PATH, FS_PERMIT_R | FS_PERMIT_W); + FS_InitFile( &src ); + FS_InitFile( &dest ); + if ( !FS_OpenFileEx( &src, "rom:/CardRomHeaderChecker.nand.srl", FS_FILEMODE_R ) ) success = FALSE; + len = (int)FS_GetFileLength( &src ); + + buf = (void *)0x2400000; + for(llen = 0; llen < len; ) + { + int rd; + rd = FS_ReadFile( &src, buf, len ); + if(rd == -1) + { + success = FALSE; + break; + } + buf = (void *)((u32)buf + rd); + llen += rd; + } + buf = (void *)0x2400000; + if ( !FS_CloseFile( &src ) ) success = FALSE; + if (len != llen) success = FALSE; + + if ( !FS_OpenFileEx( &dest, OS_TMP_APP_PATH, FS_FILEMODE_W ) ) success = FALSE; + llen = FS_WriteFile( &dest, buf, len ); + if ( !FS_CloseFile( &dest ) ) success = FALSE; + if (len != llen) success = FALSE; + + if( !success ) break; + + //アプリ起動 + OS_DoApplicationJump( targetApp, OS_APP_JUMP_TMP ); + break; + case 1: + OS_DoApplicationJump( NULL, OS_APP_JUMP_NORMAL ); + //再起動 + break; + } + } + } +} + +// 初期化 +void ExecTmpAppInit( void ) +{ + MenuInit(); +} + +// メインループ +void ExecTmpAppMain(void) +{ + s_pNowProcess(); +} diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.h b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.h new file mode 100644 index 00000000..5610ade2 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/ExecTmpApp.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandApp - demos - launcher_param - ExecTmpApp + File: ExecTmpApp.h + + Copyright 2007-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 __COOPERATION_B_H__ +#define __COOPERATION_B_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void ExecTmpAppInit( void ); +void ExecTmpAppMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __COOPERATION_B_H__ diff --git a/build/debugsoft/CardRomHeaderChecker/TmpJump/src/main.c b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/main.c new file mode 100644 index 00000000..6c62624d --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/TmpJump/src/main.c @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandApp - demos - launcher_param - ExecTmpApp + File: main.c + + Copyright 2007-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 "misc_simple.h" +#include "ExecTmpApp.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- +BOOL g_isValidTSD; + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + myInit(); + + ExecTmpAppInit(); + // メインループ---------------------------- + while(1){ + + myPreMain(); + + ExecTmpAppMain(); + + myProMain(); + + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CWA/libsyscall.a b/build/debugsoft/CardRomHeaderChecker/common/0CWA/libsyscall.a new file mode 100644 index 00000000..3498a72f Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CWA/libsyscall.a differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CWA/rom_header_0cwa.template.sbin b/build/debugsoft/CardRomHeaderChecker/common/0CWA/rom_header_0cwa.template.sbin new file mode 100644 index 00000000..487804e8 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CWA/rom_header_0cwa.template.sbin differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CXA/libsyscall.a b/build/debugsoft/CardRomHeaderChecker/common/0CXA/libsyscall.a new file mode 100644 index 00000000..58bb57ef Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CXA/libsyscall.a differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CXA/rom_header_0cxa.template.sbin b/build/debugsoft/CardRomHeaderChecker/common/0CXA/rom_header_0cxa.template.sbin new file mode 100644 index 00000000..264ba8f9 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CXA/rom_header_0cxa.template.sbin differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CYA/libsyscall.a b/build/debugsoft/CardRomHeaderChecker/common/0CYA/libsyscall.a new file mode 100644 index 00000000..4c38cdc4 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CYA/libsyscall.a differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CYA/rom_header_0cya.template.sbin b/build/debugsoft/CardRomHeaderChecker/common/0CYA/rom_header_0cya.template.sbin new file mode 100644 index 00000000..073f58b1 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CYA/rom_header_0cya.template.sbin differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CZA/libsyscall.a b/build/debugsoft/CardRomHeaderChecker/common/0CZA/libsyscall.a new file mode 100644 index 00000000..7377eea2 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CZA/libsyscall.a differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/0CZA/rom_header_0cza.template.sbin b/build/debugsoft/CardRomHeaderChecker/common/0CZA/rom_header_0cza.template.sbin new file mode 100644 index 00000000..f99ad765 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/0CZA/rom_header_0cza.template.sbin differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner/Makefile b/build/debugsoft/CardRomHeaderChecker/common/banner/Makefile new file mode 100644 index 00000000..1f8aa1d4 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/common/banner/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner/banner_v3.bsf b/build/debugsoft/CardRomHeaderChecker/common/banner/banner_v3.bsf new file mode 100644 index 00000000..03b7b035 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/banner/banner_v3.bsf differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner/icon/gameIcon.bmp b/build/debugsoft/CardRomHeaderChecker/common/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..3ea06fe9 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/banner/icon/gameIcon.bmp differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner2/Makefile b/build/debugsoft/CardRomHeaderChecker/common/banner2/Makefile new file mode 100644 index 00000000..1f8aa1d4 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/common/banner2/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner2/banner_v3.bsf b/build/debugsoft/CardRomHeaderChecker/common/banner2/banner_v3.bsf new file mode 100644 index 00000000..3977e385 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/banner2/banner_v3.bsf differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/banner2/icon/gameIcon.bmp b/build/debugsoft/CardRomHeaderChecker/common/banner2/icon/gameIcon.bmp new file mode 100644 index 00000000..3ea06fe9 Binary files /dev/null and b/build/debugsoft/CardRomHeaderChecker/common/banner2/icon/gameIcon.bmp differ diff --git a/build/debugsoft/CardRomHeaderChecker/common/src/main.c b/build/debugsoft/CardRomHeaderChecker/common/src/main.c new file mode 100644 index 00000000..e0d97568 --- /dev/null +++ b/build/debugsoft/CardRomHeaderChecker/common/src/main.c @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - template - demos + File: main.c + + Copyright 2003-2005,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 "DEMO.h" + +#define COLOR_WHITE (GX_RGBA(31, 31, 31, 1)) +#define COLOR_CYAN (GX_RGBA(0, 31, 31, 1)) +#define COLOR_RED (GX_RGBA(31, 0, 0, 1)) +#define COLOR_YELLOW (GX_RGBA(31, 31, 0, 1)) + +#define TITLE_COLOR COLOR_YELLOW +#define LABEL_COLOR COLOR_WHITE +#define VALUE_COLOR COLOR_WHITE +#define OK_COLOR COLOR_CYAN +#define NG_COLOR COLOR_RED + +// CRC計算 +#define CRC16_INIT_VALUE 0xffff +#define CALC_CRC16_SIZE 0x15e +static u16 CalcCRC16(u16 start, u8 *data, int size); + +void TwlMain(void) +{ + ROM_Header *prhTWL, *prhNTR; + char str[100]; + u16 row = 0; + u16 shift = 8; + u16 crc; + + OS_Init(); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); + + // カードROMヘッダ: NTR互換用 + prhNTR = (ROM_Header*)HW_CARD_ROM_HEADER; + + DEMOSetBitmapTextColor(COLOR_YELLOW); + DEMODrawText( 8, row, "Card ROM Header" ); + row += 2 * shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Title Name:" ); + MI_CpuClear8( str, 100 ); + MI_CpuCopy8( prhNTR->s.title_name, str, TITLE_NAME_MAX ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, str ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Game Code:" ); + MI_CpuClear8( str, 100 ); + MI_CpuCopy8( prhNTR->s.game_code, str, GAME_CODE_MAX ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, str ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Header CRC:" ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, "0x%04x", prhNTR->s.header_crc16 ); + row += shift; + + crc = CalcCRC16( CRC16_INIT_VALUE, (u8*)prhNTR, CALC_CRC16_SIZE ); + if( crc == prhNTR->s.header_crc16 ) + { + DEMOSetBitmapTextColor(OK_COLOR); + DEMODrawText( 96, row, "0x%04x OK", crc ); + } + else + { + DEMOSetBitmapTextColor(NG_COLOR); + DEMODrawText( 96, row, "0x%04x NG", crc ); + } + row += 3 * shift; + + // この固定メモリアドレスにTWLカードROMヘッダがある + // これはカードROMヘッダとは異なる + // カードROMヘッダ: NTR互換のための領域でROMヘッダのNTR互換部分だけがある + // TWLカードROMヘッダ: NTR互換部分に加えてROMヘッダのTWLで追加された部分もある + prhTWL = (ROM_Header*)HW_TWL_CARD_ROM_HEADER_BUF; + + DEMOSetBitmapTextColor(COLOR_YELLOW); + DEMODrawText( 8, row, "TWL Card ROM Header" ); + row += 2 * shift; + + if( OS_IsRunOnTwl() ) + { + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Title Name: " ); + MI_CpuClear8( str, 100 ); + MI_CpuCopy8( prhTWL->s.title_name, str, TITLE_NAME_MAX ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, str ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Game Code: " ); + MI_CpuClear8( str, 100 ); + MI_CpuCopy8( prhTWL->s.game_code, str, GAME_CODE_MAX ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, str ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "TitleID_Hi: " ); + prhTWL = (ROM_Header*)HW_TWL_CARD_ROM_HEADER_BUF; + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, "0x%08x", prhTWL->s.titleID_Hi ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "TitleID_Lo: " ); + MI_CpuClear8( str, 100 ); + MI_CpuCopy8( prhTWL->s.titleID_Lo, str, 4 ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, str ); + row += shift; + + DEMOSetBitmapTextColor(LABEL_COLOR); + DEMODrawText( 8, row, "Header CRC:" ); + DEMOSetBitmapTextColor(VALUE_COLOR); + DEMODrawText( 96, row, "0x%04x", prhTWL->s.header_crc16 ); + row += shift; + + crc = CalcCRC16( CRC16_INIT_VALUE, (u8*)prhTWL, CALC_CRC16_SIZE ); + if( crc == prhTWL->s.header_crc16 ) + { + DEMOSetBitmapTextColor(OK_COLOR); + DEMODrawText( 96, row, "0x%04x OK", crc ); + } + else + { + DEMOSetBitmapTextColor(NG_COLOR); + DEMODrawText( 96, row, "0x%04x NG", crc ); + } + row += 2 * shift; + }else + { + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMODrawText( 8, row, "Running on NITRO Mode." ); + row += 2 * shift; + } + + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMODrawText( 8, row, "End." ); + row += 2 * shift; + DEMODrawText( 8, row, "Press A to check Self-Jump." ); + + while (1) + { + DEMOReadKey(); + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + if(DEMO_IS_TRIG(PAD_BUTTON_A)) OS_RebootSystem(); + } +} + + +/*---------------------------------------------------------------------------* + * Math + * + * u16 CalcCRC16( u16 start, u8 *data, int size ) + *---------------------------------------------------------------------------*/ + +static u16 crc16_table[16] = { + 0x0000, 0xCC01, 0xD801, 0x1400, + 0xF001, 0x3C00, 0x2800, 0xE401, + 0xA001, 0x6C00, 0x7800, 0xB401, + 0x5000, 0x9C01, 0x8801, 0x4400 +}; + +static u16 CalcCRC16(u16 start, u8 *data, int size) +{ + u16 r1; + u16 total = start; + + while (size-- > 0) + { + // 下位4bit + r1 = crc16_table[total & 0xf]; + total = (u16)((total >> 4) & 0x0fff); + total = (u16)(total ^ r1 ^ crc16_table[*data & 0xf]); + + // 上位4bit + r1 = crc16_table[total & 0xf]; + total = (u16)((total >> 4) & 0x0fff); + total = (u16)(total ^ r1 ^ crc16_table[(*data >> 4) & 0xf]); + + data++; + } + return total; +} + +/*====== End of main.c ======*/ diff --git a/build/debugsoft/Internet/Makefile b/build/debugsoft/Internet/Makefile new file mode 100644 index 00000000..0e2cb013 --- /dev/null +++ b/build/debugsoft/Internet/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = NCFGCrusher \ + + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/Internet/NCFGCrusher/Makefile b/build/debugsoft/Internet/NCFGCrusher/Makefile new file mode 100644 index 00000000..6ecde606 --- /dev/null +++ b/build/debugsoft/Internet/NCFGCrusher/Makefile @@ -0,0 +1,68 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlWiFi - NCFG - demos - ncfg-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = $(ROOT)/build/demos/gx/UnitTours/DEMOLib + +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL +TWL_ARCHGEN := LIMITED +TWL_NANDAPP := TRUE +TARGET_NAME = NCFGCrusher +TARGET_BIN = $(TARGET_NAME).srl +#TARGET_BIN = $(TARGET_NAME).tad +SRCS = main.c + + +ROM_SPEC = $(TARGET_NAME).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + BannerFile=./banner/banner.bnr \ + GameCode=4S03 \ + TitleName=$(TARGET_NAME) \ + AppType=USER \ +# Media=NAND \ + + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.exe + + +#------------------------- +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + + + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLWIFI_ROOT)/build/buildtools/commondefs.demos +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLWIFI_ROOT)/build/buildtools/modulerules +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/Internet/NCFGCrusher/banner/banner.bnr b/build/debugsoft/Internet/NCFGCrusher/banner/banner.bnr new file mode 100644 index 00000000..60eba830 Binary files /dev/null and b/build/debugsoft/Internet/NCFGCrusher/banner/banner.bnr differ diff --git a/build/debugsoft/Internet/NCFGCrusher/readme.txt b/build/debugsoft/Internet/NCFGCrusher/readme.txt new file mode 100644 index 00000000..f4309edd --- /dev/null +++ b/build/debugsoft/Internet/NCFGCrusher/readme.txt @@ -0,0 +1,33 @@ +NCFGTest + +*概要 +接続設定を破壊するツールです。 + +*操作方法 +上下キーで破壊する接続設定を選択し、Aボタンで決定します。 +下画面に元の接続設定データと、破壊後のデータが表示されます。 + +破壊は、各データの先頭に 0x61 〜 0x67を埋め込む形で実現しています。 + + +---------- +*NCFGの修復仕様まとめ + +接続設定のCRCをチェックし、エラーがある場合はその設定を初期化します。 +(IPアドレスの設定や、接続タイプ等が全てクリアされる状態) + +Nitroのときのように、接続設定1と2を異常にすると、3も道連れになりクリアされるというようなことはありません。 + + +より、詳細な仕様は影舞に記されています。 +http://phoenix.boy.nintendo.co.jp/~twl-wifi/kagemai/html/user.cgi?project=twl-wifi&action=view_report&id=84 +http://phoenix.boy.nintendo.co.jp/~twl-wifi/kagemai/html/user.cgi?project=twl-wifi&action=view_report&id=83 + +一部抜粋 +- CRC エラーの接続先は、個別に消去します。 +- 全領域 CRC エラーだった場合は、初回起動だと見なし、消去のみを行い、 + エラーを返しません。 +- 設定がされていた領域で消去が発生した場合は、エラーを通知します。 +- それ以外の場合は、エラーを返しません。 + (元々設定されていなかった領域で消去が発生した場合も含む) + diff --git a/build/debugsoft/Internet/NCFGCrusher/src/main.c b/build/debugsoft/Internet/NCFGCrusher/src/main.c new file mode 100644 index 00000000..d3104ffb --- /dev/null +++ b/build/debugsoft/Internet/NCFGCrusher/src/main.c @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------* + Project: TwlWiFi - NCFG - demos - ncfg-1 + File: main.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + NVRAM 上のネットワーク設定を一定の値で初期化しながら、 + その結果をダンプするサンプルプログラムです。 + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +//#include +//#include + +static void MainLoop(void); +//static void VBlankIntr(void); + +static void ReadNCFG(s32 index, u8* out); +static void WriteNCFG(s32 index); +static void InitDEMOSystem(void); + +static u32 UpdateCursor(u32 val, u32 max, u16 key); + +static const char* SLOT_NAME[] = { + "SLOT_1", "SLOT_2", "SLOT_3", "SLOT_EX_1", "SLOT_EX_2", "SLOT_EX_3" +}; +static const u32 SLOT_NUM = sizeof(SLOT_NAME) / sizeof(char*); + +void NitroMain() +{ + OS_Init(); + FX_Init(); + GX_Init(); + +// GX_DispOff(); +// GXS_DispOff(); + + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + InitDEMOSystem(); + + (void)PAD_Read(); + + + + OS_TPrintf("UP DOWN - SELECT NCFG SLOT\n"); + OS_TPrintf("A - OVERWRITE NCFG\n"); + + + MainLoop(); + + OS_Terminate(); +} + +static u32 UpdateCursor(u32 val, u32 max, u16 key) +{ + if(key & PAD_KEY_DOWN) + { + val = (val + 1) % max; + } + if(key & PAD_KEY_UP) + { + val = (val + max - 1) % max; + } + return val; +} + +static void MainLoop(void) +{ + u32 index = 0; + s32 slot_index[] = + { + NCFG_SLOT_1, + NCFG_SLOT_2, + NCFG_SLOT_3, + NCFG_SLOT_EX_1, + NCFG_SLOT_EX_2, + NCFG_SLOT_EX_3, + }; + u16 key = 0, old_key = 0, trig = 0; + + while(1) + { + s32 i = 0; + + old_key = key; + key = PAD_Read(); + trig = (u16)(key & (key ^ old_key)); + + index = UpdateCursor(index, SLOT_NUM, trig); + if(trig & PAD_BUTTON_A) + { + WriteNCFG(slot_index[index]); + OS_TPrintf("%s was modified\n", SLOT_NAME[index]); + } + + for(i = 0; i < SLOT_NUM; ++i) + { + + DEMODrawText(0, i * 8, ((index == i) ? "*" : " ")); + DEMODrawText(8, i * 8, "%s\n", SLOT_NAME[i]); + } + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } +} + +static void ReadNCFG(s32 index, u8* out) +{ + static u8 buf[512]; + FSFile fp; + s32 result; + + FS_InitFile(&fp); + + result = NCFG_ReadBackupMemory(buf, sizeof(buf), index); + OS_TPrintf("NCFG_ReadBackupMemory(%d): %d\n", index, result); + if ( result >= 0 ) + { + // OS_TPrintfEx("% *.16b", result, buf); + OS_TPrintfEx("% 256.16b", buf); + OS_TPrintf("\n"); + } + + MI_CpuCopy8(buf, out, sizeof(buf)); +} + +static void WriteNCFG(s32 index) +{ + static u8 buf[512]; + s32 result; + + ReadNCFG(index, buf); + MI_CpuCopy("abcdefg", buf, 7); + result = NCFG_WriteBackupMemory(index, buf, sizeof(buf)); + OS_TPrintf("NCFG_WriteBackupMemory(%d): %d\n", index, result); + OS_TPrintfEx("% 256.16b", buf); + OS_TPrintf("\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitDEMOSystem + + Description: コンソールの画面出力用の表示設定を行います。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitDEMOSystem(void) +{ + // 画面表示の初期化。 + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); +} diff --git a/build/debugsoft/Jpeg/Makefile b/build/debugsoft/Jpeg/Makefile new file mode 100644 index 00000000..3124add1 --- /dev/null +++ b/build/debugsoft/Jpeg/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = SdToPhoto + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/Jpeg/SdToPhoto/Makefile b/build/debugsoft/Jpeg/SdToPhoto/Makefile new file mode 100644 index 00000000..3707d142 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/Makefile @@ -0,0 +1,138 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - NandFiler +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +SRCS = main.cpp +TARGET_NAME = sd2photo +TWLNMENU_ROOT ?= . + + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = $(TARGET_NAME)$(ROM_SPEC_NAME_PART).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=4S01 \ + Secure=TRUE \ + BannerFile=./banner/banner.bnr \ + NANDAccess=TRUE \ + SDCardAccess=TRUE \ + TitleName=$(TARGET_NAME) + +#------------------------- +#-- CARD, NANDによるオプションの指定 + +TWL_NANDAPP = TRUE + +ifeq ($(APP_TYPE),) +APP_TYPE = CARD +endif + +ifeq ($(APP_TYPE),CARD) +MEDIA = GameCard +SUFFIX = .srl +endif + +ifeq ($(APP_TYPE),NAND) +MEDIA = NAND +SUFFIX = .tad +ROM_SPEC_NAME_PART := $(ROM_SPEC_NAME_PART).nand +endif + +ROM_SPEC_PARAM += Media=$(MEDIA) +TARGET_BIN = $(TARGET_NAME)$(SUFFIX) + +#------------------------- +# 対象拡張子のためのインクルードファイルを決定 +ifneq ($(SUFFIX_DEFINE),) +SUFFIX_FILE = $(SUFFIX_DEFINE) +else +SUFFIX_FILE = default_suffix.h +endif + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#------------------------- +# セキュア用 +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +MAKETAD_OPTION := -s + + +#------------------------- +# ビルドパラメータ +INCDIR = $(TWLSYSTEM_ROOT)/include \ + ./include + + +#------------------------- +# インストール指定 + +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +#------------------------- +# 対象拡張子のためのインクルードファイルをビルドディレクトリにコピー +.PHONY: suffix + +suffix: + cp $(SUFFIX_FILE) ./include/suffix.h + +#------------------------- +# ビルド +do-build: suffix $(TARGETS) + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +ifdef MAKE_BANNER +$(BINDIR)/$(TARGET_NAME)$(ROM_SPEC_NAME_PART).srl: $(BANNER) +endif + + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr b/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr new file mode 100644 index 00000000..c299ae43 Binary files /dev/null and b/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr differ diff --git a/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h b/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h new file mode 100644 index 00000000..9e83a577 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h @@ -0,0 +1,9 @@ +namespace{ + const char* SUFFIX[] = + { + ".jpg", + ".jpeg", + ".JPG", + ".JPEG", + }; +} \ No newline at end of file diff --git a/build/debugsoft/Jpeg/SdToPhoto/readme.txt b/build/debugsoft/Jpeg/SdToPhoto/readme.txt new file mode 100644 index 00000000..6bdf0cb0 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/readme.txt @@ -0,0 +1,28 @@ +sd2photo + +*概要 +  SDカード内を走査して、指定した拡張子のファイルを探し、 +  "photo:/"以下へコピーするツールです。 + +*拡張子の指定方法 + コピー対象とする拡張子を記述したファイルをビルド時に指定します。 + 具体的な指定はmake時に下記の変数を渡すことで行ってください。 + + SUFFIX_DEFINE=hoge + + 省略すると、default_suffix.h が指定されます。(".jpg", ".jpeg", ".JPG", "JPEG"に対応します。) + +*操作方法 +  SDカードを挿入した状態でデバッガ等で起動してください。 + (SDを指さずに起動すると画面が赤くなり、SDが挿されるまで待ちます) + +  自動的に、ファイルの検索とコピーが始まります。 +   +  検索、コピー中は、画面の色が緑色になっています。 +  (SDを抜いたり電源を切ったりしないほうが無難です。) +  処理が終わったら青色になります。 + +*仕様 +  ・フォルダ構成をそのままコピーします。例えば、SD上で"/test/aa.jpg"があったとすれば、NAND上で"photo:/test/aa.jpg"が作成されます。 +  ・NAND上に同名のファイルが存在する場合、問答無用に上書きされます。 +  ・残り容量が少ない場合、上書きになる場合でもファイルをコピーできないことがあります。 diff --git a/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp b/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp new file mode 100644 index 00000000..0c5502cc --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp @@ -0,0 +1,286 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - NandFiler + File: main.cpp + + 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 "suffix.h" + +inline void* operator new(size_t size) { return OS_Alloc(size); } +inline void* operator new[](size_t size) { return OS_Alloc(size); } +inline void operator delete(void* ptr) { OS_Free(ptr); } +inline void operator delete[](void* ptr) { OS_Free(ptr); } + +typedef std::list PathList; + +namespace +{ + void + InitInterrupt(void) + { + OS_EnableIrq(); + OS_EnableInterrupts(); + } + + void + InitAlloc(void) + { + OSHeapHandle hHeap; + void* lo = OS_GetMainArenaLo(); + void* hi = OS_GetMainArenaHi(); + + lo = OS_InitAlloc(OS_ARENA_MAIN, lo, hi, 1); + OS_SetArenaLo(OS_ARENA_MAIN, lo); + + hHeap = OS_CreateHeap(OS_ARENA_MAIN, lo, hi); + SDK_ASSERT( hHeap >= 0 ); + + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); + } +} + + + +static void InitInteruptSystem(); +static void InitFileSystem(); + +static void PickupTargetPath(const char* root, const char* suffix, PathList& out); +static void CopyTarget(const char* to, const char* header, PathList& out); +static void CopyFile(const char* src, const char* dest); + +void +TwlStartUp() +{ + OS_Init(); + InitAlloc(); +} + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数です。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + InitInteruptSystem(); + InitFileSystem(); + + GX_DispOn(); + GXS_DispOn(); + + // SDがささってなかったら刺さるまで待つ + { + FSArchiveResource res; + while(!FS_GetArchiveResource("sdmc:/", &res)) + { + *(u16*)HW_PLTT = static_cast(0x001f); + *(u16*)HW_DB_PLTT = static_cast(0x001f); + } + } + + PathList path; + + for(u32 i = 0; i < sizeof(SUFFIX) / sizeof(char*); ++i) + { + PickupTargetPath("sdmc:/", SUFFIX[i], path); + } + CopyTarget("nand2:/photo", "sdmc:", path); + + + *(u16*)HW_PLTT = 0x001f << 10; + *(u16*)HW_DB_PLTT = 0x001f << 10; + // ランチャーに戻れるように、 終了しない + for (;;) + { + // フレーム更新。 + { + OS_WaitVBlankIntr(); + } + } + + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: InitInteruptSystem + + Description: 割り込みを初期化します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitInteruptSystem() +{ + // 個別割り込みフラグを全て不許可に + (void)OS_SetIrqMask(0); + + // マスター割り込みフラグを許可に + (void)OS_EnableIrq(); + + // IRQ 割り込みを許可します + (void)OS_EnableInterrupts(); + + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); +} + + +/*---------------------------------------------------------------------------* + Name: InitFileSystem + + Description: FS を初期化して rom にアクセスできるようにします。 + この関数を呼び出す前に InitInteruptSystem() が + 呼ばれている必要があります。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitFileSystem() +{ + // ARM7との通信FIFO割り込み許可 + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + + // ファイルシステム初期化 + FS_Init( FS_DMA_NOT_USE ); +} + + +static void PickupTargetPath(const char* root, const char* suffix, PathList& out) +{ + FSFile fp; + FSDirectoryEntryInfo fdei; + BOOL result; + + FS_InitFile(&fp); + // ディレクトリのオープン + result = FS_OpenDirectory(&fp, root, NULL); + if(!result) + { + OS_TPrintf("%s: Fail Open\nErrorCode:%d\n", root, FS_GetArchiveResultCode(root)); + return; + } + + while(FS_ReadDirectory(&fp, &fdei)) + { + if(STD_StrCmp(fdei.longname, ".") == 0 || STD_StrCmp(fdei.longname, "..") == 0) + continue; + + OS_TPrintf("%s:\n", fdei.longname); + // ディレクトリなら子を読む + if(fdei.attributes & FS_ATTRIBUTE_IS_DIRECTORY) + { + PickupTargetPath((std::string(root) + fdei.longname + "/").c_str(), suffix, out); + } + else // ファイルならoutに追加 + { + // 拡張子を判定 + if(std::string(fdei.longname).rfind(suffix) + STD_StrLen(suffix) == STD_StrLen(fdei.longname)) + { + out.push_back(std::string(root) + fdei.longname); + } + } + } + + FS_CloseDirectory(&fp); + +} + +static void CopyTarget(const char* to, const char* header, PathList& list) +{ + PathList::iterator itr = list.begin(), end = list.end(); + u16 color = 0; + for(; itr != end; ++itr) + { + std::string dest = std::string(to) + (*itr).substr(static_cast(STD_StrLen(header))); + + CopyFile((*itr).c_str(), dest.c_str()); + color = static_cast((color + 2) & 0x001f); + *(u16*)HW_PLTT = static_cast(color << 5); + *(u16*)HW_DB_PLTT = static_cast(color << 5); + } +} + +static void CopyFile(const char* src, const char* dest) +{ + FSFile sfp, dfp; + BOOL result; + std::string tmp_name = dest; + + tmp_name += "___tmp"; + + OS_TPrintf("Copying %s...", dest); + + // テンポラリファイルにコピー + FS_DeleteFile(tmp_name.c_str()); + result = FS_CreateFileAuto(tmp_name.c_str(), FS_PERMIT_R | FS_PERMIT_W); +// result = FS_CreateFileAuto(dest, FS_PERMIT_R | FS_PERMIT_W); + if(!result) + { + OS_TPrintf("%s:Cant create\n", tmp_name.c_str()); + return; + } + + result = FS_OpenFileEx(&sfp, src, FS_FILEMODE_R); + if(!result) + { + OS_TPrintf("%s:Cant open\n", src); + return; + } + + result = FS_OpenFileEx(&dfp, tmp_name.c_str(), FS_FILEMODE_W); + if(!result) + { + OS_TPrintf("%s:Cant open\n", src); + FS_CloseFile(&sfp); + return; + } + + const u32 BUFSIZE = 4096; + u8 buf[BUFSIZE]; + s32 count = 0; + while((count = FS_ReadFile(&sfp, buf, BUFSIZE)) > 0) + { + s32 write = FS_WriteFile(&dfp, buf, count); + if(write <= 0) + { + OS_TPrintf("Cant Write\n"); + FS_CloseFile(&sfp); + FS_CloseFile(&dfp); + FS_DeleteFile(tmp_name.c_str()); + return; + } + } + + FS_CloseFile(&sfp); + FS_CloseFile(&dfp); + + // テンポラリファイルをリネーム + // すでにファイルが存在するなら削除 + FS_DeleteFileAuto(dest); + FS_RenameFile(tmp_name.c_str(), dest); + + OS_TPrintf("...ok\n"); +} + diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set0.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set0.srl new file mode 100644 index 00000000..c3b8101e Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set0.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set1.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set1.srl new file mode 100644 index 00000000..41454f33 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set1.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set2.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set2.srl new file mode 100644 index 00000000..1059b85f Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set3.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set3.srl new file mode 100644 index 00000000..96a7fa05 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set4.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set4.srl new file mode 100644 index 00000000..7a103aa6 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set5.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set5.srl new file mode 100644 index 00000000..7f706ebf Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/armadillo_set6.srl b/build/debugsoft/KeyCheck/Dev/armadillo_set6.srl new file mode 100644 index 00000000..e98c1942 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/armadillo_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/mongoose_set2.srl b/build/debugsoft/KeyCheck/Dev/mongoose_set2.srl new file mode 100644 index 00000000..def6ba70 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/mongoose_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/mongoose_set3.srl b/build/debugsoft/KeyCheck/Dev/mongoose_set3.srl new file mode 100644 index 00000000..5e79f94d Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/mongoose_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/mongoose_set4.srl b/build/debugsoft/KeyCheck/Dev/mongoose_set4.srl new file mode 100644 index 00000000..7b38ed22 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/mongoose_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/mongoose_set5.srl b/build/debugsoft/KeyCheck/Dev/mongoose_set5.srl new file mode 100644 index 00000000..4faf26e0 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/mongoose_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/mongoose_set6.srl b/build/debugsoft/KeyCheck/Dev/mongoose_set6.srl new file mode 100644 index 00000000..bd8a9d41 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/mongoose_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/racoon_set2.srl b/build/debugsoft/KeyCheck/Dev/racoon_set2.srl new file mode 100644 index 00000000..eb42d0d8 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/racoon_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/racoon_set3.srl b/build/debugsoft/KeyCheck/Dev/racoon_set3.srl new file mode 100644 index 00000000..1980084e Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/racoon_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/racoon_set4.srl b/build/debugsoft/KeyCheck/Dev/racoon_set4.srl new file mode 100644 index 00000000..27d56f8d Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/racoon_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/racoon_set5.srl b/build/debugsoft/KeyCheck/Dev/racoon_set5.srl new file mode 100644 index 00000000..a8e2d1b9 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/racoon_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/racoon_set6.srl b/build/debugsoft/KeyCheck/Dev/racoon_set6.srl new file mode 100644 index 00000000..96cdd865 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/racoon_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/tarsier_set2.srl b/build/debugsoft/KeyCheck/Dev/tarsier_set2.srl new file mode 100644 index 00000000..d9e10af8 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/tarsier_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/tarsier_set3.srl b/build/debugsoft/KeyCheck/Dev/tarsier_set3.srl new file mode 100644 index 00000000..e93d4697 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/tarsier_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/tarsier_set4.srl b/build/debugsoft/KeyCheck/Dev/tarsier_set4.srl new file mode 100644 index 00000000..cea13a31 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/tarsier_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/tarsier_set5.srl b/build/debugsoft/KeyCheck/Dev/tarsier_set5.srl new file mode 100644 index 00000000..70d0f78c Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/tarsier_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Dev/tarsier_set6.srl b/build/debugsoft/KeyCheck/Dev/tarsier_set6.srl new file mode 100644 index 00000000..bf9f3126 Binary files /dev/null and b/build/debugsoft/KeyCheck/Dev/tarsier_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set0.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set0.srl new file mode 100644 index 00000000..ede06b83 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set0.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set1.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set1.srl new file mode 100644 index 00000000..98e62e7c Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set1.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set2.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set2.srl new file mode 100644 index 00000000..21fe3d60 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set3.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set3.srl new file mode 100644 index 00000000..12db7e22 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set4.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set4.srl new file mode 100644 index 00000000..89b4086a Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set5.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set5.srl new file mode 100644 index 00000000..979532be Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/armadillo_set6.srl b/build/debugsoft/KeyCheck/Prod/armadillo_set6.srl new file mode 100644 index 00000000..c939e469 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/armadillo_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/mongoose_set2.srl b/build/debugsoft/KeyCheck/Prod/mongoose_set2.srl new file mode 100644 index 00000000..37218915 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/mongoose_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/mongoose_set3.srl b/build/debugsoft/KeyCheck/Prod/mongoose_set3.srl new file mode 100644 index 00000000..ca289e05 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/mongoose_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/mongoose_set4.srl b/build/debugsoft/KeyCheck/Prod/mongoose_set4.srl new file mode 100644 index 00000000..7fa5f3eb Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/mongoose_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/mongoose_set5.srl b/build/debugsoft/KeyCheck/Prod/mongoose_set5.srl new file mode 100644 index 00000000..90500aa5 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/mongoose_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/mongoose_set6.srl b/build/debugsoft/KeyCheck/Prod/mongoose_set6.srl new file mode 100644 index 00000000..69db2f21 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/mongoose_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/racoon_set2.srl b/build/debugsoft/KeyCheck/Prod/racoon_set2.srl new file mode 100644 index 00000000..8916c5dd Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/racoon_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/racoon_set3.srl b/build/debugsoft/KeyCheck/Prod/racoon_set3.srl new file mode 100644 index 00000000..cd90c658 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/racoon_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/racoon_set4.srl b/build/debugsoft/KeyCheck/Prod/racoon_set4.srl new file mode 100644 index 00000000..073a68a6 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/racoon_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/racoon_set5.srl b/build/debugsoft/KeyCheck/Prod/racoon_set5.srl new file mode 100644 index 00000000..3a37b511 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/racoon_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/racoon_set6.srl b/build/debugsoft/KeyCheck/Prod/racoon_set6.srl new file mode 100644 index 00000000..44c72602 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/racoon_set6.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/tarsier_set2.srl b/build/debugsoft/KeyCheck/Prod/tarsier_set2.srl new file mode 100644 index 00000000..c093fa3a Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/tarsier_set2.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/tarsier_set3.srl b/build/debugsoft/KeyCheck/Prod/tarsier_set3.srl new file mode 100644 index 00000000..6c00ec6e Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/tarsier_set3.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/tarsier_set4.srl b/build/debugsoft/KeyCheck/Prod/tarsier_set4.srl new file mode 100644 index 00000000..e299cade Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/tarsier_set4.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/tarsier_set5.srl b/build/debugsoft/KeyCheck/Prod/tarsier_set5.srl new file mode 100644 index 00000000..3dd460e0 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/tarsier_set5.srl differ diff --git a/build/debugsoft/KeyCheck/Prod/tarsier_set6.srl b/build/debugsoft/KeyCheck/Prod/tarsier_set6.srl new file mode 100644 index 00000000..4f50af01 Binary files /dev/null and b/build/debugsoft/KeyCheck/Prod/tarsier_set6.srl differ diff --git a/build/debugsoft/Makefile b/build/debugsoft/Makefile new file mode 100644 index 00000000..ae8ed58c --- /dev/null +++ b/build/debugsoft/Makefile @@ -0,0 +1,38 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = Jpeg \ + Wireless \ + Internet \ + ApplicationJump \ + TMPJump \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/MakerTitle/Makefile b/build/debugsoft/MakerTitle/Makefile new file mode 100644 index 00000000..c43a41b4 --- /dev/null +++ b/build/debugsoft/MakerTitle/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = SaveData \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/Makefile b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/Makefile new file mode 100644 index 00000000..0bb8d479 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/Makefile @@ -0,0 +1,188 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - save_data - DisplayVersion +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + +ifndef MODE +#------------------------------------------------------------------------ +# APP_TYPE の指定がないなら全てをビルドする + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something-build +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL= +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something-build: + +$(REMAKE) TWLSDK_PLATFORM=TWL MODE=SEQURE SKIP_SUBDIR=FALSE $(MY_GOAL) + rm `find -name *.lcf` + rm -rf depend + rm -rf obj + +$(REMAKE) TWLSDK_PLATFORM=TWL MODE=USER SKIP_SUBDIR=FALSE $(MY_GOAL) + +do-something: + +$(REMAKE) TWLSDK_PLATFORM=TWL MODE=SEQURE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL MODE=USER SKIP_SUBDIR=FALSE $(MY_GOAL) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +else + + + +SUBDIRS = + + +#---------------------------------------------------------------------------- +TWL_NANDAPP := TRUE +MASTER_NAME := SaveDataTest +APP_NAME = $(MASTER_NAME)_$(MODE) + +SRCS = main.c font.c screen.c menu.c dataver.c + +LLIBRARIES = libnam$(TWL_LIBSUFFIX).a libes$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a + +#------------------------- +#-- セキュアアプリ、ユーザアプリの切り替え + +ifeq ($(MODE),USER) +MACRO_FLAGS += -DUSER_MODE +APP_TYPE := User +SEQURE := FALSE +GAME_CODE := 4S5A +endif + +ifeq ($(MODE),SEQURE) +APP_TYPE := System +SEQURE := TRUE +GAME_CODE := 4S4A +endif + + +TARGET_BIN = $(APP_NAME).tad + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = dispver.$(MODE).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + TitleName=VER_CHECKER \ + GameCode=$(GAME_CODE) \ + BannerFile=./banner/banner_$(MODE).bnr \ + PublicSaveDataSize=16K \ + PrivateSaveDataSize=16K \ + WramMapping=MAP_TS_SCR \ + AppType=$(APP_TYPE) \ + Media=NAND \ + Secure=$(SEQURE) \ + + + +#------------------------- +#-- NAMを使うためにsecure componentを使う + +COMPONENT_NAME = armadillo +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/$(COMPONENT_NAME)/$(TWL_BUILDTYPE_ARM7)/$(COMPONENT_NAME) +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#------------------------- +# インストール指定 + +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(MASTER_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +#------------------------- +#-- カードアプリと同様に ROM-FS にファイルを持たせます。 + +#MAKEROM_ROMROOT = ./rom_data +#MAKEROM_ROMFILES = *.* + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + +#------------------------- +# rom 内のファイルは全て自動生成なので clean で削除されるようにします +LDIRT_CLEAN = $(MAKEROM_ROMROOT) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifeq ($(MODE),USER) +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.exe # commondefs を include した後でなければならない +endif + +ifeq ($(MODE),SEQURE) +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe # commondefs を include した後でなければならない +MAKETAD_OPTION := -s # modulerules を include する前でなければならない +endif + +#---------------------------------------------------------------------------- + +#.PHONY: build_time + +do-build: $(TARGETS) + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +$(BINDIR)/$(TARGET_BIN_BASENAME).$(TWL_ELF_EXT): make_dir +#$(BINDIR)/$(TARGET_BIN_BASENAME).$(TWL_ELF_EXT): make_dir $(BANNER) +#build_time + +#------------------------- +#-- rom_data/build_time.txt を作成します。 + +make_dir: + $(INSTALL) -d $(MAKEROM_ROMROOT) +#build_time: +# $(INSTALL) -d $(MAKEROM_ROMROOT) +# echo -n "build at `date \"+%Y/%m/%d %H:%M:%S\"` on \"`hostname`\"" > $(MAKEROM_ROMROOT)/build_time.txt + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +endif + +#===== End of Makefile ===== diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_SEQURE.bnr b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_SEQURE.bnr new file mode 100644 index 00000000..8c1a6972 Binary files /dev/null and b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_SEQURE.bnr differ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_USER.bnr b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_USER.bnr new file mode 100644 index 00000000..1383869a Binary files /dev/null and b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/banner/banner_USER.bnr differ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/dataver.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/dataver.h new file mode 100644 index 00000000..1ee7dfef --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/dataver.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: dataver.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 DATAVER_H_ +#define DATAVER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +void GetAppVersionString(char *str); +BOOL GetPublicDataInfoStrings(char *verstr, char *timestr, char *datestr); +BOOL GetPrivateDataInfoStrings(char *verstr, char *timestr, char *datestr); +BOOL SetPublicDataTimeStamp(void); +BOOL SetPrivateDataTimeStamp(void); + +s32 GetOutNandAppInfo(void); +s32 GetOurNandAppNum(void); +BOOL GetOurNandAppVersionString(s32 no, char *verstr, char *inistr); +BOOL GetOurNandAppPublicDataInfoStrings(s32 no, char *verstr, char *timestr, char *datestr); +BOOL GetOurNandAppPrivateDataInfoStrings(s32 no, char *verstr, char *timestr, char *datestr); +BOOL SetOurNandAppPublicDataTimeStamp(s32 no); +BOOL SetOurNandAppPrivateDataTimeStamp(s32 no); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* DATAVER_H_ */ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/font.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/font.h new file mode 100644 index 00000000..a323d9e1 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/font.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.h + + Copyright 2003 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/menu.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/menu.h new file mode 100644 index 00000000..8c9f7238 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/menu.h @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: menu.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 MENU_H_ +#define MENU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +//メニューに関する定義 +#define MENU_DEPTH_NUM 2 +#define MENU_ITEM_NUM 11 +#define MENU_ITEM_STRLEN 24 + +//ChangeMenuItemのパラメータ +#define MENU_ITEM_UP 0 +#define MENU_ITEM_DOWN 1 +#define MENU_DEPTH_UP 2 +#define MENU_DEPTH_DOWN 3 + + +typedef struct { + s16 nNext; // -1: これ以上枝はない + //char cItemStr[MENU_ITEM_STRLEN]; + char *cItemStr; +}menu_item_t; + +typedef struct { + s16 nPrev; // -1: 自分が親 + menu_item_t sItem[MENU_ITEM_NUM]; +}menu_sheet_t; + + +void DisplayMenuSet(void); +void InitMenu(void); +void ChangeMenuItem(u16 action); +void ExecMenuItem(void); +void ExecMenuItemB(void); +void ExecMenuItemX(void); +void ExecMenuItemRight(void); +void ExecMenuItemLeft(void); +void ExitMenuCancel(void); +void SetMenuString(u32 depth, u32 ipos, char *str); +void SetCurrentMenuString(char *str); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* MENU_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/screen.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/screen.h new file mode 100644 index 00000000..39b44f73 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/include/screen.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: screen.h + + Copyright 2003 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/readme.txt b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/readme.txt new file mode 100644 index 00000000..4076b863 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/readme.txt @@ -0,0 +1,21 @@ +セーブデータバージョンチェックソフト + +このソフトはセーブデータのインポート・エクスポートを確認するためのソフトです。 +以下のことをします。 + ・アプリバージョンを表示する + ・アプリバージョンをパブリックセーブデータ・プライベートセーブデータに保存する + ・各セーブデータに保存したバージョン番号およびタイムスタンプを表示する + +これを使うことでアプリバージョンが変わった時のセーブデータの挙動を確認することができます。 + +【使い方】 +・ソフトを起動すると以下の表示を行います +  アプリバージョン +  パブリックセーブデータに保存したバージョン番号およびタイムスタンプ +  プライベートセーブデータに保存したバージョン番号およびタイムスタンプ +・矢印↑↓で項目を選択しAボタンを押すと該当するセーブデータを書き換えます +・Xボタンを押すと全セーブデータを書き換えます + +【制限事項】 +書き換えを実行してもタイムスタンプに2秒以内の時間のずれが発生します +(ファイルシステムは2秒間隔でしか設定しないため) diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/dataver.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/dataver.c new file mode 100644 index 00000000..0cd30162 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/dataver.c @@ -0,0 +1,601 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: dataver.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 "dataver.h" +#include +#include +#include +#include + +//#define ACCESS_TEST_1 +//#define ACCESS_TEST_2 +//#define ACCESS_TEST_3 +//#define ACCESS_TEST_4 +//#define ACCESS_TEST_5 + +#define PUBDATA_VERSION_PATH "dataPub:/version" +#define PRVDATA_VERSION_PATH "dataPrv:/version" +#define OTHER_PUBDATA_VERSION_PATH "otherPub:/version" +#define OTHER_PRVDATA_VERSION_PATH "otherPrv:/version" +#define VERSION_LEN 3 +#define OUR_COMPANY_CODE 0x3031 // "01" : Nintendo +#define SELF_INITIAL_CODE 0x34564341 //"4VCA" + +static BOOL getDataInfoStrings(char *path, char *verstr, char *timestr, char *datestr); +static BOOL setDataTimeStamp(char *path); +static BOOL setOurNandAppDataTimeStamp(s32 no, BOOL pub); + +FSResult g_fs_result; +static s32 g_title_num; +static NAMTitleId g_title[40]; + +#ifdef USER_MODE +static const char* TARGET_APP = "4VDA"; +#endif + +void GetAppVersionString(char *str) +{ + u8 *pHeader, version; + + pHeader = (u8*)HW_TWL_ROM_HEADER_BUF; + version = *(pHeader + 0x1e); + + str[0] = (char)(version / 100 + 0x30); + str[1] = (char)((version % 100) / 10 + 0x30); + str[2] = (char)(version % 10 + 0x30); + str[3] = '\0'; +} + +BOOL GetPublicDataInfoStrings(char *verstr, char *timestr, char *datestr) +{ + return getDataInfoStrings(PUBDATA_VERSION_PATH, verstr, timestr, datestr); +} + +static BOOL getDataInfoStrings(char *path, char *verstr, char *timestr, char *datestr) +{ + FSFile file; + FSPathInfo info; + FSResult fresult; + + FS_InitFile( &file ); + + if( !FS_GetPathInfo(path, &info) ) + { + fresult = FS_GetArchiveResultCode(path); + return FALSE; + } + + STD_TSPrintf( timestr, "%04d/%02d/%02d", + info.mtime.year, info.mtime.month, info.mtime.day ); + STD_TSPrintf( datestr, "%02d:%02d:%02d", + info.mtime.hour, info.mtime.minute, info.mtime.second ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_R ) == FALSE ) + { + return FALSE; + } + + if( FS_ReadFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + return FALSE; + } + verstr[VERSION_LEN] = '\0'; + + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } + + return TRUE; +} + +BOOL GetPrivateDataInfoStrings(char *verstr, char *timestr, char *datestr) +{ + return getDataInfoStrings(PRVDATA_VERSION_PATH, verstr, timestr, datestr); +} + +BOOL SetPublicDataTimeStamp() +{ + return setDataTimeStamp(PUBDATA_VERSION_PATH); +} + +static BOOL setDataTimeStamp(char *path) +{ + FSFile file; + //FSPathInfo info; + char verstr[8]; + FSResult fresult; + + GetAppVersionString( verstr ); + + FS_InitFile( &file ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + if( !FS_CreateFile(path, FS_PERMIT_R | FS_PERMIT_W) ) + { + fresult = FS_GetArchiveResultCode(path); + g_fs_result = fresult; + return FALSE; + } + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + return FALSE; + } + } + + if( FS_WriteFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + return FALSE; + } + + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } + + return TRUE; +} + +BOOL SetPrivateDataTimeStamp() +{ + return setDataTimeStamp(PRVDATA_VERSION_PATH); +} + +s32 GetOutNandAppInfo(void) +{ + s32 i, j; + s32 appnum, ret; + NAMTitleInfo info; + NAMTitleId tmptitle[40]; + + NAM_Init(OS_AllocFromMain, OS_FreeToMain); + + appnum = NAM_GetNumTitles(); + if( appnum < 0 ) + return -1; + ret = NAM_GetTitleList( tmptitle, 40 ); + if( ret != NAM_OK ) + return -2; + for( i=0, j=0; i= g_title_num ) + return FALSE; + + // 該当NANDアプリのバージョンを得る + if( NAM_ReadTitleInfo( &info, g_title[no] ) != NAM_OK ) + return FALSE; + + // str に返す + //OS_TPrintf("app ver = 0x%x\n", info.version); + verstr[0] = (char)(info.version / 100 + 0x30); + verstr[1] = (char)((info.version % 100) / 10 + 0x30); + verstr[2] = (char)(info.version % 10 + 0x30); + verstr[3] = '\0'; + + ini = NAM_GetTitleIdLo(g_title[no]); + *(u32*)inistr = MI_SwapEndian32(ini); + inistr[4] = '\0'; + + return TRUE; +} + +static BOOL getOtherNandAppDataInfoStrings(s32 no, BOOL pub, char *verstr, char *timestr, char *datestr) +{ + BOOL ret = FALSE; + FSFile file; + FSPathInfo info; + FSResult fresult; + u32 ini; + NATitleArchive arc; + char *path; + const char pubpath[] = OTHER_PUBDATA_VERSION_PATH; + const char prvpath[] = OTHER_PRVDATA_VERSION_PATH; + + ini = MI_SwapEndian32( NAM_GetTitleIdLo(g_title[no]) ); + arc = pub ? NA_TITLE_ARCHIVE_DATAPUB : NA_TITLE_ARCHIVE_DATAPRV; +#ifdef USER_MODE + if( NA_LoadOtherTitleArchive( TARGET_APP, arc ) != FS_RESULT_SUCCESS ) + return FALSE; +#else + if( NA_LoadOtherTitleArchive( (char*)&ini, arc ) != FS_RESULT_SUCCESS ) + return FALSE; +#endif + path = pub ? (char*)pubpath : (char*)prvpath; + + FS_InitFile( &file ); + + if( !FS_GetPathInfo(path, &info) ) + { + fresult = FS_GetArchiveResultCode(path); + goto quit; + } + + STD_TSPrintf( timestr, "%04d/%02d/%02d", + info.mtime.year, info.mtime.month, info.mtime.day ); + STD_TSPrintf( datestr, "%02d:%02d:%02d", + info.mtime.hour, info.mtime.minute, info.mtime.second ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_R ) == FALSE ) + { + goto quit; + } + + if( FS_ReadFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + goto quit; + } + verstr[VERSION_LEN] = '\0'; + + if( FS_CloseFile( &file ) == FALSE ) + { + goto quit; + } + + ret = TRUE; + +quit: + NA_UnloadOtherTitleArchive(); + + return ret; +} + +BOOL GetOurNandAppPublicDataInfoStrings(s32 no, char *verstr, char *timestr, char *datestr) +{ + return getOtherNandAppDataInfoStrings(no, TRUE, verstr, timestr, datestr ); +} + +BOOL GetOurNandAppPrivateDataInfoStrings(s32 no, char *verstr, char *timestr, char *datestr) +{ + return getOtherNandAppDataInfoStrings(no, FALSE, verstr, timestr, datestr ); +} + + +static BOOL setOurNandAppDataTimeStamp(s32 no, BOOL pub) +{ + BOOL ret = FALSE; + FSFile file; + char verstr[8]; + //char inistr[8]; + FSResult fresult; + u32 ini; + NATitleArchive arc; + char *path; + const char pubpath[] = OTHER_PUBDATA_VERSION_PATH; + const char prvpath[] = OTHER_PRVDATA_VERSION_PATH; + + //GetOurNandAppVersionString( no, verstr, inistr ); + GetAppVersionString( verstr ); + ini = MI_SwapEndian32( NAM_GetTitleIdLo(g_title[no]) ); + + arc = pub ? NA_TITLE_ARCHIVE_DATAPUB : NA_TITLE_ARCHIVE_DATAPRV; +#ifdef USER_MODE + if( NA_LoadOtherTitleArchive( TARGET_APP, arc ) != FS_RESULT_SUCCESS ) + goto quit; +#else + if( NA_LoadOtherTitleArchive( (char*)&ini, arc ) != FS_RESULT_SUCCESS ) + goto quit; +#endif + path = pub ? (char*)pubpath : (char*)prvpath; + + FS_InitFile( &file ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + if( !FS_CreateFile(path, FS_PERMIT_R | FS_PERMIT_W) ) + { + fresult = FS_GetArchiveResultCode(path); + g_fs_result = fresult; + goto quit; + } + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + goto quit; + } + } + + if( FS_WriteFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + return FALSE; + } + + if( FS_CloseFile( &file ) == FALSE ) + { + goto quit; + } + + ret = TRUE; + +quit: + NA_UnloadOtherTitleArchive(); + + return ret; +} +BOOL SetOurNandAppPublicDataTimeStamp(s32 no) +{ + return setOurNandAppDataTimeStamp( no, TRUE ); +} + +BOOL SetOurNandAppPrivateDataTimeStamp(s32 no) +{ + return setOurNandAppDataTimeStamp( no, FALSE ); +} + +#if 0 +/* *INDENT-OFF* */ +static const char * const fs_result_strings[] = +{ + "FS_RESULT_SUCCESS", + "FS_RESULT_FAILURE", + "FS_RESULT_BUSY", + "FS_RESULT_CANCELED", + "FS_RESULT_UNSUPPORTED", + "FS_RESULT_ERROR", + "FS_RESULT_INVALID_PARAMETER", + "FS_RESULT_NO_MORE_RESOUCE", + "FS_RESULT_ALREADY_DONE", + "FS_RESULT_PERMISSION_DENIED", + "FS_RESULT_MEDIA_FATAL", + "FS_RESULT_NO_ENTRY", + "FS_RESULT_MEDIA_NOTHING", + "FS_RESULT_MEDIA_UNKNOWN", + "FS_RESULT_BAD_FORMAT", +}; +static const size_t fs_result_string_max = sizeof(fs_result_strings) / sizeof(*fs_result_strings); +SDK_COMPILER_ASSERT(fs_result_string_max == FS_RESULT_MAX); +/* *INDENT-ON* */ + +static void ReportLastErrorPath(const char *path) +{ + FSResult result = FS_GetArchiveResultCode(path); + + SDK_ASSERT((result >= 0) && (result < fs_result_string_max)); + OS_TPrintf("FS error:\n \"%s\"\n %s\n", + path, fs_result_strings[result]); +} + +static void ReportLastErrorFile(const FSFile *file) +{ + FSArchive *arc = FS_GetAttachedArchive(file); + FSResult result = FS_GetResultCode(file); + + SDK_ASSERT((result >= 0) && (result < fs_result_string_max)); + OS_TPrintf("FS error:\n (archive \"%s:\")\n %s\n", + FS_GetArchiveName(arc), fs_result_strings[result]); +} + +BOOL PubDataAccessTest(void) +{ + BOOL ret; + FSFile file, dir; + FSResult res; + FSArchiveResource resource; + static const char *testdir = "dataPub:/testdir"; + static const char *testfile = "dataPub:/testdir/test.txt"; + +#if defined(ACCESS_TEST_1) + FS_InitFile( &file ); + FS_InitFile( &dir ); + +#if 1 + if( FS_OpenDirectory( &dir, testdir, FS_FILEMODE_R | FS_FILEMODE_W ) ) + { + OS_TPrintf("%s already exists\n", testdir); + FS_CloseDirectory( &dir ); + } + else if( FS_CreateDirectory( testdir, FS_PERMIT_R | FS_PERMIT_W ) == FALSE ) + { + res = FS_GetArchiveResultCode( testdir ); + return FALSE; + } +#endif + +#if 1 + if( FS_CreateFile( testfile, FS_PERMIT_R | FS_PERMIT_W ) == FALSE ) + { + OS_TPrintf("dataPub:/testdir/test.txt already exists\n"); + //return FALSE; + } + + // dataPub:/testdir/test.txt を開いてみる + if( FS_OpenFileEx( &file, testfile, FS_FILEMODE_W ) == FALSE ) + { + return FALSE; + } + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } +#endif +#elif defined(ACCESS_TEST_2) + if( FS_GetArchiveResource("rom:/", &resource) == FALSE ) + { + res = FS_GetArchiveResultCode( "dataPub:/" ); + return FALSE; + } +#elif defined(ACCESS_TEST_3) + { + FSArchive* FSi_GetArchiveChain(void); + FSArchive *arc; + + for (arc = FSi_GetArchiveChain(); arc ; arc = arc->next) + { + FSPathInfo info[1]; + char path[FS_ENTRY_LONGNAME_MAX]; + + OS_Printf("archive - %s\n", FS_GetArchiveName(arc)); + } + } +#elif defined(ACCESS_TEST_4) + { + static const char *basedir = "dataPub:/test"; + static const char *basedir2 = "dataPub:"; + char tmppath[FS_ENTRY_LONGNAME_MAX]; + FSArchiveResource resource; + static FSResult fresult; + + // at first, initialize FSFile structures. (equal to C++ constructor) + FSFile sfile[1]; + FSFile sdir[1]; + FS_InitFile(sfile); + FS_InitFile(sdir); + + if( !FS_GetArchiveResource(basedir2, &resource) ) + { + fresult = FS_GetArchiveResultCode(basedir2); + return FALSE; + } + + // DIRECTORY CREATION TEST + { + if (FS_OpenDirectory(sdir, basedir, FS_FILEMODE_R | FS_FILEMODE_W)) + { + OS_TPrintf("\"%s\" already exists.\n", basedir); + (void)FS_CloseDirectory(sdir); + } + else if (!FS_CreateDirectory(basedir, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(basedir); + OS_TPanic("FS_CreateDirectory(\"%s\") failed.\n", basedir); + } + else + { + int i; + OS_TPrintf("FS_CreateDirectory(\"%s\") succeeded.\n", basedir); + for (i = 1; i <= 3; ++i) + { + (void)STD_TSPrintf(tmppath, "%s/dir%d", basedir, i); + if (!FS_CreateDirectory(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_CreateDirectory(%s) failed.\n", tmppath); + } + else + { + OS_TPrintf("FS_CreateDirectory(%s) succeeded.\n", tmppath); + } + } + } + } + // DIRECTORY DELETION TEST + { + STD_TSPrintf(tmppath, "%s/tmp/", basedir); + if (!FS_CreateDirectory(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + OS_TPrintf("FS_CreateDirectory(\"%s\") failed.\n", tmppath); + } + if (!FS_DeleteDirectory(tmppath)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_DeleteDirectory(\"%s\") failed.\n", tmppath); + } + } + // DIRECTORY DELETE + if (!FS_DeleteDirectoryAuto(basedir)) + { + ReportLastErrorPath(basedir); + OS_TPanic("FS_DeleteDirectoryAuto(\"%s\") failed.\n", basedir); + } + } +#elif defined(ACCESS_TEST_5) + { + static const char *basedir = "dataPub:/test"; + char tmppath[FS_ENTRY_LONGNAME_MAX]; + + // at first, initialize FSFile structures. (equal to C++ constructor) + FSFile sfile[1]; + FSFile sdir[1]; + FS_InitFile(sfile); + FS_InitFile(sdir); + + // FILE CREATION TEST + { + enum { file_max = 3 }; + static const char *(message[file_max]) = + { + "hello, world!", + "foobar", + "hogehoge", + }; + int i; + for (i = 0; i < file_max; ++i) + { + STD_TSPrintf(tmppath, "%s/arm9%d.txt", basedir, i); + if (!FS_CreateFile(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + } + else + { + OS_TPrintf("FS_CreateFile(%s) succeeded.\n", tmppath); + if (!FS_OpenFileEx(sfile, tmppath, FS_FILEMODE_W)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_OpenFileEx(%s) failed.\n", tmppath); + } + else + { + if (FS_WriteFile(sfile, message[i], STD_GetStringLength(message[i])) < 0) + { + ReportLastErrorFile(sfile); + OS_TPanic("FS_WritFile() failed.\n"); + } + else + { + OS_TPrintf("FS_WritFile() succeeded.\n"); + } + } + (void)FS_CloseFile(sfile); + } + } + } + } +#endif + + return TRUE; +} +#endif diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/font.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/font.c new file mode 100644 index 00000000..30670436 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/font.c @@ -0,0 +1,574 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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 "font.h" + +//---------------------------------------------------------------- +// Character data +// +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +//---------------------------------------------------------------- +// Palette data +// +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/main.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/main.c new file mode 100644 index 00000000..d1fe1362 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/main.c @@ -0,0 +1,255 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: main.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include +#include "font.h" +#include "screen.h" +#include "menu.h" + +static void myInit(void); +static void myVBlankIntr(void); +static void InitializeAllocateSystem(void); +static void PrintBootType(void); + +extern BOOL PubDataAccessTest(void); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: main + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + u16 trigger; + u16 preButton = PAD_Read(); + u16 button; + + //---------------- initialize + myInit(); + InitMenu(); + PrintBootType(); + +#if 0 + if( PubDataAccessTest() == FALSE ) + { + OS_Printf("Data access NG\n"); + return; + } +#endif + + //---------------- main loop + while (TRUE) + { + button = PAD_Read(); + trigger = (u16)((button ^ preButton) & button); + preButton = button; + + //---- clear screen buffer + ClearScreen(); + + //---- display menus + DisplayMenuSet(); + + //---- press UP key (toggle menu) + if(trigger & PAD_KEY_UP) + { + ChangeMenuItem(MENU_ITEM_UP); + } + + if(trigger & PAD_KEY_DOWN) + { + ChangeMenuItem(MENU_ITEM_DOWN); + } + if(trigger & PAD_KEY_RIGHT) + { + ExecMenuItemRight(); + } + if(trigger & PAD_KEY_LEFT) + { + ExecMenuItemLeft(); + } + + //---- push A + if (trigger & PAD_BUTTON_A) + { + ExecMenuItem(); + } + //---- push B + if (trigger & PAD_BUTTON_B) + { + ExecMenuItemB(); + } + //---- push X + if (trigger & PAD_BUTTON_X) + { + ExecMenuItemX(); + } + + OS_WaitVBlankIntr(); + } +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + RTC_Init(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + InitializeAllocateSystem(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSystemInit + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + FS_Init( FS_DMA_NOT_USE ); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitializeAllocateSystem(void) +{ + void *tempLo; + OSHeapHandle hh; + + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_Panic("ARM9: Fail to create heap...\n"); + } + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +static void PrintBootType(void) +{ + const OSBootType btype = OS_GetBootType(); + + switch( btype ) + { + case OS_BOOTTYPE_ROM: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_ROM\n"); break; + case OS_BOOTTYPE_NAND: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_NAND\n"); break; + default: + { + OS_Warning("unknown BootType(=%d)", btype); + } + break; + } +} + diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/menu.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/menu.c new file mode 100644 index 00000000..0a990fb6 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/menu.c @@ -0,0 +1,652 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: menu.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 "font.h" +#include "screen.h" +#include "menu.h" +#include "dataver.h" +#include + +/* + * menu.c + * メニュー表示機能 + * + * テストアプリに適した簡単なメニュー表示を行う。メニュー階層は複数段可能。 + * + * なお、この機能を使用するためには、以下のソースが必要 + * font.c, font.h, screen.c, screen.h + * + * 導入手順: + * 1, menu.hの以下の定義値を変更する + * MENU_DEPTH_NUM : メニューの階層数 + * MENU_ITEM_NUM : メニュー項目の最大数 + * MENU_ITEM_STRLEN : メニュー表示文字列の最大長 + * 2, menu.cの以下の定義を変更する + * MENU_TITLE : メニューのタイトル + * 3, 以下の構造体を変更する + * MenuItem : メニュー表示内容および階層間情報 + * 4, 関数 ExecMenuItem() がメニュー項目に応じた処理を定義するハンドラなので、 + * 定義を行う + * 5, Mainから以下の関数を呼ぶ + * InitMenu : メニュー関連の初期化 + * DisplayMenuSet : メニュー機能の表示 + * ChangeMenuItem : メニュー選択項目の変更(この関数はキー操作時に呼び出すようにする) + * ExecMenuItem : メニュー項目に応じた処理の実行(この関数はキー操作時に呼び出すようにする) + * + * + * 不明な点は安田まで。 + */ + +#define MENU_TITLE "APP version viewer" +//#define NEW_MENU_POS // YASUDA +#define DRAW_LINE_AS_CHAR + +static char cItemStr[MENU_ITEM_NUM][MENU_ITEM_STRLEN]; +static char cItemSt2[MENU_ITEM_NUM][MENU_ITEM_STRLEN]; + +static menu_sheet_t MenuItem[MENU_DEPTH_NUM] = +{ + {-1, -1, cItemStr[0], -1, cItemStr[1], -1, cItemStr[2], -1, cItemStr[3], + -1, cItemStr[4], -1, cItemStr[5], -1, cItemStr[6], -1, cItemStr[7], + -1, cItemStr[8], -1, cItemStr[9], 1, cItemStr[10] }, + { 0, -1, cItemSt2[0], -1, cItemSt2[1], -1, cItemSt2[2], -1, cItemSt2[3], + -1, cItemSt2[4], -1, cItemSt2[5], -1, cItemSt2[6], -1, cItemSt2[7], + -1, cItemSt2[8], -1, cItemSt2[9], -1, cItemSt2[10] }, +}; + +static s16 MenuDepth; +static s16 MenuPos; +static u8 isMenuCancel = 0; + +//---- for RTC +static RTCTime myCurrentTime; +static int myResult; + +static void DisplayControlInfo(void); +static void DisplayMenu(void); +static void EnterMenuCancel(void); + +static void setAllItems(void); +static void setAppVerItem(void); +static void setPublicDataItem(void); +static void setPrivateDataItem(void); +static void setOtherDataItem(void); +static void setAllItems_OtherApp(void); +static void setOtherAppVerItem(void); +static void setOtherNandAppPublicDataItem(void); +static void setOtherNandAppPrivateDataItem(void); + +// YASUDA +extern FSResult g_fs_result; + +static s32 g_other_app_num = 0; +static s32 g_current_other_app = 0; + +#ifdef USER_MODE + char* APP_TYPE = "USER"; +#else + char* APP_TYPE = "SEQURE"; +#endif + + +//---------------------------------------------------------------- +// InitMenu +// +void InitMenu(void) +{ + MenuDepth = 0; + MenuPos = 2; + + GetOutNandAppInfo(); + + setAllItems(); +#if defined(DRAW_LINE_AS_CHAR) + STD_CopyString( MenuItem[0].sItem[1].cItemStr, "---------+------------" ); + STD_CopyString( MenuItem[0].sItem[5].cItemStr, "---------+------------" ); + STD_CopyString( MenuItem[0].sItem[9].cItemStr, "---------+------------" ); +#endif +} + +//---------------------------------------------------------------- +// DisplayMenuSet +// +void DisplayMenuSet(void) +{ + if(isMenuCancel > 0) + { + return; + } + + //PrintString(3, 3, 15, "parameter is %d", param); + DisplayMenu(); + + //---- display time + myResult = RTC_GetTime(&myCurrentTime); + if (myResult == 0 /*no error */ ) + { +#if !defined(NEW_MENU_POS) + PrintString(5, 21, 8, "%02d:%02d:%02d", + myCurrentTime.hour, myCurrentTime.minute, myCurrentTime.second); +#else + PrintString(5, 23, 8, "%02d:%02d:%02d", + myCurrentTime.hour, myCurrentTime.minute, myCurrentTime.second); +#endif + } + + //---- display counter + //PrintString(18, 20, 4, "%08X", OS_GetVBlankCount()); + + //---- display control infomation + DisplayControlInfo(); +} + +//---------------------------------------------------------------- +// DisplayControlInfo +// +static void DisplayControlInfo(void) +{ + if(MenuDepth == 0) + { + //---- display key description + PrintString(3, 2, 15, MENU_TITLE); + + if( MenuPos != 10 ) + { +#if !defined(NEW_MENU_POS) + PrintString(5, 17, 15, "[A] set current data"); + PrintString(5, 18, 15, "[X] set both data"); +#else + PrintString(5, 19, 15, "[A] set current data"); + PrintString(5, 20, 15, "[X] set both data"); +#endif + } + else + { +#if !defined(NEW_MENU_POS) + PrintString(5, 17, 15, "[A] show other app data"); + PrintString(5, 18, 15, "[X] set both data"); +#else + PrintString(5, 19, 15, "[A] show other app data"); + PrintString(5, 20, 15, "[X] set both data"); +#endif + } + } + else + { + //---- display key description + PrintString(3, 2, 15, "OTHER APP info"); + +#if !defined(NEW_MENU_POS) + PrintString(5, 17, 15, "[A/X] set data"); + PrintString(5, 18, 15, "[B] return main"); + PrintString(5, 19, 15, "[<-/->] switch apps"); +#else + PrintString(5, 19, 15, "[A/X] set data"); + PrintString(5, 20, 15, "[B] set both data"); + PrintString(5, 21, 15, "[<-/->] switch apps"); +#endif + } +} + +//---------------------------------------------------------------- +// DisplayMenu +// +static void DisplayMenu(void) +{ + u16 pos; + char *str; + + PrintString(0, 0, 14, APP_TYPE); + + + for(pos = 0; pos < MENU_ITEM_NUM; pos++) + { + str = MenuItem[MenuDepth].sItem[pos].cItemStr; + //---- display key description + if( str[0] != '\0' ) + { +#if !defined(DRAW_LINE_AS_CHAR) + PrintString(3, (s16)(5 + pos), 15, str); +#else + if( MenuDepth == 0 ) + { + if( (pos != 1) && (pos != 5) && (pos != 9) ) + { + PrintString(3, (s16)(5 + pos), 15, str); + } + else + { + PrintString(3, (s16)(5 + pos), 6, str); + } + } + else + { + if( (pos != 2) && (pos != 6) ) + { + PrintString(3, (s16)(5 + pos), 15, str); + } + else + { + PrintString(3, (s16)(5 + pos), 5, str); + } + } +#endif + } + + PrintString(1, (s16)(5 + MenuPos), 8, "#"); + } +} + + +//---------------------------------------------------------------- +// ChangeMenuItem +// +void ChangeMenuItem(u16 action) +{ + switch(action) + { + case MENU_ITEM_UP: + ColorString((s16)(1 + MenuPos), 5, 1, 0); + MenuPos--; + if(MenuPos < 0) + { + MenuPos = 0; + } + //動作のチューニング + if( MenuDepth == 0 ) + { + if( (MenuPos>=0) && (MenuPos<6) ){ + MenuPos = 2; + }else if( (MenuPos>=6) && (MenuPos<10) ){ + MenuPos = 6; + }else if( (MenuPos>=10) && (MenuPos<11) ){ + MenuPos = 10; + } + } + else + { + if( (MenuPos>=0) && (MenuPos<7) ){ + MenuPos = 3; + }else if( (MenuPos>=7) && (MenuPos<11) ){ + MenuPos = 7; + } + } + break; + case MENU_ITEM_DOWN: + ColorString((s16)(1 + MenuPos), 5, 1, 0); + MenuPos++; + if(MenuPos >= MENU_ITEM_NUM) + { + MenuPos--; + } + if(MenuItem[MenuDepth].sItem[MenuPos].cItemStr[0] == '\0') + { + MenuPos--; + } + //動作のチューニング + if( MenuDepth == 0 ) + { + if( (MenuPos>0) && (MenuPos<=2) ){ + MenuPos = 2; + }else if( (MenuPos>2) && (MenuPos<=6) ){ + MenuPos = 6; + }else if( (MenuPos>6) && (MenuPos<=10) ){ + MenuPos = 10; + } + } + else + { + if( (MenuPos>0) && (MenuPos<=3) ){ + MenuPos = 3; + }else if( (MenuPos>3) && (MenuPos<=10) ){ + MenuPos = 7; + } + } + break; + case MENU_DEPTH_UP: + MenuDepth = MenuItem[MenuDepth].nPrev; + MenuPos = 0; + if(MenuDepth < 0) + { + MenuDepth = 0; + } + break; + case MENU_DEPTH_DOWN: + { + s16 pos; + pos = MenuItem[MenuDepth].sItem[MenuPos].nNext; + if(pos >= 0) + { + MenuDepth = pos; + MenuPos = 0; + } + } + break; + } +} + + +//---------------------------------------------------------------- +// ExecMenuItem +// +void ExecMenuItem(void) +{ + switch(MenuDepth) + { + case 0: + switch(MenuPos) + { + case 0: + break; + case 2: + // Public data タイムスタンプ変更 + SetPublicDataTimeStamp(); + setPublicDataItem(); + break; + case 6: + // Private data タイムスタンプ変更 + SetPrivateDataTimeStamp(); + setPrivateDataItem(); + setOtherDataItem(); + break; + case 10: + // 他アプリデータ表示へ + ChangeMenuItem(MENU_DEPTH_DOWN); + MenuPos = 3; + setAllItems_OtherApp(); + break; + default: + break; + } + break; + case 1: + switch(MenuPos) + { + case 3: + // 該当アプリのPublic data タイムスタンプ変更 + SetOurNandAppPublicDataTimeStamp(g_current_other_app); + setOtherNandAppPublicDataItem(); + break; + case 7: + // 該当アプリのPrivate data タイムスタンプ変更 + SetOurNandAppPrivateDataTimeStamp(g_current_other_app); + setOtherNandAppPrivateDataItem(); + break; + default: + break; + } + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// ExecMenuItemB +// +void ExecMenuItemB(void) +{ + switch(MenuDepth) + { + case 1: + // メインメニューに戻る + ChangeMenuItem(MENU_DEPTH_UP); + MenuPos = 2; + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// ExecMenuItemX +// +void ExecMenuItemX(void) +{ + switch(MenuDepth) + { + case 0: + switch(MenuPos) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + // 両 data タイムスタンプ変更 + SetPublicDataTimeStamp(); + SetPrivateDataTimeStamp(); + setAllItems(); + break; + default: + break; + } + break; + case 1: + // 両 data タイムスタンプ変更 + SetOurNandAppPublicDataTimeStamp(g_current_other_app); + SetOurNandAppPrivateDataTimeStamp(g_current_other_app); + setAllItems_OtherApp(); + break; + default: + break; + } +} + + +//---------------------------------------------------------------- +// ExecMenuItemRight +// +void ExecMenuItemRight(void) +{ + switch(MenuDepth) + { + case 1: + // アプリ番号を変更 + if( g_other_app_num > 0 ) + { + if(++g_current_other_app >= g_other_app_num ) + { + g_current_other_app = 0; + } + // 表示書き換え + setAllItems_OtherApp(); + } + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// ExecMenuItemLeft +// +void ExecMenuItemLeft(void) +{ + switch(MenuDepth) + { + case 1: + // アプリ番号を変更 + if( g_other_app_num > 0 ) + { + if(--g_current_other_app < 0) + { + g_current_other_app = g_other_app_num - 1; + } + // 表示書き換え + setAllItems_OtherApp(); + } + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// EnterMenuCancel +// +static void EnterMenuCancel(void) +{ + isMenuCancel = 1; + ClearScreen(); +} + +//---------------------------------------------------------------- +// ExitMenuCancel +// +void ExitMenuCancel(void) +{ + if(isMenuCancel > 0){ + isMenuCancel = 0; + } +} + +void SetMenuString(u32 depth, u32 ipos, char *str) +{ + STD_CopyString( MenuItem[depth].sItem[ipos].cItemStr, str ); +} + +void SetCurrentMenuString(char *str) +{ + SetMenuString( MenuDepth, MenuPos, str ); +} + +static void setAllItems(void) +{ + setAppVerItem(); + setPublicDataItem(); + setPrivateDataItem(); + setOtherDataItem(); +} + +static void setAppVerItem(void) +{ + char ver[8]; + + GetAppVersionString(ver); + STD_TSPrintf( cItemStr[0], "APP ver : %s", ver ); +} + +static void setPublicDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetPublicDataInfoStrings( ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemStr[2], "PUB ver : %s", ver ); + STD_TSPrintf( cItemStr[3], " date : %s", time1 ); + STD_TSPrintf( cItemStr[4], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemStr[2], "PUB : NONE", ver ); + STD_TSPrintf( cItemStr[3], " " ); + STD_TSPrintf( cItemStr[4], " " ); + } +} + +static void setPrivateDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetPrivateDataInfoStrings( ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemStr[6], "PRV ver : %s", ver ); + STD_TSPrintf( cItemStr[7], " date : %s", time1 ); + STD_TSPrintf( cItemStr[8], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemStr[6], "PRV : NONE" ); + STD_TSPrintf( cItemStr[7], " " ); + STD_TSPrintf( cItemStr[8], " " ); + } +} + +static void setOtherDataItem(void) +{ + g_other_app_num = GetOurNandAppNum(); + STD_TSPrintf( cItemStr[10], "OTHER : %d apps", g_other_app_num ); +} + +static void setAllItems_OtherApp(void) +{ + setOtherAppVerItem(); + setOtherNandAppPublicDataItem(); + setOtherNandAppPrivateDataItem(); + +#if defined(DRAW_LINE_AS_CHAR) + STD_CopyString( MenuItem[1].sItem[2].cItemStr, "---------+-------------" ); + STD_CopyString( MenuItem[1].sItem[6].cItemStr, "---------+-------------" ); +#endif +} + +static void setOtherAppVerItem(void) +{ + char ver[8], ini[8]; + + if( g_other_app_num == 0 ) + { + STD_TSPrintf( cItemSt2[0], "OTHER APP : none" ); + } + else + { + GetOurNandAppVersionString( g_current_other_app, ver, ini ); + + STD_TSPrintf( cItemSt2[0], "No. : %02d/%02d (%s)", + g_current_other_app + 1, g_other_app_num, ini ); + STD_TSPrintf( cItemSt2[1], "APP ver : %s", ver ); + } +} + + +static void setOtherNandAppPublicDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetOurNandAppPublicDataInfoStrings( g_current_other_app, ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemSt2[3], "PUB ver : %s", ver ); + STD_TSPrintf( cItemSt2[4], " date : %s", time1 ); + STD_TSPrintf( cItemSt2[5], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemSt2[3], "PUB : NONE", ver ); + STD_TSPrintf( cItemSt2[4], " " ); + STD_TSPrintf( cItemSt2[5], " " ); + } +} + +static void setOtherNandAppPrivateDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetOurNandAppPrivateDataInfoStrings( g_current_other_app, ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemSt2[7], "PRV ver : %s", ver ); + STD_TSPrintf( cItemSt2[8], " date : %s", time1 ); + STD_TSPrintf( cItemSt2[9], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemSt2[7], "PRV : NONE" ); + STD_TSPrintf( cItemSt2[8], " " ); + STD_TSPrintf( cItemSt2[9], " " ); + } +} diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/screen.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/screen.c new file mode 100644 index 00000000..58b6c424 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion/src/screen.c @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include "screen.h" + +u16 gScreen[32 * 32]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/Makefile b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/Makefile new file mode 100644 index 00000000..19d62810 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/Makefile @@ -0,0 +1,106 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - save_data - DisplayVersion +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +TWL_NANDAPP := TRUE + +SRCS = main.c font.c screen.c menu.c dataver.c +MASTER_NAME = SaveDataTest +APP_NAME = $(MASTER_NAME)_TARGET +TARGET_BIN = $(APP_NAME).tad + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = test.autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_nand.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + TitleName=VER_CHECKER \ + GameCode=4VDA \ + BannerFile=./banner/banner_TARGET.bnr \ + PublicSaveDataSize=16K \ + PrivateSaveDataSize=16K + + +#------------------------- +#-- カードアプリと同様に ROM-FS にファイルを持たせます。 + +#MAKEROM_ROMROOT = ./rom_data +#MAKEROM_ROMFILES = *.* + +#------------------------- +# インストール指定 + +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(MASTER_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + +#------------------------- +# rom 内のファイルは全て自動生成なので clean で削除されるようにします +LDIRT_CLEAN = $(MAKEROM_ROMROOT) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +#include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +#.PHONY: build_time + +do-build: $(TARGETS) + + +$(BINDIR)/$(TARGET_BIN_BASENAME).$(TWL_ELF_EXT): make_dir +#build_time + +#------------------------- +#-- rom_data/build_time.txt を作成します。 + +make_dir: + $(INSTALL) -d $(MAKEROM_ROMROOT) +#build_time: +# $(INSTALL) -d $(MAKEROM_ROMROOT) +# echo -n "build at `date \"+%Y/%m/%d %H:%M:%S\"` on \"`hostname`\"" > $(MAKEROM_ROMROOT)/build_time.txt + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/banner/banner_TARGET.bnr b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/banner/banner_TARGET.bnr new file mode 100644 index 00000000..878bdab7 Binary files /dev/null and b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/banner/banner_TARGET.bnr differ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/dataver.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/dataver.h new file mode 100644 index 00000000..c8756072 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/dataver.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: dataver.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 DATAVER_H_ +#define DATAVER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +void GetAppVersionString(char *str); +BOOL GetPublicDataInfoStrings(char *verstr, char *timestr, char *datestr); +BOOL GetPrivateDataInfoStrings(char *verstr, char *timestr, char *datestr); +BOOL SetPublicDataTimeStamp(void); +BOOL SetPrivateDataTimeStamp(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* DATAVER_H_ */ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/font.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/font.h new file mode 100644 index 00000000..a323d9e1 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/font.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.h + + Copyright 2003 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/menu.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/menu.h new file mode 100644 index 00000000..c8a58ef2 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/menu.h @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: menu.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 MENU_H_ +#define MENU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +//メニューに関する定義 +#define MENU_DEPTH_NUM 1 +#define MENU_ITEM_NUM 9 +#define MENU_ITEM_STRLEN 24 + +//ChangeMenuItemのパラメータ +#define MENU_ITEM_UP 0 +#define MENU_ITEM_DOWN 1 +#define MENU_DEPTH_UP 2 +#define MENU_DEPTH_DOWN 3 + + +typedef struct { + s16 nNext; // -1: これ以上枝はない + //char cItemStr[MENU_ITEM_STRLEN]; + char *cItemStr; +}menu_item_t; + +typedef struct { + s16 nPrev; // -1: 自分が親 + menu_item_t sItem[MENU_ITEM_NUM]; +}menu_sheet_t; + + +void DisplayMenuSet(void); +void InitMenu(void); +void ChangeMenuItem(u16 action); +void ExecMenuItem(void); +void ExecMenuItemX(void); +void ExitMenuCancel(void); +void SetMenuString(u32 depth, u32 ipos, char *str); +void SetCurrentMenuString(char *str); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* MENU_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/screen.h b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/screen.h new file mode 100644 index 00000000..39b44f73 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/include/screen.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: screen.h + + Copyright 2003 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/readme.txt b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/readme.txt new file mode 100644 index 00000000..ef1ef7d5 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/readme.txt @@ -0,0 +1,23 @@ +セーブデータバージョンチェックソフトの相方 + +このソフトはDisplayVersionの相方です。 +以下のことをします。 + ・アプリバージョンを表示する + ・アプリバージョンをパブリックセーブデータ・プライベートセーブデータに保存する + ・各セーブデータに保存したバージョン番号およびタイムスタンプを表示する + +DisplayVersionとの違いは共有データアクセス機能がないこととイニシャルコードが違うこと +にあります。 + +【使い方】 +・ソフトを起動すると以下の表示を行います +  アプリバージョン +  パブリックセーブデータに保存したバージョン番号およびタイムスタンプ +  プライベートセーブデータに保存したバージョン番号およびタイムスタンプ +・矢印↑↓で項目を選択しAボタンを押すと該当するセーブデータを書き換えます +・Xボタンを押すと全セーブデータを書き換えます + +【制限事項】 +DisplayVersionと同様の制限事項があります。 +書き換えを実行してもタイムスタンプに2秒以内の時間のずれが発生します +(ファイルシステムは2秒間隔でしか設定しないため) diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/dataver.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/dataver.c new file mode 100644 index 00000000..65f53ae5 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/dataver.c @@ -0,0 +1,379 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: dataver.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 "dataver.h" +#include + +#define ACCESS_TEST_1 +//#define ACCESS_TEST_2 +//#define ACCESS_TEST_3 +//#define ACCESS_TEST_4 +//#define ACCESS_TEST_5 + +#define PUBDATA_VERSION_PATH "dataPub:/version" +#define PRVDATA_VERSION_PATH "dataPrv:/version" +#define VERSION_LEN 3 + +static BOOL getDataInfoStrings(char *path, char *verstr, char *timestr, char *datestr); +static BOOL setDataTimeStamp(char *path); + +FSResult g_fs_result; + +void GetAppVersionString(char *str) +{ + u8 *pHeader, version; + + pHeader = (u8*)HW_TWL_ROM_HEADER_BUF; + version = *(pHeader + 0x1e); + + str[0] = (char)(version / 100 + 0x30); + str[1] = (char)((version % 100) / 10 + 0x30); + str[2] = (char)(version % 10 + 0x30); + str[3] = '\0'; +} + +BOOL GetPublicDataInfoStrings(char *verstr, char *timestr, char *datestr) +{ + return getDataInfoStrings(PUBDATA_VERSION_PATH, verstr, timestr, datestr); +} + +static BOOL getDataInfoStrings(char *path, char *verstr, char *timestr, char *datestr) +{ + FSFile file; + FSPathInfo info; + FSResult fresult; + + FS_InitFile( &file ); + + if( !FS_GetPathInfo(path, &info) ) + { + fresult = FS_GetArchiveResultCode(path); + return FALSE; + } + + STD_TSPrintf( timestr, "%04d/%02d/%02d", + info.mtime.year, info.mtime.month, info.mtime.day ); + STD_TSPrintf( datestr, "%02d:%02d:%02d", + info.mtime.hour, info.mtime.minute, info.mtime.second ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_R ) == FALSE ) + { + return FALSE; + } + + if( FS_ReadFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + return FALSE; + } + verstr[VERSION_LEN] = '\0'; + + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } + + return TRUE; +} + +BOOL GetPrivateDataInfoStrings(char *verstr, char *timestr, char *datestr) +{ + return getDataInfoStrings(PRVDATA_VERSION_PATH, verstr, timestr, datestr); +} + +BOOL SetPublicDataTimeStamp() +{ + return setDataTimeStamp(PUBDATA_VERSION_PATH); +} + +static BOOL setDataTimeStamp(char *path) +{ + FSFile file; + //FSPathInfo info; + char verstr[8]; + FSResult fresult; + + GetAppVersionString( verstr ); + + FS_InitFile( &file ); + + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + if( !FS_CreateFile(path, FS_PERMIT_R | FS_PERMIT_W) ) + { + fresult = FS_GetArchiveResultCode(path); + g_fs_result = fresult; + return FALSE; + } + if( FS_OpenFileEx( &file, path, FS_FILEMODE_W ) == FALSE ) + { + return FALSE; + } + } + + if( FS_WriteFile( &file, verstr, VERSION_LEN ) != VERSION_LEN ) + { + return FALSE; + } + + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } + + return TRUE; +} + +BOOL SetPrivateDataTimeStamp() +{ + return setDataTimeStamp(PRVDATA_VERSION_PATH); +} + + +#if 0 +/* *INDENT-OFF* */ +static const char * const fs_result_strings[] = +{ + "FS_RESULT_SUCCESS", + "FS_RESULT_FAILURE", + "FS_RESULT_BUSY", + "FS_RESULT_CANCELED", + "FS_RESULT_UNSUPPORTED", + "FS_RESULT_ERROR", + "FS_RESULT_INVALID_PARAMETER", + "FS_RESULT_NO_MORE_RESOUCE", + "FS_RESULT_ALREADY_DONE", + "FS_RESULT_PERMISSION_DENIED", + "FS_RESULT_MEDIA_FATAL", + "FS_RESULT_NO_ENTRY", + "FS_RESULT_MEDIA_NOTHING", + "FS_RESULT_MEDIA_UNKNOWN", + "FS_RESULT_BAD_FORMAT", +}; +static const size_t fs_result_string_max = sizeof(fs_result_strings) / sizeof(*fs_result_strings); +SDK_COMPILER_ASSERT(fs_result_string_max == FS_RESULT_MAX); +/* *INDENT-ON* */ + +static void ReportLastErrorPath(const char *path) +{ + FSResult result = FS_GetArchiveResultCode(path); + + SDK_ASSERT((result >= 0) && (result < fs_result_string_max)); + OS_TPrintf("FS error:\n \"%s\"\n %s\n", + path, fs_result_strings[result]); +} + +static void ReportLastErrorFile(const FSFile *file) +{ + FSArchive *arc = FS_GetAttachedArchive(file); + FSResult result = FS_GetResultCode(file); + + SDK_ASSERT((result >= 0) && (result < fs_result_string_max)); + OS_TPrintf("FS error:\n (archive \"%s:\")\n %s\n", + FS_GetArchiveName(arc), fs_result_strings[result]); +} + +BOOL PubDataAccessTest(void) +{ + BOOL ret; + FSFile file, dir; + FSResult res; + FSArchiveResource resource; + static const char *testdir = "dataPub:/testdir"; + static const char *testfile = "dataPub:/testdir/test.txt"; + +#if defined(ACCESS_TEST_1) + FS_InitFile( &file ); + FS_InitFile( &dir ); + +#if 1 + if( FS_OpenDirectory( &dir, testdir, FS_FILEMODE_R | FS_FILEMODE_W ) ) + { + OS_TPrintf("%s already exists\n", testdir); + FS_CloseDirectory( &dir ); + } + else if( FS_CreateDirectory( testdir, FS_PERMIT_R | FS_PERMIT_W ) == FALSE ) + { + res = FS_GetArchiveResultCode( testdir ); + return FALSE; + } +#endif + +#if 1 + if( FS_CreateFile( testfile, FS_PERMIT_R | FS_PERMIT_W ) == FALSE ) + { + OS_TPrintf("dataPub:/testdir/test.txt already exists\n"); + //return FALSE; + } + + // dataPub:/testdir/test.txt を開いてみる + if( FS_OpenFileEx( &file, testfile, FS_FILEMODE_W ) == FALSE ) + { + return FALSE; + } + if( FS_CloseFile( &file ) == FALSE ) + { + return FALSE; + } +#endif +#elif defined(ACCESS_TEST_2) + if( FS_GetArchiveResource("rom:/", &resource) == FALSE ) + { + res = FS_GetArchiveResultCode( "dataPub:/" ); + return FALSE; + } +#elif defined(ACCESS_TEST_3) + { + FSArchive* FSi_GetArchiveChain(void); + FSArchive *arc; + + for (arc = FSi_GetArchiveChain(); arc ; arc = arc->next) + { + FSPathInfo info[1]; + char path[FS_ENTRY_LONGNAME_MAX]; + + OS_Printf("archive - %s\n", FS_GetArchiveName(arc)); + } + } +#elif defined(ACCESS_TEST_4) + { + static const char *basedir = "dataPub:/test"; + static const char *basedir2 = "dataPub:"; + char tmppath[FS_ENTRY_LONGNAME_MAX]; + FSArchiveResource resource; + static FSResult fresult; + + // at first, initialize FSFile structures. (equal to C++ constructor) + FSFile sfile[1]; + FSFile sdir[1]; + FS_InitFile(sfile); + FS_InitFile(sdir); + + if( !FS_GetArchiveResource(basedir2, &resource) ) + { + fresult = FS_GetArchiveResultCode(basedir2); + return FALSE; + } + + // DIRECTORY CREATION TEST + { + if (FS_OpenDirectory(sdir, basedir, FS_FILEMODE_R | FS_FILEMODE_W)) + { + OS_TPrintf("\"%s\" already exists.\n", basedir); + (void)FS_CloseDirectory(sdir); + } + else if (!FS_CreateDirectory(basedir, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(basedir); + OS_TPanic("FS_CreateDirectory(\"%s\") failed.\n", basedir); + } + else + { + int i; + OS_TPrintf("FS_CreateDirectory(\"%s\") succeeded.\n", basedir); + for (i = 1; i <= 3; ++i) + { + (void)STD_TSPrintf(tmppath, "%s/dir%d", basedir, i); + if (!FS_CreateDirectory(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_CreateDirectory(%s) failed.\n", tmppath); + } + else + { + OS_TPrintf("FS_CreateDirectory(%s) succeeded.\n", tmppath); + } + } + } + } + // DIRECTORY DELETION TEST + { + STD_TSPrintf(tmppath, "%s/tmp/", basedir); + if (!FS_CreateDirectory(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + OS_TPrintf("FS_CreateDirectory(\"%s\") failed.\n", tmppath); + } + if (!FS_DeleteDirectory(tmppath)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_DeleteDirectory(\"%s\") failed.\n", tmppath); + } + } + // DIRECTORY DELETE + if (!FS_DeleteDirectoryAuto(basedir)) + { + ReportLastErrorPath(basedir); + OS_TPanic("FS_DeleteDirectoryAuto(\"%s\") failed.\n", basedir); + } + } +#elif defined(ACCESS_TEST_5) + { + static const char *basedir = "dataPub:/test"; + char tmppath[FS_ENTRY_LONGNAME_MAX]; + + // at first, initialize FSFile structures. (equal to C++ constructor) + FSFile sfile[1]; + FSFile sdir[1]; + FS_InitFile(sfile); + FS_InitFile(sdir); + + // FILE CREATION TEST + { + enum { file_max = 3 }; + static const char *(message[file_max]) = + { + "hello, world!", + "foobar", + "hogehoge", + }; + int i; + for (i = 0; i < file_max; ++i) + { + STD_TSPrintf(tmppath, "%s/arm9%d.txt", basedir, i); + if (!FS_CreateFile(tmppath, FS_PERMIT_R | FS_PERMIT_W)) + { + ReportLastErrorPath(tmppath); + } + else + { + OS_TPrintf("FS_CreateFile(%s) succeeded.\n", tmppath); + if (!FS_OpenFileEx(sfile, tmppath, FS_FILEMODE_W)) + { + ReportLastErrorPath(tmppath); + OS_TPanic("FS_OpenFileEx(%s) failed.\n", tmppath); + } + else + { + if (FS_WriteFile(sfile, message[i], STD_GetStringLength(message[i])) < 0) + { + ReportLastErrorFile(sfile); + OS_TPanic("FS_WritFile() failed.\n"); + } + else + { + OS_TPrintf("FS_WritFile() succeeded.\n"); + } + } + (void)FS_CloseFile(sfile); + } + } + } + } +#endif + + return TRUE; +} +#endif diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/font.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/font.c new file mode 100644 index 00000000..30670436 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/font.c @@ -0,0 +1,574 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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 "font.h" + +//---------------------------------------------------------------- +// Character data +// +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +//---------------------------------------------------------------- +// Palette data +// +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/main.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/main.c new file mode 100644 index 00000000..ab15bdee --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/main.c @@ -0,0 +1,216 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: main.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include +#include "font.h" +#include "screen.h" +#include "menu.h" + +static void myInit(void); +static void myVBlankIntr(void); +static void PrintBootType(void); + +extern BOOL PubDataAccessTest(void); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: main + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + u16 trigger; + u16 preButton = PAD_Read(); + u16 button; + + //---------------- initialize + myInit(); + InitMenu(); + PrintBootType(); + +#if 0 + if( PubDataAccessTest() == FALSE ) + { + OS_Printf("Data access NG\n"); + return; + } +#endif + + //---------------- main loop + while (TRUE) + { + button = PAD_Read(); + trigger = (u16)((button ^ preButton) & button); + preButton = button; + + //---- clear screen buffer + ClearScreen(); + + //---- display menus + DisplayMenuSet(); + + //---- press UP key (toggle menu) + if(trigger & PAD_KEY_UP) + { + ChangeMenuItem(MENU_ITEM_UP); + } + + if(trigger & PAD_KEY_DOWN) + { + ChangeMenuItem(MENU_ITEM_DOWN); + } + + //---- push A + if (trigger & PAD_BUTTON_A) + { + ExecMenuItem(); + } + //---- push X + if (trigger & PAD_BUTTON_X) + { + ExecMenuItemX(); + } + + OS_WaitVBlankIntr(); + } +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + RTC_Init(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSystemInit + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + FS_Init( FS_DMA_NOT_USE ); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static void PrintBootType(void) +{ + const OSBootType btype = OS_GetBootType(); + + switch( btype ) + { + case OS_BOOTTYPE_ROM: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_ROM\n"); break; + case OS_BOOTTYPE_NAND: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_NAND\n"); break; + default: + { + OS_Warning("unknown BootType(=%d)", btype); + } + break; + } +} + diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/menu.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/menu.c new file mode 100644 index 00000000..a81ad802 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/menu.c @@ -0,0 +1,392 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: menu.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 "font.h" +#include "screen.h" +#include "menu.h" +#include "dataver.h" +#include + +/* + * menu.c + * メニュー表示機能 + * + * テストアプリに適した簡単なメニュー表示を行う。メニュー階層は複数段可能。 + * + * なお、この機能を使用するためには、以下のソースが必要 + * font.c, font.h, screen.c, screen.h + * + * 導入手順: + * 1, menu.hの以下の定義値を変更する + * MENU_DEPTH_NUM : メニューの階層数 + * MENU_ITEM_NUM : メニュー項目の最大数 + * MENU_ITEM_STRLEN : メニュー表示文字列の最大長 + * 2, menu.cの以下の定義を変更する + * MENU_TITLE : メニューのタイトル + * 3, 以下の構造体を変更する + * MenuItem : メニュー表示内容および階層間情報 + * 4, 関数 ExecMenuItem() がメニュー項目に応じた処理を定義するハンドラなので、 + * 定義を行う + * 5, Mainから以下の関数を呼ぶ + * InitMenu : メニュー関連の初期化 + * DisplayMenuSet : メニュー機能の表示 + * ChangeMenuItem : メニュー選択項目の変更(この関数はキー操作時に呼び出すようにする) + * ExecMenuItem : メニュー項目に応じた処理の実行(この関数はキー操作時に呼び出すようにする) + * + * + * 不明な点は安田まで。 + */ + +#define MENU_TITLE "APP version viewer" +//#define NEW_MENU_POS // YASUDA +#define DRAW_LINE_AS_CHAR + +static char cItemStr[9][MENU_ITEM_STRLEN]; + +static menu_sheet_t MenuItem[MENU_DEPTH_NUM] = +{ + {-1, 1, cItemStr[0], 2, cItemStr[1], 3, cItemStr[2], 4, cItemStr[3], + 5, cItemStr[4], 6, cItemStr[5], 7, cItemStr[6], 8, cItemStr[7], + -1, cItemStr[8] } +}; + +static s16 MenuDepth; +static s16 MenuPos; +static u8 isMenuCancel; + +//---- for RTC +static RTCTime myCurrentTime; +static int myResult; + +static void DisplayMenu(void); +static void EnterMenuCancel(void); + +static void setAllItems(void); +static void setAppVerItem(void); +static void setPublicDataItem(void); +static void setPrivateDataItem(void); + +// YASUDA +extern FSResult g_fs_result; + +//---------------------------------------------------------------- +// InitMenu +// +void InitMenu(void) +{ + MenuDepth = 0; + MenuPos = 2; + + setAllItems(); +#if defined(DRAW_LINE_AS_CHAR) + STD_CopyString( MenuItem[0].sItem[1].cItemStr, "---------+------------" ); + STD_CopyString( MenuItem[0].sItem[5].cItemStr, "---------+------------" ); +#endif +} + +//---------------------------------------------------------------- +// DisplayMenuSet +// +void DisplayMenuSet(void) +{ + if(isMenuCancel > 0) + { + return; + } + + //---- display key description + PrintString(3, 2, 15, MENU_TITLE); + //PrintString(3, 3, 15, "parameter is %d", param); + DisplayMenu(); + + //---- display time + myResult = RTC_GetTime(&myCurrentTime); + if (myResult == 0 /*no error */ ) + { +#if !defined(NEW_MENU_POS) + PrintString(5, 21, 8, "%02d:%02d:%02d", + myCurrentTime.hour, myCurrentTime.minute, myCurrentTime.second); +#else + PrintString(5, 23, 8, "%02d:%02d:%02d", + myCurrentTime.hour, myCurrentTime.minute, myCurrentTime.second); +#endif + } + + //---- display counter + //PrintString(18, 20, 4, "%08X", OS_GetVBlankCount()); + + //---- display control infomation +#if !defined(NEW_MENU_POS) + PrintString(5, 17, 15, "[A] set current data"); + PrintString(5, 18, 15, "[X] set both data"); + PrintString(5, 19, 15, "[up/down] switch item"); +#else + PrintString(5, 19, 15, "[A] set current data"); + PrintString(5, 20, 15, "[X] set both data"); + PrintString(5, 21, 15, "[up/down] switch item"); +#endif +} + +//---------------------------------------------------------------- +// DisplayMenu +// +static void DisplayMenu(void) +{ + u16 pos; + char *str; + + for(pos = 0; pos < MENU_ITEM_NUM; pos++) + { + str = MenuItem[MenuDepth].sItem[pos].cItemStr; + //---- display key description + if( str[0] != '\0' ) + { +#if !defined(DRAW_LINE_AS_CHAR) + PrintString(3, (s16)(5 + pos), 15, str); +#else + if( (pos != 1) && (pos != 5) ) + { + PrintString(3, (s16)(5 + pos), 15, str); + } + else + { + PrintString(3, (s16)(5 + pos), 6, str); + } +#endif + } + + PrintString(1, (s16)(5 + MenuPos), 8, "#"); + } +} + + +//---------------------------------------------------------------- +// ChangeMenuItem +// +void ChangeMenuItem(u16 action) +{ + switch(action) + { + case MENU_ITEM_UP: + ColorString((s16)(1 + MenuPos), 5, 1, 0); + MenuPos--; + if(MenuPos < 0) + { + MenuPos = 0; + } + //動作のチューニング + if( (MenuPos>=0) && (MenuPos<6) ) + { + MenuPos = 2; + } + if( (MenuPos>=6) && (MenuPos<9) ) + { + MenuPos = 6; + } + break; + case MENU_ITEM_DOWN: + ColorString((s16)(1 + MenuPos), 5, 1, 0); + MenuPos++; + if(MenuPos >= MENU_ITEM_NUM) + { + MenuPos--; + } + if(MenuItem[MenuDepth].sItem[MenuPos].cItemStr[0] == '\0') + { + MenuPos--; + } + //動作のチューニング + if( (MenuPos>0) && (MenuPos<=2) ) + { + MenuPos = 2; + } + if( (MenuPos>2) && (MenuPos<=9) ) + { + MenuPos = 6; + } + break; + case MENU_DEPTH_UP: + MenuDepth = MenuItem[MenuDepth].nPrev; + MenuPos = 0; + if(MenuDepth < 0) + { + MenuDepth = 0; + } + break; + case MENU_DEPTH_DOWN: + { + s16 pos; + pos = MenuItem[MenuDepth].sItem[MenuPos].nNext; + if(pos >= 0) + { + MenuDepth = pos; + MenuPos = 0; + } + } + break; + } +} + + +//---------------------------------------------------------------- +// ExecMenuItem +// +void ExecMenuItem(void) +{ + switch(MenuDepth) + { + case 0: + switch(MenuPos) + { + case 0: + break; + case 1: + case 2: + case 3: + // Public data タイムスタンプ変更 + SetPublicDataTimeStamp(); +#if 0 // YASUDA + STD_TSPrintf( cItemStr[1], "PUB err : %d", g_fs_result ); +#else + setPublicDataItem(); +#endif + break; + case 4: + case 5: + case 6: + // Private data タイムスタンプ変更 + SetPrivateDataTimeStamp(); + setPrivateDataItem(); + break; + default: + break; + } + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// ExecMenuItemX +// +void ExecMenuItemX(void) +{ + switch(MenuDepth) + { + case 0: + switch(MenuPos) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + // 両 data タイムスタンプ変更 + SetPublicDataTimeStamp(); + SetPrivateDataTimeStamp(); + setAllItems(); + break; + default: + break; + } + break; + default: + break; + } +} + +//---------------------------------------------------------------- +// EnterMenuCancel +// +static void EnterMenuCancel(void) +{ + isMenuCancel = 1; + ClearScreen(); +} + +//---------------------------------------------------------------- +// ExitMenuCancel +// +void ExitMenuCancel(void) +{ + if(isMenuCancel > 0){ + isMenuCancel = 0; + } +} + +void SetMenuString(u32 depth, u32 ipos, char *str) +{ + STD_CopyString( MenuItem[depth].sItem[ipos].cItemStr, str ); +} + +void SetCurrentMenuString(char *str) +{ + SetMenuString( MenuDepth, MenuPos, str ); +} + +static void setAllItems(void) +{ + setAppVerItem(); + setPublicDataItem(); + setPrivateDataItem(); +} + +static void setAppVerItem(void) +{ + char ver[8]; + + GetAppVersionString(ver); + STD_TSPrintf( cItemStr[0], "APP ver : %s", ver ); +} + +static void setPublicDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetPublicDataInfoStrings( ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemStr[2], "PUB ver : %s", ver ); + STD_TSPrintf( cItemStr[3], " date : %s", time1 ); + STD_TSPrintf( cItemStr[4], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemStr[2], "PUB : NONE", ver ); + STD_TSPrintf( cItemStr[3], " " ); + STD_TSPrintf( cItemStr[4], " " ); + } +} + +static void setPrivateDataItem(void) +{ + char ver[8], time1[16], time2[16]; + + if( GetPrivateDataInfoStrings( ver, time1, time2 ) == TRUE ) + { + STD_TSPrintf( cItemStr[6], "PRV ver : %s", ver ); + STD_TSPrintf( cItemStr[7], " date : %s", time1 ); + STD_TSPrintf( cItemStr[8], " : %s", time2 ); + } + else + { + STD_TSPrintf( cItemStr[6], "PRV : NONE" ); + STD_TSPrintf( cItemStr[7], " " ); + STD_TSPrintf( cItemStr[8], " " ); + } +} diff --git a/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/screen.c b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/screen.c new file mode 100644 index 00000000..58b6c424 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/DisplayVersion_target/src/screen.c @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include "screen.h" + +u16 gScreen[32 * 32]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/debugsoft/MakerTitle/SaveData/Makefile b/build/debugsoft/MakerTitle/SaveData/Makefile new file mode 100644 index 00000000..ec164d0e --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/Makefile @@ -0,0 +1,28 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - save_data +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = DisplayVersion_target \ + DisplayVersion \ + + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/MakerTitle/SaveData/readme.txt b/build/debugsoft/MakerTitle/SaveData/readme.txt new file mode 100644 index 00000000..5290e288 --- /dev/null +++ b/build/debugsoft/MakerTitle/SaveData/readme.txt @@ -0,0 +1,30 @@ +同一メーカータイトルのセーブデータ検証アプリ + +【概要】 + +同一メーカータイトルアプリのセーブデータへのアクセスを検証するアプリケーションセットです。 + + +【アプリケーションリスト】 +コンパイルすると、/debugsoft/dispver以下に以下のファイルが生成されます。 + +・dispver_TARGET.tad [4VDA] +  … セーブデータをアクセスされるアプリ(ダミーアプリ) + +・dispver_SEQURE.tad [4S4A] +  … 同一メーカータイトルへのアクセスを行うセキュアアプリ +・dispver_USER.tad  [4S5A] +  … 同一メーカータイトルへのアクセスを行うユーザアプリ + + +【実行手順】 +Nmenu等を使って、3つのファイル全てをNANDにインポートします。 +その後、SEQURE, USERを起動すると、TARGETのアプリにアクセスできることが確認できます。 +アプリ自身の仕様については、/DisplayVersion 以下のreadme.txtを参照して下さい。 + + +【制限事項】 +・USERアプリについては、OTHERや APP Verなどの項目が正常には表示されません。 +・USERアプリについて、OTHER が 0 appsいなっていても、そこでAボタンを押すと、4VDAのセーブデータへアクセス可能です。これは正しい動作です。 + + diff --git a/build/debugsoft/MakerTitle/TitleList/Makefile b/build/debugsoft/MakerTitle/TitleList/Makefile new file mode 100644 index 00000000..1acd6ed2 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/Makefile @@ -0,0 +1,294 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - save_data - DisplayVersion +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + + + +ifeq ($(ROM_NAME),) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something-build +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL= +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something-build: + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=A SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=B SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=C SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=D SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=E SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=F SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=G SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=H SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=I SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=J SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=A USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=B USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=C USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=D USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=E USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=F USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=G USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=H USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=I USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=J USE_SPECIAL=TRUE SKIP_SUBDIR=FALSE $(MY_GOAL) + + +do-something: + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=A SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=B SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=C SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=D SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=E SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=F SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=G SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=H SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=I SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) TWLSDK_PLATFORM=TWL ROM_NAME=J SKIP_SUBDIR=FALSE $(MY_GOAL) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +else + +SUBDIRS = +MACRO_FLAGS := + +#---------------------------------------------------------------------------- +TWL_NANDAPP := TRUE +MASTER_NAME := TitleList +APP_NAME = $(MASTER_NAME)_$(ROM_NAME) + +SRCS = main.c font.c screen.c appmain.c + +LLIBRARIES = libnam$(TWL_LIBSUFFIX).a libes$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a + + +#------------------------- +#-- API タイプの指定 +ifeq ($(USE_SPECIAL),) +API_TYPE = NORMAL +else +API_TYPE = SPECIAL +MACRO_FLAGS += -DUSE_SPECIAL +endif + + +#------------------------- +#-- ROM A 〜 Jまでのパラメータ設定 + +# デフォルトのロムパラメータ +PUB_SAVE := 16K +PRV_SAVE := 16K +MAKER_CODE := 01 +SEQURE := FALSE +APP_TYPE := User + +ifeq ($(ROM_NAME),A) +APP_TYPE := System +SEQURE := TRUE +endif + +ifeq ($(ROM_NAME),B) +APP_TYPE := System +endif + +ifeq ($(ROM_NAME),C) +endif + +ifeq ($(ROM_NAME),D) +PRV_SAVE := 0K +endif + +ifeq ($(ROM_NAME),E) +PUB_SAVE := 0K +endif + +ifeq ($(ROM_NAME),F) +PRV_SAVE := 0K +PUB_SAVE := 0K +endif + +ifeq ($(ROM_NAME),G) +MAKER_CODE := 02 +endif + +ifeq ($(ROM_NAME),H) +MAKER_CODE := 02 +PRV_SAVE := 0K +endif + +ifeq ($(ROM_NAME),I) +MAKER_CODE := 02 +PUB_SAVE := 0K +endif + +ifeq ($(ROM_NAME),J) +MAKER_CODE := 02 +PRV_SAVE := 0K +PUB_SAVE := 0K +endif + + + +ENABLE_PUB := TRUE +ENABLE_PRV := TRUE + +ifeq ($(ENABLE_PUB),0K) +ENABLE_PUB := FALSE +endif + +ifeq ($(ENABLE_PRV),0K) +ENABLE_PRV := FALSE +endif + + +GAME_CODE = 4K$(ROM_NAME)A +TARGET_BIN = $(APP_NAME).tad + + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = $(MASTER_NAME).$(ROM_NAME).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=$(MAKER_CODE) \ + TitleName=TITLE_LIST_$(ROM_NAME) \ + GameCode=$(GAME_CODE) \ + BannerFile=./banner/banner_$(ROM_NAME).bnr \ + PublicSaveDataSize=$(PUB_SAVE) \ + PrivateSaveDataSize=$(PRV_SAVE) \ + WramMapping=MAP_TS_SCR \ + AppType=$(APP_TYPE) \ + Media=NAND \ + Secure=$(SEQURE) \ + + + +#------------------------- +#-- NAMを使うためにsecure componentを使う + +COMPONENT_NAME = armadillo +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/$(COMPONENT_NAME)/$(TWL_BUILDTYPE_ARM7)/$(COMPONENT_NAME) +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#------------------------- +# インストール指定 + +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(MASTER_NAME)/$(API_TYPE) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +#------------------------- +#-- カードアプリと同様に ROM-FS にファイルを持たせます。 + +#MAKEROM_ROMROOT = ./rom_data +#MAKEROM_ROMFILES = *.* + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner_$(ROM_NAME).bnr +BANNERSRC := ./banner/data/Cell/Cell_$(ROM_NAME).nce +#BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + +#------------------------- +# rom 内のファイルは全て自動生成なので clean で削除されるようにします +LDIRT_CLEAN = $(MAKEROM_ROMROOT) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifeq ($(SEQURE),TRUE) +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe # commondefs を include した後でなければならない +MAKETAD_OPTION := -s # modulerules を include する前でなければならない +else +ifeq ($(APP_TYPE),System) +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.sys.exe # commondefs を include した後でなければならない +MAKETAD_OPTION := -s # modulerules を include する前でなければならない +else +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.exe # commondefs を include した後でなければならない +endif +endif +#---------------------------------------------------------------------------- + +#MACRO_FLAGS += -DMYCODE=\"$(GAME_CODE)\" +#MACRO_FLAGS += -DMYNAME=\"$(ROM_NAME)\" +#MACRO_FLAGS += -DENABLEPUB=$(ENABLE_PUB) +#MACRO_FLAGS += -DENABLEPRV=$(ENABLE_PRV) + + +do-build: rmlcf mycode $(TARGETS) +#do-build: rmlcf $(TARGETS) + +.PHONY: mycode rmlcf + +mycode: + echo -e "#ifndef MYCODE_\n#define MYCODE_\n#define MYCODE \"$(GAME_CODE)\"\n#define MYNAME \"$(ROM_NAME)\"\n#define ENABLEPUB $(ENABLE_PUB)\n#define ENABLEPRV $(ENABLE_PRV)\n\n#endif" > ./include/mycode.h + +#mycode: +# echo -e "#ifndef MYCODE_\n#define MYCODE_\n#define MYCODE \"$(GAME_CODE)\"\n#define MYNAME \"$(ROM_NAME)\"\n#define ENABLEPUB $(ENABLE_PUB)\n#define ENABLEPRV $(ENABLE_PRV)\n\n#endif" > ./include/mycode.h + + +rmlcf: + rm -rf $(BINDIR)/*.lcf + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +$(BINDIR)/$(TARGET_BIN_BASENAME).$(TWL_ELF_EXT): make_dir +#$(BINDIR)/$(TARGET_BIN_BASENAME).$(TWL_ELF_EXT): $(BANNER) make_dir + +#------------------------- +#-- rom_data/build_time.txt を作成します。 + +make_dir: + $(INSTALL) -d $(MAKEROM_ROMROOT) +#build_time: +# $(INSTALL) -d $(MAKEROM_ROMROOT) +# echo -n "build at `date \"+%Y/%m/%d %H:%M:%S\"` on \"`hostname`\"" > $(MAKEROM_ROMROOT)/build_time.txt + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +endif + +#===== End of Makefile ===== diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bnr new file mode 100644 index 00000000..1af566da Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bsf new file mode 100644 index 00000000..9fe5011a Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_A.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bnr new file mode 100644 index 00000000..5cec127e Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bsf new file mode 100644 index 00000000..f8ea7018 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_B.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bnr new file mode 100644 index 00000000..a5326216 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bsf new file mode 100644 index 00000000..59013f90 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_C.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bnr new file mode 100644 index 00000000..bcc3a8a9 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bsf new file mode 100644 index 00000000..1c3d9973 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_D.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bnr new file mode 100644 index 00000000..683b9c0e Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bsf new file mode 100644 index 00000000..5ed0366b Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_E.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bnr new file mode 100644 index 00000000..c220052d Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bsf new file mode 100644 index 00000000..a0ee3ccd Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_F.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bnr new file mode 100644 index 00000000..cf8a7efb Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bsf new file mode 100644 index 00000000..86916741 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_G.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bnr new file mode 100644 index 00000000..5bb665bd Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bsf new file mode 100644 index 00000000..6c4f8dff Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_H.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bnr new file mode 100644 index 00000000..961b5c7c Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bsf new file mode 100644 index 00000000..699b804e Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_I.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bnr b/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bnr new file mode 100644 index 00000000..c02e0461 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bnr differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bsf b/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bsf new file mode 100644 index 00000000..14475cce Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/banner_J.bsf differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_A.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_A.nce new file mode 100644 index 00000000..34aa5f8f Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_A.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_B.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_B.nce new file mode 100644 index 00000000..4a31775b Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_B.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_C.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_C.nce new file mode 100644 index 00000000..5327b480 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_C.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_D.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_D.nce new file mode 100644 index 00000000..a44c31bf Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_D.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_E.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_E.nce new file mode 100644 index 00000000..a89d8f72 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_E.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_F.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_F.nce new file mode 100644 index 00000000..b1c01841 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_F.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_G.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_G.nce new file mode 100644 index 00000000..1a426982 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_G.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_H.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_H.nce new file mode 100644 index 00000000..4fbd9ea5 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_H.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_I.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_I.nce new file mode 100644 index 00000000..68899287 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_I.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_J.nce b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_J.nce new file mode 100644 index 00000000..bff60169 Binary files /dev/null and b/build/debugsoft/MakerTitle/TitleList/banner/data/Cell/Cell_J.nce differ diff --git a/build/debugsoft/MakerTitle/TitleList/include/appmain.h b/build/debugsoft/MakerTitle/TitleList/include/appmain.h new file mode 100644 index 00000000..5aa7f062 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/include/appmain.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK_IPL - debugsoft - MakerTitle - TitleList + File: appmain.h + + Copyright 2003 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 APPMAIN_H_ +#define APPMAIN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +void DrawScreen(void); +void DoWritingTest(void); +void DoReadingTest(void); +void DeleteSaveDatas(void); +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/TitleList/include/font.h b/build/debugsoft/MakerTitle/TitleList/include/font.h new file mode 100644 index 00000000..a323d9e1 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/include/font.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.h + + Copyright 2003 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/TitleList/include/screen.h b/build/debugsoft/MakerTitle/TitleList/include/screen.h new file mode 100644 index 00000000..0387a9ae --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/include/screen.h @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: screen.h + + Copyright 2003 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[2][32 * 32]; + +void ClearScreen(void); +void ClearSubScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/MakerTitle/TitleList/include/title.h b/build/debugsoft/MakerTitle/TitleList/include/title.h new file mode 100644 index 00000000..74d93621 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/include/title.h @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK_IPL - debugsoft - MakerTitle - TitleList + File: title.h + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ + +// セーブデータチェック対象ロム +static char* GAMECODE_LIST[] = { + "4KAA", + "4KBA", + "4KCA", + "4KDA", + "4KEA", + "4KFA", + "4KGA", + "4KHA", + "4KIA", + "4KJA", +}; + +static const u32 TITLE_COUNT = sizeof(GAMECODE_LIST) / sizeof(char*); + +static u64 TITLE_ID_HIGH[] = { + 0x00030015ull, + 0x00030005ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, + 0x00030004ull, +}; + +// PublicとPrivateの有無 +static BOOL DATA_EXIST[TITLE_COUNT][2] = { + {TRUE, TRUE}, // A + {TRUE, TRUE}, // B + {TRUE, TRUE}, // C + {TRUE, FALSE}, // D + {FALSE, TRUE}, // E + {FALSE, FALSE}, // F + {TRUE, TRUE}, // G + {TRUE, FALSE}, // H + {FALSE, TRUE}, // I + {FALSE, FALSE}, // J + +}; + diff --git a/build/debugsoft/MakerTitle/TitleList/src/appmain.c b/build/debugsoft/MakerTitle/TitleList/src/appmain.c new file mode 100644 index 00000000..85bf2d27 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/src/appmain.c @@ -0,0 +1,312 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK_IPL - debugsoft - MakerTitle - TitleList + File: appmain.c + + Copyright 2003 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 "appmain.h" +#include "screen.h" +#include "mycode.h" +#include "title.h" +#include +#include +#include +#include + +BOOL TestWriting(const char* code, BOOL out_results[2]); +BOOL WriteFile(const char* arc_name, const char* file_name); +BOOL ReadFile(const char* arc_name, const char* file_name, char* out, int len); +void PrintResult(int x, int y, char* text); + +static FSFATFSArchiveWork archiveWork ATTRIBUTE_ALIGN(32); + +const char* ARC_NAME[2] = { + "otherPub:/", + "otherPrv:/", +}; + + +const char* SAV_NAME[2] = { + "dataPub:/", + "dataPrv:/", +}; + +const char* FILE_NAME = "save.dat"; + +BOOL TestWriting(const char* code, BOOL out_results[2]) +{ + s32 i = 0; + +#ifndef USE_SPECIAL + const NATitleArchive arc[2] = { + NA_TITLE_ARCHIVE_DATAPUB, + NA_TITLE_ARCHIVE_DATAPRV, + }; +#else + const char* arc[2] = { + "otherPub", + "otherPrv", + }; + u32 lo = 0; + OSTitleId TitleID; + lo = MI_LoadBE32(code); + TitleID = (TITLE_ID_HIGH[code[2] - 'A'] << 32) | lo; + +#endif + + + for(i = 0; i < 2; ++i) + { +#ifndef USE_SPECIAL + FSResult res = NA_LoadOtherTitleArchive(code, arc[i]); +#else + FSResult res = FSi_MountSpecialArchive(TitleID, arc[i], &archiveWork); + OS_TPrintf("%llu \n", TitleID); + OS_TPrintf("%lu lu\n", TitleID >> 32, TitleID); +#endif + out_results[i] = (res != FS_RESULT_SUCCESS) ? FALSE : TRUE; + if(res != FS_RESULT_SUCCESS) + { + OS_TPrintf("Mount Failed:%s\n", code); + OS_TPrintf("ErrorCode:%d\n", res); + continue; + } + + WriteFile(ARC_NAME[i], FILE_NAME); + +#ifndef USE_SPECIAL + NA_UnloadOtherTitleArchive(); +#else + FSi_MountSpecialArchive(TitleID, NULL, &archiveWork); +#endif + } + + return out_results[0] | out_results[1]; +} + +BOOL WriteFile(const char* arc_name, const char* file_name) +{ + FSFile fp; + char buf[256]; + s32 len = 0; + + STD_TSPrintf(buf, "%s%s", arc_name, file_name); + + FS_InitFile(&fp); + FS_CreateFile(buf, FS_PERMIT_W | FS_PERMIT_R); + + if(!FS_OpenFileEx(&fp, buf, FS_FILEMODE_RW)) + { + OS_TPrintf("Open Fail:%s\n", buf); + return FALSE; + } + + FS_SeekFileToEnd(&fp); + len = STD_TSPrintf(buf, "Written by [%s]\n", MYNAME); + FS_WriteFile(&fp, buf, len); + FS_CloseFile(&fp); + + return TRUE; +} + +void DrawScreen(void) +{ + PrintString(0, 0, 15, "GameCode:%s", MYCODE); + PrintString(0, 2, 15, "A - Writing test to other apps"); + PrintString(0, 3, 15, "B - Show my save data"); + if(STD_StrCmp("4KAA", MYCODE) == 0) + { + PrintString(0, 4, 15, "X - Clear save datas"); + } +} + +void DoWritingTest(void) +{ + BOOL results[TITLE_COUNT][2]; + s16 i = 0; + char* result_char[3] = {"O", "X", "-"}; + + MI_CpuClear8(results, sizeof(results)); + + ClearSubScreen(); + PrintString(0, 24, 15, "APP : PUB PRV WRITE"); + PrintString(0, 25, 15, "---------------------"); + for(i = 0; i < TITLE_COUNT; ++i) + { + char buf[256]; + char format[] = "ROM %c: %s %s %s"; + // 自分自身はチェックしない +// OS_TPrintf("%s %s\n", GAMECODE_LIST[i], MYCODE); + if(STD_StrCmp(GAMECODE_LIST[i], MYCODE) == 0){ + STD_TSPrintf(buf, format, 'A' + i, "-", "-", "-"); + } + else + { + s32 result_code[3] = {0, 0, 0}; + TestWriting(GAMECODE_LIST[i], results[i]); + result_code[0] = (!DATA_EXIST[i][0]) ? 2 : (results[i][0] ? 0 : 1); + result_code[1] = (!DATA_EXIST[i][1]) ? 2 : (results[i][1] ? 0 : 1); + result_code[2] = (result_code[0] == 2 && result_code[1] == 2) ? 2 : (result_code[0] != 1 && result_code[1] != 1) ? 0 : 1; + STD_TSPrintf(buf, format, 'A' + i, + result_char[result_code[0]], + result_char[result_code[1]], + result_char[result_code[2]] + ); + } + OS_TPrintf("%s\n", buf); + PrintString(0, (s16)(26 + i), 15, buf); + } +} + +void DoReadingTest(void) +{ + char read_buf[2048]; + + ClearSubScreen(); + + { + s32 i = 0; + BOOL result[2] = {FALSE, FALSE}; + + PrintString(0, 24, 15, "Public"); + PrintString(16, 24, 15, "Private"); + for(i = 0; i < 2; ++i) + { + MI_CpuClear8(read_buf, sizeof(read_buf)); + result[i] = ReadFile(SAV_NAME[i], FILE_NAME, read_buf, sizeof(read_buf)); +/* if(!result[i]) + { + continue; + }*/ + OS_TPrintf("%s%s\n", SAV_NAME[i], FILE_NAME); + OS_TPrintf("%s\n", read_buf); + OS_TPrintfEx("% 256.16b\n", read_buf); + + PrintResult(i * 16, 25, read_buf); + } + } +} + +BOOL ReadFile(const char* arc_name, const char* file_name, char* out, int len) +{ + FSFile fp; + char buf[256]; + + STD_TSPrintf(buf, "%s%s", arc_name, file_name); + + FS_InitFile(&fp); + + if(!FS_OpenFileEx(&fp, buf, FS_FILEMODE_R)) + { + FSResult res; + + res = FS_GetArchiveResultCode(buf); + OS_TPrintf("Code:%d\n", res); + OS_TPrintf("Open Fail:%s\n", buf); + if(res == FS_RESULT_ERROR) + { + STD_TSPrintf(out, "None.\n"); + } + else if(res == FS_RESULT_NO_ENTRY) + { + STD_TSPrintf(out, "File not found.\n"); + } + else + { + STD_TSPrintf(out,"Error:%d\n%s Open Failed\n", res, buf); + } + return FALSE; + } + + FS_ReadFile(&fp, out, len); + FS_CloseFile(&fp); + + return TRUE; +} + +void PrintResult(int x, int y, char* text) +{ + int len = 0, i = 0; + char *p = text, *next = NULL; + char buf[2048]; + while(*p != '\0') + { + next = STD_StrChr(p, '\n'); + STD_CopyLStringZeroFill(buf, p, next - p + 1); + OS_TPrintf("str:%s\n", buf); + PrintString((short)x, (short)y, 15, buf); + y++; + p = next + 1; + } +} + +void DeleteSaveDatas(void) +{ + int i = 0, j = 0, k = 0; +#ifndef USE_SPECIAL + const NATitleArchive arc[2] = { + NA_TITLE_ARCHIVE_DATAPUB, + NA_TITLE_ARCHIVE_DATAPRV, + }; +#else + const char* arc[2] = { + "otherPub", + "otherPrv", + }; + u32 lo = 0; + OSTitleId TitleID; +#endif + + + ClearSubScreen(); + for(i = 0; i < TITLE_COUNT; ++i) + { + for(j = 0; j < 2; ++j) + { + char path[256]; + FSResult res; +#ifndef USE_SPECIAL + res = NA_LoadOtherTitleArchive(GAMECODE_LIST[i], arc[j]); +#else + lo = MI_LoadBE32(GAMECODE_LIST[i]); + TitleID = (TITLE_ID_HIGH[i] << 32) | lo; + res = FSi_MountSpecialArchive(TitleID, arc[j], &archiveWork); +#endif + if(res != FS_RESULT_SUCCESS) + { + OS_TPrintf("Mount Failed:%s\n", GAMECODE_LIST[i]); + OS_TPrintf("ErrorCode:%d\n", res); + continue; + } + + STD_TSPrintf(path, "%s%s", ARC_NAME[j], FILE_NAME); + if(!FS_DeleteFile(path)) + { + OS_TPrintf("Delete Fail:%s\n", path); + } + else + { + OS_TPrintf("Deleted:%s %s\n", GAMECODE_LIST[i], path); + PrintString(0,(short) (24 + k++), 15, "Deleted:%s %s", GAMECODE_LIST[i], path); + } + FS_CreateFile(path, FS_PERMIT_W | FS_PERMIT_R); + +#ifndef USE_SPECIAL + NA_UnloadOtherTitleArchive(); +#else + FSi_MountSpecialArchive(TitleID, NULL, &archiveWork); +#endif + } + } +} diff --git a/build/debugsoft/MakerTitle/TitleList/src/font.c b/build/debugsoft/MakerTitle/TitleList/src/font.c new file mode 100644 index 00000000..30670436 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/src/font.c @@ -0,0 +1,574 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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 "font.h" + +//---------------------------------------------------------------- +// Character data +// +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +//---------------------------------------------------------------- +// Palette data +// +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; diff --git a/build/debugsoft/MakerTitle/TitleList/src/main.c b/build/debugsoft/MakerTitle/TitleList/src/main.c new file mode 100644 index 00000000..0ce708a2 --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/src/main.c @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - yasuda - MenuTest + File: main.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include +#include +#include "font.h" +#include "screen.h" +#include "appmain.h" +#include "mycode.h" // Makeで自動生成されるはずのファイル. + +static void myInit(void); +static void myVBlankIntr(void); +static void InitializeAllocateSystem(void); +static void PrintBootType(void); + +extern BOOL PubDataAccessTest(void); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: main + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + u16 trigger; + u16 preButton = PAD_Read(); + u16 button; + + //---------------- initialize + myInit(); + PrintBootType(); + + ClearSubScreen(); + + //---------------- main loop + while (TRUE) + { + button = PAD_Read(); + trigger = (u16)((button ^ preButton) & button); + preButton = button; + + //---- clear screen buffer + ClearScreen(); + + if(trigger & PAD_BUTTON_A) + { + DoWritingTest(); + } + if(trigger & PAD_BUTTON_B) + { + DoReadingTest(); + } + + if((trigger & PAD_BUTTON_X) && STD_StrCmp("4KAA", MYCODE) == 0) + { + DeleteSaveDatas(); + } + + + //---- display menus + // DisplayMenuSet(); + + //---- press UP key (toggle menu) +/* if(trigger & PAD_KEY_UP) + { + ChangeMenuItem(MENU_ITEM_UP); + } + + if(trigger & PAD_KEY_DOWN) + { + ChangeMenuItem(MENU_ITEM_DOWN); + } + if(trigger & PAD_KEY_RIGHT) + { + ExecMenuItemRight(); + } + if(trigger & PAD_KEY_LEFT) + { + ExecMenuItemLeft(); + } + + //---- push A + if (trigger & PAD_BUTTON_A) + { + ExecMenuItem(); + } + //---- push B + if (trigger & PAD_BUTTON_B) + { + ExecMenuItemB(); + } + //---- push X + if (trigger & PAD_BUTTON_X) + { + ExecMenuItemX(); + }*/ + + DrawScreen(); + + OS_WaitVBlankIntr(); + } +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + RTC_Init(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + InitializeAllocateSystem(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(&gScreen[0], 0, sizeof(gScreen) / 2); + GXS_LoadBG0Scr(&gScreen[1], 0, sizeof(gScreen) / 2); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSystemInit + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + FS_Init( FS_DMA_NOT_USE ); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(&gScreen[0], 0, sizeof(gScreen) / 2); + GXS_LoadBG0Scr(&gScreen[1], 0, sizeof(gScreen) / 2); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitializeAllocateSystem(void) +{ + void *tempLo; + OSHeapHandle hh; + + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_Panic("ARM9: Fail to create heap...\n"); + } + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +static void PrintBootType(void) +{ + const OSBootType btype = OS_GetBootType(); + + switch( btype ) + { + case OS_BOOTTYPE_ROM: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_ROM\n"); break; + case OS_BOOTTYPE_NAND: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_NAND\n"); break; + default: + { + OS_Warning("unknown BootType(=%d)", btype); + } + break; + } +} + diff --git a/build/debugsoft/MakerTitle/TitleList/src/screen.c b/build/debugsoft/MakerTitle/TitleList/src/screen.c new file mode 100644 index 00000000..562bfe5a --- /dev/null +++ b/build/debugsoft/MakerTitle/TitleList/src/screen.c @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - os - reset-1 + File: font.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWL +#include +#else +#include +#endif +#include "screen.h" + +u16 gScreen[2][32 * 32]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen[0], sizeof(gScreen) / 2); +} + +void ClearSubScreen(void) +{ + MI_CpuClearFast((void *)gScreen[1], sizeof(gScreen) / 2); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + u32 index = (u32)(y / 24); + y = (s16)(y % 24); + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + + p = &gScreen[index][((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[index][32 * 32]; + + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[index][0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + u32 index = (u32)(y / 24); + y = (s16)(y % 24); + if (length < 0) + return; + p = &gScreen[index][((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[index][32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[index][0]; + } + } +} diff --git a/build/debugsoft/NotLaunch/Makefile b/build/debugsoft/NotLaunch/Makefile new file mode 100644 index 00000000..39f3be22 --- /dev/null +++ b/build/debugsoft/NotLaunch/Makefile @@ -0,0 +1,124 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - NotLaunch +# File: Makefile +# +# 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:$ +#---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL +override TWL_ARCHGEN = LIMITED + +ifeq ($(APP_TYPE),) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL=default +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something: + +$(REMAKE) -B APP_TYPE=SYSTEM CARD_REGION=ALL $(MY_GOAL) + +$(REMAKE) -B APP_TYPE=SYSTEM CARD_REGION=Japan $(MY_GOAL) + +$(REMAKE) -B APP_TYPE=SYSTEM CARD_REGION=America $(MY_GOAL) + +$(REMAKE) -B APP_TYPE=SYSTEM CARD_REGION=Europe $(MY_GOAL) + +$(REMAKE) -B APP_TYPE=SYSTEM CARD_REGION=Australia $(MY_GOAL) +# +$(REMAKE) -B APP_TYPE=USER CARD_REGION=ALL $(MY_GOAL) +# +$(REMAKE) -B APP_TYPE=USER CARD_REGION=Japan $(MY_GOAL) +# +$(REMAKE) -B APP_TYPE=USER CARD_REGION=America $(MY_GOAL) +# +$(REMAKE) -B APP_TYPE=USER CARD_REGION=Europe $(MY_GOAL) +# +$(REMAKE) -B APP_TYPE=USER CARD_REGION=Australia $(MY_GOAL) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +else + +TWL_NANDAPP = TRUE +TARGET_BIN = NotLaunch_$(APP_TYPE)_$(CARD_REGION).tad + +SRCDIR = ./src + +SRCS = main.c + +ROM_SPEC = NotLaunch.autogen.rsf + +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf + +#---------------------------------------------------------------------------- +# decide gamecode (region) + +ifeq ($(CARD_REGION),ALL) +GAME_CODE_R = A +endif + +ifeq ($(CARD_REGION),Japan) +GAME_CODE_R = J +endif + +ifeq ($(CARD_REGION),America) +GAME_CODE_R = E +endif + +ifeq ($(CARD_REGION),Europe) +GAME_CODE_R = P +endif + +ifeq ($(CARD_REGION),Australia) +GAME_CODE_R = U +endif + +ifeq ($(CARD_REGION),China) +GAME_CODE_R = C +endif + +ifeq ($(CARD_REGION),Korea) +GAME_CODE_R = K +endif +#---------------------------------------------------------------------------- + +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=457$(GAME_CODE_R) \ + Media=NAND \ + Launch=FALSE \ + CardRegion=$(CARD_REGION) + +ifeq ($(APP_TYPE),USER) +ROM_SPEC_PARAM += AppType=User +endif + +endif # ifeq ($(APP_TYPE),) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifeq ($(APP_TYPE),SYSTEM) +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.sys.exe +MAKETAD_OPTION := -s +endif + +do-build: $(TARGETS) + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = ./roms + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/NotLaunch/src/main.c b/build/debugsoft/NotLaunch/src/main.c new file mode 100644 index 00000000..f84e0652 --- /dev/null +++ b/build/debugsoft/NotLaunch/src/main.c @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - NotLaunch + File: main.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 + + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +void TwlMain(void) +{ + OS_Init(); + + + + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/433A/libsyscall.a b/build/debugsoft/TMPJump/433A/libsyscall.a new file mode 100644 index 00000000..4f5ea2d2 Binary files /dev/null and b/build/debugsoft/TMPJump/433A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/433A/libsyscall_c.bin b/build/debugsoft/TMPJump/433A/libsyscall_c.bin new file mode 100644 index 00000000..37f0da7e Binary files /dev/null and b/build/debugsoft/TMPJump/433A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/433A/rom_header_433a.template.sbin b/build/debugsoft/TMPJump/433A/rom_header_433a.template.sbin new file mode 100644 index 00000000..79e274b0 Binary files /dev/null and b/build/debugsoft/TMPJump/433A/rom_header_433a.template.sbin differ diff --git a/build/debugsoft/TMPJump/434A/libsyscall.a b/build/debugsoft/TMPJump/434A/libsyscall.a new file mode 100644 index 00000000..ea73def6 Binary files /dev/null and b/build/debugsoft/TMPJump/434A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/434A/libsyscall_c.bin b/build/debugsoft/TMPJump/434A/libsyscall_c.bin new file mode 100644 index 00000000..4d28a4c2 Binary files /dev/null and b/build/debugsoft/TMPJump/434A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/434A/rom_header_434a.template.sbin b/build/debugsoft/TMPJump/434A/rom_header_434a.template.sbin new file mode 100644 index 00000000..546927d8 Binary files /dev/null and b/build/debugsoft/TMPJump/434A/rom_header_434a.template.sbin differ diff --git a/build/debugsoft/TMPJump/435A/libsyscall.a b/build/debugsoft/TMPJump/435A/libsyscall.a new file mode 100644 index 00000000..5c0bc8de Binary files /dev/null and b/build/debugsoft/TMPJump/435A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/435A/libsyscall_c.bin b/build/debugsoft/TMPJump/435A/libsyscall_c.bin new file mode 100644 index 00000000..d96b6dfb Binary files /dev/null and b/build/debugsoft/TMPJump/435A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/435A/rom_header_435a.template.sbin b/build/debugsoft/TMPJump/435A/rom_header_435a.template.sbin new file mode 100644 index 00000000..7c855e67 Binary files /dev/null and b/build/debugsoft/TMPJump/435A/rom_header_435a.template.sbin differ diff --git a/build/debugsoft/TMPJump/436A/libsyscall.a b/build/debugsoft/TMPJump/436A/libsyscall.a new file mode 100644 index 00000000..c82a882e Binary files /dev/null and b/build/debugsoft/TMPJump/436A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/436A/libsyscall_c.bin b/build/debugsoft/TMPJump/436A/libsyscall_c.bin new file mode 100644 index 00000000..c319bafc Binary files /dev/null and b/build/debugsoft/TMPJump/436A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/436A/rom_header_436a.template.sbin b/build/debugsoft/TMPJump/436A/rom_header_436a.template.sbin new file mode 100644 index 00000000..dadbde58 Binary files /dev/null and b/build/debugsoft/TMPJump/436A/rom_header_436a.template.sbin differ diff --git a/build/debugsoft/TMPJump/437A/libsyscall.a b/build/debugsoft/TMPJump/437A/libsyscall.a new file mode 100644 index 00000000..ddd9ba9c Binary files /dev/null and b/build/debugsoft/TMPJump/437A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/437A/libsyscall_c.bin b/build/debugsoft/TMPJump/437A/libsyscall_c.bin new file mode 100644 index 00000000..e4247e1d Binary files /dev/null and b/build/debugsoft/TMPJump/437A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/437A/rom_header_437a.template.sbin b/build/debugsoft/TMPJump/437A/rom_header_437a.template.sbin new file mode 100644 index 00000000..79c1b408 Binary files /dev/null and b/build/debugsoft/TMPJump/437A/rom_header_437a.template.sbin differ diff --git a/build/debugsoft/TMPJump/458A/libsyscall.a b/build/debugsoft/TMPJump/458A/libsyscall.a new file mode 100644 index 00000000..f1e865af Binary files /dev/null and b/build/debugsoft/TMPJump/458A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/458A/libsyscall_c.bin b/build/debugsoft/TMPJump/458A/libsyscall_c.bin new file mode 100644 index 00000000..d6321e44 Binary files /dev/null and b/build/debugsoft/TMPJump/458A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/458A/rom_header_458a.template.sbin b/build/debugsoft/TMPJump/458A/rom_header_458a.template.sbin new file mode 100644 index 00000000..98335c71 Binary files /dev/null and b/build/debugsoft/TMPJump/458A/rom_header_458a.template.sbin differ diff --git a/build/debugsoft/TMPJump/459A/libsyscall.a b/build/debugsoft/TMPJump/459A/libsyscall.a new file mode 100644 index 00000000..d768c1ce Binary files /dev/null and b/build/debugsoft/TMPJump/459A/libsyscall.a differ diff --git a/build/debugsoft/TMPJump/459A/libsyscall_c.bin b/build/debugsoft/TMPJump/459A/libsyscall_c.bin new file mode 100644 index 00000000..a416f3c0 Binary files /dev/null and b/build/debugsoft/TMPJump/459A/libsyscall_c.bin differ diff --git a/build/debugsoft/TMPJump/459A/rom_header_459a.template.sbin b/build/debugsoft/TMPJump/459A/rom_header_459a.template.sbin new file mode 100644 index 00000000..2ee7454a Binary files /dev/null and b/build/debugsoft/TMPJump/459A/rom_header_459a.template.sbin differ diff --git a/build/debugsoft/TMPJump/AppforFailedTmpJump/Makefile b/build/debugsoft/TMPJump/AppforFailedTmpJump/Makefile new file mode 100644 index 00000000..14ceddc9 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforFailedTmpJump/Makefile @@ -0,0 +1,68 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - tmpjumpTest - AppforFailedTmpJump +# File: Makefile +# + +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_CODEGEN = ARM +TWL_ARCHGEN = LIMITED + +TWL_NANDAPP = TRUE + +TARGET_BIN = Test_$(TARGET_PLATFORM)fail.srl + +INCDIR = ../include +SRCDIR = ../src +SRCS = common.c font.c screen.c main_f.c + +ifeq ($(ROMTYPE),MASTER) +MAKEROM_ROMROOT = ../mas_data +else +MAKEROM_ROMROOT = ../data +endif + +MAKEROM_ROMFILES = dummy.srl + + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifeq ($(TARGET_PLATFORM),TWL) +ROM_SPEC = main_459a.rsf +LIBSYSCALL = ../459A/libsyscall.a + +endif + +ifeq ($(TARGET_PLATFORM),NITRO) +ROM_SPEC = main_458a.rsf +LIBSYSCALL = ../458A/libsyscall.a + +endif + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + +ifeq ($(ROMTYPE),MASTER) +INSTALL_DIR = ../mas_data +else +INSTALL_DIR = ../data +endif +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/TMPJump/AppforFailedTmpJump/main_458a.rsf b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_458a.rsf new file mode 100644 index 00000000..11d12a58 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_458a.rsf @@ -0,0 +1,103 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).nef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7:r).nef" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TJmpTest_NF + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../458A/rom_header_458a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "../banner/banner.bnr" + + # + # Permit TmpJump: for TWL "ApplicationJump" function + # + PermitTmpJump FALSE + + ### + ### + ### + #### END +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/debugsoft/TMPJump/AppforFailedTmpJump/main_459a.rsf b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_459a.rsf new file mode 100644 index 00000000..ce9917c4 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_459a.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest_L + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../459A/rom_header_459a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "../banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 459A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/TMPJump/AppforFailedTmpJump/main_f.c b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_f.c new file mode 100644 index 00000000..334c4500 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforFailedTmpJump/main_f.c @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - tmpjumpTest - AppforTmpJump + File: main.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:$ + *---------------------------------------------------------------------------*/ + +#ifdef SDK_TWL +#include +#else +#include +#endif + +#include "common.h" +#include "screen.h" + +#define DMA_NO_FS 1 + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +static const char gRomPath[32] = "rom:/dummy.srl"; +static u64 gTargetId = 0x0003000434333441; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void DrawMainScene(void); +void VBlankIntr(void); + +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + InitCommon(); + InitScreen(); + + FS_Init(DMA_NO_FS); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // 一度空読み + ReadKey(&gKey); + + while(TRUE) + { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_A) + { +#ifdef SDK_TWL + BOOL success = TRUE; + FSFile src, dest; + void *buf; + s32 len = 0; + + // srl を NAND 上の OS_TMP_APP_PATH へコピー + FS_DeleteFile(OS_TMP_APP_PATH); + FS_CreateFile(OS_TMP_APP_PATH, FS_PERMIT_R | FS_PERMIT_W); + FS_InitFile( &src ); + FS_InitFile( &dest ); + if ( !FS_OpenFileEx( &src, gRomPath, FS_FILEMODE_R ) ) success = FALSE; + len = (s32)FS_GetFileLength( &src ); + + buf = OS_AllocFromMain((u32)len); + if (buf == NULL) + { + success = FALSE; + break; + } + + if ( -1 == FS_ReadFile( &src, buf, len ) ) + { + success = FALSE; + break; + } + + if ( !FS_CloseFile( &src ) ) success = FALSE; + + if ( !FS_OpenFileEx( &dest, OS_TMP_APP_PATH, FS_FILEMODE_W ) ) success = FALSE; + if ( -1 == FS_WriteFile( &dest, buf, len ) ) success = FALSE; + if ( !FS_CloseFile( &dest ) ) success = FALSE; + + if ( !success ) break; + + // TMP ジャンプを試みる + if ( !OS_DoApplicationJump( gTargetId, OS_APP_JUMP_TMP) ) + { + PutSubScreen(1, 10, 0xf1, "ERROR!: Failed to TMP jump"); + } + break; +#endif + } + + if (gKey.trg & PAD_BUTTON_B) + { +#ifdef SDK_TWL + // メインアプリへ戻る + if ( !OS_ReturnToPrevApplication() ) + { + PutSubScreen(1, 10, 0xf1, "ERROR!: Failed to return jump"); + } + break; +#endif + } + + DrawMainScene(); + + OS_WaitVBlankIntr(); + } + + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +static void DrawMainScene(void) +{ + PutMainScreen(1, 1, 0xf2, "Application on tmp dir"); +#ifdef SDK_TWL + PutMainScreen(1, 18, 0xff, "A : try TMP jump"); + PutMainScreen(1, 20, 0xff, "B : Return to Main App"); +#else + PutMainScreen(1, 20, 0xf8, "Can not return to Main (OK)"); +#endif +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/debugsoft/TMPJump/AppforTmpJump/Makefile b/build/debugsoft/TMPJump/AppforTmpJump/Makefile new file mode 100644 index 00000000..f6fc5c92 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforTmpJump/Makefile @@ -0,0 +1,79 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - tmpjumpTest - AppforTmpJump +# File: Makefile +# + +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_CODEGEN = ARM +TWL_ARCHGEN = ALL + +TWL_NANDAPP = TRUE + +TARGET_BIN = TestApp$(TEST_ARCH).srl + +INCDIR = ../include +SRCDIR = ./ ../src +SRCS = common.c font.c screen.c main_2.c + +ifeq ($(ROMTYPE),MASTER) +MAKEROM_ROMROOT = ../mas_data +else +MAKEROM_ROMROOT = ../data +endif +MAKEROM_ROMFILES = dummy.srl + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +ifeq ($(TARGET_PLATFORM),TWL) +TEST_ARCH = _$(TWL_ARCHGEN) + +ifeq ($(TWL_ARCHGEN),HYBRID) + +ROM_SPEC = main_434a.rsf +LIBSYSCALL = ../434A/libsyscall.a + +else + +ROM_SPEC = main_435a.rsf +LIBSYSCALL = ../435A/libsyscall.a + +endif +# TARGET_PLATFORM = NITRO +endif + +ifeq ($(TARGET_PLATFORM),NITRO) + +TEST_ARCH = +ROM_SPEC = main_433a.rsf +LIBSYSCALL = ../433A/libsyscall.a + +endif + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + +ifeq ($(ROMTYPE),MASTER) +INSTALL_DIR = ../mas_data +else +INSTALL_DIR = ../data +endif +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/TMPJump/AppforTmpJump/main_2.c b/build/debugsoft/TMPJump/AppforTmpJump/main_2.c new file mode 100644 index 00000000..334c4500 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforTmpJump/main_2.c @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - tmpjumpTest - AppforTmpJump + File: main.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:$ + *---------------------------------------------------------------------------*/ + +#ifdef SDK_TWL +#include +#else +#include +#endif + +#include "common.h" +#include "screen.h" + +#define DMA_NO_FS 1 + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +static const char gRomPath[32] = "rom:/dummy.srl"; +static u64 gTargetId = 0x0003000434333441; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void DrawMainScene(void); +void VBlankIntr(void); + +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + InitCommon(); + InitScreen(); + + FS_Init(DMA_NO_FS); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // 一度空読み + ReadKey(&gKey); + + while(TRUE) + { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_A) + { +#ifdef SDK_TWL + BOOL success = TRUE; + FSFile src, dest; + void *buf; + s32 len = 0; + + // srl を NAND 上の OS_TMP_APP_PATH へコピー + FS_DeleteFile(OS_TMP_APP_PATH); + FS_CreateFile(OS_TMP_APP_PATH, FS_PERMIT_R | FS_PERMIT_W); + FS_InitFile( &src ); + FS_InitFile( &dest ); + if ( !FS_OpenFileEx( &src, gRomPath, FS_FILEMODE_R ) ) success = FALSE; + len = (s32)FS_GetFileLength( &src ); + + buf = OS_AllocFromMain((u32)len); + if (buf == NULL) + { + success = FALSE; + break; + } + + if ( -1 == FS_ReadFile( &src, buf, len ) ) + { + success = FALSE; + break; + } + + if ( !FS_CloseFile( &src ) ) success = FALSE; + + if ( !FS_OpenFileEx( &dest, OS_TMP_APP_PATH, FS_FILEMODE_W ) ) success = FALSE; + if ( -1 == FS_WriteFile( &dest, buf, len ) ) success = FALSE; + if ( !FS_CloseFile( &dest ) ) success = FALSE; + + if ( !success ) break; + + // TMP ジャンプを試みる + if ( !OS_DoApplicationJump( gTargetId, OS_APP_JUMP_TMP) ) + { + PutSubScreen(1, 10, 0xf1, "ERROR!: Failed to TMP jump"); + } + break; +#endif + } + + if (gKey.trg & PAD_BUTTON_B) + { +#ifdef SDK_TWL + // メインアプリへ戻る + if ( !OS_ReturnToPrevApplication() ) + { + PutSubScreen(1, 10, 0xf1, "ERROR!: Failed to return jump"); + } + break; +#endif + } + + DrawMainScene(); + + OS_WaitVBlankIntr(); + } + + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +static void DrawMainScene(void) +{ + PutMainScreen(1, 1, 0xf2, "Application on tmp dir"); +#ifdef SDK_TWL + PutMainScreen(1, 18, 0xff, "A : try TMP jump"); + PutMainScreen(1, 20, 0xff, "B : Return to Main App"); +#else + PutMainScreen(1, 20, 0xf8, "Can not return to Main (OK)"); +#endif +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/debugsoft/TMPJump/AppforTmpJump/main_433a.rsf b/build/debugsoft/TMPJump/AppforTmpJump/main_433a.rsf new file mode 100644 index 00000000..2219b56a --- /dev/null +++ b/build/debugsoft/TMPJump/AppforTmpJump/main_433a.rsf @@ -0,0 +1,103 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - tmpjumpTest - AppforTmpJump +# File: main_433a.rsf +# +# 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$ +#---------------------------------------------------------------------------- +# +# Nitro ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).nef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7:r).nef" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest_N + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../433A/rom_header_433a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "../banner/banner.bnr" + + # + # Permit TmpJump: for TWL "ApplicationJump" function + # + PermitTmpJump TRUE + + ### + ### + ### + #### END +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/debugsoft/TMPJump/AppforTmpJump/main_434a.rsf b/build/debugsoft/TMPJump/AppforTmpJump/main_434a.rsf new file mode 100644 index 00000000..70118126 --- /dev/null +++ b/build/debugsoft/TMPJump/AppforTmpJump/main_434a.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest_L + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../434A/rom_header_434a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "../banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 434A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/TMPJump/AppforTmpJump/main_435a.rsf b/build/debugsoft/TMPJump/AppforTmpJump/main_435a.rsf new file mode 100644 index 00000000..bc264e1e --- /dev/null +++ b/build/debugsoft/TMPJump/AppforTmpJump/main_435a.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest_L + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ../435A/rom_header_435a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "../banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 435A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/TMPJump/Makefile b/build/debugsoft/TMPJump/Makefile new file mode 100644 index 00000000..69b8368a --- /dev/null +++ b/build/debugsoft/TMPJump/Makefile @@ -0,0 +1,93 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - tmpjumpTest +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +TWL_ARCHGEN := LIMITED + +# GameCard, NAND の両方を作成する + +ifndef APP_TYPE + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL=default +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something: + +$(REMAKE) APP_TYPE=CARD SKIP_SUBDIR=FALSE $(MY_GOAL) + +$(REMAKE) APP_TYPE=NAND SKIP_SUBDIR=FALSE $(MY_GOAL) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +else # ifndef APP_TYPE + +TWL_NANDAPP = TRUE +TARGET_NAME = tmpjumpTest$(ROMTYPE) + +ifeq ($(APP_TYPE),NAND) +TARGET_BIN = $(TARGET_NAME).tad +ROM_SPEC = main_437a.rsf + +else +TARGET_BIN = $(TARGET_NAME).srl +ROM_SPEC = main_436a.rsf +endif + +endif # ifndef APP_TYPE + +INCDIR = ./include +SRCDIR = ./src + +SRCS = main.c common.c screen.c font.c + +ifeq ($(ROMTYPE),MASTER) +MAKEROM_ROMROOT = ./mas_data +else +MAKEROM_ROMROOT = ./data +endif + +MAKEROM_ROMFILES = TestApp.srl \ + TestApp_HYBRID.srl \ + TestApp_LIMITED.srl \ + Test_NITROfail.srl \ + Test_TWLfail.srl + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/TMPJumpTest +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/TMPJump/ReadMe.txt b/build/debugsoft/TMPJump/ReadMe.txt new file mode 100644 index 00000000..7926141d --- /dev/null +++ b/build/debugsoft/TMPJump/ReadMe.txt @@ -0,0 +1,60 @@ +tmpjumpTest + +アプリジャンプ機能(TMPジャンプ)をテストするためのアプリセットです。 +======================================================== + +<概要> =============================================== +このテストでは、以下の 7つのアプリを使用します。 + +--------------------------------------------------------- +address | GameCode | Media | +--------------------------------+-----------+-----------+ +data/TestApp.srl | 433A | GameCard | +data/TestApp_HYBRID.srl | 434A | GameCard | +data/TestApp_LIMITED.srl | 435A | GameCard | tmp 格納用 ROM +data/TestApp_NTR_fail.srl | 458A | GameCard | +data/TestApp_TWL_fail.srl | 459A | GameCard | +--------------------------------------------------------- +bin/.../tmpjumpTest.srl | 436A | GameCard | 起動用 ROM +bin/.../tmpjumpTest.nand.tad | 437A | NAND | +--------------------------------------------------------- + +上の 5つのアプリは、下 2つのアプリに埋め込まれています。 + +<使い方> ============================================= + +まず、「フラッシュカードに書き込んだ 436A」または「インポートした 437A」を起動します。 + +436A, 437A では、選択したアプリを NAND の /tmp 以下へコピーし、TMPジャンプを実行します。 +TMP ジャンプ先のアプリからは、NITRO モードでビルドされている 433A を除く全てのアプリは +ジャンプ元のアプリへ戻ってくることができます。 + + + +(08/08/28 追加)アプリ2点追加、機能追加2点 +TMP ジャンプ先となるアプリとして、458A、459A の 2つを追加しました。 +これら 2つのアプリは「TMP ジャンプ不許可」のアプリなので、TMP ジャンプを実行すると +「必ず失敗」する仕様になっています。 + +TMP ジャンプ先のアプリから、さらに TMP ジャンプが実行できるようにしました。 +仕様では、「必ず失敗」するようになっています。 + +起動用 ROM で、リターンジャンプが可能になりました。 +一度 TMP ジャンプで飛んだあと、リターンジャンプによって起動用 ROM に戻り、 +再度リターンジャンプを実行すると、戻り先が設定されていないために +「必ず失敗」するはずです。 + +(09/06/05 追加)注意 +TMP アプリを NAND の tmp領域へ書き込むために FS_ReadFile() でバッファに読み出す際に +キャッシュ化けによりアプリデータの終端付近が壊れることがありました。 +TWL-SDK 5.2 PR で対策(※)がとられていますので、本テストアプリをビルドする際は仕様する +SDK バージョンに注意してください。 +なお TWL-SDK UIG branch には修正が入っていませんので本テストアプリのビルドに使用しないで下さい。 + +※…TWL-SDK リリースノート Note 72-14 (FS) ファイルアクセス時のキャッシュ操作に関する修正参照 + +<更新履歴>============================================ +2009/06/05 不具合についての情報を追記 +2008/08/28 仕様追加に伴う加筆修正 +2008/08/12 新規追加 + diff --git a/build/debugsoft/TMPJump/banner/banner.bnr b/build/debugsoft/TMPJump/banner/banner.bnr new file mode 100644 index 00000000..e234d8cd Binary files /dev/null and b/build/debugsoft/TMPJump/banner/banner.bnr differ diff --git a/build/debugsoft/TMPJump/data/TestApp.srl b/build/debugsoft/TMPJump/data/TestApp.srl new file mode 100644 index 00000000..d0ce9eb8 Binary files /dev/null and b/build/debugsoft/TMPJump/data/TestApp.srl differ diff --git a/build/debugsoft/TMPJump/data/TestApp_HYBRID.srl b/build/debugsoft/TMPJump/data/TestApp_HYBRID.srl new file mode 100644 index 00000000..f9001dab Binary files /dev/null and b/build/debugsoft/TMPJump/data/TestApp_HYBRID.srl differ diff --git a/build/debugsoft/TMPJump/data/TestApp_LIMITED.srl b/build/debugsoft/TMPJump/data/TestApp_LIMITED.srl new file mode 100644 index 00000000..dcbaa000 Binary files /dev/null and b/build/debugsoft/TMPJump/data/TestApp_LIMITED.srl differ diff --git a/build/debugsoft/TMPJump/data/Test_NITROfail.srl b/build/debugsoft/TMPJump/data/Test_NITROfail.srl new file mode 100644 index 00000000..0574274f Binary files /dev/null and b/build/debugsoft/TMPJump/data/Test_NITROfail.srl differ diff --git a/build/debugsoft/TMPJump/data/Test_TWLfail.srl b/build/debugsoft/TMPJump/data/Test_TWLfail.srl new file mode 100644 index 00000000..17f45a43 Binary files /dev/null and b/build/debugsoft/TMPJump/data/Test_TWLfail.srl differ diff --git a/build/debugsoft/TMPJump/data/dummy.srl b/build/debugsoft/TMPJump/data/dummy.srl new file mode 100644 index 00000000..54a62709 Binary files /dev/null and b/build/debugsoft/TMPJump/data/dummy.srl differ diff --git a/build/debugsoft/TMPJump/include/common.h b/build/debugsoft/TMPJump/include/common.h new file mode 100644 index 00000000..f06d1e6e --- /dev/null +++ b/build/debugsoft/TMPJump/include/common.h @@ -0,0 +1,81 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 COMMON_H_ +#define COMMON_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#ifdef SDK_TWL +#include +#else +#include +#endif + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/* アプリ間パラメータ関連 */ +#define APPJUMP_STRING_LENGTH 24 // 引数一つ分として受け渡しされる文字列の長さ制限 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +// アプリ間でバイナリデータとして引き渡す構造体 +typedef struct AppParam +{ + u32 jumpCount; // アプリジャンプの実行回数 + u8 isAutoJump; // 一定間隔で自動的にアプリジャンプを実行するかどうかのフラグ + u8 rsv[3]; // 4バイトアラインメントのため +} AppParam; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/include/font.h b/build/debugsoft/TMPJump/include/font.h new file mode 100644 index 00000000..37699026 --- /dev/null +++ b/build/debugsoft/TMPJump/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.h + + Copyright 2007 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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/include/screen.h b/build/debugsoft/TMPJump/include/screen.h new file mode 100644 index 00000000..0d08dffd --- /dev/null +++ b/build/debugsoft/TMPJump/include/screen.h @@ -0,0 +1,49 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.h + + Copyright 2007 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 SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/main_436a.rsf b/build/debugsoft/TMPJump/main_436a.rsf new file mode 100644 index 00000000..5990b122 --- /dev/null +++ b/build/debugsoft/TMPJump/main_436a.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ./436A/rom_header_436a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "./banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 436A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/TMPJump/main_437a.rsf b/build/debugsoft/TMPJump/main_437a.rsf new file mode 100644 index 00000000..c5a20aae --- /dev/null +++ b/build/debugsoft/TMPJump/main_437a.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName TmpJmpTest + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate ./437A/rom_header_437a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile "./banner/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump TRUE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 437A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/debugsoft/TMPJump/mas_data/TestApp.srl b/build/debugsoft/TMPJump/mas_data/TestApp.srl new file mode 100644 index 00000000..d0ce9eb8 Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/TestApp.srl differ diff --git a/build/debugsoft/TMPJump/mas_data/TestApp_HYBRID.srl b/build/debugsoft/TMPJump/mas_data/TestApp_HYBRID.srl new file mode 100644 index 00000000..aef61fdf Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/TestApp_HYBRID.srl differ diff --git a/build/debugsoft/TMPJump/mas_data/TestApp_LIMITED.srl b/build/debugsoft/TMPJump/mas_data/TestApp_LIMITED.srl new file mode 100644 index 00000000..b8802444 Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/TestApp_LIMITED.srl differ diff --git a/build/debugsoft/TMPJump/mas_data/Test_NITROfail.srl b/build/debugsoft/TMPJump/mas_data/Test_NITROfail.srl new file mode 100644 index 00000000..0574274f Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/Test_NITROfail.srl differ diff --git a/build/debugsoft/TMPJump/mas_data/Test_TWLfail.srl b/build/debugsoft/TMPJump/mas_data/Test_TWLfail.srl new file mode 100644 index 00000000..c0c9c8ae Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/Test_TWLfail.srl differ diff --git a/build/debugsoft/TMPJump/mas_data/dummy.srl b/build/debugsoft/TMPJump/mas_data/dummy.srl new file mode 100644 index 00000000..8d5cce72 Binary files /dev/null and b/build/debugsoft/TMPJump/mas_data/dummy.srl differ diff --git a/build/debugsoft/TMPJump/src/common.c b/build/debugsoft/TMPJump/src/common.c new file mode 100644 index 00000000..b1883893 --- /dev/null +++ b/build/debugsoft/TMPJump/src/common.c @@ -0,0 +1,153 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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 "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitHeap(void) +{ + void* tempLo; + OSHeapHandle hh; + + // メインメモリ上のアリーナにヒープをひとつ作成 + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + // ヒープ作成に失敗した場合は異常終了 + OS_Panic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/src/font.c b/build/debugsoft/TMPJump/src/font.c new file mode 100644 index 00000000..2111ca07 --- /dev/null +++ b/build/debugsoft/TMPJump/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005,2006 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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/TMPJump/src/main.c b/build/debugsoft/TMPJump/src/main.c new file mode 100644 index 00000000..177d9543 --- /dev/null +++ b/build/debugsoft/TMPJump/src/main.c @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - tmpjumpTest + File: main.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 "common.h" +#include "screen.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define DMA_NO_FS 1 +#define APP_NUM 5 // TMP ジャンプ先ロム数 + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +// キー入力 +static KeyInfo gKey; + +// tmp へコピーする srl +static u8 gSrlNumber = 0; + +// 各 srl の TitleID +static u64 gRomTitleIDList[APP_NUM] = +{ + 0x0003000434333341, // NTR GameCode 433A + 0x0003000434333441, // TWL-HYB GameCode 434A + 0x0003000434333541, // TWL-LTD GameCode 435A + 0x0003000434353841, // NTR (don't permit TMP jump) GameCode 458A + 0x0003000434353941 // TWL (don't permit TMP jump) GameCode 459A +}; + +// 各 srl の場所 +static const char gRomPath[APP_NUM][32] = +{ + "rom:/TestApp.srl", "rom:/TestApp_HYBRID.srl", "rom:/TestApp_LIMITED.srl", + "rom:/Test_NITROfail.srl", "rom:/Test_TWLfail.srl" +}; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void DrawMainScene(void); +void VBlankIntr(void); + +void TwlMain(void) +{ + InitCommon(); + InitScreen(); + + FS_Init(DMA_NO_FS); + + GX_DispOn(); + GXS_DispOn(); + + ClearScreen(); + + // 一度空読み + ReadKey(&gKey); + + while(TRUE) + { + ReadKey(&gKey); + + if (gKey.trg & PAD_BUTTON_A) + { + BOOL success = TRUE; + FSFile src, dest; + void *buf; + s32 len = 0; + + PutSubScreen(1, 8, 0xff, "now writing tmp app..."); + OS_WaitVBlankIntr(); + + // srl を NAND 上の OS_TMP_APP_PATH へコピー + FS_DeleteFile(OS_TMP_APP_PATH); + FS_CreateFile(OS_TMP_APP_PATH, FS_PERMIT_R | FS_PERMIT_W); + FS_InitFile( &src ); + FS_InitFile( &dest ); + if ( !FS_OpenFileEx( &src, gRomPath[gSrlNumber], FS_FILEMODE_R ) ) success = FALSE; + len = (s32)FS_GetFileLength( &src ); + + buf = OS_AllocFromMain((u32)len); + if (buf == NULL) + { + success = FALSE; + break; + } + + if ( -1 == FS_ReadFile( &src, buf, len ) ) + { + success = FALSE; + break; + } + + if ( !FS_CloseFile( &src ) ) success = FALSE; + + if ( !FS_OpenFileEx( &dest, OS_TMP_APP_PATH, FS_FILEMODE_W ) ) success = FALSE; + if ( -1 == FS_WriteFile( &dest, buf, len ) ) success = FALSE; + if ( !FS_CloseFile( &dest ) ) success = FALSE; + + if ( !success ) break; + + // アプリジャンプ + OS_DoApplicationJump( gRomTitleIDList[gSrlNumber], OS_APP_JUMP_TMP ); + // 失敗時にはエラーを下画面に出力して終了 + PutSubScreen(1, 10, 0xf1, "ERROR: TMP Jump failed!"); + break; + } + + if (gKey.trg & PAD_BUTTON_B) + { + // リターンジャンプを試みる + if(!OS_ReturnToPrevApplication()) + { + // 失敗時にはメッセージを表示 + PutSubScreen(1, 10, 0xf1, "ERROR: Return Jump failed!"); + break; + } + } + + // 方向キー上下で、OS_TMP_APP_PATH へコピーする srl を選択 + if (gKey.trg & PAD_KEY_DOWN) + { + gSrlNumber++; + if (gSrlNumber > APP_NUM - 1) + gSrlNumber = 0; + } + else if (gKey.trg & PAD_KEY_UP) + { + if (gSrlNumber == 0) + gSrlNumber = APP_NUM -1; + else + gSrlNumber--; + } + + ClearScreen(); + DrawMainScene(); + + OS_WaitVBlankIntr(); + } + + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + +static void DrawMainScene(void) +{ + PutMainScreen(1, 1, 0xf2, "Application (Main)"); + PutMainScreen(2, 4, 0xff, "B BUTTON: try return jump"); + + PutMainScreen(3, 12, 0xff, "Tmp jump to NITRO rom"); + PutMainScreen(3, 14, 0xff, "Tmp jump to TWL-HYB rom"); + PutMainScreen(3, 16, 0xff, "Tmp jump to TWL-LTD rom"); + + PutMainScreen(3, 18, 0xfe, "Tmp jump to NITRO x rom"); + PutMainScreen(3, 20, 0xfe, "Tmp jump to TWL x rom"); + + // 選択中を示すカーソル描画 + PutMainScreen(1, gSrlNumber * 2 + 12, 0xf4, "*"); +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグをセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/debugsoft/TMPJump/src/screen.c b/build/debugsoft/TMPJump/src/screen.c new file mode 100644 index 00000000..a9fec417 --- /dev/null +++ b/build/debugsoft/TMPJump/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + Copyright 2007 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 "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/debugsoft/Wireless/Makefile b/build/debugsoft/Wireless/Makefile new file mode 100644 index 00000000..e54149f6 --- /dev/null +++ b/build/debugsoft/Wireless/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = WifiIcon + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/debugsoft/Wireless/WifiIcon/Makefile b/build/debugsoft/Wireless/WifiIcon/Makefile new file mode 100644 index 00000000..abf9410a --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/Makefile @@ -0,0 +1,101 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - WiFiIcon +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +SRCS = main.c +TARGET_NAME := WiFiIcon +TARGET_BIN := main.tad +TWLNMENU_ROOT ?= . + +TWL_NANDAPP = TRUE + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = $(TARGET_NAME).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=4S02 \ + BannerFile=./banner/banner.bnr \ + TitleName=$(TARGET_NAME) \ + Media=NAND \ + WiFiConnectionIcon=TRUE \ + Secure=TRUE +# DSWirelessIcon=TRUE \ + + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#------------------------- +# セキュア用 +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +MAKETAD_OPTION := -s + + +#------------------------- +# ビルドパラメータ +INCDIR = $(TWLSYSTEM_ROOT)/include \ + ./include + +#------------------------- +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +#------------------------- +# ビルド +do-build: $(TARGETS) + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +#ifdef MAKE_BANNER +#$(BINDIR)/$(TARGET_NAME)$(ROM_SPEC_NAME_PART).srl: $(BANNER) +#endif + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr b/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr new file mode 100644 index 00000000..2a5447a2 Binary files /dev/null and b/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr differ diff --git a/build/debugsoft/Wireless/WifiIcon/readme.txt b/build/debugsoft/Wireless/WifiIcon/readme.txt new file mode 100644 index 00000000..4f4ce4e8 --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/readme.txt @@ -0,0 +1,6 @@ +WiFiIcon + +*概要 +  WiFiアイコン確認用のアプリ。 +  WiFiアイコンのフラグをオンにしてビルドされます。 +  アプリ自身の機能はありません。 diff --git a/build/debugsoft/Wireless/WifiIcon/src/main.c b/build/debugsoft/Wireless/WifiIcon/src/main.c new file mode 100644 index 00000000..5d509820 --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/src/main.c @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - WiFiIcon + File: main.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 + +static void InitInterrupt(void) +{ + OS_EnableIrq(); + OS_EnableInterrupts(); +} + +static void InitAlloc(void) +{ + OSHeapHandle hHeap; + void* lo = OS_GetMainArenaLo(); + void* hi = OS_GetMainArenaHi(); + + lo = OS_InitAlloc(OS_ARENA_MAIN, lo, hi, 1); + OS_SetArenaLo(OS_ARENA_MAIN, lo); + + hHeap = OS_CreateHeap(OS_ARENA_MAIN, lo, hi); + SDK_ASSERT( hHeap >= 0 ); + + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); +} + +static void InitInteruptSystem(); + + +void +TwlStartUp() +{ + OS_Init(); + InitAlloc(); +} + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数です。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + InitInteruptSystem(); + + GX_DispOn(); + GXS_DispOn(); + + *(u16*)HW_PLTT = 0x001f << 10; + *(u16*)HW_DB_PLTT = 0x001f << 10; + // ランチャーに戻れるように、 終了しない + for (;;) + { + // フレーム更新。 + { + OS_WaitVBlankIntr(); + } + } + + OS_Terminate(); +} + + +/*---------------------------------------------------------------------------* + Name: InitInteruptSystem + + Description: 割り込みを初期化します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitInteruptSystem() +{ + // 個別割り込みフラグを全て不許可に + (void)OS_SetIrqMask(0); + + // マスター割り込みフラグを許可に + (void)OS_EnableIrq(); + + // IRQ 割り込みを許可します + (void)OS_EnableInterrupts(); + + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); +} diff --git a/build/debugsoft/treenand2sd/Makefile b/build/debugsoft/treenand2sd/Makefile new file mode 100644 index 00000000..93d53d6b --- /dev/null +++ b/build/debugsoft/treenand2sd/Makefile @@ -0,0 +1,71 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - treenand +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIR_FLAGS = TWL_ARCHGEN=$(TWL_ARCHGEN) +SUBDIRS = $(SDLOG_DIR) + +TARGET_PLATFORM := TWL + +TWL_PROC := ARM9 +TWL_ARCHGEN := LIMITED +TARGET_BIN = treenand2sd.srl + +SRCS = main.cpp text.c MyStrings.c fontdata.c + +SDLOG_DIR = $(ROOT)/build/tests/sdlog/sdlog +LINCLUDES += $(SDLOG_DIR)/include +LLIBRARY_DIRS = $(SDLOG_DIR)/lib/$(TWL_BUILDTYPE) +LLIBRARIES += libsdlog$(NITRO_LIBSUFFIX).a\ + +ROM_SPEC = demo.autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=4NTA \ + NANDAccess=TRUE \ + SDCardAccess=TRUE \ + Secure=TRUE \ + CardRegion=ALL \ + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------- +# セキュアアプリ指定 + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- +#追加するCCオプション +#---------------------------------------------------------------------------- +CCFLAGS += -w nounwanted + +ifeq ($(TWL_BUILD_TYPE),RELEASE) +INSTALL_DIR = $(ROOT)/bin/ARM9-TS/Release +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/treenand2sd/include/MyStrings.h b/build/debugsoft/treenand2sd/include/MyStrings.h new file mode 100644 index 00000000..aa698cea --- /dev/null +++ b/build/debugsoft/treenand2sd/include/MyStrings.h @@ -0,0 +1,84 @@ +/************************************************************************* + +簡単な文字列表示する関数群 + + ************************************************************************/ +#include + +#include "basicdef.h" +#include "text.h" + +/************************************************************************ + 二重定義や宣言/参照を同じヘッダで使用するためのプリプロセッサ + ************************************************************************/ + +/* 多重インクルードの回避 */ +#ifndef MYSTRINGS_H_INCLUDED +#define MYSTRINGS_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ + +☆使用する構造体 + + ************************************************************************/ + + +/* 画面出力するために使用するコンソール */ +typedef struct { + COORDINATE_TYPE Cursor; /* 現在のカーソル位置 */ + int Palette; /* 現在使用するパレット */ + + int ScrollStart; /* スクロール開始・終了位置 */ + int ScrollEnd; + + TEXT_VRAM_TYPE *Text; /* 書き込み先 */ + +} CONSOLE_TYPE; + + +/************************************************************************ + +☆参照宣言 + ************************************************************************/ + +extern CONSOLE_TYPE StdConsole; +extern CONSOLE_TYPE *Console; + + + +/************************************************************************ +☆パブリックと同等に使用するマクロ + ************************************************************************/ +#define wPuts( str__ ) wcPuts( &StdConsole, str__ ) +#define _Puts( str__ ) _cPuts( &StdConsole, str__ ) +#define wPutchar( character__ ) wcPutchar( &StdConsole, character__ ) +#define wPutcharNC( character__ ) wcPutcharNC( &StdConsole, character__ ) +#define wGotoxy( x__, y__ ) wcGotoxy( &StdConsole, x__, y__ ) +#define wSetPalette( Palette__ ) wcSetPalette( &StdConsole, Palette__ ); + + +/************************************************************************ +☆パブリック関数の宣言 + ************************************************************************/ +extern int wcPuts ( CONSOLE_TYPE *Console, const char *str ); +extern void _cPuts ( CONSOLE_TYPE *Console, const char *str ); +extern void wcGotoxy ( CONSOLE_TYPE *Console, int x, int y ); +extern void wcSetPalette( CONSOLE_TYPE *Console, int Palette ); +extern int wcPutchar ( CONSOLE_TYPE *Console, int Character ); +extern int wcPutcharNC ( CONSOLE_TYPE *Console, int Character ); +extern void wcPrintf ( CONSOLE_TYPE *Console, const char *fmt , ... ); +extern void wPrintf ( const char *fmt , ... ); +extern void swPrintf ( const char *fmt , ... ); +extern int wCountLine ( const char *Str ); + +#ifdef __cplusplus +} +#endif + +/* 多重インクルードの回避 */ +#endif + diff --git a/build/debugsoft/treenand2sd/include/basicdef.h b/build/debugsoft/treenand2sd/include/basicdef.h new file mode 100644 index 00000000..6670ec12 --- /dev/null +++ b/build/debugsoft/treenand2sd/include/basicdef.h @@ -0,0 +1,123 @@ +/************************************************************************** + + 基本定義ヘッダファイル + + 多くのソースファイルで使用する基本的な情報を記述しています。 + + + *************************************************************************/ + + +/* 多重インクルードの回避 */ +#ifndef __BASICDEF_H__ +#define __BASICDEF_H__ + +/************************************************************************** + 標準でインクルードするヘッダファイル + *************************************************************************/ +#include +#include // NULLを使用するため + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************** + #define系プリプロセッサ命令 記述領域 + *************************************************************************/ + +//V周期 +#define VERTICAL_CYCLE 16743 //単位μS + + +//画面関係の定義 +#define SCREEN_WIDTH 32 /* コンソールで使用するテキストRAMの列数 */ +#define SCREEN_HEIGHT 24 /* コンソールで使用するテキストRAMの行数 */ + +#define VIRTUAL_SCREEN_WIDTH 32 /* 仮想画面のサイズ */ +#define VIRTUAL_SCREEN_HEIGHT 32 + +#define CHARACTER_SIDE_LENGTH 8 /* キャラクタの一辺の長さ */ + +#define SCREEN_WIDTH_DOT 256 +#define SCREEN_HEIGHT_DOT 192 + +/************************************************************************** + 汎用マクロ定義 + *************************************************************************/ + +//配列の要素数を求める 'Code Complete 上 第二版 P379 から引用 +#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) + +/************************************************************************** + 型定義 + *************************************************************************/ + + +#if 0 +/* ブール型の設定 */ +#undef FALSE +#undef TRUE +typedef enum { FALSE=0, TRUE=1 } BOOL; +#endif + +/* 整数型座標構造体 */ +typedef struct { /* 座標を指定する構造体 */ + int x; /* X座標 */ + int y; /* Y座標 */ +} COORDINATE_TYPE; + +/* 各色の成分 */ +typedef enum { + RAW_COLOR_BLACK = 0x0000, + RAW_COLOR_RED = 0x001f, + RAW_COLOR_GREEN = 0x03e0, + RAW_COLOR_YELLOW = 0x03ff, + RAW_COLOR_BLUE = 0x7c00, + RAW_COLOR_MAGENTA = 0x7c1f, + RAW_COLOR_CYAN = 0x7fe0, + RAW_COLOR_WHITE = 0x7fff, + + RAW_COLOR_GRAY1 = 0x1004, + RAW_COLOR_GRAY2 = 0x2108, + RAW_COLOR_GRAY3 = 0x318c, + RAW_COLOR_GRAY4 = 0x4210, + RAW_COLOR_GRAY5 = 0x5294, + RAW_COLOR_GRAY6 = 0x6318 + +} RAW_COLOR; + +/* パレット設定 */ +typedef enum { + COLOR_TRANSLUCENT = 0, + COLOR_RED = 1, + COLOR_GREEN = 2, + COLOR_YELLOW = 3, + COLOR_BLUE = 4, + COLOR_MAGENTA = 5, + COLOR_CYAN = 6, + COLOR_WHITE = 7, + COLOR_BLACK = 8, + COLOR_GRAY1 = 9, + COLOR_GRAY2 =10, + COLOR_GRAY3 =11, + COLOR_GRAY4 =12, + COLOR_GRAY5 =13, + COLOR_GRAY6 =14 + + +} COLOR_TYPE; + +#define COLOR_GRAY COLOR_GRAY5 + +#ifdef __cplusplus +} +#endif + +/* 多重インクルードの回避 */ +#endif + + + + + diff --git a/build/debugsoft/treenand2sd/include/fontdata.h b/build/debugsoft/treenand2sd/include/fontdata.h new file mode 100644 index 00000000..33fcb71b --- /dev/null +++ b/build/debugsoft/treenand2sd/include/fontdata.h @@ -0,0 +1,27 @@ +/******************************************************************** + + 標準データの定義 + + + ********************************************************************/ +#ifndef _DATA_H +#define _DATA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "basicdef.h" +/************************************************************************ + +☆外部公開変数 + + ***********************************************************************/ +extern const u16 PlttData_Sample[16][16]; +extern const u32 CharData_Sample[8*0x100]; + +#ifdef __cplusplus +} +#endif + +#endif /* _DATA_H */ diff --git a/build/debugsoft/treenand2sd/include/text.h b/build/debugsoft/treenand2sd/include/text.h new file mode 100644 index 00000000..e8fa13b7 --- /dev/null +++ b/build/debugsoft/treenand2sd/include/text.h @@ -0,0 +1,70 @@ +/************************************************************************ + + テキストVRAMエミュレーション + + ************************************************************************/ +#include "basicdef.h" + +/************************************************************************ + 二重定義や宣言/参照を同じヘッダで使用するためのプリプロセッサ + ************************************************************************/ + +/* 多重インクルードの回避 */ +#ifndef TEXT_H_INCLUDED +#define TEXT_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ +☆パブリック関数の宣言 + ************************************************************************/ +extern void wInitTextVram( void ); +extern void wSuspendTextVram( void ); +extern void wResumeTextVram( void ); + +extern void swSuspendTextVram( void ); +extern void swResumeTextVram( void ); + +extern void wRemoveTextVram( void ); + +/************************************************************************ +☆テキストVRAMで使用する定数値 + ************************************************************************/ + +#define CLEAR_CHARACTER ' ' /* 画面クリア時に使用するキャラクタ */ + +/************************************************************************ +☆テキストVRAMで使用する構造体 + ************************************************************************/ + + +/* + * テキストVRAM本体です。 + * Map :表示文字をアスキーコードで入力します + * + * 現在、他の属性はなし。 + */ + + +typedef struct { /* テキストVRAM操作用*/ + u16 Map[VIRTUAL_SCREEN_HEIGHT][VIRTUAL_SCREEN_WIDTH]; +} TEXT_VRAM_TYPE; + +/************************************************************************ +☆テキストVRAMの参照宣言 + ************************************************************************/ + +/* テキストVRAM本体 */ +extern TEXT_VRAM_TYPE wText; +extern TEXT_VRAM_TYPE swText; + +#ifdef __cplusplus +} +#endif + + + +/* 多重インクルードの回避 */ +#endif diff --git a/build/debugsoft/treenand2sd/src/MyStrings.c b/build/debugsoft/treenand2sd/src/MyStrings.c new file mode 100644 index 00000000..52398988 --- /dev/null +++ b/build/debugsoft/treenand2sd/src/MyStrings.c @@ -0,0 +1,313 @@ +/************************************************************************ + +タイトル: + 文字、文字列表示ルーチン集 + + ************************************************************************/ +#include +#include "basicdef.h" +#include "MyStrings.h" + +/************************************************************************ +☆動作モード + ************************************************************************/ +#define USE_SDK_PRINTF //SDKのPrintf関係を使用するときに定義 + +/************************************************************************ + +☆実体宣言 + ************************************************************************/ + +//標準のコンソール +CONSOLE_TYPE StdConsole = { { 0, 0}, + COLOR_BLACK, + 0, SCREEN_HEIGHT-2, + &wText + }; + +CONSOLE_TYPE *Console = &StdConsole; + +/************************************************************************ +☆プロトタイプ宣言 + ************************************************************************/ +static void ScrollDown( CONSOLE_TYPE *Console ); + +/************************************************************************ +************************************************************************* +************************************************************************* + + + + + +☆文字出力関係のユーティリティ + + + + + +************************************************************************* +************************************************************************* +*************************************************************************/ + +/************************************************************************ + + 一文字表示 + +概要: + 引数の文字コードをテキストVRAM上に表示させる + ( putchar とコンパチかな?) + +引数: + Console 表示コンソール + Character 文字コード + +戻り値: + 文字コード(putcharとなるべく仕様をあわせるため) + + ***********************************************************************/ +extern int wcPutchar( CONSOLE_TYPE *Console, int Character ){ + int i; + u16 *Pointer; + switch( Character ){ + + case '\n': /* 改行コードの処理 */ + Console->Cursor.y++; + Console->Cursor.x = 0; + break; + + case '\t': /* タブコードの処理(4タブ) */ + Console->Cursor.x +=4 - ( (StdConsole.Cursor.x) % 4 ); + break; + + case '\f': /* 改ページコードの処理 */ + Pointer = &(Console->Text->Map[0][0] ); + for( i=0 ; iText->Map[ Console->Cursor.y ][ Console->Cursor.x++ ] + = (u16)( (Console->Palette << 12 ) | Character ); + } + + /* 行あふれの処理 */ + if( Console->Cursor.x > SCREEN_WIDTH-1 ){ + Console->Cursor.x = 0; + Console->Cursor.y++; + } + + /* 列あふれの処理 */ + if( Console->Cursor.y > Console->ScrollEnd ){ + --Console->Cursor.y; + ScrollDown( Console ); + + } + return Character; +} + +/************************************************************************ + + 一文字表示(制御コード処理なし) + +概要: + 引数の文字コードをテキストVRAM上に表示させる + wcPutcharの制御コード判定なしバージョン + +引数: + Console 表示コンソール + Character 文字コード + +戻り値: + 文字コード(putcharとなるべく仕様をあわせるため) + + ***********************************************************************/ +extern int wcPutcharNC( CONSOLE_TYPE *Console, int Character ){ + + /* 文字の表示 */ + Console->Text->Map[ Console->Cursor.y ][ Console->Cursor.x++ ] + = (u16)( (Console->Palette << 12) | Character ); + /* 行あふれの処理 */ + if( Console->Cursor.x > SCREEN_WIDTH-1 ){ + Console->Cursor.x = 0; + Console->Cursor.y++; + } + + /* 列あふれの処理 */ + if( Console->Cursor.y > Console->ScrollEnd ){ + --Console->Cursor.y; + ScrollDown( Console ); + + } + return Character; +} + +/************************************************************************ + + 文字列表示(改行なし版) + +概要: + 引数の文字列を表示させる(最後に改行コードが入らないので注意) + +引数: + Console 表示コンソール + String 表示文字列 + +※ 0x80-0xffの文字コードに対応するため、(u8 *)へのキャストをしています。 + + ***********************************************************************/ +extern void _cPuts( CONSOLE_TYPE *Console, const char *String ){ + int CurrentCharacter; + while( CurrentCharacter = *(u8 *)String++ ) wcPutchar( Console, CurrentCharacter ); +} + +/************************************************************************ + + 文字列表示 + +概要: + 引数の文字列を画面に表示させる(最後に改行コードが入ります) + +引数: + Console 表示コンソール + String 表示文字列 + +戻り値: + 常に0 putsとのコンパチビリティを保つため + + ***********************************************************************/ +extern int wcPuts( CONSOLE_TYPE *Console, const char *String ){ + _cPuts( Console, String ); /* 文字列の表示 */ + _cPuts( Console, "\n" ); /* 改行 */ + return 0; +} + +/************************************************************************ + + テキスト画面を下にスクロールさせる + +引数: + Console 該当コンソール + + ***********************************************************************/ +static void ScrollDown( CONSOLE_TYPE *Console ){ + int i; + + for( i=Console->ScrollStart+1 ; i<=Console->ScrollEnd ; i++ ){ + /* 一列上にコピーする */ + memcpy( Console->Text->Map[i-1], Console->Text->Map[i], SCREEN_WIDTH* sizeof(u16) ); + } + + /* 最終行のクリア */ + for( i=0 ; iText->Map[ Console->ScrollEnd ][i] = CLEAR_CHARACTER; + } + +} + +/************************************************************************ + + カーソル位置の設定 + +引数: + Console 該当コンソール + x X座標 + y Y座標 + + ************************************************************************/ +extern void wcGotoxy( CONSOLE_TYPE *Console, int x, int y ){ + /* とりあえず座標のコピー */ + Console->Cursor.x = x; + Console->Cursor.y = y; + + /* 範囲制限をするこれをしないとオーバーランを起こす */ + if( Console->Cursor.x < 0 ) Console->Cursor.x = 0; + if( Console->Cursor.x > SCREEN_WIDTH-1 ) Console->Cursor.x = SCREEN_WIDTH-1; + if( Console->Cursor.y < 0 ) Console->Cursor.y = 0; + if( Console->Cursor.y > SCREEN_HEIGHT-1 ) Console->Cursor.y = SCREEN_HEIGHT-1; + +} +/************************************************************************ + + パレットの設定 + +引数: + Console 該当コンソール + Palette 設定パレット + + ************************************************************************/ +extern void wcSetPalette( CONSOLE_TYPE *Console, int Palette ){ + + Console->Palette = Palette; + +} + +/************************************************************************ + +☆Printf + +※NitroSDKのOS_Printfを参考にしています。 + + + Printfもどき + +※標準のコンソールに表示されます。 + +引数: + fmt: フォーマット付き文字列 + ...: パラメータ + + + ************************************************************************/ +extern void wPrintf( const char *fmt , ... ){ + + char common_buffer[0x100]; + + va_list vlist; + + //引数取得 + va_start( vlist, fmt ); + + //vprintf相当部分 +#ifdef USE_SDK_PRINTF + OS_VSNPrintf( common_buffer, sizeof(common_buffer), fmt, vlist ); +#else + vsnprintf( common_buffer, sizeof(common_buffer), fmt, vlist ); +#endif + _Puts( common_buffer ); + + //引数後処理 + va_end( vlist ); + +} + + +/************************************************************************ + + 文字列の行数のカウントする + +引数: + Str 文字列 + +戻り値: + 行数 + ************************************************************************/ +extern int wCountLine( const char *Str ){ + + int Line; + + if( *Str=='\0' ) return 0; //空文字列の判定 + + Line=1; + while( *Str!='\0' ){ + if( *Str=='\n' ) Line++; + Str++; + } + + return Line; +} + + + diff --git a/build/debugsoft/treenand2sd/src/fontdata.c b/build/debugsoft/treenand2sd/src/fontdata.c new file mode 100644 index 00000000..ce0da841 --- /dev/null +++ b/build/debugsoft/treenand2sd/src/fontdata.c @@ -0,0 +1,594 @@ +/******************************************************************** + +タイトル: + 標準データの定義 + + + ********************************************************************/ +#include "basicdef.h" +#include "fontdata.h" + +/************************************************************************ + +☆プライベート宣言 + + ***********************************************************************/ + +/************************************************************************ + +☆データ定義 + + ***********************************************************************/ + +/************************************************************************ + + パレットデータ + +概要: + + 0は背景用パレットデータ + 1〜8はテキストVRAM用パレットデータ + 15はキャンパス用パレットデータ + 14はBG用パレットデータ + + ***********************************************************************/ +const u16 PlttData_Sample[16][16] = { + + { RAW_COLOR_WHITE, RAW_COLOR_BLACK }, // 背景用パレット + { RAW_COLOR_WHITE, RAW_COLOR_RED, }, // Palette 1 + { RAW_COLOR_WHITE, RAW_COLOR_GREEN }, // Palette 2 + { RAW_COLOR_WHITE, RAW_COLOR_YELLOW }, // Palette 3 + { RAW_COLOR_WHITE, RAW_COLOR_BLUE }, // Palette 4 + { RAW_COLOR_WHITE, RAW_COLOR_MAGENTA }, // Palette 5 + { RAW_COLOR_WHITE, RAW_COLOR_CYAN }, // Palette 6 + { RAW_COLOR_WHITE, RAW_COLOR_WHITE }, // Palette 7 + { RAW_COLOR_WHITE, RAW_COLOR_BLACK }, // Palette 8 + + { RAW_COLOR_WHITE}, // Palette 9 + { RAW_COLOR_WHITE}, // Palette 10 + { RAW_COLOR_WHITE}, // Palette 11 + { RAW_COLOR_WHITE}, // Palette 12 + { RAW_COLOR_WHITE}, // Palette 13 + { RAW_COLOR_WHITE}, // Palette 14 壁紙用 + + { RAW_COLOR_WHITE, RAW_COLOR_RED, // Palette 15 + RAW_COLOR_GREEN, RAW_COLOR_YELLOW, + RAW_COLOR_BLUE, RAW_COLOR_MAGENTA, + RAW_COLOR_CYAN, RAW_COLOR_WHITE, + RAW_COLOR_BLACK, RAW_COLOR_GRAY1, + RAW_COLOR_GRAY2, RAW_COLOR_GRAY3, + RAW_COLOR_GRAY4, RAW_COLOR_GRAY5, + RAW_COLOR_GRAY6, RAW_COLOR_WHITE, + }, // キャンパス用パレット +}; + + + +/************************************************************************ + + キャラクタデータ + + ***********************************************************************/ +const u32 CharData_Sample[8*0x100] = { + 0x00000000,0x00000000,0x00000000,0x00000000, //0000 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x11111111,0x11111111,0x11111111,0x11111111, //0001 + 0x11111111,0x11111111,0x11111111,0x11111111, + 0x00000000,0x00000000,0x00000000,0x00000000, //0002 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0003 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0004 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0005 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0006 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0007 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0008 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0009 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000A + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000B + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000C + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000D + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000E + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //000F + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0010 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0011 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0012 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0013 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0014 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0015 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0016 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0017 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0018 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0019 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001A + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001B + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001C + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001D + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001E + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //001F + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0020 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00011000,0x00011000,0x00011000,0x00011000, //0021 ! + 0x00000000,0x00011000,0x00011000,0x00000000, + 0x00011011,0x00011011,0x00010010,0x00000000, //0022 " + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00010100,0x00111110,0x00010100, //0023 # + 0x00010100,0x00111110,0x00010100,0x00000000, + 0x00001000,0x00111110,0x00001011,0x00111110, //0024 $ + 0x01101000,0x00111110,0x00001000,0x00000000, + 0x01100111,0x00110101,0x00011111,0x00001100, //0025 % + 0x01110110,0x01010011,0x01110001,0x00000000, + 0x00011100,0x00110110,0x00011100,0x00001110, //0026 & + 0x00011011,0x01110011,0x00111110,0x00000000, + 0x00000011,0x00000011,0x00000010,0x00000000, //0027 ' + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00011100,0x00000110,0x00000011,0x00000011, //0028 ( + 0x00000011,0x00000110,0x00011100,0x00000000, + 0x00011100,0x00110000,0x01100000,0x01100000, //0029 ) + 0x01100000,0x00110000,0x00011100,0x00000000, + 0x00000000,0x00000000,0x00001000,0x00101010, //002A * + 0x00011100,0x00101010,0x00001000,0x00000000, + 0x00000000,0x00000000,0x00001000,0x00001000, //002B + + 0x00111110,0x00001000,0x00001000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //002C , + 0x00000000,0x00000011,0x00000011,0x00000010, + 0x00000000,0x00000000,0x00000000,0x00000000, //002D - + 0x00111110,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //002E . + 0x00000000,0x00000011,0x00000011,0x00000000, + 0x01100000,0x00110000,0x00011000,0x00001100, //002F / + 0x00000110,0x00000011,0x00000001,0x00000000, + 0x00011100,0x00110010,0x01100011,0x01100011, //0030 0 + 0x01100011,0x00100110,0x00011100,0x00000000, + 0x00011000,0x00011100,0x00011110,0x00011000, //0031 1 + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x00111110,0x01100011,0x01100011,0x00111000, //0032 2 + 0x00001110,0x00000011,0x01111111,0x00000000, + 0x01111110,0x00110000,0x00011000,0x00111100, //0033 3 + 0x01100000,0x01100011,0x00111110,0x00000000, + 0x00110000,0x00111000,0x00111100,0x00110110, //0034 4 + 0x00110011,0x01111111,0x00110000,0x00000000, + 0x00111111,0x00000011,0x00000011,0x00111111, //0035 5 + 0x01100000,0x01100011,0x00111110,0x00000000, + 0x00111100,0x00000110,0x00000011,0x00111111, //0036 6 + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x01111111,0x01110000,0x00111000,0x00011100, //0037 7 + 0x00001100,0x00001100,0x00001100,0x00000000, + 0x00111110,0x01100011,0x01100011,0x00111110, //0038 8 + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x00111110,0x01100011,0x01100011,0x01111110, //0039 9 + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00000000,0x00011000,0x00011000,0x00000000, //003A : + 0x00000000,0x00011000,0x00011000,0x00000000, + 0x00000000,0x00011000,0x00011000,0x00000000, //003B ; + 0x00000000,0x00011000,0x00011000,0x00010000, + 0x01100000,0x00111000,0x00001110,0x00000011, //003C < + 0x00001110,0x00111000,0x01100000,0x00000000, + 0x00000000,0x00000000,0x00111110,0x00000000, //003D = + 0x00000000,0x00111110,0x00000000,0x00000000, + 0x00000011,0x00001110,0x00111000,0x01100000, //003E > + 0x00111000,0x00001110,0x00000011,0x00000000, + 0x01111110,0x11000011,0x11000011,0x01111000, //003F ? + 0x00011000,0x00000000,0x00011000,0x00000000, + 0x00111110,0x01100011,0x01011001,0x01010101, //0040 @ + 0x01011101,0x01110011,0x00011110,0x00000000, + 0x00111110,0x01100011,0x01100011,0x01111111, //0041 A + 0x01100011,0x01100011,0x01100011,0x00000000, + 0x00111111,0x01100011,0x01100011,0x00111111, //0042 B + 0x01100011,0x01100011,0x00111111,0x00000000, + 0x00111110,0x01100011,0x01100011,0x00000011, //0043 C + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x00111111,0x01100011,0x01100011,0x01100011, //0044 D + 0x01100011,0x01100011,0x00111111,0x00000000, + 0x01111111,0x00000011,0x00000011,0x00111111, //0045 E + 0x00000011,0x00000011,0x01111111,0x00000000, + 0x01111111,0x00000011,0x00000011,0x00111111, //0046 F + 0x00000011,0x00000011,0x00000011,0x00000000, + 0x00111110,0x01100011,0x00000011,0x01111011, //0047 G + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x01100011,0x01100011,0x01100011,0x01111111, //0048 H + 0x01100011,0x01100011,0x01100011,0x00000000, + 0x00011000,0x00011000,0x00011000,0x00011000, //0049 I + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x01100000,0x01100000,0x01100000,0x01100000, //004A J + 0x01100000,0x01100011,0x00111110,0x00000000, + 0x01100011,0x01110011,0x00111011,0x00011111, //004B K + 0x00111011,0x01110011,0x01100011,0x00000000, + 0x00000011,0x00000011,0x00000011,0x00000011, //004C L + 0x00000011,0x00000011,0x01111111,0x00000000, + 0x01100011,0x01100011,0x01110111,0x01110111, //004D M + 0x01111111,0x01101011,0x01101011,0x00000000, + 0x01100011,0x01100111,0x01101111,0x01111111, //004E N + 0x01111011,0x01110011,0x01100011,0x00000000, + 0x00111110,0x01100011,0x01100011,0x01100011, //004F O + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x00111111,0x01100011,0x01100011,0x00111111, //0050 P + 0x00000011,0x00000011,0x00000011,0x00000000, + 0x00111110,0x01100011,0x01100011,0x01100011, //0051 Q + 0x01100011,0x00111110,0x01110000,0x00000000, + 0x00111111,0x01100011,0x01100011,0x00111111, //0052 R + 0x01100011,0x01100011,0x01100011,0x00000000, + 0x00111110,0x01100011,0x00000011,0x00111110, //0053 S + 0x01100000,0x01100011,0x00111110,0x00000000, + 0x11111111,0x00011000,0x00011000,0x00011000, //0054 T + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x01100011,0x01100011,0x01100011,0x01100011, //0055 U + 0x01100011,0x01100011,0x00111110,0x00000000, + 0x01100011,0x01100011,0x00110110,0x00110110, //0056 V + 0x00011100,0x00011100,0x00001000,0x00000000, + 0x11011011,0x11011011,0x11011011,0x11011011, //0057 W + 0x11011011,0x01111110,0x01100110,0x00000000, + 0x01000001,0x01100011,0x00110110,0x00011100, //0058 X + 0x00011100,0x00110110,0x01100011,0x00000000, + 0x11000011,0x11000011,0x11100111,0x01111110, //0059 Y + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x01111111,0x00110000,0x00011000,0x00001100, //005A Z + 0x00000110,0x00000011,0x01111111,0x00000000, + 0x00001111,0x00000011,0x00000011,0x00000011, //005B [ + 0x00000011,0x00000011,0x00001111,0x00000000, + 0x01100110,0x01100110,0x11111111,0x00011000, //005C \' + 0x11111111,0x00011000,0x00011000,0x00000000, + 0x01111000,0x01100000,0x01100000,0x01100000, //005D ] + 0x01100000,0x01100000,0x01111000,0x00000000, + 0x00011100,0x00110110,0x00100010,0x00000000, //005E ^ + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //005F _ + 0x00000000,0x00000000,0x01111111,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x00000000, //0060 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x01111000,0x01100100, //0061 a + 0x01100110,0x01110110,0x01101110,0x00000000, + 0x00000110,0x00000110,0x00111110,0x01100110, //0062 b + 0x01100110,0x01100110,0x00111110,0x00000000, + 0x00000000,0x00000000,0x00111100,0x01100110, //0063 c + 0x00000110,0x01100110,0x00111100,0x00000000, + 0x01100000,0x01100000,0x01111100,0x01100110, //0064 d + 0x01100110,0x01100110,0x01111100,0x00000000, + 0x00000000,0x00000000,0x00111100,0x01100110, //0065 e + 0x01111110,0x00000110,0x00111100,0x00000000, + 0x01110000,0x00011000,0x01111110,0x00011000, //0066 f + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x00000000,0x00000000,0x00111100,0x01100110, //0067 g + 0x01100110,0x01111100,0x01100000,0x00111110, + 0x00000110,0x00000110,0x00000110,0x00111110, //0068 h + 0x01100110,0x01100110,0x01100110,0x00000000, + 0x00011000,0x00011000,0x00000000,0x00011000, //0069 i + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x00110000,0x00110000,0x00000000,0x00110000, //006A j + 0x00110000,0x00110000,0x00110011,0x00011110, + 0x00000011,0x01100011,0x00110011,0x00011111, //006B k + 0x00011111,0x00110011,0x01100011,0x00000000, + 0x00011000,0x00011000,0x00011000,0x00011000, //006C l + 0x00011000,0x00011000,0x00011000,0x00000000, + 0x00000000,0x00000000,0x01111111,0x11011011, //006D m + 0x11011011,0x11011011,0x11011011,0x00000000, + 0x00000000,0x00000000,0x00111110,0x01100110, //006E n + 0x01100110,0x01100110,0x01100110,0x00000000, + 0x00000000,0x00000000,0x00111100,0x01100110, //006F o + 0x01100110,0x01100110,0x00111100,0x00000000, + 0x00000000,0x00000000,0x00111110,0x01100110, //0070 p + 0x01100110,0x00111110,0x00000110,0x00000110, + 0x00000000,0x00000000,0x01111100,0x01100110, //0071 q + 0x01100110,0x01111100,0x01100000,0x01100000, + 0x00000000,0x00000000,0x00101100,0x00011100, //0072 r + 0x00001100,0x00001100,0x00001100,0x00000000, + 0x00000000,0x00000000,0x00111100,0x00000110, //0073 s + 0x00111100,0x01100000,0x00111100,0x00000000, + 0x00000000,0x00011000,0x00111100,0x00011000, //0074 t + 0x00011000,0x00011000,0x00110000,0x00000000, + 0x00000000,0x00000000,0x01100110,0x01100110, //0075 u + 0x01100110,0x01100110,0x01111100,0x00000000, + 0x00000000,0x00000000,0x01100110,0x01100110, //0076 v + 0x01100110,0x00111100,0x00011000,0x00000000, + 0x00000000,0x00000000,0x11011011,0x11011011, //0077 w + 0x11011011,0x11011011,0x01111110,0x00000000, + 0x00000000,0x00000000,0x01100110,0x00111100, //0078 x + 0x00011000,0x00111100,0x01100110,0x00000000, + 0x00000000,0x00000000,0x01100110,0x01100110, //0079 y + 0x01100110,0x01111100,0x01100000,0x00111110, + 0x00000000,0x00000000,0x01111110,0x00110000, //007A z + 0x00011000,0x00001100,0x01111110,0x00000000, + 0x00011100,0x00000110,0x00000110,0x00000111, //007B { + 0x00000110,0x00000110,0x00011100,0x00000000, + 0x00001000,0x00001000,0x00001000,0x00001000, //007C | + 0x00001000,0x00001000,0x00001000,0x00000000, + 0x00011100,0x00110000,0x00110000,0x01110000, //007D } + 0x00110000,0x00110000,0x00011100,0x00000000, + 0x01101100,0x00111110,0x00011011,0x00000000, //007E ~ + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //007F + 0x00000000,0x00000000,0x00000000,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x00000000, //0080 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0081 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0082 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0083 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0084 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0085 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0086 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0087 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0088 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0089 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008A + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008B + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008C + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008D + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008E + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //008F + 0x00000000,0x00000000,0x00000000,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x00000000, //0090 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0091 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0092 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0093 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0094 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0095 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0096 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0097 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0098 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //0099 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009A + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009B + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009C + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009D + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009E + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //009F + 0x00000000,0x00000000,0x00000000,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x00000000, //00A0 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00A1 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00A2 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00A3 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00A4 + 0x00000000,0x00000000,0x00000000,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x00001100, //00A5 ・ + 0x00001100,0x00000000,0x00000000,0x00000000, + 0x01111110,0x01000000,0x01111110,0x01000000, //00A6 ヲ + 0x01100000,0x00110000,0x00011100,0x00000000, + 0x00000000,0x00000000,0x00111110,0x00101000, //00A7 ァ + 0x00011000,0x00001000,0x00000100,0x00000000, + 0x00000000,0x00000000,0x00100000,0x00011000, //00A8 ィ + 0x00001110,0x00001000,0x00001000,0x00000000, + 0x00000000,0x00000000,0x00001000,0x00111110, //00A9 ゥ + 0x00100010,0x00110000,0x00011100,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00011100, //00AA ェ + 0x00001000,0x00001000,0x00111110,0x00000000, + 0x00000000,0x00000000,0x00010000,0x00111110, //00AB ォ + 0x00011000,0x00010100,0x00010010,0x00000000, + 0x00000000,0x00000000,0x00000100,0x00111110, //00AC ャ + 0x00100100,0x00010100,0x00000100,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00011100, //00AD ュ + 0x00010000,0x00010000,0x01111110,0x00000000, + 0x00000000,0x00000000,0x00111100,0x00100000, //00AE ョ + 0x00111100,0x00100000,0x00111100,0x00000000, + 0x00000000,0x00000000,0x00001010,0x00101010, //00AF ッ + 0x00100000,0x00110000,0x00011100,0x00000000, + 0x00000000,0x00000000,0x00000000,0x01111110, //00B0 ー + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x01111111,0x01000000,0x01100100,0x00111100, //00B1 ア + 0x00000100,0x00000110,0x00000011,0x00000000, + 0x01100000,0x00110000,0x00011100,0x00010111, //00B2 イ + 0x00010000,0x00010000,0x00010000,0x00000000, + 0x00001000,0x01111111,0x01000001,0x01000001, //00B3 ウ + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00000000,0x00111110,0x00001000,0x00001000, //00B4 エ + 0x00001000,0x00001000,0x01111111,0x00000000, + 0x00100000,0x01111111,0x00101000,0x00101100, //00B5 オ + 0x00100110,0x00100011,0x00110000,0x00000000, + 0x00000100,0x01111111,0x01000100,0x01000100, //00B6 カ + 0x01000100,0x01100110,0x00110011,0x00000000, + 0x00000100,0x01111111,0x00001000,0x00001000, //00B7 キ + 0x01111111,0x00010000,0x00010000,0x00000000, + 0x01111110,0x01000010,0x01000011,0x01000000, //00B8 ク + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00000010,0x01111110,0x00010010,0x00010001, //00B9 ケ + 0x00010000,0x00011000,0x00001110,0x00000000, + 0x01111111,0x01000000,0x01000000,0x01000000, //00BA コ + 0x01000000,0x01000000,0x01111111,0x00000000, + 0x00100010,0x01111111,0x00100010,0x00100010, //00BB サ + 0x00100000,0x00110000,0x00011110,0x00000000, + 0x00000011,0x01000000,0x01000011,0x01000000, //00BC シ + 0x01000000,0x01100000,0x00111111,0x00000000, + 0x00111111,0x00100000,0x00100000,0x00010000, //00BD ス + 0x00001000,0x00010100,0x01100011,0x00000000, + 0x00000010,0x01111111,0x01000010,0x01100010, //00BE セ + 0x00100010,0x00000110,0x01111100,0x00000000, + 0x01000001,0x01000011,0x01000010,0x01100000, //00BF ソ + 0x00110000,0x00011000,0x00001100,0x00000000, + 0x01111110,0x01000010,0x01000011,0x01111000, //00C0 タ + 0x01000000,0x01100000,0x00111110,0x00000000, + 0x00110000,0x00011110,0x00010000,0x01111111, //00C1 チ + 0x00010000,0x00011000,0x00001110,0x00000000, + 0x01000101,0x01000101,0x01000101,0x01000000, //00C2 ツ + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00111110,0x00000000,0x01111111,0x00001000, //00C3 テ + 0x00001000,0x00001100,0x00000110,0x00000000, + 0x00000010,0x00000010,0x00000010,0x00011110, //00C4 ト + 0x00100010,0x00000010,0x00000010,0x00000000, + 0x00001000,0x00001000,0x01111111,0x00001000, //00C5 ナ + 0x00001000,0x00001100,0x00000111,0x00000000, + 0x00111110,0x00000000,0x00000000,0x00000000, //00C6 ニ + 0x00000000,0x00000000,0x01111111,0x00000000, + 0x00111111,0x00100000,0x00110000,0x00011010, //00C7 ヌ + 0x00001100,0x00010110,0x00100011,0x00000000, + 0x00001000,0x01111111,0x01100000,0x00110000, //00C8 ネ + 0x00011100,0x01101010,0x01001001,0x00000000, + 0x00100000,0x00100000,0x00100000,0x00100000, //00C9 ノ + 0x00110000,0x00011000,0x00001110,0x00000000, + 0x00011000,0x00110000,0x01100001,0x01000001, //00CA ハ + 0x01000001,0x01000001,0x01000001,0x00000000, + 0x00000001,0x00000001,0x00111111,0x00000001, //00CB ヒ + 0x00000001,0x00000011,0x00111110,0x00000000, + 0x01111111,0x01000000,0x01000000,0x01000000, //00CC フ + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00000000,0x00000000,0x00001110,0x00011001, //00CD ヘ + 0x00110001,0x01100000,0x01000000,0x00000000, + 0x00001000,0x01111111,0x00001000,0x00001000, //00CE ホ + 0x01001001,0x01001001,0x01001001,0x00000000, + 0x01111111,0x01000000,0x01000000,0x01100011, //00CF マ + 0x00111110,0x00001100,0x00011000,0x00000000, + 0x00011111,0x01110000,0x00000110,0x00011100, //00D0 ミ + 0x00110000,0x00000111,0x01111100,0x00000000, + 0x00001100,0x00000110,0x00000010,0x01000011, //00D1 ム + 0x01000001,0x01000001,0x01111111,0x00000000, + 0x01000000,0x01100010,0x00110100,0x00011000, //00D2 メ + 0x00001100,0x00010110,0x00100011,0x00000000, + 0x01111111,0x00000100,0x01111111,0x00000100, //00D3 モ + 0x00000100,0x00001100,0x01111000,0x00000000, + 0x00000100,0x01111111,0x01000100,0x01100100, //00D4 ヤ + 0x00110100,0x00000100,0x00000100,0x00000000, + 0x00011110,0x00010000,0x00010000,0x00010000, //00D5 ユ + 0x00010000,0x00010000,0x01111111,0x00000000, + 0x01111110,0x01000000,0x01000000,0x01111110, //00D6 ヨ + 0x01000000,0x01000000,0x01111110,0x00000000, + 0x01111111,0x00000000,0x01111111,0x01000000, //00D7 ラ + 0x01000000,0x01100000,0x00111110,0x00000000, + 0x01000010,0x01000010,0x01000010,0x01000010, //00D8 リ + 0x01000000,0x01100000,0x00111100,0x00000000, + 0x00001010,0x00001010,0x00001010,0x00001010, //00D9 ル + 0x01001010,0x01101010,0x00111011,0x00000000, + 0x00000001,0x00000001,0x01000001,0x01100001, //00DA レ + 0x00110001,0x00011001,0x00001111,0x00000000, + 0x01111111,0x01000001,0x01000001,0x01000001, //00DB ロ + 0x01000001,0x01000001,0x01111111,0x00000000, + 0x01111111,0x01000001,0x01000001,0x01000000, //00DC ワ + 0x01100000,0x00110000,0x00011110,0x00000000, + 0x00000111,0x01000000,0x01000000,0x01000000, //00DD ン + 0x01100000,0x00110000,0x00011111,0x00000000, + 0x00001001,0x00010010,0x00000000,0x00000000, //00DE ゙ + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00001110,0x00001010,0x00001110,0x00000000, //00DF ゚ + 0x00000000,0x00000000,0x00000000,0x00000000, + + 0x00000000,0x00000000,0x00000000,0x11100000, //00E0 メニューの左上 + 0x11110000,0x00111000,0x00011000,0x00011000, + 0x00000000,0x00000000,0x00000000,0x00000111, //00E1 メニューの右上 + 0x00001111,0x00011100,0x00011000,0x00011000, + 0x00011000,0x00011000,0x00111000,0x11110000, //00E2 メニューの左下 + 0x11100000,0x00000000,0x00000000,0x00000000, + 0x00011000,0x00011000,0x00011100,0x00001111, //00E3 メニューの右下 + 0x00000111,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x11111111, //00E4 メニューの縦線 + 0x11111111,0x00000000,0x00000000,0x00000000, + 0x00011000,0x00011000,0x00011000,0x00011000, //00E5 メニューの横線 + 0x00011000,0x00011000,0x00011000,0x00011000, + 0x11111111,0x11111111,0x11111111,0x11111111, //00E6 ■ + 0x11111111,0x11111111,0x11111111,0x11111111, + 0x10101010,0x10101010,0x10101010,0x10101010, //00E7 縦ストライプ + 0x10101010,0x10101010,0x10101010,0x10101010, + 0x11111111,0x00000000,0x11111111,0x00000000, //00E8 横ストライプ + 0x11111111,0x00000000,0x11111111,0x00000000, + 0x00000000,0x11111110,0x11111110,0x11111110, //00E9 LCD検査のΓ + 0x11111110,0x11111110,0x11111110,0x11111110, + 0x11111000,0x11111111,0x11111111,0x11111111, //00EA LCD検査の ̄ + 0x11111111,0x11111111,0x11111111,0x11111111, + 0x11111110,0x11111110,0x11111110,0x11111111, //00EB LCD検査のΙ + 0x11111111,0x11111111,0x11111111,0x11111111, + + 0x00000000,0x00000000,0x00000000,0x00000000, //00EC TPマーカの左上 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000001,0x00000001,0x00000001, //00ED TPマーカの右上 + 0x00000001,0x00000001,0x00000000,0x00000000, + 0x00111111,0x00000000,0x00000000,0x00000000, //00EE TPマーカの左下 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x11111001,0x00000000,0x00000000,0x00000001, //00EF TPマーカの右下 + 0x00000001,0x00000001,0x00000001,0x00000001, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F0 TP精度マーカの左上 + 0x11110000,0x11110000,0x00110000,0x00110000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F1 TP精度マーカの右上 + 0x00011111,0x00011111,0x00011000,0x00011001, + 0x10110000,0x00110000,0x00110000,0x11110000, //00F2 TP精度マーカの左下 + 0x11110000,0x00000000,0x00000000,0x00000000, + 0x00011011,0x00011001,0x00011000,0x00011111, //00F3 TP精度マーカの右下 + 0x00011111,0x00000000,0x00000000,0x00000000, + 0x00000000,0x11111110,0x10000010,0x10000010, //00F4 □ + 0x10000010,0x10000010,0x10000010,0x11111110, + 0x00000000,0x11111110,0x11111110,0x11111110, //00F5 ■ + 0x11111110,0x11111110,0x11111110,0x11111110, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F6 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F7 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F8 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00F9 + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FA + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FB + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FC + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FD + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FE + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, //00FF + 0x00000000,0x00000000,0x00000000,0x00000000, +}; + + diff --git a/build/debugsoft/treenand2sd/src/main.cpp b/build/debugsoft/treenand2sd/src/main.cpp new file mode 100644 index 00000000..6f4ad204 --- /dev/null +++ b/build/debugsoft/treenand2sd/src/main.cpp @@ -0,0 +1,365 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - treenand + File: main.c + + Copyright 2007 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 +#include "text.h" +#include "MyStrings.h" + +inline void* operator new(size_t size) { return OS_Alloc(size); } +inline void* operator new[](size_t size) { return OS_Alloc(size); } +inline void operator delete(void* ptr) { OS_Free(ptr); } +inline void operator delete[](void* ptr) { OS_Free(ptr); } + +namespace +{ + void + InitInterrupt(void) + { + OS_EnableIrq(); + OS_EnableInterrupts(); + } + + void + InitAlloc(void) + { + OSHeapHandle hHeap; + void* lo = OS_GetMainArenaLo(); + void* hi = OS_GetMainArenaHi(); + + lo = OS_InitAlloc(OS_ARENA_MAIN, lo, hi, 1); + OS_SetArenaLo(OS_ARENA_MAIN, lo); + + hHeap = OS_CreateHeap(OS_ARENA_MAIN, lo, hi); + SDK_ASSERT( hHeap >= 0 ); + + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); + } + + void + MyInit(void) + { + OS_Init(); + FX_Init(); + + GX_Init(); + + (void)OS_EnableIrqMask( OS_IE_V_BLANK ); + (void)OS_EnableIrq(); + + FS_Init(MI_DMA_MAX_NUM); + + GX_DispOff(); + GXS_DispOff(); + + (void)GX_VBlankIntr(TRUE); // to generate VBlank interrupt request + //--------------------------------------------------------------------------- + // All VRAM banks to LCDC + //--------------------------------------------------------------------------- + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + + //--------------------------------------------------------------------------- + // Clear all LCDC space + //--------------------------------------------------------------------------- + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //--------------------------------------------------------------------------- + // Disable the banks on LCDC + //--------------------------------------------------------------------------- + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); // clear the standard palette + + MI_CpuFillFast((void*)HW_DB_OAM, 192, HW_DB_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette + + GX_DispOn(); + GXS_DispOn(); + + *(vu16 *) REG_IME_ADDR = 1; // IME セット + + wInitTextVram(); + + //SDの存在チェック + { + FSPathInfo info; + + if(FS_GetPathInfo( "sdmc:/", &info ) ) + { + if( (info.attributes&FS_ATTRIBUTE_IS_PROTECTED)==FS_ATTRIBUTE_IS_PROTECTED ) + { + wSetPalette(COLOR_RED); + wPrintf("\n\n SD CARD IS PROTECTED!!"); + OS_Terminate(); + } + else + { + return; + } + } + else + { + wSetPalette(COLOR_RED); + wPrintf("\n\n SD CARD NOTHING!!"); + OS_Terminate(); + } + } + + } +} + +namespace +{ + class DirEntry; + typedef std::vector EntryList; + class DirEntry + { + private: + FSDirectoryEntryInfo m_dei; + std::string m_path; + EntryList* m_pEntryList; + + public: + DirEntry(std::string parent, const FSDirectoryEntryInfo& dei) + : m_path(parent + "/" + dei.longname) + , m_dei(dei) + , m_pEntryList(NULL) + {} + ~DirEntry(){ delete m_pEntryList; } + bool operator <(const DirEntry& rhs) const + { + return this->m_path < rhs.m_path; + } + + std::string GetPath() const { return m_path; } + std::string GetName() const { return m_dei.longname; } + std::string GetShortName() const { return m_dei.shortname; } + u32 GetSize() const { return m_dei.filesize; } + + bool IsDirectory() const { return (m_dei.attributes & FS_ATTRIBUTE_IS_DIRECTORY) != 0; } + bool IsReadOnly() const { return (m_dei.attributes & FS_ATTRIBUTE_DOS_READONLY) != 0; } + bool IsHidden() const { return (m_dei.attributes & FS_ATTRIBUTE_DOS_HIDDEN) != 0; } + bool IsSystem() const { return (m_dei.attributes & FS_ATTRIBUTE_DOS_SYSTEM) != 0; } + bool IsVolume() const { return (m_dei.attributes & FS_ATTRIBUTE_DOS_VOLUME) != 0; } + bool IsArchive() const { return (m_dei.attributes & FS_ATTRIBUTE_DOS_ARCHIVE) != 0; } + + void SetEntryList(EntryList* pEntryList) + { + delete m_pEntryList; + m_pEntryList = pEntryList; + } + const EntryList& GetEntryList() const + { + return *m_pEntryList; + } + std::string GetDateTimeString() const + { + std::ostringstream oss; + + oss << std::setw(4) << std::setfill('0') << m_dei.mtime.year << "/"; + oss << std::setw(2) << std::setfill('0') << m_dei.mtime.month << "/"; + oss << std::setw(2) << std::setfill('0') << m_dei.mtime.day << " "; + oss << std::setw(2) << std::setfill('0') << m_dei.mtime.hour << ":"; + oss << std::setw(2) << std::setfill('0') << m_dei.mtime.minute << ":"; + oss << std::setw(2) << std::setfill('0') << m_dei.mtime.second; + + return oss.str(); + } + }; + + typedef std::vector EntryList; + + void + GetDirEntry(EntryList* pList, std::string path) + { + BOOL bSuccess; + FSFile dir; + FSDirectoryEntryInfo dei; + + pList->clear(); + + FS_InitFile(&dir); + bSuccess = FS_OpenDirectory(&dir, path.c_str(), FS_FILEMODE_R); + if( bSuccess ) + { + while( FS_ReadDirectory(&dir, &dei) ) + { + std::string name = dei.longname; + + if( (name == ".") || (name == "..") ) + { + continue; + } + + pList->push_back( DirEntry(path, dei) ); + } + + FS_CloseDirectory(&dir); + } + + std::sort(pList->begin(), pList->end()); + } + + void + GetDirEntryRecursive(EntryList* pList, std::string path) + { + EntryList::iterator i; + + GetDirEntry(pList, path); + + for( i = pList->begin(); i != pList->end(); ++i ) + { + if( i->IsDirectory() ) + { + EntryList* pSubEntryList = new EntryList; + GetDirEntryRecursive(pSubEntryList, i->GetPath()); + i->SetEntryList(pSubEntryList); + } + } + } + + void + DrawEntries(std::string prevPart, std::string prevPart2, const EntryList& elist) + { + EntryList::const_iterator i; + + for( i = elist.begin(); i != elist.end(); ++i ) + { + std::ostringstream oss, oss2; + const bool isLast = (i + 1 == elist.end()); + + oss << prevPart; + oss2<< prevPart2; + oss << (isLast ? "└": "├" ); + oss2<< "+"; + oss << " " << i->GetName(); + oss2<< " " << i->GetName(); + if( i->IsDirectory() ) + { + oss << "/"; + oss2<< "/"; + + }else + { + char str[0x100]=""; + char size[20]=""; + int offset,j; + + offset = 60-STD_StrLen(oss.str().c_str()); + for(j=0;jGetSize()); + STD_StrCat(str,size); + + oss << " " << str; + oss2<< " " << size; + } + oss << std::endl; + oss2<< std::endl; + + OS_PutString(oss.str().c_str()); + SDLOG_Printf(oss.str().c_str()); + wPrintf(oss2.str().c_str()); + OS_Sleep(100); + + if( i->IsDirectory() ) + { + DrawEntries(prevPart + (isLast ? " ": "| "), (prevPart2 + " "), i->GetEntryList()); + } + } + } + + void + TreeNand(const char* root) + { + EntryList elist; + GetDirEntryRecursive(&elist, root); + + OS_TPrintf("%s\n", root); + DrawEntries("","", elist); + } +} + + +void +TwlStartUp() +{ + OS_Init(); + InitAlloc(); +} + +// 文字表示 +static void PutString( char *format, ... ) +{ + u16 *dest = (u16*)G2_GetBG1ScrPtr(); + char temp[32+1]; + int i; + va_list va; + + va_start(va, format); + (void)OS_VSNPrintf(temp, sizeof(temp), format, va); + va_end(va); + + for (i = 0; i < 32 && temp[i]; i++) + { + dest[i] = (u16)((u8)temp[i] | (1 << 12)); + } +} + +#define BUFFER_SIZE 0x900 +#define PARTITION_SIZE 0x300 +char logBuffer[ (BUFFER_SIZE + 1) ]; +void +TwlMain(void) +{ + + MyInit(); + + if( !SDLOG_Init("sdmc:/treenand2sd/", logBuffer, BUFFER_SIZE, PARTITION_SIZE, SDLOG_WRITE_TYPE_CONTINUANCE) ) + { + OS_Panic("Error"); + } + + OS_TPrintf("treenand start.\n"); + OS_TPrintf("---------------------------------------------------------------\n"); + wPrintf("\fnand:\n"); + wPrintf("-------------------------------\n"); + TreeNand("nand:"); + + wPrintf("\n\nnand2:\n"); + wPrintf("-------------------------------\n"); + TreeNand("nand2:"); + OS_TPrintf("---------------------------------------------------------------\n"); + OS_TPrintf("treenand completed.\n"); + + SDLOG_Flush(); + SDLOG_Finish(); + OS_Printf("Program is finished!\n"); + + wSetPalette(COLOR_BLUE); + wPrintf("\n !Program is finished!\n"); + + OS_Terminate(); +} + diff --git a/build/debugsoft/treenand2sd/src/text.c b/build/debugsoft/treenand2sd/src/text.c new file mode 100644 index 00000000..0e8ba5b6 --- /dev/null +++ b/build/debugsoft/treenand2sd/src/text.c @@ -0,0 +1,113 @@ +/******************************************************************** + +タイトル: + テキストVRAMエミュレーション + +********************************************************************/ +#include "fontdata.h" +#include "text.h" + +/************************************************************************ + +☆グローバル変数宣言 + + ************************************************************************/ +/* テキストVRAM本体 */ +TEXT_VRAM_TYPE wText; + +/************************************************************************ + +☆プロトタイプ宣言 + + ************************************************************************/ +static void UpdateTextVram( void ); +static void Init( void ); + + + +/************************************************************************ + +☆システム関数群 + + ************************************************************************/ + +/************************************************************************ + + 初期化 + +概要: + キャラ・パレットの転送 + BG0コントロール + + ***********************************************************************/ +static void Init( void ){ + + GX_SetBankForBG(GX_VRAM_BG_128_A); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + G2_SetBG0Priority(0); + G2_BlendNone(); // no 2D alpha blending or brightness change + G2_BG0Mosaic(FALSE); + GX_SetVisibleWnd(GX_WNDMASK_NONE); // ウインドウ無し + G2_SetBG0Offset(0, 0); //オフセット0 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + + //表示リソースの再ロード + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 256 colors mode + GX_BG_SCRBASE_0x0000, // screen base offset + 0x0000 is the address for BG #0 screen + GX_BG_CHARBASE_0x04000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + GX_LoadBG0Char(CharData_Sample, 0, sizeof(CharData_Sample)); + GX_LoadBGPltt(PlttData_Sample, 0, sizeof(PlttData_Sample)); + +} + +/************************************************************************ + + テキストVRAMサービス初期化 + +注意事項: + プログラム開始時に一度だけコールしてください。 + + ***********************************************************************/ +extern void wInitTextVram( void ){ + + static BOOL Initialized = FALSE; + + if( !Initialized ){ + + /* 初期設定をおこなう */ + Init(); + + // Vブランク割り込み設定 + OS_InitIrqTable(); + OS_SetIrqFunction(OS_IE_V_BLANK, UpdateTextVram); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableInterrupts(); + + Initialized = TRUE; + } +} + +/************************************************************************ + + テキストVRAMの更新ルーチン + +注意事項: + 割込みのコールバックルーチンです。 + + 画面を自動的に更新するために定期的に呼び出してください。 + (上記のInitTextVramを使用する場合は不要) + + ***********************************************************************/ +static void UpdateTextVram( void ){ + + MI_CpuCopy16( wText.Map, G2_GetBG0ScrPtr(), sizeof(wText.Map) ); + DC_StoreRange( G2_GetBG0ScrPtr(), sizeof(wText.Map) ); + +} + diff --git a/build/gcdfirm/Makefile b/build/gcdfirm/Makefile new file mode 100644 index 00000000..a763bb3a --- /dev/null +++ b/build/gcdfirm/Makefile @@ -0,0 +1,36 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - firmware +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + gcdfirm-disp \ + gcdfirm-print \ + sdmc-launcher \ + sdmc-launcher-writer \ + memory-launcher-writer \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-disp/ARM7/Makefile b/build/gcdfirm/gcdfirm-disp/ARM7/Makefile new file mode 100644 index 00000000..ac07e3ac --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM7/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - menu-launcher +# File: Makefile +# +# Copyright 2007 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:$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = gcdfirm_disp7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037b8000 + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-disp/ARM7/main.c b/build/gcdfirm/gcdfirm-disp/ARM7/main.c new file mode 100644 index 00000000..e76df595 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM7/main.c @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - firm_writer_gcd + File: main.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +//#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#undef OS_PutChar +#define OS_TPrintf(...) ((void)0) +#define OS_PutChar(...) ((void)0) +#endif // PRINT_DEBUG + +void TwlSpMain( void ) +{ +#ifdef PRINT_DEBUG + reg_SCFG_JTAG = REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK; +#endif // PRINT_DEBUG + + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + + OS_InitFIRM(); + + OS_TPrintf( "\nARM7 starts.\n" ); + + OS_EnableInterrupts(); + OS_EnableIrq(); + + PM_InitFIRM(); +#if SDK_TS_VERSION < 300 + PMi_SetParams( REG_PMIC_BL_BRT_A_ADDR, PMIC_BACKLIGHT_BRIGHT_DEFAULT, PMIC_BL_BRT_A_MASK ); + PMi_SetParams( REG_PMIC_BL_BRT_B_ADDR, PMIC_BACKLIGHT_BRIGHT_DEFAULT, PMIC_BL_BRT_B_MASK ); +#else + MCUi_WriteRegister( MCU_REG_BL_ADDR, MCU_REG_BL_BRIGHTNESS_MASK ); +#endif + PM_BackLightOn( TRUE ); + + // ボタンが押されるまで待つ + OS_TPrintf( "\nPress A button.\n"); + while ( !(PAD_Read() & PAD_BUTTON_A) ) + { + } + + OS_TPrintf( "\nARM7 ends.\n" ); + (void)OS_DisableIrq(); +// OSi_Finalize(); +#ifdef PRINT_DEBUG + reg_SCFG_JTAG = REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK; +#endif // PRINT_DEBUG + while (1) + { + } +// OS_Terminate(); +} + + diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/Makefile b/build/gcdfirm/gcdfirm-disp/ARM9/Makefile new file mode 100644 index 00000000..c357b701 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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:$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = gcdfirm_disp9.srl + +SRCS = main.c \ + screen.c \ + font.c \ + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037c0000 + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/gcdfirm_disp7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/font.c b/build/gcdfirm/gcdfirm-disp/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/include/font.h b/build/gcdfirm/gcdfirm-disp/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/include/screen.h b/build/gcdfirm/gcdfirm-disp/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/main.c b/build/gcdfirm/gcdfirm-disp/ARM9/main.c new file mode 100644 index 00000000..fb48c3d9 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/main.c @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - ts_dev9 + File: main.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "font.h" +#include "screen.h" +//#include + +//#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +static void myInit(void); +static void myVBlankIntr(void); + +void TwlMain( void ) +{ + s16 x = 2, y = 2; + + OS_TPrintf( "\nGCD Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick())); + + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + + myInit(); + + OS_TPrintf( "\nARM9 starts.\n" ); + + //---- clear screen buffer + ClearScreen(); + + PrintString( x, y, FONT_CYAAN, "Gcdfirm-Disp" ); + PrintString( (s16)(x+17), y++, FONT_WHITE, "%s", __DATE__ ); + PrintString( (s16)(x+20), y++, FONT_WHITE, "%s", __TIME__ ); + y++; + + PrintString( x, y++, FONT_YELLOW, "Hello!"); + + OS_TPrintf( "\nARM9 ends.\n" ); + + OS_WaitVBlankIntr(); + + OS_Terminate(); +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/gcdfirm/gcdfirm-disp/ARM9/screen.c b/build/gcdfirm/gcdfirm-disp/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/gcdfirm/gcdfirm-disp/Makefile b/build/gcdfirm/gcdfirm-disp/Makefile new file mode 100644 index 00000000..c8392331 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - gcdfirm-disp +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = gcdfirm_disp-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).gcd +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/gcdfirm_disp9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/gcdfirm_disp7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-disp/gcdfirm.gcdsf b/build/gcdfirm/gcdfirm-disp/gcdfirm.gcdsf new file mode 100644 index 00000000..b5a9fa74 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/gcdfirm.gcdsf @@ -0,0 +1,21 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : 0x0 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN : ./wram_regs/wram_regs.rbin + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +#NORFIRM : $(NORFIRM_BIN) +#NANDFIRM : $(NANDFIRM_BIN) diff --git a/build/gcdfirm/gcdfirm-disp/wram_regs/Makefile b/build/gcdfirm/gcdfirm-disp/wram_regs/Makefile new file mode 100644 index 00000000..1c1afc6d --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-disp/wram_regs/wram_regs.c b/build/gcdfirm/gcdfirm-disp/wram_regs/wram_regs.c new file mode 100644 index 00000000..3fa6c9c2 --- /dev/null +++ b/build/gcdfirm/gcdfirm-disp/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - gcdfirm + File: wram_regs.c + + Copyright 2007 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:: 2008-07-28#$ + $Rev: 2005 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#include +#include + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/gcdfirm/gcdfirm-print/Makefile b/build/gcdfirm/gcdfirm-print/Makefile new file mode 100644 index 00000000..8e865d8a --- /dev/null +++ b/build/gcdfirm/gcdfirm-print/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - gcdfirm-print +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = ../../norfirm/norfirm-print + +TARGET_FIRM_BIN = gcdfirm_print-$(TWL_BUILD_TYPE).gcd +BINDIR = . +MAKEFIRM_ARM9 = ../../norfirm/norfirm-print/ARM9/bin/$(TWL_BUILDTYPE_ARM9)/twl_norfirm9_print.tef +MAKEFIRM_ARM7 = ../../norfirm/norfirm-print/ARM7/bin/$(TWL_BUILDTYPE_ARM7)/twl_norfirm7_print.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += ../../norfirm/norfirm-print/wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/gcdfirm-print/gcdfirm.gcdsf b/build/gcdfirm/gcdfirm-print/gcdfirm.gcdsf new file mode 100644 index 00000000..1a0a93a2 --- /dev/null +++ b/build/gcdfirm/gcdfirm-print/gcdfirm.gcdsf @@ -0,0 +1,22 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ../../norfirm/norfirm-print/wram_regs/wram_regs.rbin + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x07fe00 diff --git a/build/gcdfirm/memory-launcher-writer/ARM7/Makefile b/build/gcdfirm/memory-launcher-writer/ARM7/Makefile new file mode 100644 index 00000000..18fc996d --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - memory-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher_writer7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037b8000 + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LINCLUDES = $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/ARM7/main.c b/build/gcdfirm/memory-launcher-writer/ARM7/main.c new file mode 100644 index 00000000..202cf760 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM7/main.c @@ -0,0 +1,468 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - gcdfirm - sdmc-launcher-writer + File: main.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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +#include +#include + +#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#undef OS_PutChar +#define OS_TPrintf(...) ((void)0) +#define OS_PutChar(...) ((void)0) +#endif // PRINT_DEBUG + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +#ifdef USE_DEBUG_LED +static u8 step = 0x00; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 +#define DMA_CARD 2 + +static u8* const nor = (u8*)HW_TWL_MAIN_MEM; +static u8* const nand = (u8*)HW_TWL_MAIN_MEM + offsetof(NANDHeader,l); + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + // GCDヘッダコピー + MI_CpuCopyFast( OSi_GetFromBromAddr(), (void*)HW_CARD_ROM_HEADER, HW_CARD_ROM_HEADER_SIZE ); + // NANDコンテキストコピー + MI_CpuCopyFast( &OSi_GetFromBromAddr()->SDNandContext, (void*)HW_SD_NAND_CONTEXT_BUF, sizeof(SDPortContextData) ); + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + MCUi_WriteRegister( MCU_REG_BL_ADDR, MCU_REG_BL_BRIGHTNESS_MASK ); + PM_BackLightOn( TRUE ); + // XYボタン通知 + PAD_InitXYButton(); + + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // TWL mode for ES library + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + GCDHeader* const gh = (GCDHeader*)HW_ROM_HEADER_BUF; + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( nor, (gh->l.nandfirm_size + 512) * 2 ); +} + +/* + 独自CARDライブラリ +*/ + +#define CARD_COMMAND_PAGE 0x01000000 +#define CARD_COMMAND_MASK 0x07000000 +#define CARD_RESET_HI 0x20000000 +#define CARD_COMMAND_OP_G_READPAGE 0xB7 + +static u32 cache_page; +static u8 CARDi_cache_buf[CARD_ROM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: CARDi_SetRomOp + + Description: カードコマンド設定 + + Arguments: command コマンド + offset 転送ページ数 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_SetRomOp(u32 command, u32 offset) +{ + u32 cmd1 = (u32)((offset >> 8) | (command << 24)); + u32 cmd2 = (u32)((offset << 24)); + // 念のため前回のROMコマンドの完了待ち。 + while ((reg_MI_MCCNT1 & REG_MI_MCCNT1_START_MASK) != 0) + { + } + // マスターイネーブル。 + reg_MI_MCCNT0 = (u16)(REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK | + (reg_MI_MCCNT0 & ~REG_MI_MCCNT0_SEL_MASK)); + // コマンド設定。 + reg_MI_MCCMD0 = MI_HToBE32(cmd1); + reg_MI_MCCMD1 = MI_HToBE32(cmd2); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_GetRomFlag + + Description: カードコマンドコントロールパラメータを取得 + + Arguments: flag カードデバイスへ発行するコマンドのタイプ + (CARD_COMMAND_PAGE / CARD_COMMAND_ID / + CARD_COMMAND_STAT / CARD_COMMAND_REFRESH) + + Returns: カードコマンドコントロールパラメータ + *---------------------------------------------------------------------------*/ +SDK_INLINE u32 CARDi_GetRomFlag(u32 flag) +{ + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + return (u32)(flag | REG_MI_MCCNT1_START_MASK | CARD_RESET_HI | (rom_ctrl & ~CARD_COMMAND_MASK)); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_StartRomPageTransfer + + Description: ROMページ転送を開始。 + + Arguments: offset 転送元のROMオフセット + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_StartRomPageTransfer(u32 offset) +{ + u8 op = CARD_COMMAND_OP_G_READPAGE; + CARDi_SetRomOp(op, offset); + reg_MI_MCCNT1 = CARDi_GetRomFlag(CARD_COMMAND_PAGE); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_ReadRomWithCPU + + Description: CPUを使用してROM転送。 + キャッシュやページ単位の制限を考慮する必要は無いが + 転送完了まで関数がブロッキングする点に注意。 + + Arguments: userdata (他のコールバックとして使用するためのダミー) + buffer 転送先バッファ + offset 転送元ROMオフセット + length 転送サイズ + + Returns: None. + *---------------------------------------------------------------------------*/ +static int CARDi_ReadRomWithCPU(void *userdata, void *buffer, u32 offset, u32 length) +{ + int retval = (int)length; + // 頻繁に使用するグローバル変数をローカル変数へキャッシュ。 + u32 cachedPage = cache_page; + u8 * const cacheBuffer = CARDi_cache_buf; + while (length > 0) + { + // ROM転送は常にページ単位。 + u8 *ptr = (u8 *)buffer; + u32 n = CARD_ROM_PAGE_SIZE; + u32 pos = MATH_ROUNDDOWN(offset, CARD_ROM_PAGE_SIZE); + // 以前のページと同じならばキャッシュを使用。 + if (pos == cachedPage) + { + ptr = cacheBuffer; + } + else + { + // バッファへ直接転送できないならキャッシュへ転送。 + if(((pos != offset) || (((u32)buffer & 3) != 0) || (length < n))) + { + cachedPage = pos; + ptr = cacheBuffer; + } + // 4バイト整合の保証されたバッファへCPUで直接リード。 + CARDi_StartRomPageTransfer(pos); + { + u32 word = 0; + for (;;) + { + // 1ワード転送完了を待つ。 + u32 ctrl = reg_MI_MCCNT1; + if ((ctrl & REG_MI_MCCNT1_RDY_MASK) != 0) + { + // データを読み出し、必要ならバッファへ格納。 + u32 data = reg_MI_MCD1; + if (word < (CARD_ROM_PAGE_SIZE / sizeof(u32))) + { + ((u32 *)ptr)[word++] = data; + } + } + // 1ページ転送完了なら終了。 + if ((ctrl & REG_MI_MCCNT1_START_MASK) == 0) + { + break; + } + } + } + } + // キャッシュ経由ならキャッシュから転送。 + if (ptr == cacheBuffer) + { + u32 mod = offset - pos; + n = MATH_MIN(length, CARD_ROM_PAGE_SIZE - mod); + MI_CpuCopy8(cacheBuffer + mod, buffer, n); + } + buffer = (u8 *)buffer + n; + offset += n; + length -= n; + } + // ローカル変数からグローバル変数へ反映。 + cache_page = cachedPage; + (void)userdata; + return retval; +} + + +/* + GCD_LoadStatic関連 +*/ +//static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; +static ROM_Header* const rh= (ROM_Header*)HW_TWL_MAIN_MEM; + +#define MODULE_ALIGNMENT 0x20 // 16*2バイト単位で読み込む +//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む +#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) + +/* + start point + main static + sub static + main ltd + sub ltd + end point +*/ +#define ROM_HEADER_RAM_OFFSET 0xe00 + +static void GCD_LoadStatic( u32 offset ) +{ + u8** ram_offset = (u8**)((u32)rh + ROM_HEADER_RAM_OFFSET); + u8* dest = (u8*)rh + HW_TWL_ROM_HEADER_BUF_SIZE; + ram_offset[0] = dest; // start point + if ( rh->s.main_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.main_rom_offset, RoundUpModuleSize(rh->s.main_size) ); + ram_offset[1] = dest; + dest += RoundUpModuleSize(rh->s.main_size); + } + if ( rh->s.sub_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.sub_rom_offset, RoundUpModuleSize(rh->s.sub_size) ); + ram_offset[2] = dest; + dest += RoundUpModuleSize(rh->s.sub_size); + } + if ( rh->s.main_ltd_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.main_ltd_rom_offset, RoundUpModuleSize(rh->s.main_ltd_size) ); + ram_offset[3] = dest; + dest += RoundUpModuleSize(rh->s.main_ltd_size); + } + if ( rh->s.sub_ltd_size > 0 ) + { + CARDi_ReadRomWithCPU( NULL, dest, offset + rh->s.sub_ltd_rom_offset, RoundUpModuleSize(rh->s.sub_ltd_size) ); + ram_offset[4] = dest; + dest += RoundUpModuleSize(rh->s.sub_ltd_size); + } + ram_offset[5] = dest; // end point +} + +static void GCD_LoadHeader( u32 offset ) +{ + CARDi_ReadRomWithCPU( NULL, rh, offset, HW_TWL_ROM_HEADER_BUF_SIZE ); +} + +extern SDMC_ERR_CODE FATFSi_sdmcGoIdle(u16 ports, void (*func1)(),void (*func2)()); + +void TwlSpMain( void ) +{ + GCDHeader* const gh = &OSi_GetFromBromAddr()->header.gcd; + u32 offset = gh->l.nandfirm_offset; + u32 size = gh->l.nandfirm_size; + u32 append_offset = gh->l.append_offset; + u32 nsize = size - offsetof(NANDHeader,l); // size to write to nand + u32 sectors = (nsize + 511)/512; + u8* nor2 = nor + size; // buffer to verify + u8* nand2 = nand + size; // buffer to verify + + SdmcResultInfo sdResult; + + InitDebugLED(); + SetDebugLED(++step); // 0x01 + + PreInit(); + SetDebugLED(++step); // 0x02 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + SetDebugLED(++step); // 0x03 + + PostInit(); + SetDebugLED(++step); // 0x04 + + // NAND初期化 + if (SDMC_NORMAL != FATFSi_sdmcInit( (SDMC_DMA_NO)DMA_FATFS_1, (SDMC_DMA_NO)DMA_FATFS_2 )) + { + OS_TPrintf("Failed to call FATFSi_sdmcInit().\n"); + goto err; + } + FATFSi_sdmcGoIdle( 2, NULL, NULL ); + SetDebugLED(++step); // 0x05 + + // CARD初期化 + SetDebugLED(++step); // 0x06 + + PXI_SendStream(&size, sizeof(size)); + + if ( size < sizeof(NANDHeader) ) + { + OS_TPrintf("No NAND firm is there.\n"); + goto err; + } + SetDebugLED(++step); // 0x07 + + // read all + *(u32*)nor = 0; + CARDi_ReadRomWithCPU( NULL, nor, offset, size ); + SetDebugLED(++step); // 0x08 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // write NOR + NVRAMi_Write( 0, nor, sizeof(NORHeaderDS)); + SetDebugLED(++step); // 0x09 + + { // write boot_nandfirm flag + s32 tmp = -1; + NVRAMi_Write( 0x2ff, &tmp, 1 ); + } + SetDebugLED(++step); // 0x0a + + // write NAND + if (SDMC_NORMAL != FATFSi_sdmcWriteFifo( nand, sectors, 1, SDMC_PORT_NAND, &sdResult )) + { + OS_TPrintf("Failed to call FATFSi_sdmcWriteFifo() to write header.\n"); + goto err; + } + + SetDebugLED(++step); // 0x0b + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // verify NOR + NVRAMi_Read( 0, nor2, sizeof(NORHeaderDS) ); + if ( MI_CpuComp8( nor, nor2, sizeof(NORHeaderDS) ) ) + { + OS_TPrintf("Failed to verify firm data in NOR.\n"); + goto err; + } + SetDebugLED(++step); // 0x0c + + // verify NAND + if ( FATFSi_sdmcReadFifo( nand2, sectors, 1, SDMC_PORT_NAND, &sdResult ) ) + { + OS_TPrintf("Failed to call FATFSi_sdmcReadFifo() to write header.\n"); + goto err; + } + SetDebugLED(++step); // 0x0d + if ( MI_CpuComp8( nand, nand2, nsize ) ) + { + OS_TPrintf("Failed to verify firm data in NAND.\n"); + goto err; + } + SetDebugLED(++step); // 0x0e + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + /* + 追加SRL読み込み + */ + + /* + GCD_LoadHeader + */ + GCD_LoadHeader( append_offset ); + + SetDebugLED(++step); // 0x0f + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // 9: after AESi_InitSeed + SetDebugLED(++step); // 0x10 + + /* + GCD_LoadStatic + */ + GCD_LoadStatic( append_offset ); + + SetDebugLED(0); // 0x00 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + + OS_TPrintf("Success all.\n"); + MCUi_WriteRegister( MCU_REG_COMMAND_ADDR, MCU_REG_COMMAND_RESET_MASK ); + OS_Terminate(); + +err: + SetDebugLED((u8)(step|0xF0)); + EraseAll(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/Makefile b/build/gcdfirm/memory-launcher-writer/ARM9/Makefile new file mode 100644 index 00000000..43683c97 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher_writer9.srl + +SRCS = main.c \ + screen.c \ + font.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037c0000 + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher_writer7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/font.c b/build/gcdfirm/memory-launcher-writer/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h b/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h b/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/main.c b/build/gcdfirm/memory-launcher-writer/ARM9/main.c new file mode 100644 index 00000000..37ef06e4 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/main.c @@ -0,0 +1,246 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - ts_dev9 + File: main.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "font.h" +#include "screen.h" + +//#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +static void myInit(void); +static void myVBlankIntr(void); + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void*)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void*)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void*)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); + MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ +} + +void TwlMain( void ) +{ + u32 len; +#define X_OFF 2 + s16 y = 2; + + PreInit(); + myInit(); + PostInit(); + + //---- clear screen buffer + ClearScreen(); + + PrintString( X_OFF, y, FONT_CYAAN, "NAND Firm Writer" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PXI_RecvStream(&len, sizeof(len)); + PrintString( X_OFF, y++, FONT_WHITE, "Firm length: %d bytes", len ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Load NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Write NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Verify NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Load SRL Header..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + PrintString( X_OFF, y++, FONT_WHITE, "Load SRL Static Data..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + PrintString( X_OFF, 20, FONT_GREEN, "SUCCESS ALL!" ); + do + { + OS_WaitVBlankIntr(); + } + while ( PAD_DetectFold() && (PAD_Read() & PAD_ALL_MASK) == (PAD_BUTTON_START|PAD_BUTTON_SELECT|PAD_BUTTON_X)); + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + OS_Terminate(); + +err: + PrintString( X_OFF+20, y++, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/gcdfirm/memory-launcher-writer/ARM9/screen.c b/build/gcdfirm/memory-launcher-writer/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/gcdfirm/memory-launcher-writer/Makefile b/build/gcdfirm/memory-launcher-writer/Makefile new file mode 100644 index 00000000..7786d8de --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/Makefile @@ -0,0 +1,65 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - memory-launcher-writer +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) + +TARGET_FIRM_BIN = memory_launcher_writer-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).gcd + +NANDFIRM_BIN = ../../nandfirm/memory-launcher/memory_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand + +APPEND_SRL = $(TWLSDK_ROOT)/bin/ARM9-TS/Release/nand2sd.srl +#APPEND_SRL = ../../systemMenu_tools/NandInitializerRed/ARM9.TWL/bin/ARM9-TS.LTD.thumb/Release/NandInitializerRed.srl + +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/memory_launcher_writer9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher_writer7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +MAKEFIRM_DEFS += -DNANDFIRM_BIN=$(NANDFIRM_BIN) -DAPPEND_SRL=$(APPEND_SRL) + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +LDEPENDS_BIN += $(NANDFIRM_BIN) + +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +$(NANDFIRM_BIN): + $(REMAKE) -C $(dir $(NANDFIRM_BIN)) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf b/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf new file mode 100644 index 00000000..80d6aac8 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/gcdfirm.gcdsf @@ -0,0 +1,23 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : 0x0 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN : ./wram_regs/wram_regs.rbin + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +#NORFIRM : $(NORFIRM_BIN) +NANDFIRM : $(NANDFIRM_BIN) + +APPEND : $(APPEND_SRL) diff --git a/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile b/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile new file mode 100644 index 00000000..1c1afc6d --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c b/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c new file mode 100644 index 00000000..aaa4dc33 --- /dev/null +++ b/build/gcdfirm/memory-launcher-writer/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - gcdfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM7/Makefile b/build/gcdfirm/sdmc-launcher-writer/ARM7/Makefile new file mode 100644 index 00000000..4a2ee6a5 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher_writer7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037b8000 + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LINCLUDES = $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM7/main.c b/build/gcdfirm/sdmc-launcher-writer/ARM7/main.c new file mode 100644 index 00000000..18bb228b --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM7/main.c @@ -0,0 +1,385 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - gcdfirm - sdmc-launcher-writer + File: main.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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +#include +#include + +#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#undef OS_PutChar +#define OS_TPrintf(...) ((void)0) +#define OS_PutChar(...) ((void)0) +#endif // PRINT_DEBUG + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +#ifdef USE_DEBUG_LED +static u8 step = 0x00; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#define THREAD_PRIO_FATFS 8 + +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 +#define DMA_CARD 2 + +static u8* const nor = (u8*)HW_TWL_MAIN_MEM; +static u8* const nand = (u8*)HW_TWL_MAIN_MEM + offsetof(NANDHeader,l); + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + // GCDヘッダコピー + MI_CpuCopyFast( OSi_GetFromBromAddr(), (void*)HW_CARD_ROM_HEADER, HW_CARD_ROM_HEADER_SIZE ); + // NANDコンテキストコピー + MI_CpuCopyFast( &OSi_GetFromBromAddr()->SDNandContext, (void*)HW_SD_NAND_CONTEXT_BUF, sizeof(SDPortContextData) ); + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + MCUi_WriteRegister( MCU_REG_BL_ADDR, MCU_REG_BL_BRIGHTNESS_MASK ); + PM_BackLightOn( TRUE ); + // XYボタン通知 + PAD_InitXYButton(); + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // TWL mode for ES library + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + GCDHeader* const gh = (GCDHeader*)HW_ROM_HEADER_BUF; + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( nor, (gh->l.nandfirm_size + 512) * 2 ); +} + +/* + 独自CARDライブラリ +*/ + +#define CARD_COMMAND_PAGE 0x01000000 +#define CARD_COMMAND_MASK 0x07000000 +#define CARD_RESET_HI 0x20000000 +#define CARD_COMMAND_OP_G_READPAGE 0xB7 + +static u32 cache_page; +static u8 CARDi_cache_buf[CARD_ROM_PAGE_SIZE] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: CARDi_SetRomOp + + Description: カードコマンド設定 + + Arguments: command コマンド + offset 転送ページ数 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_SetRomOp(u32 command, u32 offset) +{ + u32 cmd1 = (u32)((offset >> 8) | (command << 24)); + u32 cmd2 = (u32)((offset << 24)); + // 念のため前回のROMコマンドの完了待ち。 + while ((reg_MI_MCCNT1 & REG_MI_MCCNT1_START_MASK) != 0) + { + } + // マスターイネーブル。 + reg_MI_MCCNT0 = (u16)(REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK | + (reg_MI_MCCNT0 & ~REG_MI_MCCNT0_SEL_MASK)); + // コマンド設定。 + reg_MI_MCCMD0 = MI_HToBE32(cmd1); + reg_MI_MCCMD1 = MI_HToBE32(cmd2); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_GetRomFlag + + Description: カードコマンドコントロールパラメータを取得 + + Arguments: flag カードデバイスへ発行するコマンドのタイプ + (CARD_COMMAND_PAGE / CARD_COMMAND_ID / + CARD_COMMAND_STAT / CARD_COMMAND_REFRESH) + + Returns: カードコマンドコントロールパラメータ + *---------------------------------------------------------------------------*/ +SDK_INLINE u32 CARDi_GetRomFlag(u32 flag) +{ + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + return (u32)(flag | REG_MI_MCCNT1_START_MASK | CARD_RESET_HI | (rom_ctrl & ~CARD_COMMAND_MASK)); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_StartRomPageTransfer + + Description: ROMページ転送を開始。 + + Arguments: offset 転送元のROMオフセット + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_StartRomPageTransfer(u32 offset) +{ + u8 op = CARD_COMMAND_OP_G_READPAGE; + CARDi_SetRomOp(op, offset); + reg_MI_MCCNT1 = CARDi_GetRomFlag(CARD_COMMAND_PAGE); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_ReadRomWithCPU + + Description: CPUを使用してROM転送。 + キャッシュやページ単位の制限を考慮する必要は無いが + 転送完了まで関数がブロッキングする点に注意。 + + Arguments: userdata (他のコールバックとして使用するためのダミー) + buffer 転送先バッファ + offset 転送元ROMオフセット + length 転送サイズ + + Returns: None. + *---------------------------------------------------------------------------*/ +static int CARDi_ReadRomWithCPU(void *userdata, void *buffer, u32 offset, u32 length) +{ + int retval = (int)length; + // 頻繁に使用するグローバル変数をローカル変数へキャッシュ。 + u32 cachedPage = cache_page; + u8 * const cacheBuffer = CARDi_cache_buf; + while (length > 0) + { + // ROM転送は常にページ単位。 + u8 *ptr = (u8 *)buffer; + u32 n = CARD_ROM_PAGE_SIZE; + u32 pos = MATH_ROUNDDOWN(offset, CARD_ROM_PAGE_SIZE); + // 以前のページと同じならばキャッシュを使用。 + if (pos == cachedPage) + { + ptr = cacheBuffer; + } + else + { + // バッファへ直接転送できないならキャッシュへ転送。 + if(((pos != offset) || (((u32)buffer & 3) != 0) || (length < n))) + { + cachedPage = pos; + ptr = cacheBuffer; + } + // 4バイト整合の保証されたバッファへCPUで直接リード。 + CARDi_StartRomPageTransfer(pos); + { + u32 word = 0; + for (;;) + { + // 1ワード転送完了を待つ。 + u32 ctrl = reg_MI_MCCNT1; + if ((ctrl & REG_MI_MCCNT1_RDY_MASK) != 0) + { + // データを読み出し、必要ならバッファへ格納。 + u32 data = reg_MI_MCD1; + if (word < (CARD_ROM_PAGE_SIZE / sizeof(u32))) + { + ((u32 *)ptr)[word++] = data; + } + } + // 1ページ転送完了なら終了。 + if ((ctrl & REG_MI_MCCNT1_START_MASK) == 0) + { + break; + } + } + } + } + // キャッシュ経由ならキャッシュから転送。 + if (ptr == cacheBuffer) + { + u32 mod = offset - pos; + n = MATH_MIN(length, CARD_ROM_PAGE_SIZE - mod); + MI_CpuCopy8(cacheBuffer + mod, buffer, n); + } + buffer = (u8 *)buffer + n; + offset += n; + length -= n; + } + // ローカル変数からグローバル変数へ反映。 + cache_page = cachedPage; + (void)userdata; + return retval; +} + + +extern SDMC_ERR_CODE FATFSi_sdmcGoIdle(u16 ports, void (*func1)(),void (*func2)()); + +void TwlSpMain( void ) +{ + GCDHeader* const gh = &OSi_GetFromBromAddr()->header.gcd; + u32 offset = gh->l.nandfirm_offset; + u32 size = gh->l.nandfirm_size; + u32 nsize = size - offsetof(NANDHeader,l); // size to write to nand + u32 sectors = (nsize + 511)/512; + u8* nor2 = nor + size; // buffer to verify + u8* nand2 = nand + size; // buffer to verify + + SdmcResultInfo sdResult; + + InitDebugLED(); + SetDebugLED(++step); // 0x01 + + PreInit(); + SetDebugLED(++step); // 0x02 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + SetDebugLED(++step); // 0x03 + + PostInit(); + SetDebugLED(++step); // 0x04 + + // NAND初期化 + if (SDMC_NORMAL != FATFSi_sdmcInit( (SDMC_DMA_NO)DMA_FATFS_1, (SDMC_DMA_NO)DMA_FATFS_2 )) + { + OS_TPrintf("Failed to call FATFSi_sdmcInit().\n"); + goto err; + } + FATFSi_sdmcGoIdle( 2, NULL, NULL ); + SetDebugLED(++step); // 0x05 + + // CARD初期化 + SetDebugLED(++step); // 0x06 + + PXI_SendStream(&size, sizeof(size)); + + if ( size < sizeof(NANDHeader) ) + { + OS_TPrintf("No NAND firm is there.\n"); + goto err; + } + SetDebugLED(++step); // 0x07 + + // read all + *(u32*)nor = 0; + CARDi_ReadRomWithCPU( NULL, nor, offset, size ); + SetDebugLED(++step); // 0x08 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // write NOR + NVRAMi_Write( 0, nor, sizeof(NORHeaderDS)); + SetDebugLED(++step); // 0x09 + + { // write boot_nandfirm flag + s32 tmp = -1; + NVRAMi_Write( 0x2ff, &tmp, 1 ); + } + SetDebugLED(++step); // 0x0a + + // write NAND + if (SDMC_NORMAL != FATFSi_sdmcWriteFifo( nand, sectors, 1, SDMC_PORT_NAND, &sdResult )) + { + OS_TPrintf("Failed to call FATFSi_sdmcWriteFifo() to write header.\n"); + goto err; + } + + SetDebugLED(++step); // 0x0b + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + // verify NOR + NVRAMi_Read( 0, nor2, sizeof(NORHeaderDS) ); + if ( MI_CpuComp8( nor, nor2, sizeof(NORHeaderDS) ) ) + { + OS_TPrintf("Failed to verify firm data in NOR.\n"); + goto err; + } + SetDebugLED(++step); // 0x0c + + // verify NAND + if ( FATFSi_sdmcReadFifo( nand2, sectors, 1, SDMC_PORT_NAND, &sdResult ) ) + { + OS_TPrintf("Failed to call FATFSi_sdmcReadFifo() to write header.\n"); + goto err; + } + SetDebugLED(++step); // 0x0d + if ( MI_CpuComp8( nand, nand2, nsize ) ) + { + OS_TPrintf("Failed to verify firm data in NAND.\n"); + goto err; + } + SetDebugLED(0); // 0x00 + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + + OS_TPrintf("Success all.\n"); + MCUi_WriteRegister( MCU_REG_COMMAND_ADDR, MCU_REG_COMMAND_RESET_MASK ); + OS_Terminate(); + +err: + SetDebugLED((u8)(step|0xF0)); + EraseAll(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/Makefile b/build/gcdfirm/sdmc-launcher-writer/ARM9/Makefile new file mode 100644 index 00000000..f433ab79 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher_writer9.srl + +SRCS = main.c \ + screen.c \ + font.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037c0000 + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher_writer7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/font.c b/build/gcdfirm/sdmc-launcher-writer/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/include/font.h b/build/gcdfirm/sdmc-launcher-writer/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/include/screen.h b/build/gcdfirm/sdmc-launcher-writer/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/main.c b/build/gcdfirm/sdmc-launcher-writer/ARM9/main.c new file mode 100644 index 00000000..a8247ebd --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/main.c @@ -0,0 +1,229 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - ts_dev9 + File: main.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "font.h" +#include "screen.h" + +//#define PRINT_DEBUG + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +static void myInit(void); +static void myVBlankIntr(void); + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void*)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void*)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void*)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); + MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + // FromBrom全消去 + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ +} + +void TwlMain( void ) +{ + u32 len; +#define X_OFF 2 + s16 y = 2; + + PreInit(); + myInit(); + PostInit(); + + //---- clear screen buffer + ClearScreen(); + + PrintString( X_OFF, y, FONT_CYAAN, "NAND Firm Writer" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PXI_RecvStream(&len, sizeof(len)); + PrintString( X_OFF, y++, FONT_WHITE, "Firm length: %d bytes", len ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Load NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Write NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + PrintString( X_OFF, y++, FONT_WHITE, "Verify NAND Firm..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + goto err; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + PrintString( X_OFF, 20, FONT_GREEN, "SUCCESS ALL!" ); + do + { + OS_WaitVBlankIntr(); + } + while ( PAD_DetectFold() && (PAD_Read() & PAD_ALL_MASK) == (PAD_BUTTON_START|PAD_BUTTON_SELECT|PAD_BUTTON_X)); + + PXI_NotifyID( FIRM_PXI_ID_NULL ); + OS_Terminate(); + +err: + PrintString( X_OFF+20, y++, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/gcdfirm/sdmc-launcher-writer/ARM9/screen.c b/build/gcdfirm/sdmc-launcher-writer/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/gcdfirm/sdmc-launcher-writer/Makefile b/build/gcdfirm/sdmc-launcher-writer/Makefile new file mode 100644 index 00000000..fbe89e23 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/Makefile @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - sdmc-launcher-writer +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) + +TARGET_FIRM_BIN = sdmc_launcher_writer-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).gcd + +NANDFIRM_BIN = ../../nandfirm/sdmc-launcher/sdmc_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand + +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/sdmc_launcher_writer9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher_writer7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +MAKEFIRM_DEFS += -DNANDFIRM_BIN=$(NANDFIRM_BIN) + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +LDEPENDS_BIN += $(NANDFIRM_BIN) + +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +$(NANDFIRM_BIN): + $(REMAKE) -C $(dir $(NANDFIRM_BIN)) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher-writer/gcdfirm.gcdsf b/build/gcdfirm/sdmc-launcher-writer/gcdfirm.gcdsf new file mode 100644 index 00000000..462d43fd --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/gcdfirm.gcdsf @@ -0,0 +1,21 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : 0x0 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN : ./wram_regs/wram_regs.rbin + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +#NORFIRM : $(NORFIRM_BIN) +NANDFIRM : $(NANDFIRM_BIN) diff --git a/build/gcdfirm/sdmc-launcher-writer/wram_regs/Makefile b/build/gcdfirm/sdmc-launcher-writer/wram_regs/Makefile new file mode 100644 index 00000000..1c1afc6d --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher-writer/wram_regs/wram_regs.c b/build/gcdfirm/sdmc-launcher-writer/wram_regs/wram_regs.c new file mode 100644 index 00000000..aaa4dc33 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher-writer/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - gcdfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/gcdfirm/sdmc-launcher/ARM7/Makefile b/build/gcdfirm/sdmc-launcher/ARM7/Makefile new file mode 100644 index 00000000..eadfd05b --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM7/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher/ARM7/main.c b/build/gcdfirm/sdmc-launcher/ARM7/main.c new file mode 100644 index 00000000..f15e5828 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM7/main.c @@ -0,0 +1,307 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - gcdfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +#define PROFILE_ENABLE + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC800 + + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +#ifdef USE_DEBUG_LED +static u8 step = 0x80; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +static BOOL SetDebugLED(u8 pattern) +{ + I2Ci_Wait(); + reg_OS_I2C_DAT = I2C_ADDR_DEBUG_LED; + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | // 割り込み禁止は IE にて行うことで仕様統一 + (I2C_WRITE << REG_OS_I2C_CNT_RW_SHIFT) | + (0 << REG_OS_I2C_CNT_ACK_SHIFT) | + (1 << REG_OS_I2C_CNT_START_SHIFT)); + I2Ci_Wait(); + reg_OS_I2C_DAT = 0x01; + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (I2C_WRITE << REG_OS_I2C_CNT_RW_SHIFT) | + (I2C_WRITE << REG_OS_I2C_CNT_ACK_SHIFT)); + I2Ci_Wait(); + reg_OS_I2C_DAT = pattern; + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (I2C_WRITE << REG_OS_I2C_CNT_RW_SHIFT) | + (0 << REG_OS_I2C_CNT_ACK_SHIFT) | + (1 << REG_OS_I2C_CNT_STOP_SHIFT)); + I2Ci_Wait(); +#ifdef PRINT_MEMORY_ADDR + OS_TPrintf("%02X.%02X.%02X.\n", I2C_ADDR_DEBUG_LED, 0x01, pattern); +#endif + return (BOOL)((reg_OS_I2C_CNT & REG_OS_I2C_CNT_ACK_MASK) >> REG_OS_I2C_CNT_ACK_SHIFT); +} +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + /* + リセットパラメータ(1バイト)を共有領域(1バイト)にコピー + */ +#define HOTSTART_FLAG_ENABLE 0x80 + *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + PM_BackLightOn( TRUE ); // ARM9側画面表示のため + + // マウント情報の初期化 + FS_InitMountInfo(FALSE, TRUE); + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_FIRMWARE ); // change battery level only + PUSH_PROFILE(); + SetDebugLED(++step); // 0x84 + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + OS_BootFromFIRM(); +#endif +} + +void TwlSpMain( void ) +{ + int fd; // menu file descriptor + +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + InitDebugLED(); + SetDebugLED(++step); // 0x81 + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: after PreInit + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + SetDebugLED(++step); // 0x82 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + // 2: after OS_InitFIRM + PUSH_PROFILE(); + SetDebugLED(++step); // 0x83 + + PostInit(); + // 3: after PostInit + PUSH_PROFILE(); + SetDebugLED(++step); // 0x85 + + if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) ) + { + OS_TPrintf("Failed to call FATFS_Init().\n"); + goto end; + } + // 4: after FATFS_Init + PUSH_PROFILE(); + SetDebugLED(++step); // 0x86 + + if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); + goto end; + } + // 5: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x87 + + if ( (fd = FS_OpenSrl()) < 0 ) + { + OS_TPrintf("Failed to call FS_OpenSrl().\n"); + goto end; + } + // 6: after FS_OpenSrl + PUSH_PROFILE(); + SetDebugLED(++step); // 0x88 + + if ( !FS_LoadHeader( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadHeader().\n"); + goto end; + } + // 7: after FS_LoadHeader + PUSH_PROFILE(); + SetDebugLED(++step); // 0x89 + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); + goto end; + } + // 8: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8a + + AESi_InitKeysFIRM(); + AESi_InitSeed(); + // 9: after AESi_InitSeed + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8b + + if ( !FS_LoadStatic( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + // 10: after FS_LoadStatic + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8c + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); + goto end; + } + // 11: after PXI + PUSH_PROFILE(); + +#ifdef PROFILE_ENABLE + { + int i; + PXI_RecvID(); + OS_TPrintf("\n[ARM7] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM7] End\n"); + } +#endif + SetDebugLED( 0 ); + + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + FS_SetMountInfoForSrl(); + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // change TWL mode + OS_BootFromFIRM(); + +end: + SetDebugLED( (u8)(0xF0 | step)); + + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/gcdfirm/sdmc-launcher/ARM9/Makefile b/build/gcdfirm/sdmc-launcher/ARM9/Makefile new file mode 100644 index 00000000..ebf8e3c3 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher9.srl + +SRCS = main.c font.c screen.c + +CRT0_O = crt0_firm.o + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +LINCLUDES = ./include + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher/ARM9/font.c b/build/gcdfirm/sdmc-launcher/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher/ARM9/include/font.h b/build/gcdfirm/sdmc-launcher/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher/ARM9/include/screen.h b/build/gcdfirm/sdmc-launcher/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/gcdfirm/sdmc-launcher/ARM9/main.c b/build/gcdfirm/sdmc-launcher/ARM9/main.c new file mode 100644 index 00000000..e9f18b2c --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/main.c @@ -0,0 +1,519 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - gcdfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 "font.h" +#include "screen.h" + +#ifdef FIRM_USE_PRODUCT_KEYS +static const u8* rsa_key_user = NULL; // not acceptable +static const u8* rsa_key_sys = NULL; // not acceptable +static const u8 rsa_key_secure[128] = +{ + 0xC7, 0x94, 0x50, 0x00, 0x3A, 0xE1, 0x0E, 0x6C, 0xA8, 0xD1, 0xC0, 0x2D, 0x77, 0xB7, 0x6D, 0xBC, + 0x31, 0xDB, 0x12, 0x08, 0x09, 0x0D, 0x2A, 0xE8, 0xC9, 0x1A, 0x2B, 0x6E, 0x6C, 0x85, 0x78, 0xD7, + 0x46, 0x50, 0x05, 0xB5, 0xCC, 0x3B, 0xEC, 0xBA, 0xF4, 0xDE, 0xC2, 0x13, 0x13, 0xBE, 0x67, 0xEE, + 0x85, 0x19, 0xEB, 0x62, 0xB3, 0x5C, 0x09, 0xA8, 0x54, 0x44, 0x26, 0x85, 0x25, 0xEA, 0xE5, 0x85, + 0xD1, 0xB5, 0xCE, 0xA0, 0xFF, 0x6B, 0x61, 0xCA, 0x94, 0xC1, 0x67, 0xBE, 0xC0, 0x7E, 0x3B, 0xFF, + 0x12, 0x9B, 0x79, 0xDB, 0xAC, 0xD3, 0x5A, 0x3F, 0x14, 0x37, 0x49, 0xA8, 0x7C, 0x2F, 0x07, 0xF4, + 0x8B, 0xA9, 0x8B, 0x8D, 0xB2, 0x60, 0xA5, 0xD5, 0x64, 0xEE, 0xCF, 0x3F, 0x32, 0xEE, 0x77, 0xAC, + 0x27, 0x75, 0x2B, 0x04, 0xD7, 0x26, 0xA8, 0x8A, 0x55, 0x2A, 0x76, 0xE5, 0x68, 0x80, 0x57, 0x85 +}; +#else +#if 0 +static const u8 rsa_key_user[128] = +{ + 0xAC, 0x93, 0xBB, + 0x3C, 0x15, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, + 0xD5, 0x79, 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, + 0xCB, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, + 0xF0, 0x11, 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, + 0x7F, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, + 0x96, 0x4F, 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, + 0x62, 0x39, 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, + 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11 +}; +#else +static const u8* rsa_key_user = NULL; // not acceptable +#endif +static const u8 rsa_key_sys[128] = +{ + 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, + 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, + 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, + 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, + 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, + 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, + 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, + 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, +}; +static const u8 rsa_key_secure[128] = +{ + 0xa7, 0x9f, 0x54, 0xa0, 0xc7, 0x45, 0xae, 0xf6, 0x63, 0xa7, 0x53, 0xb7, 0x0a, 0xcc, 0x0b, 0xcb, + 0x65, 0xe1, 0x11, 0xc6, 0x05, 0x15, 0xb5, 0x6e, 0xbd, 0xac, 0x0c, 0xca, 0xf4, 0x7c, 0x68, 0x7a, + 0xf9, 0x0e, 0x5d, 0x98, 0x5b, 0xc8, 0x4d, 0x22, 0x3b, 0xa3, 0xbe, 0x8b, 0x5b, 0x7f, 0x26, 0x44, + 0x9f, 0xc4, 0x48, 0x44, 0xb1, 0x32, 0xb7, 0xbe, 0x63, 0xba, 0xd6, 0xc1, 0x10, 0xce, 0xf6, 0xed, + 0x47, 0x8f, 0xe1, 0xff, 0x7f, 0x5a, 0xd5, 0x5d, 0x94, 0x38, 0x2f, 0xa1, 0xd4, 0xef, 0x82, 0xb1, + 0x0d, 0xc4, 0x43, 0xec, 0xbe, 0x77, 0xb6, 0x82, 0x9c, 0xfa, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, + 0xfb, 0xd6, 0x05, 0xc8, 0x9a, 0x7e, 0xad, 0x44, 0x40, 0x0d, 0x35, 0x9c, 0x45, 0x44, 0x64, 0x36, + 0x61, 0x4b, 0xf7, 0xe6, 0x31, 0x5c, 0x7d, 0x96, 0x73, 0xe8, 0xac, 0xb4, 0xe3, 0x5e, 0xd1, 0x9d, +}; +#endif + +static SVCSignHeapContext acPool; + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +#define PROFILE_ENABLE + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC000 + +//#ifdef SDK_FINALROM // FINALROMで無効化 +//#undef PROFILE_ENABLE +//#endif + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void*)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void*)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void*)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); + MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // アリーナ設定 + { + static u32 arena[ 0x400 / sizeof(u32) ]; + OS_SetMainArenaLo( arena ); + OS_SetMainArenaHi( &arena[ 0x400 / sizeof(u32) ] ); + } + // RSA用ヒープ設定 + SVC_InitSignHeap( &acPool, (void*)HW_FIRM_RSA_BUF, HW_FIRM_RSA_BUF_SIZE ); + // FS/FATFS初期化 + FS_InitFIRM(); +} + +/*************************************************************** + TryResolveSrl + + ランチャーSRLを解決する + 1) sdmc:/menu.srl があればそれを選択 + 2) 最初に見つかった sdmc:/***.srl を選択 + 3) 失敗 +***************************************************************/ +#define MENU_FILE "sdmc:/menu.srl" +#define MENU_DIR "sdmc:/" +static BOOL TryResolveSrl(void) +{ + FSPathInfo info; + FSFile dir; + FSDirectoryEntryInfo entry; + + MI_CpuClearFast( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + + // 1) sdmc:/menu.srl があればそれを選択 + if ( FS_GetPathInfo( MENU_FILE, &info ) && (info.attributes & FS_ATTRIBUTE_IS_DIRECTORY) == 0 ) + { + STD_CopyString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, MENU_FILE ); + return TRUE; + } + + // 2) 最初に見つかった sdmc:/***.srl を選択 + FS_InitFile( &dir ); + if ( FS_OpenDirectory( &dir, MENU_DIR, 0 ) ) + { + while ( FS_ReadDirectory( &dir, &entry ) ) + { + u32 len = entry.longname_length; + if ( (entry.attributes & FS_ATTRIBUTE_IS_DIRECTORY) == 0 + && len < HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE - STD_GetStringLength( MENU_DIR ) + && len > 4 + // postfix + && entry.longname[len-4] == '.' + && (entry.longname[len-3] == 's' || entry.longname[len-3] == 'S') + && (entry.longname[len-2] == 'r' || entry.longname[len-2] == 'R') + && (entry.longname[len-1] == 'l' || entry.longname[len-1] == 'L')) + { + int offset; + FS_CloseDirectory( &dir ); + offset = STD_CopyLString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, MENU_DIR, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + offset += STD_CopyLString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF + offset, entry.longname, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE - offset ); + return TRUE; + } + } + FS_CloseDirectory( &dir ); + } + + // 3) 失敗 + return FALSE; +} + +/*************************************************************** + CheckHeader + + ヘッダがシステムメニューとして問題ないかチェック +***************************************************************/ +static BOOL CheckHeader(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + // イニシャルコードなど + OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); + OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); + OS_TPrintf("Codec Mode : %s\n", rhs->exFlags.codec_mode ? "TWL" : "NITRO"); + OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); + OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); + if ( rhs->enable_aes ) + { + OS_TPrintf("AES Key Type : %s\n", rhs->developer_encrypt_old || rhs->exFlags.developer_encrypt ? "FOR DEVELOPMENT" : "FOR PRODUCT"); + } + // エントリポイント + OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); + OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); + // ロード範囲 + OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); + OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); + OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); + OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); + OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); + OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); + OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); + OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); + OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); + OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); + OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); + OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); +#ifndef NO_SECURITY_CHECK + // 順序ほぼ最適化済み +#ifdef FIRM_USE_PRODUCT_KEYS + if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only + !rhs->enable_signature || // Should be use ROM header signature +#else + if ( // no check +#endif + !rhs->exFlags.codec_mode || // TWL mode only + // should be in main memory + HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || + // should be in static area without Limited region + (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || + // should be in main memory (end address) + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || + // should be in static area without Limited region (end address) + (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || + 0 ) + { + OS_TPrintf("Invalid ROM header for SDMC Launcher!\n"); + return FALSE; + } +#endif + return TRUE; +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + OS_BootFromFIRM(); +#endif +} + +static void myInit(void); +static void myVBlankIntr(void); + +void TwlMain( void ) +{ +#define X_OFF 2 + s16 y = 2; +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: before OS_InitFIRM + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + + myInit(); +#ifdef PROFILE_ENABLE + // 2: before OS_InitTick + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); + + OS_InitTick(); +#endif + + PostInit(); + // 3: after PostInit + PUSH_PROFILE(); + + //---- clear screen buffer + ClearScreen(); + PrintString( X_OFF, y, FONT_CYAAN, "SDMC Launcher (G)" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Initialized." ); + y++; + PrintString( X_OFF, y++, FONT_WHITE, "Finding SRL..." ); + OS_WaitVBlankIntr(); + + if ( !TryResolveSrl() ) + { + goto end; + } + PrintString( 0, y++, FONT_GREEN, "%30.32s", (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF + STD_GetStringLength( MENU_DIR ) ); + // 4: after FS_ResolveSrl + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_SET_PATH ); + // 5: after PXI + PUSH_PROFILE(); + + PrintString( X_OFF, y++, FONT_WHITE, "Loading header..." ); + OS_WaitVBlankIntr(); + + if ( !FS_LoadHeader( &acPool, rsa_key_user, rsa_key_sys, rsa_key_secure ) || !CheckHeader() ) + { + OS_TPrintf("Failed to call FS_LoadHeader() and/or CheckHeader().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 6: after FS_LoadHeader + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); + // 7: after PXI + PUSH_PROFILE(); + + PrintString( X_OFF, y++, FONT_WHITE, "Loading static data..." ); + OS_WaitVBlankIntr(); + + if ( !FS_LoadStatic( NULL ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 8: after FS_LoadStatic + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); + // 9: after PXI + PUSH_PROFILE(); + + OS_WaitVBlankIntr(); + +#ifdef PROFILE_ENABLE + { + int i; + OS_TPrintf("\n[ARM9] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM9] End\n"); + PXI_NotifyID( FIRM_PXI_ID_NULL ); + } +#endif + + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + PrintString( X_OFF, y++, FONT_WHITE, "Booting..." ); + OS_WaitVBlankIntr(); + OS_BootFromFIRM(); + +end: + PrintString( X_OFF+20, y, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + +//----------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- backdrop + *(u16*)HW_PLTT = GX_RGB(0,8,0); + *(u16*)HW_DB_PLTT = GX_RGB(0,8,0); + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/gcdfirm/sdmc-launcher/ARM9/screen.c b/build/gcdfirm/sdmc-launcher/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/gcdfirm/sdmc-launcher/Makefile b/build/gcdfirm/sdmc-launcher/Makefile new file mode 100644 index 00000000..8a4bd771 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - gcdfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = sdmc_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).gcd +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/sdmc_launcher9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_gcd.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = gcdfirm.gcdsf + +LDIRT_CLEAN += $(wildcard *.gcd) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher/gcdfirm.gcdsf b/build/gcdfirm/sdmc-launcher/gcdfirm.gcdsf new file mode 100644 index 00000000..b5a9fa74 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/gcdfirm.gcdsf @@ -0,0 +1,21 @@ +#GCDSF --- Gcdfirm Spec File + +VERSION : 0x0 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN : ./wram_regs/wram_regs.rbin + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +#NORFIRM : $(NORFIRM_BIN) +#NANDFIRM : $(NANDFIRM_BIN) diff --git a/build/gcdfirm/sdmc-launcher/readme.txt b/build/gcdfirm/sdmc-launcher/readme.txt new file mode 100644 index 00000000..b1b1973e --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/readme.txt @@ -0,0 +1,5 @@ +注意事項 + +起動するアプリがromアーカイブを使用する場合、 +NAライブラリをリンクしておく必要があります。 +(単純にリンクするライブラリに追加するだけです) diff --git a/build/gcdfirm/sdmc-launcher/wram_regs/Makefile b/build/gcdfirm/sdmc-launcher/wram_regs/Makefile new file mode 100644 index 00000000..76342425 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/gcdfirm/sdmc-launcher/wram_regs/wram_regs.c b/build/gcdfirm/sdmc-launcher/wram_regs/wram_regs.c new file mode 100644 index 00000000..aaa4dc33 --- /dev/null +++ b/build/gcdfirm/sdmc-launcher/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - gcdfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/libraries/Makefile b/build/libraries/Makefile new file mode 100644 index 00000000..f316ea53 --- /dev/null +++ b/build/libraries/Makefile @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS_P = \ + init \ + os \ + pxi \ + fs \ + mi \ + fatfs \ + aes \ + pm \ + nvram \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/aes/ARM7/Makefile b/build/libraries/aes/ARM7/Makefile new file mode 100644 index 00000000..b06ea6cf --- /dev/null +++ b/build/libraries/aes/ARM7/Makefile @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - aes +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +# Codegen for sub processer +TWL_PROC = ARM7 + +SRCDIR = . + +SRCS = \ + aes_init.c \ + +TARGET_LIB = libaes_sp$(FIRM_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/aes/ARM7/aes_init.c b/build/libraries/aes/ARM7/aes_init.c new file mode 100644 index 00000000..2111b9c7 --- /dev/null +++ b/build/libraries/aes/ARM7/aes_init.c @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - aes + File: aes_init.c + + Copyright 2007 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 + +// 変更可 +#define AES_IDS_ID0_C(c) (((unsigned long)c[0] << 0) | ((unsigned long)c[1] << 8) | ((unsigned long)c[2] << 16) | ((unsigned long)c[3] << 24)) +#define AES_IDS_ID0_D(c) (((unsigned long)c[3] << 0) | ((unsigned long)c[2] << 8) | ((unsigned long)c[1] << 16) | ((unsigned long)c[0] << 24)) + + +/*---------------------------------------------------------------------------* + Name: AESi_PreInitKeys + + Description: reset IDs preset by bootrom. + you SHOULD NOT touch any ID registers after this call. + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_PreInitKeys( void ) +{ + AES_WaitKey(); + + reg_AES_AES_ID_B2 = reg_OS_CHIP_ID1 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][0]; + reg_AES_AES_ID_D1 = reg_OS_CHIP_ID0 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][8]; + reg_AES_AES_ID_D2 = reg_OS_CHIP_ID1 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][4]; +} + +/*---------------------------------------------------------------------------* + Name: AESi_InitKeysForApp + + Description: set IDs depending on the application. + you SHOULD NOT touch any ID registers after this call. + + Arguments: game_code game code + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitKeysForApp( u8 game_code[4] ) +{ + AES_Lock(); + AES_WaitKey(); + + reg_AES_AES_ID_A2 = AES_IDS_ID0_C(game_code); + reg_AES_AES_ID_A3 = AES_IDS_ID0_D(game_code); + AES_Unlock(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_InitKeysForHard + + Description: set IDs depending on the system hardware. + you SHOULD NOT use this for standard applications. + + Arguments: fuse camouflaged fuse id + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitKeysForHard( u8 fuse[8] ) +{ + AES_Lock(); + AES_WaitKey(); + + reg_AES_AES_ID_B2 = *(u32*)&fuse[4]; + reg_AES_AES_ID_B3 = *(u32*)&fuse[0]; + reg_AES_AES_ID_D0 = *(u32*)&fuse[0]; + reg_AES_AES_ID_D3 = *(u32*)&fuse[4]; + AES_Unlock(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_InitSeedWithRomHeader + + Description: set SEED/KEY from ROM header + + Arguments: rom_header ROM header + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitSeedWithRomHeader( ROM_Header* rom_header ) +{ + AES_Lock(); + AES_WaitKey(); + if ( !rom_header ) + { + return; + } + if ( rom_header->s.developer_encrypt_old || rom_header->s.exFlags.developer_encrypt ) + { + AES_SetKeyA( (AESKey*)rom_header->s.title_name ); + } + else + { + AES_SetKeySeedA( (AESKeySeed*)rom_header->s.main_ltd_static_digest ); + } + AES_Unlock(); +} diff --git a/build/libraries/aes/Makefile b/build/libraries/aes/Makefile new file mode 100644 index 00000000..a9cca493 --- /dev/null +++ b/build/libraries/aes/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - aes +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM7 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/fatfs/ARM9/Makefile b/build/libraries/fatfs/ARM9/Makefile new file mode 100644 index 00000000..c1c9e673 --- /dev/null +++ b/build/libraries/fatfs/ARM9/Makefile @@ -0,0 +1,42 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - fatfs +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +SRCS = fatfs_firm.c + +TARGET_LIB = libfatfs$(FIRM_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/fatfs/ARM9/src/fatfs_firm.c b/build/libraries/fatfs/ARM9/src/fatfs_firm.c new file mode 100644 index 00000000..23d0f8ff --- /dev/null +++ b/build/libraries/fatfs/ARM9/src/fatfs_firm.c @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fatfs + File: fatfs_firm.c + + Copyright 2007 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 + +void FATFS_InitFIRM( void ) +{ + FATFSiCommandBuffer = (void*)HW_FIRM_FATFS_COMMAND_BUFFER; + FATFSiArcnameList = (void*)HW_FIRM_FATFS_ARCHNAME_LIST; + FATFS_Init(); +} + +void FATFSi_GetUnicodeConversionTable(const u8 **u2s, const u16 **s2u) +{ + *u2s = NULL; + *s2u = NULL; +} diff --git a/build/libraries/fatfs/Makefile b/build/libraries/fatfs/Makefile new file mode 100644 index 00000000..8ec2c27c --- /dev/null +++ b/build/libraries/fatfs/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - fatfs +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/fs/ARM7/Makefile b/build/libraries/fs/ARM7/Makefile new file mode 100644 index 00000000..6a4d6dce --- /dev/null +++ b/build/libraries/fs/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - fs +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +# Codegen for sub processer +TWL_PROC = ARM7 + +LINCLUDES = \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCS = fs_firm.c fs_firm_ex.c fs_loader.c fs_unicode.c + +SRCDIR = ./src ../common/src + +TARGET_LIB = libfs_sp$(FIRM_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/fs/ARM7/src/fs_firm.c b/build/libraries/fs/ARM7/src/fs_firm.c new file mode 100644 index 00000000..2ba0b882 --- /dev/null +++ b/build/libraries/fs/ARM7/src/fs_firm.c @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_firm.c + + Copyright 2007 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 + +static void ConvertPath( u16* dest, const char* src, u32 max) +{ + dest[0] = 0; + { + const OSMountInfo *info; + int len; + // デバイス部分を取得 + for (len = 0; src[len] && src[len] != ':'; len++) + { + if (len >= max) // もっと手前で止めても良い? + { + OS_TPrintf("%s: Cannot detect ':' in %d charactors.\n", __func__, len); + return; + } + } + + // ドライブ名の解決 + for (info = (void*)HW_FIRM_MOUNT_INFO_BUF; *info->drive; ++info) + { + if ((STD_CompareNString(src, info->archiveName, len) == 0) && + (info->archiveName[len] == 0)) + { + if (info->target != OS_MOUNT_TGT_ROOT) // 多重マウント未対応 + { + return; + } + dest[0] = (u16)*info->drive; + break; + } + } + max --; + dest++; + src += len; + } + { + int len; + // 残りunicode化 (ASCIIのみ) + for (len = 0; len < max && src[len]; len++) + { + if (src[len] == '/') + { + dest[len] = L'\\'; + } +#ifndef SDK_FINALROM + else if (src[len] & 0x80) + { + OS_TPrintf("%s: Multi-byte charactor was detected (0x%02X).\n", __func__, src[len]); + dest[len] = (u16)src[len]; // ignore but maybe broken + } +#endif + else + { + dest[len] = (u16)src[len]; + } + } + if (len < max) + { + dest[len] = 0; + } + else // l type (ensure to terminate zero) + { + dest[max-1] = 0; + } + } +} + +/*---------------------------------------------------------------------------* + Name: FS_InitMountInfo + + Description: set mount info for firm + + Arguments: nand TRUE if set nand entry + sdmc TRUE if set sdmc entry + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_InitMountInfo( BOOL nand, BOOL sdmc ) +{ + const OSMountInfo nandSetting = { 'A', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand", "/" }; + const OSMountInfo sdmcSetting = { 'B', OS_MOUNT_DEVICE_SD, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "sdmc", "/" }; + OSMountInfo* dest = (OSMountInfo*)HW_FIRM_MOUNT_INFO_BUF; + + if ( nand ) + { + MI_CpuCopy8(&nandSetting, dest++, sizeof(OSMountInfo)); + } + if ( sdmc ) + { + MI_CpuCopy8(&sdmcSetting, dest++, sizeof(OSMountInfo)); + } + if ( dest < (void*)HW_FIRM_BOOT_SRL_PATH_BUF ) + { + *(u32*)dest = 0; + } + *(u8*)HW_TWL_RED_LAUNCHER_VER = 1; + *(char*)HW_FIRM_BOOT_SRL_PATH_BUF = 0; // no rom archive +} + +/*---------------------------------------------------------------------------* + Name: FS_OpenSrl + + Description: open srl file named via HW_FIRM_TEMP_SRL_PATH_BUF + + Arguments: None + + Returns: file discriptor + *---------------------------------------------------------------------------*/ +int FS_OpenSrl( void ) +{ + u16 fatpath[HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE]; + ConvertPath(fatpath, (void*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE); + return FATFSi_rtfs_po_open((u8*)fatpath, 0, 0); +} diff --git a/build/libraries/fs/ARM7/src/fs_firm_ex.c b/build/libraries/fs/ARM7/src/fs_firm_ex.c new file mode 100644 index 00000000..6493fdcc --- /dev/null +++ b/build/libraries/fs/ARM7/src/fs_firm_ex.c @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_firm_ex.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 + +#if 0 + すべて確実ではないコード + 本来ならメインメモリ辺りにデータを置き、REBOOT内部でコピーする必要がある +#endif + +/*---------------------------------------------------------------------------* + Name: FS_SetMountInfoForSrl + + Description: set mount info for srl file + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_SetMountInfoForSrl( void ) +{ + const OSMountInfo defaultMountList[] ATTRIBUTE_ALIGN(4) = { + // drive device target pertitionIdx resource userPermission rsvA B archive path + { 'A', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, 0, 0, 0, "nand", "/" }, // ユーザーアプリはこのアーカイブではR/W不可 + { 'B', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 1, OS_MOUNT_RSC_WRAM, 0, 0, 0, "nand2", "/" }, // ユーザーアプリはこのアーカイブではR/W不可 + { 'C', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R), 0, 0, "content", NULL }, // Write不可 + { 'D', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R), 0, 0, "shared1", "nand:/shared1" }, // Write不可 + { 'E', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "shared2", "nand:/shared2" }, + { 'F', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 1, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "photo", "nand2:/photo" }, + { 'G', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPrv", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。 + { 'H', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPub", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。 + { 'I', OS_MOUNT_DEVICE_SD, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "sdmc", "/" }, + }; +#define NAND_MOUNT_INDEX 0 +#define NAND2_MOUNT_INDEX 1 +#define CONTENT_MOUNT_INDEX 2 + const ROM_Header_Short* const rhs = HW_TWL_ROM_HEADER_BUF; + const char* const srl = HW_TWL_FS_BOOT_SRL_PATH_BUF; + OSMountInfo* dest = (OSMountInfo *)HW_TWL_FS_MOUNT_INFO_BUF; + + MI_CpuCopy8(defaultMountList, dest, sizeof(defaultMountList)); + // nandアプリならパスを追加 + if ( *srl ) + { + const char* lastpath = STD_SearchCharReverse( srl, '/' ); + u32 len = (u32)(lastpath - srl); + if (len > OS_MOUNT_PATH_LEN) + { + len = OS_MOUNT_PATH_LEN; + } + MI_CpuCopy8(srl, dest[CONTENT_MOUNT_INDEX].path, len); + if (len != OS_MOUNT_PATH_LEN) + { + dest[CONTENT_MOUNT_INDEX].path[len] = 0; + } + } + // secureアプリならアクセス許可 + if ( rhs->titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) + { + dest[NAND_MOUNT_INDEX].userPermission = dest[NAND2_MOUNT_INDEX].userPermission = (OS_MOUNT_USR_R|OS_MOUNT_USR_W); + } +} diff --git a/build/libraries/fs/ARM7/src/fs_loader.c b/build/libraries/fs/ARM7/src/fs_loader.c new file mode 100644 index 00000000..af6ecf48 --- /dev/null +++ b/build/libraries/fs/ARM7/src/fs_loader.c @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_loader.c + + Copyright 2007 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 + +//#define WORKAROUND_NAND_2KB_BUG + +#define FS_HEADER_AUTH_SIZE 0xe00 + +#define MODULE_ALIGNMENT 0x20 // 16*2バイト単位で読み込む +//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む +#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +static BOOL aesFlag; +static AESCounter aesCounter; + +#define DMA_SEND 2 +#define DMA_RECV 3 +static void ReplaceWithAes( void* ptr, u32 size ) +{ + AES_Lock(); + AES_Reset(); + AES_Reset(); + AES_WaitKey(); + AES_LoadKey( AES_KEY_SLOT_A ); + AES_WaitKey(); + AES_DmaSend( DMA_SEND, ptr, size, NULL, NULL ); + AES_DmaRecv( DMA_RECV, ptr, size, NULL, NULL ); + AES_SetCounter( &aesCounter ); + AES_Run( AES_MODE_CTR, 0, size / AES_BLOCK_SIZE, NULL, NULL ); + AES_AddToCounter( &aesCounter, size / AES_BLOCK_SIZE ); + MI_WaitNDma( DMA_RECV ); + AES_Unlock(); +} + +static void EnableAes( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.main_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target_rom_offset) / AES_BLOCK_SIZE ); +} +static void EnableAes2( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.sub_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target2_rom_offset) / AES_BLOCK_SIZE ); +} +static void DisableAes( void ) +{ + aesFlag = FALSE; +} + +static u32 GetTransferSize( u32 offset, u32 size ) +{ + if ( rh->s.enable_aes ) + { + u32 end = offset + RoundUpModuleSize(size); + u32 aes_offset = rh->s.aes_target_rom_offset; + u32 aes_end = aes_offset + RoundUpModuleSize(rh->s.aes_target_size); + u32 aes_offset2 = rh->s.aes_target2_rom_offset; + u32 aes_end2 = aes_offset2 + RoundUpModuleSize(rh->s.aes_target2_size); + + if ( offset >= aes_offset && offset < aes_end ) + { + if ( end > aes_end ) + { + size = aes_end - offset; + } + EnableAes( offset ); + } + else if ( offset >= aes_offset2 && offset < aes_end2 ) + { + if ( end > aes_end2 ) + { + size = aes_end2 - offset; + } + EnableAes2( offset ); + } + else + { + if ( offset < aes_offset && offset + size > aes_offset ) + { + size = aes_offset - offset; + } + DisableAes(); + } + } + else + { + DisableAes(); + } + return size; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: load data in file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + size total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( int fd, u32 offset, u32 size ) +{ + static int count = 0; + + if ( fd < 0 ) + { + return FALSE; + } + // seek + if ( FATFSi_rtfs_po_lseek( fd, (long)offset, PSEEK_SET ) != (long)offset ) + { + OS_TPrintf("Failed to seek file. (offset=0x%X)\n", offset); + return FALSE; + } + while ( size > 0 ) + { + u8* dest = (u8*)HW_FIRM_LOAD_BUFFER_BASE + count * HW_FIRM_LOAD_BUFFER_UNIT_SIZE; + u32 unit = size < HW_FIRM_LOAD_BUFFER_UNIT_SIZE ? size : HW_FIRM_LOAD_BUFFER_UNIT_SIZE; + PXI_AcquireLoadBufferSemaphore(); // wait to be ready + if ( MI_GetWramBankMaster_B( count ) != MI_WRAM_ARM7 ) + { + OS_TPanic("PROGRAM ERROR!"); + } +#ifdef WORKAROUND_NAND_2KB_BUG + { + u32 done; + for ( done = 0; done < unit; done += 2048 ) + { + u8* d = dest + done; + u32 u = unit - done < 2048 ? unit - done : 2048; + if ( FATFSi_rtfs_po_read( fd, (u8*)d, (int)u ) != (int)u ) + { + OS_TPrintf("Failed to read file. (dest=%p, size=0x%X)\n", d, u); + return FALSE; + } + } + } +#else + if ( FATFSi_rtfs_po_read( fd, (u8*)dest, (int)unit ) != (int)unit ) + { + OS_TPrintf("Failed to read file. (dest=%p, size=0x%X)\n", dest, unit); + return FALSE; + } +#endif + if ( aesFlag ) + { + ReplaceWithAes( dest, unit ); + } + PXI_ReleaseLoadBufferSemaphore(); + count = ( count + 1 ) % HW_FIRM_LOAD_BUFFER_UNIT_NUMS; + size -= unit; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: load data in file and pass to ARM9 via WRAM-B in view of AES + settings in the ROM header in HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + length total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( int fd, u32 offset, u32 size ) +{ + size = RoundUpModuleSize( size ); + while ( size > 0 ) + { + u32 unit = GetTransferSize( offset, size ); + if ( !FS_LoadBuffer( fd, offset, unit ) ) + { + return FALSE; + } + offset += unit; + size -= unit; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: load ROM header in the head of file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( int fd ) +{ + if (fd < 0) + { + return FALSE; + } + DisableAes(); + if ( !FS_LoadBuffer(fd, 0, FS_HEADER_AUTH_SIZE) || + !FS_LoadBuffer(fd, FS_HEADER_AUTH_SIZE, HW_TWL_ROM_HEADER_BUF_SIZE - FS_HEADER_AUTH_SIZE) ) + { + return FALSE; + } + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: load static regions in file and pass to ARM9 via WRAM-B + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( int fd ) +{ + if ( rh->s.main_size > 0 ) + { + if ( !FS_LoadModule( fd, rh->s.main_rom_offset, rh->s.main_size ) ) + { + return FALSE; + } + } + if ( rh->s.sub_size > 0 ) + { + if ( !FS_LoadModule( fd, rh->s.sub_rom_offset, rh->s.sub_size ) ) + { + return FALSE; + } + } + if ( rh->s.main_ltd_size > 0 ) + { + if ( !FS_LoadModule( fd, rh->s.main_ltd_rom_offset, rh->s.main_ltd_size ) ) + { + return FALSE; + } + } + if ( rh->s.sub_ltd_size > 0 ) + { + if ( !FS_LoadModule( fd, rh->s.sub_ltd_rom_offset, rh->s.sub_ltd_size ) ) + { + return FALSE; + } + } + return TRUE; +} + diff --git a/build/libraries/fs/ARM9/Makefile b/build/libraries/fs/ARM9/Makefile new file mode 100644 index 00000000..66a6fa7a --- /dev/null +++ b/build/libraries/fs/ARM9/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - fs +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +LINCLUDES = $(ES_ROOT)/twl/include + +SRCS = fs_firm.c fs_loader.c fs_unicode.c + +SRCDIR = ./src ../common/src + +TARGET_LIB = libfs$(FIRM_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/fs/ARM9/src/fs_firm.c b/build/libraries/fs/ARM9/src/fs_firm.c new file mode 100644 index 00000000..7e5fd678 --- /dev/null +++ b/build/libraries/fs/ARM9/src/fs_firm.c @@ -0,0 +1,334 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_firm.c + + Copyright 2007 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 + +//#define PROFILE_ES 0x02FFCB00 + +// bootContent を表す特殊な contentIndex +#define CONTENT_INDEX_BOOT 0xFFFF + +#define PATH_FORMAT_TMD "nand:/title/%08x/%08x/content/title.tmd" +#define PATH_FORMAT_CONTENT "nand:/title/%08x/%08x/content/%08x.app" + +/*---------------------------------------------------------------------------* + Name: FS_InitFIRM + + Description: initialize FS/FATFS for firm + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_InitFIRM( void ) +{ + // FS/FATFSの全メモリクリア + MI_CpuClearFast((void*)HW_FIRM_FATFS_ARCHNAME_LIST, HW_FIRM_FS_FATFS_ASYNC_REQUEST_END - HW_FIRM_FATFS_ARCHNAME_LIST); + FATFS_InitFIRM(); + FS_Init( FS_DMA_NOT_USE ); +} + +/*---------------------------------------------------------------------------* + Name: FSi_SetupFATBuffers + + Description: override weak function + + Arguments: + + Returns: None + *---------------------------------------------------------------------------*/ +void FSi_SetupFATBuffers(void) +{ + FSiFATFSDrive = (void*)HW_FIRM_FS_FATFS_DRIVE; + FSiFATFSAsyncRequest = (void*)HW_FIRM_FS_FATFS_ASYNC_REQUEST; + FSiTemporaryBuffer = (void*)HW_FIRM_FS_TEMP_BUFFER; +} + +/*---------------------------------------------------------------------------* + Name: FSi_OverrideRomArchive + + Description: override weak function + + Arguments: + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FSi_OverrideRomArchive(FSArchive *arc) +{ + (void)arc; + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: LoadTMD + + Description: 対象のタイトルの TMD ファイルをメモリに読み込みます。 + 処理が正常に行われた場合に得られるバッファへのポインタは + 不要になったら NAMi_Free で解放する必要があります。 + + Arguments: pTmd: タイトルメタデータの読み込み先 + titleId: 対象のタイトルの TitleID。 + + Returns: 処理が正常に行われたなら TRUEを返します。 + そうでなければ FALSE を返します。 + *---------------------------------------------------------------------------*/ +static BOOL LoadTMD(ESTitleMeta* pTmd, OSTitleId titleId) +{ + char path[64]; + FSFile f; + BOOL bSuccess; + u32 fileSize; + s32 readSize; + s32 readResult; + + // TMD のパスを生成 + STD_TSPrintf(path, PATH_FORMAT_TMD, (u32)(titleId >> 32), (u32)titleId); + + FS_InitFile(&f); + bSuccess = FS_OpenFileEx(&f, path, FS_FILEMODE_R); + + if( ! bSuccess ) + { + // ファイルが開けなかった + return FALSE; + } + + fileSize = FS_GetFileLength(&f); + + // ファイルサイズをチェック 1 + // 固定部分サイズ <= fileSize <= 固定部分サイズ + 可変長部分最大サイズ + if( (fileSize < sizeof(IOSCSigRsa2048) + sizeof(ESTitleMetaHeader)) + || (sizeof(ESTitleMeta) < fileSize) ) + { + // ファイルサイズが異常 + FS_CloseFile(&f); + return FALSE; + } + + readSize = (s32)fileSize; + readResult = FS_ReadFile(&f, pTmd, readSize); + FS_CloseFile(&f); + + if( readResult != readSize ) + { + // ファイルからの読み込みに失敗 + return FALSE; + } + + // ファイルサイズをチェック 2 + // 可変長部分を正しく考慮 + if( fileSize != sizeof(IOSCSigRsa2048) + + sizeof(ESTitleMetaHeader) + + sizeof(ESContentMeta) * MI_SwapEndian16(pTmd->head.numContents) ) + { + // ファイルサイズが異常 + return FALSE; + } + + // タイトル ID の一致をチェック + if( titleId != MI_SwapEndian64(pTmd->head.titleId) ) + { + // タイトル ID が一致しない + return FALSE; + } + + return TRUE; +} +/*---------------------------------------------------------------------------* + Name: FS_GetTitleBootContentPathFast + + Description: NAND にインストールされているアプリの実行ファイルのパスを + 取得します。 + 取得する情報の正当性を検証しないため高速ですが、 + 情報が改竄されている可能性があることに注意しなければなりません。 + + Arguments: buf: パスを格納するバッファへのポインタ。 + FS_ENTRY_LONGNAME_MAX 以上のサイズが必要です。 + titleId: パスを取得するアプリの Title ID。 + + Returns: 正常に処理が行われたなら TRUE を返します。 + *---------------------------------------------------------------------------*/ +BOOL FS_GetTitleBootContentPathFast(char* buf, OSTitleId titleId) +{ + ESTitleMeta tmd; + u32 bootContentId; + int bootContentIndex; + int numContents; + int i; + + SDK_POINTER_ASSERT(buf); + + + + if( !LoadTMD(&tmd, titleId) ) + { + return FALSE; + } + + // 生の TMD は BigEndian + bootContentIndex = MI_SwapEndian16(tmd.head.bootIndex); + numContents = MI_SwapEndian16(tmd.head.numContents); + + // bootContentIndex に一致するコンテンツを探す + for( i = 0; i < numContents; ++i ) + { + const ESContentMeta* pContent = &tmd.contents[i]; + + if( MI_SwapEndian16(pContent->index) == bootContentIndex ) + { + bootContentId = MI_SwapEndian32(pContent->cid); + break; + } + } + + if( i >= numContents ) + { + return FALSE; + } + + // コンテンツのパスを生成 + STD_TSPrintf(buf, PATH_FORMAT_CONTENT, (u32)(titleId >> 32), (u32)titleId, bootContentId); + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: SEA_Decrypt + SEA_GetCryptoBufferAddr + SEA_GetCryptoBufferSize + + Description: stub function + + Arguments: + + Returns: + *---------------------------------------------------------------------------*/ +AESResult SEA_Decrypt(const void* src, u32 srcSize, void* dst); +SDK_WEAK_SYMBOL AESResult SEA_Decrypt(const void* src, u32 srcSize, void* dst) + __attribute__((never_inline)) +{ +(void)src; +(void)srcSize; +(void)dst; + return AES_RESULT_SUCCESS; +} +u32 SEA_GetCryptoBufferAddr(void); +SDK_WEAK_SYMBOL u32 SEA_GetCryptoBufferAddr(void) __attribute__((never_inline)) { return HW_FIRM_ES_BUF; } +u32 SEA_GetCryptoBufferSize(void); +SDK_WEAK_SYMBOL u32 SEA_GetCryptoBufferSize(void) __attribute__((never_inline)) { return HW_FIRM_ES_BUF_SIZE; } + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrl + + Description: resolve srl filename and store to HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: titleId title id for srl file + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_ResolveSrl( OSTitleId titleId ) +{ + MI_CpuClearFast( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + if ( ES_ERR_OK != ES_InitLib() || + ES_ERR_OK != ES_GetContentPath(titleId, CONTENT_INDEX_BOOT, (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF) || + ES_ERR_OK != ES_CloseLib() ) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrlList + + Description: resolve srl filename with list and store to + HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: titleIdList pointer to title id array for srl file + nums number of title id + + Returns: -1 if failed, otherwise succeeded titile id number + *---------------------------------------------------------------------------*/ +int FS_ResolveSrlList( const OSTitleId* titleIdList, u32 nums ) +{ + int i; +#ifdef PROFILE_ES + OSTick tick[8]; + char*ptr=(char*)PROFILE_ES; + tick[0] = OS_GetTick(); +#endif + MI_CpuClearFast( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); +#ifdef PROFILE_ES + tick[1] = OS_GetTick(); +#endif +/* + ES_InitLib()では、SEA_GetCryptoBuffer[Addr|Size]()で渡されるメモリを使用する。 + (SEA_Decrypt()も呼び出すがファームでは結果を使わない) + また、CRYPTOライブラリ経由で、ES_GetContentPath()で消費するのと同じサイズだけ + メモリの動的確保をする可能性がある。 +*/ + if ( !titleIdList || !nums || ES_ERR_OK != ES_InitLib() ) + { + return FALSE; + } + for ( i = 0; i < nums; i++ ) + { +#ifdef PROFILE_ES + tick[2+i] = OS_GetTick(); +#endif + if ( ES_ERR_OK == ES_GetContentPath(titleIdList[i], CONTENT_INDEX_BOOT, (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF) ) + { + break; + } + } +#ifdef PROFILE_ES + tick[3+i] = OS_GetTick(); +#endif + if ( ES_ERR_OK != ES_CloseLib() ) + { + return FALSE; + } +#ifdef PROFILE_ES + tick[4+i] = OS_GetTick(); + tick[5+i] = tick[4+i]; + for(i=0;i<7;i++) + ptr+=STD_TSPrintf(ptr, "tick[%d]:%d\n",i,(int)OS_TicksToMicroSeconds(tick[i+1]-tick[i])); +#endif + return (i == nums ? -1 : i); +} + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrlUnsecured + + Description: resolve srl filename and store to HW_TWL_FS_BOOT_SRL_PATH_BUF + without almost security check + + Arguments: titleId title id for srl file + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_ResolveSrlUnsecured( OSTitleId titleId ) +{ + MI_CpuClearFast( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + if ( !FS_GetTitleBootContentPathFast((char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, titleId) ) + { + return FALSE; + } + return TRUE; +} + + diff --git a/build/libraries/fs/ARM9/src/fs_loader.c b/build/libraries/fs/ARM9/src/fs_loader.c new file mode 100644 index 00000000..b9a119fd --- /dev/null +++ b/build/libraries/fs/ARM9/src/fs_loader.c @@ -0,0 +1,393 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_loader.c + + Copyright 2007 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 + +#define FS_HEADER_AUTH_SIZE 0xe00 + +#define HASH_UNIT 0x1000 + +static ROM_Header* const rh = (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +static u8 currentKey[ SVC_SHA1_BLOCK_SIZE ]; + +static const u8 defaultKey[ SVC_SHA1_BLOCK_SIZE ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + + +/*---------------------------------------------------------------------------* + Name: FS_SetDigestKey + + Description: set specified key or default key for HMAC-SHA-1 + + Arguments: digestKey pointer to key + if NULL, use default key + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline void FS_SetDigestKey( const u8* digestKey ) +{ + if ( digestKey ) + { + MI_CpuCopy8(digestKey, currentKey, SVC_SHA1_BLOCK_SIZE); + } + else + { + MI_CpuCopy8(defaultKey, currentKey, SVC_SHA1_BLOCK_SIZE); + } +} + +static inline BOOL CheckDigest( u8* a, u8* b, BOOL aClr, BOOL bClr ) +{ + BOOL result = TRUE; + int i; + for ( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) + { + if ( a[i] != b[i] ) + { + result = FALSE; + } + } + if ( aClr ) MI_CpuClear8(a, SVC_SHA1_DIGEST_SIZE); + if ( bClr ) MI_CpuClear8(b, SVC_SHA1_DIGEST_SIZE); + return result; +} +#ifdef SUPPORT_CERTIFICATION +/*---------------------------------------------------------------------------* + Name: CheckRomCertificate + + Description: check the certification in the ROM + + ROMヘッダに付加された証明書のチェックを行います。 + makerom.TWL内のコードに依存します。 + + Arguments: pool pointer to the SVCSignHeapContext + pCert pointer to the certification + pCAPubKey pointer to the public key for the certification + gameCode initial code + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static BOOL CheckRomCertificate( SVCSignHeapContext* pool, const RomCertificate *pCert, const void* pCAPubKey, u32 gameCode ) +{ + u8 digest[SVC_SHA1_DIGEST_SIZE]; + u8 md[SVC_SHA1_DIGEST_SIZE]; + + // 証明書ヘッダのマジックナンバーチェック + if( pCert->header.magicNumber != TWL_ROM_CERT_MAGIC_NUMBER || + // 証明書ヘッダとROMヘッダのゲームコード一致チェック + pCert->header.gameCode != gameCode ) + { + return FALSE; + } + // 証明書署名チェック + SVC_DecryptSign( pool, &digest, pCert->sign, pCAPubKey ); + + // ダイジェストの計算 + SVC_CalcSHA1( md, pCert, ROM_CERT_SIGN_OFFSET ); + + // 比較 + return CheckDigest(md, digest, TRUE, TRUE); +} +#endif +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: receive data from ARM7 via WRAM-B and store in destination address, + calculate SHA1 in parallel if ctx is specified + + Arguments: dest destination address to read + size total length to read in bytes + ctx pointer to SHA1 context or NULL + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( u8* dest, u32 size, SVCSHA1Context *ctx ) +{ + static int count = 0; + + while ( size > 0 ) + { + u8* src = (u8*)HW_FIRM_LOAD_BUFFER_BASE + count * HW_FIRM_LOAD_BUFFER_UNIT_SIZE; + u32 unit = size < HW_FIRM_LOAD_BUFFER_UNIT_SIZE ? size : HW_FIRM_LOAD_BUFFER_UNIT_SIZE; + PXI_AcquireLoadBufferSemaphore(); // wait to be ready + MIi_SetWramBankMaster_B( count, MI_WRAM_ARM9 ); + if (ctx) + { + int done; + for ( done = 0; done < unit; done += HASH_UNIT ) + { + u8* s = src + done; + u8* d = dest + done; + u32 u = unit - done < HASH_UNIT ? unit - done : HASH_UNIT; + SVC_SHA1Update( ctx, s, u ); + MI_CpuCopyFast( s, d, u ); + } + } + else + { + MI_CpuCopyFast( src, dest, unit ); + } + DC_InvalidateRange( src, unit ); + size -= unit; + dest += unit; + MIi_SetWramBankMaster_B( count, MI_WRAM_ARM7 ); + PXI_ReleaseLoadBufferSemaphore(); + count = ( count + 1 ) % HW_FIRM_LOAD_BUFFER_UNIT_NUMS; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: GetTransferSize + + Description: get size to transfer once + + 一度に受信するサイズを返します。 + + 転送範囲がAES領域をまたぐ場合は、境界までのサイズ (引数より + 小さなサイズ) を返します。 + makerom.TWLまたはIPLの使用に依存します。 + + Arguments: offset offset of region from head of ROM_Header + size size of region + + Returns: size to transfer once + *---------------------------------------------------------------------------*/ +static u32 GetTransferSize( u32 offset, u32 size ) +{ + if ( rh->s.enable_aes ) + { + u32 end = offset + size; + u32 aes_offset = rh->s.aes_target_rom_offset; + u32 aes_end = aes_offset + rh->s.aes_target_size; + u32 aes_offset2 = rh->s.aes_target2_rom_offset; + u32 aes_end2 = aes_offset2 + rh->s.aes_target2_size; + + if ( offset >= aes_offset && offset < aes_end ) + { + if ( end > aes_end ) + { + size = aes_end - offset; + } + } + else if ( offset >= aes_offset2 && offset < aes_end2 ) + { + if ( end > aes_end2 ) + { + size = aes_end2 - offset; + } + } + else + { + if ( offset < aes_offset && offset + size > aes_offset ) + { + size = aes_offset - offset; + } + } + } + return size; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: receive data from ARM7 via WRAM-B and store in destination address + in view of AES settings in the ROM header at HW_TWL_ROM_HEADER_BUF, + then verify the digest + + Arguments: dest destination address to read + offset file offset to start to read in bytes + size total length to read in bytes + digest digest to verify + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( u8* dest, u32 offset, u32 size, const u8 digest[SVC_SHA1_DIGEST_SIZE] ) +{ +#ifndef NO_SECURITY_CHECK + SVCHMACSHA1Context ctx; + u8 md[SVC_SHA1_DIGEST_SIZE]; + + SVC_HMACSHA1Init(&ctx, currentKey, SVC_SHA1_BLOCK_SIZE ); + while ( size > 0 ) + { + u32 unit = GetTransferSize( offset, size ); + if ( !FS_LoadBuffer( dest, unit, &ctx.sha1_ctx ) ) + { + return FALSE; + } + dest += unit; + offset += unit; + size -= unit; + } + SVC_HMACSHA1GetHash(&ctx, md); + return CheckDigest(md, (u8*)digest, TRUE, FALSE); +#else + (void)digest; + while ( size > 0 ) + { + u32 unit = GetTransferSize( offset, size ); + if ( !FS_LoadBuffer( dest, unit, NULL ) ) + { + return FALSE; + } + dest += unit; + offset += unit; + size -= unit; + } + return TRUE; +#endif +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: receive ROM header, store to HW_TWL_ROM_HEADER_BUF, + and verify signature + + Arguments: pool heap context to call SVC_DecryptSign + rsa_key_user public key to verify the signature for user application + rsa_key_sys public key to verify the signature for system application + rsa_key_secure public key to verify the signature for secure application + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( SVCSignHeapContext* pool, const void* rsa_key_user, const void* rsa_key_sys, const void* rsa_key_secure ) +{ +#ifndef NO_SECURITY_CHECK + const void* rsa_key; + SVCSHA1Context ctx; + u8 md[SVC_SHA1_DIGEST_SIZE]; + SignatureData sd; + + SVC_SHA1Init( &ctx ); + if ( !FS_LoadBuffer( (u8*)rh, FS_HEADER_AUTH_SIZE, &ctx ) ) + { + return FALSE; + } + SVC_SHA1GetHash( &ctx, md ); + if ( !FS_LoadBuffer( (u8*)rh + FS_HEADER_AUTH_SIZE, HW_TWL_ROM_HEADER_BUF_SIZE - FS_HEADER_AUTH_SIZE, NULL ) ) + { + return FALSE; + } + + // 鍵の確定 + rsa_key = (rh->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK) + ? rsa_key_secure + : ( (rh->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK) ? rsa_key_sys : rsa_key_user ); +#ifdef SUPPORT_CERTIFICATION + // コンテンツ証明書 + if ( CheckRomCertificate( pool, &rh->certificate, rsa_key, *(u32*)rh->s.game_code ) ) + { + rsa_key = rh->certificate.pubKeyMod; // ヘッダ用の鍵の取り出し + } + else + { + // とりあえずコンテンツ証明書用の鍵がそのまま使えると仮定 + } +#endif + // ヘッダ署名チェック + SVC_DecryptSign( pool, &sd, rh->signature, rsa_key ); + + if ( !CheckDigest( md, sd.digest, TRUE, FALSE ) ) + { + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) + return FALSE; + } + + // ダイジェスト以外のデータのチェックが必要!! + + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) +#else + (void)pool; + (void)rsa_key1; + (void)rsa_key2; + FS_LoadBuffer( (u8*)rh, FS_HEADER_AUTH_SIZE, NULL ); + FS_LoadBuffer( (u8*)rh + FS_HEADER_AUTH_SIZE, HW_TWL_ROM_HEADER_BUF_SIZE - FS_HEADER_AUTH_SIZE, NULL ); +#endif + // ROMヘッダのコピー + MI_CpuCopyFast( rh, (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: receive static regions from ARM6 via WRAM-B and store them + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: digestKey pointer to key for HMAC-SHA1 + if NULL, use default key + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( const u8* digestKey ) +{ + FS_SetDigestKey( digestKey ); + if ( rh->s.main_size > 0 ) + { + if ( !FS_LoadModule( rh->s.main_ram_address, rh->s.main_rom_offset, rh->s.main_size, rh->s.main_static_digest ) ) + { + return FALSE; + } + } + if ( rh->s.sub_size > 0 ) + { + if ( !FS_LoadModule( rh->s.sub_ram_address, rh->s.sub_rom_offset, rh->s.sub_size, rh->s.sub_static_digest ) ) + { + return FALSE; + } + } + if ( rh->s.main_ltd_size > 0 ) + { + if ( !FS_LoadModule( rh->s.main_ltd_ram_address, rh->s.main_ltd_rom_offset, rh->s.main_ltd_size, rh->s.main_ltd_static_digest ) ) + { + return FALSE; + } + } + if ( rh->s.sub_ltd_size > 0 ) + { + if ( !FS_LoadModule( rh->s.sub_ltd_ram_address, rh->s.sub_ltd_rom_offset, rh->s.sub_ltd_size, rh->s.sub_ltd_static_digest ) ) + { + return FALSE; + } + } + return TRUE; +} diff --git a/build/libraries/fs/Makefile b/build/libraries/fs/Makefile new file mode 100644 index 00000000..94c7f98c --- /dev/null +++ b/build/libraries/fs/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - fatfs +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 ARM7 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/fs/common/src/fs_unicode.c b/build/libraries/fs/common/src/fs_unicode.c new file mode 100644 index 00000000..e9a49dc2 --- /dev/null +++ b/build/libraries/fs/common/src/fs_unicode.c @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - fs + File: fs_unicode.c + + Copyright 2007 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 + +/*---------------------------------------------------------------------------* + Name: FSi_ConvertStringSjisToUnicode + + Description: ShiftJIS文字列をUnicode文字列に変換。 + 扱うパス名が明らかにASCIIのみである場合など + UnicodeとShiftJISの相互変換を簡略化できる場合は + この関数をオーバーライドすることによって + STDライブラリの標準処理がリンクされるのを防ぐことができる。 + + Arguments: dst 変換先バッファ. + NULL を指定すると格納処理は無視される. + dst_len 変換先バッファの最大文字数を格納して渡し, + 実際に格納された文字数を受け取るポインタ. + NULL を与えた場合は無視される. + src 変換元バッファ. + src_len 変換すべき最大文字数を格納して渡し, + 実際に変換された文字数を受け取るポインタ. + この指定よりも文字列終端の位置が優先される. + 負の値を格納して渡すか NULL を与えた場合は + 終端位置までの文字数を指定したとみなされる. + callback 変換できない文字が現れた時に呼ばれるコールバック. + NULLを指定した場合, 変換できない文字の位置で + 変換処理を終了する. + + Returns: 変換処理の結果. + *---------------------------------------------------------------------------*/ +STDResult FSi_ConvertStringSjisToUnicode(u16 *dst, int *dst_len, + const char *src, int *src_len, + STDConvertUnicodeCallback callback) +{ +#pragma unused(callback) + STDResult result = STD_RESULT_SUCCESS; + int i; + int max = 0x7FFFFFFF; + if (src_len && (*src_len >= 0)) + { + max = *src_len; + } + if (dst && dst_len && (*dst_len >= 0) && (*dst_len < max)) + { + max = *dst_len; + } + for (i = 0; i < max; ++i) + { + int c = ((const u8 *)src)[i]; + if (c == 0) + { + break; + } + else if (c >= 0x80) + { + result = STD_RESULT_ERROR; + break; + } + dst[i] = (u16)c; + } + if (src_len) + { + *src_len = i; + } + if (dst_len) + { + *dst_len = i; + } + return result; +} + +/*---------------------------------------------------------------------------* + Name: FSi_ConvertStringUnicodeToSjis + + Description: Unicode文字列をShiftJIS文字列に変換。 + 扱うパス名が明らかにASCIIのみである場合など + UnicodeとShiftJISの相互変換を簡略化できる場合は + この関数をオーバーライドすることによって + STDライブラリの標準処理がリンクされるのを防ぐことができる。 + + Arguments: dst 変換先バッファ. + NULL を指定すると格納処理は無視される. + dst_len 変換先バッファの最大文字数を格納して渡し, + 実際に格納された文字数を受け取るポインタ. + NULL を与えた場合は無視される. + src 変換元バッファ. + src_len 変換すべき最大文字数を格納して渡し, + 実際に変換された文字数を受け取るポインタ. + この指定よりも文字列終端の位置が優先される. + 負の値を格納して渡すか NULL を与えた場合は + 終端位置までの文字数を指定したとみなされる. + callback 変換できない文字が現れた時に呼ばれるコールバック. + NULLを指定した場合, 変換できない文字の位置で + 変換処理を終了する. + + Returns: 変換処理の結果. + *---------------------------------------------------------------------------*/ +STDResult FSi_ConvertStringUnicodeToSjis(char *dst, int *dst_len, + const u16 *src, int *src_len, + STDConvertSjisCallback callback) +{ +#pragma unused(callback) + STDResult result = STD_RESULT_SUCCESS; + int i; + int max = 0x7FFFFFFF; + if (src_len && (*src_len >= 0)) + { + max = *src_len; + } + if (dst && dst_len && (*dst_len >= 0) && (*dst_len < max)) + { + max = *dst_len; + } + for (i = 0; i < max; ++i) + { + int c = ((const u16 *)src)[i]; + if (c == 0) + { + break; + } + else if (c >= 0x80) + { + result = STD_RESULT_ERROR; + break; + } + dst[i] = (char)c; + } + if (src_len) + { + *src_len = i; + } + if (dst_len) + { + *dst_len = i; + } + return result; +} diff --git a/build/libraries/init/ARM7/Makefile b/build/libraries/init/ARM7/Makefile new file mode 100644 index 00000000..9be2e1f7 --- /dev/null +++ b/build/libraries/init/ARM7/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - init +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +# Codegen for sub processer +override TWL_PROC = ARM7 + +# Avoid to use pre-compile-header of "nitro.h" +TWL_NO_STD_PCHDR = True + +# Avoid to build THUMB version object +override TWL_CODEGEN = ARM + +SRCDIR = . ../common +SRCS = crt0_firm.c \ + crt0_jtag.c \ + +TARGET_OBJ = crt0_firm.o \ + crt0_jtag.o \ + +MACRO_FLAGS += -DSDK_NOINIT + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/init/ARM7/crt0_firm.c b/build/libraries/init/ARM7/crt0_firm.c new file mode 100644 index 00000000..9e881ca9 --- /dev/null +++ b/build/libraries/init/ARM7/crt0_firm.c @@ -0,0 +1,633 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - init + File: crt0_firm.c + + Copyright 2007 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 + +void _start(void); +void _start_AutoloadDoneCallback(void *argv[]); + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* 外部関数参照定義 */ +extern void OS_IrqHandler(void); +extern void _fp_init(void); +extern void __call_static_initializers(void); + +static void INITi_CpuClear32(register u32 data, register void *destp, register u32 size); +static void INITi_CpuClearFast(register u32 data, register void* destp, register u32 size); +static void INITi_DoAutoload(void); +static void INITi_ShelterLtdBinary(void); +static void INITi_CopySysConfig( void ); +static void INITi_DetectMainMemorySize(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif + +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); + +void *const _start_ModuleParams[] = +{ + (void *)SDK_AUTOLOAD_LIST, + (void *)SDK_AUTOLOAD_LIST_END, + (void *)SDK_AUTOLOAD_START, + (void *)SDK_STATIC_BSS_START, + (void *)SDK_STATIC_BSS_END, + (void*)0, // CompressedStaticEnd. This fixed number will be updated by compstatic tool. + (void*)0, // SDK_VERSION_ID // SDK version info /* [TODO] ビルドを通すため */ + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, // CompressedLtdautoloadEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +/*---------------------------------------------------------------------------* + Name: _start + + Description: Start up + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void _start( void ) +{ + //---- set IME = 0 + // ( use that LSB of HW_REG_BASE equal to 0 ) + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] + + //---- initialize stack pointer + // SVC mode + mov r0, #HW_PSR_SVC_MODE + msr cpsr_c, r0 + ldr sp, =HW_FIRM_SVC_STACK_END + + // IRQ mode + mov r0, #HW_PSR_IRQ_MODE + msr cpsr_c, r0 + ldr r0, =HW_FIRM_IRQ_STACK_END + mov sp, r0 + + // System mode + ldr r1, =HW_FIRM_IRQ_STACK_SIZE + sub r1, r0, r1 + mov r0, #HW_PSR_SYS_MODE + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4byte for stack check code + +#ifdef FIRM_DISABLE_CR_AT_WARMBOOT + //---- read reset flag from mcu +#ifdef SDK_TS +#if 0 + mov r0, #REG_PMIC_SW_FLAGS_ADDR + bl PMi_GetRegister + ands r0, r0, #PMIC_SW_FLAGS_WARMBOOT +#else + mov r0, #I2C_SLAVE_MICRO_CONTROLLER + mov r1, #MCU_REG_TEMP_ADDR + bl I2Ci_ReadRegister + ldr r2, =HW_RESET_PARAMETER_BUF + str r0, [r2] // store 4 bytes + cmp r0, #0 +#endif + movne r0, #FIRM_PXI_ID_WARMBOOT + moveq r0, #FIRM_PXI_ID_COLDBOOT + bl PXIi_SendByIntf +#endif // SDK_TS +#endif // FIRM_DISABLE_CR_AT_WARMBOOT + + //---- wait for main memory mode into burst mode + ldr r3, =REG_EXMEMCNT_L_ADDR + mov r1, #REG_MI_EXMEMCNT_L_EMODE_MASK +@1: + ldrh r2, [r3] + tst r2, r1 + beq @1 + + mov r0, #FIRM_PXI_ID_INIT_MMEM + bl PXIi_WaitIDByIntf + + //---- clear HW_TWL_MAIN_MEM_SHARED + mov r0, #0 + ldr r1, =HW_TWL_MAIN_MEM_SHARED + mov r2, #HW_TWL_MAIN_MEM_SHARED_SIZE + bl INITi_CpuClearFast + + //---- notify to clear HW_MAIN_MEM_SHARED + mov r0, #FIRM_PXI_ID_INIT_MMEM + bl PXIi_SendIDByIntf + + /* SCFG を HW_SYS_CONF_BUF へコピー */ + bl INITi_CopySysConfig + + //---- load autoload block and initialize bss + //bl INITi_DoAutoload +#ifndef SDK_FINALROM // for IS-TWL-DEBUGGER + bl _start_AutoloadDoneCallback +#endif + + //---- fill static bss with 0 + ldr r0, =_start_ModuleParams + ldr r1, [r0, #12] // BSS segment start + ldr r2, [r0, #16] // BSS segment end + mov r0, #0 + sub r2, r2, r1 + bl INITi_CpuClearFast + + //---- detect main memory size + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + //---- set debug print window + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7<<8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR<<8) + strh r0, [r1, #2] +#endif + + //---- set interrupt vector + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1, #0] + +#ifndef SDK_NOINIT + //---- for C++ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers +// bl INITi_CallStaticInitializers +#endif + + //---- start (to 16bit code) + ldr r1, =TwlSpMain + ldr lr, =HW_RESET_VECTOR + + bx r1 +} + +/*---------------------------------------------------------------------------* + Name: INITi_CpuClearFast + Description: 32 Byte 単位でバッファのクリアを行う。 + Arguments: r0 - クリアする値。 + r1 - クリア先へのポインタ。 + r2 - 連続してクリアするバッファ長。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CpuClearFast(register u32 data, register void* destp, register u32 size) +{ + stmfd sp!, {r4-r9} + + add r9, r1, r2 // r9: destEndp = destp + size + mov r12, r2, lsr #5 // r12: destBlockEndp = destp + size/32*32 + add r12, r1, r12, lsl #5 + + mov r2, r0 + mov r3, r2 + mov r4, r2 + mov r5, r2 + mov r6, r2 + mov r7, r2 + mov r8, r2 + +@40: + cmp r1, r12 // while (destp < destBlockEndp) + stmltia r1!, {r0, r2-r8} // *((vu32 *)(destp++)) = data + blt @40 +@41: + cmp r1, r9 // while (destp < destEndp) + stmltia r1!, {r0} // *((vu32 *)(destp++)) = data + blt @41 + + ldmfd sp!, {r4-r9} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CpuClear32 + Description: 32 bit 単位でバッファのクリアを行う。 + Arguments: r0 - クリアする値。 + r1 - クリア先へのポインタ。 + r2 - 連続してクリアするバッファ長。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CpuClear32(register u32 data, register void* destp, register u32 size) +{ + add r12, r1, r2 +@001: cmp r1, r12 + strlt r0, [r1], #4 + blt @001 + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* + * < 二段階オートロード > + * 0x02f88000 に crt0 及び一段目ロード元バイナリが配置されている。 + * NITRO と共有可能な WRAM 上に配置されるべきバイナリデータを 0x037c0000 にロードする。 + * TWL でしか動作しない WRAM 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + * 0x02e80000 に二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f84000 - 0x02f88000 に退避する。 + * NITRO と共有可能な MAIN 上に配置されるべきバイナリデータを 0x02f88000 + sizeof(crt0) にロードする。 + * TWL でしか動作しない MAIN 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + */ +static asm void +INITi_DoAutoload(void) +{ +@000: + stmdb sp!, {lr} + /* WRAM 用ブロックをオートロード */ + ldr r1, =_start_ModuleParams + ldr r12, [r1] // r12 = SDK_AUTOLOAD_LIST + ldr r0, [r1, #4] // r0 = SDK_AUTOLOAD_LIST_END + ldr r1, [r1, #8] // r1 = SDK_AUTOLOAD_START +@001: cmp r12, r0 + bge @010 + /* 固定セクションをロード */ + stmdb sp!, {r0} + ldr r2, [r12], #4 // r2 = start address of destination range + ldr r3, [r12], #4 // r3 = size of fixed section + add r3, r3, r2 // r3 = end address of destination range of fixed section +@002: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @002 + /* static initializer テーブル情報を読み出し */ + ldr r0, [r12], #4 // r0 = address of the table managing pointers of static initializers +#ifndef SDK_NOINIT + stmdb sp!, {r0-r3, r12} + bl INITi_ShelterStaticInitializer + ldmia sp!, {r0-r3, r12} +#endif + /* .bss セクションを 0 クリア */ + mov r0, #0 + ldr r3, [r12], #4 // r3 = size of .bss section + add r3, r3, r2 // r3 = end address of destination range of .bss section +@003: cmp r2, r3 + strlt r0, [r2], #4 + blt @003 +@004: ldmia sp!, {r0} + b @001 + +@010: /* メインメモリ用ブロックの存在を確認 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + 0x1dc /* ARM7 用拡張常駐モジュール ROM サイズ */ + ldr r0, [r1] + cmp r0, #0 + beq @020 + + /* 再読み出し不可部分を退避 */ + bl INITi_ShelterLtdBinary + + /* メインメモリ用ブロックをオートロード */ + ldr r1, =_start_LtdModuleParams + ldr r12, [r1] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r0, [r1, #4] // r0 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r1, #8] // r1 = SDK_LTDAUTOLOAD_START +@011: cmp r12, r0 + bge @020 + /* 固定セクションをロード */ + stmdb sp!, {r0} + ldr r2, [r12], #4 // r2 = start address of destination range + ldr r3, [r12], #4 // r3 = size of fixed section + add r3, r3, r2 // r3 = end address of destination range of fixed section +@012: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @012 + /* static initializer テーブル情報を読み出し */ + ldr r0, [r12], #4 // r0 = address of the table managing pointers of static initializers +#ifndef SDK_NOINIT + stmdb sp!, {r0-r3, r12} + bl INITi_ShelterStaticInitializer + ldmia sp!, {r0-r3, r12} +#endif + /* .bss セクションを 0 クリア */ + mov r0, #0 + ldr r3, [r12], #4 // r3 = size of .bss section + add r3, r3, r2 // r3 = end address of destination range of .bss section +@013: cmp r2, r3 + strlt r0, [r2], #4 + blt @013 +@014: ldmia sp!, {r0} + b @011 + +@020: /* オートロード完了コールバック関数呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmia sp!, {lr} + b _start_AutoloadDoneCallback +} + +/*---------------------------------------------------------------------------* + Name: INITi_ShelterLtdBinary + Description: TWL 専用のオートロード元バイナリデータの内、カード ROM から + 再読み出しできない領域のデータを退避エリアに退避する。 + 再読み出しできない領域のデータは ARM7 用と ARM9 用の拡張常駐 + モジュールの2つに分かれている可能性があるので、冗長ではあるが + 両方の先頭から 0x4000 分をそれぞれ退避する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterLtdBinary(void) +{ + /* 退避元・先アドレスを調査 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + 0x1d8 /* ARM7 用拡張常駐モジュール RAM アドレス */ + ldr r1, [r1] + ldr r3, =HW_TWL_ROM_HEADER_BUF + 0x038 /* ARM7 用常駐モジュール RAM アドレス */ + ldr r3, [r3] + sub r2, r3, #0x4000 /* 再読み出し不可領域サイズ */ /* ARM7 用退避エリア */ + + /* コピー */ +@loop: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @loop + + bx lr +} + +#ifndef SDK_NOINIT +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_FIRM_IRQ_STACK_END + ldr r2, =HW_FIRM_IRQ_STACK_SIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* 退避場所先頭から空き場所を調査 */ +@001: ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 + + /* 空き場所にテーブルをコピー */ +@002: ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_FIRM_IRQ_STACK_END + ldr r2, =HW_FIRM_IRQ_STACK_SIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* テーブルに管理されているポインタを一つずつ呼び出し */ +@001: ldr r0, [r1] + cmp r0, #0 + beq @002 + stmdb sp!, {r1} + mov lr, pc + bx r0 + ldmia sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 + +@002: ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CopySysConfig + + Description: copy SCFG registers to HW_SYS_CONF_BUF and HW_PRV_WRAM_SYSRV + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static asm void INITi_CopySysConfig( void ) +{ +//################ temp: this process will be done in IPL + // SCFG enable? + ldr r2, =REG_EXT_ADDR + ldr r0, [r2] + tst r0, #0x80000000 + beq @9 + + ldr r2, =HW_PRV_WRAM_SYSRV + //EXT(extentions) + ldr r3, =REG_EXT_ADDR + ldr r0, [r3] + str r0, [r2, #HWi_WSYS04_WRAMOFFSET] + //OPT(bonding option) + ldr r3, =REG_OP_ADDR + ldrb r0, [r3] + //A9ROM(ARM9 ROM) + ldr r3, =REG_A9ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A9ROM_RSEL_MASK | REG_SCFG_A9ROM_SEC_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM9RSEL_SHIFT - REG_SCFG_A9ROM_RSEL_SHIFT) + //A7ROM(ARM7 ROM) + ldr r3, =REG_A7ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A7ROM_RSEL_MASK | REG_SCFG_A7ROM_FUSE_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM7RSEL_SHIFT - REG_SCFG_A7ROM_RSEL_SHIFT) + //DS-WL(DS wireless) + ldr r3, =REG_A7ROM_ADDR + ldrb r1, [r3] + and r12,r1, #REG_SCFG_WL_OFFB_MASK + orr r0, r0, r12, LSL #(HWi_WSYS08_WL_OFFB_SHIFT - REG_SCFG_WL_OFFB_SHIFT) + strb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + //OPT(JTAG info) + ldr r3, =REG_JTAG_ADDR + ldrh r0, [r3] + and r12,r0, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r12, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + //CLK(only wram clock) + ldr r3, =REG_CLK_ADDR + ldrh r1, [r3] + and r12,r1, #(REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS09_CLK_SD1HCLK_SHIFT - REG_SCFG_CLK_SD1HCLK_SHIFT) + and r12,r1, #(REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK) + orr r0, r0, r12, LSR #(REG_SCFG_CLK_WRAMHCLK_SHIFT - HWi_WSYS09_CLK_WRAMHCLK_SHIFT) + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] +@9: +//################ + + //---- copy scfg setting + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + Description: メインメモリサイズを調査する。 + 調査結果は (u16*)HW_MMEMCHECER_SUB に格納される。 + 格納される値は [OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32B] + NOTE: プラットフォームが NITRO の場合は考慮していない。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void +INITi_DetectMainMemorySize(void) +{ + ldr r2, =HW_MMEMCHECKER_SUB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + + /* OSi_CHECKNUM1 (0x55) 書き込みテスト */ + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@1 subs r2, r2, #4 + bcs @1 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @check_smix + + /* OSi_CHECKNUM2 (0xaa) を 書き込みテスト */ + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@2 subs r2, r2, #4 + bcs @2 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@check_smix: + /* SMIX レジスタを調査 */ + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + /* 調査結果を格納 */ + ldr r2, =HW_MMEMCHECKER_SUB + strb r0, [r2] + bx lr +} + +/*---------------------------------------------------------------------------* + Name: TwlSpStartUp + + Description: hook for user start up + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void TwlSpStartUp(void) +{ +} + +#include diff --git a/build/libraries/init/ARM9/Makefile b/build/libraries/init/ARM9/Makefile new file mode 100644 index 00000000..e863b343 --- /dev/null +++ b/build/libraries/init/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - init +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +# Avoid to use pre-compile-header of "nitro.h" +TWL_NO_STD_PCHDR = True + +# Avoid to build THUMB version object +override TARGET_CODEGEN = ARM + +SRCDIR = . ../common +SRCS = crt0_firm.c \ + crt0_jtag.c \ + +TARGET_OBJ = crt0_firm.o \ + crt0_jtag.o \ + +MACRO_FLAGS += -DSDK_NOINIT + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/init/ARM9/crt0_firm.c b/build/libraries/init/ARM9/crt0_firm.c new file mode 100644 index 00000000..939db358 --- /dev/null +++ b/build/libraries/init/ARM9/crt0_firm.c @@ -0,0 +1,955 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - init + File: crt0_firm.c + + Copyright 2007 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 + +void _start(void); +void _start_AutoloadDoneCallback(void *argv[]); + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* 外部関数参照定義 */ +extern void OS_IrqHandler(void); +extern void _fp_init(void); +extern void __call_static_initializers(void); + +/* 内部関数プロトタイプ定義 */ +static void INITi_CpuClear32(register u32 data, register void *destp, register u32 size); +static void INITi_CpuClearFast(register u32 data, register void* destp, register u32 size); +static void INITi_InitCoprocessor(void); +static void INITi_InitRegion(void); +static void INITi_DoAutoload(void); +static void INITi_ShelterLtdBinary(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif + +/* リンカスックリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); + +//#include +#define SDK_VERSION_ID ((u32)SDK_VERSION_MAJOR<<24|\ + (u32)SDK_VERSION_MINOR<<16|\ + (u32)SDK_VERSION_RELSTEP) + +void* const _start_ModuleParams[] = +{ + (void*)SDK_AUTOLOAD_LIST, + (void*)SDK_AUTOLOAD_LIST_END, + (void*)SDK_AUTOLOAD_START, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, // CompressedStaticEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_VERSION_ID, // SDK version info /* [TODO] ビルドを通すため */ + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, // CompressedLtdautoloadEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define INITi_HW_DTCM SDK_AUTOLOAD_DTCM_START + +SDK_WEAK_SYMBOL asm void _start( void ) +{ + //---- set IME = 0 + // ( use that LSB of HW_REG_BASE equal to 0 ) + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] + + // カード電源ON時はカードリセット解除設定 + ldr r3, =REG_MC_ADDR + ldr r0, [r3] + and r0, r0, #REG_MI_MC_SL1_MODE_MASK + cmp r0, #0x2 << REG_MI_MC_SL1_MODE_SHIFT + ldreq r3, =REG_MCCNT1_ADDR + moveq r0, #REG_MI_MCCNT1_RESB_MASK + streq r0, [r3] + + //---- initialize stack pointer + // SVC mode + mov r0, #HW_PSR_SVC_MODE + msr cpsr_c, r0 + ldr r0, =INITi_HW_DTCM + add r0, r0, #0x3fc0 + mov sp, r0 + + // IRQ mode + mov r0, #HW_PSR_IRQ_MODE + msr cpsr_c, r0 + ldr r0, =INITi_HW_DTCM + add r0, r0, #0x3fc0 + sub r0, r0, #HW_SVC_STACK_SIZE + sub sp, r0, #4 // 4byte for stack check code + tst sp, #4 + subeq sp, sp, #4 // for 8byte-alignment + + // System mode + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, r0, r1 + mov r0, #HW_PSR_SYS_MODE + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4byte for stack check code + tst sp, #4 + subeq sp, sp, #4 // for 8byte-alignment + + //---- read reset flag from pmic +#ifdef SDK_TS +#ifdef FIRM_DISABLE_CR_AT_WARMBOOT +@0: bl PXIi_RecvIDByIntf + cmp r0, #FIRM_PXI_ID_COLDBOOT + cmpne r0, #FIRM_PXI_ID_WARMBOOT + bne @0 + + //---- initialize Main Memory + cmp r0, #FIRM_PXI_ID_COLDBOOT + moveq r0, #TRUE + movne r0, #FALSE + bl MIi_InitMainMemCR + +#else // !FIRM_DISABLE_CR_AT_WARMBOOT + //---- initialize Main Memory + bl MIi_InitMainMemCR + +#endif // !FIRM_DISABLE_CR_AT_WARMBOOT +#endif // SDK_TS + + /* システム制御コプロセッサ初期化 */ + bl INITi_InitCoprocessor + + /* リージョン初期設定 */ + bl INITi_InitRegion + + //---- notify main memory mode into burst mode + mov r0, #FIRM_PXI_ID_INIT_MMEM + bl PXIi_SendIDByIntf + + //---- wait to clear HW_MAIN_MEM_SHARED + mov r0, #FIRM_PXI_ID_INIT_MMEM + bl PXIi_WaitIDByIntf + + //---- clear memory + // DTCM (16KB) + mov r0, #0 + ldr r1, =INITi_HW_DTCM + mov r2, #HW_DTCM_SIZE + bl INITi_CpuClear32 + + //---- load autoload block and initialize bss +// bl INITi_DoAutoload +#ifndef SDK_FINALROM // for IS-TWL-DEBUGGER + bl _start_AutoloadDoneCallback +#endif + + //---- fill static static bss with 0 + mov r0, #0 + ldr r3, =_start_ModuleParams + ldr r1, [r3, #12] // SDK_STATIC_BSS_START + ldr r2, [r3, #16] // SDK_STATIC_BSS_END + sub r2, r2, r1 + bl INITi_CpuClearFast + + //---- flush static bss region + // (r0 == #0, r3 == _start_ModuleParams::BSS_segment_start) + bic r1, r3, #HW_CACHE_LINE_SIZE - 1 +@cacheflush: + mcr p15, 0, r0, c7, c10, 4 // wait writebuffer empty + mcr p15, 0, r1, c7, c5, 1 // ICache + mcr p15, 0, r1, c7, c14, 1 // DCache + add r1, r1, #HW_CACHE_LINE_SIZE + cmp r1, r2 + blt @cacheflush + + // print buffer (used for ARM7's printing) + ldr r1, =HW_COMPONENT_PARAM + str r0, [r1, #0] + + //---- set interrupt vector + ldr r1, =INITi_HW_DTCM + add r1, r1, #0x3fc0 + add r1, r1, #HW_DTCM_SYSRV_OFS_INTR_VECTOR + ldr r0, =OS_IrqHandler + str r0, [r1, #0] + +#ifndef SDK_NOINIT + //---- for C++ + bl _fp_init + bl TwlStartUp + bl __call_static_initializers +// bl INITi_CallStaticInitializers +#endif + //---- start (to 16bit code) + ldr r1, =TwlMain + ldr lr, =HW_RESET_VECTOR + bx r1 +} + +/*---------------------------------------------------------------------------* + Name: INITi_CpuClearFast + Description: 32 Byte 単位でバッファのクリアを行う。 + Arguments: r0 - クリアする値。 + r1 - クリア先へのポインタ。 + r2 - 連続してクリアするバッファ長。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CpuClearFast(register u32 data, register void* destp, register u32 size) +{ + stmfd sp!, {r4-r9} + + add r9, r1, r2 // r9: destEndp = destp + size + mov r12, r2, lsr #5 // r12: destBlockEndp = destp + size/32*32 + add r12, r1, r12, lsl #5 + + mov r2, r0 + mov r3, r2 + mov r4, r2 + mov r5, r2 + mov r6, r2 + mov r7, r2 + mov r8, r2 + +@40: + cmp r1, r12 // while (destp < destBlockEndp) + stmltia r1!, {r0, r2-r8} // *((vu32 *)(destp++)) = data + blt @40 +@41: + cmp r1, r9 // while (destp < destEndp) + stmltia r1!, {r0} // *((vu32 *)(destp++)) = data + blt @41 + + ldmfd sp!, {r4-r9} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CpuClear32 + Description: 32 bit 単位でバッファのクリアを行う。 + Arguments: r0 - クリアする値。 + r1 - クリア先へのポインタ。 + r2 - 連続してクリアするバッファ長。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CpuClear32(register u32 data, register void* destp, register u32 size) +{ + add r12, r1, r2 +@001: cmp r1, r12 + strlt r0, [r1], #4 + blt @001 + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_InitCoprocessor + Description: システム制御コプロセッサを初期化する。 + 同時に、I-TCM 及び D-TCM を使用可能な状態にする。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_InitCoprocessor(void) +{ + /* コプロセッサの状態取得 */ + mrc p15, 0, r0, c1, c0, 0 + + tst r0, #HW_C1_PROTECT_UNIT_ENABLE + beq @010 + tst r0, #HW_C1_DCACHE_ENABLE + beq @003 + + /* D-Cache 内容をメモリにライトバック */ + mov r1, #0 +@001: mov r2, #0 +@002: orr r3, r1, r2 + mcr p15, 0, r3, c7, c10, 2 + add r2, r2, #HW_CACHE_LINE_SIZE + cmp r2, #HW_DCACHE_SIZE / 4 + blt @002 + adds r1, r1, #1 << HW_C7_CACHE_SET_NO_SHIFT + bne @001 + +@003: /* ライトバッファが空になるのを待つ */ + mov r1, #0 + mcr p15, 0, r1, c7, c10, 4 + +@010: /* コプロセッサの状態を初期化 */ + ldr r1, = HW_C1_ITCM_LOAD_MODE \ + | HW_C1_DTCM_LOAD_MODE \ + | HW_C1_ITCM_ENABLE \ + | HW_C1_DTCM_ENABLE \ + | HW_C1_LD_INTERWORK_DISABLE \ + | HW_C1_ICACHE_ENABLE \ + | HW_C1_DCACHE_ENABLE \ + | HW_C1_PROTECT_UNIT_ENABLE + bic r0, r0, r1 + ldr r1, = HW_C1_SB1_BITSET \ + | HW_C1_EXCEPT_VEC_UPPER + orr r0, r0, r1 + mcr p15, 0, r0, c1, c0, 0 + + /* I-TCM のサイズを設定 */ + mov r1, #HW_C9_TCMR_32MB + mcr p15, 0, r1, c9, c1, 1 + /* D-TCM のサイズ及び領域ベースアドレスを設定 */ + ldr r1, =SDK_AUTOLOAD_DTCM_START + orr r1, r1, #HW_C9_TCMR_16KB + mcr p15, 0, r1, c9, c1, 0 + + /* I-TCM / D-TCM 使用許可設定 */ + mov r1, #HW_C1_ITCM_ENABLE | HW_C1_DTCM_ENABLE + orr r0, r0, r1 + mcr p15, 0, r0, c1, c0, 0 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_InitRegion + Description: リージョン初期設定を行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* When hardware is TWL +; Region G: BACK_GROUND: Base = 0x0, Size = 4GB, I:NC NB / D:NC NB, I:NA / D:NA +; Region 0: IO_VRAM: Base = 0x04000000, Size = 64MB, I:NC NB / D:NC NB, I:RW / D:RW +; Region 1: MAINMEM_WRAM: Base = 0x02000000, Size = 32MB, I:Cach Buf / D:Cach Buf, I:RW / D:RW +; Region 2: ARM7_RESERVE: Base = 0x02f80000, Size = 512KB, I:NC NB / D:NC NB, I:NA / D:NA +; Region 3: EX_MAINMEM: Base = 0x0d000000, Size = 16MB, I:Cach Buf / D:Cach Buf, I:RW / D:RW +; Region 4: DTCM: Base = 0x02fe0000, Size = 16KB, I:NC NB / D:NC NB, I:NA / D:RW +; Region 5: ITCM: Base = 0x01000000, Size = 16MB, I:NC NB / D:NC NB, I:RW / D:RW +; Region 6: BIOS: Base = 0xffff0000, Size = 32KB, I:Cach NB / D:Cach NB, I:RO / D:RO +; Region 7: SHARED_WORK: Base = 0x02ffc000, Size = 16KB, I:NC NB / D:NC NB, I:NA / D:RW +*/ +/* When hardware is NITRO +; Region G: BACK_GROUND: Base = 0x0, Size = 4GB, I:NC NB / D:NC NB, I:NA / D:NA +; Region 0: IO_VRAM: Base = 0x04000000, Size = 64MB, I:NC NB / D:NC NB, I:RW / D:RW +; Region 1: MAIN_MEM: Base = 0x02000000, Size = 8MB*, I:Cach Buf / D:Cach Buf, I:RW / D:RW +; (* When hardware is not debugger, size will be reduced to 4MB in OS_InitArena() ) +;// Region 2: ARM7_RESERVE: Base = 0x027e0000, Size = 128KB, I:NC NB / D:NC NB, I:NA / D:NA +;// (* When hardware is not debugger, base will be moved to 0x023e0000 in OS_InitArena() ) +; Region 2: SHARED_WORK: Base = 0x027ff000, Size = 4KB, I:NC NB / D:NC NB, I:NA / D:RW +; Region 3: CARTRIDGE: Base = 0x08000000, Size = 128MB, I:NC NB / D:NC NB, I:NA / D:RW +; Region 4: DTCM: Base = 0x02fe0000, Size = 16KB, I:NC NB / D:NC NB, I:NA / D:RW +; Region 5: ITCM: Base = 0x01000000, Size = 16MB, I:NC NB / D:NC NB, I:RW / D:RW +; Region 6: BIOS: Base = 0xffff0000, Size = 32KB, I:Cach NB / D:Cach NB, I:RO / D:RO +; Region 7: SHARED_WORK: Base = 0x02fff000, Size = 4KB, I:NC NB / D:NC NB, I:NA / D:RW +*/ + +static asm void +INITi_InitRegion(void) +{ + mov r12, lr + +#define SET_PROTECTION_A(id, adr, siz) ldr r0, =(adr|HW_C6_PR_##siz|HW_C6_PR_ENABLE) +#define SET_PROTECTION_B(id, adr, siz) mcr p15, 0, r0, c6, id, 0 +#define REGION_BIT(a, b, c, d, e, f, g, h) (((a) << 0) | ((b) << 1) | ((c) << 2) | ((d) << 3) | ((e) << 4) | ((f) << 5) | ((g) << 6) | ((h) << 7)) +#define REGION_ACC(a, b, c, d, e, f, g, h) (((a) << 0) | ((b) << 4) | ((c) << 8) | ((d) << 12) | ((e) << 16) | ((f) << 20) | ((g) << 24) | ((h) << 28)) +#define NA 0 +#define RW 1 +#define RO 5 + + /* (0) I/O レジスタ及び VRAM 等 */ + SET_PROTECTION_A(c0, HW_IOREG, 64MB) + SET_PROTECTION_B(c0, HW_IOREG, 64MB) + + /* (4) D-TCM */ + ldr r0, =SDK_AUTOLOAD_DTCM_START + orr r0, r0, #HW_C6_PR_16KB | HW_C6_PR_ENABLE + SET_PROTECTION_B(c4, SDK_AUTOLOAD_DTCM_START, 16KB) + + /* (5) I-TCM */ + SET_PROTECTION_A(c5, HW_ITCM_IMAGE, 16MB) + SET_PROTECTION_B(c5, HW_ITCM_IMAGE, 16MB) + + /* (6) システムコール ROM */ + SET_PROTECTION_A(c6, HW_BIOS, 32KB) + SET_PROTECTION_B(c6, HW_BIOS, 32KB) + + /* TWL ハードウェア上で動作しているかどうかを調査 */ +#if 0 + bl INITi_IsRunOnTwl + bne @002 +#endif + +@001: /* ハードウェアが TWL の場合 */ + /* (1) メインメモリ及び WRAM */ + SET_PROTECTION_A(c1, HW_TWL_MAIN_MEM_MAIN, 32MB) + SET_PROTECTION_B(c1, HW_TWL_MAIN_MEM_MAIN, 32MB) + + /* (2) ARM7 専用メインメモリ空間 */ + SET_PROTECTION_A(c2, HW_TWL_MAIN_MEM_SUB, 512KB) + SET_PROTECTION_B(c2, HW_TWL_MAIN_MEM_SUB, 512KB) + + /* (3) 拡張メインメモリ */ + SET_PROTECTION_A(c3, HW_TWL_MAIN_MEM_EX, 16MB) + SET_PROTECTION_B(c3, HW_TWL_MAIN_MEM_EX, 16MB) + + /* (7) ARM9/ARM7 共有メインメモリ空間 */ + SET_PROTECTION_A(c7, HW_TWL_MAIN_MEM_SHARED, 16KB) + SET_PROTECTION_B(c7, HW_TWL_MAIN_MEM_SHARED, 16KB) + + /* 命令キャッシュ許可 */ + mov r0, #REGION_BIT(0, 1, 0, 1, 0, 0, 1, 0) + mcr p15, 0, r0, c2, c0, 1 + + /* データキャッシュ許可 */ +// mov r0, #REGION_BIT(0, 1, 0, 1, 0, 0, 1, 0) + mov r0, #REGION_BIT(0, 1, 1, 1, 0, 0, 1, 0) + mcr p15, 0, r0, c2, c0, 0 + + /* ライトバッファ許可 */ +// mov r0, #REGION_BIT(0, 1, 0, 1, 0, 0, 0, 0) + mov r0, #REGION_BIT(0, 1, 1, 1, 0, 0, 0, 0) + mcr p15, 0, r0, c3, c0, 0 + + /* 命令アクセス許可 */ + ldr r0, =REGION_ACC(RW, RW, NA, RW, NA, RW, RO, NA) + mcr p15, 0, r0, c5, c0, 3 + + /* データアクセス許可 */ +// ldr r0, =REGION_ACC(RW, RW, NA, RW, RW, RW, RO, RW) + ldr r0, =REGION_ACC(RW, RW, RW, RW, RW, RW, RO, RW) + mcr p15, 0, r0, c5, c0, 2 +#if 0 + b @003 + +@002: /* ハードウェアが NITRO の場合 */ + /* (1) メインメモリ */ + //SET_PROTECTION_A(c1, HW_MAIN_MEM_MAIN, 8MB) + //SET_PROTECTION_B(c1, HW_MAIN_MEM_MAIN, 8MB) + SET_PROTECTION_A(c1, HW_MAIN_MEM_MAIN, 32MB) + SET_PROTECTION_B(c1, HW_MAIN_MEM_MAIN, 32MB) + /* Size will be arranged in OS_InitArena(). */ + + /* (2) ARM7 専用メインメモリ空間 */ + SET_PROTECTION_A(c2, (HW_MAIN_MEM_EX_END - HW_MAIN_MEM_SHARED_SIZE - HW_MAIN_MEM_SUB_SIZE), 128KB) + SET_PROTECTION_B(c2, (HW_MAIN_MEM_EX_END - HW_MAIN_MEM_SHARED_SIZE - HW_MAIN_MEM_SUB_SIZE), 128KB) + /* Base address will be moved in OS_InitArena(). */ + + /* (3) カートリッジ */ + //SET_PROTECTION_A(c3, HW_CTRDG_ROM, 128MB) + //SET_PROTECTION_B(c3, HW_CTRDG_ROM, 128MB) + SET_PROTECTION_A(c3, HW_CTRDG_ROM, 32MB) + SET_PROTECTION_B(c3, HW_CTRDG_ROM, 32MB) + + /* (7) ARM9/ARM7 共有メインメモリ空間 */ + SET_PROTECTION_A(c7, HW_MAIN_MEM_SHARED, 4KB) + SET_PROTECTION_B(c7, HW_MAIN_MEM_SHARED, 4KB) + + /* 命令キャッシュ許可 */ + mov r0, #REGION_BIT(0, 1, 0, 0, 0, 0, 1, 0) + mcr p15, 0, r0, c2, c0, 1 + + /* データキャッシュ許可 */ + //mov r0, #REGION_BIT(0, 1, 0, 0, 0, 0, 1, 0) + mov r0, #REGION_BIT(0, 1, 0, 1, 0, 0, 1, 0) + mcr p15, 0, r0, c2, c0, 0 + + /* ライトバッファ許可 */ + //mov r0, #REGION_BIT(0, 1, 0, 0, 0, 0, 0, 0) + mov r0, #REGION_BIT(0, 1, 0, 1, 0, 0, 0, 0) + mcr p15, 0, r0, c3, c0, 0 + + /* 命令アクセス許可 */ + //ldr r0, =REGION_ACC(RW, RW, NA, NA, NA, RW, RO, NA) + ldr r0, =REGION_ACC(RW, RW, NA, RW, NA, RW, RO, NA) + mcr p15, 0, r0, c5, c0, 3 + + /* データアクセス許可 */ + ldr r0, =REGION_ACC(RW, RW, NA, RW, RW, RW, RO, RW) + mcr p15, 0, r0, c5, c0, 2 +#endif +@003: /* プロテクションユニット及びキャッシュ使用許可設定 */ + mrc p15, 0, r0, c1, c0, 0 + ldr r1, = HW_C1_ICACHE_ENABLE \ + | HW_C1_DCACHE_ENABLE \ + | HW_C1_CACHE_ROUND_ROBIN \ + | HW_C1_PROTECT_UNIT_ENABLE + orr r0, r0, r1 + mcr p15, 0, r0, c1, c0, 0 + + /* キャッシュの内容を破棄 */ + mov r1, #0 + mcr p15, 0, r1, c7, c6, 0 + mcr p15, 0, r1, c7, c5, 0 + + bx r12 +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。4M bytes を越える PSRAM メモリ空間 + に配置されるオートロードブロックの展開は、ハードウェアが TWL で + ある場合にだけ行う。オートロード元データとオートロード先が一部 + 重なる場合もあるので、後方から展開を行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* + * < 二段階オートロード > + * 0x02000000 に Static セグメント及び一段目ロード元バイナリが(必要に応じて後半が圧縮されて)配置されている。 + * 圧縮されている場合は、まず 0x02000000 に後方から上書きしつつ解凍する。 + * NITRO と共有可能な ITCM 上に配置されるべきバイナリデータを 0x01ff8000 にロードする。 + * NITRO と共有可能な DTCM 上に配置されるべきバイナリデータを 0x02fe0000 にロードする。 + * 0x02400000 に二段目ロード元バイナリが(必要に応じて全て圧縮されて)配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f80000 - 0x02f84000 に退避する。 + * 圧縮されている場合は、まず 0x02400000 に後方から上書きしつつ解凍する。 + * TWL でしか動作しない WRAM 上に配置されるべきバイナリデータをそれぞれ指定アドレスにロードする。 + * TWL でしか動作しないメインメモリ上に配置されるべきバイナリデータを前方からコピーすることでロードする。 + * これは、NITRO と共有可能なメインメモリ上に配置されるデータが 0x02400000 を越えないはずであるため、 + * 配置すべきアドレスは 0x02400000 より小さいアドレスになるはずである為。 + * また、オートロード情報リストの実体がメインメモリへのオートロードブロックの .bss セクションのクリアの過程で + * 破壊される可能性があるが、一連のオートロード処理の最後の段階なので、破壊されても問題ない。 + */ +static asm void +INITi_DoAutoload(void) +{ +@000: + stmdb sp!, {lr} + /* NITRO 共用ブロックの解凍 */ + ldr r1, =_start_ModuleParams + ldr r0, [r1, #20] // r0 = bottom of compressed data + bl MIi_UncompressBackward + +@010: + /* NITRO 共用ブロックをオートロード */ + ldr r1, =_start_ModuleParams + ldr r12, [r1] // r12 = SDK_AUTOLOAD_LIST + ldr r0, [r1, #4] // r0 = SDK_AUTOLOAD_LIST_END + ldr r1, [r1, #8] // r1 = SDK_AUTOLOAD_START +@011: cmp r12, r0 + bge @020 + /* 固定セクションをロード */ + stmdb sp!, {r0} + ldr r2, [r12], #4 // r2 = start address of destination range + stmdb sp!, {r2} + ldr r3, [r12], #4 // r3 = size of fixed section + add r3, r3, r2 // r3 = end address of destination range of fixed section +@012: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @012 + /* static initializer テーブル情報を読み出し */ + ldr r0, [r12], #4 // r0 = address of the table managing pointers of static initializers +#ifndef SDK_NOINIT + stmdb sp!, {r0-r3, r12} + bl INITi_ShelterStaticInitializer + ldmia sp!, {r0-r3, r12} +#endif + /* .bss セクションを 0 クリア */ + mov r0, #0 // r0 = number to fill .bss section + ldr r3, [r12], #4 // r3 = size of .bss section + add r3, r3, r2 // r3 = end address of destination range of .bss section +@013: cmp r2, r3 + strlt r0, [r2], #4 + blt @013 + /* キャッシュを調整 */ + ldmia sp!, {r2} // r2 = start address of destination range + mov r0, #HW_ITCM_IMAGE + cmp r2, r0 + movge r0, #HW_ITCM_END + cmpge r0, r2 + bgt @015 // If I-TCM autoload block, skip cache control logic. + ldr r0, =SDK_AUTOLOAD_DTCM_START + cmp r2, r0 + addge r0, r0, #HW_DTCM_SIZE + cmpge r0, r2 + bgt @015 // If D-TCM autoload block, skip cache control logic. + bic r2, r2, #HW_CACHE_LINE_SIZE - 1 // RoundDown32 +@014: cmp r2, r3 + bge @015 + mcr p15, 0, r2, c7, c14, 1 // Store and Invalidate D-Cache + mcr p15, 0, r2, c7, c5, 1 // Invalidate I-Cache + add r2, r2, #HW_CACHE_LINE_SIZE + b @014 +@015: ldmia sp!, {r0} + b @011 + +@020: + /* TWL ハードウェア上で動作しているかどうかを調査 */ +#if 0 + bl INITi_IsRunOnTwl + bne @030 +#endif + + /* TWL 専用ブロックの存在を確認 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + 0x1cc /* ARM9 用拡張常駐モジュール ROM サイズ */ + ldr r0, [r1] + cmp r0, #0 + beq @030 + + /* 再読み出し不可部分を退避 */ + bl INITi_ShelterLtdBinary + + /* TWL 専用ブロックの解凍 */ + ldr r1, =_start_LtdModuleParams + ldr r0, [r1, #12] + bl MIi_UncompressBackward + + /* TWL 専用ブロックをオートロード */ + ldr r1, =_start_LtdModuleParams + ldr r12, [r1] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r0, [r1, #4] // r0 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r1, #8] // r1 = SDK_LTDAUTOLOAD_START +@021: cmp r12, r0 + bge @030 + /* 固定セクションをロード */ + stmdb sp!, {r0} + ldr r2, [r12], #4 // r2 = start address of destination range + stmdb sp!, {r2} + ldr r3, [r12], #4 // r3 = size of fixed section + add r3, r3, r2 // r3 = end address of destination range of fixed section +@022: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @022 + /* static initializer テーブル情報を読み出し */ + ldr r0, [r12], #4 // r0 = address of the table managing pointers of static initializers +#ifndef SDK_NOINIT + stmdb sp!, {r0-r3, r12} + bl INITi_ShelterStaticInitializer + ldmia sp!, {r0-r3, r12} +#endif + /* .bss セクションを 0 クリア */ + mov r0, #0 // r0 = number to fill .bss section + ldr r3, [r12], #4 // r3 = size of .bss section + add r3, r3, r2 // r3 = end address of destination range of .bss section +@023: cmp r2, r3 + strlt r0, [r2], #4 + blt @023 + /* キャッシュを調整 */ + ldmia sp!, {r2} // r2 = start address of destination range + mov r0, #HW_ITCM_IMAGE + cmp r2, r0 + movge r0, #HW_ITCM_END + cmpge r0, r2 + bgt @025 // If I-TCM autoload block, skip cache control logic. + ldr r0, =SDK_AUTOLOAD_DTCM_START + cmp r2, r0 + addge r0, r0, #HW_DTCM_SIZE + cmpge r0, r2 + bgt @025 // If D-TCM autoload block, skip cache control logic. + bic r2, r2, #HW_CACHE_LINE_SIZE - 1 // RoundDown32 +@024: cmp r2, r3 + bge @025 + mcr p15, 0, r2, c7, c14, 1 // Store and Invalidate D-Cache + mcr p15, 0, r2, c7, c5, 1 // Invalidate I-Cache + add r2, r2, #HW_CACHE_LINE_SIZE + b @024 +@025: ldmia sp!, {r0} + b @021 + +@030: /* ライトバッファが空になるのを待つ */ + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 + + /* オートロード完了コールバック関数呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmia sp!, {lr} + b _start_AutoloadDoneCallback +} + +/*---------------------------------------------------------------------------* + Name: INITi_ShelterLtdBinary + Description: TWL 専用のオートロード元バイナリデータの内、カード ROM から + 再読み出しできない領域のデータを退避エリアに退避する。 + 再読み出しできない領域のデータは ARM7 用と ARM9 用の拡張常駐 + モジュールの2つに分かれている可能性があるので、冗長ではあるが + 両方の先頭から 0x4000 分をそれぞれ退避する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterLtdBinary(void) +{ + /* ARM7 専用メインメモリ空間保護リージョンを一旦アクセス可能に変更 */ + mrc p15, 0, r0, c5, c0, 3 + mrc p15, 0, r1, c5, c0, 2 + stmdb sp!, {r0, r1} + bic r0, r0, #(0xf << 8) + orr r0, r0, #(0x1 << 8) + bic r1, r1, #(0xf << 8) + orr r1, r1, #(0x1 << 8) + mcr p15, 0, r0, c5, c0, 3 + mcr p15, 0, r1, c5, c0, 2 + + /* 退避元・先アドレスを調査 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + 0x1c8 /* ARM9 用拡張常駐モジュール RAM アドレス */ + ldr r1, [r1] + ldr r3, =HW_TWL_ROM_HEADER_BUF + 0x038 /* ARM7 用常駐モジュール RAM アドレス */ + ldr r3, [r3] + sub r3, r3, #0x4000 /* 再読み出し不可領域サイズ */ /* ARM7 用退避エリア */ + sub r2, r3, #0x4000 /* 再読み出し不可領域サイズ */ /* ARM9 用退避エリア */ + + /* コピー */ +@loop: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @loop + + /* ARM7 専用メインメモリ空間保護リージョン設定を元に戻す */ + ldmia sp!, {r0, r1} + mcr p15, 0, r0, c5, c0, 3 + mcr p15, 0, r1, c5, c0, 2 + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部 (から 4 バイトずらした位置) + に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#ifndef SDK_NOINIT +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =SDK_AUTOLOAD_DTCM_START + add r1, r1, #HW_DTCM_SIZE + sub r1, r1, #HW_DTCM_SYSRV_SIZE + sub r1, r1, #HW_SVC_STACK_SIZE + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* 退避場所先頭から空き場所を調査 */ +@001: ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 + + /* 空き場所にテーブルをコピー */ +@002: ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部 (から 4 バイト + ずらした位置) に退避されている関数ポインタテーブルを一つずつ + 呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =SDK_AUTOLOAD_DTCM_START + add r1, r1, #HW_DTCM_SIZE + sub r1, r1, #HW_DTCM_SYSRV_SIZE + sub r1, r1, #HW_SVC_STACK_SIZE + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* テーブルに管理されているポインタを一つずつ呼び出し */ +@001: ldr r0, [r1] + cmp r0, #0 + beq @002 + stmdb sp!, {r1} + blx r0 + ldmia sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 + +@002: + ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: MIi_UncompressBackward + Description: Uncompress special archive for module compression. + Arguments: bottom = Bottom adrs of packed archive + 1 + bottom[-8..-6] = offset for top of compressed data + inp_top = bottom - bottom[-8..-6] + bottom[-5] = offset for bottom of compressed data + inp = bottom - bottom[-5] + bottom[-4..-1] = offset for bottom of original data + outp = bottom + bottom[-4..-1] + typedef struct + { + u32 bufferTop:24; + u32 compressBottom:8; + u32 originalBottom; + } CompFooter; + Returns: None. + *---------------------------------------------------------------------------*/ +asm void +MIi_UncompressBackward(register void* bottom) +{ +#define data r0 +#define inp_top r1 +#define outp r2 +#define inp r3 +#define outp_save r4 +#define flag r5 +#define count8 r6 +#define index r7 +#define len r12 + + cmp bottom, #0 + beq @exit + stmfd sp!, {r4-r7} + ldmdb bottom, {r1-r2} + add outp, bottom, outp + sub inp, bottom, inp_top, LSR #24 + bic inp_top, inp_top, #0xff000000 + sub inp_top, bottom, inp_top + mov outp_save, outp +@loop: + cmp inp, inp_top // exit if inp==inp_top + ble @end_loop + ldrb flag, [inp, #-1]! // r4 = compress_flag = *--inp + mov count8, #8 +@loop8: + subs count8, count8, #1 + blt @loop + tst flag, #0x80 + bne @blockcopy +@bytecopy: + ldrb data, [inp, #-1]! + strb data, [outp, #-1]! // Copy 1 byte + b @joinhere +@blockcopy: + ldrb len, [inp, #-1]! + ldrb index, [inp, #-1]! + orr index, index, len, LSL #8 + bic index, index, #0xf000 + add index, index, #0x0002 + add len, len, #0x0020 +@patterncopy: + ldrb data, [outp, index] + strb data, [outp, #-1]! + subs len, len, #0x0010 + bge @patterncopy + +@joinhere: + cmp inp, inp_top + mov flag, flag, LSL #1 + bgt @loop8 +@end_loop: + + // DC_FlushRange & IC_InvalidateRange + mov r0, #0 + bic inp, inp_top, #HW_CACHE_LINE_SIZE - 1 +@cacheflush: + mcr p15, 0, r0, c7, c10, 4 // wait writebuffer empty + mcr p15, 0, inp, c7, c5, 1 // ICache + mcr p15, 0, inp, c7, c14, 1 // DCache + add inp, inp, #HW_CACHE_LINE_SIZE + cmp inp, outp_save + blt @cacheflush + + ldmfd sp!, {r4-r7} +@exit bx lr +} + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: TwlStartUp + + Description: hook for user start up + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void TwlStartUp(void) +{ +} + +/*---------------------------------------------------------------------------* + Name: OSi_ReferSymbol + + Description: used by SDK_REFER_SYMBOL macro to avoid dead-strip. + + Arguments: symbol unused + + Returns: None. + *---------------------------------------------------------------------------*/ +void OSi_ReferSymbol(void *symbol) +{ +#pragma unused(symbol) +} + +#include diff --git a/build/libraries/init/Makefile b/build/libraries/init/Makefile new file mode 100644 index 00000000..18137ffb --- /dev/null +++ b/build/libraries/init/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - init +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 \ + ARM7 \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/init/common/crt0_jtag.c b/build/libraries/init/common/crt0_jtag.c new file mode 100644 index 00000000..b65eec15 --- /dev/null +++ b/build/libraries/init/common/crt0_jtag.c @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - init + File: crt0_jtag.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 + +void _start(void); + +void* const _start_ModuleParams[]; +void* const _start_LtdModuleParams[]; + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +void _start( void ); + +asm void _start( void ) +{ +#ifdef SDK_ARM7 + ldr r3, =REG_JTAG_ADDR + ldr r0, =REG_SCFG_JTAG_DSPJE_MASK | REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK + strh r0, [r3] +#endif + +@10: + b @10 + + // link for compstatic.TWL + ldr r0, =_start_ModuleParams + ldr r0, =_start_LtdModuleParams +} + +#include diff --git a/build/libraries/mi/ARM9/Makefile b/build/libraries/mi/ARM9/Makefile new file mode 100644 index 00000000..6a59de28 --- /dev/null +++ b/build/libraries/mi/ARM9/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - mi +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +TARGET_CODEGEN_ALL ?= TRUE + +SRCDIR = . ../common + +SRCS = \ + mi_init_mainMemory.c \ + +TARGET_LIB = libmi$(FIRM_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/mi/ARM9/mi_init_mainMemory.c b/build/libraries/mi/ARM9/mi_init_mainMemory.c new file mode 100644 index 00000000..57986e6a --- /dev/null +++ b/build/libraries/mi/ARM9/mi_init_mainMemory.c @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - mi + File: mi_init_mainMemory.c + + Copyright 2007 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 + +void MIi_InitMainMemCRCore( void ); + +/*---------------------------------------------------------------------------* + Name: MIi_IsMainMemoryInitialized + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL MIi_IsMainMemoryInitialized( void ) +{ + return (BOOL)((reg_MI_EXMEMCNT & REG_MI_EXMEMCNT_CE2_MASK) >> REG_MI_EXMEMCNT_CE2_SHIFT); +} + +/*---------------------------------------------------------------------------* + Name: MIi_WaitMainMemoryInitialize + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_WaitMainMemoryInitialize( void ) +{ + while( MIi_IsMainMemoryInitialized() == FALSE ) + { + } +} + + +/*---------------------------------------------------------------------------* + Name: MIi_InitMainMemCR + + Description: change mainmem into the burst mode + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +#include + +asm void MIi_InitMainMemCR( BOOL setCR ) +{ + mov r12, lr + + mov r2, r0 + + mov r0, #0x8000 // low period 0.97ms + bl OS_SpinWaitCpuCycles + + ldr r3, =REG_EXMEMCNT_ADDR + mov r1, #REG_MI_EXMEMCNT_CE2_MASK + ldrh r0, [r3] + tst r0, r1 + bxne r12 + + strh r1, [r3] + + mov r0, #0x8000 // high period 0.97ms + bl OS_SpinWaitCpuCycles + + cmp r2, #FALSE + beq @10 + + // メインメモリが同期モード時(ハードリセット時)に + // 非同期モード(CLK固定)でコマンド発行しても大丈夫 + ldr r3, =HW_TWL_MAIN_MEM_END - 2 + bl MIi_InitMainMemCRCore +#ifdef SDK_TS + ldr r3, =HW_TWL_MAIN_MEM_EX_END - 2 + bl MIi_InitMainMemCRCore +#endif // SDK_TS + +@10: + ldr r3, =REG_EXMEMCNT_ADDR + ldr r1, = (1 << REG_MI_EXMEMCNT_IFM_SHIFT) | \ + (1 << REG_MI_EXMEMCNT_CE2_SHIFT) | \ + (MI_PROCESSOR_ARM7 << REG_MI_EXMEMCNT_EP_SHIFT) | \ + (MI_PROCESSOR_ARM7 << REG_MI_EXMEMCNT_MPA_SHIFT) | \ + (MI_PROCESSOR_ARM7 << REG_MI_EXMEMCNT_MPB_SHIFT) | \ + (MI_PROCESSOR_ARM7 << REG_MI_EXMEMCNT_CP_SHIFT) | \ + (MIi_PHI_CLOCK_LOW << REG_MI_EXMEMCNT_PHI_SHIFT) | \ + (MI_CTRDG_ROMCYCLE1_18 << REG_MI_EXMEMCNT_ROM1st_SHIFT) | \ + (MI_CTRDG_ROMCYCLE2_6 << REG_MI_EXMEMCNT_ROM2nd_SHIFT) | \ + (MI_CTRDG_RAMCYCLE_10 << REG_MI_EXMEMCNT_RAM_SHIFT) + strh r1, [r3] + + mov r0, #0x1000 // 0.12ms + bl OS_SpinWaitCpuCycles + + // 同期モードでコマンド再発行 + ldr r3, =HW_TWL_MAIN_MEM_END - 2 + bl MIi_InitMainMemCRCore +#ifdef SDK_TS + ldr r3, =HW_TWL_MAIN_MEM_EX_END - 2 + bl MIi_InitMainMemCRCore +#endif // SDK_TS + + bx r12 +} + +asm void MIi_InitMainMemCRCore( void ) +{ +// stmfd sp!, { lr } + +#ifdef TWL_PLATFORM_BB + mov r2, lr + ldr r0, =MMEM_DCR0_BURST_MODE | MMEM_DCR0_BURST_CONTINUOUS \ + | MMEM_DCR0_PARTIAL_REFRESH_NONE | MMEM_DCR0_SB1 + ldr r1, =MMEM_DCR1_1ST_R4_W3 | MMEM_DCR1_BURST_WRITE | MMEM_DCR1_BURST_LINER \ + | MMEM_DCR1_CLOCK_TRIGGER_UP | MMEM_DCR1_SB1 + ldrh lr, [r3] + strh lr, [r3] + strh lr, [r3] + mov lr, r2 + ldr r2, =HW_MAIN_MEM | MMEM_DCR2_CLOCK_TRIGGER_UP \ + | MMEM_DCR2_BURST_MODE | MMEM_DCR2_BURST_CONTINUOUS \ + | MMEM_DCR2_1ST_R4_W3 | MMEM_DCR2_BURST_WRITE | MMEM_DCR2_BURST_LINER \ + | MMEM_DCR2_PARTIAL_REFRESH_NONE | MMEM_DCR2_SB1 + strh r0, [r3] + strh r1, [r3] + ldrh r3, [r2] +#else // SDK_TS + mov r2, lr + ldr r0, =MMEM_TCR0 + ldr r1, =MMEM_TCR1 + ldrh lr, [r3] + strh lr, [r3] + strh lr, [r3] + mov lr, r2 + ldr r2, =MMEM_TCR2 + strh r0, [r3] + strh r1, [r3] + strh r2, [r3] +#endif // SDK_TS + +// ldmfd sp!, { lr } + bx lr +} + +asm void MIi_GetMainMemCR( MIMmemCR* dest ) +{ +#ifdef SDK_TS + ldr r3, =HW_WRAM_AREA - 2 + ldr r1, =MMEM_TCR0_R + ldrh r2, [r3] + strh r2, [r3] + strh r2, [r3] + strh r1, [r3] + ldrh r1, [r3] + ldrh r2, [r3] + strh r2, [r0, #4] + strh r1, [r0, #2] + ldr r1, =MMEM_TCR0_R + strh r1, [r0, #0] +#endif // SDK_TS + + bx lr +} \ No newline at end of file diff --git a/build/libraries/mi/Makefile b/build/libraries/mi/Makefile new file mode 100644 index 00000000..a439cbf6 --- /dev/null +++ b/build/libraries/mi/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - mi +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/nvram/ARM7/Makefile b/build/libraries/nvram/ARM7/Makefile new file mode 100644 index 00000000..39f2f275 --- /dev/null +++ b/build/libraries/nvram/ARM7/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - spi +# File: Makefile +# +# Copyright 2003 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +TWL_PROC = ARM7 + +SRCDIR = . ../common +SRCS = \ + nvram_misc.c \ + +TARGET_LIB = libnvram_sp$(FIRM_LIBSUFFIX).a +INCDIR = ../include +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include ../common/include + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/nvram/ARM7/nvram_misc.c b/build/libraries/nvram/ARM7/nvram_misc.c new file mode 100644 index 00000000..2141bc63 --- /dev/null +++ b/build/libraries/nvram/ARM7/nvram_misc.c @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------* + Project: TwlBromSDK - libraries - + File: nvram_misc.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include +#include "spi_sp.h" +#include "nvram_sp.h" + +/*---------------------------------------------------------------------------* + Name: NvramCheckReadyToRead + + Description: NVRAMを読み出し可能な状態かどうか確認する。 + + Arguments: None. + + Returns: BOOL - 読み出し可能な状態の場合にTRUEを返す。 + FALSEの場合は読み出し禁止の状態。 + *---------------------------------------------------------------------------*/ +static BOOL NvramCheckReadyToRead(void) +{ + u16 tempStatus; + + // ステータスレジスタ読み出し + NVRAM_ReadStatusRegister((u8 *)(&tempStatus)); + // 書き込みもしくは消去操作中かを確認 + if (tempStatus & NVRAM_STATUS_REGISTER_WIP) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NvramCheckReadyToWrite + + Description: NVRAMを書き込み可能な状態かどうか確認する。 + + Arguments: None. + + Returns: BOOL - 書き込み可能な状態の場合にTRUEを返す。 + FALSEの場合は書き込み禁止の状態。 + *---------------------------------------------------------------------------*/ +static BOOL NvramCheckReadyToWrite(void) +{ + u16 tempStatus; + + // ステータスレジスタ読み出し + NVRAM_ReadStatusRegister((u8 *)(&tempStatus)); + // 書き込みもしくは消去操作中かを確認 + if (tempStatus & NVRAM_STATUS_REGISTER_WIP) + { + return FALSE; + } + // 書き込み許可されているかを確認 + if (!(tempStatus & NVRAM_STATUS_REGISTER_WEL)) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NVRAM_WaitOperation + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void NVRAM_WaitOperation(void) +{ + while( NvramCheckReadyToRead() == FALSE ) { + } +} + +/*---------------------------------------------------------------------------* + Name: NVRAM_WaitWriteEnable + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void NVRAM_WaitWriteEnable(void) +{ + while( NvramCheckReadyToWrite() == FALSE ) { + } +} + + +/*---------------------------------------------------------------------------* + Name: NVRAMi_Read + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void NVRAMi_Read(u32 address, void *buf, u32 size) +{ + NVRAM_WaitOperation(); + NVRAM_ReadDataBytes(address, size, buf); + return; +} + + +/*---------------------------------------------------------------------------* + Name: NVRAMi_Write + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void NVRAMi_Write(u32 address, void *buf, u32 size) +{ + u32 i; + u32 page_start; + u32 page_end; + u32 offset_start; + u32 offset_end; + u8 *src_ptr; + u8 temp_buffer[SPI_NVRAM_PAGE_SIZE]; + + src_ptr = (u8 *)buf; + page_start = (address / SPI_NVRAM_PAGE_SIZE) * SPI_NVRAM_PAGE_SIZE; + page_end = ((address+size-1) / SPI_NVRAM_PAGE_SIZE ) * SPI_NVRAM_PAGE_SIZE; + offset_start = address % SPI_NVRAM_PAGE_SIZE; + offset_end = (address+size-1) % SPI_NVRAM_PAGE_SIZE; + + while( page_start <= page_end ) { + if( offset_start != 0 ) { + NVRAMi_Read(page_start, temp_buffer, offset_start); + } + if( page_start != page_end ) { + for( i = offset_start ; i < SPI_NVRAM_PAGE_SIZE ; i++ ) { + temp_buffer[i] = *src_ptr++; + } + } + else { + for( i = offset_start ; i <= offset_end ; i++ ) { + temp_buffer[i] = *src_ptr++; + } + if( offset_end != (SPI_NVRAM_PAGE_SIZE-1) ) { + NVRAMi_Read(page_start+offset_end+1, &(temp_buffer[offset_end+1]), SPI_NVRAM_PAGE_SIZE - (offset_end+1) ); + } + } + + NVRAM_WriteEnable(); + NVRAM_WaitWriteEnable(); + + NVRAM_PageErase((u32)page_start); + + NVRAM_WaitOperation(); + + NVRAM_WriteEnable(); + + NVRAM_PageWrite((u32)page_start, (u16)SPI_NVRAM_PAGE_SIZE, temp_buffer); + NVRAM_WaitOperation(); + + page_start += SPI_NVRAM_PAGE_SIZE; + offset_start = 0; + } +} diff --git a/build/libraries/nvram/Makefile b/build/libraries/nvram/Makefile new file mode 100644 index 00000000..f7829b79 --- /dev/null +++ b/build/libraries/nvram/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - nvram +# File: Makefile +# +# 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM7 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/os/ARM7/Makefile b/build/libraries/os/ARM7/Makefile new file mode 100644 index 00000000..afb4df5f --- /dev/null +++ b/build/libraries/os/ARM7/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries_sp - os +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +# Codegen for sub processer +TWL_PROC = ARM7 + +SRCDIR = ../common . +INCDIR = ./include ../common/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 \ + +SRCS = \ + os_init_firm.c \ + os_boot.c \ + +TARGET_LIB = libos_sp$(FIRM_LIBSUFFIX).a + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/os/ARM9/Makefile b/build/libraries/os/ARM9/Makefile new file mode 100644 index 00000000..6c53b800 --- /dev/null +++ b/build/libraries/os/ARM9/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - os +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +TARGET_CODEGEN_ALL ?= TRUE + +SRCDIR = ../common . + +SRCS = \ + os_init_firm.c \ + os_boot.c \ + +TARGET_LIB = libos$(FIRM_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/os/ARM9/os_cache_tag.c b/build/libraries/os/ARM9/os_cache_tag.c new file mode 100644 index 00000000..cb16308a --- /dev/null +++ b/build/libraries/os/ARM9/os_cache_tag.c @@ -0,0 +1,269 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS + File: os_cache_tag.c + + Copyright 2007 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 + + +//=========================================================================== +// DATA CACHE (for specified range) +//=========================================================================== +/*---------------------------------------------------------------------------* + Name: DC_ClearTagAll + + Description: clear tag in data cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_ClearTagAll( void ) +{ + DC_FillTagAll( 0 ); +} + +/*---------------------------------------------------------------------------* + Name: DC_FillTagAll + + Description: clear tag in data cache + + Arguments: data : fill data + + Returns: None. + *---------------------------------------------------------------------------*/ +asm void DC_FillTagAll( u32 data ) +{ + mov r12, #0 +@1: + mov r2, #0 +@2: + orr r3, r2, r12 + mcr p15, 3, r3, c15, c0, 0 // set index + mcr p15, 3, r0, c15, c2, 0 // clear tag + add r2, r2, #HW_CACHE_LINE_SIZE + cmp r2, #HW_DCACHE_SIZE/4 + blt @2 + + add r12, r12, #1< diff --git a/build/libraries/os/Makefile b/build/libraries/os/Makefile new file mode 100644 index 00000000..a2045b3d --- /dev/null +++ b/build/libraries/os/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - os +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 \ + ARM7 \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/os/common/os_boot.c b/build/libraries/os/common/os_boot.c new file mode 100644 index 00000000..1092db90 --- /dev/null +++ b/build/libraries/os/common/os_boot.c @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS + File: os_boot.c + + Copyright 2007 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 "reboot.h" + +extern void SDK_STATIC_START(void); // static and bss start address +extern void SDK_STATIC_BSS_END(void); // static and bss end address + +/*---------------------------------------------------------------------------* + Name: OS_BootWithRomHeaderFromFIRM + + Description: boot with ROM header + + Arguments: rom_header : ROM header + + Returns: None + *---------------------------------------------------------------------------*/ +void OS_BootWithRomHeaderFromFIRM( ROM_Header* rom_header ) +{ +#ifdef SDK_ARM9 + void *entry = rom_header->s.main_entry_address; + void *const code_buf = (void*)OS_BOOT_CODE_BUF; // 0x023fee00 + void *const stack_top = (void*)OS_BOOT_STACK_TOP; // (HW_DTCM_END - HW_DTCM_SYSRV_SIZE - HW_SVC_STACK_SIZE) +#else + void *entry = rom_header->s.sub_entry_address; + void *const code_buf = (void*)OS_BOOT_CODE_BUF; // 0x03fff600 + void *const stack_top = (void*)OS_BOOT_STACK_TOP; // (HW_WRAM_AREA_END - HW_PRV_WRAM_SYSRV_SIZE - HW_SVC_STACK_SIZE) +#endif + void *const wram_reg = rom_header->s.main_wram_config_data; + REBOOTTarget target = rom_header->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ? REBOOT_TARGET_TWL_SECURE : (rom_header->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK ? REBOOT_TARGET_TWL_SYSTEM : REBOOT_TARGET_TWL_APP); + BOOL scfg = TRUE; // no touch + BOOL set_jtag = FALSE; // no touch + BOOL forbid_jtag = FALSE; // no touch + BOOL psram_4mb = FALSE; // no touch + static u32 mem_list[32]; + int i = 0; + +#ifdef SDK_ARM9 + // 無線ファームパラメータのコピー元アドレスの設定 + *(u32 *)HW_PRELOAD_PARAMETER_ADDR = HW_PARAM_TWL_SETTINGS_DATA_DEFAULT; +#endif + + // pre clear + /* 自身の static & bss のクリア */ + mem_list[i++] = (u32)SDK_STATIC_START; + mem_list[i++] = (u32)SDK_STATIC_BSS_END-(u32)SDK_STATIC_START; +#ifdef SDK_ARM9 + /* ITCM全クリア (FromFrimを除く) */ + mem_list[i++] = HW_ITCM; + mem_list[i++] = HW_FIRM_FROM_FIRM_BUF - HW_ITCM; + mem_list[i++] = HW_FIRM_FROM_FIRM_BUF_END; + mem_list[i++] = HW_ITCM_END - HW_FIRM_FROM_FIRM_BUF_END; + /* FS/FATFSバッファのクリア */ + mem_list[i++] = (u32)HW_FIRM_FATFS_COMMAND_BUFFER; // 0x02ff7800 - 0x02ffbfff + mem_list[i++] = (u32)HW_FIRM_FS_TEMP_BUFFER_END - (u32)HW_FIRM_FATFS_COMMAND_BUFFER; + /* 一部鍵バッファのクリア (鍵管理.xls参照) */ + mem_list[i++] = (u32)OSi_GetFromFirmAddr()->rsa_pubkey[0]; + mem_list[i++] = ACS_PUBKEY_LEN; +#else // SDK_ARM7 + /* FS_Loader用バッファのクリア */ + mem_list[i++] = HW_FIRM_LOAD_BUFFER_BASE; + mem_list[i++] = HW_FIRM_LOAD_BUFFER_UNIT_SIZE * HW_FIRM_LOAD_BUFFER_UNIT_NUMS; + { /* REBOOT_ExecuteのCODEとSTACKの隙間をクリア */ + u32 stack_bottom = (u32)stack_top - OS_BOOT_STACK_SIZE_MIN - sizeof(mem_list); + u32 code_buf_end = OS_BOOT_CODE_BUF + OS_BOOT_CODE_SIZE; + SDK_ASSERT( stack_bottom > code_buf_end ); + mem_list[i++] = code_buf_end; + mem_list[i++] = stack_bottom - code_buf_end; + } + /* 一部鍵バッファのクリア (鍵管理.xls参照) */ + mem_list[i++] = (u32)OSi_GetFromFirmAddr()->aes_key[2]; + mem_list[i++] = ACS_AES_LEN; +#endif // SDK_ARM7 + mem_list[i++] = NULL; + // copy forward +#ifdef SDK_ARM7 + // MountInfo (移動する?) + mem_list[i++] = HW_TWL_FS_MOUNT_INFO_BUF; + mem_list[i++] = (u32)rom_header->s.sub_mount_info_ram_address; + mem_list[i++] = HW_FIRM_FS_MOUNT_INFO_BUF_SIZE; + // srlファイル名 + mem_list[i++] = HW_TWL_FS_BOOT_SRL_PATH_BUF; + mem_list[i++] = (u32)rom_header->s.sub_mount_info_ram_address + HW_FIRM_FS_MOUNT_INFO_BUF_SIZE; + mem_list[i++] = HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE; +#endif + mem_list[i++] = NULL; + // copy backward + mem_list[i++] = NULL; + // post clear +#ifdef SDK_ARM7 + // MountInfo (移動する?) + mem_list[i++] = HW_TWL_FS_MOUNT_INFO_BUF; + mem_list[i++] = HW_FIRM_FS_MOUNT_INFO_BUF_SIZE; + // srlファイル名 + mem_list[i++] = HW_TWL_FS_BOOT_SRL_PATH_BUF; + mem_list[i++] = HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE; +#endif + mem_list[i++] = NULL; + SDK_ASSERT(i <= sizeof(mem_list)/sizeof(mem_list[0])); +#ifndef FIRM_USE_PRODUCT_KEYS + // 開発鍵を使っている時は量産用CPUではブートしない +#ifdef SDK_ARM9 + if ( ! (*(u8*)OS_CHIPTYPE_DEBUGGER_ADDR & OS_CHIPTYPE_DEBUGGER_MASK) ) +#else // SDK_ARM7 + if ( ! (*(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK) ) +#endif // SDK_ARM7 +#else // !FIRM_USE_PRODUCT_KEYS + // 量産鍵を使っている時は開発用CPUではブートしない +#ifdef SDK_ARM9 + if ( *(u8*)OS_CHIPTYPE_DEBUGGER_ADDR & OS_CHIPTYPE_DEBUGGER_MASK ) +#else // SDK_ARM7 + if ( *(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK ) +#endif // SDK_ARM7 +#endif // !FIRM_USE_PRODUCT_KEYS + { + OS_Terminate(); + } + REBOOT_Execute(entry, wram_reg, mem_list, code_buf, stack_top, target, scfg, set_jtag, forbid_jtag, psram_4mb); + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: OSi_FromBromToMenu + + Description: convert OSFromBromBuf to OSFromFirmBuf + + Arguments: None + + Returns: FALSE if FromBrom is broken + *---------------------------------------------------------------------------*/ +BOOL OSi_FromBromToMenu( void ) +{ + OSFromBromBuf* const fromBromBuf = OSi_GetFromBromAddr(); + BOOL result = TRUE; + int i; + // check offset (why not to omit by compiler?) + if ( OSi_GetFromFirmAddr()->rsa_pubkey != fromBromBuf->rsa_pubkey ) // same area without header + { + result = FALSE; + } + // check unused signature area + for (i = 0; i < sizeof(fromBromBuf->hash_table_hash); i++) // check all values are same + { + if (fromBromBuf->hash_table_hash[i] != 0x00) + { + result = FALSE; + } + } + // clear out of OSFromFirmBuf area + MI_CpuClearFast( fromBromBuf->header.max, sizeof(fromBromBuf->header.max) ); +#ifdef SDK_ARM7 + MI_CpuCopyFast( &fromBromBuf->SDNandContext, (void*)HW_SD_NAND_CONTEXT_BUF, sizeof(SDPortContextData) ); + MI_CpuClearFast( &fromBromBuf->SDNandContext, sizeof(SDPortContextData) ); +#endif + return result; +} diff --git a/build/libraries/os/common/os_init_firm.c b/build/libraries/os/common/os_init_firm.c new file mode 100644 index 00000000..3e2763a6 --- /dev/null +++ b/build/libraries/os/common/os_init_firm.c @@ -0,0 +1,190 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS + File: os_init_firm.c + + Copyright 2007 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 + +/*---------------------------------------------------------------------------* + Name: OS_InitNOR + + Description: initialize sdk os for firm + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +#pragma profile off +void OS_InitFIRM(void) +{ +#ifdef SDK_ARM9 + //---- system shared area check +// SDK_ASSERT((u32)&(OS_GetSystemWork()->command_area) == HW_CMD_AREA); + + //---------------------------------------------------------------- + // for ARM9 + +#ifdef SDK_ENABLE_ARM7_PRINT + // Init PrintServer for ARM7 (if specified) +// OS_InitPrintServer(); +#endif + + //---- Init interProcessor I/F + // Sync with ARM7 to enable OS_GetConsoleType() + // PXI_Init() must be called before OS_InitArenaEx() + //PXI_Init(); + //PXI_InitFifoFIRM(); + PXI_InitFIRM(); + + //---- Init Arena (arenas except SUBPRIV-WRAM) + OS_InitArena(); + + //---- Init Spinlock + OS_InitLock(); + + //---- Init Arena (extended main) + OS_InitArenaEx(); + + //---- Init IRQ Table + OS_InitIrqTable(); + + //---- Init IRQ Stack checker + OS_SetIrqStackChecker(); + + //---- Init Exception System +// OS_InitException(); + + //---- Init MI (Wram bank and DMA0 arranged) + MI_Init(); + + //---- Init VCountAlarm + OS_InitVAlarm(); + + //---- Init VRAM exclusive System + OSi_InitVramExclusive(); + + //---- Init Thread System +#ifndef SDK_NO_THREAD + OS_InitThread(); +#endif + //---- Init Reset System +#ifndef SDK_SMALL_BUILD +// OS_InitReset(); +#endif + + //---- Init Cartridge +#ifndef SDK_TEG +// CTRDG_Init(); +#endif + + //---- Init Card +#ifndef SDK_SMALL_BUILD +// CARD_Init(); +#endif + + //---- init System config +#ifdef SDK_TWL +// if (OS_IsRunOnTwl() == TRUE) +// { + SCFG_Init(); +// } +#endif + + //---- Init Power Manager +#ifndef SDK_TEG +// PM_Init(); +#endif + + //---- adjust VCOUNT +// OSi_WaitVCount0(); + +#else // SDK_ARM9 + //---------------------------------------------------------------- + // for ARM7 + + //---- Init interProcessor I/F + //PXI_Init(); + //PXI_InitFifoFIRM(); + PXI_InitFIRM(); + + //---- Init Arena (SUBPRIV-WRAM arena) + OS_InitArena(); + + //---- Init Spinlock + OS_InitLock(); + + //---- Init IRQ Table + OS_InitIrqTable(); + +#define SDK_EXCEPTION_BUG +#ifndef SDK_EXCEPTION_BUG + //---- Init Exception System + OS_InitException(); +#endif + + //---- Init MI +#ifdef SDK_TWL + MI_Init(); +#endif + + //---- Init Tick + OS_InitTick(); + + //---- Init Alarm System + OS_InitAlarm(); + + //---- Init Thread System + OS_InitThread(); + + //---- Init Reset System +#ifndef SDK_SMALL_BUILD +// OS_InitReset(); +#endif + + //---- Init Cartridge +#ifndef SDK_TEG +// CTRDG_Init(); +#endif + + //---- init System config +#ifdef SDK_TWL +// if (OS_IsRunOnTwl() == TRUE) +// { + SCFG_Init(); +// } +#endif + +#endif // SDK_ARM9 + +#ifndef FIRM_USE_PRODUCT_KEYS + // 開発鍵を使っている時は量産用CPUでは起動しない +#ifdef SDK_ARM9 + if ( ! (*(u8*)OS_CHIPTYPE_DEBUGGER_ADDR & OS_CHIPTYPE_DEBUGGER_MASK) ) +#else // SDK_ARM7 + if ( ! (*(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK) ) +#endif // SDK_ARM7 +#else // !FIRM_USE_PRODUCT_KEYS + // 量産鍵を使っている時は開発用CPUでは起動しない +#ifdef SDK_ARM9 + if ( *(u8*)OS_CHIPTYPE_DEBUGGER_ADDR & OS_CHIPTYPE_DEBUGGER_MASK ) +#else // SDK_ARM7 + if ( *(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK ) +#endif // SDK_ARM7 +#endif // !FIRM_USE_PRODUCT_KEYS + { + OS_Terminate(); + } +} + +#pragma profile reset diff --git a/build/libraries/pm/ARM7/Makefile b/build/libraries/pm/ARM7/Makefile new file mode 100644 index 00000000..22959011 --- /dev/null +++ b/build/libraries/pm/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - pm +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +# Codegen for sub processer +TWL_PROC = ARM7 + +INCDIR = $(ROOT)/build/libraries/spi/ARM7/pm/include \ + +SRCDIR = . + +SRCS = \ + pm_init.c \ + pm_pmic_ex.c \ + +TARGET_LIB = libpm_sp$(FIRM_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/pm/ARM7/pm_init.c b/build/libraries/pm/ARM7/pm_init.c new file mode 100644 index 00000000..e3b6431d --- /dev/null +++ b/build/libraries/pm/ARM7/pm_init.c @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - pm + File: pm_init.c + + Copyright 2007 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 + +/*---------------------------------------------------------------------------* + Name: PM_InitFIRM + + Description: set default parameters + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_InitFIRM( void ) +{ +#if SDK_TS_VERSION < 300 + // LED + PMi_ResetFlags( REG_PMIC_LED_CTL_ADDR, PMIC_LED_CTL_AUTO_BLINK | PMIC_LED_CTL_BLINK_BY_SLEEP ); + PMi_SetParams( REG_PMIC_LVL4_BRT_ADDR, + PMIC_LED_1_BRT_LEVEL_4_OFF | PMIC_LED_2_BRT_LEVEL_4_OFF, + PMIC_LVL4_BRT_LED_1_MASK | PMIC_LVL4_BRT_LED_2_MASK + ); + PMi_SetParams( REG_PMIC_LVL3_BRT_ADDR, + PMIC_LED_1_BRT_LEVEL_3_100 | PMIC_LED_2_BRT_LEVEL_3_OFF, + PMIC_LVL3_BRT_LED_1_MASK | PMIC_LVL3_BRT_LED_2_MASK + ); + PMi_SetParams( REG_PMIC_LVL2_BRT_ADDR, + PMIC_LED_1_BRT_LEVEL_2_OFF | PMIC_LED_1_BRT_LEVEL_2_100, + PMIC_LVL2_BRT_LED_1_MASK | PMIC_LVL2_BRT_LED_2_MASK + ); + PMi_SetParams( REG_PMIC_LVL1_BRT_ADDR, + PMIC_LED_1_BRT_LEVEL_1_100 | PMIC_LED_2_BRT_LEVEL_1_100, + PMIC_LVL1_BRT_LED_1_MASK | PMIC_LVL1_BRT_LED_2_MASK + ); + + // correct battery LED curve + PMi_SetFlags( REG_PMIC_VLBAT_CTL_ADDR, PMIC_VLBAT_CTL_VLBAT_2_ACTIVE | PMIC_VLBAT_CTL_VLBAT_3_ACTIVE ); + + // LCD ON + PMi_SetFlags( REG_PMIC_CTL2_ADDR, PMIC_CTL2_VDD50 ); + + // back light level does not set +#endif +} + +/*---------------------------------------------------------------------------* + Name: PM_BackLightOn + + Description: power B/L on if not set yet + + Arguments: force TRUE: wait until valid condition + FALSE not set unless valid condition + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_BackLightOn( BOOL force ) +{ + static BOOL doneBackLight = FALSE; + + if ( doneBackLight ) + { + return; // have already set + } + if ( force ) + { + while ( (reg_GX_DISPSTAT & REG_GX_DISPSTAT_INI_MASK) == FALSE ) + { + } + } + if ( reg_GX_DISPSTAT & REG_GX_DISPSTAT_INI_MASK ) + { + PMi_SetFlags( REG_PMIC_CTL_ADDR, PMIC_CTL_BKLT1 | PMIC_CTL_BKLT2 ); + doneBackLight = TRUE; + } +} + +/*---------------------------------------------------------------------------* + Name: PM_Shutdown + + Description: shutdown + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_Shutdown( void ) +{ + PMi_SetFlags( REG_PMIC_CTL_ADDR, PMIC_CTL_PWR_OFF ); +} diff --git a/build/libraries/pm/ARM7/pm_pmic_ex.c b/build/libraries/pm/ARM7/pm_pmic_ex.c new file mode 100644 index 00000000..5932fa03 --- /dev/null +++ b/build/libraries/pm/ARM7/pm_pmic_ex.c @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - pm + File: pm_pmic_ex.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +//================================================================================ +// PMIC BIT CONTROL +//================================================================================ +/*---------------------------------------------------------------------------* + Name: PMi_SetParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetParams( u8 reg, u8 setBits, u8 maskBits ) +{ + u8 tmp; + tmp = PMi_GetRegister( reg ); + tmp &= ~maskBits; + setBits &= maskBits; + tmp |= setBits; + PMi_SetRegister( reg, tmp ); +} + +/*---------------------------------------------------------------------------* + Name: PMi_SetFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetFlags( u8 reg, u8 setBits ) +{ + PMi_SetParams( reg, setBits, setBits ); +} + +/*---------------------------------------------------------------------------* + Name: PMi_ResetFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_ResetFlags( u8 reg, u8 clrBits ) +{ + PMi_SetParams( reg, 0, clrBits ); +} + diff --git a/build/libraries/pm/Makefile b/build/libraries/pm/Makefile new file mode 100644 index 00000000..f9636f04 --- /dev/null +++ b/build/libraries/pm/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - libraries - pm +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM7 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/pxi/ARM7/Makefile b/build/libraries/pxi/ARM7/Makefile new file mode 100644 index 00000000..fb82a1e3 --- /dev/null +++ b/build/libraries/pxi/ARM7/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries_sp - pxi +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +override TWL_CODEGEN = ALL + +# Codegen for sub processer +TWL_PROC = ARM7 + +SRCDIR = ../common . + +SRCS = \ + pxi_firm.c +# pxi_misc.c \ + +TARGET_LIB = libpxi_sp$(FIRM_LIBSUFFIX).a + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/pxi/ARM9/Makefile b/build/libraries/pxi/ARM9/Makefile new file mode 100644 index 00000000..208491d2 --- /dev/null +++ b/build/libraries/pxi/ARM9/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - pxi +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +TARGET_CODEGEN_ALL ?= TRUE + +SRCDIR = ../common . + +SRCS = \ + pxi_firm.c +# pxi_misc.c \ + +TARGET_LIB = libpxi$(FIRM_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(FIRM_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries/pxi/Makefile b/build/libraries/pxi/Makefile new file mode 100644 index 00000000..2dbcba07 --- /dev/null +++ b/build/libraries/pxi/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - libraries - pxi +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 \ + ARM7 \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/pxi/common/pxi_firm.c b/build/libraries/pxi/common/pxi_firm.c new file mode 100644 index 00000000..156662b2 --- /dev/null +++ b/build/libraries/pxi/common/pxi_firm.c @@ -0,0 +1,331 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - library - pxi + File: pxi_firm.c + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include +#include + +#define PXI_FIRM_ID_MAX 8 +#define PXI_FIRM_STREAM_MAX 16 + +typedef struct +{ + u32 wp; + u32 rp; + + u8 id[PXI_FIRM_ID_MAX]; + + u32 semaphore; // for fs_loader.c + + u32 length; + u32 current; + u8 data[PXI_FIRM_STREAM_MAX]; +} +PxiWork; +static PxiWork work; + +static void PxiFirmStreamCallback( PXIFifoTag tag, u32 data, BOOL err ) +{ + (void)tag; + (void)err; + if ( !work.length ) // stream is starting + { + if ( data > PXI_FIRM_STREAM_MAX ) + { + OS_TPrintf("Receiving stream has too large size (%d > %d).\n", data, PXI_FIRM_STREAM_MAX); + } + work.length = data; + work.current = 0; + } + else if ( work.current < work.length ) // stream is cotinuous + { + int i; + u8* ptr = (u8*)&data; + for ( i = 0; i < 3 && work.current < work.length; i++ ) + { + work.data[ work.current++ ] = *ptr++; + } + } + else + { + OS_TPrintf("Stream buffer was overflow because of multiple usage.\n"); + } +} + +static void PxiFirmIDCallback( PXIFifoTag tag, u32 data, BOOL err ) +{ + u32 next_wp = ( work.wp + 1 ) % PXI_FIRM_ID_MAX; + (void)tag; + (void)err; + + // special ID + if ( data == FIRM_PXI_ID_LOAD_BUFFER_SEMAPHORE ) + { + work.semaphore++; + if ( work.semaphore > HW_FIRM_LOAD_BUFFER_UNIT_NUMS ) + { + OS_TPanic("PROGRAM ERROR: Semaphore counter was overlow."); + } + return; + } + + if ( next_wp != work.rp ) + { + work.wp = next_wp; + work.id[work.wp] = (u8)data; + } + else + { + OS_TPrintf("ID buffer was overflow (%d is ignored).\n", (u8)data); + } +} + +/*---------------------------------------------------------------------------* + Name: PXI_InitFIRM + + Description: initialize PXI for firm + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_InitFIRM(void) +{ +#ifdef SDK_ARM9 + work.semaphore = 0; +#else + work.semaphore = HW_FIRM_LOAD_BUFFER_UNIT_NUMS; +#endif + work.rp = work.wp = work.length = 0; + + PXI_Init(); +#ifdef SDK_ARM9 + while (!PXI_IsCallbackReady(PXI_FIFO_TAG_USER_1, PXI_PROC_ARM7)) + { + } +#endif + PXI_SetFifoRecvCallback( PXI_FIFO_TAG_USER_0, PxiFirmStreamCallback ); + PXI_SetFifoRecvCallback( PXI_FIFO_TAG_USER_1, PxiFirmIDCallback ); +#ifdef SDK_ARM7 + while (!PXI_IsCallbackReady(PXI_FIFO_TAG_USER_1, PXI_PROC_ARM9)) + { + } +#endif +#ifdef SDK_ARM9 + PXIi_WaitIDByIntf( FIRM_PXI_ID_INIT_ARM7 ); +#else + PXIi_SendIDByIntf( FIRM_PXI_ID_INIT_ARM7 ); +#endif + +} + +/*---------------------------------------------------------------------------* + Name: PXI_SendStream + + Description: Send data stream + + Arguments: buf pointer to data buffer + size transfer size + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_SendStream( const void* buf, int size ) +{ + u8* ptr = (u8*)buf; + while ( 0 > PXI_SendWordByFifo( PXI_FIFO_TAG_USER_0, (u32)size, 0 ) ) + { + } + while ( size > 0 ) + { + u32 data = (u32)(ptr[0] << 0 | ptr[1] << 8 | ptr[2] << 16); + while ( 0 > PXI_SendWordByFifo( PXI_FIFO_TAG_USER_0, data, 0 ) ) + { + } + size -= 3; + ptr += 3; + } +} + +/*---------------------------------------------------------------------------* + Name: PXI_RecvStream + + Description: Receive data stream + + Arguments: buf pointer to data buffer + size transfer size + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_RecvStream( void* buf, int size ) +{ + while ( 1 ) + { + OSIntrMode enabled = OS_DisableInterrupts(); + if ( work.length && work.current >= work.length ) + { + if ( size != work.length ) + { + OS_TPrintf("Stream data size was not expected."); + } + else + { + MI_CpuCopy8( work.data, buf, (u32)size ); + work.length = work.current = 0; + } + OS_RestoreInterrupts( enabled ); + return; + } + OS_RestoreInterrupts( enabled ); + } +} + +/*---------------------------------------------------------------------------* + Name: PXI_NotifyID + + Description: Send ID + + Arguments: id id to send + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_NotifyID( FIRMPxiID id ) +{ + while ( 0 > PXI_SendWordByFifo( PXI_FIFO_TAG_USER_1, id, 0 ) ) + { + } +#if 0 +#ifdef SDK_ARM9 + OS_TPrintf("[ARM9] Notify: %d\n", (u8)id); +#else + OS_TPrintf("[ARM7] Notify: %d\n", (u8)id); +#endif +#endif +} + +/*---------------------------------------------------------------------------* + Name: PXI_RecvID + + Description: Receive ID + + Arguments: None + + Returns: Received ID + *---------------------------------------------------------------------------*/ +FIRMPxiID PXI_RecvID( void ) +{ + while ( 1 ) + { + OSIntrMode enabled = OS_DisableInterrupts(); + if ( work.rp != work.wp ) + { + FIRMPxiID id; + work.rp = ( work.rp + 1 ) % PXI_FIRM_ID_MAX; + id = (FIRMPxiID)work.id[work.rp]; + OS_RestoreInterrupts( enabled ); +#if 0 +#ifdef SDK_ARM9 + OS_TPrintf("[ARM9] Received: %d\n", id); +#else + OS_TPrintf("[ARM7] Received: %d\n", id); +#endif +#endif + return id; + } + OS_RestoreInterrupts( enabled ); + } +} + +/*---------------------------------------------------------------------------* + Name: PXI_ReleaseLoadBufferSemaphore + + Description: Release semaphore for *_LoadBuffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_ReleaseLoadBufferSemaphore( void ) +{ + PXI_NotifyID( FIRM_PXI_ID_LOAD_BUFFER_SEMAPHORE ); +} + +/*---------------------------------------------------------------------------* + Name: PXI_AcquireLoadBufferSemaphore + + Description: Acquire semaphore for *_LoadBuffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_AcquireLoadBufferSemaphore( void ) +{ + while ( 1 ) + { + OSIntrMode enabled = OS_DisableInterrupts(); + if ( work.semaphore > 0 ) + { + work.semaphore--; + OS_RestoreInterrupts( enabled ); + return; + } + OS_RestoreInterrupts( enabled ); + } +} + +/*---------------------------------------------------------------------------* + Name: PXIi_SendIDByIntf + + Description: Send 4bit id to the other processor + + Arguments: id sending id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXIi_SendIDByIntf( u32 id ) +{ + reg_PXI_INTF = (u16)(id << REG_PXI_INTF_SEND_SHIFT); +} + +/*---------------------------------------------------------------------------* + Name: PXIi_RecvIDByIntf + + Description: Receive 4bit id from the other processor + + Arguments: None + + Returns: received id + *---------------------------------------------------------------------------*/ +u32 PXIi_RecvIDByIntf( void ) +{ + return (u32)((reg_PXI_INTF & REG_PXI_INTF_RECV_MASK) >> REG_PXI_INTF_RECV_SHIFT); +} + +/*---------------------------------------------------------------------------* + Name: PXIi_WaitIDByIntf + + Description: Wait 4bit id from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXIi_WaitIDByIntf( u32 id ) +{ + while (PXIi_RecvIDByIntf() != id) + { + } +} + diff --git a/build/libraries_sysmenu/Makefile b/build/libraries_sysmenu/Makefile new file mode 100644 index 00000000..69369536 --- /dev/null +++ b/build/libraries_sysmenu/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = reloc_info \ + sysmenu \ + boot \ + hotsw \ + namut \ + mcu \ + ds \ + sharedFont \ + util \ + dht \ + wds \ + errorLog \ + nwm \ +# TwlWireless \ +# acsign \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/TwlWireless/Makefile b/build/libraries_sysmenu/TwlWireless/Makefile new file mode 100644 index 00000000..b7ae7d42 --- /dev/null +++ b/build/libraries_sysmenu/TwlWireless/Makefile @@ -0,0 +1,85 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TWL WLAN - twl - +# File: Makefile +# +# Copyright 2007 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. +# +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +override TARGET_PLATFORM := TWL +override TWL_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED +export TWL_CODEGEN +export TWL_ARCHGEN +TWL_PROC := ARM7 + +# always build overridden targets under sub processes +SUBDIR_FLAGS = TWL_CODEGEN=$(TWL_CODEGEN) TWL_ARCHGEN=$(TWL_ARCHGEN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +export TWL_WLAN_ROOT = $(subst $(SPACE),\ ,$(subst \,/,$(TWL_IPL_RED_ROOT))) +export TWLWLAN_DRV_ROOT = $(subst $(SPACE),\ ,$(subst \,/,$(TWLWIRELESS_ROOT))) + +#---------------------------------------------------------------------------- + +# set enviromental variables for TianShan +ATH_OS_TYPE := TWL +ATH_WLAN_DRV_PATH := $(TWLWLAN_DRV_ROOT) +NIN_PACKAGE_PATH := + +# COM_TYPE = [SERIAL/SPIUSB] +COM_TYPE ?= SPIUSB + +# env. variables for TianShan tree +export ATH_OS_TYPE +export NIN_PACKAGE_PATH +export ATH_WLAN_DRV_PATH +export COM_TYPE + +export TARGET_FIRM +export LIBDIR = ./lib.SYSMENU/$(TWL_BUILDTYPE) +export OBJDIR = ./obj.SYSMENU/$(TWL_BUILDTYPE) +export DEPENDDIR = ./depend.SYSMENU/$(TWL_BUILDTYPE) +export MACRO_FLAGS = -DSDK_SYSMENU_BUILD + +export TWLSDK_INSTALL_ROOT = $(SYSMENU_INSTALL_LIBDIR)/../../.. + +export LDIRT_CLEAN = ./obj.SYSMENU ./depend.SYSMENU ./lib.SYSMENU + +# Install +INSTALL_DIR = $(call eupath,$(TWLSDK_INSTALL_ROOT)/lib/TwlWireless/$(TWL_LIBTYPE)) +INSTALL_TARGETS = $(INSTALL_DIR)/libsdio_sp.SYSMENU$(TWL_LIBSUFFIX).a \ + $(INSTALL_DIR)/libathdrv_sp.SYSMENU$(TWL_LIBSUFFIX).a + +SUBDIRS = $(TWLWIRELESS_ROOT) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +# Override generic DO_INSTALL +define DO_INSTALL + $(INSTALL) -d $(INSTALL_DIR) $(AND) \ + $(foreach FILE, $(INSTALL_TARGETS), \ + if [ ! -e $(INSTALL_DIR)/$(FILE) -o \ + $(FILE) -nt $(INSTALL_DIR)/$(FILE) ]; \ + then \ + $(ECHO) " install: $(subst .SYSMENU,,$(FILE)) -> $(FILE)" $(AND) \ + $(INSTALL) $(subst .SYSMENU,,$(FILE)) $(INSTALL_DIR)/$(notdir $(FILE)) $(AND) \ + $(RM) $(INSTALL_DIR)/$(notdir $(subst .SYSMENU,,$(FILE))); \ + fi $(AND) ) $(TRUE) +endef + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/acsign/ARM9/Makefile b/build/libraries_sysmenu/acsign/ARM9/Makefile new file mode 100644 index 00000000..65189f44 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/Makefile @@ -0,0 +1,58 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.encrypt + + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +INCDIR = include \ + $(ROOT)/build/libraries/mb/common/include + +SRCS = acsign.c acmemory.c acsign_util.c \ + +TARGET_LIB = libacsign$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +CCFLAGS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + -DNO_STDIO_H \ + -DNO_STDLIB_H + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/acsign/ARM9/Makefile.encrypt b/build/libraries_sysmenu/acsign/ARM9/Makefile.encrypt new file mode 100644 index 00000000..2640e983 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/Makefile.encrypt @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +INCDIR = include + +SRCS = acsign_encrypt.c \ + ber_lib.c ber_isk.c ber_par.c + +TARGET_LIB = libacsign_enc$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +CCFLAGS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + -DNO_STDIO_H \ + -DNO_STDLIB_H + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/acsign/ARM9/include/acmemory.h b/build/libraries_sysmenu/acsign/ARM9/include/acmemory.h new file mode 100644 index 00000000..1a3e206e --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/acmemory.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: acmemory.h + + Copyright 2007 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 _ACMEMORY_H_ +#define _ACMEMORY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +// +void ACMemory_Clear( ); +void* ACMemory_Alloc( u32 size ); +void* ACMemory_Realloc( void *adrs, u32 nowsize, u32 newsize ); +void ACMemory_Free( void* adrs ); +void* ACMemory_Memset( void* adrs, u32 val, u32 cnt ); +void* ACMemory_Memcpy( void* dst, void* src, u32 cnt ); + +#ifdef __cplusplus +} +#endif + +#endif //_ACMEMORY_H_ diff --git a/build/libraries_sysmenu/acsign/ARM9/include/ber.h b/build/libraries_sysmenu/acsign/ARM9/include/ber.h new file mode 100644 index 00000000..c0821a1c --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/ber.h @@ -0,0 +1,667 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef HEADER_COMMON_BER_H +#define HEADER_COMMON_BER_H + +#ifdef __cplusplus +extern "C" { +#endif + +//#include "r_com.h" // local modified. +#include +#include +#include +#include + +/* The ASN.1 types are in this file */ +#include "ber_type.h" + +#if defined(VXWORKS) && defined(m_len) +#undef m_len +#endif + +/* In the info field */ +/** + * The name-space of the object is universal or global. + */ +#define BER_UNIVERSAL 0x00 +/** + * The name-space of the object is application specific. + */ +#define BER_APPLICATION 0x40 +/** + * The name-space of the object is context specific. + * Context-specific items are constructed types of a value (cont [1]). + */ +#define BER_CONTEXT_SPECIFIC 0x80 +/** + * The name-space of the object is private. + */ +#define BER_PRIVATE 0xc0 +/** + * Masks the class part of the type of the BER item. + */ +#define BER_CLASS_MASK 0xc0 + +/** + * The items has no explicit data. All following items that fit in the length + * of the constructed item are part of the data. If the constructed item is + * indefinite encoded, the data finishes with an EOC of 0 length. + * The items that make up the data of this item are said to have a greater + * depth than the constructed item. + */ +#define BER_CONSTRUCTED 0x20 +/** + * This mask is used to determine the type of the item. + */ +#define BER_PRIMITIVE_TAG_MASK 0x1f + +/* Set in the flags */ +/** + * Flag indicates that the stack of items was dynamically allocated and needs + * to be freed. + */ +#define BER_FLAG_DYNAMIC 0x01 +/** + * Flag indicates that the items in the #BER_ITEMS_SK were dynamically allocated + * and need to be freed. + */ +#define BER_FLAG_DYNAMIC_ITEMS 0x02 +/** + * A prefix byte has been set. A bit string requires a byte to precede the data + * in order to provide information about the number of valid bits. + */ +#define BER_FLAG_PREFIX_BYTE 0x04 +/** + * The item has an invalid length value associated with it. This may be because + * the length is greater than the parent's length or because the item has a + * that is required more than five bytes to represent. + */ +#define BER_FLAG_INVALID_LENGTH 0x08 +/** + * The header bytes have been seen for this item and any parents will not have + * these bytes available. + */ +#define BER_FLAG_SEEN_HEADER 0x10 +/** + * No data for this item has been made available. + */ +#define BER_FLAG_NO_DATA_SEEN 0x20 +/** + * Set if the header of the BER_ITEM has already been encoded. + */ +#define BER_FLAG_HEADER_ENCODED 0x40 +/** + * @fn int BER_prefix_byte(BER_ITEMS *i) + * + * Returns whether the prefix byte flag has been set for this item. + * + * @param i [In] BER item. + * @return Bit is set. + *
  • 0 = False, the bit is not set.
  • + *
  • 1 = True, the bit is set.
  • + * + * @note This flag is used for the bit string type as it requires an extra + * byte to indicate a number of valid bits. + * + * @see BER_ITEM_set_prefix_byte(). + */ + +#define BER_prefix_byte(i) ((i)->flags & BER_FLAG_PREFIX_BYTE) +/** + * @fn int BER_invalid_length(BER_ITEMS *i) + * + * Returns whether the invalid length flag has been set for this item. + * + * @param i [In] BER item. + * @return Bit is set. + *
  • 0 = False, the bit is not set.
  • + *
  • 1 = True, the bit is set.
  • + */ +#define BER_invalid_length(i) ((i)->flags & BER_FLAG_INVALID_LENGTH) + +/* In the info field */ +/** + * Mask off the flags of the information field. + */ +#define BER_INFO_MASK 0x0f +/** + * The encoding is BER rather than DER. + */ +#define BER_BER 0x01 +/** + * The item is indefinite length encoded. This means that there is no length + * value that can be used to determine the length of the data for this item. + */ +#define BER_ILEN 0x02 +/** + * The contents of this item are to be hidden. + */ +#define BER_HIDE_CONTENTS 0x04 +/** + * The header of this item has not been set yet. + */ +#define BER_NO_HEADER 0x08 + + +/** + * @fn int BER_hide_contents(BER_ITEMS *i) + * + * Returns whether the hide contents flag has been set for this item. + * + * @param i [In] BER item. + * @return Bit is set. + *
  • 0 = False, the bit is not set.
  • + *
  • 1 = True, the bit is set.
  • + */ +#define BER_hide_contents(i) ((i)->info & BER_HIDE_CONTENTS) + +/** + * @fn int BER_no_header(BER_ITEMS *i) + * + * Returns whether the no header flag has been set for this item. + * + * @param i [In] BER item. + * @return Bit is set. + *
  • 0 = False, the bit is not set.
  • + *
  • 1 = True, the bit is set.
  • + * + * @note This could be set when the data has been placed in the item but the + * header has not been setup. + */ +#define BER_no_header(i) ((i)->info & BER_NO_HEADER) + +/** + * @fn unsigned long BER_MASK(int a) + * + * Returns the BER type as a bit mask. + * + * @param a [In] Type of the item. + * @return Each ASN.1 type maps to a bit in a 32 bit value. + * + * @note There are less than 32 primative ASN.1 types. This + * means a 32bit word can be used to specify acceptable 'types'. + */ +#define BER_MASK(a) (1UL << (a)) + +/** + * @fn int BER_constructed(BER_ITEMS *a) + * + * Returns a value to indicate that the item is constructed. + * + * @param a [In] BER item. + * @return Constructed bit set. + *
  • 0 = False, the bit is not set.
  • + *
  • #BER_CONSTRUCTED = True, the bit is set.
  • + */ +#define BER_constructed(a) (((a)->info) & BER_CONSTRUCTED) + +/** + * @fn int BER_class(BER_ITEMS *a) + * + * Returns a value to indicate the name-space of the item. + * + * @param a [In] BER item. + * @return Application and/or context specific bit set. + *
  • #BER_UNIVERSAL = Universal.
  • + *
  • #BER_APPLICATION = application specific item.
  • + *
  • #BER_CONTEXT_SPECIFIC = context specific item.
  • + *
  • #BER_PRIVATE = private item.
  • + * + * @note The top two bits of the type are used to specify the name-space of + * the item and these are pulled out and put in the info field. + */ +#define BER_class(a) (((a)->info) & BER_CLASS_MASK) + +/** + * @fn int BER_indefinite_encoding(BER_ITEMS *a) + * + * Returns a value to indicate if the item is indefinite encoded. That is, + * the number of bytes to the data is not known. + * + * @param a [In] BER item. + * @return Indefinite length bit set. + *
  • 0 = False, the bit is not set.
  • + *
  • #BER_ILEN = True, the bit is set.
  • + */ +#define BER_indefinite_encoding(a) (((a)->info) & BER_ILEN) + +/** + * @fn void BER_ITEMS_SK_clear(BER_ITEMS_SK *sk) + * + * Clears the items out of the stack. + * + * @param sk [In] Stack of BER items. + * + * @note The items in the stack are not freed by this call. + */ +#define BER_ITEMS_SK_clear(sk) ((sk)->num=0) + +/** + * Maximum length of the tag/type of an item. + */ +#define BER_MAX_TAG_LEN_IN_BITS (sizeof(int) * 8) +/** + * Minumum length of the data for a header of an item that streaming can use + * when decoding. + */ +#define BER_MIN_HEADER_LEN 2 +/** + * Maximum length of the header of an item. + */ +#define BER_MAX_HEADER_LEN (1 + (BER_MAX_TAG_LEN_IN_BITS / 8) + \ + 1 + sizeof(unsigned long)) + +#ifndef NO_STREAM +/** + * The initial state in which a new item is created. + */ +#define BER_STATE_READ_NEXT_ITEM 1 +/** + * The state in which the item header is read in and processed. + */ +#define BER_STATE_READ_NEXT_ITEM_HEADER 2 +/** + * The state in which the data of the item is read in and processed. + */ +#define BER_STATE_READ_NEXT_ITEM_DATA 3 +/** + * The state in which the current item is the last for the constructed item + * above. + */ +#define BER_STATE_GO_UP 4 +#endif /* !NO_STREAM */ + +/** + * This structure holds the information about the data part of the BER item. + */ +typedef struct ber_bytes_st +{ + /** + * Length of the data for this item. + */ + unsigned long len; + /** + * A pointer to the start of the valid data of this item. + */ + unsigned char *bytes; +} BER_BYTES; + +/** + * This structure holds the information about the data part of the BER item. + */ +typedef struct ber_item_st +{ + /** + * The data of the item. + */ + BER_BYTES data; +#ifndef NO_STREAM + /** + * The depth of this item. The depth is the number of constructed items this + * item is under. + */ + unsigned char depth; + /** + * The header bytes of the item. They are kept as the buffer it comes from + * may no longer be valid when the header data is needed. + */ + unsigned char header[BER_MAX_HEADER_LEN]; + /** + * Number of data bytes seen of this item. When streaming the number of + * bytes seen depends on the number of bytes in the buffer that is being + * parsed. + */ + unsigned long seen; + /** + * Number of data bytes left to get out. When streaming the number of + * valid bytes available depends on the number of bytes in the buffer that + * is being parsed. + */ + unsigned long part_len; + /** + * Number of data bytes already encoded of the BER_ITEM. When + * streaming the number of bytes encoded depends on how much space + * is in the output buffer and how many bytes are available to encode. + */ + unsigned int encoded; +#endif /* !NO_STREAM */ + /** + * The tag number that indicates the type of the item. + */ + unsigned int type; + /** + * Information about the item. Includes the name-space, constructed bit + * and whether it is indefinite encoded. + */ + unsigned char info; + /** + * The length of the header bytes. Varies depending on name-space and the + * number of bytes needed to represent data length. + */ + unsigned char hlen; + /** + * The extra flags of the item. Includes flags to indicate what parts of the + * item are dynamic. + */ + unsigned char flags; + /** + * Holds an 'extra' prefix byte. Needed for the bit string type as it + * requires an extra byte to indicate the number of valid bits in the data. + */ + unsigned char prefix_byte; +} BER_ITEM; + +/** + * An item and pointer to other items linked to it. + */ +typedef struct ber_items_st +{ + /** + * The current item data. + */ + BER_ITEM item; + /** + * The constructed item that this item is the data for. + */ + struct ber_items_st *parent; + /** + * The next item that is also in this constructed item. + */ + struct ber_items_st *next; + /** + * When the item is constructed, this points to the first item that is + * part of the data for this item. + */ + struct ber_items_st *down; +} BER_ITEMS; + +/** + * Stack of BER items. The stack is the context of the BER items. + */ +typedef struct ber_items_sk_st +{ + /** + * The number of items stored in the stack. + */ + unsigned int num; + /** + * The maximum number of items that can be stored in the stack. + */ + unsigned int max; + /** + * The array of items. + */ + BER_ITEMS *items; + /** + * Flags of the structure. Includes dynamic allocation of data. + * If the data is dynamic, this means that it can grow. + */ + unsigned int flags; +#ifndef NO_STREAM + /** + * Current streaming parsing state. + */ + int state; + /** + * Current item is indefinite encoded. + */ + int inf; + /** + * The parent or the constructed item this item belongs to is indefinite + * encoded. + */ + int pinf; + /** + * The current item is a constructed item. + */ + int con; + /** + * The next item needs to be placed under the current item. + * Alternatively, the previous item was a constructed item. + */ + int down; + /** + * The index into the array of items of the current item. + * Due to the fact that the items may be reallocated an index needs to be + * kept rather than a pointer. + */ + int this_idx; + /** + * The index into the array of items of the next/new item. + * Due to the fact that the items may be reallocated an index needs to be + * kept rather than a pointer. + */ + int next_idx; + /** + * Holds a pointer to the next/new item for the next call to the streaming + * parsing function. + */ + BER_ITEMS *next; +#endif /* !NO_STREAM */ +} BER_ITEMS_SK; + +/** + * @fn unsigned int BER_ITEMS_SK_num(BER_ITEMS_SK *sk) + * + * Returns the number of items in the stack. + * + * @param sk [In] Stack of BER items. + * @return Number of items in the stack. + * + * @note Useful in calculating the index of the next new item. + */ +#define BER_ITEMS_SK_num(sk) ((sk)->num) +/** + * @fn unsigned BER_ITEMS *BER_ITEMS_SK_items(BER_ITEMS_SK *sk, unsigned int n) + * + * Returns a pointer to a data item in the stack. + * + * @param sk [In] Stack of BER items. + * @param n [In] Array position of the item to obtain. + * @return Pointer to a BER item. + */ +#define BER_ITEMS_SK_items(sk,n) (&((sk)->items[n])) + + +/** + * Return value indicating no error occurred. + */ +#define BER_OK 0 +/** + * Return value indicating no error occurred. + */ +#define BER_ERR_OK 0 +/** + * Error indicating that the type/tag of the item was too long. + * This normally indicates that the encoding is invalid. + * Some valid private name-space items may cause this error. + */ +#define BER_ERR_TAG_TOO_LONG 1 +/** + * Error indicating that there are not enough bytes in the buffer to complete + * the message. This is not a fatal error when streaming. + */ +#define BER_ERR_NOT_ENOUGH_BYTES 2 +/** + * Error indicating that the value of the length of data is too long. + * A length value can be infinitely long but only lengths that can fit in an + * unsigned long are supported. + */ +#define BER_ERR_LENGTH_TOO_LARGE 3 +/** + * Error indicating that the item is not constructed as expected or required. + */ +#define BER_ERR_NOT_CONSTRUCTED 4 +/** + * Error indicating that the function was unable to allocate the memory + * required. + */ +#define BER_ERR_OUT_OF_MEMORY 5 +/** + * Error indicating that the function needed space for more items but was + * unable to grow the stack. This is mostly likely to occur when the array + * of items is static and more items than allocated are required. + */ +#define BER_ERR_OUT_OF_ITEMS_STORAGE 6 +/** + * Error indicating that the comparison of the tag/type failed. + */ +#define BER_ERR_CMP_TAG 7 +/** + * Error indicating that the item is not an integer as expected or required. + */ +#define BER_ERR_NOT_AN_INTEGER 8 +/** + * Error indicating that the length of the data is too large to return in an + * unsigned long. + */ +#define BER_ERR_NUMBER_TOO_LARGE 9 +/** + * Error indicating that the bytes of data did not match in the comparison. + */ +#define BER_ERR_CMP_BYTES 10 +/** + * Error indicating an end of content item is present when not in an indefinite + * encoded item. Normally occurs when buffer is not filled properly. + */ +#define BER_ERR_UNEXPECTED_EOC 11 +/** + * Error indicating that the value of the length is invalid. This occurs when + * the length is an indefinite length value and the item is not constructed. + */ +#define BER_ERR_INVALID_LENGTH_ENCODING 12 +/** + * Error indicating that the partial length of the value is not zero. This + * means that there is data in the items that has not been used yet that will + * be invalidated by parsing the new data. Streaming only. + */ +#define BER_ERR_PARTIAL 13 +/** + * Error indicating that the various length fields of a BER_ITEM do + * not make sense and therefore processing cannot continue. In this + * case an unidentified logic error earlier in the code has occured. + */ +#define BER_ERR_PAR_ENC_LENGTH 14 +/** + * Invalid state in parsing or encoding. + */ +#define BER_ERR_INVALID_STATE 15 + + +/* A description of the BER item header: + * First byte definition + * 5 1 - search for a class + * 0 - search for a number + * for class + * 7-6 - for class, it class field + * 4-0 - tag, normal taging convention + * for number + * 7-6 - 0 - do next operation + * - 0x40 - finished + * - 0x80 - operate on the contents of this item + * - 0xc0 - operate on the contents and return at end + * 4-0 - num to scan, can only do 31 at a time, extend with subsequent calls + * Number counts skip explicit and implicit tags, they only count on + * universal types. + * If bit 5 is set, and 6-7 are 0, then we have 'special' comands + * which we can use WRT class elements. + * These two are needed when we are 'sitting' on a non-primative tag + * item since the normal 'counting' commands will skip the element before + * they perform their command. + * 0x20 return + * 0x21 operate on the contents + */ +/* To get a public key and the algorithm the following strings would work + * 0x80|0,0x40|5 - this will return the pubkey structure + * 0x80,0xc0 - Return the pubkey algorithm (from the pubkey) + * 0x80,0xc1 - Return the pubkey parameters + * 0x81 - Return the pubkey bitstring + * 0x80,0x20|0x80|3,0xc0 - return the first extension + */ + +int BER_read_item(BER_ITEM *item,unsigned char *p,unsigned long max); +int BER_find(BER_ITEM *ret,BER_ITEM *in,unsigned char *find); +int BER_ITEMS_SK_get(BER_ITEMS_SK *sk,int *items_idx); +void BER_ITEMS_append(BER_ITEMS *a,BER_ITEMS *b); +int BER_ITEMS_under(BER_ITEMS *a,BER_ITEMS *b); +int BER_ITEMS_SK_grow(BER_ITEMS_SK *ks,unsigned int num); +int BER_parse(BER_ITEMS_SK *ks,unsigned char *in,unsigned long max, + unsigned long *num_used); +int BER_parse_stream(BER_ITEMS_SK *ks,unsigned char **in,long mlen, + long *num_used); + +#ifdef HEADER_COMMON_BIO_H +int BER_print(BIO *bio,BER_ITEMS *items); +int BER_out(BIO *out,BER_ITEMS *start); +#else /* !HEADER_COMMON_BIO_H */ +int BER_print(char *,BER_ITEMS *items); +int BER_out(char *out,BER_ITEMS *start); +#endif /* !HEADER_COMMON_BIO_H */ + +void BER_ITEM_init(BER_ITEM *item); +void BER_ITEMS_init(BER_ITEMS *item); +void BER_ITEM_set_all(BER_ITEM *item,unsigned int sclass,unsigned int tag, + unsigned char *data,unsigned int len,unsigned int info, unsigned int flags); +void BER_ITEM_set_header(BER_ITEM *item, unsigned int sclass,unsigned int tag, + unsigned int flags); +void BER_ITEM_set_data(BER_ITEM *item, unsigned char *data, unsigned int len); +int BER_ITEM_cmp_tag(BER_ITEM *a,unsigned int tag); +int BER_ITEM_get_long(BER_ITEM *a,long *l); +int BER_ITEM_set_long(BER_ITEM *a, long lret, unsigned char *buf); + +size_t BER_ITEM_header_len(BER_ITEM *item); +unsigned int BER_ITEM_header_write(BER_ITEM *item, unsigned char *out); +unsigned int BER_ITEM_header_swrite(BER_ITEM *item, unsigned char *out); + +int BER_ITEM_cmp_bytes(BER_ITEM *a,unsigned char *d, unsigned int l); +void BER_ITEMS_SK_init(BER_ITEMS_SK *sk,BER_ITEMS *items,unsigned int num, + unsigned int max); +void BER_ITEMS_SK_free(BER_ITEMS_SK *sk); +unsigned long BER_ITEMS_recalc_length(BER_ITEMS *a); +int BER_ITEMS_encode(BER_ITEMS *a, unsigned char *out, unsigned long *olen, + unsigned long max); +int BER_ITEMS_encode_stream(BER_ITEMS **a, unsigned char *out, + unsigned long *olen, unsigned long max); +int BER_load_level(BER_ITEMS_SK *sk, unsigned char *ino, unsigned long m_len); + +/* We have to make the second parameter 'unsigned int' instead of + * 'unsigned char' because both the Sun and HP compilers complain + * when using a mix of ANSI prototypes and K&R function implementations + */ +void BER_ITEM_set_prefix_byte(BER_ITEM *item, unsigned int byte); + +/* Used to count bits in an array of chars, strip leading 0, counts bits */ +int R_num_bits(unsigned char *buf, int len, int bigendian); + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_COMMON_BER_H */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/ber_lcl.h b/build/libraries_sysmenu/acsign/ARM9/include/ber_lcl.h new file mode 100644 index 00000000..d1d3a787 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/ber_lcl.h @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber_lcl.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef HEADER_COMMON_BER_LCL_H +#define HEADER_COMMON_BER_LCL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STANDALONE +#include "r_com.h" +#else +#include +#include +#define NO_STDLIB_MAPPING +#include "acmemory.h" +#define Malloc(a) ACMemory_Alloc(a) +#define Free(a) ACMemory_Free(a) +#define Memset(a,b,c) ACMemory_Memset(a,b,c) +#define Memcpy(a,b,c) ACMemory_Memcpy(a,b,c) +#define Realloc(a,b,c) ACMemory_Realloc(a,b,c) +#define Memcmp(a,b,c) memcmp(a,b,c) +#define Bsearch(a,b,c,d,e) bsearch(a,b,c,d,e) +#endif + +#include "ber.h" + +#ifdef UNDER_CE +#include "wcestdlb.h" /* include for bsearch */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_COMMON_BER_H */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/ber_type.h b/build/libraries_sysmenu/acsign/ARM9/include/ber_type.h new file mode 100644 index 00000000..92fe40de --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/ber_type.h @@ -0,0 +1,221 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber_type.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/** + * @file + * This file contains information on the ASN.1 types used to perform + * Basic Encoding Rules (BER) encoding and decoding operations. + */ + +#ifndef HEADER_COMMON_BER_TYPE_H +#define HEADER_COMMON_BER_TYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Indicates the end of content for encoded items with an unspecified length. + */ +#define BER_EOC 0 + +/** + * Indicates either "true" or "false" as per the ASN.1 boolean values + * #BER_TRUE and #BER_FALSE. + */ +#define BER_BOOLEAN 1 + +/** + * Effectively unbounded but commonly used to hold values + * that will fit into a long. + */ +#define BER_INTEGER 2 + +/** + * An array of Bytes in which the first Byte is the number of bits to + * discard from the end. + */ +#define BER_BIT_STRING 3 + +/** + * An 8-bit (hexadecimal Byte) array or Byte array. + */ +#define BER_OCTET_STRING 4 + +/** + * A Basic Encoding Rules (BER) object that has no data. It is used when data + * is specified for a general case but not a specific case. + */ +#define BER_NULL 5 + +/** + * A Basic Encoding Rules (BER) object used to hold an ASN.1 identifier that + * describes the make-up of the rest of the constructed elements. + */ +#define BER_OBJECT 6 + +/** + * An indefinitely long string of characters (plus space) used to describe an + * object. + */ +#define BER_OBJECT_DESCRIPTOR 7 + +/** + * Embedded material that is not defined using ASN.1, such as a GIF file. This + * type is deprecated in favour of #BER_EMBEDDED_PDV. + */ +#define BER_EXTERNAL 8 + +/** + * A comma-separated list of three integers for the mantissa, the base + * (2 or 10), and the exponent. (Also PLUS-INFINITY and + * MINUS-INFINITY.)
    + * Hence, {x, y, z} is (x times (y to the power z)), + * where y is allowed to take only the values 2 and 10. + */ +#define BER_REAL 9 + +/** + * A comma-separated list of names. + */ +#define BER_ENUMERATED 10 + +/** + * Embedded material that is not defined using ASN.1, such as a GIF file. This + * type supercedes #BER_EXTERNAL. + */ +#define BER_EMBEDDED_PDV 11 + +/** + * A character string which may contain characters from any language. + */ +#define BER_UTF8STRING 12 + +/** + * A constructed type that is used to hold an ordered list of elements. + */ +#define BER_SEQUENCE 16 + +/** + * A constructed type that is used to hold a list of repeating elements. + */ +#define BER_SET 17 + +/** + * A string of characters containing the digits zero to 9 and space. + */ +#define BER_NUMERICSTRING 18 + +/** + * A character array that only allows a small subset of values, namely + * [A-Z] [a-z] [0-9] and [ '()+,-./:=?]. + */ +#define BER_PRINTABLESTRING 19 + +/** + * A deprecated synonym for #BER_TELETEXSTRING. + */ +#define BER_T61STRING 20 + +/** + * A character string that allows register entries 6, 87, 102, 103, 106, 107, + * 126, 144, 150, 153, 156, 164, 165 and 168 (plus space and delete) + * of the International Register of Coded Character Sets. + */ +#define BER_TELETEXSTRING 20 + +/** + * A character string that enables access to the "characters" used to + * build crude pictures on videotext systems. + */ +#define BER_VIDEOTEXSTRING 21 + +/** + * A character string that allows the register entries 1 and 6 (plus space and + * delete) of the International Register of Coded Character Sets to be used + * with escape sequences. + */ +#define BER_IA5STRING 22 + +/** + * A character string representing the date and time in the format:
    + * ddmmyyhhmmssZ. + */ +#define BER_UTCTIME 23 + +/** + * A character string representing the date and time in the format:
    + * ddmmyyyyhhmmssZ. + */ +#define BER_GENERALIZEDTIME 24 + +/** + * A character string that allows any of the register entries in the + * International Register for printable characters other than + * the control character entries. + */ +#define BER_GRAPHICSTRING 25 + +/** + * A deprecated synonym for #BER_VISIBLESTRING. + */ +#define BER_ISO64STRING 26 + +/** + * A character string that allows register entry 6 of the International + * Register of Coded Character Sets to be used with escape sequences. + */ +#define BER_VISIBLESTRING 26 + +/** + * A character string that allows any of the register entries in the + * International Register for printable characters. + */ +#define BER_GENERALSTRING 27 + +/** + * A character string which may contain characters from any language + * without using combining characters. + */ +#define BER_UNIVERSALSTRING 28 + +/** + * A character string which may contain characters from any living + * language. + */ +#define BER_BMPSTRING 30 + +/** The boolean value "false" for the #BER_BOOLEAN ASN.1 type. */ +#define BER_FALSE 0 +/** The boolean value "true" for the #BER_BOOLEAN ASN.1 type. */ +#define BER_TRUE 255 + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_COMMON_BER_TYPE_H */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/bn.h b/build/libraries_sysmenu/acsign/ARM9/include/bn.h new file mode 100644 index 00000000..ed99275e --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/bn.h @@ -0,0 +1,1136 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef HEADER_COMMON_BN_H +#define HEADER_COMMON_BN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FLAT_INC +#include "r_types.h" +#else +#include "../include/r_types.h" +#endif + +#if !defined(CCONV) +#define CCONV +#endif + +#ifndef PRE_CCONV +#define PRE_CCONV +#endif + +/* convert from the new to the old option names */ +#if defined(OPT_BN_LLONG) +#define BN_LLONG /* comment to make sure Configure leaves this alone */ +#endif + +#if defined(OPT_BN_MUL_LATENCY) +#define BN_MUL_LATENCY +#endif + +/* by default we have the following switched on - unless we have an option + * that switched them off for a specific platform + */ +#ifdef OPT_NO_COMBA +#define OPT_NO_BN_MUL_COMBA +#define OPT_NO_BN_SQR_COMBA +#endif + +#ifdef OPT_NO_REC +#define OPT_NO_BN_RECURSION_MUL +#define OPT_NO_BN_RECURSION_SQR +#endif + +#ifndef OPT_NO_BN_MUL_COMBA +#define BN_MUL_COMBA +#endif +#ifndef OPT_NO_BN_SQR_COMBA +#define BN_SQR_COMBA +#endif +#ifndef OPT_NO_BN_RECURSION_MUL +#define BN_RECURSION_MUL +#endif +#ifndef OPT_NO_BN_RECURSION_SQR +#define BN_RECURSION_SQR +#endif +#ifndef OPT_NO_BN_RECURSION_MONT +#undef BN_RECURSION_MONT /* DO NOT TURN THIS ON, IT IS BROKEN */ +#endif + +#if (!defined(OPT_NO_BN_MUL_COMBA) && !defined(OPT_NO_BN_SQR_COMBA)) +#if OPT_MONT_REDUCE_COMBA /* TEMP UNTIL C IS IMPLEMENTED-DEF'd ON PLATFORMS W/ ASM */ +#define BN_REDUCE_COMBA +#endif +#endif + +#define RECP_MUL_MOD +#define MONT_MUL_MOD + +#ifndef OPT_NO_BN_SURRENDER +#define BN_SURRENDER +#else +#undef BN_SURRENDER +#endif + +#ifdef SMALL_CODE_SIZE +#undef BN_MUL_COMBA /* stop modification */ +#undef BN_SQR_COMBA /* stop modification */ +#undef BN_REDUCE_COMBA /* stop modification */ +#undef BN_RECURSION_MUL /* stop modification */ +#undef BN_RECURSION_SQR /* stop modification */ +#undef BN_RECURSION_MONT /* stop modification */ +#endif + + + +/* This next option uses the C libraries (2 word)/(1 word) function. + * If it is not defined, I use my C version (which is slower). + * The reason for this flag is that when the particular C compiler + * library routine is used, and the library is linked with a different + * compiler, the library is missing. This mostly happens when the + * library is built with gcc and then linked using nornal cc. This would + * be a common occurance because gcc normally produces code that is + * 2 times faster than system compilers for the big number stuff. + * For machines with only one compiler (or shared libraries), this should + * be on. Again this in only really a problem on machines + * using "long long's", are 32bit, and are not using my assember code. */ +#if defined(MSDOS) || defined(WINDOWS) || defined(linux) +#define BN_DIV2W +#endif + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#undef SIXTY_BIT +#undef THIRTY_TWO_BIT +#undef THIRTY_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#undef TEST_EIGHT_BIT + +#if defined(OPT_64_BIT_LONG) +#define SIXTY_FOUR_BIT_LONG +#endif +#if defined(OPT_64_BIT) +#define SIXTY_FOUR_BIT +#endif +#if defined(OPT_60_BIT) +#define SIXTY_BIT +#endif +#if defined(OPT_32_BIT) +#define THIRTY_TWO_BIT +#endif +#if defined(OPT_32_BIT_INT) +#define THIRTY_TWO_BIT +#endif +#if defined(OPT_30_BIT) +#define THIRTY_BIT +#endif +#if defined(OPT_16_BIT) +#define SIXTEEN_BIT +#endif +#if defined(OPT_8_BIT) +#define EIGHT_BIT +#endif +#if defined(OPT_8_BIT_TEST) +#define TEST_EIGHT_BIT +#endif + +/* This define is used for those few functions that 'break' when + * things are compiled for 8 bit words. Basically the size of an + * integer. + */ +#define BN_ILONG BN_ULONG + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#undef BN_LLONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2lh (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000UL) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#define BN_HEX_FMT "%016lX" +#endif + +/* This is where the long long data type is 64 bits, but long is 32. + * For machines where there are 64bit registers, this is the mode to use. + * IRIX, on R4000 and above should use this mode, along with the relevent + * assember code. Do NOT define BN_LLONG. + */ +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG /* Protect against config */ +/* #define BN_ULLONG unsigned long long */ +#ifdef WIN64 +#define BN_ULONG unsigned _int64 +#define BN_LONG _int64 +#else +#define BN_ULONG unsigned long long +#define BN_LONG long long +#endif +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2lh (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000ULL) +#ifdef WIN64 +#define BN_DEC_FMT1 "%I64u" +#define BN_DEC_FMT2 "%019I64u" +#define BN_DEC_NUM 19 +#define BN_HEX_FMT "%016I64X" +#else +#define BN_DEC_FMT1 "%llu" +#define BN_DEC_FMT2 "%019llu" +#define BN_DEC_NUM 19 +#define BN_HEX_FMT "%016llX" +#endif +#endif + +#ifdef SIXTY_BIT +#undef SIXTY_FOUR_BIT +#undef BN_LLONG /* Protect against config */ +/* #define BN_ULLONG unsigned long long */ +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 120 +#define BN_BITS2 60 +#define BN_BITS4 30 +#define BN_MASK2 (0x0fffffffffffffffLL) +#define BN_MASK2l ( 0x3fffffffL) +#define BN_MASK2lh ( 0x3fffffffL) +#define BN_MASK2h (0x0fffffffc0000000LL) +#define BN_MASK2h1 (0x0fffffffe0000000LL) +#define BN_TBIT (0x0800000000000000LL) +#define BN_DEC_CONV (100000000000000000LL) +#define BN_DEC_FMT1 "%9u" +#define BN_DEC_FMT2 "%017llu" +#define BN_DEC_NUM 17 +#define BN_HEX_FMT "%016llX" +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef WIN32 +#if defined(__BORLANDC__) +#define BN_ULLONG unsigned __int64 +#else /* !__BORLANDC__ */ +#if defined(__MINGW32__) || defined(__DJGPP__) +#define BN_ULLONG unsigned long long +#else +#define BN_ULLONG unsigned _int64 +#endif /* __MINGW32__ || __DJGPP__ */ +#endif /* __BORLANDC__ */ +#else /* !WIN32 */ +#define BN_ULLONG unsigned long long +#endif /* WIN32 */ +#ifdef OPT_32_BIT_INT +#define BN_ULONG unsigned int +#define BN_LONG int +#else +#define BN_ULONG unsigned long +#define BN_LONG long +#endif +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +/* This is needed because the Watcom compiler pre-processor + * under QNX tries to parses the 'LL' part even though it is + * never used. + */ +#ifdef BN_LLONG +#ifndef WIN32 +#define BN_MASK (0xffffffffffffffffLL) +#else +#define BN_MASK (0xffffffffffffffffL) +#endif +#endif +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2lh (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#define BN_HEX_FMT "%08lX" +#endif + +#ifdef THIRTY_BIT +#ifdef WIN32 +#if defined(__MINGW32__) || defined(__DJGPP__) +#define BN_ULLONG unsigned long long +#else /* ! (__MINGW32__ || __DJGPP__) */ +#define BN_ULLONG unsigned _int64 +#endif /* __MINGW32__ || __DJGPP__ */ +#else /* !WIN32 */ +#define BN_ULLONG unsigned long long +#endif /* WIN32 */ +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 60 +#define BN_BITS2 30 +#define BN_BITS4 15 +/* This is needed because the Watcom compiler pre-processor + * under QNX tries to parses the 'LL' part even though it is + * never used. + */ +#ifdef BN_LLONG +#ifndef WIN32 +#define BN_MASK (0x0fffffffffffffffLL) +#else +#define BN_MASK (0x0fffffffffffffffL) +#endif +#endif +#define BN_MASK2 (0x3fffffffL) +#define BN_MASK2l (0x7fff) +#define BN_MASK2lh (0x7fff) +#define BN_MASK2h1 (0x3fffc000L) +#define BN_MASK2h (0x3fff8000L) +#define BN_TBIT (0x20000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#define BN_HEX_FMT "%08lX" +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK (0xffffffff) +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2lh (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (10000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%04u" +#define BN_DEC_NUM 4 +#define BN_HEX_FMT "%04X" +#endif + +#ifdef TEST_EIGHT_BIT +#define EIGHT_BIT /* comment to stop editing */ +#endif + +#ifdef EIGHT_BIT +#undef BN_ILONG +#define BN_ILONG unsigned int +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#ifdef TEST_EIGHT_BIT +#define BN_ULLONG unsigned int +#define BN_ULONG unsigned int +#define BN_LONG int +#else +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#endif +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK (0xffff) +#define BN_MASK2 (0xff) +#define BN_MASK2lh (0xf) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#define BN_HEX_FMT "%02X" +#endif + +#ifdef BIGNUM +#undef BIGNUM +#endif + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 +#define BN_FLG_FREE 0x8000 /* used for debuging */ +#define BN_CTX_FLG_ABORT 0x4000 /* used for aborting RSA operations*/ +#define BN_set_flags(b,n) ((b)->flags|=(n)) +#define BN_get_flags(b,n) ((b)->flags&(n)) +#define BN_CTX_set_flags(b,n) ((b)->flags|=(n)) +#define BN_CTX_get_flags(b,n) ((b)->flags&(n)) + +#ifndef HEADER_COMMON_BN_H_TYPEDEF_DEF +#define HEADER_COMMON_BN_H_TYPEDEF_DEF +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_prime_ctx_st BN_PRIME_CTX; +typedef struct bn_blind_ctx_st BN_BLIND_CTX; +typedef struct bn_blind_meth_st BN_BLIND_METH; +#endif + +typedef struct bn_mod_exp_meth_st BN_ME_METH; +typedef struct bn_mod_exp_ctx_st BN_ME_CTX; + + +/* The data array d must always have an extra 'valid' word in location + * bn->d[bn->max]. It must be ok for reading. This is needed if + * BN_MUL_LATENCY is defined. + */ +struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int max; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + }; + +/* Used for temp variables */ +#define BN_CTX_NUM 12 +struct bignum_ctx + { + int tos; + BIGNUM bn[BN_CTX_NUM+1]; + int flags; + R_SURRENDER *surrender; + }; + +#if defined(WIN64) || defined(__ia64__) || defined(CPU_IA64) +#define BN_USHORT unsigned int +#else +#define BN_USHORT unsigned short +#endif + +/* Used for prime number generation */ +struct bn_prime_ctx_st + { + BN_USHORT *primes; + BN_USHORT *mods; + int num_primes; + int prime_checks; + R_SURRENDER *surrender; + R_RANDOM *random; + int flags; + }; + +struct bn_blind_ctx_st + { + int init; + BN_BLIND_METH *meth; + BIGNUM B; + BIGNUM Bi; + BIGNUM mod; + }; + +struct bn_blind_meth_st + { + void (*init) (BN_BLIND_CTX *); + void (*ctx_free)(BN_BLIND_CTX *); + int (*set) (BN_BLIND_CTX *,R_RANDOM *,BIGNUM *,BIGNUM *, BN_ME_CTX *,BN_CTX *); + int (*convert) (BN_BLIND_CTX *,BIGNUM *,BN_CTX *); + int (*invert) (BN_BLIND_CTX *,BIGNUM *,BN_CTX *); + int (*update) (BN_BLIND_CTX *,BN_CTX *); + int (*copy) (BN_BLIND_CTX *,BN_BLIND_CTX *); + }; + +/* Used for montgomery multiplication */ +struct bn_mont_ctx_st + { + int use_word; /* 0 for word form, 1 for long form */ + int ri; /* number of bits in R */ + int riw; /* number of words in R */ + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* The inverse of N */ + BN_ULONG n0; /* word form of inverse, normally only one of + * Ni or n0 is defined */ + int flags; + }; + +/* Used by the recursive exponentiation implementations */ +typedef struct bn_mod_exp_rec_meth_st + { +#ifndef NOPROTO + void (PRE_CCONV CCONV *mul)(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); + void (PRE_CCONV CCONV *sqr)(BN_ULONG *r, BN_ULONG *a); + void (PRE_CCONV CCONV *low_mul)(); +#else + void (PRE_CCONV CCONV *mul)(); + void (PRE_CCONV CCONV *sqr)(); + void (PRE_CCONV CCONV *low_mul)(); +#endif + } BN_MOD_EXP_REC_METH; + +/* If this flag is set, if there is a custom method for a modulus + * two times larger, use it. This is mostly mean for use on the + * itanium where a 512*512 routine is 10 times faster than the C + * code version, so we need to detect that we can turn of CRT + * for RSA if there is an native IA64 512*512 present. + */ +#define BN_ME_FLG_FAST_ASM 0x0001 + +struct bn_mod_exp_meth_st + { + int num; /* Word size we target */ + char *name; /* Identify the method */ +#ifndef NOPROTO + int (*useit)(const BN_ME_METH *meth); + /* If 'power' is null, reuse the old one */ + int (*mod_exp)(BN_ME_CTX *mctx,BIGNUM *r,BIGNUM *a,BIGNUM *p, + BN_CTX *ctx); + /* Create the BN_ME_CTX */ + int (*init_ctx)(const BN_ME_METH *meth,BN_ME_CTX **mctx); + /* Get rid of it */ + int (*free_ctx)(BN_ME_CTX *mctx); + /* Assign the modulus */ + int (*set)(BN_ME_CTX *mctx,BIGNUM *n,int cmd,int flags,BN_CTX *ctx); +#else + int (*useit)(); + int (*mod_exp)(); + int (*init_ctx)(); + int (*free_ctx)(); + int (*set)(); +#endif + int argi; + char *argp; /* 'Extra stuff' */ + }; + +#define BN_ME_METH_TABLE_MAX 32 +/* Used in BN_library_init */ +#define BN_INIT_LAST 0x00 +#define BN_INIT_BN_ME_METH 0x01 + +#define BN_BNME_F_DEFAULT 0x01 +/* Used only when loading, kept as bits internally, normally loaded as + * words */ +#define BN_BNME_F_BITS 0x02 +typedef struct bn_me_meth_info_st + { +#ifndef NOPROTO + const BN_ME_METH *(*meth)(void); +#else + const BN_ME_METH *(*meth)(); +#endif + int min; + int max; + int flags; + } BN_ME_METH_INFO; + +#define BN_ME_SET_MOD 0x01 +#define BN_ME_SET_BASE 0x02 +#define BN_ME_SET_EXP 0x03 +#define BN_ME_SET_FLG_NO_LOOKUP 0x01 /* Passed to BN_ME_CTX_set() */ + +#define BN_FLG_CACHE 0x10 /* Cache values */ +#define BN_ME_FLG_BASE 0x40 /* base has been cached */ +#define BN_ME_FLG_EXP 0x80 /* power has been cached */ +/* When one of these structures is setup, it is intended that the + * base or power, if not null, will be used for the current calculation. + * If the base and/or power are cached, they will only be used if the input + * value is null. + * For RSA, the power would normally be set. + * For DH, the base and power would be set. The initial value generated + * would be the public key, which is exchanged. The phase2 part would + * change the base but not the power. + * For DSA signing, a fixed base is used, but a random power. + * For DSA verification, there are two bases and two powers, + * a^p%m * b^q%m + * One way to implement this is to use a special function to + * generate a composite power value, and or a special base form. + * The other option is to have a special function to generate + * the 'base' array. The problem is that we are exponentiating with + * a 3 value power value, instead of the normal two. It should be possible + * to use the standard a^b%m function. + */ +struct bn_mod_exp_ctx_st + { + const BN_ME_METH *meth; + char *callback; + char *cb_arg; + int flags; + /* Evil hack for storage of data values, it should really be here + * other than the first value */ + char *modulus; /* eg BN_MONT_CTX */ + char *power; /* eg power representation */ + char *base; /* eg base representation */ + char *arg; + }; + +/* Used for reciprocal division/mod functions + * It cannot be shared between threads + */ +struct bn_recp_ctx_st + { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; + }; + +typedef struct bn_rec_st + { + int depth; + int n; +#ifndef NOPROTO + void (PRE_CCONV CCONV *mul)(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); + void (PRE_CCONV CCONV *sqr)(BN_ULONG *r, BN_ULONG *a); + void (PRE_CCONV CCONV *low_mul)(); +#else + void (PRE_CCONV CCONV *mul)(); + void (PRE_CCONV CCONV *sqr)(); + void (PRE_CCONV CCONV *low_mul)(); +#endif + } BN_REC; + +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + r,a,&((mont)->RR),(mont),ctx) + +#define BN_prime_checks (5) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) +#define BN_length(a) ((a)->top * BN_BYTES) +#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) +#define BN_is_zero(a) (((a)->top == 0) || BN_is_word(a,0)) +#define BN_is_one(a) (BN_is_word((a),1)) +#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) +#define BN_one(a) (BN_set_word((a),(BN_ULONG)1)) +#define BN_zero(a) (BN_set_word((a),(BN_ULONG)0)) + +/*#define BN_ascii2bn(a) BN_hex2bn(a) */ +/*#define BN_bn2ascii(a) BN_bn2hex(a) */ + +#define bn_expand(n,b) ((((((b+BN_BITS2-1))/BN_BITS2)) <= (n)->max)?\ + (n):bn_expand2((n),(b)/BN_BITS2+1)) +#define bn_wexpand(n,b) (((b) <= (n)->max)?(n):bn_expand2((n),(b))) + +#ifdef SMALL_CODE_SIZE +void bn_zexpand(BIGNUM *a,int n); +void bn_fix_top(BIGNUM *a); +#else +#define bn_zexpand(a,n) \ + if ((a)->top < n) \ + { \ + int i; \ + bn_wexpand((a),n); \ + if ((a)->d!=NULL) \ + { \ + for (i=(a)->top; id[i]=0; \ + } \ + } + +#define bn_fix_top(a) \ + { \ + BN_ULONG *ftl; \ + if ((a)->top > 0) \ + { \ + for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(ftl--)) break; \ + } \ + } +#endif + +#define BN_MONT_CTX_set(a,b,c) BN_MONT_CTX_set_word((a),(b),(c)) + +#ifndef NOPROTO + + +const BN_ME_METH *BN_ME_METH_word(void); +const BN_ME_METH *BN_ME_METH_full(void); + +#if (defined(BN_MUL_COMBA) || defined(BN_SQR_COMBA)) + +/* word4 - used for 64bit multiprime*/ +const BN_ME_METH *BN_ME_METH_word4(void); +const BN_ME_METH *BN_ME_METH_rec4_word8(void); +const BN_ME_METH *BN_ME_METH_rec4_word16(void); +const BN_ME_METH *BN_ME_METH_rec4_word32(void); +const BN_ME_METH *BN_ME_METH_rec4_word64(void); +const BN_ME_METH *BN_ME_METH_rec4_word128(void); + +/* word6 - used for 64bit multiprime*/ +const BN_ME_METH *BN_ME_METH_word6(void); +const BN_ME_METH *BN_ME_METH_rec6_word12(void); +const BN_ME_METH *BN_ME_METH_rec6_word24(void); +const BN_ME_METH *BN_ME_METH_rec6_word48(void); +const BN_ME_METH *BN_ME_METH_rec6_word96(void); + +const BN_ME_METH *BN_ME_METH_word8(void); +const BN_ME_METH *BN_ME_METH_rec8_word16(void); +const BN_ME_METH *BN_ME_METH_rec8_word32(void); +const BN_ME_METH *BN_ME_METH_rec8_word64(void); +const BN_ME_METH *BN_ME_METH_rec8_word128(void); +const BN_ME_METH *BN_ME_METH_rec8_word256(void); + +const BN_ME_METH *BN_ME_METH_word11(void); +const BN_ME_METH *BN_ME_METH_rec11_word22(void); +const BN_ME_METH *BN_ME_METH_rec11_word44(void); +const BN_ME_METH *BN_ME_METH_rec11_word88(void); + +const BN_ME_METH *BN_ME_METH_word16(void); +const BN_ME_METH *BN_ME_METH_rec16_word32(void); +const BN_ME_METH *BN_ME_METH_rec16_word64(void); +const BN_ME_METH *BN_ME_METH_rec16_word128(void); +const BN_ME_METH *BN_ME_METH_rec16_word256(void); + +#endif + +#ifdef CPU_IA64 +const BN_ME_METH *BN_ME_METH_ia64_384(void); +const BN_ME_METH *BN_ME_METH_ia64_512(void); +const BN_ME_METH *BN_ME_METH_ia64_1024(void); +#endif + +#if (defined(CPU_SPARC_V8PLUS) || defined (CPU_SPARC_V9)) +const BN_ME_METH *BN_ME_METH_usparc(void); +const BN_ME_METH *BN_ME_METH_usparc_352(void); +const BN_ME_METH *BN_ME_METH_usparc_512(void); +#endif + +#if 1 || defined(CPU_X86) +const BN_ME_METH *BN_ME_METH_pentium4_29(void); +const BN_ME_METH *BN_ME_METH_pentium4_28(void); +#endif + +/* NCipher Nfast hardware accelerator method prototype */ +const BN_ME_METH *BN_ME_METH_nfast(void); + + +BIGNUM *BN_value_one(void); +const char * BN_options(void); +BN_CTX *BN_CTX_new(void); +void BN_CTX_init(BN_CTX *c); +void BN_CTX_free(BN_CTX *c); +#ifndef NO_BN_RAND +int BN_rand(BIGNUM *rnd, R_RANDOM *rand, int bits, int top,int bottom); +#endif +int BN_num_bits(BIGNUM *a); +int BN_num_bits_word(BN_ILONG); +BIGNUM *BN_new(void); +void BN_init(BIGNUM *); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(BIGNUM *a, unsigned char *to); +BIGNUM *BN_mpi2bn(unsigned char *s,int len,BIGNUM *ret); +int BN_bn2mpi(BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_usub(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_uadd(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); +int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_div(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx); +int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b,BN_CTX *ctx); +int BN_sqr(BIGNUM *r, BIGNUM *a,BN_CTX *ctx); +BN_ULONG BN_mod_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(BIGNUM *a); +int BN_cmp(BIGNUM *a, BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, BIGNUM *a); +int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p,BN_CTX *ctx); +int BN_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,BN_CTX *ctx, + BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, BIGNUM *a1, BIGNUM *p1,BIGNUM *a2, + BIGNUM *p2,BIGNUM *m,BN_CTX *ctx,BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, + BIGNUM *m,BN_CTX *ctx); +int BN_mask_bits(BIGNUM *a,int n); +int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, BIGNUM *m, + BN_CTX *ctx); +#if !defined(WIN16) && !defined(NO_FP_API) +int BN_print_fp(FILE *fp, BIGNUM *a); +#endif +#ifdef HEADER_COMMON_BIO_H +int BN_print(BIO *fp, BIGNUM *a); +#else +/* int BN_print(char *fp, BIGNUM *a); */ +#endif +int BN_reciprocal(BIGNUM *r, BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *bn_expand2(BIGNUM *b, int bits); +BIGNUM *BN_dup(BIGNUM *a); +int BN_ucmp(BIGNUM *a, BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char * BN_bn2hex(BIGNUM *a); +char * BN_bn2dec(BIGNUM *a); +int BN_hex2bn(BIGNUM **a,char *str); +int BN_dec2bn(BIGNUM **a,char *str); +int BN_gcd(BIGNUM *r,BIGNUM *in_a,BIGNUM *in_b,BN_CTX *ctx); +BIGNUM *BN_mod_inverse(BIGNUM *ret,BIGNUM *a, BIGNUM *n,BN_CTX *ctx); +/* Return R, where it is R*(1< +#include +#include "r_error.h" +#include "err.h" +#include +#else //NITRO +#include "r_error.h" +#ifndef NULL +#define NULL 0 +#endif +#endif + +#ifndef STANDALONE +#include "r_com.h" +#else +#if 0 //RSA +#define NO_STDLIB_MAPPING +#define Malloc(a) malloc(a) +#define Free(a) free(a) +#define Memset(a,b,c) memset(a,b,c) +#define Memcpy(a,b,c) memcpy(a,b,c) +#else // Nitro +#define NO_STDLIB_MAPPING +#include "acmemory.h" +#define Malloc(a) ACMemory_Alloc(a) +#define Free(a) ACMemory_Free(a) +#define Memset(a,b,c) ACMemory_Memset(a,b,c) +#define Memcpy(a,b,c) ACMemory_Memcpy(a,b,c) +#endif +#endif + +/* TEMP FIX */ +#undef BNerr +#define BNerr(a,b) +#include "bn.h" + +#define BN_EXP_TABLE_SIZE 16 + +/* see the bn_limit_ fields which are the start of a runtime + * tunable set of values to match these fixed compile-time constants + */ +/* Pentium pro 16,16,16,32,64 */ +/* Alpha 16,16,16,16.64 */ +/* StrongARM */ +#define BN_MULL_SIZE_NORMAL (16) /* 32 */ +#define BN_MUL_RECURSIVE_SIZE_NORMAL (16) /* 32 */ /* less than */ +#define BN_SQR_RECURSIVE_SIZE_NORMAL (16) /* 32 */ +#define BN_MUL_LOW_RECURSIVE_SIZE_NORMAL (32) /* 32 */ +#define BN_MONT_CTX_SET_SIZE_WORD (64) /* 32 */ + +/************************************************************* + * Using the long long type + */ +#define Lw(t) (((BN_ULONG)(t))&BN_MASK2) +#define Hw(t) (((BN_ULONG)((t)>>BN_BITS2))&BN_MASK2) + +/* These are used for internal error checking and are not normally used */ +#ifdef BN_DEBUG +#define bn_check_top(a) \ + { if ( ((a)->top < 0) || \ + ((a)->top > (a)->max) || \ + (((a)->top == 0) && (a)->neg) || \ + (((a)->top == 1) && (a->d[0] == 0))) \ + { char *nullp=NULL; *nullp='z'; } } +#define bn_check_num(a) if ((a) < 0) { char *nullp=NULL; *nullp='z'; } +#define bn_assert(a) if (!(a)) { char *nullp=NULL; *nullp='z'; } +#define bn_set_used_check(l,size,num) bn_su_check(l,size,num) +#ifdef BN_DEBUG2 +#define bn_do_used_check(fp,str,l,size,num) bn_du_check(fp,str,l,size,num) +#else +#define bn_do_used_check(fp,str,l,size,num) +#endif +#else +#define bn_assert(a) +#define bn_check_top(a) +#define bn_check_num(a) +#define bn_set_used_check(l,size,num) +#define bn_do_used_check(fp,str,l,size,num) +#endif + + +/*********************************************** +* IA64 32 bit build SWIZZLE code +* This essentially casts our points which are +* 32bits under abi32 to 64bit unsigned long +* longs and then grabs the top two bits of the +* pointer and places it in the 2nd and 3rd bits +* of the unsigned long long. +**********************************************/ +#ifdef HPUX_IA64_32 +#define SWIZLLE(VALUE) ((((unsigned long long)(VALUE) & 0xc0000000LL) <<31)\ +|((unsigned long long)(VALUE))) +#else +#define SWIZZLE(VALUE) (VALUE) +#endif + +#define bn_neg_words(a,n) \ + { \ + int iii; \ + \ + for (iii=0; iiimax=(r)->top,BN_set_flags((r),BN_FLG_STATIC_DATA)) +#else +#define bn_set_max(r) +#endif + +/* These macros are used to 'take' a section of a bignum for read only use */ +#define bn_set_low(r,a,n) \ + { \ + (r)->top=((a)->top > (n))?(n):(a)->top; \ + (r)->d=(a)->d; \ + (r)->neg=(a)->neg; \ + (r)->flags|=BN_FLG_STATIC_DATA; \ + bn_set_max(r); \ + } + +#define bn_set_high(r,a,n) \ + { \ + if ((a)->top > (n)) \ + { \ + (r)->top=(a)->top-n; \ + (r)->d= &((a)->d[n]); \ + } \ + else \ + (r)->top=0; \ + (r)->neg=(a)->neg; \ + (r)->flags|=BN_FLG_STATIC_DATA; \ + bn_set_max(r); \ + } + +/* #define bn_expand(n,b) ((((b)/BN_BITS2) <= (n)->max)?(n):bn_expand2((n),(b))) */ + +#ifdef BN_LLONG +#define mul_add(r,a,w,c) { \ + BN_ULLONG t; \ + t=(BN_ULLONG)w * (a) + (r) + (c); \ + (r)= Lw(t); \ + (c)= Hw(t); \ + } + +#define mul(r,a,w,c) { \ + BN_ULLONG t; \ + t=(BN_ULLONG)w * (a) + (c); \ + (r)= Lw(t); \ + (c)= Hw(t); \ + } + +#else +/************************************************************* + * No long long type + */ + +#define LBITS(a) ((a)&BN_MASK2l) +#define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2lh) +#define L2HBITS(a) ((BN_ULONG)((a)&BN_MASK2lh)<>(BN_BITS4-1); \ + m =((m&BN_MASK2l)<<(BN_BITS4+1))&BN_MASK2; \ + l=(l+m)&BN_MASK2; if (l < m) h++; \ + (lo)=l; \ + (ho)=h; \ + } + +#if 0 +#define mul_add(r,a,bl,bh,b_hl,c) { \ + BN_ULONG l,h; \ + BN_ULONG lt,mt; \ + \ + h= (a); \ + l=LBITS(h); \ + h=HBITS(h); \ + mt=bl*l; \ + lt=mt+c+(r); \ + c=bh*h; \ + mt+=c+(l-h)*b_hl; \ + mt+=(lt>>BN_BITS4); \ + (r)=(lt&BN_MASK2l)|((mt&BN_MASK2l)<>BN_BITS4); \ + } +#else /* Normal version */ +#define mul_add(r,a,bl,bh,b_hl,c) { \ + BN_ULONG l,h; \ + \ + h= (a); \ + l=LBITS(h); \ + h=HBITS(h); \ + mul64(l,h,(bl),(bh)); \ + \ + /* non-multiply part */ \ + l=(l+(c))&BN_MASK2; if (l < (c)) h++; \ + (c)=(r); \ + l=(l+(c))&BN_MASK2; if (l < (c)) h++; \ + (c)=h&BN_MASK2; \ + (r)=l; \ + } +#endif + +#define mul(r,a,bl,bh,c) { \ + BN_ULONG l,h; \ + \ + h= (a); \ + l=LBITS(h); \ + h=HBITS(h); \ + mul64(l,h,(bl),(bh)); \ + \ + /* non-multiply part */ \ + l+=(c); if ((l&BN_MASK2) < (c)) h++; \ + (c)=h&BN_MASK2; \ + (r)=l&BN_MASK2; \ + } + +#endif + +#ifndef BN_MUL_COMBA +#define bn_mul_comba4(r,a,b) bn_mul_normal(r,a,4,b,4) +#define bn_mul_comba5(r,a,b) bn_mul_normal(r,a,5,b,5) +#define bn_mul_comba6(r,a,b) bn_mul_normal(r,a,6,b,6) +#define bn_mul_comba8(r,a,b) bn_mul_normal(r,a,8,b,8) +#define bn_mul_comba11(r,a,b) bn_mul_normal(r,a,11,b,11) +#define bn_mul_comba12(r,a,b) bn_mul_normal(r,a,12,b,12) +#define bn_mul_comba16(r,a,b) bn_mul_normal(r,a,16,b,16) +#endif +#if 1 +#ifndef BN_SQR_COMBA +#define bn_sqr_comba4(r,a) bn_mul_normal(r,a,4,a,4) +#define bn_sqr_comba5(r,a) bn_mul_normal(r,a,5,a,5) +#define bn_sqr_comba6(r,a) bn_mul_normal(r,a,6,a,6) +#define bn_sqr_comba8(r,a) bn_mul_normal(r,a,8,a,8) +#define bn_sqr_comba11(r,a) bn_mul_normal(r,a,11,a,11) +#define bn_sqr_comba12(r,a) bn_mul_normal(r,a,12,a,12) +#define bn_sqr_comba16(r,a) bn_mul_normal(r,a,16,a,16) +#endif +#else +#ifndef BN_SQR_COMBA +#define bn_sqr_comba4(r,a) bn_mul_comba4(r,a,a) +#define bn_sqr_comba5(r,a) bn_mul_comba5(r,a,a) +#define bn_sqr_comba6(r,a) bn_mul_comba6(r,a,a) +#define bn_sqr_comba8(r,a) bn_mul_comba8(r,a,a) +#define bn_sqr_comba11(r,a) bn_mul_comba11(r,a,a) +#define bn_sqr_comba12(r,a) bn_mul_comba12(r,a,a) +#define bn_sqr_comba16(r,a) bn_mul_comba16(r,a,a) +#endif +#endif +#ifndef BN_REDUCE_COMBA +#define r0_bn_mont_comba4(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba5(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba6(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba8(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba11(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba12(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#define r0_bn_mont_comba16(r,a,n,num,n0) bn_from_montgomery_words(r,a,n,num,n0) +#endif + +#ifndef NOPROTO + +BIGNUM *bn_expand2(BIGNUM *b, int bits); + +#ifdef X86_ASM +void bn_add_words(BN_ULONG *r,BN_ULONG *a,int num); +#endif + +#else + +BIGNUM *bn_expand2(); +#ifdef X86_ASM +BN_ULONG bn_add_words(); +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_COMMON_BN_LCL_H */ + +void bn_mul_low_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,BN_ULONG *t); +void bn_mul_high(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,BN_ULONG *l,int n2, BN_ULONG *t); +int BN_gen_exp_string(unsigned char *str, BIGNUM *p, int bits); +void bn_from_montgomery_rec_full(BN_ULONG *rp, BN_ULONG *ap, + BN_ULONG *np, BN_ULONG *nip, BN_ULONG *tmp,BN_REC *rec); + +int bn_mont_ctx_new_word(const BN_ME_METH *meth, BN_ME_CTX **retp); + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/bn_thx.h b/build/libraries_sysmenu/acsign/ARM9/include/bn_thx.h new file mode 100644 index 00000000..451b3e4d --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/bn_thx.h @@ -0,0 +1,317 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/***************************************************************************** + * Copyright (c). 2001 RSA Security Inc. All rights reserved. + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + ****************************************************************************/ +/** + * @file bn_thx.h + * @brief header file created for used as interface defines for systems + * containing hetergeneous environments where some bn operations + * will be performed in isolation from the rest of the library + */ +#ifndef HEADER_COMMON_BN_THX_H +#define HEADER_COMMON_BN_THX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* These defines are required on systems so that the mod_exp code + * to be used in isolation from the bn operation with library will work, + * if these are not available, the header files with equivalent functionality + * should be added inside a CPU or Operating system define + */ +#ifndef NO_STDIO_H +#include +#endif + +#ifndef NO_STDLIB_H +#include +#endif + +#ifndef NO_STRING_H +#include +#endif + +/* Interface for ARM/DSP systems, this interface requires only + * the standard defines and includes at the moment + */ +#ifdef CPU_TMS320 +#define THX_RECIPIENT +#define CPU_DSP +#endif + +#ifdef THX_RECIPIENT + +#ifndef restrict +#define restrict +#endif + +#ifndef Malloc +#define Malloc malloc +#endif + +#ifndef Memcpy +#define Memcpy memcpy +#endif + +#ifndef Memmove +#define Memmove memmove +#endif + +#ifndef Memset +#define Memset memset +#endif + +#ifndef Free +#define Free free +#endif + +#endif /* THX_RECIPIENT */ + +#ifndef THX_RECIPIENT /* not the recipient, we must be the caller */ + +#include "bn_lcl.h" + +#endif /* ! THX_RECIPIENT */ + +/* The follow define protected inclusions are excerpts from the + * header file bn.h, this has been done, so that code written for the + * THX systems can be used in isolation from the library + * This code may need to be updated in line with changes to the bn.h + * header file. + */ +#ifndef HEADER_COMMON_BN_H +#define HEADER_COMMON_BN_H + +#if !defined(CCONV) +#define CCONV +#endif + +#ifndef PRE_CCONV +#define PRE_CCONV +#endif + +/* convert from the new to the old option names */ +#if defined(OPT_BN_LLONG) +#define BN_LLONG /* comment to make sure Configure leaves this alone */ +#endif + +#if defined(OPT_32_BIT_INT) || defined(OPT_32_BIT) +#define THIRTY_TWO_BIT +#endif + +#define BN_ILONG BN_ULONG + +#ifdef THIRTY_TWO_BIT +#define BN_ULLONG unsigned long long +#ifdef OPT_32_BIT_INT +#define BN_ULONG unsigned int +#define BN_LONG int +#else +#define BN_ULONG unsigned long +#define BN_LONG long +#endif +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +/* This is needed because the Watcom compiler pre-processor + * under QNX is perverted and tries to parses the 'LL' + * part even though it is never used. + */ +#ifdef BN_LLONG +#define BN_MASK (0xffffffffffffffffL) +#endif +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2lh (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#define BN_HEX_FMT "%08lX" +#endif + +#define BN_EXP_TABLE_SIZE 16 + +typedef struct bignum_st BIGNUM; + +struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int max; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + }; + +PRE_CCONV BN_ULONG CCONV bn_mul_add_words(BN_ULONG *rp,BN_ULONG *ap, + int num, BN_ULONG w); +PRE_CCONV BN_ULONG CCONV bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, + int num, BN_ULONG w); +PRE_CCONV void CCONV bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); +BN_ULONG CCONV bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); +PRE_CCONV BN_ULONG CCONV bn_add_words(BN_ULONG *rp, BN_ULONG *ap, + BN_ULONG *bp,int num); +PRE_CCONV BN_ULONG CCONV bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, + BN_ULONG *bp,int num); + +#ifndef BN_ME_METH +#define BN_ME_METH void +#endif + +#endif /* ! HEADER_COMMON_BN_H */ + +/* The follow define protected inclusions are excerpts from the + * header file r_error.h, this has been done, so that code written for the + * THX systems can be used in isolation from the library + * This code may need to be updated in line with changes to the r_error.h + * header file. + */ +#ifndef HEADER_COMMON_R_ERROR_H +#define HEADER_COMMON_R_ERROR_H + +/* The FATAL_INTERNAL_ERROR is a flag that is set with the following + * error codes: + * R_ERROR_INVALID_STATE + * R_ERROR_INIT_NOT_CALLED + * R_ERROR_SHOULD_NOT_HAVE_BEEN_CALLED + */ +#define R_ERROR_FATAL_INTERNAL_ERROR 64 + +/* The BAD_PARAMETER is a flag that is set with the following error + * codes: + * R_ERROR_NULL_ARG + * R_ERROR_BUFFER_TOO_SMALL + * R_ERROR_BAD_VALUE + * R_ERROR_BAD_RANGE + * R_ERROR_BAD_FORMAT + * R_ERROR_BAD_TYPE + * R_ERROR_BAD_DATA + * R_ERROR_BAD_LENGTH + */ +#define R_ERROR_BAD_PARAMETER 32 + +/* Base value for all general errors used through all products */ +#define R_ERROR_BASE 10000 + +#define R_ERROR_NONE 0 + +#define R_ERROR_FAILED (R_ERROR_BASE+1) +#define R_ERROR_IO (R_ERROR_BASE+2) +#define R_ERROR_PROTOCOL (R_ERROR_BASE+3) +#define R_ERROR_EOF (R_ERROR_BASE+4) +#define R_ERROR_ALLOC_FAILURE (R_ERROR_BASE+5) +#define R_ERROR_EVAL_RESTRICTION (R_ERROR_BASE+6) +#define R_ERROR_EVAL_EXPIRED (R_ERROR_BASE+7) +#define R_ERROR_NOT_FOUND (R_ERROR_BASE+8) +#define R_ERROR_NOT_AVAILABLE (R_ERROR_BASE+9) +#define R_ERROR_NOT_IMPLEMENTED (R_ERROR_BASE+10) +#define R_ERROR_NOT_SUPPORTED (R_ERROR_BASE+11) +#define R_ERROR_INVALID_STATE \ + ((R_ERROR_BASE+12) | R_ERROR_FATAL_INTERNAL_ERROR) +#define R_ERROR_INIT_NOT_CALLED \ + ((R_ERROR_BASE+13) | R_ERROR_FATAL_INTERNAL_ERROR) +#define R_ERROR_SHOULD_NOT_HAVE_BEEN_CALLED \ + ((R_ERROR_BASE+14) | R_ERROR_FATAL_INTERNAL_ERROR) +#define R_ERROR_METHOD_UNDEFINED \ + ((R_ERROR_BASE+15) | R_ERROR_FATAL_INTERNAL_ERROR) +#define R_ERROR_BUFFER_TOO_SMALL \ + ((R_ERROR_BASE+16) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_NULL_ARG ((R_ERROR_BASE+17) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_VALUE ((R_ERROR_BASE+18) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_RANGE ((R_ERROR_BASE+19) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_FORMAT ((R_ERROR_BASE+20) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_TYPE ((R_ERROR_BASE+21) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_DATA ((R_ERROR_BASE+22) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_BAD_LENGTH ((R_ERROR_BASE+23) | R_ERROR_BAD_PARAMETER) +#define R_ERROR_RCOM_LIBRARY_NOT_SUPPORTED (R_ERROR_BASE+24) + +/* Resource Manager base for errors */ +#define R_COM_ERR_LIB_CTX_BASE 10100 + +#endif /* HEADER_COMMON_R_ERROR_H */ + + +const BN_ME_METH *BN_ME_METH_thxc(void); +/** + * @note THX code only needs to store rr, n0, str + * + */ +typedef struct thxc_mont_ctx_st + { + BIGNUM *rr; + unsigned char *str; + unsigned int str_len; + BN_ULONG n0; + } THXC_MONT_CTX; + + +int Rx_thxr_mod_exp_mont( BN_ULONG *result, BN_ULONG *ap, BN_ULONG *np, + BN_ULONG *rrp, BN_ULONG n0, int top, int tmp_len, unsigned char *str); + +int Ri_thxr_mod_exp_mont( BN_ULONG *result, BN_ULONG *ap, BN_ULONG *np, + BN_ULONG *rrp, BN_ULONG *dp, BN_ULONG *aap, BN_ULONG *rp, BN_ULONG *tmp, + BN_ULONG n0, int top, unsigned char *str); + +void Ri_thxr_mul_normal(BN_ULONG *r,BN_ULONG *a,int na,BN_ULONG *b,int nb); +void Ri_thxr_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp); + +void Ri_thxr_from_montgomery_words(BN_ULONG *ret,BN_ULONG *ap,BN_ULONG *np, + int w, BN_ULONG n0); + +BN_ULONG Ri_thxr_from_mont_words(BN_ULONG *ap,BN_ULONG *wap, + BN_ULONG *np, int w, BN_ULONG n0); + +#ifdef CPU_TMS320 + +/* Method and functions required for the ARM/DSP interface */ + +const BN_ME_METH *BN_ME_METH_dspc(void); + +int Rx_dsp_mod_exp_mont( BN_ULONG *result, BN_ULONG *ap, BN_ULONG *np, + BN_ULONG *rrp, BN_ULONG n0, int top, int tmp_len, unsigned char *str); + +int Ri_dsp_mod_exp_mont( BN_ULONG *result, BN_ULONG *ap, BN_ULONG *np, + BN_ULONG *rrp, BN_ULONG *dp, BN_ULONG *aap, BN_ULONG *rp, BN_ULONG *tmp, + BN_ULONG n0, int top, unsigned char *str); + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_COMMON_BN_THX_H */ diff --git a/build/libraries_sysmenu/acsign/ARM9/include/md5.h b/build/libraries_sysmenu/acsign/ARM9/include/md5.h new file mode 100644 index 00000000..7a5ca73a --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/md5.h @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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 _MD5_H_ +#define _MD5_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* MD5.H - header file for MD5C.C + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +typedef struct MD5_CTX MD5_CTX; +typedef struct MD5_CTX MD5Context; + +/* MD5 context. */ +struct MD5_CTX{ + unsigned long state[4]; /* state (ABCD) */ + unsigned long count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} ; + +void MD5Init(MD5_CTX *); +void MD5Update(MD5_CTX *, unsigned char *, unsigned int); +void MD5Final(unsigned char digest[16], MD5_CTX *); + + +#if defined( MD5_TEST ) +int MD5Test( ); +#endif // MD5_TEST + +#ifdef __cplusplus +} +#endif + +#endif // _MD5_H_ diff --git a/build/libraries_sysmenu/acsign/ARM9/include/r_error.h b/build/libraries_sysmenu/acsign/ARM9/include/r_error.h new file mode 100644 index 00000000..16ffb55a --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/r_error.h @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/** + * @file r_error.h + * This file contains the error definitions for the toolkit. + */ +#ifndef HEADER_COMMON_R_ERROR_H +#define HEADER_COMMON_R_ERROR_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup R_ERROR_IDS Error Identifiers + * This section outlines the error codes returned, enabling identification of + * specific errors. For more information, see the + * Developer's Guide. + * + * @{ + */ +/** + * Indicates that a fatal error has occurred in the operation performed. + * This flag is set with the following error codes:
    + *
      + *
    • #R_ERROR_INVALID_STATE.
    • + *
    • #R_ERROR_INIT_NOT_CALLED.
    • + *
    • #R_ERROR_SHOULD_NOT_HAVE_BEEN_CALLED.
    • + *
    + */ +#define R_ERROR_FATAL_INTERNAL_ERROR 64 + +/** + * Indicates that the specified parameter is incorrect or contains invalid + * information. This flag is set with the following error codes:
    + *
      + *
    • #R_ERROR_NULL_ARG.
    • + *
    • #R_ERROR_BUFFER_TOO_SMALL.
    • + *
    • #R_ERROR_BAD_VALUE.
    • + *
    • #R_ERROR_BAD_RANGE.
    • + *
    • #R_ERROR_BAD_FORMAT.
    • + *
    • #R_ERROR_BAD_TYPE.
    • + *
    • #R_ERROR_BAD_DATA.
    • + *
    • #R_ERROR_BAD_LENGTH.
    • + *
    + */ +#define R_ERROR_BAD_PARAMETER 32 + +/* Indicates the base value for all general errors used through all products */ +#define R_ERROR_BASE 10000 + +/** + * Indicates that no errors were detected in the requested operation. + */ +#define R_ERROR_NONE 0 + +/** + * Indicates that the requested operation failed. + */ +#define R_ERROR_FAILED (R_ERROR_BASE+1) +/** + * Indicates that the requested operation detected an Input/Output error. + */ +#define R_ERROR_IO (R_ERROR_BASE+2) +/** + * Indicates that the requested operation detected a protocol error. + */ +#define R_ERROR_PROTOCOL (R_ERROR_BASE+3) +/** + * Indicates that the requested operation detected an End-of-File (EOF) error. + */ +#define R_ERROR_EOF (R_ERROR_BASE+4) +/** + * Indicates that the requested operation failed in a memory allocation + * operation. + */ +#define R_ERROR_ALLOC_FAILURE (R_ERROR_BASE+5) +/** + * Indicates that the requested operation is restricted in an evaluation + * version of the library. + */ +#define R_ERROR_EVAL_RESTRICTION (R_ERROR_BASE+6) +/** + * Indicates that the evaluation period of the library has expired. + */ +#define R_ERROR_EVAL_EXPIRED (R_ERROR_BASE+7) +/** + * Indicates that the requested operation detected that a pre-requirement was + * not found. + */ +#define R_ERROR_NOT_FOUND (R_ERROR_BASE+8) +/** + * Indicates that the requested operation detected that a pre-requirement was + * unavailable. + */ +#define R_ERROR_NOT_AVAILABLE (R_ERROR_BASE+9) +/** + * Indicates that the requested operation is not implemented in the current + * instantiation of the library. + */ +#define R_ERROR_NOT_IMPLEMENTED (R_ERROR_BASE+10) +/** + * Indicates that the requested operation is not supported in the current + * instantiation of the library. + */ +#define R_ERROR_NOT_SUPPORTED (R_ERROR_BASE+11) +/** + * Indicates that the requested operation entered an invalid state. + */ +#define R_ERROR_INVALID_STATE \ + ((R_ERROR_BASE+12) | R_ERROR_FATAL_INTERNAL_ERROR) +/** + * Indicates that the requested operation detected that an initialization + * operation has not been performed. + */ +#define R_ERROR_INIT_NOT_CALLED \ + ((R_ERROR_BASE+13) | R_ERROR_FATAL_INTERNAL_ERROR) +/** + * Indicates that the requested operation should not have been called. + */ +#define R_ERROR_SHOULD_NOT_HAVE_BEEN_CALLED \ + ((R_ERROR_BASE+14) | R_ERROR_FATAL_INTERNAL_ERROR) +/** + * Indicates that the requested method is not defined. + */ +#define R_ERROR_METHOD_UNDEFINED \ + ((R_ERROR_BASE+15) | R_ERROR_FATAL_INTERNAL_ERROR) +/** + * Indicates that the requested operation detected an inadequately sized + * buffer. + */ +#define R_ERROR_BUFFER_TOO_SMALL \ + ((R_ERROR_BASE+16) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * was passed as NULL. + */ +#define R_ERROR_NULL_ARG ((R_ERROR_BASE+17) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed contained a bad or incorrect value. + */ +#define R_ERROR_BAD_VALUE ((R_ERROR_BASE+18) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed was out of the allowed range. + */ +#define R_ERROR_BAD_RANGE ((R_ERROR_BASE+19) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed used a format that is not supported or incorrect. + */ +#define R_ERROR_BAD_FORMAT ((R_ERROR_BASE+20) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed used a type that is not supported or incorrect. + */ +#define R_ERROR_BAD_TYPE ((R_ERROR_BASE+21) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed contained incorrect or invalid data. + */ +#define R_ERROR_BAD_DATA ((R_ERROR_BASE+22) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the requested operation detected that a required argument + * passed contained an incorrect length value. + */ +#define R_ERROR_BAD_LENGTH ((R_ERROR_BASE+23) | R_ERROR_BAD_PARAMETER) +/** + * Indicates that the library instantiation requested is not supported. + */ +#define R_ERROR_RCOM_LIBRARY_NOT_SUPPORTED (R_ERROR_BASE+24) +/** + * Indicates that the request operation was denied. + */ +#define R_ERROR_DENIED (R_ERROR_BASE+25) +/** + * Indicates that authentication is required before the operation + * can succeed. + */ +#define R_ERROR_AUTHENTICATION_REQUIRED (R_ERROR_BASE+26) + +/** + * Indicates that a required module was unable to be loaded. + */ +#define R_ERROR_MODULE_LOAD_FAILED \ + ((R_ERROR_BASE+27)|R_ERROR_FATAL_INTERNAL_ERROR) + +/* Resource Manager base for errors */ +#define R_COM_ERR_LIB_CTX_BASE 10100 + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_COMMON_R_ERROR_H */ + + + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/r_stdiag.h b/build/libraries_sysmenu/acsign/ARM9/include/r_stdiag.h new file mode 100644 index 00000000..fbe3d3ca --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/r_stdiag.h @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +/* + * *************************************************************************** + * + * Purpose: + * + * This file defines an API for performing stack diagnostics. + * + * It provides: + * Peek Stack Usage statistics + * To use it: + * 1. Build the library without "NO_R_DIAG" defined + * 2. Make a call to R_DIAG_set_stack_datum() prior to + * calling the first library function. + * 3. Add calls to the macro R_DIAG_CHECK_STACK where potential + * high stack usage points are. + * 4. Call R_DIAG_get_stack_low_water_mark() at then end of the + * library calls to return the maximum stack usage OR + * 5. Call R_DIAG_print_stack_depth() to display the peek stack + * usage + * + * + * + * History: + * 3-Aug-00 mjs development + * + * ************************************************************************** + */ + + +#ifndef HEADER_COMMON_R_STDIAG_H +#define HEADER_COMMON_R_STDIAG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NO_R_DIAG + +#ifdef NOPROTO +int R_DIAG_set_stack_datum(char *ptr); +int R_DIAG_check_stack(char *ptr, char *file, int line, int hit); +int R_DIAG_get_stack_low_water_mark(int *depth, char **file, int *line, + int *hit); +int R_DIAG_print_stack_depth(BIO *bio); + +#else + +int R_DIAG_set_stack_datum(); +int R_DIAG_check_stack(); +int R_DIAG_get_stack_low_water_mark(); +int R_DIAG_print_stack_depth(); + +#endif + +#define R_DIAG_CHECK_STACK {\ + char r_diag_stack_check_var = 0;\ + static int r_diag_stack_check_cnt = 0;\ +\ + R_DIAG_check_stack(&r_diag_stack_check_var, __FILE__,\ + __LINE__,++r_diag_stack_check_cnt);\ + } +#else +#define R_DIAG_CHECK_STACK +#endif + + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_COMMON_R_STDIAG_H */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/r_types.h b/build/libraries_sysmenu/acsign/ARM9/include/r_types.h new file mode 100644 index 00000000..f6514b13 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/r_types.h @@ -0,0 +1,257 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/** + * @file r_types.h + * This file contains the library structure and type definitions. + */ +#ifndef HEADER_COMMON_R_TYPES_H +#define HEADER_COMMON_R_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup DATA_MNG_FLAGS Data Management Flags + * This section lists the data management flags. + * @{ + */ + +/** + * @} + */ + +/* This gets set if the flags field if the we need to 'free' the + * R_RANDOM when we call R_rand_free(). If it is not set, the + * rand_ctrl will only be called to clean things up. + */ +#define R_RANDOM_FLG_MALLOCED 0x01 + +/* portable form of a random callback function */ +/** + * @typedef R_RANDOM + * The random object type. + */ +typedef struct r_random_st R_RANDOM; +/** + * This structure is used by the random object type. + */ +struct r_random_st +{ + /** + * A method function for generation of random data. + * + * @see R_rand_bytes(). + */ + int (*rand_bytes)(R_RANDOM *ctx,unsigned char *bytes,int len); + /** + * A method function for seeding of the random generator. + * @see R_rand_seed(). + */ + int (*rand_seed)(R_RANDOM *ctx,unsigned char *bytes,int len); + /** + * A method function for control of the random generator used by + * other functions as a single interface. + * + * @see R_rand_entropy_count(), R_rand_set_entropy_func(), + * R_rand_get_entropy_func(), R_rand_load_file(), R_rand_write_file() + * and R_rand_file_name(). + */ + int (*rand_ctrl)(R_RANDOM *ctx,int op,char *arg); + /** + * The data used by the random implementation. + */ + char *arg; + /** + * A method flag for used for keeping the state of the #R_RANDOM. + */ + int flags; /* normally set to zero */ +}; +/** + * @typedef R_SURRENDER + * The surrender function and argument. + */ +typedef struct r_surrender_st R_SURRENDER; +/** + * This structure provides a status update of a time intensive operation. It + * also allows you to abort the operation if required. + */ +struct r_surrender_st +{ + /* Return 0 to continue, non-zero to 'cancel' function */ + /** + * The surrender function pointer used as a generic method of + * passing user-defined callback or information collection functions. + */ + int (*callback)(R_SURRENDER *ctx,int function,int num); + /** + * The argument data used by the callback operation. + */ + char *arg; +}; + +typedef struct r_fixed_point_number_st R_FIXED_POINT_NUMBER; +struct r_fixed_point_number_st +{ + unsigned long hi; + unsigned long lo; +}; + +/** + * @typedef R_INDEXED_INFO + * This structure details the index containing information for get and set + * functions. + */ +typedef struct r_indexed_info_st R_INDEXED_INFO; +/** This structure details the index containing information for get and set + * functions. + */ +struct r_indexed_info_st +{ + /** The index into the list of the item to work with. */ + int index; + /** The data of the item in the list. */ + void *data; + /** The length of the data. */ + unsigned int len; + /** The data value as an integer. */ + int value; +}; + +/** + * @typedef R_ID_INFO + * The information to work with requires a second identity value to find it. + */ +typedef struct r_id_info_st R_ID_INFO; +/** The information to get or set requires a second information identifier. + * This type is used when calling set_info and get_info to get a number of + * information items in one call. + */ +struct r_id_info_st +{ + /** The information identifier. */ + int info_id; + /** The information data associated with the identifier. */ + void *value; +}; + +/** @defgroup R_FLAG_COPY_IDS Copy Flag Identifiers + * + * This section provides information on the copy mode. When data is passed + * to/from the library you can specify whether or not the copy should be done + * by value, by reference or by direct assignment. + * @ingroup DATA_MNG_FLAGS + * @{ + */ + +/** + * The copy flag. When data is passed to/from the library you can specify + * whether or not the copy should be done by value, by reference or + * by direct assignment. + */ +typedef int R_FLAG_COPY; + +/* + * action flag app lib + * obj_get BY_VAL F X + * BY_REF X F [app will not free "obj" until it is + * BY_ASSIGN F X finished with the returned reference] + * obj_set BY_VAL F X + * BY_REF F X [app will not free passed reference + * BY_ASSIGN X F until after it has freed "obj"] + * + * BY_REF makes the lifetime of the two objects linked and it is up to + * the application to manage the objects in a manner that preserves this + * relationship. + */ + +/** + * Indicates to copy by value. A complete clone of the object is made. + * The lifecycles of the two objects are independent. + */ +#define R_FLAG_COPY_BY_VALUE 0x0000 + +/** + * Indicates to copy by reference. A reference to the object is made. + * The lifecycles of objects sharing references are linked. + */ +#define R_FLAG_COPY_BY_REFERENCE 0x0001 + +/** + * Indicates to copy by assignment. The object is assigned to the required + * party. The caller does not keep a reference to the passed object. + */ +#define R_FLAG_COPY_BY_ASSIGN 0x0002 + +/** + * Indicates to copy using the default flag settings. + */ +#define R_FLAG_COPY_DEFAULT R_FLAG_COPY_BY_VALUE + +/** + * @} + */ + +/** @defgroup R_FLAG_SHARE_IDS Shared Flag Identifiers + * + * This section provides information on the shared flags available. + * @ingroup DATA_MNG_FLAGS + * @{ + */ + +/** + * The constructor flag. Indicates whether or not it is permissible to share + * the internal state between objects. + */ +typedef int R_FLAG_SHARE; + +/** + * Indicates to share nothing. The states of the two objects are completely + * separate. + */ +#define R_FLAG_SHARE_NONE 0x0000 + +/** + * Indicates to share data. Constructed objects may reference the state of + * the object from which it was constructed. The lifecycles of the two objects + * are linked. + */ +#define R_FLAG_SHARE_DATA 0x0001 + +/** Indicates the share default in which nothing is shared. */ +#define R_FLAG_SHARE_DEFAULT R_FLAG_SHARE_NONE + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/build/libraries_sysmenu/acsign/ARM9/include/sha.h b/build/libraries_sysmenu/acsign/ARM9/include/sha.h new file mode 100644 index 00000000..e1543a75 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/sha.h @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef HEADER_COMMON_SHA_H +#define HEADER_COMMON_SHA_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(CCONV) +#define CCONV +#endif + +#ifndef PRE_CCONV +#define PRE_CCONV +#endif + +#define SHA_CBLOCK 64 +#define SHA_LBLOCK 16 +#define SHA_BLOCK 16 +#define SHA_LAST_BLOCK 56 +#define SHA_LENGTH_BLOCK 8 +#define SHA_DIGEST_LENGTH 20 + +/* the default is to use unsigned long */ +#if !defined(OPT_SHA_INT) && !defined(OPT_SHA_LONG) +#define OPT_SHA_LONG +#endif + +#ifdef OPT_SHA_LONG +#define SHA_LONG unsigned long +#endif + +#ifdef OPT_SHA_INT +#define SHA_LONG unsigned int +#endif + +typedef struct sha_ctx_st SHA_CTX; + +struct sha_ctx_st + { + SHA_LONG h0,h1,h2,h3,h4; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + int num; + void (PRE_CCONV CCONV *sha_block)(SHA_CTX *c, const unsigned char *W, + int num); + }; + +#ifndef NOPROTO +int SHA1_Setup(SHA_CTX *c, void (PRE_CCONV CCONV *sha_block)(SHA_CTX *c, + const unsigned char *W, int num)); +void SHA_Init(SHA_CTX *c); +void SHA_Update(SHA_CTX *c, const unsigned char *data, unsigned long len); +void SHA_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); +void SHA_Transform(SHA_CTX *c, const unsigned char *data); +void SHA1_Init(SHA_CTX *c); +void SHA1_Update(SHA_CTX *c, const unsigned char *data, unsigned long len); +void SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); +#else +void SHA_Init(); +void SHA_Update(); +void SHA_Final(); +unsigned char *SHA(); +void SHA_Transform(); +void SHA1_Init(); +void SHA1_Update(); +void SHA1_Final(); +unsigned char *SHA1(); +void SHA1_Transform(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_COMMON_SHA_H */ diff --git a/build/libraries_sysmenu/acsign/ARM9/include/sha1.h b/build/libraries_sysmenu/acsign/ARM9/include/sha1.h new file mode 100644 index 00000000..692f2e9b --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/sha1.h @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * sha1.h + * + * Description: + * This is the header file for code which implements the Secure + * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published + * April 17, 1995. + * + * Many of the variable names in this code, especially the + * single character names, were used because those were the names + * used in the publication. + * + * Please read the file sha1.c for more information. + * + */ + +#ifndef _SHA1_H_ +#define _SHA1_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SHA_enum_ +#define _SHA_enum_ +enum +{ + shaSuccess = 0, + shaNull, /* Null pointer parameter */ + shaInputTooLong, /* input data too long */ + shaStateError /* called Input after Result */ +}; +#endif + +/* + * This structure will hold context information for the SHA-1 + * hashing operation + */ +typedef struct SHA1Context +{ + unsigned long Intermediate_Hash[20/4]; /* Message Digest */ + + unsigned long Length_Low; /* Message length in bits */ + unsigned long Length_High; /* Message length in bits */ + + int Message_Block_Index; /* Index into message block array */ + unsigned char Message_Block[64]; /* 512-bit message blocks */ + + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corrupted? */ +} SHA1Context; + +/* + * Function Prototypes + */ + +int SHA1Reset( SHA1Context *); +int SHA1Input( SHA1Context *, + const unsigned char *, + unsigned int); +int SHA1Result( SHA1Context *, + unsigned char Message_Digest[20]); + +#if defined( SHA1_TEST ) +int SHA1Test( ); +#endif // SHA1_TEST + + +#ifdef __cplusplus +} +#endif + +#endif // _SHA1_H_ diff --git a/build/libraries_sysmenu/acsign/ARM9/include/sha_locl.h b/build/libraries_sysmenu/acsign/ARM9/include/sha_locl.h new file mode 100644 index 00000000..10553ab4 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/include/sha_locl.h @@ -0,0 +1,290 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef HEADER_COMMON_SHA_LOCL_H +#define HEADER_COMMON_SHA_LOCL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STANDALONE +#include "r_com.h" +#else +#if 0 //RSA +#include +#include +#include +#define Memcpy memcpy +#define Memset memset +#define Strcpy strcpy +#else //NITRO +#include "acmemory.h" +#define Malloc(a) ACMemory_Alloc(a) +#define Free(a) ACMemory_Free(a) +#define Memset(a,b,c) ACMemory_Memset(a,b,c) +#define Memcpy(a,b,c) ACMemory_Memcpy(a,b,c) +#endif +#endif + +#ifdef undef +/* one or the other must be defined */ +#ifndef SHA_1 /* FIPE 180-1 */ +#define SHA_0 /* FIPS 180 */ +#endif +#endif + +#define ULONG unsigned long +#define UCHAR unsigned char +#define UINT unsigned int + +#ifdef NOCONST +#define const +#endif + +#undef c2nl +#define c2nl(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++))) )) + +#undef p_c2nl +#define p_c2nl(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + case 3: l|=((unsigned long)(*((c)++))); \ + } \ + } + +#undef c2nl_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2nl_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<< 8; \ + case 2: l|=((unsigned long)(*(--(c))))<<16; \ + case 1: l|=((unsigned long)(*(--(c))))<<24; \ + } \ + } + +#undef p_c2nl_p +#define p_c2nl_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++)))<<24; \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<<16; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<< 8; \ + } \ + } + +#undef nl2c +#define nl2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +#undef c2l +#define c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ + l|=(((unsigned long)(*((c)++)))<< 8), \ + l|=(((unsigned long)(*((c)++)))<<16), \ + l|=(((unsigned long)(*((c)++)))<<24)) + +#undef p_c2l +#define p_c2l(c,l,n) { \ + switch (n) { \ + case 0: l =((unsigned long)(*((c)++))); \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + case 3: l|=((unsigned long)(*((c)++)))<<24; \ + } \ + } + +#undef c2l_p +/* NOTE the pointer is not incremented at the end of this */ +#define c2l_p(c,l,n) { \ + l=0; \ + (c)+=n; \ + switch (n) { \ + case 3: l =((unsigned long)(*(--(c))))<<16; \ + case 2: l|=((unsigned long)(*(--(c))))<< 8; \ + case 1: l|=((unsigned long)(*(--(c)))); \ + } \ + } + +#undef p_c2l_p +#define p_c2l_p(c,l,sc,len) { \ + switch (sc) \ + { \ + case 0: l =((unsigned long)(*((c)++))); \ + if (--len == 0) break; \ + case 1: l|=((unsigned long)(*((c)++)))<< 8; \ + if (--len == 0) break; \ + case 2: l|=((unsigned long)(*((c)++)))<<16; \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24)&0xff)) + +#ifdef OPT_SHA_B_ENDIAN +#define B_ENDIAN +#endif +#ifdef OPT_SHA_L_ENDIAN +#define L_ENDIAN +#endif + +#undef ROTATE +#if defined(WIN32) +#define ROTATE(a,n) _lrotl(a,n) +#else +#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) +#endif + +/* byte order reversal */ +#if defined(WIN32) +/* 5 instructions with rotate instruction, else 9 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + (a)=((ROTATE(l,8)&0x00FF00FF)|(ROTATE(l,24)&0xFF00FF00)); \ + } +#else +/* 6 instructions with rotate instruction, else 8 */ +#define Endian_Reverse32(a) \ + { \ + unsigned long l=(a); \ + l=(((l&0xFF00FF00)>>8L)|((l&0x00FF00FF)<<8L)); \ + (a)=ROTATE(l,16L); \ + } +#endif + +/* F() below can be + * simplified to the code in F_00_19. + * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) + * another tweak to be made + * in F_40_59, (x&a)|(y&a) -> (x|y)&a + */ +#define F_00_19(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) +#define F_20_39(b,c,d) ((b) ^ (c) ^ (d)) +#define F_40_59(b,c,d) (((b) & (c)) | (((b)|(c)) & (d))) +#define F_60_79(b,c,d) F_20_39(b,c,d) + +#ifdef SHA_0 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) X[(i)&0x0f]=(a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]); +#endif +#ifdef SHA_1 +#undef Xupdate +#define Xupdate(a,i,ia,ib,ic,id) (a)=\ + (ia[(i)&0x0f]^ib[((i)+2)&0x0f]^ic[((i)+8)&0x0f]^id[((i)+13)&0x0f]);\ + X[(i)&0x0f]=(a)=ROTATE((a),1); +#endif + +#define BODY_00_15(i,a,b,c,d,e,f,xa) \ + (f)=xa[i]+(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_60_79(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)=X[(i)&0x0f]+(e)+K_60_79+ROTATE((a),5)+F_60_79((b),(c),(d)); \ + (b)=ROTATE((b),30); + +/* + * The CodeWarrior compiler has a problem correctly expanding things like + * + * (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); + * + * so we separate this to 3 explicit adds, just for PalmOS. + */ +#ifndef UNDER_PALMOS + +#define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_00_19+ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_32_39(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_20_39+ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_40_59(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e)+K_40_59+ROTATE((a),5)+F_40_59((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#else /* UNDER_PALMOS */ + +#define BODY_16_19(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e); \ + (f)+=K_00_19; \ + (f)+=ROTATE((a),5)+F_00_19((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_20_31(i,a,b,c,d,e,f,xa,xb,xc,xd) \ + Xupdate(f,i,xa,xb,xc,xd); \ + (f)+=(e); \ + (f)+=K_20_39; \ + (f)+=ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_32_39(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e); \ + (f)+=K_20_39; \ + (f)+=ROTATE((a),5)+F_20_39((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#define BODY_40_59(i,a,b,c,d,e,f,xa) \ + Xupdate(f,i,xa,xa,xa,xa); \ + (f)+=(e); \ + (f)+=K_40_59; \ + (f)+=ROTATE((a),5)+F_40_59((b),(c),(d)); \ + (b)=ROTATE((b),30); + +#endif /* UNDER_PALMOS */ + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_COMMON_SHA_LOCL_H */ diff --git a/build/libraries_sysmenu/acsign/ARM9/src/acmemory.c b/build/libraries_sysmenu/acsign/ARM9/src/acmemory.c new file mode 100644 index 00000000..d97bac91 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/acmemory.c @@ -0,0 +1,335 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +// +// BN系関数用のメモリ関連処理を置き換え +// +#include +#include "acmemory.h" + +/* + head tail + | | | | + +--------+---------+----....----+---------+--------+ + |block |check |buffer |check |block | + +--------+---------+----....----+---------+--------+ + |4byte |4byte |Upper4(size)|4byte |4byte | + <------------------ 4 * n -------------------> + + block = n = (4 * 4 + Upper4(size)) / 4 + check = 0x0F5555F0:未使用/0x0FAAAAF0:使用中 +*/ + +unsigned long aACMemoryPoolA[ 16 ]; +unsigned long aACMemoryPool[ 1024 * 32 / sizeof (unsigned long) ]; // 32K +unsigned long aACMemoryPoolB[ 16 ]; + +#define ACMEMORYPOOL_HEAD (aACMemoryPool) +#define ACMEMORYPOOL_TAIL (aACMemoryPool + sizeof aACMemoryPool / sizeof (unsigned long)) +#define ACMEMORYPOOL_SIZE ((unsigned long)ACMEMORYPOOL_TAIL - (unsigned long)ACMEMORYPOOL_HEAD) + +#define ACMEMORY_CHECK_BASE 0xF000000F +#define ACMEMORY_CHECK_FREE (0x00555500 | ACMEMORY_CHECK_BASE) +#define ACMEMORY_CHECK_USED (0x00AAAA00 | ACMEMORY_CHECK_BASE) + +#define ACMemory_Lower4( _size ) (((_size) ) & 0xFFFFFFFC) +#define ACMemory_Upper4( _size ) (((_size) + 3) & 0xFFFFFFFC) + +#define pACMemory_FromHeadToBody( _head ) ((unsigned long*)(((volatile unsigned long*)(_head)) + 2)) +#define pACMemory_FromBodyToHead( _body ) ((unsigned long*)(((volatile unsigned long*)(_body)) - 2)) +#define pACMemory_FromHeadToTail( _head ) ((unsigned long*)(((volatile unsigned long*)(_head)) + nACMemory_HeadBlock( _head ))) +#define pACMemory_FromTailToHead( _tail ) ((unsigned long*)(((volatile unsigned long*)(_tail)) - nACMemory_TailBlock( _tail ))) +#define nACMemory_HeadBlock( _head ) (((volatile unsigned long*)(_head))[+0]) +#define nACMemory_HeadCheck( _head ) (((volatile unsigned long*)(_head))[+1]) +#define nACMemory_TailBlock( _tail ) (((volatile unsigned long*)(_tail))[-1]) +#define nACMemory_TailCheck( _tail ) (((volatile unsigned long*)(_tail))[-2]) + + +static void *(*s_acsignAlloc)( u32 length ); +static void (*s_acsignFree)( void *ptr ); + +void ACSign_SetAllocFunc( void *(*pAlloc)( u32 ), void (*pFree)( void * ) ); +void ACSign_SetAllocFunc( void *(*pAlloc)( u32 ), void (*pFree)( void * ) ) +{ + s_acsignAlloc = pAlloc; + s_acsignFree = pFree; +} + + +//#define USE_OSALLOC +//#define USE_ACMEMORY_DEBUGDUMP +//#define USE_ACMEMORY_DEBUGFILL + +// +#if defined( USE_ACMEMORY_DEBUGDUMP ) +static +void acMemory_DebugDump( ) +{ + unsigned long* ptr = ACMEMORYPOOL_HEAD; + + // + OS_Printf( "----ACMemory_Dump [0x%.8x - 0x%.8x : 0x%.8x ]----\n", ACMEMORYPOOL_HEAD, ACMEMORYPOOL_TAIL, ACMEMORYPOOL_SIZE ); + + for ( ; (unsigned long)ptr < (unsigned long)ACMEMORYPOOL_TAIL; ) + { + OS_Printf( " [0x%.8x - 0x%.8x] (0x%.8x) <%c> ", + ptr, + pACMemory_FromHeadToTail( ptr ), + nACMemory_HeadBlock( ptr ), + nACMemory_HeadCheck( ptr ) == ACMEMORY_CHECK_USED ? '*' : '-' ); + + //OS_Printf( "0x%.8x 0x%.8x", nACMemory_HeadBlock( ptr ), nACMemory_HeadCheck( ptr ) ); + + //OS_Printf( " .... " ); + + ptr += nACMemory_HeadBlock( ptr ); + + //OS_Printf( "0x%.8x 0x%.8x", nACMemory_TailCheck( ptr ), nACMemory_TailBlock( ptr ) ); + + OS_Printf( "\n" ); + OS_PrintServer(); + } + ptr = 0; +} + +#define ACMemory_DebugDump( ) acMemory_DebugDump( ) + +#else + +#define ACMemory_DebugDump( ) + +#endif //USE_ACMEMORY_DEBUGDUMP + +// +#if defined( USE_ACMEMORY_DEBUGFILL ) +static +void acMemory_DebugFill( void* ptr, int cnt, int val ) +{ + (void)ACMemory_Memset( ptr, val, cnt ); +} + +#define ACMemory_DebugFill( _ptr, _cnt, _val ) acMemory_DebugFill( _ptr, _cnt, _val ) + +#else + +#define ACMemory_DebugFill( _ptr, _cnt, _val ) + +#endif //USE_ACMEMORY_DEBUGFILL + +// +void ACMemory_Clear( ) +{ + unsigned long* head = ACMEMORYPOOL_HEAD; + unsigned long* tail = ACMEMORYPOOL_TAIL; + unsigned long block; + unsigned long check; + + + block = ACMEMORYPOOL_SIZE / 4; + check = ACMEMORY_CHECK_FREE; + + nACMemory_HeadBlock( head ) = block; + nACMemory_HeadCheck( head ) = check; + nACMemory_TailBlock( tail ) = block; + nACMemory_TailCheck( tail ) = check; + + ACMemory_DebugFill( pACMemory_FromHeadToBody( head ), (block - 4) * 4, 0xFF ); + ACMemory_DebugDump( ); +} + +// +void* ACMemory_Alloc( u32 size ) +{ + if( s_acsignAlloc ) { + return s_acsignAlloc( size ); + } + return NULL; + + /* + #if defined( USE_OSALLOC ) + OSIntrMode nOSIntrMode; + void* alloc = NULL; + + nOSIntrMode = OS_DisableInterrupts( ); + alloc = OS_Alloc( size ); + (void)OS_RestoreInterrupts( nOSIntrMode ); + return alloc; + + #else + + unsigned long* head = ACMEMORYPOOL_HEAD; + unsigned long* tail = ACMEMORYPOOL_TAIL; + unsigned long block, oldblock, newblock; + unsigned long check, oldcheck, newcheck; + + if ( !size ) return 0; + + // + if ( size < 16 ) size = 16; + block = 4 + ACMemory_Upper4( size ) / 4; + check = ACMEMORY_CHECK_USED; + + // + for ( ; ; ) + { + if ( (unsigned long)head >= (unsigned long)tail ) + { + head = 0; + break; + } + + newblock = nACMemory_HeadBlock( head ); + newcheck = nACMemory_HeadCheck( head ); + if ( newcheck == check ) + { + head += newblock; + continue ; + } + if ( newblock < block + 4 + 4 ) + { + head += newblock; + continue ; + } + + break; + } + + if ( !head ) return 0; + + // + oldblock = nACMemory_HeadBlock( head ); + oldcheck = nACMemory_HeadCheck( head ); + + nACMemory_HeadBlock( head ) = block; + nACMemory_HeadCheck( head ) = check; + + tail = pACMemory_FromHeadToTail( head ); + nACMemory_TailBlock( tail ) = block; + nACMemory_TailCheck( tail ) = check; + + if ( (unsigned long)tail < (unsigned long)ACMEMORYPOOL_TAIL ) + { + nACMemory_HeadBlock( tail ) = oldblock - block; + nACMemory_HeadCheck( tail ) = oldcheck; + tail = pACMemory_FromHeadToTail( tail ); + nACMemory_TailBlock( tail ) = oldblock - block; + nACMemory_TailCheck( tail ) = oldcheck; + } + + // + (void)ACMemory_Memset( pACMemory_FromHeadToBody( head ), 0x00, (block - 4) * 4 ); + + ACMemory_DebugFill( pACMemory_FromHeadToBody( head ), (block - 4) * 4, 0x00 ); + ACMemory_DebugDump( ); + + return (void*)pACMemory_FromHeadToBody( head ); + #endif + */ +} + +// +void ACMemory_Free( void* adrs ) +{ + if( s_acsignFree ) { + s_acsignFree( adrs ); + } + /* + #if defined( USE_OSALLOC ) + OSIntrMode nOSIntrMode; + + nOSIntrMode = OS_DisableInterrupts( ); + OS_Free( adrs ); + (void)OS_RestoreInterrupts( nOSIntrMode ); + #else + + unsigned long* work; + unsigned long* head; + unsigned long* tail; + unsigned long block; + unsigned long check; + + + if ( !adrs ) return ; + + // + head = pACMemory_FromBodyToHead( adrs ); + tail = pACMemory_FromHeadToTail( head ); + block = nACMemory_HeadBlock( head ); + check = ACMEMORY_CHECK_FREE; + + // + if ( nACMemory_HeadBlock( head ) != nACMemory_TailBlock( tail ) ) + return ; + if ( nACMemory_HeadCheck( head ) != nACMemory_TailCheck( tail ) ) + return ; + + + // + if ( (unsigned long)head != (unsigned long)ACMEMORYPOOL_HEAD ) + { + work = pACMemory_FromTailToHead( head ); + if ( nACMemory_HeadCheck( work ) == check ) + { + block += nACMemory_HeadBlock( work ); + head = work; + } + } + // + if ( (unsigned long)tail != (unsigned long)ACMEMORYPOOL_TAIL ) + { + work = pACMemory_FromHeadToTail( tail ); + if ( nACMemory_TailCheck( work ) == check ) + { + block += nACMemory_TailBlock( work ); + tail = work; + } + } + + // + nACMemory_HeadBlock( head ) = nACMemory_TailBlock( tail ) = block; + nACMemory_HeadCheck( head ) = nACMemory_TailCheck( tail ) = check; + + ACMemory_DebugFill( pACMemory_FromHeadToBody( head ), (block - 4) * 4, 0xFF ); + ACMemory_DebugDump( ); + + #endif + */ +} + + +// +void* ACMemory_Memset( void* adrs, u32 val, u32 cnt ) +{ + if ( !adrs ) return 0; + MI_CpuFill8( (void*)adrs, (u8)val, (u32)cnt ); + return adrs; +} + +// +void* ACMemory_Memcpy( void* dst, void* src, u32 cnt ) +{ + if ( !dst || !src ) return 0; + MI_CpuCopy8( (const void*)src, (void*)dst, (u32)cnt ); + return dst; +} + + +void* ACMemory_Realloc( void *adrs, u32 nowsize, u32 newsize ) +{ +#pragma unused( adrs, nowsize, newsize ) + return NULL; +} diff --git a/build/libraries_sysmenu/acsign/ARM9/src/acsign.c b/build/libraries_sysmenu/acsign/ARM9/src/acsign.c new file mode 100644 index 00000000..89a528cd --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/acsign.c @@ -0,0 +1,453 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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 "acmemory.h" + +// SHA1 +#include "sha.h" +#include "sha1dgst.c" + +#define _DLENGTH_ (160/8) +#define _BLENGTH_ (512/8) + +#define HASHContext SHA_CTX + +#define HASHReset( _context ) (void)SHA1_Init( _context ) +#define HASHSetSource( _context, _ptr, _len ) (void)SHA1_Update( _context, _ptr, _len ) +#define HASHGetDigest( _context, _ptr ) (void)SHA1_Final( _ptr, _context ) + +// BN +#include "bn.h" + +#include "bn_lib.c" +#include "bn_asm.c" +#include "bn_comba.c" +#include "bn_lsh.c" +#include "bn_rsh.c" +#include "bn_word.c" +#include "bn_add.c" +#include "bn_mul.c" +#include "bn_div.c" +#include "bn_exp.c" +#include "bn_sqr.c" +#include "bn_fm_w.c" +#include "bn_gcd.c" +#include "bn_ex_str.c" +#include "bn_ms_w.c" +//#include "bn_me.c" +#include "bn_rec.c" +#include "bn_mont.c" +#include "bn_recp.c" +#include "bn_wdiv.c" +#include "bn_r_exp.c" +#include "bn_m_exp.c" + + +#if !defined( RSA_ENC_DEC ) + +#define BER_NULL 5 +#define BER_OBJECT 6 +#define BER_SEQUENCE 16 +#define BER_OCTET_STRING 4 +#define BER_CONSTRUCTED 0x20 + + +// +// rsa_padding_check_pkcs1_type_1関数相当 +// +static +int decode_padding( unsigned char* pdst_adrs, unsigned int* pdst_size, + unsigned char* psrc_adrs, unsigned int nsrc_size, + int length ) +{ + unsigned char* p; + unsigned char* q; + unsigned char* pe; + int i; + + if (nsrc_size >= length ) + return 0; + + /* The leading 0 was removed by the bignum->bin conversion */ + if (nsrc_size < 10) + return 0; + + p = psrc_adrs; + pe = &(psrc_adrs[nsrc_size]); + /* if (p[0] != 0) goto err; */ + if ( p[0] != 1 ) + return 0; + p++; + + for ( i = 0; i < 8; i++ ) + { + if ( *(p++) != 0xFF ) + return 0; + } + for ( ; p != pe; p++ ) + { + if ( *p != 0xFF ) + break; + } + if ( p == pe ) + return 0; + + if ( *(p++) != 0 ) + return 0; + + *pdst_size = (unsigned int)((int)pe - (int)p); + q = pdst_adrs; + while ( p != pe ) + *(q++)= *(p++); + + return 1; +} + +// +// +// +static +int pk_skip( unsigned char **datap, unsigned int *dlenp, + unsigned char type, unsigned int *lenp) +{ + unsigned char *data = *datap; + unsigned int dlen = *dlenp; + unsigned int len = 0; + unsigned char l; + + if (*(data++) != type) + return 0; + + if (dlen < 1) + return 0; + dlen--; + + if ( (*data & 0x80) != 0 ) + { + l = (unsigned char)( *data & 0x7F ); + if (dlen < (unsigned int)l + 1) + return 0; + dlen -= l; + if (lenp != NULL) + { + data++; + do + { + len <<= 7; + len += (*data & 0x7f); + l--; + } + while (l > 0); + } + else + { + data += l; + } + } + else + { + len = *data; + data++; + if (dlen < 1) + return 0; + dlen--; + } + + *datap = data; + *dlenp = dlen; + if (lenp != NULL) + { + *lenp = len; + } + + return 1; +} + +// +// PK_decode_sighash関数相当 +// +static +int decode_sighash( unsigned char* data, unsigned int dlen, + unsigned char** ppdgst_adrs, unsigned int* pdgst_size, + unsigned char** pphash_adrs, unsigned int* phash_size ) +{ + #if 0 + /* 01 */ OB_cmpu(BER_SEQUENCE, 0, 0), + /* 02 */ OB_down(0, 1), + /* 03 */ OB_cmpu(BER_SEQUENCE, 0, 0), + /* 04 */ OB_down(0, 1), + /* 05 */ OB_cmpu(BER_OBJECT, 0, 0), + /* 06 */ OB_call(OB_F_SET, PK_TYPE_SIG, PK_SIG_DIGEST_OID), + + /* go up a level - we got all we need out of the + * sequence that contains the parameters + * - we could OB_next(0,1) and check that we have BER_NULL + * as then next item but there is no real need to do that + */ + + /* 07 */ OB_up(0, 1), + /* 08 */ OB_next(0, 1), + /* 09 */ OB_cmpu(BER_OCTET_STRING, 0, 0), + /* 10 */ OB_call(OB_F_SET, PK_TYPE_SIG, PK_SIG_HASH), + + /* 11 */ OB_exit(0), + /* 12 */ OB_FINISH, + #endif + + unsigned int len; + + if ( !pk_skip(&data, &dlen, (BER_SEQUENCE|BER_CONSTRUCTED), NULL) ) + return 0; + + if ( !pk_skip(&data, &dlen, (BER_SEQUENCE|BER_CONSTRUCTED), NULL) ) + return 0; + + if ( !pk_skip(&data, &dlen, (BER_OBJECT), &len) ) + return 0; + + /* + if (digest != NULL) + { + digest->adrs = data; + digest->size = len; + } + */ + if ( ppdgst_adrs ) *ppdgst_adrs = data; + if ( pdgst_size ) *pdgst_size = len; + + data += len; + if (dlen < len) + return 0; + dlen -= len; + + if ( !pk_skip(&data, &dlen, BER_NULL, &len) ) + return 0; + data += len; + if (dlen < len) + return 0; + dlen -= len; + + if ( !pk_skip(&data, &dlen, (BER_OCTET_STRING), &len) ) + return 0; + + /* + if (hash != NULL) + { + hash->adrs = data; + hash->size = len; + } + */ + if ( pphash_adrs ) *pphash_adrs = data; + if ( phash_size ) *phash_size = len; + + return 1; +} + +#endif + + + + +// +#define SGN_LEN 128 +#define MOD_LEN 128 +#define EXP_LEN 3 + +int ACSign_Decrypto( + void* buffer, // 出力領域 + void* sgn_ptr, // データへのポインタ + void* key_ptr // キーへのポインタ + ) +{ + BN_CTX* ctx; + BIGNUM src, dst, exp, mod; + void* exp_ptr; + void* mod_ptr; + int nTmp, nWrk; + unsigned char* pAdrs = 0; + unsigned int nSize = 0; + unsigned long nDummyExp = 0x00010001; // 65537固定 + unsigned long aBufferA[ 256 / sizeof (unsigned long) ]; + unsigned long aBufferB[ 256 / sizeof (unsigned long) ]; + + + if ( !buffer ) return 0; + if ( !sgn_ptr ) return 0; + if ( !key_ptr ) return 0; + + // +// ACMemory_Clear( ); + + // + exp_ptr = &nDummyExp; + mod_ptr = key_ptr; + + (void)ACMemory_Memset( aBufferA, 0, sizeof aBufferA ); + (void)ACMemory_Memset( aBufferB, 0, sizeof aBufferB ); + + ctx=BN_CTX_new(); + + BN_init( &src ); + BN_init( &dst ); + BN_init( &exp ); + BN_init( &mod ); + + (void)BN_bin2bn( sgn_ptr, SGN_LEN, &src ); + (void)BN_bin2bn( exp_ptr, EXP_LEN, &exp ); + (void)BN_bin2bn( mod_ptr, MOD_LEN, &mod ); + + nTmp = BN_mod_exp( &dst, &src, &exp, &mod, ctx ); + + nTmp = BN_bn2bin( &dst, (unsigned char*)aBufferA ); + + BN_free( &src ); + BN_free( &dst ); + BN_free( &exp ); + BN_free( &mod ); + + if (ctx != NULL) + BN_CTX_free(ctx); + + #if defined( RSA_ENC_DEC ) + + pAdrs = (unsigned char*)aBufferA + 4; //ダミー部4バイトは読み飛ばし + nSize = nTmp; + + (void)ACMemory_Memcpy( buffer, pAdrs, _DLENGTH_ * 4 ); + + #else + + if ( !decode_padding( (unsigned char*)aBufferB, (unsigned int*)&nWrk, (unsigned char*)aBufferA, (unsigned int )nTmp, SGN_LEN ) ) + return 0; + if ( !decode_sighash( (unsigned char*)aBufferB, (unsigned int)nWrk, NULL, NULL, (unsigned char**)&pAdrs, (unsigned int*)&nSize ) ) + return 0; + if ( nSize != _DLENGTH_ ) + return 0; + + (void)ACMemory_Memcpy( buffer, pAdrs, _DLENGTH_ * 1 ); + + #endif + + return 1; +} + + +// +#define ROMH_SIZE 0x0160 +int ACSign_Digest( + void* buffer, // 出力領域 + void* romh_ptr, // データへのポインタ + void* mbin_ptr, // データへのポインタ + int mbin_len, // データの長さ + void* sbin_ptr, // データへのポインタ + int sbin_len, // データの長さ + u32 serial_num // シリアルナンバー + ) +{ + #if defined( RSA_ENC_DEC ) + HASHContext context; + + + if ( !buffer ) return 0; + if ( !romh_ptr ) return 0; + if ( !mbin_ptr || !mbin_len ) return 0; + if ( !sbin_ptr || !sbin_len ) return 0; + + + HASHReset( &context ); + HASHSetSource( &context, romh_ptr, ROMH_SIZE ); + HASHGetDigest( &context, (unsigned char*)buffer + _DLENGTH_ * 0 ); + + HASHReset( &context ); + HASHSetSource( &context, mbin_ptr, mbin_len ); + HASHGetDigest( &context, (unsigned char*)buffer + _DLENGTH_ * 1 ); + + HASHReset( &context ); + HASHSetSource( &context, sbin_ptr, sbin_len ); + HASHGetDigest( &context, (unsigned char*)buffer + _DLENGTH_ * 2 ); + + HASHReset( &context ); + HASHSetSource( &context, buffer, _DLENGTH_ * 3 ); + HASHGetDigest( &context, (unsigned char*)buffer + _DLENGTH_ * 3 ); + + #else + + HASHContext context; + unsigned char aBuffer[ (_DLENGTH_ * 3 + sizeof (unsigned long)) ]; + + if ( !buffer ) return 0; + if ( !romh_ptr ) return 0; + if ( !mbin_ptr || !mbin_len ) return 0; + if ( !sbin_ptr || !sbin_len ) return 0; + + HASHReset( &context ); + HASHSetSource( &context, romh_ptr, ROMH_SIZE ); + HASHGetDigest( &context, (unsigned char*)aBuffer + _DLENGTH_ * 0 ); + + HASHReset( &context ); + HASHSetSource( &context, mbin_ptr, mbin_len ); + HASHGetDigest( &context, (unsigned char*)aBuffer + _DLENGTH_ * 1 ); + + HASHReset( &context ); + HASHSetSource( &context, sbin_ptr, sbin_len ); + HASHGetDigest( &context, (unsigned char*)aBuffer + _DLENGTH_ * 2 ); + + // シリアル番号分 今は0固定 + aBuffer[ (_DLENGTH_ * 3) + 0 ] = (unsigned char)((serial_num >> 0) & 0xFF); + aBuffer[ (_DLENGTH_ * 3) + 1 ] = (unsigned char)((serial_num >> 8) & 0xFF); + aBuffer[ (_DLENGTH_ * 3) + 2 ] = (unsigned char)((serial_num >> 16) & 0xFF); + aBuffer[ (_DLENGTH_ * 3) + 3 ] = (unsigned char)((serial_num >> 24) & 0xFF); + + HASHReset( &context ); + HASHSetSource( &context, (unsigned char*)aBuffer, _DLENGTH_ * 3 + sizeof (unsigned long) ); + HASHGetDigest( &context, (unsigned char*)buffer ); + #endif + return 1; +} + + +// +int ACSign_Compare( + void* decrypto, // ACSign_Decryptoの出力 + void* digest // ACSign_Digestの出力 + ) +{ + unsigned char* ptrA = (unsigned char*)decrypto; + unsigned char* ptrB = (unsigned char*)digest; + int loop; + int test = 1; + + if ( !decrypto ) return 0; + if ( !digest ) return 0; + + #if defined( RSA_ENC_DEC ) + for ( loop = 0; loop < _DLENGTH_ * 4; loop++ ) + #else + for ( loop = 0; loop < _DLENGTH_ * 1; loop++ ) + #endif + { + if ( *ptrA++ != *ptrB++ ) + { + test = 0; + break; + } + } + return test; +} + + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/acsign_encrypt.c b/build/libraries_sysmenu/acsign/ARM9/src/acsign_encrypt.c new file mode 100644 index 00000000..fdb4d898 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/acsign_encrypt.c @@ -0,0 +1,205 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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 "acmemory.h" +#include "ber.h" + +// SHA1 +#include "sha.h" + +#define _DLENGTH_ (160/8) +#define _BLENGTH_ (512/8) + +#define HASHContext SHA_CTX + +#define HASHReset( _context ) (void)SHA1_Init( _context ) +#define HASHSetSource( _context, _ptr, _len ) (void)SHA1_Update( _context, _ptr, _len ) +#define HASHGetDigest( _context, _ptr ) (void)SHA1_Final( _ptr, _context ) + +// BN +#include "bn.h" +#include "bn_lcl.h" + +#define BER_NULL 5 +#define BER_OBJECT 6 +#define BER_SEQUENCE 16 +#define BER_OCTET_STRING 4 +#define BER_CONSTRUCTED 0x20 + + +// RSAキー構成要素のパラメータ +typedef struct KeyParam { + u8 *pData; + int length; +}KeyParam; + +static BOOL GetRSAPrivateKeyParam( const u8 *pKeyDER, KeyParam *pMod, KeyParam *pPrvExp ); + + +// +// rsa_padding_add_pkcs1_type_1関数相当 +// +static int add_padding(unsigned char *out, + int out_len, const unsigned char *in, int in_len) +{ + unsigned char *p; + int j,i; + + if ((in_len+11) > out_len) + return(1); + + /* First we copy data bytes to the output buffer, this + * way the input and output buffers can be the same + * and things will still work */ + p=out+out_len-in_len; + for (i=in_len-1; i>=0; i--) + p[i]=in[i]; + p=out; + *(p++)=0; + *(p++)=1; /* Private Key BT (Block Type) */ + + /* pad with 0xff data */ + j=out_len-3-in_len; + Memset(p,0xff,(u32)j); + p[j]='\0'; + return(0); +} + + +// +// RSA +// +#define SIGN_DATA_ENCODE_BER_LEN 0x0f +#define ACS_ENCRYPTED_SIGN_LEN 128 +BOOL ACSign_Encrypto(void *sign, const void *key, const void *data, int length, BOOL isEncodeBER ) +{ + BN_CTX *ctx; + BIGNUM src, dst, exp, mod; + u8 buf[ACS_ENCRYPTED_SIGN_LEN]; + u8 dataBER[ACS_ENCRYPTED_SIGN_LEN]; + BOOL result = TRUE; + KeyParam key_mod; + KeyParam key_prvExp; + const void *pData; + int len; + + if (NULL == sign || NULL == key || NULL == data || 0 > length || ( ACS_ENCRYPTED_SIGN_LEN - SIGN_DATA_ENCODE_BER_LEN ) < length ) { + return FALSE; + } + + if( !GetRSAPrivateKeyParam( key, &key_mod, &key_prvExp ) ) { + OS_TPrintf( "RSA PrivKey Param get failed.\n" ); + return FALSE; + } + + if( isEncodeBER ) { + const u8 *pSignDataEncodeBER = (const u8 *)"\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14"; + u8 *p = dataBER; + int i; + for( i = 0; i < SIGN_DATA_ENCODE_BER_LEN; i++ ) { + *p++ = pSignDataEncodeBER[ i ]; + } + for( i = 0; i < length; i++ ) { + *p++ = ((const u8 *)data)[ i ]; + } + pData = dataBER; + length += SIGN_DATA_ENCODE_BER_LEN; + }else { + pData = data; + } + + if ( add_padding( buf, ACS_ENCRYPTED_SIGN_LEN, pData, length ) ) { + OS_TPrintf("encode_padding was failed.\n"); + result = FALSE; + goto end; + } + + + ctx = BN_CTX_new(); + + BN_init(&src); + BN_init(&dst); + BN_init(&exp); + BN_init(&mod); + + BN_bin2bn((u8*)buf, ACS_ENCRYPTED_SIGN_LEN, &src); + BN_bin2bn(key_prvExp.pData, key_prvExp.length, &exp); + BN_bin2bn(key_mod.pData, key_mod.length, &mod); + + BN_mod_exp( &dst, &src, &exp, &mod, ctx ); + + { // BIGNUMは最上位が"0"の時、長さが減らされるので、あらかじめ調整しておく + u8 *pSign = sign; + int padLen = ACS_ENCRYPTED_SIGN_LEN - BN_num_bytes( &dst ); + while( ( padLen > 0 ) && ( padLen < ACS_ENCRYPTED_SIGN_LEN ) ) { + *pSign++ = 0; + padLen--; + } + + len = BN_bn2bin( &dst, pSign ); + } + + BN_free(&src); + BN_free(&dst); + BN_free(&exp); + BN_free(&mod); + + if (ctx) { + BN_CTX_free(ctx); + } + + if ( len > ACS_ENCRYPTED_SIGN_LEN ) { // サイズチェック。 + OS_TPrintf( "len = %d\n", len ); + result = FALSE; + goto end; + } +end: + return result; +} + + +// DERフォーマットのRSA PublicKeyからパラメータを取得 +static BOOL GetRSAPrivateKeyParam( const u8 *pKeyDER, KeyParam *pMod, KeyParam *pPrvExp ) +{ + BOOL retval = FALSE; + BER_ITEMS_SK sk; + BER_ITEMS *bi; + BER_ITEM item; + + // 先頭アイテムから、ファイル全体のサイズを算出 + if( BER_read_item( &item, (unsigned char *)pKeyDER, 16 ) ) { + return FALSE; + } + + BER_ITEMS_SK_init( &sk, NULL, 0, 0 ); + if( BER_parse( &sk, (unsigned char *)pKeyDER, item.data.len + item.hlen, NULL ) == BER_OK ) { + bi = BER_ITEMS_SK_items( &sk, 2 ); // mod + pMod->pData = bi->item.data.bytes; + pMod->length = (int)bi->item.data.len; + + bi = BER_ITEMS_SK_items( &sk, 4 ); // private exp + pPrvExp->pData = bi->item.data.bytes; + pPrvExp->length = (int)bi->item.data.len; + + retval = TRUE; + } + BER_ITEMS_SK_free( &sk ); + + return retval; +} + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/acsign_util.c b/build/libraries_sysmenu/acsign/ARM9/src/acsign_util.c new file mode 100644 index 00000000..0dd8ee07 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/acsign_util.c @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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 + +#define AUTH_KEY_BUFFER_LEN 128 +#define MB_AUTH_SIGN_SIZE (128) /* digital sign size */ + + +typedef struct MbAuthCode +{ + char magic_code[2]; // マジックナンバー + u16 version; // バージョン + u8 sign[MB_AUTH_SIGN_SIZE]; // 署名 + u32 serial_number; // シリアル番号 +} MbAuthCode; // 16byte + + + +static u8 key_buffer[AUTH_KEY_BUFFER_LEN] = { + 0x9E,0xC1,0xCC,0xC0,0x4A,0x6B,0xD0,0xA0,0x6D,0x62,0xED,0x5F,0x15,0x67,0x87,0x12, + 0xE6,0xF4,0x77,0x1F,0xD8,0x5C,0x81,0xCE,0x0C,0xD0,0x22,0x31,0xF5,0x89,0x08,0xF5, + 0xBE,0x04,0xCB,0xC1,0x4F,0x63,0xD9,0x5A,0x98,0xFF,0xEB,0x36,0x0F,0x9C,0x5D,0xAD, + 0x15,0xB9,0x99,0xFB,0xC6,0x86,0x2C,0x0A,0x0C,0xFC,0xE6,0x86,0x03,0x60,0xD4,0x87, + 0x28,0xD5,0x66,0x42,0x9C,0xF7,0x04,0x14,0x4E,0x6F,0x73,0x20,0xC3,0x3E,0x3F,0xF5, + 0x82,0x2E,0x78,0x18,0xD6,0xCD,0xD5,0xC2,0xDC,0xAA,0x1D,0x34,0x91,0xEC,0x99,0xC9, + 0xF7,0xBF,0xBF,0xA0,0x0E,0x1E,0xF0,0x25,0xF8,0x66,0x17,0x54,0x34,0x28,0x2D,0x28, + 0xA3,0xAE,0xF0,0xA9,0xFA,0x3A,0x70,0x56,0xD2,0x34,0xA9,0xC5,0x9E,0x5D,0xF5,0xE1 +}; + + +int ACSignDecrpto(void *output_buffer, MBDownloadFileInfo *download_file_info_buf) +{ + return ACSign_Decrypto(output_buffer, + ((MbAuthCode *)(download_file_info_buf->auth_code))->sign, + key_buffer); +} + + +int ACSignDigest(void *input_buffer, MBDownloadFileInfo *download_file_info_buf) +{ + int ret_code; + u8 digest_output_buffer[AUTH_BUFFER_LEN]; + + ret_code = ACSign_Digest((void *)digest_output_buffer, // 出力領域 20 Bytes + (void *)(download_file_info_buf->seg[0].recv_addr), + (void *)(download_file_info_buf->seg[1].recv_addr), + (int)(download_file_info_buf->seg[1].size), + (void *)(download_file_info_buf->seg[2].recv_addr), + (int)(download_file_info_buf->seg[2].size), + ((MbAuthCode *)(download_file_info_buf)->auth_code)->serial_number // serial_number + ); + if( ret_code == 0 ) + { + return ret_code; // failure + } + + return ACSign_Compare( + input_buffer, // ACSign_Decryptoの出力 + (void*)digest_output_buffer // ACSign_Digestの出力 + ); +} + +#if 0 +void* doAlloc( int size ) +{ + OSIntrMode nOSIntrMode; + void* alloc = NULL; + + nOSIntrMode = OS_DisableInterrupts( ); + alloc = OS_Alloc( size ); + (void)OS_RestoreInterrupts( nOSIntrMode ); + return alloc; +} + +void doFree( void* adrs ) +{ + OSIntrMode nOSIntrMode; + + nOSIntrMode = OS_DisableInterrupts( ); + OS_Free( adrs ); + (void)OS_RestoreInterrupts( nOSIntrMode ); +} + +void* doMemset( void* adrs, int val, int cnt ) +{ + return memset( adrs, val, cnt ); +} + +void* doMemcpy( void* dst, void* src, int cnt ) +{ + return memcpy( dst, src, cnt ); +} + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/ber_isk.c b/build/libraries_sysmenu/acsign/ARM9/src/ber_isk.c new file mode 100644 index 00000000..77137220 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/ber_isk.c @@ -0,0 +1,295 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber_isk.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "ber_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BER_ITEMS_SK_INIT +#define SPLIT_BER_ITEMS_SK_GET +#define SPLIT_BER_ITEMS_APPEND +#define SPLIT_BER_ITEMS_UNDER +#define SPLIT_BER_ITEMS_SK_GROW +#define SPLIT_BER_ITEMS_SK_FREE +#endif /* NO_SPLIT */ + +/* BER_ITEMS_SK_EXPAND_COUNT - number of items to expand to given that + * there are "X" items currently. + * + * note: each item typically costs 28 bytes so 20 is around .5k which + * is a reasonable growth size + */ +#define BER_ITEMS_SK_EXPAND_COUNT(X) ((X)+20) + +#ifdef SPLIT_BER_ITEMS_SK_INIT +/** + * Initialises the stack of BER items. The array of items, the current number + * of items and the maximum number of items allocated may be set. + * + * @param sk [In] A stack of BER items. + * @param items [In] An array of BER items. + * @param num [In] The number of BER items in the array. + * @param max [In] The number of BER items allocated in the array. + */ +void BER_ITEMS_SK_init(BER_ITEMS_SK *sk, BER_ITEMS *items, unsigned int num, + unsigned int max) +{ + sk->num=num; + sk->max=max; + if (items == NULL) + { + sk->flags=BER_FLAG_DYNAMIC_ITEMS; + } + else + { + sk->flags=0; + } + sk->items=items; + +#ifndef NO_STREAM + sk->state=BER_STATE_READ_NEXT_ITEM; + sk->inf=0; + sk->pinf=0; + sk->con=0; + sk->down=1; + sk->this_idx=-1; + sk->next=NULL; +#endif /* !NO_STREAM */ +} +#endif /* SPLIT_BER_ITEMS_SK_INIT */ + +#ifdef SPLIT_BER_ITEMS_SK_GET +/** + * Obtains the next available BER item in the stack. + * + * @param sk [In] Stack of BER items. + * @param index [Out] Index into array of new item. + * @return Indication of successful completion of function. + * Values are: + *
  • 0 indicates the function succeeded.
  • + *
  • >0 indicates the function failed.
  • + * + * @note If there is no item available in the array then the array is grown. + * This means that an existing external pointer to an item may not be + * valid after a call to this function. + */ +int BER_ITEMS_SK_get(BER_ITEMS_SK *sk, int *index) +{ + int ret; /* return value */ + BER_ITEMS *it; /* next item */ + + /* Ensure there are enough spare items. */ + if (sk->num >= sk->max) + { + /* Reallocate the array. */ + ret = BER_ITEMS_SK_grow(sk, BER_ITEMS_SK_EXPAND_COUNT(sk->num)); + if (ret != 0) + { + return(ret); + } + } + + /* Set the new item index for return. */ + *index = (int)sk->num; + + /* Initialize the new item. */ + it = &(sk->items[sk->num++]); + Memset((char *)it, 0, sizeof(BER_ITEMS)); + + /* return success */ + return(0); +} + +#endif /* SPLIT_BER_ITEMS_SK_GET */ + +#ifdef SPLIT_BER_ITEMS_APPEND +/** + * Places the BER item b next to the BER item a in the tree + * structure. + * + * @param a [In] A BER item. + * @param b [In] A BER item. + */ +void BER_ITEMS_append(a,b) +BER_ITEMS *a,*b; +{ + b->parent=a->parent; + if (b->parent != NULL) + { + b->parent->item.flags|=BER_FLAG_INVALID_LENGTH; + } + b->next=a->next; + a->next=b; +} +#endif /* SPLIT_BER_ITEMS_APPEND */ + +#ifdef SPLIT_BER_ITEMS_UNDER +/** + * Places the BER item b below the BER item a in the tree + * structure. + * + * @param a [In] A BER item. + * @param b [In] A BER item. + * + * @return An indication of success:
    + *
  • 0 indicates success
  • + *
  • >0 indicates failure
  • + */ +int BER_ITEMS_under(BER_ITEMS *a, BER_ITEMS *b) +{ + if (!(BER_constructed(&a->item) || BER_hide_contents(&a->item))) + { + return(BER_ERR_NOT_CONSTRUCTED); + } + b->parent=a; + b->next=a->down; + a->down=b; + + a->item.flags|=BER_FLAG_INVALID_LENGTH; + return(0); +} +#endif /* SPLIT_BER_ITEMS_UNDER */ + +#ifdef SPLIT_BER_ITEMS_SK_GROW +/** + * Grows the number of allocated BER items. + * + * @param sk [In] A stack of BER items. + * @param num [In] The number of BER items to allocate. + * + * @return An indication of success:
    + *
  • 0 indicates success
  • + *
  • >0 indicates failure
  • + */ +int BER_ITEMS_SK_grow(BER_ITEMS_SK *sk, unsigned int num) +{ + int ptr_fix; + unsigned int i; + unsigned int j; + BER_ITEMS *nai; + BER_ITEMS *oai; + BER_ITEMS *oend; + + if (num <= sk->num) + { + return(0); + } + + if (sk->flags & BER_FLAG_DYNAMIC_ITEMS) + { + if (sk->items == NULL) + { + ptr_fix=0; + nai=(BER_ITEMS *)Malloc(sizeof(BER_ITEMS)*num); + if (nai == NULL) + { + return(BER_ERR_OUT_OF_MEMORY); + } + Memset(nai,0,sizeof(BER_ITEMS)*num); + } + else + { + ptr_fix=1; + nai=(BER_ITEMS *)Realloc(sk->items, sizeof(BER_ITEMS)*num, + sizeof(BER_ITEMS)*sk->max); + if (nai == NULL) + { + return(BER_ERR_OUT_OF_MEMORY); + } + Memset(&(nai[sk->max]),0, sizeof(BER_ITEMS)*(num-sk->max)); + } + if (nai == NULL) + { + return(BER_ERR_OUT_OF_MEMORY); + } + + /* If we have realloced, and the Memory has moved, we + * need to fix the pointers */ + if ((sk->items != nai) && ptr_fix) + { + oai=sk->items; + oend= &(sk->items[sk->num]); + for (i=0; inum; i++) + { + if ((nai[i].parent >= oai) && + (nai[i].parent <= oend)) + { + j=(unsigned int)( nai[i].parent-oai ); + nai[i].parent= &(nai[j]); + } + if ((nai[i].next >= oai) && + (nai[i].next <= oend)) + { + j=(unsigned int)( nai[i].next-oai ); + nai[i].next= &(nai[j]); + } + if ((nai[i].down >= oai) && + (nai[i].down <= oend)) + { + j=(unsigned int)( nai[i].down-oai ); + nai[i].down= &(nai[j]); + } + } + } + + sk->max=num; + sk->items=nai; + return(0); + } + + return(BER_ERR_OUT_OF_ITEMS_STORAGE); +} +#endif /* SPLIT_BER_ITEMS_SK_GROW */ + +#ifdef SPLIT_BER_ITEMS_SK_FREE +void BER_ITEMS_SK_free(sk) +BER_ITEMS_SK *sk; + { + unsigned int i; + + for (i=0; imax; i++) + { + if ((sk->items[i].item.data.bytes != NULL) && + (sk->items[i].item.flags & BER_FLAG_DYNAMIC)) + { + Free(sk->items[i].item.data.bytes); + sk->items[i].item.data.bytes=NULL; + } + } + if ((sk->flags & BER_FLAG_DYNAMIC_ITEMS) && (sk->items != NULL)) + { + Free(sk->items); + sk->items=NULL; + } + sk->num=0; + if (sk->flags & BER_FLAG_DYNAMIC) + Free(sk); + } +#endif /* SPLIT_BER_ITEMS_SK_FREE */ + +#endif /* !(defined(NO_SPLIT) && defined(SPLIT_FILE)) */ diff --git a/build/libraries_sysmenu/acsign/ARM9/src/ber_lib.c b/build/libraries_sysmenu/acsign/ARM9/src/ber_lib.c new file mode 100644 index 00000000..6bd4ed0a --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/ber_lib.c @@ -0,0 +1,437 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber_lib.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "ber_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BER_NUM_BITS +#define SPLIT_BER_ITEM_CMP_BYTES +#define SPLIT_BER_ITEM_CMP_TAG +#define SPLIT_BER_ITEM_INIT +#define SPLIT_BER_ITEMS_INIT +#define SPLIT_BER_ITEM_SET_ALL +#define SPLIT_BER_ITEM_SET_HEADER +#define SPLIT_BER_ITEM_SET_PREFIX_BYTE +#define SPLIT_BER_ITEM_SET_DATA +#define SPLIT_BER_READ_ITEM +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BER_NUM_BITS +/** + * Calculates the number of used bits in a buffer bytes. This function is + * useful when dealing with a BER item that is a bit string. + * + * @param buf [In] The buffer of data. + * @param len [In] The length of the buffer in bytes. + * @param bigendian [In] Indicates that the bits in the data is order in + * big endian order. + * + * @return The number of bits. + */ +int R_num_bits(unsigned char *buf, int len, int bigendian) +{ + int ret; + int i; + int j; + int inc; + int c; + + if (len == 0) + { + return(0); + } + if (bigendian) + { + inc = 1; + j = 0; + } + else + { + j = len - 1; + inc = -1; + } + + ret = (len-1)*8; + for (i = 0; i < len; i++) + { + c = buf[j]; + if (c == 0) + { + ret -= 8; + j += inc; + } + else + { + if (c & 0x80) + { + return(ret+8); + } + if (c & 0x40) + { + return(ret+7); + } + if (c & 0x20) + { + return(ret+6); + } + if (c & 0x10) + { + return(ret+5); + } + if (c & 0x08) + { + return(ret+4); + } + if (c & 0x04) + { + return(ret+3); + } + if (c & 0x02) + { + return(ret+2); + } + /* if (c & 0x01) */ + { + return(ret+1); + } + } + } + return(0); +} +#endif /* SPLIT_BER_NUM_BITS */ + + +#ifdef SPLIT_BER_ITEM_CMP_BYTES +/** + * Compares the data bytes of the BER item with the data of the buffer. + * + * @param a [In] A BER item. + * @param d [In] A buffer of data. + * @param l [In] The length of the data. + * + * @return Indication of a match:
    + *
  • 0 indicates a match
  • + *
  • BER_ERR_CMP_BYTES indicates no match
  • + */ +int BER_ITEM_cmp_bytes(BER_ITEM *a, unsigned char *d, unsigned int l) +{ + unsigned char *b; + + if (l != a->data.len) + { + return(BER_ERR_CMP_BYTES); + } + + if (l == 0) + { + return(0); + } + + b = a->data.bytes; + if (BER_prefix_byte(a)) + { + if (a->prefix_byte != *(d++)) + { + return(BER_ERR_CMP_BYTES); + } + + l--; + } + + if (Memcmp(d,b,l) != 0) + { + return(BER_ERR_CMP_BYTES); + } + + return(0); +} +#endif /* SPLIT_BER_ITEM_CMP_BYTES */ + +#ifdef SPLIT_BER_ITEM_CMP_TAG +/** + * Compares the tag of a BER item with a BER type value for a match. + * + * @param a [In] A BER item. + * @param type [In] A type of BER item. + * + * @return Indication of a match:
    + *
  • 0 indicares a match
  • + *
  • BER_ERR_CMP_TAG indicates no match
  • + */ +int BER_ITEM_cmp_tag(BER_ITEM *a, unsigned int type) +{ + int i; + int j; + + if (a->type != type) + { + return(BER_ERR_CMP_TAG); + } + + if ((a->info & BER_PRIVATE) != 0) + { + return(BER_ERR_CMP_TAG); + } + + i = ((a->type == BER_SEQUENCE) || (a->type == BER_SET)); + j = (a->info&BER_CONSTRUCTED) ? 1 : 0; + + return((i == j) ? 0: BER_ERR_CMP_TAG); +} +#endif /* SPLIT_BER_ITEM_CMP_TAG */ + +#ifdef SPLIT_BER_ITEM_INIT +/** + * Initializes a BER item. + * + * @param item [In] A BER item. + * + * @pre The BER item is not a NULL pointer. + */ +void BER_ITEM_init(BER_ITEM *item) +{ + Memset(item, 0, sizeof(BER_ITEM)); +} +#endif /* SPLIT_BER_ITEM_INIT */ + +#ifdef SPLIT_BER_ITEMS_INIT +/** + * Initializes a BER items. + * + * @param items [In] A BER items. + * + * @pre The BER item is not a NULL pointer. + */ +void BER_ITEMS_init(BER_ITEMS *items) +{ + Memset(items, 0, sizeof(BER_ITEMS)); +} +#endif /* SPLIT_BER_ITEMS_INIT */ + +#ifdef SPLIT_BER_ITEM_SET_ALL +/** + * Sets the data against a BER item. + * + * @param item [In] A BER item. + * @param sclass [In] The class of a BER item. + * @param tag [In] The tag of a BER item. + * @param data [In] The data of a BER item. + * @param len [In] The length of the data of a BER item. + * @param info [In] The info of a BER item. + * @param flags [In] The flags of a BER item. + */ +void BER_ITEM_set_all(BER_ITEM *item, unsigned int sclass, unsigned int tag, + unsigned char *data, unsigned int len, unsigned int info, + unsigned int flags) +{ + BER_ITEM_set_header(item, sclass, tag, info); + BER_ITEM_set_data(item, data, len); + item->flags |= flags; +} +#endif /* SPLIT_BER_ITEM_SET_ALL */ + +#ifdef SPLIT_BER_ITEM_SET_HEADER +/** + * Sets the header data against a BER item. + * + * @param item [In] A BER item. + * @param sclass [In] The class of a BER item. + * @param tag [In] The tag of a BER item. + * @param info [In] The info of a BER item. + */ +void BER_ITEM_set_header(BER_ITEM *item, unsigned int sclass, unsigned int tag, + unsigned int info) +{ + item->info = (unsigned char)( (sclass & BER_PRIVATE) | + (info & (BER_INFO_MASK | BER_CONSTRUCTED)) ); + item->flags |= BER_FLAG_INVALID_LENGTH; + + if (((sclass & BER_PRIVATE) == 0) && + ((tag == BER_SEQUENCE) || (tag == BER_SET))) + { + item->info |= BER_CONSTRUCTED; + } + + item->type = tag; +} +#endif /* SPLIT_BER_ITEM_SET_HEADER */ + +#ifdef SPLIT_BER_ITEM_SET_PREFIX_BYTE +/** + * Places a byte at the front of the data of a BER item. This is useful for + * handling bit strings that require a bytes to be placed before the actual + * data. + * + * @param item [In] A BER item. + * @param abyte [In] A byte. + */ +void BER_ITEM_set_prefix_byte(BER_ITEM *item, unsigned int abyte) +{ + if ((item->flags & BER_FLAG_PREFIX_BYTE) == 0) + { + item->flags |= BER_FLAG_PREFIX_BYTE; + item->data.len++; + } + + item->prefix_byte = (unsigned char)( abyte & 0xff ); +} +#endif /* SPLIT_BER_ITEM_SET_PREFIX_BYTE */ + +#ifdef SPLIT_BER_ITEM_SET_DATA +/** + * Sets data against a BER item. + * + * @param item [In] A BER item. + * @param data [In] The data of a BER item. + * @param len [In] The length of the data of a BER item. + */ +void BER_ITEM_set_data(BER_ITEM *item, unsigned char *data, unsigned int len) +{ + item->flags |= BER_FLAG_INVALID_LENGTH; + item->data.bytes = data; + item->data.len = len; +} +#endif /* SPLIT_BER_ITEM_SET_DATA */ + +#ifdef SPLIT_BER_READ_ITEM +/** + * Reads the data from the buffer as a BER item and stores the header + * information into item. + * + * @param item [In] A BER item. + * @param p [In] A buffer of data. + * @param max [In] The number of bytes in buffer. + */ +int BER_read_item(BER_ITEM *item, unsigned char *p, unsigned long max) +{ + unsigned int i=0; + unsigned int tag; + unsigned int j; + unsigned int x; + unsigned int tclass; + unsigned long len; + + if (2 > max) + { + return(BER_ERR_NOT_ENOUGH_BYTES); + } + + tclass = p[i++]; + + /* First get the class and constructed flags */ + item->info = (unsigned char)( tclass & (BER_PRIVATE | BER_CONSTRUCTED) ); + + /* Get the tag */ + tag = tclass & BER_PRIMITIVE_TAG_MASK; + if (tag == BER_PRIMITIVE_TAG_MASK) + { + /* This code handles tags greater than 30 */ + tag = 0; + j =0; + for (;;) + { + if ((unsigned long)i >= max) + { + return(BER_ERR_NOT_ENOUGH_BYTES); + } + + x = p[i++]; + tag |= x & 0x7f; + if (x & 0x80) + { + break; + } + j += 7; + if (j > BER_MAX_TAG_LEN_IN_BITS) + { + return(BER_ERR_TAG_TOO_LONG); + } + tag<<=7; + } + } + item->type = tag; + + /* Now get the length */ + if ((unsigned long)i >= max) + { + return(BER_ERR_NOT_ENOUGH_BYTES); + } + + len = p[i++]; + if (len & 0x80) + { /* Long or extended */ + len &= 0x7f; + if (len == 0) + { + item->info |= BER_ILEN; + /* Don't set this flag if indefinite length encoding. + * Assume if the Constructed bit is set that it is indef encoding. + */ + if (!(tclass & BER_CONSTRUCTED)) + item->flags |= BER_FLAG_INVALID_LENGTH; + } + else + { + if (len > sizeof(unsigned long)) + { + return(BER_ERR_LENGTH_TOO_LARGE); + } + if ((unsigned long)i+len >= max) + { + return(BER_ERR_NOT_ENOUGH_BYTES); + } + + j = len; + len = 0; + for (;;) + { + len |= p[i++]; + if (--j <= 0) + { + break; + } + len <<= 8; + } + } + } + item->data.len = len; + item->data.bytes = &(p[i]); + item->hlen = (unsigned char)i; + +#ifndef NO_STREAM + /* Keep a copy of the header for an outer sequence. */ + Memcpy(item->header, p, i); +#endif /* !NO_STREAM */ + + return(BER_OK); +} +#endif /* SPLIT_BER_READ_ITEM */ + +#endif /* !(defined(NO_SPLIT) && defined(SPLIT_FILE)) */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/ber_par.c b/build/libraries_sysmenu/acsign/ARM9/src/ber_par.c new file mode 100644 index 00000000..5098acb6 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/ber_par.c @@ -0,0 +1,251 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - makerom.TWL + File: ber_par.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ +/* $Id$ */ +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "ber_lcl.h" + +/* We need to 'parse' the input data into an BER_ITEMS_SK, which is composed of + * BER_ITEMS. + * For definite length encoding, we read a full 'level' at a time, and then + * process the sub-elements. + * For indefinite encoding, we go as 'deep' as we can, updating the + * length info of the indefinite encodings as we go. + * This is easy to do because when we go back up to our parent, + * just compare it's start data byte with the current pointer. + */ + +#define READ_NEXT_ITEM 1 +#define GO_UP 2 + +int BER_parse(BER_ITEMS_SK *sk, unsigned char *ino, unsigned long m_len, + unsigned long *n_used) +{ + int this_idx; + int next_idx; + BER_ITEMS *this = NULL; + BER_ITEMS *next = NULL; + int ret=999; + int state; + unsigned char *in = ino; + unsigned char *max = in + m_len; + unsigned char *end = max; + int inf = 0; + int pinf = 0; + int con = 0; + int down; + + state = READ_NEXT_ITEM; + down = 1; + this_idx = -1; + pinf = 0; + for (;;) + { + switch (state) + { + case READ_NEXT_ITEM: + /* Read the item into 'next' */ + if ((ret=BER_ITEMS_SK_get(sk,&next_idx)) != 0) + { + goto err; + } + next=BER_ITEMS_SK_items(sk,next_idx); + ret = BER_read_item(&(next->item), in, (unsigned long)(end - in)); + if (ret != 0) + { + goto err; + } + /* Check the length of the data against what is available */ + if (next->item.data.len > (unsigned long)(end - in)) + { + ret = BER_ERR_NOT_ENOUGH_BYTES; + goto err; + } + inf = BER_indefinite_encoding(&(next->item)); + con = BER_constructed(&(next->item)); + in += next->item.hlen; + + if (this_idx == -1) + { + this = NULL; + } + else + { + this = BER_ITEMS_SK_items(sk, this_idx); + } + + /* If we are pushing it under, do so */ + if (down) + { + next->parent = this; + if (this != NULL) + { + this->down = next; + if (!pinf) + { + end = this->item.data.bytes+ this->item.data.len; + } + pinf = BER_indefinite_encoding(&this->item); + } + else + { + pinf = 0; + } + next->next = NULL; + } + else + { + next->parent = this->parent; + next->next = NULL; + this->next = next; + } +#ifndef NO_STREAM + next->item.seen = next->item.data.len; + next->item.part_len = next->item.data.len; +#endif /* !NO_STREAM */ + down = 0; + this = next; + this_idx = next_idx; + if ((this->item.type == BER_EOC) && (this->item.data.len == 0) && + (BER_class(&(this->item)) == BER_UNIVERSAL)) + { + if (pinf) + { + this->parent->item.data.len=(unsigned long) + (in - this->parent->item.data.bytes); +#ifndef NO_STREAM + this->parent->item.seen = this->parent->item.data.len; + this->parent->item.part_len = this->parent->item.data.len; +#endif /* !NO_STREAM */ + state = GO_UP; + break; + } + else + { + ret = BER_ERR_UNEXPECTED_EOC; + goto err; + } + } + + if (con && (inf || (this->item.data.len > 0))) + { + pinf = inf; + down = 1; + } + else + { + in += this->item.data.len; + } + + if (in > end) + { + ret = BER_ERR_NOT_ENOUGH_BYTES; + goto err; + } + + if (in == end) + { + state = GO_UP; + } + else + { + state = READ_NEXT_ITEM; + } + + if (inf && !con) + { + ret = BER_ERR_INVALID_LENGTH_ENCODING; + goto err; + } + + break; + case GO_UP: + /* this is valid and is the 'end'. We need to + * go back up one and then see if we contiune or + * go_up again. */ + this_idx +=(int)(this->parent-this); + this = this->parent; + down = 0; + if (this == NULL) + { + ret = 0; + goto end; /* we have finished */ + } + + /* Must have finished this one */ + /* inf = BER_indefinite_encoding(&this->item); */ + + if (this->parent != NULL) + { + pinf = BER_indefinite_encoding(&this->parent->item); + if (pinf) + { + end = max; + } + else + { + end = this->parent->item.data.bytes + + this->parent->item.data.len; + } + } + else + { + if (BER_indefinite_encoding(&this->item)) + { + ret = 0; + goto end; + } + pinf = 0; + end = max; + } + + if (end < in) + { + ret = BER_ERR_NOT_ENOUGH_BYTES; + goto err; + } + if (end == in) + { + state = GO_UP; + } + else + { + state = READ_NEXT_ITEM; + } + break; + default: + break; + } + } +end: + /* if there were no errors we set the length of data we consumed + * if the user wants to know that information. + */ + if (n_used != NULL) + *n_used = (unsigned long)( in - ino ); +err: + return(ret); +} + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_add.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_add.c new file mode 100644 index 00000000..7b36c8b6 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_add.c @@ -0,0 +1,320 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +/** + * @file bn_add.c + * @brief BIGNUM addition and subtraction functions + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_ADD +#define SPLIT_BN_UADD +#define SPLIT_BN_USUB +#define SPLIT_BN_SUB +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BN_ADD +/* r can == a or b */ +int BN_add(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + /* a + b a+b + * a + -b a-b + * -a + b b-a + * -a + -b -(a+b) + */ + if (a->neg ^ b->neg) + { + /* only one is negative */ + if (a->neg) + { tmp=a; a=b; b=tmp; } + + /* we are now a - b */ + + if (BN_ucmp(a,b) < 0) + { + if (!BN_usub(r,b,a)) return(0); + r->neg=1; + } + else + { + if (!BN_usub(r,a,b)) return(0); + r->neg=0; + } + return(1); + } + + if (a->neg) /* both are neg */ + r->neg=1; + else + r->neg=0; + + if (!BN_uadd(r,a,b)) return(0); + return(1); + } +#endif + +#ifdef SPLIT_BN_UADD +/* unsigned add of b to a, r must be large enough */ +int BN_uadd(r,a,b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + register int i; + int max,min; + BN_ULONG *ap,*bp,*rp,carry,t1; + BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + if (a->top < b->top) + { tmp=a; a=b; b=tmp; } + max=a->top; + min=b->top; + + if (bn_wexpand(r,max+1) == NULL) + return(0); + + r->top=max; + + + ap=a->d; + bp=b->d; + rp=r->d; + carry=0; + + carry=bn_add_words(rp,ap,bp,min); + rp+=min; + ap+=min; + bp+=min; + i=min; + + if (carry) + { + while (i < max) + { + i++; + t1= *(ap++); + if ((*(rp++)=(t1+1)&BN_MASK2) >= t1) + { + carry=0; + break; + } + } + if ((i >= max) && carry) + { + *(rp++)=1; + r->top++; + } + } + if (rp != ap) + { + for (; ib from a + * @param r result of subtraction + * @param a pointer to a BIGNUM + * @param b pointer to a BIGNUM + * @pre a must be larger than b + * @return 1 on success, 0 on failure + * @todo On next IRIX port check the validity of IRIX_CC_BUG. + */ +#ifdef SPLIT_BN_USUB +int BN_usub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max,min; + register BN_ULONG t1,t2,*ap,*bp,*rp; + int i,carry; +#if defined(IRIX_CC_BUG) && !defined(LINT) + int dummy; +#endif + + bn_check_top(a); + bn_check_top(b); + + /* + * check for pre-condition violation + */ + if (a->top < b->top) + { +#ifndef NO_ERR + BNerr(BN_F_BN_USUB,BN_R_ARG2_LT_ARG3); +#endif + return(0); + } + + max=a->top; + min=b->top; + if (bn_wexpand(r,max) == NULL) return(0); + + ap=a->d; + bp=b->d; + rp=r->d; + + /* + * perform the subtraction and see if we + * have a (final) carry + */ + carry=0; + for (i=0; i t2) break; + } + } + + if (rp != ap) + { +#ifdef BN_LIBRARY_SMALL + Memcpy(rp,ap,sizeof(*rp)*(max-i)); +#else /* BN_LIBRARY_SMALL */ + for (;;) + { + if (i++ >= max) break; + rp[0]=ap[0]; + if (i++ >= max) break; + rp[1]=ap[1]; + if (i++ >= max) break; + rp[2]=ap[2]; + if (i++ >= max) break; + rp[3]=ap[3]; + rp+=4; + ap+=4; + } +#endif /* BN_LIBRARY_SMALL */ + } + + r->top=max; + bn_fix_top(r); + return(1); + } +#endif + +#ifdef SPLIT_BN_SUB +int BN_sub(r, a, b) +BIGNUM *r; +BIGNUM *a; +BIGNUM *b; + { + int max; + int add=0,neg=0; + BIGNUM *tmp; + + bn_check_top(a); + bn_check_top(b); + + /* a - b a-b + * a - -b a+b + * -a - b -(a+b) + * -a - -b b-a + */ + if (a->neg) + { + if (b->neg) + { tmp=a; a=b; b=tmp; } + else + { add=1; neg=1; } + } + else + { + if (b->neg) { add=1; neg=0; } + } + + if (add) + { + if (!BN_uadd(r,a,b)) return(0); + r->neg=neg; + return(1); + } + + /* We are actually doing a - b */ + + max=(a->top > b->top)?a->top:b->top; + if (bn_wexpand(r,max) == NULL) return(0); + if (BN_ucmp(a,b) < 0) + { + if (!BN_usub(r,b,a)) return(0); + r->neg=1; + } + else + { + if (!BN_usub(r,a,b)) return(0); + r->neg=0; + } + return(1); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_asm.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_asm.c new file mode 100644 index 00000000..64efa61f --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_asm.c @@ -0,0 +1,525 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#ifndef OPT_BN_ASM + +#define BN_MUL_ADD_WORDS + +#ifndef BN_MUL_WORDS +#define BN_MUL_WORDS +#endif + +#ifndef BN_SQR_WORDS +#define BN_SQR_WORDS +#endif + +#ifndef BN_ADD_WORDS +#define BN_ADD_WORDS +#endif + +#ifndef BN_SUB_WORDS +#define BN_SUB_WORDS +#endif + +#endif + + +#include "bn_lcl.h" + +#ifdef BN_LLONG + +/* + * bn_mul_add_words + * + * for(i=0;i=0; i--) + fprintf(stderr,BN_HEX_FMT,ap[i]); + fprintf(stderr,"*"); + fprintf(stderr,BN_HEX_FMT,w); + fprintf(stderr,"+"); + for (i=num-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,rp[i]); +#endif + + for (;;) + { + mul_add(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul_add(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul_add(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul_add(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + fprintf(stderr,"-"); + fprintf(stderr,BN_HEX_FMT,c1); + for (i=nn-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,rp[i]); + fprintf(stderr,"\n"); + } +#endif + return(c1); + } +#endif + +#ifdef BN_MUL_WORDS +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c1=0; + + bn_check_num(num); + if (num <= 0) return(c1); + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + { + int i,nn=num; + + for (i=num-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,ap[i]); + fprintf(stderr,"*"); + fprintf(stderr,BN_HEX_FMT,w); +#endif + + for (;;) + { + mul(rp[0],ap[0],w,c1); + if (--num == 0) break; + mul(rp[1],ap[1],w,c1); + if (--num == 0) break; + mul(rp[2],ap[2],w,c1); + if (--num == 0) break; + mul(rp[3],ap[3],w,c1); + if (--num == 0) break; + ap+=4; + rp+=4; + } + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + fprintf(stderr,"-"); + fprintf(stderr,BN_HEX_FMT,c1); + for (i=nn-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,rp[i]); + fprintf(stderr,"\n"); + } +#endif + return(c1); + } +#endif + +#ifdef BN_SQR_WORDS +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + bn_check_num(n); + if (n <= 0) return; + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + { + int i,nn=n; + + for (i=n-1; i>=0; i--) + { + fprintf(stderr,BN_HEX_FMT,a[i]); + if (i != 0) + fprintf(stderr,"^2*2^%X+",i*2*BN_BITS2); + else + fprintf(stderr,"^2"); + } +#endif + + for (;;) + { + BN_ULLONG t; + + t=(BN_ULLONG)(a[0])*(a[0]); + r[0]=Lw(t); r[1]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[1])*(a[1]); + r[2]=Lw(t); r[3]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[2])*(a[2]); + r[4]=Lw(t); r[5]=Hw(t); + if (--n == 0) break; + + t=(BN_ULLONG)(a[3])*(a[3]); + r[6]=Lw(t); r[7]=Hw(t); + if (--n == 0) break; + + a+=4; + r+=8; + } +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + + fprintf(stderr,"-"); + for (i=nn+nn-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,r[i]); + fprintf(stderr,"\n"); + } +#endif + } +#endif + +#else + +#ifdef BN_MUL_ADD_WORDS + +BN_ULONG bn_mul_add_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG c=0; + BN_ULONG bl,bh,b_hl; + + bn_check_num(num); + if (num <= 0) return((BN_ULONG)0); + + bl=LBITS(w); + bh=HBITS(w); + b_hl=bh-bl; +/* +{ int i,nnum=num; +BN_ULONG *rrp=rp; +for (i=num-1; i>=0; i--) printf("%02X",rp[i]); +printf("+"); +for (i=num-1; i>=0; i--) printf("%02X",ap[i]); +printf("*%02X - ",w); +*/ + for (;;) + { + mul_add(rp[0],ap[0],bl,bh,b_hl,c); + if (--num == 0) break; + mul_add(rp[1],ap[1],bl,bh,b_hl,c); + if (--num == 0) break; + mul_add(rp[2],ap[2],bl,bh,b_hl,c); + if (--num == 0) break; + mul_add(rp[3],ap[3],bl,bh,b_hl,c); + if (--num == 0) break; + ap+=4; + rp+=4; + } + +/* +printf("%02X",c); +for (i=nnum-1; i>=0; i--) printf("%02X",rrp[i]); +printf("\n"); +} +*/ + return(c); + } + +#endif + +#ifdef BN_MUL_WORDS +BN_ULONG bn_mul_words(rp,ap,num,w) +BN_ULONG *rp,*ap; +int num; +BN_ULONG w; + { + BN_ULONG carry=0; + BN_ULONG bl,bh; + + bn_check_num(num); + if (num <= 0) return((BN_ULONG)0); + + bl=LBITS(w); + bh=HBITS(w); + + for (;;) + { + mul(rp[0],ap[0],bl,bh,carry); + if (--num == 0) break; + mul(rp[1],ap[1],bl,bh,carry); + if (--num == 0) break; + mul(rp[2],ap[2],bl,bh,carry); + if (--num == 0) break; + mul(rp[3],ap[3],bl,bh,carry); + if (--num == 0) break; + ap+=4; + rp+=4; + } + return(carry); + } +#endif + +#ifdef BN_SQR_WORDS +void bn_sqr_words(r,a,n) +BN_ULONG *r,*a; +int n; + { + bn_check_num(n); + if (n <= 0) return; + for (;;) + { + sqr64(r[0],r[1],a[0]); + if (--n == 0) break; + + sqr64(r[2],r[3],a[1]); + if (--n == 0) break; + + sqr64(r[4],r[5],a[2]); + if (--n == 0) break; + + sqr64(r[6],r[7],a[3]); + if (--n == 0) break; + + a+=4; + r+=8; + } + } +#endif + +#endif + +#ifdef BN_ADD_WORDS +#ifdef BN_LLONG +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULLONG ll=0; + + bn_check_num(n); + if (n <= 0) return((BN_ULONG)0); + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + { + int i,nn=n; + + for (i=n-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,a[i]); + fprintf(stderr,"+"); + for (i=n-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,b[i]); +#endif + + for (;;) + { + ll+=(BN_ULLONG)a[0]+b[0]; + r[0]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[1]+b[1]; + r[1]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[2]+b[2]; + r[2]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + ll+=(BN_ULLONG)a[3]+b[3]; + r[3]=(BN_ULONG)ll&BN_MASK2; + ll>>=BN_BITS2; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + fprintf(stderr,"-"); + fprintf(stderr,BN_HEX_FMT,(BN_ULONG)ll); + for (i=nn-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,r[i]); + fprintf(stderr,"\n"); + } +#endif + return((BN_ULONG)ll); + } +#else +BN_ULONG bn_add_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULONG c,l,t; + + bn_check_num(n); + if (n <= 0) return((BN_ULONG)0); + + c=0; + for (;;) + { + t=a[0]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[0])&BN_MASK2; + c+=(l < t); + r[0]=l; + if (--n <= 0) break; + + t=a[1]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[1])&BN_MASK2; + c+=(l < t); + r[1]=l; + if (--n <= 0) break; + + t=a[2]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[2])&BN_MASK2; + c+=(l < t); + r[2]=l; + if (--n <= 0) break; + + t=a[3]; + t=(t+c)&BN_MASK2; + c=(t < c); + l=(t+b[3])&BN_MASK2; + c+=(l < t); + r[3]=l; + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + + return((BN_ULONG)c); + } +#endif +#endif + +#ifdef BN_SUB_WORDS +BN_ULONG bn_sub_words(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { + BN_ULONG c,t1,t2; + + bn_check_num(n); + if (n <= 0) return((BN_ULONG)0); + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + { + int i,nn=n; + + for (i=n-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,a[i]); + fprintf(stderr,"-"); + for (i=n-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,b[i]); +#endif + + c=0; + for (;;) + { + t1=a[0]; t2=b[0]; + r[0]=(t1-t2-c)&BN_MASK2; + if (t1 != t2) c=(t1 < t2); + if (--n <= 0) break; + + t1=a[1]; t2=b[1]; + r[1]=(t1-t2-c)&BN_MASK2; + if (t1 != t2) c=(t1 < t2); + if (--n <= 0) break; + + t1=a[2]; t2=b[2]; + r[2]=(t1-t2-c)&BN_MASK2; + if (t1 != t2) c=(t1 < t2); + if (--n <= 0) break; + + t1=a[3]; t2=b[3]; + r[3]=(t1-t2-c)&BN_MASK2; + if (t1 != t2) c=(t1 < t2); + if (--n <= 0) break; + + a+=4; + b+=4; + r+=4; + } + +#if defined(BN_ASM_DEBUG) && !defined(NO_FP_API) + fprintf(stderr,"- "); + if (c) fprintf(stderr,"-"); + for (i=nn-1; i>=0; i--) + fprintf(stderr,BN_HEX_FMT,r[i]); + fprintf(stderr,"\n"); + } +#endif + return(c); + } +#endif + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_comba.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_comba.c new file mode 100644 index 00000000..462c8f4d --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_comba.c @@ -0,0 +1,450 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_MUL_COMBA8 +#define SPLIT_BN_MUL_COMBA4 +#define SPLIT_BN_SQR_COMBA8 +#define SPLIT_BN_SQR_COMBA4 +#endif /* NO_SPLIT */ + +#ifndef OPT_BN_ASM +/* #if 1 */ + +#ifdef BN_LLONG +#define mul_add_c(a,b,c0,c1,c2) \ + t=(BN_ULLONG)a*b; \ + t1=(BN_ULONG)Lw(t); \ + t2=(BN_ULONG)Hw(t); \ + c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define mul_add_c2(a,b,c0,c1,c2) \ + t=(BN_ULLONG)a*b; \ + tt=(t+t)&BN_MASK; \ + if (tt < t) c2++; \ + t1=(BN_ULONG)Lw(tt); \ + t2=(BN_ULONG)Hw(tt); \ + c0=(c0+t1)&BN_MASK2; \ + if ((c0 < t1) && (((++t2)&BN_MASK2) == 0)) c2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define sqr_add_c(a,i,c0,c1,c2) \ + t=(BN_ULLONG)a[i]*a[i]; \ + t1=(BN_ULONG)Lw(t); \ + t2=(BN_ULONG)Hw(t); \ + c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define sqr_add_c2(a,i,j,c0,c1,c2) \ + mul_add_c2((a)[i],(a)[j],c0,c1,c2) +#else +#define mul_add_c(a,b,c0,c1,c2) \ + t1=LBITS(a); t2=HBITS(a); \ + bl=LBITS(b); bh=HBITS(b); \ + mul64(t1,t2,bl,bh); \ + c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define mul_add_c2(a,b,c0,c1,c2) \ + t1=LBITS(a); t2=HBITS(a); \ + bl=LBITS(b); bh=HBITS(b); \ + mul64(t1,t2,bl,bh); \ + if (t2 & BN_TBIT) c2++; \ + t2=(t2+t2)&BN_MASK2; \ + if (t1 & BN_TBIT) t2++; \ + t1=(t1+t1)&BN_MASK2; \ + c0=(c0+t1)&BN_MASK2; \ + if ((c0 < t1) && (((++t2)&BN_MASK2) == 0)) c2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define sqr_add_c(a,i,c0,c1,c2) \ + sqr64(t1,t2,(a)[i]); \ + c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \ + c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++; + +#define sqr_add_c2(a,i,j,c0,c1,c2) \ + mul_add_c2((a)[i],(a)[j],c0,c1,c2) +#endif + +#if defined(BN_MUL_COMBA) + +#ifdef SPLIT_BN_MUL_COMBA8 +#undef bn_mul_comba8 +void bn_mul_comba8(r,a,b) +BN_ULONG *r,*a,*b; + { +#ifdef BN_LLONG + BN_ULLONG t; +#else + BN_ULONG bl,bh; +#endif + BN_ULONG t1,t2; + BN_ULONG c1,c2,c3; + + c1=0; + c2=0; + c3=0; + mul_add_c(a[0],b[0],c1,c2,c3); + r[0]=c1; + c1=0; + mul_add_c(a[0],b[1],c2,c3,c1); + mul_add_c(a[1],b[0],c2,c3,c1); + r[1]=c2; + c2=0; + mul_add_c(a[2],b[0],c3,c1,c2); + mul_add_c(a[1],b[1],c3,c1,c2); + mul_add_c(a[0],b[2],c3,c1,c2); + r[2]=c3; + c3=0; + mul_add_c(a[0],b[3],c1,c2,c3); + mul_add_c(a[1],b[2],c1,c2,c3); + mul_add_c(a[2],b[1],c1,c2,c3); + mul_add_c(a[3],b[0],c1,c2,c3); + r[3]=c1; + c1=0; + mul_add_c(a[4],b[0],c2,c3,c1); + mul_add_c(a[3],b[1],c2,c3,c1); + mul_add_c(a[2],b[2],c2,c3,c1); + mul_add_c(a[1],b[3],c2,c3,c1); + mul_add_c(a[0],b[4],c2,c3,c1); + r[4]=c2; + c2=0; + mul_add_c(a[0],b[5],c3,c1,c2); + mul_add_c(a[1],b[4],c3,c1,c2); + mul_add_c(a[2],b[3],c3,c1,c2); + mul_add_c(a[3],b[2],c3,c1,c2); + mul_add_c(a[4],b[1],c3,c1,c2); + mul_add_c(a[5],b[0],c3,c1,c2); + r[5]=c3; + c3=0; + mul_add_c(a[6],b[0],c1,c2,c3); + mul_add_c(a[5],b[1],c1,c2,c3); + mul_add_c(a[4],b[2],c1,c2,c3); + mul_add_c(a[3],b[3],c1,c2,c3); + mul_add_c(a[2],b[4],c1,c2,c3); + mul_add_c(a[1],b[5],c1,c2,c3); + mul_add_c(a[0],b[6],c1,c2,c3); + r[6]=c1; + c1=0; + mul_add_c(a[0],b[7],c2,c3,c1); + mul_add_c(a[1],b[6],c2,c3,c1); + mul_add_c(a[2],b[5],c2,c3,c1); + mul_add_c(a[3],b[4],c2,c3,c1); + mul_add_c(a[4],b[3],c2,c3,c1); + mul_add_c(a[5],b[2],c2,c3,c1); + mul_add_c(a[6],b[1],c2,c3,c1); + mul_add_c(a[7],b[0],c2,c3,c1); + r[7]=c2; + c2=0; + mul_add_c(a[7],b[1],c3,c1,c2); + mul_add_c(a[6],b[2],c3,c1,c2); + mul_add_c(a[5],b[3],c3,c1,c2); + mul_add_c(a[4],b[4],c3,c1,c2); + mul_add_c(a[3],b[5],c3,c1,c2); + mul_add_c(a[2],b[6],c3,c1,c2); + mul_add_c(a[1],b[7],c3,c1,c2); + r[8]=c3; + c3=0; + mul_add_c(a[2],b[7],c1,c2,c3); + mul_add_c(a[3],b[6],c1,c2,c3); + mul_add_c(a[4],b[5],c1,c2,c3); + mul_add_c(a[5],b[4],c1,c2,c3); + mul_add_c(a[6],b[3],c1,c2,c3); + mul_add_c(a[7],b[2],c1,c2,c3); + r[9]=c1; + c1=0; + mul_add_c(a[7],b[3],c2,c3,c1); + mul_add_c(a[6],b[4],c2,c3,c1); + mul_add_c(a[5],b[5],c2,c3,c1); + mul_add_c(a[4],b[6],c2,c3,c1); + mul_add_c(a[3],b[7],c2,c3,c1); + r[10]=c2; + c2=0; + mul_add_c(a[4],b[7],c3,c1,c2); + mul_add_c(a[5],b[6],c3,c1,c2); + mul_add_c(a[6],b[5],c3,c1,c2); + mul_add_c(a[7],b[4],c3,c1,c2); + r[11]=c3; + c3=0; + mul_add_c(a[7],b[5],c1,c2,c3); + mul_add_c(a[6],b[6],c1,c2,c3); + mul_add_c(a[5],b[7],c1,c2,c3); + r[12]=c1; + c1=0; + mul_add_c(a[6],b[7],c2,c3,c1); + mul_add_c(a[7],b[6],c2,c3,c1); + r[13]=c2; + c2=0; + mul_add_c(a[7],b[7],c3,c1,c2); + r[14]=c3; + r[15]=c1; + } +#endif + +#ifdef SPLIT_BN_MUL_COMBA4 +#undef bn_mul_comba4 +void bn_mul_comba4(r,a,b) +BN_ULONG *r,*a,*b; + { +#ifdef BN_LLONG + BN_ULLONG t; +#else + BN_ULONG bl,bh; +#endif + BN_ULONG t1,t2; + BN_ULONG c1,c2,c3; + + c1=0; + c2=0; + c3=0; + mul_add_c(a[0],b[0],c1,c2,c3); + r[0]=c1; + c1=0; + mul_add_c(a[0],b[1],c2,c3,c1); + mul_add_c(a[1],b[0],c2,c3,c1); + r[1]=c2; + c2=0; + mul_add_c(a[2],b[0],c3,c1,c2); + mul_add_c(a[1],b[1],c3,c1,c2); + mul_add_c(a[0],b[2],c3,c1,c2); + r[2]=c3; + c3=0; + mul_add_c(a[0],b[3],c1,c2,c3); + mul_add_c(a[1],b[2],c1,c2,c3); + mul_add_c(a[2],b[1],c1,c2,c3); + mul_add_c(a[3],b[0],c1,c2,c3); + r[3]=c1; + c1=0; + mul_add_c(a[3],b[1],c2,c3,c1); + mul_add_c(a[2],b[2],c2,c3,c1); + mul_add_c(a[1],b[3],c2,c3,c1); + r[4]=c2; + c2=0; + mul_add_c(a[2],b[3],c3,c1,c2); + mul_add_c(a[3],b[2],c3,c1,c2); + r[5]=c3; + c3=0; + mul_add_c(a[3],b[3],c1,c2,c3); + r[6]=c1; + r[7]=c2; + } +#endif + +#else + +#ifdef SPLIT_BN_MUL_COMBA4 +#undef bn_mul_comba4 +void bn_mul_comba4(r,a,b) +BN_ULONG *r,*a,*b; + { + r[4]=bn_mul_words( &(r[0]),a,4,b[0]); + r[5]=bn_mul_add_words(&(r[1]),a,4,b[1]); + r[6]=bn_mul_add_words(&(r[2]),a,4,b[2]); + r[7]=bn_mul_add_words(&(r[3]),a,4,b[3]); + } +#endif + +#ifdef SPLIT_BN_MUL_COMBA8 +#undef bn_mul_comba8 +void bn_mul_comba8(r,a,b) +BN_ULONG *r,*a,*b; + { + r[ 8]=bn_mul_words( &(r[0]),a,8,b[0]); + r[ 9]=bn_mul_add_words(&(r[1]),a,8,b[1]); + r[10]=bn_mul_add_words(&(r[2]),a,8,b[2]); + r[11]=bn_mul_add_words(&(r[3]),a,8,b[3]); + r[12]=bn_mul_add_words(&(r[4]),a,8,b[4]); + r[13]=bn_mul_add_words(&(r[5]),a,8,b[5]); + r[14]=bn_mul_add_words(&(r[6]),a,8,b[6]); + r[15]=bn_mul_add_words(&(r[7]),a,8,b[7]); + } +#endif + +#endif /* BN_MUL_COMBA */ + +#ifdef BN_SQR_COMBA + +#ifdef SPLIT_BN_SQR_COMBA8 +#undef bn_sqr_comba8 +void bn_sqr_comba8(r,a) +BN_ULONG *r,*a; + { +#ifdef BN_LLONG + BN_ULLONG t,tt; +#else + BN_ULONG bl,bh; +#endif + BN_ULONG t1,t2; + BN_ULONG c1,c2,c3; + + c1=0; + c2=0; + c3=0; + sqr_add_c(a,0,c1,c2,c3); + r[0]=c1; + c1=0; + sqr_add_c2(a,1,0,c2,c3,c1); + r[1]=c2; + c2=0; + sqr_add_c(a,1,c3,c1,c2); + sqr_add_c2(a,2,0,c3,c1,c2); + r[2]=c3; + c3=0; + sqr_add_c2(a,3,0,c1,c2,c3); + sqr_add_c2(a,2,1,c1,c2,c3); + r[3]=c1; + c1=0; + sqr_add_c(a,2,c2,c3,c1); + sqr_add_c2(a,3,1,c2,c3,c1); + sqr_add_c2(a,4,0,c2,c3,c1); + r[4]=c2; + c2=0; + sqr_add_c2(a,5,0,c3,c1,c2); + sqr_add_c2(a,4,1,c3,c1,c2); + sqr_add_c2(a,3,2,c3,c1,c2); + r[5]=c3; + c3=0; + sqr_add_c(a,3,c1,c2,c3); + sqr_add_c2(a,4,2,c1,c2,c3); + sqr_add_c2(a,5,1,c1,c2,c3); + sqr_add_c2(a,6,0,c1,c2,c3); + r[6]=c1; + c1=0; + sqr_add_c2(a,7,0,c2,c3,c1); + sqr_add_c2(a,6,1,c2,c3,c1); + sqr_add_c2(a,5,2,c2,c3,c1); + sqr_add_c2(a,4,3,c2,c3,c1); + r[7]=c2; + c2=0; + sqr_add_c(a,4,c3,c1,c2); + sqr_add_c2(a,5,3,c3,c1,c2); + sqr_add_c2(a,6,2,c3,c1,c2); + sqr_add_c2(a,7,1,c3,c1,c2); + r[8]=c3; + c3=0; + sqr_add_c2(a,7,2,c1,c2,c3); + sqr_add_c2(a,6,3,c1,c2,c3); + sqr_add_c2(a,5,4,c1,c2,c3); + r[9]=c1; + c1=0; + sqr_add_c(a,5,c2,c3,c1); + sqr_add_c2(a,6,4,c2,c3,c1); + sqr_add_c2(a,7,3,c2,c3,c1); + r[10]=c2; + c2=0; + sqr_add_c2(a,7,4,c3,c1,c2); + sqr_add_c2(a,6,5,c3,c1,c2); + r[11]=c3; + c3=0; + sqr_add_c(a,6,c1,c2,c3); + sqr_add_c2(a,7,5,c1,c2,c3); + r[12]=c1; + c1=0; + sqr_add_c2(a,7,6,c2,c3,c1); + r[13]=c2; + c2=0; + sqr_add_c(a,7,c3,c1,c2); + r[14]=c3; + r[15]=c1; + } +#endif + +#ifdef SPLIT_BN_SQR_COMBA4 +#undef bn_sqr_comba4 +void bn_sqr_comba4(r,a) +BN_ULONG *r,*a; + { +#ifdef BN_LLONG + BN_ULLONG t,tt; +#else + BN_ULONG bl,bh; +#endif + BN_ULONG t1,t2; + BN_ULONG c1,c2,c3; + + c1=0; + c2=0; + c3=0; + sqr_add_c(a,0,c1,c2,c3); + r[0]=c1; + c1=0; + sqr_add_c2(a,1,0,c2,c3,c1); + r[1]=c2; + c2=0; + sqr_add_c(a,1,c3,c1,c2); + sqr_add_c2(a,2,0,c3,c1,c2); + r[2]=c3; + c3=0; + sqr_add_c2(a,3,0,c1,c2,c3); + sqr_add_c2(a,2,1,c1,c2,c3); + r[3]=c1; + c1=0; + sqr_add_c(a,2,c2,c3,c1); + sqr_add_c2(a,3,1,c2,c3,c1); + r[4]=c2; + c2=0; + sqr_add_c2(a,3,2,c3,c1,c2); + r[5]=c3; + c3=0; + sqr_add_c(a,3,c1,c2,c3); + r[6]=c1; + r[7]=c2; + } +#endif +#else + +#ifdef SPLIT_BN_SQR_COMBA4 +/* hmm... is it faster just to do a multiply? */ +#undef bn_sqr_comba4 +void bn_sqr_comba4(r,a) +BN_ULONG *r,*a; + { + BN_ULONG t[8]; + bn_sqr_normal(r,a,4,t); + } +#endif + +#ifdef SPLIT_BN_SQR_COMBA8 +#undef bn_sqr_comba8 +void bn_sqr_comba8(r,a) +BN_ULONG *r,*a; + { + BN_ULONG t[16]; + bn_sqr_normal(r,a,8,t); + } +#endif + +#endif + +#endif /* OPT_BN_ASM */ + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_div.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_div.c new file mode 100644 index 00000000..7036d196 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_div.c @@ -0,0 +1,381 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/** + * @file bn_div.c + * @brief Division and modulus functions + */ +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_DIV +#define SPLIT_BN_MOD +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BN_DIV +/* The old slow way */ +#ifdef OLD_BN_DIVISION +int BN_div(dv, rem, m, d,ctx) +BIGNUM *dv; +BIGNUM *rem; +BIGNUM *m; +BIGNUM *d; +BN_CTX *ctx; + { + int i,nm,nd; + BIGNUM *D; + + bn_check_top(m); + bn_check_top(d); + if (BN_is_zero(d)) + { +#ifndef NO_ERR + BNerr(BN_F_BN_DIV,BN_R_DIV_BY_ZERO); +#endif + return(0); + } + + if (BN_ucmp(m,d) < 0) + { + if (rem != NULL) + { if (BN_copy(rem,m) == NULL) return(0); } + if (dv != NULL) BN_zero(dv); + return(1); + } + + D= &(ctx->bn[ctx->tos]); + if (dv == NULL) dv= &(ctx->bn[ctx->tos+1]); + if (rem == NULL) rem= &(ctx->bn[ctx->tos+2]); + + nd=BN_num_bits(d); + nm=BN_num_bits(m); + if (BN_copy(D,d) == NULL) return(0); + if (BN_copy(rem,m) == NULL) return(0); + + /* The next 2 are needed so we can do a dv->d[0]|=1 later + * since BN_lshift1 will only work once there is a value + */ + BN_zero(dv); + bn_wexpand(dv,1); + dv->top=1; + + if (!BN_lshift(D,D,nm-nd)) return(0); + for (i=nm-nd; i>=0; i--) + { + if (!BN_lshift1(dv,dv)) return(0); + if (BN_ucmp(rem,D) >= 0) + { + dv->d[0]|=1; + if (!BN_usub(rem,rem,D)) return(0); + } +/* CAN IMPROVE (and have now :=) */ + if (!BN_rshift1(D,D)) return(0); + } + rem->neg=BN_is_zero(rem)?0:m->neg; + dv->neg=m->neg^d->neg; + return(1); + } + +#else +/** + * Performs Big number division + * + * @param dv [In] division + * @param rm [Out] remainder + * @param num [In] number + * @param divisor [In] divisor + * @param ctx [In] Temporary data storage + * + * @todo add more comments to this function + */ +int BN_div(BIGNUM *dv, BIGNUM *rm, BIGNUM *num, BIGNUM *divisor, BN_CTX *ctx) + { + int norm_shift,i,j,loop; + BIGNUM *tmp,wnum,*snum,*sdiv,*res; + BN_ULONG *resp,*wnump; + BN_ULONG d0,d1; + int num_n,div_n; + + bn_check_top(num); + bn_check_top(divisor); + + if (BN_is_zero(divisor)) + { +#ifndef NO_ERR + BNerr(BN_F_BN_DIV,BN_R_DIV_BY_ZERO); +#endif + return(0); + } + + if (BN_ucmp(num,divisor) < 0) + { + if (rm != NULL) + { if (BN_copy(rm,num) == NULL) return(0); } + if (dv != NULL) (void)BN_zero(dv); + return(1); + } + + tmp= &(ctx->bn[ctx->tos]); + tmp->neg=0; + snum= &(ctx->bn[ctx->tos+1]); + sdiv= &(ctx->bn[ctx->tos+2]); + if (dv == NULL) + res= &(ctx->bn[ctx->tos+3]); + else res=dv; + + /* First we normalise the numbers */ + norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); + if (!BN_lshift(sdiv,divisor,norm_shift)) return(0); + sdiv->neg=0; + norm_shift+=BN_BITS2; + if (!BN_lshift(snum,num,norm_shift)) return(0); + snum->neg=0; + div_n=sdiv->top; + num_n=snum->top; + loop=num_n-div_n; + + /* Lets setup a 'window' into snum + * This is the part that corresponds to the current + * 'area' being divided */ + BN_init(&wnum); + wnum.d= &(snum->d[loop]); + wnum.top= div_n; + wnum.max= snum->max+1; /* a bit of a lie */ + + /* Get the top 2 words of sdiv */ + /* i=sdiv->top; */ + d0=sdiv->d[div_n-1]; + d1=(div_n == 1)?0:sdiv->d[div_n-2]; + + /* pointer to the 'top' of snum */ + wnump= &(snum->d[num_n-1]); + + /* Setup to 'res' */ + if (!bn_wexpand(res,(loop+1))) goto err; + res->neg= (num->neg^divisor->neg); + res->top=loop; + resp= &(res->d[loop-1]); + + /* space for temp */ + if (!bn_wexpand(tmp,(div_n+1))) goto err; + + if (BN_ucmp(&wnum,sdiv) >= 0) + { + if (!BN_usub(&wnum,&wnum,sdiv)) goto err; + *resp=1; + res->d[res->top-1]=1; + } + else + res->top--; + resp--; + + for (i=0; i>BN_BITS2) || + (t2 <= ((BN_ULLONG)(rem< t1l) t3h++; + t3h=(t1h-t3h)&BN_MASK2; + + /*if ((t3>>BN_BITS2) || + (t2 <= ((t3<d,sdiv->d,div_n,q); + tmp->d[div_n]=l0; + for (j=div_n+1; j>0; j--) + if (tmp->d[j-1]) break; + tmp->top=j; + + j=wnum.top; +#ifdef BN_DEBUG + /* Sometimes this is 0 now (wnum.top is not). + * We need to look at this some time, I am quite + * sure it has no affect. + */ + bn_fix_top(&wnum); +#endif + (void)BN_sub(&wnum,&wnum,tmp); + + snum->top=snum->top+wnum.top-j; + + if (wnum.neg) + { + q--; + j=wnum.top; + (void)BN_add(&wnum,&wnum,sdiv); + snum->top+=wnum.top-j; + } + *(resp--)=q; + wnump--; + } + bn_fix_top(snum); + if (rm != NULL) + { + i=num->neg; /* just in case num == rm */ + if (BN_rshift(rm,snum,norm_shift) == 0) + return(0); + rm->neg=i; + } + return(1); +err: + return(0); + } +#endif +#endif + +#ifdef SPLIT_BN_MOD +/** + * Calculate the remainder where rem = m mod d + * + * @param rem [Out] Modulus result + * @param m [In] Base value + * @param d [In] Divisor + * @param ctx [In] BN_CTX for data space + * + * @pre variables are initialised and valid + * @post rem contained modulus + * + * @retval 1 success + * @retval 0 failure + * + * @note when BN_LIBRARY_SMALL define uses following algorithm + * otherwise calls through to BN_div + * + * @note m < d rem = m + * (length m = length of d) and (m > d) , rem = m - d + * alg otherwise + * let rem = m + * loop while rem > d + * let dv = shift left d, n bits to = length rem + * if dv > rem + * let dv = shift left d, n - 1 bits ( = length rem - 1) + * end if + * let rem = rem - dv; + * end loop + * + * @relates BN_div + */ +int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx) +{ +#ifdef BN_LIBRARY_SMALL + int nm,nd; + BIGNUM *dv, *dv2; + + /* if m < d , mod = m */ + if (BN_ucmp(m,d) < 0) + return((BN_copy(rem,m) == NULL)?0:1); + + dv= &(ctx->bn[ctx->tos]); + dv2 = &(ctx->bn[ctx->tos+1]); + + nm=BN_num_bits(m); + nd=BN_num_bits(d); + + /* if bits m = bits d and m >= d (from above) + * rem = m - d + */ + if(nm == nd) + { + BN_usub(rem, m, d); + goto end; + } + + if (BN_copy(rem, m) == NULL) + { + return 0; + } + + /* while the rem > d */ + while(BN_ucmp(rem,d) > 0) + { + nm=BN_num_bits(rem); + if(!BN_lshift(dv2,d,nm-nd)) + { + return(0); + } + + if(BN_ucmp(dv2, rem) >0) + { + if(!BN_lshift(dv2,d,nm-nd-1)) + { + return(0); + } + } + + BN_usub(rem,rem,dv2); + } +end: + return(1); +#else + return(BN_div(NULL,rem,m,d,ctx)); +#endif +} +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_ex_str.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_ex_str.c new file mode 100644 index 00000000..02e31d1c --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_ex_str.c @@ -0,0 +1,453 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +#include "bn_lcl.h" + +const static unsigned char p2 []={0,8,1,1,1,1,1,0,0,0}; +const static unsigned char p4 []={0,8,1,1,1,4,1,0,0,0}; +const static unsigned char p16[]={0,8,1,1,1,16,1,0,0,0}; + +/* The following defines allow for redefinition of the window size + * of the exponent string at compile time, this affects the size + * of temporary data required in montgomery operations. + * Larger window sizes have more memory and are slightly faster + */ +#ifndef MAX_WIN_SIZE +#define MAX_WIN_SIZE 5 +#endif + +#if (MAX_WIN_SIZE == 6) +#define MAX_NUM_SIZE 16 +#endif + +#if (MAX_WIN_SIZE == 5) +#define MAX_NUM_SIZE 16 +#endif + +#if (MAX_WIN_SIZE == 4) +#define MAX_NUM_SIZE 8 +#endif + +#if (MAX_WIN_SIZE == 3) +#define MAX_NUM_SIZE 4 +#endif + +#ifndef MAX_NUM_SIZE +#define MAX_NUM_SIZE 16 +#endif + +/* This table is used to calculate how far to shift a window to find + * the next 1 bit within the window, for a given window size + * Comment next to each value represents window size, value of the window + * and the number of shifts to find the next 1 bit. + * where the value of the window is 0, the shift is the size of the window + * and thus may not necessary yield a 1 bit, but refreshes the window + */ +const static unsigned char shift[64]= + {6, /* window 6, bits 000000, shift 6 */ + 0, /* 6, bits 000001, shift 0 */ + 1, /* 6, bits 000010, shift 1 */ + 0, /* 6, bits 000011, shift 0 */ + 2, /* 6, bits 000100, shift 2 */ + 0, /* 6, bits 000101, shift 0 */ + 1, /* 6, bits 000110, shift 1 */ + 0, /* 6, bits 000111, shift 0 */ + 3, /* 6, bits 001000, shift 3 */ + 0, /* 6, bits 001001, shift 0 */ + 1, /* 6, bits 001010, shift 1 */ + 0, /* 6, bits 001011, shift 0 */ + 2, /* 6, bits 001100, shift 2 */ + 0, /* 6, bits 001101, shift 0 */ + 1, /* 6, bits 001110, shift 1 */ + 0, /* 6, bits 001111, shift 0 */ + 4, /* 6, bits 010000, shift 4 */ + 0, /* 6, bits 010001, shift 0 */ + 1, /* 6, bits 010010, shift 1 */ + 0, /* 6, bits 010011, shift 0 */ + 2, /* 6, bits 010100, shift 2 */ + 0, /* 6, bits 010101, shift 0 */ + 1, /* 6, bits 010110, shift 1 */ + 0, /* 6, bits 010111, shift 0 */ + 3, /* 6, bits 011000, shift 3 */ + 0, /* 6, bits 011001, shift 0 */ + 1, /* 6, bits 011010, shift 1 */ + 0, /* 6, bits 011011, shift 0 */ + 2, /* 6, bits 011100, shift 2 */ + 0, /* 6, bits 011101, shift 0 */ + 1, /* 6, bits 011110, shift 1 */ + 0, /* 6, bits 011111, shift 0 */ + 5, /* 6, bits 100000, shift 5 */ + /* also window 5, bits 00000, shift 5 */ + 0, /* 5 ,bits 00001, shift 0 */ + 1, /* 5 ,bits 00010, shift 1 */ + 0, /* 5 ,bits 00011, shift 0 */ + 2, /* 5 ,bits 00100, shift 2 */ + 0, /* 5 ,bits 00101, shift 0 */ + 1, /* 5 ,bits 00110, shift 1 */ + 0, /* 5 ,bits 00111, shift 0 */ + 3, /* 5 ,bits 01000, shift 3 */ + 0, /* 5 ,bits 01001, shift 0 */ + 1, /* 5 ,bits 01010, shift 1 */ + 0, /* 5 ,bits 01011, shift 0 */ + 2, /* 5 ,bits 01100, shift 2 */ + 0, /* 5 ,bits 01101, shift 0 */ + 1, /* 5 ,bits 01110, shift 1 */ + 0, /* 5 ,bits 01111, shift 0 */ + 4, /* 5 ,bits 10000, shift 1 */ + /* also window 4, bits 0000, shift 4 */ + 0, /* 4 ,bits 0001, shift 0 */ + 1, /* 4 ,bits 0010, shift 1 */ + 0, /* 4 ,bits 0011, shift 0 */ + 2, /* 4 ,bits 0100, shift 2 */ + 0, /* 4 ,bits 0101, shift 0 */ + 1, /* 4 ,bits 0110, shift 1 */ + 0, /* 4 ,bits 0111, shift 0 */ + 3, /* 4 ,bits 1000, shift 3 */ + /* also window 3, bits 000, shift 3 */ + 0, /* 3 ,bits 001, shift 0 */ + 1, /* 3 ,bits 010, shift 1 */ + 0, /* 3 ,bits 011, shift 0 */ + 2, /* 3 ,bits 100, shift 2 */ + 0, /* 3 ,bits 101, shift 0 */ + 1, /* 3 ,bits 110, shift 1 */ + 0 /* 3 ,bits 111, shift 0 */ + }; + +/* This table defines the starting point in the shift table for + * a particular window size + */ +const static unsigned char *shift_val[7]= + { + &(shift[63]), /* window 0 - unused */ + &(shift[62]), /* window 1 */ + &(shift[60]), /* window 2 - unused */ + &(shift[56]), /* window 3 */ + &(shift[48]), /* window 4 */ + &(shift[32]), /* window 5 */ + &(shift[ 0]), /* window 6 - unused */ + }; + +/** + * Calculates a Montgomery exponent string. + * + * For a supplied exponent p, generate an exponent string strp, which + * defines in pairs the number of multiplies and square operations + * required by a particular bit pattern, commonly used exponents + * 3, 11 and F4 have predefined constant string values, the rest + * are calculated into a cast unsigned char * array via the data + * pointer of a BIGNUM taken from the BN_CTX stack of BIGNUMs + * + * @param p [In] Exponent + * @param strp [Out] Exponent string result + * @param flags [In] Unused + * @param ctx [In] Temporary data storage + * + * @pre p, and ctx are initialised and valid + * @post strp points to required exponent string + * + * @notes String length value in strp[2] is invalid for strings + * greater than length 255 + * string terminates with pattern, 0, 0 this should be + * used in accurately determining the length of a returned + * string strp. + * + * @note strings with value sqr = 255, mul = 0, sqr value should be + * treated as value 256, and added to the next sqr value, this + * is used by exponent strings where more then 256 contiguous + * zero bits are in the exponent bit representation. + * + * @note code contains conditional compilation of code dependent on + * the OS int/long sizes + */ +int BN_gen_exp_bits(p,strp,flags,ctx) +BIGNUM *p; +unsigned char **strp; +int flags; +BN_CTX *ctx; + { + int bits,i,j,window,num; + unsigned char *str=NULL; + BIGNUM *tmp; + + flags=flags; + bits=p->top*BN_BITS2; + tmp=&(ctx->bn[ctx->tos]); + if (p->top == 0) + return(0); + +#if (BN_BITS2 > 17) + if (p->top == 1) +#else + if (bits <= 32) +#endif + { +#if (BN_BITS2 > 17) + if ((p->top == 1) && (p->d[0] == 0x10001)) + str=(unsigned char *)p16; +#endif +#if (16 >= BN_BITS2) && (BN_BITS > 8) + if ( (p->top == 2) && + (p->d[0] == 0x0001) && + (p->d[1] == 0x0001)) + str=(unsigned char *)p16; +#endif +#if (8 >= BN_BITS) + if ( (p->top == 3) && + (p->d[0] == 0x01) && + (p->d[1] == 0x00) && + (p->d[2] == 0x01)) + str=(unsigned char *)p16; +#endif + else if ((p->d[0] == 0x11) && (p->top == 1)) + str=(unsigned char *)p4; + else if ((p->d[0] == 0x3) && (p->top == 1)) + str=(unsigned char *)p2; + window=1; + num=1; + i=BN_BITS2; + } + else if (bits >= 256) + { + window=MAX_WIN_SIZE; /* max size of window */ + num=MAX_NUM_SIZE; + i=(BN_BITS2+(MAX_WIN_SIZE -1))/MAX_WIN_SIZE; + } + else if (bits >= 128) + { + window=4; + num=8; + i=(BN_BITS2+3)/4; + } + else /* 128 to 33 */ + { + window=3; + num=4; + i=(BN_BITS2+2)/3; + } + + /* Number of tmp words */ + j=(p->top*i*2+BN_BYTES-1+4)/BN_BYTES; + + if (str == NULL) + { + if (!bn_wexpand(tmp,j)) + return(0); + str=(unsigned char *)tmp->d; + i=BN_gen_exp_string(&(str[4]),p,window); + i+=2; + str[0]=(unsigned char)((i>>8)&0xff); + str[1]=(unsigned char)((i )&0xff); + str[2]=(unsigned char)window; + str[3]=(unsigned char)num; + } + else + { + i=8; + } + *strp=str; + return(i+2); + } + + +/** + * Generates the Montgomery exponent string. + * + * This function is used to generate an 'exponent string' + * which is an array of bytes that encode how to perform the steps in + * the a^p%m operation. + * + * @param str [Out] Containing the generated string + * @param p [In] Exponent to generate the string for + * @param bits [In] Size of the window for shifting the values of the BIGNUM + * + * @pre p is initialised and value BIGNUM, bits is not 0 + * @post str points to generated exponent string + * + * @note str is cast assigned the data of a BIGNUM allocated and + * expanded from the BN_CTX of the calling function BN_gen_exp_bits + * it does not need to be de-allocated + * + * @note string consisted of unsigned char pairs and 4 byte init + * pairs are sqr count and multiply, where strings are greater + * than 256 bit, length in position str[2] is invalid + * + * @note strings with value sqr = 255, mul = 0, sqr value should be + * treated as value 256, and added to the next sqr value, this + * is used by exponent strings where more then 256 contiguous + * zero bits are in the exponent bit representation. + * + */ +int BN_gen_exp_string(str,p,bits) +unsigned char *str; +BIGNUM *p; +int bits; + { + unsigned char *sp; + unsigned int mask; + const unsigned char *shift; + BN_ULONG w,wh,wl,*d; + unsigned int i,mul,sqr,t,s,ss; + int top; + + if (bits > 6) bits=6; + shift= shift_val[bits]; + + /* This is the mask for the bits we wish to operate on */ + mask=(unsigned int)( (1<top*BN_BITS2+bits-1)/bits)*2+2]); + *sp-- = 0; + *sp-- = 0; + top=p->top; /* Total words we will shift in */ + d=p->d; + w=wl= *d++; + if (top <= 1) + wh=0; + else + wh= *d++; + sqr=0; + i=0; + + for (;;) + { + /* t will contain how far we need to shift to set a 1 + * in the bottom bit. */ + for (;;) + { + t=w&mask; /* retrieve our window */ + s=shift[t]; /* get the shift value for the window */ + if (s == 0) break; /* no shift write out the vals */ + sqr+=s; /* add the shifted zero count to sqr */ + ss+=s; /* ss is total shift for wl */ + if (ss >= BN_BITS2) /* we have shifted > word len */ + { + if (top <= 1) break; /* no more to do */ + top--; /* dec the count */ + + wl=wh; /* copy the next word */ + /* load the word after or 0 if no more */ + wh=(top <= 1)?0:(*d++); + /* adjust our shift by len of word */ + ss-=BN_BITS2; + } + /* reset our window word w */ + if (ss == 0) + w=wl; + else + w=(wl>>ss)|(wh<<(BN_BITS2-ss)); + } + + /* At this point we have the 0th bit set */ + mul=t; + if (t == 0) break; /* we have reached the end of p */ + /* write out sqr/mul pair */ + *sp-- = (unsigned char)(sqr & 0xff); + *sp-- = (unsigned char)(mul & 0xff); + if(sqr >= 256) /* check whether sqr exceeds max uchar */ + { + /* output the expanded list of to allow for this + * and numbers will require to be added together + * at interpret time + */ + while(sqr >= 256) + { + *sp-- = 255; + *sp-- = 0; /* mul is never zero normally */ + sqr-= 256; + } + } + sqr=(unsigned int)bits; /* set sqr to be the window size */ + + ss+=bits; /* ss is total shift for wl */ + if (ss >= BN_BITS2) /* adjust window words w,wl, wh again */ + { + if (top <= 1) break; + top--; + + wl=wh; + wh=(top <= 1)?0:(*(d++)); + ss-=BN_BITS2; + } + + if (ss == 0) + w=wl; + else + w=(wl>>ss)|(wh<<(BN_BITS2-ss)); + } + sp++; + i=2; + /* reverse the string from the top of the exponent string + * and copy to the bottom, allocated exponent string is 2 * max length + * expected for exponent string + */ + while (sp[0] != 0 || sp[1] != 0) + { + str[0]=sp[0]; + str[1]=sp[1]; + str+=2; + sp+=2; + i+=2; + } + str[0]=0; + str[1]=0; + + return( (int)i ); + } + +#ifdef MAIN +main() + { + BIGNUM p; + unsigned char buf[512],*pp; + int i; + + BN_init(&p); + BN_rand(&p,33,1,0); +#ifndef NO_FP_API + BN_print_fp(stdout,&p); fprintf(stdout,"\n"); +#endif + + BN_rand(&p,512,1,1); +#ifndef NO_FP_API + BN_print_fp(stdout,&p); fprintf(stdout,"\n"); +#endif + for (i=0; i<10000; i++) + BN_gen_exp_string(buf,&p,5); + +#if 0 + BN_gen_exp_string(buf,&p,3); + + pp=buf; + for (;;) + { + printf("mul %d sqr %d\n",pp[0],pp[1]); + if (pp[1] == 0) break; + pp+=2; + } +#endif + } +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_exp.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_exp.c new file mode 100644 index 00000000..723b62f5 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_exp.c @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_MOD_EXP_ORIG +#define SPLIT_BN_MOD_EXP +#endif /* NO_SPLIT */ + +#define TABLE_SIZE 16 + +#ifdef SPLIT_BN_MOD_EXP_ORIG +#if 0 +/* this one works - simple but works */ +int BN_mod_exp_orig(r,a,p,m,ctx) +BIGNUM *r,*a,*p,*m; +BN_CTX *ctx; + { + int i,bits,ret=0; + BIGNUM *v,*tmp; + + v= &(ctx->bn[ctx->tos++]); + tmp= &(ctx->bn[ctx->tos++]); + + if (BN_copy(v,a) == NULL) goto err; + bits=BN_num_bits(p); + + if (BN_is_odd(p)) + { if (BN_copy(r,a) == NULL) goto err; } + else { if (!BN_one(r)) goto err; } + + for (i=1; itos-=2; + return(ret); + } + +#endif + +/* this one works - simple but works */ +int BN_exp(r,a,p,ctx) +BIGNUM *r,*a,*p; +BN_CTX *ctx; + { + int i,bits,ret=0,tos; + BIGNUM *v,*rr; + + bn_check_top(a); + bn_check_top(p); + + tos=ctx->tos; + v= &(ctx->bn[ctx->tos++]); + if ((r == a) || (r == p)) + rr= &(ctx->bn[ctx->tos++]); + else + rr=r; + + if (BN_copy(v,a) == NULL) goto err; + bits=BN_num_bits(p); + + if (BN_is_odd(p)) + { if (BN_copy(rr,a) == NULL) goto err; } + else { if (!BN_one(rr)) goto err; } + + for (i=1; itos=tos; + if (r != rr) (void)BN_copy(r,rr); + return(ret); + } +#endif + +#ifdef SPLIT_BN_MOD_EXP +/** + * Perform mod exp on BIGNUM + * @param r Pointer to return value BIGNUM + * @param a Pointer to data value BIGNUM + * @param p Pointer to Public exponent BIGNUM + * @param m Pointer to modulus BIGNUM + * @param ctx Pointer to BN_CTX + * @return 0 success + * @pre BIGNUMs a, p, m and BN_CTX ctx exist and are valid + * @post BIGNUM r points to evaluated mod_exp + * @note BN_mod_exp_mont is only available if library compiled + * with define BN_MONT_MUL, and will only be used to compute + * mod_exp operation where the modulus m is odd. + * BN_mod_exp_recp is only available if library is compiled + * with define RECP_MUL_MOD. + * BN_mod_exp_simple is the default method, not available if + * library is compiled with define RECP_MUL_MOD. + * if BN_mod_exp_mont is available, which ever of BN_mod_exp_simple + * or BN_mod_exp_recp is available will only be used for even + * modulus m values. + * @relates BN_mod_exp_mont + * @relates BN_mod_exp_recp + * @relates BN_mod_exp_simple + */ +int BN_mod_exp(r,a,p,m,ctx) +BIGNUM *r; +BIGNUM *a; +BIGNUM *p; +BIGNUM *m; +BN_CTX *ctx; + { + int ret; + + bn_check_top(a); + bn_check_top(p); + bn_check_top(m); + +#ifdef MONT_MUL_MOD + + if (BN_is_odd(m)) + { ret=BN_mod_exp_mont(r,a,p,m,ctx,NULL); } + else +#endif +#ifdef RECP_MUL_MOD + { ret=BN_mod_exp_recp(r,a,p,m,ctx); } +#else + { ret=BN_mod_exp_simple(r,a,p,m,ctx); } +#endif + + return(ret); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_fm_w.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_fm_w.c new file mode 100644 index 00000000..54c67abb --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_fm_w.c @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +#include "bn_lcl.h" + +/* rp has w words, the top w words are 0 */ +void bn_from_montgomery_words(ret,a,np,w,n0) +BN_ULONG *ret; +BN_ULONG *a; +BN_ULONG *np; +int w; +BN_ULONG n0; + { + BN_ULONG v0,v1,*ap,*wap; + int i; + + v1=0; + + ap=a; + wap= &(a[w]); + /* Consider putting this loop in ASM */ + for (i=0; i0; i--) + if (ap[i] != np[i]) break; + } + v1=(ap[i] >= np[i]); + } + if (v1) + (void)bn_sub_words(ret,ap,np,w); + else + { +#if 0 /* Alpha does not like Memcpy */ + Memcpy(ret,ap,sizeof(BN_ULONG)*w); +#else + for (i=0; ibn[ctx->tos]); + b= &(ctx->bn[ctx->tos+1]); + + if (BN_copy(a,in_a) == NULL) goto err; + if (BN_copy(b,in_b) == NULL) goto err; + + if (BN_cmp(a,b) < 0) { t=a; a=b; b=t; } + t=bn_euclid(a,b); + if (t == NULL) goto err; + + if (BN_copy(r,t) == NULL) goto err; + ret=1; +err: + return(ret); + } + +BIGNUM *bn_euclid(a,b) +BIGNUM *a,*b; + { + BIGNUM *t; + int shifts=0; + + bn_check_top(a); + bn_check_top(b); + + for (;;) + { + if (BN_is_zero(b)) + break; + + if (BN_is_odd(a)) + { + if (BN_is_odd(b)) + { + if (!BN_sub(a,a,b)) goto err; + if (!BN_rshift1(a,a)) goto err; + if (BN_cmp(a,b) < 0) + { t=a; a=b; b=t; } + } + else /* a odd - b even */ + { + if (!BN_rshift1(b,b)) goto err; + if (BN_cmp(a,b) < 0) + { t=a; a=b; b=t; } + } + } + else /* a is even */ + { + if (BN_is_odd(b)) + { + if (!BN_rshift1(a,a)) goto err; + if (BN_cmp(a,b) < 0) + { t=a; a=b; b=t; } + } + else /* a even - b even */ + { + if (!BN_rshift1(a,a)) goto err; + if (!BN_rshift1(b,b)) goto err; + shifts++; + } + } + } + if (shifts) + { + if (!BN_lshift(a,a,shifts)) goto err; + } + return(a); +err: + return(NULL); + } +#endif + +#ifdef SPLIT_BN_MOD_INVERSE +/* solves ax == 1 (mod n) */ +BIGNUM *BN_mod_inverse(in, a, n, ctx) +BIGNUM *in; +BIGNUM *a; +BIGNUM *n; +BN_CTX *ctx; + { + BIGNUM *A,*B,*X,*Y,*M,*D,*R; + BIGNUM *T,*ret=NULL; + int sign; + + bn_check_top(a); + bn_check_top(n); + + A= &(ctx->bn[ctx->tos]); + B= &(ctx->bn[ctx->tos+1]); + X= &(ctx->bn[ctx->tos+2]); + D= &(ctx->bn[ctx->tos+3]); + M= &(ctx->bn[ctx->tos+4]); + Y= &(ctx->bn[ctx->tos+5]); + ctx->tos+=6; + if (in == NULL) + R=BN_new(); + else + R=in; + if (R == NULL) goto err; + + (void)BN_zero(X); + (void)BN_one(Y); + if (BN_copy(A,a) == NULL) goto err; + if (BN_copy(B,n) == NULL) goto err; + sign=1; + + while (!BN_is_zero(B)) + { + if (!BN_div(D,M,A,B,ctx)) goto err; + T=A; + A=B; + B=M; + /* T has a struct, M does not */ + + if (!BN_mul(T,D,X,ctx)) goto err; + if (!BN_add(T,T,Y)) goto err; + M=Y; + Y=X; + X=T; + sign= -sign; + } + if (sign < 0) + { + if (!BN_sub(Y,n,Y)) goto err; + } + + if (BN_is_one(A)) + { if (!BN_mod(R,Y,n,ctx)) goto err; } + else + { +#ifndef NO_ERR + BNerr(BN_F_BN_MOD_INVERSE,BN_R_NO_INVERSE); +#endif + goto err; + } + ret=R; +err: + if ((ret == NULL) && (in == NULL)) BN_free(R); + ctx->tos-=6; + return(ret); + } +#endif + +#ifdef SPLIT_BN_MOD_INVERSE_WORD +/* solves 1 == (ret*(1<l + * @param l [In] a word (size of word depends on machine) + * @returns number of bits in parameter l + */ +#ifdef SPLIT_BN_NUM_BITS_WORD +int BN_num_bits_word(l) +BN_ILONG l; + { + int i; + + /* + * This table represents the number of bits required to + * represent a "number", where "number" is indexed from + * 0 into the table. So: + * number 0 = # bits req'd to represent 0 = bits[0] = 0 + * number 1 = # bits req'd to represent 1 = bits[1] = 1 + * number 2 = # bits req'd to represent 2 = bits[2] = 2 + * number 3 = # bits req'd to represent 3 = bits[3] = 2 + * number 4 = # bits req'd to represent 4 = bits[4] = 3 + * etc. + * + * The small code size table exists to save some space, + * but requires (at most) an extra shift, an extra AND, + * and an extra add. + */ +#ifdef SMALL_CODE_SIZE + const static char bits[16]={ + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4 + }; +#else + const static char bits[256]={ + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + }; +#endif + +#if defined(SIXTY_FOUR_BIT_LONG) + if (l & 0xffffffff00000000L) + { + if (l & 0xffff000000000000L) + { + if (l & 0xff00000000000000L) + i=56; + else i=48; + } + else + { + if (l & 0x0000ff0000000000L) + i=40; + else i=32; + } + } + else +#else +#ifdef SIXTY_FOUR_BIT + if (l & 0xffffffff00000000LL) + { + if (l & 0xffff000000000000LL) + { + if (l & 0xff00000000000000LL) + i=56; + else i=48; + } + else + { + if (l & 0x0000ff0000000000LL) + i=40; + else i=32; + } + } + else +#endif +#endif + { +#if defined(THIRTY_BIT) || defined(THIRTY_ONE_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) + if (l & 0xffff0000L) + { + if (l & 0xff000000L) + i=24; + else i=16; + } + else +#endif + { + if (l & 0xff00L) + i=8; + else + i=0; + } + } +#ifndef SMALL_CODE_SIZE + return(i+bits[l>>i]); +#else + l>>=i; + if (l & 0xf0) + return(bits[l>>4]+i+4); + else + return(bits[l]+i); +#endif + } +#endif + +#ifdef SPLIT_BN_NUM_BITS +int BN_num_bits(a) +BIGNUM *a; + { + BN_ULONG l; + int i; + + bn_check_top(a); + + if (a->top == 0) return(0); + l=a->d[a->top-1]; + i=(a->top-1)*BN_BITS2; +#ifdef BN_DEBUG + if (l == 0) + { +#if !defined(NO_FP_API) && !defined(WIN16) + fprintf(stderr,"BAD TOP VALUE\n"); +#endif + abort(); /* BN_DEBUG */ + /* TODO: need to understand what sort of error can + * be reported for this error + */ + return(0); + } +#endif + return(i+BN_num_bits_word(l)); + } +#endif + +/** + * Clears and free a BIGNUM + * + * @param a [In] BIGNUM to clear then free + */ +#ifdef SPLIT_BN_CLEAR_FREE +void BN_clear_free(BIGNUM *a) +{ + if (a == NULL) + { + return; + } + + BN_clear(a); + BN_free(a); +} +#endif + +#ifdef SPLIT_BN_FREE +/** + * Frees a BIGNUM + * + * @param a [In] BIGNUM to free + */ +void BN_free(a) +BIGNUM *a; + { + if (a == NULL) return; + if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA))) + Free(a->d); + a->flags|=BN_FLG_FREE; /* REMOVE? */ + if (a->flags & BN_FLG_MALLOCED) + Free(a); + } +#endif + +#ifdef SPLIT_BN_INIT + +#ifdef SMALL_CODE_SIZE +/** + * Zero expands a bignum + * + * @param a [In] BIGNUM to expand + * @param n [In] number of bits to expand to + * + * @pre a is a valid BIGNUM. + */ +void bn_zexpand(a,n) +BIGNUM *a; +int n; + { + if ((a)->top < n) + { + int i; + bn_wexpand((a),n); + if (a->d!=NULL) + { + for (i=(a)->top; id[i]=0; + } + } + } + +/** + * Fixes the top value in the BIGNUM to be the count of BN_ULONGs with data. + * + * @param a [In] BIGNUM to free + * + * @pre a is a valid BIGNUM. + */ +void bn_fix_top(a) +BIGNUM *a; + { + BN_ULONG *ftl; + if ((a)->top > 0) + { + for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) + if (*(ftl--)) break; + } + } +#endif + +/** + * Initializes a BIGNUM + * + * @param a [In] BIGNUM reference + * + * @pre a is a valid BIGNUM. + */ +void BN_init(a) +BIGNUM *a; + { + (void)Memset(a,0,sizeof(BIGNUM)); + } +#endif + +#ifdef SPLIT_BN_NEW +/** + * Allocates a BIGNUM + * + * @return pointer to allocated BIGNUM + */ +BIGNUM *BN_new() + { + BIGNUM *ret; + + if ((ret=(BIGNUM *)Malloc(sizeof(BIGNUM))) == NULL) + { +#ifndef NO_ERR + BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); +#endif + return(NULL); + } + ret->flags=BN_FLG_MALLOCED; + ret->top=0; + ret->neg=0; + ret->max=0; + ret->d=NULL; + return(ret); + } +#endif + +#ifdef SPLIT_BN_CTX_NEW +/** + * Allocates a BIGNUM context + * + * @return pointer to allocated BIGNUM context + */ +BN_CTX *BN_CTX_new() + { + BN_CTX *ret; + + ret=(BN_CTX *)Malloc(sizeof(BN_CTX)); + if (ret == NULL) + { +#ifndef NO_ERR + BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE); +#endif + return(NULL); + } + + BN_CTX_init(ret); + ret->flags=BN_FLG_MALLOCED; + return(ret); + } +#endif + +#ifdef SPLIT_CTX_INIT +/** + * Initializes a BIGNUM context + * + * @param a [In] BIGNUM context reference + * + * @pre a is a valid BIGNUM context. + */ +void BN_CTX_init(ctx) +BN_CTX *ctx; + { + (void)Memset(ctx,0,sizeof(BN_CTX)); + ctx->tos=0; + ctx->flags=0; + } +#endif + +#ifdef SPLIT_BN_CTX_FREE +/** + * Frees a BIGNUM context + * + * @param a [In] BIGNUM context reference + * + * @pre a is a valid BIGNUM context. + */ +void BN_CTX_free(c) +BN_CTX *c; + { + int i; + + for (i=0; ibn[i])); + if (c->flags & BN_FLG_MALLOCED) + Free(c); + } +#endif + +#ifdef SPLIT_BN_EXPAND2 +BIGNUM *bn_expand2(b, words) +BIGNUM *b; +int words; + { + BN_ULONG *A,*B,*a; + + R_DIAG_CHECK_STACK; + + bn_check_top(b); + + if (words > b->max) + { + bn_check_top(b); + if (BN_get_flags(b,BN_FLG_STATIC_DATA)) + { +#ifndef NO_ERR + BNerr(BN_F_BN_EXPAND2,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); +#endif + return(NULL); + } + a=A=(BN_ULONG *)Malloc(sizeof(BN_ULONG)*(words+1)); + if (A == NULL) + { +#ifndef NO_ERR + BNerr(BN_F_BN_EXPAND2,ERR_R_MALLOC_FAILURE); +#endif + return(NULL); + } + /* during development this is a nice way of making sure + * that we are not relying on the top byte being 0 or + * other such things + */ +#ifdef BN_DEBUG + (void)Memset(A,0x5c,sizeof(BN_ULONG)*(words+1)); +#endif + + B=b->d; + if (B != NULL) + { +#ifndef SMALL_CODE_SIZE + int i; + + /* for (i=b->top&(~7); i>0; i-=8) */ + /* The above line can induce a SunC compiler bug */ + for (i=(b->top>>3); i>0; i--) + { + BN_ULONG T0,T1,T2,T3; + + T0=B[0]; + T1=B[1]; + T2=B[2]; + T3=B[3]; + A[0]=T0; + A[1]=T1; + A[2]=T2; + A[3]=T3; + T0=B[4]; + T1=B[5]; + T2=B[6]; + T3=B[7]; + A[4]=T0; + A[5]=T1; + A[6]=T2; + A[7]=T3; + A+=8; + B+=8; + } + switch (b->top&7) + { + case 7: + A[6]=B[6]; + case 6: + A[5]=B[5]; + case 5: + A[4]=B[4]; + case 4: + A[3]=B[3]; + case 3: + A[2]=B[2]; + case 2: + A[1]=B[1]; + case 1: + A[0]=B[0]; + case 0: + /* I need the 'case 0' entry for utrix cc. + * If the optimiser is turned on, it does the + * switch table by doing + * a=top&7 + * a--; + * goto jump_table[a]; + * If top is 0, this makes us jump to 0xffffffc + * which is rather bad. + * eric 23-Apr-1998 + */ + ; + } +#if 0 /* Not needed */ + B= &(b->d[b->top]); + j=b->max-8; + for (i=b->top; itop); +#endif + Free(b->d); + } + + b->d=a; + b->max=words; + } + return(b); + } +#endif + +#ifdef SPLIT_BN_DUP +/** + * Duplicates a BIGNUM + * + * @param a [In] BIGNUM reference + * + * @returns pointer to duplicate BIGNUM of a + */ +BIGNUM *BN_dup(a) +BIGNUM *a; + { + BIGNUM *r; + BIGNUM *ret; + + bn_check_top(a); + + r=BN_new(); + if (r == NULL) return(NULL); + ret = (BIGNUM *)BN_copy(r,a); + if (ret == NULL) + { + BN_free(r); + } + return(ret); + } +#endif + +#ifdef SPLIT_BN_COPY +/** + * Copies a BIGNUM to an existing BIGNUM + * + * @param a [In] To BIGNUM reference + * @param b [Out] From BIGNUM reference + * + * @pre Both a and b are valid BIGNUMs + * + * @returns pointer to duplicate BIGNUM of a + */ +BIGNUM *BN_copy(a, b) +BIGNUM *a; +BIGNUM *b; + { +#ifndef SMALL_CODE_SIZE + int i; + BN_ULONG *A,*B; +#endif + + bn_check_top(b); + + if (a == b) return(a); + if (bn_wexpand(a,b->top) == NULL) return(NULL); +#ifndef SMALL_CODE_SIZE + A=a->d; + B=b->d; + +/* for (i=b->top&~0x07; i>0; i-=8) */ +/* The above version of this loop has been removed. It appeared + to generate a compiler bug in SunC 4.x and 5.x. I do not believe + that the code was to blame. Compiling with -fast was the problem + since this would loop unroll the loop below another 3 times. + The compiler would generate generate + andcc %o0,-8,%o1 # load ~0x07 + ld [%i2],%o3 # load *B + ble .L77000125 # exit loop unless 8 or more + ld [%i1],%o2 # load *A + sub %o1,-7,%o0 # + sdivcc %o0,8,%o0 # when do we clear %y? + bvs,a .L900001510 + sethi %hi(0x80000000),%o0 +.L900001510: + cmp %o0,3 + bl .L77000114 # one loop + ld [%o2],%o0 + # three loop code + + The loop would then be unrolled 3 times. The problem I believe + I was seeing was that the sdivcc operates is %y:%o0 / 8. + %y is not being cleared, and so occasionally this would + cause problems. The replacement code sequence stops + the compiler generating the sdiv instruction. + */ + for (i=(b->top>>3); i>0; i--) + { + BN_ULONG T0,T1,T2,T3; + T0=B[0]; + T1=B[1]; + T2=B[2]; + T3=B[3]; + A[0]=T0; + A[1]=T1; + A[2]=T2; + A[3]=T3; + T0=B[4]; + T1=B[5]; + T2=B[6]; + T3=B[7]; + A[4]=T0; + A[5]=T1; + A[6]=T2; + A[7]=T3; + A+=8; + B+=8; + } + switch (b->top&0x07) + { + case 7: + A[6]=B[6]; + case 6: + A[5]=B[5]; + case 5: + A[4]=B[4]; + case 4: + A[3]=B[3]; + case 3: + A[2]=B[2]; + case 2: + A[1]=B[1]; + case 1: + A[0]=B[0]; + case 0: + /* I need the 'case 0' entry for utrix cc. + * If the optimiser is turned on, it does the + * switch table by doing + * a=top&7 + * a--; + * goto jump_table[a]; + * If top is 0, this makes us jump to 0xffffffc which is + * rather bad. + * eric 23-Apr-1998 + */ + ; + } +#else + (void)Memcpy(a->d,b->d,sizeof(b->d[0])*b->top); +#endif + +/* (void)Memset(&(a->d[b->top]),0,sizeof(a->d[0])*(a->max-b->top));*/ + a->top=b->top; + if ((a->top == 0) && (a->d != NULL)) + a->d[0]=0; + a->neg=b->neg; + return(a); + } +#endif + +#ifdef SPLIT_BN_CLEAR +/** + * Clears a BIGNUM + * + * @param a [In] BIGNUM to clear + * + * @pre a is valid + */ +void BN_clear(a) +BIGNUM *a; + { + if (a->d != NULL) + (void)Memset(a->d,0,a->max*sizeof(a->d[0])); + a->top=0; + a->neg=0; + } +#endif + +#ifdef SPLIT_BN_GET_WORD +BN_ULONG BN_get_word(a) +BIGNUM *a; + { + int i,n; + BN_ULONG ret=0; + + n=BN_num_bytes(a); + if (n > ((int) sizeof(BN_ULONG))) + return(BN_MASK2); + for (i=a->top-1; i>=0; i--) + { +#ifndef SIXTY_FOUR_BIT /* the data item > unsigned long */ + ret<<=BN_BITS4; /* stops the compiler complaining */ + ret<<=BN_BITS4; +#else + ret=0; +#endif + ret|=a->d[i]; + } + return(ret); + } +#endif + +#ifdef SPLIT_BN_SET_WORD +/** + * Set the BIGNUM to the supplied BN_ULONG value. + * + * @param a [In/Out] BIGNUM to be updated + * @param w [In] Value to be set in a + * + * @notes Function will expand a to be an + * array of 8 BN_ULONGs in size. + * @todo Review behaviour of expansion without checking + * of size first. + */ +int BN_set_word(a,w) +BIGNUM *a; +BN_ULONG w; + { + int i,n; + + if (bn_expand(a,(int)(sizeof(BN_ULONG)*8)) == NULL) return(0); + +#ifdef BN_BYTES + /* This is used when a BN_ULONG is greater in size + * than the BN_BYTES of the array, eg BN_ULONG 64 bits + * and actual a->d array of 32 bits. + */ + n=sizeof(BN_ULONG)/BN_BYTES; +#else + n=1; +#endif + a->neg=0; + a->top=0; + a->d[0]=(BN_ULONG)w&BN_MASK2; + if (a->d[0] != 0) a->top=1; + for (i=1; i>=BN_BITS2 so compilers don't complain + * on builds where sizeof(long) == BN_TYPES */ +#ifndef SIXTY_FOUR_BIT /* the data item > unsigned long */ + w>>=BN_BITS4; + w>>=BN_BITS4; +#else + w=0; +#endif + a->d[i]=(BN_ULONG)w&BN_MASK2; + if (a->d[i] != 0) a->top=i+1; + } + return(1); + } +#endif + +#ifdef BN_BYTES +#ifdef SPLIT_BN_BIN2BN +/* ignore negative */ +BIGNUM *BN_bin2bn(s, len, ret) +unsigned char *s; +int len; +BIGNUM *ret; + { + int i,m; + int n; + BN_ULONG l; + + if (ret == NULL) ret=BN_new(); + if (ret == NULL) return(NULL); + l=0; + n=len; + if (n == 0) + { + ret->top=0; + return(ret); + } + if (bn_expand(ret,(int)(n+2)*8) == NULL) + return(NULL); + i=((n-1)/BN_BYTES)+1; + m=((n-1)%(BN_BYTES)); + ret->top=i; + while (n-- > 0) + { + l=(l<<8L)| *(s++); + if (m-- == 0) + { + ret->d[--i]=l; + l=0; + m=BN_BYTES-1; + } + } + /* need to call this due to clear byte at top if avoiding + * having the top bit set (-ve number) */ + bn_fix_top(ret); + return(ret); + } +#endif + +#ifdef SPLIT_BN_BN2BIN +/* ignore negative */ +int BN_bn2bin(a, to) +BIGNUM *a; +unsigned char *to; + { + int n,i; + BN_ULONG l; + + bn_check_top(a); + + n=i=BN_num_bytes(a); + while (i-- > 0) + { + l=a->d[i/BN_BYTES]; + *(to++)=(unsigned char)((l>>(8*(i%BN_BYTES)))&0xff); + } + return(n); + } +#endif +#else +#ifdef SPLIT_BN_BIN2BN +/* ignore negative */ +BIGNUM *BN_bin2bn(s, len, ret) +unsigned char *s; +int len; +BIGNUM *ret; + { + int i,w,r,b,j,v; + int n; + BN_ULONG l; + + if (ret == NULL) ret=BN_new(); + if (ret == NULL) return(NULL); + while (len > 0) + { + if (*s != 0) break; + s++; + len--; + } + n=len*8; + if (bn_expand(ret,n) == NULL) + return(NULL); + for (i=0; imax; i++) + ret->d[i]=0; + j=0; + for (i=len-1; i>=0; i--) + { + v=((int)s[i])&0xff; + w=j/BN_BITS2; + b=j%BN_BITS2; + r=BN_BITS2-b; + j+=8; + if (r >= 8) + { + ret->d[w]|=(((BN_ULONG)v)<d[w] =(ret->d[w]|(((BN_ULONG)v)<d[w+1]=(ret->d[w+1]|(((BN_ULONG)v)>>r)); + } + } + + ret->top=((n-1)/BN_BITS2)+1; + bn_fix_top(ret); + return(ret); + } +#endif + +#ifdef SPLIT_BN_BN2BIN +int BN_bn2bin(a, to) +BIGNUM *a; +unsigned char *to; + { + int num,i,bi,w,b,r,max; + BN_ULONG l,*lp; + + bn_check_top(a); + + num=bi=BN_num_bytes(a); + lp=a->d; + for (i=0; i= 8) + to[bi]=(lp[w]>>b)&0xff; + else + { + to[bi]=(lp[w]>>b); + if (w+1 < a->top) + to[bi]|=lp[w+1]<top-b->top; + if (i != 0) return(i); + ap=a->d; + bp=b->d; + for (i=a->top-1; i>=0; i--) + { + t1= ap[i]; + t2= bp[i]; + if (t1 != t2) + return(t1 > t2?1:-1); + } + return(0); + } +#endif + +#ifdef SPLIT_BN_CMP +int BN_cmp(a, b) +BIGNUM *a; +BIGNUM *b; + { + int i; + int gt,lt; + BN_ULONG t1,t2; + + if ((a == NULL) || (b == NULL)) + { + if (a != NULL) + return(-1); + else if (b != NULL) + return(1); + else + return(0); + } + + bn_check_top(a); + bn_check_top(b); + + if (a->neg != b->neg) + { + if (a->neg) + return(-1); + else return(1); + } + if (a->neg == 0) + { gt=1; lt= -1; } + else { gt= -1; lt=1; } + + if (a->top > b->top) return(gt); + if (a->top < b->top) return(lt); + for (i=a->top-1; i>=0; i--) + { + t1=a->d[i]; + t2=b->d[i]; + if (t1 > t2) return(gt); + if (t1 < t2) return(lt); + } + return(0); + } +#endif + +#ifdef SPLIT_BN_SET_BIT +int BN_set_bit(a, n) +BIGNUM *a; +int n; + { + int i,j,k; + + bn_check_top(a); + + i=n/BN_BITS2; + j=n%BN_BITS2; + if (a->top <= i) + { + if (bn_wexpand(a,i+1) == NULL) return(0); + for(k=a->top; kd[k]=0; + a->top=i+1; + } + + a->d[i]|=(((BN_ULONG)1)<top <= i) return(0); + + a->d[i]&=(~(((BN_ULONG)1)<top <= i) return(0); + return((a->d[i]&(((BN_ULONG)1)<= a->top) return(0); + if (b == 0) + a->top=w; + else + { + a->top=w+1; + a->d[w]&= ~(((BN_ULONG)BN_MASK2)< bb)?1:-1); + for (i=n-2; i>=0; i--) + { + aa=a[i]; + bb=b[i]; + if (aa != bb) return((aa > bb)?1:-1); + } + return(0); + } +#endif +#endif + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_lsh.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_lsh.c new file mode 100644 index 00000000..21508b16 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_lsh.c @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_LSHIFT1 +#define SPLIT_BN_LSHIFT +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BN_LSHIFT1 +#ifdef SMALL_CODE_SIZE + +int BN_lshift1(r, a) +BIGNUM *r,*a; + { + return(BN_lshift(r, a, 1)); + } + +#else + +int BN_lshift1(r, a) +BIGNUM *r; +BIGNUM *a; + { + register BN_ULONG *ap,*rp,t,c; + int i; + + bn_check_top(a); + + if (r != a) + { + if (bn_wexpand(r,a->top+1) == NULL) return(0); + r->neg=a->neg; + r->top=a->top; + } + else + { + if (bn_wexpand(r,a->top+1) == NULL) return(0); + } + ap=a->d; + rp=r->d; + c=0; + for (i=0; itop; i++) + { + t= *(ap++); + *(rp++)=((t<<1L)|c)&BN_MASK2; + c=(t & BN_TBIT)?1:0; + } + if (c) + { + *rp=1; + r->top++; + } + return(1); + } +#endif +#endif + +#ifdef SPLIT_BN_LSHIFT +int BN_lshift(r, a, n) +BIGNUM *r; +BIGNUM *a; +int n; + { + int i,nw,lb,rb; + BN_ULONG *t,*f; + BN_ULONG l; + + bn_check_top(a); + +#ifndef SMALL_CODE_SIZE + if (n == 1) return(BN_lshift1(r,a)); +#endif + if (bn_wexpand(r,a->top+(n/BN_BITS2)+1) == NULL) return(0); + r->neg=a->neg; + nw=n/BN_BITS2; + lb=n%BN_BITS2; + rb=BN_BITS2-lb; + f=a->d; + t=r->d; + t[a->top+nw]=0; + if (lb == 0) + for (i=a->top-1; i>=0; i--) + t[nw+i]=f[i]; + else + for (i=a->top-1; i>=0; i--) + { + l=f[i]; + t[nw+i+1]|=(l>>rb)&BN_MASK2; + t[nw+i]=(l<top=a->top+nw+1; + bn_fix_top(r); + return(1); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_m_exp.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_m_exp.c new file mode 100644 index 00000000..480bb599 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_m_exp.c @@ -0,0 +1,299 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#if 0 //RSA +#include +#endif +#include "bn_lcl.h" + +/* #ifdef MONT_MUL_MOD */ +/** + * Generic form of Montgomery Exponentiation, can be called directly + * out side of a BN_ME_METH + * + * @param rr_in BIGNUM pointer for result + * @param a_in BIGNUM pointer for base + * @param p BIGNUM pointer to the exponent + * @param m BIGNUM pointer to the modulus + * @param ctx BN_CTX pointer for temp values are argument storage + * @param in_mont BN_MONT_CTX pointer to structure of montgomery values + * + * @pre arguments are all initialised and not NULL or zero + * @post rr_in contains evaluated result + * + * @note + */ +int BN_mod_exp_mont(rr_in,a_in,p,m,ctx,in_mont) +BIGNUM *rr_in; +BIGNUM *a_in; +BIGNUM *p; +BIGNUM *m; +BN_CTX *ctx; +BN_MONT_CTX *in_mont; + { + int i,j,k,ret=0,tos,top; + int mul,sqr,num; + BIGNUM *d,*aa,*r,*a,*t; + BN_ULONG *vall[BN_EXP_TABLE_SIZE],*dp,*rp,n0,*rr,*tmp,*np; + BN_MONT_CTX *mont=NULL; + unsigned char *str=NULL; +#ifdef BN_SURRENDER + R_SURRENDER *surrender=NULL; + int count=0; +#endif + + bn_check_top(a_in); + bn_check_top(p); + bn_check_top(m); + + if (!(m->d[0] & 1)) + { +#ifndef NO_ERR + BNerr(BN_F_BN_MOD_EXP_MONT,BN_R_CALLED_WITH_EVEN_MODULUS); +#endif + return(0); + } + + tos=ctx->tos; + + if (BN_is_zero(a_in)) + { (void)BN_zero(rr_in); return(1); } + if (BN_is_zero(p)) + { (void)BN_one(rr_in); return(1); } + if (BN_is_one(p)) + { (void)BN_copy(rr_in,a_in); return(1); } + + /* If this is not done, things will break in the montgomery + * part */ + +#if 1 + if (in_mont != NULL) + mont=in_mont; + else +#endif + { + if ((mont=BN_MONT_CTX_new()) == NULL) goto err; + if (!BN_MONT_CTX_set(mont,m,ctx)) goto err; + } + +#ifdef BN_SURRENDER + surrender=ctx->surrender; +#endif + + if (!BN_gen_exp_bits(p,&str,0,ctx)) goto err; + /* Remember this function uses another element from the passed ctx */ + ctx->tos++; + num=str[3]; + i=(BN_BITS+str[2]-1)/str[2]; + str+=4; + + + top=mont->N.top; + if ((a_in->top == top) && (a_in->d[top-1] < m->d[top-1])) + { + a=a_in; + } + else if (a_in->top < top) + { + a= &(ctx->bn[ctx->tos++]); + a->top=a_in->top; + bn_zexpand(a,top); + for (j=0; jtop; j++) + a->d[j]=a_in->d[j]; + } + else /* if (a_in->top > i) */ + { + a= &(ctx->bn[ctx->tos++]); + if (!BN_mod(a,a_in,m,ctx)) goto err; + bn_zexpand(a,top); + } + + /* At this point a is the size of the modulus and is 0 padded + * out to its size if needed. + */ + + /* Number of tmp words */ + k=num*top; + j=k+(p->top*i*2+BN_BYTES-1+4)/BN_BYTES; + + aa=&(ctx->bn[ctx->tos++]); + d= &(ctx->bn[ctx->tos++]); + r= &(ctx->bn[ctx->tos++]); + t= &(ctx->bn[ctx->tos++]); + + if (bn_wexpand(rr_in,top) == NULL) goto err; + if (bn_wexpand(d,top*4) == NULL) goto err; /* *2? */ + if (bn_wexpand(r,top*2) == NULL) goto err; + if (bn_wexpand(aa,j) == NULL) goto err; + if (bn_wexpand(t,top*2) == NULL) goto err; + dp=d->d; + rp=r->d; + tmp=t->d; + rr=mont->RR.d; + + n0=mont->n0; + np=mont->N.d; + + vall[0]=aa->d; + + bn_mul_normal(tmp,a->d,top,rr,top); + bn_from_montgomery_words(vall[0],tmp,np,top,n0); + + if (num > 1) + { + bn_sqr_normal(tmp,vall[0],top,dp); + bn_from_montgomery_words(dp,tmp,np,top,n0); + + for (i=1; i>1],sizeof(BN_ULONG)*top); + while (sqr != 0) + { +#ifdef BN_SURRENDER + /* + * Check this at the start of the loop rather than the + * end so we avoid as many of the bn operations as possible + */ + if (surrender != NULL) + { + if (surrender->callback(surrender,0xff, count++) != 0) + { + goto err; + } + } +#endif /* BN_SURRENDER */ + + /* + * check the abort flag at the start of the loop so we avoid + * as many of the bn operations as possible + */ + if (BN_CTX_get_flags(ctx, BN_CTX_FLG_ABORT)) + { + goto err; + } + + for (i=0; i>1],top); + bn_from_montgomery_words(rp,tmp,np,top,n0); + } + else + { + bn_mul_normal(tmp,rp,top,a->d,top); + bn_from_montgomery_words(rr_in->d,tmp,np,top,n0); + goto end; + } + } + + /* if (mul != 1) */ + { + for (i=top; id,rp,np,top,n0); + } +end: /* Use this to avoid an if */ + + /* + * Even if the operation has completed successfully, if the + * abort flag is set we want to abort so that anything + * calling this function will know not to continue. + */ + if (BN_CTX_get_flags(ctx, BN_CTX_FLG_ABORT)) + { + goto err; + } + + rr_in->top=top; + bn_fix_top(rr_in); + ret=1; +err: +#ifdef BN_SURRENDER + /* + * Even if the operation completed successfully we want to abort + * if the abort flag has been is set, so that subsequent operations + * do not continue. Allow the caller change to return value and + * cause the function to fail. + */ + if (surrender != NULL) + { + if (surrender->callback(surrender, 0xff, -1) != 0) + { + ret = 0; + } + } +#endif + if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); + ctx->tos=tos; + return(ret); + } +/* #endif */ + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_me.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_me.c new file mode 100644 index 00000000..fae07491 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_me.c @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ +/** + * @file bn_me.c + * @brief BN method functions and utilities + */ +#include "bn_lcl.h" +#include "bn_thx.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_MOD_EXP_METH_DEFAULT +#define SPLIT_BN_MONT_CTX_USEIT +#define SPLIT_BN_ME_CTX_NAME +#define SPLIT_BN_ME_CTX_NEW +#define SPLIT_BN_ME_CTX_FREE +#define SPLIT_BN_ME_CTX_SET +#define SPLIT_BN_ME_CTX_MOD_EXP +#endif /* NO_SPLIT */ + +#ifndef NOPROTO +BN_ME_METH *bn_mod_exp_meth_default(int fallback); +#else +BN_ME_METH *bn_mod_exp_meth_default(); +#endif + +#ifdef SPLIT_BN_MOD_EXP_METH_DEFAULT + +/** + * Returns the default mod_exp method, choose first available in the + * method table or a hardwired default + * + * @param fallback [In] Flag for choice of method + * - 0 use the first value in the method table + * - 1 use the all encompassing default method + * + * @pre BN_default_init() has been run setting up library + * + * @post + * + * @internal uses global table bnme[] and counter me_num + * + * @internal only read the BN_ME_METH_INFO table no need for locking + * + * @relates BN_library_init + * @relates BN_default_init + * @relates BN_ME_CTX_new + * @relates BN_ME_CTX_free + * + */ +BN_ME_METH *bn_mod_exp_meth_default(int fallback) +{ + const BN_ME_METH *tmp; + +#ifndef BN_LIBRARY_SMALL + BN_ME_METH_INFO *meth_info; + + if(!fallback && ((meth_info = BN_bnme_get_info(0)) != NULL)) + { + tmp = meth_info->meth(); + } + else +#endif + { + /* set in bn.h or override bn_thx.h */ + tmp = BN_ME_METH_DEFAULT(); + } + return((BN_ME_METH *)tmp); +} +#endif + +#ifdef SPLIT_BN_MONT_CTX_USEIT + +#ifndef NOPROTO +int bn_mont_ctx_useit(int argi); +#else +int bn_mont_ctx_useit(); +#endif + +/** + * Montgomery method default useit function + * + * @param argi [In] reserved for future use + * + * @return 0 success + */ +int bn_mont_ctx_useit(int argi) + { + return(0); + } +#endif + +#ifdef SPLIT_BN_ME_CTX_NAME +/** + * Retrieve the BN method name string + * + * @param ctx [In] Method + * + * @pre ctx is valid and not NULL + * + * @return string pointer + */ +char *BN_ME_CTX_name(BN_ME_CTX *ctx) + { + return(ctx->meth->name); + } +#endif + +#ifdef SPLIT_BN_ME_CTX_NEW +/** + * Allocate a new BN_ME_CTX structure and assign method + * + * @param meth [In] Method to assign + * @param in [Out] Result BN_ME_CTX + * + * @note if meth is NULL system method default is used + * + * @retval pointer to BN_ME_CTX success + * @retval NULL failure + */ +BN_ME_CTX *BN_ME_CTX_new(BN_ME_METH *meth, BN_ME_CTX **in) + { + int i; + BN_ME_CTX *ret; + + if (in == NULL) + in= &ret; + + if (meth == NULL) + meth=bn_mod_exp_meth_default(0); + i=meth->init_ctx(meth,in); + if (i) + return(NULL); + else + return(*in); + } +#endif + +#ifdef SPLIT_BN_ME_CTX_FREE +/** + * Free context method + * + * @param mctx [In] Context object to be deallocated + * + * @note it is the callers responsibility to set mctx to NULL after free + * + * @pre mctx is not NULL and is valide BN_ME_CTX + */ +void BN_ME_CTX_free(BN_ME_CTX *mctx) + { + mctx->meth->free_ctx(mctx); + } +#endif + +#ifdef SPLIT_BN_ME_CTX_SET +/** + * Set value to BN_ME_CTX by identifier + * + * @param mctx [In] Method context object + * @param b [In] Big number + * @param cmd [In] Command identifier + * @param flags [In] Mask operation directives + * @param ctx [In] BN data store + * + * @note cmd values: + * @li BN_ME_SET_MOD will cause a method lookup is method not set + * + * @note passes control to set method in mctx + * + * @return result of mctx method set operation + */ +int BN_ME_CTX_set(BN_ME_CTX *mctx, BIGNUM *b, int cmd, int flags, BN_CTX *ctx) + { +#ifndef BN_LIBRARY_SMALL +#ifndef NOPROTO + const BN_ME_METH *(*meth)(void); +#else + const BN_ME_METH *(*meth)(); +#endif +#endif /* BN_LIBRARY_SMALL */ + + /* If we are loading the modulus, and we do not have the + * no_lookup flag (without a null method) + */ + if ((cmd == BN_ME_SET_MOD) && + ((mctx->meth != NULL) && !(flags & BN_ME_SET_FLG_NO_LOOKUP))) + { +#ifndef BN_LIBRARY_SMALL + meth=(const BN_ME_METH*(*)(void)) + BN_bnme_get(BN_num_bits(b),BN_BNME_F_BITS); + if (meth != NULL) + mctx->meth=meth(); + else +#endif + mctx->meth=bn_mod_exp_meth_default(1); + } + return(mctx->meth->set(mctx,b,cmd,flags,ctx)); + } +#endif + +#ifdef SPLIT_BN_ME_CTX_MOD_EXP +/** + * Call method mod_exp operation + * + * @param mctx [In] Method context object + * @param ret [Out] Result + * @param a [In] Base value + * @param p [In] Exponent + * @param m [In] Modulus + * @param ctx [In] Data storage + * + * @pre a must be expandable + * + * @return 0 success + */ +int BN_ME_CTX_mod_exp(BN_ME_CTX *mctx, BIGNUM *ret, BIGNUM *a, BIGNUM *p, + BIGNUM *m, BN_CTX *ctx) + { + int wtop; + + /* Before we call the method, make sure we are not doing 0^p, + * and p is not 0 or 1 */ + if (BN_is_zero(a)) + { BN_zero(ret); return(0); } + if (p != NULL) + { + if (BN_is_zero(p)) + { BN_one(ret); return(0); } + else if (BN_is_one(p)) + { BN_copy(ret,a); return(0); } + } + + /* wtop is the size 'a' needs to be for the method */ + wtop=mctx->meth->num; + bn_zexpand(a,wtop); + + return(mctx->meth->mod_exp(mctx,ret,a,p,ctx)); + } +#endif + +#endif + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_mont.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_mont.c new file mode 100644 index 00000000..d6a45def --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_mont.c @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#undef BN_DEBUG +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_MOD_MUL_MONTGOMERY +#define SPLIT_BN_FROM_MONTGOMERY +#define SPLIT_BN_MONT_CTX_NEW +#define SPLIT_BN_MONT_CTX_INIT +#define SPLIT_BN_MONT_CTX_FREE +#define SPLIT_BN_MONT_CTX_COPY +#endif /* NO_SPLIT */ + +/* #define DEBUG */ + +#ifdef SPLIT_BN_MOD_MUL_MONTGOMERY +/* We multiply a by b, generating a number 2n words long. + * This is then reduced by the montogmery number, which is + * n words. */ +int BN_mod_mul_montgomery(r,a,b,mont,ctx) +BIGNUM *r,*a,*b; +BN_MONT_CTX *mont; +BN_CTX *ctx; + { + BIGNUM *tmp,*tmp2; + int ret=0,w; + int i; + + bn_check_top(a); + bn_check_top(b); + + w=mont->riw; + + tmp= &(ctx->bn[ctx->tos++]); + tmp2= &(ctx->bn[ctx->tos++]); + bn_check_top(tmp); + bn_check_top(tmp2); + if (bn_wexpand(tmp,w+w) == NULL) goto err; + if (bn_wexpand(r,w+w) == NULL) goto err; + + if (a == b) + { + if (bn_wexpand(tmp2,w+w) == NULL) goto err; +#ifdef BN_SQR_COMBA + if ((a->top == 8) && (a->top == b->top)) + bn_sqr_comba8(tmp->d,a->d); + else +#endif + { + bn_sqr_normal(tmp->d,a->d,a->top,tmp2->d); + } + } + else + { +#ifdef BN_MUL_COMBA + if (a->top == 8) + bn_mul_comba8(tmp->d,a->d,b->d); + else +#endif + { + bn_mul_normal(tmp->d,a->d,a->top,b->d,b->top); + } + } + + i=a->top+b->top; + while (i<(w+w)) + { + tmp->d[i]=0; + i++; + } + tmp->top=w+w; + tmp->neg=0; + + /* reduce from aRR to aR */ + /* tmp->d is 2w words */ +#if 0 + bn_fix_top(tmp); + BN_from_montgomery_words(r,tmp,mont,ctx); +#else + bn_from_montgomery_words(r->d,tmp->d,mont->N.d,w,mont->n0); +#endif + r->top=w; + r->neg=0; + bn_fix_top(r); + + ret=1; +err: + ctx->tos-=2; + return(ret); + } +#endif + +#ifdef SPLIT_BN_FROM_MONTGOMERY +int BN_from_montgomery(ret,a,mont,ctx) +BIGNUM *ret; +BIGNUM *a; +BN_MONT_CTX *mont; +BN_CTX *ctx; + { + BIGNUM *n,*r; + BN_ULONG *np,*rp,n0,v0,v1,*nrp; + int al,nl,max,i; + int retn=0; + + bn_check_top(a); + + r= &(ctx->bn[ctx->tos]); + + if (!BN_copy(r,a)) goto err1; + n= &(mont->N); + + /* mont->riw is the size of mont->N in bits/words */ + al=mont->riw; + + nl=n->top; + if ((al == 0) || (nl == 0)) { r->top=0; return(1); } + + max=(nl+al+1); /* allow for overflow (no?) XXX */ + if (bn_wexpand(r,max) == NULL) goto err1; + if (bn_wexpand(ret,max) == NULL) goto err1; + + r->neg=a->neg^n->neg; + np=n->d; + rp=r->d; + nrp= &(r->d[nl]); + + /* clear the top words of T */ + for (i=r->top; id[i]=0; + + r->top=max; + n0=mont->n0; + + v1=0; + for (i=0; iriw will be a multiple of the word size */ + (void)BN_rshift(ret,r,mont->riw*BN_BITS2); + + if (BN_ucmp(ret, &(mont->N)) >= 0) + { + (void)BN_usub(ret,ret,&(mont->N)); /* XXX */ + } + retn=1; + +err1: + return(retn); + } +#endif + +#ifdef SPLIT_BN_MONT_CTX_NEW +BN_MONT_CTX *BN_MONT_CTX_new() + { + BN_MONT_CTX *ret; + + if ((ret=(BN_MONT_CTX *)Malloc(sizeof(BN_MONT_CTX))) == NULL) + return(NULL); + + BN_MONT_CTX_init(ret); + ret->flags=BN_FLG_MALLOCED; + return(ret); + } +#endif + +#ifdef SPLIT_BN_MONT_CTX_INIT +void BN_MONT_CTX_init(ctx) +BN_MONT_CTX *ctx; + { + ctx->use_word=0; + ctx->riw=0; + BN_init(&(ctx->RR)); + BN_init(&(ctx->N)); + BN_init(&(ctx->Ni)); + ctx->flags=0; + } +#endif + +#ifdef SPLIT_BN_MONT_CTX_FREE +void BN_MONT_CTX_free(mont) +BN_MONT_CTX *mont; + { + BN_free(&(mont->RR)); + BN_free(&(mont->N)); + BN_free(&(mont->Ni)); + if (mont->flags & BN_FLG_MALLOCED) + Free(mont); + } +#endif + +#ifdef SPLIT_BN_MONT_CTX_COPY +BN_MONT_CTX *BN_MONT_CTX_copy(to, from) +BN_MONT_CTX *to, *from; + { + if (to == from) return(to); + + (void)BN_copy(&(to->RR),&(from->RR)); + (void)BN_copy(&(to->N),&(from->N)); + (void)BN_copy(&(to->Ni),&(from->Ni)); + bn_zexpand(&(to->RR),from->riw); + bn_zexpand(&(to->Ni),from->riw); + to->use_word=from->use_word; + to->riw=from->riw; + to->n0=from->n0; + return(to); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_ms_w.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_ms_w.c new file mode 100644 index 00000000..86a6510d --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_ms_w.c @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +int BN_MONT_CTX_set_word(mont,mod,ctx) +BN_MONT_CTX *mont; +BIGNUM *mod; +BN_CTX *ctx; + { + BIGNUM Ri,*R; +#if 1 + BN_ULONG tmod,rr; +#else + BN_ULONG buf[2]; + BIGNUM tmod; +#endif + + + bn_check_top(mod); + if (mod->top == 0) return(0); + + R= &(mont->RR); /* grab RR as a temp */ + if (BN_copy(&(mont->N),mod) == NULL) /* Set N */ + return(0); + + BN_init(&Ri); + + mont->use_word=1; + +/* EAY is this number of words to shift, or the number to shift to end up + * with a '1' in the next word? + * for 8 bit words, is 0x01ab == 1 or 2 + */ + mont->riw=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2; + if (!BN_zero(R)) return(0); + + /* We are now setting a number which is larger than our current + * one after we do the shift + */ + if (!BN_set_bit(R,BN_BITS2)) + goto err; + +#if 0 + tmod.d=buf; + tmod.top=1; + tmod.max=mod->max; + tmod.neg=mod->neg; + buf[0]=mod->d[0]&BN_MASK2; + buf[1]=0; + + if ((BN_mod_inverse(&Ri,R,&tmod,ctx)) == NULL) + goto err; +#else + tmod=mod->d[0]; + rr=BN_mod_inverse_word(tmod); + if (!BN_set_word(&Ri,rr)) + goto err; +#endif + + /* R*Ri */ + if (!BN_lshift(&Ri,&Ri,BN_BITS2)) + goto err; + + if (!BN_is_zero(&Ri)) + (void)BN_sub_word(&Ri,1); + else + { + /* This is not common..., 1 in BN_MASK2, + * It happens when buf[0] was == 1. So for 8 bit, + * this is 1/256, 16bit, 1 in 2^16 etc. + */ + if (!BN_set_word(&Ri,BN_MASK2)) + goto err; + } +#if 0 + BN_div(&Ri,NULL,&Ri,&tmod,ctx); + //BN_div_word(&Ri,tmod); + mont->n0=Ri.d[0]; +#else +#if 0 + { + BN_ULONG h,l; + + h=l=0; + if (Ri.top >= 2) h=Ri.d[1]; + if (Ri.top >= 1) l=Ri.d[0]; + mont->n0=bn_div_words(h,l,tmod); + } +#endif + mont->n0=bn_div_words( + (Ri.top >= 2)?Ri.d[1]:0, + (Ri.top >= 1)?Ri.d[0]:0, + tmod); +#endif + /* mod->top=z; */ + + /* setup RR for conversions */ + (void)BN_zero(&(mont->RR)); + if (!BN_set_bit(&(mont->RR),mont->riw*2*BN_BITS2)) + goto err; + (void)BN_mod(&(mont->RR),&(mont->RR),&(mont->N),ctx); + bn_zexpand(&(mont->RR),mont->riw); +#if 0 + bn_zexpand(&(mont->Ni),mont->riw); /*This is not used? */ +#endif + +err: + BN_free(&Ri); + return(1); + } + + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_mul.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_mul.c new file mode 100644 index 00000000..76e83e74 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_mul.c @@ -0,0 +1,795 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_MUL_RECURSIVE +#define SPLIT_BN_MUL_PART_RECURSIVE +#define SPLIT_BN_MUL_LOW_RECURSIVE +#define SPLIT_BN_MUL_HIGH +#define SPLIT_BN_MUL +#define SPLIT_BN_MUL_NORMAL +#define SPLIT_BN_MUL_LOW_NORMAL +#endif /* NO_SPLIT */ + +#ifdef SMALL_CODE_SIZE +#undef BN_RECURSION_MUL +#endif + +#ifdef BN_RECURSION_MUL +#if 0 /* Replaced by bn_mul_rec_words() */ +/* r is 2*n2 words in size, + * a and b are both n2 words in size. + * n2 must be a power of 2. + * We multiply and return the result. + * t must be 2*n2 words in size + * We calulate + * a[0]*b[0] + * a[0]*b[0]+a[1]*b[1]+(a[0]-a[1])*(b[1]-b[0]) + * a[1]*b[1] + */ +#ifdef SPLIT_BN_MUL_RECURSIVE +void bn_mul_recursive(r,a,b,n2,t) +BN_ULONG *r,*a,*b; +int n2; +BN_ULONG *t; + { + int n=n2/2,c1,c2; + unsigned int neg,zero; + BN_ULONG ln,lo,*p; + +#ifdef BN_COUNT +printf(" bn_mul_recursive %d * %d\n",n2,n2); +#endif +#ifdef BN_MUL_COMBA +/* if (n2 == 4) + { + bn_mul_comba4(r,a,b); + return; + } + else */ if (n2 == 8) + { + bn_mul_comba8(r,a,b); + return; + } +#endif + if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) + { + /* This should not happen */ + bn_mul_normal(r,a,n2,b,n2); + return; + } + /* r=(a[0]-a[1])*(b[1]-b[0]) */ + c1=bn_cmp_words(a,&(a[n]),n); + c2=bn_cmp_words(&(b[n]),b,n); + zero=neg=0; + switch (c1*3+c2) + { + case -4: + bn_sub_words(t, &(a[n]),a, n); /* - */ + bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */ + break; + case -3: + zero=1; + break; + case -2: + bn_sub_words(t, &(a[n]),a, n); /* - */ + bn_sub_words(&(t[n]),&(b[n]),b, n); /* + */ + neg=1; + break; + case -1: + case 0: + case 1: + zero=1; + break; + case 2: + bn_sub_words(t, a, &(a[n]),n); /* + */ + bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */ + neg=1; + break; + case 3: + zero=1; + break; + case 4: + bn_sub_words(t, a, &(a[n]),n); + bn_sub_words(&(t[n]),&(b[n]),b, n); + break; + } + +#ifdef BN_MUL_COMBA + if (n == 4) + { + if (!zero) + bn_mul_comba4(&(t[n2]),t,&(t[n])); + else + Memset(&(t[n2]),0,8*sizeof(BN_ULONG)); + + bn_mul_comba4(r,a,b); + bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n])); + } + else if (n == 8) + { + if (!zero) + bn_mul_comba8(&(t[n2]),t,&(t[n])); + else + Memset(&(t[n2]),0,16*sizeof(BN_ULONG)); + + bn_mul_comba8(r,a,b); + bn_mul_comba8(&(r[n2]),&(a[n]),&(b[n])); + } + else +#endif + { + p= &(t[n2*2]); + if (!zero) + bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p); + else + Memset(&(t[n2]),0,n2*sizeof(BN_ULONG)); + bn_mul_recursive(r,a,b,n,p); + bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,p); + } + + /* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign + * r[10] holds (a[0]*b[0]) + * r[32] holds (b[1]*b[1]) + */ + + c1=(int)bn_add_words(t,r,&(r[n2]),n2); + + if (neg) /* if t[32] is negative */ + { + c1-=(int)bn_sub_words(&(t[n2]),t,&(t[n2]),n2); + } + else + { + /* Might have a carry */ + c1+=(int)bn_add_words(&(t[n2]),&(t[n2]),t,n2); + } + + /* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1]) + * r[10] holds (a[0]*b[0]) + * r[32] holds (b[1]*b[1]) + * c1 holds the carry bits + */ + c1+=(int)bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2); + if (c1) + { + p= &(r[n+n2]); + lo= *p; + ln=(lo+c1)&BN_MASK2; + *p=ln; + + /* The overflow will stop before we over write + * words we should not overwrite */ + if (ln < (BN_ULONG)c1) + { + do { + p++; + lo= *p; + ln=(lo+1)&BN_MASK2; + *p=ln; + } while (ln == 0); + } + } + } +#endif +#endif + +#if 0 +#ifdef SPLIT_BN_MUL_PART_RECURSIVE +/* n+tn is the word length + * t must be n*4 is size, as does r */ +void bn_mul_part_recursive(r,a,b,tn,n,t) +BN_ULONG *r,*a,*b; +int tn,n; +BN_ULONG *t; + { + int i,j,n2=n*2; + int c1; + BN_ULONG ln,lo,*p; + +#ifdef BN_COUNT +printf(" bn_mul_part_recursive %d * %d\n",tn+n,tn+n); +#endif + if (n < 8) + { + i=tn+n; + bn_mul_normal(r,a,i,b,i); + return; + } + + /* r=(a[0]-a[1])*(b[1]-b[0]) */ + bn_sub_words(t, a, &(a[n]),n); /* + */ + bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */ + +#ifdef BN_MUL_COMBA +/* if (n == 4) + { + bn_mul_comba4(&(t[n2]),t,&(t[n])); + bn_mul_comba4(r,a,b); + bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn); + Memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2)); + } + else */ if (n == 8) + { + bn_mul_comba8(&(t[n2]),t,&(t[n])); + bn_mul_comba8(r,a,b); + bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn); + Memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2)); + } + else +#endif + { + p= &(t[n2*2]); + bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p); + bn_mul_recursive(r,a,b,n,p); + i=n/2; + /* If there is only a bottom half to the number, + * just do it */ + j=tn-i; + if (j == 0) + { + bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),i,p); + Memset(&(r[n2+i*2]),0,sizeof(BN_ULONG)*(n2-i*2)); + } + else if (j > 0) /* eg, n == 16, i == 8 and tn == 11 */ + { + bn_mul_part_recursive(&(r[n2]),&(a[n]),&(b[n]), + j,i,p); + Memset(&(r[n2+tn*2]),0, + sizeof(BN_ULONG)*(n2-tn*2)); + } + else /* (j < 0) eg, n == 16, i == 8 and tn == 5 */ + { + Memset(&(r[n2]),0,sizeof(BN_ULONG)*n2); + if (tn < BN_MUL_RECURSIVE_SIZE_NORMAL) + { + bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn); + } + else + { + for (;;) + { + i/=2; + if (i < tn) + { + bn_mul_part_recursive(&(r[n2]), + &(a[n]),&(b[n]), + tn-i,i,p); + break; + } + else if (i == tn) + { + bn_mul_recursive(&(r[n2]), + &(a[n]),&(b[n]), + i,p); + break; + } + } + } + } + } + + /* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign + * r[10] holds (a[0]*b[0]) + * r[32] holds (b[1]*b[1]) + */ + + c1=(int)bn_add_words(t,r,&(r[n2]),n2); + c1-=(int)bn_sub_words(&(t[n2]),t,&(t[n2]),n2); + + /* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1]) + * r[10] holds (a[0]*b[0]) + * r[32] holds (b[1]*b[1]) + * c1 holds the carry bits + */ + c1+=(int)bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2); + if (c1) + { + p= &(r[n+n2]); + lo= *p; + ln=(lo+c1)&BN_MASK2; + *p=ln; + + /* The overflow will stop before we over write + * words we should not overwrite */ + if (ln < (BN_ULONG)c1) + { + do { + p++; + lo= *p; + ln=(lo+1)&BN_MASK2; + *p=ln; + } while (ln == 0); + } + } + } +#endif +#endif + +#if 0 +#ifdef SPLIT_BN_MUL_LOW_RECURSIVE +/* a and b must be the same size, which is n2. + * r must be n2 words and t must be n2*2 + */ +void bn_mul_low_recursive(r,a,b,n2,t) +BN_ULONG *r,*a,*b; +int n2; +BN_ULONG *t; + { + int n=n2/2; + +#ifdef BN_COUNT +printf(" bn_mul_low_recursive %d * %d\n",n2,n2); +#endif + + bn_mul_recursive(r,a,b,n,&(t[0])); + if (n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL) + { + bn_mul_low_recursive(&(t[0]),&(a[0]),&(b[n]),n,&(t[n2])); + bn_add_words(&(r[n]),&(r[n]),&(t[0]),n); + bn_mul_low_recursive(&(t[0]),&(a[n]),&(b[0]),n,&(t[n2])); + bn_add_words(&(r[n]),&(r[n]),&(t[0]),n); + } + else + { + bn_mul_low_normal(&(t[0]),&(a[0]),&(b[n]),n); + bn_mul_low_normal(&(t[n]),&(a[n]),&(b[0]),n); + bn_add_words(&(r[n]),&(r[n]),&(t[0]),n); + bn_add_words(&(r[n]),&(r[n]),&(t[n]),n); + } + } +#endif +#endif + +#ifdef SPLIT_BN_MUL_HIGH +#if 0 +/* a and b must be the same size, which is n2. + * r must be n2 words and t must be n2*2 + * l is the low words of the output. + * t must be n2*3 + */ +void bn_mul_high(r,a,b,l,n2,t) +BN_ULONG *r,*a,*b,*l; +int n2; +BN_ULONG *t; + { + int i,n; + int c1,c2; + int neg,oneg,zero; + BN_ULONG ll,lc,*lp,*mp; + +#ifdef BN_COUNT +printf(" bn_mul_high %d * %d\n",n2,n2); +#endif + n=n2/2; + + /* Calculate (al-ah)*(bh-bl) */ + neg=zero=0; + c1=bn_cmp_words(&(a[0]),&(a[n]),n); + c2=bn_cmp_words(&(b[n]),&(b[0]),n); + switch (c1*3+c2) + { + case -4: + bn_sub_words(&(r[0]),&(a[n]),&(a[0]),n); + bn_sub_words(&(r[n]),&(b[0]),&(b[n]),n); + break; + case -3: + zero=1; + break; + case -2: + bn_sub_words(&(r[0]),&(a[n]),&(a[0]),n); + bn_sub_words(&(r[n]),&(b[n]),&(b[0]),n); + neg=1; + break; + case -1: + case 0: + case 1: + zero=1; + break; + case 2: + bn_sub_words(&(r[0]),&(a[0]),&(a[n]),n); + bn_sub_words(&(r[n]),&(b[0]),&(b[n]),n); + neg=1; + break; + case 3: + zero=1; + break; + case 4: + bn_sub_words(&(r[0]),&(a[0]),&(a[n]),n); + bn_sub_words(&(r[n]),&(b[n]),&(b[0]),n); + break; + } + + oneg=neg; + /* t[10] = (a[0]-a[1])*(b[1]-b[0]) */ + /* r[10] = (a[1]*b[1]) */ +#ifdef BN_MUL_COMBA + if (n == 8) + { + bn_mul_comba8(&(t[0]),&(r[0]),&(r[n])); + bn_mul_comba8(r,&(a[n]),&(b[n])); + } + else +#endif + { +#ifdef BN_MUL_RECURSION + bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,&(t[n2])); + bn_mul_recursive(r,&(a[n]),&(b[n]),n,&(t[n2])); +#else + bn_mul_normal(&(t[0]),&(r[0]),n,&(r[n]),n); + bn_mul_normal(r,&(a[n]),n,&(b[n]),n); +#endif + } + + /* s0 == low(al*bl) + * s1 == low(ah*bh)+low((al-ah)*(bh-bl))+low(al*bl)+high(al*bl) + * We know s0 and s1 so the only unknown is high(al*bl) + * high(al*bl) == s1 - low(ah*bh+s0+(al-ah)*(bh-bl)) + * high(al*bl) == s1 - (r[0]+l[0]+t[0]) + */ + if (l != NULL) + { + lp= &(t[n2+n]); + c1=(int)bn_add_words(lp,&(r[0]),&(l[0]),n); + } + else + { + c1=0; + lp= &(r[0]); + } + + if (neg) + neg=(int)bn_sub_words(&(t[n2]),lp,&(t[0]),n); + else + { + bn_add_words(&(t[n2]),lp,&(t[0]),n); + neg=0; + } + + if (l != NULL) + { + bn_sub_words(&(t[n2+n]),&(l[n]),&(t[n2]),n); + } + else + { + lp= &(t[n2+n]); + mp= &(t[n2]); + for (i=0; i 0) + { + lc=c1; + do { + ll=(r[i]+lc)&BN_MASK2; + r[i++]=ll; + lc=(lc > ll); + } while (lc); + } + else + { + lc= -c1; + do { + ll=r[i]; + r[i++]=(ll-lc)&BN_MASK2; + lc=(lc > ll); + } while (lc); + } + } + if (c2 != 0) /* Add starting at r[1] */ + { + i=n; + if (c2 > 0) + { + lc=c2; + do { + ll=(r[i]+lc)&BN_MASK2; + r[i++]=ll; + lc=(lc > ll); + } while (lc); + } + else + { + lc= -c2; + do { + ll=r[i]; + r[i++]=(ll-lc)&BN_MASK2; + lc=(lc > ll); + } while (lc); + } + } + } +#endif +#endif +#endif + +#ifdef SPLIT_BN_MUL +int BN_mul(r,a,b,ctx) +BIGNUM *r,*a,*b; +BN_CTX *ctx; + { + int top,al,bl,neg; + BIGNUM *rr; +#ifdef BN_RECURSION_MUL + BIGNUM *t; + int i,j,k,l; +#endif + +#ifdef BN_COUNT +printf("BN_mul %d * %d\n",a->top,b->top); +#endif + + bn_check_top(a); + bn_check_top(b); + bn_check_top(r); + + al=a->top; + bl=b->top; + + if ((al == 0) || (bl == 0)) + { + (void)BN_zero(r); + return(1); + } + top=al+bl; + neg=a->neg^b->neg; + + if ((r == a) || (r == b)) + rr= &(ctx->bn[ctx->tos+1]); + else + rr=r; + + if (bn_wexpand(rr,top) == NULL) return(0); + rr->top=top; + +#if defined(BN_MUL_COMBA) || defined(BN_RECURSION_MUL) + if (al == bl) + { +# ifdef BN_MUL_COMBA +/* if (al == 4) + { + bn_mul_comba4(rr->d,a->d,b->d); + goto end; + } + else */ if (al == 8) + { + bn_mul_comba8(rr->d,a->d,b->d); + goto end; + } + else +# endif +#ifdef BN_RECURSION_MUL + if (al < BN_MULL_SIZE_NORMAL) +#endif + { + bn_mul_normal(rr->d,a->d,al,b->d,bl); + goto end; + } +# ifdef BN_RECURSION_MUL + goto symetric; +# endif + } +#endif +#ifdef BN_RECURSION_MUL + else if ((al < BN_MULL_SIZE_NORMAL) || (bl < BN_MULL_SIZE_NORMAL)) + { + bn_mul_normal(rr->d,a->d,al,b->d,bl); + goto end; + } + else + { + i=(al-bl); + if ((i == 1) && !BN_get_flags(b,BN_FLG_STATIC_DATA)) + { + bn_wexpand(b,al); + b->d[bl]=0; + bl++; + goto symetric; + } + else if ((i == -1) && !BN_get_flags(a,BN_FLG_STATIC_DATA)) + { + bn_wexpand(a,bl); + a->d[al]=0; + al++; + goto symetric; + } + } +#endif + +#ifdef BN_RECURSION_MUL +normal_mul: +#endif + bn_mul_normal(rr->d,a->d,al,b->d,bl); + +#ifdef BN_RECURSION_MUL + if (0) + { +symetric: + /* symetric and > 4 */ + /* 16 or larger */ + l=BN_num_bits_word((BN_ULONG)al); + j=1<<(l-1); + k=j+j; + t= &(ctx->bn[ctx->tos]); + if (al == j) /* exact multiple */ + { + BN_REC rec; + rec.depth=l-5; + rec.n=j; + rec.mul=bn_mul_comba8; + rec.sqr=bn_sqr_comba8; + if (bn_wexpand(t,k+k) == NULL) + return(0); + if (bn_wexpand(rr,k) == NULL) + return(0); + bn_mul_rec_words(rr->d,a->d,b->d,t->d,&rec); + } + else + goto normal_mul; +#if 0 + { + bn_zexpand(a,k); + bn_zexpand(b,k); + bn_wexpand(t,k); + bn_wexpand(rr,k); + bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d); + } +#endif + } +#endif +#if defined(BN_MUL_COMBA) || defined(BN_RECURSION_MUL) +end: +#endif + + r->neg=neg; + bn_fix_top(rr); + if (r != rr) (void)BN_copy(r,rr); + return(1); + } +#endif + + +#ifdef SPLIT_BN_MUL_NORMAL +void bn_mul_normal(r,a,na,b,nb) +BN_ULONG *r,*a; +int na; +BN_ULONG *b; +int nb; + { + BN_ULONG *rr; + +#ifdef BN_COUNT +printf(" bn_mul_normal %d * %d\n",na,nb); +#endif + /* asymetric and >= 4 */ +#if 0 + if ((na == nb) && (na == 8)) + { + bn_mul_normal(r,a,na,b,nb); + return; + } +#endif + + if (na < nb) + { + int itmp; + BN_ULONG *ltmp; + + itmp=na; na=nb; nb=itmp; + ltmp=a; a=b; b=ltmp; + + } + rr= &(r[na]); + rr[0]=bn_mul_words(r,a,na,b[0]); + + for (;;) + { + if (--nb <= 0) return; + rr[1]=bn_mul_add_words(&(r[1]),a,na,b[1]); + if (--nb <= 0) return; + rr[2]=bn_mul_add_words(&(r[2]),a,na,b[2]); + if (--nb <= 0) return; + rr[3]=bn_mul_add_words(&(r[3]),a,na,b[3]); + if (--nb <= 0) return; + rr[4]=bn_mul_add_words(&(r[4]),a,na,b[4]); + rr+=4; + r+=4; + b+=4; + } + } +#endif + +#ifdef SPLIT_BN_MUL_LOW_NORMAL +void bn_mul_low_normal(r,a,b,n) +BN_ULONG *r,*a,*b; +int n; + { +#ifdef BN_COUNT +printf(" bn_mul_low_normal %d * %d\n",n,n); +#endif + (void)bn_mul_words(r,a,n,b[0]); + + for (;;) + { + if (--n <= 0) return; + (void)bn_mul_add_words(&(r[1]),a,n,b[1]); + if (--n <= 0) return; + (void)bn_mul_add_words(&(r[2]),a,n,b[2]); + if (--n <= 0) return; + (void)bn_mul_add_words(&(r[3]),a,n,b[3]); + if (--n <= 0) return; + (void)bn_mul_add_words(&(r[4]),a,n,b[4]); + r+=4; + b+=4; + } + } +#endif +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_r_exp.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_r_exp.c new file mode 100644 index 00000000..ef056efd --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_r_exp.c @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +/* #ifdef RECP_MUL_MOD */ +int BN_mod_exp_recp(r,a,p,m,ctx) +BIGNUM *r; +BIGNUM *a; +BIGNUM *p; +BIGNUM *m; +BN_CTX *ctx; + { + int i,j,bits,ret=0,wstart,wend,window,wvalue; + int start=1,ts=0; + BIGNUM *aa; + BIGNUM val[BN_EXP_TABLE_SIZE]; + BN_RECP_CTX recp; + + bits=BN_num_bits(p); + + if (BN_is_zero(a)) + { (void)BN_zero(r); return(1); } + if (BN_is_zero(p)) + { (void)BN_one(r); return(1); } + if (BN_is_one(p)) + { (void)BN_copy(r,a); return(1); } + + BN_RECP_CTX_init(&recp); + if (BN_RECP_CTX_set(&recp,m,ctx) <= 0) goto err; + + BN_init(&(val[0])); + ts=1; + + aa= &(ctx->bn[ctx->tos++]); + + if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ + if (!BN_mod_mul_reciprocal(aa,&(val[0]),&(val[0]),&recp,ctx)) + goto err; /* 2 */ + + if (bits <= 17) /* This is probably 3 or 0x10001, so just do singles */ + window=1; + else if (bits >= 256) + window=5; /* max size of window */ + else if (bits >= 128) + window=4; + else + window=3; + + j=1<<(window-1); + for (i=1; i>1]),&recp,ctx)) + goto err; + + /* move the 'window' down further */ + wstart-=wend+1; + wvalue=0; + start=0; + if (wstart < 0) break; + } + ret=1; +err: + ctx->tos--; + for (i=0; in; + int n2=n/2; + int neg=0; + BN_ULONG c1; + + + if (rec->depth == 0) + { + /* t needs to have space for 4*n words + * The multiply needs to be a n2*n2 -> n + */ +#ifndef NOPROTO + void (PRE_CCONV CCONV *rmul)(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); +#else + void (PRE_CCONV CCONV *rmul)(); +#endif + rmul=rec->mul; + +#ifdef _EXTRA_ARG_ + /* THIS IS WRONG - there is no extra int arg on the end */ + rmul(&(r[0]),&(a[0]),&(b[0]),n2); + rmul(&(r[n]),&(a[n2]),&(b[n2]),n2); +#else + rmul(&(r[0]),&(a[0]),&(b[0])); + rmul(&(r[n]),&(a[n2]),&(b[n2])); +#endif + + if (bn_sub_words(&(tt[n+0]), &(a[0]),&(a[n2]),n2)) + { + bn_2s_comp(&(tt[n+ 0]),&(tt[n+ 0]),n2); + neg=1; + } + else + neg=0; + if (bn_sub_words(&(tt[n+n2]),&(b[n2]),&(b[0]),n2)) + { + neg^=1; + bn_2s_comp(&(tt[n+n2]),&(tt[n+n2]),n2); + } + +#ifdef _EXTRA_ARG_ + rmul(&(tt[0]),&(tt[n+0]),&(tt[n+n2]),n2); +#else + rmul(&(tt[0]),&(tt[n+0]),&(tt[n+n2])); +#endif + } + else /* Leaf node */ + { + /* t has 4*n words taken per call. + * Since n is half the size per call, we need + * 6*n words for our current level and all sub levels + * The multiply needs to be a n2*n2 -> n + */ + rec->depth--; + rec->n=n2; + bn_mul_rec_words(&(r[0]), &(a[0]), &(b[0]), &(tt[n+n]),rec); + bn_mul_rec_words(&(r[n]), &(a[n2]),&(b[n2]), &(tt[n+n]),rec); + + neg=0; + if (bn_sub_words(&(tt[n+0]), &(a[0]),&(a[n2]),n2)) + { + bn_2s_comp(&(tt[n+ 0]),&(tt[n+ 0]),n2); + neg=1; + } + else + neg=0; + if (bn_sub_words(&(tt[n+n2]),&(b[n2]),&(b[0]),n2)) + { + neg^=1; + bn_2s_comp(&(tt[n+n2]),&(tt[n+n2]),n2); + } + + bn_mul_rec_words(&(tt[0]),&(tt[n]),&(tt[n+n2]),&(tt[n+n]),rec); + rec->n=n; + rec->depth++; + } + + c1=bn_add_words(&(tt[n]),&(r[0]),&(r[n]),n); + + if (neg) + c1-=bn_sub_words(&(tt[0]),&(tt[n]),&(tt[0]),n); + else + c1+=bn_add_words(&(tt[0]),&(tt[n]),&(tt[0]),n); + tt[n]=c1; + c1=bn_add_words(&(r[n2]),&(r[n2]),&(tt[0]),n+1); + if (c1) + { + tt= &(r[n+n2+1]); + do { + } while (++(*(tt++)) == 0); + } + } +#endif + +#ifdef SPLIT_BN_SQR_REC_WORDS +/* tt needs to be 3*n words */ +void bn_sqr_rec_words(r,a,tt,rec) +BN_ULONG *r,*a,*tt; +BN_REC *rec; + { + int n=rec->n; + int n2=n/2; + BN_ULONG c1; + + if (rec->depth == 0) + { + /* t needs to have space for 4*n words + * The multiply needs to be a n2*n2 -> n + */ +#ifndef NOPROTO + void (PRE_CCONV CCONV *rsqr)(BN_ULONG *r, BN_ULONG *a); +#else + void (PRE_CCONV CCONV *rsqr)(); +#endif + + rsqr=rec->sqr; + +#ifdef _EXTRA_ARG_ + /* THIS IS WRONG - there is no extra int arg on the end */ + rsqr(&(r[0]), &(a[0]), n2); + rsqr(&(r[n]), &(a[n2]),n2); +#else + rsqr(&(r[0]), &(a[0])); + rsqr(&(r[n]), &(a[n2])); +#endif + + if (bn_sub_words(&(tt[n+0]), &(a[0]),&(a[n2]),n2)) + bn_2s_comp(&(tt[n+0]),&tt[n+0], n2); + +#ifdef _EXTRA_ARG_ + rsqr(&(tt[0]),&(tt[n]), n2); +#else + rsqr(&(tt[0]),&(tt[n])); +#endif + + } + else /* Leaf node */ + { + /* t has 4*n words taken per call. + * Since n is half the size per call, we need + * 6*n words for our current level and all sub levels + * The multiply needs to be a n2*n2 -> n + */ + rec->depth--; + rec->n=n2; + bn_sqr_rec_words(&(r[0]), &(a[0]), &(tt[n+n]),rec); + bn_sqr_rec_words(&(r[n]), &(a[n2]),&(tt[n+n]),rec); + + if (bn_sub_words(&(tt[n+0]), &(a[0]),&(a[n2]),n2)) + bn_2s_comp(&(tt[n+0]),&tt[n+0], n2); + bn_sqr_rec_words(&(tt[0]),&(tt[n]),&(tt[n+n]),rec); + + rec->n=n; + rec->depth++; + } + + c1=bn_add_words(&(tt[n]),&(r[0]),&(r[n]),n); + c1-=bn_sub_words(&(tt[0]),&(tt[n]),&(tt[0]),n); + + tt[n]=c1; + c1=bn_add_words(&(r[n2]),&(r[n2]),&(tt[0]),n+1); + if (c1) + { + tt= &(r[n+n2+1]); + do { + } while (++(*(tt++)) == 0); + } + } +#endif + +#endif /* !NO_SPLIT || !SPLIT_FILE */ diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_recp.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_recp.c new file mode 100644 index 00000000..6830f59d --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_recp.c @@ -0,0 +1,218 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +void BN_RECP_CTX_init(recp) +BN_RECP_CTX *recp; + { + BN_init(&(recp->N)); + BN_init(&(recp->Nr)); + recp->num_bits=0; + recp->flags=0; + } + +BN_RECP_CTX *BN_RECP_CTX_new() + { + BN_RECP_CTX *ret; + + if ((ret=(BN_RECP_CTX *)Malloc(sizeof(BN_RECP_CTX))) == NULL) + return(NULL); + + BN_RECP_CTX_init(ret); + ret->flags=BN_FLG_MALLOCED; + return(ret); + } + +void BN_RECP_CTX_free(recp) +BN_RECP_CTX *recp; + { + BN_free(&(recp->N)); + BN_free(&(recp->Nr)); + if (recp->flags & BN_FLG_MALLOCED) + Free(recp); + } + +int BN_RECP_CTX_set(recp,d,ctx) +BN_RECP_CTX *recp; +BIGNUM *d; +BN_CTX *ctx; + { + (void)BN_copy(&(recp->N),d); + (void)BN_zero(&(recp->Nr)); + recp->num_bits=BN_num_bits(d); + recp->shift=0; + ctx=ctx; /* Stop warning */ + return(1); + } + +int BN_mod_mul_reciprocal(r, x, y, recp, ctx) +BIGNUM *r; +BIGNUM *x; +BIGNUM *y; +BN_RECP_CTX *recp; +BN_CTX *ctx; + { + int ret=0; + BIGNUM *a; + + bn_check_top(x); + bn_check_top(y); + + a= &(ctx->bn[ctx->tos++]); + if (y != NULL) + { + if (x == y) + { if (!BN_sqr(a,x,ctx)) goto err; } + else + { if (!BN_mul(a,x,y,ctx)) goto err; } + } + else + a=x; /* Just do the mod */ + + (void)BN_div_recp(NULL,r,a,recp,ctx); + ret=1; +err: + ctx->tos--; + return(ret); + } + +int BN_div_recp(dv,rem,m,recp,ctx) +BIGNUM *dv; +BIGNUM *rem; +BIGNUM *m; +BN_RECP_CTX *recp; +BN_CTX *ctx; + { + int i,j,tos,ret=0,ex; + BIGNUM *a,*b,*d,*r; + + bn_check_top(m); + + tos=ctx->tos; + a= &(ctx->bn[ctx->tos++]); + b= &(ctx->bn[ctx->tos++]); + if (dv != NULL) + d=dv; + else + d= &(ctx->bn[ctx->tos++]); + if (rem != NULL) + r=rem; + else + r= &(ctx->bn[ctx->tos++]); + + if (BN_ucmp(m,&(recp->N)) < 0) + { + (void)BN_zero(d); + (void)BN_copy(r,m); + ctx->tos=tos; + return(1); + } + + /* We want the remainder + * Given input of ABCDEF / ab + * we need multiply ABCDEF by 3 digests of the reciprocal of ab + * + */ + i=BN_num_bits(m); + + j=recp->num_bits*2; + if (j > i) + { + i=j; + ex=0; + } + else + { + ex=(i-j)/2; + } + + j=i/2; + + if (i != recp->shift) + recp->shift=BN_reciprocal(&(recp->Nr),&(recp->N), + i,ctx); + + if (!BN_rshift(a,m,j-ex)) goto err; + if (!BN_mul(b,a,&(recp->Nr),ctx)) goto err; + if (!BN_rshift(d,b,j+ex)) goto err; + d->neg=0; + if (!BN_mul(b,&(recp->N),d,ctx)) goto err; + if (!BN_usub(r,m,b)) goto err; + r->neg=0; + + j=0; +#if 1 + while (BN_ucmp(r,&(recp->N)) >= 0) + { + if (j++ > 2) + { +#ifndef NO_ERR + BNerr(BN_F_BN_DIV_RECP,BN_R_BAD_RECIPROCAL); +#endif + goto err; + } + if (!BN_usub(r,r,&(recp->N))) goto err; + if (!BN_add_word(d,1)) goto err; + } +#endif + + r->neg=BN_is_zero(r)?0:m->neg; + d->neg=m->neg^recp->N.neg; + ret=1; +err: + ctx->tos=tos; + return(ret); + } + +/* len is the expected size of the result + * We actually calculate with an extra word of precision, so + * we can do faster division if the remainder is not required. + */ +int BN_reciprocal(r,m,len,ctx) +BIGNUM *r; +BIGNUM *m; +int len; +BN_CTX *ctx; + { + int ret= -1; + BIGNUM t; + + bn_check_top(m); + + BN_init(&t); + + (void)BN_zero(&t); + if (!BN_set_bit(&t,len)) goto err; + + if (!BN_div(r,NULL,&t,m,ctx)) goto err; + ret=len; +err: + BN_free(&t); + return(ret); + } + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_rsh.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_rsh.c new file mode 100644 index 00000000..0f0d5c60 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_rsh.c @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_RSHIFT1 +#define SPLIT_BN_RSHIFT +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BN_RSHIFT1 +#ifdef SMALL_CODE_SIZE +int BN_rshift1(r, a) +BIGNUM *r; +BIGNUM *a; + { + return(BN_rshift(r,a,1)); + } + +#else + +int BN_rshift1(r, a) +BIGNUM *r; +BIGNUM *a; + { + BN_ULONG *ap,*rp,t,c; + int i; + + bn_check_top(a); + + if (BN_is_zero(a)) + { + BN_zero(r); + return(1); + } + if (a != r) + { + if (bn_wexpand(r,a->top) == NULL) return(0); + r->top=a->top; + r->neg=a->neg; + } + ap=a->d; + rp=r->d; + c=0; + for (i=a->top-1; i>=0; i--) + { + t=ap[i]; + rp[i]=((t>>1)&BN_MASK2)|c; + c=(t&1)?BN_TBIT:0; + } + bn_fix_top(r); + return(1); + } +#endif +#endif + +#ifdef SPLIT_BN_RSHIFT +int BN_rshift(r, a, n) +BIGNUM *r; +BIGNUM *a; +int n; + { + int i,j,nw,lb,rb; + BN_ULONG *t,*f; + BN_ULONG l,tmp; + + bn_check_top(a); + +#ifndef SMALL_CODE_SIZE + if (n == 1) return(BN_rshift1(r,a)); +#endif + nw=n/BN_BITS2; + rb=n%BN_BITS2; + lb=BN_BITS2-rb; + if (nw > a->top) + { + (void)BN_zero(r); + return(1); + } + if (r != a) + { + if (bn_wexpand(r,a->top-nw+1+1/*???*/) == NULL) return(0); + r->neg=a->neg; + } + + f= &(a->d[nw]); + t=r->d; + j=a->top-nw; + r->top=j; + + if (rb == 0) + { + for (i=j+1; i > 0; i--) + *(t++)= *(f++); + } + else + { + l= *(f++); + for (i=1; i>rb)&BN_MASK2; + l= *(f++); + *(t++) =(tmp|(l<>rb)&BN_MASK2; + *t=0; + } + bn_fix_top(r); + return(1); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_sqr.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_sqr.c new file mode 100644 index 00000000..24b5c4cb --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_sqr.c @@ -0,0 +1,289 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#ifdef SMALL_CODE_SIZE +#undef BN_RECURSION_SQR +#endif + +#if !(defined(NO_SPLIT) && defined(SPLIT_FILE)) + +#ifdef NO_SPLIT +#define SPLIT_BN_SQR +#define SPLIT_BN_SQR_NORMAL +#define SPLIT_BN_RECURSION_SQR +#endif /* NO_SPLIT */ + +#ifdef SPLIT_BN_SQR +/* r must not be a */ +int BN_sqr(r, a, ctx) +BIGNUM *r; +BIGNUM *a; +BN_CTX *ctx; + { + int max,al; + BIGNUM *tmp,*rr; + +#ifdef BN_COUNT +printf("BN_sqr %d * %d\n",a->top,a->top); +#endif + bn_check_top(a); + tmp= &(ctx->bn[ctx->tos]); + rr=(a != r)?r: (&ctx->bn[ctx->tos+1]); + + al=a->top; + if (al <= 0) + { + r->top=0; + return(1); + } + + max=(al+al); + if (bn_wexpand(rr,max) == NULL) return(0); + + rr->top=max; + rr->neg=0; + + if (al == 4) + { +#ifndef BN_SQR_COMBA + BN_ULONG t[8]; + bn_sqr_normal(rr->d,a->d,4,t); +#else + bn_sqr_comba4(rr->d,a->d); +#endif + } + else if (al == 8) + { +#ifndef BN_SQR_COMBA + BN_ULONG t[16]; + bn_sqr_normal(rr->d,a->d,8,t); +#else + bn_sqr_comba8(rr->d,a->d); +#endif + } + else + { +#if 1 && defined(BN_RECURSION_SQR) + if (al < BN_SQR_RECURSIVE_SIZE_NORMAL) + { + BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL*2]; + bn_sqr_normal(rr->d,a->d,al,t); + } + else + { + int j,l,k; + + l=BN_num_bits_word((BN_ULONG)al); + j=1<<(l-1); + k=j+j; + if ((al == j) && !BN_get_flags(a,BN_FLG_STATIC_DATA)) + { + BN_REC rec; + if (bn_wexpand(tmp,k*2) == NULL) return(0); + rec.depth=l-5; + rec.n=j; + rec.mul=bn_mul_comba8; + rec.sqr=bn_sqr_comba8; + + bn_sqr_rec_words(rr->d,a->d,tmp->d,&rec); + } + else + { + if (bn_wexpand(tmp,max) == NULL) return(0); + bn_assert(al*2 <= max); + bn_sqr_normal(rr->d,a->d,al,tmp->d); + } + } +#else + if (bn_wexpand(tmp,max) == NULL) return(0); + bn_assert(al*2 <= max); + bn_sqr_normal(rr->d,a->d,al,tmp->d); +#endif +#ifdef BN_DEBUG + tmp->top=0; +#endif + } + + if ((max > 0) && (rr->d[max-1] == 0)) rr->top--; + if (rr != r) (void)BN_copy(r,rr); + return(1); + } +#endif + +#ifdef SPLIT_BN_SQR_NORMAL +/* tmp must have 2*n words */ +void bn_sqr_normal(r, a, n, tmp) +BN_ULONG *r; +BN_ULONG *a; +int n; +BN_ULONG *tmp; + { + int i,j,max; + BN_ULONG *ap,*rp,m; + + max=n*2; + ap=a; + rp=r; + rp[0]=rp[max-1]=0; + rp++; + j=n; + + if (--j > 0) + { + m= (*ap++); + rp[j]=bn_mul_words(rp,ap,j,m); + rp+=2; + } + + for (i=n-2; i>0; i--) + { + j--; + m= *(ap++); + rp[j]=bn_mul_add_words(rp,ap,j,m); + rp+=2; + } + + (void)bn_add_words(r,r,r,max); + + /* There will not be a carry */ + + bn_sqr_words(tmp,a,n); + + (void)bn_add_words(r,r,tmp,max); + } +#endif + +#if 0 /* replaced by bn_sqr_rec_words() AND this has bugs */ +#ifdef SPLIT_BN_RECURSION_SQR +#ifdef BN_RECURSION_SQR +/* r is 2*n words in size, + * a and b are both n words in size. + * n must be a power of 2. + * We multiply and return the result. + * t must be 2*n words in size + * We calulate + * a[0]*b[0] + * a[0]*b[0]+a[1]*b[1]+(a[0]-a[1])*(b[1]-b[0]) + * a[1]*b[1] + */ +void bn_sqr_recursive(r,a,n2,t) +BN_ULONG *r,*a; +int n2; +BN_ULONG *t; + { + int n=n2/2; + int zero,c1; + BN_ULONG ln,lo,*p; + +#ifdef BN_COUNT +printf(" bn_sqr_recursive %d * %d\n",n2,n2); +#endif + if (n2 == 4) + { +#ifndef BN_SQR_COMBA + bn_sqr_normal(r,a,4,t); +#else + bn_sqr_comba4(r,a); +#endif + return; + } + else if (n2 == 8) + { +#ifndef BN_SQR_COMBA + bn_sqr_normal(r,a,8,t); +#else + bn_sqr_comba8(r,a); +#endif + return; + } + if (n2 < BN_SQR_RECURSIVE_SIZE_NORMAL) + { + bn_sqr_normal(r,a,n2,t); + return; + } + /* r=(a[0]-a[1])*(a[1]-a[0]) */ + c1=bn_cmp_words(a,&(a[n]),n); + zero=0; + if (c1 > 0) + bn_sub_words(t,a,&(a[n]),n); + else if (c1 < 0) + bn_sub_words(t,&(a[n]),a,n); + else + zero=1; + + /* The result will always be negative unless it is zero */ + p= &(t[n2*2]); + + if (!zero) + bn_sqr_recursive(&(t[n2]),t,n,p); + else + Memset(&(t[n2]),0,n*sizeof(BN_ULONG)); + bn_sqr_recursive(r,a,n,p); + bn_sqr_recursive(&(r[n2]),&(a[n]),n,p); + + /* t[32] holds (a[0]-a[1])*(a[1]-a[0]), it is negative or zero + * r[10] holds (a[0]*b[0]) + * r[32] holds (b[1]*b[1]) + */ + + c1=(int)(bn_add_words(t,r,&(r[n2]),n2)); + + /* t[32] is negative */ + c1-=(int)(bn_sub_words(&(t[n2]),t,&(t[n2]),n2)); + + /* t[32] holds (a[0]-a[1])*(a[1]-a[0])+(a[0]*a[0])+(a[1]*a[1]) + * r[10] holds (a[0]*a[0]) + * r[32] holds (a[1]*a[1]) + * c1 holds the carry bits + */ + c1+=(int)(bn_add_words(&(r[n]),&(r[n]),&(t[n2]),n2)); + if (c1) + { + p= &(r[n+n2]); + lo= *p; + ln=(lo+c1)&BN_MASK2; + *p=ln; + + /* The overflow will stop before we over write + * words we should not overwrite */ + if (ln < (BN_ULONG)c1) + { + do { + p++; + lo= *p; + ln=(lo+1)&BN_MASK2; + *p=ln; + } while (ln == 0); + } + } + } +#endif +#endif +#endif +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/bn_wdiv.c b/build/libraries_sysmenu/acsign/ARM9/src/bn_wdiv.c new file mode 100644 index 00000000..97c21860 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/bn_wdiv.c @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +#include "bn_lcl.h" + +#ifndef OPT_BN_ASM + +#ifndef BN_DIV_WORDS +#define BN_DIV_WORDS +#endif + +#endif + +#ifdef BN_DIV_WORDS +#if defined(BN_LLONG) +BN_ULONG bn_div_words(h,l,d) +BN_ULONG h,l,d; + { + return((BN_ULONG)(((((BN_ULLONG)h)< ((BN_ULONG)1)<= d) h-=d; + + if (i) + { + d=(d<>(BN_BITS2-i)))&BN_MASK2; + l=(l<>BN_BITS4)&BN_MASK2lh; + dl=(d&BN_MASK2l); + for (;;) + { + if ((h>>BN_BITS4) == dh) + q=BN_MASK2l; + else + q=h/dh; + + for (;;) + { + t=(h-q*dh)&BN_MASK2; + if ((t&BN_MASK2h) || + (((dl*q)&BN_MASK2) <= (( + (t<>BN_BITS4)&BN_MASK2lh))&BN_MASK2))) + break; + q--; + } + th=(q*dh)&BN_MASK2; + tl=(q*dl)&BN_MASK2; + t=(tl>>BN_BITS4); + tl=(tl&BN_MASK2lh)<>BN_BITS4))&BN_MASK2; + l=(l&BN_MASK2l)<top-1; i>=0; i--) + { +#ifndef BN_LLONG + ret=((ret<d[i]>>BN_BITS4)&BN_MASK2l))%w; + ret=((ret<d[i]&BN_MASK2l))%w; +#else + ret=(BN_ULLONG)(((ret<<(BN_ULLONG)BN_BITS2)|a->d[i])% + (BN_ULLONG)w); +#endif + } + return((BN_ULONG)ret); + } +#endif + +#ifdef SPLIT_BN_DIV_WORD +BN_ULONG BN_div_word(a, w) +BIGNUM *a; +BN_ULONG w; + { + BN_ULONG ret; + int i; + + if (a->top == 0) return(0); + ret=0; + w=w&BN_MASK2;//w&=BN_MASK2; + for (i=a->top-1; i>=0; i--) + { + BN_ULONG l,d; + + l=a->d[i]; + d=bn_div_words(ret,l,w); + ret=(l-((d*w)&BN_MASK2))&BN_MASK2; + a->d[i]=d; + } + if ((a->top > 0) && (a->d[a->top-1] == 0)) + a->top--; + return(ret); + } +#endif + +#ifdef SPLIT_BN_ADD_WORD +int BN_add_word(a, w) +BIGNUM *a; +BN_ULONG w; + { + BN_ULONG l; + int i; + + if (w == 0) return(1); + bn_check_top(a); + + w=w&BN_MASK2;//w&=BN_MASK2; + if (a->neg) + { + if(a->top > 1) + { + a->neg=0; + i=BN_sub_word(a,w); + a->neg=1; + return(i); + } + else + { /* a->top == 1, it cannot be 0 */ + l=a->d[0]; + if (l > w) + a->d[0]=l-w; + else if (l < w) + { + a->neg=0; + a->d[0]=w-l; + } + else + { + a->neg=0; + a->top=0; + } + return(1); + } + } + w=w&BN_MASK2;//w&=BN_MASK2; + if (bn_wexpand(a,a->top+1) == NULL) return(0); + a->d[a->top]=0; + i=0; + for (;;) + { + l=(a->d[i]+(BN_ULONG)w)&BN_MASK2; + a->d[i]=l; + if (w > l) + w=1; + else + break; + i++; + } + if (i >= a->top) + a->top++; + return(1); + } +#endif + +#ifdef SPLIT_BN_SUB_WORD +int BN_sub_word(a, w) +BIGNUM *a; +BN_ULONG w; + { + int i; + + bn_check_top(a); + if (w == 0) return(1); + + w=w&BN_MASK2;//w&=BN_MASK2; + if (a->neg) + { + a->neg=0; + i=BN_add_word(a,w); + a->neg=1; + return(i); + } + + w=w&BN_MASK2;//w&=BN_MASK2; + if (a->top <= 1) + { + BN_ULONG l; + + if (a->top == 0) + { + if (bn_wexpand(a,1) == NULL) return(0); + a->d[0]=w; + a->neg = 1; + a->top = 1; + return(1); + } + l=a->d[0]; + if (l == w) + a->top=0; + else if (l > w) + a->d[0]=l-w; + else + { + a->neg=1; + a->d[0]=w-l; + } + return(1); + } + i=0; + for (;;) + { + if (a->d[i] >= w) + { + a->d[i]-=w; + break; + } + else + { + a->d[i]=(a->d[i]-w)&BN_MASK2; + i++; + w=1; + } + } + if ((a->d[i] == 0) && (i == (a->top-1))) + a->top--; + return(1); + } +#endif + +#ifdef SPLIT_BN_MUL_WORD +int BN_mul_word(a,w) +BIGNUM *a; +BN_ULONG w; + { + BN_ULONG ll; + + w=w&BN_MASK2;//w&=BN_MASK2; + if (a->top) + { + ll=bn_mul_words(a->d,a->d,a->top,w); + if (ll) + { + if (bn_wexpand(a,a->top+1) == NULL) return(0); + a->d[a->top++]=ll; + } + } + return(1); + } +#endif + +#endif diff --git a/build/libraries_sysmenu/acsign/ARM9/src/main.c b/build/libraries_sysmenu/acsign/ARM9/src/main.c new file mode 100644 index 00000000..d0d591b8 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/main.c @@ -0,0 +1,320 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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 "acsign.h" +#include "acmemory.h" + +/*---------------------------------------------------------------------------*/ +unsigned long binarray[ 1024 * 1024 * 2 / sizeof (unsigned long) ]; +unsigned long keyarray[ 1024 / sizeof (unsigned long) ]; +unsigned long sgnarray[ 1024 / sizeof (unsigned long) ]; +unsigned long bufferA[ ACSIGN_BUFFER / sizeof (unsigned long) ]; +unsigned long bufferB[ ACSIGN_BUFFER / sizeof (unsigned long) ]; + + + +/*--------------------------------------------------------------------------*/ +// ROMヘッダ +//---------------------------------------------------------------------- +typedef struct { + // + // 0x000 System Reserved + // + char title_name[12]; // Soft title name + u32 game_code; // Game code + + u16 maker_code; // Maker code + u8 machine_code; // Machine code + u8 rom_type; // Rom type + u8 rom_size; // Rom size + + u8 reserved_A[9]; // System Reserved A ( Set ALL 0 ) + u8 soft_version; // Soft version + + u8 comp_arm9_boot_area:1; // Compress arm9 boot area + u8 comp_arm7_boot_area:1; // Compress arm7 boot area + u8 inspectCard:1; // 検査カードフラグ + u8 disableClearMemoryPad:1; // IPL2メモリパッドクリア・ディセーブルフラグ + u8 :0; + + + // + // 0x020 for Static modules (Section:B) + // + // ARM9 + u32 main_rom_offset; // ROM offset + void* main_entry_address; // Entry point + void* main_ram_address; // RAM address + u32 main_size; // Module size + + // ARM7 + u32 sub_rom_offset; // ROM offset + void* sub_entry_address; // Entry point + void* sub_ram_address; // RAM address + u32 sub_size; // Module size + + // + // 0x040 for File Name Table[FNT] (Section:C) + // + u32 fnt_offset; // ROM offset + u32 fnt_size; // Table size + + // + // 0x048 for File Allocation Table[FAT] (Section:E) + // + u32 fat_offset; // ROM offset + u32 fat_size; // Table size + + // + // 0x050 for Overlay Tables[OVT] (Section:D) + // + // ARM9 + u32 main_ovt_offset; // ROM offset + u32 main_ovt_size; // Table size + + // ARM7 + u32 sub_ovt_offset; // ROM offset + u32 sub_ovt_size; // Table size + + // 0x060 for ROM control parameter + u8 reserved_A2[32]; + + // 0x080 - 0x0C0 System Reserved + u8 reserved_B[64]; // System Reserved B (Set 0) + + // 0x0C0 for NINTENDO logo data + u8 nintendo_logo[0x9c]; // NINTENDO logo data + u16 nintendo_logo_crc16; // CRC-16 + + // 0x15E ROM header CRC-16 + u16 header_crc16; // ROM header CRC-16 +} RomHeader; + + +/* V-blank callback */ +static void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + + + + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitializeAllocateSystem(void) +{ + void* tempLo; + OSHeapHandle hh; + + // OS_Initは呼ばれているという前提 + tempLo = OS_InitAlloc( + OS_ARENA_MAIN , + OS_GetMainArenaLo() , + OS_GetMainArenaHi() , + 1 + ); + OS_SetArenaLo( + OS_ARENA_MAIN , + tempLo + ); + hh = OS_CreateHeap( + OS_ARENA_MAIN , + OS_GetMainArenaLo() , + OS_GetMainArenaHi() + ); + if( hh < 0 ) + { + OS_Panic("ARM9: Fail to create heap...\n"); + } + hh = OS_SetCurrentHeap( + OS_ARENA_MAIN , + hh + ); +} + + +// +static +void TestAC(char* iplfile, char* srlfile, char* sgnfile, FSFile* pfile ) +{ + RomHeader* pHeader; + const char* path; + BOOL fresult; + void* srl_ptr = 0; + long srl_len = 0; + void* key_ptr = 0; + long key_len = 0; + void* sgn_ptr = 0; + long sgn_len = 0; + + + if ( !pfile ) return ; + if ( !iplfile ) return ; + if ( !srlfile ) return ; + if ( !sgnfile ) return ; + + path = iplfile; + if ( (fresult = FS_OpenFile(pfile, path)) ) + { + key_len = FS_ReadFile( pfile, keyarray, sizeof keyarray ); + key_ptr = keyarray; + fresult = FS_CloseFile( pfile ); + } + if ( !fresult ) + OS_Printf("file read error! %s\n", path ); + + path = srlfile; + if ( (fresult = FS_OpenFile(pfile, path)) ) + { + srl_len = FS_ReadFile( pfile, binarray, sizeof binarray ); + srl_ptr = binarray; + fresult = FS_CloseFile( pfile ); + } + if ( !fresult ) + OS_Printf("file read error! %s\n", path ); + + path = sgnfile; //"/data/sgn0.bin"; // sgn + if ( (fresult = FS_OpenFile(pfile, path)) ) + { + sgn_len = FS_ReadFile( pfile, sgnarray, sizeof sgnarray ); + sgn_ptr = sgnarray; + fresult = FS_CloseFile( pfile ); + } + if ( !fresult ) + OS_Printf("file read error! %s\n", path ); + + // 認証 + if ( srl_ptr && srl_len && key_ptr && key_len && sgn_ptr && sgn_len ) + { + long nSerial = 0; + pHeader = (RomHeader*)binarray; + + MI_CpuFill8( bufferA, 0, sizeof bufferA ); + MI_CpuFill8( bufferB, 0, sizeof bufferB ); + #if 0 + HMAC/Digtal Signature + >char seg_id[2]; //->"ac"に固定 + >u16 version; //-> 1に固定 + >u8 auth_code[20]/digital_sign[128] + >long serial_number + >char title_name[12]; // RomHeader.title_name + >u32 game_code; // RomHeader.game_code + >u16 maker_code; // RomHeader.make_code + >u8 machine_code; // RomHeader.machine_code + #endif + ((unsigned char*)&nSerial)[0] = ((unsigned char*)sgn_ptr + 4 + 128)[0]; + ((unsigned char*)&nSerial)[1] = ((unsigned char*)sgn_ptr + 4 + 128)[1]; + ((unsigned char*)&nSerial)[2] = ((unsigned char*)sgn_ptr + 4 + 128)[2]; + ((unsigned char*)&nSerial)[3] = ((unsigned char*)sgn_ptr + 4 + 128)[3]; + + (void)ACSign_Decrypto( bufferA, + (char*)sgn_ptr + 4, // ファイル内の暗号化部分はへのオフセットをプラス + (char*)key_ptr + 16 ); // PC側でMODのみのファイルに対応すれば+16が不要 + + (void)ACSign_Digest( bufferB, + srl_ptr, + (char*)srl_ptr + pHeader->main_rom_offset, + pHeader->main_size, + (char*)srl_ptr + pHeader->sub_rom_offset, + pHeader->sub_size, + nSerial ); + + if ( ACSign_Compare( bufferA, bufferB ) ) + { + OS_Printf( "Authentication_Code test : success! [%12s %12s] \n", srlfile, sgnfile ); + } + else + { + OS_Printf( "Authentication_Code test : failure! [%12s %12s]\n", srlfile, sgnfile ); + } + + } + else + { + OS_Printf( "no test\n" ); + } + + OS_PrintServer(); +} + + +void NitroMain(void) +{ + FSFile file; + + + OS_InitPrintServer(); + OS_Init(); + OS_InitThread(); + InitializeAllocateSystem(); + + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + + if ( sizeof (int ) < sizeof ( long ) ) + OS_Printf( "sizeof (int ) != sizeof ( long )\n" ); + if ( sizeof ( RomHeader ) != 0x0160 ) + OS_Printf( "sizeof ( RomHeader ) != 0x0160\n" ); + + /* initialize file-system */ + FS_Init( (u32)MI_DMA_MAX_NUM ); /* use DMA-3 for FS */ + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // ファイル読み込み + FS_InitFile(&file); + //TestAC( "/data/iplpub.bin", "/data/main.srl", "/data/sgn.bin", &file ); + + TestAC( "/data/iplpub.bin", "/data/main0.srl", "/data/sgn0.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main1.srl", "/data/sgn1.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main2.srl", "/data/sgn2.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main3.srl", "/data/sgn3.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main4.srl", "/data/sgn4.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main5.srl", "/data/sgn5.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main6.srl", "/data/sgn6.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main7.srl", "/data/sgn7.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main0.srl", "/data/sgn7.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main3.srl", "/data/sgn1.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main5.srl", "/data/sgn5.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main1.srl", "/data/sgn0.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main0.srl", "/data/sgn1.bin", &file ); + TestAC( "/data/iplpub.bin", "/data/main0.srl", "/data/sgn0.bin", &file ); + + OS_Terminate(); +} + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/md5.c b/build/libraries_sysmenu/acsign/ARM9/src/md5.c new file mode 100644 index 00000000..9b89e568 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/md5.c @@ -0,0 +1,412 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +#include "md5.h" + +/* Constants for MD5Transform routine. */ + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform(unsigned long [4], unsigned char [64]); +static void Encode(unsigned char *, unsigned long *, unsigned int); +static void Decode(unsigned long *, unsigned char *, unsigned int); +static void MD5_memcpy(unsigned char*, unsigned char*, unsigned int); +static void MD5_memset(unsigned char*, int, unsigned int); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (unsigned long)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (unsigned long)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (unsigned long)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (unsigned long)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void MD5Init(context) +MD5_CTX *context; /* context */ +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ +void MD5Update(context, input, inputLen) +MD5_CTX *context; /* context */ +unsigned char *input; /* input block */ +unsigned int inputLen; /* length of input block */ +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((unsigned long)inputLen << 3)) < ((unsigned long)inputLen << 3)) + context->count[1]++; + context->count[1] += ((unsigned long)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. */ + if (inputLen >= partLen) { + MD5_memcpy((unsigned char*)&context->buffer[index], (unsigned char*)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + MD5_memcpy((unsigned char*)&context->buffer[index], (unsigned char*)&input[i], inputLen-i); +} + +/* MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void MD5Final(digest, context) +unsigned char digest[16]; /* message digest */ +MD5_CTX *context; /* context */ +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. */ + MD5_memset ((unsigned char*)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform (state, block) +unsigned long state[4]; +unsigned char block[64]; +{ + unsigned long a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + MD5_memset ((unsigned char*)x, 0, sizeof (x)); +} + +/* Encodes input (unsigned long) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode(output, input, len) +unsigned char *output; +unsigned long *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j ] = (unsigned char)( input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (unsigned long). Assumes len is + a multiple of 4. + */ +static void Decode(output, input, len) +unsigned long *output; +unsigned char *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((unsigned long)input[j]) | (((unsigned long)input[j+1]) << 8) | + (((unsigned long)input[j+2]) << 16) | (((unsigned long)input[j+3]) << 24); +} + +/* Note: Replace "for loop" with standard memcpy if possible. + */ + +static void MD5_memcpy(output, input, len) +unsigned char* output; +unsigned char* input; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + output[i] = input[i]; +} + +/* Note: Replace "for loop" with standard memset if possible. + */ +static void MD5_memset(output, value, len) +unsigned char* output; +int value; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + ((char *)output)[i] = (char)value; +} + + + + +////////////////////////////////////////////////////////////////////////////// +#if defined( MD5_TEST ) + +#include + +char* samplearray[ 7 ] = +{ + "", + "a", + "abc", + "message digest", + "abcdefghijklmnopqrstuvwxyz", + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "1234567890" // x8 +}; + +char* resultarray[ 7 ] = +{ + "\xD4\x1D\x8C\xD9\x8F\x00\xB2\x04\xE9\x80\x09\x98\xEC\xF8\x42\x7E", + "\x0C\xC1\x75\xB9\xC0\xF1\xB6\xA8\x31\xC3\x99\xE2\x69\x77\x26\x61", + "\x90\x01\x50\x98\x3C\xD2\x4F\xB0\xD6\x96\x3F\x7D\x28\xE1\x7F\x72", + "\xF9\x6B\x69\x7D\x7C\xB7\x93\x8D\x52\x5A\x2F\x31\xAA\xF1\x61\xD0", + "\xC3\xFC\xD3\xD7\x61\x92\xE4\x00\x7D\xFB\x49\x6C\xCA\x67\xE1\x3B", + "\xD1\x74\xAB\x98\xD2\x77\xD9\xF5\xA5\x61\x1C\x2C\x9F\x41\x9D\x9F", + "\x57\xED\xF4\xA2\x2B\xE3\xC9\x55\xAC\x49\xDA\x2E\x21\x07\xB6\x7A" +}; + +int repeatarray[ 7 ] = +{ + 1, + 1, + 1, + 1, + 1, + 1, + 8 +}; + +int MD5Test( ) +{ + MD5_CTX context; + unsigned char digest[16]; + int i, j, error; + + error = 0; + for ( j = 0; j < 7; j++ ) + { + MD5Init(&context); + + for ( i = 0; i < repeatarray[j]; i++ ) + { + MD5Update (&context, + (unsigned char*)samplearray[j], + (unsigned int)strlen( samplearray[j]) ); + } + + MD5Final(digest, &context); + + error = memcmp( digest, resultarray[j], 16 ); + + if ( error ) + break; + } + + return error ? 0 : 1; +} + +#endif // MD5_TEST +////////////////////////////////////////////////////////////////////////////// diff --git a/build/libraries_sysmenu/acsign/ARM9/src/sha1.c b/build/libraries_sysmenu/acsign/ARM9/src/sha1.c new file mode 100644 index 00000000..e7f2a653 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/sha1.c @@ -0,0 +1,470 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * sha1.c + * + * Description: + * This file implements the Secure Hashing Algorithm 1 as + * defined in FIPS PUB 180-1 published April 17, 1995. + * + * The SHA-1, produces a 160-bit message digest for a given + * data stream. It should take about 2**n steps to find a + * message with the same digest as a given message and + * 2**(n/2) to find any two messages with the same digest, + * when n is the digest size in bits. Therefore, this + * algorithm can serve as a means of providing a + * "fingerprint" for a message. + * + * Portability Issues: + * SHA-1 is defined in terms of 32-bit "words". This code + * uses (included via "sha1.h" to define 32 and 8 + * bit unsigned integer types. If your C compiler does not + * support 32 bit unsigned integers, this code is not + * appropriate. + * + * Caveats: + * SHA-1 is designed to work with messages less than 2^64 bits + * long. Although SHA-1 allows a message digest to be generated + * for messages of any number of bits less than 2^64, this + * implementation only works with messages with a length that is + * a multiple of the size of an 8-bit character. + * + */ + +#include "sha1.h" + +/* + * Define the SHA1 circular left shift macro + */ +#define SHA1CircularShift(bits,word) \ + (((word) << (bits)) | ((word) >> (32-(bits)))) + +/* Local Function Prototyptes */ +void SHA1PadMessage(SHA1Context *); +void SHA1ProcessMessageBlock(SHA1Context *); + +/* + * SHA1Reset + * + * Description: + * This function will initialize the SHA1Context in preparation + * for computing a new SHA1 message digest. + * + * Parameters: + * context: [in/out] + * The context to reset. + * + * Returns: + * sha Error Code. + * + */ +int SHA1Reset(SHA1Context *context) +{ + if (!context) + { + return shaNull; + } + + context->Length_Low = 0; + context->Length_High = 0; + context->Message_Block_Index = 0; + + context->Intermediate_Hash[0] = 0x67452301; + context->Intermediate_Hash[1] = 0xEFCDAB89; + context->Intermediate_Hash[2] = 0x98BADCFE; + context->Intermediate_Hash[3] = 0x10325476; + context->Intermediate_Hash[4] = 0xC3D2E1F0; + + context->Computed = 0; + context->Corrupted = 0; + + return shaSuccess; +} + +/* + * SHA1Result + * + * Description: + * This function will return the 160-bit message digest into the + * Message_Digest array provided by the caller. + * NOTE: The first octet of hash is stored in the 0th element, + * the last octet of hash in the 19th element. + * + * Parameters: + * context: [in/out] + * The context to use to calculate the SHA-1 hash. + * Message_Digest: [out] + * Where the digest is returned. + * + * Returns: + * sha Error Code. + * + */ +int SHA1Result( SHA1Context *context, + unsigned char Message_Digest[20]) +{ + int i; + + if (!context || !Message_Digest) + { + return shaNull; + } + + if (context->Corrupted) + { + return context->Corrupted; + } + + if (!context->Computed) + { + SHA1PadMessage(context); + for(i=0; i<64; ++i) + { + /* message may be sensitive, clear it out */ + context->Message_Block[i] = 0; + } + context->Length_Low = 0; /* and clear length */ + context->Length_High = 0; + context->Computed = 1; + + } + + for(i = 0; i < 20; ++i) + { + Message_Digest[i] = (unsigned char) + (context->Intermediate_Hash[i>>2] + >> 8 * ( 3 - ( i & 0x03 ) )); + } + + return shaSuccess; +} + +/* + * SHA1Input + * + * Description: + * This function accepts an array of octets as the next portion + * of the message. + * + * Parameters: + * context: [in/out] + * The SHA context to update + * message_array: [in] + * An array of characters representing the next portion of + * the message. + * length: [in] + * The length of the message in message_array + * + * Returns: + * sha Error Code. + * + */ +int SHA1Input( SHA1Context *context, + const unsigned char *message_array, + unsigned int length) +{ + if (!length) + { + return shaSuccess; + } + + if (!context || !message_array) + { + return shaNull; + } + + if (context->Computed) + { + context->Corrupted = shaStateError; + + return shaStateError; + } + + if (context->Corrupted) + { + return context->Corrupted; + } + while(length-- && !context->Corrupted) + { + context->Message_Block[context->Message_Block_Index++] = + (unsigned char)(*message_array & 0xFF); + + context->Length_Low += 8; + if (context->Length_Low == 0) + { + context->Length_High++; + if (context->Length_High == 0) + { + /* Message is too long */ + context->Corrupted = 1; + } + } + + if (context->Message_Block_Index == 64) + { + SHA1ProcessMessageBlock(context); + } + + message_array++; + } + + return shaSuccess; +} + +/* + * SHA1ProcessMessageBlock + * + * Description: + * This function will process the next 512 bits of the message + * stored in the Message_Block array. + * + * Parameters: + * None. + * + * Returns: + * Nothing. + * + * Comments: + * + * Many of the variable names in this code, especially the + * single character names, were used because those were the + * names used in the publication. + * + * + */ +void SHA1ProcessMessageBlock(SHA1Context *context) +{ + const unsigned long K[] = { /* Constants defined in SHA-1 */ + 0x5A827999, + 0x6ED9EBA1, + 0x8F1BBCDC, + 0xCA62C1D6 + }; + int t; /* Loop counter */ + unsigned long temp; /* Temporary word value */ + unsigned long W[80]; /* Word sequence */ + unsigned long A, B, C, D, E; /* Word buffers */ + + /* + * Initialize the first 16 words in the array W + */ + for(t = 0; t < 16; t++) + { + W[t] = context->Message_Block[t * 4 ] << 24; + W[t] |= context->Message_Block[t * 4 + 1] << 16; + W[t] |= context->Message_Block[t * 4 + 2] << 8; + W[t] |= context->Message_Block[t * 4 + 3]; + } + + for(t = 16; t < 80; t++) + { + W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + } + + A = context->Intermediate_Hash[0]; + B = context->Intermediate_Hash[1]; + C = context->Intermediate_Hash[2]; + D = context->Intermediate_Hash[3]; + E = context->Intermediate_Hash[4]; + + for(t = 0; t < 20; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + + B = A; + A = temp; + } + + for(t = 20; t < 40; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 40; t < 60; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 60; t < 80; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + context->Intermediate_Hash[0] += A; + context->Intermediate_Hash[1] += B; + context->Intermediate_Hash[2] += C; + context->Intermediate_Hash[3] += D; + context->Intermediate_Hash[4] += E; + + context->Message_Block_Index = 0; +} + +/* + * SHA1PadMessage + * + + * Description: + * According to the standard, the message must be padded to an even + * 512 bits. The first padding bit must be a '1'. The last 64 + * bits represent the length of the original message. All bits in + * between should be 0. This function will pad the message + * according to those rules by filling the Message_Block array + * accordingly. It will also call the ProcessMessageBlock function + * provided appropriately. When it returns, it can be assumed that + * the message digest has been computed. + * + * Parameters: + * context: [in/out] + * The context to pad + * ProcessMessageBlock: [in] + * The appropriate SHA*ProcessMessageBlock function + * Returns: + * Nothing. + * + */ + +void SHA1PadMessage(SHA1Context *context) +{ + /* + * Check to see if the current message block is too small to hold + * the initial padding bits and length. If so, we will pad the + * block, process it, and then continue padding into a second + * block. + */ + if (context->Message_Block_Index > 55) + { + context->Message_Block[context->Message_Block_Index++] = 0x80; + while(context->Message_Block_Index < 64) + { + context->Message_Block[context->Message_Block_Index++] = 0; + } + + SHA1ProcessMessageBlock(context); + + while(context->Message_Block_Index < 56) + { + context->Message_Block[context->Message_Block_Index++] = 0; + } + } + else + { + context->Message_Block[context->Message_Block_Index++] = 0x80; + while(context->Message_Block_Index < 56) + { + + context->Message_Block[context->Message_Block_Index++] = 0; + } + } + + /* + * Store the message length as the last 8 octets + */ + context->Message_Block[56] = (unsigned char)(context->Length_High >> 24); + context->Message_Block[57] = (unsigned char)(context->Length_High >> 16); + context->Message_Block[58] = (unsigned char)(context->Length_High >> 8); + context->Message_Block[59] = (unsigned char)(context->Length_High ); + context->Message_Block[60] = (unsigned char)(context->Length_Low >> 24); + context->Message_Block[61] = (unsigned char)(context->Length_Low >> 16); + context->Message_Block[62] = (unsigned char)(context->Length_Low >> 8); + context->Message_Block[63] = (unsigned char)(context->Length_Low ); + + SHA1ProcessMessageBlock(context); +} + + + + +////////////////////////////////////////////////////////////////////////////// +#if defined( SHA1_TEST ) + +#include "string.h" + +char* samplearray[4] = +{ + "abc", + "abcdbcdecdefdefgefghfghighijhi" "jkijkljklmklmnlmnomnopnopq", + "a", + "01234567012345670123456701234567" "01234567012345670123456701234567" +}; + +char* resultarray[ 4 ] = +{ + "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D", + "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1", + "\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F", + "\xDE\xA3\x56\xA2\xCD\xDD\x90\xC7\xA7\xEC\xED\xC5\xEB\xB5\x63\x93\x4F\x46\x04\x52" +}; + +long int repeatcount[4] = { 1, 1, 1000000, 10 }; + +int SHA1Test( ) +{ + SHA1Context sha; + unsigned char digest[20]; + int i, j, error; + + error = 0; + for ( j = 0; j < 4; ++j ) + { + if ( !error ) + error = SHA1Reset(&sha); + + for(i = 0; i < repeatcount[j]; ++i) + { + if ( !error ) + error = SHA1Input(&sha, + (const unsigned char *)samplearray[j], + (unsigned int)strlen(samplearray[j])); + } + + if ( !error ) + error = SHA1Result(&sha, digest); + + if ( !error ) + error = memcmp( digest, resultarray[j], 20 ); + + if (error) + break; + } + + return error ? 0 : 1; +} + +#endif // SHA1_TEST +////////////////////////////////////////////////////////////////////////////// + diff --git a/build/libraries_sysmenu/acsign/ARM9/src/sha1dgst.c b/build/libraries_sysmenu/acsign/ARM9/src/sha1dgst.c new file mode 100644 index 00000000..4742b605 --- /dev/null +++ b/build/libraries_sysmenu/acsign/ARM9/src/sha1dgst.c @@ -0,0 +1,786 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +/* + * Copyright (C) 1998-2002 RSA Security Inc. All rights reserved. + * + * This work contains proprietary information of RSA Security. + * Distribution is limited to authorized licensees of RSA + * Security. Any unauthorized reproduction, distribution or + * modification of this work is strictly prohibited. + * + */ + +////!!!!#include "r_com.h" + +#ifndef NO_SHA1 +#undef SHA_0 +#define SHA_1 +#include "sha.h" +#include "sha_locl.h" +#ifdef CPU_X86 +#include "r_cpuid.h" +#endif /* NO_SHA1 */ + +const char *SHA1_version="SHA1 part of RCOM 2.3.0 11-Jun-2002"; + +/* Implemented from SHA-1 document - The Secure Hash Algorithm + */ + +#define INIT_DATA_h0 (SHA_LONG)0x67452301L +#define INIT_DATA_h1 (SHA_LONG)0xefcdab89L +#define INIT_DATA_h2 (SHA_LONG)0x98badcfeL +#define INIT_DATA_h3 (SHA_LONG)0x10325476L +#define INIT_DATA_h4 (SHA_LONG)0xc3d2e1f0L + +#define K_00_19 (SHA_LONG)0x5a827999L +#define K_20_39 (SHA_LONG)0x6ed9eba1L +#define K_40_59 (SHA_LONG)0x8f1bbcdcL +#define K_60_79 (SHA_LONG)0xca62c1d6L + +#ifndef CCONV +#define CCONV +#endif + +#ifndef PRE_CCONV +#define PRE_CCONV +#endif + +/* Endian flags are only used for the assembler code */ +#ifndef OPT_SHA1_ASM +#undef L_ENDIAN +#undef B_ENDIAN +#endif + + +#ifdef OPT_SHA1_ASM + +#ifdef CPU_X86 +void CCONV sha1_block_586(SHA_CTX *c,const unsigned char *p, int num); +void CCONV sha1_block_686(SHA_CTX *c,const unsigned char *p, int num); +void CCONV sha1_block_786(SHA_CTX *c,const unsigned char *p, int num); +unsigned long r_cpuid(unsigned long *,char **name); + +#elif OPT_SHA1_ARM +PRE_CCONV void CCONV sha1_arm4_fast(SHA_CTX *c, const unsigned char *p, + int num); +PRE_CCONV void CCONV sha1_arm4_small(SHA_CTX *c, const unsigned char *p, + int num); +#else +void CCONV sha1_block_asm(SHA_CTX *c, const unsigned char *p, int num); +#endif /* CPU_X86 */ + +#else /* OPT_SHA1_ASM */ + +void sha1_block(SHA_CTX *c, SHA_LONG *p, int num); + +#endif /* OPT_SHA1_ASM */ + +#undef M_c2nl +#undef M_p_c2nl +#undef M_c2nl_p +#undef M_p_c2nl_p +#undef M_nl2c + +#if defined(L_ENDIAN) && !defined(OPT_SHA1_ASM) +# define M_c2nl c2l +# define M_p_c2nl p_c2l +# define M_c2nl_p c2l_p +# define M_p_c2nl_p p_c2l_p +# define M_nl2c l2c +#else +# define M_c2nl c2nl +# define M_p_c2nl p_c2nl +# define M_c2nl_p c2nl_p +# define M_p_c2nl_p p_c2nl_p +# define M_nl2c nl2c +#endif /* defined(L_ENDIAN) && !defined(OPT_SHA1_ASM) */ + +int SHA1_Setup(c,sha_block) +SHA_CTX *c; +void (PRE_CCONV CCONV *sha_block)(SHA_CTX *c, const unsigned char *W, int num); + { + c->sha_block=sha_block; + return(0); + } + +void SHA1_Init(c) +SHA_CTX *c; + { + c->h0=INIT_DATA_h0; + c->h1=INIT_DATA_h1; + c->h2=INIT_DATA_h2; + c->h3=INIT_DATA_h3; + c->h4=INIT_DATA_h4; + c->Nl=0; + c->Nh=0; + c->num=0; + +#ifdef OPT_SHA1_ASM +#ifdef CPU_X86 + if (c->sha_block == NULL) + { + unsigned long cpu,attrib; + + /* We should make the methods loadable */ + cpu=r_cpuid(&attrib,NULL); + if (attrib & R_CPU_X86_HAS_PENTIUM_IV) + c->sha_block=sha1_block_786; + else if (attrib & R_CPU_X86_HAS_PENTIUM_PRO) + c->sha_block=sha1_block_686; + else + c->sha_block=sha1_block_586; + } +#else /* CPU_X86 */ + +#ifndef OPT_SHA1_ARM + c->sha_block=sha1_block_asm; +#else /* OPT_SHA1_ARM */ + if (c->sha_block == NULL) + { +#ifdef SMALL_CODE_SIZE + c->sha_block = sha1_arm4_small; +#else /* SMALL_CODE_SIZE */ + c->sha_block = sha1_arm4_fast; +#endif /* SMALL_CODE_SIZE */ + } +#endif /* OPT_SHA1_ARM */ +#endif /* CPU_X86 */ + +#else /* OPT_SHA1_ASM */ + c->sha_block=(void (PRE_CCONV CCONV *)(SHA_CTX *, const unsigned char *, int))sha1_block; +#endif /* OPT_SHA1_ASM */ + } + +#ifdef OPT_SHA1_ASM + +void SHA1_Update(c, data, len) +SHA_CTX *c; +const register unsigned char *data; +unsigned long len; + { + int i; + unsigned int alignment; + unsigned long l; + unsigned char *cp=(unsigned char *)c->data; + + if (len == 0) return; + + l=(c->Nl+(len<<3))&0xffffffffL; + if (l < c->Nl) /* overflow */ + c->Nh++; + c->Nh+=(len>>29); + c->Nl=l; + + if (c->num != 0) + { + if (c->num+len >= SHA_CBLOCK) + { + i=SHA_CBLOCK-c->num; + Memcpy(&(cp[c->num]),data,i); + len-=i; + data+=i; + + c->sha_block(c,cp,64); + c->num=0; + /* drop through and do the rest */ + } + else + { + Memcpy(&(cp[c->num]),data,len); + c->num+=(int)len; + return; + } + } + /* we now can process the input data in blocks of SHA_CBLOCK + * chars and save the leftovers to c->data. */ + if (len >= SHA_CBLOCK) + { + i=(int)(len& ~63); + len-=i; + + /* + * Check to see if the input data lies on a word boundary. + * Do this as the ASM relies on input data being word aligned. + */ + alignment = (((unsigned int)data) & (sizeof(unsigned int)-1)) + & 0x03; + if (alignment == 0) + { + c->sha_block(c,data,i); + data+=i; + } + else + { + do { + Memcpy(cp, data, SHA_CBLOCK); + data += SHA_CBLOCK; + c->sha_block(c, cp, SHA_CBLOCK); + i -= SHA_CBLOCK; + } while (i > 0); + } + } + c->num=len; + if (len) + { + Memcpy(cp,data,(int)len); + } + } + +void SHA1_Transform(c,b) +SHA_CTX *c; +const unsigned char *b; + { + c->sha_block(c,b,64); + } + +void SHA1_Final(md, c) +unsigned char *md; +SHA_CTX *c; + { + register int i,j; + register SHA_LONG l; + register SHA_LONG *p; + const static unsigned char end[4]={0x80,0x00,0x00,0x00}; + unsigned char *cp= (unsigned char *)end; + unsigned char *pc; + + /* c->num should definitly have room for at least one more byte. */ + p=c->data; + j=c->num; + i=j>>2; + +#ifdef PURIFY + /* PURIFY */ + /* we reference uninitialised data but don't keep the result + * which purify complains about ... and we don't want to have + * to come back here to find a non-existant problem later + */ + + /* purify often complains about the following line as an + * Uninitialized Memory Read. While this can be true, the + * following p_c2l macro will reset l when that case is true. + * This is because j&0x03 contains the number of 'valid' bytes + * already in p[i]. If and only if j&0x03 == 0, the UMR will + * occur but this is also the only time p_c2l will do + * l= *(cp++) instead of l|= *(cp++) + */ + if ((j&0x03) == 0) p[i]=0; +#endif + + pc=(unsigned char *)c->data; + pc[j]=0x80; + for (j++; j & 0x03; j++) + pc[j]=0; + i++; + /* i is the next 'undefined word' */ + if (c->num >= SHA_LAST_BLOCK) + { + for (; isha_block(c,(unsigned char *)p,64); + i=0; + } + for (; i<(SHA_LBLOCK-2); i++) + p[i]=0; + + l=c->Nl; + pc[63]=(unsigned char)((l )&0xff); + pc[62]=(unsigned char)((l>> 8)&0xff); + pc[61]=(unsigned char)((l>>16)&0xff); + pc[60]=(unsigned char)((l>>24)&0xff); + l=c->Nh; + pc[59]=(unsigned char)((l )&0xff); + pc[58]=(unsigned char)((l>> 8)&0xff); + pc[57]=(unsigned char)((l>>16)&0xff); + pc[56]=(unsigned char)((l>>24)&0xff); + + c->sha_block(c,(unsigned char *)p,64); + cp=md; + l=c->h0; nl2c(l,cp); + l=c->h1; nl2c(l,cp); + l=c->h2; nl2c(l,cp); + l=c->h3; nl2c(l,cp); + l=c->h4; nl2c(l,cp); + + /* clear stuff, sha1_block_asm may be leaving some stuff on the stack + * but I'm not worried :-) */ + c->num=0; +/* Memset((char *)&c,0,sizeof(c));*/ + } + +#else /* !OPT_SHA1_ASM */ + +void SHA1_Update(c, data, len) +SHA_CTX *c; +const register unsigned char *data; +unsigned long len; + { + register SHA_LONG *p; + int ew,ec,sw,sc; + SHA_LONG l; + + if (len == 0) return; + + l=(c->Nl+(len<<3))&0xffffffffL; + if (l < c->Nl) /* overflow */ + c->Nh++; + c->Nh+=(len>>29); + c->Nl=l; + + if (c->num != 0) + { + p=c->data; + sw=c->num>>2; + sc=c->num&0x03; + + if ((c->num+len) >= SHA_CBLOCK) + { + l= p[sw]; + M_p_c2nl(data,l,sc); + p[sw++]=l; + for (; swnum); + + c->sha_block(c,(unsigned char *)p,64); + c->num=0; + /* drop through and do the rest */ + } + else + { + c->num+=(int)len; + if ((sc+len) < 4) /* ugly, add char's to a word */ + { + l= p[sw]; + M_p_c2nl_p(data,l,sc,len); + p[sw]=l; + } + else + { + ew=(c->num>>2); + ec=(c->num&0x03); + l= p[sw]; + M_p_c2nl(data,l,sc); + p[sw++]=l; + for (; sw < ew; sw++) + { M_c2nl(data,l); p[sw]=l; } + if (ec) + { + M_c2nl_p(data,l,ec); + p[sw]=l; + } + } + return; + } + } + /* We can only do the following code for assember, the reason + * being that the sha1_block 'C' version changes the values + * in the 'data' array. The assember code avoids this and + * copies it to a local array. I should be able to do this for + * the C version as well.... + */ +#if defined(B_ENDIAN) || defined(OPT_SHA1_ASM) + if ((((unsigned long)data)%sizeof(SHA_LONG)) == 0) + { + sw=len/SHA_CBLOCK; + if (sw) + { + sw*=SHA_CBLOCK; + c->sha_block(c,(SHA_LONG *)data,sw); + data+=sw; + len-=sw; + } + } +#endif + /* we now can process the input data in blocks of SHA_CBLOCK + * chars and save the leftovers to c->data. */ + p=c->data; + while (len >= SHA_CBLOCK) + { +#if defined(B_ENDIAN) || defined(L_ENDIAN) + if (p != (SHA_LONG *)data) + Memcpy(p,data,SHA_CBLOCK); + data+=SHA_CBLOCK; +# ifdef L_ENDIAN +# ifndef OPT_SHA1_ASM /* Will not happen */ + for (sw=(SHA_LBLOCK/4); sw; sw--) + { + Endian_Reverse32(p[0]); + Endian_Reverse32(p[1]); + Endian_Reverse32(p[2]); + Endian_Reverse32(p[3]); + p+=4; + } + p=c->data; +# endif +# endif +#else + for (sw=(SHA_BLOCK/4); sw; sw--) + { + M_c2nl(data,l); *(p++)=l; + M_c2nl(data,l); *(p++)=l; + M_c2nl(data,l); *(p++)=l; + M_c2nl(data,l); *(p++)=l; + } + p=c->data; +#endif + c->sha_block(c,(unsigned char *)p,64); + len-=SHA_CBLOCK; + } + ec=(int)len; + c->num=ec; + ew=(ec>>2); + ec&=0x03; + + for (sw=0; sw < ew; sw++) + { M_c2nl(data,l); p[sw]=l; } + M_c2nl_p(data,l,ec); + p[sw]=l; + } + +void SHA1_Transform(c,b) +SHA_CTX *c; +const unsigned char *b; + { + SHA_LONG p[16]; +#ifndef B_ENDIAN + SHA_LONG *q; + int i; +#endif + +#if defined(B_ENDIAN) || defined(L_ENDIAN) + Memcpy(p,b,64); +#ifdef L_ENDIAN + q=p; + for (i=(SHA_LBLOCK/4); i; i--) + { + Endian_Reverse32(q[0]); + Endian_Reverse32(q[1]); + Endian_Reverse32(q[2]); + Endian_Reverse32(q[3]); + q+=4; + } +#endif +#else + q=p; + for (i=(SHA_LBLOCK/4); i; i--) + { + SHA_LONG l; + c2nl(b,l); *(q++)=l; + c2nl(b,l); *(q++)=l; + c2nl(b,l); *(q++)=l; + c2nl(b,l); *(q++)=l; + } +#endif + c->sha_block(c,(unsigned char *)p,64); + } + + +void sha1_block(c, W, num) +SHA_CTX *c; +SHA_LONG *W; +int num; + { +#ifndef SMALL_CODE_SIZE + register SHA_LONG A,B,C,D,E,T; + SHA_LONG X[16]; + + A=c->h0; + B=c->h1; + C=c->h2; + D=c->h3; + E=c->h4; + + for (;;) + { + BODY_00_15( 0,A,B,C,D,E,T,W); + BODY_00_15( 1,T,A,B,C,D,E,W); + BODY_00_15( 2,E,T,A,B,C,D,W); + BODY_00_15( 3,D,E,T,A,B,C,W); + BODY_00_15( 4,C,D,E,T,A,B,W); + BODY_00_15( 5,B,C,D,E,T,A,W); + BODY_00_15( 6,A,B,C,D,E,T,W); + BODY_00_15( 7,T,A,B,C,D,E,W); + BODY_00_15( 8,E,T,A,B,C,D,W); + BODY_00_15( 9,D,E,T,A,B,C,W); + BODY_00_15(10,C,D,E,T,A,B,W); + BODY_00_15(11,B,C,D,E,T,A,W); + BODY_00_15(12,A,B,C,D,E,T,W); + BODY_00_15(13,T,A,B,C,D,E,W); + BODY_00_15(14,E,T,A,B,C,D,W); + BODY_00_15(15,D,E,T,A,B,C,W); + BODY_16_19(16,C,D,E,T,A,B,W,W,W,W); + BODY_16_19(17,B,C,D,E,T,A,W,W,W,W); + BODY_16_19(18,A,B,C,D,E,T,W,W,W,W); + BODY_16_19(19,T,A,B,C,D,E,W,W,W,X); + + BODY_20_31(20,E,T,A,B,C,D,W,W,W,X); + BODY_20_31(21,D,E,T,A,B,C,W,W,W,X); + BODY_20_31(22,C,D,E,T,A,B,W,W,W,X); + BODY_20_31(23,B,C,D,E,T,A,W,W,W,X); + BODY_20_31(24,A,B,C,D,E,T,W,W,X,X); + BODY_20_31(25,T,A,B,C,D,E,W,W,X,X); + BODY_20_31(26,E,T,A,B,C,D,W,W,X,X); + BODY_20_31(27,D,E,T,A,B,C,W,W,X,X); + BODY_20_31(28,C,D,E,T,A,B,W,W,X,X); + BODY_20_31(29,B,C,D,E,T,A,W,W,X,X); + BODY_20_31(30,A,B,C,D,E,T,W,X,X,X); + BODY_20_31(31,T,A,B,C,D,E,W,X,X,X); + BODY_32_39(32,E,T,A,B,C,D,X); + BODY_32_39(33,D,E,T,A,B,C,X); + BODY_32_39(34,C,D,E,T,A,B,X); + BODY_32_39(35,B,C,D,E,T,A,X); + BODY_32_39(36,A,B,C,D,E,T,X); + BODY_32_39(37,T,A,B,C,D,E,X); + BODY_32_39(38,E,T,A,B,C,D,X); + BODY_32_39(39,D,E,T,A,B,C,X); + + BODY_40_59(40,C,D,E,T,A,B,X); + BODY_40_59(41,B,C,D,E,T,A,X); + BODY_40_59(42,A,B,C,D,E,T,X); + BODY_40_59(43,T,A,B,C,D,E,X); + BODY_40_59(44,E,T,A,B,C,D,X); + BODY_40_59(45,D,E,T,A,B,C,X); + BODY_40_59(46,C,D,E,T,A,B,X); + BODY_40_59(47,B,C,D,E,T,A,X); + BODY_40_59(48,A,B,C,D,E,T,X); + BODY_40_59(49,T,A,B,C,D,E,X); + BODY_40_59(50,E,T,A,B,C,D,X); + BODY_40_59(51,D,E,T,A,B,C,X); + BODY_40_59(52,C,D,E,T,A,B,X); + BODY_40_59(53,B,C,D,E,T,A,X); + BODY_40_59(54,A,B,C,D,E,T,X); + BODY_40_59(55,T,A,B,C,D,E,X); + BODY_40_59(56,E,T,A,B,C,D,X); + BODY_40_59(57,D,E,T,A,B,C,X); + BODY_40_59(58,C,D,E,T,A,B,X); + BODY_40_59(59,B,C,D,E,T,A,X); + + BODY_60_79(60,A,B,C,D,E,T,X); + BODY_60_79(61,T,A,B,C,D,E,X); + BODY_60_79(62,E,T,A,B,C,D,X); + BODY_60_79(63,D,E,T,A,B,C,X); + BODY_60_79(64,C,D,E,T,A,B,X); + BODY_60_79(65,B,C,D,E,T,A,X); + BODY_60_79(66,A,B,C,D,E,T,X); + BODY_60_79(67,T,A,B,C,D,E,X); + BODY_60_79(68,E,T,A,B,C,D,X); + BODY_60_79(69,D,E,T,A,B,C,X); + BODY_60_79(70,C,D,E,T,A,B,X); + BODY_60_79(71,B,C,D,E,T,A,X); + BODY_60_79(72,A,B,C,D,E,T,X); + BODY_60_79(73,T,A,B,C,D,E,X); + BODY_60_79(74,E,T,A,B,C,D,X); + BODY_60_79(75,D,E,T,A,B,C,X); + BODY_60_79(76,C,D,E,T,A,B,X); + BODY_60_79(77,B,C,D,E,T,A,X); + BODY_60_79(78,A,B,C,D,E,T,X); + BODY_60_79(79,T,A,B,C,D,E,X); + + c->h0=(c->h0+E)&0xffffffffL; + c->h1=(c->h1+T)&0xffffffffL; + c->h2=(c->h2+A)&0xffffffffL; + c->h3=(c->h3+B)&0xffffffffL; + c->h4=(c->h4+C)&0xffffffffL; + + num-=64; + if (num <= 0) break; + + A=c->h0; + B=c->h1; + C=c->h2; + D=c->h3; + E=c->h4; + + W+=16; + } +#else /* SMALL_CODE_SIZE */ + SHA_LONG A,B,C,D,E,T; + SHA_LONG X[16]; + SHA_LONG *a1,*a2,*a3; + + A=c->h0; + B=c->h1; + C=c->h2; + D=c->h3; + E=c->h4; + + for (;;) + { + int i; + + for (i=0; i<16; i++) + { + BODY_00_15(i,A,B,C,D,E,T,W); + E=D; D=C; C=B; B=A; A=T; + } + + a1=W; + for (i=16; i<20; i++) + { + if (i == 19) a1=X; + BODY_16_19(i,A,B,C,D,E,T,W,W,W,a1); + E=D; D=C; C=B; B=A; A=T; + } + + a1=a2=a3=W; + for (i=20; i<40; i++) + { + if (i == 24) a3=X; + if (i == 30) a2=X; + if (i == 32) a1=X; + BODY_20_31(i,A,B,C,D,E,T,a1,a2,a3,X); + E=D; D=C; C=B; B=A; A=T; + } + + for (i=40; i<60; i++) + { + BODY_40_59(i,A,B,C,D,E,T,X); + E=D; D=C; C=B; B=A; A=T; + } + + for (i=60; i<80; i++) + { + BODY_60_79(i,A,B,C,D,E,T,X); + E=D; D=C; C=B; B=A; A=T; + } + + c->h0=(c->h0+A)&0xffffffffL; + c->h1=(c->h1+B)&0xffffffffL; + c->h2=(c->h2+C)&0xffffffffL; + c->h3=(c->h3+D)&0xffffffffL; + c->h4=(c->h4+E)&0xffffffffL; + + num-=64; + if (num <= 0) break; + + A=c->h0; + B=c->h1; + C=c->h2; + D=c->h3; + E=c->h4; + + W+=16; + } +#endif /* SMALL_CODE_SIZE */ + } + +void SHA1_Final(md, c) +unsigned char *md; +SHA_CTX *c; + { + register int i,j; + register SHA_LONG l; + register SHA_LONG *p; + const static unsigned char end[4]={0x80,0x00,0x00,0x00}; + unsigned char *cp= (unsigned char *)end; + + /* c->num should definitly have room for at least one more byte. */ + p=c->data; + j=c->num; + i=j>>2; + +#ifdef PURIFY + /* PURIFY */ + /* we reference uninitialised data but don't keep the result + * which purify complains about ... and we don't want to have + * to come back here to find a non-existant problem later + */ + + /* purify often complains about the following line as an + * Uninitialized Memory Read. While this can be true, the + * following p_c2l macro will reset l when that case is true. + * This is because j&0x03 contains the number of 'valid' bytes + * already in p[i]. If and only if j&0x03 == 0, the UMR will + * occur but this is also the only time p_c2l will do + * l= *(cp++) instead of l|= *(cp++) + */ + if ((j&0x03) == 0) p[i]=0; +#endif + + l=p[i]; + M_p_c2nl(cp,l,j&0x03); + p[i]=l; + i++; + /* i is the next 'undefined word' */ + if (c->num >= SHA_LAST_BLOCK) + { + for (; isha_block(c,(unsigned char *)p,64); + i=0; + } + for (; i<(SHA_LBLOCK-2); i++) + p[i]=0; + p[SHA_LBLOCK-2]=c->Nh; + p[SHA_LBLOCK-1]=c->Nl; +#if defined(L_ENDIAN) + Endian_Reverse32(p[SHA_LBLOCK-2]); + Endian_Reverse32(p[SHA_LBLOCK-1]); +#endif + c->sha_block(c,(unsigned char *)p,64); + cp=md; + l=c->h0; nl2c(l,cp); + l=c->h1; nl2c(l,cp); + l=c->h2; nl2c(l,cp); + l=c->h3; nl2c(l,cp); + l=c->h4; nl2c(l,cp); + + /* clear stuff, sha1_block may be leaving some stuff on the stack + * but I'm not worried :-) */ + c->num=0; +/* Memset((char *)&c,0,sizeof(c));*/ + } +#endif + +#if 0 +int pr(ctx) +SHA_CTX *ctx; + { + int i,j; + unsigned char *p=(unsigned char *)(ctx->data); + + fprintf(stderr,"num = %08X%08X\n",ctx->Nh,ctx->Nl); + fprintf(stderr," %08X %08X %08X %08X %08X\n", + ctx->h0,ctx->h1,ctx->h2,ctx->h3,ctx->h4); + fprintf(stderr,"bufnum = %d\n",ctx->num); + fprintf(stderr," "); + for (j=0; j<64; j+=16) + { + for (i=0; i<16; i++) + { +/* + if ((i+j) >= ctx->num) + fprintf(stderr,"--"); + else +*/ + fprintf(stderr,"%02X",p[i+j]); + } + if ((j+16) >=64) + fprintf(stderr,"\n"); + else + fprintf(stderr,"\n "); + } + } + +#endif + +#endif /* NO_SHA1 */ diff --git a/build/libraries_sysmenu/acsign/Makefile b/build/libraries_sysmenu/acsign/Makefile new file mode 100644 index 00000000..17e9a1ed --- /dev/null +++ b/build/libraries_sysmenu/acsign/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/boot/ARM7/Makefile b/build/libraries_sysmenu/boot/ARM7/Makefile new file mode 100644 index 00000000..7075cc92 --- /dev/null +++ b/build/libraries_sysmenu/boot/ARM7/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +#---------------------------------------------------------------------------- + +SRCDIR = ./src + +INCDIR = ../common/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 \ + +SRCS = bootAPI.c \ + +TARGET_LIB = libboot_sp$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot + +LINCLUDES += $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c b/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c new file mode 100644 index 00000000..f9e9eb80 --- /dev/null +++ b/build/libraries_sysmenu/boot/ARM7/src/bootAPI.c @@ -0,0 +1,498 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: boot.c + + Copyright 2007 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 +#include +#include +#include +#include "reboot.h" +#include "internal_api.h" +#include "../../../hotsw/ARM7/include/hotswTypes.h" + +extern void SPI_Lock(u32 id); +extern void SPI_Unlock(u32 id); + +// define data------------------------------------------------------- +#define MAINP_SEND_IF 0x2000 +#define reg_MI_MC_SWP (*(REGType8v *) ( REG_MC1_ADDR + 1 ) ) + +#define PRE_CLEAR_NUM_MAX (7*2) +#define COPY_NUM_MAX (6*3) +#define COPY_HEADER_NUM_MAX (1*3) +#define POST_CLEAR_NUM_MAX (12 + 6*2) + +#define CLRLIST_REBOOT_STACK_PAD_SIZE_IDX (2*3+1) + +#define TITLE_ID_NAND_INITIALIZER 0x00030011304E4941ULL // 0NIA + +// 起動制限をかけるタイトル一覧 +typedef struct TitleBlackList { + OSTitleId titleID; + int rom_version; +}TitleBlackList; + +// extern data------------------------------------------------------- + +// function's prototype---------------------------------------------- + +static void BOOTi_ClearREG_RAM( void ); +static void BOOTi_CutAwayRegionList( u32 *regionlist, u32 start, u32 end ); +static void BOOTi_CheckTitleBlackList( ROM_Header_Short *pROMH ); +static void BOOTi_RebootCallback( void** entryp, void* mem_list, REBOOTTarget* target ); +static void BOOTi_SetMainMemModeForNTR( void ); +void BOOTi_SetMainMemModeForNTRCore( u32 addr ); + +// global variables-------------------------------------------------- + +// static variables-------------------------------------------------- + +static REBOOTTarget target; + +// メモリリスト +static u32 mem_list[PRE_CLEAR_NUM_MAX + 1 + COPY_NUM_MAX + COPY_HEADER_NUM_MAX + 2 + POST_CLEAR_NUM_MAX + 1] = +{ + // pre clear + HW_WRAM_B_OR_C_MIRROR, SYSM_OWN_ARM7_WRAM_ADDR_END - HW_WRAM_B_OR_C_MIRROR, // 0x03780000 - 0x0380f000 SYSM_OWN_ARM7_WRAM_ADDRとHW_WRAM_A, HW_WRAM_Bをまとめてクリア + SYSM_OWN_ARM7_MMEM_ADDR, SYSM_OWN_ARM7_MMEM_ADDR_END - SYSM_OWN_ARM7_MMEM_ADDR, + SYSM_OWN_ARM9_MMEM_ADDR, SYSM_OWN_ARM9_MMEM_ADDR_END - SYSM_OWN_ARM9_MMEM_ADDR, + OS_BOOT_CODE_BUF_END, 1, // REBOOTコアコードとスタックの隙間サイズはメモリリスト完成後に差し替える(NULLではREBOOT_GetCoreStackSizeが失敗する) + HW_LAUNCHER_DELIVER_PARAM_BUF_END, OS_BOOT_CODE_BUF - (HW_LAUNCHER_DELIVER_PARAM_BUF_END + (HW_WRAM_AREA_END - HW_PRV_WRAM_END)), // ランチャーのスタック領域 + HW_WRAM_BASE, HW_WRAM_SIZE, // 共有WRAM  Launcherの特殊配置なので、BASEからサイズぶん + HW_WRAM_C, HW_WRAM_C_SIZE, // 0x03700000 - 0x03740000 + NULL, + // copy forward + NULL, + // copy backward + NULL, + // post clear + NULL, +}; + +static u32 twl_post_clear_list[POST_CLEAR_NUM_MAX + 1] = +{ + SYSM_TWL_ARM7_LOAD_MMEM_END, OS_BOOT_A9CODE_BUF, + OS_BOOT_A9CODE_BUF + OS_BOOT_CODE_SIZE, SYSM_TWL_ARM9_LTD_LOAD_MMEM, + SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, SYSM_TWL_MOUNT_INFO_TMP_BUFFER + SYSM_MOUNT_INFO_SIZE + OS_MOUNT_PATH_LEN, + HW_EXCP_VECTOR_MAIN, HW_EXCP_VECTOR_MAIN + 4, // ARM9例外ベクタ + HW_EXCP_VECTOR_BUF, HW_EXCP_VECTOR_BUF + 4, // ARM7例外ベクタ + NULL, +}; + +static u32 nitro_post_clear_list[POST_CLEAR_NUM_MAX + 1] = +{ + SYSM_NTR_ARM7_LOAD_MMEM_END, OS_BOOT_A9CODE_BUF, + SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, SYSM_DBG_NTR_SYSTEM_BUF, + SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, SYSM_TWL_MOUNT_INFO_TMP_BUFFER + SYSM_MOUNT_INFO_SIZE + OS_MOUNT_PATH_LEN, + HW_EXCP_VECTOR_MAIN, HW_EXCP_VECTOR_MAIN + 4, // ARM9例外ベクタ + HW_EXCP_VECTOR_BUF, HW_EXCP_VECTOR_BUF + 4, // ARM7例外ベクタ + NULL, +}; + +// const data-------------------------------------------------------- + +// 起動制限をかけるタイトル一覧 +static const TitleBlackList s_blackList[] = { + { TITLE_ID_NAND_INITIALIZER, 0 }, + { 0ULL, -1 }, +}; + + +void BOOT_Init( void ) +{ + reg_PXI_MAINPINTF = 0x0000; +} + + +BOOL BOOT_WaitStart( void ) +{ + if( (reg_PXI_MAINPINTF & 0x000f ) == 0x000f ) { + // 最適化されるとポインタを初期化しただけでは何もコードは生成されません + ROM_Header *th = (ROM_Header *)SYSM_APP_ROM_HEADER_BUF; // TWL拡張ROMヘッダ(キャッシュ領域、DSアプリには無い) + ROM_Header *dh = (ROM_Header *)(SYSMi_GetWork()->romHeaderNTR); // DS互換ROMヘッダ(非キャッシュ領域) + // リブート + REBOOTi_SetTwlRomHeaderAddr( th ); + REBOOTi_SetRomHeaderAddr( dh ); + REBOOTi_SetPostFinalizeCallback( BOOTi_RebootCallback ); + OS_Boot( OS_BOOT_ENTRY_FROM_ROMHEADER, mem_list, target ); + } + return FALSE; +} + +// SDKのFinalize処理後に呼び出される +static void BOOTi_RebootCallback( void** entryp, void* mem_list_v, REBOOTTarget* target ) +{ +#pragma unused(entryp) + u32* mem_list = mem_list_v; + ROM_Header *th = (void*)REBOOTi_GetTwlRomHeaderAddr(); + ROM_Header *dh = (void*)REBOOTi_GetRomHeaderAddr(); + ROM_Header *ch = (void*)HW_CARD_ROM_HEADER; + BOOL isNtrMode; + u32 spiLockId; + + (void)OS_DisableIrq(); // ここで割り込み禁止にしないとダメ。 + (void)OS_SetIrqMask(0); // SDKバージョンのサーチに時間がかかると、ARM9がHALTにかかってしまい、ARM7のサウンドスレッドがARM9にFIFOでデータ送信しようとしてもFIFOが一杯で送信できない状態で無限ループに入ってしまう。 + (void)OS_SetIrqMaskEx(0); + + MI_StopAllDma(); // 割り込み禁止状態でDMA停止 + MI_StopAllNDma(); + + // 起動アプリNTR-ROMヘッダへのパッチ処理のためコピー + MI_CpuCopyFast( th, dh, HW_CARD_ROM_HEADER_SIZE ); + + // カードNTR-ROMヘッダをNANDアプリやDSダウンロードプレイのためコピー + MI_CpuCopyFast( (void*)SYSM_CARD_ROM_HEADER_BAK, ch, HW_CARD_ROM_HEADER_SIZE ); + + if ( (((ROM_Header *)SYSM_CARD_ROM_HEADER_BAK)->s.platform_code & PLATFORM_CODE_FLAG_TWL) && (dh->s.platform_code & PLATFORM_CODE_FLAG_TWL) ){ + // カードTWL-ROMヘッダをHW_TWL_CARD_ROM_HEADER_BUFにコピー + MI_CpuCopyFast( (void*)SYSM_CARD_ROM_HEADER_BAK, (void*)HW_TWL_CARD_ROM_HEADER_BUF, HW_TWL_CARD_ROM_HEADER_BUF_SIZE ); + } + + // デバッガによるROMエミュレーション時はNTR-ROMヘッダバッファの + // ゲームコマンドパラメータをスクランブルOFF設定に書き換える + if ( SYSM_IsRunOnDebugger() ) + { + // NitroSDKバグ対策でブートメディア種別に関わらずROMヘッダを常時書き換え + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + // カードROMヘッダ(非キャッシュ領域)は常時設定 + ch->s.game_cmd_param = SYSMi_GetWork()->gameCommondParam; + + // この処理は、DSダウンロードプレイ側で行う。 + // MI_CpuCopyFast ( ch, (void *)MB_CARD_ROM_HEADER_ADDRESS, 0x160); + + // ブラックリストをチェックし、起動制限をかける + BOOTi_CheckTitleBlackList( (void*)th ); + + // マウント情報を一時的にSYSM_TWL_MOUNT_INFO_TMP_BUFFERに登録 + // ここまでにSYSM_APP_ROM_HEADER_BUFのキャッシュがライトバックされている必要あり + SYSMi_SetBootAppMountInfo( &SYSMi_GetWork2()->bootTitleProperty ); + + // FSによってshared領域にコピーされたランチャー自身のマウントパスのクリア + MI_CpuClearFast((char *)HW_TWL_FS_BOOT_SRL_PATH_BUF, OS_MOUNT_PATH_LEN); + + // NAND/TMPアプリ用KeyTableの生成 + if( ! SYSMi_GetWork()->flags.arm9.isCardBoot ) + { + HOTSWi_MakeBlowfishTableDSForNAND(); + } + // ARM9FLXの先頭2k暗号オブジェクトをデクリプト + { + // 再配置情報があればそちらのアドレス、なければヘッダ指定のアドレス + void *addr = (SYSMi_GetWork()->romRelocateInfo[0].src != NULL) ? SYSMi_GetWork()->romRelocateInfo[0].src : dh->s.main_ram_address; + HOTSWi_SetSecureSegmentBuffer(HOTSW_MODE1, addr, SECURE_AREA_SIZE); + HOTSW_DecryptObjectFile( addr ); + } + + // TWL/NTRモード判定 + if ( ! dh->s.platform_code || + (SYSM_IsRunOnDebugger() && ((SYSMRomEmuInfo*)HOTSW_GetRomEmulationBuffer())->isForceNTRMode) ) + { + isNtrMode = TRUE; + } + else + { + isNtrMode = FALSE; + } + + // NTRモード時にはARM9やDMAがメインメモリをアクセスしていないタイミングでデータ非保持モードへ切り替え(フリーズ対策) + if ( isNtrMode ) + { + // ARM9がOS_Haltに達するまで待つ(0.1msec) + OS_SpinWait(HW_CPU_CLOCK_ARM7 / 10000); + BOOTi_SetMainMemModeForNTR(); + } + + BOOTi_ClearREG_RAM(); // ARM7側のメモリ&レジスタクリア。 + reg_MI_MBK9 = 0; // 全WRAMのロック解除 + reg_PXI_MAINPINTF = MAINP_SEND_IF | 0x0100; // ARM9に対してブートするようIRQで要求+ARM7のステートを1にする。 + + // 鍵情報の引渡しを行う。 + // ブートアプリのROMヘッダのaccessKeyControl情報を見て判定 + SYSMi_SetAESKeysForAccessControl( isNtrMode, th ); + + // SDK共通リブート + { + int list_count = PRE_CLEAR_NUM_MAX + 1; + int l; + u32 *post_clear_list; + + *target = REBOOT_TARGET_TWL_SYSTEM; + + // copy forwardリスト設定 + // マウント情報 + if( !isNtrMode ) + { + mem_list[list_count++] = SYSM_TWL_MOUNT_INFO_TMP_BUFFER; + mem_list[list_count++] = (u32)th->s.sub_mount_info_ram_address; + mem_list[list_count++] = SYSM_MOUNT_INFO_SIZE + OS_MOUNT_PATH_LEN; + } + // モジュール再配置コピーforward + for( l=0; lromRelocateInfo[l].src != NULL && !SYSMi_GetWork()->romRelocateInfo[l].rev ) + { + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].src; + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].dest; + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].length; + } + } + mem_list[list_count++] = NULL; + + // copy backwardリスト設定 + // モジュール再配置コピーbackward + for( l=0; lromRelocateInfo[l].src != NULL && SYSMi_GetWork()->romRelocateInfo[l].rev ) + { + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].src; + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].dest; + mem_list[list_count++] = SYSMi_GetWork()->romRelocateInfo[l].length; + } + } + // NTRシステム領域コピー(pre clearの消去範囲へ含まれるようになったため) + if( isNtrMode ) + { + mem_list[list_count++] = HW_MAIN_MEM_SHARED; + mem_list[list_count++] = 0x02800000 - HW_MAIN_MEM_SHARED_SIZE; + mem_list[list_count++] = HW_MAIN_MEM_SHARED_SIZE; + } + mem_list[list_count++] = NULL; + + // post clearリスト設定 + if ( ! isNtrMode ) + { + post_clear_list = twl_post_clear_list; + BOOTi_CutAwayRegionList( post_clear_list, (u32)th->s.main_ltd_ram_address, (u32)th->s.main_ltd_ram_address + th->s.main_ltd_size); + BOOTi_CutAwayRegionList( post_clear_list, (u32)th->s.sub_ltd_ram_address, (u32)th->s.sub_ltd_ram_address + th->s.sub_ltd_size); + }else + { + post_clear_list = nitro_post_clear_list; + // NTR-IPLと同様にシステム領域直前をクリアしておく + // [TODO:] すでにpost_clear_listに含まれている気がする。要確認 + mem_list[list_count++] = 0x02800000 - OS_BOOT_SYS_CLR_SIZE; + mem_list[list_count++] = OS_BOOT_SYS_CLR_SIZE - HW_MAIN_MEM_SHARED_SIZE; + } + BOOTi_CutAwayRegionList( post_clear_list, (u32)dh->s.main_ram_address, (u32)dh->s.main_ram_address + dh->s.main_size); + BOOTi_CutAwayRegionList( post_clear_list, (u32)dh->s.sub_ram_address, (u32)dh->s.sub_ram_address + dh->s.sub_size); + for( l=0; post_clear_list[l]!=NULL ; l+=2 ) + { + mem_list[list_count++] = post_clear_list[l]; + mem_list[list_count++] = post_clear_list[l+1] - post_clear_list[l]; + } + mem_list[list_count] = NULL; + // REBOOTコアコードとスタックの隙間サイズを算出 + mem_list[CLRLIST_REBOOT_STACK_PAD_SIZE_IDX] = OS_BOOT_STACK_TOP - REBOOT_GetCoreStackSize(mem_list) - OS_BOOT_CODE_BUF_END; + + // サウンド停止 + SND_Shutdown(); + + // アプリケーション選択 + if ( ! isNtrMode ) + { + if ( th->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK ) + { + if ( th->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) + { + *target = REBOOT_TARGET_TWL_SECURE; + } + else + { + *target = REBOOT_TARGET_TWL_SYSTEM; + } + } + else + { + *target = REBOOT_TARGET_TWL_APP; + } + } + else + { + *target = REBOOT_TARGET_DS_APP; + } + + // I2S停止(MCLKは動作継続) + reg_SND_SMX_CNT &= ~REG_SND_SMX_CNT_E_MASK; + + spiLockId = (u32)OS_GetLockID(); + if (spiLockId == OS_LOCK_ID_ERROR) + { + OS_Warning("%s: OS_GetLockID failed.\n", __FUNCTION__); + } + SPI_Lock(spiLockId); // CODEC用SPI排他ロック + + // CODEC再初期化 + CDC_Init(); + + // CODEC-DSモードへの遷移 + if ( isNtrMode || th->s.exFlags.codec_mode == OS_CODECMODE_NITRO ) + { + // DSタイトルのスピーカ設定を行う + if ( *target == REBOOT_TARGET_DS_APP ) + { + DS_SetSpeakerVolume( dh ); + } + CDC_GoDsMode(); + } + + SPI_Unlock(spiLockId); // CODEC用SPI排他ロック + + // I2S再開 + // DSサウンド:DSP = 8:0 + // 32KHz + reg_SND_SMX_CNT = REG_SND_SMX_CNT_MIX_RATE_MASK | + REG_SND_SMX_CNT_E_MASK; + + // USG以前のDSアプリには無線パッチを適用 + // ARM9はロードアドレスをキャッシュストアしておく必要あり + if ( *target == REBOOT_TARGET_DS_APP ) + { + DS_InsertWLPatch( dh ); + } + } +} + +static void BOOTi_SetMainMemModeForNTR( void ) +{ + BOOTi_SetMainMemModeForNTRCore(HW_TWL_MAIN_MEM_END - 2); + BOOTi_SetMainMemModeForNTRCore(HW_TWL_MAIN_MEM_EX_END - 2); +} + +asm void BOOTi_SetMainMemModeForNTRCore( u32 addr ) +{ + ldr r1, =MMEM_TCR0 + ldr r2, =MMEM_TCR1_DS + ldrh r3, [r0] + strh r3, [r0] + strh r3, [r0] + ldr r3, =MMEM_TCR2 + strh r1, [r0] + strh r2, [r0] + strh r3, [r0] + bx lr +} + +static void BOOTi_ClearREG_RAM( void ) +{ +#ifdef DEBUG_USED_CARD_SLOT_B_ + reg_MI_MC_SWP ^= 0x80; // カードスロットのスワップ +#endif + // カード抜けチェックバッファにカードIDをセット + ((SDKBootCheckInfo*)HW_BOOT_CHECK_INFO_BUF)->nCardID = SYSMi_GetWork()->appCardID; + + *(vu32 *)HW_RESET_PARAMETER_BUF = 0; // リセットバッファをクリア + + // レジスタクリアは基本的に OS_Boot で行う + + // クリアしていないレジスタは、VCOUNT, JOY, PIFCNT, MC-, EXMEMCNT, IME, PAUSE, POWLCDCNT, 他セキュリティ系です。 + (void)OS_ResetRequestIrqMask((u32)~0); + (void)OS_ResetRequestIrqMaskEx((u32)~0); +} + +// 単純リスト要素削除 +static void BOOTi_DeleteElementFromList( u32 *list, u32 index ) +{ + int l; + for( l=(int)index; list[l]!=NULL; l++ ) + { + list[l] = list[l+1]; + } +} + +// 単純リスト要素追加 +static void BOOTi_InsertElementToList( u32 *list, u32 index, u32 value ) +{ + int l = (int)index; + while(list[l]!=NULL) + { + l++; + } + list[l+1] = NULL; + for( ; index= start ) + { + break; + } + } + for( m=l; regionlist[m]!=NULL; m++ ) + { + if( regionlist[m] > end ) + { + break; + } + } + // この時点でregionlist[l]およびregionlist[m]は、start <= regionlist[l], end < regionlist[m]で、且つ最も小さな値 + + if( m % 2 == 1 ) + { + BOOTi_InsertElementToList( regionlist, (u32)m, end ); + // endをリストに追加した場合、mは追加した要素を指すように + } + if( l % 2 == 1 ) + { + BOOTi_InsertElementToList( regionlist, (u32)l, start ); + m++; + // startをリストに追加した場合、mは1増える + l++; + // startをリストに追加した場合、lは追加した要素の次の要素を指すように + } + + // regionlist[l]からregionlist[m-1]までの要素を消す + for( n=l; lrom_version >= 0 ) { + if( ( pBlackList->titleID == pROMH->titleID ) && + ( pBlackList->rom_version == pROMH->rom_version ) ) { + OS_TPrintf( "Hit black list : %c%c%c%c ver.%d...Terminate.\n", + pROMH->titleID_Lo[ 3 ], pROMH->titleID_Lo[ 2 ], pROMH->titleID_Lo[ 1 ], pROMH->titleID_Lo[ 0 ], + pROMH->rom_version ); + OS_Terminate(); + } + pBlackList++; + } +} diff --git a/build/libraries_sysmenu/boot/ARM9/Makefile b/build/libraries_sysmenu/boot/ARM9/Makefile new file mode 100644 index 00000000..554ffa4b --- /dev/null +++ b/build/libraries_sysmenu/boot/ARM9/Makefile @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +#---------------------------------------------------------------------------- + +SRCDIR = ./src + +INCDIR = ../common/include + +SRCS = bootAPI.c + +TARGET_LIB = libboot$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c b/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c new file mode 100644 index 00000000..eddb17aa --- /dev/null +++ b/build/libraries_sysmenu/boot/ARM9/src/bootAPI.c @@ -0,0 +1,218 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: bootAPI.c + + Copyright 2007-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 +#include +#include +#include "reboot.h" +#include "../../../hotsw/ARM7/include/hotswTypes.h" + + +// define data------------------------------------------------------- +#define SUBP_RECV_IF_ENABLE 0x4000 + +// extern data------------------------------------------------------- + +// function's prototype---------------------------------------------- +static void BOOTi_ClearREG_RAM( void ); +static void BOOTi_RebootCallback( void** entryp, void* mem_list, REBOOTTarget* target ); + +// global variables-------------------------------------------------- + +// static variables-------------------------------------------------- + +static REBOOTTarget target; + +// メモリリスト +// バッファオーバランのリスク回避のため不要な鍵はpre clearで消す。 +static u32 mem_list[] = +{ + // pre clear + HW_ITCM, HW_ITCM_SIZE, + //HW_DTCM, HW_DTCM_SIZE, + NULL, + // copy forward + NULL, + // copy backward + NULL, + // post clear + NULL, +}; + +// const data-------------------------------------------------------- +void BOOT_Init( void ) +{ + reg_PXI_SUBPINTF = 0x0000; +} + +static void ie_subphandler( void ) +{ + OS_TPrintf( "INTR SUBP!!\n" ); + OS_SetIrqCheckFlag( OS_IE_SUBP ); +} + +void BOOT_Ready( void ) +{ + // 最適化されるとポインタを初期化しただけでは何もコードは生成されません + ROM_Header *th = (ROM_Header *)SYSM_APP_ROM_HEADER_BUF; // TWL拡張ROMヘッダ(キャッシュ領域、DSアプリには無い) + ROM_Header *dh = (ROM_Header *)(SYSMi_GetWork()->romHeaderNTR); // DS互換ROMヘッダ(非キャッシュ領域) + + // HOTSW終了処理待ち + while( ! HOTSW_isFinalized() ) { + OS_Sleep( 1 ); + } + + // リブート + REBOOTi_SetTwlRomHeaderAddr( th ); + REBOOTi_SetRomHeaderAddr( dh ); + REBOOTi_SetPostFinalizeCallback( BOOTi_RebootCallback ); + OS_Boot( OS_BOOT_ENTRY_FROM_ROMHEADER, mem_list, target ); +} + +// ブート準備をして、ARM7からの通知を待つ。 +// SDKのFinalize処理後に呼び出される +static void BOOTi_RebootCallback( void** entryp, void* mem_list_v, REBOOTTarget* target ) +{ +#pragma unused(entryp) + u32* mem_list = mem_list_v; + ROM_Header *th = (void*)REBOOTi_GetTwlRomHeaderAddr(); + ROM_Header *dh = (void*)REBOOTi_GetRomHeaderAddr(); + BOOL isNtrMode; + + // エントリアドレスの正当性をチェックし、無効な場合は無限ループに入る。 +// SYSMi_CheckEntryAddress(); + +// FinalizeCardPulledOut(); // カード抜け検出終了処理 + BOOTi_ClearREG_RAM(); // レジスタ&RAMクリア + (void)GX_VBlankIntr( FALSE ); + DC_StoreAll(); + + MI_StopAllDma(); // 割り込み禁止状態でDMA停止 + MI_StopAllNDma(); + + (void)OS_SetIrqFunction( OS_IE_SUBP, ie_subphandler ); + OS_EnableInterrupts(); + (void)OS_SetIrqMask( OS_IE_SUBP ); // サブプロセッサ割り込みのみを許可。 + MI_SetWramBank(MI_WRAM_ARM7_ALL); // WRAM0/1の最終配置はOS_Bootで行う + reg_PXI_SUBPINTF = SUBP_RECV_IF_ENABLE | 0x0f00; // ARM9ステートを "0x0f" に + // ※もうFIFOはクリア済みなので、使わない。 + // ARM7からの通知待ち + // この時点でARM7によるdhへのNTR-ROMヘッダをコピーが保証される + OS_WaitInterrupt( 1, OS_IE_SUBP ); + + OS_TPrintf( "INTR SUBP passed!!\n" ); + + // SDKのFinalize処理完了後にブート種別をアプリのものへ変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = SYSMi_GetWork()->appBootType; + + // 割り込みをクリアして最終ブートシーケンスへ。 + reg_PXI_SUBPINTF &= 0x0f00; // サブプロセッサ割り込み許可フラグをクリア + (void)OS_DisableIrq(); + (void)OS_SetIrqMask( 0 ); + (void)OS_ResetRequestIrqMask( (u32)~0 ); + + // TWL/NTRモード判定 + if ( ! dh->s.platform_code || + (SYSM_IsRunOnDebugger() && ((SYSMRomEmuInfo*)HOTSW_GetRomEmulationBuffer())->isForceNTRMode) ) + { + isNtrMode = TRUE; + } + else + { + isNtrMode = FALSE; + } + + // WRAMの配置 + { + MIHeader_WramRegs *pWRAMREGS = (MIHeader_WramRegs *)th->s.main_wram_config_data; + int i; + reg_GX_VRAMCNT_C = pWRAMREGS->main_vrambnk_c; + reg_GX_VRAMCNT_D = pWRAMREGS->main_vrambnk_d; + // WRAM0/1の最終配置はOS_Bootで行う + + // DSP停止 + DSP_ResetOn(); // DSPブロック初期化 + DSP_ResetInterfaceCore(); // DSP-A9IFの初期化 + DSP_PowerOff(); // DSPをOFF + + // TWL拡張WRAM + // ARM7のrebootでクリア + for (i=0; is.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK ) + { + if ( th->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) + { + *target = REBOOT_TARGET_TWL_SECURE; + } + else + { + *target = REBOOT_TARGET_TWL_SYSTEM; + } + } + else + { + *target = REBOOT_TARGET_TWL_APP; + } + } + else + { + *target = REBOOT_TARGET_DS_APP; + } + + // 鍵は不要になるので、消しておく + { + OSFromFirmBuf* fromFirm = (void*)HW_FIRM_FROM_FIRM_BUF; + MI_CpuClearFast(fromFirm, sizeof(OSFromFirmBuf)); + } + } +} + + +// 使用したレジスタ&メモリのクリア +static void BOOTi_ClearREG_RAM( void ) +{ + // 最後がサブプロセッサ割り込み待ちなので、IMEはクリアしない。 + (void)OS_SetIrqMask( 0 ); + (void)OS_ResetRequestIrqMask( (u32)~0 ); + + // レジスタクリアは基本的に OS_Boot で行う +} + diff --git a/build/libraries_sysmenu/boot/Makefile b/build/libraries_sysmenu/boot/Makefile new file mode 100644 index 00000000..6335ad0a --- /dev/null +++ b/build/libraries_sysmenu/boot/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +SUBDIRS = ARM7 ARM9 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/dht/ARM7/Makefile b/build/libraries_sysmenu/dht/ARM7/Makefile new file mode 100644 index 00000000..49a92df2 --- /dev/null +++ b/build/libraries_sysmenu/dht/ARM7/Makefile @@ -0,0 +1,44 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +SRCDIR = ../common/src +SRCS = dht.c + +TARGET_LIB = libdht_sp$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/dht/ARM9/Makefile b/build/libraries_sysmenu/dht/ARM9/Makefile new file mode 100644 index 00000000..58b7d50f --- /dev/null +++ b/build/libraries_sysmenu/dht/ARM9/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +MYSUBDIRS = ./ + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SRCDIR = ../common/src +SRCS = dht.c + +TARGET_LIB = libdht$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +LDIRT_CLEAN = $(REVISION_SRC) + +#---------------------------------------------------------------------------- + +do-build: $(REVISION_SRC) $(MYSUBDIRS) $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/dht/Makefile b/build/libraries_sysmenu/dht/Makefile new file mode 100644 index 00000000..6335ad0a --- /dev/null +++ b/build/libraries_sysmenu/dht/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +SUBDIRS = ARM7 ARM9 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/dht/common/src/dht.c b/build/libraries_sysmenu/dht/common/src/dht.c new file mode 100644 index 00000000..6da8cd33 --- /dev/null +++ b/build/libraries_sysmenu/dht/common/src/dht.c @@ -0,0 +1,841 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - DHT + File: dht.c + + Copyright 2007 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 + + +/* + 定義すると処理時間を表示する +*/ +#define PRINT_PROFILE + +#ifdef PRINT_PROFILE +static int count; +static OSTick profile[0x10]; +#define PROFILE_INIT() (count = 0) +#define PROFILE_COUNT() (profile[count++] = OS_GetTick()) +#else +#define PROFILE_INIT() ((void)0) +#define PROFILE_COUNT() ((void)0) +#define +#endif + +static const u8 g_pubkey_DER[ 0xa2 ] = { + 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xc7, 0xf4, 0x1d, + 0x27, 0x3f, 0xe8, 0xae, 0x7f, 0x7c, 0xbc, 0x9a, 0xae, 0x09, 0x8d, 0x19, 0x26, 0x2e, 0x90, 0x04, + 0x03, 0x13, 0x93, 0xbc, 0xb2, 0xe0, 0x8b, 0x1f, 0x85, 0x48, 0xf5, 0xf6, 0x94, 0x69, 0x3e, 0x05, + 0x1b, 0x97, 0x85, 0x44, 0x6d, 0xa3, 0xcd, 0xa8, 0x01, 0xfe, 0xdc, 0x77, 0x5d, 0xd1, 0xb1, 0x36, + 0x21, 0xfc, 0x80, 0xe8, 0xa6, 0x0e, 0xde, 0x59, 0x76, 0xca, 0x96, 0xcc, 0x87, 0x4c, 0xc3, 0x90, + 0xc6, 0x3b, 0xc8, 0x17, 0x9d, 0x2d, 0xac, 0x45, 0xbc, 0xa7, 0x15, 0xb2, 0xe3, 0xd7, 0x76, 0xfa, + 0x09, 0x8c, 0x55, 0x09, 0x22, 0x95, 0x4b, 0xe7, 0xde, 0xc0, 0x82, 0xf2, 0x02, 0x1a, 0x8a, 0x42, + 0x38, 0x7f, 0xbb, 0x31, 0xd6, 0xa8, 0x36, 0xdc, 0x8d, 0x2c, 0x42, 0x56, 0x51, 0xc1, 0xa3, 0x30, + 0x21, 0x30, 0xef, 0x06, 0x72, 0x0c, 0xa6, 0x55, 0xb7, 0x4f, 0x30, 0x35, 0x1b, 0x02, 0x03, 0x01, + 0x00, 0x01 +}; + +static const u8 hmac_key[] = DHT_HMAC_KEY; // for phase1, phase2 +static const u8 hmac_key2[] = DHT_HMAC_KEY2; // for phase3, phase4 + +static DHTReadFunc imageReadFunc; +static void* imageBuffer; +static u8* fatCache; +static int fatPage; + +/* + 自家製bsearch +*/ + +static void *bsearch(const void *key, const void *base, + size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) +{ + u32 left = 0; + u32 right = nmemb; + + if ( compar((u8*)base + size * (right - 1), key) < 0 ) + { + return NULL; + } + if ( compar((u8*)base + size * left, key) > 0 ) + { + return NULL; + } + + while (left <= right) + { + u32 mid = (left + right) >> 1; + const void* data = (u8*)base + size * mid; + int result = compar(data, key); +//OS_TPrintf("left = %d, mid = %d, right = %d\n", left, mid, right); + if ( !result ) + { + return (void*)data; + } + if ( result < 0 ) + { + left = mid + 1; + } + else + { + right = mid - 1; + } + } + return NULL; +} +static int CompareGameCodeAndVersion(const void* a, const void* b) +{ + return MI_CpuComp8(a, b, 5); +} + +/* +データベースを読み込む (前準備) +*/ +u32 DHT_GetDatabaseLength(const DHTFile* pDHT) +{ + if ( pDHT->header.magic_code != DHT_MAGIC_CODE ) // magic codeチェック + { + OS_TPrintf("Invalid magic code (magic=0x%08X).\n", pDHT->header.magic_code); + return 0; + } + return sizeof(DHTHeader) + pDHT->header.nums * sizeof(DHTDatabase); +} +u32 DHT_GetDatabaseExLength(const DHTFileEx* pDHT) +{ + if ( pDHT->header.magic_code != DHT_MAGIC_CODE_EX ) // magic codeチェック + { + OS_TPrintf("Invalid magic code (magic=0x%08X) [EX].\n", pDHT->header.magic_code); + return 0; + } + return sizeof(DHTHeader) + pDHT->header.nums * sizeof(DHTDatabaseEx); +} +u32 DHT_GetDatabaseAdHocLength(const DHTFileAdHoc* pDHT) +{ + if ( pDHT->header.magic_code != DHT_MAGIC_CODE_ADHOC ) // magic codeチェック + { + OS_TPrintf("Invalid magic code (magic=0x%08X) [AdHoc].\n", pDHT->header.magic_code); + return 0; + } + return sizeof(DHTHeader) + pDHT->header.nums * sizeof(DHTDatabaseAdHoc); +} + +static BOOL DHT_CheckDatabase(const DHTFile* pDHT) +{ + SVCSignHeapContext pool; + static u8 heap[4*1024]; // avoid stack overflow + u8 md1[20]; + u8 md2[20]; + s32 result; + // ファイル署名取り出し + SVC_InitSignHeap(&pool, heap, sizeof(heap)); + SVC_DecryptSign(&pool, md1, pDHT->header.sign, &g_pubkey_DER[29]); + // ハッシュ計算 + SVC_CalcSHA1(md2, DHT_GET_SIGN_TARGET_ADDR(&pDHT->header), DHT_GET_SIGN_TARGET_SIZE(&pDHT->header)); + // 検証 + result = SVC_CompareSHA1(md1, md2); + if ( !result ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("SIGN = % 20B\n", md1); + OS_TPrintfEx("HASH = % 20B\n", md2); + OS_TPrintf("Signature is not valid.\n"); + return FALSE; + } + return TRUE; +} + +BOOL DHT_PrepareDatabase(DHTFile* pDHT, FSFile* fp) +{ + s32 result; + s32 length; + PROFILE_INIT(); + + if ( fp ) + { + // ヘッダ読み込み + PROFILE_COUNT(); + result = FS_ReadFile(fp, &pDHT->header, sizeof(DHTHeader)); + if ( result != sizeof(DHTHeader) ) + { + OS_TPrintf("Cannot read the DHT header (result=%d).\n", result); + return FALSE; + } + // データベース読み込み + PROFILE_COUNT(); + length = (s32)DHT_GetDatabaseLength(pDHT) - (s32)sizeof(DHTHeader); // ヘッダを除く + if ( length < 0 ) + { + OS_TPrintf("Invalid DHT header.\n"); + return FALSE; + } + result = FS_ReadFile(fp, pDHT->database, length); + if ( result != length ) + { + OS_TPrintf("Cannot read the DHT database (result=%d).\n", result); + return FALSE; + } + } + else + { + PROFILE_COUNT(); + PROFILE_COUNT(); + } + + // データベースの検証 + PROFILE_COUNT(); + result = DHT_CheckDatabase(pDHT); + + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to prepare the database.\n"); + OS_TPrintf("%10d msec for reading header.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for reading database.\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for comparing hash.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("\nTotal: %10d msec.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[0])); +#endif + return result; +} + +/* +ROMヘッダに対応するデータベースを手に入れる +*/ +const DHTDatabase* DHT_GetDatabase(const DHTFile* pDHT, const ROM_Header_Short* pROMHeader) +{ + u8 data[5]; + DHTDatabase* db; + PROFILE_INIT(); + + // 準備 + PROFILE_COUNT(); + MI_CpuCopy8( pROMHeader->game_code, data, 4 ); + data[4] = pROMHeader->rom_version; + db = (DHTDatabase*)bsearch(data, pDHT->database, pDHT->header.nums, sizeof(DHTDatabase), CompareGameCodeAndVersion); + if ( !db ) + { + OS_TPrintf("Cannot find the database.\n"); + } +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("%10d msec for searching database.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif + return db; +} +/* +拡張データベースを読み込む (前準備) +*/ + +static BOOL DHT_CheckDatabaseEx(const DHTFileEx* pDHT) +{ + SVCSignHeapContext pool; + static u8 heap[4*1024]; // avoid stack overflow + u8 md1[20]; + u8 md2[20]; + s32 result; + // ファイル署名取り出し + SVC_InitSignHeap(&pool, heap, sizeof(heap)); + SVC_DecryptSign(&pool, md1, pDHT->header.sign, &g_pubkey_DER[29]); + // ハッシュ計算 + SVC_CalcSHA1(md2, DHT_GET_SIGN_TARGET_ADDR(&pDHT->header), DHT_GET_SIGN_TARGET_SIZE_EX(&pDHT->header)); + // 検証 + result = SVC_CompareSHA1(md1, md2); + if ( !result ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("SIGN = % 20B [EX]\n", md1); + OS_TPrintfEx("HASH = % 20B [EX]\n", md2); + OS_TPrintf("Signature is not valid. [EX]\n"); + return FALSE; + } + return TRUE; +} + +BOOL DHT_PrepareDatabaseEx(DHTFileEx* pDHT, FSFile* fp) +{ + s32 result; + s32 length; + PROFILE_INIT(); + + if ( fp ) + { + // ヘッダ読み込み + PROFILE_COUNT(); + result = FS_ReadFile(fp, &pDHT->header, sizeof(DHTHeader)); + if ( result != sizeof(DHTHeader) ) + { + OS_TPrintf("Cannot read the DHT header (result=%d). [EX]\n", result); + return FALSE; + } + // 拡張データベース読み込み + PROFILE_COUNT(); + length = (s32)DHT_GetDatabaseExLength(pDHT) - (s32)sizeof(DHTHeader); // ヘッダを除く + if ( length < 0 ) + { + OS_TPrintf("Invalid DHT header. [EX]\n"); + return FALSE; + } + result = FS_ReadFile(fp, pDHT->database, length); + if ( result != length ) + { + OS_TPrintf("Cannot read the DHT database (result=%d). [EX]\n", result); + return FALSE; + } + } + else + { + PROFILE_COUNT(); + PROFILE_COUNT(); + } + + // 拡張データベースの検証 + PROFILE_COUNT(); + result = DHT_CheckDatabaseEx(pDHT); + + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to prepare the database. [EX]\n"); + OS_TPrintf("%10d msec for reading header. [EX]\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for reading database. [EX]\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for comparing hash. [EX]\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("\nTotal: %10d msec. [EX]\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[0])); +#endif + return result; +} + +/* +ROMヘッダに対応する拡張データベースを手に入れる +*/ +const DHTDatabaseEx* DHT_GetDatabaseEx(const DHTFileEx* pDHT, const ROM_Header_Short* pROMHeader) +{ + u8 data[5]; + DHTDatabaseEx* db; + PROFILE_INIT(); + + // 準備 + PROFILE_COUNT(); + MI_CpuCopy8( pROMHeader->game_code, data, 4 ); + data[4] = pROMHeader->rom_version; + db = (DHTDatabaseEx*)bsearch(data, pDHT->database, pDHT->header.nums, sizeof(DHTDatabaseEx), CompareGameCodeAndVersion); + if ( !db ) + { + OS_TPrintf("Cannot find the database. [EX]\n"); + } +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("%10d msec for searching database. [EX]\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif + return db; +} +/* +個別対応データベースを読み込む (前準備) +*/ + +static BOOL DHT_CheckDatabaseAdHoc(const DHTFileAdHoc* pDHT) +{ + SVCSignHeapContext pool; + static u8 heap[4*1024]; // avoid stack overflow + u8 md1[20]; + u8 md2[20]; + s32 result; + // ファイル署名取り出し + SVC_InitSignHeap(&pool, heap, sizeof(heap)); + SVC_DecryptSign(&pool, md1, pDHT->header.sign, &g_pubkey_DER[29]); + // ハッシュ計算 + SVC_CalcSHA1(md2, DHT_GET_SIGN_TARGET_ADDR(&pDHT->header), DHT_GET_SIGN_TARGET_SIZE_EX(&pDHT->header)); + // 検証 + result = SVC_CompareSHA1(md1, md2); + if ( !result ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("SIGN = % 20B [AdHoc]\n", md1); + OS_TPrintfEx("HASH = % 20B [AdHoc]\n", md2); + OS_TPrintf("Signature is not valid. [AdHoc]\n"); + return FALSE; + } + return TRUE; +} + +BOOL DHT_PrepareDatabaseAdHoc(DHTFileAdHoc* pDHT, FSFile* fp) +{ + s32 result; + s32 length; + PROFILE_INIT(); + + if ( fp ) + { + // ヘッダ読み込み + PROFILE_COUNT(); + result = FS_ReadFile(fp, &pDHT->header, sizeof(DHTHeader)); + if ( result != sizeof(DHTHeader) ) + { + OS_TPrintf("Cannot read the DHT header (result=%d). [AdHoc]\n", result); + return FALSE; + } + // 拡張データベース読み込み + PROFILE_COUNT(); + length = (s32)DHT_GetDatabaseAdHocLength(pDHT) - (s32)sizeof(DHTHeader); // ヘッダを除く + if ( length < 0 ) + { + OS_TPrintf("Invalid DHT header. [AdHoc]\n"); + return FALSE; + } + result = FS_ReadFile(fp, pDHT->database, length); + if ( result != length ) + { + OS_TPrintf("Cannot read the DHT database (result=%d). [AdHoc]\n", result); + return FALSE; + } + } + else + { + PROFILE_COUNT(); + PROFILE_COUNT(); + } + + // 拡張データベースの検証 + PROFILE_COUNT(); + result = DHT_CheckDatabaseAdHoc(pDHT); + + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to prepare the database. [AdHoc]\n"); + OS_TPrintf("%10d msec for reading header. [AdHoc]\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for reading database. [AdHoc]\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for comparing hash. [AdHoc]\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("\nTotal: %10d msec. [AdHoc]\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[0])); +#endif + return result; +} + +/* +ROMヘッダに対応する拡張データベースを手に入れる +*/ +static const DHTDatabaseAdHoc* DHT_GetDatabaseAdHoc(const DHTFileAdHoc* pDHT, const ROM_Header_Short* pROMHeader) +{ + u8 data[5]; + DHTDatabaseAdHoc* db; + PROFILE_INIT(); + + // 準備 + PROFILE_COUNT(); + MI_CpuCopy8( pROMHeader->game_code, data, 4 ); + data[4] = pROMHeader->rom_version; + db = (DHTDatabaseAdHoc*)bsearch(data, pDHT->database, pDHT->header.nums, sizeof(DHTDatabaseAdHoc), CompareGameCodeAndVersion); + if ( !db ) + { + OS_TPrintf("Cannot find the database. [AdHoc]\n"); + } +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("%10d msec for searching database. [AdHoc]\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif + return db; +} + +/* +ハッシュ計算 (1) +読み込み済みデータをチェックする +*/ +void DHT_CheckHashPhase1Init(SVCHMACSHA1Context* ctx, const ROM_Header_Short* pROMHeader) +{ + PROFILE_INIT(); + PROFILE_COUNT(); + // 準備 + SVC_HMACSHA1Init(ctx, hmac_key, sizeof(hmac_key)); + // ヘッダ + SVC_HMACSHA1Update(ctx, pROMHeader, DHT_DS_HEADER_SIZE); +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\n%10d msec for scanning header.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif +} +void DHT_CheckHashPhase1Update(SVCHMACSHA1Context* ctx, const void* ptr, s32 length) +{ + PROFILE_INIT(); + PROFILE_COUNT(); + // ARM9 or ARM7 static + if ( length > 0 ) + { + SVC_HMACSHA1Update(ctx, ptr, (u32)length); + } + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("%10d msec for scanning %d bytes.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0]), length); +#endif +} +BOOL DHT_CheckHashPhase1Final(SVCHMACSHA1Context* ctx, const u8 *hash) +{ + u8 md[20]; + BOOL result; + PROFILE_INIT(); + PROFILE_COUNT(); + SVC_HMACSHA1GetHash(ctx, md); + result = SVC_CompareSHA1(hash, md); + if ( !result ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("DB = % 20B\n", hash); + OS_TPrintfEx("HASH = % 20B\n", md); + OS_TPrintf("%s: hash[0] is not valid.\n", __func__); + } + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("%10d msec for comparing hash.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif + return result; +} +BOOL DHT_CheckHashPhase1(const u8* hash, const ROM_Header_Short* pROMHeader, const void* pARM9, const void* pARM7) +{ + SVCHMACSHA1Context ctx; + BOOL result; + PROFILE_INIT(); + + // 準備&ヘッダ + PROFILE_COUNT(); + DHT_CheckHashPhase1Init(&ctx, pROMHeader); + + // ARM9 Static + DHT_CheckHashPhase1Update(&ctx, pARM9, (s32)pROMHeader->main_size); + // ARM7 Static + DHT_CheckHashPhase1Update(&ctx, pARM7, (s32)pROMHeader->sub_size); + // 検証 + result = DHT_CheckHashPhase1Final(&ctx, hash); + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to check the hash (phase 1).\n"); + OS_TPrintf("\nTotal: %10d msec.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); +#endif + return result; +} + +/* +ハッシュ計算 (2) +対象領域の読み込みとチェックを行う +*/ +static BOOL ImageHMACSHA1Update(SVCHMACSHA1Context* ctx, s32 offset, s32 length, void* arg) +{ + if ( !imageBuffer || !imageReadFunc ) + { + return FALSE; + } + if ( !imageReadFunc(imageBuffer, offset, length, arg) ) + { + return FALSE; + } + SVC_HMACSHA1Update(ctx, imageBuffer, (u32)length); + return TRUE; +} + +static BOOL GetOverlayInfo(int no, int fat_offset, int* pOffset, int* pLength, DHTReadFunc func, void* arg) +{ + ROM_FAT *fat; + int page = (fat_offset + no * (s32)sizeof(ROM_FAT)) / DHT_FAT_PAGE_SIZE; + if ( !fatCache ) + { + return FALSE; + } + if ( fatPage != page ) + { + if ( fatPage + 1 == page ) // 1ページはキャッシュ済み + { + MI_CpuCopy8( &fatCache[DHT_FAT_PAGE_SIZE], &fatCache[0], DHT_FAT_PAGE_SIZE ); + if ( !func(&fatCache[DHT_FAT_PAGE_SIZE], (page+1) * DHT_FAT_PAGE_SIZE, DHT_FAT_PAGE_SIZE, arg) ) + { + return FALSE; + } + } + else // 通常は2ページ読み + { + if ( !func(fatCache, page * DHT_FAT_PAGE_SIZE, DHT_FAT_CACHE_SIZE, arg) ) + { + return FALSE; + } + } + fatPage = page; + } + fat = (ROM_FAT*)(fatCache + fat_offset + no * sizeof(ROM_FAT) - page * DHT_FAT_PAGE_SIZE); + if ( pOffset ) + { + *pOffset = (s32)fat->top.offset; + } + if ( pLength ) + { + *pLength = (s32)(fat->bottom.offset - fat->top.offset); + } + return TRUE; +} + +BOOL DHT_CheckHashPhase2(const u8* hash, const ROM_Header_Short* pROMHeader, DHTPhase2Work* work, DHTReadFunc func, void* arg) +{ + imageBuffer = work->buffer; + imageReadFunc = func; + return DHT_CheckHashPhase2Ex(hash, pROMHeader, (DHTPhase2ExWork*)work->fatCache, func, ImageHMACSHA1Update, arg); +} + +BOOL DHT_CheckHashPhase2Ex(const u8* hash, const ROM_Header_Short* pROMHeader, DHTPhase2ExWork* work, DHTReadFunc func, DHTReadFuncEx funcEx, void* arg) +{ + int overlay_nums = (int)(pROMHeader->main_ovt_size / sizeof(ROM_OVT)); + u8 md[20]; + PROFILE_INIT(); + + if ( overlay_nums ) + { + SVCHMACSHA1Context ctx; + int total_sectors; + int i; + + if ( !func || !funcEx || !work ) + { + return FALSE; + } + fatCache = work->fatCache; + fatPage = -2; // default value = out of range + + // 準備 + PROFILE_COUNT(); + SVC_HMACSHA1Init(&ctx, hmac_key, sizeof(hmac_key)); + // OVT + PROFILE_COUNT(); + if ( !funcEx(&ctx, (s32)pROMHeader->main_ovt_offset, (s32)pROMHeader->main_ovt_size, arg) ) + { + OS_TPrintf("Cannot calc HMAC-SHA1 for OVT.\n"); + return FALSE; + } + // FAT + PROFILE_COUNT(); + if ( !funcEx(&ctx, (s32)pROMHeader->fat_offset, overlay_nums * (s32)sizeof(ROM_FAT), arg) ) + { + OS_TPrintf("Cannot calc HMAC-SHA1 for %d of FAT.\n", overlay_nums); + return FALSE; + } + // 各オーバーレイ + PROFILE_COUNT(); + total_sectors = 0; + for (i = 0; i < overlay_nums; i++) + { + int max_sectors = (DHT_OVERLAY_MAX/512 - total_sectors) / (overlay_nums - i); + int offset; + int length; + if ( !GetOverlayInfo(i, (s32)pROMHeader->fat_offset, &offset, &length, func, arg) ) + { + OS_TPrintf("Cannot get %d of overlay info.\n", i); + return FALSE; + } + length = (length + 511) / 512; // bytes -> sectors + if ( length > max_sectors ) + { + length = max_sectors; + } + if ( length < 0 || offset < sizeof(ROM_Header) ) + { + OS_TPrintf("Broken FAT for %d of overlay.\n", i); + return FALSE; + } + if ( !funcEx(&ctx, offset, length * 512, arg) ) + { + OS_TPrintf("Cannot calc HMAC-SHA1 for %d of overlay.\n", i); + return FALSE; + } + total_sectors += length; + } + // 検証 + PROFILE_COUNT(); + SVC_HMACSHA1GetHash(&ctx, md); + } + else + { + PROFILE_COUNT(); + PROFILE_COUNT(); + PROFILE_COUNT(); + PROFILE_COUNT(); + PROFILE_COUNT(); + MI_CpuClear8(md, sizeof(md)); + } + if ( !SVC_CompareSHA1(md, hash) ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("DB = % 20B\n", hash); + OS_TPrintfEx("HASH = % 20B\n", md); + OS_TPrintf("%s: hash[1] is not valid.\n", __func__); + return FALSE; + } + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to check the hash (phase 2).\n"); + OS_TPrintf("%10d msec for preparing hash.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for scanning OVT.\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for scanning FAT.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("%10d msec for scanning every overlays.\n", (int)OS_TicksToMilliSeconds(profile[4]-profile[3])); + OS_TPrintf("%10d msec for comparing hash.\n", (int)OS_TicksToMilliSeconds(profile[5]-profile[4])); + OS_TPrintf("\nTotal: %10d msec.\n", (int)OS_TicksToMilliSeconds(profile[5]-profile[0])); +#endif + return TRUE; +} + +void DHT_CheckHashPhase2ExUpdate(SVCHMACSHA1Context* ctx, const void* ptr, s32 length) +{ + // ARM9 or ARM7 static + if ( length > 0 ) + { + SVC_HMACSHA1Update(ctx, ptr, (u32)length); + } +} + +/* +ハッシュ計算 (3) +バナーデータをチェックする +*/ +BOOL DHT_CheckHashPhase3(const u8 *hash, const NTRBannerFile* pBanner) +{ + SVCHMACSHA1Context ctx; + u8 md[20]; + + PROFILE_INIT(); + PROFILE_COUNT(); + SVC_HMACSHA1Init(&ctx, hmac_key2, sizeof(hmac_key2)); + + // バナーの読み込み (ヘッダ) + PROFILE_COUNT(); + SVC_HMACSHA1Update(&ctx, &pBanner->h, sizeof(BannerHeader)); + + // バナーの読み込み (ボディ) + if (pBanner->h.version == 0) + { + OS_TPrintf("Invalid banner format.\n"); + return FALSE; + } + PROFILE_COUNT(); + if ( pBanner->h.version >= 1 ) + { + SVC_HMACSHA1Update(&ctx, &pBanner->v1, sizeof(BannerFileV1)); + } + PROFILE_COUNT(); + if ( pBanner->h.version >= 2 ) + { + SVC_HMACSHA1Update(&ctx, &pBanner->v2, sizeof(BannerFileV2)); + } + PROFILE_COUNT(); + if ( pBanner->h.version >= 3 ) + { + SVC_HMACSHA1Update(&ctx, &pBanner->v3, sizeof(BannerFileV3)); + } + + // 検証 + PROFILE_COUNT(); + SVC_HMACSHA1GetHash(&ctx, md); + if ( !SVC_CompareSHA1(md, hash) ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("DB = % 20B\n", hash); + OS_TPrintfEx("HASH = % 20B\n", md); + OS_TPrintf("%s: banner_hash is not valid.\n", __func__); + return FALSE; + } + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to check the hash (phase 3).\n"); + OS_TPrintf("%10d msec for preparing hash.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for scanning header.\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for scanning V1 body.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("%10d msec for scanning V2 body.\n", (int)OS_TicksToMilliSeconds(profile[4]-profile[3])); + OS_TPrintf("%10d msec for scanning V3 body.\n", (int)OS_TicksToMilliSeconds(profile[5]-profile[4])); + OS_TPrintf("%10d msec for comparing hash.\n", (int)OS_TicksToMilliSeconds(profile[6]-profile[5])); + OS_TPrintf("\nTotal: %10d msec.\n", (int)OS_TicksToMilliSeconds(profile[6]-profile[0])); +#endif + return TRUE; +} + +/* +ハッシュ計算 (4) +個別対応 +*/ +BOOL DHT_CheckHashPhase4(const DHTFileAdHoc* pDHT, const ROM_Header_Short* pROMHeader, DHTPhase4Work* work, DHTReadFunc func, void* arg) +{ + imageBuffer = work->buffer; + imageReadFunc = func; + return DHT_CheckHashPhase4Ex(pDHT, pROMHeader, ImageHMACSHA1Update, arg); +} + +BOOL DHT_CheckHashPhase4Ex(const DHTFileAdHoc* pDHT, const ROM_Header_Short* pROMHeader, DHTReadFuncEx funcEx, void* arg) +{ + const DHTDatabaseAdHoc* plist; + SVCHMACSHA1Context ctx; + int i; + u8 md[20]; + PROFILE_INIT(); + + if ( !funcEx || !pDHT || !pROMHeader ) + { + return FALSE; + + } + + plist = DHT_GetDatabaseAdHoc(pDHT, pROMHeader); + + if ( !plist ) + { + return TRUE; // not found in individual list + } + + // 準備 + PROFILE_COUNT(); + SVC_HMACSHA1Init(&ctx, hmac_key2, sizeof(hmac_key2)); + + for (i = 0; i < DHT_INDIVIDUAL_ENTRY_MAX; i++) + { + if (plist->entry[i].offset == 0) + { + break; + } + if ( !funcEx(&ctx, (s32)plist->entry[i].offset, (s32)plist->entry[i].length, arg) ) + { + OS_TPrintf("Cannot read the phase 3 for %.4s(%x).\n", pROMHeader->game_code, pROMHeader->rom_version); + return FALSE; + } + } + // 検証 + PROFILE_COUNT(); + SVC_HMACSHA1GetHash(&ctx, md); + + if ( !SVC_CompareSHA1(md, plist->hash) ) + { + OS_TPrintf("\n"); + OS_TPrintfEx("DB = % 20B\n", plist->hash); + OS_TPrintfEx("HASH = % 20B\n", md); + OS_TPrintf("%s: phase4list->hash is not valid.\n", __func__); + return FALSE; + } + // 結果報告 +#ifdef PRINT_PROFILE + PROFILE_COUNT(); + OS_TPrintf("\nDone to check the hash (phase 3).\n"); + OS_TPrintf("%10d msec for preparing hash.\n", (int)OS_TicksToMilliSeconds(profile[1]-profile[0])); + OS_TPrintf("%10d msec for scanning regions.\n", (int)OS_TicksToMilliSeconds(profile[2]-profile[1])); + OS_TPrintf("%10d msec for comparing hash.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[2])); + OS_TPrintf("\nTotal: %10d msec.\n", (int)OS_TicksToMilliSeconds(profile[3]-profile[0])); +#endif + return TRUE; +} + diff --git a/build/libraries_sysmenu/ds/ARM7/Makefile b/build/libraries_sysmenu/ds/ARM7/Makefile new file mode 100644 index 00000000..7c86eab0 --- /dev/null +++ b/build/libraries_sysmenu/ds/ARM7/Makefile @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# 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:: 2008-02-07#$ +# $Rev: 612 $ +# $Author: yutaka $ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +#---------------------------------------------------------------------------- + +SRCDIR = ./src \ + ../common/src + +INCDIR = ../common/include \ + $(ROOT)/build/libraries/mb/common/include \ + +SRCS = ds_wlpatch.c \ + ds_volume.c + +TARGET_LIB = libds_sp$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/ds/ARM7/src/ds_volume.c b/build/libraries_sysmenu/ds/ARM7/src/ds_volume.c new file mode 100644 index 00000000..588d1061 --- /dev/null +++ b/build/libraries_sysmenu/ds/ARM7/src/ds_volume.c @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: ds_volume.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 + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define NUM_OF_MIC_PROBLEM_TITLE 128 + +/*---------------------------------------------------------------------------* + 型宣言 + *---------------------------------------------------------------------------*/ + +typedef struct _DsMicProblemTitle +{ + u8 gamecode[4]; // NULL終端兼アライメント用に1バイト大きいサイズを与える + +} DsMicProblemTitle; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ + +static DsMicProblemTitle sList[NUM_OF_MIC_PROBLEM_TITLE] ATTRIBUTE_ALIGN(32) = +{ + "ABX", + "YO9", + "ALH", + "ACC", + "YCQ", + "YYK", + "AZW", + "AKA", + "AN9", + "AKE", + "YFS", + "YG8", + "AY7", + "YON", + "A5H", + "A5I", + "AMH", + "A3T", + "YBO", + "ADA", + "APA", + "CPU", + "APY", + "AWH", + "AXB", + + "A4U", + "A8N", + "ABJ", + "ABN", + "ACL", + "ART", + "AVT", + "AWY", + "AXJ", + "AYK", + "YB2", + "YB3", + "YCH", + "YFE", + "YGD", + "YKR", + "YRM", + "YW2", + "AJU", + "ACZ", + "AHD", + "ANR", + "YT3", + "AVI", + "AV2", + + "AV3", + "AV4", + "AV5", + "AV6", + "YNZ", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + "000", + + "000", + "000", + "000" +}; + +/*---------------------------------------------------------------------------* + グローバル関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: DS_SetSpeakerVolume + + Description: DSタイトルのスピーカ音量を設定します。 + マイク入力関係で問題の発生するタイトルは音量をNTRレベルに + 抑えます。 + + Arguments: romHeaderNTR: DSタイトルのROMヘッダ + + Returns: None + *---------------------------------------------------------------------------*/ +void DS_SetSpeakerVolume( void* romHeaderNTR ) +{ + ROM_Header* dh = romHeaderNTR; + u32 arg_gamecode = *(u32 *)dh->s.game_code & 0x00ffffff; + BOOL hit = FALSE; + int i; + + // 負荷をなるべく一定にするためリストと一致した場合でも全リストをチェックする + for (i=0;i +#include +#include +#include "mb_fileinfo.h" + +// define data---------------------------------------------------------- +#define SWI_NO_CPU_SET_FAST ( 12 << 16 ) // SVC_CpuSetFast() + +#define SDK_VER_30 0x03000000 +#define SDK_VER_22_RELEASE_PLUS_3 0x02027533 +#define SDK_VER_30_RC3 0x03004f4c + +#define SDKVER_OFFSET_IN_PATTERN (-4) +#define PATCH1_OFFSET_IN_PATTERN 0x18 +#define PATCH3_OFFSET_IN_PATTERN 0x04 + +// function's prototype------------------------------------------------- +static void* DSi_GetPatchBaseAddr( void ); +static BOOL DSi_IsPatchedSDKVersion( void ); +static u32 DSi_SearchBinaryCore( const u32 *patp, int pat_word_size, int patch_offset ); +static void DSi_SetPatchCodeToREDRsvArea( u32 patch_addr, const u32 *patchp ); +void DSi_CopyWLPatch( void ); + +// extern data---------------------------------------------------------- + +// const data----------------------------------------------------------- + +// SDKバージョン検出用マジックコード +static const u32 sdk_ver_magic_code[] = { + 0xdec00621, + 0x2106c0de, +}; + +// パッチ1対象コード +static const u32 patch1_org[] = { + 0xe59f1028, 0xe59f2028, 0xe1d200b0, 0xe2100001, + 0x1afffffc, 0xe1d100b0, 0xe3500006, 0x0afffff9, + 0xe1d100b0, 0xe3500005, 0x0afffff6, 0xe12fff1e, + 0x04808214, 0x0480819c, +}; + +// パッチ3対象コード +static const u32 patch3_org[] = { + 0xE1D100B0, + 0xE3500006, 0x0AFFFFF9, 0xE1D100B0, 0xE3500005, // patch target( top 20bytes ) + 0x0AFFFFF6, 0xE3A01000, 0xE59F0068, 0xE1C010B0, + 0xE59F0064, 0xE1C010B0, 0xE59F004C, 0xE5900000, + 0xE2800C03, +}; + +// パッチ1コード +static const u32 patch1_code[] = { + 0xe3500005, + 0x312fff1e, + 0xe1d100b0, + 0xe3500008, + 0x9afffff6, +}; + +// パッチ3コード +static const u32 patch3_code[] = { + 0xE3500005, + 0x3A000002, + 0xE1D100B0, + 0xE3500008, + 0x9AFFFFF6, +}; + +// static variables----------------------------------------------------- +static u32 mbSignBuf[MB_AUTHCODE_SIZE / sizeof(u32)] __attribute__ ((aligned(32))); +static ROM_Header *dh; // DS互換ROMヘッダ + +// function's description----------------------------------------------- + + +//---------------------------------------------------------------------- +// +// USG-CPU以降におけるARM7コード無線不具合へのパッチ処理 +// ※ゲームのロードが完了した後に本関数をコールして下さい。 +// +//---------------------------------------------------------------------- + +// パッチコードの挿入 +void DS_InsertWLPatch( void* romHeaderNTR ) +{ + dh = romHeaderNTR; + + // SDKバージョンがパッチ対象? + if( DSi_IsPatchedSDKVersion() ) { + // patch1, patch3をサーチ + const u32 *patchp = patch1_code; + u32 patch_addr = DSi_SearchBinaryCore( patch1_org, sizeof( patch1_org ) / sizeof( u32 ), PATCH1_OFFSET_IN_PATTERN ); + + if( patch_addr == 0 ) { + patchp = patch3_code; + patch_addr = DSi_SearchBinaryCore( patch3_org, sizeof( patch3_org ) / sizeof( u32 ), PATCH3_OFFSET_IN_PATTERN ); + } + // パッチ対象コードが見つかったら、パッチコードをセット。 + if( patch_addr ) { + ROM_Header *dh = romHeaderNTR; // DS互換ROMヘッダ + if( SYSMi_GetWork()->cloneBootMode == SYSM_CLONE_BOOT_MODE ) { // ※クローンブートかどうかはDS_CheckROMCloneBoot()で事前に調査。 + // クローンブートならば、直パッチ + SVC_CpuCopyFast( patchp, patch_addr, DS_WLPATCH_SIZE ); + }else { + // それ以外ならば、RED_RSVにパッチコードを挿入。 + // ※パッチアドレスをIPL2の一時格納バッファアドレスから実際のARM7ロードアドレスに変換。 + patch_addr = patch_addr + ((u32)dh->s.sub_entry_address - (u32)DSi_GetPatchBaseAddr()); + DSi_SetPatchCodeToREDRsvArea( patch_addr, patchp ); + dh->s.sub_entry_address = (void *)DS_REDRSV_PATCH_FUNC_ADDR; + } + } + } +} + + +// パッチベースアドレスの取得 +static void* DSi_GetPatchBaseAddr( void ) +{ + void* p = (void*)SYSMi_GetWork()->romRelocateInfo[1].src; + + // 再配置しない場合は + if ( ! p ) + { + void* h = dh->s.sub_ram_address; + if ( h >= (void*)SYSM_NTR_ARM7_LOAD_MMEM && h < (void*)(SYSM_NTR_ARM7_LOAD_MMEM_END - DS_WLPATCH_SIZE) ) + { + p = h; + } + } + + return p; +} + + +// パッチ対象のSDKバージョンかどうか判定 +static BOOL DSi_IsPatchedSDKVersion( void ) +{ + u32 addr; + u32 sdk_ver; + + // SDKバージョンのサーチ + addr = DSi_SearchBinaryCore( sdk_ver_magic_code, sizeof( sdk_ver_magic_code ) / sizeof( u32 ), SDKVER_OFFSET_IN_PATTERN ); + if( addr == 0 ) { + return FALSE; + } + + // SDKバージョンの判定 + sdk_ver = *(u32 *)addr; + + if( sdk_ver >= SDK_VER_30 ) { + if( sdk_ver >= SDK_VER_30_RC3 ) { + return FALSE; + } + }else if( sdk_ver >= SDK_VER_22_RELEASE_PLUS_3 ) { + return FALSE; + } + return TRUE; +} + + +// バイナリサーチ +static u32 DSi_SearchBinaryCore( const u32 *patp, int pat_word_size, int patch_offset ) +{ + u32 *tgtp; + int tgt_word_size; + + if( patp == sdk_ver_magic_code ) { + tgtp = dh->s.main_entry_address; + tgt_word_size = (int)( dh->s.main_size + - ( (int)dh->s.main_entry_address - (int)dh->s.main_ram_address ) ) >> 2; + }else { + tgtp = DSi_GetPatchBaseAddr(); + tgt_word_size = (int)dh->s.sub_size >> 2; + } + + while( tgt_word_size-- ) { + if( *tgtp++ == *patp ) { + const u32 *srcp = patp + 1; + u32 *checkp = tgtp; + int i = pat_word_size - 1; + + if( tgt_word_size < i ) { + break; + } + + while( i-- ) { + if( *srcp++ != *checkp++ ) break; + } + + if( i < 0 ) { + return (u32)( (u32)( tgtp - 1 ) + patch_offset ); + } + } + } + return 0; +} + + +//---------------------------------------------------------------------- +// +// パッチコードのセットおよびパッチ処理の実体 +// +//---------------------------------------------------------------------- + +// パッチコードをシステムのRED予約領域にセット +static void DSi_SetPatchCodeToREDRsvArea( u32 patch_addr, const u32 *patchp ) +{ + u32 *dstp = (u32 *)HW_RED_RESERVED; + u32 *srcp = (u32 *)&DSi_CopyWLPatch; + int i; + + for( i = 0; i < DS_WLPATCH_SIZE/sizeof(u32); i++ ) { + *dstp++ = *patchp++; + } + *dstp++ = patch_addr; + *dstp++ = (u32)dh->s.sub_entry_address; + + for( i = 0; i < DS_WLPATCH_COPYCODE_SIZE/sizeof(u32); i++ ) { + *dstp++ = *srcp++; + } +} + + +#include + + +#if 0 +#define SWI_NO_CPU_SET_FAST (12<<16) +// 他プログラムへ組み込んでテストする時のダミーパッド +asm void WLPatch_Dummy( void ) +{ + nop // patch code (20bytes) + nop + nop + nop + nop + nop // target addr + nop // ARM7 entry addr +} +#endif + + +// WLへパッチを当てるコード実体 +asm void DSi_CopyWLPatch( void ) +{ + add r0, pc, #-0x24 // R0 <- patch1 code addr + ldr r1, [ pc, #-0x14 ] // R1 <- target addr + mov r2, #( 20 / 4 ) // R2 <- copy size / sizeof(u32) + swi SWI_NO_CPU_SET_FAST // SVC_CpuSetFast + ldr r12, [ pc, #-0x1c ] // ARM7 entry address + mov lr, r12 + mov r0, #0 + mov r1, r0 + mov r2, r0 + bx r12 +} + +#include + +/* +#define DMA_SRC_INC 0x00000000 // 転送元 インクリメント 選択 +#define SVC_CpuCopyFast(srcp, destp, size) \ + \ + SVC_CpuSetFast( (u8 *)(srcp), \ + (u8 *)(destp), \ + ( DMA_SRC_INC | ( (size)/(32/8) & 0x1fffff ) ) ) +*/ diff --git a/build/libraries_sysmenu/errorLog/ARM9/Makefile b/build/libraries_sysmenu/errorLog/ARM9/Makefile new file mode 100644 index 00000000..387a0bda --- /dev/null +++ b/build/libraries_sysmenu/errorLog/ARM9/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - NAMUT +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +INCDIR = include + +SRCS = errorLog.c + +TARGET_LIB = liberrorlog$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +CCFLAGS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + -DNO_STDIO_H \ + -DNO_STDLIB_H + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/errorLog/ARM9/src/errorLog.c b/build/libraries_sysmenu/errorLog/ARM9/src/errorLog.c new file mode 100644 index 00000000..9e8a1a28 --- /dev/null +++ b/build/libraries_sysmenu/errorLog/ARM9/src/errorLog.c @@ -0,0 +1,870 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - ErrorLog + File: errorLog.c + + Copyright **** 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$ + *---------------------------------------------------------------------------*/ + +// Fatal error発生時に"nand:/sys/log/sysmenu.log"にログを吐くためのライブラリ + + +#include +#include +#include +#include +#include + + +#define ERRORLOG_DIRECTORYPATH "nand:/sys/log" +#define ERRORLOG_FILEPATH "nand:/sys/log/sysmenu.log" + +#define ERRORLOG_HEADER_SIZE 6 +#define ERRORLOG_WRITE_FORMAT_RED1 "\n\n#RED %02u-%02u-%02u[%3s] %02u:%02u:%02u\n" +#define ERRORLOG_WRITE_FORMAT_RED2 "title: %04s ErrorCode: %u\n%s" +#define ERRORLOG_WRITE_FORMAT1 "\n\n#FFT %02u-%02u-%02u[%3s] %02u:%02u:%02u\n" +#define ERRORLOG_WRITE_FORMAT2 "title: %04s\n%s" +#define ERRORLOG_READ_FORMAT_RED1 "\n\n#RED %d-%d-%d[%3s] %d:%d:%d\n" +#define ERRORLOG_READ_FORMAT_RED2 "title: %4s ErrorCode: %u\n%*s" +#define ERRORLOG_READ_FORMAT1 "\n\n#FFT %d-%d-%d[%3s] %d:%d:%d\n" +#define ERRORLOG_READ_FORMAT2 "title: %4s\n%s" + +#define ERRORLOG_WRITE_FORMAT ERRORLOG_WRITE_FORMAT1 ERRORLOG_WRITE_FORMAT2 +#define ERRORLOG_WRITE_FORMAT_RED ERRORLOG_WRITE_FORMAT_RED1 ERRORLOG_WRITE_FORMAT_RED2 +#define ERRORLOG_READ_FORMAT ERRORLOG_READ_FORMAT1 ERRORLOG_READ_FORMAT2 +#define ERRORLOG_READ_FORMAT_RED ERRORLOG_READ_FORMAT_RED1 ERRORLOG_READ_FORMAT_RED2 + +#define ERRORLOG_NUM_ARGS 9 + +#define ERRORLOG_STR_OFFSET 42 + + + +// 内部関数SYSMi_CheckAndCreateDirectoryのエラーチェッカ +typedef enum CheckStatus { + CHECK_EXIST = 0, + CHECK_CREATE = 1, + CHECK_FAILED = 2 +} CheckStatus; + + +/*-- global variables ----------------------*/ + +ErrorLogWork elWork; +static BOOL isInitialized = FALSE; + +/*-- function prototype ----------------------*/ +CheckStatus ERRORLOGi_CheckAndCreateDirectory( const char *path ); +CheckStatus ERRORLOGi_CheckAndCreateFile( const char *path ); +int ERRORLOGi_ReadEntry( void ); +BOOL ERRORLOGi_SetString( char *buf, ErrorLogEntry *entry ); +BOOL ERRORLOGi_addNewEntryRED( int idx, RTCDate *date, RTCTime *time, int errorCode ); +void ERRORLOGi_addNewEntry( int idx, RTCDate *date, RTCTime *time, const char *fmt, va_list arglist ); +void ERRORLOGi_WriteLogToBuf( char *buf ); +BOOL ERRORLOGi_WriteLogToFile( char *buf ); +void ERRORLOGi_fillSpace( char *buf, int bufsize ); +BOOL ERRORLOGi_WriteCommon( BOOL isLauncherError, u64 errorCode, const char *fmt, va_list arglist ); +u32 ERRORLOGi_getTitleId( void ); + +static char *s_strWeek[7]; +static char *s_strError[FATAL_ERROR_MAX]; + + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_Init + + Description: Errorlogライブラリ用の初期化関数です。 + + + Arguments: Alloc: メモリ確保用の関数です。 + Free: メモリ開放用の関数です。 + + Returns: 成功すればTRUEを、失敗すればFALSEを返します。 + *---------------------------------------------------------------------------*/ +BOOL ERRORLOG_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) ) +{ + if( isInitialized ) + { + return FALSE ; + } + + SDK_POINTER_ASSERT(AllocFunc); + SDK_POINTER_ASSERT(FreeFunc); + + elWork.Alloc = AllocFunc; + elWork.Free = FreeFunc; + + OS_InitMutex( &elWork.mutex ); + OS_LockMutex( &elWork.mutex ); + + // ログ読み出し用のバッファを確保 + if( elWork.entry == NULL ) + { + elWork.entry = (ErrorLogEntry*) elWork.Alloc ( sizeof (ErrorLogEntry) * ERRORLOG_NUM_ENTRY ); + MI_CpuClear8( elWork.entry, sizeof (ErrorLogEntry) * ERRORLOG_NUM_ENTRY); + } + + SDK_ASSERT( elWork.entry ); + + if( !FS_IsAvailable() ) + { + // FSがInitされてなかったらInitする + FS_Init( FS_DMA_NOT_USE ); + } + + FS_InitFile( &elWork.file ); + + // ファイルの存在確認 + if( ERRORLOGi_CheckAndCreateDirectory( ERRORLOG_DIRECTORYPATH ) == CHECK_FAILED ) + { + OS_UnlockMutex( &elWork.mutex ); + return FALSE; + } + + // ファイルの存在を確認、ついでに中でオープンしてエントリの読み込み + switch ( ERRORLOGi_CheckAndCreateFile( ERRORLOG_FILEPATH ) ) + { + case CHECK_FAILED: + OS_UnlockMutex( &elWork.mutex ); + return FALSE; + break; + + case CHECK_EXIST: + // 既にログファイルが存在していたら、そこからログを読み出す + elWork.numEntry = ERRORLOGi_ReadEntry(); + break; + + case CHECK_CREATE: + // 新規にファイルが作られたなら何もしなくていい + break; + } + + FS_CloseFile( &elWork.file ); + OS_UnlockMutex( &elWork.mutex ); + isInitialized = TRUE; + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_End + + Description: Errorlogライブラリの終了処理を行います。 + 再度ELライブラリを利用するためにはErrorLog_Initを呼ぶ必要があります。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ERRORLOG_End( void ) +{ + int idx; + + for( idx = 0; idx < ERRORLOG_NUM_ENTRY ; idx++ ) + { + if( elWork.entry[idx].errorStr != NULL ) + { + elWork.Free( elWork.entry[idx].errorStr ); + } + } + + elWork.Free( elWork.entry ); + + isInitialized = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_Printf + + Description: nand:/sys/log/sysmenu.logにエラーログをフリーな形式で書き込みます。 + + Arguments: : printfに準拠 + + Returns: 書き込みに成功したときはTRUEを、失敗したときはFALSEを返します。 + *---------------------------------------------------------------------------*/ +BOOL ERRORLOG_Printf( const char *fmt, ... ) +{ + BOOL result = TRUE; + va_list arglist; + + if( !isInitialized ) + { + return FALSE; + } + + OS_LockMutex( &elWork.mutex ); + va_start( arglist, fmt ); + result = ERRORLOGi_WriteCommon( FALSE, 0, fmt, arglist ); + va_end( arglist ); + OS_UnlockMutex( &elWork.mutex ); + + return result; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_Write + + Description: nand:/sys/log/sysmenu.logにエラーログを出力します。 + + Arguments: errorCode: 発生したエラーのエラーコード + + Returns: 書き込みに成功したときはTRUEを、失敗したときはFALSEを返します。 + *---------------------------------------------------------------------------*/ +BOOL ERRORLOG_Write( u64 errorCode ) +{ + BOOL res; + + if( !isInitialized ) + { + return FALSE; + } + + OS_LockMutex( &elWork.mutex ); + res = ERRORLOGi_WriteCommon( TRUE, errorCode, NULL, NULL ); + OS_UnlockMutex( &elWork.mutex ); + + return res; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_WriteCommon + + Description: + + Arguments: isLauncherError: ERRORLOG_Writeから呼ばれた場合はTRUE、 + ERRORLOG_Printfから呼ばれた場合はFALSEとなります。 + errorCode: isLauncherErrorがTRUEな時に書き込まれるエラーコード + fmt, ...: isLauncherErrorがFALSEな時に書き込まれる文字列と引数 + + Returns: 書き込みに成功したときはTRUEを、失敗したときはFALSEを返します。 + *---------------------------------------------------------------------------*/ + +BOOL ERRORLOGi_WriteCommon( BOOL isLauncherError, u64 errorCode, const char *fmt, va_list arglist ) +{ + int bufBeginPoint = 0; // リングバッファの開始点 + int numEntry = 0; + int counter = 0; + int retry = 3; + + RTCDate date; + RTCTime time; + + char *writeBuf; + + writeBuf = (char*) elWork.Alloc( ERRORLOG_SIZE ); + SDK_ASSERT( writeBuf ); + + // RTCが初期化されていない場合の保険 + RTC_Init(); + + // 新しいログエントリを書き込むためのRTCリード + while( retry-- > 0 ) { + if( RTC_GetDateTime( &date, &time ) == RTC_RESULT_SUCCESS ) { + break; + } + OS_Sleep(1); + } + if( retry < 0 ) { + // RTCリードに失敗した場合でも、オール0の値をセットして続行(マルチスレッド動作時にRTCアクセスは失敗する可能性がある) + MI_CpuClear8( &date, sizeof(RTCDate) ); + MI_CpuClear8( &time, sizeof(RTCTime) ); + } + + if( isLauncherError ) + { + for(counter = 0; counter < FATAL_ERROR_MAX; counter++ ) + { + if( ( errorCode >> counter ) & 0x1LL ) + { + // 末尾のビットが立っていたらエントリに入れてバッファ開始点を進める + ERRORLOGi_addNewEntryRED( elWork.numEntry % ERRORLOG_NUM_ENTRY , &date, &time, counter ); + elWork.numEntry++; + } + } + } + else + { + ERRORLOGi_addNewEntry( elWork.numEntry % ERRORLOG_NUM_ENTRY, &date, &time, fmt, arglist ); + elWork.numEntry++; + } + + // まずエントリをもとにバッファに書き込む + ERRORLOGi_WriteLogToBuf( writeBuf ); + + // 最終的にファイルを書き込む + if( !ERRORLOGi_WriteLogToFile( writeBuf ) ) + { + elWork.Free( writeBuf ); + return FALSE; + } + + elWork.Free( writeBuf ); + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_GetNum + + Description: 読み出したエントリ数を取得します。 + + Arguments: なし。 + + Returns: ログファイルから読み出したエントリ数を返します。 + *---------------------------------------------------------------------------*/ + +int ERRORLOG_GetNum() +{ + return elWork.numEntry < ERRORLOG_NUM_ENTRY ? elWork.numEntry : ERRORLOG_NUM_ENTRY; +} + + +/*---------------------------------------------------------------------------* + Name: ERRORLOG_Read + + Description: 指定したナンバのエラーログエントリへのポインタを取得します。 + + Arguments: idx: エントリ番号の指定 + + Returns: idx番目のエントリへのポインタです。 + *---------------------------------------------------------------------------*/ + +const ErrorLogEntry* ERRORLOG_Read( int idx ) +{ + if( idx >= 0 && idx < ERRORLOG_NUM_ENTRY ) + { + return &elWork.entry[idx]; + } + else + { + return NULL; + } +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_addNewEntryRED + + Description: エラーコードとRTCデータをエラーログのエントリに追加します。 + + Arguments: int: エントリを挿入するインデクス + date: 日付データ + time: 時刻データ + errorCode: エラーコード + + Returns: FATAL_ERROR_MAXを超えるエラーコードが渡された場合はFALSEを、 + それ以外のときはTRUEを返します。 + *---------------------------------------------------------------------------*/ + + +BOOL ERRORLOGi_addNewEntryRED( int idx, RTCDate *date, RTCTime *time, int errorCode ) +{ + + if( errorCode >= FATAL_ERROR_MAX ) + { + // イリーガルなエラーコード + OS_TPrintf("EL Error: Illigal error code (%d)\n", errorCode); + return FALSE; + } + + elWork.entry[idx].isLauncherError = TRUE; + elWork.entry[idx].isBroken = FALSE; + elWork.entry[idx].year = (int)date->year; + elWork.entry[idx].month = (int)date->month; + elWork.entry[idx].day = (int)date->day; + STD_CopyLStringZeroFill( elWork.entry[idx].week, s_strWeek[ date->week ], 4 ); + elWork.entry[idx].hour = (int)time->hour; + elWork.entry[idx].minute = (int)time->minute; + elWork.entry[idx].second = (int)time->second; + elWork.entry[idx].errorCode = (int)errorCode; + elWork.entry[idx].titleId = ERRORLOGi_getTitleId(); + + if( elWork.entry[idx].errorStr != NULL ) + { + // 上書きされる前がUIG側のエラーだった場合はstr用のバッファを開放しておく + elWork.Free( elWork.entry[idx].errorStr ); + } + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_addNewEntry + + Description: 自由な文字列とRTCデータをエラーログエントリに追加します。 + + Arguments: int: エントリを挿入するインデクス + date: 日付データ + time: 時刻データ + fmt: エラーログに書き込まれる文字列のフォーマット + arglist: fmtに対する引数 + + + Returns: なし。 + *---------------------------------------------------------------------------*/ + + +void ERRORLOGi_addNewEntry( int idx, RTCDate *date, RTCTime *time, const char *fmt, va_list arglist ) +{ + + elWork.entry[idx].isLauncherError = FALSE; + elWork.entry[idx].isBroken = FALSE; + elWork.entry[idx].year = (int)date->year; + elWork.entry[idx].month = (int)date->month; + elWork.entry[idx].day = (int)date->day; + STD_CopyLStringZeroFill( elWork.entry[idx].week, s_strWeek[ date->week ], 4 ); + elWork.entry[idx].hour = (int)time->hour; + elWork.entry[idx].minute = (int)time->minute; + elWork.entry[idx].second = (int)time->second; + elWork.entry[idx].titleId = ERRORLOGi_getTitleId(); + + if( elWork.entry[idx].errorStr == NULL ) + { + // str用の領域があたってなければ確保する + elWork.entry[idx].errorStr = elWork.Alloc( ERRORLOG_BUFSIZE+1 ); + MI_CpuClear8( elWork.entry[idx].errorStr, ERRORLOG_BUFSIZE+1 ); + } + + STD_TVSNPrintf( elWork.entry[idx].errorStr, ERRORLOG_BUFSIZE, fmt, arglist ); +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_CheckAndCreateDirectory + + Description: この関数は該当ディレクトリが存在していれば何もしません。 + 該当ディレクトリが存在していなかった場合は + ディレクトリを作成します。 + + Arguments: path: チェックを行うディレクトリのパス + + Returns: ディレクトリが存在した場合はCHECK_EXISTを、 + 存在しておらず作成した場合はCHECK_CREATEを、 + ディレクトリ作成に失敗した場合はCHECK_FAILEDを返します。 + *---------------------------------------------------------------------------*/ + +CheckStatus ERRORLOGi_CheckAndCreateDirectory( const char *path ) +{ + FSFile dir; + + FS_InitFile( &dir ); + + if( FS_OpenDirectory( &dir, path, FS_FILEMODE_RW ) ) + { + // ディレクトリが存在していたらそのままCloseして戻る + FS_CloseDirectory( &dir ); + return CHECK_EXIST; + } + + // ディレクトリが存在しないのでディレクトリを作成 + if( ! FS_CreateDirectoryAuto( path, FS_PERMIT_R | FS_PERMIT_W ) ) + { + OS_TPrintf("EL Error: FS_CreateDirectory() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + // ディレクトリ作成に失敗 + return CHECK_FAILED; + } + + // ディレクトリ作成に成功 + return CHECK_CREATE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_CheckAndCreateFile + + Description: この関数は該当ファイルが存在していれば何もしません。 + 該当ファイルが存在していなかった場合はファイルを作成します。 + + Arguments: path: チェックを行うファイルのパス + + Returns: ファイルが存在した場合はCHECK_EXISTを、 + 存在しておらず作成した場合はCHECK_CREATEを、 + ファイル作成に失敗した場合はCHECK_FAILEDを返します。 + *---------------------------------------------------------------------------*/ + +CheckStatus ERRORLOGi_CheckAndCreateFile( const char *path ) +{ + + if( FS_OpenFileEx( &elWork.file, path, FS_FILEMODE_RWL ) ) + { + return CHECK_EXIST; + } + + // ファイルが存在しないので作成する + if( !FS_CreateFile( path, FS_PERMIT_R | FS_PERMIT_W ) ) + { + OS_TPrintf("EL Error: FS_CreateFile() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + // ファイル作成に失敗 + return CHECK_FAILED; + } + + + // ファイル作成に成功 + if( !FS_OpenFileEx( &elWork.file, path, FS_FILEMODE_RW ) ) + { + // 作成したファイルをopenできなかった場合 + OS_TPrintf("EL Error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + return CHECK_FAILED; + } + + if( FS_SetFileLength( &elWork.file, ERRORLOG_SIZE ) != FS_RESULT_SUCCESS ) + { + // 作成したファイルのサイズを設定できなかった + OS_TPrintf("EL Error: FS_SetFileLength() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + FS_CloseFile( &elWork.file ); + return CHECK_FAILED; + } + + // サイズ変更が終わったら、念のためファイルサイズ変更不可なRWLモードで開きなおしておく + FS_CloseFile( &elWork.file ); + + if( !FS_OpenFileEx( &elWork.file, path, FS_FILEMODE_RWL ) ) + { + OS_TPrintf("EL Error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + return CHECK_FAILED; + } + + + // ファイルのゼロ埋めを行う + { + char nullbuf[1024]; + int i; + + MI_CpuClear8( nullbuf, 1024); + + for(i = 0; i < 16; i++) + { + FS_WriteFile( &elWork.file, nullbuf, 1024); + } + } + + return CHECK_CREATE; +} + + + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_ReadEntry + + Description: ログファイルに書き込まれた過去のエントリを読み出す + + Arguments: なし。 + + Returns: 読み出したエントリの数 + *---------------------------------------------------------------------------*/ + +int ERRORLOGi_ReadEntry( void ) +{ + char buf[ERRORLOG_BUFSIZE+1]; + char titlebuf[5]; + int numEntry = 0; + int readSize = 0; + + buf[ERRORLOG_BUFSIZE] = '\0'; + + FS_SeekFileToBegin( &elWork.file ); + readSize = FS_ReadFile( &elWork.file, buf, ERRORLOG_BUFSIZE ); + + // エントリの頭には必ず'#'が書き込まれているのでそれで判定 + while( readSize == ERRORLOG_BUFSIZE && numEntry < ERRORLOG_NUM_ENTRY) + { + int numArgs = 0; + + // 決められたファイルフォーマットからエントリに読み込む + if( ! STD_StrNCmp( "\n\n#RED", buf, ERRORLOG_HEADER_SIZE ) ) + { + // ランチャから書き込まれたエラーの場合 + + + elWork.entry[numEntry].isLauncherError = TRUE; + elWork.entry[numEntry].isBroken = FALSE; + numArgs = STD_TSScanf( buf, ERRORLOG_READ_FORMAT_RED, + &(elWork.entry[numEntry].year) , + &(elWork.entry[numEntry].month) , + &(elWork.entry[numEntry].day) , + &(elWork.entry[numEntry].week) , + &(elWork.entry[numEntry].hour) , + &(elWork.entry[numEntry].minute) , + &(elWork.entry[numEntry].second) , + titlebuf , + &(elWork.entry[numEntry].errorCode) ); + + elWork.entry[numEntry].titleId = MI_LoadLE32( titlebuf ); + + } + else if( !STD_StrNCmp( "\n\n#FFT", buf, ERRORLOG_HEADER_SIZE ) ) + { + // フリーフォーマットで書き込まれたエラーの場合 + if( elWork.entry[numEntry].errorStr == NULL ) + { + elWork.entry[numEntry].errorStr = elWork.Alloc( ERRORLOG_BUFSIZE+1 ); + } + + elWork.entry[numEntry].isLauncherError = FALSE; + elWork.entry[numEntry].isBroken = FALSE; + numArgs = STD_TSScanf( buf, ERRORLOG_READ_FORMAT, + &(elWork.entry[numEntry].year) , + &(elWork.entry[numEntry].month) , + &(elWork.entry[numEntry].day) , + &(elWork.entry[numEntry].week) , + &(elWork.entry[numEntry].hour) , + &(elWork.entry[numEntry].minute) , + &(elWork.entry[numEntry].second) , + titlebuf , + elWork.entry[numEntry].errorStr ); // 最後の一つは引数数のつじつまを合わせるため + + elWork.entry[numEntry].titleId = MI_LoadLE32( titlebuf ); + STD_CopyLStringZeroFill( elWork.entry[numEntry].errorStr, &buf[ERRORLOG_STR_OFFSET], ERRORLOG_STR_LENGTH + 1); + + } + + if ( numArgs != ERRORLOG_NUM_ARGS ) + { + char cmpBuf[ERRORLOG_BUFSIZE+1]; + MI_CpuClear8( cmpBuf, ERRORLOG_BUFSIZE+1 ); + if( ! MI_CpuComp8( cmpBuf, buf, ERRORLOG_BUFSIZE+1 ) ) + { + // 全部ヌル文字だったらそのエントリは書き込まれていないだけ + readSize = FS_ReadFile( &elWork.file, buf, ERRORLOG_BUFSIZE ); + continue; + } + + // エラーログが壊れていて解析できなかった場合の処理 + // もしくは古いログで上記の接頭辞がないログの場合の処理 + if( elWork.entry[numEntry].errorStr == NULL ) + { + elWork.entry[numEntry].errorStr = elWork.Alloc( ERRORLOG_BUFSIZE+1 ); + } + + elWork.entry[numEntry].isBroken = TRUE; + STD_CopyLStringZeroFill( elWork.entry[numEntry].errorStr, buf, ERRORLOG_BUFSIZE+1 ); + + } + + numEntry++; + readSize = FS_ReadFile( &elWork.file, buf, ERRORLOG_BUFSIZE ); + } + + return numEntry; +} + + + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_SetString + + Description: バッファに書き込むべきログデータをセットします。 + + Arguments: buf: 文字列をセットするバッファへのポインタ + entry: エラー内容のエントリ + + Returns: 成功した場合はTRUE、失敗した場合はFALSEが返ります。 + *---------------------------------------------------------------------------*/ + +BOOL ERRORLOGi_SetString( char *buf, ErrorLogEntry *entry ) +{ + char titlebuf[5]; + + if( entry->isBroken ) + { + STD_CopyLString( buf, entry->errorStr, ERRORLOG_BUFSIZE ); + buf[ ERRORLOG_BUFSIZE-1 ] = '\n'; + return TRUE; + } + + // 壊れてない場合はtitleIDを書き込む必要があるので、u32を文字列化する + STD_CopyLStringZeroFill( titlebuf, (char*)&entry->titleId, 5); + + if ( entry->isLauncherError ) + { + STD_TSNPrintf(buf, ERRORLOG_BUFSIZE, ERRORLOG_WRITE_FORMAT_RED, + entry->year, entry->month, entry->day, entry->week, + entry->hour, entry->minute, entry->second, + titlebuf, entry->errorCode, + s_strError[entry->errorCode] ? s_strError[entry->errorCode] : "" ); + } + else + { + STD_TSNPrintf(buf, ERRORLOG_BUFSIZE, ERRORLOG_WRITE_FORMAT, + entry->year, entry->month, entry->day, entry->week, + entry->hour, entry->minute, entry->second, + titlebuf, entry->errorStr ); + } + + // 余りをスペースで埋めて、改行で終端する + ERRORLOGi_fillSpace( buf, ERRORLOG_BUFSIZE ); + buf[ ERRORLOG_BUFSIZE-1 ] = '\n'; + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_WriteLogToBuf + + Description: 受け取ったエントリの中身をバッファへ書き出します。 + + Arguments: buf: 16KB長バッファへのポインタ + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ERRORLOGi_WriteLogToBuf( char *buf ) +{ + // エントリを書き出す開始点 + int entryIdx = elWork.numEntry <= ERRORLOG_NUM_ENTRY ? 0 : elWork.numEntry % ERRORLOG_NUM_ENTRY ; + int counter; + int counterMax = elWork.numEntry <= ERRORLOG_NUM_ENTRY ? elWork.numEntry : ERRORLOG_NUM_ENTRY ; + + for( counter = 0; counter < counterMax ; counter++ ) + { + // bufに一エントリずつ文字列化して詰めていく + ERRORLOGi_SetString( &buf[ counter * ERRORLOG_BUFSIZE ], &(elWork.entry[ (entryIdx + counter) % ERRORLOG_NUM_ENTRY ]) ); + + if( counter == counterMax-1 ) + { + // 最後のエントリは改行を入れずにヌル文字で終端 + buf[ (counter+1) * ERRORLOG_BUFSIZE - 1] = '\0'; + } + } + + // バッファのあまり部分をゼロ埋めする + MI_CpuClear8( &buf[ counter * ERRORLOG_BUFSIZE], (u32) ((ERRORLOG_NUM_ENTRY - counter) * ERRORLOG_BUFSIZE ) ); +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_WriteLogToFile + + Description: 受け取ったエントリの中身をログファイルに書き出します。 + + Arguments: buf: 書き込み内容の格納されたバッファへのポインタ + + Returns: 成功した場合はTRUE、失敗した場合はFALSEが返ります。 + *---------------------------------------------------------------------------*/ + +BOOL ERRORLOGi_WriteLogToFile( char *buf ) +{ + // ファイルの頭に戻って書き込みなおす + FS_OpenFileEx( &elWork.file, ERRORLOG_FILEPATH, FS_FILEMODE_W ); + FS_SeekFileToBegin( &elWork.file ); + + if( FS_WriteFile( &elWork.file, buf, ERRORLOG_SIZE ) != ERRORLOG_SIZE ) + { + OS_TPrintf("EL Error: FS_WriteFile() failed.\n"); + FS_CloseFile( &elWork.file ); + return FALSE; + } + + if( ! FS_CloseFile( &elWork.file ) ) + { + OS_TPrintf("EL Error: FS_CloseFile() in WriteLogToFile() failed."); + return FALSE; + } + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_fillSpace + + Description: 受け取ったエントリの余りの部分をスペースで埋めます。 + + Arguments: buf: 書き込み内容の格納されたバッファへのポインタ + bufsize: エントリ全体のサイズ + + Returns: なし。 + *---------------------------------------------------------------------------*/ + +void ERRORLOGi_fillSpace( char *buf, int bufsize ) +{ + u32 length = strlen( buf ); + MI_CpuFill8( &buf[length], ' ', bufsize - length ); +} + +/*---------------------------------------------------------------------------* + Name: ERRORLOGi_getTitleId + + Description: 起動しているアプリのtitleIdを取得 + + Arguments: + + Returns: 起動しているアプリのtitleID_Lo + *---------------------------------------------------------------------------*/ + +u32 ERRORLOGi_getTitleId( void ) +{ + return MI_LoadBE32( (void*)(HW_TWL_ROM_HEADER_BUF + 0x230) ); + +} + +FSFile ERRORLOGi_getLogFilePt( void ) +{ + return elWork.file; +} + +static char *s_strWeek[] = { + "SUN", + "MON", + "TUE", + "WED", + "THU", + "FRI", + "SAT" +}; + +static char *s_strError[ FATAL_ERROR_MAX ] = { + "FATAL_ERROR_UNDEFINED", + "FATAL_ERROR_NAND", + "FATAL_ERROR_HWINFO_NORMAL", + "FATAL_ERROR_HWINFO_SECURE", + "FATAL_ERROR_TWLSETTINGS", + "FATAL_ERROR_SHARED_FONT", + "FATAL_ERROR_WLANFIRM_AUTH", + "FATAL_ERROR_WLANFIRM_LOAD", + "FATAL_ERROR_TITLE_LOAD_FAILED", + "FATAL_ERROR_TITLE_POINTER_ERROR", + "FATAL_ERROR_AUTHENTICATE_FAILED", + "FATAL_ERROR_ENTRY_ADDRESS_ERROR", + "FATAL_ERROR_TITLE_BOOTTYPE_ERROR", + "FATAL_ERROR_SIGN_DECRYPTION_FAILED", + "FATAL_ERROR_SIGN_COMPARE_FAILED", + "FATAL_ERROR_HEADER_HASH_CALC_FAILED", + "FATAL_ERROR_TITLEID_COMPARE_FAILED", + "FATAL_ERROR_VALID_SIGN_FLAG_OFF", + "FATAL_ERROR_CHECK_TITLE_LAUNCH_RIGHTS_FAILED", + "FATAL_ERROR_MODULE_HASH_CHECK_FAILED", + "FATAL_ERROR_MODULE_HASH_CALC_FAILED", + "FATAL_ERROR_MEDIA_CHECK_FAILED", + "FATAL_ERROR_DL_MAGICCODE_CHECK_FAILED", + "FATAL_ERROR_DL_SIGN_DECRYPTION_FAILED", + "FATAL_ERROR_DL_HASH_CALC_FAILED", + "FATAL_ERROR_DL_SIGN_COMPARE_FAILED", + "FATAL_ERROR_WHITELIST_INITDB_FAILED", + "FATAL_ERROR_WHITELIST_NOTFOUND", + "FATAL_ERROR_DHT_PHASE1_FAILED", + "FATAL_ERROR_DHT_PHASE2_FAILED", + "FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF", + "FATAL_ERROR_TWL_BOOTTYPE_UNKNOWN", + "FATAL_ERROR_NTR_BOOTTYPE_UNKNOWN", + "FATAL_ERROR_PLATFORM_UNKNOWN", + "FATAL_ERROR_LOAD_UNFINISHED", + "FATAL_ERROR_LOAD_OPENFILE_FAILED", + "FATAL_ERROR_LOAD_MEMALLOC_FAILED", + "FATAL_ERROR_LOAD_SEEKFILE_FAILED", + "FATAL_ERROR_LOAD_READHEADER_FAILED", + "FATAL_ERROR_LOAD_LOGOCRC_ERROR = 39", + "FATAL_ERROR_LOAD_READDLSIGN_FAILED", + "FATAL_ERROR_LOAD_RELOCATEINFO_FAILED", + "FATAL_ERROR_LOAD_READMODULE_FAILED", + "FATAL_ERROR_NINTENDO_LOGO_CHECK_FAILED", + "FATAL_ERROR_SYSMENU_VERSION", + "FATAL_ERROR_DHT_PHASE1_CALC_FAILED", + "FATAL_ERROR_LOAD_UNKNOWN_BOOTTYPE", + "FATAL_ERROR_LOAD_AUTH_HEADER_FAILED", + "FATAL_ERROR_LOAD_NEVER_STARTED", + "FATAL_ERROR_EJECT_CARD_AFTER_LOAD_START", + "FATAL_ERROR_TITLEID_COMPARE_FAILED_NTR", +}; \ No newline at end of file diff --git a/build/libraries_sysmenu/errorLog/Makefile b/build/libraries_sysmenu/errorLog/Makefile new file mode 100644 index 00000000..95f57d37 --- /dev/null +++ b/build/libraries_sysmenu/errorLog/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - NAMUT +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/hotsw/ARM7/Makefile b/build/libraries_sysmenu/hotsw/ARM7/Makefile new file mode 100644 index 00000000..bf76e373 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/Makefile @@ -0,0 +1,60 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +#---------------------------------------------------------------------------- + +SRCDIR = ./src +INCDIR = ./include + +SRCS = hotswBlowfish.c \ + Blowfish_megachips.c \ + hotsw.c \ + dsCardCommon.c \ + romEmulation.c \ + twl_blowfish_table_dev.c \ + customNDma.c + +TARGET_LIB = libhotsw_sp$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +ifeq ($(HOTSW_NO_MESSAGE),TRUE) +MACRO_FLAGS += -DHOTSW_NO_MESSAGE +endif + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/blowfish.h b/build/libraries_sysmenu/hotsw/ARM7/include/blowfish.h new file mode 100644 index 00000000..b8e30b0a --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/blowfish.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: blowfish.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef HOTSW_GCD_BLOWFISH_H +#define HOTSW_GCD_BLOWFISH_H + + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ +extern BLOWFISH_CTX HotSwBlowfishInitTableBufDS; +extern BLOWFISH_CTX HotSwBlowfishInitTableTWL_dev; + +// Function Prototype ------------------------------------------------------------------------ + +// Blowfish KeyとTableの初期化 +void InitBlowfishKeyAndTableDS(BLOWFISH_CTX *ctx, u32 *keyBufp, s32 keyLen); + +// Key Table の生成 +void MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen); + +// Key Table2 の生成 +void MakeBlowfishTableTWL(CardBootData *cbd, s32 keyLen, u16 bondingOp); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // HOTSW_GCD_BLOWFISH_H diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/customNDma.h b/build/libraries_sysmenu/hotsw/ARM7/include/customNDma.h new file mode 100644 index 00000000..18a6d088 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/customNDma.h @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: customNDma.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_CUSTOM_NDMA_H__ +#define __HOTSW_CUSTOM_NDMA_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +static inline void HOTSW_WaitCardCtrl(void) +{ + while( reg_HOTSW_MCCNT1 & REG_MI_MCCNT1_START_MASK ){} +} + +#ifdef USE_NEW_DMA +static inline void HOTSW_WaitNDmaCtrl(u32 ndmaNo) +{ + while( MI_NDMA_REG( ndmaNo, MI_NDMA_REG_CNT_WOFFSET ) & MI_NDMA_ENABLE_MASK ){} +} +#else +static inline void HOTSW_WaitDmaCtrl(u32 dmaNo) +{ + while( MI_DMA_REG( dmaNo, MI_DMA_REG_CNT_WOFFSET ) & MI_DMA_ENABLE ){} +} +#endif + +// =========================================================================== +// Function Describe +// =========================================================================== +#ifdef USE_NEW_DMA +// New DMA +void HOTSW_NDmaCopy_Card(u32 ndmaNo, const void *src, void *dest, u32 size); +void HOTSW_NDmaPipe_Card(u32 ndmaNo, const void *src, void *dest, u32 size); +#else +// Old DMA +void HOTSW_DmaCopy32_Card(u32 dmaNo, const void *src, void *dest, u32 size); +void HOTSW_DmaPipe32_Card(u32 dmaNo, const void *src, void *dest, u32 size); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_CUSTOM_NDMA_H__ \ No newline at end of file diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/dsCardCommon.h b/build/libraries_sysmenu/hotsw/ARM7/include/dsCardCommon.h new file mode 100644 index 00000000..8436a137 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/dsCardCommon.h @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK + File: + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_DSCARD_COMMON_H__ +#define __HOTSW_DSCARD_COMMON_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// =========================================================================== +// Function Describe +// =========================================================================== +// ■ ノーマルモードのコマンド ■ +// ノーマルモードのID読み込み +HotSwState ReadIDNormal(CardBootData *cbd); + +// ノーマルモードのBoot Segment(4Kbyte)読み込み +HotSwState ReadBootSegNormal(CardBootData *cbd); + +// ノーマルモードでステータスを読み込む +HotSwState ReadStatusNormal(CardBootData *cbd); + +// ノーマルモードでバッドブロックを置換 +HotSwState RefreshBadBlockNormal(CardBootData *cbd); + +// ノーマルモードからセキュアモードへの変更 +HotSwState ChangeModeNormal(CardBootData *cbd); + +// ノーマルモードからセキュア2モードへの変更 +HotSwState ChangeModeNormal2(CardBootData *cbd); + +// カード側のKeyTableをロード +HotSwState LoadTable(void); + +// デバッガのROMエミュレーション情報読み込み +HotSwState ReadRomEmulationInfo(SYSMRomEmuInfo *info); + + +// ■ セキュアモードのコマンド ■ +// セキュアモードのID読み込み +HotSwState ReadIDSecure(CardBootData *cbd); + +// セキュアモードのSecure Segment(16Kbyte)読み込み +HotSwState ReadSegSecure(CardBootData *cbd); + +// セキュアモードのPNジェネレータON +HotSwState SwitchONPNGSecure(CardBootData *cbd); + +// セキュアモードのPNジェネレータOFF +HotSwState SwitchOFFPNGSecure(CardBootData *cbd); + +// セキュアモードのモード変更 +HotSwState ChangeModeSecure(CardBootData *cbd); + + +// ■ ゲームモードのコマンド ■ +// ゲームモードのID読み込み +HotSwState ReadIDGame(CardBootData *cbd); + +// ゲームモードの指定ページ読み込み +HotSwState ReadPageGame(CardBootData *cbd, u32 start_addr, void* buf, u32 size); + +// ゲームモードでステータスを読み込む +HotSwState ReadStatusGame(CardBootData *cbd); + +// ゲームモードでバッドブロックを置換 +HotSwState RefreshBadBlockGame(CardBootData *cbd); + + +// ■ 内部関数 ■ +// LEコマンドをBEへ変換してレジスタへセット +void HOTSWi_SetCommand(GCDCmd64 *cndLE); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_DSCARD_COMMON_H__ diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/hotswTypes.h b/build/libraries_sysmenu/hotsw/ARM7/include/hotswTypes.h new file mode 100644 index 00000000..18b14fd9 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/hotswTypes.h @@ -0,0 +1,346 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: type.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_TYPES_H__ +#define __HOTSW_TYPES_H__ + +#include +#include +#include +#include +#include "romSpec.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +// Define ------------------------------------------------------------------- +// --- NewDMA Ch +#define HOTSW_NDMA_NO 2 +#define HOTSW_DMA_NO 3 + +// --- Blowfish +#define KEY_BUF_SIZE 3 + +// --- Boot Segment +#define BOOT_SEGMENT_SIZE 0x1000 + +// --- Secure Segment +#define SECURE_SEGMENT_START 0x4000 +#define SECURE_SEGMENT_SIZE 0x4000 +#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE) + +// --- TWL Card +#define TWLCARD_BORDER_OFFSET 0x80000 + +// --- Page / Segment (Byte) +#define PAGE_SIZE 0x200 +#define ONE_SEGMENT_SIZE 0x1000 + +// --- Page / Segment (Word) +#define PAGE_WORD_SIZE 0x80 +#define ONE_SEGMENT_WORD_SIZE 0x400 + +// --- Rom Emulation +#define ROM_EMULATION_DATA_SIZE 0x20 + +// --- Thread +#define HOTSW_THREAD_STACK_SIZE (1024 * 2) +#define HOTSW_DMA_MSG_NUM 8 +#define HOTSW_INSERT_MSG_NUM 16 +#define HOTSW_PULLED_MSG_NUM 16 +#define HOTSW_CTRL_MSG_NUM 8 +#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM) +#define HOTSW_POLLING_CTRL_BUFFER_NUM 4 + +// --- Card Control Reg 0 +#define HOTSW_E2PROM_CTRL_MASK 0x00ff + +// --- Card Control Reg 1 +#define START_FLG_MASK 0x80000000 +#define READY_FLG_MASK 0x00800000 + +#define LATENCY1_SHIFT 0 +#define LATENCY1_MASK 0x00001fff + +#define DS_SHIFT 13 +#define DS_MASK 0x00002000 + +#define SE_SHIFT 14 +#define SE_MASK 0x00004000 + +#define SCR_SHIFT 15 +#define SCR_MASK 0x00008000 + +#define LATENCY2_SHIFT 16 +#define LATENCY2_MASK 0x003f0000 + +#define CS_SHIFT 22 +#define CS_MASK 0x00400000 + +#define RDY_SHIFT 23 +#define RDY_MASK 0x00800000 + +#define PC_SHIFT 24 +#define PC_MASK 0x07000000 + +#define CT_SHIFT 27 +#define CT_MASK 0x08000000 + +#define TRM_SHIFT 28 +#define TRM_MASK 0x10000000 + +#define RESB_SHIFT 29 +#define RESB_MASK 0x20000000 + +#define WR_SHIFT 30 +#define WR_MASK 0x40000000 + +#define START_SHIFT 31 +#define START_MASK 0x80000000 + +#define SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク + +// --- Page Count +#define HOTSW_PAGE_0 0x0UL << PC_SHIFT +#define HOTSW_PAGE_1 0x1UL << PC_SHIFT +#define HOTSW_PAGE_2 0x2UL << PC_SHIFT +#define HOTSW_PAGE_4 0x3UL << PC_SHIFT +#define HOTSW_PAGE_8 0x4UL << PC_SHIFT +#define HOTSW_PAGE_16 0x5UL << PC_SHIFT +#define HOTSW_PAGE_32 0x6UL << PC_SHIFT +#define HOTSW_PAGE_STAT 0x7UL << PC_SHIFT + +// --- Latency +#define AddLatency2ToLatency1(param)\ + ( (((param) & LATENCY2_MASK) \ + >> LATENCY2_SHIFT) \ + + ((param) & LATENCY1_MASK) \ + ) + +// --- Register Define +#ifndef DEBUG_USED_CARD_SLOT_B_ +// Slot A +#define SLOT_STATUS_MODE_SELECT_MSK 0x0c +#define SLOT_STATUS_CDET_MSK 0x01 +#define SLOT_STATUS_MODE_00 0x00 +#define SLOT_STATUS_MODE_01 0x04 +#define SLOT_STATUS_MODE_10 0x08 +#define SLOT_STATUS_MODE_11 0x0c + +#define reg_HOTSW_MCCMD0 reg_MI_MCCMD0_A +#define reg_HOTSW_MCCMD1 reg_MI_MCCMD1_A + +#define reg_HOTSW_MCCNT0 reg_MI_MCCNT0_A +#define reg_HOTSW_MCCNT1 reg_MI_MCCNT1_A + +#define HOTSW_MCD1 REG_MCD1_A_ADDR +#define reg_HOTSW_MCD1 reg_MI_MCD1_A + +#define reg_HOTSW_MCSCR0 reg_MI_MCSCR0_A +#define reg_HOTSW_MCSCR1 reg_MI_MCSCR1_A +#define reg_HOTSW_MCSCR2 reg_MI_MCSCR2_A + +#define HOTSW_IF_CARD_DET OS_IE_CARD_A_DET +#define HOTSW_IF_CARD_IREQ OS_IE_CARD_A_IREQ + +#else +// Slot B +#define SLOT_STATUS_MODE_SELECT_MSK 0xc0 +#define SLOT_STATUS_CDET_MSK 0x10 +#define SLOT_STATUS_MODE_00 0x00 +#define SLOT_STATUS_MODE_01 0x40 +#define SLOT_STATUS_MODE_10 0x80 +#define SLOT_STATUS_MODE_11 0xc0 + +#define reg_HOTSW_MCCMD0 reg_MI_MCCMD0_B +#define reg_HOTSW_MCCMD1 reg_MI_MCCMD1_B + +#define reg_HOTSW_MCCNT0 reg_MI_MCCNT0_B +#define reg_HOTSW_MCCNT1 reg_MI_MCCNT1_B + +#define HOTSW_MCD1 REG_MCD1_B_ADDR +#define reg_HOTSW_MCD1 reg_MI_MCD1_B + +#define reg_HOTSW_MCSCR0 reg_MI_MCSCR0_B +#define reg_HOTSW_MCSCR1 reg_MI_MCSCR1_B +#define reg_HOTSW_MCSCR2 reg_MI_MCSCR2_B + +#define HOTSW_IF_CARD_DET OS_IE_CARD_B_DET +#define HOTSW_IF_CARD_IREQ OS_IE_CARD_B_IREQ + +#endif + +// Enum --------------------------------------------------------------------- +typedef enum CardTypeEx{ + DS_CARD_TYPE_1 = 0, + DS_CARD_TYPE_2, + TWL_CARD, + ROM_EMULATION +} CardTypeEx; + +typedef enum RomMode{ + HOTSW_ROM_MODE_NULL = 0, + HOTSW_ROM_MODE_NORMAL, + HOTSW_ROM_MODE_SECURE, + HOTSW_ROM_MODE_GAME, + + HOTSW_ROM_MODE_NUM +} RomMode; + +typedef enum NormalCommandType{ + RD_ID = 0, + RD_BSEG, + CHG_MODE +} NormalCommandType; + +typedef enum SecureCommandType{ + S_RD_ID = 0, + S_RD_SEG, + S_PNG_ON, + S_PNG_OFF, + S_CHG_MODE +} SecureCommandType; + +typedef enum GameCommandType{ + G_RD_ID = 0, + G_RD_PAGE +} GameCommandType; + +typedef enum CardType{ + CARD_DS_TYPE1 = 0, + CARD_DS_TYPE2, + CARD_TWL +} CardType; + +typedef enum HotSwState{ + HOTSW_SUCCESS = 0, + HOTSW_ROMEMU_ONLY, + HOTSW_TIME_OUT, + HOTSW_CARD_LOCK_ERROR, + HOTSW_CRC_CHECK_ERROR, + HOWSW_REGION_CHECK_ERROR, + HOTSW_HASH_CHECK_ERROR, + HOTSW_ID_CHECK_ERROR, + HOTSW_PULLED_OUT_ERROR, + HOTSW_DATA_DECRYPT_ERROR, + HOTSW_BUFFER_OVERRUN_ERROR, + HOTSW_MODE_ERROR, + HOTSW_ILLEGAL_CARD_ERROR, + HOTSW_GAMEMODE_ID_CHECK_ERROR, + HOTSW_BUS_LOCK_ERROR, + HOTSW_UNEXPECTED_ERROR +} HotSwState; + +// union --------------------------------------------------------------------- +typedef union +{ + u64 dw; + u8 b[8]; +} GCDCmd64; + +// ブートセグメントデータ +typedef union BootSegmentData +{ + ROM_Header rh; + u32 word[BOOT_SEGMENT_SIZE / sizeof(u32)]; +} BootSegmentData; + +// struct ------------------------------------------------------------------- +/*typedef struct BLOWFISH_CTX{ + u32 P[16 + 2]; + u32 S[4][256]; +} BLOWFISH_CTX;*/ + +// カードブート時に必要な変数一式をまとめた構造体 +typedef struct CardBootData{ + u32 vae; + u32 vbi; + u32 vd; + + u32 id_nml; + u32 id_scr; + u32 id_scr2; + u32 id_gam; + +#ifndef USE_WRAM_LOAD + u32 arm9Stc; + u32 arm7Stc; + u32 arm9Ltd; + u32 arm7Ltd; +#endif + + BOOL twlFlg; + BOOL debuggerFlg; + BOOL isLoadTypeTwl; + BOOL illegalCardFlg; + + u32 romStatus; + + u32 keyBuf[KEY_BUF_SIZE]; + u32 keyBuf2[KEY_BUF_SIZE]; + + CardTypeEx cardType; + ModeType modeType; + u32 secureLatency; + u32 gameCommondParam; + + BootSegmentData *pBootSegBuf; + u32 *pSecureSegBuf; + u32 *pSecure2SegBuf; + + BLOWFISH_CTX keyTable; + BLOWFISH_CTX keyTable2; +} CardBootData; + +// スレッド・メッセージ関係をまとめた構造体 +typedef struct CardThreadData{ + u64 hotswStack[HOTSW_THREAD_STACK_SIZE / sizeof(u64)]; + u64 monitorStack[HOTSW_THREAD_STACK_SIZE / sizeof(u64)]; + OSThread hotswThread; + OSThread monitorThread; + + u32 idx_insert; + u32 idx_pulledOut; + u32 idx_ctrl; + u32 idx_dma; + u32 idx_polling; + + OSMessage hotswDmaMsg[HOTSW_DMA_MSG_NUM]; + OSMessage hotswPollingCtrlMsg[HOTSW_POLLING_CTRL_BUFFER_NUM]; + HotSwMessageForArm7 hotswInsertMsg[HOTSW_INSERT_MSG_NUM]; + HotSwMessageForArm7 hotswPulledOutMsg[HOTSW_PULLED_MSG_NUM]; + HotSwMessageForArm7 hotswPxiMsg[HOTSW_CTRL_MSG_NUM]; + + OSMessageQueue hotswQueue; + OSMessageQueue hotswDmaQueue; + OSMessageQueue hotswPollingCtrlQueue; + + OSMessage hotswMsgBuffer[HOTSW_MSG_BUFFER_NUM]; + OSMessage hotswDmaMsgBuffer[HOTSW_DMA_MSG_NUM]; + OSMessage hotswPollingCtrlBuffer[HOTSW_POLLING_CTRL_BUFFER_NUM]; +} CardThreadData; + +// カード起動用関数 +typedef struct CardSecureModeFunction { + HotSwState (*ReadID_S)(CardBootData *cbd); + HotSwState (*ReadSegment_S)(CardBootData *cbd); + HotSwState (*SetPNG_S)(CardBootData *cbd); + HotSwState (*ChangeMode_S)(CardBootData *cbd); +} CardSecureModeFunction; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_TYPES_H__ \ No newline at end of file diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/romEmulation.h b/build/libraries_sysmenu/hotsw/ARM7/include/romEmulation.h new file mode 100644 index 00000000..54c956df --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/romEmulation.h @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK + File: romEmulation.h + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_ROM_EMULATION_H__ +#define __HOTSW_ROM_EMULATION_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// =========================================================================== +// Function Describe +// =========================================================================== +// ■ セキュアモードのコマンド ■ +// Rom EmulationのセキュアモードのID読み込み +HotSwState ReadIDSecure_ROMEMU(CardBootData *cbd); + +// Rom EmulationのセキュアモードのSecure Segment(16Kbyte)読み込み +HotSwState ReadSegSecure_ROMEMU(CardBootData *cbd); + +// Rom EmulationのセキュアモードのPNジェネレータON +HotSwState SwitchONPNGSecure_ROMEMU(CardBootData *cbd); + +// Rom EmulationのセキュアモードのPNジェネレータOFF +HotSwState SwitchOFFPNGSecure_ROMEMU(CardBootData *cbd); + +// Rom Emulationのセキュアモードのモード変更 +HotSwState ChangeModeSecure_ROMEMU(CardBootData *cbd); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_ROM_EMULATION_H__ diff --git a/build/libraries_sysmenu/hotsw/ARM7/include/romSpec.h b/build/libraries_sysmenu/hotsw/ARM7/include/romSpec.h new file mode 100644 index 00000000..b57979e0 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/include/romSpec.h @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: romSpec.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 __HOTSW_ROMSPEC_H__ +#define __HOTSW_ROMSPEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// ROM memory map + +#define HOTSW_PAGE_SIZE 0x200 // 512B +#define HOTSW_BOOT_SEG_SIZE 0x1000 // 4KB +#define HOTSW_LOAD_TABLE_SIZE 0x2000 // 8KB +#define HOTSW_KEYTABLE_AREA_SIZE 0x3000 // 12KB +#define HOTSW_KEYTABLE2_AREA_SIZE 0x3000 // 12KB +#define HOTSW_SECURE_AREA_SIZE 0x4000 // 16KB +#define HOTSW_SECURE2_AREA_SIZE 0x4000 // 16KB +#define HOTSW_ROMEMU_INFO_SIZE 0x20 + +#define HOTSW_BOOTSEGMENT_AREA_OFS 0x0000 // 0KB +#define HOTSW_KEYTABLE_AREA_OFS 0x1000 // 4KB +#define HOTSW_SECURE_AREA_OFS 0x4000 // 16KB +#define HOTSW_GAME_AREA_OFS 0x8000 // 32KB +#define HOTSW_SECURE2_AREA_OFS 0x3000 // 12KB +#define HOTSW_GAME2_AREA_OFS 0x7000 // 28KB +#define HOTSW_ROMEMU_INFO_OFS (HOTSW_SECURE_AREA_OFS - HOTSW_PAGE_SIZE + 0x160) + + +// ROM ID + +#define HOTSW_ROMID_1TROM_MASK 0x80000000UL +#define HOTSW_ROMID_TWLROM_MASK 0x40000000UL +#define HOTSW_ROMID_RFSSUP_MASK 0x20000000UL +#define HOTSW_ROMID_SIZE_MASK 0x0000ff00UL + +// ROM STATUS + +#define HOTSW_ROMST_RFS_WARN_L1_MASK 0x00000004UL +#define HOTSW_ROMST_RFS_WARN_L2_MASK 0x00000008UL +#define HOTSW_ROMST_RFS_READY_MASK 0x00000020UL + + +// NORMAL command + +#define HSWOP_N_OP_MASK 0xff00000000000000ULL +#define HSWOP_N_OP_SIZE 8 + +#define HSWOP_N_OP_RD_ID 0x9000000000000000ULL +#define HSWOP_N_OP_RD_PAGE 0x0000000000000000ULL +#define HSWOP_N_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_N_OP_LD_TABLE 0x9f00000000000000ULL +#define HSWOP_N_OP_RD_CACHE_START 0x5800000000000000ULL +#define HSWOP_N_OP_RD_CACHE 0x6000000000000000ULL +#define HSWOP_N_OP_RD_CACHE_LAST 0x6800000000000000ULL +#define HSWOP_N_OP_RD_STAT 0xd600000000000000ULL +#define HSWOP_N_OP_RFS_BLK 0xb500000000000000ULL +#define HSWOP_N_OP_CHG_MODE 0x3c00000000000000ULL +#define HSWOP_N_OP_CHG2_MODE 0x3d00000000000000ULL + +#define HSWOP_N_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_N_RD_PAGE_PAD 0x00fffffeff00ffffULL +#define HSWOP_N_CHG_MODE_PAD 0x00000000f00000ffULL +#define HSWOP_N_CHG2_MODE_PAD HSWOP_N_CHG_MODE_PAD + +#define HSWOP_N_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_N_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_N_RD_PAGE_ADDR_MASK 0x00fffffe00000000ULL + +#define HSWOP_N_VAE_SHIFT 32 +#define HSWOP_N_VAE_SIZE 24 +#define HSWOP_N_VAE_MASK 0x00ffffff00000000ULL + +#define HSWOP_N_VBI_SHIFT 8 +#define HSWOP_N_VBI_SIZE 20 +#define HSWOP_N_VBI_MASK 0x000000000fffff00ULL + + +// SECURE command + +#define HSWOP_S_OP_MASK 0xf000000000000000ULL +#define HSWOP_S_OP_SIZE 4 + +#define HSWOP_S_OP_RD_ID 0x1000000000000000ULL +#define HSWOP_S_OP_RD_SEG 0x2000000000000000ULL +#define HSWOP_S_OP_PNG_ON 0x4000000000000000ULL +#define HSWOP_S_OP_PNG_OFF 0x6000000000000000ULL +#define HSWOP_S_OP_CHG_MODE 0xa000000000000000ULL + +#define HSWOP_S_VA_SHIFT HSWOP_S_VB_SIZE +#define HSWOP_S_VA_SIZE 24 +#define HSWOP_S_VA_MASK 0x00000ffffff00000ULL + +#define HSWOP_S_VB_SHIFT 0 +#define HSWOP_S_VB_SIZE 20 +#define HSWOP_S_VB_MASK 0x00000000000fffffULL + +#define HSWOP_S_VC_SHIFT (HSWOP_S_VA_SIZE + HSWOP_S_VB_SIZE) +#define HSWOP_S_VC_SIZE 16 +#define HSWOP_S_VC_MASK 0x0ffff00000000000ULL + +#define HSWOP_S_VD_SHIFT HSWOP_S_VA_SHIFT +#define HSWOP_S_VD_SIZE HSWOP_S_VA_SIZE +#define HSWOP_S_VD_MASK HSWOP_S_VA_MASK + + +// GAME command + +#define HSWOP_G_OP_MASK 0xff00000000000000ULL +#define HSWOP_G_OP_SIZE 8 + +#define HSWOP_G_OP_RD_ID 0xb800000000000000ULL +#define HSWOP_G_OP_RD_UID 0xb900000000000000ULL +#define HSWOP_G_OP_RD_PAGE 0xb700000000000000ULL +#define HSWOP_G_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_G_OP_RD_CACHE_START HSWOP_N_OP_RD_CACHE_START +#define HSWOP_G_OP_RD_CACHE HSWOP_N_OP_RD_CACHE +#define HSWOP_G_OP_RD_CACHE_LAST HSWOP_N_OP_RD_CACHE_LAST +#define HSWOP_G_OP_RD_STAT HSWOP_N_OP_RD_STAT +#define HSWOP_G_OP_RFS_BLK HSWOP_N_OP_RFS_BLK + +#define HSWOP_G_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_UID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_PAGE_PAD 0x00f0000000ffffffULL + +#define HSWOP_G_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_G_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_G_RD_PAGE_ADDR_MASK 0x000ffffe00000000ULL + + +#ifdef __cplusplus +} /* extern "C" */ + +#endif + +/* __HOTSW_ROMSPEC_H__ */ +#endif diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/Blowfish_megachips.c b/build/libraries_sysmenu/hotsw/ARM7/src/Blowfish_megachips.c new file mode 100644 index 00000000..fefac1c5 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/Blowfish_megachips.c @@ -0,0 +1,148 @@ +/*-------------------------------------------------------------------- +! +! Blowfish.c +! +! Copyright 2002 by MegaChips Corporation +! +!--------------------------------------------------------------------- +! PROJECT: IRIS Demo +! CATEGORY: C source +! COMMENT: Blowfish subroutine +! $Author: kawamura.kumiko $ +! $Date: 2002/12/02 08:13:54 $ +! $Revision: 1.2 $ +!-- +*/ +#include "blowfish.h" + + +#define MAXKEYBYTES 56 /* 448 bits */ +#define N 16 + + +static u32 F(const BLOWFISH_CTX *ctx, u32 x); + +void InitBlowfish(BLOWFISH_CTX *ctx, const unsigned char *key, int keyLen) +{ + int i, j, k; + u32 data, datal, datar; + + j = 0; + for (i = 0; i < N + 2; ++i) { + data = 0x00000000; + for (k = 0; k < 4; ++k) { + data = (data << 8) | key[j]; + j = j + 1; + if (j >= keyLen) + j = 0; + } + ctx->P[i] = ctx->P[i] ^ data; + } + + datal = 0x00000000; + datar = 0x00000000; + + for (i = 0; i < N + 2; i += 2) { + EncryptByBlowfish(ctx, &datal, &datar); + ctx->P[i] = datal; + ctx->P[i + 1] = datar; + } + + for (i = 0; i < 4; ++i) { + for (j = 0; j < 256; j += 2) { + EncryptByBlowfish(ctx, &datal, &datar); + ctx->S[i][j] = datal; + ctx->S[i][j + 1] = datar; + } + } + +} + + +void EncryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr) +{ + u32 Xl; + u32 Xr; + u32 temp; + int i; + + Xl = *xl; + Xr = *xr; + + for (i = 0; i < N; ++i) { + Xl = Xl ^ ctx->P[i]; + Xr = F(ctx, Xl) ^ Xr; + + temp = Xl; + + Xl = Xr; + Xr = temp; + } + + temp = Xl; + Xl = Xr; + Xr = temp; + + Xr = Xr ^ ctx->P[N]; + Xl = Xl ^ ctx->P[N + 1]; + + *xl = Xl; + *xr = Xr; +} + +void DecryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr) +{ + u32 Xl; + u32 Xr; + u32 temp; + int i; + + + Xl = *xl; + Xr = *xr; + + for (i = N + 1; i > 1; --i) { + Xl = Xl ^ ctx->P[i]; + Xr = F(ctx, Xl) ^ Xr; + + temp = Xl; + Xl = Xr; + Xr = temp; + } + + temp = Xl; + Xl = Xr; + Xr = temp; + + Xr = Xr ^ ctx->P[1]; + Xl = Xl ^ ctx->P[0]; + + *xl = Xl; + *xr = Xr; +} + + +static u32 F(const BLOWFISH_CTX *ctx, u32 x) { + u32 a, b, c, d; + u32 y; + + d = x & 0x00FF; + x >>= 8; + + c = x & 0x00FF; + x >>= 8; + + b = x & 0x00FF; + x >>= 8; + + a = x & 0x00FF; + + y = ctx->S[0][a] + ctx->S[1][b]; + + y = y ^ ctx->S[2][c]; + y = y + ctx->S[3][d]; + + return y; +} + + diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/customNDma.c b/build/libraries_sysmenu/hotsw/ARM7/src/customNDma.c new file mode 100644 index 00000000..7c534867 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/customNDma.c @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: customNDma.c + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include + +// Extern ------------------------------------------------------------------- +extern CardThreadData HotSwThreadData; + +// union -------------------------------------------------------------------- +#ifndef USE_NEW_DMA +typedef union +{ + u32 b32; + u16 b16; +} +MIiDmaClearSrc; +#endif + +// Define data -------------------------------------------------------------- +#ifndef USE_NEW_DMA +#define NDMA_WORD_COUNT_1 0x1 +#define ASSERT_NDMANO( ndmaNo ) SDK_ASSERTMSG( (ndmaNo) <= MI_NDMA_MAX_NUM, "illegal NDMA No." ); +#define ASSERT_DMANO( dmaNo ) SDK_ASSERTMSG( (dmaNo) <= MI_DMA_MAX_NUM, "illegal DMA No." ); + +#define MIi_DMA_MODE_NOINT 1 +#define MIi_DMA_MODE_WAIT 2 +#define MIi_DMA_MODE_NOCLEAR 4 +#define MIi_DMA_MODE_SRC32 0x10 +#define MIi_DMA_MODE_SRC16 0x20 + +#define MIi_DMA_CLEAR_DATA_BUF HW_PRV_WRAM_DMA_CLEAR_DATA_BUF +#endif + +// Function prototype ------------------------------------------------------- +#ifdef USE_NEW_DMA +static void HOTSWi_NDmaCopy_Card(u32 ndmaNo, const void *src, void *dest, u32 size, u32 dcont); +static void InterruptCallbackNDma(void); +#else +static void HOTSWi_DmaCopy32_Card(u32 dmaNo, const void *src, void *dest, u32 size, u32 dcont); +static void HOTSWi_DmaSetParameters(u32 dmaNo, u32 src, u32 dest, u32 ctrl, u32 mode); +#endif + + +// =========================================================================== +// Function Describe +// =========================================================================== +/*---------------------------------------------------------------------------* + Name: HOTSW_NDmaCopy_Card + + Description: カードから送られてきたデータを指定アドレスにNDMA転送する + *---------------------------------------------------------------------------*/ +#ifdef USE_NEW_DMA +void HOTSW_NDmaCopy_Card(u32 ndmaNo, const void *src, void *dest, u32 size) +{ + HOTSWi_NDmaCopy_Card(ndmaNo, src, dest, size, MI_NDMA_DEST_INC); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_NDmaPipe_Card + + Description: カードから送られてきたデータを指定アドレスにNDMA転送で読み捨てる + *---------------------------------------------------------------------------*/ +#ifdef USE_NEW_DMA +void HOTSW_NDmaPipe_Card(u32 ndmaNo, const void *src, void *dest, u32 size) +{ + HOTSWi_NDmaCopy_Card(ndmaNo, src, dest, size, MI_NDMA_DEST_FIX); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_NDmaCopy_Card + + Description: NDMA転送の準備 + + 注:先にこの関数でDMA転送の準備をしてから、カードレジスタのstartフラグを上げてください + *---------------------------------------------------------------------------*/ +#ifdef USE_NEW_DMA +static void HOTSWi_NDmaCopy_Card(u32 ndmaNo, const void *src, void *dest, u32 size, u32 dcont) +{ + u32 contData; + OSIntrMode enabled = OS_DisableInterrupts(); + + //--- Assert + ASSERT_NDMANO( ndmaNo ); + + //---- confirm CARD free + HOTSW_WaitCardCtrl(); + + //---- confirm DMA free + HOTSW_WaitNDmaCtrl(ndmaNo); + + //---- Handler Set + (void)OS_SetIrqFunction(OS_IE_NDMA2, InterruptCallbackNDma); + + //---- set up registers + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_SAD_WOFFSET ) = (u32)src; + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_DAD_WOFFSET ) = (u32)dest; + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_BCNT_WOFFSET ) = MI_NDMA_INTERVAL_PS_1; + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_TCNT_WOFFSET ) = (u32)(size/4); + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_WCNT_WOFFSET ) = NDMA_WORD_COUNT_1; + + //---- decide control register + contData = MI_NDMA_BWORD_1 | MI_NDMA_ENABLE/* | MI_NDMA_CONTINUOUS_ON*/; + contData |= MI_NDMA_SRC_FIX | dcont | MI_NDMA_SRC_RELOAD_DISABLE | MI_NDMA_DEST_RELOAD_DISABLE; +#ifndef DEBUG_USED_CARD_SLOT_B_ + contData |= MI_NDMA_TIMING_CARD_A; +#else + contData |= MI_NDMA_TIMING_CARD_B; +#endif + + //---- set interrupt enable + contData |= MI_NDMA_IF_ENABLE; + + //---- start + MI_NDMA_REG( ndmaNo, MI_NDMA_REG_CNT_WOFFSET ) = contData; + + (void)OS_RestoreInterrupts( enabled ); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: InterruptCallbackNDma + + Description: カードB データ転送終了割り込みハンドラ + *---------------------------------------------------------------------------*/ +#ifdef USE_NEW_DMA +static void InterruptCallbackNDma(void) +{ + // メッセージ送信 + OS_SendMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&HotSwThreadData.hotswDmaMsg[HotSwThreadData.idx_dma], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_dma = (HotSwThreadData.idx_dma+1) % HOTSW_DMA_MSG_NUM; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_DmaCopy32_Card + + Description: カードから送られてきたデータを指定アドレスにDMA転送する + *---------------------------------------------------------------------------*/ +#ifndef USE_NEW_DMA +void HOTSW_DmaCopy32_Card(u32 dmaNo, const void *src, void *dest, u32 size) +{ + HOTSWi_DmaCopy32_Card(dmaNo, src, dest, size, MI_DMA_DEST_INC); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_DmaPipe32_Card + + Description: カードから送られてきたデータを指定アドレスにDMA転送で読み捨てる + *---------------------------------------------------------------------------*/ +#ifndef USE_NEW_DMA +void HOTSW_DmaPipe32_Card(u32 dmaNo, const void *src, void *dest, u32 size) +{ + HOTSWi_DmaCopy32_Card(dmaNo, src, dest, size, MI_DMA_DEST_FIX); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_DmaCopy32_Card + + Description: DMA転送の準備 + + 注:先にこの関数でDMA転送の準備をしてから、カードレジスタのstartフラグを上げてください + *---------------------------------------------------------------------------*/ +#ifndef USE_NEW_DMA +static void HOTSWi_DmaCopy32_Card(u32 dmaNo, const void *src, void *dest, u32 size, u32 dcont) +{ + u32 contData; + + //--- Assert + ASSERT_DMANO( dmaNo ); + + if (size == 0) + { + return; + } + + //---- confirm CARD free + HOTSW_WaitCardCtrl(); + + //---- confirm DMA free + HOTSW_WaitDmaCtrl(dmaNo); + + //---- decide control register + contData = ( MI_DMA_ENABLE | MI_DMA_IF_ENABLE | MI_DMA_TIMING_CARD | MI_DMA_SRC_FIX | dcont | MI_DMA_CONTINUOUS_ON | MI_DMA_32BIT_BUS | 1 ); + + //---- parameter set + HOTSWi_DmaSetParameters(dmaNo, (u32)src, (u32)dest, contData, 0); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_DmaSetParameters + + Description: DMAのパラメータセット + *---------------------------------------------------------------------------*/ +#ifndef USE_NEW_DMA +static void HOTSWi_DmaSetParameters(u32 dmaNo, u32 src, u32 dest, u32 ctrl, u32 mode) +{ + OSIntrMode enabled; + vu32 *p; + + if ( ! (mode & MIi_DMA_MODE_NOINT) ) + { + enabled = OS_DisableInterrupts(); + } + + //p = (vu32 *)((u32)REG_DMA0SAD_ADDR + dmaNo * 12); + p = (vu32*)MI_DMA_REGADDR( dmaNo, MI_DMA_REG_SAD_WOFFSET ); + + if ( mode & MIi_DMA_MODE_SRC32 ) + { + MIiDmaClearSrc *srcp = (MIiDmaClearSrc *) ((u32)MIi_DMA_CLEAR_DATA_BUF + dmaNo * 4); + srcp->b32 = src; + src = (u32)srcp; + } + else if ( mode & MIi_DMA_MODE_SRC16 ) + { + MIiDmaClearSrc *srcp = (MIiDmaClearSrc *) ((u32)MIi_DMA_CLEAR_DATA_BUF + dmaNo * 4); + srcp->b16 = (u16)src; + src = (u32)srcp; + } + + *p = (vu32)src; + *(p + 1) = (vu32)dest; + *(p + 2) = (vu32)ctrl; + + if ( mode & MIi_DMA_MODE_WAIT ) + { + // ARM7 must wait 2 cycle (load is 3 cycle) + u32 dummy = reg_MI_DMA0SAD; + } + + if ( ! (mode & MIi_DMA_MODE_NOINT) ) + { + (void)OS_RestoreInterrupts(enabled); + } +} +#endif \ No newline at end of file diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/dsCardCommon.c b/build/libraries_sysmenu/hotsw/ARM7/src/dsCardCommon.c new file mode 100644 index 00000000..66af1552 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/dsCardCommon.c @@ -0,0 +1,932 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: dsCardCommon.c + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +// extern ------------------------------------------------------------------- +extern CardThreadData HotSwThreadData; + +// define ------------------------------------------------------------------- +#define SECURE_SEGMENT_NUM 4 +#define ONE_SEGMENT_PAGE_NUM 8 + +#define ROM_EMULATION_START_OFS 0x160 +#define ROM_EMULATION_END_OFS 0x180 + +#define RD_NORMAL_ID_LATENCY1 0x657 + +// static value ------------------------------------------------------------- +static OSMessage s_Msg; + +// Function prototype ------------------------------------------------------- +static HotSwState HOTSWi_ChangeModeNormal(CardBootData *cbd, u64 cmd); +static void PreSendSecureCommand(CardBootData *cbd, u32 *scrambleMask); + +// =========================================================================== +// Function Describe +// =========================================================================== + +/*---------------------------------------------------------------------------* + Name: HOTSWi_SetCommand + + Description: 引数で与えられたコマンドのエンディアンを変えてレジスタにセットする + *---------------------------------------------------------------------------*/ +void HOTSWi_SetCommand(GCDCmd64 *cndLE) +{ + GCDCmd64 cndBE; + + // ビッグエンディアンに直す + cndBE.b[7] = cndLE->b[0]; + cndBE.b[6] = cndLE->b[1]; + cndBE.b[5] = cndLE->b[2]; + cndBE.b[4] = cndLE->b[3]; + cndBE.b[3] = cndLE->b[4]; + cndBE.b[2] = cndLE->b[5]; + cndBE.b[1] = cndLE->b[6]; + cndBE.b[0] = cndLE->b[7]; + + // MCCMD レジスタ設定 + reg_HOTSW_MCCMD0 = *(u32*)cndBE.b; + reg_HOTSW_MCCMD1 = *(u32*)&cndBE.b[4]; +} + + +// ■------------------------------------■ +// ■ ノーマルモードのコマンド ■ +// ■------------------------------------■ +/*---------------------------------------------------------------------------* + Name: ReadIDNormal + + Description: ノーマルモード時のカードIDを読み込む関数 + *---------------------------------------------------------------------------*/ +HotSwState ReadIDNormal(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &cbd->id_nml, sizeof(cbd->id_nml) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &cbd->id_nml, sizeof(cbd->id_nml) ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_RD_ID; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | HOTSW_PAGE_STAT | (RD_NORMAL_ID_LATENCY1 & LATENCY1_MASK); + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + // 1us Wait + OS_SpinWait( OS_USEC_TO_CPUCYC(1) ); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadBootSegNormal + + Description: ノーマルモードのBoot Segment読み込み + + CT=240ns Latency1=0x1fff Latency2=0x3f Pagecount=8page + *---------------------------------------------------------------------------*/ +HotSwState ReadBootSegNormal(CardBootData *cbd) +{ + u32 i, loop, pc, size; + u32 *dst = cbd->pBootSegBuf->word; + u32 temp; + u64 page = 0; + GCDCmd64 cndLE; + + if(cbd->cardType == DS_CARD_TYPE_1){ + loop = 0x1UL; + pc = 0x4UL; + size = BOOT_SEGMENT_SIZE; + } + else{ + loop = ONE_SEGMENT_PAGE_NUM; + pc = 0x1UL; + size = PAGE_SIZE; + } + + // secure2モード移行の為、Boot Segmentを1ページ分読み込む。データは捨てバッファに格納 + if(cbd->modeType == HOTSW_MODE2){ + loop = 0x1UL; + pc = 0x1UL; + size = PAGE_SIZE; + } + + for(i=0; imodeType == HOTSW_MODE1){ + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, dst + (u32)(PAGE_WORD_SIZE*i), size ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, dst + (u32)(PAGE_WORD_SIZE*i), size ); +#endif + } + else{ + // DMA転送(読み捨て)の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaPipe_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &temp, size ); +#else + HOTSW_DmaPipe32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &temp, size ); +#endif + } + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_RD_PAGE; + cndLE.dw |= page << HSWOP_N_RD_PAGE_ADDR_SHIFT; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | CT_MASK | PC_MASK & (pc << PC_SHIFT) | LATENCY2_MASK | LATENCY1_MASK; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + page++; + + // 10us Wait + OS_SpinWait( OS_USEC_TO_CPUCYC(10) ); + } + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadStatusNormal + + Description: ノーマルモードでステータスを読み込む + *---------------------------------------------------------------------------*/ +HotSwState ReadStatusNormal(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + cbd->romStatus = HOTSW_ROMST_RFS_READY_MASK; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &cbd->romStatus, sizeof(cbd->romStatus) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &cbd->romStatus, sizeof(cbd->romStatus) ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_RD_STAT; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~(SCRAMBLE_MASK | LATENCY1_MASK)) | START_MASK | HOTSW_PAGE_STAT; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: RefreshBadBlockNormal + + Description: ノーマルモードでバッドブロックを置換 + *---------------------------------------------------------------------------*/ +HotSwState RefreshBadBlockNormal(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_RFS_BLK; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~(SCRAMBLE_MASK | LATENCY1_MASK)) | START_MASK | HOTSW_PAGE_0; + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ChangeModeNormal + + Description: ノーマルモードからセキュアモードへの変更 + + CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page + *---------------------------------------------------------------------------*/ +HotSwState ChangeModeNormal(CardBootData *cbd) +{ + return HOTSWi_ChangeModeNormal(cbd, HSWOP_N_OP_CHG_MODE); +} + + +/*---------------------------------------------------------------------------* + Name: ChangeModeNorma2 + + Description: ノーマルモードからセキュア2モードへの変更 + + CT=240ns Latency1=0x18 Latency2=0 Pagecount=0page + *---------------------------------------------------------------------------*/ +HotSwState ChangeModeNormal2(CardBootData *cbd) +{ + return HOTSWi_ChangeModeNormal(cbd, HSWOP_N_OP_CHG2_MODE); +} + + +static HotSwState HOTSWi_ChangeModeNormal(CardBootData *cbd, u64 cmd) +{ + GCDCmd64 cndLE; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // リトルエンディアンで作って + cndLE.dw = cmd; + cndLE.dw |= cbd->vbi << HSWOP_N_VBI_SHIFT; + cndLE.dw |= (u64)cbd->vae << HSWOP_N_VAE_SHIFT; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~SCRAMBLE_MASK) | START_MASK | HOTSW_PAGE_0; + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + // 47us Wait + OS_SpinWait( OS_USEC_TO_CPUCYC(47) ); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: LoadTable + + Description: カード側の Key Table をロードする関数 + + ※この関数は開発カード用に発行しないといけない。 +  製品版カードの場合、このコマンドは無視される + *---------------------------------------------------------------------------*/ +HotSwState LoadTable(void) +{ + GCDCmd64 cndLE; + u32 temp; + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaPipe_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &temp, HOTSW_LOAD_TABLE_SIZE ); +#else + HOTSW_DmaPipe32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &temp, HOTSW_LOAD_TABLE_SIZE ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_LD_TABLE; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | HOTSW_PAGE_16 | LATENCY2_MASK & (0x18 << LATENCY2_SHIFT); + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + // 1us Wait + OS_SpinWait( OS_USEC_TO_CPUCYC(1) ); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadRomEmulationInfo + + Description: Romエミュレーション情報の読み込み + *---------------------------------------------------------------------------*/ +HotSwState ReadRomEmulationInfo(SYSMRomEmuInfo *info) +{ + u32 count=0; + u32 temp; + u32 *dst = (void*)info; + + MI_CpuClear8( info, sizeof(SYSMRomEmuInfo) ); + + // 量産用CPUでは平文アクセス防止のためリードしない + if ( ! (*(u8*)HWi_WSYS08_ADDR & HWi_WSYS08_OP_OPT_MASK) || + ! ((OS_GetRunningConsoleType() & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB) + ) + { + return HOTSW_SUCCESS; + } + + // MCCMD レジスタ設定 + reg_HOTSW_MCCMD0 = 0x3e000000; + reg_HOTSW_MCCMD1 = 0x0; + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 (START = 1 PC = 001(1ページリード)に latency1 = 0x5fe) + reg_HOTSW_MCCNT1 = START_MASK | HOTSW_PAGE_1 | (0x5fe & LATENCY1_MASK); + + // MCCNTレジスタのRDYフラグをポーリングして、フラグが立ったらデータをMCD1レジスタに再度セット。スタートフラグが0になるまでループ。 + while(reg_HOTSW_MCCNT1 & START_FLG_MASK){ + while(!(reg_HOTSW_MCCNT1 & READY_FLG_MASK)){} + if(count >= ROM_EMULATION_START_OFS && count < ROM_EMULATION_END_OFS){ + *dst++ = reg_HOTSW_MCD1; + } + else{ + temp = reg_HOTSW_MCD1; + } + count+=4; + } + + return HOTSW_SUCCESS; +} + + +// ■--------------------------------------■ +// ■ セキュアモードのコマンド ■ +// ■--------------------------------------■ +/*---------------------------------------------------------------------------* + Name: SetSecureCommand + + Description: 引数で与えられたコマンドをBlowfishで暗号化してレジスタにセット + *---------------------------------------------------------------------------*/ +static void SetSecureCommand(SecureCommandType type, CardBootData *cbd) +{ + GCDCmd64 cndLE; + u64 data; + BLOWFISH_CTX *ctx; + + // comannd0部分 + switch(type){ + case S_RD_ID: + cndLE.dw = HSWOP_S_OP_RD_ID; + break; + + case S_PNG_ON: + cndLE.dw = HSWOP_S_OP_PNG_ON; + break; + + case S_PNG_OFF: + cndLE.dw = HSWOP_S_OP_PNG_OFF; + break; + + case S_CHG_MODE: + cndLE.dw = HSWOP_S_OP_CHG_MODE; + break; + } + + // コマンド作成 + data = (type == S_PNG_ON) ? (u64)cbd->vd : (u64)cbd->vae; + cndLE.dw |= cbd->vbi; + cndLE.dw |= data << HSWOP_S_VA_SHIFT; + + if(!HOTSWi_IsRomEmulation()){ + ctx = (cbd->modeType == HOTSW_MODE1) ? &cbd->keyTable : &cbd->keyTable2; + + // コマンドの暗号化 + EncryptByBlowfish( ctx, (u32*)&cndLE.b[4], (u32*)cndLE.b ); + } + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); +} + + +/*---------------------------------------------------------------------------* + Name: PreSendSecureCommand + + Description: + *---------------------------------------------------------------------------*/ +static void PreSendSecureCommand(CardBootData *cbd, u32 *scrambleMask) +{ + // ★ TWL-ROM&NTR-3DM対応 + if(cbd->cardType == DS_CARD_TYPE_2){ + u32 latency = (u32)cbd->pBootSegBuf->rh.s.secure_cmd_latency * 0x100; + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | *scrambleMask | cbd->pBootSegBuf->rh.s.secure_cmd_param; + + // セキュアコマンド間レイテンシ待ち + OS_Sleep( OS_CPUCYC_TO_MSEC(latency) ); + } + // ★ TWL-XtraROM&NTR-MROM対応 + else{ + *scrambleMask |= TRM_MASK; + } +} + + +/*---------------------------------------------------------------------------* + Name: ReadIDSecure + + Description: + + CT=240ns Latency1=0x8f8+0x18 Latency2=0 Pagecount=Status + *---------------------------------------------------------------------------*/ +HotSwState ReadIDSecure(CardBootData *cbd) +{ + u32 scrambleMask; + u32 *buf = (cbd->modeType == HOTSW_MODE1) ? &cbd->id_scr : &cbd->id_scr2; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // スクランブルの設定 + scrambleMask = HOTSWi_IsRomEmulation() ? 0 : (u32)(SCRAMBLE_MASK & ~CS_MASK); + + // コマンド作成・設定 + SetSecureCommand(S_RD_ID, cbd); + + // コマンド初回送信(NTR-MROMはレイテンシクロック設定変更のみ) + PreSendSecureCommand(cbd, &scrambleMask); + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, buf, sizeof(buf) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, buf, sizeof(buf) ); +#endif + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | HOTSW_PAGE_STAT | scrambleMask | cbd->pBootSegBuf->rh.s.secure_cmd_param; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + // コマンドカウンタインクリメント + cbd->vbi++; + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadSegSecure + + Description: + *---------------------------------------------------------------------------*/ +HotSwState ReadSegSecure(CardBootData *cbd) +{ + u32 scrambleMask = HOTSWi_IsRomEmulation() ? 0 : (u32)(SCRAMBLE_MASK & ~CS_MASK); + u32 *buf = (cbd->modeType == HOTSW_MODE1) ? cbd->pSecureSegBuf : cbd->pSecure2SegBuf; + u32 loop, pc, size, interval, i, j=0, k; + u64 segNum = 4; + GCDCmd64 cndLE; + BLOWFISH_CTX *ctx = (cbd->modeType == HOTSW_MODE1) ? &cbd->keyTable : &cbd->keyTable2; + + if(cbd->cardType == DS_CARD_TYPE_1){ + loop = 0x1UL; + pc = 0x4UL; + size = ONE_SEGMENT_SIZE; + interval = ONE_SEGMENT_WORD_SIZE; + } + else{ + loop = ONE_SEGMENT_PAGE_NUM; + pc = 0x1UL; + size = PAGE_SIZE; + interval = PAGE_WORD_SIZE; + } + + for(i=0; ivbi; + cndLE.dw |= (u64)cbd->vae << HSWOP_S_VA_SHIFT; + cndLE.dw |= segNum << HSWOP_S_VC_SHIFT; + + // コマンドの暗号化 + EncryptByBlowfish( ctx, (u32*)&cndLE.b[4], (u32*)cndLE.b ); + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // コマンド初回送信(NTR-MROMはレイテンシクロック設定変更のみ) + PreSendSecureCommand(cbd, &scrambleMask); + + for(k=0; kpBootSegBuf->rh.s.secure_cmd_param; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + // 転送済みページ数 + j++; + } + + // 読み込みセグメント番号インクリメント + segNum++; + + // コマンドカウンタインクリメント + cbd->vbi++; + } + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: SwitchONPNGSecure + + Description: + *---------------------------------------------------------------------------*/ +HotSwState SwitchONPNGSecure(CardBootData *cbd) +{ + u32 scrambleMask; + + if(!HOTSW_IsCardExist()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // スクランブルの設定 + scrambleMask = HOTSWi_IsRomEmulation() ? 0 : (u32)(SCRAMBLE_MASK & ~CS_MASK); + + // コマンド作成・設定 + SetSecureCommand(S_PNG_ON, cbd); + + // コマンド初回送信(NTR-MROMはレイテンシクロック設定変更のみ) + PreSendSecureCommand(cbd, &scrambleMask); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | scrambleMask | cbd->pBootSegBuf->rh.s.secure_cmd_param | (cbd->secureLatency & LATENCY1_MASK); + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + // コマンドカウンタインクリメント + cbd->vbi++; + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: SwitchOFFPNGSecure + + Description: + *---------------------------------------------------------------------------*/ +HotSwState SwitchOFFPNGSecure(CardBootData *cbd) +{ + u32 scrambleMask; + + if(!HOTSW_IsCardExist()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // スクランブルの設定 + scrambleMask = HOTSWi_IsRomEmulation() ? 0 : (u32)(SCRAMBLE_MASK & ~CS_MASK); + + // コマンド作成・設定 + SetSecureCommand(S_PNG_OFF, cbd); + + // コマンド初回送信(NTR-MROMはレイテンシクロック設定変更のみ) + PreSendSecureCommand(cbd, &scrambleMask); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | scrambleMask | cbd->pBootSegBuf->rh.s.secure_cmd_param | (cbd->secureLatency & LATENCY1_MASK); + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + // コマンドカウンタインクリメント + cbd->vbi++; + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ChangeModeSecure + + Description: + + CT=240ns Latency1=0x8f8+0x18 Latency2=0 Pagecount=0page + *---------------------------------------------------------------------------*/ +HotSwState ChangeModeSecure(CardBootData *cbd) +{ + u32 scrambleMask; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // スクランブルの設定 + scrambleMask = HOTSWi_IsRomEmulation() ? 0 : (u32)(SCRAMBLE_MASK & ~CS_MASK); + + // コマンド作成・設定 + SetSecureCommand(S_CHG_MODE, cbd); + + // コマンド初回送信(NTR-MROMはレイテンシクロック設定変更のみ) + PreSendSecureCommand(cbd, &scrambleMask); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = START_MASK | scrambleMask | cbd->pBootSegBuf->rh.s.secure_cmd_param | (cbd->secureLatency & LATENCY1_MASK); + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + // コマンドカウンタインクリメント + cbd->vbi++; + + return HOTSW_SUCCESS; +} + + +// ■------------------------------------■ +// ■ ゲームモードのコマンド ■ +// ■------------------------------------■ +/*---------------------------------------------------------------------------* + Name: ReadIDGame + + Description: ゲームモードでIDを読み込む + *---------------------------------------------------------------------------*/ +HotSwState ReadIDGame(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &cbd->id_gam, sizeof(cbd->id_gam) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &cbd->id_gam, sizeof(cbd->id_gam) ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_G_OP_RD_ID; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = cbd->gameCommondParam | START_MASK | HOTSW_PAGE_STAT; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + // 1us Wait + OS_SpinWait( OS_USEC_TO_CPUCYC(1) ); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: ゲームモードで、指定されたページを指定バッファに指定サイズ分を読み込む + + CT=150ns Pagecount=1page Latency=RomHeaderで指定の値 + *---------------------------------------------------------------------------*/ +HotSwState ReadPageGame(CardBootData *cbd, u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + GCDCmd64 cndLE; + + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + for(i=0; igameCommondParam | START_MASK | HOTSW_PAGE_1; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + } + + // 100ns Wait + OS_SpinWait( OS_NSEC_TO_CPUCYC(100) ); + + return HOTSW_SUCCESS; +} + + +/*---------------------------------------------------------------------------* + Name: ReadStatusGame + + Description: ゲームモードでステータスを読み込む + *---------------------------------------------------------------------------*/ +HotSwState ReadStatusGame(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + cbd->romStatus = HOTSW_ROMST_RFS_READY_MASK; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // DMA転送の準備 +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, &cbd->romStatus, sizeof(cbd->romStatus) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, &cbd->romStatus, sizeof(cbd->romStatus) ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_G_OP_RD_STAT; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 (START = 1 W/R = 0 PC = 111(ステータスリード) その他Romヘッダの情報におまかせ) + reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~LATENCY1_MASK) | START_MASK | HOTSW_PAGE_STAT; + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + return HOTSW_SUCCESS; +} + + +/* ----------------------------------------------------------------- + RefreshBadBlockGame関数 + + ゲームモードでバッドブロックを置換 + * ----------------------------------------------------------------- */ +HotSwState RefreshBadBlockGame(CardBootData *cbd) +{ + GCDCmd64 cndLE; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + // リトルエンディアンで作って + cndLE.dw = HSWOP_G_OP_RFS_BLK; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK ); + + // MCCNT1 レジスタ設定 + reg_HOTSW_MCCNT1 = (cbd->gameCommondParam & ~LATENCY1_MASK) | START_MASK | HOTSW_PAGE_0; + + // カードデータ転送終了まで待つ + HOTSW_WaitCardCtrl(); + + return HOTSW_SUCCESS; +} diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/hotsw.c b/build/libraries_sysmenu/hotsw/ARM7/src/hotsw.c new file mode 100644 index 00000000..5df571cf --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/hotsw.c @@ -0,0 +1,2563 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: hotsw.c + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include <../build/libraries/mb/common/include/mb_fileinfo.h> + +//#define HOTSW_DISABLE_FORCE_CARD_OFF +#define HOTSW_CHECK_CREATE_MONITOR_THREAD + +// カード電源ONからROMヘッダロードまでの期間にスリープに入る時のワンセグ対策しない場合 +//#define HOWSW_ENABLE_DEEP_SLEEP_WHILE_INSERT_CARD + +// define ------------------------------------------------------------------- +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) +//#define CHATTERING_COUNTER 0x264c // 150ms分 (0x264c * 15.3us = 150001us) +//#define CHATTERING_COUNTER 0x3310 // 200ms分 (0x3310 * 15.3us = 200001us) +//#define CHATTERING_COUNTER 0x4c98 // 300ms分 (0x4c98 * 15.3us = 300002us) + +#define COUNTER_A 0x264c // 150ms分 (0x264c * 15.3us = 150001us) + +#define CARD_EXIST_CHECK_POLLING_TIME 100 +#define CARD_INSERT_CHECK_INTERVAL 5 + +#define UNDEF_CODE 0xe7ffdeff // 未定義コード +#define ENCRYPT_DEF_SIZE 0x800 // 2KB ※ ARM9常駐モジュール先頭2KB + +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) + +#define SLOT_B_LOCK_BUF HW_CTRDG_LOCK_BUF + +#define HOTSW_DSTV_GAME_CODE 'JSNU' + +#ifdef SDK_ARM9 +#define reg_HOTSW_EXMEMCNT reg_MI_EXMEMCNT +#define HOTSW_EXMEMCNT_SELB_MASK REG_MI_EXMEMCNT_MPB_MASK +#define HOTSW_EXMEMCNT_SELB_SHIFT REG_MI_EXMEMCNT_MPB_SHIFT +#else // SDK_ARM7 +#define reg_HOTSW_EXMEMCNT reg_MI_EXMEMCNT_L +#define HOTSW_EXMEMCNT_SELB_MASK 0x0400 +#define HOTSW_EXMEMCNT_SELB_SHIFT 10 +#endif + +// enum --------------------------------------------------------------------- +typedef enum HotSwCallBackType{ + HOTSW_CHANGE_GAMEMODE = 0, + HOTSW_CARD_INSERT, + HOTSW_CARD_PULLOUT +} HotSwCallBackType; + +// Function prototype ------------------------------------------------------- +static u32 GetMcSlotMode(void); +static void SetMcSlotMode(u32 mode); + +static void SetInterruptCallback( OSIrqMask intr_bit, OSIrqFunction func ); +static void SetInterruptCallbackEx( OSIrqMask intr_bit, void *func ); +static void SetInterrupt(void); + +static void InterruptCallbackCardDet(void); +static void InterruptCallbackPxi(PXIFifoTag tag, u32 data, BOOL err); +#ifndef USE_NEW_DMA +static void InterruptCallbackCardData(void); +#endif + +static void LockHotSwRsc(OSLockWord* word); +static void UnlockHotSwRsc(OSLockWord* word); + +static void HotSwThread(void *arg); +static void MonitorThread(void *arg); + +static void McPowerOn(void); +static void McPowerOff(void); +static void SetMCSCR(void); + +static BOOL isTwlModeLoad(void); +static HotSwState ReadSecureModeCardData(void); +static void ClearCardFlgs(void); + +static void FinalizeHotSw(HotSwCardState state); +static void ForceNitroModeToFinalize(void); +static void ForceNormalModeToFinalize(void); +static BOOL ChangeGameMode(void); +static void ClearCardIrq(void); +static void ClearAllCardRegister(void); + +static HotSwState LoadCardData(void); +static void RegisterRomEmuInfo(void); +static void GenVA_VB_VD(void); + +static HotSwState ReadImageReturnErrorCode(void* dest, s32 offset, s32 length, void* arg); +static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg); + +static HotSwState LoadBannerData(void); +static HotSwState CheckCardAuthCode(void); + +#ifndef USE_WRAM_LOAD +static HotSwState DecryptObjectFile(void); +static HotSwState LoadStaticModule(void); + +static HotSwState CheckStaticModuleHash(void); +static BOOL CheckArm7HashValue(void); +static BOOL CheckArm9HashValue(void); +static BOOL CheckExtArm7HashValue(void); +static BOOL CheckExtArm9HashValue(void); +#else +static void ReadCardData(u32 src, u32 dest, u32 size); +static void SendPxiMessage(HotSwCallBackType type); +#endif + +static void DebugPrintErrorMessage(HotSwState state); + +HotSwState HOTSWi_RefreshBadBlock(u32 romMode); + +static void CheckCardInsert(BOOL cardExist); +static void CheckCardPullOut(BOOL cardExist); +static void SendInsertMessage(void); + +static void PulledOutSequence(void); + +// Static Values ------------------------------------------------------------ +#include + +static char encrypt_object_key[] ATTRIBUTE_ALIGN(4) = "encryObj"; + +static u16 s_RscLockID; +static u16 s_CardLockID; +static u16 s_PollingLockID; +static u16 s_bondingOp; + +static u32 s_BootSegBufSize, s_SecureSegBufSize, s_Secure2SegBufSize; + +static u32 s_gameID; + +static BootSegmentData *s_pBootSegBuffer; +static u32 *s_pSecureSegBuffer; +static u32 *s_pSecure2SegBuffer; + +static CardBootData s_cbData ATTRIBUTE_ALIGN(4); +static SYSMRomEmuInfo s_romEmuInfo; +static BOOL s_isRomEmu; +static BOOL s_debuggerFlg; + +static BOOL s_isPulledOut = TRUE; +static BOOL s_pollingThreadSleepFlg = FALSE; + +static volatile BOOL s_isBusyMonitorThread; + +// HMACSHA1の鍵 +static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = { + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24 +}; + +static CardSecureModeFunction s_funcTable[] = { + // Game Card + { ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure}, + // RomEmulation + { ReadIDSecure_ROMEMU, ReadSegSecure_ROMEMU, SwitchONPNGSecure_ROMEMU, ChangeModeSecure_ROMEMU } +}; + +// Global Values ------------------------------------------------------------ +BLOWFISH_CTX HotSwBlowfishInitTableBufDS; +CardThreadData HotSwThreadData; + +#include + +// =========================================================================== +// Function Describe +// =========================================================================== + +/*---------------------------------------------------------------------------* + Name: HOTSW_Init + + Description: + *---------------------------------------------------------------------------*/ +void HOTSW_Init(u32 threadPrio) +{ + SYSM_work* sw = SYSMi_GetWork(); + + OS_InitTick(); + OS_InitThread(); + +#ifndef INITIAL_KEYTABLE_PRELOAD + // 初期化後に他の用途でWRAM_0を使用できるようにローカルバッファへコピーしておく + MI_CpuCopyFast((void *)HW_WRAM_0_LTD, &HotSwBlowfishInitTableBufDS, sizeof(BLOWFISH_CTX)); +#endif + + // PXI初期化 + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_HOTSW, InterruptCallbackPxi); + +#ifdef USE_WRAM_LOAD + while(!PXI_IsCallbackReady(PXI_FIFO_TAG_HOTSW, PXI_PROC_ARM9)) + { + // do nothing + } +#endif + + // 割り込みマスクの設定 + SetInterrupt(); + + // 割り込みの有効化 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // チャッタリングカウンタの値を設定 + reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC1_CC_MASK) | + (CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT)); + + // Counter-Aの値を設定 + reg_MI_MC2 = COUNTER_A; + + // Bonding Optionの取得 + s_bondingOp = SCFG_REG_GetBondingOption(); + + // 構造体の初期化 + MI_CpuClear8(&s_cbData, sizeof(CardBootData)); + + // カードスレッド用構造体の初期化 + MI_CpuClear8(&HotSwThreadData, sizeof(CardThreadData)); + + // HotSwリソースの排他制御用Lock IDの取得(開放しないで持ち続ける) + { + s32 tempLockID; + // ARM9と排他制御用のロックIDの取得 + while((tempLockID = OS_GetLockID()) == OS_LOCK_ID_ERROR){ + // do nothing + } + s_RscLockID = (u16)tempLockID; + + // カードアクセス用のロックIDの取得 + while((tempLockID = OS_GetLockID()) == OS_LOCK_ID_ERROR){ + // do nothing + } + s_CardLockID = (u16)tempLockID; + + // ポーリングスレッド用のロックIDの取得 + while((tempLockID = OS_GetLockID()) == OS_LOCK_ID_ERROR){ + // do nothing + } + s_PollingLockID = (u16)tempLockID; + } + + // メッセージキューの初期化 + OS_InitMessageQueue( &HotSwThreadData.hotswQueue, &HotSwThreadData.hotswMsgBuffer[0], HOTSW_MSG_BUFFER_NUM ); + OS_InitMessageQueue( &HotSwThreadData.hotswDmaQueue, &HotSwThreadData.hotswDmaMsgBuffer[0], HOTSW_DMA_MSG_NUM ); + OS_InitMessageQueue( &HotSwThreadData.hotswPollingCtrlQueue, &HotSwThreadData.hotswPollingCtrlBuffer[0], HOTSW_POLLING_CTRL_BUFFER_NUM ); + + // isLoadRomEmuOnlyフラグが立っている時は、LoadCardData関数においてカードの読み込みがNormalモードで終わってしまうため + // MonitorThreadで挿されているかの確認で行っているGameModeのID読みが正常に出来ないため、ID照合で不一致が起こってしまう。 + // それを防ぐために、isLoadRomEmuOnlyフラグが立っているときは、MonitorThreadを生成・起動しないようにする。 + // ※ isLoadRomEmuOnlyフラグはHyenaのMain関数でHOTSW_Initが呼ばれる前に処理されている。 +#ifdef HOTSW_CHECK_CREATE_MONITOR_THREAD + if(!SYSMi_GetWork()->flags.hotsw.isLoadRomEmuOnly){ +#endif + // カードの状態監視用スレッドの生成 ( DSテレビ対策 ) + OS_CreateThread(&HotSwThreadData.monitorThread, + MonitorThread, + NULL, + HotSwThreadData.monitorStack + HOTSW_THREAD_STACK_SIZE / sizeof(u64), + HOTSW_THREAD_STACK_SIZE, + threadPrio + ); + + // スレッド起動 + OS_WakeupThreadDirect(&HotSwThreadData.monitorThread); +#ifdef HOTSW_CHECK_CREATE_MONITOR_THREAD + } +#endif + + // カードデータロード用スレッドの生成 ※カード状態監視スレッドと優先度同じだけど、後に作成したこっちのスレッドが優先される + OS_CreateThread(&HotSwThreadData.hotswThread, + HotSwThread, + NULL, + HotSwThreadData.hotswStack + HOTSW_THREAD_STACK_SIZE / sizeof(u64), + HOTSW_THREAD_STACK_SIZE, + threadPrio + ); + + // スレッド起動 + OS_WakeupThreadDirect(&HotSwThreadData.hotswThread); + + // バッファの設定 + HOTSW_SetBootSegmentBuffer((void *)SYSM_CARD_ROM_HEADER_BAK, SYSM_APP_ROM_HEADER_SIZE ); + HOTSW_SetSecureSegmentBuffer(HOTSW_MODE1, (void *)SYSM_CARD_NTR_SECURE_BUF, SECURE_AREA_SIZE ); + HOTSW_SetSecureSegmentBuffer(HOTSW_MODE2, (void *)SYSM_CARD_TWL_SECURE_BUF, SECURE_AREA_SIZE ); + + // カードが挿さってあったらスレッドを起動する + if(HOTSW_IsCardExist()){ + // メッセージ送信 + OS_SendMessage(&HotSwThreadData.hotswQueue, (OSMessage)&HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_insert = (HotSwThreadData.idx_insert+1) % HOTSW_INSERT_MSG_NUM; + } + else{ + sw->flags.hotsw.is1stCardChecked = TRUE; + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_CopyInitialKeyTable + + Description: DS互換BlowfishテーブルをWRAM経由でローカルにコピーする + + ※この関数はHOTSW_Initが呼ばれる前に呼んで下さい。 + *---------------------------------------------------------------------------*/ +#ifdef INITIAL_KEYTABLE_PRELOAD +void HOTSW_CopyInitialKeyTable(void) +{ + // ARM9でKey Tableの用意が出来るまでポーリング + while( !SYSMi_GetWork()->flags.hotsw.isKeyTableLoadReady ){ + OS_SpinWait( 0x400 ); + } + + // 初期化後に他の用途でWRAM_0を使用できるようにローカルバッファへコピーしておく + MI_CpuCopyFast((void *)HW_WRAM_0_LTD, &HotSwBlowfishInitTableBufDS, sizeof(BLOWFISH_CTX)); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: LoadCardData + + Description: カードからデータをロードする + + ※BootSegmentBuffer SecureSegmentBufferの設定を行ってから + この関数を呼んでください。 + *---------------------------------------------------------------------------*/ +static HotSwState LoadCardData(void) +{ + HotSwState retval = HOTSW_SUCCESS; + HotSwState state = HOTSW_SUCCESS; + u32 romMode = HOTSW_ROM_MODE_NULL; + + // カードのロック + CARD_LockRom(s_CardLockID); + + // カード電源リセット + McPowerOff(); +#ifndef HOWSW_ENABLE_DEEP_SLEEP_WHILE_INSERT_CARD + MCU_EnableDeepSleepToPowerLine( MCU_PWR_LINE_33, FALSE ); +#endif + McPowerOn(); + + // バッファを設定 + s_cbData.pBootSegBuf = s_pBootSegBuffer; + s_cbData.pSecureSegBuf = s_pSecureSegBuffer; + s_cbData.pSecure2SegBuf= s_pSecure2SegBuffer; + + // ロード処理開始 + if(HOTSW_IsCardAccessible()){ + s_cbData.modeType = HOTSW_MODE1; + + // カード側でKey Tableをロードする + state = LoadTable(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ---------------------- Normal Mode ---------------------- + romMode = HOTSW_ROM_MODE_NORMAL; + + // カードID読み込み + state = ReadIDNormal(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // カードタイプを判別をして、使う関数を切替える IDの最上位ビットが1なら3DM + s_cbData.cardType = (s_cbData.id_nml & HOTSW_ROMID_1TROM_MASK) ? DS_CARD_TYPE_2 : DS_CARD_TYPE_1; + + { + SYSMRomEmuInfo *romEmuInfo = (void *)&s_romEmuInfo; + BOOL enableDeepSleep = TRUE; + + // バナーリードが完了して、フラグ処理が終わるまでARM9と排他制御する + LockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + // Boot Segment読み込み + state = ReadBootSegNormal(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ワンセグ差込み時はカードバス電源をディープスリープ(PFM)に入れない + // (スリープ時シャットダウン対策。カードロード中にスリープしても良いように早目に設定) + if ( *(u32*)(s_cbData.pBootSegBuf->rh.s.game_code) == HOTSW_DSTV_GAME_CODE ) + { + enableDeepSleep = FALSE; + } + MCU_EnableDeepSleepToPowerLine( MCU_PWR_LINE_33, enableDeepSleep ); + + // ARM9/7で不整合が発生しないようにRomエミュレーション情報ロードは初回のみ + if ( ! SYSMi_GetWork()->flags.hotsw.is1stCardChecked ) + { + // Romエミュレーション情報を取得 + //(製品本体なら内部で構造体をクリアするだけ) + state = ReadRomEmulationInfo(&s_romEmuInfo); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // 取得したRomエミュレーション情報を比較 + s_debuggerFlg = TRUE; + if ( romEmuInfo->magic_code != SYSM_ROMEMU_INFO_MAGIC_CODE ){ + s_debuggerFlg = FALSE; + } + } + // ※ROMエミュレーション情報を読まなければ、デバッガ上でカードアクセスができなくなるため、ランチャー自身をデバッグできなくなる。 + // よって、ROMエミュレーション情報リード部分をデバッガビルド時以外に切ることはできない。 + + // 初回のRomエミュレーション情報を使用 + s_isRomEmu = FALSE; + if(HOTSWi_IsRomEmulation()){ + s_isRomEmu = TRUE; + HOTSW_PutString("Read Emulation ROM\n"); + s_cbData.cardType = ROM_EMULATION; + s_cbData.gameCommondParam = s_cbData.pBootSegBuf->rh.s.game_cmd_param & ~SCRAMBLE_MASK; + HOTSW_TPrintf("SYSMi_GetWork()->gameCommondParam : 0x%08x\n", s_cbData.gameCommondParam); + } + else{ + s_cbData.gameCommondParam = s_cbData.pBootSegBuf->rh.s.game_cmd_param; + } + SYSMi_GetWork()->gameCommondParam = s_cbData.gameCommondParam; + + // CRCチェック + if( !UTL_CheckAppCRC16( &s_cbData.pBootSegBuf->rh.s ) ) { + retval = (retval == HOTSW_SUCCESS) ? HOTSW_CRC_CHECK_ERROR : retval; + } + + if(s_cbData.pBootSegBuf->rh.s.platform_code & PLATFORM_CODE_FLAG_TWL){ + s_cbData.twlFlg = TRUE; + } + + // アプリジャンプのデバッグ時にROMエミュレーション情報だけ必要な場合 + if(SYSMi_GetWork()->flags.hotsw.isLoadRomEmuOnly){ + SYSMi_GetWork()->flags.hotsw.isExistCard = TRUE; + RegisterRomEmuInfo(); + // 排他制御ここまで + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + goto finalize; + } + } + + if( retval == HOTSW_SUCCESS ) { + if(!s_cbData.twlFlg){ + if ( !s_cbData.pBootSegBuf->rh.s.exFlags.enable_nitro_whitelist_signature ) + // NTRカードの場合はRomHeaderバッファの1ページ目以降をクリアしておく。 + MI_CpuClearFast((void *)(SYSM_CARD_ROM_HEADER_BAK + PAGE_SIZE), SYSM_APP_ROM_HEADER_SIZE - PAGE_SIZE); + } + + // SecureコマンドのPNG_ONコマンドetc用のレイテンシを求める(Latency1とLatency2を足す) + s_cbData.secureLatency = AddLatency2ToLatency1(s_cbData.pBootSegBuf->rh.s.secure_cmd_param); + + // Key Table初期化 + MakeBlowfishTableDS(&s_cbData, 8); + + // コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成 + GenVA_VB_VD(); + + // セキュアモードに移行 + state = ChangeModeNormal(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ---------------------- Secure Mode ---------------------- + romMode = HOTSW_ROM_MODE_SECURE; + + // SecureモードのIDとSecureSegmentを読み込む + state = ReadSecureModeCardData(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ★TWLカード対応 一旦リセット後Secure2モードに移行 + // SCFG + if((s_cbData.isLoadTypeTwl = isTwlModeLoad()) == TRUE){ + HOTSW_PutString("Read Mode : TwlCard\n"); + + // Mode2に移行する準備 + s_cbData.modeType = HOTSW_MODE2; + + // ---------------------- Reset ---------------------- + McPowerOff(); + McPowerOn(); + + // ---------------------- Normal Mode ---------------------- + // 先頭1Page分だけでOK。データは読み捨てバッファに + state = ReadBootSegNormal(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // Key Table初期化 + MakeBlowfishTableTWL(&s_cbData, 8, s_bondingOp); + + // コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成 + GenVA_VB_VD(); + + // セキュア2モードに移行 + state = ChangeModeNormal2(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ---------------------- Secure2 Mode ---------------------- + // Secure2モードのIDとSecureSegmentを読み込む + state = ReadSecureModeCardData(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + + // ゲームモードに移行 + state = s_funcTable[s_isRomEmu].ChangeMode_S(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ---------------------- Game Mode ---------------------- + romMode = HOTSW_ROM_MODE_GAME; + + if(retval != HOTSW_SUCCESS || s_cbData.illegalCardFlg){ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_ILLEGAL_CARD_ERROR : retval; + + // 排他制御ここまで + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + goto finalize; + } + + // ID読み込み + state = ReadIDGame(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // カードIDの比較をして、一致しなければFALSEを返す + { + u32 secure_ID = (s_cbData.modeType == HOTSW_MODE1) ? s_cbData.id_scr : s_cbData.id_scr2; + if(secure_ID != s_cbData.id_gam){ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_ID_CHECK_ERROR : retval; + + // 排他制御ここまで + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + goto finalize; + } + } + + // バナーファイルの読み込み + state = LoadBannerData(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // 排他制御ここまで(※CRCチェックまでにミスがなかったら、排他制御ここまで) + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + // 認証コード読み込み&ワーク領域にコピー + state = CheckCardAuthCode(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + +#ifndef USE_WRAM_LOAD + // 常駐モジュール残りを指定先に転送 + state = LoadStaticModule(); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // ARM9常駐モジュールの先頭2KBの暗号化領域を複合化 + (void)DecryptObjectFile(); +#endif + } + else{ + // 排他制御ここまで(※CRCチェックまでにミスがあったら、ここで開放する) + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + HOTSW_TPrintf("ng... Card Data Load Skip ( state : %d )\n", retval); + } + } + else{ + state = HOTSW_PULLED_OUT_ERROR; + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + +finalize: + if( retval == HOTSW_SUCCESS ) + { + // バッドブロックを置換 + state = HOTSWi_RefreshBadBlock(romMode); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + +end: + // カードDMA終了確認 +#ifdef USE_NEW_DMA + HOTSW_WaitNDmaCtrl(HOTSW_NDMA_NO); +#else + HOTSW_WaitDmaCtrl(HOTSW_DMA_NO); +#endif + + // カードアクセス終了確認 + HOTSW_WaitCardCtrl(); + + // カードのロック開放(※ロックIDは開放せずに持ち続ける) + CARD_UnlockRom(s_CardLockID); + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: isTwlModeLoad + + Description: カードのロードをTWLモードで行うかDSモードで行うかを決める + + ※ 読み込みシーケンスの詳細は docs/ゲームカード/カード読み込みシーケンス表.xls 参照 + *---------------------------------------------------------------------------*/ +static BOOL isTwlModeLoad(void) +{ + // TWLカード + if(s_cbData.id_nml & HOTSW_ROMID_TWLROM_MASK){ + // NANDアプリの場合 + if(s_cbData.pBootSegBuf->rh.s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK){ + return FALSE; + } + else{ + // PlatformCodeがTwl or Hybridの場合 + if(s_cbData.pBootSegBuf->rh.s.platform_code & PLATFORM_CODE_FLAG_TWL){ + return TRUE; + } + else{ + return FALSE; + } + } + } + // DSカード + else{ + // PlatformCodeがTwl or Hybridの場合 + if(s_cbData.pBootSegBuf->rh.s.platform_code & PLATFORM_CODE_FLAG_TWL){ + // 製品用本体 (最終的には開発用本体も) +#ifdef HOTSW_FINAL_VERSION + if(s_bondingOp == SCFG_OP_PRODUCT || !s_debuggerFlg) +#else + if(s_bondingOp == SCFG_OP_PRODUCT) +#endif + { + s_cbData.illegalCardFlg = TRUE; + } + } + + return FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: ReadSecureModeCardData + + Description: セキュアモードの各種読み込みを行う関数 + + ※ s_cbData.modeTypeの設定はこの関数の外で行う + *---------------------------------------------------------------------------*/ +static HotSwState ReadSecureModeCardData(void) +{ + HotSwState retval = HOTSW_SUCCESS; + HotSwState state = HOTSW_SUCCESS; + + u32 secure_ID; + + // PNG設定 + state = s_funcTable[s_isRomEmu].SetPNG_S(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // DS側符号生成回路初期値設定 (レジスタ設定) + SetMCSCR(); + + // ID読み込み + state = s_funcTable[s_isRomEmu].ReadID_S(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + + // カードIDの比較をして、一致しなければFALSEを返す + secure_ID = (s_cbData.modeType == HOTSW_MODE1) ? s_cbData.id_scr : s_cbData.id_scr2; + if(s_cbData.id_nml != secure_ID){ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_ID_CHECK_ERROR : retval; + } + + if(retval == HOTSW_SUCCESS){ + // Secure領域のSegment読み込み + state = s_funcTable[s_isRomEmu].ReadSegment_S(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_RefreshBadBlock + + Description: ノーマルモードまたはゲームモードでバッドブロックを置換 + *---------------------------------------------------------------------------*/ +HotSwState HOTSWi_RefreshBadBlock(u32 romMode) +{ + HotSwState retval = HOTSW_SUCCESS; + HotSwState state = HOTSW_SUCCESS; + + HotSwState (*pReadStatus)(CardBootData *cbd); + HotSwState (*pRefreshBadBlock)(CardBootData *cbd); + + if ( ! ( romMode == HOTSW_ROM_MODE_NORMAL || romMode == HOTSW_ROM_MODE_GAME ) ) + { + return HOTSW_SUCCESS; + } + + if ( romMode == HOTSW_ROM_MODE_NORMAL ) + { + pReadStatus = ReadStatusNormal; + pRefreshBadBlock = RefreshBadBlockNormal; + } + else + if ( romMode == HOTSW_ROM_MODE_GAME ) + { + pReadStatus = ReadStatusGame; + pRefreshBadBlock = RefreshBadBlockGame; + } + + // ステータス対応ROMのみステータス読み込み + if ( s_cbData.id_nml & HOTSW_ROMID_RFSSUP_MASK ) + { + state = pReadStatus(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + // 要求レベルに関わらずバッドブロックを置換(製品カードでは滅多に発生しない) + if ( s_cbData.romStatus & (HOTSW_ROMST_RFS_WARN_L1_MASK | HOTSW_ROMST_RFS_WARN_L2_MASK) ) + { + state = pRefreshBadBlock(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + while (1) + { + state = pReadStatus(&s_cbData); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + if ( s_cbData.romStatus & HOTSW_ROMST_RFS_READY_MASK || + (retval != HOTSW_SUCCESS) ) + { + break; + } + OS_Sleep(1); + } + } + } + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_IsRomEmulation + + Description: ROMをエミュレーションしているか? + *---------------------------------------------------------------------------*/ +BOOL HOTSWi_IsRomEmulation(void) +{ + return s_debuggerFlg && s_romEmuInfo.isEnableSlot1; +} + +/*---------------------------------------------------------------------------* + Name: RegisterRomEmuInfo + + Description: ROMエミュレーション情報を登録 + *---------------------------------------------------------------------------*/ +static void RegisterRomEmuInfo(void) +{ + SYSM_work* sw = SYSMi_GetWork(); + + // デバッガ情報 + if ( ! sw->flags.hotsw.is1stCardChecked && s_debuggerFlg ) + { + MI_CpuCopy8( &s_romEmuInfo, &(sw->romEmuInfo), ROM_EMULATION_DATA_SIZE ); + sw->flags.hotsw.isOnDebugger = s_debuggerFlg; + } + + sw->flags.hotsw.isCardStateChanged = TRUE; + sw->flags.hotsw.is1stCardChecked = TRUE; +} + + +/*---------------------------------------------------------------------------* + Name: LoadBannerData + + Description: バナーデータを読み込む + + 注:ゲームモードになってから呼び出してください + *---------------------------------------------------------------------------*/ +static HotSwState LoadBannerData(void) +{ + BOOL state; + HotSwState retval = HOTSW_SUCCESS; + SYSM_work* sw = SYSMi_GetWork(); + + // バナーリード + if( s_cbData.pBootSegBuf->rh.s.banner_offset ) { + retval = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.banner_offset, + (u32 *)SYSM_CARD_BANNER_BUF, + sizeof(TWLBannerFile) ); + + // バナーリードが成功していたら各種フラグTRUE その他の場合はFALSE (この関数の外で排他制御されているからここでは排他制御しないでOK) + state = (retval == HOTSW_SUCCESS) ? TRUE : FALSE; + sw->flags.hotsw.isValidCardBanner = state; + sw->flags.hotsw.isExistCard = state; + } + else{ + // バナーデータが登録されていない場合 (この関数の外で排他制御されているからここでは排他制御しないでOK) + sw->flags.hotsw.isValidCardBanner = FALSE; + sw->flags.hotsw.isExistCard = TRUE; + } + + if ( sw->flags.hotsw.isExistCard ) + { + sw->flags.hotsw.isInspectCard = s_cbData.pBootSegBuf->rh.s.inspect_card; + } + else + { + sw->flags.hotsw.isInspectCard = FALSE; + } + + // デバッガ情報を登録 + RegisterRomEmuInfo(); + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: ReadImageReturnErrorCode + + Description: カードから中途半端なサイズ(page途中)のデータを読み出す関数 + エラーコードを返す + *---------------------------------------------------------------------------*/ +static HotSwState ReadImageReturnErrorCode(void* dest, s32 offset, s32 length, void* arg) +{ + HotSwState retval = HOTSW_SUCCESS; + + static u8 page_buffer[512]; + u32 page_offset = (u32)(offset & -512); + u32 buffer_offset = (u32)(offset % 512); + u32 valid_length = 512 - buffer_offset; + u32 remain_length; + + // 開始アドレスがページの途中 + if ( offset % 512 ) + { + retval = ReadPageGame((CardBootData*)arg, page_offset, page_buffer, 512); + + if (retval != HOTSW_SUCCESS) + { + return retval; + } + + MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length)); + + dest = (u8*)dest + valid_length; + offset += valid_length; + length -= valid_length; + if ( length < 0) + { + return retval; + } + } + + remain_length = (u32)(length % 512); + retval = ReadPageGame((CardBootData*)arg, (u32)offset, dest, (u32)(length - remain_length)); + + if (retval != HOTSW_SUCCESS) + { + return retval; + } + + // ケツがページ途中 + if( remain_length ){ + dest = (u8*)dest + (length - remain_length); + offset += length - remain_length; + + retval = ReadPageGame((CardBootData*)arg, (u32)offset, page_buffer, 512); + + if (retval != HOTSW_SUCCESS) + { + return retval; + } + + MI_CpuCopy8(page_buffer, dest, remain_length); + } + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: ReadImage + + Description: カードから中途半端なサイズ(page途中)のデータを読み出す関数 + 成功するとTRUEを返す + *---------------------------------------------------------------------------*/ +static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg) +{ + return (ReadImageReturnErrorCode(dest, offset, length, arg) == HOTSW_SUCCESS); +} + + +/*---------------------------------------------------------------------------* + Name: ReadCardData + + Description: ARM9から通知された範囲のデータをカードから読み込み + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +static void ReadCardData(u32 src, u32 dest, u32 size) +{ + u32 sendSize = 0; + HotSwState state = HOTSW_SUCCESS; + + if(!SYSMi_GetWork()->flags.hotsw.isCardGameMode){ + state = HOTSW_MODE_ERROR; + } + + if(SYSMi_GetWork()->flags.hotsw.isCardStateChanged){ + state = HOTSW_PULLED_OUT_ERROR; + } + + // カードのロック + CARD_LockRom(s_CardLockID); + + ReadIDGame(&s_cbData); + if(s_cbData.id_gam != s_gameID){ + state = HOTSW_GAMEMODE_ID_CHECK_ERROR; + } + + if(!(reg_MI_EXMEMCNT_L & REG_MI_EXMEMCNT_L_MP_MASK)){ + state = HOTSW_BUS_LOCK_ERROR; + } + + while(size > 0 && state == HOTSW_SUCCESS){ + // --- Boot Segment + if(src >= HOTSW_BOOTSEGMENT_AREA_OFS && src < HOTSW_KEYTABLE_AREA_OFS){ + sendSize = ((src + size) > HOTSW_KEYTABLE_AREA_OFS) ? HOTSW_KEYTABLE_AREA_OFS - src : size; + MI_CpuCopy8((u32 *)(SYSM_CARD_ROM_HEADER_BAK + (src - HOTSW_BOOTSEGMENT_AREA_OFS)), (u32 *)dest, sendSize); + } + + // --- Key Table + else if(src >= HOTSW_KEYTABLE_AREA_OFS && src < HOTSW_SECURE_AREA_OFS){ + sendSize = ((src + size) > HOTSW_SECURE_AREA_OFS) ? HOTSW_SECURE_AREA_OFS - src : size; + state = ReadImageReturnErrorCode((u32 *)dest, (s32)src, (s32)sendSize, &s_cbData); + } + // --- Secure Segment + else if(src >= HOTSW_SECURE_AREA_OFS && src < HOTSW_GAME_AREA_OFS){ + sendSize = ((src + size) > HOTSW_GAME_AREA_OFS) ? HOTSW_GAME_AREA_OFS - src : size; + MI_CpuCopy8((u32 *)((u32)s_cbData.pSecureSegBuf + (src - HOTSW_SECURE_AREA_OFS)), (u32 *)dest, sendSize); + } + // --- Game Segment + else if(src >= HOTSW_GAME_AREA_OFS){ + // KeyTable2が設定されている場合 + if(s_cbData.isLoadTypeTwl){ + u32 keyTable2Adr = (u32)s_cbData.pBootSegBuf->rh.s.twl_card_keytable_area_rom_offset * TWLCARD_BORDER_OFFSET; + u32 Secure2Adr = keyTable2Adr + HOTSW_SECURE2_AREA_OFS; + u32 Game2Adr = keyTable2Adr + HOTSW_GAME2_AREA_OFS; + + // --- Game Segment + if(src < keyTable2Adr){ + sendSize = ((src + size) > keyTable2Adr) ? keyTable2Adr - src : size; + state = ReadImageReturnErrorCode((u32 *)dest, (s32)src, (s32)sendSize, &s_cbData); + } + // --- Key Table2 + else if(src >= keyTable2Adr && src < Secure2Adr){ + sendSize = ((src + size) > Secure2Adr) ? Secure2Adr - src : size; + state = ReadImageReturnErrorCode((u32 *)dest, (s32)src, (s32)sendSize, &s_cbData); + } + // --- Secure2 Segment + else if(src >= Secure2Adr && src < Game2Adr){ + sendSize = ((src + size) > Game2Adr) ? Game2Adr - src : size; + MI_CpuCopy8((u32 *)((u32)s_cbData.pSecure2SegBuf + (src - Secure2Adr)), (u32 *)dest, sendSize); + } + // --- Game2 Segment + else{ + sendSize = size; + state = ReadImageReturnErrorCode((u32 *)dest, (s32)src, (s32)sendSize, &s_cbData); + } + } + // --- Game Segment + else{ + sendSize = size; + state = ReadImageReturnErrorCode((u32 *)dest, (s32)src, (s32)sendSize, &s_cbData); + } + } + + size -= sendSize; + src += sendSize; + dest += sendSize; + } + + ReadIDGame(&s_cbData); + if(s_cbData.id_gam != s_gameID){ + if(state == HOTSW_SUCCESS){ + state = HOTSW_GAMEMODE_ID_CHECK_ERROR; + } + } + + // カードのアンロック + CARD_UnlockRom(s_CardLockID); + + { + HotSwPxiMessageForArm9 msg; + CardDataReadState retval; + + switch(state){ + case HOTSW_SUCCESS: + retval = CARD_READ_SUCCESS; + break; + + case HOTSW_TIME_OUT: + retval = CARD_READ_TIME_OUT; + break; + + case HOTSW_PULLED_OUT_ERROR: + retval = CARD_READ_PULLED_OUT_ERROR; + break; + + case HOTSW_BUFFER_OVERRUN_ERROR: + retval = CARD_READ_BUFFER_OVERRUN_ERROR; + break; + + case HOTSW_MODE_ERROR: + retval = CARD_READ_MODE_ERROR; + break; + + case HOTSW_GAMEMODE_ID_CHECK_ERROR: + retval = CARD_READ_ID_CHECK_ERROR; + break; + + case HOTSW_BUS_LOCK_ERROR: + retval = CARD_READ_BUS_LOCK_ERROR; + break; + + default: + retval = CARD_READ_UNEXPECTED_ERROR; + break; + } + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm9)); + + msg.msg.read = TRUE; + msg.msg.result = (u8)retval; + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } + } +} +#endif + + +/*---------------------------------------------------------------------------* + Name: LoadStaticModule + + Description: ARM7,9の常駐モジュールを展開する関数 + + 注:ゲームモードになってから呼び出してください + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +static HotSwState LoadStaticModule(void) +{ + HotSwState retval = HOTSW_SUCCESS; + HotSwState state = HOTSW_SUCCESS; + u32 arm9StcEnd = s_cbData.pBootSegBuf->rh.s.main_rom_offset + s_cbData.pBootSegBuf->rh.s.main_size; + u32 arm9LtdStcEnd = s_cbData.pBootSegBuf->rh.s.main_ltd_rom_offset + s_cbData.pBootSegBuf->rh.s.main_ltd_size; + u32 secure2SegEnd = (u32)(s_cbData.pBootSegBuf->rh.s.twl_card_keytable_area_rom_offset * TWLCARD_BORDER_OFFSET + SECURE_SEGMENT_SIZE); + + // 配置先と再配置情報を取得 & Arm9の常駐モジュール残りを指定先に転送 + s_cbData.arm9Stc = (u32)s_cbData.pBootSegBuf->rh.s.main_ram_address; + if(SYSM_CheckLoadRegionAndSetRelocateInfo( ARM9_STATIC, &s_cbData.arm9Stc, s_cbData.pBootSegBuf->rh.s.main_size, &SYSMi_GetWork()->romRelocateInfo[ARM9_STATIC] , s_cbData.twlFlg)){ + if(arm9StcEnd > SECURE_SEGMENT_END){ + state = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.main_rom_offset + SECURE_SEGMENT_SIZE, (u32 *)(s_cbData.arm9Stc + SECURE_SEGMENT_SIZE), MATH_ROUNDUP( arm9StcEnd, SYSM_ALIGNMENT_LOAD_MODULE ) - SECURE_SEGMENT_END); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + } + else{ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_BUFFER_OVERRUN_ERROR : retval; + } + if(retval != HOTSW_SUCCESS){ + return retval; + } + + // 配置先と再配置情報を取得 & Arm7の常駐モジュールを指定先に転送 + s_cbData.arm7Stc = (u32)s_cbData.pBootSegBuf->rh.s.sub_ram_address; + if(SYSM_CheckLoadRegionAndSetRelocateInfo( ARM7_STATIC, &s_cbData.arm7Stc, s_cbData.pBootSegBuf->rh.s.sub_size, &SYSMi_GetWork()->romRelocateInfo[ARM7_STATIC], s_cbData.twlFlg)){ + state = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.sub_rom_offset, (u32 *)s_cbData.arm7Stc, MATH_ROUNDUP( s_cbData.pBootSegBuf->rh.s.sub_size, SYSM_ALIGNMENT_LOAD_MODULE ) ); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + else{ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_BUFFER_OVERRUN_ERROR : retval; + } + if(retval != HOTSW_SUCCESS){ + return retval; + } + + // 拡張常駐モジュールの読み込み + if( s_cbData.twlFlg ) { + u32 size = ( s_cbData.pBootSegBuf->rh.s.main_ltd_size < SECURE_SEGMENT_SIZE ) ? s_cbData.pBootSegBuf->rh.s.main_ltd_size : SECURE_SEGMENT_SIZE; + s_cbData.arm9Ltd = (u32)s_cbData.pBootSegBuf->rh.s.main_ltd_ram_address; + // 配置先と再配置情報を取得 & Arm9の常駐モジュールを指定先に転送 + if(SYSM_CheckLoadRegionAndSetRelocateInfo( ARM9_LTD_STATIC, &s_cbData.arm9Ltd, s_cbData.pBootSegBuf->rh.s.main_ltd_size, &SYSMi_GetWork()->romRelocateInfo[ARM9_LTD_STATIC] , TRUE)){ + if(!s_cbData.isLoadTypeTwl){ + // Secure2領域読み + state = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.main_ltd_rom_offset, (u32 *)SYSM_CARD_TWL_SECURE_BUF, MATH_ROUNDUP( size, SYSM_ALIGNMENT_LOAD_MODULE )); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + + // (Arm9Ltd領域 - Secure2領域)分の読み込み + if( s_cbData.pBootSegBuf->rh.s.main_ltd_size > SECURE_SEGMENT_SIZE ) { + state = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.main_ltd_rom_offset + SECURE_SEGMENT_SIZE, + (u32 *)(s_cbData.arm9Ltd + SECURE_SEGMENT_SIZE), + MATH_ROUNDUP( s_cbData.pBootSegBuf->rh.s.main_ltd_size, SYSM_ALIGNMENT_LOAD_MODULE ) - size); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + } + else{ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_BUFFER_OVERRUN_ERROR : retval; + } + + if(retval != HOTSW_SUCCESS){ + return retval; + } + + // 配置先と再配置情報を取得 & Arm7の常駐モジュールを指定先に転送 + s_cbData.arm7Ltd = (u32)s_cbData.pBootSegBuf->rh.s.sub_ltd_ram_address; + if(SYSM_CheckLoadRegionAndSetRelocateInfo( ARM7_LTD_STATIC, &s_cbData.arm7Ltd, s_cbData.pBootSegBuf->rh.s.sub_ltd_size, &SYSMi_GetWork()->romRelocateInfo[ARM7_LTD_STATIC], TRUE)){ + state = ReadPageGame(&s_cbData, s_cbData.pBootSegBuf->rh.s.sub_ltd_rom_offset, (u32 *)s_cbData.arm7Ltd, MATH_ROUNDUP( s_cbData.pBootSegBuf->rh.s.sub_ltd_size, SYSM_ALIGNMENT_LOAD_MODULE ) ); + retval = (retval == HOTSW_SUCCESS) ? state : retval; + } + else{ + retval = (retval == HOTSW_SUCCESS) ? HOTSW_BUFFER_OVERRUN_ERROR : retval; + } + if(retval != HOTSW_SUCCESS){ + return retval; + } + + // セキュア領域先頭2K分のハッシュ値を求めて、Work領域にコピー + { + SVCHMACSHA1Context hash; + + // ハッシュ初期化 + SVC_HMACSHA1Init( &hash, s_digestDefaultKey, sizeof(s_digestDefaultKey) ); + + // セキュア領域先頭2kb分UpDate + SVC_HMACSHA1Update( &hash, s_cbData.pSecureSegBuf, ENCRYPT_DEF_SIZE ); + + // Arm9と排他制御する + LockHotSwRsc(&SYSMi_GetWork()->lockHotSW); + + // ハッシュコンテキストをWork領域にコピー + MI_CpuCopy8( &hash, &SYSMi_GetWork2()->hmac_sha1_context, sizeof(SVCHMACSHA1Context) ); + + // Arm9との排他制御、ここまで + UnlockHotSwRsc(&SYSMi_GetWork()->lockHotSW); + } + +//#define MY_DEBUG +#ifdef MY_DEBUG + (void)CheckStaticModuleHash(); +#endif + } + + return retval; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: CheckCardAuthCode + + Description: Rom Headerの認証コードアドレスを読んで、クローンブート対応か判定する + *---------------------------------------------------------------------------*/ +static HotSwState CheckCardAuthCode(void) +{ + u32 authBuf[PAGE_SIZE/sizeof(u32)]; + u32 auth_offset = s_cbData.pBootSegBuf->rh.s.rom_valid_size ? s_cbData.pBootSegBuf->rh.s.rom_valid_size : 0x01000000; + u32 page_offset = auth_offset & 0xFFFFFE00; + HotSwState retval = HOTSW_SUCCESS; + + u8 *p = (u8 *)authBuf; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + + retval = ReadPageGame( &s_cbData, page_offset, authBuf, MB_AUTHCODE_SIZE ); + + p += auth_offset & 0x000001FF; + if( *p++ == 'a' && *p == 'c' ) { + HOTSW_PutString(" ☆ Clone Boot Mode\n"); + SYSMi_GetWork()->cloneBootMode = SYSM_CLONE_BOOT_MODE; + }else { + HOTSW_PutString(" □ Other Boot Mode\n"); + SYSMi_GetWork()->cloneBootMode = SYSM_OTHER_BOOT_MODE; + } + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_SetBootSegmentBuffer + + Description: Boot Segment バッファの指定 + + 注:カードデータロード中は呼び出さないようにする + *---------------------------------------------------------------------------*/ +void HOTSW_SetBootSegmentBuffer(void* buf, u32 size) +{ + SDK_ASSERT(size > BOOT_SEGMENT_SIZE); + + s_pBootSegBuffer = (BootSegmentData *)buf; + s_BootSegBufSize = size; + + s_cbData.pBootSegBuf = s_pBootSegBuffer; + + // バッファの初期化 + MI_CpuClear8(s_pBootSegBuffer, size); +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_SetSecureSegmentBuffer + + Description: Secure Segment バッファの指定 + + 注:カードデータロード中は呼び出さないようにする + *---------------------------------------------------------------------------*/ +void HOTSW_SetSecureSegmentBuffer(ModeType type ,void* buf, u32 size) +{ + HOTSWi_SetSecureSegmentBuffer(type, buf, size); + // バッファの初期化 + MI_CpuClear8(s_pSecureSegBuffer, size); +} + +void HOTSWi_SetSecureSegmentBuffer(ModeType type ,void* buf, u32 size) +{ + SDK_ASSERT(size > SECURE_SEGMENT_SIZE); + + if(type == HOTSW_MODE1){ + s_pSecureSegBuffer = (u32 *)buf; + s_SecureSegBufSize = size; + + s_cbData.pSecureSegBuf = s_pSecureSegBuffer; + + } + else{ + s_pSecure2SegBuffer = (u32 *)buf; + s_Secure2SegBufSize = size; + + s_cbData.pSecure2SegBuf = s_pSecure2SegBuffer; + } +} + + +/*---------------------------------------------------------------------------* + Name: GenVA_VB_VD + + Description: コマンド認証値・コマンドカウンタ・PNジェネレータ初期値の生成 + *---------------------------------------------------------------------------*/ +static void GenVA_VB_VD(void) +{ + SYSM_work* sw = SYSMi_GetWork(); + u32 dummy = 0; + MATHRandContext32 rnd; + u64 fuse64 = SCFG_ReadFuseData(); + u32 fuse32[2]; + + // 念のためeFuseIDを推測できなくする + fuse32[0] = ((u32*)&fuse64)[0]; + fuse32[1] = ((u32*)&fuse64)[1]; + EncryptByBlowfish(&s_cbData.keyTable, &fuse32[0], &fuse32[1]); + + // 乱数を初期化 + // チック&RTC初回ロード値&ゲームコード&eFuseIDを種とする。 + // (起動する度に変化するパラメータと組み合わせる。 + // Vカウンタは2130サイクル変化しないので固定値になりやすい。) + // 起動毎、ゲームカード毎、本体毎にスクランブルが変化することになる。 + MATH_InitRand32(&rnd, OS_GetTick() ^ sw->Rtc1stData.words[0] ^ sw->Rtc1stData.words[1] ^ *(u32*)(s_cbData.pBootSegBuf->rh.s.game_code) ^ fuse32[0] ^ fuse32[1]); + + s_cbData.vae = MATH_Rand32(&rnd, 0); + s_cbData.vbi = MATH_Rand32(&rnd, 0); + s_cbData.vd = MATH_Rand32(&rnd, 0); + dummy = MATH_Rand32(&rnd, 0); + + EncryptByBlowfish(&s_cbData.keyTable, &s_cbData.vae, &s_cbData.vbi); + EncryptByBlowfish(&s_cbData.keyTable, &s_cbData.vd , &dummy); + + s_cbData.vae &= 0xffffff; + s_cbData.vbi &= 0xfffff; + s_cbData.vd &= 0xffffff; +} + + +/*---------------------------------------------------------------------------* + Name: DecryptObjectFile + + Description: セキュア領域先頭2KBの暗号化領域を復号化 + *---------------------------------------------------------------------------*/ +static u32 encDestBuf[ENCRYPT_DEF_SIZE/sizeof(u32)]; + +#ifndef USE_WRAM_LOAD +static HotSwState DecryptObjectFile(void) +#else +BOOL HOTSW_DecryptObjectFile(void* dest) +#endif +{ + u8 i; + s32 restSize; + s32 size = (s32)s_cbData.pBootSegBuf->rh.s.main_size; + u32 *pEncBuf = encDestBuf; +#ifndef USE_WRAM_LOAD + u32 *pEncDes = s_cbData.pSecureSegBuf; +#else + u32 *pEncDes = (u32 *)dest; +#endif + BLOWFISH_CTX *tableBufp = &s_cbData.keyTable; + BOOL exist = TRUE; +#ifndef USE_WRAM_LOAD + HotSwState retval = HOTSW_SUCCESS; +#else + BOOL retval = TRUE; +#endif + + if (size > ENCRYPT_DEF_SIZE) { + size = ENCRYPT_DEF_SIZE; + } + restSize = size; + + // 読み込んだセキュア領域をバッファから一時バッファにコピー + MI_CpuCopy32(pEncDes, pEncBuf, (u32)size); + + // セキュア領域先頭8バイトをBlowfishで複合化 + DecryptByBlowfish(&s_cbData.keyTable, &(pEncBuf)[1], &(pEncBuf)[0]); + + // Key Tableを変換 + s_cbData.keyBuf[1] = (s_cbData.keyBuf[1] << 1); + s_cbData.keyBuf[2] = (s_cbData.keyBuf[2] >> 1); + InitBlowfishKeyAndTableDS(&s_cbData.keyTable, s_cbData.keyBuf, 8); + + // もう一度セキュア領域先頭8バイトをBlowfishで複合化 + DecryptByBlowfish(&s_cbData.keyTable, &(pEncBuf)[1], &(pEncBuf)[0]); + for ( i=0; i<8; i++ ){ + // 先頭8バイトが複合化の結果 "encryObj" となっていたら複合化成功 + if ( encrypt_object_key[i] != ((char*)pEncBuf)[i] ){ + exist = FALSE; + break; + } + } + + // 暗号化オブジェクト有効時 + if ( exist ){ + u32 *bufp = pEncBuf; + + bufp[0] = UNDEF_CODE; + bufp[1] = UNDEF_CODE; + while ((restSize -= 8) > 0) { + bufp += 2; // 復号処理 + DecryptByBlowfish(tableBufp, &(bufp)[1], &(bufp)[0]); + } + } + else{ +#ifndef USE_WRAM_LOAD + retval = HOTSW_DATA_DECRYPT_ERROR; +#else + retval = FALSE; +#endif + MI_NDmaFill( HOTSW_NDMA_NO, pEncBuf, UNDEF_CODE, (u32)size ); // 未定義コードでクリア + } + MI_CpuCopy32(pEncBuf, pEncDes, (u32)size); + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: LockHotSwRsc + + Description: 共有ワークのリソースの排他制御用 lockを行う + *---------------------------------------------------------------------------*/ +static void LockHotSwRsc(OSLockWord* word) +{ + while(OS_TryLockByWord( s_RscLockID, word, NULL ) != OS_LOCK_SUCCESS){ + OS_Sleep(1); + } +} + + +/*---------------------------------------------------------------------------* + Name: UnlockHotSwRsc + + Description: 共有ワークのリソースの排他制御用 Unlockを行う + *---------------------------------------------------------------------------*/ +static void UnlockHotSwRsc(OSLockWord* word) +{ + OS_UnlockByWord( s_RscLockID, word, NULL ); +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_IsCardExist + + Description: SCFG_MC1のCDETフラグを見て、カードの存在判定を行う + *---------------------------------------------------------------------------*/ +BOOL HOTSW_IsCardExist(void) +{ + if( !(reg_MI_MC1 & REG_MI_MC_SL1_CDET_MASK) ){ + return TRUE; + } + else{ + return FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_IsCardAccessible + + Description: SCFG_MC1のCDETフラグとM(モード)を見て、カードスロットにアクセスできる状態か判定する + *---------------------------------------------------------------------------*/ +BOOL HOTSW_IsCardAccessible(void) +{ + if( HOTSW_IsCardExist() && (GetMcSlotMode() == SLOT_STATUS_MODE_10)){ + return TRUE; + } + else{ + return FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: GetMcSlotMode + + Description: スロットの現在のモードを返す + *---------------------------------------------------------------------------*/ +static u32 GetMcSlotMode(void) +{ + return reg_MI_MC1 & REG_MI_MC_SL1_MODE_MASK; +} + + +/*---------------------------------------------------------------------------* + Name: SetMcSlotMode + + Description: カードスロットのモード設定 + *---------------------------------------------------------------------------*/ +static void SetMcSlotMode(u32 mode) +{ + reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC_SL1_MODE_MASK) | mode); +} + + +/*---------------------------------------------------------------------------* + Name: McPowerOn + + Description: スロット電源ON + *---------------------------------------------------------------------------*/ +static void McPowerOn(void) +{ + // Counter-Aカウンタ設定値到達まで待つ + while(GetMcSlotMode() == SLOT_STATUS_MODE_11){ + OS_Sleep(1); + } + + if(GetMcSlotMode() == SLOT_STATUS_MODE_00){ + // 3DMのリセット待ち + OS_Sleep(1); + + // SCFG_MC1 の Slot Status の M1,M0 を 01 にする + SetMcSlotMode(SLOT_STATUS_MODE_01); + + // VDDの安定期間待ち + OS_Sleep(10); + + // SCFG_MC1 の Slot Status の M1,M0 を 10 にする + SetMcSlotMode(SLOT_STATUS_MODE_10); + + // RESBを上げるまでの待ち時間 + OS_Sleep(27); + + // リセットをhighに (RESB = 1にする) + reg_HOTSW_MCCNT1 = RESB_MASK; + + // カードへ最初のコマンドを送るまでの待ち時間 + OS_Sleep(120); + } +} + + +/*---------------------------------------------------------------------------* + Name: McPowerOff + + Description: スロット電源OFF + *---------------------------------------------------------------------------*/ +static void McPowerOff(void) +{ + // Counter-Aカウンタ設定値到達まで待つ + while(GetMcSlotMode() == SLOT_STATUS_MODE_11){ + OS_Sleep(1); + } + + if(GetMcSlotMode() == SLOT_STATUS_MODE_10){ + // SCFG_MC1 の Slot Status の M1,M0 を 11 にする + SetMcSlotMode(SLOT_STATUS_MODE_11); + + // SCFG_MC1 の Slot Status の M1,M0 が 00 になるまでポーリング + while(GetMcSlotMode() != SLOT_STATUS_MODE_00){ + OS_Sleep(1); + } + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_TurnCardPowerOn + + Description: デバッガ通信用にカードスロットの電源をONにする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void HOTSWi_TurnCardPowerOn(u32 slot) +{ + u32 shift; + u32 mask = slot >= 2 ? (u32)REG_MI_MC_SL2_CDET_MASK : (u32)REG_MI_MC_SL1_CDET_MASK; + + // カードが差さっていなければONしない + if ( reg_MI_MC & mask ) + { + return; + } + + shift = slot >= 2 ? (u32)REG_MI_MC_SL2_MODE_SHIFT : (u32)REG_MI_MC_SL1_MODE_SHIFT; + mask = slot >= 2 ? (u32)REG_MI_MC_SL2_MODE_MASK : (u32)REG_MI_MC_SL1_MODE_MASK; + + // 電源が落ちている最中なら待つ + if ( (reg_MI_MC & mask) == (0x3 << shift) ) + { + OS_Sleep(1); + } + + if ( (reg_MI_MC & mask) == (0x0 << shift) ) + { + // 3DMのリセット待ち + OS_Sleep(1); + + reg_MI_MC = (u16)((reg_MI_MC & ~mask) | (0x1 << shift)); + // VDDの安定期間 + OS_Sleep(10); + + reg_MI_MC = (u16)((reg_MI_MC & ~mask) | (0x2 << shift)); + // RESBのLow期間 + OS_Sleep(27); + + reg_MI_MCCNT1_B = REG_MI_MCCNT1_RESB_MASK; + // RESBのHigh期間 + // カードへ最初のコマンドを送るまでの待ち時間 + OS_Sleep(120); + } +} + + +/*---------------------------------------------------------------------------* + Name: SetMCSCR + + Description: 符号生成回路初期値設定レジスタを設定する + + ※注:この関数はセキュアモードで、sPNG_ONコマンドを実行してから呼び出してください。 + *---------------------------------------------------------------------------*/ +static void SetMCSCR(void) +{ + static u32 pnbL = 0x879b9b05; + static u8 pnbH = 0x5c; + static u8 pnaL1 = 0x60; + static u8 pnaL0Table[8] = { 0xe8, 0x4d, 0x5a, 0xb1, 0x17, 0x8f, 0x99, 0xd5 }; + + u32 pnaL = s_cbData.vd << 15 | pnaL1 << 8 | pnaL0Table[(s_cbData.pBootSegBuf->rh.s.rom_type & 0x7)]; + u8 pnaH = (u8)((s_cbData.vd >> 17) & 0x7f); + + // SCR A + reg_HOTSW_MCSCR0 = pnaL; + + // SCR B + reg_HOTSW_MCSCR1 = pnbL; + + // [d0 -d6 ] -> SCR A + // [d16-d22] -> SCR B + reg_HOTSW_MCSCR2 = (u32)(pnaH | pnbH << 16); + + // MCCNT1 レジスタ設定 (SCR = 1に) + reg_HOTSW_MCCNT1 = SCR_MASK; +} + + +/*---------------------------------------------------------------------------* + Name: HotSwThread + + Description: カード抜け・挿し処理スレッド + *---------------------------------------------------------------------------*/ +static void HotSwThread(void *arg) +{ + #pragma unused( arg ) + + HotSwState retval; + HotSwMessageForArm7 *msg; + + while(1){ + OS_ReceiveMessage(&HotSwThreadData.hotswQueue, (OSMessage *)&msg, OS_MESSAGE_BLOCK); + + SYSMi_GetWork()->flags.hotsw.isBusyHotSW = TRUE; + + if( msg->ctrl == TRUE ) { + SYSMi_GetWork()->flags.hotsw.isEnableHotSW = msg->value; + s_pollingThreadSleepFlg = msg->value ? FALSE : TRUE; + + if(msg->value){ +#ifndef USE_WRAM_LOAD + s_isPulledOut = TRUE; +#endif + OS_SendMessage(&HotSwThreadData.hotswPollingCtrlQueue, + (OSMessage *)&HotSwThreadData.hotswPollingCtrlMsg[HotSwThreadData.idx_polling], + OS_MESSAGE_NOBLOCK); + HotSwThreadData.idx_polling = (HotSwThreadData.idx_polling+1) % HOTSW_POLLING_CTRL_BUFFER_NUM; + } + else{ + if(msg->finalize == FALSE){ + ClearCardFlgs(); + } + } + } + + if( msg->finalize == TRUE && msg->ctrl == FALSE) { + FinalizeHotSw( msg->state ); + } + +#ifdef USE_WRAM_LOAD + if( msg->read == TRUE ){ + ReadCardData(SYSMi_GetWork()->cardReadParam.src, + SYSMi_GetWork()->cardReadParam.dest, + SYSMi_GetWork()->cardReadParam.size); + + SYSMi_GetWork()->flags.hotsw.isBusyHotSW = FALSE; + + continue; + } + + if( msg->type == HOTSW_INSERT ){ + SendPxiMessage(HOTSW_CARD_INSERT); + } +#endif + + while(1){ + if( !SYSMi_GetWork()->flags.hotsw.isEnableHotSW ) { + HOTSW_PutString("### HotSw is restrained...\n"); + break; + } + + if(HOTSW_IsCardExist()){ + if(!s_isPulledOut){ + if(GetMcSlotMode() == SLOT_STATUS_MODE_10){ + s_gameID = s_cbData.id_gam; + + LockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + + if( msg->ctrl && msg->value ){ + SYSMi_GetWork()->flags.hotsw.isExistCard = TRUE; + SYSMi_GetWork()->flags.hotsw.isCardStateChanged = TRUE; + if( s_cbData.pBootSegBuf->rh.s.banner_offset ){ + SYSMi_GetWork()->flags.hotsw.isValidCardBanner = TRUE; + } + } + SYSMi_GetWork()->flags.hotsw.isCardLoadCompleted = TRUE; +#ifdef USE_WRAM_LOAD + SYSMi_GetWork()->flags.hotsw.isCardGameMode = TRUE; +#endif + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); +#ifdef USE_WRAM_LOAD + SendPxiMessage(HOTSW_CHANGE_GAMEMODE); +#endif + HOTSW_PutString("ok!\n"); + + break; + } + } + + retval = LoadCardData(); + + DebugPrintErrorMessage(retval); + + s_isPulledOut = FALSE; + + // エラー処理 + if(retval != HOTSW_SUCCESS){ + McPowerOff(); + PulledOutSequence(); + break; + } + } + + // カードが抜けてたら + else{ + PulledOutSequence(); + break; + } + } // Card Read while loop + + if( !SYSMi_GetWork()->flags.hotsw.is1stCardChecked ){ + LockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + SYSMi_GetWork()->flags.hotsw.is1stCardChecked = TRUE; + UnlockHotSwRsc(&SYSMi_GetWork()->lockCardRsc); + } + + SYSMi_GetWork()->flags.hotsw.isBusyHotSW = FALSE; + } // while loop +} + + +/*---------------------------------------------------------------------------* + Name: PulledOutSequence + + Description: カード抜け処理 + *---------------------------------------------------------------------------*/ +static void PulledOutSequence(void) +{ +#ifdef USE_WRAM_LOAD + SendPxiMessage(HOTSW_CARD_PULLOUT); +#endif + + ClearCardFlgs(); + + MI_CpuClear32(&s_cbData, sizeof(CardBootData)); + + MI_CpuClearFast(s_pBootSegBuffer, s_BootSegBufSize); + MI_CpuClearFast(s_pSecureSegBuffer, s_SecureSegBufSize); + MI_CpuClearFast(s_pSecure2SegBuffer, s_Secure2SegBufSize); + MI_CpuClearFast((u32 *)SYSM_CARD_BANNER_BUF, sizeof(TWLBannerFile)); + + s_isPulledOut = TRUE; + + s_gameID = 0; + + // ワンセグのスリープ時シャットダウン対策を戻す + MCU_EnableDeepSleepToPowerLine( MCU_PWR_LINE_33, TRUE ); +} + + +/*---------------------------------------------------------------------------* + Name: ClearCardFlgs + + Description: カードデータバッファのバッファとフラグの後始末 + *---------------------------------------------------------------------------*/ +static void ClearCardFlgs(void) +{ + // フラグ処理 + LockHotSwRsc(&SYSMi_GetWork()->lockHotSW); + SYSMi_GetWork()->flags.hotsw.isExistCard = FALSE; + SYSMi_GetWork()->flags.hotsw.isValidCardBanner = FALSE; + SYSMi_GetWork()->flags.hotsw.isCardStateChanged = TRUE; + SYSMi_GetWork()->flags.hotsw.isCardLoadCompleted = FALSE; +#ifdef USE_WRAM_LOAD + SYSMi_GetWork()->flags.hotsw.isCardGameMode = FALSE; +#endif + UnlockHotSwRsc(&SYSMi_GetWork()->lockHotSW); +} + + +/*---------------------------------------------------------------------------* + Name: FinalizeHotSw + + Description: アプリ起動時に、活線挿抜関係の後始末を行う。 + *---------------------------------------------------------------------------*/ +static void FinalizeHotSw(HotSwCardState state) +{ + ROM_Header* rh = (void*)SYSM_APP_ROM_HEADER_BUF; + static BOOL finalized = FALSE; + + if(finalized){ + return; + } + finalized = TRUE; + + // カード挿入検出停止 + (void)OS_DisableIrqMask( HOTSW_IF_CARD_DET ); + + // ポーリングスレッドが動作中は待つ + while(s_isBusyMonitorThread){ + OS_Sleep(1); + } + + // ポーリングスレッドを消去 + OS_KillThread( &HotSwThreadData.monitorThread, NULL ); + + SYSMi_GetWork()->appCardID = 0; + + // カードアクセスできないなら、(一応)スロット電源OFFしてレジスタクリア + if(!HOTSW_IsCardAccessible()){ + McPowerOff(); + ClearAllCardRegister(); + goto final; + } + + switch(state){ + // Slot Power Off + case HOTSW_CARD_STATE_POWER_OFF: + McPowerOff(); + break; + + // Normalモードに移行 + case HOTSW_CARD_STATE_NORMAL_MODE: + ForceNormalModeToFinalize(); + break; + + // Gameモードに移行 + case HOTSW_CARD_STATE_GAME_MODE: + ForceNitroModeToFinalize(); + break; + + // 状態キープ + case HOTSW_CARD_STATE_KEEP: + SYSMi_GetWork()->appCardID = s_cbData.id_gam; + break; + + // else + default: + ClearAllCardRegister(); + McPowerOff(); + } + +final: + ClearCardIrq(); + + // デバッガではTWLカードスロット2を電源ON + //(既にONなら何もしない) + // NANDアプリ起動時はデフォルトではカードI/FをOFFにするが、 + // デバッガモニタではカードI/Fが必要なためスロット2を使用 + if ( SYSM_IsRunOnDebugger() ) + { + HOTSWi_TurnCardPowerOn( 2 ); + } + + // 終了完了通知 + SYSMi_GetWork()->gameCommondParam = s_cbData.gameCommondParam; + SYSMi_GetWork()->flags.hotsw.isFinalized = TRUE; +} + + +/*---------------------------------------------------------------------------* + Name: ForceNitroModeToFinalize + + Description: Nitro互換のGame Modeに強制移行させる + *---------------------------------------------------------------------------*/ +static void ForceNitroModeToFinalize(void) +{ + s_cbData.id_gam = 0; + + if(!ChangeGameMode()){ + ClearAllCardRegister(); + McPowerOff(); + + HOTSW_PutString("Failed To Change Game Mode... Card Slot Power Off\n"); + } + + SYSMi_GetWork()->appCardID = s_cbData.id_gam; +} + + +/*---------------------------------------------------------------------------* + Name: ForceNormalModeToFinalize + + Description: Normal Modeに強制移行させる + *---------------------------------------------------------------------------*/ +static void ForceNormalModeToFinalize(void) +{ + CARD_LockRom(s_CardLockID); + + McPowerOff(); // 既にOFFになっているため実質的には無効 + McPowerOn(); + + s_cbData.modeType = HOTSW_MODE2; + (void)LoadTable(); + (void)ReadIDNormal(&s_cbData); + (void)ReadBootSegNormal(&s_cbData); + + CARD_UnlockRom(s_CardLockID); + + s_cbData.gameCommondParam = s_cbData.pBootSegBuf->rh.s.game_cmd_param & ~SCRAMBLE_MASK; + SYSMi_GetWork()->appCardID = s_cbData.id_nml; + + HOTSW_PutString("- game card on flg is TRUE : now Normal Mode\n"); +} + + +/*---------------------------------------------------------------------------* + Name: ChangeGameMode + + Description: Nitro互換のRomHeaderを読んで、Game Modeに移行させる + *---------------------------------------------------------------------------*/ +static BOOL ChangeGameMode(void) +{ + HotSwState state; + + CARD_LockRom(s_CardLockID); + + McPowerOff(); + McPowerOn(); + + s_cbData.pBootSegBuf = s_pBootSegBuffer; + s_cbData.modeType = HOTSW_MODE1; + + // ---------------------- Normal Mode ---------------------- + state = LoadTable(); + state = ReadIDNormal(&s_cbData); + state = ReadBootSegNormal(&s_cbData); + + if(s_isRomEmu){ + s_cbData.cardType = ROM_EMULATION; + s_cbData.gameCommondParam = s_cbData.pBootSegBuf->rh.s.game_cmd_param & ~SCRAMBLE_MASK; + } + else{ + s_cbData.cardType = (s_cbData.id_nml & HOTSW_ROMID_1TROM_MASK) ? DS_CARD_TYPE_2 : DS_CARD_TYPE_1; + s_cbData.gameCommondParam = s_cbData.pBootSegBuf->rh.s.game_cmd_param; + } + s_cbData.secureLatency = AddLatency2ToLatency1(s_cbData.pBootSegBuf->rh.s.secure_cmd_param); + + MI_CpuClear32(&s_cbData.keyTable, sizeof(BLOWFISH_CTX)); + MI_CpuClear32(s_cbData.keyBuf, sizeof(s_cbData.keyBuf)); + + MakeBlowfishTableDS(&s_cbData, 8); + GenVA_VB_VD(); + state = ChangeModeNormal(&s_cbData); + + // ---------------------- Secure Mode ---------------------- + state = s_funcTable[s_isRomEmu].SetPNG_S(&s_cbData); + SetMCSCR(); + state = s_funcTable[s_isRomEmu].ChangeMode_S(&s_cbData); + + // ---------------------- Game Mode ---------------------- + state = ReadIDGame(&s_cbData); + + if(s_cbData.id_nml != s_cbData.id_gam){ + state = HOTSW_ID_CHECK_ERROR; + } + + HOTSW_TPrintf("Card Normal ID : 0x%08x\n", s_cbData.id_nml); + HOTSW_TPrintf("Card Game ID : 0x%08x\n", s_cbData.id_gam); + +#ifdef USE_NEW_DMA + HOTSW_WaitNDmaCtrl(HOTSW_NDMA_NO); +#else + HOTSW_WaitDmaCtrl(HOTSW_DMA_NO); +#endif + + HOTSW_WaitCardCtrl(); + + CARD_UnlockRom(s_CardLockID); + + if(state == HOTSW_SUCCESS){ + return TRUE; + } + else{ + return FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: SendPxiMessage + + Description: ARM9にメッセージを送る + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +static void SendPxiMessage(HotSwCallBackType type) +{ + HotSwPxiMessageForArm9 msg; + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm9)); + + switch(type){ + case HOTSW_CHANGE_GAMEMODE: + msg.msg.mode = TRUE; + break; + + case HOTSW_CARD_INSERT: + msg.msg.insert = TRUE; + break; + + case HOTSW_CARD_PULLOUT: + msg.msg.pullout = TRUE; + break; + + default: + return; + } + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } +} +#endif + + +/*---------------------------------------------------------------------------* + Name: ClearCardIrq + + Description: カード関連の割り込みをクリアする + *---------------------------------------------------------------------------*/ +#define REGCLEAR_16 0x0000 +#define REGCLEAR_32 0x00000000UL + +static void ClearCardIrq(void) +{ + // HotSwで使っている割り込みを無効にする + OSIntrMode irq = OS_DisableInterrupts(); + (void)OS_DisableIrqMask( HOTSW_IF_CARD_DET ); + (void)OS_ResetRequestIrqMask( HOTSW_IF_CARD_DET ); + (void)OS_RestoreInterrupts( irq ); +} + + +/*---------------------------------------------------------------------------* + Name: ClearAllCardRegister + + Description: カード関連の全てのレジスタをクリアする。 + *---------------------------------------------------------------------------*/ +static void ClearAllCardRegister(void) +{ + ClearCardIrq(); + + // コマンド設定レジスタをクリア [各32bit] + reg_HOTSW_MCCMD0 = REGCLEAR_32; + reg_HOTSW_MCCMD1 = REGCLEAR_32; + + // メモリカードイネーブルとか割り込みイネーブルとかをクリア [16bit中 d15-d8が関係あり] + reg_HOTSW_MCCNT0 &= HOTSW_E2PROM_CTRL_MASK; + + // latencyとかstartフラグとかのレジスタをクリア [32bit] + reg_HOTSW_MCCNT1 = REGCLEAR_32; + + // カードからのデータがたまるレジスタをクリア [32bit] + reg_HOTSW_MCD1 = REGCLEAR_32; + + // 符号生成回路初期値設定レジスタをクリア [各32bit] + reg_HOTSW_MCSCR0 = REGCLEAR_32; + reg_HOTSW_MCSCR1 = REGCLEAR_32; + reg_HOTSW_MCSCR2 = REGCLEAR_32; + + // Slot Status,SWPをクリア [d15-d0 Slot Status,SWP] + reg_MI_MC1 &= REG_MI_MC1_CC_MASK; +} + + +/*---------------------------------------------------------------------------* + Name: MonitorThread + + Description: 実際のカード状態とHotSwThreadで状態を比べて、違いがあった場合は + メッセージを送る + + s_isPulledOut : True -> カードなし HOTSW_IsCardExist : True -> カードあり + False -> カードあり False -> カードなし + *---------------------------------------------------------------------------*/ +static void MonitorThread(void *arg) +{ + #pragma unused( arg ) + + u32 count = 0; + BOOL isCardExist; + + while(1){ + // カードデータロード中は待機 + do{ + OS_Sleep(CARD_EXIST_CHECK_POLLING_TIME); + + count++; + } + while( SYSMi_GetWork()->flags.hotsw.isBusyHotSW ); + + // ポーリングスレッド抑制フラグが上がってたら、スリープ。抑制フラグが下りたら起床。 + if(s_pollingThreadSleepFlg){ + OSMessage msg; + OS_ReceiveMessage(&HotSwThreadData.hotswPollingCtrlQueue, (OSMessage *)&msg, OS_MESSAGE_BLOCK); + } + + s_isBusyMonitorThread = TRUE; + + isCardExist = HOTSW_IsCardExist(); + + CheckCardPullOut(isCardExist); + + if(count >= CARD_INSERT_CHECK_INTERVAL){ + CheckCardInsert(isCardExist); + count = 0; + } + + s_isBusyMonitorThread = FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckCardInsert + + Description: カードは挿さっているのに、ランチャーが認識してなかったらメッセージを送る + *---------------------------------------------------------------------------*/ +static void CheckCardInsert(BOOL cardExist) +{ + // カードは挿さっているのに、ランチャーが認識してなかったらメッセージを送る + if(cardExist && s_isPulledOut){ + OSIntrMode enabled = OS_DisableInterrupts(); + + SendInsertMessage(); + + (void)OS_RestoreInterrupts( enabled ); + } + // カードは挿さっていて、ランチャーが認識していたらGameモードのID読みをして、抜けてないか調べる + else if(cardExist && !s_isPulledOut && !SYSMi_GetWork()->flags.hotsw.isBusyHotSW){ + OS_PutString("GameMode ID Check...\n"); + + // カードのロック + CARD_LockRom(s_PollingLockID); + + ReadIDGame(&s_cbData); + + if(s_cbData.id_gam != s_gameID){ + OSIntrMode enabled; + + McPowerOff(); + + enabled = OS_DisableInterrupts(); + + PulledOutSequence(); + SendInsertMessage(); + + (void)OS_RestoreInterrupts( enabled ); + } + + // カードのロック開放(※ロックIDは開放せずに持ち続ける) + CARD_UnlockRom(s_PollingLockID); + } +} + + +static void SendInsertMessage(void) +{ + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].ctrl = FALSE; + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].value = 0; + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].type = HOTSW_INSERT; + + // メッセージをキューの先頭に入れる + OS_JamMessage(&HotSwThreadData.hotswQueue, (OSMessage *)&HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_insert = (HotSwThreadData.idx_insert+1) % HOTSW_INSERT_MSG_NUM; +} + + +/*---------------------------------------------------------------------------* + Name: CheckCardPullOut + + Description: カードは抜かれているのに、ランチャーが認識していたらメッセージを送る + *---------------------------------------------------------------------------*/ +static void CheckCardPullOut(BOOL cardExist) +{ + if(!cardExist && !s_isPulledOut){ + OSIntrMode enabled; + +#ifndef HOTSW_DISABLE_FORCE_CARD_OFF + { + u32 mode = GetMcSlotMode(); + if(mode == SLOT_STATUS_MODE_01 || mode == SLOT_STATUS_MODE_10){ + SetMcSlotMode(SLOT_STATUS_MODE_11); + } + } +#endif + enabled = OS_DisableInterrupts(); + + HotSwThreadData.hotswPulledOutMsg[HotSwThreadData.idx_pulledOut].ctrl = FALSE; + HotSwThreadData.hotswPulledOutMsg[HotSwThreadData.idx_pulledOut].value = 0; + HotSwThreadData.hotswPulledOutMsg[HotSwThreadData.idx_pulledOut].type = HOTSW_PULLOUT; + + // メッセージをキューの先頭に入れる + OS_JamMessage(&HotSwThreadData.hotswQueue, (OSMessage *)&HotSwThreadData.hotswPulledOutMsg[HotSwThreadData.idx_pulledOut], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_pulledOut = (HotSwThreadData.idx_pulledOut+1) % HOTSW_PULLED_MSG_NUM; + + (void)OS_RestoreInterrupts( enabled ); + } +} + + +/*---------------------------------------------------------------------------* + Name: InterruptCallbackCardDet + + Description: カードB挿し割り込みハンドラ + *---------------------------------------------------------------------------*/ +static void InterruptCallbackCardDet(void) +{ + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].ctrl = FALSE; + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].value = 0; + HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert].type = HOTSW_INSERT; + + // メッセージ送信 + OS_SendMessage(&HotSwThreadData.hotswQueue, (OSMessage *)&HotSwThreadData.hotswInsertMsg[HotSwThreadData.idx_insert], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_insert = (HotSwThreadData.idx_insert+1) % HOTSW_INSERT_MSG_NUM; + + HOTSW_PutString("●\n"); +} + + +/*---------------------------------------------------------------------------* + Name: InterruptCallbackPxi + + Description: PXI割り込みハンドラ + *---------------------------------------------------------------------------*/ +static void InterruptCallbackPxi(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused(tag) +#pragma unused(err) + HotSwPxiMessageForArm7 d; + + d.data = data; + +#ifndef USE_WRAM_LOAD + HOTSW_TPrintf("... Pxi Message - value:%x ctrl:%x finalize:%x bootType:%x\n", + d.msg.value, d.msg.ctrl, d.msg.finalize, d.msg.cardState); +#else + HOTSW_TPrintf("... Pxi Message - value:%x ctrl:%x finalize:%x read:%x bootType:%x\n", + d.msg.value, d.msg.ctrl, d.msg.finalize, d.msg.read, d.msg.cardState); + + HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl].read = (d.msg.read) ? TRUE : FALSE; +#endif + HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl].ctrl = (d.msg.ctrl) ? TRUE : FALSE; + HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl].finalize = (d.msg.finalize) ? TRUE : FALSE; + HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl].value = d.msg.value; + HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl].state = (HotSwCardState)d.msg.cardState; + + // メッセージ送信 + OS_SendMessage(&HotSwThreadData.hotswQueue, (OSMessage *)&HotSwThreadData.hotswPxiMsg[HotSwThreadData.idx_ctrl], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_ctrl = (HotSwThreadData.idx_ctrl+1) % HOTSW_CTRL_MSG_NUM; +} + + +/*---------------------------------------------------------------------------* + Name: InterruptCallbackCardData + + Description: カードB データ転送終了割り込みハンドラ + *---------------------------------------------------------------------------*/ +#ifndef USE_NEW_DMA +static void InterruptCallbackCardData(void) +{ + // DMA強制終了 + MI_StopDma(HOTSW_DMA_NO); + + // メッセージ送信 + OS_SendMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&HotSwThreadData.hotswDmaMsg[HotSwThreadData.idx_dma], OS_MESSAGE_NOBLOCK); + + // メッセージインデックスをインクリメント + HotSwThreadData.idx_dma = (HotSwThreadData.idx_dma+1) % HOTSW_DMA_MSG_NUM; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: SetInterruptCallback + SetInterruptCallbackEx + + Description: 割り込みコールバック関数と割り込み許可の設定を行う + *---------------------------------------------------------------------------*/ +static void SetInterruptCallback( OSIrqMask intr_bit, OSIrqFunction func ) +{ + (void)OS_SetIrqFunction(intr_bit, func); + (void)OS_EnableIrqMask(intr_bit); +} + +static void SetInterruptCallbackEx( OSIrqMask intr_bit, void *func ) +{ + (void)OS_SetIrqFunctionEx(intr_bit, func); + (void)OS_EnableIrqMaskEx(intr_bit); +} + + +/*---------------------------------------------------------------------------* + Name: SetInterrupt + + Description: 割り込みコールバック関数を一度に設定する関数 + *---------------------------------------------------------------------------*/ +static void SetInterrupt(void) +{ + SetInterruptCallback( OS_IE_CARD_A_DET , InterruptCallbackCardDet ); + +#ifdef USE_NEW_DMA + (void)OS_EnableIrqMask(OS_IE_NDMA2); +#else + SetInterruptCallback( OS_IE_CARD_DATA , InterruptCallbackCardData ); +#endif +} + + +/*---------------------------------------------------------------------------* + Name: CheckStaticModuleHash + + Description: 常駐モジュールのハッシュチェックを行う + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +#include +static HotSwState CheckStaticModuleHash(void) +{ + BOOL flg = TRUE; + + // Arm9常駐モジュール Hash値のチェック + if(!CheckArm9HashValue()){ + flg = FALSE; + HOTSW_PutString("×Arm9 Static Module Hash Check Error...\n"); + } + + // Arm7常駐モジュール Hash値のチェック + if(!CheckArm7HashValue()){ + flg = FALSE; + HOTSW_PutString("×Arm7 Static Module Hash Check Error...\n"); + } + + // Arm9拡張常駐モジュール Hash値のチェック + if(!CheckExtArm9HashValue()){ + flg = FALSE; + HOTSW_PutString("×Arm9 Ltd Static Module Hash Check Error...\n"); + } + + // Arm7拡張常駐モジュール Hash値のチェック + if(!CheckExtArm7HashValue()){ + flg = FALSE; + HOTSW_PutString("×Arm7 Ltd Static Module Hash Check Error...\n"); + } + + if(flg){ + HOTSW_PutString("*** Static Module Load was Completed!!\n"); + } + + return flg ? HOTSW_SUCCESS : HOTSW_HASH_CHECK_ERROR; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: CheckArm7HashValue + + Description: Arm7常駐モジュールのハッシュチェック + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +static BOOL CheckArm7HashValue(void) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + (u32 *)(s_cbData.arm7Stc), + s_cbData.pBootSegBuf->rh.s.sub_size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, s_cbData.pBootSegBuf->rh.s.sub_static_digest ); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: CheckArm9HashValue + + Description: Arm9常駐モジュールのハッシュチェック + + ※ 先頭2Kの復号化が行われる前のデータのハッシュを比べる + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +static BOOL CheckArm9HashValue(void) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + SVCHMACSHA1Context hash; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ハッシュ初期化 + SVC_HMACSHA1Init( &hash, s_digestDefaultKey, sizeof(s_digestDefaultKey) ); + + // セキュア領域分UpDate + SVC_HMACSHA1Update( &hash, s_cbData.pSecureSegBuf, SECURE_SEGMENT_SIZE ); + + // ゲーム領域分UpDate + SVC_HMACSHA1Update( &hash, (u32 *)(s_cbData.arm9Stc + SECURE_SEGMENT_SIZE), s_cbData.pBootSegBuf->rh.s.main_size - SECURE_SEGMENT_SIZE ); + + // Hash値取得 + SVC_HMACSHA1GetHash( &hash, sha1data ); + + return SVC_CompareSHA1( sha1data, s_cbData.pBootSegBuf->rh.s.main_static_digest ); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: CheckExtArm7HashValue + + Description: Arm7拡張常駐モジュールのハッシュチェック + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +static BOOL CheckExtArm7HashValue(void) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + (u32 *)s_cbData.arm7Ltd, + s_cbData.pBootSegBuf->rh.s.sub_ltd_size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, s_cbData.pBootSegBuf->rh.s.sub_ltd_static_digest ); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: CheckExtArm9HashValue + + Description: Arm9拡張常駐モジュールのハッシュチェック + *---------------------------------------------------------------------------*/ +#ifndef USE_WRAM_LOAD +static BOOL CheckExtArm9HashValue(void) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + u32 size; + BOOL retval = TRUE; + SVCHMACSHA1Context hash; + + // Arm9拡張常駐モジュールのセキュア領域分のサイズを取得 + size = ( s_cbData.pBootSegBuf->rh.s.main_ltd_size < SECURE_SEGMENT_SIZE ) ? + s_cbData.pBootSegBuf->rh.s.main_ltd_size : SECURE_SEGMENT_SIZE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ハッシュ初期化 + SVC_HMACSHA1Init( &hash, s_digestDefaultKey, sizeof(s_digestDefaultKey) ); + + // セキュア領域分UpDate + SVC_HMACSHA1Update( &hash, (u32 *)SYSM_CARD_TWL_SECURE_BUF, size ); + + // ゲーム領域分UpDate (Arm9拡張常駐モジュールがSecure領域で収まってたらここは飛ばす) + if( s_cbData.pBootSegBuf->rh.s.main_ltd_size > SECURE_SEGMENT_SIZE ){ + SVC_HMACSHA1Update( &hash, (u32 *)(s_cbData.arm9Ltd + SECURE_SEGMENT_SIZE), s_cbData.pBootSegBuf->rh.s.main_ltd_size - size ); + } + + // Hash値取得 + SVC_HMACSHA1GetHash( &hash, sha1data ); + + return SVC_CompareSHA1( sha1data, s_cbData.pBootSegBuf->rh.s.main_ltd_static_digest ); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_GetCardBootData + + Description: + *---------------------------------------------------------------------------*/ +void *HOTSWi_GetCardBootData(void) +{ + return &s_cbData; +} + + +/*---------------------------------------------------------------------------* + Name: DebugPrintErrorMessage + + Description: + *---------------------------------------------------------------------------*/ +static void DebugPrintErrorMessage(HotSwState state) +{ + switch(state){ + case HOTSW_SUCCESS: + HOTSW_PutString(" - Success\n"); + break; + + case HOTSW_TIME_OUT: + HOTSW_PutString(" - Error 1 : TimeOut\n"); + break; + + case HOTSW_CARD_LOCK_ERROR: + HOTSW_PutString(" - Error 2 : Slot Lock\n"); + break; + + case HOTSW_CRC_CHECK_ERROR: + HOTSW_PutString(" - Error 3 : CRC Check\n"); + break; + + case HOWSW_REGION_CHECK_ERROR: + HOTSW_PutString(" - Error 3 : Region Check\n"); + break; + + case HOTSW_HASH_CHECK_ERROR: + HOTSW_PutString(" - Error 4 : Hash Check\n"); + break; + + case HOTSW_ID_CHECK_ERROR: + HOTSW_PutString(" - Error 5 : ID Check\n"); + break; + + case HOTSW_PULLED_OUT_ERROR: + HOTSW_PutString(" - Error 6 : Pulled Out\n"); + break; + + case HOTSW_DATA_DECRYPT_ERROR: + HOTSW_PutString(" - Error 7 : Data Decrypt\n"); + break; + + case HOTSW_BUFFER_OVERRUN_ERROR: + HOTSW_PutString(" - Error 8 : Buffer OverRun\n"); + break; + + case HOTSW_UNEXPECTED_ERROR: + HOTSW_PutString(" - Error 9 : Unexpected\n"); + break; + + default : + HOTSW_PutString(" - illigal Error\n"); + break; + } +} \ No newline at end of file diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/hotswBlowfish.c b/build/libraries_sysmenu/hotsw/ARM7/src/hotswBlowfish.c new file mode 100644 index 00000000..317c57f7 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/hotswBlowfish.c @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: blowfish.c + + Copyright 2007 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. + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include + +// Function Prototype ------------------------------------------------------- + + +/*---------------------------------------------------------------------------* + Name: MakeBlowfishTableDSForNAND + + Description: NANDアプリ用KeyTableの生成 + *---------------------------------------------------------------------------*/ +void HOTSWi_MakeBlowfishTableDSForNAND(void) +{ + CardBootData *cbd = HOTSWi_GetCardBootData(); + cbd->pBootSegBuf = (void*)SYSM_APP_ROM_HEADER_BUF; + MakeBlowfishTableDS(cbd, 8); +} + +/*---------------------------------------------------------------------------* + Name: MakeBlowfishTableDS + + Description: KeyTableの生成 + *---------------------------------------------------------------------------*/ +void MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen) +{ + const BLOWFISH_CTX *initTable = &HotSwBlowfishInitTableBufDS; + + u32 *RomHeaderGameCode = (u32 *)cbd->pBootSegBuf->rh.s.game_code; + u32 *keyBuf = cbd->keyBuf; + BLOWFISH_CTX *ctx = &cbd->keyTable; + + MI_CpuCopyFast((void *)initTable, (void *)ctx, sizeof(BLOWFISH_CTX)); + + keyBuf[0] = *RomHeaderGameCode; + keyBuf[1] = *RomHeaderGameCode >> 1; + keyBuf[2] = *RomHeaderGameCode << 1; + + InitBlowfishKeyAndTableDS(ctx, keyBuf, keyLen); + InitBlowfishKeyAndTableDS(ctx, keyBuf, keyLen); +} + + +/*---------------------------------------------------------------------------* + Name: MakeBlowfishTableTWL + + Description: KeyTable2の生成 + *---------------------------------------------------------------------------*/ +void MakeBlowfishTableTWL(CardBootData *cbd, s32 keyLen, u16 bondingOp) +{ + u32 *RomHeaderGameCode = (u32 *)cbd->pBootSegBuf->rh.s.game_code; + u32 *keyBuf = cbd->keyBuf2; + BLOWFISH_CTX *ctx = &cbd->keyTable2; + void *tempCTX; + + + // 製品機の場合 + if(bondingOp == SCFG_OP_PRODUCT){ + MI_CpuCopyFast((void *)((OSFromFirm7Buf *)HW_FIRM_FROM_FIRM_BUF)->twl_blowfish, (void *)ctx, sizeof(BLOWFISH_CTX)); + } + // 開発機の場合 + else{ + MI_CpuCopyFast(&HotSwBlowfishInitTableTWL_dev, (void *)ctx, sizeof(BLOWFISH_CTX)); + + + // スタック領域がオーバーフローするから、ヒープ領域から領域を確保する。 + tempCTX = OS_AllocFromSubPrivWram( sizeof(BLOWFISH_CTX) ); + + if(tempCTX != NULL){ + ctx = tempCTX; + } + else{ + return; + } + } + + keyBuf[0] = *RomHeaderGameCode; + keyBuf[1] = *RomHeaderGameCode >> 1; + keyBuf[2] = *RomHeaderGameCode << 1; + + InitBlowfishKeyAndTableDS(ctx, keyBuf, keyLen); + + // Heapの開放 + if(bondingOp != SCFG_OP_PRODUCT){ + OS_FreeToSubPrivWram( tempCTX ); + } +} + + +/*---------------------------------------------------------------------------* + Name: InitBlowfishKeyAndTableDS + + Description: + *---------------------------------------------------------------------------*/ +void InitBlowfishKeyAndTableDS(BLOWFISH_CTX *ctx, u32 *keyBufp, s32 keyLen) +{ + EncryptByBlowfish(ctx, (void*)&(keyBufp)[2], (void*)&(keyBufp)[1]); + EncryptByBlowfish(ctx, (void*)&(keyBufp)[1], (void*)&(keyBufp)[0]); + InitBlowfish(ctx, (u8 *)keyBufp, keyLen); +} + diff --git a/build/libraries_sysmenu/hotsw/ARM7/src/romEmulation.c b/build/libraries_sysmenu/hotsw/ARM7/src/romEmulation.c new file mode 100644 index 00000000..ec051a60 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM7/src/romEmulation.c @@ -0,0 +1,222 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK + File: romEmulation.c + *---------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include + +// Define Data -------------------------------------------------------------- +#define BOOT_PAGE_NUM 8 +#define SECURE_PAGE_NUM 32 + +// static value ------------------------------------------------------------- +static OSMessage s_Msg; + +// extern ------------------------------------------------------------------- +extern CardThreadData HotSwThreadData; + + + +// =========================================================================== +// Function Describe +// =========================================================================== + +// ■--------------------------------------■ +// ■ ノーマルモードのコマンド ■ +// ■--------------------------------------■ +/*---------------------------------------------------------------------------* + Name: ReadIDNormal_ROMEMU + + Description: DSカードType1のノーマルモードのID読み込み + *---------------------------------------------------------------------------*/ +// 共通 + +/*---------------------------------------------------------------------------* + Name: ReadBootSegNormal_ROMEMU + + Description: DSカードType1のノーマルモードのBoot Segment読み込み + *---------------------------------------------------------------------------*/ +// 共通 + +/*---------------------------------------------------------------------------* + Name: ChangeModeNormal_ROMEMU + + Description: DSカードType1のノーマルモードのモード変更 + *---------------------------------------------------------------------------*/ +// 共通 + + +// ■--------------------------------------■ +// ■ セキュアモードのコマンド ■ +// ■--------------------------------------■ +/*---------------------------------------------------------------------------* + Name: ReadIDSecure_ROMEMU + + Description: + *---------------------------------------------------------------------------*/ +HotSwState ReadIDSecure_ROMEMU(CardBootData *cbd) +{ + GCDCmd64 cndLE; + u32 *buf = (cbd->modeType == HOTSW_MODE1) ? &cbd->id_scr : &cbd->id_scr2; + + if(!HOTSW_IsCardAccessible()){ + return HOTSW_PULLED_OUT_ERROR; + } + +#ifdef USE_NEW_DMA + HOTSW_NDmaCopy_Card( HOTSW_NDMA_NO, (u32 *)HOTSW_MCD1, buf, sizeof(buf) ); +#else + HOTSW_DmaCopy32_Card( HOTSW_DMA_NO, (u32 *)HOTSW_MCD1, buf, sizeof(buf) ); +#endif + + // リトルエンディアンで作って + cndLE.dw = HSWOP_N_OP_RD_ID; + + // MCCMD レジスタ設定 + HOTSWi_SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 +#ifdef USE_NEW_DMA + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK); +#else + reg_HOTSW_MCCNT0 = (u16)((reg_HOTSW_MCCNT0 & HOTSW_E2PROM_CTRL_MASK) | REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK); +#endif + + // MCCNT1 レジスタ設定 (START = 1 PC = 111(ステータスリード) latency1 = 1 に) + reg_HOTSW_MCCNT1 = START_MASK | PC_MASK & (0x7 << PC_SHIFT) | (0x1 & LATENCY1_MASK); + + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&s_Msg, OS_MESSAGE_BLOCK); + + return HOTSW_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: ReadSegSecure_ROMEMU + + Description: + *---------------------------------------------------------------------------*/ +HotSwState ReadSegSecure_ROMEMU(CardBootData *cbd) +{ + u32 *buf = (cbd->modeType == HOTSW_MODE1) ? cbd->pSecureSegBuf : cbd->pSecure2SegBuf; + u32 i,j=0; + u32 keyTable2Adr = (u32)cbd->pBootSegBuf->rh.s.twl_card_keytable_area_rom_offset * TWLCARD_BORDER_OFFSET; + u32 Secure2Adr = (cbd->modeType == HOTSW_MODE1) ? HOTSW_SECURE_AREA_OFS : (keyTable2Adr + HOTSW_SECURE2_AREA_OFS); + u64 page = Secure2Adr/HOTSW_PAGE_SIZE; + GCDCmd64 cndLE; + u32 n = 0; + + for(i=0; i + + +const BLOWFISH_CTX HotSwBlowfishInitTableTWL_dev = { + 0x05526369, 0x040B421F, 0x04DAE16B, 0x03222EFA, + 0x05EB3557, 0x0089EBE1, 0x03E13C75, 0x02BD8B6D, + 0x071E6069, 0x0406B0C5, 0x0737814E, 0x04357C20, + 0x06E70543, 0x02D6B325, 0x05F42EDC, 0x075FA408, + 0x058CB61F, 0x0005B115, + + 0x04FB84D7, 0x00835937, 0x074D69B0, 0x03092EF8, + 0x02C477AA, 0x02633C66, 0x021479EB, 0x02BE7290, + 0x04254FE3, 0x041A18DE, 0x0011129E, 0x019209F3, + 0x053751A3, 0x02B46D10, 0x02819FB4, 0x008B2FA5, + 0x0720D1F8, 0x0314C7A2, 0x04B9AE7B, 0x04168028, + 0x01AD742F, 0x02AA9574, 0x05A95800, 0x047A0DA5, + 0x0279F093, 0x06FAA890, 0x06A3A9BD, 0x061142AB, + 0x02D36BB5, 0x07D5B8CB, 0x01D5147F, 0x0185B4F2, + 0x04329CCE, 0x04B1B5D8, 0x06E13A40, 0x04F0898C, + 0x059B5707, 0x072D9FD8, 0x04A6A963, 0x0571C044, + 0x050B1D95, 0x06B8DE98, 0x0253CAFF, 0x040F93D5, + 0x024DE9A5, 0x016159BD, 0x04164C1E, 0x06039C0F, + 0x0162BB3A, 0x037A6F5F, 0x023E1F80, 0x01BEDC47, + 0x02E42CC4, 0x02BA1AD3, 0x009FCD4A, 0x01A09A64, + 0x03D5F72F, 0x002F16F7, 0x061523C2, 0x019EDE98, + 0x02FB4E21, 0x024ABA82, 0x035F324B, 0x043B186D, + 0x046FD0BA, 0x03D84F7D, 0x01519C5F, 0x054FC637, + 0x06443165, 0x00591465, 0x07D4856A, 0x05C847F1, + 0x0749E7A2, 0x017D80EC, 0x0111BF2F, 0x02C920BE, + 0x06D85623, 0x064ADF93, 0x03260CCC, 0x02C0F28D, + 0x005BBE0C, 0x0371F35E, 0x00407119, 0x06075C7B, + 0x06CB6DC2, 0x0031CB12, 0x05220DB5, 0x03D235D9, + 0x0736EB35, 0x0716448C, 0x02B9E4E9, 0x06C408D8, + 0x0282D902, 0x052586A3, 0x0775A47F, 0x056CA10B, + 0x028F164F, 0x03365948, 0x07BBDB4D, 0x034217C7, + 0x00FDF4DB, 0x0278BE82, 0x056B2EE3, 0x003A57F4, + 0x026E44DA, 0x0587D6DF, 0x0699B381, 0x05DD58DD, + 0x0099C34B, 0x07FE334F, 0x061682A1, 0x075F48DC, + 0x05A95910, 0x07C8D2F2, 0x0701F13E, 0x01F92114, + 0x051F55EB, 0x03158B95, 0x06A4CBEB, 0x0688C7D5, + 0x0439631E, 0x006448FE, 0x01AB7B3F, 0x03DCD3B0, + 0x0735B15D, 0x01045A14, 0x047CF4D0, 0x01BFE119, + 0x065976D4, 0x06BF4287, 0x0054D2BF, 0x037E281A, + 0x0474DC3E, 0x01DDF533, 0x07FD249E, 0x0696FF5C, + 0x06FC83EF, 0x00895986, 0x077FAD53, 0x02A0D475, + 0x0589CF47, 0x0463060D, 0x04F58C53, 0x018C0184, + 0x0416EF7F, 0x0148B8E7, 0x00665F46, 0x06B15F0E, + 0x07DD76B3, 0x07592BBE, 0x02C752F9, 0x035B639A, + 0x07B561AB, 0x055A02C1, 0x032C87F4, 0x074DF8C9, + 0x04DE7E08, 0x01779DD0, 0x04B0A183, 0x02CD73F1, + 0x015C106E, 0x070EEBBC, 0x0055BB03, 0x02651FA2, + 0x06CE6DD3, 0x065B3BAC, 0x05B18A61, 0x01843559, + 0x00F1600A, 0x035B2893, 0x0119BA0F, 0x0311E24C, + 0x0076A1DC, 0x075E5486, 0x02651C67, 0x02B0FAB2, + 0x029CED3A, 0x03E9DDAB, 0x03B35437, 0x03D30D6D, + 0x03629908, 0x070B253C, 0x0403FD6E, 0x0631AE1B, + 0x04C6E55B, 0x05CFEA46, 0x00F78239, 0x04C31E56, + 0x02AC48EA, 0x02DA5793, 0x07D7EE80, 0x01A58DD0, + 0x0440BC8E, 0x047FA958, 0x04A120AE, 0x07A48C2F, + 0x0490D631, 0x04205C1B, 0x074491E1, 0x03DC8737, + 0x05AA7B91, 0x028149A0, 0x02D15368, 0x02B857B2, + 0x03352071, 0x013F2B3F, 0x02A32234, 0x00AD5A5F, + 0x02C1BB07, 0x0746B1A8, 0x016F1BC5, 0x008EEC53, + 0x011F6374, 0x0236DEF8, 0x01F5F136, 0x015E1206, + 0x07E815F6, 0x042879C6, 0x033AD57D, 0x0558442A, + 0x0243F9F1, 0x00B50791, 0x04632BED, 0x008CE746, + 0x02BA47B9, 0x04DC953D, 0x0230C520, 0x028B8A44, + 0x034E4AAD, 0x05F4404A, 0x05C02F9A, 0x049C2098, + 0x05738F11, 0x07341FBB, 0x01845FDA, 0x043ED01F, + 0x0497A307, 0x055FF998, 0x04DDD428, 0x05DDFDA4, + 0x07442F72, 0x0607229D, 0x052FD116, 0x00E528D3, + 0x01E3D7AA, 0x02EBBA09, 0x06E3C252, 0x04F17067, + 0x070622BB, 0x0308860B, 0x039D045B, 0x04DD8848, + 0x01D9105D, 0x0389C9AA, 0x00B06AAE, 0x034DCAAC, + + 0x01C5E8E5, 0x02834663, 0x07BC04DB, 0x046C0F43, + 0x05795C2C, 0x00C3A9D0, 0x0698646D, 0x0441E7DA, + 0x0104EC07, 0x04CF09C4, 0x01FA3B1F, 0x07A3A818, + 0x00C3492F, 0x059E41C5, 0x020C91CC, 0x04F45D15, + 0x0462532F, 0x05B0B06B, 0x03B77F77, 0x071208FD, + 0x00BDB01C, 0x068A9386, 0x047F4C10, 0x0028A7F0, + 0x06A27510, 0x056F2B43, 0x0005764C, 0x056E9195, + 0x0267997F, 0x04018898, 0x0535EE95, 0x07027559, + 0x067491B6, 0x02F34209, 0x034E47BB, 0x02E492E6, + 0x013A1C03, 0x0253A5C4, 0x0664E84A, 0x0069A5E6, + 0x000D2E8F, 0x06C4DAA8, 0x06FA8774, 0x04D3A4C8, + 0x02ABC317, 0x05144060, 0x021120E9, 0x072E4B71, + 0x073C25AF, 0x0591407E, 0x00D96350, 0x02DF7B1D, + 0x0025231F, 0x03D6E660, 0x03DC62BF, 0x06F28B61, + 0x02AF873D, 0x077DBF4C, 0x06BC320E, 0x07D9B25B, + 0x079FF100, 0x035304BC, 0x06FB6C25, 0x017E04F0, + 0x04B879DA, 0x02472768, 0x06B05478, 0x07F9296D, + 0x06D3A241, 0x00E9D0EE, 0x06C4FF27, 0x055F65D9, + 0x02551093, 0x04067917, 0x038B524D, 0x07405D23, + 0x053FDCBE, 0x04A6A73D, 0x03529F18, 0x041DCA50, + 0x069A923E, 0x06564436, 0x003CA4E0, 0x07E422B6, + 0x059D37DA, 0x06E48164, 0x0137BA88, 0x038B9355, + 0x008E1D46, 0x005426EA, 0x06B67424, 0x02C58519, + 0x04AF2FE5, 0x0032FC6F, 0x006ED904, 0x0596BDC2, + 0x061A29F2, 0x023A9D03, 0x00439E06, 0x00348DD2, + 0x01DCF8CE, 0x075688E9, 0x04D29E0A, 0x03BD448C, + 0x05AB97F3, 0x050BE3BB, 0x05C07374, 0x01BEB46C, + 0x035D666C, 0x05A7A7FF, 0x0327E38A, 0x05802A3D, + 0x0145D043, 0x0444FF08, 0x03C2E090, 0x042EF1AB, + 0x0620D57B, 0x07F6E013, 0x06FBA530, 0x030C14A8, + 0x01215A38, 0x03BE914A, 0x05FFB3D2, 0x028478DC, + 0x0726564B, 0x00537D65, 0x006161DE, 0x07AEB02B, + 0x020D6D8E, 0x01C4FA66, 0x05F12500, 0x046868EF, + 0x02174F3B, 0x02255533, 0x071AE436, 0x014A54F7, + 0x07DB3334, 0x041BDA53, 0x0283D946, 0x053130DA, + 0x01ABA660, 0x07360D56, 0x0056855C, 0x00CE94BD, + 0x0406CDD9, 0x06E6E008, 0x004D36E0, 0x051C6286, + 0x0270346E, 0x05AD0969, 0x07D0E274, 0x00E5991E, + 0x0286B221, 0x056319CA, 0x0084E10B, 0x050CBD59, + 0x0683D539, 0x034B03AA, 0x069ADBB5, 0x013F16D2, + 0x01EA112A, 0x037C0DB8, 0x070F9266, 0x026BE5C1, + 0x04E4E47C, 0x021DC174, 0x049F4368, 0x030BA52B, + 0x04A7E825, 0x02869122, 0x02986850, 0x02501755, + 0x03B99C06, 0x00960EB8, 0x07DAFE1F, 0x03C1F644, + 0x0423E828, 0x032C4A38, 0x0602F748, 0x06AA625E, + 0x07587950, 0x02964BF0, 0x03A6B633, 0x03627E34, + 0x03BF74E4, 0x03DA2A2F, 0x04AAB440, 0x01028113, + 0x03860A5C, 0x04874576, 0x078C31ED, 0x0048BC9C, + 0x01544842, 0x019922EA, 0x03D13432, 0x072E4602, + 0x05947F38, 0x045059D9, 0x03BCB4B1, 0x04D1196E, + 0x003EA37F, 0x031AB679, 0x049F4941, 0x03B29D99, + 0x048F5356, 0x0776CD4B, 0x0313BA85, 0x0200BBA3, + 0x00B8AB81, 0x005AC364, 0x0454D94F, 0x0097FA8A, + 0x06CF6FF2, 0x02596050, 0x0542E364, 0x00CBF046, + 0x03D9624A, 0x05B68507, 0x04FC61A1, 0x05BE5A73, + 0x023ACFF7, 0x06CFCFE3, 0x02639FBA, 0x057B3C8F, + 0x017CFE6C, 0x01CB94D3, 0x0328D69B, 0x02ECFEE7, + 0x070258F0, 0x021799B6, 0x02FEB4CB, 0x0511A362, + 0x0089C6AB, 0x06A305D4, 0x05B8A852, 0x0231138C, + 0x03C30AB5, 0x043E510D, 0x06565249, 0x0421DCF4, + 0x04D58857, 0x05D10658, 0x05EEA869, 0x04404D1D, + 0x010E0C8F, 0x04B64F11, 0x005E881E, 0x0683A890, + 0x031B0717, 0x02A38461, 0x01EB6C9B, 0x055CE3B8, + 0x0414733D, 0x060C602F, 0x00F033FF, 0x05167B33, + + 0x04A9DC78, 0x0077F324, 0x03791527, 0x062A6309, + 0x03291611, 0x022F9818, 0x07452BDE, 0x06F92768, + 0x010C5DA6, 0x07675065, 0x0332B09A, 0x00856009, + 0x02993788, 0x06F81E49, 0x0036CA92, 0x07AA2EEA, + 0x0458BD2F, 0x004DD8AC, 0x026BEC7E, 0x03278664, + 0x075581CF, 0x01E96321, 0x0113EE6C, 0x04303FCB, + 0x0242F3CA, 0x00B08BDD, 0x050F5CF8, 0x0504A197, + 0x07FE5BFB, 0x07BDF90B, 0x01C65BB1, 0x00921436, + 0x007202F5, 0x04CA4249, 0x034FB69E, 0x0283DB7B, + 0x03C7C61A, 0x06B3EA14, 0x077B885A, 0x07752D31, + 0x037ED1C8, 0x04A5CE3D, 0x06D3F995, 0x00DCC24B, + 0x047072D0, 0x01C166DB, 0x01860647, 0x07489365, + 0x00EE5F88, 0x063F8882, 0x06D77198, 0x0145A590, + 0x0291187A, 0x006E4606, 0x069550A6, 0x06224C8C, + 0x068BB1CE, 0x01519F5D, 0x01F1A883, 0x06309385, + 0x06C653E2, 0x01AB6E47, 0x0541D01E, 0x00A21869, + 0x038F42FA, 0x04F8BCE5, 0x07AC3407, 0x049FC3B5, + 0x07F4902B, 0x03CF9275, 0x05526F3D, 0x05E28B23, + 0x00EEEA3A, 0x03982C33, 0x04124282, 0x0396F250, + 0x0195A14C, 0x072E5EAE, 0x00E6E717, 0x003DC85E, + 0x038B6FF8, 0x04C7B6FE, 0x076F853B, 0x05BAA978, + 0x030EDF53, 0x04F1AEAB, 0x03A3D1B0, 0x0207BA9D, + 0x03928189, 0x006E3DFD, 0x012EDB63, 0x062116C3, + 0x0786305B, 0x065C3FAD, 0x044AE49B, 0x0431138D, + 0x068963C6, 0x07CDC08C, 0x0179CBEE, 0x04E823B2, + 0x03F919C6, 0x04B360F1, 0x06E5AC3C, 0x0540C334, + 0x06A9102C, 0x061CB509, 0x013B8536, 0x00D5B3D6, + 0x04838C80, 0x066308A8, 0x076AE7EA, 0x0613968A, + 0x054EC14E, 0x05BC0854, 0x034602A9, 0x068FB55C, + 0x04D5A55B, 0x02FC18B0, 0x044B9B70, 0x05BF28AF, + 0x07FE89F2, 0x0452207A, 0x03AFAA4F, 0x0288FEA8, + 0x0426C60C, 0x034D6F1D, 0x053EA274, 0x06F5631E, + 0x0349AF3E, 0x048ABC15, 0x026E0937, 0x03C69B8B, + 0x03CA94DE, 0x02F36D84, 0x01ABC96A, 0x01C5C9E1, + 0x05B3C1A6, 0x0025E14B, 0x033E0FD8, 0x07BABDEF, + 0x06FFC780, 0x02ED1E95, 0x04B92564, 0x075B4238, + 0x078FEF49, 0x04A1024B, 0x00AA6C24, 0x01310C32, + 0x067B8D0D, 0x059D38EC, 0x06411603, 0x039D4F50, + 0x0003471B, 0x002F1F45, 0x027AF1F8, 0x061E6850, + 0x055AB734, 0x036E99E3, 0x07014475, 0x069B10C3, + 0x068BE51A, 0x02C006C5, 0x0288E7B8, 0x075B45DB, + 0x016F1C65, 0x03465E48, 0x043C68CA, 0x05E77E8D, + 0x0051F731, 0x012DC2FF, 0x01C11914, 0x02ADA6A1, + 0x02456B10, 0x0365049F, 0x013F80A6, 0x03B4AD28, + 0x01C480E2, 0x06C2F6DB, 0x06512084, 0x00E5DC11, + 0x02DC1915, 0x01840696, 0x034087A0, 0x07C40C20, + 0x03963E03, 0x062BAEE1, 0x07BC9556, 0x02DF2044, + 0x009823EE, 0x027671B0, 0x051C0806, 0x0479E463, + 0x0241414B, 0x0524582B, 0x06077E70, 0x02969905, + 0x01480578, 0x02AF230F, 0x07A9D824, 0x03955F39, + 0x04416164, 0x035E768D, 0x02DBEB41, 0x031AC25E, + 0x01B43DA1, 0x040FF3CC, 0x02B93B42, 0x00D0CD63, + 0x05C34037, 0x05E17F9D, 0x06D4006B, 0x06216274, + 0x00536CF2, 0x003C9402, 0x006B6BCA, 0x02C4975A, + 0x022B10A4, 0x05711925, 0x0155CE98, 0x038C6B67, + 0x02A06A0C, 0x060FAC1C, 0x02AB5B25, 0x038FB9A3, + 0x011261EC, 0x00A391B5, 0x07DB8671, 0x04FA631C, + 0x0739EFBE, 0x06EDC12A, 0x04F4C770, 0x003DD114, + 0x00888C03, 0x00FFF95C, 0x02EFBD4E, 0x029C2CCC, + 0x02D3F3C3, 0x029B853C, 0x02603C10, 0x00F8431D, + 0x03250BE4, 0x0460FEF8, 0x0250E2D5, 0x0439722E, + 0x02513A6E, 0x05D82FCD, 0x064894C2, 0x05492769, + 0x03266680, 0x047E0475, 0x02FA0EB6, 0x06BA3C61, + 0x047FA9A9, 0x02C1A9FE, 0x025ACFB7, 0x02985ED2, + + 0x04441BAC, 0x060D6E18, 0x04D5A4D7, 0x042A7F2E, + 0x06902DAB, 0x00E87B20, 0x017F6ECE, 0x0134312A, + 0x054D7CCE, 0x04C49F48, 0x03E33BA0, 0x00990CF1, + 0x00BD21BD, 0x01466B0D, 0x0702E278, 0x038ED06C, + 0x04BC7EB9, 0x07D59BF7, 0x04572039, 0x02C0EF14, + 0x00B3DEDC, 0x0560B71B, 0x04EE3D97, 0x018816E1, + 0x06185D9B, 0x01D91E3E, 0x0333A02E, 0x0287192F, + 0x02052CC5, 0x06E702F5, 0x044385D7, 0x03C0D8EC, + 0x03EAA772, 0x0495D684, 0x029CBCAD, 0x051DB4F4, + 0x0413BD8A, 0x057B06E4, 0x02650B62, 0x04683194, + 0x07CDCE28, 0x05815B81, 0x02BF630C, 0x0408C8CD, + 0x07F1D99C, 0x04D9DB4D, 0x07E2FCA1, 0x067F15BE, + 0x034C32D2, 0x07A5E06F, 0x0349D642, 0x06475323, + 0x05104EAB, 0x04FD4462, 0x03750461, 0x02B1D943, + 0x061EA9C7, 0x067BC97D, 0x02619A6B, 0x0654F1A7, + 0x0153E670, 0x00E597C0, 0x05F234AB, 0x04F7C459, + 0x026DD557, 0x06A0FC01, 0x0705E313, 0x05056DFE, + 0x018DD524, 0x033F7EBE, 0x02075A2E, 0x05BF99F2, + 0x00AA1078, 0x00C6B82E, 0x0194A559, 0x06AC62BB, + 0x03187480, 0x024316BE, 0x035B674C, 0x069C78DA, + 0x0698BE5B, 0x079353F3, 0x02AE3CD4, 0x00CAC9D4, + 0x006DBF93, 0x061BCE6F, 0x04B74C88, 0x07E0113E, + 0x013EC74C, 0x035AD6BE, 0x0360215D, 0x07F3B0E0, + 0x01B37B6A, 0x05B2A0CC, 0x03D32F5D, 0x016BB94D, + 0x01A374D1, 0x06A8F973, 0x0181AC19, 0x04176B01, + 0x0785C98E, 0x0013DB53, 0x075247CE, 0x0767FF49, + 0x00B29434, 0x061FDEB3, 0x05C57CF0, 0x07D1FDA2, + 0x030968E5, 0x01C01BA4, 0x03BAC374, 0x0744CDE1, + 0x07E9CDBA, 0x0199E71A, 0x012481EA, 0x07D1712E, + 0x01CD4CCB, 0x01377B6D, 0x05605B0E, 0x002FEAD2, + 0x02B2337B, 0x07622D30, 0x00A04AD9, 0x02D3BE46, + 0x07F02949, 0x0424A261, 0x076585B5, 0x078816BE, + 0x07154117, 0x01C11842, 0x050029F9, 0x07928B4E, + 0x04F89976, 0x0458082C, 0x0119CF5D, 0x01B54C8A, + 0x04F5282C, 0x02095F82, 0x01DFDB26, 0x06B7BC89, + 0x0582A656, 0x075A623D, 0x04BDB794, 0x0637A962, + 0x057A662D, 0x046B8EC7, 0x0621680F, 0x025175A7, + 0x0021CB4A, 0x009B3215, 0x015F1CAD, 0x06589BDD, + 0x06C0168B, 0x0362B7F9, 0x07300782, 0x06B22353, + 0x06540788, 0x01160327, 0x023E8711, 0x05014033, + 0x000405D7, 0x028C4AD2, 0x0236D242, 0x05F2E721, + 0x067CF60A, 0x05BB8ACD, 0x0060EF1A, 0x05AC708E, + 0x07E2BC7D, 0x07C99786, 0x00E49260, 0x01E5411A, + 0x047D51FB, 0x05CD01A8, 0x071081EB, 0x04CD0F64, + 0x039818D2, 0x0333096C, 0x04B686D1, 0x0399D633, + 0x0774C73D, 0x07CE7E4A, 0x03E8FB45, 0x07F00496, + 0x07909622, 0x047701B7, 0x0527C8D1, 0x07E9318D, + 0x00629C06, 0x00C79873, 0x024C1C1C, 0x0743B797, + 0x05B1E662, 0x01542F00, 0x02AC058C, 0x0178AE04, + 0x0153DC07, 0x07D617F5, 0x05BC22B3, 0x054658D6, + 0x07E328D1, 0x04769750, 0x041DCC6A, 0x04C55E9F, + 0x025F562F, 0x012AD3D9, 0x07E16C24, 0x079177C2, + 0x04FCA8EF, 0x02D93386, 0x05161E69, 0x06B39D9D, + 0x008699E0, 0x0405519F, 0x029FB6BA, 0x038F33FF, + 0x0443ED1D, 0x04608C08, 0x02426B87, 0x0662A078, + 0x05A748EC, 0x0305A6CE, 0x04E1841B, 0x0171FE26, + 0x057ADCFA, 0x00F46C0A, 0x00052EC8, 0x051F0984, + 0x06E385FF, 0x01173F10, 0x05166DF2, 0x07793AE8, + 0x013C3393, 0x006135F5, 0x06C00900, 0x04D5F763, + 0x02C7993D, 0x07049AEE, 0x0272F2BD, 0x021D5CB5, + 0x05A53EFE, 0x06466AB1, 0x077FDD2B, 0x03976DA3, + 0x05EEBAC3, 0x0315E29B, 0x000D8D97, 0x00E0292F, + 0x01AC4A30, 0x05D468EA, 0x07F92E7A, 0x04790EB8, + 0x00416DE1, 0x01C0269C, 0x06564FC0, 0x064D8FD1 +}; diff --git a/build/libraries_sysmenu/hotsw/ARM9/Makefile b/build/libraries_sysmenu/hotsw/ARM9/Makefile new file mode 100644 index 00000000..21eb10c7 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM9/Makefile @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +#---------------------------------------------------------------------------- + +SRCDIR = ./src + +SRCS = hotsw_ctrl.c + +TARGET_LIB = libhotsw$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +ifeq ($(HOTSW_NO_MESSAGE),TRUE) +MACRO_FLAGS += -DHOTSW_NO_MESSAGE +endif + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/hotsw/ARM9/src/hotsw_ctrl.c b/build/libraries_sysmenu/hotsw/ARM9/src/hotsw_ctrl.c new file mode 100644 index 00000000..a94cc2e9 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/ARM9/src/hotsw_ctrl.c @@ -0,0 +1,555 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: hotsw_ctrl.c + + Copyright 2007 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 <../ARM7/include/hotswTypes.h> +#include <../ARM7/include/customNDma.h> + +// Extern ------------------------------------------------------------------- +extern CardThreadData HotSwThreadData; + +// define ------------------------------------------------------------------- +#define HOTSW_READ_MSG_NUM 1 +#define HOTSW_CARD_GAME_MODE_CALLBACK 1 +#define HOTSW_CARD_INSERT_CALLBACK 2 +#define HOTSW_CARD_PULLOUT_CALLBACK 3 +#define HOTSW_CALLBACK_FUNCTION_NUM 3 + +// Function prototype ------------------------------------------------------- +static void InterruptCallbackPxi(PXIFifoTag tag, u32 data, BOOL err); +static CardDataReadState ReadPageGame(u32 start_addr, void* buf, u32 size); + +// Static Values ------------------------------------------------------------ +static HotSwMessageForArm9 s_HotswMsg; +static OSMessage s_HotswMsgBuffer[HOTSW_READ_MSG_NUM]; +static OSMessageQueue s_HotswQueue; + +static BOOL s_ReadBusy; +static OSIrqFunction s_HotswFuncTable[HOTSW_CALLBACK_FUNCTION_NUM]; + +static u16 s_CardLockID; + + +// =========================================================================== +// Function Describe +// =========================================================================== +/*---------------------------------------------------------------------------* + Name: HOTSW_Init + + Description: 活栓挿抜処理の初期化 + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +void HOTSW_Init() +{ + s32 tempLockID; + + // カードアクセス用のロックIDの取得 + while((tempLockID = OS_GetLockID()) == OS_LOCK_ID_ERROR){ + // do nothing + } + s_CardLockID = (u16)tempLockID; + + // メッセージキューの初期化 + OS_InitMessageQueue( &s_HotswQueue, &s_HotswMsgBuffer[0], HOTSW_READ_MSG_NUM ); + + // Busyフラグを落としておく + s_ReadBusy = FALSE; + + // PXI初期化 + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_HOTSW, InterruptCallbackPxi); + + while(!PXI_IsCallbackReady(PXI_FIFO_TAG_HOTSW, PXI_PROC_ARM7)) + { + // do nothing + } +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_EnableHotSWAsync + + Description: PXI通信でARM7に活線挿抜有効/無効を通知(非同期版) + + ※ 活線挿抜を一時的に抑制する場合はこちらの関数を使ってください。 + *---------------------------------------------------------------------------*/ +void HOTSW_EnableHotSWAsync( BOOL enable ) +{ + HotSwPxiMessageForArm7 msg; + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm7)); + enable = enable ? 1 : 0; + + // 現在の値と同じなら何もせずリターン + if( SYSMi_GetWork()->flags.hotsw.isEnableHotSW == enable ) { + return; + } + + msg.msg.finalize = FALSE; + msg.msg.ctrl = TRUE; + msg.msg.value = enable; + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_EnableHotSWAsync + + Description: PXI通信でARM7に活線挿抜有効/無効を通知(同期版) + + ※ 活線挿抜を一時的に抑制する場合はこちらの関数を使ってください。 + *---------------------------------------------------------------------------*/ +void HOTSW_EnableHotSW( BOOL enable ) +{ + HOTSW_EnableHotSWAsync( enable ); + + while(HOTSW_isEnableHotSW() != enable){ + // do nothing + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_InvalidHotSWAsync + + Description: PXI通信でARM7に活線挿抜無効を通知。(非同期版) + + ※ アプリをブートさせるときに活線挿抜を抑制する場合はこちらの関数を使ってください。 + *---------------------------------------------------------------------------*/ +void HOTSW_InvalidHotSWAsync( void ) +{ + HotSwPxiMessageForArm7 msg; + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm7)); + + // 現在の値と同じなら何もせずリターン + if( SYSMi_GetWork()->flags.hotsw.isEnableHotSW == FALSE ) { + return; + } + + msg.msg.finalize = TRUE; + msg.msg.ctrl = TRUE; + msg.msg.value = FALSE; + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_InvalidHotSW + + Description: PXI通信でARM7に活線挿抜無効を通知。(同期版) + + ※ アプリをブートさせるときに活線挿抜を抑制する場合はこちらの関数を使ってください。 + *---------------------------------------------------------------------------*/ +void HOTSW_InvalidHotSW( void ) +{ + HOTSW_InvalidHotSWAsync(); + + while(HOTSW_isEnableHotSW() != FALSE){ + // do nothing + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_FinalizeHotSW + + Description: PXI通信でARM7に活線挿抜Finalize処理を通知 + *---------------------------------------------------------------------------*/ +void HOTSW_FinalizeHotSWAsync( HotSwCardState cardState ) +{ + HotSwPxiMessageForArm7 msg; + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm7)); + + msg.msg.finalize = TRUE; + msg.msg.ctrl = FALSE; + msg.msg.cardState= (u8)cardState; + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_isFinalized + + Description: 終了処理が完了したかを返す + *---------------------------------------------------------------------------*/ +BOOL HOTSW_isFinalized(void) +{ + return SYSMi_GetWork()->flags.hotsw.isFinalized; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_isEnableHotSW + + Description: 活線挿抜の許可/抑制の状態を返す + *---------------------------------------------------------------------------*/ +BOOL HOTSW_isEnableHotSW(void) +{ + return SYSMi_GetWork()->flags.hotsw.isEnableHotSW; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_isCardLoadCompleted + + Description: カードアプリのロードが完了しているかを返す + *---------------------------------------------------------------------------*/ +BOOL HOTSW_isCardLoadCompleted(void) +{ + return SYSMi_GetWork()->flags.hotsw.isCardLoadCompleted; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_isBusyHotSW + + Description: 活線挿抜処理中かどうかを返す + *---------------------------------------------------------------------------*/ +BOOL HOTSW_isBusyHotSW(void) +{ + return SYSMi_GetWork()->flags.hotsw.isBusyHotSW; +} + + +/*---------------------------------------------------------------------------* + Name: HOTSW_ReadCardDataAsync + + Description: カードデータを読み出す関数。(非同期版) + ※実際に読んでるのはARM7側 + + ※ 本関数を呼び出して、CARD_READ_SUCCESSが返ってきても、データが正しく + リードできているとはかぎりません。 + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +CardDataReadState HOTSW_ReadCardDataAsync(void* src, void* dest, u32 size) +{ + HotSwPxiMessageForArm7 msg; + + MI_CpuClear8( &msg, sizeof(HotSwPxiMessageForArm7)); + + if( !HOTSW_isGameMode() ){ + return CARD_READ_MODE_ERROR; + } + + if( s_ReadBusy ){ + return CARD_READ_BUSY; + } + s_ReadBusy = TRUE; + + SYSMi_GetWork()->cardReadParam.src = (u32)src; + SYSMi_GetWork()->cardReadParam.dest = (u32)dest; + SYSMi_GetWork()->cardReadParam.size = size; + + DC_FlushRange( &SYSMi_GetWork()->cardReadParam, sizeof(CardReadParam) ); + DC_FlushRange( dest, size ); + + msg.msg.read = TRUE; + + while (PXI_SendWordByFifo(PXI_FIFO_TAG_HOTSW, msg.data, FALSE) != PXI_FIFO_SUCCESS) + { + // do nothing + } + + return CARD_READ_SUCCESS; +} +#endif + +/*---------------------------------------------------------------------------* + Name: HOTSW_ReadCardData + + Description: カードデータを読み出す関数。(同期版) + ※実際に読んでるのはARM7側 + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +CardDataReadState HOTSW_ReadCardData(void* src, void* dest, u32 size) +{ + HotSwMessageForArm9 *msg; + CardDataReadState retval; + + retval = HOTSW_ReadCardDataAsync( src, dest, size); + + if(retval != CARD_READ_SUCCESS){ + return retval; + } + + OS_ReceiveMessage( &s_HotswQueue, (OSMessage *)&msg, OS_MESSAGE_BLOCK ); + + return (CardDataReadState)msg->result; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_isGameMode + + Description: カードがゲームモードになったかどうかを返す + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +BOOL HOTSW_isGameMode(void) +{ + return SYSMi_GetWork()->flags.hotsw.isCardGameMode ? TRUE : FALSE; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: InterruptCallbackPxi + + Description: PXI割り込みハンドラ + *---------------------------------------------------------------------------*/ +static void InterruptCallbackPxi(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused(tag) +#pragma unused(err) + HotSwPxiMessageForArm9 d; + + MI_CpuClear8( &d, sizeof(HotSwPxiMessageForArm9) ); + + d.data = data; + + if(d.msg.mode){ + if(s_HotswFuncTable[HOTSW_CARD_GAME_MODE_CALLBACK] != NULL){ + s_HotswFuncTable[HOTSW_CARD_GAME_MODE_CALLBACK](); + } + } + + if(d.msg.insert){ + if(s_HotswFuncTable[HOTSW_CARD_INSERT_CALLBACK] != NULL){ + s_HotswFuncTable[HOTSW_CARD_INSERT_CALLBACK](); + } + } + + if(d.msg.pullout){ + if(s_HotswFuncTable[HOTSW_CARD_PULLOUT_CALLBACK] != NULL){ + s_HotswFuncTable[HOTSW_CARD_PULLOUT_CALLBACK](); + } + } + + + if(d.msg.read){ + s_ReadBusy = FALSE; + + s_HotswMsg.isReadComplete = (d.msg.read) ? TRUE : FALSE; + s_HotswMsg.result = (CardDataReadState)d.msg.result; + + HOTSW_TPrintf("%s %d Rcev Error Code[Arm9]:%x\n", __FUNCTION__, __LINE__, s_HotswMsg.result); + + // メッセージ送信 + OS_SendMessage( &s_HotswQueue, (OSMessage *)&s_HotswMsg, OS_MESSAGE_NOBLOCK); + } +} + + +/*---------------------------------------------------------------------------* + Name: SetGameModeCallBackFunction + + Description: カードがGameモードになった時のコールバック関数を設定 + + ※ HOTSW_Initが呼び出される前に設定してください + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +void HOTSW_SetGameModeCallBackFunction(OSIrqFunction function) +{ + s_HotswFuncTable[HOTSW_CARD_GAME_MODE_CALLBACK] = function; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: SetCardInsertCallBackFunction + + Description: カードが刺さった時のコールバック関数を設定 + + ※ HOTSW_Initが呼び出される前に設定してください + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +void HOTSW_SetCardInsertCallBackFunction(OSIrqFunction function) +{ + s_HotswFuncTable[HOTSW_CARD_INSERT_CALLBACK] = function; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: SetCardPullOutCallBackFunction + + Description: カードが抜けた時のコールバック関数を設定 + + ※ HOTSW_Initが呼び出される前に設定してください + *---------------------------------------------------------------------------*/ +#ifdef USE_WRAM_LOAD +void HOTSW_SetCardPullOutCallBackFunction(OSIrqFunction function) +{ + s_HotswFuncTable[HOTSW_CARD_PULLOUT_CALLBACK] = function; +} +#endif + + +/*---------------------------------------------------------------------------* + Name: HOTSW_ReadCardDataOnGameMode + + Description: Gameモードのデータ読み関数 + *---------------------------------------------------------------------------*/ +CardDataReadState HOTSW_ReadCardDataOnGameMode(const void* src, void* dest, u32 size) +{ + CardDataReadState retval = CARD_READ_SUCCESS; + + static u8 page_buffer[512]; + u32 offset = (u32)src; + u32 page_offset = (u32)(offset & -512); + u32 buffer_offset = (u32)(offset % 512); + u32 valid_length = 512 - buffer_offset; + u32 remain_length; + + // 開始アドレスがページの途中 + if ( offset % 512 ) + { + retval = ReadPageGame(page_offset, page_buffer, 512); + + if (retval != HOTSW_SUCCESS) + { + return retval; + } + + MI_CpuCopy8(page_buffer + buffer_offset, dest, (size < valid_length ? size : valid_length)); + + dest = (u8*)dest + valid_length; + offset += valid_length; + size -= valid_length; + if ( size < 0) + { + return retval; + } + } + + remain_length = (u32)(size % 512); + retval = ReadPageGame(offset, dest, (u32)(size - remain_length)); + + // ケツがページ途中 + if( remain_length ){ + dest = (u8*)dest + (size - remain_length); + offset += size - remain_length; + + retval = ReadPageGame(offset, page_buffer, 512); + + if (retval != HOTSW_SUCCESS) + { + return retval; + } + + MI_CpuCopy8(page_buffer, dest, remain_length); + } + + return retval; +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: GameモードのPage読み関数 + *---------------------------------------------------------------------------*/ +static CardDataReadState ReadPageGame(u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + GCDCmd64 cndLE, cndBE; + +#ifdef USE_NEW_DMA + OSMessage msg; +#endif + + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + // カードのロック + CARD_LockRom(s_CardLockID); + + for(i=0; igameCommondParam | START_MASK | HOTSW_PAGE_1; + +#ifdef USE_NEW_DMA + // メッセージ受信 + OS_ReceiveMessage(&HotSwThreadData.hotswDmaQueue, (OSMessage *)&msg, OS_MESSAGE_BLOCK); +#else + while(reg_HOTSW_MCCNT1 & START_FLG_MASK){ + while(!(reg_HOTSW_MCCNT1 & READY_FLG_MASK)){} + *((u32 *)buf + counter++) = reg_HOTSW_MCD1; + } +#endif + } + + // 100ns Wait + OS_SpinWait( OS_NSEC_TO_CPUCYC(100) ); + + // カードのロック開放(※ロックIDは開放せずに持ち続ける) + CARD_UnlockRom(s_CardLockID); + + return CARD_READ_SUCCESS; +} diff --git a/build/libraries_sysmenu/hotsw/Makefile b/build/libraries_sysmenu/hotsw/Makefile new file mode 100644 index 00000000..1badcc03 --- /dev/null +++ b/build/libraries_sysmenu/hotsw/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM7 ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/mcu/ARM7/Makefile b/build/libraries_sysmenu/mcu/ARM7/Makefile new file mode 100644 index 00000000..91e79dbc --- /dev/null +++ b/build/libraries_sysmenu/mcu/ARM7/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# 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: $ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +#---------------------------------------------------------------------------- + +SRCDIR = ./src + +INCDIR = ./include ../common/include + +SRCS = mcu.c + +TARGET_LIB = libsysmmcu_sp$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/mcu/ARM7/src/mcu.c b/build/libraries_sysmenu/mcu/ARM7/src/mcu.c new file mode 100644 index 00000000..30c8c27c --- /dev/null +++ b/build/libraries_sysmenu/mcu/ARM7/src/mcu.c @@ -0,0 +1,261 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mcu.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:: 2008-01-25#$ + $Rev: 3844 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#include +#include + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define MCUTEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define MCUTEST_THREAD_STACK_SIZE 512 // スレッドのスタックサイズ + +#define MCUTEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define MCU_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define MCU_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct SYSMMcuWork +{ + u32 total; + u32 current; + SYSMMcuCommand command; + u8 data[MCUTEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[MCUTEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // MCU用スレッド + u64 stack[MCUTEST_THREAD_STACK_SIZE / sizeof(u64)]; + // MCU用スレッドのスタック +} +SYSMMcuWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL mcuInitialized; +static SYSMMcuWork mcuWork; +static u8 mcu_ver; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void SYSM_McuPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void SYSM_ReturnMcuResult(SYSMMcuCommand command, SYSMMcuPxiResult result); +static void SYSM_ReturnMcuResultEx(SYSMMcuCommand command, SYSMMcuPxiResult result, u8 size, u8* data); +static void SYSM_McuThread(void *arg); +#if 0 +static void SYSM_McuHandlerExternalDC(void) +{ +OS_TPrintf("MCU_IE_EXTERNAL_DC_TRIGGER\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_EXTERNAL_DC_TRIGGER); +} +#endif +static void SYSM_McuHandlerBatteryLow(void) +{ +OS_TPrintf("MCU_IE_BATTERY_LOW_TRIGGER\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_BATTERY_LOW_TRIGGER); +} + +static void SYSM_McuHandlerBatteryEmpty(void) +{ +OS_TPrintf("MCU_IE_BATTERY_EMPTY_TRIGGER\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_BATTERY_EMPTY_TRIGGER); +} + +static void SYSM_McuHandlerPowerSwitch(void) +{ +OS_TPrintf("MCU_IE_POWER_SWITCH_PRESSED\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_POWER_SWITCH_PRESSED); +} + +static void SYSM_McuHandlerPowerOffRequest(void) +{ +OS_TPrintf("MCU_IE_POWER_OFF_REQUEST\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_POWER_OFF_REQUEST); +} + +static void SYSM_McuHandlerResetRequest(void) +{ +OS_TPrintf("MCU_IE_RESET_REQUEST\n"); + SYSM_ReturnMcuResult(MCU_TEST_COMMAND_INTERRUPT, (SYSMMcuPxiResult)MCU_IE_RESET_REQUEST); +} + +#ifdef SDK_SUPPORT_PMIC_2 +// マイコンバージョン取得 +u8 SYSMi_GetMcuVersion( void ) +{ + return (u8)(mcu_ver >> MCU_REG_VER_INFO_VERSION_SHIFT); +} +#endif // SDK_SUPPORT_PMIC_2 + +// 初期化 +void SYSM_InitMcuPxi( u32 prio ) +{ + if (mcuInitialized) + { + return; + } + mcuInitialized = TRUE; + + OS_InitMessageQueue(&mcuWork.msgQ, mcuWork.msgArray, MCUTEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&mcuWork.thread, SYSM_McuThread, 0, + (void *)(mcuWork.stack + (MCUTEST_THREAD_STACK_SIZE / sizeof(u64))), + MCUTEST_THREAD_STACK_SIZE, prio); + OS_WakeupThreadDirect(&mcuWork.thread); + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_MCUTEST, SYSM_McuPxiCallback); + +#ifdef SDK_SUPPORT_PMIC_2 + // マイコンバージョン取得 + mcu_ver = (u8)(MCU_ReadRegister( MCU_REG_VER_INFO_ADDR )); +#endif // SDK_SUPPORT_PMIC_2 + +#if 0 +#if 0 + MCU_SetIrqFunction(MCU_IE_EXTERNAL_DC_TRIGGER, McuHandlerExternalDC); +#endif + MCU_SetIrqFunction(MCU_IE_BATTERY_LOW_TRIGGER, McuHandlerBatteryLow); + MCU_SetIrqFunction(MCU_IE_BATTERY_EMPTY_TRIGGER, McuHandlerBatteryEmpty); + MCU_SetIrqFunction(MCU_IE_POWER_SWITCH_PRESSED, McuHandlerPowerSwitch); + MCU_SetIrqFunction(MCU_IE_POWER_OFF_REQUEST, McuHandlerPowerOffRequest); + MCU_SetIrqFunction(MCU_IE_RESET_REQUEST, McuHandlerResetRequest); + +{ + OSTick tick = OS_GetTick(); + MCU_ReadRegister(0x70); + OS_TPrintf("Read: %d usec\n", (u32)OS_TicksToMicroSeconds(OS_GetTick()-tick)); + tick = OS_GetTick(); + MCU_WriteRegister(0x70, 0); + OS_TPrintf("Write: %d usec\n", (u32)OS_TicksToMicroSeconds(OS_GetTick()-tick)); +} + + // PMICへの電源ボタン割り込み削除 (あれば) + OS_DisableIrqMaskEx(OS_IE_GPIO33_0); + // (再)初期化 + MCU_InitIrq(1); +#endif +} + +static void SYSM_McuPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & MCUTEST_PXI_START_BIT) // 先頭データ + { + mcuWork.total = (u8)((data & MCUTEST_PXI_DATA_NUMS_MASK) >> MCUTEST_PXI_DATA_NUMS_SHIFT); + mcuWork.current = 0; + mcuWork.command = (SYSMMcuCommand)((data & MCUTEST_PXI_COMMAND_MASK) >> MCUTEST_PXI_COMMAND_SHIFT); + mcuWork.data[mcuWork.current++] = (u8)((data & MCUTEST_PXI_1ST_DATA_MASK) >> MCUTEST_PXI_1ST_DATA_SHIFT); + } + else if (mcuWork.command) // 後続データ + { + mcuWork.data[mcuWork.current++] = (u8)((data & 0xFF0000) >> 16); + mcuWork.data[mcuWork.current++] = (u8)((data & 0x00FF00) >> 8); + mcuWork.data[mcuWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (mcuWork.current >= mcuWork.total) + { + switch (mcuWork.command) + { + case MCU_TEST_COMMAND_READ_REGISTER: + case MCU_TEST_COMMAND_WRITE_REGISTER: + if (!OS_SendMessage(&mcuWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + SYSM_ReturnMcuResult(mcuWork.command, MCU_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + SYSM_ReturnMcuResult(mcuWork.command, MCU_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void SYSM_ReturnMcuResult(SYSMMcuCommand command, SYSMMcuPxiResult result) +{ + u32 pxiData = (u32)(MCUTEST_PXI_START_BIT | MCUTEST_PXI_RESULT_BIT | + ((command << MCUTEST_PXI_COMMAND_SHIFT) & MCUTEST_PXI_COMMAND_MASK) | + ((1 << MCUTEST_PXI_DATA_NUMS_SHIFT) & MCUTEST_PXI_DATA_NUMS_MASK) | + ((result << MCUTEST_PXI_1ST_DATA_SHIFT) & MCUTEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, pxiData, 0)) + { + } +} + +static void SYSM_ReturnMcuResultEx(SYSMMcuCommand command, SYSMMcuPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(MCUTEST_PXI_START_BIT | MCUTEST_PXI_RESULT_BIT | + ((command << MCUTEST_PXI_COMMAND_SHIFT) & MCUTEST_PXI_COMMAND_MASK) | + (((size+1) << MCUTEST_PXI_DATA_NUMS_SHIFT) & MCUTEST_PXI_DATA_NUMS_MASK) | + ((result << MCUTEST_PXI_1ST_DATA_SHIFT) & MCUTEST_PXI_1ST_DATA_MASK)); + OSIntrMode enabled = OS_DisableInterrupts(); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, pxiData, 0)) + { + } + } + OS_RestoreInterrupts(enabled); +} + +static void SYSM_McuThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + u8 value; + + while (TRUE) + { + (void)OS_ReceiveMessage(&mcuWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (mcuWork.command) + { + case MCU_TEST_COMMAND_READ_REGISTER: + value = MCU_ReadRegister(mcuWork.data[0]); + SYSM_ReturnMcuResultEx(mcuWork.command, MCU_PXI_RESULT_SUCCESS, 1, &value); + break; + + case MCU_TEST_COMMAND_WRITE_REGISTER: + value = (u8)MCU_WriteRegister(mcuWork.data[0], mcuWork.data[1]); + SYSM_ReturnMcuResult(mcuWork.command, value ? MCU_PXI_RESULT_SUCCESS : MCU_PXI_RESULT_ILLEGAL_STATUS); + break; + + default: + SYSM_ReturnMcuResult(mcuWork.command, MCU_PXI_RESULT_INVALID_COMMAND); + } + mcuWork.command = MCU_TEST_COMMAND_NULL; + } +} + +#include diff --git a/build/libraries_sysmenu/mcu/ARM9/Makefile b/build/libraries_sysmenu/mcu/ARM9/Makefile new file mode 100644 index 00000000..619e6b9c --- /dev/null +++ b/build/libraries_sysmenu/mcu/ARM9/Makefile @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# 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:: 2008-02-07#$ +# $Rev: 612 $ +# $Author: yutaka $ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +#---------------------------------------------------------------------------- + +SRCDIR = ./src + +INCDIR = ./include ../common/include + +SRCS = mcu.c + +TARGET_LIB = libsysmmcu$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/libraries_sysmenu/mcu/ARM9/src/mcu.c b/build/libraries_sysmenu/mcu/ARM9/src/mcu.c new file mode 100644 index 00000000..ebe66b3e --- /dev/null +++ b/build/libraries_sysmenu/mcu/ARM9/src/mcu.c @@ -0,0 +1,311 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mcu.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:: 2008-01-29#$ + $Rev: 3905 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#include +#include + +#define DMA_WILL_STOP // MCU_GetMaxLinesRoundならdefine、MCU_GET_MAX_LINESならundef + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define MCU_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define MCU_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct SYSMMcuWork +{ + BOOL lock; + + SYSMMcuCommand command; + SYSMMcuPxiResult result; + SYSMMcuCallback callback; + SYSMMcuCallback handler; + void* arg; + + u32 total; + u32 current; + u8* data; +} +SYSMMcuWork; + +#include + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL mcuInitialized; +static SYSMMcuWork mcuWork; +static u8 mcu_ver; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL SYSM_SendMcuPxiCommand(SYSMMcuCommand command, u8 size, u8 data); +static void SYSM_SendMcuPxiData(u8 *pData); +static void SYSM_McuPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void SYSM_DoneMcu(SYSMMcuResult result); +static void SYSM_WaitMcuBusy(void); + + +// 初期化 +void SYSM_InitMcuPxi( void ) +{ + if (mcuInitialized) + { + return; + } + mcuInitialized = TRUE; + mcuWork.lock = TRUE; + mcuWork.handler = NULL; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_MCUTEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_MCUTEST, SYSM_McuPxiCallback); + + mcuWork.lock = TRUE; + mcuWork.callback = NULL; + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, 0, 0)) + { + return; + } + while (*(vu32*)&mcuWork.lock) + { + } + +#ifdef SDK_SUPPORT_PMIC_2 + // マイコンバージョン取得 + while ( SYSM_ReadMcuRegisterAsync( MCU_REG_VER_INFO_ADDR, &mcu_ver, NULL, NULL ) != MCU_RESULT_SUCCESS ) {} +#endif // SDK_SUPPORT_PMIC_2 +} + +#ifdef SDK_SUPPORT_PMIC_2 +// マイコンバージョン取得 +u8 SYSMi_GetMcuVersion( void ) +{ + return (u8)(mcu_ver >> MCU_REG_VER_INFO_VERSION_SHIFT); +} +#endif // SDK_SUPPORT_PMIC_2 + +SYSMMcuResult SYSM_ReadMcuRegisterAsync( u8 addr, u8 *pValue, SYSMMcuCallback callback, void* arg ) +{ + OSIntrMode enabled = OS_DisableInterrupts(); + if (mcuWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return MCU_RESULT_BUSY; + } + mcuWork.lock = TRUE; + mcuWork.callback = callback; + mcuWork.arg = arg; + mcuWork.data = pValue; + (void)OS_RestoreInterrupts(enabled); + + if (SYSM_SendMcuPxiCommand(MCU_TEST_COMMAND_READ_REGISTER, 1, (u8)addr)) + { + return MCU_RESULT_SUCCESS; + } + return MCU_RESULT_SEND_ERROR; +} + +SYSMMcuResult SYSM_WriteMcuRegisterAsync( u8 addr, u8 value, SYSMMcuCallback callback, void* arg ) +{ + OSIntrMode enabled; + u8 data[3]; + + enabled = OS_DisableInterrupts(); + if (mcuWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return MCU_RESULT_BUSY; + } + mcuWork.lock = TRUE; + mcuWork.callback = callback; + mcuWork.arg = arg; + mcuWork.data = NULL; + data[0] = value; + (void)OS_RestoreInterrupts(enabled); + + if (SYSM_SendMcuPxiCommand(MCU_TEST_COMMAND_WRITE_REGISTER, 2, (u8)addr)) + { + SYSM_SendMcuPxiData(data); + return MCU_RESULT_SUCCESS; + } + return MCU_RESULT_SEND_ERROR; +} + +void SYSM_SetMcuInterruptHandler( SYSMMcuCallback handler ) +{ + mcuWork.handler = handler; +} + +///////// +static BOOL SYSM_SendMcuPxiCommand(SYSMMcuCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(MCUTEST_PXI_START_BIT | + ((command << MCUTEST_PXI_COMMAND_SHIFT) & MCUTEST_PXI_COMMAND_MASK) | + ((size << MCUTEST_PXI_DATA_NUMS_SHIFT) & MCUTEST_PXI_DATA_NUMS_MASK) | + ((data << MCUTEST_PXI_1ST_DATA_SHIFT) & MCUTEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void SYSM_SendMcuPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_MCUTEST, pxiData, 0)) + { + } +} + +static void SYSM_McuPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + SYSM_DoneMcu(MCU_RESULT_FATAL_ERROR); + return; + } + if (data & MCUTEST_PXI_START_BIT) // 先頭データ + { + if (data & MCUTEST_PXI_RESULT_BIT) + { + mcuWork.total = (u8)((data & MCUTEST_PXI_DATA_NUMS_MASK) >> MCUTEST_PXI_DATA_NUMS_SHIFT); + mcuWork.current = 0; + mcuWork.command = (SYSMMcuCommand)((data & MCUTEST_PXI_COMMAND_MASK) >> MCUTEST_PXI_COMMAND_SHIFT); + mcuWork.result = (SYSMMcuPxiResult)((data & MCUTEST_PXI_1ST_DATA_MASK) >> MCUTEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + SYSM_DoneMcu(MCU_RESULT_FATAL_ERROR); + return; + } + } + else if (mcuWork.command) // 後続データ + { + if (mcuWork.data == NULL) + { + SYSM_DoneMcu(MCU_RESULT_FATAL_ERROR); + return; + } + if (mcuWork.current < mcuWork.total-1) + { + mcuWork.data[mcuWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (mcuWork.current < mcuWork.total-1) + { + mcuWork.data[mcuWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (mcuWork.current < mcuWork.total-1) + { + mcuWork.data[mcuWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + + if (mcuWork.command == MCU_TEST_COMMAND_NULL) + { + SYSM_DoneMcu(MCU_RESULT_SUCCESS); + return; + } + + if (mcuWork.command == MCU_TEST_COMMAND_INTERRUPT) + { + if (mcuWork.handler) + { + mcuWork.handler(MCU_RESULT_SUCCESS, (void*)mcuWork.result); + } + return; + } + + if (mcuWork.current == mcuWork.total-1) + { + SYSMMcuResult result; + switch (mcuWork.result) + { + case MCU_PXI_RESULT_SUCCESS: // alias MCU_PXI_RESULT_SUCCESS_TRUE + result = MCU_RESULT_SUCCESS; // alias MCU_RESULT_SUCCESS_TRUE + break; + case MCU_PXI_RESULT_SUCCESS_FALSE: + result = MCU_RESULT_SUCCESS_FALSE; + break; + case MCU_PXI_RESULT_INVALID_COMMAND: + result = MCU_RESULT_INVALID_COMMAND; + break; + case MCU_PXI_RESULT_INVALID_PARAMETER: + result = MCU_RESULT_ILLEGAL_PARAMETER; + break; + case MCU_PXI_RESULT_ILLEGAL_STATUS: + result = MCU_RESULT_ILLEGAL_STATUS; + break; + case MCU_PXI_RESULT_BUSY: + result = MCU_RESULT_BUSY; + break; + default: + result = MCU_RESULT_FATAL_ERROR; + } + SYSM_DoneMcu(result); + mcuWork.command = MCU_TEST_COMMAND_NULL; + return; + } +} + +static void SYSM_DoneMcu(SYSMMcuResult result) +{ + SYSMMcuCallback callback = mcuWork.callback; + void* arg = mcuWork.arg; + mcuWork.callback = NULL; + mcuWork.arg = NULL; + if (mcuWork.lock) + { + mcuWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void SYSM_WaitMcuBusy(void) +{ + volatile BOOL *p = &mcuWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +#include diff --git a/build/libraries_sysmenu/mcu/Makefile b/build/libraries_sysmenu/mcu/Makefile new file mode 100644 index 00000000..e89234c0 --- /dev/null +++ b/build/libraries_sysmenu/mcu/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# 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: $ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +SUBDIRS = ARM7 ARM9 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/namut/ARM9/Makefile b/build/libraries_sysmenu/namut/ARM9/Makefile new file mode 100644 index 00000000..4e2cd989 --- /dev/null +++ b/build/libraries_sysmenu/namut/ARM9/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - NAMUT +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +INCDIR = include + +SRCS = namut.c + +TARGET_LIB = libnamut$(TWL_LIBSUFFIX).a + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +CCFLAGS += -DSMALL_CODE_SIZE \ + -DSTANDALONE \ + -DOPT_32_BIT \ + -DNO_SPLIT \ + -DNO_FP_API \ + -DNO_R_DIAG \ + -DNO_STDIO_H \ + -DNO_STDLIB_H + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/namut/ARM9/src/namut.c b/build/libraries_sysmenu/namut/ARM9/src/namut.c new file mode 100644 index 00000000..a3f605fd --- /dev/null +++ b/build/libraries_sysmenu/namut/ARM9/src/namut.c @@ -0,0 +1,1369 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - NAMUT + File: namut.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$ + *---------------------------------------------------------------------------*/ + +// Nand Application Management UTility ライブラリ、略してNAMUTライブラリです。 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +// eTicketType +typedef enum ETicketType { + ETICKET_TYPE_COMMON = 0, + ETICKET_TYPE_PERSONALIZED = 1 +}ETicketType; + +typedef struct { + u8 pad1[ 12 ]; + u32 deviceId; + u8 pad2[ 216 - 16 ]; +} ESTicketView; + +typedef s32 ESError; +#define ES_ERR_OK 0 + +extern ESError ES_GetTicketViews(u64 titleId, ESTicketView* ticketViewList, + u32* ticketViewCnt); + +// 本体初期化(NAND初期化)で消去しないタイトルを +// TitleProperty (TitleID 32bit)のビットで指定します。 +// どれか1つでもビットが立っていれば消去の対象から外します。 +#define PROTECT_TITLE_PROPERTY (TITLE_ID_APP_TYPE_MASK) +#define CLEAR_DATA_SIZE 16384 // ファイル消去データ用(512の倍数で大きいほど処理が早い) + +// 本体初期化(NAND初期化)実行時に +// 指定ディレクトリ以下は全て消去されます。 +// 指定ディレクトリ自体は残ります。 +static const char* sDeleteDirectoryList[] = +{ + "nand:/import", + "nand:/progress", + "nand2:/photo", + "nand:/tmp" +}; + +// 本体初期化(NAND初期化)実行時に +// 指定ファイルはランダムデータでFillされます。 +static const char* sFillFileList[] = +{ + "nand:/shared2/launcher/wrap.bin" +}; + +#define VOLUME_INITIAL_VALUE 5 // 本体初期化時に設定する本体ボリューム値 +#define BACKLIGHT_INITIAL_VALUE 3 // 本体初期化時に設定するバックライト輝度 +#define NAMUT_SHARE_ARCHIVE_MAX 6 // shareデータ個数 + +#define SHOP_TITLE_ID 0x00030015484E4600 // ショップのTitleID(リージョン除く) +#define TITLE_ID_MASK_EXCEPT_REGION 0xFFFFFFFFFFFFFF00 // TitleIDのマスク(リージョン除く) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static NAMUTAlloc spAllocFunc; +static NAMUTFree spFreeFunc; +static FSDirectoryEntryInfo sEntryInfo; +static char sCurrentFullPath[FS_ENTRY_LONGNAME_MAX]; +static u32 sNCFGAddr; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL NAMUTi_DeleteNonprotectedTitle( BOOL isForceEraseAllUserApp ); +static BOOL NAMUTi_ClearSavedataAll(void); +static BOOL NAMUTi_InitShareData(void); +static BOOL NAMUTi_MountAndFormatOtherTitleSaveData(u64 titleID, const char *arcname); +static BOOL NAMUTi_RandClearFile(const char* path); +static BOOL NAMUTi_CheckExistenceFile(const char* path); +static BOOL NAMUTi_ClearWiFiSettings( void ); +static BOOL NAMUTi_DeleteShopAccount( void ); +static void* NAMUT_Alloc(u32 size); +static void NAMUT_Free(void* buffer); +static s32 GetETicketType(NAMTitleId titleId, ETicketType *pETicketType ); +static s32 GetTicketViews(ESTicketView** pptv, u32* pNumTicket, NAMTitleId titleId); + +/*---------------------------------------------------------------------------* + Name: NAMUT_Init + + Description: NAMUT ライブラリの初期化を行います。 + + Arguments: allocFunc: メモリ確保関数へのポインタ。(要:32byteアライメント) + freeFunc: メモリ解放関数へのポインタ。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void NAMUT_Init(NAMUTAlloc allocFunc, NAMUTFree freeFunc) +{ + SDK_ASSERT( spAllocFunc == NULL ); + SDK_ASSERT( spFreeFunc == NULL ); + SDK_POINTER_ASSERT(allocFunc); + SDK_POINTER_ASSERT(freeFunc); + + spAllocFunc = allocFunc; + spFreeFunc = freeFunc; +} + +/*---------------------------------------------------------------------------* + Name: NAMUT_Format + + Description: 本体初期化(NAND初期化)を行います。 + (システム系の必要なファイルのみを残し他を消去します + ユーザーアプリは、common, personalizedに関わらず全て消去します) + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_Format( void ) +{ + return NAMUT_FormatCore( TRUE, TRUE ); +} + +/*---------------------------------------------------------------------------* + Name: NAMUT_FormatCore + + Description: 本体初期化(NAND初期化)を行います。 + (システム系の必要なファイルのみを残し他を消去します + ユーザーアプリを common, personalizedに関わらず全て消去するか、 +        personalizedのみ消去するかを引数で選択できます。 + + Arguments: isForceEraseAllUserApp: TRUE の時は、common, personalizedに関わらずユーザーアプリを全消去 + FALSEの時は、commonETicketのアプリを残す。 + isDeleteWifiSettings: WiFi設定を削除するか?(TRUEで削除) + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_FormatCore( BOOL isForceEraseAllUserApp, BOOL isDeleteWiFiSettings ) +{ + int i; + BOOL ret = TRUE; + + // プロテクトされていないタイトルの削除を行います + if (!NAMUTi_DeleteNonprotectedTitle( isForceEraseAllUserApp )) + { + ret = FALSE; + OS_TWarning("Fail! NAMUTi_DeleteNonprotectedTitle()\n"); + } + + // ショップアカウント情報を削除します + if (!NAMUTi_DeleteShopAccount()) + { + ret = FALSE; + OS_TWarning("Fail! NAMUTi_DeleteShopAccount()\n"); + } + + // プロテクトタイトルのセーブデータを初期化します + if (!NAMUTi_ClearSavedataAll()) + { + ret = FALSE; + OS_TWarning("Fail! NAMUTi_ClearSavedataAll()\n"); + } + + // shareデータを初期化します + if (!NAMUTi_InitShareData()) + { + ret = FALSE; + OS_TWarning("Fail! NAMUTi_InitShareData()\n"); + } + + // 指定ファイルを乱数でクリアします + for (i=0; i 0) + { + ret &= NAMUTi_ClearSavedataPublic( savePublicPath, namTitleInfo.titleId ); + } + // privateSaveSizeが0以上ならフォーマット + if (namTitleInfo.privateSaveSize > 0) + { + ret &= NAMUTi_ClearSavedataPrivate( savePrivatePath, namTitleInfo.titleId ); + } + } + + // サブバナーファイルパス取得 + if (NAM_GetTitleBannerFilePath( subBannerPath, namTitleInfo.titleId) == NAM_OK) + { + NAMUTi_DestroySubBanner( subBannerPath ); + } + else { ret = FALSE; } + } + else { ret = FALSE; } + } + + NAMUT_Free(pTitleIdArray); + + return ret; +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_ClearSavedataPublic + + Description: 指定したセーブデータファイルに対して + 乱数クリア&フォーマットを行います。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_ClearSavedataPublic(const char* path, u64 titleID) +{ + //----- 乱数クリア + if (NAMUTi_RandClearFile(path) == FALSE) + { + OS_Warning(" Fail NAMUTi_RandClearFile"); + return FALSE; + } + + //----- NANDアプリのセーブデータファイルをマウントかつフォーマット + return NAMUTi_MountAndFormatOtherTitleSaveData(titleID, "otherPub"); +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_ClearSavedataPrivate + + Description: 指定したセーブデータファイルに対して + 乱数クリア&フォーマットを行います。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_ClearSavedataPrivate(const char* path, u64 titleID) +{ + //----- 乱数クリア + if (NAMUTi_RandClearFile(path) == FALSE) + { + OS_Warning(" Fail NAMUTi_RandClearFile"); + return FALSE; + } + + //----- NANDアプリのセーブデータファイルをマウントかつフォーマット + return NAMUTi_MountAndFormatOtherTitleSaveData(titleID, "otherPrv"); +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_DestroySubBanner + + Description: 指定したサブバナーのCRC破壊を試みます。 + 指定したサブバナーが存在しない可能性もありますが + その場合でもTRUEを返します。(コードはOS_DeleteSubBannerFileのパクリ) + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_DestroySubBanner(const char* path) +{ + TWLSubBannerFile* pBanner; + u16 crc, solt; + FSFile file[1]; + BOOL ret = FALSE; + + // R属性でファイルをオープンを試みてファイルの存在有無を確認する + // 存在しない場合はTRUEで返す + FS_InitFile(file); + if ( !FS_OpenFileEx(file, path, FS_FILEMODE_R) ) + { + return TRUE; + } + + pBanner = NAMUT_Alloc( sizeof(TWLSubBannerFile) ); + if (!pBanner) + { + OS_TWarning("Allocation failed. (%d)\n"); + return FALSE; + } + + // RWL属性で開く + FS_InitFile(file); + if ( !FS_OpenFileEx(file, path, FS_FILEMODE_RWL) ) + { + OS_Warning("banner file open failed.\n"); + NAMUT_Free( pBanner ); + return FALSE; + } + + // CRCを改竄して書き戻す + if( FS_ReadFile( file, pBanner, sizeof(TWLSubBannerFile) ) != -1 ) + { + crc = SVC_GetCRC16( 0xffff, &pBanner->anime, sizeof(BannerAnime) ); + solt = 1; + crc += solt; + pBanner->h.crc16_anime = crc; + FS_SeekFile( file, 0, FS_SEEK_SET ); + if( sizeof(BannerHeader) == FS_WriteFile(file, &pBanner->h, sizeof(BannerHeader)) ) + { + ret = TRUE; + }else + { + OS_Warning("banner file write failed.\n"); + } + }else + { + OS_Warning("banner file read failed.\n"); + } + FS_CloseFile(file); + + NAMUT_Free( pBanner ); + return ret; +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_MountAndFormatOtherTitleSaveData + + Description: 指定NANDアプリのセーブデータファイルをマウントかつフォーマット。 + + Arguments: titleID : タイトルID + arcname : "otherPub"、"otherPriv"、またはNULL + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +static BOOL NAMUTi_MountAndFormatOtherTitleSaveData(u64 titleID, const char *arcname) +{ + BOOL succeeded = FALSE; + FSFATFSArchiveWork* pWork; + FSResult result; + + pWork = NAMUT_Alloc( sizeof(FSFATFSArchiveWork) ); + if (!pWork) + { + OS_TWarning("Allocation failed. (%d)\n"); + return FALSE; + } + + // マウント試行。 + result = FSi_MountSpecialArchive(titleID, arcname, pWork); + if (result != FS_RESULT_SUCCESS) + { + OS_TWarning("FSi_MountSpecialArchive failed. (%d)\n", result); + } + else + { + // 成功したらフォーマット試行。 + char path[FS_ENTRY_LONGNAME_MAX]; + (void)STD_TSPrintf(path, "%s:/", arcname); + if (!FATFSi_FormatMedia(path)) + { + OS_TWarning("FATFSi_FormatMedia failed. (%d)\n", FATFS_GetLastError()); + } + else if (!FATFS_FormatDrive(path)) + { + OS_TWarning("FATFS_FormatDrive failed. (%d)\n", FATFS_GetLastError()); + } + else + { + succeeded = TRUE; + } + // アンマウント。 + (void)FSi_MountSpecialArchive(titleID, NULL, pWork); + } + + NAMUT_Free ( pWork ); + + return succeeded; +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_InitShareData + + Description: 全Shareデータファイルをフォーマット。 + この関数実行前にShare:/がマウントされていてはいけない。 + + Arguments: None + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +static BOOL NAMUTi_InitShareData(void) +{ + BOOL succeeded = TRUE; + FSFATFSArchiveWork* pWork; + char path[NAM_PATH_LEN]; + FSResult result; + int i; + + pWork = NAMUT_Alloc( sizeof(FSFATFSArchiveWork) ); + if (!pWork) + { + OS_TWarning("Allocation failed. (%d)\n"); + return FALSE; + } + + for (i=0;i CLEAR_DATA_SIZE; filesize -= CLEAR_DATA_SIZE) + { + if( AES_Rand(pClearData, CLEAR_DATA_SIZE) != AES_RESULT_SUCCESS ) + { + FS_CloseFile(&file); + NAMUT_Free( pClearData ); + return FALSE; + } + FS_WriteFile(&file, pClearData, CLEAR_DATA_SIZE); + } + + if (filesize > 0) + { + if( AES_Rand(pClearData, filesize) != AES_RESULT_SUCCESS ) + { + FS_CloseFile(&file); + NAMUT_Free( pClearData ); + return FALSE; + } + FS_WriteFile(&file, pClearData, (s32)filesize); + } + FS_CloseFile(&file); + NAMUT_Free( pClearData ); + } + else + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_CheckExistenceFile + + Description: 指定したファイルが存在するかどうかを判定します。 + + Arguments: path + + Returns: 存在するならTRUE + *---------------------------------------------------------------------------*/ +static BOOL NAMUTi_CheckExistenceFile(const char* path) +{ + FSFile file; + + FS_InitFile(&file); + + if (!FS_OpenFileEx(&file, path, FS_FILEMODE_R)) + { + return FALSE; + } + + FS_CloseFile(&file); + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NAMUT_GetSoftBoxCount + + Description: NANDの InstalledSoftBoxCount、FreeSoftBoxCountを調べて + 指定された変数に格納します。 + + Arguments: installed : installedカウント格納変数 + free : freeカウント格納変数 + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_GetSoftBoxCount( u8* installed, u8* free ) +{ + u32 installedSoftBoxCount; + + // installedSoftBoxCountの取得 + if ( NAM_OK != NAM_GetInstalledSoftBoxCount( &installedSoftBoxCount ) ) { + return FALSE; + } + + // installed count + *installed = (u8)installedSoftBoxCount; + + // free count + *free = (u8)(LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - installedSoftBoxCount); + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: NAMUT_UpdateSoftBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_UpdateSoftBoxCount( void ) +{ + u8 installedSoftBoxCount; + u8 freeSoftBoxCount; + u8 *pBuffer; + BOOL retval = TRUE; + + // InstalledSoftBoxCount, FreeSoftBoxCount を数えなおす + if (!NAMUT_GetSoftBoxCount(&installedSoftBoxCount, &freeSoftBoxCount)) + { + return FALSE; + } + + // LCFGライブラリの静的変数に対する更新 + LCFG_TSD_SetInstalledSoftBoxCount( installedSoftBoxCount ); + LCFG_TSD_SetFreeSoftBoxCount( freeSoftBoxCount ); + + // LCFGライブラリの静的変数の値をNANDに反映 + pBuffer = NAMUT_Alloc( LCFG_WRITE_TEMP ); + if (!pBuffer) { return FALSE; } + // ミラーリングデータの両方に書き込みを行う。 + retval &= LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + retval &= LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + NAMUT_Free( pBuffer ); + + return retval; +} + +/*---------------------------------------------------------------------------* + Name: NAMUT_ClearTWLSettings + + Description: TWL本体設定データのクリアを行います。 + + Arguments: None. + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_ClearTWLSettings( BOOL doWriteback ) +{ + BOOL retval = TRUE; + + // 本体設定データのクリア。TPキャリブレーションデータは残す。 + { + LCFGTWLTPCalibData calib; + u32 installedSoftBoxCount; + + // installedSoftBoxCountの取得 + if ( NAM_OK != NAM_GetInstalledSoftBoxCount( &installedSoftBoxCount ) ) { + return FALSE; + } + + LCFG_TSD_GetTPCalibration( &calib ); + LCFG_ClearTWLSettings( (u8)installedSoftBoxCount ); + LCFG_TSD_SetTPCalibration( &calib ); + } + + // LCFGライブラリの静的変数の値をNANDに反映 + if( doWriteback ) { + u8 *pBuffer = NAMUT_Alloc( LCFG_WRITE_TEMP ); + if (!pBuffer) { return FALSE; } + // ミラーリングデータの両方に書き込みを行う。 + retval &= LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + retval &= LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + NAMUT_Free( pBuffer ); + } + + return retval; +} + +/*---------------------------------------------------------------------------* + Name: NAMUTi_ClearWiFiSettings + + Description: NVRAMのWiFi設定データをクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static BOOL NAMUTi_ClearWiFiSettings( void ) +{ +#define NCFG_ADDR 0x20 +#define NTR_WIFI_DATA_SIZE 0x400 +#define TWL_WIFI_DATA_SIZE 0x600 + const s32 RetryCount = 5; + s32 i; + BOOL readSuccess = FALSE; + BOOL writeSuccess = FALSE; + u32 total_size = ( NTR_WIFI_DATA_SIZE + TWL_WIFI_DATA_SIZE ); + u8* pClearData = NAMUT_Alloc( total_size ); + + if (!pClearData) + { + OS_TWarning("Allocation failed. (%d)\n"); + return FALSE; + } + + if (!NVRAMi_IsInitialized()) { + NVRAMi_Init(); + } + DC_FlushRange( &sNCFGAddr, 2 ); + sNCFGAddr = 0; + for (i=0;i 0 ) + { + int i; + // eTicket は、そのままもしくは追加しかありえないので、プリインストールされたアプリでは、必ずCommon eTikcetが存在する。 + // よって、全ての eTicket のうち、ひとつでも deviceId が 0x00000000 なら、common eTicket と判断。 + for( i = 0; i < numTicket; i++ ) + { + if( ptv[i].deviceId == 0x00000000 ) { + *pETicketType = ETICKET_TYPE_COMMON; + } + } + } + NAMUT_Free(ptv); + } + return result; +} + +/*---------------------------------------------------------------------------* + Name: GetTicketViews + + Description: 指定されたタイトルの eTicket を取得 +        ※nam_title.c の GetTicketViews 関数をコピペ + + Arguments: pptv : 取得成功時に eTicket リストのポインタを格納するポインタ + pNumTicket : 取得成功時に eTicket 数を格納するポインタ + titleID : eTicket を取得したいタイトルの titleID + + Returns: NAM_OK : 取得成功 + それ以外 : 取得失敗 + *---------------------------------------------------------------------------*/ + +static s32 GetTicketViews(ESTicketView** pptv, u32* pNumTicket, NAMTitleId titleId) +{ + s32 result; + u32 numTicket; + ESTicketView* ptv = NULL; + + result = ES_GetTicketViews(titleId, NULL, &numTicket); +// PRINT_RESULT(result); + + if( result != ES_ERR_OK ) + { + return result; + } + + if( numTicket != 0 ) + { + ptv = NAMUT_Alloc(sizeof(ESTicketView) * numTicket); + + if( ptv == NULL ) + { + return NAM_NO_MEMORY; + } + + result = ES_GetTicketViews(titleId, ptv, &numTicket); +// PRINT_RESULT(result); + } + + if( result == ES_ERR_OK ) + { + *pptv = ptv; + *pNumTicket = numTicket; + } + else + { + NAMUT_Free(ptv); + } + + return result; +} + +// インストールされているタイトルのeTikcetタイプを出力 +BOOL NAMUT_PrintInstalledTitleETicketType( void ) +{ + u32 title_num; // NAND にインストールされているアプリの数 + u32 title_num_installed; // NANDにインストールされたことがあるアプリの数 + u32 title_num_all; // 上2つをマージしたアプリの数 + NAMTitleId* pTitleIdArray; + NAMTitleId* pTitleIdArrayInstalled; + s32 result = TRUE; + s32 i,j; + + // タイトル数取得 + title_num = (u32)NAM_GetNumTitles(); + title_num_installed = (u32)NAM_GetNumInstalledTitles(); + + // タイトルID配列用メモリ確保 + pTitleIdArray = NAMUT_Alloc(sizeof(NAMTitleId)*(title_num + title_num_installed)); + pTitleIdArrayInstalled = NAMUT_Alloc(sizeof(NAMTitleId)*title_num_installed); + + if (pTitleIdArray == NULL || pTitleIdArrayInstalled == NULL) + { + OS_TWarning("Allocation failed in %s\n", __func__); + NAMUT_Free(pTitleIdArray); + NAMUT_Free(pTitleIdArrayInstalled); + return FALSE; + } + + // タイトルリスト取得 + if (NAM_GetTitleList(pTitleIdArray, title_num) != NAM_OK || + NAM_GetInstalledTitleList(pTitleIdArrayInstalled, title_num_installed) != NAM_OK) + { + OS_TWarning("Fail! NAM_Get*TitleList() in %s\n", __func__); + NAMUT_Free(pTitleIdArray); + NAMUT_Free(pTitleIdArrayInstalled); + return FALSE; + } + + // NAM_GetTitleListでは削除されているがeTicketのみ存在するタイトルがリストアップされず + // NAM_GetInstalledTitleListではSRLはあるがeTicketがないタイトルがリストアップされない。 + // そのため両者をマージする + title_num_all = title_num; + for (i=0;i +#include "reboot.h" + +// const data------------------------------------------------------------------ + +typedef struct RomSegmentRange { + u32 start; + u32 end; +}RomSegmentRange; + +static RomSegmentRange romSegmentRange[RELOCATE_INFO_NUM] = { + { SYSM_TWL_ARM9_LOAD_MMEM, SYSM_TWL_ARM9_LOAD_MMEM_END }, + { SYSM_TWL_ARM7_LOAD_MMEM, SYSM_TWL_ARM7_LOAD_MMEM_END }, + { SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END }, + { SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END }, +}; + +static RomSegmentRange romSegmentRangeNitro[RELOCATE_INFO_NUM] = { + { SYSM_NTR_ARM9_LOAD_MMEM, SYSM_NTR_ARM9_LOAD_MMEM_END }, + { SYSM_NTR_ARM7_LOAD_MMEM, SYSM_NTR_ARM7_LOAD_MMEM_END }, + { SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END }, + { SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END }, +}; + +static u32 load_region_check_list[RELOCATE_INFO_NUM][RELOCATE_INFO_NUM * 2 - 1] = +{ + {SYSM_NTR_ARM7_LOAD_MMEM, SYSM_NTR_ARM7_LOAD_MMEM_END, + SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, + SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, + NULL }, + {SYSM_NTR_ARM9_LOAD_MMEM, SYSM_NTR_ARM9_LOAD_MMEM_END, + SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, + SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, + NULL }, + {SYSM_NTR_ARM9_LOAD_MMEM, SYSM_NTR_ARM9_LOAD_MMEM_END, + SYSM_NTR_ARM7_LOAD_MMEM, SYSM_NTR_ARM7_LOAD_MMEM_END, + SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, + NULL }, + {SYSM_NTR_ARM9_LOAD_MMEM, SYSM_NTR_ARM9_LOAD_MMEM_END, + SYSM_NTR_ARM7_LOAD_MMEM, SYSM_NTR_ARM7_LOAD_MMEM_END, + SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, + NULL }, +}; + +// ============================================================================ +// +// 再配置情報生成 +// +// ============================================================================ + +// ROMのロード先領域をチェックし、再配置の必要があればロード先アドレスを変更し、再配置情報を*infoにセットする。 +// ロード先領域が被ってはいけない領域のリストcheck_destは{開始, 終了, 開始2, 終了2, ……, NULL}の形式。 +// 再配置の有り無しに関わらずロード可能ならばTRUE、ロード不可能ならばFALSEを返す +// 再配置が必要ない場合、再配置情報のsrc,dest,lengthにはそれぞれNULLが代入される。 +static BOOL SYSMi_CheckLoadRegionAndSetRelocateInfoEx +( u32 *dest, u32 length, RomSegmentRange default_region, u32 *check_dest, Relocate_Info *info ) +{ + u32 ori_len = length; + + // AES暗号化領域の関係で、再配置必要性およびサイズオーバーのチェックに使うlengthは32バイトアライメントに補正 + // (そうでないと、デフォルトロード領域の後ろ数バイトまでAES暗号解除処理されてしまう可能性があるため) + length = MATH_ROUNDUP( length, SYSM_ALIGNMENT_LOAD_MODULE ); + MI_CpuClearFast( info, sizeof(Relocate_Info) ); + if( default_region.end - default_region.start < length ) return FALSE;// サイズオーバー + if( !( default_region.start <= *dest && *dest + length <= default_region.end ) ) + { + // 再配置の必要あり + while( *check_dest != NULL ) + { + if( check_dest[0] < *dest + length && *dest < check_dest[1] ) return FALSE;// チェック領域に被ったらNG + check_dest += 2; + } + + // ここから先はlengthでなくori_lenを使用 + + // ここまで来ていれば再配置可 + // 後方コピーフラグOFF + info->rev = FALSE; + if( default_region.start < *dest + ori_len && *dest + ori_len <= default_region.end ) + { + // デフォルト配置領域の先頭部に、再配置先の後部が被っている + // ポストクリア情報 + info->post_clear_addr = *dest + ori_len; + info->post_clear_length = default_region.end - (*dest + ori_len); + } + else if( default_region.start <= *dest && *dest < default_region.end ) + { + // デフォルト配置領域の後部に、再配置先の先頭部が被っている + // ポストクリア情報 + info->post_clear_addr = default_region.start; + info->post_clear_length = *dest - default_region.start; + if( *dest < default_region.start + ori_len ) + { + // 更に、デフォルト配置領域にロードしたデータの最後尾と再配置先の先頭部が被っている + // 後方コピーフラグON + info->rev = TRUE; + } + }else + { + // まったく被っていない + // ポストクリア情報 + info->post_clear_addr = default_region.start; + info->post_clear_length = default_region.end - default_region.start; + } + info->src = default_region.start; + info->dest = *dest; + info->length = ori_len; + *dest = default_region.start; + }else + { + // 再配置の必要なし + } + return TRUE; +} + +// SYSMi_CheckLoadRegionAndSetRelocateInfoExのラッパー関数 +BOOL SYSM_CheckLoadRegionAndSetRelocateInfo( RomSegmentName seg, u32 *dest, u32 length, Relocate_Info *info, BOOL isTwlApp) +{ + RomSegmentRange *rsr; + if( isTwlApp ) + { + rsr = romSegmentRange; + }else + { + //NTR専用 + rsr = romSegmentRangeNitro; + } + + // *dest から *dest+length がアプリロード禁止領域(Launcher最終ブートコード及びエントリポイント不可領域)に被っていないかどうか判定 + if( ( + ( seg == ARM9_STATIC || seg == ARM9_LTD_STATIC ) && + !( ( *dest >= HW_MAIN_MEM ) && ( *dest + length < HW_TWL_MAIN_MEM_SHARED ) ) + ) || + ( ( seg == ARM7_STATIC || seg == ARM7_LTD_STATIC ) && + !( ( ( *dest >= HW_MAIN_MEM ) && + ( *dest + length < HW_TWL_MAIN_MEM_SHARED ) ) || + ( ( *dest >= HW_WRAM_BASE ) && + ( *dest + length < SYSM_NTR_ARM7_LOAD_WRAM_END ) ) ) + ) || + !( ( *dest + length < OS_BOOT_A9CODE_BUF ) || ( *dest >= OS_BOOT_A9CODE_BUF + OS_BOOT_CODE_SIZE ) ) || + !( ( *dest + length < OS_BOOT_A7CODE_BUF ) || ( *dest >= OS_BOOT_A7CODE_BUF + OS_BOOT_CODE_SIZE ) ) + ) { + OS_TPrintf("load address invalid.\n"); + return FALSE; + } + + return SYSMi_CheckLoadRegionAndSetRelocateInfoEx(dest, length, rsr[seg], load_region_check_list[seg], info); +} diff --git a/build/libraries_sysmenu/sharedFont/ARM9/Makefile b/build/libraries_sysmenu/sharedFont/ARM9/Makefile new file mode 100644 index 00000000..90eff0f8 --- /dev/null +++ b/build/libraries_sysmenu/sharedFont/ARM9/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SRCDIR = $(ROOT)/build/libraries/os/ARM9.TWL/src/ +SRCS = os_sharedFont.c + +TARGET_LIB = libsharedfont_launcher$(TWL_LIBSUFFIX).a + +LINCLUDES += $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/ARM9/include + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DUSE_FONT_WRAM_LOAD + +ifeq ($(DEFAULT_COMP_ARM7),hyena) +MACRO_FLAGS += -DUSE_HYENA_COMPONENT +endif + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/sharedFont/Makefile b/build/libraries_sysmenu/sharedFont/Makefile new file mode 100644 index 00000000..a2098ba3 --- /dev/null +++ b/build/libraries_sysmenu/sharedFont/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/sysmenu/ARM7/Makefile b/build/libraries_sysmenu/sysmenu/ARM7/Makefile new file mode 100644 index 00000000..38238e05 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM7/Makefile @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM7 +override TWL_CODEGEN = ALL + +SRCS_COMMON = status.c \ + pxi.c \ + mountInfo.c \ + decryptAES.c + +SRCS = setAESKey.c \ + $(addprefix ../common/src/, $(SRCS_COMMON)) + +TARGET_LIB = libsysmenu_sp$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +LINCLUDES = $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include \ + $(ROOT)/build/libraries/spi/ARM7/pm/include \ + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/sysmenu/ARM7/src/setAESKey.c b/build/libraries_sysmenu/sysmenu/ARM7/src/setAESKey.c new file mode 100644 index 00000000..9f0e7d09 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM7/src/setAESKey.c @@ -0,0 +1,240 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setAESKey.c + + Copyright 2007 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 "internal_api.h" + +// define data----------------------------------------------------------------- +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +void SYSMi_SetAESKeysForAccessControlCore( ROM_Header *pROMH, u8 *pDst, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC ); + +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +// const data------------------------------------------------------------------ + +static const u8 dev_sslClientCert[] ATTRIBUTE_ALIGN(4) = { + 0x79, 0xf9, 0x51, 0xbc, 0x3b, 0xb7, 0xe4, 0xca, + 0x18, 0x8f, 0xaf, 0x91, 0x8d, 0x89, 0xd3, 0x46, +}; + +// dev_commonKeyはベタで持っていい。 +static const u8 dev_commonKey[] ATTRIBUTE_ALIGN(4) = { + 0xA1, 0x60, 0x4A, 0x6A, 0x71, 0x23, 0xB5, 0x29, + 0xAE, 0x8B, 0xEC, 0x32, 0xC8, 0x16, 0xFC, 0xAA +}; + +static const u8 dev_seedES[] ATTRIBUTE_ALIGN(4) = { + 0x2D, 0xD4, 0x03, 0x98, 0xA7, 0x6B, 0x03, 0x28, + 0xCE, 0x61, 0x04, 0xBB, 0x0A, 0xBB, 0x03, 0x5B, +}; + +static const u8 dev_seedNAM[] ATTRIBUTE_ALIGN(4) = { + 0x4D, 0x04, 0xA4, 0x7F, 0xE3, 0x02, 0x30, 0x2E, + 0x2A, 0x07, 0x06, 0xE6, 0xD9, 0x06, 0x47, 0x76, +}; + +static const u8 dev_seedSlotC[] ATTRIBUTE_ALIGN(4) = { + 0x3B, 0x06, 0x86, 0x57, 0x33, 0x04, 0x88, 0x11, + 0x49, 0x04, 0x6B, 0x33, 0x12, 0x02, 0xAC, 0xF3, +}; + +static const u8 dev_jpegEncodeKeyForLauncher[] ATTRIBUTE_ALIGN(4) = { + 0xEF, 0x9A, 0xB3, 0x39, 0x48, 0x3C, 0x2B, 0x13, + 0x39, 0x31, 0xA5, 0x3F, 0x86, 0x25, 0x9B, 0xB3, +}; + +static const u8 dev_jpegEncodeKeyForNormal[] ATTRIBUTE_ALIGN(4) = { + 0x79, 0xAF, 0xFE, 0xA7, 0xF3, 0x6A, 0xB7, 0xBE, + 0x83, 0xB6, 0x41, 0xFD, 0xFC, 0x42, 0xD7, 0x3B, +}; + + +// ============================================================================ +// +// AES鍵スロット設定 +// +// ============================================================================ + +void SYSMi_SetAESKeysForAccessControl( BOOL isNtrMode, ROM_Header *pROMH ) +{ + BOOL isClearSlotA = TRUE; + BOOL isClearSlotB = TRUE; + BOOL isClearSlotC = TRUE; + + // 鍵のセット + MI_CpuClearFast( (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, HW_LAUNCHER_DELIVER_PARAM_BUF_SIZE ); + if( !isNtrMode ) { + SYSMi_SetAESKeysForSSLClientCert( pROMH, &isClearSlotA ); + SYSMi_SetAESKeysForSignJPEG( pROMH, &isClearSlotB, &isClearSlotC ); + SYSMi_SetAESKeysForAccessControlCore( pROMH, (u8 *)HW_LAUNCHER_DELIVER_PARAM_BUF, &isClearSlotB, &isClearSlotC ); + } + + // ブートするアプリに応じて、AESキースロットのクリアを行う。 + { + if( isClearSlotA ) AESi_ResetAesKeyA(); + if( isClearSlotB ) AESi_ResetAesKeyB(); + if( isClearSlotC ) AESi_ResetAesKeyC(); + + // NANDにアクセスしないアプリは、スロットDの鍵をクリアする  +// if( th->s.access_control.nand_access == 0 ) AESi_ResetAesKeyD(); ※rebootの中のREBOOTi_DetachAllDrivesでNANDにアクセスする場合があるので、ここでクリアはできない。やるならその後ろで。 + } + + // その他の鍵は不要になるので、消しておく + { + OSFromFirmBuf* fromFirm = (void*)HW_FIRM_FROM_FIRM_BUF; + MI_CpuClearFast(fromFirm, sizeof(OSFromFirmBuf)); + } +} + + +void SYSMi_SetAESKeysForSSLClientCert( ROM_Header *pROMH, BOOL *pIsClearSlotA ) +{ + if ( pROMH->s.access_control.hw_aes_slot_A_SSLClientCert == TRUE ) { + void *pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->aes_key[ 3 ] ) : (void *)dev_sslClientCert; + + if( pIsClearSlotA ) { + *pIsClearSlotA = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeyA( pAESKey ); + AES_Unlock(); + } +} + + +void SYSMi_SetAESKeysForSignJPEG( ROM_Header *pROMH, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC ) +{ + void *pAESKey; + if( ( pROMH->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) && + ( ( 0 == STD_CompareNString( (const char *)&pROMH->s.titleID_Lo[ 1 ], "ANH", 3 ) ) +#ifdef DEV_UIG_LAUNCHER + || ( ( 0 == STD_CompareNString( (const char *)&pROMH->s.titleID_Lo[ 1 ], "AN4", 3 ) ) && ( SCFG_GetBondingOption() != 0 ) ) +#endif + ) + ) { + // for Launcher + pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x30 ] ) : (void *)dev_jpegEncodeKeyForLauncher; + if( pIsClearSlotC ) { + *pIsClearSlotC = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeyC( pAESKey ); + AES_Unlock(); + + }else if( ( pROMH->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK ) && + ( 0 == STD_CompareNString( (const char *)&pROMH->s.titleID_Lo[ 1 ], "INH", 3 ) ) + ) { + // for 写真帳 + pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x40 ] ) : (void *)dev_jpegEncodeKeyForNormal; + if( pIsClearSlotB ) { + *pIsClearSlotB = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeyB( pAESKey ); + AES_Unlock(); + + pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x30 ] ) : (void *)dev_jpegEncodeKeyForLauncher; + if( pIsClearSlotC ) { + *pIsClearSlotC = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeyC( pAESKey ); + AES_Unlock(); + + }else if( pROMH->s.access_control.nand_access == TRUE || pROMH->s.access_control.sd_card_access == TRUE ) { + // SignJPEG用AESキー + if ( pROMH->s.access_control.hw_aes_slot_B_SignJPEGForLauncher == TRUE) { + // for Launcher + pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x30 ] ) : (void *)dev_jpegEncodeKeyForLauncher; + }else { + // for ノーマルアプリ + pAESKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x40 ] ) : (void *)dev_jpegEncodeKeyForNormal; + } + if( pIsClearSlotB ) { + *pIsClearSlotB = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeyB( pAESKey ); + AES_Unlock(); + } +} + + +void SYSMi_SetAESKeysForAccessControlCore( ROM_Header *pROMH, u8 *pDst, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC ) +{ + // セキュアアプリ以外はセットなし + if ( !( pROMH->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) ) { + return; + } + + // commonClientKey + if( pROMH->s.access_control.common_client_key ) { + void *pCommonKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + OSi_GetFromFirmAddr()->aes_key[ 0 ] : (void *)dev_commonKey; + MI_CpuCopy8( pCommonKey, pDst, AES_BLOCK_SIZE ); + } + // commonClientKeyForDebugger + else if( pROMH->s.access_control.common_client_key_for_debugger_sysmenu ) { + MI_CpuCopy8( OSi_GetFromFirmAddr()->aes_key[ 1 ], pDst, AES_BLOCK_SIZE ); + } + + // HW AES Slot B + if( pROMH->s.access_control.hw_aes_slot_B ) { + void *pSeedES = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0 ] ) : (void *)dev_seedES; + MI_CpuCopy8( pSeedES, pDst + 0x10, AES_BLOCK_SIZE ); + if( pIsClearSlotB ) { + *pIsClearSlotB = FALSE; + } + // AESスロットのデフォルト値セットは不要 + } + // HW AES Slot C + if( pROMH->s.access_control.hw_aes_slot_C ) { + void *pSeedNAM = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x10 ] ) : (void *)dev_seedNAM; + void *pSeedSlotC = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ? + &( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x20 ] ) : (void *)dev_seedSlotC; + MI_CpuCopy8( pSeedNAM, pDst + 0x20, AES_BLOCK_SIZE ); + if( pIsClearSlotC ) { + *pIsClearSlotC = FALSE; + } + // AESスロットのデフォルト値セット + AES_Lock(); + AES_SetKeySeedC( pSeedSlotC ); + AES_Unlock(); + } +} + + diff --git a/build/libraries_sysmenu/sysmenu/ARM9/Makefile b/build/libraries_sysmenu/sysmenu/ARM9/Makefile new file mode 100644 index 00000000..b219ec5a --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/Makefile @@ -0,0 +1,105 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +REVISION_SRC = src/revision.c + +SRCDIR = src +SRCS = sysmenu_lib.c \ + ninLogoFunc.c \ + device.c \ + keys.c \ + title.c \ + fs_wram.c \ + ../common/src/status.c \ + ../common/src/pxi.c \ + ../common/src/mountInfo.c \ + ../common/src/decryptAES.c \ + $(REVISION_SRC) + + +TARGET_LIB = libsysmenu$(TWL_LIBSUFFIX).a + +ifeq ($(SYSM_DO_NOT_SHOW_LAUNCHER),TRUE) +MACRO_FLAGS += -DSYSM_DO_NOT_SHOW_LAUNCHER +endif + +ifeq ($(SYSM_DISABLE_INITIAL_SETTINGS),TRUE) +MACRO_FLAGS += -DSYSM_DISABLE_INITIAL_SETTINGS +endif + +ifeq ($(DEFAULT_COMP_ARM7),hyena) +MACRO_FLAGS += -DUSE_HYENA_COMPONENT +endif + +ifeq ($(SYSM_BUILD_FOR_PRODUCTION_TEST),TRUE) +MACRO_FLAGS += -DSYSM_BUILD_FOR_PRODUCTION_TEST +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifeq ($(SYSM_DEV_WHITELIST_CHECK_SKIP),TRUE) +MACRO_FLAGS += -DDEV_WHITELIST_CHECK_SKIP +endif + +ifeq ($(SYSM_IGNORE_DHT_PHASE_3),TRUE) +MACRO_FLAGS += -DSYSM_IGNORE_DHT_PHASE_3 +endif + +ifeq ($(SYSM_IGNORE_DHT_EX_NOT_FOUND),TRUE) +MACRO_FLAGS += -DSYSM_IGNORE_DHT_EX_NOT_FOUND +endif + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +LINCLUDES = $(ROOT)/build/libraries/mb/common/include \ + $(ROOT)/build/libraries/spi/ARM9/include \ + $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include + +LDIRT_CLEAN = $(REVISION_SRC) + +#---------------------------------------------------------------------------- + +do-build: $(REVISION_SRC) $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#SVNリビジョン埋め込み +$(REVISION_SRC) :: + @if test -e $(SYSMENU_ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(SYSMENU_ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|const char *g_strIPLSvnRevision = \"\1\";|" > $(REVISION_SRC); \ + else \ + echo "const char *g_strIPLSvnRevision = \"-\";" > $(REVISION_SRC); \ + fi + @if test -e $(ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|const char *g_strSDKSvnRevision = \"\1\";|" >> $(REVISION_SRC); \ + else \ + echo "const char *g_strSDKSvnRevision = \"-\";" >> $(REVISION_SRC); \ + fi + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/sysmenu/ARM9/include/fs_wram.h b/build/libraries_sysmenu/sysmenu/ARM9/include/fs_wram.h new file mode 100644 index 00000000..2ddcf697 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/include/fs_wram.h @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - include - fs + File: fs_wram.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 TWL_FS_WRAM_H_ +#define TWL_FS_WRAM_H_ + +#ifdef SDK_TWL +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + FSWramCallback + Read/Write中のWRAMにデータがある状態で呼び出されるAPI + 改ざんした場合は、改ざん後のデータが有効となることに注意 + addr データがあるアドレス + orig_addr 本来のRead格納先/Write元アドレス + len 有効なデータサイズ + wram 使用しているWRAM + slot 使用しているスロット + arg APIに渡した引数 +*/ +typedef void (*FSWramCallback)(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg); + +/* + FS_InitWramTransfer + 一度だけ呼び出しておく必要がある + priority 立ち上げるスレッドの優先順位 +*/ +BOOL FS_InitWramTransfer( u32 priority ); +/* + FS_ReadFileViaWram + FS/FATFSに対して同期Readを行う + 完了するまで返ってこない点に注意 + p_file FSでオープンしたファイル (シーク済み) + dst 読み出し先 + len 読み出しサイズ + wram 供出するWRAM (B or C) + slot 供出する先頭スロット (だれも確保していない&ARM7/ARM9両方で確保可能であること) + size 供出するサイズ + callback Read中にWRAMにデータがある段階で随時呼び出されるコールバック + arg コールバックに渡される引数 +*/ +BOOL FS_ReadFileViaWram( FSFile *p_file, void *dst, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ); +BOOL HOTSW_ReadCardViaWram( void *src, void *dst, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ); +/* + FS_WriteFileViaWram + FS/FATFSに対して同期Writeを行う + 完了するまで返ってこない点に注意 + p_file FSでオープンしたファイル (シーク済み) + src 書き込み元 + len 書き込みサイズ + wram 供出するWRAM (B or C) + slot 供出する先頭スロット (だれも確保していない&ARM7/ARM9両方で確保可能であること) + size 供出するサイズ + callback Write中にWRAMにデータがある段階で随時呼び出されるコールバック + arg コールバックに渡される引数 +*/ +BOOL FS_WriteFileViaWram( FSFile *p_file, const void *src, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_FS_WRAM_H_ */ diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/device.c b/build/libraries_sysmenu/sysmenu/ARM9/src/device.c new file mode 100644 index 00000000..c015653a --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/device.c @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SYSM_lib.c + + Copyright 2007 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 "internal_api.h" + +// define data----------------------------------------------------------------- +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +// const data------------------------------------------------------------------ + +// ============================================================================ +// +// デバイス制御 +// +// ============================================================================ + +// RTCクロック補正値をセット +void SYSMi_WriteAdjustRTC( void ) +{ + RTCRawAdjust raw; + raw.adjust = LCFG_THW_GetRTCAdjust(); + ( void )RTCi_SetRegAdjust( &raw ); +} + + +// 起動時のRTCチェック +void SYSMi_CheckRTC( void ) +{ + RTCDate date; + RTCTime time; + + // RTCのリセット or おかしい値を検出した場合はRTCオフセット値をクリアする。 + ( void )RTC_GetDateTime( &date, &time ); + if( !UTL_CheckRTCDate( &date ) || + !UTL_CheckRTCTime( &time ) || + SYSMi_GetWork()->flags.arm7.isResetRTC + ) { + OS_TPrintf("\"RTC reset\" or \"Illegal RTC data\" detect!\n"); + LCFG_TSD_SetRTCOffset( 0 ); + LCFG_TSD_SetRTCLastSetYear( 0 ); + { + u8 *pBuffer = SYSM_Alloc( LCFG_WRITE_TEMP ); + if( pBuffer != NULL ) { + LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + SYSM_Free( pBuffer ); + } + } + } +} + diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/fs_wram.c b/build/libraries_sysmenu/sysmenu/ARM9/src/fs_wram.c new file mode 100644 index 00000000..d2934ddf --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/fs_wram.c @@ -0,0 +1,546 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - fs + File: fs_wram.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 "fs_wram.h" +#include +#include +/* + 基本概念 + + ARM9側スレッドありとなしでは構造が全く変わるが、CARDもやっているのでスレッド前提はありかと + (PXIが非同期で発生する点に注意) + + ●Read時の流れ + ARM9 (API) ARM7 (TASK) + WRAMをすべてARM7側にする + 開始要求→ (ファイルシーク) + ファイルからWRAMに1ブロックコピー + ←データ準備完了 + ファイルからWRAMに1ブロックコピー + 該当ブロックをARM9側にする ←データ準備完了 + (コールバック呼び出し) + WRAMからdstにコピー + 該当ブロックをARM7側にする + 完了をARM7に通知→ ファイルからWRAMに1ブロックコピー + ←データ準備完了 + 該当ブロックをARM9側にする WRAMが足りなくなったらストール + (コールバック呼び出し) + WRAMからdstにコピー + 該当ブロックをARM7側にする + 完了をARM7に通知→ ファイルからWRAMに1ブロックコピー + ←データ準備完了 + 該当ブロックをARM9側にする 全部コピーし終われば完了 + (コールバック呼び出し) + WRAMからdstにコピー + 該当ブロックをARM7側にする + 完了をARM7に通知→ 何もすることがないので無視 + 全部コピーし終われば完了 + + ●Write時の流れ + ARM9 (API) ARM7 (TASK) + 開始予告→ (ファイルシーク) + 該当ブロックをARM9側にする + srcからWRAMに1ブロックコピー + (コールバック呼び出し) + 該当ブロックをARM7側にする + データ準備完了→ 該当ブロックをファイルに書き込む + ←データ転送完了 + 該当ブロックをARM9側にする + srcからWRAMに1ブロックコピー + (コールバック呼び出し) + 該当ブロックをARM7側にする + データ準備完了→ + 該当ブロックをARM9側にする + srcからWRAMに1ブロックコピー + (コールバック呼び出し) + 該当ブロックをARM7側にする + データ準備完了→ + WRAMが足りなくなったらストール 該当ブロックをファイルに書き込む + ←データ転送完了 + 該当ブロックをARM9側にする + srcからWRAMに1ブロックコピー + (コールバック呼び出し) + 該当ブロックをARM7側にする + データ準備完了→ + 全部コピーし終われば完了待ち 該当ブロックをファイルに書き込む + ←データ転送完了 + 該当ブロックをファイルに書き込む + ←データ転送完了 + 全部コピーし終われば完了 + 完了 + + ●今後の方針 + CARD、メモリファイルも対応? → FSがARM7側で処理するAPIを用意するか次第 + + AESもFSi_IsValidAddressForARM7のようなものでアクセス可能にできれば、 + コールバック内で一時的にARM7に渡して暗号処理を施して返してもらうと + いうことも可能 (試してないがAESはdest==srcが可能かと) +*/ + +/* + コールバックを呼び出す単位 + READ: WRAMサイズ128KB、コールバック単位512Bで十分 (多すぎても問題ない) + WRITE: WRAMサイズ256KB、コールバック単位1KBは欲しい(多すぎても問題ない) +*/ +#define FS_WRAM_CALLBACK_UNIT 1024 + +#define FS_WRAM_THREAD_STACK_SIZE 512 + +// 以下、固定値 +#define FS_WRAM_MESSAGE_ARRAY_MAX 8 +#define FS_WRAM_SLOT_SIZE (32*1024) + +typedef enum FSWramCommand +{ + FS_WRAM_COMMAND_READ, + FS_WRAM_COMMAND_WRITE, + FS_WRAM_COMMAND_READ_CARD +} +FSWramCommand; + +typedef struct FSWramCommandParam +{ + void* addr; + int length; +} +FSWramCommandParam; + +typedef struct FSWramWork +{ + u64 stack[FS_WRAM_THREAD_STACK_SIZE/sizeof(u64)]; + OSThread thread; + + OSMessageQueue msgQ4task; + OSMessage msgArray4task[FS_WRAM_MESSAGE_ARRAY_MAX]; + OSMessageQueue msgQ4api; + OSMessage msgArray4api[FS_WRAM_MESSAGE_ARRAY_MAX]; + + FSWramCommandParam param[FS_WRAM_MESSAGE_ARRAY_MAX]; + + BOOL busy; + + FSWramCommand command; + FSFile *p_file; + void *card_src; + + int nums; // WRAMスロット数 + u32 base; // WRAMの先頭アドレス +} +FSWramWork; + +static FSWramWork FSiWramWork; + +/* +// override +BOOL FSi_IsValidAddressForARM7(const void *buffer, u32 length); +BOOL FSi_IsValidAddressForARM7(const void *buffer, u32 length) +{ + u32 addr = (u32)buffer; + u32 dtcm = OS_GetDTCMAddress(); + if ((addr + length > dtcm) && (addr < dtcm + HW_DTCM_SIZE)) + { + return FALSE; + } + if ((addr >= HW_TWL_MAIN_MEM) && (addr + length <= HW_TWL_MAIN_MEM_END)) + { + return TRUE; + } + if ((addr >= HW_EXT_WRAM_ARM7) && (addr + length <= GX_GetSizeOfARM7())) + { + return TRUE; + } + if (FSiWramWork.busy) + { + if ((addr >= FSiWramWork.base) && (addr + length <= FSiWramWork.base + FSiWramWork.nums * FS_WRAM_SLOT_SIZE)) + { + return TRUE; + } + } + return FALSE; +} +*/ + +static void FSi_WramThread(void* arg) +{ +#pragma unused(arg) + while (1) + { + CardDataReadState card_read_state; + FSWramCommandParam *cmd; + int result; + OS_ReceiveMessage(&FSiWramWork.msgQ4task, (OSMessage*)&cmd, OS_MESSAGE_BLOCK); + switch (FSiWramWork.command) + { + case FS_WRAM_COMMAND_READ: + result = FS_ReadFile( FSiWramWork.p_file, cmd->addr, cmd->length ); +//OS_TPrintf("%s: (0x%08X) %d msec\n", __func__, cmd->addr, (int)OS_TicksToMilliSeconds(OS_GetTick())); + break; + case FS_WRAM_COMMAND_READ_CARD: + // カードリード + if(!FSi_IsValidAddressForARM7(cmd->addr, (u32)cmd->length)) + { + result = 0; + break; + } + card_read_state = HOTSW_ReadCardData( FSiWramWork.card_src, cmd->addr, (u32)cmd->length); + FSiWramWork.card_src = (void *)((u32)FSiWramWork.card_src + (u32)cmd->length); + result = (card_read_state == CARD_READ_SUCCESS) ? cmd->length : 0; + if((card_read_state != CARD_READ_SUCCESS)) ERRORLOG_Printf( "FSi_WramThread: read-card error:%d\n", card_read_state ); + break; + case FS_WRAM_COMMAND_WRITE: + result = FS_WriteFile( FSiWramWork.p_file, cmd->addr, cmd->length ); +//OS_TPrintf("%s: (0x%08X) %d msec\n", __func__, cmd->addr, (int)OS_TicksToMilliSeconds(OS_GetTick())); + break; + default: + result = -1; + } + if ( cmd->length != result ) + { + OS_TWarning("%s: Failed to %s file (%d <=> %d).\n", __func__, FSiWramWork.command==FS_WRAM_COMMAND_READ?"read":"write", cmd->length, result); + } + OS_SendMessage(&FSiWramWork.msgQ4api, (OSMessage)(result==cmd->length?TRUE:FALSE), OS_MESSAGE_BLOCK); + } +} + +BOOL FS_InitWramTransfer( u32 priority ) +{ + static BOOL initialized = FALSE; + if (initialized) + { + return FALSE; + } + OS_InitMessageQueue(&FSiWramWork.msgQ4task, FSiWramWork.msgArray4task, FS_WRAM_MESSAGE_ARRAY_MAX); + OS_InitMessageQueue(&FSiWramWork.msgQ4api, FSiWramWork.msgArray4api, FS_WRAM_MESSAGE_ARRAY_MAX); + OS_CreateThread(&FSiWramWork.thread, FSi_WramThread, 0, + (void*)(FSiWramWork.stack + (FS_WRAM_THREAD_STACK_SIZE/sizeof(u64))), + FS_WRAM_THREAD_STACK_SIZE, priority); + OS_WakeupThreadDirect(&FSiWramWork.thread); + initialized = TRUE; + return TRUE; +} + +static int FSi_Increment( int p ) +{ + return (p + 1) % FSiWramWork.nums; +} + +static int FSi_GetStackCount( int call, int ret ) +{ + return (call - ret + FSiWramWork.nums) % FSiWramWork.nums; +} + +static BOOL FSi_ReadWram(u8* dest, u32 len, MIWramPos wram, s32 slot, FSWramCallback callback, void* arg) +{ + u32 size4api = len; + u32 size4task = len; + int call = 0; + int ret = 0; + + while ( size4api > 0 ) + { + const u8* src = (u8*)(FSiWramWork.base + ret * FS_WRAM_SLOT_SIZE); + u32 unit = size4api < FS_WRAM_SLOT_SIZE ? size4api : FS_WRAM_SLOT_SIZE; + BOOL result; + + // できるだけ起動する + for ( ; FSi_GetStackCount(call, ret) < FSiWramWork.nums - 1 && size4task > 0; call = FSi_Increment(call) ) + { + FSiWramWork.param[call].addr = (void*)(FSiWramWork.base + call * FS_WRAM_SLOT_SIZE); + FSiWramWork.param[call].length = (int)(size4task < FS_WRAM_SLOT_SIZE ? size4task : FS_WRAM_SLOT_SIZE); + OS_SendMessage(&FSiWramWork.msgQ4task, (OSMessage)&FSiWramWork.param[call], OS_MESSAGE_BLOCK); + size4task -= FSiWramWork.param[call].length; + } + + // task待ち + OS_ReceiveMessage(&FSiWramWork.msgQ4api, (OSMessage*)&result, OS_MESSAGE_BLOCK); + if (!result) + { + OS_TPrintf("%s: Failed to read file.\n", __func__); + return FALSE; + } + MI_SwitchWramSlot( wram, slot + ret, MI_WRAM_SIZE_32KB, MI_WRAM_ARM7, MI_WRAM_ARM9 ); +//OS_TPrintf("%s: %d,%d (0x%08X->0x%08X) %d msec\n", __func__, call, ret, src, dest, (int)OS_TicksToMilliSeconds(OS_GetTick())); + if ( callback ) + { + int done; + for ( done = 0; done < unit; done += FS_WRAM_CALLBACK_UNIT ) + { + const u8* s = src + done; + u8* d = dest + done; + u32 u = unit - done < FS_WRAM_CALLBACK_UNIT ? unit - done : FS_WRAM_CALLBACK_UNIT; + callback(s, d, u, wram, slot + ret, arg); + MI_CpuCopyFast( s, d, u ); + } + } + else + { + MI_CpuCopyFast( src, dest, unit ); + } + DC_InvalidateRange( (void*)src, unit ); + //MI_SwitchWramSlot( wram, slot + ret, MI_WRAM_SIZE_32KB, MI_WRAM_ARM9, MI_WRAM_ARM7 ); + size4api -= unit; + dest += unit; + ret = FSi_Increment(ret); + } + return TRUE; +} + +static BOOL FSi_WriteWram(const u8* src, u32 len, MIWramPos wram, s32 slot, FSWramCallback callback, void* arg) +{ + u32 size = len; + int call = 0; + int ret = 0; + + while ( size > 0 ) + { + u8* dest = (u8*)(FSiWramWork.base + call * FS_WRAM_SLOT_SIZE); + u32 unit = size < FS_WRAM_SLOT_SIZE ? size : FS_WRAM_SLOT_SIZE; + BOOL result; + + // task済み回収 + while ( OS_ReceiveMessage(&FSiWramWork.msgQ4api, (OSMessage*)&result, OS_MESSAGE_NOBLOCK) ) + { + if (!result) + { + OS_TPrintf("%s: Failed to read file.\n", __func__); + return FALSE; + } + ret = FSi_Increment(ret); + } + // task回収ゼロだったら待つ + if ( FSi_GetStackCount( call, ret ) == FSiWramWork.nums - 1 ) + { + OS_ReceiveMessage(&FSiWramWork.msgQ4api, (OSMessage*)&result, OS_MESSAGE_BLOCK); + if (!result) + { + OS_TPrintf("%s: Failed to read file.\n", __func__); + return FALSE; + } + ret = FSi_Increment(ret); + } + MI_SwitchWramSlot( wram, slot + call, MI_WRAM_SIZE_32KB, MI_WRAM_ARM7, MI_WRAM_ARM9 ); +//OS_TPrintf("%s: %d,%d (0x%08X->0x%08X) %d msec\n", __func__, call, ret, src, dest, (int)OS_TicksToMilliSeconds(OS_GetTick())); + if ( callback ) + { + int done; + for ( done = 0; done < unit; done += FS_WRAM_CALLBACK_UNIT ) + { + const u8* s = src + done; + u8* d = dest + done; + u32 u = unit - done < FS_WRAM_CALLBACK_UNIT ? unit - done : FS_WRAM_CALLBACK_UNIT; + MI_CpuCopyFast( s, d, u ); + callback(d, s, u, wram, slot + ret, arg); + } + } + else + { + MI_CpuCopyFast( src, dest, unit ); + } + DC_FlushRange( dest, unit ); + //MI_SwitchWramSlot( wram, slot + call, MI_WRAM_SIZE_32KB, MI_WRAM_ARM9, MI_WRAM_ARM7 ); + // 1つ用意できたので起動する + FSiWramWork.param[call].addr = (void*)(FSiWramWork.base + call * FS_WRAM_SLOT_SIZE); + FSiWramWork.param[call].length = (int)unit; + OS_SendMessage(&FSiWramWork.msgQ4task, (OSMessage)&FSiWramWork.param[call], OS_MESSAGE_BLOCK); + size -= unit; + src += unit; + dest += unit; + call = FSi_Increment(call); + } + // 残りtask回収 + while ( FSi_GetStackCount(call, ret) ) + { + BOOL result; + OS_ReceiveMessage(&FSiWramWork.msgQ4api, (OSMessage*)&result, OS_MESSAGE_BLOCK); + if (!result) + { + OS_TPrintf("%s: Failed to read file.\n", __func__); + return FALSE; + } + ret = FSi_Increment(ret); + } + return TRUE; +} + +BOOL HOTSW_ReadCardViaWram( void *src, void *dst, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ) +{ + OSIntrMode enabled = OS_DisableInterrupts(); + BOOL result; + int l,n; + SDK_ASSERT( wram != MI_WRAM_A ); + + if ( FSiWramWork.busy ) // 転送中 + { + OS_RestoreInterrupts(enabled); + return FALSE; + } + FSiWramWork.busy = TRUE; + OS_RestoreInterrupts(enabled); + + + // WRAMの確保 + FSiWramWork.base = MI_AllocWramSlot( wram, slot, size, MI_WRAM_ARM9 ); + if ( FSiWramWork.base == 0 ) + { + FSiWramWork.busy = FALSE; + OS_TPrintf("Cannot allocate WRAM %d, %d, %d\n", wram, slot, size); + return FALSE; + } + // cash care + DC_InvalidateRange((void *)FSiWramWork.base, (u32)(size << 15)); + + + // パラメータ設定 + FSiWramWork.command = FS_WRAM_COMMAND_READ_CARD; + FSiWramWork.card_src = src; + FSiWramWork.nums = MI_WRAM_ENUM_TO_SIZE( size ) * 1024 / FS_WRAM_SLOT_SIZE; + + // 必要に応じて7側にスイッチ可能なWRAMとして指定 + n = 0; + for(l=0;lARM9起動 + result = FSi_ReadWram(dst, (u32)len, wram, slot, callback, arg); + + MI_FreeWramSlot( wram, slot, size, MI_WRAM_ARM9 ); + FSi_SetSwitchableWramSlots(0,0); // スイッチ可能WRAMの指定を元に戻す + FSiWramWork.busy = FALSE; + return result; +} + +BOOL FS_ReadFileViaWram( FSFile *p_file, void *dst, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ) +{ + OSIntrMode enabled = OS_DisableInterrupts(); + BOOL result; + int l,n; + SDK_ASSERT( wram != MI_WRAM_A ); + + if ( FSiWramWork.busy ) // 転送中 + { + OS_RestoreInterrupts(enabled); + return FALSE; + } + FSiWramWork.busy = TRUE; + OS_RestoreInterrupts(enabled); + + + // WRAMの確保 + FSiWramWork.base = MI_AllocWramSlot( wram, slot, size, MI_WRAM_ARM9 ); + if ( FSiWramWork.base == 0 ) + { + FSiWramWork.busy = FALSE; + OS_TPrintf("Cannot allocate WRAM %d, %d, %d\n", wram, slot, size); + return FALSE; + } + // cash care + DC_InvalidateRange((void *)FSiWramWork.base, (u32)(size << 15)); + + + // パラメータ設定 + FSiWramWork.command = FS_WRAM_COMMAND_READ; + FSiWramWork.p_file = p_file; + FSiWramWork.nums = MI_WRAM_ENUM_TO_SIZE( size ) * 1024 / FS_WRAM_SLOT_SIZE; + + // 必要に応じて7側にスイッチ可能なWRAMとして指定 + n = 0; + for(l=0;lARM9起動 + result = FSi_ReadWram(dst, (u32)len, wram, slot, callback, arg); + + MI_FreeWramSlot( wram, slot, size, MI_WRAM_ARM9 ); + FSi_SetSwitchableWramSlots(0,0); // スイッチ可能WRAMの指定を元に戻す + FSiWramWork.busy = FALSE; + return result; +} + +BOOL FS_WriteFileViaWram( FSFile *p_file, const void *src, s32 len, MIWramPos wram, s32 slot, MIWramSize size, FSWramCallback callback, void* arg ) +{ + OSIntrMode enabled = OS_DisableInterrupts(); + BOOL result; + int l,n; + SDK_ASSERT( wram != MI_WRAM_A ); + + if ( FSiWramWork.busy ) // 転送中 + { + OS_RestoreInterrupts(enabled); + return FALSE; + } + FSiWramWork.busy = TRUE; + OS_RestoreInterrupts(enabled); + + + // WRAMの確保 + FSiWramWork.base = MI_AllocWramSlot( wram, slot, size, MI_WRAM_ARM7 ); + if ( FSiWramWork.base == 0 ) + { + FSiWramWork.busy = FALSE; + OS_TPrintf("Cannot allocate WRAM %d, %d, %d\n", wram, slot, size); + return FALSE; + } + + // パラメータ設定 + FSiWramWork.command = FS_WRAM_COMMAND_WRITE; + FSiWramWork.p_file = p_file; + FSiWramWork.nums = MI_WRAM_ENUM_TO_SIZE( size ) * 1024 / FS_WRAM_SLOT_SIZE; + + // 必要に応じて7側にスイッチ可能なWRAMとして指定 + n = 0; + for(l=0;lWRAM起動 + result = FSi_WriteWram(src, (u32)len, wram, slot, callback, arg); + + MI_FreeWramSlot( wram, slot, size, MI_WRAM_ARM7 ); + FSi_SetSwitchableWramSlots(0,0); // スイッチ可能WRAMの指定を元に戻す + FSiWramWork.busy = FALSE; + return result; +} diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/keys.c b/build/libraries_sysmenu/sysmenu/ARM9/src/keys.c new file mode 100644 index 00000000..bc9bd7fe --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/keys.c @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: keys.c + + Copyright 2007 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 + +// define data----------------------------------------------------------------- + +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +// const data------------------------------------------------------------------ + +// 開発用アプリROMヘッダ署名公開鍵リスト +const u8 g_devPubKey[ 4 ][ 0x80 ] = { + // ランチャー + { + 0xbc, 0xfd, 0xa1, 0xff, 0x1f, 0x66, 0xdf, 0xec, 0xb4, 0x69, 0xf8, 0xf7, 0x43, 0x0c, 0x5d, 0x0f, + 0x00, 0xd7, 0x20, 0x49, 0x42, 0x06, 0x03, 0x29, 0x85, 0x0b, 0x99, 0x59, 0x61, 0x98, 0x70, 0x6e, + 0xff, 0xf6, 0xb4, 0x70, 0x66, 0xf0, 0xdd, 0x8f, 0xdc, 0xe9, 0xf2, 0x0d, 0xd0, 0x21, 0x1d, 0x77, + 0xb8, 0x9c, 0x51, 0x87, 0xc0, 0xb1, 0x33, 0xab, 0x13, 0x96, 0x0b, 0x47, 0xb8, 0x42, 0x4a, 0x0d, + 0xc3, 0x77, 0xe1, 0x87, 0xb1, 0x6b, 0x24, 0x31, 0x10, 0x8a, 0x47, 0xf2, 0x32, 0xf4, 0xc9, 0x78, + 0x25, 0x13, 0xd4, 0x80, 0x10, 0x05, 0x52, 0xc3, 0xe7, 0x50, 0x7b, 0x29, 0x49, 0xce, 0x93, 0xd9, + 0x8f, 0x2a, 0xb5, 0x4d, 0xd1, 0xc1, 0x91, 0xd8, 0x07, 0x16, 0x10, 0x15, 0xff, 0xd6, 0x84, 0x8f, + 0x54, 0x3d, 0x91, 0x5b, 0x37, 0x45, 0x48, 0xe4, 0x6b, 0x62, 0xd2, 0x11, 0x9b, 0x0d, 0x71, 0x69, + }, + // システムアプリ + { + 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, + 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, + 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, + 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, + 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, + 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, + 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, + 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, + }, + // ショップアプリ + { + 0xa7, 0x9f, 0x54, 0xa0, 0xc7, 0x45, 0xae, 0xf6, 0x63, 0xa7, 0x53, 0xb7, 0x0a, 0xcc, 0x0b, 0xcb, + 0x65, 0xe1, 0x11, 0xc6, 0x05, 0x15, 0xb5, 0x6e, 0xbd, 0xac, 0x0c, 0xca, 0xf4, 0x7c, 0x68, 0x7a, + 0xf9, 0x0e, 0x5d, 0x98, 0x5b, 0xc8, 0x4d, 0x22, 0x3b, 0xa3, 0xbe, 0x8b, 0x5b, 0x7f, 0x26, 0x44, + 0x9f, 0xc4, 0x48, 0x44, 0xb1, 0x32, 0xb7, 0xbe, 0x63, 0xba, 0xd6, 0xc1, 0x10, 0xce, 0xf6, 0xed, + 0x47, 0x8f, 0xe1, 0xff, 0x7f, 0x5a, 0xd5, 0x5d, 0x94, 0x38, 0x2f, 0xa1, 0xd4, 0xef, 0x82, 0xb1, + 0x0d, 0xc4, 0x43, 0xec, 0xbe, 0x77, 0xb6, 0x82, 0x9c, 0xfa, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, + 0xfb, 0xd6, 0x05, 0xc8, 0x9a, 0x7e, 0xad, 0x44, 0x40, 0x0d, 0x35, 0x9c, 0x45, 0x44, 0x64, 0x36, + 0x61, 0x4b, 0xf7, 0xe6, 0x31, 0x5c, 0x7d, 0x96, 0x73, 0xe8, 0xac, 0xb4, 0xe3, 0x5e, 0xd1, 0x9d, + }, + // ユーザーアプリ + { + 0xac, 0x93, 0xbb, 0x3c, 0x15, 0x5c, 0x5f, 0x25, 0xb0, 0x4c, 0x37, 0xa4, 0x2d, 0x85, 0x29, 0x1d, + 0x7a, 0x9d, 0x2d, 0xd5, 0x79, 0xb5, 0x5d, 0xb1, 0x08, 0x20, 0x9c, 0xf0, 0x4c, 0x56, 0x27, 0x97, + 0xf8, 0x7e, 0x3e, 0xcb, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9b, 0xb0, 0x5b, 0x06, 0xf6, 0xaf, + 0xaa, 0x9c, 0xa5, 0xf0, 0x11, 0xa7, 0x8a, 0xcb, 0x0c, 0x11, 0xd6, 0x0c, 0x3d, 0x30, 0xac, 0x51, + 0x79, 0x5a, 0xb5, 0x7f, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xbf, 0x3b, 0xfa, 0x93, 0xbf, 0x6b, + 0x5b, 0x3f, 0x86, 0x96, 0x4f, 0xcc, 0x90, 0x12, 0xb2, 0x39, 0x8d, 0x68, 0x16, 0x7b, 0xc6, 0x87, + 0xf1, 0xf5, 0x60, 0x62, 0x39, 0xfb, 0x10, 0x7e, 0x48, 0x7f, 0xdd, 0x82, 0x38, 0x38, 0x76, 0xb5, + 0xce, 0x21, 0x4b, 0xc9, 0x6f, 0x31, 0x8d, 0x23, 0x57, 0x3d, 0xb6, 0x6c, 0xee, 0xc2, 0x0d, 0x11, + }, +}; + + diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/ninLogoFunc.c b/build/libraries_sysmenu/sysmenu/ARM9/src/ninLogoFunc.c new file mode 100644 index 00000000..135feaf7 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/ninLogoFunc.c @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: ninLogoFunc.c + + Copyright 2007 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 + +// define data----------------------------------------------------------- + +// extern data----------------------------------------------------------- + +// function's prototype-------------------------------------------------- +static void UnCompNintendoLogo2(u16 *pLogoData, u16 *pDst, u32 *pTemp ); +static void SVC_DiffUnFilter16_16_2( u16 *pSrc, u16 *pDst ); +static s32 MEMBm_InitFunc( const u8 *pDevice, void *pRAM, const void *pParam ); +static s32 MEMBm_TerminateFunc( const u8 *pDevice ); +static u8 MEMBm_ByteStreamFunc( const u8 *pDevice ); +static u32 MEMBm_WordStreamFunc( const u8 *pDevice ); + + +// global variable------------------------------------------------------- + +// static variable------------------------------------------------------- +static MIUnpackBitsParam Nin_UnPackBitsParam2 = { (8 * 8 / 2) * ( 7 * 2 ), + 1, + 4, // カラーbit数(4=4bit=16色, 8=8bit=256色) + 0, + 0 }; + +// const data------------------------------------------------------------ +static const u8 Nin_Char_Diff_Huff_Table2[]={ + 0x24,0xd4,0x00,0x00, + 0x0f,0x40,0x00,0x00,0x00,0x01,0x81,0x82,0x82,0x83,0x0f,0x83,0x0c,0xc3,0x03,0x83, + 0x01,0x83,0x04,0xc3,0x08,0x0e,0x02,0xc2,0x0d,0xc2,0x07,0x0b,0x06,0x0a,0x05,0x09, +}; + + +const MIReadStreamCallbacks memb_ifp2={ + MEMBm_InitFunc, + MEMBm_TerminateFunc, + MEMBm_ByteStreamFunc, + NULL, + MEMBm_WordStreamFunc, +}; + + +// function's description-------------------------------------------- + +// Nintendoロゴチェック 「リターン 1:Nintendoロゴ認識成功 0:失敗」 +BOOL SYSM_CheckNintendoLogo( u16 *pLogoData ) +{ + u16 *pLogoOrg = (u16 *)SYSROM9_NINLOGO_ADR; // ARM9のシステムROMのロゴデータとカートリッジ内のものを比較 + u16 length = NINTENDO_LOGO_DATA_LENGTH >> 1; + + while( length-- ) { + if( *pLogoOrg++ != *pLogoData++ ) { + return FALSE; + } + } + return TRUE; +} + + +// Nintendoロゴデータの展開ルーチン(OBJ2Dマップモードで展開) +// ※tempBuffpには、0x700byte必要です。 +void SYSM_LoadNintendoLogo2D( u16 *pLogoData, u16 *pDst, int paletteColorIndex ) +{ + u32 work[ 0x100 / sizeof(u32) ]; + u16 *pBuffer = SYSM_Alloc( 0x700 ); + if( pBuffer == NULL ) { + OS_Panic( "memory allocation failed.\n" ); + } + Nin_UnPackBitsParam2.destOffset = paletteColorIndex - 1; + UnCompNintendoLogo2( pLogoData, (u16 *)pBuffer, work ); + MI_CpuCopy16( (u16 *)( (u32)pBuffer + 0 ), pDst + 0x0000 / sizeof(u16), 0x1a0 ); + MI_CpuCopy16( (u16 *)( (u32)pBuffer + 0x1a0), pDst + 0x0400 / sizeof(u16), 0x1a0 ); + SYSM_Free( pBuffer ); +} + + +void SYSM_LoadNintendoLogo1D( u16 *pLogoData, u16 *pDst, int paletteColorIndex ) +{ + u32 work[ 0x100 / sizeof(u32) ]; + u16 *pBuffer = SYSM_Alloc( 0x700 ); + if( pBuffer == NULL ) { + OS_Panic( "memory allocation failed.\n" ); + } + Nin_UnPackBitsParam2.destOffset = paletteColorIndex - 1; + UnCompNintendoLogo2( pLogoData, (u16 *)pBuffer, work ); + MI_CpuCopy16( (u16 *)pBuffer, pDst, 0x340 ); + SYSM_Free( pBuffer ); +} + +/* UnCompNintendoLogo2ワーク内訳 + + <配置先> dstp(0x700) temp(0x100) + + Nintendoロゴ+ヘッダ 0x0c0 + ハフマン展開バッファ 0x200 + ハフマン展開後のバッファ 0x0d0 + diff後のデータ 0x0d0 + UnpackBits後のデータ 0x700 + +*/ + +// Nintendoロゴ展開ルーチン (r0=ロゴ圧縮データ r1=展開先アドレス) +#include +static asm void UnCompNintendoLogo2( u16 *pLogoData, u16 *pDst, u32 *pTemp ) +{ + push {r0-r2,r4, lr} + + ldr r0, =Nin_Char_Diff_Huff_Table2 + mov r1, r2 // r1 <- temp + mov r4, r1 // r4 <- temp + mov r2, #36 + bl MIi_CpuCopy16 // Nintendoロゴの圧縮テーブル部分のみをコピーしてくる + + ldr r0, [sp, #0] // r0 <- NintendoLogoDatap + mov r2, #36 + add r1, r4, r2 // r1 <- temp + 36 + mov r2, #NINTENDO_LOGO_DATA_LENGTH + bl MIi_CpuCopy16 // NintendoLogoDatapからNintendoロゴデータ本体をコピーしてくる + + mov r0, r4 // r0 <- temp + ldr r1, [sp, #4] // r1 <- dstp + mov r2, #1 + lsl r2, r2, #8 + add r2, r2, r1 // r2 <- dstp + 0x100 + ldr r3, =memb_ifp2 // r3 <- memb_ifp2 + bl SVC_UncompressHuffmanFromDevice // ハフマン展開 + + ldr r0, [sp, #4] + ldr r2, =0x0000d082 + str r2, [r0,#0] + + mov r1, r4 // temp + bl SVC_DiffUnFilter16_16_2 // Diff展開 + + mov r0, r4 // temp + ldr r1, [sp, #4] // dstp + ldr r2, =Nin_UnPackBitsParam2 + bl SVC_UnpackBits // ビット展開 + + pop {r0-r2,r4, pc} +} + + +// 差分フィルタ展開システムコール(16Bit→16Bit) (r0=Srcp, r1=Destp) +static asm void SVC_DiffUnFilter16_16_2( u16 *pSrc, u16 *pDst ) +{ + swi 24 + bx lr +} +#include + + +// ============================================================================ +// バイトアクセス可能メモリ用アクセスルーチン群 +// ============================================================================ +static s32 MEMBm_InitFunc( const u8 *pDevice, void *pRAM, const void *pParam ) +{ + #pragma unused(pRAM) + if(pParam) return (s32)MEMBm_WordStreamFunc(pDevice); + else return 0; +} + +static s32 MEMBm_TerminateFunc( const u8 *pDevice ) +{ + #pragma unused(pDevice) + return 0; +} + +static u8 MEMBm_ByteStreamFunc( const u8 *pDevice ) +{ + return *pDevice; +} + +static u32 MEMBm_WordStreamFunc( const u8 *pDevice ) +{ + return *(u32 *)pDevice; +} diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c new file mode 100644 index 00000000..30b04658 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/sysmenu_lib.c @@ -0,0 +1,604 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SYSM_lib.c + + Copyright 2007 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 "internal_api.h" + +// define data----------------------------------------------------------------- +#define SYSM_PM_RETRY_NUM 5 // PMリトライ回数 + +// extern data----------------------------------------------------------------- +extern void LCFG_VerifyAndRecoveryNTRSettings( void ); + +// function's prototype------------------------------------------------------- +static void SYSMi_CopyLCFGDataHWInfo( u32 dst_addr ); +static void SYSMi_CopyLCFGDataSettings( void ); +static TitleProperty *SYSMi_CheckShortcutBoot1( void ); +static TitleProperty *SYSMi_CheckShortcutBoot2( void ); +void SYSMi_SendKeysToARM7( void ); +static OSTitleId SYSMi_getTitleIdOfMachineSettings( void ); + +// global variable------------------------------------------------------------- +void *(*SYSMi_Alloc)( u32 size ); +void (*SYSMi_Free )( void *ptr ); + +#define SYSM_DEBUG_ +#ifdef SYSM_DEBUG_ +SYSM_work *pSysm; // デバッガでのSYSMワークのウォッチ用 +ROM_Header_Short *pRomHeader; +#endif +// static variable------------------------------------------------------------- +static u8 s_lcfgBuffer[ HW_PARAM_TWL_SETTINGS_DATA_SIZE // 0x01fc + + HW_PARAM_WIRELESS_FIRMWARE_DATA_SIZE // 0x0004 + + HW_PARAM_TWL_HW_NORMAL_INFO_SIZE ] ATTRIBUTE_ALIGN(32); // 0x1000 + +static TitleProperty s_bootTitleBuf; + +// const data------------------------------------------------------------------ + +// ============================================================================ +// +// 初期化 +// +// ============================================================================ + +#if 1 +#include +void _start_AutoloadDoneCallback(void* argv[]); +// AutoloadDoneCallbackは、ARMでないと動作しない。ISデバッガがブレークポイント処理のために上乗りしているが、そこからのリターンが怪しい。 +// AutoloadDoneCallbackを利用して鍵を引き渡す +// AutoloadDoneCallbackはSTATICセクションの.bssクリア前なのでSDK関数も含めて未初期化変数は使用不可。 +void _start_AutoloadDoneCallback(void* argv[]) +{ +#pragma unused(argv) + // ARM7で使用する分の鍵を渡す + SYSMi_SendKeysToARM7(); +} +#include +#endif + + +// SystemMenuの初期化 +void SYSM_Init( void *(*pAlloc)(u32), void (*pFree)(void*) ) +{ +#ifdef SYSM_DEBUG_ + pSysm = SYSMi_GetWork(); + pRomHeader = (ROM_Header_Short *)0x027fc000; +#endif /* SYSM_DEBUG_ */ + + // ARM7で使用する分の鍵を渡す + //SYSMi_SendKeysToARM7(); + + // ランチャーのマウント情報セット + //SYSMi_SetLauncherMountInfo(); + + // ARM7コンポーネント用プロテクションユニット領域変更 + OS_SetProtectionRegion( 2, SYSM_OWN_ARM7_MMEM_ADDR, 512KB ); + + SYSM_SetAllocFunc( pAlloc, pFree ); + + // PXI_SetFifoRecvCallback( SYSMENU_PXI_FIFO_TAG, SYSMi_PXIFifoRecvCallback ); + + reg_OS_PAUSE |= REG_OS_PAUSE_CHK_MASK; // PAUSEレジスタのチェックフラグのセット +} + + +// アリーナ再設定 +void SYSM_SetArena( void ) +{ + // ARM9用ブートコード配置のため、アリーナHi位置を下げる + OS_SetMainArenaHi( (void *)SYSM_OWN_ARM9_MMEM_ADDR_END ); +} + + +// システムメニューライブラリ用メモリアロケータの設定 +void SYSM_SetAllocFunc( void *(*pAlloc)(u32), void (*pFree)(void*) ) +{ + SYSMi_Alloc = pAlloc; + SYSMi_Free = pFree; +} + + +// メモリAlloc +void *SYSM_Alloc( u32 size ) +{ + void *p = SYSMi_Alloc( size ); + OS_TPrintf( "SYSM_Alloc : 0x%08x 0x%xbytes\n", p, size ); + return p; +} + + +// メモリFree +void SYSM_Free( void *ptr ) +{ + OS_TPrintf( "SYSM_Free : 0x%08x\n", ptr ); + SYSMi_Free( ptr ); +} + + +// ARM7で使用する分の鍵を渡す +void SYSMi_SendKeysToARM7( void ) +{ + MI_SetWramBank(MI_WRAM_ARM9_ALL); + // DS互換BlowfishテーブルをARM7へ渡す + MI_CpuCopyFast( &((OSFromFirm9Buf *)HW_FIRM_FROM_FIRM_BUF)->ds_blowfish, (void *)&GetDeliverBROM9KeyAddr()->ds_blowfish, sizeof(BLOWFISH_CTX) ); + // AES鍵0をARM7へ渡す +// MI_CpuCopyFast( &((OSFromFirm9Buf *)HW_FIRM_FROM_FIRM_BUF)->aes_key[ 0 ], (void *)&GetDeliverBROM9KeyAddr()->aes_key[ 0 ], AES_KEY_SIZE ); + DC_FlushRange( (void *)HW_WRAM_0, sizeof(DeliverBROM9Key) ); + MI_SetWramBank(MI_WRAM_ARM7_ALL); + +#ifdef INITIAL_KEYTABLE_PRELOAD + SYSMi_GetWork()->flags.hotsw.isKeyTableLoadReady = TRUE; +#endif +} + + +// nandのtmpディレクトリの中身を消す +void SYSM_DeleteTmpDirectory( TitleProperty *pBootTitle ) +{ + // bootTypeがLAUNCHER_BOOTTYPE_TEMPでない場合、tmpフォルダ内のデータを消す + if( !pBootTitle || pBootTitle->flags.bootType != LAUNCHER_BOOTTYPE_TEMP ) { + if( NAMUT_DeleteNandTmpDirectory() ) { + OS_TPrintf( "\"nand:/tmp\" delete succeeded.\n" ); + }else { + OS_TPrintf( "\"nand:/tmp\" delete failed.\n" ); + } + } +} + +// ============================================================================ +// +// 情報取得 +// +// ============================================================================ + +// パラメータリード +TitleProperty *SYSM_ReadParameters( void ) +{ + TitleProperty *pBootTitle = NULL; + + //----------------------------------------------------- + // FATALエラーチェック + //----------------------------------------------------- + if( SYSMi_GetWork()->flags.arm7.isNANDFatalError ) { + UTL_SetFatalError( FATAL_ERROR_NAND ); + } + + //----------------------------------------------------- + // HW情報のリード + //----------------------------------------------------- + // ノーマル情報リード + if( !LCFG_ReadHWNormalInfo() ) { +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + OS_TPrintf( "HW Normal Info Broken!\n" ); + UTL_SetFatalError( FATAL_ERROR_HWINFO_NORMAL ); +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + } + // セキュア情報リード + if( !LCFG_ReadHWSecureInfo() ) { +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + OS_TPrintf( "HW Secure Info Broken!\n" ); + UTL_SetFatalError( FATAL_ERROR_HWINFO_SECURE ); +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + } + + //----------------------------------------------------- + // システム領域にHWInfoをコピー + //----------------------------------------------------- + // NTRカードアプリARM9コードのロード領域とメモリがかち合うが、先頭0x4000はセキュア領域で別バッファに格納されるので、 + // ここでこれらのパラメータをロードしても大丈夫。 + SYSMi_CopyLCFGDataHWInfo( (u32)s_lcfgBuffer ); + + //----------------------------------------------------- + // 本体設定データのリード(※必ずHWSecureInforリード後に実行すること。LanguageBitmapを判定に使うため) + //----------------------------------------------------- + { + u8 *pBuffer = SYSM_Alloc( LCFG_READ_TEMP ); + if( pBuffer ) { + // NANDからTWL本体設定データをリード + BOOL isRead = LCFG_ReadTWLSettings( (u8 (*)[LCFG_READ_TEMP])pBuffer ); + + // リード失敗ファイルが存在する場合は、ファイルをリカバリ + if( LCFG_RecoveryTWLSettings() ) { + if( !isRead ) { + // リードに完全に失敗していた場合は、フラッシュ壊れシーケンスへ。 + LCFG_TSD_SetFlagFinishedBrokenTWLSettings( FALSE ); + (void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); // LCFG_READ_TEMP > LCFG_WRITE_TEMP なので、pBufferをそのまま流用 + } + }else { + // リカバリ失敗時は、FALTALエラー + UTL_SetFatalError( FATAL_ERROR_TWLSETTINGS ); + } + SYSM_Free( pBuffer ); + }else { + // メモリ確保ができなかった時は、FATALエラー + UTL_SetFatalError( FATAL_ERROR_TWLSETTINGS ); + } + LCFG_VerifyAndRecoveryNTRSettings(); // NTR設定データを読み出して、TWL設定データとベリファイし、必要ならリカバリ + } + + //----------------------------------------------------- + // システム領域に本体設定をコピー + //----------------------------------------------------- + // NTRカードアプリARM9コードのロード領域とメモリがかち合うが、先頭0x4000はセキュア領域で別バッファに格納されるので、 + // ここでこれらのパラメータをロードしても大丈夫。 + SYSMi_CopyLCFGDataSettings(); + + //----------------------------------------------------- + // 無線ON/OFFフラグをもとに、LEDを設定する。 + //----------------------------------------------------- + { + PMWirelessLEDStatus enable; + int retry = SYSM_PM_RETRY_NUM; + if( LCFG_THW_IsForceDisableWireless() ) { + enable = PM_WIRELESS_LED_OFF; + }else { + enable = LCFG_TSD_IsAvailableWireless() ? PM_WIRELESS_LED_ON : PM_WIRELESS_LED_OFF; + } + while( retry-- > 0 ) { + if ( PMi_SetWirelessLED( enable ) == PM_RESULT_SUCCESS ) { + break; + } + OS_Sleep(1); + } + } + + //----------------------------------------------------- + // 各種デバイス設定 + //----------------------------------------------------- + // バックライト輝度設定 +#ifdef SDK_SUPPORT_PMIC_2 + if ( SYSMi_GetMcuVersion() <= 1 ) + { + // X2ボード以前だけ輝度設定する + SYSM_SetBackLightBrightness( LCFG_TWL_BACKLIGHT_LEVEL_MAX ); + } +#endif // SDK_SUPPORT_PMIC_2 + + // RTC補正 + SYSMi_WriteAdjustRTC(); + // RTC値のチェック + SYSMi_CheckRTC(); + + //----------------------------------------------------- + // ARM7の処理待ち + //----------------------------------------------------- + + // ARM7のランチャーパラメータ取得が完了するのを待つ + while( !SYSMi_GetWork()->flags.arm7.isARM9Start ) { + SVC_WaitByLoop( 0x1000 ); + } +//#ifdef DEBUG_USED_CARD_SLOT_B_ + // ARM7のカードチェック完了を待つ + while( !SYSMi_GetWork()->flags.hotsw.is1stCardChecked ) { + SVC_WaitByLoop( 0x1000 ); + } +//#endif + + + //----------------------------------------------------- + // ランチャーパラメータの判定 + //----------------------------------------------------- + if( SYSM_IsHotStart() ) { + // ホットスタート時は、基本ロゴデモスキップ + SYSM_SetLogoDemoSkip( TRUE ); + + if( !SYSM_IsRunOnDebugger() && LCFG_TSD_GetLastTimeBootSoftPlatform() == PLATFORM_CODE_NTR ) { + // 前回ブートがNTRなら、ランチャーパラメータ無効 + SYSM_SetValidLauncherParam(FALSE); + MI_CpuClear32( &SYSMi_GetWork()->launcherParam, sizeof(LauncherParam) ); + } + + if( SYSMi_GetWork()->flags.arm7.isValidLauncherParam ) { + // ロゴデモスキップ無効? + if( !SYSM_GetLauncherParamBody()->v1.flags.isLogoSkip ) { + SYSM_SetLogoDemoSkip( FALSE ); + } + + // アプリ直接起動の指定があったらロゴデモを飛ばして指定アプリ起動 + if( SYSM_GetLauncherParamBody()->v1.bootTitleID ) { + s_bootTitleBuf.titleID = SYSM_GetLauncherParamBody()->v1.bootTitleID; + s_bootTitleBuf.flags = SYSM_GetLauncherParamBody()->v1.flags; + s_bootTitleBuf.pBanner = (TWLBannerFile *)(*(TWLBannerFile **)(SYSM_GetLauncherParamBody()->v1.rsv)); + pBootTitle = &s_bootTitleBuf; + } + } + } + + // アプリジャンプでないときには、アプリ間パラメタをクリア + // ※あらかじめNTRカードのセキュア領域を退避せずに直接0x2000000からロードしている場合も容赦なく消すので注意 + if( !pBootTitle ) + { + MI_CpuClearFast((void *)HW_PARAM_DELIVER_ARG, HW_PARAM_DELIVER_ARG_SIZE); + } + + //----------------------------------------------------- + // 量産工程用ショートカットキー or + // 検査カード起動 + //----------------------------------------------------- + if( pBootTitle == NULL ) { + // ココまでダイレクトブートが設定されていない場合のみ判定 + pBootTitle = SYSMi_CheckShortcutBoot1(); + } + + //----------------------------------------------------- + // その他のショートカット起動 + //----------------------------------------------------- + if( pBootTitle == NULL ) { + // ココまでダイレクトブートが設定されていない場合のみ判定 + pBootTitle = SYSMi_CheckShortcutBoot2(); + } + + return pBootTitle; +} + + +// HWInfoのメモリ展開。 +static void SYSMi_CopyLCFGDataHWInfo( u32 dst_addr ) +{ + // HotStart時にも保持する必要のあるデータをランチャー用に移動するプリロードパラメータバッファにコピー。 + MI_CpuCopy8( (void *)HW_PARAM_WIRELESS_FIRMWARE_DATA, (void *)(dst_addr + HW_PARAM_TWL_SETTINGS_DATA_SIZE), + HW_PARAM_WIRELESS_FIRMWARE_DATA_SIZE ); // 無線ファーム用 + + // プリロードパラメータアドレスをランチャー向けに変更。 + *(u32 *)HW_PRELOAD_PARAMETER_ADDR = dst_addr; + + // HWノーマル情報、HWセキュア情報をメモリに展開しておく + MI_CpuCopyFast( LCFGi_GetHWN(), (void *)HW_PARAM_TWL_HW_NORMAL_INFO, sizeof(LCFGTWLHWNormalInfo) ); + MI_CpuCopyFast( LCFGi_GetHWS(), (void *)HW_HW_SECURE_INFO, HW_HW_SECURE_INFO_END - HW_HW_SECURE_INFO ); +} + + +// 本体設定データのメモリ展開。 +static void SYSMi_CopyLCFGDataSettings( void ) +{ + // 本体設定データ + MI_CpuCopyFast( LCFGi_GetTSD(), (void *)HW_PARAM_TWL_SETTINGS_DATA, sizeof(LCFGTWLSettingsData) ); + + // 本体設定データのLauncherStatus部分をクリアしておく + { + LCFGTWLSettingsData *pSettings = (LCFGTWLSettingsData *)HW_PARAM_TWL_SETTINGS_DATA; + MI_CpuClear32( &pSettings->launcherStatus, sizeof(LCFGTWLLauncherStatus) ); + } + + // NTR本体設定データをメモリに展開しておく + { + LCFG_NSD_SetLanguage( LCFG_NSD_GetLanguageEx() ); + MI_CpuCopy8( LCFGi_GetNSD(), OS_GetSystemWork()->nvramUserInfo, sizeof(LCFGNTRSettingsData) ); + } +} + + + +BOOL SYSM_IsLauncherHidden( void ) +{ +#ifdef SYSM_DO_NOT_SHOW_LAUNCHER + return TRUE; +#else + return FALSE; +#endif +} + + +static TitleProperty * SYSMi_ShortcutCardBootSub( void ) +{ + s_bootTitleBuf.flags.isAppRelocate = TRUE; + s_bootTitleBuf.flags.isAppLoadCompleted = FALSE; + s_bootTitleBuf.flags.isInitialShortcutSkip = TRUE; // 初回起動シーケンスを飛ばす + s_bootTitleBuf.flags.isLogoSkip = TRUE; // ロゴデモを飛ばす + s_bootTitleBuf.flags.bootType = LAUNCHER_BOOTTYPE_ROM; + s_bootTitleBuf.flags.isValid = TRUE; + // ROMヘッダバッファのコピー + { + u16 id = (u16)OS_GetLockID(); + (void)OS_LockByWord( id, &SYSMi_GetWork()->lockCardRsc, NULL ); // ARM7と排他制御する + (void)SYSMi_CopyCardRomHeader(); + (void)OS_UnlockByWord( id, &SYSMi_GetWork()->lockCardRsc, NULL ); // ARM7と排他制御する + OS_ReleaseLockID( id ); + } + if( SYSM_GetCardRomHeader()->platform_code & PLATFORM_CODE_FLAG_TWL ) { + s_bootTitleBuf.titleID = *(u64 *)( &SYSM_GetCardRomHeader()->titleID_Lo ); + }else{ + // NTRアプリの時は、TitleIDがないので、GameCodeをいじって擬似的にTitleIDとする。 + s_bootTitleBuf.titleID = (u64)( ( SYSM_GetCardRomHeader()->game_code[ 3 ] << 0 ) | + ( SYSM_GetCardRomHeader()->game_code[ 2 ] << 8 ) | + ( SYSM_GetCardRomHeader()->game_code[ 1 ] << 16 ) | + ( SYSM_GetCardRomHeader()->game_code[ 0 ] << 24 ) ); + } + SYSM_SetLogoDemoSkip( s_bootTitleBuf.flags.isLogoSkip ); + return &s_bootTitleBuf; +} + +// ショートカット起動のチェックその1 +static TitleProperty *SYSMi_CheckShortcutBoot1( void ) +{ + MI_CpuClear8( &s_bootTitleBuf, sizeof(TitleProperty) ); + + if( SYSM_IsExistCard() ) { + //----------------------------------------------------- + // 量産工程用ショートカットキー or + // 検査カード起動 + //----------------------------------------------------- + if( LCFG_THW_IsForceLogoDemoSkip() || + SYSM_IsInspectCard() || + ( ( PAD_Read() == SYSM_PAD_PRODUCTION_SHORTCUT_CARD_BOOT ) && + ( !LCFG_TSD_IsFinishedBrokenTWLSettings() || !LCFG_TSD_IsFinishedInitialSetting() || !LCFG_TSD_IsFinishedInitialSetting_Launcher() ) ) + ){ + return SYSMi_ShortcutCardBootSub(); + } + //----------------------------------------------------- + // ISデバッガ起動 or + // ISデバッガバナーViewモード起動 + //----------------------------------------------------- + if( SYSM_IsRunOnDebugger() && // ISデバッガが有効かつJTAGがまだ有効でない時 + !( *(u8 *)( HW_SYS_CONF_BUF + HWi_WSYS09_OFFSET ) & HWi_WSYS09_JTAG_CPUJE_MASK ) + ){ + if( SYSMi_IsDebuggerBannerViewMode() ) { + return NULL; // バナービューモード時は、通常起動でランチャーメニューを表示 + }else { + return SYSMi_ShortcutCardBootSub(); + } + } + } + + return NULL; // 「ブート内容未定」でリターン +} + +// ショートカット起動のチェックその2 +static TitleProperty *SYSMi_CheckShortcutBoot2( void ) +{ + BOOL isSetArgument = FALSE; + BOOL isBootMSET = FALSE; + u16 argument = 0; +#ifndef SYSM_DISABLE_INITIAL_SETTINGS + int i; + char *p = (char *)LCFG_TSD_GetTPCalibrationPtr(); +#endif + + MI_CpuClear8( &s_bootTitleBuf, sizeof(TitleProperty) ); + +#ifndef SYSM_DISABLE_INITIAL_SETTINGS + // タッチパネルキャリブレーションデータがクリアされていないかチェック + for( i = 0; i < sizeof(LCFGNTRTPCalibData); i++ ) { + if( *p != 0 ) break; + p++; + } + //----------------------------------------------------- + // TWL設定データ破損時のフラッシュ壊れシーケンス起動 + //----------------------------------------------------- + if( ( i == sizeof(LCFGNTRTPCalibData) ) || + !LCFG_TSD_IsFinishedBrokenTWLSettings() ) { + argument = 100; // フラッシュ壊れシーケンス起動 + isSetArgument = TRUE; + isBootMSET = TRUE; + }else +#endif + //----------------------------------------------------- + // L+R+Startボタン押下起動で、本体設定のタッチパネル設定を起動 + //----------------------------------------------------- + if( ( PAD_Read() & SYSM_PAD_SHORTCUT_TP_CALIBRATION ) == + SYSM_PAD_SHORTCUT_TP_CALIBRATION ) { + argument = 101; + isSetArgument = TRUE; + isBootMSET = TRUE; + } +#ifndef SYSM_DISABLE_INITIAL_SETTINGS + //----------------------------------------------------- + // TWL設定データ未設定時の初回起動シーケンス起動 + //----------------------------------------------------- + else if( !LCFG_TSD_IsFinishedInitialSetting() ) { + argument = 0; + isSetArgument = FALSE; + isBootMSET = TRUE; + } +#endif + + //----------------------------------------------------- + // ランチャー画面を表示しないバージョンの場合 + // カードがささっていたらカードを起動する + // ささっていない場合は本体設定を起動 + //----------------------------------------------------- +#ifdef SYSM_DO_NOT_SHOW_LAUNCHER + else if( SYSM_IsExistCard() ) + { + return SYSMi_ShortcutCardBootSub(); + }else + { + argument = 0; + isSetArgument = FALSE; + isBootMSET = TRUE; + } +#endif + + // 「アプリ間パラメータセット」有効時は、パラメータをセット + if( isSetArgument ) { + OSDeliverArgInfo argInfo; + int result; + + OS_InitDeliverArgInfo(&argInfo, 0); + OS_DecodeDeliverArg(); + OSi_SetDeliverArgState( OS_DELIVER_ARG_BUF_ACCESSIBLE | OS_DELIVER_ARG_BUF_WRITABLE ); + result = OS_SetSysParamToDeliverArg( (u16)argument ); + + if(result != OS_DELIVER_ARG_SUCCESS ) + { + OS_Warning("Failed to Set DeliverArgument."); + return FALSE; + } + OS_EncodeDeliverArg(); + } + + // 「本体設定ブート」有効時は、本体設定プート決定 + if( isBootMSET ) { + s_bootTitleBuf.titleID = SYSMi_getTitleIdOfMachineSettings(); + if(s_bootTitleBuf.titleID != 0) + { + s_bootTitleBuf.flags.isLogoSkip = TRUE; // 本体設定を起動できる時だけロゴデモを飛ばす + } + s_bootTitleBuf.flags.bootType = LAUNCHER_BOOTTYPE_NAND; + s_bootTitleBuf.flags.isValid = TRUE; + s_bootTitleBuf.flags.isAppRelocate = FALSE; + s_bootTitleBuf.flags.isAppLoadCompleted = FALSE; + return &s_bootTitleBuf; + } + + return NULL; // 「ブート内容未定」でリターン +} + + +// NAM_Initされるようになったので、NAMで本体設定のID取得 +// それらしきものがインストールされていない場合は0(NULL)をリターン +static OSTitleId SYSMi_getTitleIdOfMachineSettings( void ) +{ + OSTitleId ret = NULL; + int l; + int getNum; + int validNum = 0; + NAMTitleId *pTitleIDList = NULL; + ROM_Header_Short *header = ( ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + + // インストールされているタイトルの取得 + getNum = NAM_GetNumTitles(); + pTitleIDList = SYSM_Alloc( sizeof(NAMTitleId) * getNum ); + if( pTitleIDList == NULL ) { + OS_TPrintf( "%s: alloc error.\n", __FUNCTION__ ); + return 0; + } + (void)NAM_GetTitleList( pTitleIDList, (u32)getNum ); + + // 取得したタイトルに本体情報のIDがあるかチェック + for( l = 0; l < getNum; l++ ) { + char *code = ((char *)&pTitleIDList[l]) + 1; + if( 0 == STD_CompareNString( code, "BNH", 3 ) ) + { + ret = (OSTitleId)pTitleIDList[l]; + break; + } + } + SYSM_Free( pTitleIDList ); + + return ret; +} + +//====================================================================== +// デバッグ +//====================================================================== diff --git a/build/libraries_sysmenu/sysmenu/ARM9/src/title.c b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c new file mode 100644 index 00000000..fb0201b8 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/ARM9/src/title.c @@ -0,0 +1,2427 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SYSM_lib.c + + Copyright 2007 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 "internal_api.h" +#include "fs_wram.h" +#include + +// define data----------------------------------------------------------------- + +#define MEASURE_MAKELIST_TIME 0 + +#define CARD_BANNER_INDEX ( LAUNCHER_TITLE_LIST_NUM - 1 ) + +#define LAUNCHER_KEY_INDEX 0 // ファームから送られてくる鍵のうちLauncherキーのインデックス +#define SYSTEM_APP_KEY_INDEX 1 // ファームから送られてくるSYSTEMアプリキーのインデックス +#define SECURE_APP_KEY_INDEX 2 // ファームから送られてくるSECUREアプリキーのインデックス +#define USER_APP_KEY_INDEX 3 // ファームから送られてくるUSERアプリキーのインデックス + +#define ROM_HEADER_HASH_OFFSET (0x0) // 署名からROMヘッダハッシュを取り出すためのオフセット + +#define SIGN_HEAP_ADDR 0x023c0000 // 署名計算のためのヒープ領域開始アドレス +#define SIGN_HEAP_SIZE 0x1000 // 署名計算のためのヒープサイズ +#define ARM9_ENCRYPT_DEF_SIZE 0x800 // ARM9FLXの先頭暗号化部分のサイズ + +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) +#define TWL_ROM_HEADER_HASH_CALC_DATA_LEN 0xe00 // ROMヘッダのハッシュ計算する部分の長さTWL版 +#define NTR_ROM_HEADER_HASH_CALC_DATA_LEN 0x160 // ROMヘッダのハッシュ計算する部分の長さDS版 + +#define AUTH_KEY_BUFFER_LEN 128 +#define MB_AUTH_SIGN_SIZE (128) /* digital sign size */ + +#define THREAD_PRIO_FS_WRAM 3 +#define WRAM_SIZE_FOR_FS MI_WRAM_SIZE_96KB + +#ifdef USE_HYENA_COMPONENT +#define WRAM_SLOT_FOR_FS 5 +#else +#define WRAM_SLOT_FOR_FS 0 +#endif + +#include + +#define SYSM_TITLE_MESSAGE_ARRAY_MAX 1 + +#define SIZE_16KB ( 16 * 1024 ) + +typedef struct MbAuthCode +{ + char magic_code[2]; // マジックナンバー + u16 version; // バージョン + u8 sign[MB_AUTH_SIGN_SIZE]; // 署名 + u32 serial_number; // シリアル番号 +} MbAuthCode; // 16byte + +typedef struct CalcHMACSHA1CallbackArg +{ + SVCHMACSHA1Context ctx; + u32 hash_length; +} CalcHMACSHA1CallbackArg; + +typedef struct CalcSHA1CallbackArg +{ + SVCSHA1Context ctx; + u32 hash_length; +} CalcSHA1CallbackArg; + +// extern data----------------------------------------------------------------- +extern const u8 g_devPubKey[ 4 ][ 0x80 ]; + +// function's prototype------------------------------------------------------- + +static void SYSMi_LoadTitleThreadFunc( TitleProperty *pBootTitle ); +static BOOL SYSMi_CheckTitlePointer( TitleProperty *pBootTitle ); +static void SYSMi_makeTitleIdList( void ); +static BOOL SYSMi_AuthenticateHeader( TitleProperty *pBootTitle, ROM_Header *head ); +static void SYSMi_applyPatchToBandBrothers( void ); +static void SYSMi_ClearRomLoadSegment( ROM_Header_Short *rhs ); +static void SYSMi_CutAwayRegionList( u32 *regionlist, u32 start, u32 end ); +static void SYSMi_CpuClearFast( void *dest, u32 size ); + +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +static OSThread s_thread; +static OSThread s_auth_thread; +static TWLBannerFile s_card_bannerBuf; + +static u8 s_authcode[MATH_ROUNDUP32(sizeof(MbAuthCode))] ATTRIBUTE_ALIGN(32); +static MbAuthCode *sp_authcode = (MbAuthCode *)s_authcode; +static MbAuthCode bup_num; + +static BOOL s_loadstart = FALSE; + +static BOOL s_loadPaused = FALSE; + +static OSMessageQueue s_msgQ; +static OSMessage s_msgArray[SYSM_TITLE_MESSAGE_ARRAY_MAX]; + +static int s_listLength = 0; + +static u8 *s_calc_hash = NULL; +static BOOL s_b_dev = FALSE; +static BOOL s_result_phase1 = FALSE; + +static struct +{ + void* buffer; + DHTFile* dht; // in buffer + DHTFileEx* dhtex; // in buffer + DHTFileAdHoc* dhtah; // in buffer + const u8* hash1; + const u8* hash2; + const u8* hash3; +} +s_dht; + +// const data------------------------------------------------------------------ +static const OSBootType s_launcherToOSBootType[ LAUNCHER_BOOTTYPE_MAX ] = { + OS_BOOTTYPE_ILLEGAL, // ILLEGAL + OS_BOOTTYPE_ROM, // ROM + OS_BOOTTYPE_NAND, // TEMP + OS_BOOTTYPE_NAND, // NAND + OS_BOOTTYPE_MEMORY, // MEMORY +}; + +// HMAC_SHA1用鍵 +static const u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + +// ダウンロードアプリ署名用公開鍵 +static const u8 nitro_dl_sign_key[AUTH_KEY_BUFFER_LEN] = { + 0x9E,0xC1,0xCC,0xC0,0x4A,0x6B,0xD0,0xA0,0x6D,0x62,0xED,0x5F,0x15,0x67,0x87,0x12, + 0xE6,0xF4,0x77,0x1F,0xD8,0x5C,0x81,0xCE,0x0C,0xD0,0x22,0x31,0xF5,0x89,0x08,0xF5, + 0xBE,0x04,0xCB,0xC1,0x4F,0x63,0xD9,0x5A,0x98,0xFF,0xEB,0x36,0x0F,0x9C,0x5D,0xAD, + 0x15,0xB9,0x99,0xFB,0xC6,0x86,0x2C,0x0A,0x0C,0xFC,0xE6,0x86,0x03,0x60,0xD4,0x87, + 0x28,0xD5,0x66,0x42,0x9C,0xF7,0x04,0x14,0x4E,0x6F,0x73,0x20,0xC3,0x3E,0x3F,0xF5, + 0x82,0x2E,0x78,0x18,0xD6,0xCD,0xD5,0xC2,0xDC,0xAA,0x1D,0x34,0x91,0xEC,0x99,0xC9, + 0xF7,0xBF,0xBF,0xA0,0x0E,0x1E,0xF0,0x25,0xF8,0x66,0x17,0x54,0x34,0x28,0x2D,0x28, + 0xA3,0xAE,0xF0,0xA9,0xFA,0x3A,0x70,0x56,0xD2,0x34,0xA9,0xC5,0x9E,0x5D,0xF5,0xE1 +}; + +// ============================================================================ +// DHT +// ============================================================================ + +static BOOL GetDatabaseFilepath(char *path) +{ + u8 title[4] = { 'H','N','H','A' }; + +#if( USE_LCFG_STRING == 0 ) + char *title0 = "HNGA"; +#endif + u32 titleID_hi; + u32 titleID_lo; + u64 titleID = 0; + + +#if( USE_LCFG_STRING == 0 ) + { + int i; + if( title[0] == 0 ) { + for( i = 0 ; i < 4 ; i++ ) { + title[i] = (u8)*title0++; + } + } + } +#endif + + titleID_hi = (( 3 /* Nintendo */ << 16) | 8 /* CHANNEL_DATA_ONLY */ | 4 /* CHANNEL_CARD */ | 2 /* isLaunch */ | 1 /* isSystem */); + + titleID_lo = ((u32)( title[0] ) & 0xff) << 24; + titleID_lo |= ((u32)( title[1] )& 0xff) << 16; + titleID_lo |= ((u32)( title[2] )& 0xff) << 8; + titleID_lo |= (u32)( title[3] ) & 0xff; + + titleID = ((u64)(titleID_hi) << 32) | (u64)titleID_lo; + + // OS_TPrintf( "[DHT] titleID = 0x%08x%08x\n", titleID_hi, titleID_lo); + + if( NAM_OK == NAM_GetTitleBootContentPathFast(path, titleID) ) { + OS_TPrintf( "[DHT] File = %s\n", path); + } + else { + OS_TPrintf( "[DHT] Error: NAM_GetTitleBootContentPathFast titleID = 0x%08x0x%08x\n",titleID_hi, titleID_lo); + return FALSE; + } + + return TRUE; +} + +// open and read every database (フェーズ4があるので常に実行すること) +static BOOL PrepareDHTDatabase(void) +{ + char path[256]; + int length; + FSFile file; + + if ( s_dht.buffer ) + { + return TRUE; // already done !? + } + + if ( !GetDatabaseFilepath( path ) ) + { + OS_TPrintf("PrepareDHTDatabase failed: DHT file is not found.\n"); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): DHT file is not found.\n" ); + } + return FALSE; // database was not found + } + if ( !FS_OpenFileEx(&file, path, FS_FILEMODE_R) ) + { + OS_TPrintf("PrepareDHTDatabase failed: DHT file cannot open.\n"); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): DHT file cannot open.\n" ); + } + return FALSE; // cannot open the file + } + length = (int)FS_GetFileLength(&file); + +#if 0 // 1 if using attach_dummyromheader + if ( !FS_SeekFile(&file, sizeof(ROM_Header), FS_SEEK_SET) ) + { + OS_TPrintf("PrepareDHTDatabase failed: DHT file size (%d) is too small.\n", length ); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): DHT file size (%d) is too small.\n", length ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + FS_CloseFile(&file); + return FALSE; + } + length -= sizeof(ROM_Header); +#endif + + s_dht.buffer = SYSM_Alloc( (u32)length ); + if ( !s_dht.buffer ) + { + OS_TPrintf("PrepareDHTDatabase failed: cannot allocate %d bytes for buffer.\n", length ); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot allocate %d bytes for buffer.\n", length ); + } + FS_CloseFile(&file); + return FALSE; // cannot allocate the memory + } + // 基本データベース + s_dht.dht = s_dht.buffer; + if ( sizeof(DHTHeader) != FS_ReadFile(&file, &s_dht.dht->header, sizeof(DHTHeader)) ) + { + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTHeader for phase 1/2.\n" ); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTHeader for phase 1/2.\n" ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + FS_CloseFile(&file); + return FALSE; // cannot read the file + } + length = (int)DHT_GetDatabaseLength(s_dht.dht) - (int)sizeof(DHTHeader); + if ( length < 0 || length != FS_ReadFile(&file, &s_dht.dht->database, length) ) + { + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTDatabase for phase 1/2.\n" ); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTDatabase for phase 1/2.\n" ); + } + s_dht.dht = NULL; + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + FS_CloseFile(&file); + return FALSE; // cannot read the file + } + // 拡張データベース + s_dht.dhtex = (void*)((u32)s_dht.buffer + DHT_GetDatabaseLength(s_dht.dht)); + if ( sizeof(DHTHeader) != FS_ReadFile(&file, &s_dht.dhtex->header, sizeof(DHTHeader)) ) + { + s_dht.dhtex = NULL; + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTHeader for phase 3.\n" ); + FS_CloseFile(&file); +#ifndef SYSM_IGNORE_DHT_EX_NOT_FOUND + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTHeader for phase 3.\n" ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + return FALSE; // cannot read the file +#else + return TRUE; +#endif + } + length = (int)DHT_GetDatabaseExLength(s_dht.dhtex) - (int)sizeof(DHTHeader); + if ( length < 0 || length != FS_ReadFile(&file, &s_dht.dhtex->database, length) ) + { + s_dht.dhtex = NULL; + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTDatabaseEx for phase 3.\n" ); + FS_CloseFile(&file); +#ifndef SYSM_IGNORE_DHT_EX_NOT_FOUND + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTDatabaseEx for phase 3.\n" ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + return FALSE; // cannot read the file +#else + return TRUE; +#endif + } + // 個別対応データベース + s_dht.dhtah = (void*)((u32)s_dht.buffer + DHT_GetDatabaseLength(s_dht.dht) + DHT_GetDatabaseExLength(s_dht.dhtex)); + if ( sizeof(DHTHeader) != FS_ReadFile(&file, &s_dht.dhtah->header, sizeof(DHTHeader)) ) + { + s_dht.dhtah = NULL; + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTHeader for phase 4.\n" ); + FS_CloseFile(&file); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTHeader for phase 4.\n" ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + return FALSE; // phase 3が読めてphase4が読めないことはあり得ない + } + length = (int)DHT_GetDatabaseAdHocLength(s_dht.dhtah) - (int)sizeof(DHTHeader); + if ( length < 0 || length != FS_ReadFile(&file, &s_dht.dhtah->database, length) ) + { + s_dht.dhtah = NULL; + OS_TPrintf("PrepareDHTDatabase failed: cannot read DHTDatabaseAdHoc for phase 4.\n" ); + FS_CloseFile(&file); + if(!s_b_dev) { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): cannot read DHTDatabaseAdHoc for phase 4.\n" ); + } + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + return FALSE; // phase 3が読めてphase4が読めないことはあり得ない + } + FS_CloseFile(&file); + return TRUE; +} + +static BOOL WrapperFunc_ReadCardData(void* dest, s32 offset, s32 length, void* arg) +{ +#pragma unused(arg) + HOTSW_ReadCardData( (void *)offset, dest, (u32)length); + return TRUE; +} + + +//================================================================================ +// for register SCFG_OP +//================================================================================ +/*---------------------------------------------------------------------------* + Name: SCFG_GetBondingOption + + Description: Get bonding option data + + Arguments: None + + Returns: option data + *---------------------------------------------------------------------------*/ +// SharedArea Access ver. +static inline u16 SCFG_GetBondingOption(void) +{ + return (u16)(*(u8*)(HW_SYS_CONF_BUF+HWi_WSYS08_OFFSET) & HWi_WSYS08_OP_OPT_MASK); +} + + +// ============================================================================ +// +// +// 情報取得 +// +// +// ============================================================================ + +// カードタイトルの取得 +TitleProperty *SYSM_GetCardTitleList( BOOL *changed ) +{ + TitleProperty *pTitleList_Card = AMN_getTitlePropertyList(); + if(changed) *changed = FALSE; + + if(s_loadstart) + { + // ロード開始していたら、もうヘッダやタイトル情報は変更しない + return pTitleList_Card; + } + + if( SYSMi_GetWork()->flags.hotsw.isCardStateChanged ) { + u16 id = (u16)OS_GetLockID(); + const ROM_Header_Short *pROMH_bak = (ROM_Header_Short *)SYSM_CARD_ROM_HEADER_BAK; + + MI_CpuClear32( pTitleList_Card, sizeof(TitleProperty) ); + + (void)OS_LockByWord( id, &SYSMi_GetWork()->lockCardRsc, NULL ); // ARM7と排他制御する + + // ROMヘッダバッファのコピー + if( SYSM_IsExistCard() ) { + if( ( pROMH_bak->platform_code & PLATFORM_CODE_FLAG_TWL ) && !UTL_CheckAppRegion( pROMH_bak->card_region_bitmap ) ) { + // TWLアプリでカードリージョンが本体と一致しないものは、カードを認識しない。 + OS_TPrintf( "Region Check NG : %llx\n", pROMH_bak->titleID ); + MI_CpuClearFast( (void *)SYSM_APP_ROM_HEADER_BUF, SYSM_APP_ROM_HEADER_SIZE ); // ROMヘッダのクリア + MI_CpuClearFast( &s_card_bannerBuf, sizeof(TWLBannerFile) ); // バナーデータのクリア + }else { + // ROMヘッダのリード + (void)SYSMi_CopyCardRomHeader(); + // バナーデータのリード + (void)SYSMi_CopyCardBanner(); + + pTitleList_Card->pBanner = &s_card_bannerBuf; + AMN_stepBannerAnime(0, TRUE); // バナーカウンタセットしなおし + pTitleList_Card->flags.isValid = TRUE; + pTitleList_Card->flags.isAppLoadCompleted = FALSE; + pTitleList_Card->flags.isAppRelocate = TRUE; + MI_CpuCopy8( SYSM_GetCardRomHeader(), AMN_getRomHeaderList(), sizeof(ROM_Header_Short) ); + } + }else { + MI_CpuClearFast( (void *)SYSM_APP_ROM_HEADER_BUF, SYSM_APP_ROM_HEADER_SIZE ); // ROMヘッダのクリア + MI_CpuClearFast( &s_card_bannerBuf, sizeof(TWLBannerFile) ); // バナーデータのクリア + } + + SYSMi_GetWork()->flags.hotsw.isCardStateChanged = FALSE; // カード情報更新フラグを落とす + (void)OS_UnlockByWord( id, &SYSMi_GetWork()->lockCardRsc, NULL ); // ARM7と排他制御する + OS_ReleaseLockID( id ); + + // タイトル情報フラグのセット + pTitleList_Card->flags.bootType = LAUNCHER_BOOTTYPE_ROM; + + if( SYSM_GetCardRomHeader()->platform_code & PLATFORM_CODE_FLAG_TWL ) { + // TWLアプリの時は、TitleIDをそのままセット + pTitleList_Card->titleID = *(u64 *)( &SYSM_GetCardRomHeader()->titleID_Lo ); + }else { + // NTRアプリの時は、TitleIDがないので、GameCodeをいじって擬似的にTitleIDとする。 + pTitleList_Card->titleID = (u64)( ( SYSM_GetCardRomHeader()->game_code[ 3 ] << 0 ) | + ( SYSM_GetCardRomHeader()->game_code[ 2 ] << 8 ) | + ( SYSM_GetCardRomHeader()->game_code[ 1 ] << 16 ) | + ( SYSM_GetCardRomHeader()->game_code[ 0 ] << 24 ) ); + } + if(changed) *changed = TRUE; + } + + return pTitleList_Card; +} + +// カードROMヘッダのARM7バッファからARM9バッファへのコピー +BOOL SYSMi_CopyCardRomHeader( void ) +{ + BOOL retval = FALSE; + + if( SYSM_IsExistCard() ) { + // ROMヘッダのリード + DC_InvalidateRange( (void *)SYSM_CARD_ROM_HEADER_BAK, SYSM_APP_ROM_HEADER_SIZE ); // キャッシュケア + MI_CpuCopyFast( (void *)SYSM_CARD_ROM_HEADER_BAK, (void *)SYSM_APP_ROM_HEADER_BUF, SYSM_APP_ROM_HEADER_SIZE ); // ROMヘッダコピー + + retval = TRUE; + } + + return retval; +} + + +// カードバナーのARM7バッファからARM9バッファへのコピー +BOOL SYSMi_CopyCardBanner( void ) +{ + BOOL retval = FALSE; + + if( SYSM_IsExistCard() ) { + // バナーデータのコピー + TWLBannerFile *pBanner = &s_card_bannerBuf; + if( SYSMi_GetWork()->flags.hotsw.isValidCardBanner ) { + DC_InvalidateRange( (void *)SYSM_CARD_BANNER_BUF, 0x3000 ); + MI_CpuCopyFast( (void *)SYSM_CARD_BANNER_BUF, pBanner, sizeof(TWLBannerFile) ); + } + retval = AMN_checkBannerFile( pBanner ); + + if( !retval ) { + MI_CpuClearFast( pBanner, sizeof(TWLBannerFile) ); + } + } + + return retval; +} + +void SYSM_InitTitleList( void ) +{ + AMN_init( SYSM_Alloc, SYSM_Free ); +} + +// SYSM_InitTitleListを事前に呼ぶ必要あり +void SYSM_MakeNandTitleListMakerInfo( void ) +{ + AMN_restartWithReadNandTitleHeaderShort(); + while (!AMN_isNandTitleListReady()) { + OS_Sleep(1); + } +} + +// ローンチ対象となるNANDタイトルリストの取得 +// SYSM_InitTitleListを事前に呼ぶ必要あり +// return:Titleリストのポインタ +TitleProperty *SYSM_GetNandTitleList( void ) +{ + // filter_flag : ALL, ALL_APP, SYS_APP, USER_APP, Data only, 等の条件を指定してタイトルリストを取得する。 + AMN_restartWithReadNandTitle(); + while (!AMN_isNandTitleListReady()) { + OS_Sleep(1); + } + return AMN_getTitlePropertyList(); +} + +// SYSM_InitTitleListを事前に呼ぶ必要あり +void SYSM_MakeNandTitleListMakerInfoAsync( void ) +{ + AMN_restartWithReadNandTitleHeaderShort(); +} + +void SYSM_MakeNandTitleListAsync( void ) +{ + AMN_restartWithReadNandTitle(); +} + +BOOL SYSM_isNandTitleListReady( void ) +{ + return AMN_isNandTitleListReady(); +} + +TitleProperty *SYSM_GetTitlePropertyList( void ) +{ + return AMN_getTitlePropertyList(); +} + +// ============================================================================ +// +// +// アプリロード +// +// +// ============================================================================ + +static void CallbackSub_DecryptAES(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot) +{ + OSIntrMode enabled = OS_DisableInterrupts();// WRAM切り替え途中で割り込み発生→別スレッドでWRAM切り替え→死亡の可能性があるので暫定対応 + MI_SwitchWramSlot( wram, slot, MI_WRAM_SIZE_32KB, MI_WRAM_ARM9, MI_WRAM_ARM7 );// Wramを7にスイッチ + SYSM_StartDecryptAESRegion_W( addr, orig_addr, len ); // AES領域デクリプト + MI_SwitchWramSlot( wram, slot, MI_WRAM_SIZE_32KB, MI_WRAM_ARM7, MI_WRAM_ARM9 );// Wramが7にスイッチしてしまっているので戻す + OS_RestoreInterrupts(enabled);// 割り込み許可 +} + +static void SYSMi_CalcHMACSHA1Callback(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg) +{ + CalcHMACSHA1CallbackArg *cba = (CalcHMACSHA1CallbackArg *)arg; + u32 calc_len = ( cba->hash_length < len ? cba->hash_length : len ); + CallbackSub_DecryptAES( addr, orig_addr, len, wram, slot ); + if( calc_len == 0 ) return; + cba->hash_length -= calc_len; + SVC_HMACSHA1Update( &cba->ctx, addr, calc_len ); +} + +static void SYSMi_CalcSHA1Callback(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg) +{ + CalcSHA1CallbackArg *cba = (CalcSHA1CallbackArg *)arg; + u32 calc_len = ( cba->hash_length < len ? cba->hash_length : len ); + CallbackSub_DecryptAES( addr, orig_addr, len, wram, slot ); + if( calc_len == 0 ) return; + cba->hash_length -= calc_len; + SVC_SHA1Update( &cba->ctx, addr, calc_len ); +} + +static void SYSMi_DHTPhase1Callback(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg) +{ + CalcHMACSHA1CallbackArg *cba = (CalcHMACSHA1CallbackArg *)arg; + u32 calc_len = ( cba->hash_length < len ? cba->hash_length : len ); + CallbackSub_DecryptAES( addr, orig_addr, len, wram, slot ); + if( calc_len == 0 ) return; + cba->hash_length -= calc_len; + DHT_CheckHashPhase1Update( &cba->ctx, addr, (s32)calc_len ); +} + +static void SYSMi_FinalizeHotSWAsync( TitleProperty *pBootTitle, ROM_Header *head ) +{ + HotSwCardState card_state; + ROM_Header* rh = (void*)SYSM_APP_ROM_HEADER_BUF; + + DC_StoreRange( head, sizeof(ROM_Header) ); + + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + case LAUNCHER_BOOTTYPE_TEMP: + // ROMヘッダのアクセスコントロール情報をもとにカード状態を制御するのは "NAND/TMPブートのTWL-LTD" アプリのみ + if ( ( head->s.platform_code & PLATFORM_CODE_TWL_LIMITED ) == PLATFORM_CODE_TWL_LIMITED ) + { + if(rh->s.access_control.game_card_nitro_mode){ + card_state = HOTSW_CARD_STATE_GAME_MODE; + } + else if(rh->s.access_control.game_card_on){ + card_state = HOTSW_CARD_STATE_NORMAL_MODE; + }else + { + card_state = HOTSW_CARD_STATE_POWER_OFF; + } + } + // それ以外は強制的にNTR互換Game領域にアクセス可能な状態となる(DSダウンロードプレイも含む) + else + { + card_state = HOTSW_CARD_STATE_GAME_MODE; + } + break; + case LAUNCHER_BOOTTYPE_ROM: + default: + card_state = HOTSW_CARD_STATE_KEEP; + break; + } + + HOTSW_FinalizeHotSWAsync( card_state ); +} + +static void SYSMi_LoadTitleThreadFunc( TitleProperty *pBootTitle ) +{ + enum + { + region_header = 0, + region_arm9_ntr, + region_arm7_ntr, + region_arm9_twl, + region_arm7_twl, + region_max + }; + // DSダウンロードプレイおよびpictochat等のNTR拡張NANDアプリの時は、ROMヘッダを退避する + // が、NTR-ROMヘッダは旧無線パッチとデバッガパッチを当てる必要があるため、再配置はrebootライブラリで行う。 + + // ロード + char path[256]; + FSFile file[1]; + BOOL bSuccess; + BOOL isTwlApp = TRUE; + BOOL isCardApp = FALSE; + + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + // NAND + NAM_GetTitleBootContentPathFast(path, pBootTitle->titleID); + break; + case LAUNCHER_BOOTTYPE_ROM: + // CARD + isCardApp = TRUE; + break; + case LAUNCHER_BOOTTYPE_TEMP: + // tmpフォルダ + STD_TSNPrintf( path, 256, OS_TMP_APP_PATH, pBootTitle->titleID ); + break; + default: + // unknown + UTL_SetFatalError(FATAL_ERROR_LOAD_UNKNOWN_BOOTTYPE); + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "TitleID : %016llx \n", pBootTitle->titleID ); + ERRORLOG_Printf( "flags.isValid : %d\n", pBootTitle->flags.isValid ); + ERRORLOG_Printf( "flags.bootType : %d\n", pBootTitle->flags.bootType ); + ERRORLOG_Printf( "isAppLoadCompl : %d\n", pBootTitle->flags.isAppLoadCompleted ); + return; + } + + if(!isCardApp) + { + FS_InitFile( file ); + bSuccess = FS_OpenFileEx(file, path, FS_FILEMODE_R); + }else + { + bSuccess = TRUE; + } + + if( ! bSuccess ) + { +OS_TPrintf("RebootSystem failed: cant open file\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_OPENFILE_FAILED); + goto ERROR; + } + + { + int i; + u32 source[region_max]; + u32 length[region_max]; + u32 destaddr[region_max]; + static u8 header[HW_TWL_ROM_HEADER_BUF_SIZE] ATTRIBUTE_ALIGN(32); + s32 readLen; + ROM_Header *head = (ROM_Header *)header; + CalcHMACSHA1CallbackArg dht_arg; + + // WRAM利用Read関数の準備、 + // 使用するコンポーネントに応じて、WRAMのスロットを解放しておく + // hyena : WRAM_C slot 5-7 + // jackal : WRAM_C slot 0-2 + FS_InitWramTransfer( THREAD_PRIO_FS_WRAM ); + MI_FreeWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM7 ); + MI_FreeWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM9 ); + MI_FreeWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_DSP ); + MI_CancelWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM7 ); + MI_CancelWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM9 ); + MI_CancelWramSlot_C( WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_DSP ); + + // ハッシュ格納用バッファ(ヒープから取っているけど変更するかも) + s_calc_hash = SYSM_Alloc( region_max * SVC_SHA1_DIGEST_SIZE ); + if(!s_calc_hash) + { +OS_TPrintf("RebootSystem failed: Alloc Failed.\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_MEMALLOC_FAILED); + goto ERROR; + } + + // まずROMヘッダを読み込む + if(!isCardApp) + { + bSuccess = FS_SeekFile(file, 0x00000000, FS_SEEK_SET); + }else + { + bSuccess = TRUE; + } + + if( ! bSuccess ) + { +OS_TPrintf("RebootSystem failed: cant seek file(0)\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_SEEKFILE_FAILED); + goto ERROR; + } + + //ヘッダ読み込みと同時に各種ハッシュ計算……できない(NTRかTWLか判別できないため)ので読み込みのみ + { + BOOL result; + u32 len = MATH_ROUNDUP( (s32)sizeof(header), SYSM_ALIGNMENT_LOAD_MODULE ); + if(!isCardApp) + { + result = FS_ReadFileViaWram(file, (void *)header, (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, NULL, NULL ); + }else + { + result = HOTSW_ReadCardViaWram((void*) 0, (void*)header, (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, NULL, NULL ); + } + if ( !result ) + { +OS_TPrintf("RebootSystem failed: cant read file(%d, %d)\n", 0, len); + UTL_SetFatalError(FATAL_ERROR_LOAD_READHEADER_FAILED); + goto ERROR; + } + } + + if( head->s.nintendo_logo_crc16 != 0xCF56 ) + { +int i, j; +for( i = 0; i < 0x20; ++i ) +{ +for( j = 0; j < 0x10; ++j ) +{ +OS_TPrintf("%02X ", header[i * 0x10 + j]); +} +OS_TPrintf("\n"); +} +OS_TPrintf("RebootSystem failed: logo CRC error\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_LOGOCRC_ERROR); + goto ERROR; + } + + if( !(head->s.platform_code & PLATFORM_CODE_FLAG_TWL) ) + { + //NTR専用ROM or NTR TWL両方非対応のアプリ + isTwlApp = FALSE; + if( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP) + { + // NTR-DLアプリの場合はDLアプリ署名データを取得しておく + u32 valid_size = ( head->s.rom_valid_size ? head->s.rom_valid_size : 0x01000000 ); + + bSuccess = FS_SeekFile(file, (s32)valid_size, FS_SEEK_SET); + + if( ! bSuccess ) + { +OS_TPrintf("RebootSystem failed: cant seek file(0)\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_SEEKFILE_FAILED); + goto ERROR; + } + readLen = FS_ReadFile(file, sp_authcode, (s32)sizeof(MbAuthCode)); + if( readLen != (s32)sizeof(MbAuthCode) ) + { +OS_TPrintf("RebootSystem failed: cant read file(%p, %d, %d, %d)\n", sp_authcode, 0, sizeof(MbAuthCode), readLen); + UTL_SetFatalError(FATAL_ERROR_LOAD_READDLSIGN_FAILED); + goto ERROR; + } + } + } + + // ヘッダのハッシュ計算 + SVC_CalcSHA1( s_calc_hash, header, (u32)( ( isTwlApp || ( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_NAND ) || head->s.exFlags.enable_nitro_whitelist_signature ) ? + TWL_ROM_HEADER_HASH_CALC_DATA_LEN : NTR_ROM_HEADER_HASH_CALC_DATA_LEN )); + + //この時点でヘッダの正当性検証 + // ※ROMヘッダ認証 + if( !SYSMi_AuthenticateHeader( pBootTitle, head ) ) + { + UTL_SetFatalError(FATAL_ERROR_LOAD_AUTH_HEADER_FAILED); + goto ERROR; + } + + // 正当性の検証されたヘッダを、本来のヘッダバッファへコピー + MI_CpuCopy8( head, (void*)SYSM_APP_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + + // NTRカードアプリはDHTのPhase1のための計算が必要 + if( !isTwlApp && pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM ) + { + DHT_CheckHashPhase1Init(&dht_arg.ctx, &head->s); + } + + // ヘッダ読み込み完了直後の処理 + // ヘッダ読み込み完了フラグを立てる + SYSM_SetHeaderLoadCompleted(TRUE); + + // HOTSW終了処理有効化 + SYSMi_FinalizeHotSWAsync( pBootTitle, (void*)SYSM_APP_ROM_HEADER_BUF ); + + // 各領域を読み込む + source [region_arm9_ntr] = head->s.main_rom_offset; + length [region_arm9_ntr] = head->s.main_size; + destaddr[region_arm9_ntr] = (u32)head->s.main_ram_address; + + source [region_arm7_ntr] = head->s.sub_rom_offset; + length [region_arm7_ntr] = head->s.sub_size; + destaddr[region_arm7_ntr] = (u32)head->s.sub_ram_address; + + if( isTwlApp ) + { + source [region_arm9_twl] = head->s.main_ltd_rom_offset; + length [region_arm9_twl] = head->s.main_ltd_size; + destaddr[region_arm9_twl] = (u32)head->s.main_ltd_ram_address; + + source [region_arm7_twl] = head->s.sub_ltd_rom_offset; + length [region_arm7_twl] = head->s.sub_ltd_size; + destaddr[region_arm7_twl] = (u32)head->s.sub_ltd_ram_address; + } + + // 領域読み込み先のチェック及び再配置情報データの作成 + // ゲームカードの再配置情報が書き込まれているので、nandアプリロード前に一旦クリア + MI_CpuClearFast(SYSMi_GetWork()->romRelocateInfo, sizeof(Relocate_Info) * RELOCATE_INFO_NUM); + for( i=0; i= ARM9_LTD_STATIC ) continue;// nitroでは読み込まない領域 + if ( !SYSM_CheckLoadRegionAndSetRelocateInfo( (RomSegmentName)i, &(destaddr[i+region_arm9_ntr]), length[i+region_arm9_ntr], + &(SYSMi_GetWork()->romRelocateInfo[i]), isTwlApp ) ) + { + OS_TPrintf("RebootSystem failed: ROM Load Region error\n"); + UTL_SetFatalError(FATAL_ERROR_LOAD_RELOCATEINFO_FAILED); + goto ERROR; + } + } + + // AES初期化(ヘッダと再配置情報がそろってから) + (void)SYSM_InitDecryptAESRegion_W( (ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF ); + + for (i = region_arm9_ntr; i < region_max; ++i) + { + BOOL result; + + u32 len = MATH_ROUNDUP( length[i], SYSM_ALIGNMENT_LOAD_MODULE );// AESおよびDMA転送サイズの仕様で、ロードサイズは32バイトアライメントに補正 + + if ( !isTwlApp && i >= region_arm9_twl ) continue;// nitroでは読み込まない領域 + if(!isCardApp) + { + bSuccess = FS_SeekFile(file, (s32)source[i], FS_SEEK_SET); + }else + { + bSuccess = TRUE; + } + + if( ! bSuccess ) + { +OS_TPrintf("RebootSystem failed: cant seek file(%d)\n", source[i]); + UTL_SetFatalError(FATAL_ERROR_LOAD_SEEKFILE_FAILED); + goto ERROR; + } + +OS_TPrintf("RebootSystem : Load VIA WRAM %d.\n", i); + // ここでロード処理と同時にハッシュ計算とAES処理もやってしまう + // 別スレッドで同じWRAM使おうとすると多分コケるので注意 + + // コールバック関数に与える引数を初期化してRead + if( !isTwlApp && pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP ) + { + // NTRダウンロードアプリのモジュール + CalcSHA1CallbackArg arg; + SVC_SHA1Init( &arg.ctx ); + arg.hash_length = (u32)length[i]; + if(!isCardApp) + { + result = FS_ReadFileViaWram(file, (void *)destaddr[i], (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, SYSMi_CalcSHA1Callback, &arg ); + }else + { + result = HOTSW_ReadCardViaWram((void *)source[i], (void *)destaddr[i], (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, SYSMi_CalcSHA1Callback, &arg ); + } + SVC_SHA1GetHash( &arg.ctx, &s_calc_hash[i * SVC_SHA1_DIGEST_SIZE] ); + }else if( !isTwlApp && pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM ) + { + // NTRカードアプリはDHTのPhase1のための計算が必要 + // DHTチェックphase1用のハッシュを計算(DHT_CheckHashPhase1Update 関数)し、結果まで出しておく + dht_arg.hash_length = (u32)length[i]; + result = HOTSW_ReadCardViaWram((void *)source[i], (void *)destaddr[i], (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, SYSMi_DHTPhase1Callback, &dht_arg ); + }else + { + // それ以外 + CalcHMACSHA1CallbackArg arg; + SVC_HMACSHA1Init( &arg.ctx, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1 ); + arg.hash_length = length[i]; + if(!isCardApp) + { + result = FS_ReadFileViaWram(file, (void *)destaddr[i], (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, SYSMi_CalcHMACSHA1Callback, &arg ); + }else + { + result = HOTSW_ReadCardViaWram((void *)source[i], (void *)destaddr[i], (s32)len, MI_WRAM_C, + WRAM_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, SYSMi_CalcHMACSHA1Callback, &arg ); + //speed test code + /* + HOTSW_ReadCardData((void *)source[i], (void *)destaddr[i], (u32)len); + SVC_HMACSHA1Update( &arg.ctx, (void *)destaddr[i], length[i] ); + */ + } + SVC_HMACSHA1GetHash( &arg.ctx, &s_calc_hash[i * SVC_SHA1_DIGEST_SIZE] ); + } + if ( !result ) + { +OS_TPrintf("RebootSystem failed: cant read file(%d, %d)\n", source[i], len); + UTL_SetFatalError(FATAL_ERROR_LOAD_READMODULE_FAILED); + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "LOAD_READMODULE_FAILED (sub info): region %d read failed.\n", i ); + goto ERROR; + } + } + + // NTRカードアプリはDHTのPhase1最終計算を行う + if( !isTwlApp && pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM ) + { + SVC_HMACSHA1GetHash(&dht_arg.ctx, &s_calc_hash[1 * SVC_SHA1_DIGEST_SIZE]); + } + + if(!isCardApp) + { + (void)FS_CloseFile(file); + } + } + + // モジュール最終ロード先領域のうち、現在空いている場所をクリア + // [TODO:]とりあえずベタ書き。余裕があればスレッド化する。 + SYSMi_ClearRomLoadSegment( (ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF ); + + SYSM_SetLoadSucceeded(TRUE); + + // ここでスタック壊れていないかチェック + if( OS_STACK_NO_ERROR != OS_GetStackStatus( &s_thread ) ) + { + OS_TPrintf("RebootSystem warning: stack was broken!\n"); + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "SYSMi_LoadTitleThreadFunc: stack was broken! %d\n", OS_GetStackStatus( &s_thread ) ); + } + + return; + +ERROR: + if(!isCardApp) + { + (void)FS_CloseFile(file); + } + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "SYSMi_LoadTitleThreadFunc: some error has occurred.\n"); +} + +// モジュール最終ロード先領域のうち、現在空いている場所をクリア +#define CLEAR_LIST_LENGTH (8 + 1 + RELOCATE_INFO_NUM * 2) +static void SYSMi_ClearRomLoadSegment( ROM_Header_Short *rhs ) +{ + int l; + u32 twl_clear_list[CLEAR_LIST_LENGTH] = { + SYSM_TWL_ARM9_LOAD_MMEM, SYSM_TWL_ARM9_LOAD_MMEM_END, + SYSM_TWL_ARM7_LOAD_MMEM, SYSM_TWL_ARM7_LOAD_MMEM_END, + SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, + SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, + NULL, + }; + u32 nitro_clear_list[CLEAR_LIST_LENGTH] = { + SYSM_NTR_ARM9_LOAD_MMEM, SYSM_NTR_ARM9_LOAD_MMEM_END, + SYSM_NTR_ARM7_LOAD_MMEM, SYSM_NTR_ARM7_LOAD_MMEM_END, + SYSM_TWL_ARM9_LTD_LOAD_MMEM, SYSM_TWL_ARM9_LTD_LOAD_MMEM_END, + SYSM_TWL_ARM7_LTD_LOAD_MMEM, SYSM_TWL_ARM7_LTD_LOAD_MMEM_END, + NULL, + }; + u32 *clear_list; + u32 length[RELOCATE_INFO_NUM]; + u32 dataExistAddr[RELOCATE_INFO_NUM]; + + length [0] = rhs->main_size; + dataExistAddr[0] = (u32)rhs->main_ram_address; + + length [1] = rhs->sub_size; + dataExistAddr[1] = (u32)rhs->sub_ram_address; + + if( !(rhs->platform_code & PLATFORM_CODE_FLAG_TWL) ) + { + clear_list = nitro_clear_list; + } + else + { + clear_list = twl_clear_list; + length [2] = rhs->main_ltd_size; + dataExistAddr[2] = (u32)rhs->main_ltd_ram_address; + + length [3] = rhs->sub_ltd_size; + dataExistAddr[3] = (u32)rhs->sub_ltd_ram_address; + } + + for( l=0; lplatform_code & PLATFORM_CODE_FLAG_TWL) && l==2 ) + { + break; + } + // 再配置情報があればそちらの情報を取得 + if( SYSMi_GetWork()->romRelocateInfo[l].src != NULL ) + { + length[l] = SYSMi_GetWork()->romRelocateInfo[l].length; + dataExistAddr[l] = SYSMi_GetWork()->romRelocateInfo[l].src; + } + + // 領域の切り取り + SYSMi_CutAwayRegionList( clear_list, dataExistAddr[l], dataExistAddr[l] + length[l] ); + } + + // リストに従って消す + for( l=0; ltitleID & TITLE_ID_DATA_ONLY_FLAG_MASK ) + { + OS_TPrintf("SYSM_StartLoadTitle failed: This App has Data_Only flag.\n"); + return; + } + + // 最後、カード抜き挿しが発生してからSYSM_GetCardTitleListが呼ばれていない状態 + // (画面表示やリストに変更が通知されていない)だったらFATAL + // ただし、カード起動のときのみ + if( SYSMi_GetWork()->flags.hotsw.isCardStateChanged && pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM ) + { + UTL_SetFatalError(FATAL_ERROR_EJECT_CARD_AFTER_LOAD_START); + } + + s_loadstart = TRUE; + s_loadTimes++; // ロード回数のチェック用、二回目以降は非対応の実装なので + + // このあとCardRomヘッダバッファにROMヘッダを上書きで読み込むので + // この時点でHotSWが止まっていないと、さらにカードのROMヘッダ + // を上書きしてしまう可能性がある + + // アプリ未ロード状態なら、ロード開始 + if( !pBootTitle->flags.isAppLoadCompleted ) { + SYSM_SetLoadFinished(FALSE); + SYSM_SetLoadSucceeded(FALSE); + OS_InitThread(); + OS_CreateThread( &s_thread, (void (*)(void *))SYSMi_LoadTitleThreadFunc, (void*)pBootTitle, stack+STACK_SIZE/sizeof(u64), STACK_SIZE,THREAD_PRIO ); + OS_WakeupThreadDirect( &s_thread ); + + }else { + // アプリロード済み + SYSM_SetLoadSucceeded(TRUE); + SYSM_SetLoadFinished(TRUE); + } + + if( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM ) { + SYSM_SetCardBoot(TRUE); + }else if(pBootTitle->flags.isAppLoadCompleted) + { + // カードブートでなく、ロード済みの場合は今のところ何もしない + } +} + +// アプリロード済みかどうかをチェック +BOOL SYSM_IsLoadTitleFinished( void ) +{ + // ロード済みの時は、常にTRUE + if( !SYSMi_GetWork()->flags.arm9.isLoadFinished ) { + // ロードスレッドの完了をチェック。 + SYSM_SetLoadFinished(OS_IsThreadTerminated( &s_thread )); + } + return SYSMi_GetWork()->flags.arm9.isLoadFinished ? TRUE : FALSE; +} + + +// ============================================================================ +// +// +// アプリ認証 +// +// +// ============================================================================ + +// 署名つきアプリ(≠DSダウンロードアプリ署名)共通のヘッダ認証処理 +static BOOL SYSMi_AuthenticateHeaderWithSign( TitleProperty *pBootTitle, ROM_Header *head ) +{ + // 署名処理 + const u8 *key; + u32 hi; + u8 keynum; + SignatureData sigbuf; + SVCSignHeapContext con; + char *gamecode = (char *)&(pBootTitle->titleID); + OSTick start,prev; + start = OS_GetTick(); + + prev = OS_GetTick(); + hi = head->s.titleID_Hi; + // Launcherは専用の鍵を使う + if( ( 0 == STD_CompareNString( &gamecode[1], "ANH", 3 ) ) +#ifdef DEV_UIG_LAUNCHER + || ( ( 0 == STD_CompareNString( &gamecode[1], "AN4", 3 ) ) && ( SCFG_GetBondingOption() != 0 ) ) +#endif + ) + { + keynum = LAUNCHER_KEY_INDEX; + }else + { + // keynum = 1:SystemApp 2:SecureApp 3:UserApp + keynum = (u8)( (hi & TITLE_ID_HI_SECURE_FLAG_MASK) ? SECURE_APP_KEY_INDEX + : ( (hi & TITLE_ID_HI_APP_TYPE_MASK) ? SYSTEM_APP_KEY_INDEX : USER_APP_KEY_INDEX ) + ); + } + + // アプリ種別とボンディングオプションによって使う鍵を分ける +//#define LNC_PDTKEY_DBG +#ifdef LNC_PDTKEY_DBG + { + // 注:デバグ用コード。 + // 開発用TSボードで開発版ROMおよび製品版ROMの署名チェックとAESデクリプトをデバグするためのコード + if( head->s.developer_encrypt_old || head->s.exFlags.developer_encrypt ) + { + // 開発版鍵取得 + key = g_devPubKey[keynum]; + }else + { + // 製品版鍵取得 + key = ((OSFromFirm9Buf *)HW_FIRM_FROM_FIRM_BUF)->rsa_pubkey[keynum]; + } + // デバッガが有効でTLF読み込みならば、ハッシュチェックスルーフラグを立てる + if( SYSM_IsRunOnDebugger() && SYSMi_GetWork()->romEmuInfo.isTlfRom ) + { + s_b_dev = TRUE; + } + } +#else + if( SCFG_GetBondingOption() == 0 ) { + // 製品版鍵取得 + key = ((OSFromFirm9Buf *)HW_FIRM_FROM_FIRM_BUF)->rsa_pubkey[keynum]; + }else { + // 開発版 + key = g_devPubKey[keynum]; + // デバッガが有効でTLF読み込みならば、ハッシュチェックスルーフラグを立てる + if( SYSM_IsRunOnDebugger() && SYSMi_GetWork()->romEmuInfo.isTlfRom ) + { + s_b_dev = TRUE; + } + } +#endif + // 署名を鍵で復号 + MI_CpuClear8( &sigbuf, sizeof(sigbuf) ); + SVC_InitSignHeap( &con, (void *)SIGN_HEAP_ADDR, SIGN_HEAP_SIZE );// ヒープの初期化 + if( !SVC_DecryptSign( &con, sigbuf.digest, head->signature, key )) + { + OS_TPrintf("Authenticate_Header failed: Sign decryption failed.\n"); + if(!s_b_dev) { + UTL_SetFatalError(FATAL_ERROR_SIGN_DECRYPTION_FAILED); + return FALSE; + } + } + if(s_calc_hash) + { + // 署名のハッシュ値とヘッダのハッシュ値を比較 + if(!SVC_CompareSHA1(sigbuf.digest, (const void *)&s_calc_hash[0])) + { + OS_TPrintf("Authenticate_Header failed: Sign compare failed.\n"); + if(!s_b_dev) { + UTL_SetFatalError(FATAL_ERROR_SIGN_COMPARE_FAILED); + return FALSE; + } + }else + { + OS_TPrintf("Authenticate_Header : Sign check succeed. %dms.\n", OS_TicksToMilliSeconds(OS_GetTick() - prev)); + } + }else + { + OS_TPrintf("Authenticate_Header failed: Header Hash calc failed.\n"); + if(!s_b_dev) { + UTL_SetFatalError(FATAL_ERROR_HEADER_HASH_CALC_FAILED); + return FALSE; + } + } + OS_TPrintf("Authenticate_Header : total %d ms.\n", OS_TicksToMilliSeconds(OS_GetTick() - start) ); + + return TRUE; +} + +// TWLアプリ、NTR拡張NANDアプリ 共通のヘッダ認証処理 +static BOOL SYSMi_AuthenticateTWLHeader( TitleProperty *pBootTitle, ROM_Header *head ) +{ + // pBootTitle->titleIDとROMヘッダのtitleIDの一致確認をする。 + // ホワイトリストマスタリングされたNTRアプリでも行う場合はSYSMi_AuthenticateTWLHeaderへ移動 + if( pBootTitle->titleID != head->s.titleID ) + { + //TWL対応ROMで、ヘッダのtitleIDが起動指定されたIDと違う + OS_TPrintf( "Authenticate_Header failed: header TitleID error\n" ); + OS_TPrintf( "Authenticate_Header failed: selectedTitleID=%.16llx\n", pBootTitle->titleID ); + OS_TPrintf( "Authenticate_Header failed: headerTitleID=%.16llx\n", head->s.titleID ); + UTL_SetFatalError(FATAL_ERROR_TITLEID_COMPARE_FAILED); + return FALSE; + }else + { + OS_TPrintf( "Authenticate_Header : header TitleID check succeed.\n" ); + } + + if( head->s.enable_signature || ( SYSM_IsRunOnDebugger() && SYSMi_GetWork()->romEmuInfo.isTlfRom)) + { + return SYSMi_AuthenticateHeaderWithSign( pBootTitle, head ); + }else + { + // 署名有効フラグが立っていない 且つ デバッガが有効でTLFを読み込んでいるのでなければFAILED + OS_TPrintf("Authenticate_Header failed: Sign check flag is OFF!\n"); + UTL_SetFatalError(FATAL_ERROR_VALID_SIGN_FLAG_OFF); + return FALSE; + } +} + +static s32 s_nam_error = NAM_OK; + +s32 SYSMi_getCheckTitleLaunchRightsResult( void ) +{ + return s_nam_error; +} + +// TWLアプリ、NTR拡張NANDアプリ 共通の認証 +static BOOL SYSMi_AuthenticateTWLTitle( TitleProperty *pBootTitle ) +{ + ROM_Header *head; + OSTick start,prev; + start = OS_GetTick(); + + head = ( ROM_Header *)SYSM_APP_ROM_HEADER_BUF; + + // NANDアプリの場合、NAM_CheckTitleLaunchRights()を呼んでチェック + if( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_NAND ) + { + s32 result = NAM_CheckTitleLaunchRights( pBootTitle->titleID ); + if( NAM_OK != result) + { + s_nam_error = result; + OS_TPrintf("Authenticate failed: NAM_CheckTitleLaunchRights failed. %d \n",result); + UTL_SetFatalError(FATAL_ERROR_CHECK_TITLE_LAUNCH_RIGHTS_FAILED); + return FALSE; + }else + { + OS_TPrintf("Authenticate : NAM_CheckTitleLaunchRights succeed. %d ms.\n", OS_TicksToMilliSeconds(OS_GetTick() - start) ); + } + } + + // デバッガ動作以外の時はNANDアプリはNAND、カードアプリはカードからのみブート許可 + if ( ! SYSM_IsRunOnDebugger() ) + { + if ( ( (pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_NAND || + pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP) && !(head->s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK) ) || + (pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_ROM && (head->s.titleID_Hi & TITLE_ID_HI_MEDIA_MASK) ) ) + { + UTL_SetFatalError(FATAL_ERROR_MEDIA_CHECK_FAILED); + return FALSE; + } + } + + // ハッシュ比較 + { + int l; + u32 *module_addr[RELOCATE_INFO_NUM]; + u32 module_size[RELOCATE_INFO_NUM]; + u8 *hash_addr[RELOCATE_INFO_NUM]; + int module_num; + char *gamecode = (char *)&(pBootTitle->titleID); + + // それぞれARM9,7のFLXおよびLTDについてハッシュを計算してヘッダに格納されているハッシュと比較 + module_addr[ARM9_STATIC] = head->s.main_ram_address; + module_addr[ARM7_STATIC] = head->s.sub_ram_address; + module_size[ARM9_STATIC] = head->s.main_size; + module_size[ARM7_STATIC] = head->s.sub_size; + hash_addr[ARM9_STATIC] = &(head->s.main_static_digest[0]); + hash_addr[ARM7_STATIC] = &(head->s.sub_static_digest[0]); + module_num = 2; + + // NITROアプリの拡張では使わない領域 + if( head->s.platform_code != 0 ) + { + module_addr[ARM9_LTD_STATIC] = head->s.main_ltd_ram_address; + module_addr[ARM7_LTD_STATIC] = head->s.sub_ltd_ram_address; + module_size[ARM9_LTD_STATIC] = head->s.main_ltd_size; + module_size[ARM7_LTD_STATIC] = head->s.sub_ltd_size; + hash_addr[ARM9_LTD_STATIC] = &(head->s.main_ltd_static_digest[0]); + hash_addr[ARM7_LTD_STATIC] = &(head->s.sub_ltd_static_digest[0]); + module_num = RELOCATE_INFO_NUM; + } + + for( l=0; lmagic_code[0] != 'a' || sp_authcode->magic_code[1] != 'c' ) { + OS_TPrintf("Authenticate failed: Invalid AuthCode.\n"); + UTL_SetFatalError(FATAL_ERROR_DL_MAGICCODE_CHECK_FAILED); + return FALSE; + } + + // NTRダウンロードアプリ署名(DERフォーマット)の計算、ハッシュの取得。 + MI_CpuClear8( buf, 0x80 ); + SVC_InitSignHeap( &con, (void *)SIGN_HEAP_ADDR, SIGN_HEAP_SIZE );// ヒープの初期化 + if( !SVC_DecryptSignDER( &con, buf, sp_authcode->sign, nitro_dl_sign_key )) + { + OS_TPrintf("Authenticate failed: Sign decryption failed.\n"); + UTL_SetFatalError(FATAL_ERROR_DL_SIGN_DECRYPTION_FAILED); + return FALSE; + } + + // それぞれheader,ARM9FLX,ARM7FLXについてハッシュを計算して、それら3つを並べたものに対してまたハッシュをとる + if(s_calc_hash) + { + // シリアルナンバー付加 + *(u32 *)(&(s_calc_hash[SVC_SHA1_DIGEST_SIZE * 3])) = sp_authcode->serial_number; + // 最終ハッシュ計算 + SVC_CalcSHA1( final_hash, s_calc_hash, SVC_SHA1_DIGEST_SIZE * 3 + sizeof(u32)); + }else + { + OS_TPrintf("Authenticate failed: hash calc failed.\n"); + UTL_SetFatalError(FATAL_ERROR_DL_HASH_CALC_FAILED); + return FALSE; + } + + // 計算した最終ハッシュと、署名から得たハッシュとを比較 + if(!SVC_CompareSHA1((const void *)buf, (const void *)final_hash)) + { + OS_TPrintf("Authenticate failed: hash check failed.\n"); + UTL_SetFatalError(FATAL_ERROR_DL_SIGN_COMPARE_FAILED); + return FALSE; + }else + { + OS_TPrintf("Authenticate : hash check succeed.\n"); + } + } + OS_TPrintf("Authenticate : total %d ms.\n", OS_TicksToMilliSeconds(OS_GetTick() - start) ); + + return TRUE; +} + +BOOL SYSM_IsLoadTitlePaused(void) +{ + return s_loadPaused; +} + +void SYSM_ResumeLoadingThread( BOOL force ) +{ + if( !s_loadPaused ) + { + return; + } + s_loadPaused = FALSE; + // メッセージ送信 + if(!OS_SendMessage(&s_msgQ, (OSMessage)force, OS_MESSAGE_NOBLOCK)) + { + OS_TPrintf( "SYSM_ResumeLoadingThread:Message send error.\n" ); + } +} + +// NTR版カードアプリのヘッダ認証処理 +static BOOL SYSMi_AuthenticateNTRCardAppHeader( TitleProperty *pBootTitle, ROM_Header *head ) +{ + BOOL ret = TRUE; + OSTitleId ntr_fake_titleID; + +#ifdef DEV_WHITELIST_CHECK_SKIP + // 開発版ではハッシュチェックスルーフラグを立てる + if( SCFG_GetBondingOption() != 0 ) + { + s_b_dev = TRUE; + } +#endif + + // pBootTitle->titleIDとROMヘッダのゲームコードの一致確認をする。 + ntr_fake_titleID = (u64)( ( head->s.game_code[ 3 ] << 0 ) | + ( head->s.game_code[ 2 ] << 8 ) | + ( head->s.game_code[ 1 ] << 16 ) | + ( head->s.game_code[ 0 ] << 24 ) ); + if( pBootTitle->titleID != ntr_fake_titleID ) + { + // ヘッダから作成した擬似titleIDが起動指定されたタイトルに格納されている擬似IDと違う + OS_TPrintf( "SYSMi_AuthenticateNTRCardAppHeader failed: header TitleID error\n" ); + OS_TPrintf( "SYSMi_AuthenticateNTRCardAppHeader failed: selectedTitleID=%.16llx\n", pBootTitle->titleID ); + OS_TPrintf( "SYSMi_AuthenticateNTRCardAppHeader failed: headerTitleID=%.16llx\n", ntr_fake_titleID ); + UTL_SetFatalError(FATAL_ERROR_TITLEID_COMPARE_FAILED_NTR); + return FALSE; + }else + { + OS_TPrintf( "Authenticate_Header : header TitleID check succeed.\n" ); + } + + // phase 4があるので常に読み込む + if ( !PrepareDHTDatabase() ) + { + OS_TPrintf(" SYSMi_AuthenticateNTRCardAppHeader failed : database init error.\n"); + if(!s_b_dev) + { + UTL_SetFatalError(FATAL_ERROR_WHITELIST_INITDB_FAILED); + return FALSE; + } + } + // マスタリングの有無 + if( head->s.exFlags.enable_nitro_whitelist_signature ) + { + // マスタリング済みNTRカードアプリの署名チェック(実はTWLアプリと同じ) + ret = SYSMi_AuthenticateHeaderWithSign( pBootTitle, head ); + if( ret == TRUE ) + { + s_dht.hash1 = head->s.nitro_whitelist_phase1_digest; + s_dht.hash2 = head->s.nitro_whitelist_phase2_diegst; + // 新マスタリングの有無 + if( head->s.exFlags.enable_nitro_extra_whitelist ) + { + s_dht.hash3 = head->s.banner_digest; + } + } + }else + { + // ホワイトリスト検索 + const DHTDatabase* db; + if(!s_dht.dht) + { + OS_TPrintf(" Search DHT : database init Failed.\n"); + if(!s_b_dev) + { + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): whitelist for phase 1/2 was not loaded.\n" ); + UTL_SetFatalError(FATAL_ERROR_WHITELIST_INITDB_FAILED); + ret = FALSE; + } + }else + { + OS_TPrintf("Searching DHT for %.4s(%02X)...", head->s.game_code, head->s.rom_version); + db = DHT_GetDatabase(s_dht.dht, &head->s); + if ( !db ) + { + OS_TPrintf(" Search DHT : Failed.\n"); + if(!s_b_dev) + { + ERRORLOG_Printf( "WHITELIST_NOTFOUND (sub info): no entry for phase 1/2.\n" ); + UTL_SetFatalError(FATAL_ERROR_WHITELIST_NOTFOUND); + ret = FALSE; + } + }else + { + s_dht.hash1 = db->hash[0]; + s_dht.hash2 = db->hash[1]; + ret = TRUE; + } + } + } + // ROMヘッダにバナーハッシュがない (マスタリング自体とは別枠) + if( !s_dht.hash3 ) + { + // 拡張ホワイトリスト検索 + const DHTDatabaseEx* db; + if(!s_dht.dhtex) + { + OS_TPrintf(" Search DHT Ex: database init Failed.\n"); + if(!s_b_dev) + { +#ifndef SYSM_IGNORE_DHT_EX_NOT_FOUND + ERRORLOG_Printf( "WHITELIST_INITDB_FAILED (sub info): whitelist for phase 3 was not loaded.\n" ); + UTL_SetFatalError(FATAL_ERROR_WHITELIST_INITDB_FAILED); + ret = FALSE; +#endif + } + }else + { + OS_TPrintf("Searching DHT Ex for %.4s(%02X)...", head->s.game_code, head->s.rom_version); + db = DHT_GetDatabaseEx(s_dht.dhtex, &head->s); + if ( !db ) + { + OS_TPrintf(" Search DHT Ex: Failed.\n"); + if(!s_b_dev) + { + ERRORLOG_Printf( "WHITELIST_NOTFOUND (sub info): no entry for phase 3.\n" ); + UTL_SetFatalError(FATAL_ERROR_WHITELIST_NOTFOUND); + ret = FALSE; + } + }else + { + s_dht.hash3 = db->banner_hash; + ret = TRUE; + } + } + } + return ret; +} + +// NTR版カードアプリの認証 +static BOOL SYSMi_AuthenticateNTRCardTitle( TitleProperty *pBootTitle) +{ +#pragma unused(pBootTitle) + DHTPhase2Work* p2work = NULL; + ROM_Header_Short *hs = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + + // DHTチェックphase1 + if(s_calc_hash) + { + // アプリをロードする時に計算したハッシュを検証 + if( !s_dht.hash1 || !SVC_CompareSHA1( (const void *)s_dht.hash1, (const void *)&s_calc_hash[1 * SVC_SHA1_DIGEST_SIZE] ) ) + { + OS_TPrintf("DHT Phase1 failed: hash check failed.\n"); + if(!s_b_dev) { + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE1_FAILED (sub info): hash1Addr-%08x\n", s_dht.hash1 ); + if(s_dht.hash1) + { + ERRORLOG_Printf( "DHT_PAHSE1_FAILED (sub info): hash1 - %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + s_dht.hash1[0], s_dht.hash1[1], s_dht.hash1[2], s_dht.hash1[3], s_dht.hash1[4], + s_dht.hash1[5], s_dht.hash1[6], s_dht.hash1[7], s_dht.hash1[8], s_dht.hash1[9], + s_dht.hash1[10], s_dht.hash1[11], s_dht.hash1[12], s_dht.hash1[13], s_dht.hash1[14], + s_dht.hash1[15], s_dht.hash1[16], s_dht.hash1[17], s_dht.hash1[18], s_dht.hash1[19]); + ERRORLOG_Printf( "DHT_PAHSE1_FAILED (sub info): calc_hash - %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + s_calc_hash[0], s_calc_hash[1], s_calc_hash[2], s_calc_hash[3], s_calc_hash[4], + s_calc_hash[5], s_calc_hash[6], s_calc_hash[7], s_calc_hash[8], s_calc_hash[9], + s_calc_hash[10], s_calc_hash[11], s_calc_hash[12], s_calc_hash[13], s_calc_hash[14], + s_calc_hash[15], s_calc_hash[16], s_calc_hash[17], s_calc_hash[18], s_calc_hash[19]); + } + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE1_FAILED); + return FALSE; + } + }else + { + OS_TPrintf("DHT Phase1 : hash check succeed..\n"); + } + }else + { + OS_TPrintf("DHT Phase1 failed: hash calc failed.\n"); + if(!s_b_dev) { + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE1_CALC_FAILED); + return FALSE; + } + } + + // DHTチェックphase2 + OS_TPrintf("DHT Phase2..."); + p2work = SYSM_Alloc( sizeof(DHTPhase2Work) ); + if ( !p2work ) + { + OS_TPrintf(" Cannot allocate DHT work area.\n"); + if (!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE2_FAILED (sub info): p2workAddr-%08x hash2Addr-%08x\n", p2work, s_dht.hash2 ); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE2_FAILED); + return FALSE; + } + return TRUE; + } + if ( !s_dht.hash2 || !DHT_CheckHashPhase2(s_dht.hash2, hs, p2work, WrapperFunc_ReadCardData, NULL) ) + { + OS_TPrintf(" DHT Phase2 : Failed.\n"); + if(!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE2_FAILED (sub info): p2workAddr-%08x hash2Addr-%08x\n", p2work, s_dht.hash2 ); + SYSM_Free(p2work); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE2_FAILED); + return FALSE; + } + } + + // DHTチェックphase3 (バナーチェック) + OS_TPrintf("DHT Phase3..."); + if ( !s_dht.hash3 ) + { + if(!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE3_FAILED (sub info): no database no hash\n" ); +#ifndef SYSM_IGNORE_DHT_EX_NOT_FOUND + SYSM_Free(p2work); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE3_FAILED); + return FALSE; +#endif + } + } + else if ( !DHT_CheckHashPhase3(s_dht.hash3, (NTRBannerFile*)&s_card_bannerBuf) ) + { + OS_TPrintf(" DHT Phase3 : Failed.\n"); + if(!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE3_FAILED (sub info): hash3Addr-%08x\n", s_dht.hash3 ); +#ifndef SYSM_IGNORE_DHT_PHASE_3 + SYSM_Free(p2work); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE3_FAILED); + return FALSE; +#endif + } + } + + // DHTチェックphase4 (個別チェック) + OS_TPrintf("DHT Phase4..."); + if ( !s_dht.dhtah ) + { + OS_TPrintf(" DHT Phase4 : No database.\n"); + if(!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE4_FAILED (sub info): no database\n" ); +#ifndef SYSM_IGNORE_DHT_EX_NOT_FOUND + SYSM_Free(p2work); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE4_FAILED); + return FALSE; +#endif + } + } + else if ( !DHT_CheckHashPhase4(s_dht.dhtah, hs, (DHTPhase4Work*)p2work, WrapperFunc_ReadCardData, NULL) ) + { + OS_TPrintf(" DHT Phase4 : Failed.\n"); + if(!s_b_dev){ + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "DHT_PAHSE4_FAILED (sub info): p2workAddr-%08x\n", p2work ); + SYSM_Free(p2work); + UTL_SetFatalError(FATAL_ERROR_DHT_PHASE4_FAILED); + return FALSE; + } + } + + SYSM_Free(p2work); + + return TRUE; +} + +// ヘッダ認証 +static BOOL SYSMi_AuthenticateHeader( TitleProperty *pBootTitle, ROM_Header *head ) +{ + ROM_Header_Short *hs = ( ROM_Header_Short *)head; + if( hs->platform_code & PLATFORM_CODE_FLAG_TWL ) + { + // TWLアプリ + // 認証処理 + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + OS_TPrintf( "Authenticate_Header :TWL_NAND start.\n" ); + return SYSMi_AuthenticateTWLHeader( pBootTitle, head ); + case LAUNCHER_BOOTTYPE_ROM: + OS_TPrintf( "Authenticate_Header :TWL_ROM start.\n" ); + return SYSMi_AuthenticateTWLHeader( pBootTitle, head ); + case LAUNCHER_BOOTTYPE_TEMP: + OS_TPrintf( "Authenticate_Header :TWL_TEMP start.\n" ); + if (!hs->permit_landing_tmp_jump) + { + OS_TPrintf("Authenticate failed: TMP flag error.\n"); + UTL_SetFatalError(FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF); + return FALSE; + } + return SYSMi_AuthenticateTWLHeader( pBootTitle, head ); + default: + UTL_SetFatalError(FATAL_ERROR_TWL_BOOTTYPE_UNKNOWN); + return FALSE; + } + } + else + { + if( hs->platform_code & PLATFORM_CODE_FLAG_NOT_NTR ) + { + // TWLでもNTRでもない不正なアプリ + OS_TPrintf( "Authenticate_Header failed :NOT NTR NOT TWL.\n" ); + UTL_SetFatalError(FATAL_ERROR_PLATFORM_UNKNOWN); + return FALSE; + } + // NTRアプリ + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + OS_TPrintf( "Authenticate_Header :NTR_NAND start.\n" ); + return SYSMi_AuthenticateNTRNandAppHeader( pBootTitle, head ); + case LAUNCHER_BOOTTYPE_TEMP: + OS_TPrintf( "Authenticate_Header :NTR_TEMP start.\n" ); + if (!hs->permit_landing_tmp_jump) + { + OS_TPrintf("Authenticate_Header failed : TMP flag error.\n"); + UTL_SetFatalError(FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF); + return FALSE; + } + return SYSMi_AuthenticateNTRDownloadAppHeader( pBootTitle, head ); + case LAUNCHER_BOOTTYPE_ROM: + OS_TPrintf( "Authenticate_Header :NTR_ROM start.\n" ); + return SYSMi_AuthenticateNTRCardAppHeader( pBootTitle, head ); + default: + UTL_SetFatalError(FATAL_ERROR_NTR_BOOTTYPE_UNKNOWN); + return FALSE; + } + } +} + +// 認証 +static BOOL SYSMi_AuthenticateTitleCore( TitleProperty *pBootTitle) +{ + ROM_Header_Short *hs = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + if( hs->platform_code & PLATFORM_CODE_FLAG_TWL ) + { + // TWLアプリ + // 認証処理 + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + OS_TPrintf( "Authenticate :TWL_NAND start.\n" ); + return SYSMi_AuthenticateTWLTitle( pBootTitle ); + case LAUNCHER_BOOTTYPE_ROM: + OS_TPrintf( "Authenticate :TWL_ROM start.\n" ); + return SYSMi_AuthenticateTWLTitle( pBootTitle ); + case LAUNCHER_BOOTTYPE_TEMP: + OS_TPrintf( "Authenticate :TWL_TEMP start.\n" ); + if (!hs->permit_landing_tmp_jump) + { + OS_TPrintf("Authenticate failed: TMP flag error.\n"); + UTL_SetFatalError(FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF); + return FALSE; + } + return SYSMi_AuthenticateTWLTitle( pBootTitle ); + default: + UTL_SetFatalError(FATAL_ERROR_TWL_BOOTTYPE_UNKNOWN); + return FALSE; + } + } + else + { + if( hs->platform_code & PLATFORM_CODE_FLAG_NOT_NTR ) + { + // TWLでもNTRでもない不正なアプリ + OS_TPrintf( "Authenticate :NOT NTR NOT TWL.\n" ); + UTL_SetFatalError(FATAL_ERROR_PLATFORM_UNKNOWN); + return FALSE; + } + // NTRアプリ + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + OS_TPrintf( "Authenticate :NTR_NAND start.\n" ); + return SYSMi_AuthenticateNTRNandTitle( pBootTitle ); + case LAUNCHER_BOOTTYPE_TEMP: + OS_TPrintf( "Authenticate :NTR_TEMP start.\n" ); + if (!hs->permit_landing_tmp_jump) + { + OS_TPrintf("Authenticate failed: TMP flag error.\n"); + UTL_SetFatalError(FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF); + return FALSE; + } + return SYSMi_AuthenticateNTRDownloadTitle( pBootTitle ); + case LAUNCHER_BOOTTYPE_ROM: + OS_TPrintf( "Authenticate :NTR_ROM start.\n" ); + return SYSMi_AuthenticateNTRCardTitle( pBootTitle ); + default: + UTL_SetFatalError(FATAL_ERROR_NTR_BOOTTYPE_UNKNOWN); + return FALSE; + } + } +} + +// 認証処理のスレッド +static void SYSMi_AuthenticateTitleThreadFunc( TitleProperty *pBootTitle ) +{ + + // ロード開始してませんよ + if( !s_loadstart ) + { + UTL_SetFatalError(FATAL_ERROR_LOAD_NEVER_STARTED); + return; + } + + // ロード中 + if( !SYSM_IsLoadTitleFinished() ) { + UTL_SetFatalError(FATAL_ERROR_LOAD_UNFINISHED); + return; + } + // ロード成功? + if( SYSMi_GetWork()->flags.arm9.isLoadSucceeded == FALSE ) + { + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "SYSMi_AuthenticateTitleThreadFunc: loaded %d times.\n", s_loadTimes ); + UTL_SetFatalError(FATAL_ERROR_TITLE_LOAD_FAILED); + return; + } + // パラメータチェック + if( !SYSMi_CheckTitlePointer( pBootTitle ) ) { + UTL_SetFatalError(FATAL_ERROR_TITLE_POINTER_ERROR); + return; + } + // エントリアドレスの正当性をチェック + if( !SYSMi_CheckEntryAddress() ) { + UTL_SetFatalError(FATAL_ERROR_ENTRY_ADDRESS_ERROR); + return; + } + + // BOOTTYPE_MEMORYでNTRモードのFSありでブートすると、旧NitroSDKでビルドされたアプリの場合、 + // ROMアーカイブにカードが割り当てられて、FSで関係ないカードにアクセスにいってしまうので、それを防止する。 + if( ( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_MEMORY ) && + ( ( (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->platform_code ) == 0 ) && + ( ( (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->fat_size ) > 0 ) + ) { + UTL_SetFatalError(FATAL_ERROR_TITLE_BOOTTYPE_ERROR); + return; + } + + // 認証 + (void)SYSMi_AuthenticateTitleCore( pBootTitle ); + + // ここでスタック壊れていないかチェック + if( OS_STACK_NO_ERROR != OS_GetStackStatus( &s_auth_thread ) ) + { + OS_TPrintf("RebootSystem warning: stack was broken!\n"); + // デバグ用。ERRORLOG_Init()がすでに呼ばれている事前提 + ERRORLOG_Printf( "SYSMi_AuthenticateTitleThreadFunc: stack was broken! %d\n", OS_GetStackStatus( &s_auth_thread ) ); + } +} + + +// ロード済みの指定タイトルを別スレッドで検証開始する +#define AUTH_STACK_SIZE 0x1400 +void SYSM_StartAuthenticateTitle( TitleProperty *pBootTitle ) +{ + static u64 stack[ AUTH_STACK_SIZE / sizeof(u64) ]; + OS_InitThread(); + OS_CreateThread( &s_auth_thread, (void (*)(void *))SYSMi_AuthenticateTitleThreadFunc, (void*)pBootTitle, stack+AUTH_STACK_SIZE/sizeof(u64), AUTH_STACK_SIZE,THREAD_PRIO ); + OS_WakeupThreadDirect( &s_auth_thread ); + + // ROMヘッダのNintendoロゴ 正当性チェック + if( !UTL_CheckNintendoLogoData((ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF) ){ + UTL_SetFatalError( FATAL_ERROR_NINTENDO_LOGO_CHECK_FAILED ); + } +} + +// 検証済み? +BOOL SYSM_IsAuthenticateTitleFinished( void ) +{ + return OS_IsThreadTerminated( &s_auth_thread ); +} + +// アプリ起動に必要なセーブファイルやSharedファイルのリカバリ +static char *s_strResult[] = { + "Target file exists and file size matched.", + "File size didn't match. Changing size succeeded.", + "Target file didn't exist. Creating file and setting size succeeded.", + "ERROR: File Recovery Failed." +}; +static void SYSMi_FileRecovery( TitleProperty *pBootTitle ) +{ + ROM_Header_Short *hs = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + char path[2][ FS_ENTRY_LONGNAME_MAX ]; + UTL_RecoveryStatus stat; + + // TWL非対応のときは不要なのでreturn + if ( !(hs->platform_code & PLATFORM_CODE_FLAG_TWL) ) + { + return; + } + + // NANDアプリのときだけ + if ( pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_NAND ) + { + // get savedata_path + s32 result = NAM_GetTitleSaveFilePath( path[ 0 ], path[ 1 ], hs->titleID ); + + // pub_save + if( result == NAM_OK && hs->public_save_data_size != 0 ) + { + stat = UTL_RecoveryFile( path[0], hs->public_save_data_size ); + OS_TPrintf("pub_save recovery result : %s \n", s_strResult[stat]); + } + + // prv_save + if( result == NAM_OK && hs->private_save_data_size != 0 ) + { + stat = UTL_RecoveryFile( path[1], hs->private_save_data_size ); + OS_TPrintf("prv_save recovery result : %s \n", s_strResult[stat]); + } + + // sub_banner + if( hs->exFlags.availableSubBannerFile && NAM_GetTitleBannerFilePath( path[0], hs->titleID ) == NAM_OK ) + { + stat = UTL_RecoveryFile( path[0], SIZE_16KB ); + OS_TPrintf("sub_banner recovery result : %s \n", s_strResult[stat]); + } + } + + // shared2 (size+1) * 16kb + if( hs->shared2_file0_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0000", (u32)( hs->shared2_file0_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_0 recovery result : %s \n", s_strResult[stat]); + } + if( hs->shared2_file1_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0001", (u32)( hs->shared2_file1_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_1 recovery result : %s \n", s_strResult[stat]); + } + if( hs->shared2_file2_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0002", (u32)( hs->shared2_file2_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_2 recovery result : %s \n", s_strResult[stat]); + } + if( hs->shared2_file3_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0003", (u32)( hs->shared2_file3_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_3 recovery result : %s \n", s_strResult[stat]); + } + if( hs->shared2_file4_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0004", (u32)( hs->shared2_file4_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_4 recovery result : %s \n", s_strResult[stat]); + } + if( hs->shared2_file5_size != 0 ) + { + stat = UTL_RecoveryFile( "nand:/shared2/0005", (u32)( hs->shared2_file5_size + 1 ) * SIZE_16KB ); + OS_TPrintf("shared2_5 recovery result : %s \n", s_strResult[stat]); + } +} + +// ロード済みの指定タイトルの認証とブートを行う +// SYSM_GetNandTitleListまたはSYSM_GetNandTitleListMakerInfoのどちらかをSYSM_TryToBootTitle前に呼ぶ必要あり +void SYSM_TryToBootTitle( TitleProperty *pBootTitle ) +{ + // [TODO:] この内部の処理で失敗した場合にそのままブートしてしまって大丈夫か? + + if(s_calc_hash) + { + // ハッシュ値保存領域解放 + SYSM_Free( s_calc_hash ); + s_calc_hash = NULL; + } + + if(s_dht.buffer) + { + // DHT用バッファが確保されていたら解放 + SYSM_Free( s_dht.buffer ); + s_dht.buffer = NULL; + } + + // ダイレクトブート時など、まだSystemMenuVersionのデータがセットされていない場合は、ここでセットする。 + if( *(u8 *)HW_SYSM_VER_INFO_CONTENT_LAST_INITIAL_CODE == 0 ) { + SYSM_SetSystemMenuVersionControlData(); + } + + // デバッガ接続中以外の時のみTWL設定データにブートするタイトルのTitleIDとplatformCodeを保存。 + if( !SYSM_IsRunOnDebugger() || // スタンドアロン + (OSi_DetectDebugger() & OS_CONSOLE_TWLDEBUGGER) ) // デバッグ時 + { + u8 *pBuffer = SYSM_Alloc( LCFG_WRITE_TEMP ); + if( pBuffer != NULL ) { + LCFG_TSD_SetLastTimeBootSoftPlatform( (u8)SYSM_GetAppRomHeader()->platform_code ); + (void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + SYSM_Free( pBuffer ); + } + } + + // マウント情報の登録 + SYSMi_GetWork2()->bootTitleProperty = *pBootTitle; + SYSMi_SetBootSRLPathToWork2( pBootTitle ); + + // ブート種別仮セット + SYSMi_GetWork()->appBootType = s_launcherToOSBootType[ pBootTitle->flags.bootType ]; + +#if 0 + // ブート時ファイルリカバリ処理 + SYSMi_FileRecovery( pBootTitle ); +#endif + + // タイトルIDリストの作成 + SYSMi_makeTitleIdList(); + + // バンブラパッチ + SYSMi_applyPatchToBandBrothers(); + + BOOT_Ready(); // never return. + +} + +// バンブラパッチを当てる関数 +static void SYSMi_applyPatchToBandBrothers( void ) +{ + ROM_Header_Short *hs = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + + if( ( 0 == STD_CompareNString( hs->game_code , "AXBJ", 4 ) ) && ( hs->rom_version == 0 ) ) + { + u32 len = 0; + u32 llen; + FSFile src; + void *dest; + + // データ読み込み + パッチ + FS_InitFile( &src ); + if ( !FS_OpenFileEx( &src, "rom:/data/bandbrothers_arm7flx_patch.sbin", FS_FILEMODE_R ) ) return; + len = FS_GetFileLength( &src ); + + // ヘッダ情報のうち、ARM7FLXのサイズを改変する + hs->sub_size = len; + + if( SYSMi_GetWork()->romRelocateInfo[ARM7_STATIC].src != NULL ) + { + // ARM7FLXが再配置の場合 + dest = (void *)SYSMi_GetWork()->romRelocateInfo[ARM7_STATIC].src; + SYSMi_GetWork()->romRelocateInfo[ARM7_STATIC].length = len; + OS_TPrintf("bandbrothers patch : relocate info changed! \n"); + }else + { + // 再配置なし + dest = hs->sub_ram_address; + } + + for(llen = 0; llen < len; ) + { + int rd; + rd = FS_ReadFile( &src, dest, (s32)len ); + if(rd == -1) + { + FS_CloseFile( &src ); + return; + } + dest = (void *)((u32)dest + rd); + llen += rd; + } + if ( !FS_CloseFile( &src ) ) return; + if (len != llen) return; + + OS_TPrintf("bandbrothers patch : apply succeeded! \n"); + } + + return; +} + +// タイトルIDリストの作成 +static void SYSMi_makeTitleIdList( void ) +{ + OSTitleIDList *list = ( OSTitleIDList * )HW_OS_TITLE_ID_LIST; + ROM_Header_Short *hs = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + int l; + u8 count = 0; + int max = AMN_getRomHeaderListLength(); + OSTick start; + + // 時間計測総合 + start = OS_GetTick(); + + // とりあえずゼロクリア + MI_CpuClear8( (void *)HW_OS_TITLE_ID_LIST, HW_OS_TITLE_ID_LIST_SIZE ); + + // これから起動するアプリがTWLアプリでない + if( !hs->platform_code ) + { + return; + } + + for(l=0;ltitleID; + + for(m=0;mmaker_code[m] != pe_hs->maker_code[m]) + { + same_maker_code = FALSE; + } + } + + // 無効なTitleIDはスキップ + if( id == NULL ) + { + continue; + } + + gamecode = (char *)&(id); + + // ランチャーはリストに入れない + if( ( 0 == STD_CompareNString( &gamecode[1], "ANH", 3 ) ) +#ifdef DEV_UIG_LAUNCHER + || ( ( 0 == STD_CompareNString( &gamecode[1], "AN4", 3 ) ) && ( SCFG_GetBondingOption() != 0 ) ) +#endif + ) + { + continue; + } + + if( same_maker_code ) + { + // リストに追加 + list->TitleID[count] = id; + // sameMakerFlagをON + list->sameMakerFlag[count/8] |= (u8)(0x1 << (count%8)); + } + + // ジャンプ可能フラグON or ブートアプリ自身 or ジャンプ元アプリ ならばジャンプ可能 + if( pe_hs->permit_landing_normal_jump || hs->titleID == id || + ( SYSMi_GetWork()->flags.arm7.isValidLauncherParam && SYSM_GetLauncherParamBody()->v1.bootTitleID && ( SYSM_GetLauncherParamBody()->v1.prevTitleID == id ) ) + ) + { + // リストに追加してジャンプ可能フラグON + list->TitleID[count] = id; + list->appJumpFlag[count/8] |= (u8)(0x1 << (count%8)); + } + + // ブートアプリがセキュアアプリの場合 + if( hs->titleID & TITLE_ID_SECURE_FLAG_MASK ) + { + // Prv,Pubそれぞれセーブデータがあるか見て、存在すればフラグON + if(pe_hs->public_save_data_size != 0) + { + list->publicFlag[count/8] |= (u8)(0x1 << (count%8)); + } + if(pe_hs->private_save_data_size != 0) + { + list->privateFlag[count/8] |= (u8)(0x1 << (count%8)); + } + // リストに強制追加 + list->TitleID[count] = id; + }else + { + // セキュアアプリでない && メーカーコードが同じ + if( !(id & TITLE_ID_SECURE_FLAG_MASK) && same_maker_code ) + { + // Prv,Pubそれぞれセーブデータがあるか見て、存在すればフラグON + if(pe_hs->public_save_data_size != 0) + { + list->publicFlag[count/8] |= (u8)(0x1 << (count%8)); + // リストに追加 + list->TitleID[count] = id; + } + if(pe_hs->private_save_data_size != 0) + { + list->privateFlag[count/8] |= (u8)(0x1 << (count%8)); + // リストに追加 + list->TitleID[count] = id; + } + } + } + + // ここまでのうちに、list->TitleID[count]が編集されていたらcountインクリメント + if( list->TitleID[count] != NULL ) + { + count++; + } + } + list->num = count; + // end時間計測総合 + OS_TPrintf("SYSMi_makeTitleIdList : total %dms\n",OS_TicksToMilliSeconds(OS_GetTick() - start)); +} + + +// システムメニューバージョン情報制御データのセット +void SYSM_SetSystemMenuVersionControlData( void ) +{ + int l; + int max = AMN_getRomHeaderListLength(); + + for(l=0;ltitleID; + + gamecode = (char *)&(id); + // バージョン情報の特殊処理 + if( ( 0 == STD_CompareNString( &gamecode[1], "LNH", 3 ) ) ) + { + char path[ FS_ENTRY_LONGNAME_MAX ]; + char *p; + NAM_GetTitleBootContentPathFast(path, id); + p = STD_SearchString( path, ".app" ); + if( p == NULL) + { + // 失敗 + continue; + } + MI_CpuCopy8( p-8, (void *)HW_SYSM_VER_INFO_CONTENT_ID, 8 ); + ((char *)HW_SYSM_VER_INFO_CONTENT_ID )[8] = '\0'; + ((char *)HW_SYSM_VER_INFO_CONTENT_ID )[9] = gamecode[0]; + } + } +} + + +// 指定タイトルがブート可能なポインタかチェック +static BOOL SYSMi_CheckTitlePointer( TitleProperty *pBootTitle ) +{ +#pragma unused( pBootTitle ) + + return TRUE; +} + +#if 0 +void CheckDigest( void ) +{ + int i; + for( i = 0; i < 4; i++ ) { + if( SYSMi_GetWork()->reloc_info[ i ].src ) { + + }else { + } + } +} +#endif + +// 単純リスト要素削除 +static void SYSMi_DeleteElementFromList( u32 *list, u32 index ) +{ + int l; + for( l=(int)index; list[l]!=NULL; l++ ) + { + list[l] = list[l+1]; + } +} +// 単純リスト要素追加 +static void SYSMi_InsertElementToList( u32 *list, u32 index, u32 value ) +{ + int l = (int)index; + while(list[l]!=NULL) + { + l++; + } + list[l+1] = NULL; + for( ; index= start ) + { + break; + } + } + for( m=l; regionlist[m]!=NULL; m++ ) + { + if( regionlist[m] > end ) + { + break; + } + } + // この時点でregionlist[l]およびregionlist[m]は、start <= regionlist[l], end < regionlist[m]で、且つ最も小さな値 + + if( m % 2 == 1 ) + { + SYSMi_InsertElementToList( regionlist, (u32)m, end ); + // endをリストに追加した場合、mは追加した要素を指すように + } + if( l % 2 == 1 ) + { + SYSMi_InsertElementToList( regionlist, (u32)l, start ); + m++; + // startをリストに追加した場合、mは1増える + l++; + // startをリストに追加した場合、lは追加した要素の次の要素を指すように + } + + // regionlist[l]からregionlist[m-1]までの要素を消す + for( n=l; l +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//#define SYSM_LIB_NO_MESSAGE // Printf抑制スイッチ + +#ifdef SYSM_LIB_NO_MESSAGE +#define OS_Printf( ... ) ((void)0) +#define OS_TPrintf( ... ) ((void)0) +#define OS_PutString( ... ) ((void)0) +#endif + +//------------------------------------------------------- +// マウント情報セット +//------------------------------------------------------- + +#ifdef SDK_ARM9 + +// BootSRLPath受け渡し用 +void SYSMi_SetBootSRLPathToWork2( TitleProperty *pBootTitle ); + +#else // !SDK_ARM9 + +// ランチャー用 +void SYSMi_SetLauncherMountInfo( void ); + +// 起動アプリ用 +void SYSMi_SetBootAppMountInfo( TitleProperty *pBootTitle ); + +#endif // SDK_ARM9 + +// UIGランチャーの開発版(4NA*)を開発用CPUに乗ったREDランチャーから +// 起動するためのスイッチ +#define DEV_UIG_LAUNCHER + +#ifdef SDK_ARM9 +//------------------------------------------------------- +// デバイス +//------------------------------------------------------- + +// RTC補正 +void SYSMi_WriteAdjustRTC( void ); + +// RTCチェック +void SYSMi_CheckRTC( void ); + + +#endif // SDK_ARM9 + + +#ifdef SDK_ARM7 +//------------------------------------------------------- +// AES鍵設定 +//------------------------------------------------------- + +// SSLクライアント証明書用 +void SYSMi_SetAESKeysForSSLClientCert( ROM_Header *pROMH, BOOL *pIsClearSlotA ); + +// JPEG署名用(ランチャー、アプリブート共用) +void SYSMi_SetAESKeysForSignJPEG( ROM_Header *pROMH, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC ); + +// アプリブート用 +void SYSMi_SetAESKeysForAccessControl( BOOL isNtrMode, ROM_Header *pROMH ); + +#endif // SDK_ARM7 + + +//======================================================= +// +// ARM9/ARM7共通API +// +//======================================================= +BOOL SYSMi_IsDebuggerBannerViewMode( void ); +BOOL SYSMi_CheckEntryAddress( void ); +BOOL SYSMi_CopyCardRomHeader( void ); +BOOL SYSMi_CopyCardBanner( void ); + + +#ifdef __cplusplus +} +#endif + +#endif // SYSM_INTERNAL_API_H_ diff --git a/build/libraries_sysmenu/sysmenu/common/src/decryptAES.c b/build/libraries_sysmenu/sysmenu/common/src/decryptAES.c new file mode 100644 index 00000000..89672213 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/common/src/decryptAES.c @@ -0,0 +1,477 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: decryptAES.c + + Copyright 2007 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 + +// define data----------------------------------------------------------------- +#define PXI_FIFO_DATA_DECRYPTAES_W_INIT 0 +#define PXI_FIFO_DATA_DECRYPTAES_W_TARGET1 1 +#define PXI_FIFO_DATA_DECRYPTAES_W_TARGET2 2 +#define PXI_FIFO_DATA_DECRYPTAES_NORMAL 3 +#define SYSM_DECODE_AES_MESSAGE_ARRAY_MAX 8 +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +#ifdef SDK_ARM9 +static BOOL s_finished = FALSE; +static void *s_Addr_AESregion[2]; +static u32 s_Size_AESregion[2]; +static BOOL s_initialized = FALSE; +static u8 s_initCounterAES[2][AES_BLOCK_SIZE]; +static OSMessageQueue msgQ4arm9; +static OSMessage msgArray4arm9[SYSM_DECODE_AES_MESSAGE_ARRAY_MAX]; +#else +static OSMessageQueue msgQ4arm7; +static OSMessage msgArray4arm7[SYSM_DECODE_AES_MESSAGE_ARRAY_MAX]; +#endif +// const data------------------------------------------------------------------ + +#ifdef SDK_ARM9 +#include + +// WRAM経由ファイル読み込みのコールバックで使うAESデクリプト処理の初期化 +BOOL SYSM_InitDecryptAESRegion_W( ROM_Header_Short *hs ) +{ + // AESデクリプト領域アドレスの算出と保存 + // ヘッダ情報から、AESデクリプトが必要な領域のアドレスとサイズ + // (最終的な配置ではなく、ランチャーによってアプリがメモリにロードされた状態でのアドレス) + // を算出、保存する + // ここで保存したアドレスを使って、順次読み込んだ領域と比較しながらデクリプト処理を行う + // カードにも対応する場合、セキュア領域の退避についても考慮する必要あり + // ついでに7側に飛んで、鍵やらIDのセットも済ませておく + void *region_addr[2]; + u32 region_size[2]; + u32 region_offset[2]; + u32 module_offset[4]; + u32 module_size[4]; + void *module_addr[4]; + int l, m; + + // AES有効? + if( !hs->enable_aes ) + { + OS_TPrintf( "SYSM_InitDecryptAESRegion(arm9):AES disabled.\n" ); + s_initialized = FALSE; + return FALSE; + } + + module_offset[0] = hs->main_rom_offset; + module_offset[1] = hs->sub_rom_offset; + module_offset[2] = hs->main_ltd_rom_offset; + module_offset[3] = hs->sub_ltd_rom_offset; + module_size[0] = hs->main_size; + module_size[1] = hs->sub_size; + module_size[2] = hs->main_ltd_size; + module_size[3] = hs->sub_ltd_size; + module_addr[0] = hs->main_ram_address; + module_addr[1] = hs->sub_ram_address; + module_addr[2] = hs->main_ltd_ram_address; + module_addr[3] = hs->sub_ltd_ram_address; + + // 再配置情報があれば、モジュールは再配置情報のsrcのアドレスに格納されている + for( l=0; lromRelocateInfo[l].src != NULL ) + { + module_addr[l] = (void *)SYSMi_GetWork()->romRelocateInfo[l].src; + } + } + + // デクリプト情報算出&格納処理 + region_offset[0] = hs->aes_target_rom_offset; + region_offset[1] = hs->aes_target2_rom_offset; + region_size[0] = hs->aes_target_size; + region_size[1] = hs->aes_target2_size; + s_Addr_AESregion[0] = NULL; + s_Addr_AESregion[1] = NULL; + for( m=0; m<2; m++ ) + { + // デクリプトする暗号化領域の判定とオフセット計算(ARM9flx, ARM9ltd, ARM7flx, ARM7ltdのどれか) + region_addr[m] = NULL; + if( region_size[m] == 0 ) + { + continue; + } + for( l=0; l<4; l++ ) + { + // モジュール配置先の領域(サイズは32バイト単位に補正)に、復号指定領域が含まれているか? + if( module_offset[l] <= region_offset[m] && + region_offset[m] + region_size[m] <= module_offset[l] + MATH_ROUNDUP( module_size[l], SYSM_ALIGNMENT_LOAD_MODULE ) ) + { + region_addr[m] = (void *)( (u32)module_addr[l] + (region_offset[m] - module_offset[l]) ); + break; + } + } + if( region_addr[m] == NULL ) + { + continue; + } + + // Workに暗号化領域情報を格納 + s_Addr_AESregion[m] = region_addr[m]; + s_Size_AESregion[m] = region_size[m]; + } + + if(region_addr[0] == NULL && region_addr[1] == NULL) + { + // ターゲット1も2も存在しないor設定オフセットがおかしい + OS_TPrintf( "SYSM_InitDecryptAESRegion(arm9):No targets.\n" ); + s_initialized = FALSE; + return FALSE; + } + + // Workに開発/製品情報を格納 + SYSMi_GetWork()->isDeveloperAESMode = ( hs->developer_encrypt_old || hs->exFlags.developer_encrypt ) ? TRUE : FALSE; + + // カウンタの初期値記録 + MI_CpuCopy8( hs->main_static_digest, s_initCounterAES[0], AES_BLOCK_SIZE ); // 領域1初期値 + MI_CpuCopy8( hs->sub_static_digest, s_initCounterAES[1], AES_BLOCK_SIZE ); // 領域2初期値 + + // Workに「鍵」or「シードとゲームコード」をセット + if( hs->developer_encrypt_old || hs->exFlags.developer_encrypt ) + { + MI_CpuCopy8( hs->title_name, SYSMi_GetWork()->keyAES, AES_KEY_SIZE ); + }else + { + MI_CpuCopy8( hs->main_ltd_static_digest, SYSMi_GetWork()->seedAES, AES_KEY_SIZE ); + MI_CpuCopy8( hs->game_code, SYSMi_GetWork()->idAES, GAME_CODE_MAX ); + } + + // ARM7に開始通知 + s_finished = FALSE; + while( PXI_SendWordByFifo(PXI_FIFO_TAG_DECRYPTAES, PXI_FIFO_DATA_DECRYPTAES_W_INIT, FALSE) != PXI_FIFO_SUCCESS ) + { + OS_TPrintf( "SYSM_InitDecryptAESRegion(arm9):ARM9 PXI send error.\n" ); + } + + // ARM7からの完了通知を受け取って完了 + OS_ReceiveMessage(&msgQ4arm9, (OSMessage*)&s_finished, OS_MESSAGE_BLOCK); + + OS_TPrintf( "SYSM_InitDecryptAESRegion(arm9):Init finished.\n" ); + s_initialized = TRUE; + return TRUE; +} + +// WRAM経由ファイル読み込みのコールバックで使うAESデクリプト処理関数 +// 注意:キャッシュケア済み、WRAMが7に倒れ済みである事を前提とする +void SYSM_StartDecryptAESRegion_W( const void *wram_addr, const void *orig_addr, u32 size ) +{ + int l; + if( !s_initialized ) + { + return; + } + + SYSMi_GetWork()->addr_AESregion[0] = NULL; + SYSMi_GetWork()->addr_AESregion[1] = NULL; + // target1と2について両方調べる + for( l=0;l<2;l++ ) + { + u32 start; + u32 end; + + // AESデクリプト領域と、ファイルからWRAMに読み込んできた領域の目的地の比較 + if( ( ((u32)orig_addr + size) < (u32)s_Addr_AESregion[l] ) || + ( ((u32)s_Addr_AESregion[l] + s_Size_AESregion[l]) < (u32)orig_addr ) + ) + { + continue; + } + + // 上で比較した結果、共通部分があればデクリプトする領域なので括り出す + start = ( orig_addr < s_Addr_AESregion[l] ) ? (u32)s_Addr_AESregion[l] : (u32)orig_addr; + end = ( (u32)orig_addr + size < (u32)s_Addr_AESregion[l] + s_Size_AESregion[l] ) ? + (u32)orig_addr + size : (u32)s_Addr_AESregion[l] + s_Size_AESregion[l]; + + // デクリプトする領域のアドレスとサイズ(WRAMに読み込んだ状態でのアドレスとサイズ)をWORKに記録 + SYSMi_GetWork()->addr_AESregion[l] = (void *)( (s32)wram_addr + (start - (u32)orig_addr) ); + SYSMi_GetWork()->size_AESregion[l] = end - start; + + // 対象となる領域をデクリプトする際に必要なカウンタの値も算出してWORKに入れておく + MI_CpuCopy8( s_initCounterAES[l], SYSMi_GetWork()->counterAES[l], AES_BLOCK_SIZE ); + AESi_AddToCounter( (AESCounter *)SYSMi_GetWork()->counterAES[l], (start - (u32)s_Addr_AESregion[l]) / AES_BLOCK_SIZE ); +// OS_TPrintf( "SYSM_StartDecryptAESRegion_W(arm9):wramaddr:0x%0.8x start:0x%0.8x end:0x%0.8x counter offset: %d.\n",wram_addr, start,end,(start - (u32)s_Addr_AESregion[l]) / AES_BLOCK_SIZE ); + + // 7にデクリプトしてもらう(target1なのか2なのかFIFOで送る) + s_finished = FALSE; + while( PXI_SendWordByFifo(PXI_FIFO_TAG_DECRYPTAES, (u32)(PXI_FIFO_DATA_DECRYPTAES_W_TARGET1 + l), FALSE) != PXI_FIFO_SUCCESS ) + { + OS_TPrintf( "SYSM_StartDecryptAESRegion_W(arm9):ARM9 PXI send error.\n" ); + } + // ARM7からの完了通知を受け取って完了 + OS_ReceiveMessage(&msgQ4arm9, (OSMessage*)&s_finished, OS_MESSAGE_BLOCK); + } +} + +// べた書きAESデクリプト処理 +void SYSM_StartDecryptAESRegion( ROM_Header_Short *hs ) +{ + void *region_addr[2]; + u32 region_size[2]; + u32 region_offset[2]; + u32 module_offset[4]; + u32 module_size[4]; + void *module_addr[4]; + int l, m; + + // AES有効? + if( !hs->enable_aes ) + { + OS_TPrintf( "SYSM_StartDecryptAESRegion(arm9):AES disabled.\n" ); + return; + } + + module_offset[0] = hs->main_rom_offset; + module_offset[1] = hs->sub_rom_offset; + module_offset[2] = hs->main_ltd_rom_offset; + module_offset[3] = hs->sub_ltd_rom_offset; + module_size[0] = hs->main_size; + module_size[1] = hs->sub_size; + module_size[2] = hs->main_ltd_size; + module_size[3] = hs->sub_ltd_size; + module_addr[0] = hs->main_ram_address; + module_addr[1] = hs->sub_ram_address; + module_addr[2] = hs->main_ltd_ram_address; + module_addr[3] = hs->sub_ltd_ram_address; + + // 再配置情報があれば、モジュールは再配置情報のsrcのアドレスに格納されている + for( l=0; lromRelocateInfo[l].src != NULL ) + { + module_addr[l] = (void *)SYSMi_GetWork()->romRelocateInfo[l].src; + } + } + + // デクリプト情報算出&格納処理 + region_offset[0] = hs->aes_target_rom_offset; + region_offset[1] = hs->aes_target2_rom_offset; + region_size[0] = hs->aes_target_size; + region_size[1] = hs->aes_target2_size; + SYSMi_GetWork()->addr_AESregion[0] = NULL; + SYSMi_GetWork()->addr_AESregion[1] = NULL; + for( m=0; m<2; m++ ) + { + // デクリプトする暗号化領域の判定とオフセット計算(ARM9flx, ARM9ltd, ARM7flx, ARM7ltdのどれか) + region_addr[m] = NULL; + if( region_size[m] == 0 ) + { + continue; + } + for( l=0; l<4; l++ ) + { + // モジュール配置先の領域(サイズは32バイト単位に補正)に、復号指定領域が含まれているか? + if( module_offset[l] <= region_offset[m] && + region_offset[m] + region_size[m] <= module_offset[l] + MATH_ROUNDUP( module_size[l], SYSM_ALIGNMENT_LOAD_MODULE ) ) + { + region_addr[m] = (void *)( (u32)module_addr[l] + (region_offset[m] - module_offset[l]) ); + break; + } + } + if( region_addr[m] == NULL ) + { + continue; + } + + // 領域のキャッシュをフラッシュ + DC_FlushRange( region_addr[m], region_size[m] ); + + // Workに暗号化領域情報を格納 + SYSMi_GetWork()->addr_AESregion[m] = region_addr[m]; + SYSMi_GetWork()->size_AESregion[m] = region_size[m]; + + } + + if(region_addr[0] == NULL && region_addr[1] == NULL) + { + // ターゲット1も2も存在しないor設定オフセットがおかしい + OS_TPrintf( "SYSM_StartDecryptAESRegion(arm9):No targets.\n" ); + return; + } + + // Workに開発/製品情報を格納 + SYSMi_GetWork()->isDeveloperAESMode = ( hs->developer_encrypt_old || hs->exFlags.developer_encrypt ) ? TRUE : FALSE; + + // Workにカウンタの初期値セット + MI_CpuCopy8( hs->main_static_digest, SYSMi_GetWork()->counterAES[0], AES_BLOCK_SIZE ); // 領域1初期値 + MI_CpuCopy8( hs->sub_static_digest, SYSMi_GetWork()->counterAES[1], AES_BLOCK_SIZE ); // 領域2初期値 + + // Workに「鍵」or「シードとゲームコード」をセット + if( hs->developer_encrypt_old || hs->exFlags.developer_encrypt ) + { + MI_CpuCopy8( hs->title_name, SYSMi_GetWork()->keyAES, AES_KEY_SIZE ); + }else + { + MI_CpuCopy8( hs->main_ltd_static_digest, SYSMi_GetWork()->seedAES, AES_KEY_SIZE ); + MI_CpuCopy8( hs->game_code, SYSMi_GetWork()->idAES, GAME_CODE_MAX ); + } + + // ARM7に開始通知 + s_finished = FALSE; + while( PXI_SendWordByFifo(PXI_FIFO_TAG_DECRYPTAES, PXI_FIFO_DATA_DECRYPTAES_NORMAL, FALSE) != PXI_FIFO_SUCCESS ) + { + OS_TPrintf( "SYSM_StartDecryptAESRegion(arm9):ARM9 PXI send error.\n" ); + } + + // ARM7からの完了通知を受け取って完了 + OS_ReceiveMessage(&msgQ4arm9, (OSMessage*)&s_finished, OS_MESSAGE_BLOCK); + + OS_TPrintf( "SYSM_StartDecryptAESRegion(arm9):AES decryption finished.\n" ); +} + +#else //SDK_ARM7 + +#include +#include +#include + +static AESCounter aesCounter; + +#define DMA_SEND 2 +#define DMA_RECV 3 +static void ReplaceWithAes( void* ptr, u32 size ) +{ + AES_Lock(); + AES_Reset(); + AES_Reset(); + AES_WaitKey(); + AES_LoadKey( AES_KEY_SLOT_A ); + AES_WaitKey(); + AES_DmaSend( DMA_SEND, ptr, size, NULL, NULL ); + AES_DmaRecv( DMA_RECV, ptr, size, NULL, NULL ); + AES_SetCounter( &aesCounter ); + AES_Run( AES_MODE_CTR, 0, size / AES_BLOCK_SIZE, NULL, NULL ); + AES_AddToCounter( &aesCounter, size / AES_BLOCK_SIZE ); + MI_WaitNDma( DMA_RECV ); + AES_Unlock(); +} + +static void SYSMi_SetKeys( void ) +{ + if ( !SYSMi_GetWork()->isDeveloperAESMode ) + { + AESi_InitKeysForApp( SYSMi_GetWork()->idAES ); + } + + // 開発なら鍵セット、製品ならシードセット + AES_Lock(); + AES_WaitKey(); + if ( SYSMi_GetWork()->isDeveloperAESMode ) + { + AES_SetKeyA( (AESKey*)SYSMi_GetWork()->keyAES ); + } + else + { + AES_SetKeySeedA( (AESKeySeed*)SYSMi_GetWork()->seedAES ); + } + AES_Unlock(); +} + +static void SYSMi_DecryptAESRegion_sub( int target ) +{ + if( SYSMi_GetWork()->addr_AESregion[target]==NULL ) + { + OS_TPrintf( "SYSMi_DecryptAESRegion_sub(arm7):Target%d Addr Error!\n",target+1 ); + return; + } + + // カウンタの初期値セット + MI_CpuCopy8( SYSMi_GetWork()->counterAES[target], &aesCounter, AES_BLOCK_SIZE ); + + // 鍵ロードして暗号化領域の復号開始 + ReplaceWithAes( SYSMi_GetWork()->addr_AESregion[target], MATH_ROUNDUP( SYSMi_GetWork()->size_AESregion[target] ,32 ) ); +// OS_TPrintf( "SYSMi_DecryptAESRegion_sub(arm7):target:%d addr:0x%0.8x size:0x%x\n",target+1, SYSMi_GetWork()->addr_AESregion[target], SYSMi_GetWork()->size_AESregion[target] ); +} + +#endif //ifdef SDK_ARM9 + +static void SYSMi_CallbackDecryptAESRegion(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused(tag) +#pragma unused(data) +#pragma unused(err) + +#ifdef SDK_ARM9 + if(!OS_SendMessage(&msgQ4arm9, (OSMessage)TRUE, OS_MESSAGE_NOBLOCK)) + { + OS_TPrintf( "SYSMi_CallbackDecryptAESRegion(arm9):Message send error.\n" ); + } +#else //SDK_ARM7 + if(!OS_SendMessage(&msgQ4arm7, (OSMessage)data, OS_MESSAGE_NOBLOCK)) + { + OS_TPrintf( "SYSMi_CallbackDecryptAESRegion(arm7):Message send error.\n" ); + } +#endif //ifdef SDK_ARM9 +} + +#ifdef SDK_ARM7 +#define SYSM_AES_THREAD_STACK_SIZE 512 +#define AES_THREAD_PRIORITY 5 +static OSThread aes_thread; +static u64 aes_thread_stack[SYSM_AES_THREAD_STACK_SIZE/sizeof(u64)]; + +static void SYSMi_DecryptAESThread(void* arg) +{ +#pragma unused(arg) + int aes_start; + while(1) + { + OS_ReceiveMessage(&msgQ4arm7, (OSMessage*)&aes_start, OS_MESSAGE_BLOCK); + + if(aes_start == PXI_FIFO_DATA_DECRYPTAES_W_INIT) + { + SYSMi_SetKeys(); + }else if(aes_start == PXI_FIFO_DATA_DECRYPTAES_W_TARGET1 || aes_start == PXI_FIFO_DATA_DECRYPTAES_W_TARGET2) + { + int target = (int)(aes_start - PXI_FIFO_DATA_DECRYPTAES_W_TARGET1); + SYSMi_DecryptAESRegion_sub( target ); + }else if(aes_start == PXI_FIFO_DATA_DECRYPTAES_NORMAL) + { + int l; + SYSMi_SetKeys(); + for( l=0; l<2; l++ ) + { + SYSMi_DecryptAESRegion_sub( l ); + } + } + + // ARM9に完了通知 + while( PXI_SendWordByFifo(PXI_FIFO_TAG_DECRYPTAES, 0, FALSE) != PXI_FIFO_SUCCESS ) + { + OS_TPrintf( "SYSM_StartDecryptAESRegion(arm7):ARM7 PXI send error.\n" ); + } + } +} +#endif + +void SYSM_InitDecryptAESPXICallback( void ) +{ + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_DECRYPTAES, SYSMi_CallbackDecryptAESRegion); +#ifdef SDK_ARM9 + OS_InitMessageQueue(&msgQ4arm9, msgArray4arm9, SYSM_DECODE_AES_MESSAGE_ARRAY_MAX); +#else + OS_InitMessageQueue(&msgQ4arm7, msgArray4arm7, SYSM_DECODE_AES_MESSAGE_ARRAY_MAX); + // ARM7側の処理を行うためのスレッド開始 + OS_CreateThread(&aes_thread, SYSMi_DecryptAESThread, 0, + (void*)(aes_thread_stack + (SYSM_AES_THREAD_STACK_SIZE/sizeof(u64))), + SYSM_AES_THREAD_STACK_SIZE, AES_THREAD_PRIORITY); + OS_WakeupThreadDirect(&aes_thread); +#endif +} \ No newline at end of file diff --git a/build/libraries_sysmenu/sysmenu/common/src/mountInfo.c b/build/libraries_sysmenu/sysmenu/common/src/mountInfo.c new file mode 100644 index 00000000..4718dff3 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/common/src/mountInfo.c @@ -0,0 +1,371 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SYSM_lib.c + + Copyright 2007 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 "internal_api.h" + +//#define USE_SHARED2_FILE_OLD_FORMAT + +#ifndef SDK_ARM9 + +// define data----------------------------------------------------------------- +#define DEFAULT_MOUNT_LIST_NUM 9 +#define NAND_MOUNT_INDEX 0 +#define NAND2_MOUNT_INDEX 1 +#define CONTENT_MOUNT_INDEX 2 +#define SHARED1_MOUNT_INDEX 3 +#define SHARED2_MOUNT_INDEX 4 +#define PRV_SAVE_DATA_MOUNT_INDEX 6 // プライベートセーブデータの s_defaultMountInfo リストインデックス +#define PUB_SAVE_DATA_MOUNT_INDEX 7 // パブリック セーブデータの s_defaultMountInfo リストインデックス +#define SDMC_MOUNT_INDEX 8 + +#define TITLEID_APP_SYS_FLAG_SHIFT ( 32 + 0 ) +#define TITLEID_NOT_LAUNCH_FLAG_SHIFT ( 32 + 1 ) +#define TITLEID_MEDIA_NAND_FLAG_SHIFT ( 32 + 2 ) +#define TITLEID_APP_SYS_FLAG ( 1ULL << TITLEID_APP_SYS_FLAG_SHIFT ) +#define TITLEID_NOT_LAUNCH_FLAG ( 1ULL << TITLEID_NOT_LAUNCH_FLAG_SHIFT ) +#define TITLEID_MEDIA_NAND_FLAG ( 1ULL << TITLEID_MEDIA_NAND_FLAG_SHIFT ) + +// extern data----------------------------------------------------------------- +// function's prototype-------------------------------------------------------- +static void SYSMi_SetBootSRLPath( LauncherBootType bootType, NAMTitleId titleID ); +static void SYSMi_SetMountInfoCore( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pSrc, OSMountInfo *pDst ); +static void SYSMi_ModifySaveDataMount( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pMountTgt, ROM_Header_Short *pROMH ); +static void SYSMi_ModifyShared2FileMount( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pMountTgt ); + +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +// const data------------------------------------------------------------------ + +// デフォルトマウント情報リスト +OSMountInfo s_defaultMountList[ DEFAULT_MOUNT_LIST_NUM ] ATTRIBUTE_ALIGN(4) = { +// drive device target pertitionIdx resource userPermission rsvA B archive path + { 'A', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand", "/" }, // ユーザーアプリはこのアーカイブではR/W不可 + { 'B', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_ROOT, 1, OS_MOUNT_RSC_WRAM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "nand2", "/" }, // ユーザーアプリはこのアーカイブではR/W不可 + { 'C', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R), 0, 0, "content", NULL }, // Write不可 + { 'D', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R), 0, 0, "shared1", "nand:/shared1" }, // Write不可 +#ifdef USE_SHARED2_FILE_OLD_FORMAT + { 'E', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "shared2", NULL }, // アプリ間共有ファイル +#else + { 'E', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "shared2", "nand:/shared2" }, // アプリ間共有ファイル +#endif + { 'F', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_DIR, 1, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "photo", "nand2:/photo" }, + { 'G', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPrv", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。 + { 'H', OS_MOUNT_DEVICE_NAND, OS_MOUNT_TGT_FILE, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "dataPub", NULL }, // NANDにセーブデータがないアプリの場合は、マウントされない。 + { 'I', OS_MOUNT_DEVICE_SD, OS_MOUNT_TGT_ROOT, 0, OS_MOUNT_RSC_MMEM, (OS_MOUNT_USR_R|OS_MOUNT_USR_W), 0, 0, "sdmc", "/" }, +}; + +// ============================================================================ +// +// マウント情報セット +// +// ============================================================================ + +// ランチャーのマウント情報セット +void SYSMi_SetLauncherMountInfo( void ) +{ + OSMountInfo mountListBuffer[ DEFAULT_MOUNT_LIST_NUM ] ATTRIBUTE_ALIGN(4); + ROM_Header_Short *header = ( ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + NAMTitleId titleID = (( ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF)->titleID; + + // デフォルトリストをバッファにコピー + MI_CpuCopyFast( s_defaultMountList, mountListBuffer, sizeof(s_defaultMountList) ); + + // bootSRLパスの設定は、ランチャーが自分で設定するのは厄介なので、NANDファームから引き渡してもらう + + // SDカードアクセス要求がない場合は、sdmcをマウントしない。 + if( header->access_control.sd_card_access == 0 ) { + mountListBuffer[ SDMC_MOUNT_INDEX ].drive[ 0 ] = 0; + } + + // セーブデータ有無によるマウント情報の編集 + // ※このタイミングではFSは動かせないので、FSを使わない特別版で対応。 + SYSMi_ModifySaveDataMount( LAUNCHER_BOOTTYPE_NAND, + titleID, + &mountListBuffer[ PRV_SAVE_DATA_MOUNT_INDEX ], + ( ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF + ); +#ifdef USE_SHARED2_FILE_OLD_FORMAT + // 2008.06.20 shared2仕様変更に伴い、無効にする + // Shared2のアプリ間共有ファイルセット(LAUNCHERで使うかどうかは微妙) + SYSMi_ModifyShared2FileMount( LAUNCHER_BOOTTYPE_NAND, + titleID, + &mountListBuffer[ SHARED2_MOUNT_INDEX ] ); +#endif + + // マウント情報のセット + SYSMi_SetMountInfoCore( LAUNCHER_BOOTTYPE_NAND, + titleID, + &mountListBuffer[0], + (OSMountInfo *)header->sub_mount_info_ram_address ); +} + + +// SYSM_TWL_MOUNT_INFO_TMP_BUFFERに、ブートするアプリのマウント情報を登録する +void SYSMi_SetBootAppMountInfo( TitleProperty *pBootTitle ) +{ + OSMountInfo mountListBuffer[ DEFAULT_MOUNT_LIST_NUM ] ATTRIBUTE_ALIGN(4); + ROM_Header_Short *pROMH = ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF; + // アプリがTWL対応でない場合は、何もセットせずにリターン + if( ( pROMH->platform_code ) == 0 ) { + return; + } + + // 起動アプリのSRLパスをセット +// SYSMi_SetBootSRLPath( (LauncherBootType)pBootTitle->flags.bootType, +// pBootTitle->titleID ); + + STD_CopyLStringZeroFill( (char *)(SYSM_TWL_MOUNT_INFO_TMP_BUFFER + SYSM_MOUNT_INFO_SIZE), + SYSMi_GetWork2()->bootContentPath, OS_MOUNT_PATH_LEN ); + + // デフォルトリストをバッファにコピー + MI_CpuCopyFast( s_defaultMountList, mountListBuffer, sizeof(s_defaultMountList) ); + + // セキュアアプリでない場合、"nand:", "nand2:"アーカイブをNAに変更。 + if( ( pBootTitle->titleID & TITLE_ID_SECURE_FLAG_MASK ) == 0 ) { + mountListBuffer[ NAND_MOUNT_INDEX ].userPermission = 0; // "nand:" + mountListBuffer[ NAND2_MOUNT_INDEX ].userPermission = 0; // "nand2:" + } + + // 2008.06.26 contentとshared2はマウントしない方針とする。 + mountListBuffer[ CONTENT_MOUNT_INDEX ].drive[ 0 ] = 0; + mountListBuffer[ SHARED2_MOUNT_INDEX ].drive[ 0 ] = 0; + + { + int i; + u16 notMount = 0x0000; + + // カードアプリは、content, dataPub, dataPrv をマウントしない。 + if( ( pBootTitle->titleID & TITLEID_MEDIA_NAND_FLAG ) == 0 ) { + notMount |= ( 0x0001 << CONTENT_MOUNT_INDEX ) | + ( 0x0001 << PRV_SAVE_DATA_MOUNT_INDEX ) | + ( 0x0001 << PUB_SAVE_DATA_MOUNT_INDEX ); + } + + // TMPジャンプアプリは、contentをマウントしない + if( (LauncherBootType)pBootTitle->flags.bootType == LAUNCHER_BOOTTYPE_TEMP ) + { + notMount |= ( 0x0001 << CONTENT_MOUNT_INDEX ); + } + + // SDカードアクセス要求がない場合は、sdmcをマウントしない。 + if( pROMH->access_control.sd_card_access == 0 ) { + notMount |= ( 0x0001 << SDMC_MOUNT_INDEX ); + } + + // NANDアクセス要求がない場合は、NAND関係のドライブを全てマウントしない。 + if( pROMH->access_control.nand_access == 0 ) { + notMount |= 0x00ff; + } + + // アクセス不可なドライブを無効にする。 + for( i = 0; i < DEFAULT_MOUNT_LIST_NUM; i++ ) { + if( notMount & ( 0x0001 << i ) ) { + mountListBuffer[ i ].drive[ 0 ] = 0; + } + } + } + + // セーブデータ有無によるマウント情報の編集 + // ※ARM7ではNAMは動かせないので、NAMを使わないバージョンで対応。 + SYSMi_ModifySaveDataMount( LAUNCHER_BOOTTYPE_NAND, + pBootTitle->titleID, + &mountListBuffer[ PRV_SAVE_DATA_MOUNT_INDEX ], + ( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF + ); + +#if 0 + // 2008.06.20 shared2仕様変更に伴い、無効にする + // Shared2のアプリ間共有ファイルセット + SYSMi_ModifyShared2FileMount( LAUNCHER_BOOTTYPE_NAND, + pBootTitle->titleID, + &mountListBuffer[ SHARED2_MOUNT_INDEX ] ); +#endif + + // マウント情報のセット + SYSMi_SetMountInfoCore( (LauncherBootType)pBootTitle->flags.bootType, + pBootTitle->titleID, + &mountListBuffer[0], + (OSMountInfo *)SYSM_TWL_MOUNT_INFO_TMP_BUFFER ); + + /* + ※※ 注意 ※※ + MountInfoは、FSで直接参照してアクセス許可状態を判定しているため、ここにアプリ用のデータをセットすると、 + その後はパーミッションの都合上FSライブラリおよびFSを使用したESやNAMライブラリが全く使用できなくなる。(今後パーミッション仕様については変更される可能性あり) + よって、内部でFSライブラリを使用する処理は、本処理の前に完了しておく必要がある。 + */ +} + +// マウント情報を指定されたアドレスに書き込み +static void SYSMi_SetMountInfoCore( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pSrc, OSMountInfo *pDst ) +{ +#pragma unused(bootType) + + int i; + char contentpath[ FS_ENTRY_LONGNAME_MAX ]; + + // タイトルIDからcontentのファイルパスをセット + STD_TSNPrintf( contentpath, FS_ENTRY_LONGNAME_MAX, + "nand:/title/%08x/%08x/content", (u32)( titleID >> 32 ), titleID ); + STD_CopyLStringZeroFill( pSrc[CONTENT_MOUNT_INDEX].path, contentpath, OS_MOUNT_PATH_LEN ); + + MI_CpuClearFast( (void *)pDst, SYSM_MOUNT_INFO_SIZE ); + + // セット + for( i = 0; i < DEFAULT_MOUNT_LIST_NUM; i++ ) { + if( pSrc->drive[ 0 ] ) { + MI_CpuCopyFast( pSrc, pDst, sizeof(OSMountInfo) ); + pDst++; + } + pSrc++; + } + +#if 0 + pDst = (OSMountInfo *)pDst; + for( i = 0; i < DEFAULT_MOUNT_LIST_NUM; i++ ) { + OS_TPrintf( "mount path : %s\n", pDst->path ); + pDst++; + } +#endif +} + +#ifdef USE_SHARED2_FILE_OLD_FORMAT +// 2008.06.20 shared2仕様変更に伴い、無効にする +#define KB ( 1024 ) +#define MB ( 1024 * 1024 ) +#define SHARED2FILE_SIZE_VALUE_TABLE_LENGTH 9 +static u32 shared2FileSizeValueTable[] = { + 16 * KB, 32 * KB, 64 * KB, 128 * KB, 256 * KB, 512 * KB, + 1 * MB, 2 * MB, 4 * MB +}; + +// shared2ファイルのマウント情報を編集する。 +static void SYSMi_ModifyShared2FileMount( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pMountTgt ) +{ +#pragma unused(bootType,titleID) + int l; + BOOL sizeok = FALSE; + + // NANDアクセス可能でshared2_fileビットが立っていればマウント + if( (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->access_control.nand_access && + (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->access_control.shared2_file ) { + char shared2FilePath[ FS_ENTRY_LONGNAME_MAX ]; + u32 shared2DataSize = (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->shared2_file_size; + + // ファイルパスを取得 + STD_TSNPrintf( shared2FilePath, FS_ENTRY_LONGNAME_MAX, + "nand:/shared2/%04X", (( ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF)->shared2_file_index); + + // サイズチェックしてマウント情報登録 + for(l=0; lpath, shared2FilePath, OS_MOUNT_PATH_LEN ); + }else { + pMountTgt->drive[ 0 ] = 0; + } + + }else { + // 可能でなければshared2マウント無効 + pMountTgt->drive[ 0 ] = 0; + } +} +#endif + + +// タイトルIDをもとにセーブデータ有無を判定して、マウント情報を編集する。 +static void SYSMi_ModifySaveDataMount( LauncherBootType bootType, NAMTitleId titleID, OSMountInfo *pMountTgt, ROM_Header_Short *pROMH ) +{ + int i; + + // ※カードからブートされた場合でも、titleIDが"NANDアプリ"の場合は、セーブデータをマウントするようにしている。 + + // セーブデータ有無を判定して、パスをセット + if( ( ( bootType == LAUNCHER_BOOTTYPE_NAND ) && // NANDアプリがNANDからブートされた時 + ( titleID & TITLEID_MEDIA_NAND_FLAG ) ) || + ( ( bootType == LAUNCHER_BOOTTYPE_ROM ) && // ISデバッガ上で、NANDアプリがROM からブートされた時 + ( titleID & TITLEID_MEDIA_NAND_FLAG ) && + SYSM_IsRunOnDebugger() ) + ) { + char saveFilePath[ 2 ][ FS_ENTRY_LONGNAME_MAX ]; + u32 saveDataSize[ 2 ]; + saveDataSize[ 0 ] = pROMH->private_save_data_size; + saveDataSize[ 1 ] = pROMH->public_save_data_size; + + // セーブデータのファイルパスを取得 + STD_TSNPrintf( saveFilePath[ 0 ], FS_ENTRY_LONGNAME_MAX, + "nand:/title/%08x/%08x/data/private.sav", (u32)( titleID >> 32 ), titleID ); + STD_TSNPrintf( saveFilePath[ 1 ], FS_ENTRY_LONGNAME_MAX, + "nand:/title/%08x/%08x/data/public.sav", (u32)( titleID >> 32 ), titleID ); + + // "ROMヘッダのNANDセーブファイルサイズ > 0" の場合のみマウント情報を登録 + for( i = 0; i < 2; i++ ) { + if( saveDataSize[ i ] ) { + STD_CopyLStringZeroFill( pMountTgt->path, saveFilePath[ i ], OS_MOUNT_PATH_LEN ); + }else { + pMountTgt->drive[ 0 ] = 0; + } + pMountTgt++; + } + }else { + // タイトルID指定なしのカードアプリの場合は、セーブデータ無効 + for( i = 0; i < 2; i++ ) { + pMountTgt->drive[ 0 ] = 0; + } + } +} + +#else //ARM9 + +void SYSMi_SetBootSRLPathToWork2( TitleProperty *pBootTitle ) +{ + static char path[ FS_ENTRY_LONGNAME_MAX ]; + + switch( pBootTitle->flags.bootType ) + { + case LAUNCHER_BOOTTYPE_NAND: + if( NAM_GetTitleBootContentPathFast( path, pBootTitle->titleID ) != NAM_OK ) { + OS_TPrintf( "ERROR: BootContentPath Get failed.\n" ); + } + break; + case LAUNCHER_BOOTTYPE_TEMP: + STD_TSNPrintf( path, FS_ENTRY_LONGNAME_MAX, "nand:/tmp/jump.app", pBootTitle->titleID ); + break; + default: + path[ 0 ] = 0; +// STD_StrCpy( path, (const char*)"rom:" ); // ※SDK2623では、BootSRLPathを"rom:"としたらFSi_InitRomArchiveでNANDアプリ扱いされてアクセス例外で落ちる。 + break; + } + + if( path[ 0 ] ) { + STD_CopyLStringZeroFill( SYSMi_GetWork2()->bootContentPath, path, OS_MOUNT_PATH_LEN ); + }else { + MI_CpuClearFast( SYSMi_GetWork2()->bootContentPath, OS_MOUNT_PATH_LEN ); + } + OS_TPrintf( "boot SRL path : %s\n", SYSMi_GetWork2()->bootContentPath ); // ※OS_Init前で呼ぶとPrintfできないので注意。 +} + +#endif //#ifndef SDK_ARM9 \ No newline at end of file diff --git a/build/libraries_sysmenu/sysmenu/common/src/pxi.c b/build/libraries_sysmenu/sysmenu/common/src/pxi.c new file mode 100644 index 00000000..3a9b61b0 --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/common/src/pxi.c @@ -0,0 +1,256 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: pxi.c + + Copyright 2007 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 "internal_api.h" +#ifdef SDK_ARM7 +#include +#endif // SDK_ARM7 + +#ifdef DHT_TEST +#include +#ifdef SDK_ARM9 +#define DS_HASH_TABLE_SIZE (256*1024) +static u8 dht_buffer[DS_HASH_TABLE_SIZE] ATTRIBUTE_ALIGN(256); +static DHTFile *const dht = (DHTFile*)dht_buffer; +#else +extern DHTFile* dht; +#endif +#endif + +// define data----------------------------------------------------------------- +#define SYSM_PXI_COMM_STAT_REQ 0 +#define SYSM_PXI_COMM_STAT_ACK 1 + +// PXIコマンド +typedef union SYSMPXIPacket { + struct { + u16 data; + u8 cmd; // PXI_FIFOMESSAGE_BITSZ_DATA = 26 + u8 stat : 2; + }; + u32 raw; +}SYSMPXIPacket; + + +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +static volatile BOOL s_sending[SYSM_PXI_COMM_NUM]; +// const data------------------------------------------------------------------ + +// PXI初期化 +#ifdef SDK_ARM9 +void SYSM_InitPXI( void ) +#else // SDK_ARM7 +void SYSM_InitPXI( u32 mcu_prio ) +#endif // SDK_ARM7 +{ + static BOOL isInitialized; + int i; + + if (isInitialized) + { + return; + } + isInitialized = TRUE; + + // マイコンPXI初期化とマイコンバージョン取得 +#ifdef SDK_ARM9 + SYSM_InitMcuPxi(); +#else // SDK_ARM7 + SYSM_InitMcuPxi( mcu_prio ); +#endif // SDK_ARM7 + + for (i=0; i> 8) ); +} +#endif +#endif + +// PXIコマンド送信 +BOOL SYSMi_TrySendPXICommand( SYSMPXICommand cmd, u16 data ) +{ + SYSMPXIPacket packet; + + OSIntrMode saved = OS_DisableInterrupts(); + if( s_sending[cmd] ) + { + OS_RestoreInterrupts( saved ); + return FALSE; + } + s_sending[cmd] = TRUE; + OS_RestoreInterrupts( saved ); + + packet.stat = SYSM_PXI_COMM_STAT_REQ; + packet.cmd = cmd; + packet.data = data; + + while( PXI_SendWordByFifo( SYSMENU_PXI_FIFO_TAG, packet.raw, FALSE) != PXI_FIFO_SUCCESS ) + { + SVC_WaitByLoop(1); + } + + return TRUE; +} + +BOOL SYSMi_SendPXICommand( SYSMPXICommand cmd, u16 data ) +{ + while( ! SYSMi_TrySendPXICommand( cmd, data ) ) + { + OS_WaitAnyIrq(); + } + while( s_sending[cmd] ) + { + OS_WaitAnyIrq(); + } + + return TRUE; +} + +void SYSMi_PXIFifoRecvCallback( PXIFifoTag tag, u32 data, BOOL err ) +{ +#pragma unused( tag, err ) + SYSMPXIPacket packet; + u8 cmd; + packet.raw = data; + cmd = packet.cmd; + + if( packet.stat == SYSM_PXI_COMM_STAT_ACK ) + { + s_sending[cmd] = FALSE; + } + if( packet.stat == SYSM_PXI_COMM_STAT_REQ ) + { + packet.stat = SYSM_PXI_COMM_STAT_ACK; + } + +#ifdef SDK_ARM7 + + switch( cmd ) + { +#ifdef DHT_TEST + case SYSM_PXI_COMM_DS_HASH_TABLE: + dht = (void*)(0x2000000 + (packet.data << 8)); + OS_TPrintf("[ARM7] dht address: %08X\n", dht); + break; +#endif + default: +#ifndef SDK_FINALROM + OS_Panic( "illegal SYSM pxi command." ); +#else + OS_Panic(""); +#endif + break; + } + + // PXI応答返信 + PXI_SendWordByFifo( SYSMENU_PXI_FIFO_TAG, packet.raw, FALSE ); + +#endif // SDK_ARM7 +} diff --git a/build/libraries_sysmenu/sysmenu/common/src/status.c b/build/libraries_sysmenu/sysmenu/common/src/status.c new file mode 100644 index 00000000..cd1e377c --- /dev/null +++ b/build/libraries_sysmenu/sysmenu/common/src/status.c @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: status.c + + Copyright 2007 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 "internal_api.h" + +// define data----------------------------------------------------------------- +// extern data----------------------------------------------------------------- +// function's prototype------------------------------------------------------- +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +// const data------------------------------------------------------------------ + + +// ランチャーパラメータの取得 +const LauncherParamBody *SYSM_GetLauncherParamBody( void ) +{ + return (const LauncherParamBody *)&SYSMi_GetWork()->launcherParam.body; +} + +/*** フラグセット、割り込み禁止つき arm9 ****/ +void SYSM_SetHeaderLoadCompleted( BOOL comp ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isHeaderLoadCompleted = comp; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetLoadFinished( BOOL finish ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isLoadFinished = finish; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetLoadSucceeded( BOOL succeed ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isLoadSucceeded = succeed; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetCardBoot( BOOL card ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isCardBoot = card; + OS_RestoreInterrupts( mode ); +} + +// ロゴデモスキップかどうかをセット +void SYSM_SetLogoDemoSkip( BOOL skip ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isLogoSkip = skip; + OS_RestoreInterrupts( mode ); +} + +// TSD有効/無効をセット +void SYSM_SetValidTSD( BOOL valid ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm9.isValidTSD = valid; + OS_RestoreInterrupts( mode ); +} + +/*** フラグセット、割り込み禁止つき arm7 ****/ +// 必要なさげ + +void SYSM_SetHotStart( BOOL hot ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm7.isHotStart = hot; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetValidLauncherParam( BOOL valid ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm7.isValidLauncherParam = valid; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetResetRTC( BOOL reset ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm7.isResetRTC = reset; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetNANDFatalError( BOOL fatal ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm7.isNANDFatalError = fatal; + OS_RestoreInterrupts( mode ); +} + +void SYSM_SetARM9Start( BOOL start ) +{ + OSIntrMode mode = OS_DisableInterrupts(); + SYSMi_GetWork()->flags.arm7.isARM9Start = start; + OS_RestoreInterrupts( mode ); +} + +/*** ここまで フラグセット関数 ***/ + +// ホットスタートか? +BOOL SYSM_IsHotStart( void ) +{ + return (BOOL)SYSMi_GetWork()->flags.arm7.isHotStart; +} + +// ロゴデモスキップか? +BOOL SYSM_IsLogoDemoSkip( void ) +{ + return (BOOL)SYSMi_GetWork()->flags.arm9.isLogoSkip; +} + +// ISデバッガのバナービューモード起動かどうか? +BOOL SYSMi_IsDebuggerBannerViewMode( void ) +{ + return ( SYSM_IsRunOnDebugger() && + SYSM_IsExistCard() && + SYSMi_GetWork()->romEmuInfo.isForceBannerViewMode ); +} + +// TSD有効? +BOOL SYSM_IsValidTSD( void ) +{ + return (BOOL)SYSMi_GetWork()->flags.arm9.isValidTSD; +} + + +// 有効なTWL/NTRカードが差さっているか? +BOOL SYSM_IsExistCard( void ) +{ + return (BOOL)SYSMi_GetWork()->flags.hotsw.isExistCard; +} + + +// 検査用カードが差さっているか? +BOOL SYSM_IsInspectCard( void ) +{ + return ( SYSM_IsExistCard() && SYSMi_GetWork()->flags.hotsw.isInspectCard ); +} + + +// 有効なTWLカードが差さっているか? +BOOL SYSM_IsTWLCard( void ); +BOOL SYSM_IsTWLCard( void ) +{ + return ( SYSM_IsExistCard() && ( SYSM_GetCardRomHeader()->platform_code & PLATFORM_CODE_FLAG_TWL ) ); +} + + +// 有効なNTRカードが差さっているか? +BOOL SYSM_IsNTRCard( void ); +BOOL SYSM_IsNTRCard( void ) +{ + return ( SYSM_IsExistCard() && ( SYSM_GetCardRomHeader()->platform_code == PLATFORM_CODE_NTR ) ); +} + + +// エントリアドレスの正当性チェック +BOOL SYSMi_CheckEntryAddress( void ) +{ + // エントリアドレスがMMEMもしくはWRAMのロード可能領域外なら、不正と判定。 + if( !( ( (u32)SYSM_GetCardRomHeader()->main_entry_address >= HW_MAIN_MEM ) && + ( (u32)SYSM_GetCardRomHeader()->main_entry_address < HW_TWL_MAIN_MEM_SHARED ) + ) || + !( ( ( (u32)SYSM_GetCardRomHeader()->sub_entry_address >= HW_MAIN_MEM ) && + ( (u32)SYSM_GetCardRomHeader()->sub_entry_address < HW_TWL_MAIN_MEM_SHARED ) ) || + ( ( (u32)SYSM_GetCardRomHeader()->sub_entry_address >= HW_WRAM_BASE ) && + ( (u32)SYSM_GetCardRomHeader()->sub_entry_address < SYSM_NTR_ARM7_LOAD_WRAM_END ) ) + ) || + !( ( (u32)SYSM_GetCardRomHeader()->main_entry_address >= (u32)SYSM_GetCardRomHeader()->main_ram_address ) && + ( (u32)SYSM_GetCardRomHeader()->main_entry_address < (u32)SYSM_GetCardRomHeader()->main_ram_address + SYSM_GetCardRomHeader()->main_size ) + ) || + !( ( (u32)SYSM_GetCardRomHeader()->sub_entry_address >= (u32)SYSM_GetCardRomHeader()->sub_ram_address ) && + ( (u32)SYSM_GetCardRomHeader()->sub_entry_address < (u32)SYSM_GetCardRomHeader()->sub_ram_address + SYSM_GetCardRomHeader()->sub_size ) + ) + ) { + OS_TPrintf("entry address invalid.\n"); + return FALSE; + } + OS_TPrintf("entry address valid.\n"); + return TRUE; +} diff --git a/build/libraries_sysmenu/util/ARM9/Makefile b/build/libraries_sysmenu/util/ARM9/Makefile new file mode 100644 index 00000000..6617cdae --- /dev/null +++ b/build/libraries_sysmenu/util/ARM9/Makefile @@ -0,0 +1,50 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SRCDIR = src +SRCS = util.c \ + masterkey.c \ + util_menuAppManager.c \ + util_recoveryFile.c +#SRCS = util_recoveryFile.c + +TARGET_LIB = libsysmutil$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM9/include \ + $(SYSMENU_ROOT)/build/libraries_sysmenu/sysmenu/common/include + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/util/ARM9/src/masterkey.c b/build/libraries_sysmenu/util/ARM9/src/masterkey.c new file mode 100644 index 00000000..050251d1 --- /dev/null +++ b/build/libraries_sysmenu/util/ARM9/src/masterkey.c @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------* + Project: Sample Test + File: test.c + + Copyright 2005 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. + *---------------------------------------------------------------------------*/ + +#include +#include + +#define CODE_LENGTH 8 + +static u32 Crc32Table[0x100]; + +// Forward references +u32 CalcMasterkey(const u8 *src); + +static void Crc32Init(void) +{ + u32 i, j; + u32 poly = 0xedb88320; + u32 crc; + + for (i = 0; i < 0x100; i++) { + crc = i; + for (j = 8; j > 0; j--) { + if (crc & 1) { + crc = (crc >> 1) ^ poly; + } else { + crc >>= 1; + } + } + Crc32Table[i] = crc; + } +} + +static u32 CalcCrc32(const u8 *src, u32 len) +{ + u32 crc = 0xffffffff; + + while (len) { + crc = ((crc >> 8) & 0xffffffff) ^ Crc32Table[(crc ^ *src) & 0xff]; + src++; + len--; + } + return crc; +} + +u32 CalcMasterkey(const u8 *src) +{ + static u8 initFlag = 0; + u32 key; + + if (initFlag == 0) { + Crc32Init(); + initFlag = 1; + } + + key = ((CalcCrc32(src, CODE_LENGTH) ^ 0xaaaa) + 5313) % 100000; + + return key; +} + +//====================================================================== +// +// マスターキー算出 +// +//====================================================================== +u32 UTL_CalcPCTLMasterKey( void ) +{ + u32 masterKey; + u32 inquiryCode = UTL_CalcPCTLInquiryCode(); + u8 arg[ 9 ]; + RTCDate date; + RTC_Init(); + RTC_GetDate( &date ); + STD_TSPrintf( (char *)arg, "%02d%02d%04d", date.month, date.day, inquiryCode % 10000 ); + masterKey = CalcMasterkey( arg ); + OS_TPrintf( "MasterKey : %05d\n", masterKey ); + return masterKey; +} + + +//====================================================================== +// +// ペアレンタルコントロール問い合わせ番号算出 +// +//====================================================================== +u32 UTL_CalcPCTLInquiryCode( void ) +{ + int i; + u64 num = 0; + u8 *p = (u8 *)# + u8 macAddr[ 6 ]; + u32 inquiryCode; + OS_GetMacAddress( macAddr ); + for( i = 5; i >= 0; i-- ) { + *p++ = macAddr[ i ]; + } + inquiryCode = (u32)( num % 100000000UL ); + OS_TPrintf( "InquiryCode : %08d\n", inquiryCode ); + return inquiryCode; +} + diff --git a/build/libraries_sysmenu/util/ARM9/src/util.c b/build/libraries_sysmenu/util/ARM9/src/util.c new file mode 100644 index 00000000..8b95a8a2 --- /dev/null +++ b/build/libraries_sysmenu/util/ARM9/src/util.c @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util.c + + Copyright 2007 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 + +// define data------------------------------------------ +#define TP_CL_CONFIRM_MARGIN 4 // TPキャリブレーションの座標マージン(キャリブレーション後の座標での値) + +// extern data------------------------------------------ +// function's prototype declaration--------------------- +static s64 UTLi_CalcRTCSecOffset( RTCDate *datep, RTCTime *timep ); +static u64 s_fatalError = 0; + +// global variable ------------------------------------- +// static variable ------------------------------------- +// const data ----------------------------------------- +// function's description------------------------------- + + +//====================================================================== +// バックライト +//====================================================================== + +// バックライト輝度セット +u32 UTL_SetBacklightBrightness( u8 brightness ) +{ + brightness %= ( BACKLIGHT_BRIGHTNESS_MAX + 1 ); + return PM_SendUtilityCommand( PMi_UTIL_SET_BACKLIGHT_BRIGHTNESS, (u16)brightness, NULL ); +} + + +// バックライト輝度 +u32 UTL_GetBacklightBrightness( u8 *pBrightness ) +{ + u16 status; + u32 result = PM_SendUtilityCommand( PM_UTIL_GET_STATUS, PMi_UTIL_GET_BACKLIGHT_BRIGHTNESS, &status); + + if ( result == PM_RESULT_SUCCESS ) + { + if (pBrightness) + { + *pBrightness = (u8)status; + } + } + return result; +} + + +//====================================================================== +// タッチパネル +//====================================================================== + +// タッチパネルキャリブレーション +void UTL_CaribrateTP( const LCFGTWLTPCalibData *pCalib ) +{ + TPCalibrateParam calibParam; + + // TPキャリブレーション + ( void )TP_CalcCalibrateParam( &calibParam, // タッチパネル初期化 + pCalib->data.raw_x1, pCalib->data.raw_y1, (u16)pCalib->data.dx1, (u16)pCalib->data.dy1, + pCalib->data.raw_x2, pCalib->data.raw_y2, (u16)pCalib->data.dx2, (u16)pCalib->data.dy2 ); + TP_SetCalibrateParam( &calibParam ); + OS_TPrintf("TP_calib: %4d %4d %4d %4d %4d %4d\n", + pCalib->data.raw_x1, pCalib->data.raw_y1, (u16)pCalib->data.dx1, (u16)pCalib->data.dy1, + pCalib->data.raw_x2, pCalib->data.raw_y2, (u16)pCalib->data.dx2, (u16)pCalib->data.dy2 ); +} + + +// キャリブレーションが正常に行われたかチェック +BOOL UTL_IsValidCalibration( u16 x, u16 y, u16 correct_x, u16 correct_y ) +{ + return !( x < correct_x - TP_CL_CONFIRM_MARGIN || + x > correct_x + TP_CL_CONFIRM_MARGIN || + y < correct_y - TP_CL_CONFIRM_MARGIN || + y > correct_y + TP_CL_CONFIRM_MARGIN ); +} + + +//====================================================================== +// スリープ +//====================================================================== + +// スリープモードへの遷移 +void UTL_GoSleepMode( void ) +{ + // 蓋閉じ判定 + if ( ! PAD_DetectFold() ) + { + return; + } + + // デバッガ接続中だけはスリープに入らない(蓋閉じでもデバッガが起動するように) + if ( !SYSM_IsRunOnDebugger() || (OSi_DetectDebugger() & OS_CONSOLE_TWLDEBUGGER) ) + { + // カード抜け無検出設定 + // TWLではゲームカードの再ロードが可能なため + // スリープ時のカード抜け検出を無効化 + // (DS-IPLではゲームカードが起動できなくなるので + // レジューム時のROM-IDチェックでエラーになると + // シャットダウンしていた) + OSIntrMode enable = OS_DisableInterrupts(); + reg_MI_MCCNT0 &= ~REG_MI_MCCNT0_I_MASK; + OS_ResetRequestIrqMask( OS_IE_CARD_IREQ ); + OS_RestoreInterrupts( enable ); + + // スリープ遷移 + PM_GoSleepMode( PM_TRIGGER_COVER_OPEN, + 0, + 0 ); + } +} + + +//====================================================================== +// RTCオフセット制御 +//====================================================================== + +// RTCに新しい設定値をセットして、その値をもとにrtcOffset値を算出する。 +s64 UTL_CalcRTCOffset( RTCDate *newDatep, RTCTime *newTimep ) +{ + RTCDate oldDate; + RTCTime oldTime; + s64 offset0; + s64 offset1; + s64 offset; + u32 second_bak = newTimep->second; + int retry = 3; + + newTimep->second = 0; + + // ライト直前に現在のRTC値を取得する。 + while( retry > 0 ) { + if( RTC_RESULT_SUCCESS == RTC_GetDateTime( &oldDate, &oldTime ) ) { + oldTime.second = 0; + break; + } + OS_Sleep(1); + retry--; + } + if( retry == 0 ) { + // 現在時刻の取得に失敗した時は、新しいセット値を古い値にも使う + MI_CpuCopy8( newDatep, &oldDate, sizeof(RTCDate) ); + MI_CpuCopy8( newTimep, &oldTime, sizeof(RTCTime) ); + } + + // RTC設定時は、今回の設定でどれだけRTC値が変化したか(秒オフセット単位)を算出。 + if( ( oldDate.year < LCFG_TSD_GetRTCLastSetYear() ) && ( LCFG_TSD_IsFinishedInitialSetting() ) ) { + oldDate.year += 100; // 前回の設定〜今回の設定の間にRTCが一周してしまったら、yearは100を加算してoffsetを計算する。 + } + LCFG_TSD_SetRTCLastSetYear( (u8)newDatep->year ); + + offset0 = UTLi_CalcRTCSecOffset( &oldDate, &oldTime ); // 設定直前のRTC値のオフセットを算出 + offset1 = UTLi_CalcRTCSecOffset( newDatep, newTimep ); // 新しくセットされたRTC値のオフセットを算出 + offset = LCFG_TSD_GetRTCOffset() + offset1 - offset0; // 新RTC_ofs と 現在のRTC_ofs の差分の値を加算してリターン。 + + OS_Printf ("Now Date = year:%3d month:%3d date:%3d hour:%3d minute:%3d second:%3d\n", + oldDate.year, oldDate.month, oldDate.day, + oldTime.hour, oldTime.minute, oldTime.second); + OS_Printf ("Set Date = year:%3d month:%3d date:%3d hour:%3d minute:%3d second:%3d\n", + newDatep->year, newDatep->month, newDatep->day, + newTimep->hour, newTimep->minute, newTimep->second); + OS_Printf ("offset[0] = %x\n", offset0 ); + OS_Printf ("offset[1] = %x\n", offset1 ); + OS_Printf ("rtcOffset = %x\n", offset ); + + newTimep->second = second_bak; + + return offset; +} + + +// RTCオフセット値の算出 +#define SECOND_OFFSET +static s64 UTLi_CalcRTCSecOffset( RTCDate *datep, RTCTime *timep ) +{ + u32 i; + int uruu = 0; + int dayNum = 0; + s64 offset; + + // 時、分、秒を 秒 or 分オフセットに +#ifdef SECOND_OFFSET + offset = ( timep->hour * 60 + timep->minute ) * 60 + timep->second; // ※キャスト部分にバグあり +#else + offset = timep->hour * 60 + timep->minute; +#endif + + // 月、日を 日数に換算してから、 秒 or 分オフセットに + dayNum = (int)datep->day - 1; + for( i = 1; i < datep->month; i++ ) { + dayNum += UTL_GetDayNum( datep->year, i ); + } + + // 年を 日数に換算 + if( datep->year > 0 ) { + uruu = ( ( (int)datep->year - 1 ) >> 2 ) + 1; // 指定年-1までのうるう年の個数を算出して、その日数を加算。 + } + dayNum += uruu + (u32)( datep->year * 365 ); + + // 年・月・日を日数に換算した値を 秒 or 分オフセットに +#ifdef SECOND_OFFSET + offset += (s64)( dayNum * 24 * 3600 ); // ※キャスト部分にバグあり +#else + offset += (s64)( dayNum * 24 * 60 ); +#endif + + return offset; +} + + +// 指定された年・月の日数を返す。 +u32 UTL_GetDayNum( u32 year, u32 month ) +{ + u32 dayNum = 31; + if( month == 2 ) { + if( UTL_IsLeapYear100( year ) ) { + dayNum -= 2; + }else { + dayNum -= 3; + } + }else if( ( month == 4 ) || ( month == 6 ) || ( month == 9 ) || ( month == 11 ) ) { + dayNum--; + } + return dayNum; +} + + +// 簡易うるう年の判定 (うるう年:1、通常の年:0)※RTCのとりうる範2000〜2100年に限定する。 +BOOL UTL_IsLeapYear100( u32 year ) +{ + if( ( year & 0x03 ) || ( year == 100 ) ) { // うるう年は、「4で割り切れ かつ 100で割り切れない年」または「400で割り切れる年」 + return FALSE; + }else { + return TRUE; + } +} + + +// RTCの日付が正しいかチェック +BOOL UTL_CheckRTCDate( RTCDate *datep ) +{ + if( ( datep->year >= 100 ) + || ( datep->month < 1 ) || ( datep->month > 12 ) + || ( datep->day < 1 ) || ( datep->day > 31 ) + || ( datep->week >= RTC_WEEK_MAX ) ) { + return FALSE; + } + return TRUE; +} + + +// RTCの時刻が正しいかチェック +BOOL UTL_CheckRTCTime( RTCTime *timep ) +{ + if( ( timep->hour > 23 ) + || ( timep->minute > 59 ) + || ( timep->second > 59 ) ) { + return FALSE; + } + return TRUE; +} + + +//====================================================================== +// ROMヘッダEULA取得 +//====================================================================== +BOOL UTL_IsROMHeaderEULARequired( void ) +{ + return (BOOL)SYSM_GetAppRomHeader()->exFlags.agree_EULA; +} + + +//====================================================================== +// ROMヘッダのnintendoロゴの正当性チェック +//====================================================================== +//#define CTRDG_SYSROM9_NINLOGO_ADR 0xffff0020 + +BOOL UTL_CheckNintendoLogoData( ROM_Header_Short *rh ) +{ + return !MI_CpuComp8(rh->nintendo_logo, (u8 *)CTRDG_SYSROM9_NINLOGO_ADR, NINTENDO_LOGO_DATA_LENGTH); +} + + +//====================================================================== +// FATALエラー処理 +//====================================================================== + +// FATALエラーをセット +void UTL_SetFatalError( FatalErrorCode error ) +{ + OSIntrMode enable = OS_DisableInterrupts(); + s_fatalError |= (u64)1 << error; + OS_RestoreInterrupts( enable ); +} + + +// FATALエラーか? +BOOL UTL_IsFatalError( void ) +{ + return s_fatalError ? TRUE : FALSE; +} + + +// FATALエラーコード取得 +u64 UTL_GetFatalError( void ) +{ + return s_fatalError; +} + diff --git a/build/libraries_sysmenu/util/ARM9/src/util_menuAppManager.c b/build/libraries_sysmenu/util/ARM9/src/util_menuAppManager.c new file mode 100644 index 00000000..5fbfd4e9 --- /dev/null +++ b/build/libraries_sysmenu/util/ARM9/src/util_menuAppManager.c @@ -0,0 +1,1408 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util_menuAppManager.c + + Copyright 2007 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 TWL_IPL_MENU_APP_MANAGER_FOR_STG +#include +#endif + +#include + +#define MEASURE_BANNER_LOAD_TIME 0 + +void *(*AMNi_Alloc)( u32 size ) = NULL; +void (*AMNi_Free )( void *ptr ) = NULL; + +///////////////////////////////////////////////////////////////////////////////// +// private: +static BOOL AMN_isTitleIdValidForLauncher(NAMTitleId id); + +static void AMN_initFlags_(); +static void AMN_initCardTitleList_(); +static void AMN_initNandTitleList_(); + +static void AMN_lockSubBannerFileBuffer(); +static void AMN_unlockSubBannerFileBuffer(); + +static u32 AMN_getBannerAnimeCRC(const BannerAnime* pAnime); +static BOOL AMN_checkAndReplaceBannerAnime(s32 index); + +static void AMNi_updateFreeBoxCount( u8 count ); + +static vu8 sThreadStarted; +static vu8 sReadCancelFlag; // とりあえず無視。 +static vu8 sNandTitleListReady; +static vu8 sCardTitleListLength; + +static s32 sNandAllTitleListLength; // error if <= 0 +static s32 sNandTitleListLengthForLauncher; + +static s32 sNandAppRomHeaderArrayLength; + +static TitleProperty sAllTitlePropertyArray[cAllTitleArrayMax]; + +enum { + cEventMask_SubBannerFileBuffer = 0x1 +}; + +static OSEvent sSubBannerFileBufferEvent; + +enum { + cThreadPriority_Read = OS_THREAD_LAUNCHER_PRIORITY + 1, + cThreadPriority_Check = OS_THREAD_LAUNCHER_PRIORITY + 2 +}; + +static OSThread sReadThread; +static OSThread sCheckThread; +static u64 sReadThreadStack[1024]; +static u64 sCheckThreadStack[2048]; // 16KBytes FSとNAMを使うので少し多めに取る +static OSMessage sCheckMsgBuf[1]; +static OSMessageQueue sCheckMsgQueue; +static void AMN_procRead(); +static void AMN_procReadNandTitleOnly(); +static void AMN_procReadNandTitleHeaderOnly(); +static void AMN_procCheck(); + +static char sBootContentPath[FS_ENTRY_LONGNAME_MAX]; +static TWLBannerFile* spNandBannerFileArray; +static TWLBannerFile* spEmptyBannerFileBuffer; + // バナーバッファ、サブバナーバッファは0x20 Bytes alignedにしたい。 + // メモリが厳しいのでサブバナーバッファは1個で使い回す。 +static TWLSubBannerFile* spSubBannerFileBuffer; + +static AMNBannerCounter sBannerCounterArray[cAllTitleArrayMax]; +static AMNFrameAnimeData sFrameAnimeDataArray[cAllTitleArrayMax]; +static AMNFrameAnimeData sEmptyAnimeData; + +static ROM_Header_Short sRomHeaderBuffer; + +static ROM_Header_Short s_AllRomHeaderArray[OS_TITLEIDLIST_MAX]; + +// see also TwlIPL_RED/build/systemmenu_RED/Launcher/ARM9/src/bannerCounter.h +inline void AMN_BNC_resetCount( AMNBannerCounter *c ) +{ + c->count = 0; + c->control = 0; +} + +inline void AMN_BNC_setBanner( AMNBannerCounter *c, const TWLBannerFile *b) +{ + c->banner = b; +} + +inline void AMN_BNC_initCounter( AMNBannerCounter *c, const TWLBannerFile *b) +{ + AMN_BNC_setBanner( c, b ); + AMN_BNC_resetCount( c ); +} + +inline const TWLBannerFile* AMN_BNC_getBanner( AMNBannerCounter *c ) +{ + return c->banner; +} + +static void AMN_BNC_incrementCount( AMNBannerCounter *c ); +static AMNFrameAnimeData AMN_BNC_getFAD( AMNBannerCounter *c ); +static AMNFrameAnimeData AMN_BNC_getFADAndIncCount( AMNBannerCounter *c ); + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +BOOL AMN_isNandTitleListReady() { return sNandTitleListReady; } +s32 AMN_getNandTitleListLengthForLauncher() { return sNandTitleListLengthForLauncher; } +s32 AMN_getCardTitleListLength() { return sCardTitleListLength; } +s32 AMN_getRomHeaderListLength() { return sNandAppRomHeaderArrayLength + cNandTitleIndexStart;} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/*! + コンストラクタ(C++時代の遺物) + AMN_Init()から呼ばれるだけ + */ +static void AMN_Manager( ) +{ + sThreadStarted = FALSE; + spNandBannerFileArray = NULL; + spEmptyBannerFileBuffer = NULL; + spSubBannerFileBuffer = NULL; + + // CARDアプリは1個まで。 + SDK_ASSERT( cCardTitleArrayMax == 1 ); + // NANDアプリは39個まで表示できる。 + SDK_ASSERT( cNandTitleArrayMax == 39 ); + +#ifndef TWL_IPL_FINAL + + // 言語enumの監視。 + SDK_ASSERT( BANNER_PRIO_JAPANESE == OS_LANGUAGE_JAPANESE ); + SDK_ASSERT( BANNER_PRIO_ENGLISH == OS_LANGUAGE_ENGLISH ); + SDK_ASSERT( BANNER_PRIO_FRENCH == OS_LANGUAGE_FRENCH ); + SDK_ASSERT( BANNER_PRIO_GERMAN == OS_LANGUAGE_GERMAN ); + SDK_ASSERT( BANNER_PRIO_ITALIAN == OS_LANGUAGE_ITALIAN ); + SDK_ASSERT( BANNER_PRIO_SPANISH == OS_LANGUAGE_SPANISH ); + SDK_ASSERT( BANNER_PRIO_CHINESE == OS_LANGUAGE_CHINESE ); + SDK_ASSERT( BANNER_PRIO_KOREAN == OS_LANGUAGE_HANGUL ); + +#endif + + AMN_initFlags_(); +} + +/*! + 起動。 + */ +void AMN_init( void *(*pAlloc)(u32), void (*pFree)(void*) ) +{ + // 元コンストラクタ + AMN_Manager(); + // この時点でAMNi_AllocとAMNi_FreeがNULLであるべし + SDK_ASSERT( AMNi_Alloc == NULL && AMNi_Free == NULL ); + + AMNi_Alloc = pAlloc; + AMNi_Free = pFree; + + spNandBannerFileArray = (TWLBannerFile*)AMNi_Alloc( sizeof(TWLBannerFile) * cNandTitleArrayMax ); + SDK_ASSERT( spNandBannerFileArray ); + + spEmptyBannerFileBuffer = (TWLBannerFile*)AMNi_Alloc( sizeof(TWLBannerFile) ); + SDK_ASSERT( spEmptyBannerFileBuffer ); + + spSubBannerFileBuffer = (TWLSubBannerFile*)AMNi_Alloc( sizeof(TWLSubBannerFile) ); + SDK_ASSERT( spSubBannerFileBuffer ); + + MI_CpuClearFast(spEmptyBannerFileBuffer, sizeof(TWLBannerFile)); + sEmptyAnimeData.image = spEmptyBannerFileBuffer->v1.image; + sEmptyAnimeData.pltt = spEmptyBannerFileBuffer->v1.pltt; + sEmptyAnimeData.hflip = FALSE; + sEmptyAnimeData.vflip = FALSE; + + MI_CpuClearFast(sAllTitlePropertyArray, sizeof(sAllTitlePropertyArray)); + +#ifndef TWL_IPL_FINAL + // test + +#if 0 + if (0) { + BOOL ret; + + ret = NAM_CheckTitleLaunchRights( + 0x00030004534d504c // "SMPL" - nandAppSample +// 0x00030015344e4141 // "4NAA" - UIG launcher default + ); + IPL_PRINT("NAM_CheckTitleLaunchRights()=%d\n", ret); + + SDK_ASSERT( FALSE ); + } + + + if (0) { + FSFile file[1]; + BOOL ret; + + FS_InitFile(file); + ret = FS_OpenFileEx(file, "sdmc:/dummy.bkp", FS_FILEMODE_R); + IPL_PRINT("FS_OpenFileEx()=%d\n", ret); + FS_CloseFile(file); + + SDK_ASSERT( FALSE ); + + } + + + // test + if (0) { + s32 ret = NAM_ImportBkpSave("sdmc:/dummy.bkp"); + IPL_PRINT("NAM_ImportBkpSave()=%d\n", ret); + SDK_ASSERT( FALSE ); + } + + if (0) { + // なんか、[ES] generate cert failed -2012 + // になる。 + s32 ret = NAM_ExportBkp( +// 0x0003001534303241, // "402A" - UIG launcher clone +// 0x00030015344e4141, // "4NAA" - UIG launcher default + 0x00030004534d504c, // "SMPL" - nandAppSample + "sdmc:/test.bkp"); + IPL_PRINT("NAM_ExportBkp()=%d\n", ret); + } + + if (0) { + NAMBkpInfo info; + static TWLBannerFile banner; + info.fileSize = 0; + info.hardwareId = 0; + + s32 ret = NAM_ReadBkpInfo(&info, &banner, sizeof(banner), + "sdmc:/test.bkp"); + IPL_PRINT("NAM_ReadBkpInfo()=%d, fileSize=%d, HWID=%016llx\n", + ret, info.fileSize, (u64)info.hardwareId); + + SDK_ASSERT( FALSE ); + } + +#endif + +#endif + + //AMN_restart(); // 自動ロードしてしまうのは、活線挿抜ライブラリでCARDだけ読みたい場合やNAND読み込みタイミングを遅らせたい場合に不都合 +} + +/*! + 再起動。 + */ +void AMN_restart() +{ + // AMNi_AllocおよびAMNi_Freeはセットされているべし + SDK_ASSERT( AMNi_Alloc != NULL && AMNi_Free != NULL ); + + AMN_initFlags_(); + + SDK_ASSERT( !sThreadStarted || OS_IsThreadTerminated(&sReadThread) ); + + sThreadStarted = TRUE; + + OS_InitEvent(&sSubBannerFileBufferEvent); + AMN_unlockSubBannerFileBuffer(); + OS_InitMessageQueue(&sCheckMsgQueue, sCheckMsgBuf, sizeof(sCheckMsgBuf) / sizeof(*sCheckMsgBuf)); + OS_CreateThread(&sReadThread, AMN_procRead, NULL, + sReadThreadStack + (sizeof(sReadThreadStack) / sizeof(*sReadThreadStack)), + sizeof(sReadThreadStack), + cThreadPriority_Read); + OS_CreateThread(&sCheckThread, AMN_procCheck, NULL, + sCheckThreadStack + (sizeof(sCheckThreadStack) / sizeof(*sCheckThreadStack)), + sizeof(sCheckThreadStack), + cThreadPriority_Check); + // for safety, wakeup sCheckThread first + OS_WakeupThreadDirect(&sCheckThread); + OS_WakeupThreadDirect(&sReadThread); +} + +/*! + NANDタイトルだけ取得しながらの再起動。 + */ +void AMN_restartWithReadNandTitle() +{ + // AMNi_AllocおよびAMNi_Freeはセットされているべし + SDK_ASSERT( AMNi_Alloc != NULL && AMNi_Free != NULL ); + + AMN_initFlags_(); + + SDK_ASSERT( !sThreadStarted || OS_IsThreadTerminated(&sReadThread) ); + + sThreadStarted = TRUE; + + OS_InitEvent(&sSubBannerFileBufferEvent); + AMN_unlockSubBannerFileBuffer(); + OS_InitMessageQueue(&sCheckMsgQueue, sCheckMsgBuf, sizeof(sCheckMsgBuf) / sizeof(*sCheckMsgBuf)); + OS_CreateThread(&sReadThread, AMN_procReadNandTitleOnly, NULL, + sReadThreadStack + (sizeof(sReadThreadStack) / sizeof(*sReadThreadStack)), + sizeof(sReadThreadStack), + cThreadPriority_Read); + OS_CreateThread(&sCheckThread, AMN_procCheck, NULL, + sCheckThreadStack + (sizeof(sCheckThreadStack) / sizeof(*sCheckThreadStack)), + sizeof(sCheckThreadStack), + cThreadPriority_Check); + // for safety, wakeup sCheckThread first + OS_WakeupThreadDirect(&sCheckThread); + OS_WakeupThreadDirect(&sReadThread); +} + +/*! + NANDタイトルのROM_HEADER_SHORTだけ取得しながらの再起動。 + */ +void AMN_restartWithReadNandTitleHeaderShort() +{ + // AMNi_AllocおよびAMNi_Freeはセットされているべし + SDK_ASSERT( AMNi_Alloc != NULL && AMNi_Free != NULL ); + + AMN_initFlags_(); + + SDK_ASSERT( !sThreadStarted || OS_IsThreadTerminated(&sReadThread) ); + + sThreadStarted = TRUE; + + OS_CreateThread(&sReadThread, AMN_procReadNandTitleHeaderOnly, NULL, + sReadThreadStack + (sizeof(sReadThreadStack) / sizeof(*sReadThreadStack)), + sizeof(sReadThreadStack), + cThreadPriority_Read); + OS_WakeupThreadDirect(&sReadThread); +} + + +/*! + 終了。 + */ +void AMN_destroy() +{ + sReadCancelFlag = TRUE; + while ( sThreadStarted && !OS_IsThreadTerminated(&sReadThread) ) { + OS_Sleep(1); + } + + if( AMNi_Free != NULL && spSubBannerFileBuffer) + { + AMNi_Free( spSubBannerFileBuffer ); + } + if( AMNi_Free != NULL && spEmptyBannerFileBuffer) + { + AMNi_Free( spEmptyBannerFileBuffer ); + } + if( AMNi_Free != NULL && spNandBannerFileArray) + { + AMNi_Free( spNandBannerFileArray ); + } +} + +static void AMN_initFlags_() +{ + sReadCancelFlag = FALSE; + sNandTitleListReady = FALSE; + sNandAllTitleListLength = 0; + sNandTitleListLengthForLauncher = 0; + sCardTitleListLength = 0; + sNandAppRomHeaderArrayLength = 0; +} + +static void AMN_initCardTitleList_() +{ +} + +// 指定されたtitleIDのタイトルツリーを消去 +#define TITLE_TREE_PATH_LENGTH 12+8+1+8+1 +static void AMNi_deleteTitleTree( NAMTitleId titleID ) +{ + char path[TITLE_TREE_PATH_LENGTH];// "nand:/title/" + "%08x" + "/" + "%08x" + "\0" + STD_TSNPrintf( path, TITLE_TREE_PATH_LENGTH, "nand:/title/%08x/%08x", (u32)( titleID >> 32 ), (u32)titleID ); + (void)FS_DeleteDirectoryAuto( path ); + OS_TPrintf( "AMNi_deleteTitleTree : delete %s\n", path ); +} + +static BOOL AMNi_getAndAddNandTitleData( NAMTitleId titleID, BOOL readShowData ) +{ + TitleProperty* pTitleProp; + // header情報の取得 + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OSTick start; +#endif + + FSFile file[1]; + BOOL bSuccess; + char path[FS_ENTRY_LONGNAME_MAX]; + s32 readLen; + u32 offset; + BOOL isBannerExist = FALSE; + + s32 rhArrayLen = cNandTitleIndexStart + sNandAppRomHeaderArrayLength; + + // もう入らない + if (rhArrayLen >= OS_TITLEIDLIST_MAX) { + return FALSE; + } + + FS_InitFile(file); + +#if (MEASURE_BANNER_LOAD_TIME == 1) + start = OS_GetTick(); +#endif + + if( (titleID & TITLE_ID_DATA_ONLY_FLAG_MASK) == 0 ) + { + // DataOnlyでない場合 + readLen = NAM_GetTitleBootContentPathFast( path, titleID ); + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "NAM_GetTitleBootContentPath : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); +#endif + + // ファイルパスを取得 + if(readLen != NAM_OK){ + // error + SDK_ASSERT( FALSE ); + // タイトル消去 + AMNi_deleteTitleTree( titleID ); + return FALSE; + } + +#if (MEASURE_BANNER_LOAD_TIME == 1) + start = OS_GetTick(); +#endif + + // ファイルオープン + bSuccess = FS_OpenFileEx(file, path, FS_FILEMODE_R); + if( ! bSuccess ) + { + // error + SDK_ASSERT( FALSE ); + // タイトル消去 + AMNi_deleteTitleTree( titleID ); + return FALSE; + } + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "OpenFileEX : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); +#endif + + readLen = FS_ReadFile(file, &s_AllRomHeaderArray[rhArrayLen], sizeof(ROM_Header_Short)); + if( readLen != sizeof(ROM_Header_Short) ) + { + // error + SDK_ASSERT( FALSE ); + FS_CloseFile(file); + // タイトル消去 + AMNi_deleteTitleTree( titleID ); + return FALSE; + } + + offset = s_AllRomHeaderArray[rhArrayLen].banner_offset; + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "FS_ReadFile header : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); +#endif + } + else + { + // DataOnlyの場合 + int l; + NAMTitleInfo naminfo; + // この関数で得られる情報は無検証なので改ざんの可能性があるが、メーカーコードのみの判定なので、速度を優先する。(2008.06.20吉岡) + // (Fastつけないと一回300msぐらいかかる) + NAM_ReadTitleInfoFast( &naminfo, titleID ); + MI_CpuClear8(&s_AllRomHeaderArray[rhArrayLen], sizeof(ROM_Header_Short) ); + OS_TPrintf( "0x%0.16llx dataonly-title : makercode = ", titleID ); + for(l=0;l= cNandTitleArrayMax ) || !readShowData ) { + FS_CloseFile(file); + return FALSE; + } + + // 以下は表示するアプリのみ(現在リストにあるデータ数がNandタイトル数の最大を超えていない場合)の処理 + // タイトルリストへの追加 + pTitleProp = &sAllTitlePropertyArray[cNandTitleIndexStart + sNandTitleListLengthForLauncher]; + pTitleProp->titleID = titleID; + pTitleProp->pBanner = &spNandBannerFileArray[sNandTitleListLengthForLauncher]; + pTitleProp->flags.isValid = TRUE; + pTitleProp->flags.bootType = LAUNCHER_BOOTTYPE_NAND; + + // バナーの取得 + // バナーが存在する場合のみリード + + if( offset ) { + +#if (MEASURE_BANNER_LOAD_TIME == 1) + start = OS_GetTick(); +#endif + + bSuccess = FS_SeekFile(file, (s32)offset, FS_SEEK_SET); + if( bSuccess ) + { +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "FS_SeekFile banner: %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); +#endif + + readLen = FS_ReadFile( file, pTitleProp->pBanner, (s32)sizeof(TWLBannerFile) ); + if( readLen == (s32)sizeof(TWLBannerFile) ) + { + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "FS_ReadFile banner: %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); +#endif + + // バナーチェックリクエスト送信。 + OS_SendMessage(&sCheckMsgQueue, (OSMessage)(pTitleProp->pBanner), OS_MESSAGE_BLOCK); + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "check banner: %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); +#endif + isBannerExist = TRUE; + } + } + } + + if( !isBannerExist ) + { + // バナーが存在しない場合はバッファクリア + MI_CpuClearFast( pTitleProp->pBanner, sizeof(TWLBannerFile) ); + } + +#if (MEASURE_BANNER_LOAD_TIME == 1) + start = OS_GetTick(); +#endif + + FS_CloseFile(file); + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "close file : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); +#endif + + // サブバナーファイルを読み込んでみる + if(s_AllRomHeaderArray[rhArrayLen].exFlags.availableSubBannerFile && + NAM_OK == NAM_GetTitleBannerFilePath( path, titleID )) + { + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "NAM_GetTitleBannerFilePath : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); + start = OS_GetTick(); +#endif + if (FS_OpenFileEx(file, path, FS_FILEMODE_R)) { + // サブバナーバッファ確保。 + AMN_lockSubBannerFileBuffer(); + readLen = FS_ReadFile(file, spSubBannerFileBuffer, sizeof(*spSubBannerFileBuffer)); + FS_CloseFile(file); + if (readLen == sizeof(TWLSubBannerFile)) { + // 読み込みには成功したので正当性チェック + // サブバナーチェックリクエスト送信。 + OS_SendMessage(&sCheckMsgQueue, (OSMessage)(cNandTitleIndexStart + sNandTitleListLengthForLauncher), OS_MESSAGE_BLOCK); + // 解放はCHECKスレッド側で行う。 + } else { + OS_TPrintf("subbanner read failed (%d)\n", readLen); + // 解放。 + AMN_unlockSubBannerFileBuffer(); + } + } + +#if (MEASURE_BANNER_LOAD_TIME == 1) + OS_TPrintf( "open-read-close-check subbanner : %dus\n", OS_TicksToMicroSeconds( OS_GetTick() - start ) ); +#endif + } + + sNandTitleListLengthForLauncher++; + + return TRUE; +} + +/*! + see also SYSM_InitNandTitleList() and SYSM_GetNandTitleList() + インポートされているすべてのNANDアプリを列挙したリストの準備 + */ +static void AMN_initNandTitleList_() +{ + s32 ret; + s32 l; + NAMTitleId* pNandAllTitleIDList = NULL; + u8 count_valid_app_for_launcher = 0; + int finger = 0; + + // インポートされているタイトルの取得 + sNandAllTitleListLength = NAM_GetNumTitles(); + OS_TPrintf("NAM_GetNumTitles()=%d\n", sNandAllTitleListLength); + // 少なくともランチャーと無線ファームがリストアップされるはず。 + // だが、一応0は通す。 + SDK_ASSERT( sNandAllTitleListLength >= 0 ); + + if (sNandAllTitleListLength > 0) { + pNandAllTitleIDList = (NAMTitleId*)AMNi_Alloc( sizeof(NAMTitleId) * sNandAllTitleListLength ); + SDK_ASSERT( pNandAllTitleIDList ); + + if (!pNandAllTitleIDList) { + // error + sNandAllTitleListLength = 0; + } else { + ret = NAM_GetTitleList(pNandAllTitleIDList, (u32)sNandAllTitleListLength); + OS_TPrintf("NAM_GetTitleList()=%d\n", ret); + SDK_ASSERT( ret == NAM_OK ); + + if (ret != NAM_OK) { + // error + sNandAllTitleListLength = 0; + } + } + } + + // まず、タイトルを重要な順に選択ソートする。 + // HNB*を先頭に、システムアプリ、ユーザアプリの順序 + // 非表示タイトルも移動してしまっているが、あまり関係ない + for( l = 0; l < sNandAllTitleListLength; l++ ) + { + // HNB* + char *code = ((char *)&pNandAllTitleIDList[l]) + 1; + if( 0 == STD_CompareNString( code, "BNH", 3 ) ) + { + if( l != finger) + { + NAMTitleId temp = pNandAllTitleIDList[finger]; + pNandAllTitleIDList[finger] = pNandAllTitleIDList[l]; + pNandAllTitleIDList[l] = temp; + } + finger++; + } + } + for( l = finger; l < sNandAllTitleListLength; l++ ) + { + // システムアプリ + if( pNandAllTitleIDList[l] & TITLE_ID_APP_TYPE_MASK ) + { + if( l != finger) + { + NAMTitleId temp = pNandAllTitleIDList[finger]; + pNandAllTitleIDList[finger] = pNandAllTitleIDList[l]; + pNandAllTitleIDList[l] = temp; + } + finger++; + } + } + + // メモリの確保と解放を同じ関数内で行いたいので、 + // 取得したタイトルがローンチ対象かどうかをチェック + // を、ここで行う。 + // すべてのタイトルのヘッダを読み込むので、絞込みの必要はない + + for (l = 0; l < sNandAllTitleListLength; l++) { + if (AMN_isTitleIdValidForLauncher(pNandAllTitleIDList[l])) { + // 本体設定の場合、アプリマネージャ用indexは飛び飛びになったり、ForSetting()が返す値(個数)より大きくなるので + // getNandTitleListLengthForSetting()は用意しない。 + if( AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], TRUE ) ) + { + // FreeboxCount更新のためのカウンタ + count_valid_app_for_launcher++; + } + } + } + + // FreeboxCount更新 + AMNi_updateFreeBoxCount( count_valid_app_for_launcher ); + + + // ローンチ対象でないタイトルの情報の取得 + for (l = 0; l < sNandAllTitleListLength; l++) { + if (!AMN_isTitleIdValidForLauncher(pNandAllTitleIDList[l])) { + (void)AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], FALSE ); + } + } + + if (pNandAllTitleIDList) { + AMNi_Free( pNandAllTitleIDList ); + } +} + +// インポートされているすべてのタイトルのROM_HEADER_SHORTのみ読み出す +static void AMN_initNandTitleRomHeaderShortList_() +{ + s32 ret; + s32 l; + NAMTitleId* pNandAllTitleIDList = NULL; + + // インポートされているタイトルの取得 + sNandAllTitleListLength = NAM_GetNumTitles(); + OS_TPrintf("NAM_GetNumTitles()=%d\n", sNandAllTitleListLength); + // 少なくともランチャーと無線ファームがリストアップされるはず。 + // だが、一応0は通す。 + SDK_ASSERT( sNandAllTitleListLength >= 0 ); + + if (sNandAllTitleListLength > 0) { + pNandAllTitleIDList = (NAMTitleId*)AMNi_Alloc( sizeof(NAMTitleId) * sNandAllTitleListLength ); + SDK_ASSERT( pNandAllTitleIDList ); + + if (!pNandAllTitleIDList) { + // error + sNandAllTitleListLength = 0; + } else { + ret = NAM_GetTitleList(pNandAllTitleIDList, (u32)sNandAllTitleListLength); + OS_TPrintf("NAM_GetTitleList()=%d\n", ret); + SDK_ASSERT( ret == NAM_OK ); + + if (ret != NAM_OK) { + // error + sNandAllTitleListLength = 0; + } + } + } + + // タイトルの情報(ヘッダのみ)の取得 + for (l = 0; l < sNandAllTitleListLength; l++) { + (void)AMNi_getAndAddNandTitleData( pNandAllTitleIDList[l], FALSE ); + } + + // バナー表示しない場合、FreeboxCount更新は必要ない + // (怖いのは表示とカウントが食い違う事なので) + + if (pNandAllTitleIDList) { + AMNi_Free( pNandAllTitleIDList ); + } +} + +// 生データ(TitlePropertyのリスト、HeaderShortリスト)にアクセスできる抜け道関数 +TitleProperty* AMN_getTitlePropertyList( void ) +{ + return sAllTitlePropertyArray; +} + +ROM_Header_Short* AMN_getRomHeaderList( void ) +{ + return s_AllRomHeaderArray; +} + +static void AMN_procRead() +{ + MI_CpuClearFast(sAllTitlePropertyArray, sizeof(sAllTitlePropertyArray)); + + AMN_initCardTitleList_(); + AMN_initNandTitleList_(); + + OS_SendMessage(&sCheckMsgQueue, NULL, OS_MESSAGE_BLOCK); + OS_JoinThread(&sCheckThread); + + AMN_stepBannerAnimeAll( TRUE ); + + // for GX DMA + DC_StoreAll(); + + if (!sReadCancelFlag) { + sNandTitleListReady = TRUE; + } +} + +// Nandタイトルだけ取得、Card部分はno care +static void AMN_procReadNandTitleOnly() +{ + MI_CpuClearFast(&sAllTitlePropertyArray[cNandTitleIndexStart], sizeof(TitleProperty) * ( cAllTitleArrayMax - cNandTitleIndexStart ) ); + + AMN_initNandTitleList_(); + + OS_SendMessage(&sCheckMsgQueue, NULL, OS_MESSAGE_BLOCK); + OS_JoinThread(&sCheckThread); + + AMN_stepBannerAnimeAll( TRUE ); + + // for GX DMA + DC_StoreAll(); + + if (!sReadCancelFlag) { + sNandTitleListReady = TRUE; + } +} + +// NandタイトルのROM_Header_Shortだけ取得、Card部分はno care +static void AMN_procReadNandTitleHeaderOnly() +{ + AMN_initNandTitleRomHeaderShortList_(); + + // for GX DMA + DC_StoreAll(); + + if (!sReadCancelFlag) { + sNandTitleListReady = TRUE; + } +} + + +static void AMN_procCheck() +{ + OSMessage msg; + s32 index; + TWLBannerFile* pBanner; + + while (TRUE) { + OS_ReceiveMessage(&sCheckMsgQueue, &msg, OS_MESSAGE_BLOCK); +// IPL_PRINT("procCheck: msg=0x%x\n", msg); + if (!msg) { + break; + } + index = (s32)msg; + // 0はスレッド終了を意味するのでindexとしては不適切。 + // また、CARDなのでサブバナーはありえない。 + SDK_ASSERT( cNandTitleIndexStart > 0 ); + if (cNandTitleIndexStart <= index && index < (cNandTitleIndexStart + cNandTitleArrayMax)) { + // サブバナー + (void)AMN_checkAndReplaceBannerAnime(index); + AMN_unlockSubBannerFileBuffer(); + } else { + pBanner = (TWLBannerFile*)msg; + if (!AMN_checkBannerFile(pBanner)) { + // 正当性チェック失敗の場合はバッファクリア + MI_CpuClearFast(pBanner, sizeof(*pBanner)); + OS_TPrintf("check NG! msg=0x%x propAry=0x%x\n", pBanner, sAllTitlePropertyArray); + } + } + } +} + +static void AMN_lockSubBannerFileBuffer() +{ + OS_WaitEventEx_And(&sSubBannerFileBufferEvent, + cEventMask_SubBannerFileBuffer, + cEventMask_SubBannerFileBuffer); +} + +static void AMN_unlockSubBannerFileBuffer() +{ + OS_SignalEvent(&sSubBannerFileBufferEvent, + cEventMask_SubBannerFileBuffer); +} + +const TitleProperty* AMN_getTitleProperty(s32 index) +{ + const TitleProperty* pTitleProp; + + if (cAllTitleIndexStart <= index && index < cAllTitleArrayMax) { + pTitleProp = &sAllTitlePropertyArray[index]; + if (pTitleProp->flags.isValid) { + return pTitleProp; + } + } + + return NULL; +} + +const ROM_Header_Short* AMN_getTitleRomHeaderShort(s32 index) +{ + const ROM_Header_Short* pRhs; + + if (cAllTitleIndexStart <= index && index < cAllTitleArrayMax) { + pRhs = &s_AllRomHeaderArray[index]; + return pRhs; + } + + return NULL; +} + +BOOL AMN_isDSWirelessIcon(s32 index) +{ + const ROM_Header_Short* pRhs = AMN_getTitleRomHeaderShort(index); + + if (pRhs) { + return pRhs->exFlags.DSWirelessIcon; + } + + return FALSE; +} + +BOOL AMN_isWiFiConnectionIcon(s32 index) +{ + const ROM_Header_Short* pRhs = AMN_getTitleRomHeaderShort(index); + + if (pRhs) { + return pRhs->exFlags.WiFiConnectionIcon; + } + + return FALSE; +} + +BOOL AMN_isAgreeEULAFlag(s32 index) +{ + const ROM_Header_Short* pRhs = AMN_getTitleRomHeaderShort(index); + + if (pRhs) { + return pRhs->exFlags.agree_EULA; + } + + return FALSE; +} + +const u8* AMN_getParentalControlRatingInfo(s32 index) +{ + const ROM_Header_Short* pRhs = AMN_getTitleRomHeaderShort(index); + + if (pRhs) { + return pRhs->parental_control_rating_info; + } + + return FALSE; +} + +// タイトルIDが本体設定用としては無効であっても、 +// 対応するindexを返します。 +s32 AMN_getIndexByTitleId(NAMTitleId titleId) +{ + const TitleProperty* pTitleProp; + s32 index; + + // 一応、TitleID == 0 のアプリがあるかもしれない?ので、 + // NANDから優先的に探す。 + // CARDはTITLE_ID_MEDIA_MASKが1になるはず。 + + // NAND + index = cNandTitleIndexStart + sNandTitleListLengthForLauncher - 1; + while (index >= cNandTitleIndexStart) { + pTitleProp = AMN_getTitleProperty(index); + if (pTitleProp && + pTitleProp->titleID == titleId) { + return index; + } + index--; + } + + // CARD + index = sCardTitleListLength - 1; + while (index >= cCardTitleIndexStart) { + pTitleProp = AMN_getTitleProperty(index); + if (pTitleProp && + pTitleProp->titleID == titleId) { + return index; + } + index--; + } + + return -1; +} + +// indexが本体設定用としては無効であっても、 +// 対応するタイトルIDを返します。 +NAMTitleId AMN_getTitleIdByIndex(s32 index) +{ + const TitleProperty* pTitleProp = AMN_getTitleProperty(index); + + if (pTitleProp) { + return pTitleProp->titleID; + } + + return (NAMTitleId)0; +} + +void AMN_stepBannerAnimeAll(BOOL restart) +{ + s32 index; + + for (index = cAllTitleIndexStart; index < cAllTitleArrayMax; index++) { + AMN_stepBannerAnime(index, restart); + } +} + +void AMN_stepBannerAnime(s32 index, BOOL restart) +{ + const TWLBannerFile* pBanner; + AMNBannerCounter* pBNC; + + if (cAllTitleIndexStart <= index && index < cAllTitleArrayMax) { + pBNC = &sBannerCounterArray[index]; + if (restart) { + pBanner = sAllTitlePropertyArray[index].pBanner; + if (!pBanner) { + pBanner = spEmptyBannerFileBuffer; + } + AMN_BNC_initCounter(pBNC, pBanner); + } else { + AMN_BNC_incrementCount(pBNC); + } + sFrameAnimeDataArray[index] = AMN_BNC_getFAD(pBNC); + } +} + +const u8* AMN_getBannerImage(s32 index) +{ + AMNFrameAnimeData ret = AMN_getBannerAnime(index); + + return ret.image; +} + +const u8* AMN_getBannerPltt(s32 index) +{ + AMNFrameAnimeData ret = AMN_getBannerAnime(index); + + return ret.pltt; +} + +BOOL AMN_getBannerHFlip(s32 index) +{ + AMNFrameAnimeData ret = AMN_getBannerAnime(index); + + return ret.hflip; +} + +BOOL AMN_getBannerVFlip(s32 index) +{ + AMNFrameAnimeData ret = AMN_getBannerAnime(index); + + return ret.vflip; +} + +AMNFrameAnimeData AMN_getBannerAnime(s32 index) +{ + if (cAllTitleIndexStart <= index && index < cAllTitleArrayMax) { + return sFrameAnimeDataArray[index]; + } + + return sEmptyAnimeData; +} + +const u16* AMN_getBannerText2(s32 index, OSLanguage language) +{ + const TitleProperty* pTitleProp = AMN_getTitleProperty(index); + + if (language >= OS_LANGUAGE_CODE_MAX) { + language = OS_LANGUAGE_ENGLISH; + } + + if (pTitleProp) { + if (language < BANNER_LANG_NUM_V1) { + return pTitleProp->pBanner->v1.gameName[language]; + } + language = (OSLanguage)(language - BANNER_LANG_NUM_V1); + if (language < BANNER_LANG_NUM_V2) { + return pTitleProp->pBanner->v2.gameName[language]; + } + language = (OSLanguage)(language - BANNER_LANG_NUM_V2); + return pTitleProp->pBanner->v3.gameName[language]; + } + + return spEmptyBannerFileBuffer->v1.gameName[language]; +} + +const u16* AMN_getBannerText(s32 index) +{ + OSOwnerInfo info; + + // とりあえず。 + // 正式には本体設定のLCFGラッパーから取らないとダメ? + OS_GetOwnerInfo(&info); + return AMN_getBannerText2(index, (OSLanguage)info.language); +} + +// see also SYSMi_CheckBannerFile() +// バナーデータの正誤チェック +BOOL AMN_checkBannerFile(TWLBannerFile* pBanner) +{ +typedef struct BannerCheckParam { + u8 *pSrc; + u32 size; +}BannerCheckParam; + + int i; + BOOL retval = TRUE; + u16 calc_crc = 0xffff; + u16 *pHeaderCRC = (u16 *)&pBanner->h.crc16_v1; + BannerCheckParam bannerCheckList[ BANNER_VER_NTR_MAX ]; + BannerCheckParam *pChk = &bannerCheckList[ 0 ]; + + // NTR互換部分は標準でチェック + bannerCheckList[ 0 ].pSrc = (u8 *)&( pBanner->v1 ); + bannerCheckList[ 0 ].size = sizeof( BannerFileV1 ); + bannerCheckList[ 1 ].pSrc = (u8 *)&( pBanner->v2 ); + bannerCheckList[ 1 ].size = sizeof( BannerFileV2 ); + bannerCheckList[ 2 ].pSrc = (u8 *)&( pBanner->v3 ); + bannerCheckList[ 2 ].size = sizeof( BannerFileV3 ); + + for( i = 0; i < BANNER_VER_NTR_MAX; i++ ) { + if( i < pBanner->h.version ) { + calc_crc = SVC_GetCRC16( calc_crc, pChk->pSrc, pChk->size ); + if( calc_crc != *pHeaderCRC++ ) { + retval = FALSE; + break; + } + }else { + MI_CpuClear16( pChk->pSrc, pChk->size ); + } + pChk++; + } + + // TWLバナーなら、バナーアニメ部もチェック + if( pBanner->h.platform == BANNER_PLATFORM_TWL ) { + if (pBanner->h.crc16_anime != AMN_getBannerAnimeCRC(&pBanner->anime)) { + retval = FALSE; + } + } + return retval; +} + +// アニメ部CRC算出。 +static u32 AMN_getBannerAnimeCRC(const BannerAnime* pAnime) +{ + return SVC_GetCRC16(0xffff, pAnime, sizeof(*pAnime)); +} + +static BOOL AMN_checkAndReplaceBannerAnime(s32 index) +{ + BOOL retval = FALSE; + TWLBannerFile* pBanner; + + // 範囲外のindexを無視。 + if (cNandTitleIndexStart <= index && index < (cNandTitleIndexStart + sNandTitleListLengthForLauncher)) { + if (spSubBannerFileBuffer->h.crc16_anime == AMN_getBannerAnimeCRC(&spSubBannerFileBuffer->anime)) { + // 成功したのでコピーする + pBanner = &spNandBannerFileArray[index-cNandTitleIndexStart]; + // h.crc16_animeしかチェックしていないので、それとanimeだけコピー + pBanner->h.crc16_anime = spSubBannerFileBuffer->h.crc16_anime; + // MI_CpuCopy()の方が遅くなった… + pBanner->anime = spSubBannerFileBuffer->anime; + retval = TRUE; + } + } + +// IPL_PRINT("checkAndReplaceBannerAnime(%d)=%d\n", index, retval); + + return retval; +} + +// see also TwlIPL_RED/build/systemmenu_RED/Launcher/ARM9/src/bannerCounter.c +void AMN_BNC_incrementCount( AMNBannerCounter *c ) +{ + // TWLのみカウントインクリメント + if( c->banner->h.platform == BANNER_PLATFORM_TWL ) + { + if( c->banner->anime.control[0].frameCount == 0 ) + { + // アニメに終端しか存在しない + //OS_TPrintf( "BNC_incrementCount:Only a Terminator!\n" ); + return; + } + + c->count++; + if( c->count >= c->banner->anime.control[c->control].frameCount ) + { + // カウント値がコントロールのフレームカウントを超えたので次のコントロールへ + c->control++; + c->count = 0; + + //ループ及び停止の処理 + if( c->control >= BANNER_ANIME_CONTROL_INFO_NUM ) + { + // コントロールが限界を超えたら無条件でループ + AMN_BNC_resetCount( c ); + } + else if( c->banner->anime.control[c->control].frameCount == 0 ) + { + // コントロールのフレームカウントが0なら終端到達 + if( c->banner->anime.control[c->control].animeType == 0 ) + { + // アニメタイプ0ならループ + AMN_BNC_resetCount( c ); + } + else if( c->banner->anime.control[c->control].animeType == 1 ) + { + // アニメタイプ1なら停止(一つ前のコントロールに戻す) + c->control--; + } + } + } + } +} + +AMNFrameAnimeData AMN_BNC_getFAD( AMNBannerCounter *c ) +{ + AMNFrameAnimeData ret; + if( c->banner->h.platform == BANNER_PLATFORM_NTR ) + { + ret.image = c->banner->v1.image; + ret.pltt = c->banner->v1.pltt; + ret.hflip = FALSE; + ret.vflip = FALSE; + } + else + { + if( c->banner->anime.control[0].frameCount == 0 ) + { + // アニメに終端しか存在しない + //OS_TPrintf( "BNC_getFAD:Only a Terminator!\n" ); + ret.image = c->banner->v1.image; + ret.pltt = c->banner->v1.pltt; + ret.hflip = FALSE; + ret.vflip = FALSE; + return ret; + } + // コントロールデータを読んで、現在のフレームに該当するデータを返す + ret.image = c->banner->anime.image[ c->banner->anime.control[c->control].normal.cellNo ]; + ret.pltt = c->banner->anime.pltt[ c->banner->anime.control[c->control].normal.plttNo ]; + ret.hflip = c->banner->anime.control[c->control].normal.flipType & 0x1; + ret.vflip = (c->banner->anime.control[c->control].normal.flipType & 0x2) >> 1; + } + return ret; +} + +AMNFrameAnimeData AMN_BNC_getFADAndIncCount( AMNBannerCounter *c ) +{ + AMNFrameAnimeData ret = AMN_BNC_getFAD( c ); + AMN_BNC_incrementCount( c ); + return ret; +} + +BOOL AMN_isTitleIdValidForLauncher(NAMTitleId id) +{ + // "Not Launch"でない かつ "Data Only"でない なら有効なタイトルとしてリストに追加 + return ((id & ( TITLE_ID_NOT_LAUNCH_FLAG_MASK | TITLE_ID_DATA_ONLY_FLAG_MASK )) == 0); +} + +BOOL AMN_isIndexValidForSetting(s32 index) +{ + const TitleProperty* pTitleProp = AMN_getTitleProperty(index); + + if (pTitleProp) { + return NAM_IsUserTitle(pTitleProp->titleID); + } + + return FALSE; +} + +static void AMNi_updateFreeBoxCount( u8 count ) +{ + u32 installed; + u8 free; + BOOL changed = FALSE; + u8 *pBuffer; + BOOL retval = TRUE; + + installed = LCFG_TSD_GetInstalledSoftBoxCount(); + free = LCFG_TSD_GetFreeSoftBoxCount(); + + if( count > LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX ) + { + count = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX; + } + + OS_TPrintf( "AMNi_updateFreeBoxCount : Install:%d, Free:%d, LCFG_Install:%d, LCFG_Free:%d, MAX:%d\n", + count, LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count, installed, free, LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX ); + + if( (u8)installed != count ) + { + LCFG_TSD_SetInstalledSoftBoxCount( ( u8 )count ); + changed = TRUE; + } + + if( LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count != free ) + { + LCFG_TSD_SetFreeSoftBoxCount( (u8)( LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - count ) ); + changed = TRUE; + } + + if(changed) + { + // LCFGライブラリの静的変数の値をNANDに反映 + pBuffer = AMNi_Alloc( LCFG_WRITE_TEMP ); + if (!pBuffer) { + OS_TPrintf( "AMNi_updateFreeBoxCount : AMNi_Alloc failed.\n" ); + return; + } + retval = LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + AMNi_Free( pBuffer ); + if (!retval) { + OS_TPrintf( "AMNi_updateFreeBoxCount : LCFG_WriteTWLSettings failed.\n" ); + return; + } + OS_TPrintf( "AMNi_updateFreeBoxCount : FreeBoxCount is updated.\n" ); + }else + { + OS_TPrintf( "AMNi_updateFreeBoxCount : FreeBoxCount is not updated.\n" ); + } +} + +/*-------------------------------------------------------------------------------------------------------- + +// アプリケーションに埋め込むテストコードのサンプル +// 実験用にヒープを拡張メインメモリから確保しているので注意 +// 事前にOS_EnableMainExArena、OS_Init(OS_InitArena)、およびNAM_Initを呼んでおく必要あり +static OSHeapHandle os_heap_handle; +static void *alloc_tmp(u32 size) +{ + return OS_AllocFromHeap( OS_ARENA_MAINEX, os_heap_handle, size); +} +static void free_tmp( void *ptr ) +{ + OS_FreeToHeap( OS_ARENA_MAINEX, os_heap_handle, ptr ); +} +static void test2() +{ + + s32 length; + s32 idx; + void *nstart; + + nstart = OS_InitAlloc( OS_ARENA_MAINEX, OS_GetMainExArenaLo(), OS_GetMainExArenaHi(), 1 ); + OS_SetMainExArenaLo( nstart ); + + os_heap_handle = OS_CreateHeap( OS_ARENA_MAINEX, OS_GetMainExArenaLo(), OS_GetMainExArenaHi() ); + + AMN_init( alloc_tmp, free_tmp ); + + // 起動直後、自動的にバナーデータ読み込みを行います。 + // メインスレッドでは、とりあえず完了まで待ちます。 + while (!AMN_isNandTitleListReady()) { + OS_Sleep(1); + } + + // タイトル一覧をOS_Printfします。 + // cmn::util::U16toSjisは、STDライブラリの関数を呼び出してUnicodeからShiftJISへ変換します。 + length = AMN_getNandTitleListLengthForLauncher(); + for (idx = 0; idx < length; idx++) { + s32 i; + char dst[256]; + int dstlen = 256; + i = cNandTitleIndexStart + idx; + MI_CpuClearFast(dst,256); + STD_ConvertStringUnicodeToSjis(dst, &dstlen, AMN_getBannerText(i), NULL, NULL); + OS_TPrintf("title idx=%2d, titleId=%016llx exp=%02x forStg=%d bannerText=%s\n", + i, (u64)AMN_getTitleIdByIndex(i), + AMN_getTitleProperty(i)->expansionFlags, + AMN_isIndexValidForSetting(i), + dst); + } + +// タイトルIDからの逆引き + { + static const NAMTitleId table[] = { + 0x00030015344e4141, // "4NAA" - UIG launcher default + 0x0003001534303141, // "401A" - UIG launcher clone + 0x0003001534303241, // "402A" - UIG launcher clone + 0x00030017484e4141, // "HNAA" - RED launcher default + 0x00030015484e4241, // "HNBA" - RED MachineSettings + 0x0000000000000001, // nonexistent + 0 // stopper + }; + u32 i; + + i = 0; + while (table[i]) { + OS_TPrintf("index by titleId(%016llx)=%d\n", (u64)table[i], AMN_getIndexByTitleId(table[i])); + i++; + } + } + +// バナーイメージデータ + { + s32 index; + const u8* pImage; + + index = 3; //app::Manager::cNandTitleIndexStart; + pImage = AMN_getBannerImage(index); + OS_TPrintf("banner image for index(%02d)=%02x %02x %02x %02x %02x %02x %02x %02x \n", + index, + pImage[0], pImage[1], pImage[2], pImage[3], + pImage[4], pImage[5], pImage[6], pImage[7]); + } + +} + +--------------------------------------------------------------------------------------------------------*/ diff --git a/build/libraries_sysmenu/util/ARM9/src/util_recoveryFile.c b/build/libraries_sysmenu/util/ARM9/src/util_recoveryFile.c new file mode 100644 index 00000000..16a74c7d --- /dev/null +++ b/build/libraries_sysmenu/util/ARM9/src/util_recoveryFile.c @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util_recoveryFile.h + + Copyright **** 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 + +typedef enum CheckStatus { + CHECK_EXIST = 0, + CHECK_CREATE = 1, + CHECK_FAILED = 2 +} CheckStatus; + +CheckStatus UTL_CheckAndCreateDirectory( const char *path ); +CheckStatus UTL_CheckAndCreateDirectoryRec( const char *path ); + +/*---------------------------------------------------------------------------* + Name: UTL_RecoveryFile + + Description: この関数は受け取ったパスにあるファイルをチェックします。 + 対象のファイルが存在してサイズが等しければ何もしません。 + サイズが異なった場合は指定サイズに変更を行い、 + ファイルが存在しなければ作成したうえで、サイズ設定を行います。 + + Arguments: path: チェックを行うファイルのパス + filesize: 対象ファイルのサイズ + + Returns: ファイルが存在し、サイズも適正な場合は場合はUTL_RCV_OKを、 + サイズが異なり、変更した場合はUTL_RCV_SIZE_CHANGEDを、 + ファイルが存在せず、作成した場合はUTL_RCV_FILE_CREATED、 + ファイル作成に失敗した場合はUTL_RCV_FAILEDを返します。 + *---------------------------------------------------------------------------*/ + +UTL_RecoveryStatus UTL_RecoveryFile( const char* path, const u32 filesize ) +{ + FSFile file; + BOOL openRes; + + if( !FS_IsAvailable() ) + { + // FSがInitされてなかったらInitする + FS_Init( FS_DMA_NOT_USE ); + } + + FS_InitFile( &file ); + + if( UTL_CheckAndCreateDirectoryRec( path ) == CHECK_FAILED ) + { + // ファイルに至るまでのディレクトリを作成できなかった。 + return UTL_RCV_FAILED; + } + + if( (openRes = FS_OpenFileEx( &file, path, FS_FILEMODE_RWL )) == TRUE ) + { + if (FS_GetFileLength( &file ) == filesize ) + { + // ファイルが存在してサイズが合ってれば何も言わない + return UTL_RCV_OK; + } + } + + // ファイルが存在しないので作成する + if( (!openRes) && !FS_CreateFile( path, FS_PERMIT_R | FS_PERMIT_W ) ) + { + OS_TPrintf("UTL RecoveryFile Error: FS_CreateFile() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + // ファイル作成に失敗 + return UTL_RCV_FAILED; + } + + // ファイル作成に成功 + if( !FS_OpenFileEx( &file, path, FS_FILEMODE_RW ) ) + { + // 作成したファイルをopenできなかった場合 + OS_TPrintf("UTL RecoveryFile Error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + return UTL_RCV_OK; + } + + + if( FS_SetFileLength( &file, filesize ) != FS_RESULT_SUCCESS ) + { + // 作成したファイルのサイズを設定できなかった + OS_TPrintf(" UTL RecoveryFile Error: FS_SetFileLength() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) ); + FS_CloseFile( &file ); + return UTL_RCV_FAILED; + } + + + return openRes ? UTL_RCV_SIZE_CHANGED : UTL_RCV_FILE_CREATED; +} + +/*---------------------------------------------------------------------------* + Name: UTL_CheckAndCreateDirectoryRec + + Description: 該当パスに到達するまでのディレクトリを再起的にチェックし、 + 存在しないディレクトリの場合は全て作成します。 + パスの最後が'/'なら最後までディレクトリして扱い、 + そうでない場合は最後をファイル名とし、'/'の手前に記述された + ディレクトリまでをチェックします。 + + Arguments: path: チェックを行うパス + + Returns: ディレクトリが最後まで存在した場合はCHECK_EXISTを、 + 存在しておらず作成し、最後まで成功した場合はCHECK_CREATEを、 + 途中でディレクトリ作成に失敗した場合はCHECK_FAILEDを返します。 + *---------------------------------------------------------------------------*/ + + +CheckStatus UTL_CheckAndCreateDirectoryRec( const char *path ) +{ + BOOL createFlag = FALSE; + char subPath[FS_FILE_NAME_MAX]; + char *p; + int pathLength = STD_StrLen( path ); + + p = STD_StrChr( path, '/'); + + while( p != NULL ) + // スラッシュが出てこなくなるまで続ける + { + CheckStatus result; + + // 次のスラッシュまでの部分文字列を作る + int slashPos = pathLength - STD_StrLen( p ); + STD_StrLCpy( subPath, path, slashPos+1 ); + subPath[slashPos+1] = '\0'; + + result = UTL_CheckAndCreateDirectory( subPath ); + + switch( result ) + { + case CHECK_FAILED: + // 失敗したらそこで終わり + return result; + case CHECK_CREATE: + createFlag = TRUE; + break; + } + + p = STD_StrChr( ++p, '/' ); + } + + return createFlag ? CHECK_CREATE : CHECK_EXIST; + +} + +/*---------------------------------------------------------------------------* + Name: UTL_CheckAndCreateDirectory + + Description: この関数は該当ディレクトリが存在していれば何もしません。 + 該当ディレクトリが存在していなかった場合は + ディレクトリを作成します。 + + Arguments: path: チェックを行うディレクトリのパス + + Returns: ディレクトリが存在した場合はCHECK_EXISTを、 + 存在しておらず作成した場合はCHECK_CREATEを、 + ディレクトリ作成に失敗した場合はCHECK_FAILEDを返します。 + *---------------------------------------------------------------------------*/ + +CheckStatus UTL_CheckAndCreateDirectory( const char *path ) +{ + FSFile dir; + + FS_InitFile( &dir ); + + if( FS_OpenDirectory( &dir, path, FS_FILEMODE_RW ) ) + { + // ディレクトリが存在していたらそのままCloseして戻る + FS_CloseDirectory( &dir ); + return CHECK_EXIST; + } + + // ディレクトリが存在しないのでディレクトリを作成 + if( ! FS_CreateDirectory( path, FS_PERMIT_R | FS_PERMIT_W ) ) + { + OS_TPrintf("EL Error: FS_CreateDirectory() failed. path: %s FSResult: %d\n", path, FS_GetArchiveResultCode(path) ); + // ディレクトリ作成に失敗 + return CHECK_FAILED; + } + + // ディレクトリ作成に成功 + OS_TPrintf("EL createDirectory succeeded. : %s\n", path ); + return CHECK_CREATE; +} diff --git a/build/libraries_sysmenu/util/Makefile b/build/libraries_sysmenu/util/Makefile new file mode 100644 index 00000000..a2098ba3 --- /dev/null +++ b/build/libraries_sysmenu/util/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/wds/ARM9/Makefile b/build/libraries_sysmenu/wds/ARM9/Makefile new file mode 100644 index 00000000..256f37b0 --- /dev/null +++ b/build/libraries_sysmenu/wds/ARM9/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#------------------------------------------------------------------ +# +# WDS Library Makefile +# +#------------------------------------------------------------------ +#! make -f + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SUBDIRS = + +SRCS = WDS.c WDSWrapper.c + +TARGET_LIB = WDS$(TWL_LIBSUFFIX).a + +LINCLUDES = + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/wds/ARM9/src/WDS.c b/build/libraries_sysmenu/wds/ARM9/src/WDS.c new file mode 100644 index 00000000..a4d3e497 --- /dev/null +++ b/build/libraries_sysmenu/wds/ARM9/src/WDS.c @@ -0,0 +1,605 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: WDS.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +//********************************************************************** +/** +// @file WDS.c +// @brief 店頭親機がMP送信する接続先AP情報を受信 +// +// @author M.Okuno +// @date 2008/02/05 +// @version 01.00 +// +***********************************************************************/ +#include +#include +#ifdef WDS_WITHDWC +#include +#endif + +//----------------------------------------------------- +// Macros +//----------------------------------------------------- +/** + @brief スキャンバッファサイズ +*/ +#define WDS_SCAN_BUF_SIZE 1024 + +/** + @brief 親機AP情報GGID +*/ +#define WDS_APINFO_GGID 0x00000857 + +/** + @brief ステータス +*/ +enum +{ + WDS_STATUS_INIT , ///< 初期化中 + WDS_STATUS_STARTSCAN , ///< スキャン開始 + WDS_STATUS_ENDSCAN , ///< スキャン終了 + WDS_STATUS_END ///< 終了 +}; + +//----------------------------------------------------- +// Structs +//----------------------------------------------------- +/** + @brief WDSライブラリのワーク領域 +*/ +typedef struct WDSWork +{ + u8 wmwork[ WM_SYSTEM_BUF_SIZE ]; ///< WMライブラリ用バッファ + u8 scanbuf[ WDS_SCAN_BUF_SIZE ] ATTRIBUTE_ALIGN(32); ///< WMライブラリが使用するスキャンバッファ + WMScanExParam scanparam; ///< WMライブラリのスキャンパラメータ + WDSCallbackFunc scancb; ///< WMライブラリから呼び出されるコールバック + WDSApInfo apinfo[ WDS_APINFO_MAX ]; ///< スキャンしたAPビーコンを格納する配列 + u16 rssi[ WDS_APINFO_MAX ]; ///< 受信したAPビーコンの電波強度を格納する配列 + u16 tgid[ WDS_APINFO_MAX ]; ///< 複数のビーコンを識別するためのTGIDを格納する配列 + s32 apnum; ///< スキャン出来たAP情報数 + s32 apindex; ///< スキャン出来たAPを配列内のどこに書き込むかのインデックス + u32 status; ///< WDSライブラリのステータス + MATHCRC16Context crcContext; ///< CRC計算用コンテキスト + MATHCRC16Table crcTable; ///< CRC計算用テーブル +} WDSWork; + +//----------------------------------------------------- +// Variables +//----------------------------------------------------- +static WDSWork *gWdsWork = NULL; + +//-------------------------------------------------------------------------------- +/** WMBssDesc内のrssiのアッテネータ使用フラグを解釈し、単純に大小比較できる値に変換します + @param <1> アッテネータ使用フラグを含んだRSSI + @return 正規化されたRSSI + @note + WMライブラリから移植。 +*///------------------------------------------------------------------------------ +static u8 WDSGetRssi8(u8 rssi) +{ + if (rssi & 0x0002) + { + return (u8)(rssi >> 2); + } + return (u8)((rssi >> 2) + 25); +} + +//-------------------------------------------------------------------------------- +/** UTF8 → UCS2 へ変換します + @param <1> UTF8 文字 + @param <2> バイト判定 + @return UCS2 文字 + @note + browse_unicode.cpp から移植。 +*///------------------------------------------------------------------------------ +static u16 bu_UTF8_To_UCS2( const u8 *c, s32 *bytes_used ) +{ + u16 ret; + u8 b1, b2, b3; + + if( (*c & 0x80) == 0 ) { + // 1バイト、ASCII + ret = *c; + *bytes_used = 1; + } + else if( (*c & 0xe0) == 0xc0 ) { + // 2バイト、欧州文字とか? + b1 = (u8)(c[0] & 0x1f); + b2 = (u8)(c[1] & 0x3f); + ret = (u16)(( b1 << 6 ) | b2 ); + *bytes_used = 2; + } + else if( (*c & 0xf0) == 0xe0 ) { + // 3バイト、日本語はここかな + b1 = (u8)(c[0] & 0x0f); + b2 = (u8)(c[1] & 0x3f); + b3 = (u8)(c[2] & 0x3f); + ret = (u16)(( b1 << 12 ) | ( b2 << 6 ) | b3 ); + *bytes_used = 3; + } + else { + // 想定外の値の場合、ASCIIのハテナを返しとく + ret = 0x3F; + *bytes_used = 1; + } + return ret; +} + +//-------------------------------------------------------------------------------- +/** WM_StartScanEx() 用コールバック + @param <1> パラメータ +*///------------------------------------------------------------------------------ +static void WDSScanCallback( void *arg ) +{ + WMStartScanExCallback *pParam = (WMStartScanExCallback*)arg; + u32 i, j; + + // スキャンの結果得られたデータはARM7からDMA経由でメインメモリに直接書き込まれる + // そのためARM9のデータキャッシュをいったん無効化しなければデータを正常に読めないことに注意 + DC_InvalidateRange(gWdsWork->scanbuf, WDS_SCAN_BUF_SIZE); + + // 親機を発見したか判定 + if( pParam->errcode == WM_ERRCODE_SUCCESS && pParam->state == WM_STATECODE_PARENT_FOUND ) { + // 発見した親機の中に店頭用親機があるか検索 + for( i = 0 ; i < pParam->bssDescCount ; i++ ) { + // GGID 判定 + if( WM_IsValidGameInfo( &pParam->bssDesc[i]->gameInfo, sizeof(WMGameInfo) ) && pParam->bssDesc[i]->gameInfo.ggid == WDS_APINFO_GGID ) { + // AP 情報発見 + CRYPTORC4FastContext rc4context; + u8 rc4key[ 8 ]; + BOOL duplicated; + const u32 magic = 'WDS!'; + u8 *pCrcData; + u16 crc; + u32 crcLength; + + // ビーコンの重複チェック + duplicated = FALSE; + for( j = 0 ; j < gWdsWork->apnum ; j++ ) + { + if( gWdsWork->tgid[j] == pParam->bssDesc[i]->gameInfo.tgid ) + { + duplicated = TRUE; + break; + } + } + if( duplicated == TRUE ) + continue; + + // デバッグ表示 +#ifdef WDS_DEBUGPRINT + OS_TPrintf( "Found AP GGID : %08x TGID : %04x\n", pParam->bssDesc[i]->gameInfo.ggid, pParam->bssDesc[i]->gameInfo.tgid ); +#endif + + // ビーコン内容をコピーし、暗号化解除 + MI_CpuCopy8( pParam->bssDesc[i]->gameInfo.userGameInfo, &gWdsWork->apinfo[gWdsWork->apindex], sizeof(WDSApInfo) ); + MI_CpuCopy8( &magic, &rc4key[0], 4 ); + MI_CpuCopy8( &pParam->bssDesc[i]->bssid[2], &rc4key[4], 4 ); + CRYPTO_RC4FastInit( &rc4context, rc4key, 8 ); + CRYPTO_RC4FastEncrypt( &rc4context, &gWdsWork->apinfo[gWdsWork->apindex], sizeof(WDSApInfo), &gWdsWork->apinfo[gWdsWork->apindex] ); + + // CRC 判定 + pCrcData = (u8*)&gWdsWork->apinfo[gWdsWork->apindex]; + crcLength = sizeof(WDSApInfo) - sizeof(u16); + MATH_CRC16Update( &gWdsWork->crcTable, &gWdsWork->crcContext, pCrcData, crcLength ); + crc = MATH_CalcCRC16( &gWdsWork->crcTable, pCrcData, crcLength ); + + // 旧バージョンの親機はCRC部分に0x0000を入れているためそれだけは受け入れる + if( crc != gWdsWork->apinfo[gWdsWork->apindex].crc && gWdsWork->apinfo[gWdsWork->apindex].crc != 0x0000 ) { +#ifdef WDS_DEBUGPRINT + OS_TPrintf( "AP Infomation CRC Error.\n" ); +#endif + MI_CpuClear8( &gWdsWork->apinfo[gWdsWork->apindex], sizeof(WDSApInfo) ); + continue; + } + + // その他のデータを設定 + gWdsWork->rssi[gWdsWork->apindex] = WDSGetRssi8( (u8)pParam->bssDesc[i]->rssi ); + gWdsWork->tgid[gWdsWork->apindex] = pParam->bssDesc[i]->gameInfo.tgid; + gWdsWork->apindex = ( gWdsWork->apindex + 1 ) % WDS_APINFO_MAX; + gWdsWork->apnum = ( gWdsWork->apnum + 1 ); + if( gWdsWork->apnum > WDS_APINFO_MAX ) + gWdsWork->apnum = WDS_APINFO_MAX; + } + } + } + + // スキャン終了 + gWdsWork->status = WDS_STATUS_ENDSCAN; + + // コールバック実行 + if( gWdsWork->scancb ) + gWdsWork->scancb( arg ); +} + +//-------------------------------------------------------------------------------- +/** WDSライブラリが使用するワークエリアのサイズを得ます + @return 0 以外 : ワークエリアのサイズ + @note + ライブラリ初期化時に使用します +*///------------------------------------------------------------------------------ +size_t WDS_GetWorkAreaSize( void ) +{ + return sizeof( WDSWork ); +} + +//-------------------------------------------------------------------------------- +/** WDSを初期化します + @param <1> 呼び出し元によって確保されたバッファへのポインタを指定します + @param <2> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @param <3> WM_InitializeのdmaNoに準ずる引数 + @return 0 : 成功 ( コールバックを待つこと ) + @return 0 以外 : 失敗 + @note + <1> のサイズはWDS_SYSTEM_BUF_SIZEだけ必要であり、 + かつ 32バイトアラインされている必要があります。 + <2> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_Initialize()を実行する為、WMはREADYステートからIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_Initialize( void *wdsWork, WDSCallbackFunc callback, u16 dmaNo ) +{ + WMErrCode errcode; + + SDK_ASSERT( wdsWork ); + + if( callback == NULL ) + return -1; + + // ワーク用バッファ設定 + gWdsWork = (WDSWork*)wdsWork; + + // メモリ初期化 + MI_CpuClear8( gWdsWork, WDS_GetWorkAreaSize() ); + gWdsWork->status = WDS_STATUS_INIT; + + // CRC計算用コンテキスト・テーブル初期化 + MATH_CRC16Init( &gWdsWork->crcContext ); + MATH_CRC16InitTable( &gWdsWork->crcTable ); + + // WM ライブラリ初期化 + errcode = WM_Initialize( gWdsWork->wmwork, callback, dmaNo ); + if( errcode != WM_ERRCODE_OPERATING ) + return errcode; + return 0; +} + + +//-------------------------------------------------------------------------------- +/** WDSを初期化します(指定したスキャン結果を内部的に保持した状態での初期化) + @param <1> 呼び出し元によって確保されたバッファへのポインタを指定します + @param <2> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @param <3> WM_InitializeのdmaNoに準ずる引数 + @param <4> 事前にWDSを使用して取得したWDSBriefInfoの配列 + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のサイズはWDS_SYSTEM_BUF_SIZEだけ必要であり、 + かつ 32バイトアラインされている必要があります。 + <2> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_Initialize()を実行する為、WMはREADYステートからIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_InitializeEx( void *wdsWork, WDSCallbackFunc callback, u16 dmaNo, WDSBriefApInfo *apinfo ) +{ + WMErrCode errcode; + int i; + + SDK_ASSERT( wdsWork ); + + if( callback == NULL ) + return -1; + + // ワーク用バッファ設定 + gWdsWork = (WDSWork*)wdsWork; + + // メモリ初期化 + MI_CpuClear8( gWdsWork, WDS_GetWorkAreaSize() ); + gWdsWork->status = WDS_STATUS_INIT; + + // 初期値をコピー + for( i = 0 ; i < WDS_APINFO_MAX ; i++ ) + { + if( apinfo[i].isvalid == TRUE ) + { + gWdsWork->apnum++; + gWdsWork->apindex = ( gWdsWork->apindex + 1 ) % WDS_APINFO_MAX; + gWdsWork->apinfo[i] = apinfo[i].apinfo; + gWdsWork->rssi[i] = apinfo[i].rssi; + } + } + + // WM ライブラリ初期化 + errcode = WM_Initialize( gWdsWork->wmwork, callback, dmaNo ); + if( errcode != WM_ERRCODE_OPERATING ) + return errcode; + + // 初期値を入れた関係上、ステータスをスキャン完了にする + gWdsWork->status = WDS_STATUS_ENDSCAN; + + return 0; +} + +//-------------------------------------------------------------------------------- +/** WDSを終了します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 +*///------------------------------------------------------------------------------ +int WDS_End( WDSCallbackFunc callback ) +{ + WMErrCode errcode; + + if( callback == NULL ) + return -1; + + // WM 終了 + errcode = WM_End( callback ); + if( errcode != WM_ERRCODE_OPERATING ) + return errcode; + + // WDS 終了 + gWdsWork->status = WDS_STATUS_END; + gWdsWork = NULL; + + return 0; +} + +//-------------------------------------------------------------------------------- +/** DS配信システム親機ビーコンをスキャンを開始します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_StartScane()を実行する為、WMはIDLEステートの場合はSCANステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_StartScan( WDSCallbackFunc callback ) +{ + WMErrCode errcode; + + SDK_ASSERT( gWdsWork ); + + if( callback == NULL ) + return -1; + + // スキャンパラメータ設定 + // スキャンチャンネルは 1, 7, 13 + // 300ms〜600ms スキャンを行う + gWdsWork->scanparam.scanBuf = (WMBssDesc*)&gWdsWork->scanbuf; + gWdsWork->scanparam.scanBufSize = WDS_SCAN_BUF_SIZE; + gWdsWork->scanparam.channelList = WM_GetAllowedChannel(); + gWdsWork->scanparam.maxChannelTime = WM_GetDispersionScanPeriod(); + gWdsWork->scanparam.scanType = WM_SCANTYPE_PASSIVE; + MI_CpuFill8( gWdsWork->scanparam.bssid, 0xFF, WDS_MACADDR_BUF_SIZE ); + + // コールバック保存 + gWdsWork->scancb = callback; + + // スキャン開始 + gWdsWork->status = WDS_STATUS_STARTSCAN; + errcode = WM_StartScanEx( WDSScanCallback, &gWdsWork->scanparam ); + if( errcode != WM_ERRCODE_OPERATING ) + return errcode; + return 0; +} + +//-------------------------------------------------------------------------------- +/** DS配信システム親機ビーコンをスキャンを終了します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_EndScan()を実行する為、WMはIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_EndScan( WDSCallbackFunc callback ) +{ + WMErrCode errcode; + + SDK_ASSERT( gWdsWork ); + + if( callback == NULL ) + return -1; + + // スキャン終了 + gWdsWork->status = WDS_STATUS_ENDSCAN; + errcode = WM_EndScan( callback ); + if( errcode != WM_ERRCODE_OPERATING ) + return errcode; + return 0; +} + +//-------------------------------------------------------------------------------- +/** APビーコン情報の数を取得します + @return 0 以上 : 成功 + 0 未満 : 失敗 ( スキャン中 ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoNum( void ) +{ + SDK_ASSERT( gWdsWork ); + + // スキャン中判定 + if( gWdsWork->status != WDS_STATUS_ENDSCAN ) + return -1; + return gWdsWork->apnum; +} + +//-------------------------------------------------------------------------------- +/** APビーコン情報をインデックスを指定して取得します + @param <1> 取得するAPビーコン情報のインデックス値(0〜15) + @param <2> 取得するAPビーコン情報を書き込む領域へのポインタ + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoByIndex( int index, WDSBriefApInfo *briefapinfo ) +{ + SDK_ASSERT( gWdsWork ); + + // スキャン中判定 + if( gWdsWork->status != WDS_STATUS_ENDSCAN ) + return -1; + + // インデックスエラー判定 + if( index < 0 || index >= gWdsWork->apnum ) + return -1; + + // メモリ初期化 + MI_CpuClear8( briefapinfo, sizeof(WDSBriefApInfo) ); + + // その他設定 + briefapinfo->isvalid = TRUE; + briefapinfo->rssi = gWdsWork->rssi[index]; + MI_CpuCopy8(&gWdsWork->apinfo[index], &briefapinfo->apinfo, sizeof(WDSApInfo)); + + return 0; +} + +//-------------------------------------------------------------------------------- +/** APビーコン情報を全て取得します + @param <1> 取得するAPビーコン情報を書き込む配列の先頭へのポインタ(WDS_APINFO_MAX個の要素が必要) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoAll( WDSBriefApInfo *briefapinfo ) +{ + int index; + + SDK_ASSERT( gWdsWork ); + + // スキャン中判定 + if( gWdsWork->status != WDS_STATUS_ENDSCAN ) + return -1; + + // メモリ初期化 + MI_CpuClear8( briefapinfo, sizeof(WDSBriefApInfo)*WDS_APINFO_MAX ); + for( index = 0 ; index < WDS_APINFO_MAX ; index++ ) + { + briefapinfo[index].isvalid = FALSE; + } + + // 指定インデックスのAPビーコン情報をコピー + // ホットスポット名を設定 ( UTF-8 の場合は UTF-16 に変換 ) + // 全てのAPビーコン情報をコピー + for( index = 0 ; index < gWdsWork->apnum ; index++ ) { + if( WDS_GetApInfoByIndex( index, briefapinfo+index ) == -1 ) + break; + } + + return 0; +} + +#ifdef WDS_WITHDWC +//-------------------------------------------------------------------------------- +/** APビーコン情報をDWCの自動接続先として設定します + @param <1> 自動接続先として設定するAPビーコン情報のインデックス値(0〜15) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_SetConnectTargetByIndex( int index ) +{ + SDK_ASSERT( gWdsWork ); + + // スキャン中判定 + if( gWdsWork->status != WDS_STATUS_ENDSCAN ) + return -1; + + // インデックスエラー判定 + if( index < 0 || index >= gWdsWork->apnum ) + return -1; + + // 指定 SSID へ接続 + DWC_AC_SetSpecifyAp( gWdsWork->apinfo[index].ssid, gWdsWork->apinfo[index].wepkey, gWdsWork->apinfo[index].encryptflag ); + + return 0; +} + +//-------------------------------------------------------------------------------- +/** APビーコン情報をDWCの自動接続先として設定します + @param <1> 自動接続先として設定するAPビーコン情報 + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_SetConnectTargetByBriefApInfo( WDSBriefApInfo *briefapinfo ) +{ + SDK_ASSERT( gWdsWork ); + + // スキャン中判定 + if( gWdsWork->status != WDS_STATUS_ENDSCAN ) + return -1; + + // 指定 SSID へ接続 + DWC_AC_SetSpecifyAp( briefapinfo->apinfo.ssid, briefapinfo->apinfo.wepkey, briefapinfo->apinfo.encryptflag ); + + return 0; +} +#endif + +//-------------------------------------------------------------------------------- +/** APビーコン情報のAP説明文をUTF-16で得ます + @param <1> AP説明文を取得する対象のAPビーコン情報 + <2> AP説明文を書き込むバッファへのポインタ(WDS_HOTSPOTNAME_UTF16_BUF_SIZEバイト) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApDescriptionUTF16( WDSBriefApInfo *briefapinfo, void *outbuf ) +{ + SDK_ASSERT( briefapinfo->isvalid ); + + // バッファをクリア + MI_CpuClear8( outbuf, WDS_HOTSPOTNAME_UTF16_BUF_SIZE ); + + // 指定インデックスのAPビーコン情報をコピー + // ホットスポット名を設定 ( UTF-8 の場合は UTF-16 に変換 ) + if( (briefapinfo->apinfo.hotspotid & WDS_HOTSPOT_ENCODE_MASK) == WDS_HOTSPOT_ENCODE_UTF8 ) { + // UTF-8 + u8 *pStr = briefapinfo->apinfo.hotspotname; + u8 *pEndStr = briefapinfo->apinfo.hotspotname + WDS_HOTSPOTNAME_BUF_SIZE; + u16 *pUcs2 = (u16*)outbuf; + s32 temp; + + // UTF-16に変換 + while( pStr != pEndStr && *pStr != '\0' ) { + *pUcs2 = bu_UTF8_To_UCS2( pStr, &temp ); + pStr += temp; + pUcs2 += 1; + } + } + else { + // UTF-16 + MI_CpuCopy8( briefapinfo->apinfo.hotspotname, outbuf, WDS_HOTSPOTNAME_BUF_SIZE ); + } + + return 0; +} diff --git a/build/libraries_sysmenu/wds/ARM9/src/WDSWrapper.c b/build/libraries_sysmenu/wds/ARM9/src/WDSWrapper.c new file mode 100644 index 00000000..d224e166 --- /dev/null +++ b/build/libraries_sysmenu/wds/ARM9/src/WDSWrapper.c @@ -0,0 +1,1002 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: WDS.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +//********************************************************************** +/** +// @file WDSWrapper.c +// @brief WDSライブラリのラッパー +// +// @author S.Nakata +// @date 2008/06/24 +// @version 01.00 +// +***********************************************************************/ +#include +#ifdef WDS_WITHDWC +#include +#endif + +//----------------------------------------------------- +// Structs +//----------------------------------------------------- + +/** + @brief WDSラッパーのワーク領域 +*/ +typedef struct WDSWrapperWork +{ + u8 *stack; //!< WDSラッパーが使用するスタック + OSThread thread; //!< WDSラッパーが使用するスレッド構造体 + + u8 *wdswork; //!< WDSが使用するワークエリア + + WDSBriefApInfo briefapinfo[WDS_APINFO_MAX]; //!< WDSラッパーがWDSを使用した結果を格納する領域 + WDSBriefApInfo briefapinfo_previous[WDS_APINFO_MAX]; //!< 直前のWDSを使用した結果を格納する領域 + int briefapinfonum; //!< WDSラッパーがWDSを使用した結果を格納する領域 + int briefapinfonum_previous; //!< 直前のWDSを使用した結果を格納する領域 + + WDSWrapperInitializeParam initparam; //!< 初期化時パラメータのコピー + WDSWrapperStateThreadState state; //!< WDSラッパーのステート + OSTick tickstart; //!< 各種時間測定用 + + BOOL terminate; //!< 解放開始フラグ + BOOL idle; //!< 間欠スキャン中断フラグ + BOOL restart; //!< 間欠スキャン再開フラグ + +#ifdef SDK_TWL + OSDeliverArgInfo deliverinfo; //!< TWL用アプリ間引数ワークエリア +#endif + + BOOL callingback; //!< コールバック関数呼び出し中はTRUE +} WDSWrapperWork; + +//----------------------------------------------------- +// Variables +//----------------------------------------------------- +static WDSWrapperWork *g_wdswrapperwork = NULL; + +//----------------------------------------------------- +// Internal Functions +//----------------------------------------------------- +static void WDS_WrapperInitialize_CB( void *arg ); +static void WDS_WrapperStartScan_CB( void *arg ); +static void WDS_WrapperEndScan_CB(void *arg); +static void WDS_WrapperEnd_CB( void *arg ); +static void WDS_WrapperCallUserCallback( void *arg ); + +//-------------------------------------------------------------------------------- +/** ユーザー指定のコールバック関数を呼び出すユーティリティ関数 + @param arg コールバック関数に与えるパラメータ + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperCallUserCallback( void *arg ) +{ + g_wdswrapperwork->callingback = TRUE; + g_wdswrapperwork->initparam.callback( arg ); + g_wdswrapperwork->callingback = FALSE; +} + +//-------------------------------------------------------------------------------- +/** アクセスポイント情報のデバッグ用表示関数 + @param apinfo デバッグ表示を行うWDSApInfoへのポインタ + @return なし +*///------------------------------------------------------------------------------ +static void DumpWDSApInfo( WDSApInfo *apinfo ) +{ + int i; + char buf[256]; + + // SSID + MI_CpuCopy8( apinfo->ssid, buf, WDS_SSID_BUF_SIZE) ; + buf[WDS_SSID_BUF_SIZE] = 0x00; + OS_TPrintf( "SSID: %s\n", buf ); + + // APNUM + MI_CpuCopy8( apinfo->apnum, buf, WDS_APNUM_BUF_SIZE) ; + buf[WDS_APNUM_BUF_SIZE] = 0x00; + OS_TPrintf( "APNUM: %s\n", buf ); + + // HOTSPOTID + OS_TPrintf( "hotspotid: %d\n", apinfo->hotspotid ); + + // HOTSPOTNAME + OS_TPrintf( "hotspotname: " ); + for( i = 0 ; i < WDS_HOTSPOTNAME_BUF_SIZE ; i++ ) + { + OS_TPrintf( "%02x", apinfo->hotspotname[i] ); + } + OS_TPrintf( "\n" ); + + // WEPKEY + OS_TPrintf( "wepkey: " ); + for( i = 0 ; i < WDS_WEPKEY_BUF_SIZE ; i++ ) + { + OS_TPrintf( "%02x", apinfo->wepkey[i] ); + } + OS_TPrintf( "\n" ); + + // CHANNEL + OS_TPrintf( "channel: %d\n", apinfo->channel ); + + // ENCRYPTFLAG + OS_TPrintf( "encryptmethod: %d\n", apinfo->encryptflag); + + // INFOFLAG + OS_TPrintf( "infoflag: %02d\n", apinfo->infoflag); + + // RESERVE + OS_TPrintf( "reserve: " ); + for( i = 0 ; i < 5 ; i++ ) + { + OS_TPrintf( "%02x", apinfo->reserve[i] ); + } + OS_TPrintf( "\n" ); + + // MTU + OS_TPrintf( "mtu: %d\n", apinfo->mtu); + + // CRC + OS_TPrintf( "crc: %04x\n", apinfo->crc); +} + +//-------------------------------------------------------------------------------- +/** スキャン開始前ウェイトステート関数 + @param なし + @return なし + @note + @LI このステートに入っている場合、WMからのコールバックが発生する可能性はない + @LI IF関数からのフラグ変化がイレギュラーな存在としてあるが + @LI Mutexのロックを行わなくても、処理中のフラグ変化による動作異常はない +*///------------------------------------------------------------------------------ +static void WDS_WrapperBeforeInitState( void ) +{ + if( g_wdswrapperwork->restart == TRUE ) { + // 待っている途中だがすぐに受信を開始 + g_wdswrapperwork->restart = FALSE; + + // 連続スキャン開始時間の記録 + g_wdswrapperwork->tickstart = OS_GetTick(); + + // 現スキャン状態のスキャン結果をクリア + g_wdswrapperwork->briefapinfonum = 0; + + // スキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_INIT; + return; + } + else if( g_wdswrapperwork->terminate == TRUE ) { + // すでにWDSが解放されているので直接ステートを変化させる + g_wdswrapperwork->state = WDSWRAPPER_STATE_TERMINATE; + return; + } + else if( g_wdswrapperwork->idle == TRUE ) { + WDSWrapperCallbackParam param; + + // すでにWDSが解放されているのでコールバックを呼び出し、直接ステートを変化させる + g_wdswrapperwork->idle = FALSE; + g_wdswrapperwork->state = WDSWRAPPER_STATE_IDLE; + + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STOPSCAN; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し(このコールバックのスレッド優先度はWMスレッドの優先度ではない) + WDS_WrapperCallUserCallback( ¶m ); + + return; + } + + // 十分長い時間待ったかを確認 + if( g_wdswrapperwork->tickstart + OS_MilliSecondsToTicks( WDSWRAPPER_WAITPERIOD ) < OS_GetTick() ) { + // 連続スキャン開始時間の記録 + g_wdswrapperwork->tickstart = OS_GetTick(); + + // 現スキャン状態のスキャン結果をクリア + g_wdswrapperwork->briefapinfonum = 0; + + // スキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_INIT; + } +} + +//-------------------------------------------------------------------------------- +/** 初期化開始ステート関数 + @param なし + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperInitState( void ) +{ + WMErrCode err; +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("*** WDS_WrapperInitState\n"); +#endif + + // 初期化完了待ちステートをあらかじめ設定しておく + g_wdswrapperwork->state = WDSWRAPPER_STATE_WAITINIT; + + err = (WMErrCode)WDS_Initialize( g_wdswrapperwork->wdswork, WDS_WrapperInitialize_CB, 0 ); + if( err == WM_ERRCODE_SUCCESS || err == WM_ERRCODE_OPERATING ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_Initialize successed\n"); +#endif + } + else { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_Initialize failed\n"); +#endif + // 初期化開始に失敗したのでWDSラッパー解放ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_TERMINATE; + } +} + +//-------------------------------------------------------------------------------- +/** 初期化コールバック関数 + @param arg 非同期処理の結果を格納するWMCallback型変数へのポインタ + @return なし + @note + @LI この関数が呼ばれる際のステートは常にWDSWRAPPER_STATE_WAITINIT + @LI 何の処理もメインスレッドは行っていない + @LI 処理成功時は自動的にスキャン開始ステートへ + @LI 処理失敗時は自動的にWDSラッパー解放ステートへ +*///------------------------------------------------------------------------------ +static void WDS_WrapperInitialize_CB( void *arg ) +{ + WMCallback *callback = (WMCallback *)arg; + WDSWrapperCallbackParam param; + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf("WDS_Initialize_CB\n"); +#endif + + // 返り値に基づいてコールバックパラメータを設定 + param.callback = WDSWRAPPER_CALLBACK_INITIALIZE; + if( callback->errcode != WM_ERRCODE_SUCCESS ) + param.errcode = WDSWRAPPER_ERRCODE_FAILURE; + else + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + + // 返り値に基づいてステートを変更 + if( callback->errcode != WM_ERRCODE_SUCCESS ) + g_wdswrapperwork->state = WDSWRAPPER_STATE_TERMINATE; + else { + // スキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_SCAN; + + // 連続スキャン開始時間の記録 + g_wdswrapperwork->tickstart = OS_GetTick(); + } +} + +//-------------------------------------------------------------------------------- +/** スキャン開始ステート関数 + @param なし + @return なし + @note + @LI この関数が呼ばれる際は、WDSは初期化済みだがWDS_StartScan要因以外でコールバック関数は呼ばれない +*///------------------------------------------------------------------------------ +static void WDS_WrapperScanState( void ) +{ + WMErrCode err; +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf( "*** WDS_WrapperScanState\n" ); +#endif + + // スキャン完了待ちステートへあらかじめ移行しておく + g_wdswrapperwork->state = WDSWRAPPER_STATE_WAITSCAN; + + err = (WMErrCode)WDS_StartScan( WDS_WrapperStartScan_CB ); + if( err == WM_ERRCODE_SUCCESS ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_StartScan successed\n"); +#endif + } + else { + // スキャン開始に失敗したのでWDS解放開始ステートへ +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf( "WDS_StartScan failed\n" ); +#endif + g_wdswrapperwork->state = WDSWRAPPER_STATE_END; + } +} + +//-------------------------------------------------------------------------------- +/** スキャン完了待ちステート関数 + @param なし + @return なし + @note + @LI このステートの間は外部IFからのキャンセルを受け付ける + @LI この処理の中でフラグが変化しても、動作は結局同じなのでMutexロックはしない +*///------------------------------------------------------------------------------ +static void WDS_WrapperWaitScanState( void ) +{ + if( g_wdswrapperwork->terminate == TRUE ) { + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + } + else if( g_wdswrapperwork->idle == TRUE ) { + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + } +} + +//-------------------------------------------------------------------------------- +/** スキャン開始コールバック関数 + @param arg 非同期処理の結果を格納するWMCallback型変数へのポインタ + @return なし + @note + @LI ユーザー中断が原因で、ステートがWDSWRAPPER_STATE_WAITSCANではない場合がある + @LI 処理成功時はスキャン時間に基づいてIDLEかスキャン前ウェイトステートへ + @LI 処理失敗時はスキャン停止後WDSラッパー解放ステートへ +*///------------------------------------------------------------------------------ +static void WDS_WrapperStartScan_CB( void *arg ) +{ +#pragma unused( arg ) +#ifdef WDSWRAPPER_DEBUGPRINT + int i; +#endif + WDSWrapperCallbackParam param; + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("*** WDS_WrapperStartScan_CB\n"); +#endif + + // ライブラリがすでに解放済みである場合に備える + if( g_wdswrapperwork == NULL ) + return; + + // 外部からの停止等の理由でコールバック待ちステートでない場合には何もしない + if( g_wdswrapperwork->state != WDSWRAPPER_STATE_WAITSCAN ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("state != WDSWRAPPER_STATE_WAITSCAN\n"); +#endif + return; + } + + // スキャン結果を取得する + if( WDS_GetApInfoAll( g_wdswrapperwork->briefapinfo ) != 0 ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf( "WDS_GetApInfoAll failed\n" ); +#endif + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STARTSCAN; + param.errcode = WDSWRAPPER_ERRCODE_FAILURE; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + + // ただちにスキャン停止ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + + // 最終的にTERMINATEステートに入るよう設定 + g_wdswrapperwork->terminate = TRUE; + + return; + } + else { + // ビーコン数を格納 + g_wdswrapperwork->briefapinfonum = WDS_GetApInfoNum(); + } + + + if( g_wdswrapperwork->tickstart + OS_MilliSecondsToTicks( WDSWRAPPER_SCANPERIOD ) < OS_GetTick() ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("*** WDS_WrapperCompleteScanState: Scanned more than %u [ms]\n", WDSWRAPPER_SCANPERIOD ); +#endif + +#ifdef WDSWRAPPER_DEBUGPRINT + // スキャン結果を取得したのでデバッグ表示 + for( i = 0 ; i < WDS_APINFO_MAX ; i++ ) { + if( g_wdswrapperwork->briefapinfo[i].isvalid == TRUE ) { + OS_TPrintf( "================================\n" ); + OS_TPrintf( "rssi: %d\n", g_wdswrapperwork->briefapinfo[i].rssi ); + DumpWDSApInfo( &( g_wdswrapperwork->briefapinfo[i].apinfo ) ); + OS_TPrintf( "================================\n" ); + } + } +#endif + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STARTSCAN2; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + + // これまでのスキャン結果を直前のスキャン結果を保持しておく場所にコピー + MI_CpuCopy8( g_wdswrapperwork->briefapinfo, g_wdswrapperwork->briefapinfo_previous, sizeof(g_wdswrapperwork->briefapinfo) ); + g_wdswrapperwork->briefapinfonum_previous = g_wdswrapperwork->briefapinfonum; + + // 十分長い時間スキャンしたのでスキャン中断ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + } + else { + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STARTSCAN; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + + // ただちにスキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_SCAN; + } +} + +//-------------------------------------------------------------------------------- +/** スキャン停止開始ステート関数 + @param なし + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperEndScanState( void ) +{ + WMErrCode err; +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf( "*** WDS_WrapperEndScanState\n" ); +#endif + + // スキャン停止待ちステートへあらかじめ移行しておく + g_wdswrapperwork->state = WDSWRAPPER_STATE_WAITENDSCAN; + + err = (WMErrCode)WDS_EndScan( WDS_WrapperEndScan_CB ); + if( err == WM_ERRCODE_SUCCESS || err == WM_ERRCODE_ILLEGAL_STATE ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_EndScan successed\n"); +#endif + // WDS解放ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_END; + } + else if( err == WM_ERRCODE_OPERATING ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_EndScan asynchronously successed\n"); +#endif + } + else + { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_EndScan failed\n"); +#endif + // 再度スキャン停止を試みる + // (これは処理的に無限ループに入る可能性があるのでまずいが、そもそもスキャンが止まっていないとWM_Endもできないので不可避) + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + } +} + +//-------------------------------------------------------------------------------- +/** スキャン停止コールバック関数 + @param arg 非同期処理の結果を格納するWMCallback型変数へのポインタ + @return なし + @note + @LI このコールバックが呼ばれる際は、ステートは必ずWDSWRAPPER_STATE_WAITENDSCAN + @LI 処理成功時は自動的にWDS解放ステートへ + @LI 処理失敗時は自動的に再度スキャン停止ステートへ +*///------------------------------------------------------------------------------ +static void WDS_WrapperEndScan_CB(void *arg) +{ + WMCallback *callback = (WMCallback *)arg; + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf("WDS_WrapperEndScan_CB\n"); +#endif + + if( callback->errcode != WM_ERRCODE_SUCCESS ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_EndScan success\n"); +#endif + // 再度スキャン停止を試みる + // (これは処理的に無限ループに入る可能性があるのでまずいが、そもそもスキャンが止まっていないとWM_Endもできないので不可避) + g_wdswrapperwork->state = WDSWRAPPER_STATE_ENDSCAN; + } + else { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_EndScan success\n"); +#endif + // スキャン停止完了したら自動的にWDS解放ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_END; + } +} + +//-------------------------------------------------------------------------------- +/** 解放開始ステート関数 + @param なし + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperEndState( void ) +{ + WMErrCode err; + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("*** WDS_WrapperEndState\n"); +#endif + + + // 解放待ちステートへあらかじめ移行しておく + g_wdswrapperwork->state = WDSWRAPPER_STATE_WAITEND; + err = (WMErrCode)WDS_End( WDS_WrapperEnd_CB ); + + if( err == WM_ERRCODE_SUCCESS ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_End successed\n"); +#endif + } + else if( err == WM_ERRCODE_OPERATING ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_End asynchronously successed\n"); +#endif + } + else { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_Printf("WDS_End failed\n"); +#endif + // 引き続き解放を試みる + g_wdswrapperwork->state = WDSWRAPPER_STATE_END; + } +} + +//-------------------------------------------------------------------------------- +/** 解放開始コールバック関数 + @param arg 非同期処理の結果を格納するWMCallback型変数へのポインタ + @return なし + @note + @LI WDS_Endは常に成功するため、フラグに基づいてIDLEまたは初期化前ウェイトまたはライブラリ解放ステートへ +*///------------------------------------------------------------------------------ +static void WDS_WrapperEnd_CB( void *arg ) +{ +#pragma unused(arg) + WDSWrapperCallbackParam param; + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf("WDS_WrapperEnd_CB\n"); +#endif + + // WDSを終了したタイミングを記録しておく + g_wdswrapperwork->tickstart = OS_GetTick(); + + // WDS_End後のステートを各種フラグに基づいて変更 + if( g_wdswrapperwork->terminate == TRUE ) { + g_wdswrapperwork->terminate = FALSE; + g_wdswrapperwork->state = WDSWRAPPER_STATE_TERMINATE; + } + else if( g_wdswrapperwork->idle == TRUE ) { + g_wdswrapperwork->idle = FALSE; + g_wdswrapperwork->state = WDSWRAPPER_STATE_IDLE; + + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STOPSCAN; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + } + else { + g_wdswrapperwork->state = WDSWRAPPER_STATE_BEFOREINIT; + } +} + +//-------------------------------------------------------------------------------- +/** アイドルステート関数 + @param なし + @return なし + @LI このステートの間は外部IFからのスキャン開始とライブラリ解放を受け付ける + @LI この処理の中でフラグが変化しても、動作は結局同じなのでMutexロックはしない +*///------------------------------------------------------------------------------ +static void WDS_WrapperIdleState( void ) +{ + WDSWrapperCallbackParam param; + + if( g_wdswrapperwork->terminate == TRUE ) { + g_wdswrapperwork->state = WDSWRAPPER_STATE_TERMINATE; + } + else if( g_wdswrapperwork->idle == TRUE ) { + // すでにIDLE状態のため、成功コールバックを返す + g_wdswrapperwork->idle = FALSE; + g_wdswrapperwork->state = WDSWRAPPER_STATE_IDLE; + + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STOPSCAN; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + } + else if( g_wdswrapperwork->restart == TRUE ) + { + g_wdswrapperwork->idle = FALSE; + g_wdswrapperwork->restart = FALSE; + + // 連続スキャン開始時間の記録 + g_wdswrapperwork->tickstart = OS_GetTick(); + + // 現スキャン状態のスキャン結果をクリア + g_wdswrapperwork->briefapinfonum = 0; + + // スキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_INIT; + } +} + +//-------------------------------------------------------------------------------- +/** WDSラッパーライブラリが内部で実行するスレッド関数 + @param arg 常にNULL + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperThreadFunc( void *arg ) +{ +#pragma unused( arg ) + WDSWrapperCallbackParam param; + + // 間欠受信のビーコン数を初期化 + g_wdswrapperwork->briefapinfonum = 0; + + // スキャン開始ステートへ + g_wdswrapperwork->state = WDSWRAPPER_STATE_INIT; + + while( 1 ) { + OS_Sleep( 20 ); + + // ステートにより処理を分岐(ステート処理中はmutexによりlockが行われる) + if( g_wdswrapperwork->state == WDSWRAPPER_STATE_TERMINATE ) + break; + OS_Sleep( 20 ); + + switch( g_wdswrapperwork->state ) { + case WDSWRAPPER_STATE_BEFOREINIT: WDS_WrapperBeforeInitState(); break; + case WDSWRAPPER_STATE_INIT: WDS_WrapperInitState(); break; + case WDSWRAPPER_STATE_WAITINIT: break; + case WDSWRAPPER_STATE_SCAN: WDS_WrapperScanState(); break; + case WDSWRAPPER_STATE_WAITSCAN: WDS_WrapperWaitScanState(); break; + case WDSWRAPPER_STATE_ENDSCAN: WDS_WrapperEndScanState(); break; + case WDSWRAPPER_STATE_WAITENDSCAN: break; + case WDSWRAPPER_STATE_END: WDS_WrapperEndState(); break; + case WDSWRAPPER_STATE_WAITEND: break; + case WDSWRAPPER_STATE_IDLE: WDS_WrapperIdleState(); break; + case WDSWRAPPER_STATE_TERMINATE: break; + } + } + + // スキャン停止要求を受けたが、その後WDSWrapper解放要求を受け、スキャン停止コールバックが発生せずにここにきた場合の対策コード + if( g_wdswrapperwork->idle == TRUE ) { + g_wdswrapperwork->idle = FALSE; + + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_STOPSCAN; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); + } + + // コールバックパラメータの設定 + param.callback = WDSWRAPPER_CALLBACK_CLEANUP; + param.errcode = WDSWRAPPER_ERRCODE_SUCCESS; + + // コールバック関数の呼び出し + WDS_WrapperCallUserCallback( ¶m ); +} + +//-------------------------------------------------------------------------------- +/** WDSコントロールスレッドデストラクタ + @param arg 常にNULL + @return なし +*///------------------------------------------------------------------------------ +static void WDS_WrapperThreadDestructor( void *arg ) +{ +#pragma unused( arg ) + if( g_wdswrapperwork != NULL ) { + if( g_wdswrapperwork->stack != NULL ) { + g_wdswrapperwork->initparam.free( g_wdswrapperwork->stack ); + g_wdswrapperwork->stack = NULL; + } + if( g_wdswrapperwork->wdswork != NULL ) { + g_wdswrapperwork->initparam.free( g_wdswrapperwork->wdswork ); + g_wdswrapperwork->wdswork = NULL; + } + g_wdswrapperwork->initparam.free( g_wdswrapperwork ); + g_wdswrapperwork = NULL; + } +} + +//----------------------------------------------------- +// External Functions +//----------------------------------------------------- + +//-------------------------------------------------------------------------------- +/** + WDSラッパーライブラリ初期化の非同期処理を開始します。
    + 初期化処理完了時にコールバックが発生します。
    + コールバック関数でエラー通知を受け取った場合は、ライブラリが自動的に解放されるのを待ってください。 + @param param WDSラッパー初期化パラメータ + @return WDSWRAPPER_ERRCODE_SUCCESS: 初期化処理を開始 + @return WDSWRAPPER_ERRCODE_INITIALIZED: WDSラッパーライブラリは初期化済み + @return WDSWRAPPER_ERRCODE_FAILURE: 初期化に失敗 + @note + ・WDSコントロールスレッドは生成直後から間欠スキャンを実行しています +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperInitialize( WDSWrapperInitializeParam param ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork != NULL ) + return WDSWRAPPER_ERRCODE_INITIALIZED; + + // パラメータのサニティチェック + if( param.callback == NULL || param.alloc == NULL || param.free == NULL ) + return WDSWRAPPER_ERRCODE_FAILURE; + + // ワークエリアを初期化 + g_wdswrapperwork = param.alloc( sizeof( WDSWrapperWork ) ); + if( g_wdswrapperwork == NULL ) + goto FAILURE; + MI_CpuClear8( g_wdswrapperwork, sizeof( WDSWrapperWork ) ); + + // スタック領域・WDSワークエリアの初期化 + g_wdswrapperwork->stack = param.alloc( WDSWRAPPER_STACKSIZE ); + if( g_wdswrapperwork->stack == NULL ) + goto FAILURE; + g_wdswrapperwork->wdswork = param.alloc( WDS_GetWorkAreaSize() ); + if( g_wdswrapperwork->wdswork == NULL ) + goto FAILURE; + + // パラメータのコピー + g_wdswrapperwork->initparam = param; + + // スレッドの生成 + OS_CreateThread( &g_wdswrapperwork->thread, + WDS_WrapperThreadFunc, + NULL, + g_wdswrapperwork->stack + WDSWRAPPER_STACKSIZE, + WDSWRAPPER_STACKSIZE, + g_wdswrapperwork->initparam.threadprio + ); + + // ワークエリア解放用のスレッドデストラクタを設定 + OS_SetThreadDestructor( &g_wdswrapperwork->thread, WDS_WrapperThreadDestructor ); + + // スレッドの実行 + OS_WakeupThreadDirect( &g_wdswrapperwork->thread ); + + // 初期化成功 + return WDSWRAPPER_ERRCODE_SUCCESS; + +FAILURE: + if( g_wdswrapperwork != NULL ) { + if( g_wdswrapperwork->stack != NULL ) { + param.free( g_wdswrapperwork->stack ); + g_wdswrapperwork->stack = NULL; + } + if( g_wdswrapperwork->wdswork != NULL ) { + param.free( g_wdswrapperwork->wdswork ); + g_wdswrapperwork->wdswork = NULL; + } + param.free( g_wdswrapperwork ); + g_wdswrapperwork = NULL; + } + return WDSWRAPPER_ERRCODE_FAILURE; +} + +//-------------------------------------------------------------------------------- +/** + WDSコントロールスレッドを停止し、WDSラッパーライブラリを解放します。
    + 解放処理完了の直前にコールバックが発生します。
    + コールバック関数にエラーが通知されることはありません。 + @param なし + @return WDSWRAPPER_ERRCODE_SUCCESS WDSラッパー解放を開始 + @return WDSWRAPPER_ERRCODE_OPERATING WDSラッパー解放を実行中 + @return WDSWRAPPER_ERRCODE_UNINITIALIZED WDSラッパーライブラリが初期化されていない +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperCleanup( void ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + // 解放処理実行中をチェック + if( g_wdswrapperwork->terminate == TRUE ) { + return WDSWRAPPER_ERRCODE_OPERATING; + } + + g_wdswrapperwork->terminate = TRUE; + + return WDSWRAPPER_ERRCODE_SUCCESS; +} + +//-------------------------------------------------------------------------------- +/** + WDSコントロールスレッドのステートを間欠受信状態に変更します。
    + ステートの変更に成功すると、以後一回の間欠受信が完了するたびにコールバックが呼び出されます。
    + コールバック関数でエラー通知を受け取った場合は、ライブラリが自動的に解放されるのを待ってください。 + @return WDSWRAPPER_ERRCODE_SUCCESS: ステート変更に成功(コールバック発生を待ってください) + @return WDSWRAPPER_ERRCODE_FAILURE: 間欠受信に移行できるステートでない(現在のステートが維持されます) + @return WDSWRAPPER_ERRCIDE_OPERATING: すでにステートが間欠受信状態 + @return WDSWRAPPER_ERRCODE_UNINITIALIZED: WDSラッパーライブラリが初期化されていない +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperStartScan( void ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + // ステートがIDLEかBEFOREINITであることを確認 + if( g_wdswrapperwork->state != WDSWRAPPER_STATE_IDLE && g_wdswrapperwork->state != WDSWRAPPER_STATE_BEFOREINIT ) { + return WDSWRAPPER_ERRCODE_FAILURE; + } + + // 再スタート処理実行中をチェック + if( g_wdswrapperwork->restart == TRUE ) { + return WDSWRAPPER_ERRCODE_OPERATING; + } + + g_wdswrapperwork->restart = TRUE; + + return WDSWRAPPER_ERRCODE_SUCCESS; +} + +//-------------------------------------------------------------------------------- +/** + WDSコントロールスレッドのステートを間欠受信停止状態に設定します。
    + 間欠受信が実際に停止した際にコールバックが呼び出されます。
    + コールバックでエラーが通知されることはありません。 + @return WDSWRAPPER_ERRCODE_SUCCESS: ステート変更に成功 + @return WDSWRAPPER_ERRCIDE_OPERATING: すでにステートが間欠受信停止状態 + @return WDSWRAPPER_ERRCODE_UNINITIALIZED: WDSラッパーライブラリが初期化されていない + @note + ステート変更が行われてから間欠受信が停止するまでには20ms程度の時間がかかります +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperStopScan( void ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + // 間欠受信停止処理実行中をチェック + if( g_wdswrapperwork->idle == TRUE ) { + return WDSWRAPPER_ERRCODE_OPERATING; + } + + g_wdswrapperwork->idle = TRUE; + + return WDSWRAPPER_ERRCODE_SUCCESS; +} + +//-------------------------------------------------------------------------------- +/** + 直前に完了した間欠受信で有効な親機ビーコンを受け取ったか確認します + @param なし + @return WDSWRAPPER_ERRCODE_SUCCESS: 直前に完了した間欠受信で有効な親機ビーコンを受け取った + @return WDSWRAPPER_ERRCODE_FAILURE: 直前に完了した間欠受信で有効な親機ビーコンを受け取っていない + @return WDSWRAPPER_ERRCODE_UNINITIALIZED: WDSラッパーライブラリが初期化されていない + @note ライブラリ初期化時に指定したコールバック関数の中でのみ呼び出して下さい +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperCheckValidBeacon( void ) +{ + int i; + WDSWrapperErrCode ret = WDSWRAPPER_ERRCODE_FAILURE; + + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + // コールバック関数からの呼び出しかを確認 + if( g_wdswrapperwork->callingback != TRUE ) + return WDSWRAPPER_ERRCODE_FAILURE; + + if( g_wdswrapperwork->briefapinfonum_previous > 0 ) { + // 直前のWDSの結果が生きていればまずそれをチェックする + for( i = 0; i < g_wdswrapperwork->briefapinfonum_previous; i++ ) { + if( g_wdswrapperwork->briefapinfo_previous[i].isvalid == TRUE && + g_wdswrapperwork->briefapinfo_previous[i].apinfo.infoflag & WDS_INFOFLAG_NOTIFY ) { + ret = WDSWRAPPER_ERRCODE_SUCCESS; + break; + } + } + } + if( g_wdswrapperwork->briefapinfonum > 0 ) { + // 現在スキャン中のデータもチェックする + for( i = 0; i < g_wdswrapperwork->briefapinfonum; i++ ) { + if( g_wdswrapperwork->briefapinfo[i].isvalid == TRUE && + g_wdswrapperwork->briefapinfo[i].apinfo.infoflag & WDS_INFOFLAG_NOTIFY ) { + ret = WDSWRAPPER_ERRCODE_SUCCESS; + break; + } + } + } + + return ret; +} + +//-------------------------------------------------------------------------------- +/** + 直前に完了した間欠受信で受け取ったビーコン情報をArgument領域にセットします + @param なし + @return WDSWRAPPER_ERRCODE_SUCCESS: 親機ビーコン情報がArgument領域にセットされた + @return WDSWRAPPER_ERRCODE_FAILURE: 親機ビーコン情報をArgument領域にセットできなかった + @return WDSWRAPPER_ERRCODE_UNINITIALIZED: WDSラッパーライブラリが初期化されていない +*///------------------------------------------------------------------------------ +#ifdef SDK_TWL +WDSWrapperErrCode WDS_WrapperSetArgumentParam( void ) +{ + int err; + + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + // TWL用のArgumentシステムに取得したビーコンデータを書き込む + if( g_wdswrapperwork->briefapinfonum_previous <= 0 && g_wdswrapperwork->briefapinfonum > 0) { + // 直前のスキャンがビーコンなしだが、現在のスキャン結果にビーコンがある場合は現在スキャン中の情報を使う + g_wdswrapperwork->briefapinfonum_previous = g_wdswrapperwork->briefapinfonum; + MI_CpuCopy8( g_wdswrapperwork->briefapinfo, g_wdswrapperwork->briefapinfo_previous, sizeof( g_wdswrapperwork->briefapinfo ) ); + } + OS_InitDeliverArgInfo( &g_wdswrapperwork->deliverinfo, sizeof( g_wdswrapperwork->briefapinfo_previous ) ); + err = OS_SetBinaryToDeliverArg( g_wdswrapperwork->briefapinfo_previous, sizeof( g_wdswrapperwork->briefapinfo_previous ) ); + + if( err != OS_DELIVER_ARG_SUCCESS ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf( "WDS_WrapperSetArgumentParam: failed %d\n", err ); +#endif + return WDSWRAPPER_ERRCODE_FAILURE; + } + + err = OS_EncodeDeliverArg(); + if( err != OS_DELIVER_ARG_SUCCESS ) { +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf( "OS_EncodeDeliverArg: failed %d\n", err ); +#endif + return WDSWRAPPER_ERRCODE_FAILURE; + } + + +#ifdef WDSWRAPPER_DEBUGPRINT + OS_TPrintf( "WDS_WrapperSetArgumentParam: success\n" ); +#endif + + return WDSWRAPPER_ERRCODE_SUCCESS; +} +#endif + +//-------------------------------------------------------------------------------- +/** + WDSコントロールスレッドが実行中か確認します + @param なし + @return WDSWRAPPER_ERRCODE_SUCCESS: WDSコントロールスレッドが実行中 + @return WDSWRAPPER_ERRCODE_FAILURE: WDSコントロールスレッドは停止している + @return WDSWRAPPER_ERRCODE_UNINITIALIZED: WDSラッパーライブラリが初期化されていない +*///------------------------------------------------------------------------------ +WDSWrapperErrCode WDS_WrapperCheckThreadRunning( void ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return WDSWRAPPER_ERRCODE_UNINITIALIZED; + + if( OS_IsThreadTerminated( &g_wdswrapperwork->thread ) == TRUE ) + return WDSWRAPPER_ERRCODE_FAILURE; + return WDSWRAPPER_ERRCODE_SUCCESS; +} + +//-------------------------------------------------------------------------------- +/** + WDSコントロールスレッドが使用しているOSThreadへのポインタを得ます + @param なし + @return NULL: WDSラッパーライブラリが初期化されていない + @return NULL以外: 実行中・あるいは停止中のOSThreadへのポインタ +*///------------------------------------------------------------------------------ +OSThread *WDS_WrapperGetOSThread( void ) +{ + // 初期化済みをチェック + if( g_wdswrapperwork == NULL ) + return NULL; + + return &g_wdswrapperwork->thread; +} diff --git a/build/libraries_sysmenu/wds/Makefile b/build/libraries_sysmenu/wds/Makefile new file mode 100644 index 00000000..a2098ba3 --- /dev/null +++ b/build/libraries_sysmenu/wds/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries_sysmenu/wds/readme.txt b/build/libraries_sysmenu/wds/readme.txt new file mode 100644 index 00000000..d67b95b1 --- /dev/null +++ b/build/libraries_sysmenu/wds/readme.txt @@ -0,0 +1,71 @@ +■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ +■ ■ +■ TWLWDSライブラリ 2008/8/16版 ■ +■ ■ +■ ネットワーク開発部からのお知らせ ■ +■ ■ +■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ + +●動作確認バージョン +・SDK +(TwlSDK-5_00rc1-patch-plus-080805) +(TwlNADK-080725) +・コンパイラ +(CodeWarrior v2.0) +(20080215_cw_ds_2.0_sp2_Buildtools_Patch2.jpSP1) +・デバッグ環境 +(IS-TWL-DEBUGGER Version 0.70.0807.2400) + +●ビルドする際の注意事項 +・ライブラリのビルドは + %make TWLSDK_PLATFORM=TWL +・受信サンプルのビルドはWDSTestディレクトリ下で + %make TWLSDK_PLATFORM=TWL +・WDSラッパーを使用した受信サンプルのビルドはWDSWrapperTestディレクトリ下で + %make TWLSDK_PLATFORM=TWL + +●変更履歴 +2008/09/04 20080904版 +・WDS_WrapperStopScan関数を呼び出した直後にWDS_WrapperCleanup関数を呼び出すと、 +WDS_WrapperStopScanに関するコールバックが呼び出されず、WDS_WrapperCleanupに関する +コールバックのみが呼び出される問題を修正しました。 + +2008/08/16 20080816版 +・WDSWrapperがビーコンの間欠受信を停止している状態、あるいは間欠受信中でも +次の受信開始を待っている状態のいずれかでWDS_WrapperStopScan関数を使用した場合、 +間欠受信停止のコールバックが呼び出されない問題を修正しました。 + +2008/08/06 20080806版 +・WDS_WrapperStopScan関数を使用してビーコン受信を中断した場合、 +中断の直前に呼び出したWDS_WrapperCheckValidBeacon関数ではビーコンが +受信されていると通知されるにもかかわらず、中断後にはWDSWrapperライブラリの +状態が、ビーコンが受信されていない状態になる場合があるバグを修正しました。 + +2008/07/14 20080714版 +・WDSWrapperTestサンプルにスリープモードに関連する処理を追加しました。 + +2008/07/03 20080703版 +・WDSラッパー内部で行っていた排他制御に関連して発生していたフリーズ問題を修正しました。 + +2008/06/26 20080626版 +・WDSライブラリを簡易に使用するためのWDSWrapperが追加されました。 + +2008/06/11 初版 +・動作確認用バージョンから、ビーコンに以下の情報が追加されました + infoflag - 付加情報フラグが格納される領域です + mtu - そのAPが使用可能な最大のMTUを格納されます +・ビーコン受信時にビット誤りが発生した場合には、そのビーコンを無視する + ようになりました。 + +2008/02/21 動作確認用バージョン +・動作確認用として開発技術部にリリース + +●使用時の注意 +infoflagの扱い +・ランチャーメニューでのニンテンドースポットビューアの強調表示は、 + infoflagのWDS_INFOFLAG_NOTIFYビットが1にセットされたビーコンを + 受信した場合のみ行ってください。 +・なお、WDSWrapperはWDS_INFOFLAG_NOTIFYに関連した処理を内部で自動的に行います。 +WDS_WrapperCheckValidBeacon関数について +・20080703バージョン以降は、WDS_WrapperCheckValidBeacon関数は初期化時に指定した + コールバック関数の中からのみ呼び出すことができます。 diff --git a/build/nandfirm/Makefile b/build/nandfirm/Makefile new file mode 100644 index 00000000..913959b8 --- /dev/null +++ b/build/nandfirm/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - firmware +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS_P = \ + nandfirm-print \ + sdmc-launcher \ + memory-launcher \ + menu-launcher \ + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/bin/nandfirm_norheader.sbin b/build/nandfirm/bin/nandfirm_norheader.sbin new file mode 100644 index 00000000..2865df12 Binary files /dev/null and b/build/nandfirm/bin/nandfirm_norheader.sbin differ diff --git a/build/nandfirm/memory-launcher/ARM7/Makefile b/build/nandfirm/memory-launcher/ARM7/Makefile new file mode 100644 index 00000000..8b028eb0 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM7/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LLIBRARIES += libsysmenu_sp.TWL$(ARCHGEN_TYPE).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/ARM7/main.c b/build/nandfirm/memory-launcher/ARM7/main.c new file mode 100644 index 00000000..739c7ef9 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM7/main.c @@ -0,0 +1,347 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC800 + +/* + AES鍵設定API +*/ +extern void SYSMi_SetAESKeysForAccessControl( BOOL isNtrMode, ROM_Header *pROMH ); + +#ifdef USE_DEBUG_LED +static u8 step = 0x80; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + /* + リセットパラメータ(1バイト)を共有領域(1バイト)にコピー + */ +#define HOTSTART_FLAG_ENABLE 0x80 + *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + PM_BackLightOn( TRUE ); // ARM9側画面表示のため + + /* + AES関連 (NAND暗号化の鍵変更を含む) + */ + if ( OSi_GetFromFirmAddr()->aes_key[2][0] ) + { + AESi_PreInitKeys(); + } + // AESの初期化 + AES_Init(THREAD_PRIO_AES); // for encrypted NAND + // マウント情報初期化 + // nand,sdmc両方使わない場合でも読んでおかないとHW_TWL_RED_LAUNCHER_VERが立たない + FS_InitMountInfo(FALSE ,FALSE); + + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); + SetDebugLED(++step); // 0x84 + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + OS_BootFromFIRM(); +#endif +} + +/* + MI_LoadStatic関連 +*/ +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +#define MODULE_ALIGNMENT 0x20 // 16*2バイト単位で読み込む +//#define MODULE_ALIGNMENT 0x200 // 512バイト単位で読み込む +#define RoundUpModuleSize(value) (((value) + MODULE_ALIGNMENT - 1) & -MODULE_ALIGNMENT) + +/* + start point + main static + sub static + main ltd + sub ltd + end point +*/ +#define ROM_HEADER_RAM_OFFSET 0xe00 +#define TEMP_OFFSET 0x800000 // 一時待避場所 + +static BOOL aesFlag; +static AESCounter aesCounter; + +#define DMA_SEND 2 +#define DMA_RECV 3 +static void MI_DmaCopyWithAes( void* src, void* dest, u32 size ) +{ + AES_Lock(); + AES_Reset(); + AES_Reset(); + AES_WaitKey(); + AES_LoadKey( AES_KEY_SLOT_A ); + AES_WaitKey(); + AES_DmaSend( DMA_SEND, src, size, NULL, NULL ); + AES_DmaRecv( DMA_RECV, dest, size, NULL, NULL ); + AES_SetCounter( &aesCounter ); + AES_Run( AES_MODE_CTR, 0, size / AES_BLOCK_SIZE, NULL, NULL ); + AES_AddToCounter( &aesCounter, size / AES_BLOCK_SIZE ); + MI_WaitNDma( DMA_RECV ); + AES_Unlock(); +} + +static void EnableAes( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.main_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target_rom_offset) / AES_BLOCK_SIZE ); +} +static void EnableAes2( u32 offset ) +{ + aesFlag = TRUE; + MI_CpuCopy8( rh->s.sub_static_digest, &aesCounter, AES_BLOCK_SIZE ); + AES_AddToCounter( &aesCounter, (offset - rh->s.aes_target2_rom_offset) / AES_BLOCK_SIZE ); +} +static void DisableAes( void ) +{ + aesFlag = FALSE; +} + +static u32 GetTransferSize( u32 offset, u32 size ) +{ + if ( rh->s.enable_aes ) + { + u32 end = offset + RoundUpModuleSize(size); + u32 aes_offset = rh->s.aes_target_rom_offset; + u32 aes_end = aes_offset + RoundUpModuleSize(rh->s.aes_target_size); + u32 aes_offset2 = rh->s.aes_target2_rom_offset; + u32 aes_end2 = aes_offset2 + RoundUpModuleSize(rh->s.aes_target2_size); + + if ( offset >= aes_offset && offset < aes_end ) + { + if ( end > aes_end ) + { + size = aes_end - offset; + } + EnableAes( offset ); + } + else if ( offset >= aes_offset2 && offset < aes_end2 ) + { + if ( end > aes_end2 ) + { + size = aes_end2 - offset; + } + EnableAes2( offset ); + } + else + { + if ( offset < aes_offset && offset + size > aes_offset ) + { + size = aes_offset - offset; + } + if ( offset < aes_offset2 && offset + size > aes_offset2 ) + { + size = aes_offset2 - offset; + } + DisableAes(); + } + } + else + { + DisableAes(); + } + return size; +} +static void MI_LoadModule( u8* src, u8* dest, u32 offset, u32 size ) +{ + size = RoundUpModuleSize( size ); + while ( size > 0 ) + { + u32 unit = GetTransferSize( offset, size ); + if ( aesFlag ) + { + MI_DmaCopyWithAes( src, dest, unit ); + } + else + { + MI_CpuCopyFast( src, dest, unit ); + } + dest += unit; + src += unit; + offset += unit; + size -= unit; + } +} + +static void MI_LoadStatic( void ) +{ + u8** ram_offset = (u8**)((u32)rh + ROM_HEADER_RAM_OFFSET); + if ( ram_offset[5] + TEMP_OFFSET > (void*)HW_TWL_MAIN_MEM_SHARED ) + { + return; // overflow + } + /* 一旦移動させる */ + MI_CpuCopyFast( ram_offset[0], ram_offset[0] + TEMP_OFFSET, (u32)RoundUpModuleSize(ram_offset[5] - ram_offset[0])); + if ( rh->s.main_size > 0 ) + { + MI_LoadModule( ram_offset[1] + TEMP_OFFSET, rh->s.main_ram_address, rh->s.main_rom_offset, rh->s.main_size ); + } + if ( rh->s.sub_size > 0 ) + { + MI_LoadModule( ram_offset[2] + TEMP_OFFSET, rh->s.sub_ram_address, rh->s.sub_rom_offset, rh->s.sub_size ); + } + if ( rh->s.main_ltd_size > 0 ) + { + MI_LoadModule( ram_offset[3] + TEMP_OFFSET, rh->s.main_ltd_ram_address, rh->s.main_ltd_rom_offset, rh->s.main_ltd_size ); + } + if ( rh->s.sub_ltd_size > 0 ) + { + MI_LoadModule( ram_offset[4] + TEMP_OFFSET, rh->s.sub_ltd_ram_address, rh->s.sub_ltd_rom_offset, rh->s.sub_ltd_size ); + } +} + +void TwlSpMain( void ) +{ + InitDebugLED(); + SetDebugLED(++step); // 0x81 + + PreInit(); + SetDebugLED(++step); // 0x82 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + // 2: after OS_InitFIRM + SetDebugLED(++step); // 0x83 + + PostInit(); + // 3: after PostInit + SetDebugLED(++step); // 0x85 + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); + goto end; + } + // 4: after PXI + SetDebugLED(++step); // 0x87 + + AESi_InitKeysFIRM(); + AESi_InitSeed(); + // 5: after AESi_InitSeed + SetDebugLED(++step); // 0x88 + + MI_LoadStatic(); + PXI_NotifyID( FIRM_PXI_ID_NULL ); + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); + goto end; + } + // 6: after PXI + SetDebugLED( 0 ); + + SYSMi_SetAESKeysForAccessControl(FALSE, rh); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + FS_SetMountInfoForSrl(); + OS_BootFromFIRM(); + +end: + SetDebugLED( (u8)(0xF0 | step)); + + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_NITRO ); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/nandfirm/memory-launcher/ARM9/Makefile b/build/nandfirm/memory-launcher/ARM9/Makefile new file mode 100644 index 00000000..393496fd --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = memory_launcher9.srl + +SRCS = main.c font.c screen.c + +CRT0_O = crt0_firm.o + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +LINCLUDES = ./include + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/ARM9/font.c b/build/nandfirm/memory-launcher/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/include/font.h b/build/nandfirm/memory-launcher/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/include/screen.h b/build/nandfirm/memory-launcher/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/memory-launcher/ARM9/main.c b/build/nandfirm/memory-launcher/ARM9/main.c new file mode 100644 index 00000000..ce4c389b --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/main.c @@ -0,0 +1,500 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 "font.h" +#include "screen.h" + +#ifdef FIRM_USE_PRODUCT_KEYS +static const u8* const rsa_key_user = NULL; // not acceptable +static const u8* const rsa_key_sys = NULL; // not acceptable +static const u8 rsa_key_secure[128] = +{ + 0xC7, 0x94, 0x50, 0x00, 0x3A, 0xE1, 0x0E, 0x6C, 0xA8, 0xD1, 0xC0, 0x2D, 0x77, 0xB7, 0x6D, 0xBC, + 0x31, 0xDB, 0x12, 0x08, 0x09, 0x0D, 0x2A, 0xE8, 0xC9, 0x1A, 0x2B, 0x6E, 0x6C, 0x85, 0x78, 0xD7, + 0x46, 0x50, 0x05, 0xB5, 0xCC, 0x3B, 0xEC, 0xBA, 0xF4, 0xDE, 0xC2, 0x13, 0x13, 0xBE, 0x67, 0xEE, + 0x85, 0x19, 0xEB, 0x62, 0xB3, 0x5C, 0x09, 0xA8, 0x54, 0x44, 0x26, 0x85, 0x25, 0xEA, 0xE5, 0x85, + 0xD1, 0xB5, 0xCE, 0xA0, 0xFF, 0x6B, 0x61, 0xCA, 0x94, 0xC1, 0x67, 0xBE, 0xC0, 0x7E, 0x3B, 0xFF, + 0x12, 0x9B, 0x79, 0xDB, 0xAC, 0xD3, 0x5A, 0x3F, 0x14, 0x37, 0x49, 0xA8, 0x7C, 0x2F, 0x07, 0xF4, + 0x8B, 0xA9, 0x8B, 0x8D, 0xB2, 0x60, 0xA5, 0xD5, 0x64, 0xEE, 0xCF, 0x3F, 0x32, 0xEE, 0x77, 0xAC, + 0x27, 0x75, 0x2B, 0x04, 0xD7, 0x26, 0xA8, 0x8A, 0x55, 0x2A, 0x76, 0xE5, 0x68, 0x80, 0x57, 0x85 +}; +#else +#if 0 +static const u8 rsa_key_user[128] = +{ + 0xAC, 0x93, 0xBB, + 0x3C, 0x15, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, + 0xD5, 0x79, 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, + 0xCB, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, + 0xF0, 0x11, 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, + 0x7F, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, + 0x96, 0x4F, 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, + 0x62, 0x39, 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, + 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11 +}; +#else +static const u8* const rsa_key_user = NULL; // not acceptable +#endif +static const u8 rsa_key_sys[128] = +{ + 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, + 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, + 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, + 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, + 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, + 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, + 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, + 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, +}; +static const u8 rsa_key_secure[128] = +{ + 0xa7, 0x9f, 0x54, 0xa0, 0xc7, 0x45, 0xae, 0xf6, 0x63, 0xa7, 0x53, 0xb7, 0x0a, 0xcc, 0x0b, 0xcb, + 0x65, 0xe1, 0x11, 0xc6, 0x05, 0x15, 0xb5, 0x6e, 0xbd, 0xac, 0x0c, 0xca, 0xf4, 0x7c, 0x68, 0x7a, + 0xf9, 0x0e, 0x5d, 0x98, 0x5b, 0xc8, 0x4d, 0x22, 0x3b, 0xa3, 0xbe, 0x8b, 0x5b, 0x7f, 0x26, 0x44, + 0x9f, 0xc4, 0x48, 0x44, 0xb1, 0x32, 0xb7, 0xbe, 0x63, 0xba, 0xd6, 0xc1, 0x10, 0xce, 0xf6, 0xed, + 0x47, 0x8f, 0xe1, 0xff, 0x7f, 0x5a, 0xd5, 0x5d, 0x94, 0x38, 0x2f, 0xa1, 0xd4, 0xef, 0x82, 0xb1, + 0x0d, 0xc4, 0x43, 0xec, 0xbe, 0x77, 0xb6, 0x82, 0x9c, 0xfa, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, + 0xfb, 0xd6, 0x05, 0xc8, 0x9a, 0x7e, 0xad, 0x44, 0x40, 0x0d, 0x35, 0x9c, 0x45, 0x44, 0x64, 0x36, + 0x61, 0x4b, 0xf7, 0xe6, 0x31, 0x5c, 0x7d, 0x96, 0x73, 0xe8, 0xac, 0xb4, 0xe3, 0x5e, 0xd1, 0x9d, +}; +#endif + +static SVCSignHeapContext acPool; + +static const u8 defaultKey[ SVC_SHA1_BLOCK_SIZE ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC000 + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void *)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void *)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void *)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); +// MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // アリーナ設定 + { + static u32 arena[ 0x400 / sizeof(u32) ]; + OS_SetMainArenaLo( arena ); + OS_SetMainArenaHi( &arena[ 0x400 / sizeof(u32) ] ); + } + // RSA用ヒープ設定 + SVC_InitSignHeap( &acPool, (void*)HW_FIRM_RSA_BUF, HW_FIRM_RSA_BUF_SIZE ); +} + +/*************************************************************** + CheckHeader + + ヘッダがシステムメニューとして問題ないかチェック +***************************************************************/ +static BOOL CheckHeader(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + // イニシャルコードなど + OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); + OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); + OS_TPrintf("Codec Mode : %s\n", rhs->exFlags.codec_mode ? "TWL" : "NITRO"); + OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); + OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); + if ( rhs->enable_aes ) + { + OS_TPrintf("AES Key Type : %s\n", ( rhs->developer_encrypt_old || rhs->exFlags.developer_encrypt ) ? "FOR DEVELOPMENT" : "FOR PRODUCT"); + } + // エントリポイント + OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); + OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); + // ロード範囲 + OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); + OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); + OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); + OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); + OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); + OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); + OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); + OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); + OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); + OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); + OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); + OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); + // 順序ほぼ最適化済み +#ifdef FIRM_USE_PRODUCT_KEYS + if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only + !rhs->enable_signature || // Should be use ROM header signature +#else + if ( // no check +#endif + !rhs->exFlags.codec_mode || // TWL mode only + // should be in main memory + HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || + // should be in static area without Limited region + (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || + // should be in main memory (end address) + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || + // should be in static area without Limited region (end address) + (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || + 0 ) + { + OS_TPrintf("Invalid ROM header for SDMC Launcher!\n"); + return FALSE; + } + return TRUE; +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + OS_BootFromFIRM(); +#endif +} + +static inline BOOL CheckDigest( u8* a, u8* b, BOOL aClr, BOOL bClr ) +{ + BOOL result = TRUE; + int i; + for ( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) + { + if ( a[i] != b[i] ) + { + result = FALSE; + } + } + if ( aClr ) MI_CpuClear8(a, SVC_SHA1_DIGEST_SIZE); + if ( bClr ) MI_CpuClear8(b, SVC_SHA1_DIGEST_SIZE); + return result; +} + +static void myInit(void); +static void myVBlankIntr(void); + +void TwlMain( void ) +{ +#define X_OFF 2 + s16 y = 2; + + PreInit(); + myInit(); + PostInit(); + + //---- clear screen buffer + ClearScreen(); + PrintString( X_OFF, y, FONT_CYAAN, "Mem Launcher (N)" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Initialized." ); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Checking header..." ); + OS_WaitVBlankIntr(); + + /* + ヘッダチェック (再配置付き) + */ + MI_CpuCopyFast( (void*)HW_TWL_MAIN_MEM, rh, HW_TWL_ROM_HEADER_BUF_SIZE ); + DC_StoreRange( rh, HW_TWL_ROM_HEADER_BUF_SIZE ); + +#define HEADER_AUTH_SIZE 0xe00 + { + const void* rsa_key; + u8 md[SVC_SHA1_DIGEST_SIZE]; + SignatureData sd; + + // ハッシュ計算 + SVC_CalcSHA1( md, rh, HEADER_AUTH_SIZE ); + // 鍵の確定 + rsa_key = (rh->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK) + ? rsa_key_secure + : ( (rh->s.titleID_Hi & TITLE_ID_HI_APP_TYPE_MASK) ? rsa_key_sys : rsa_key_user ); + // 署名の復号化 + SVC_DecryptSign( &acPool, &sd, rh->signature, rsa_key ); + if ( !CheckDigest( md, sd.digest, TRUE, FALSE ) ) + { + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) + OS_TPrintf("Failed to call FS_LoadHeader().\n"); + goto end; + } + MI_CpuClear8( &sd, sizeof(sd) ); // 残り削除 (他に必要なものはない?) + // ROMヘッダのコピー + MI_CpuCopyFast( rh, (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + } + if ( !CheckHeader() ) + { + OS_TPrintf("Failed to call CheckHeader().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + DC_FlushAll(); + // 8: after to load header + PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); + + /* + Static再配置待ち + */ + PrintString( X_OFF, y++, FONT_WHITE, "Replacing static data..." ); + OS_WaitVBlankIntr(); + + if ( PXI_RecvID() != FIRM_PXI_ID_NULL ) + { + OS_TPrintf("Failed to decrypt static data.\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + + // 7: after PXI + PrintString( X_OFF, y++, FONT_WHITE, "Checking static data..." ); + OS_WaitVBlankIntr(); + /* + Staticチェック + */ + { + u8 md[SVC_SHA1_DIGEST_SIZE]; + if ( rh->s.main_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.main_ram_address, rh->s.main_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.main_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check main_static_digest.\n"); + goto end; + } + } + if ( rh->s.sub_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.sub_ram_address, rh->s.sub_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.sub_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check sub_static_digest.\n"); + goto end; + } + } + if ( rh->s.main_ltd_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.main_ltd_ram_address, rh->s.main_ltd_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.main_ltd_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check main_ltd_static_digest.\n"); + goto end; + } + } + if ( rh->s.sub_ltd_size > 0 ) + { + SVC_CalcHMACSHA1( md, rh->s.sub_ltd_ram_address, rh->s.sub_ltd_size, defaultKey, SVC_SHA1_BLOCK_SIZE ); + if ( !CheckDigest( md, rh->s.sub_ltd_static_digest, TRUE, FALSE ) ) + { + OS_TPrintf("Failed to check sub_ltd_static_digest.\n"); + goto end; + } + } + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 8: after FS_LoadStatic + PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); + // 9: after PXI + OS_WaitVBlankIntr(); + + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + PrintString( X_OFF, y++, FONT_WHITE, "Booting..." ); + OS_WaitVBlankIntr(); + OS_BootFromFIRM(); + +end: + PrintString( X_OFF+20, y, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- backdrop + *(u16*)HW_PLTT = GX_RGB(8,0,0); + *(u16*)HW_DB_PLTT = GX_RGB(8,0,0); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/nandfirm/memory-launcher/ARM9/screen.c b/build/nandfirm/memory-launcher/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/nandfirm/memory-launcher/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/nandfirm/memory-launcher/Makefile b/build/nandfirm/memory-launcher/Makefile new file mode 100644 index 00000000..aefebc5c --- /dev/null +++ b/build/nandfirm/memory-launcher/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - nandfirm - memory-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = memory_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/memory_launcher9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/memory_launcher7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = nandfirm.nandsf + +LDIRT_CLEAN += $(wildcard *.nand) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/nandfirm.nandsf b/build/nandfirm/memory-launcher/nandfirm.nandsf new file mode 100644 index 00000000..0cb73cd2 --- /dev/null +++ b/build/nandfirm/memory-launcher/nandfirm.nandsf @@ -0,0 +1,24 @@ +#NANDSF --- Nandfirm Spec File + +VERSION : 0xffff570000000000 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +MIRROR_OFS: 0x80000 + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x01fe00 diff --git a/build/nandfirm/memory-launcher/readme.txt b/build/nandfirm/memory-launcher/readme.txt new file mode 100644 index 00000000..b1b1973e --- /dev/null +++ b/build/nandfirm/memory-launcher/readme.txt @@ -0,0 +1,5 @@ +注意事項 + +起動するアプリがromアーカイブを使用する場合、 +NAライブラリをリンクしておく必要があります。 +(単純にリンクするライブラリに追加するだけです) diff --git a/build/nandfirm/memory-launcher/wram_regs/Makefile b/build/nandfirm/memory-launcher/wram_regs/Makefile new file mode 100644 index 00000000..8de72ccf --- /dev/null +++ b/build/nandfirm/memory-launcher/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/memory-launcher/wram_regs/wram_regs.c b/build/nandfirm/memory-launcher/wram_regs/wram_regs.c new file mode 100644 index 00000000..7e727571 --- /dev/null +++ b/build/nandfirm/memory-launcher/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - nandfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/nandfirm/menu-launcher/ARM7/Makefile b/build/nandfirm/menu-launcher/ARM7/Makefile new file mode 100644 index 00000000..0968990d --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM7/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = menu_launcher7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037b8000 + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LLIBRARIES += libsysmenu_sp.TWL$(ARCHGEN_TYPE).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher/ARM7/main.c b/build/nandfirm/menu-launcher/ARM7/main.c new file mode 100644 index 00000000..660813d7 --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM7/main.c @@ -0,0 +1,323 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - menu-launcher + File: main.c + + Copyright 2007 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 + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +//#define PROFILE_ENABLE + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +//#define USE_DEBUG_LED + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC8A0 + +/* + AES鍵設定API +*/ +extern void SYSMi_SetAESKeysForAccessControlCore( ROM_Header *pROMH, u8 *pDst, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC ); + + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef USE_DEBUG_LED +static u8 step = 0x80; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + /* + リセットパラメータ(1バイト)を共有領域(1バイト)にコピー + */ +#define HOTSTART_FLAG_ENABLE 0x80 + *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + /* + AES関連 (NAND暗号化の鍵変更を含む) + */ + if ( OSi_GetFromFirmAddr()->aes_key[2][0] ) + { + AESi_PreInitKeys(); + } + // AESの初期化 + AES_Init(THREAD_PRIO_AES); // for encrypted NAND + // 4: after AES_Init + PUSH_PROFILE(); + SetDebugLED(++step); // 0x85 + + // マウント情報の初期化 + FS_InitMountInfo(TRUE, FALSE); + // 5: after CreateIdleThread + PUSH_PROFILE(); + SetDebugLED(++step); // 0x86 + + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // TWL mode for ES library + // 6: after MCUi_WriteRegister + PUSH_PROFILE(); + SetDebugLED(++step); // 0x87 + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + OS_BootFromFIRM(); +#endif +} + +void TwlSpMain( void ) +{ + int fd; // menu file descriptor + +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + InitDebugLED(); + SetDebugLED(++step); // 0x81 + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: after PreInit + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + SetDebugLED(++step); // 0x82 + + OS_InitFIRM(); + // 2: after OS_InitFIRM + PUSH_PROFILE(); + SetDebugLED(++step); // 0x83 + + OS_EnableIrq(); + OS_EnableInterrupts(); + // 3: after OS_EnableIrq + PUSH_PROFILE(); + SetDebugLED(++step); // 0x84 + + PostInit(); + // 7: after PostInit + PUSH_PROFILE(); +#ifdef PROFILE_ENABLE + step = 0x88; +#endif + SetDebugLED(step); // 0x88 + +// PM_BackLightOn( FALSE ); + + if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) ) + { + OS_TPrintf("Failed to call FATFS_Init().\n"); + goto end; + } + // 8: after FATFS_Init + PUSH_PROFILE(); + SetDebugLED(++step); // 0x89 + +// PM_BackLightOn( FALSE ); + + if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); + goto end; + } + // 9: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8a + +// PM_BackLightOn( FALSE ); + + if ( (fd = FS_OpenSrl()) < 0 ) + { + OS_TPrintf("Failed to call FS_OpenSrl().\n"); + goto end; + } + // 10: after FS_OpenSrl + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8b + +// PM_BackLightOn( FALSE ); + + if ( !FS_LoadHeader( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadHeader().\n"); + goto end; + } + // 11: after FS_LoadHeader + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8c + +// PM_BackLightOn( FALSE ); + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); + goto end; + } + // 12: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8d + +// PM_BackLightOn( FALSE ); + + AESi_InitKeysFIRM(); + AESi_InitSeed(); + // 13: after AESi_InitSeed + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8e + +// PM_BackLightOn( FALSE ); + + if ( !FS_LoadStatic( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + // 14: after FS_LoadStatic + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8f + +// PM_BackLightOn( FALSE ); + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); + goto end; + } + // 15: after PXI + PUSH_PROFILE(); + +#ifdef PROFILE_ENABLE + { + int i; + PXI_RecvID(); + OS_TPrintf("\n[ARM7] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM7] End\n"); + } +#endif + SetDebugLED( 0 ); + +// PM_BackLightOn( TRUE ); // last chance + + SYSMi_SetAESKeysForAccessControlCore( (ROM_Header *)HW_TWL_ROM_HEADER_BUF, (u8 *)HW_LAUNCHER_DELIVER_PARAM_BUF, NULL, NULL ); + OS_BootFromFIRM(); + +end: + SetDebugLED( (u8)(0xF0 | step)); + + PM_BackLightOn( TRUE ); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/nandfirm/menu-launcher/ARM9/Makefile b/build/nandfirm/menu-launcher/ARM9/Makefile new file mode 100644 index 00000000..c4059d02 --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM9/Makefile @@ -0,0 +1,78 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM9 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = menu_launcher9.srl + +REVISION_SRC = revision.c + +SRCS = main.c print.c $(REVISION_SRC) + +CRT0_O = crt0_firm.o + +ADDRESS_STATIC = 0x037c0000 + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/menu_launcher7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# no thumb version, no final rom version +LLIBRARIES += libes.TWL$(ARCHGEN_TYPE).a libboc.TWL$(ARCHGEN_TYPE).a \ + libsfs$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LDIRT_CLEAN = $(REVISION_SRC) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#SVNリビジョン埋め込み +$(REVISION_SRC) :: + @if test -e $(TWL_IPL_RED_ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(TWL_IPL_RED_ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|const char *g_strIPLSvnRevision = \"\1\";|" > $(REVISION_SRC); \ + else \ + echo "const char *g_strIPLSvnRevision = \"-\";" > $(REVISION_SRC); \ + fi + @if test -e $(ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|const char *g_strSDKSvnRevision = \"\1\";|" >> $(REVISION_SRC); \ + else \ + echo "const char *g_strSDKSvnRevision = \"-\";" >> $(REVISION_SRC); \ + fi + + + +#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher/ARM9/include/print.h b/build/nandfirm/menu-launcher/ARM9/include/print.h new file mode 100644 index 00000000..4d08127a --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM9/include/print.h @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - menu-launcher + File: print.h + + Copyright 2007 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 PRINT_H_ +#define PRINT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void PrintError(char *text, ...); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PRINT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/menu-launcher/ARM9/main.c b/build/nandfirm/menu-launcher/ARM9/main.c new file mode 100644 index 00000000..af977228 --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM9/main.c @@ -0,0 +1,404 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - menu-launcher + File: main.c + + Copyright 2007 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 "print.h" + +#ifdef FIRM_USE_PRODUCT_KEYS +#define RSA_KEY_ADDR OSi_GetFromFirmAddr()->rsa_pubkey[0] // 鍵管理.xls参照 +#else +#define RSA_KEY_ADDR rsa_key_launcher +static const u8 rsa_key_launcher[128] = +{ + 0xbc, 0xfd, 0xa1, 0xff, 0x1f, 0x66, 0xdf, 0xec, 0xb4, 0x69, 0xf8, 0xf7, 0x43, 0x0c, 0x5d, 0x0f, + 0x00, 0xd7, 0x20, 0x49, 0x42, 0x06, 0x03, 0x29, 0x85, 0x0b, 0x99, 0x59, 0x61, 0x98, 0x70, 0x6e, + 0xff, 0xf6, 0xb4, 0x70, 0x66, 0xf0, 0xdd, 0x8f, 0xdc, 0xe9, 0xf2, 0x0d, 0xd0, 0x21, 0x1d, 0x77, + 0xb8, 0x9c, 0x51, 0x87, 0xc0, 0xb1, 0x33, 0xab, 0x13, 0x96, 0x0b, 0x47, 0xb8, 0x42, 0x4a, 0x0d, + 0xc3, 0x77, 0xe1, 0x87, 0xb1, 0x6b, 0x24, 0x31, 0x10, 0x8a, 0x47, 0xf2, 0x32, 0xf4, 0xc9, 0x78, + 0x25, 0x13, 0xd4, 0x80, 0x10, 0x05, 0x52, 0xc3, 0xe7, 0x50, 0x7b, 0x29, 0x49, 0xce, 0x93, 0xd9, + 0x8f, 0x2a, 0xb5, 0x4d, 0xd1, 0xc1, 0x91, 0xd8, 0x07, 0x16, 0x10, 0x15, 0xff, 0xd6, 0x84, 0x8f, + 0x54, 0x3d, 0x91, 0x5b, 0x37, 0x45, 0x48, 0xe4, 0x6b, 0x62, 0xd2, 0x11, 0x9b, 0x0d, 0x71, 0x69, +}; +#endif + +static SVCSignHeapContext acPool; + +#define MENU_TITLE_ID_HI 0x00030017ULL +#define MENU_TITLE_ID_LO 0x484e4141ULL +#define MENU_TITLE_ID (MENU_TITLE_ID_HI << 32 | MENU_TITLE_ID_LO) + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +//#define PROFILE_ENABLE + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC2A0 + +//#ifdef SDK_FINALROM // FINALROMで無効化 +//#undef PROFILE_ENABLE +//#endif + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +extern const char *g_strIPLSvnRevision; +extern const char *g_strSDKSvnRevision; +static void PreInit(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + static char buffer[4][8]; // バージョン情報 + /* + メインメモリ関連 + */ + // SHARED領域はスタートアップ時でクリア + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // FS用アリーナ設定 + { + static u32 arena[ 0x400 / sizeof(u32) ]; + OS_SetMainArenaLo( arena ); + OS_SetMainArenaHi( &arena[ 0x400 / sizeof(u32) ] ); + } + // FS/FATFS初期化 + FS_InitFIRM(); +} + +/*************************************************************** + TryResolveSrl + + リストからランチャーSRLを解決する +***************************************************************/ +//#define DEBUG_CRYPTO_ALLOCATOR +#ifdef DEBUG_CRYPTO_ALLOCATOR +#include +static int allocated=0; +static void* myAlloc(size_t size) +{ + void* ptr = OS_Alloc(size); + if (ptr) + { + OS_TPrintf("Alloc [%d] %d bytes.\n", ++allocated, size); + } + else + { + OS_TPrintf("Failed to allocate %d bytes.\n", size); + } + return ptr; +} +static void myFree(void* ptr) +{ + OS_TPrintf("Free [%d]\n", --allocated); + OS_Free(ptr); +} +#endif +static BOOL TryResolveSrl(void) +{ + OSTitleId titleIdList[] = + { + MENU_TITLE_ID_HI << 32, // titleId_Lo is resolved by HWSecureInfo + MENU_TITLE_ID + }; + int num; + + // CRYPTO用ヒープ設定 (ESライブラリしか使わないはず) + void* lo = OS_InitAlloc( OS_ARENA_MAIN, (void*)HW_FIRM_RSA_BUF, (void*)HW_FIRM_RSA_BUF_END, 1); + void* hi = (void*)HW_FIRM_RSA_BUF_END; + OSHeapHandle hh = OS_CreateHeap( OS_ARENA_MAIN, lo, hi ); + if ( hh < 0 ) + { + OS_TPrintf("Failed to allocate heap.\n"); + return FALSE; + } + OS_SetCurrentHeap( OS_ARENA_MAIN, hh ); + +#ifdef DEBUG_CRYPTO_ALLOCATOR + CRYPTO_SetAllocator(myAlloc, myFree); +#endif + + if ( !LCFG_ReadHWSecureInfo() ) + { + OS_TPrintf("Failed to load HWSecureInfo.\n"); + // 4: after LCFG_ReadHWSecureInfo + PUSH_PROFILE(); + + if ( FS_ResolveSrlList( &titleIdList[1], 1 ) < 0 ) // one title ID only + { + OS_TPrintf("Failed to call FS_ResolveSrlList().\n"); + return FALSE; + } + OS_TPrintf("Launcher Title ID: 0x%016llx\n", titleIdList[1]); + } + else + { + LCFG_THW_GetLauncherTitleID_Lo( (u8*)&titleIdList[0] ); + // 4: after LCFG_ReadHWSecureInfo + PUSH_PROFILE(); + + num = FS_ResolveSrlList( titleIdList, sizeof(titleIdList)/sizeof(titleIdList[0]) ); + if ( num < 0 ) + { + OS_TPrintf("Failed to call FS_ResolveSrlList().\n"); + return FALSE; + } + OS_TPrintf("Launcher Title ID: 0x%016llx\n", titleIdList[num]); + } + + OS_DestroyHeap( OS_ARENA_MAIN, hh ); + + return TRUE; +} + +/*************************************************************** + CheckHeader + + ヘッダがシステムメニューとして問題ないかチェック +***************************************************************/ +static BOOL CheckHeader(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + // イニシャルコードなど + OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); + OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); + OS_TPrintf("Codec Mode : %s\n", rhs->exFlags.codec_mode ? "TWL" : "NITRO"); + OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); + OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); + if ( rhs->enable_aes ) + { + OS_TPrintf("AES Key Type : %s\n", ( rhs->developer_encrypt_old || rhs->exFlags.developer_encrypt ) ? "FOR DEVELOPMENT" : "FOR PRODUCT"); + if ( rhs->aes_target_size ) + { + OS_TPrintf("AES address : %08X\n", rhs->aes_target_rom_offset); + OS_TPrintf("AES size : %08X\n", rhs->aes_target_size); + } + if ( rhs->aes_target2_size ) + { + OS_TPrintf("AES2 address : %08X\n", rhs->aes_target2_rom_offset); + OS_TPrintf("AES2 size : %08X\n", rhs->aes_target2_size); + } + } + // エントリポイント + OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); + OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); + // ロード範囲 + OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); + OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); + OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); + OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); + OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); + OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); + OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); + OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); + OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); + OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); + OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); + OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); + // 順序ほぼ最適化済み + if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only + !rhs->exFlags.codec_mode || // TWL mode only + !rhs->enable_signature || // Should be use ROM header signature + (rhs->titleID_Hi & 0x0005) != 0x0005 || // check only NAND/SYSTEM bits (need?) + // should be in main memory + HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || + // should be in static area without Limited region + (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || + // should be in main memory (end address) + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || + // should be in static area without Limited region (end address) + (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || + 0 ) + { + OS_TPrintf("Invalid ROM header for MENU Launcher!\n"); + return FALSE; + } + return TRUE; +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + OS_BootFromFIRM(); +#endif +} + +void TwlMain( void ) +{ + int point = 1; +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: before OS_InitFIRM + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); +#ifdef PROFILE_ENABLE + // 2: before OS_InitTick + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); + + OS_InitTick(); +#endif + + PostInit(); + // 3: after PostInit + PUSH_PROFILE(); + + if ( !TryResolveSrl() ) + { + goto end; + } + point++; // 2 + // 5: after FS_ResolveSrl + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_SET_PATH ); + // 6: after PXI + PUSH_PROFILE(); + + /* ES (CRYPTO) ライブラリはここまで */ + /* SVN_RSA はここから*/ + // RSA用ヒープ設定 + SVC_InitSignHeap( &acPool, (void*)HW_FIRM_RSA_BUF, HW_FIRM_RSA_BUF_SIZE ); + + if ( !FS_LoadHeader( &acPool, NULL, NULL, RSA_KEY_ADDR ) || !CheckHeader() ) + { + OS_TPrintf("Failed to call FS_LoadHeader() and/or CheckHeader().\n"); + goto end; + } + point++; // 3 + // 7: after FS_LoadHeader + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); + // 8: after PXI + PUSH_PROFILE(); + + if ( !FS_LoadStatic( NULL ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + point++; // 4 + // 9: after FS_LoadStatic + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); + // 10: after PXI + PUSH_PROFILE(); + +#ifdef PROFILE_ENABLE + { + int i; + OS_TPrintf("\n[ARM9] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM9] End\n"); + PXI_NotifyID( FIRM_PXI_ID_NULL ); + reg_OS_TM3CNT_H = 0; + reg_OS_TM3CNT_L = 0; + reg_OS_TM3CNT_H = (u16)(REG_OS_TM0CNT_H_E_MASK | OS_TIMER_PRESCALER_1024); + } +#endif + + OS_BootFromFIRM(); + +end: + PrintError("Error: %d-%s-%s", point, g_strIPLSvnRevision, g_strSDKSvnRevision); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/nandfirm/menu-launcher/ARM9/print.c b/build/nandfirm/menu-launcher/ARM9/print.c new file mode 100644 index 00000000..c14c914f --- /dev/null +++ b/build/nandfirm/menu-launcher/ARM9/print.c @@ -0,0 +1,614 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - menu-launcher + File: print.c + + Copyright 2007 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 "print.h" + +static u16 gScreen[32]; + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +static const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*************************************************************** + PrintError + + GX初期化+エラー番号表示 +***************************************************************/ +void PrintError(char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + static u16 palette[2] = { 0, 0xFFFF }; + + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + GX_DisableBankForLCDC(); + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(palette, 0, sizeof(palette)); + + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(palette, 0, sizeof(palette)); + + // draw string + va_start(vlist, text); + (void)STD_TVSNPrintf(temp, 33, text, vlist); + va_end(vlist); + + MI_CpuClearFast(gScreen, sizeof(gScreen)); + + *(u16 *)(&temp[32]) = 0; + p = gScreen; + pLimit = &gScreen[32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)*tempPtr; + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } + + DC_FlushRange(gScreen, sizeof(gScreen)); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + GX_DispOn(); + GXS_DispOn(); +} diff --git a/build/nandfirm/menu-launcher/Makefile b/build/nandfirm/menu-launcher/Makefile new file mode 100644 index 00000000..c60ba9a2 --- /dev/null +++ b/build/nandfirm/menu-launcher/Makefile @@ -0,0 +1,75 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = menu_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH)-$(IPL_REVISION)-$(SDK_REVISION).$(FIRM_MODE).nand +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/menu_launcher9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/menu_launcher7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = nandfirm.nandsf + +MY_APPEND = revision.bin + +LDIRT_CLEAN += $(wildcard *.nand) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifeq ($(FIRM_USE_PRODUCT_KEYS),TRUE) +FIRM_MODE = prod +else +FIRM_MODE = dev +endif + +IPL_REVISION := $(shell LANG=C svn info $(call empath,$(FIRM_ROOT)) | grep 'Revision' | sed s/[^0-9]//g) +SDK_REVISION := $(shell LANG=C svn info $(call empath,$(ROOT)) | grep 'Revision' | sed s/[^0-9]//g) + +ifeq ($(IPL_REVISION),) +IPL_REVISION := $(shell date +%Y%m%d) +endif +ifeq ($(SDK_REVISION),) +SDK_REVISION := $(shell date +%H%M%S) +endif + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) $(MY_APPEND) + cat $(MY_APPEND) >> $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +$(MY_APPEND):: + echo $(IPL_REVISION) > $(MY_APPEND) + echo $(SDK_REVISION) >> $(MY_APPEND) + +test:: + echo IPL_REVISION=$(IPL_REVISION) + + +#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher/nandfirm.nandsf b/build/nandfirm/menu-launcher/nandfirm.nandsf new file mode 100644 index 00000000..a866877d --- /dev/null +++ b/build/nandfirm/menu-launcher/nandfirm.nandsf @@ -0,0 +1,24 @@ +#NANDSF --- Nandfirm Spec File + +VERSION : 0xffff570000000000 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +MIRROR_OFS: 0x80000 + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x1fe00 diff --git a/build/nandfirm/menu-launcher/wram_regs/Makefile b/build/nandfirm/menu-launcher/wram_regs/Makefile new file mode 100644 index 00000000..76342425 --- /dev/null +++ b/build/nandfirm/menu-launcher/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - menu-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/menu-launcher/wram_regs/wram_regs.c b/build/nandfirm/menu-launcher/wram_regs/wram_regs.c new file mode 100644 index 00000000..7e727571 --- /dev/null +++ b/build/nandfirm/menu-launcher/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - nandfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/nandfirm/nandfirm-print/Makefile b/build/nandfirm/nandfirm-print/Makefile new file mode 100644 index 00000000..1da31acc --- /dev/null +++ b/build/nandfirm/nandfirm-print/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - nandfirm - nandfirm-print +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = ../../norfirm/norfirm-print + +TARGET_FIRM_BIN = nandfirm_print-$(TWL_BUILD_TYPE).nand +BINDIR = . +MAKEFIRM_ARM9 = ../../norfirm/norfirm-print/ARM9/bin/$(TWL_BUILDTYPE_ARM9)/twl_norfirm9_print.tef +MAKEFIRM_ARM7 = ../../norfirm/norfirm-print/ARM7/bin/$(TWL_BUILDTYPE_ARM7)/twl_norfirm7_print.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der +LDEPENDS_BIN += ../../norfirm/norfirm-print/wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = nandfirm-BB.nandsf + +LDIRT_CLEAN += $(wildcard *.nand) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/nandfirm-print/nandfirm-BB.nandsf b/build/nandfirm/nandfirm-print/nandfirm-BB.nandsf new file mode 100644 index 00000000..f988a712 --- /dev/null +++ b/build/nandfirm/nandfirm-print/nandfirm-BB.nandsf @@ -0,0 +1,24 @@ +#NANDSF --- Nandfirm Spec File + +VERSION : 0xffff570000000000 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ../../norfirm/norfirm-print/wram_regs/wram_regs.rbin + +MIRROR_OFS: 0x80000 + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x01fe00 diff --git a/build/nandfirm/sdmc-launcher/ARM7/Makefile b/build/nandfirm/sdmc-launcher/ARM7/Makefile new file mode 100644 index 00000000..46ea85b3 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM7/Makefile @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher7.tef + +SRCS = main.c + +CRT0_O = crt0_firm.o + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +#SRCDIR = # using default +#LCFILE = # using default + +LLIBRARIES += libsysmenu_sp.TWL$(ARCHGEN_TYPE).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/sdmc-launcher/ARM7/main.c b/build/nandfirm/sdmc-launcher/ARM7/main.c new file mode 100644 index 00000000..e00a5d81 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM7/main.c @@ -0,0 +1,293 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +#define PROFILE_ENABLE + +/* + デバッグLEDをFINALROMとは別にOn/Offできます。 +*/ +#define USE_DEBUG_LED + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC800 + +/* + AES鍵設定API +*/ +extern void SYSMi_SetAESKeysForAccessControl( BOOL isNtrMode, ROM_Header *pROMH ); + + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef USE_DEBUG_LED +static u8 step = 0x80; +#define InitDebugLED() I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x03, 0x00) +#define SetDebugLED(pattern) I2Ci_WriteRegister(I2C_SLAVE_DEBUG_LED, 0x01, (pattern)); +#else +#define InitDebugLED() ((void)0) +#define SetDebugLED(pattern) ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_FATFS 8 +#define DMA_FATFS_1 0 +#define DMA_FATFS_2 1 + +static ROM_Header* const rh= (ROM_Header*)HW_TWL_ROM_HEADER_BUF; + +/*************************************************************** + PreInit + + FromBootの対応&メインメモリの初期化 + OS_Init前なので注意 (ARM9によるメインメモリ初期化で消されないように注意) +***************************************************************/ +static void PreInit(void) +{ + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + /* + リセットパラメータ(1バイト)を共有領域(1バイト)にコピー + */ +#define HOTSTART_FLAG_ENABLE 0x80 + *(u8 *)HW_NAND_FIRM_HOTSTART_FLAG = (u8)(MCUi_ReadRegister( (u16)(MCU_REG_TEMP_ADDR + OS_MCU_RESET_VALUE_OFS) ) | HOTSTART_FLAG_ENABLE); +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + PM_BackLightOn( TRUE ); // ARM9側画面表示のため + + /* + AES関連 (NAND暗号化の鍵変更を含む) + */ + if ( OSi_GetFromFirmAddr()->aes_key[2][0] ) + { + AESi_PreInitKeys(); + } + // AESの初期化 + AES_Init(THREAD_PRIO_AES); // for encrypted NAND + // マウント情報の初期化 + FS_InitMountInfo(FALSE, TRUE); + /* + バッテリー残量チェック + */ + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_FIRMWARE ); // change battery level only + PUSH_PROFILE(); + SetDebugLED(++step); // 0x84 + if ( (MCUi_ReadRegister( MCU_REG_POWER_INFO_ADDR ) & MCU_REG_POWER_INFO_LEVEL_MASK) == 0 ) + { +#ifndef SDK_FINALROM + OS_TPanic("Battery is empty.\n"); +#else + PM_Shutdown(); +#endif + } +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + AESi_ResetAesKeyA(); + AESi_ResetAesKeyB(); + AESi_ResetAesKeyC(); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + OS_BootFromFIRM(); +#endif +} + +void TwlSpMain( void ) +{ + int fd; // menu file descriptor + +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + InitDebugLED(); + SetDebugLED(++step); // 0x81 + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: after PreInit + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + SetDebugLED(++step); // 0x82 + + OS_InitFIRM(); + OS_EnableIrq(); + OS_EnableInterrupts(); + // 2: after OS_InitFIRM + PUSH_PROFILE(); + SetDebugLED(++step); // 0x83 + + PostInit(); + // 3: after PostInit + PUSH_PROFILE(); + SetDebugLED(++step); // 0x85 + + if ( !FATFS_Init( DMA_FATFS_1, DMA_FATFS_2, THREAD_PRIO_FATFS ) ) + { + OS_TPrintf("Failed to call FATFS_Init().\n"); + goto end; + } + // 4: after FATFS_Init + PUSH_PROFILE(); + SetDebugLED(++step); // 0x86 + + if ( PXI_RecvID() != FIRM_PXI_ID_SET_PATH ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_SET_PATH).\n"); + goto end; + } + // 5: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x87 + + if ( (fd = FS_OpenSrl()) < 0 ) + { + OS_TPrintf("Failed to call FS_OpenSrl().\n"); + goto end; + } + // 6: after FS_OpenSrl + PUSH_PROFILE(); + SetDebugLED(++step); // 0x88 + + if ( !FS_LoadHeader( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadHeader().\n"); + goto end; + } + // 7: after FS_LoadHeader + PUSH_PROFILE(); + SetDebugLED(++step); // 0x89 + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_HEADER ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_HEADER).\n"); + goto end; + } + // 8: after PXI + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8a + + AESi_InitKeysFIRM(); + AESi_InitSeed(); + // 9: after AESi_InitSeed + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8b + + if ( !FS_LoadStatic( fd ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + // 10: after FS_LoadStatic + PUSH_PROFILE(); + SetDebugLED(++step); // 0x8c + + if ( PXI_RecvID() != FIRM_PXI_ID_DONE_STATIC ) + { + OS_TPrintf("PXI_RecvID() was received invalid value (!=FIRM_PXI_ID_DONE_STATIC).\n"); + goto end; + } + // 11: after PXI + PUSH_PROFILE(); + +#ifdef PROFILE_ENABLE + { + int i; + PXI_RecvID(); + OS_TPrintf("\n[ARM7] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM7] End\n"); + } +#endif + SetDebugLED( 0 ); + + SYSMi_SetAESKeysForAccessControl(FALSE, rh); + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + FS_SetMountInfoForSrl(); + MCUi_WriteRegister( MCU_REG_MODE_ADDR, MCU_SYSTEMMODE_TWL ); // change TWL mode + OS_BootFromFIRM(); + +end: + SetDebugLED( (u8)(0xF0 | step)); + + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + diff --git a/build/nandfirm/sdmc-launcher/ARM9/Makefile b/build/nandfirm/sdmc-launcher/ARM9/Makefile new file mode 100644 index 00000000..ebf8e3c3 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +LINCLUDES = + +#---------------------------------------------------------------------------- + +TARGET_BIN = sdmc_launcher9.srl + +SRCS = main.c font.c screen.c + +CRT0_O = crt0_firm.o + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#LCFILE_TEMPLATE = $(FIRM_SPECDIR)/$(TWL_PROC)-$(TWL_PLATFORM)-PARTNER.lcf.template + +LINCLUDES = ./include + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/sdmc-launcher/ARM9/font.c b/build/nandfirm/sdmc-launcher/ARM9/font.c new file mode 100644 index 00000000..ee49f50b --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/font.c @@ -0,0 +1,588 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.c + + Copyright 2003-2005 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. + + $Log: font.c,v $ + Revision 1.3 2005/02/28 05:26:11 yosizaki + do-indent. + + Revision 1.2 2004/11/02 07:19:52 terui + コメント内スペルミスを修正。 + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include "font.h" + + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/sdmc-launcher/ARM9/include/font.h b/build/nandfirm/sdmc-launcher/ARM9/include/font.h new file mode 100644 index 00000000..30d49e95 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/include/font.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: font.h + + Copyright 2003-2005 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. + + $Log: font.h,v $ + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +typedef enum +{ + FONT_BLOCK = 0, + FONT_RED = 1, + FONT_GREEN = 2, + FONT_BLUE = 3, + FONT_YELLOW = 4, + FONT_PURPLE = 5, + FONT_CYAAN = 6, + FONT_WHITE = 15 +} +MYFontColor; + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/sdmc-launcher/ARM9/include/screen.h b/build/nandfirm/sdmc-launcher/ARM9/include/screen.h new file mode 100644 index 00000000..81ed6790 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.h + + Copyright 2003-2006 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. + + $Log: screen.h,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/nandfirm/sdmc-launcher/ARM9/main.c b/build/nandfirm/sdmc-launcher/ARM9/main.c new file mode 100644 index 00000000..89aa5eae --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/main.c @@ -0,0 +1,517 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - nandfirm - sdmc-launcher + File: main.c + + Copyright 2007 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 "font.h" +#include "screen.h" + +#ifdef FIRM_USE_PRODUCT_KEYS +static const u8* const rsa_key_user = NULL; // not acceptable +static const u8* const rsa_key_sys = NULL; // not acceptable +static const u8 rsa_key_secure[128] = +{ + 0xC7, 0x94, 0x50, 0x00, 0x3A, 0xE1, 0x0E, 0x6C, 0xA8, 0xD1, 0xC0, 0x2D, 0x77, 0xB7, 0x6D, 0xBC, + 0x31, 0xDB, 0x12, 0x08, 0x09, 0x0D, 0x2A, 0xE8, 0xC9, 0x1A, 0x2B, 0x6E, 0x6C, 0x85, 0x78, 0xD7, + 0x46, 0x50, 0x05, 0xB5, 0xCC, 0x3B, 0xEC, 0xBA, 0xF4, 0xDE, 0xC2, 0x13, 0x13, 0xBE, 0x67, 0xEE, + 0x85, 0x19, 0xEB, 0x62, 0xB3, 0x5C, 0x09, 0xA8, 0x54, 0x44, 0x26, 0x85, 0x25, 0xEA, 0xE5, 0x85, + 0xD1, 0xB5, 0xCE, 0xA0, 0xFF, 0x6B, 0x61, 0xCA, 0x94, 0xC1, 0x67, 0xBE, 0xC0, 0x7E, 0x3B, 0xFF, + 0x12, 0x9B, 0x79, 0xDB, 0xAC, 0xD3, 0x5A, 0x3F, 0x14, 0x37, 0x49, 0xA8, 0x7C, 0x2F, 0x07, 0xF4, + 0x8B, 0xA9, 0x8B, 0x8D, 0xB2, 0x60, 0xA5, 0xD5, 0x64, 0xEE, 0xCF, 0x3F, 0x32, 0xEE, 0x77, 0xAC, + 0x27, 0x75, 0x2B, 0x04, 0xD7, 0x26, 0xA8, 0x8A, 0x55, 0x2A, 0x76, 0xE5, 0x68, 0x80, 0x57, 0x85 +}; +#else +#if 0 +static const u8 rsa_key_user[128] = +{ + 0xAC, 0x93, 0xBB, + 0x3C, 0x15, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, + 0xD5, 0x79, 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, + 0xCB, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, + 0xF0, 0x11, 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, + 0x7F, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, + 0x96, 0x4F, 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, + 0x62, 0x39, 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, + 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11 +}; +#else +static const u8* const rsa_key_user = NULL; // not acceptable +#endif +static const u8 rsa_key_sys[128] = +{ + 0xe9, 0x9e, 0xa7, 0x9f, 0x59, 0x4d, 0xf4, 0xa7, 0x60, 0x04, 0xbd, 0x47, 0xf2, 0xb3, 0x64, 0xcd, + 0x16, 0x79, 0xc1, 0x47, 0x39, 0xf6, 0xa9, 0xf8, 0xee, 0x1a, 0xd0, 0x72, 0xcf, 0x43, 0x97, 0x0c, + 0x93, 0xa1, 0x38, 0x4e, 0x13, 0x40, 0x6c, 0x10, 0x59, 0x43, 0xe2, 0x71, 0x29, 0x54, 0x14, 0x2c, + 0xc5, 0xda, 0x59, 0x4d, 0xb4, 0x6a, 0xef, 0x85, 0x61, 0x6f, 0x7f, 0x1c, 0x59, 0x34, 0x2c, 0xc6, + 0x24, 0xf3, 0x7b, 0xc3, 0xb7, 0x40, 0xd1, 0x46, 0xf8, 0x90, 0xb7, 0xc2, 0x98, 0x50, 0xaf, 0x95, + 0x52, 0x42, 0xdb, 0xac, 0xd6, 0x7e, 0xa9, 0xc3, 0x3d, 0x1b, 0x51, 0x56, 0x07, 0x06, 0xd0, 0x0b, + 0x01, 0xbb, 0x58, 0x93, 0xea, 0xa0, 0x2c, 0xc7, 0x7d, 0x6a, 0x31, 0x7e, 0xc9, 0xe2, 0xda, 0xfe, + 0x1f, 0x2e, 0x9d, 0xa7, 0x54, 0x84, 0xdc, 0x28, 0xb9, 0x18, 0xea, 0x16, 0xf2, 0x95, 0x55, 0x6d, +}; +static const u8 rsa_key_secure[128] = +{ + 0xa7, 0x9f, 0x54, 0xa0, 0xc7, 0x45, 0xae, 0xf6, 0x63, 0xa7, 0x53, 0xb7, 0x0a, 0xcc, 0x0b, 0xcb, + 0x65, 0xe1, 0x11, 0xc6, 0x05, 0x15, 0xb5, 0x6e, 0xbd, 0xac, 0x0c, 0xca, 0xf4, 0x7c, 0x68, 0x7a, + 0xf9, 0x0e, 0x5d, 0x98, 0x5b, 0xc8, 0x4d, 0x22, 0x3b, 0xa3, 0xbe, 0x8b, 0x5b, 0x7f, 0x26, 0x44, + 0x9f, 0xc4, 0x48, 0x44, 0xb1, 0x32, 0xb7, 0xbe, 0x63, 0xba, 0xd6, 0xc1, 0x10, 0xce, 0xf6, 0xed, + 0x47, 0x8f, 0xe1, 0xff, 0x7f, 0x5a, 0xd5, 0x5d, 0x94, 0x38, 0x2f, 0xa1, 0xd4, 0xef, 0x82, 0xb1, + 0x0d, 0xc4, 0x43, 0xec, 0xbe, 0x77, 0xb6, 0x82, 0x9c, 0xfa, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, + 0xfb, 0xd6, 0x05, 0xc8, 0x9a, 0x7e, 0xad, 0x44, 0x40, 0x0d, 0x35, 0x9c, 0x45, 0x44, 0x64, 0x36, + 0x61, 0x4b, 0xf7, 0xe6, 0x31, 0x5c, 0x7d, 0x96, 0x73, 0xe8, 0xac, 0xb4, 0xe3, 0x5e, 0xd1, 0x9d, +}; +#endif + +static SVCSignHeapContext acPool; + +/* + PROFILE_ENABLE を定義するとある程度のパフォーマンスチェックができます。 + 利用するためには、main.cかどこかに、u32 profile[256]; u32 pf_cnt = 0; を + 定義する必要があります。 +*/ +#define PROFILE_ENABLE + +/* + PRINT_MEMORY_ADDR を定義すると、そのアドレスからSPrintfを行います(このファイルのみ) + FINALROM版でもコードが残るので注意してください。 +*/ +//#define PRINT_MEMORY_ADDR 0x02FFC000 + +//#ifdef SDK_FINALROM // FINALROMで無効化 +//#undef PROFILE_ENABLE +//#endif + +#ifdef PROFILE_ENABLE +#define PROFILE_MAX 16 +u32 profile[PROFILE_MAX]; +u32 pf_cnt = 0; +#define PUSH_PROFILE() (profile[pf_cnt++] = (u32)OS_TicksToMicroSeconds(OS_GetTick())) +#else +#define PUSH_PROFILE() ((void)0) +#endif + +#ifdef PRINT_MEMORY_ADDR +static char* debugPtr = (char*)PRINT_MEMORY_ADDR; +#undef OS_TPrintf +//#define OS_TPrintf(...) (debugPtr = (char*)((u32)(debugPtr + STD_TSPrintf(debugPtr, __VA_ARGS__) + 0xf) & ~0xf)) +#define OS_TPrintf(...) (debugPtr += STD_TSPrintf(debugPtr, __VA_ARGS__)) +#endif + +/*************************************************************** + PreInit + + FromBootの対応&OS_Init前に必要なメインメモリの初期化 +***************************************************************/ +static void PreInit(void) +{ + /* + メインメモリ関連 + */ + // SHARED領域クリア + MI_CpuClearFast((void *)HW_WRAM_EX_LOCK_BUF, (HW_WRAM_EX_LOCK_BUF_END - HW_WRAM_EX_LOCK_BUF)); + MI_CpuClearFast((void *)HW_BIOS_EXCP_STACK_MAIN, (HW_REAL_TIME_CLOCK_BUF - HW_BIOS_EXCP_STACK_MAIN)); + MI_CpuClearFast((void *)HW_PXI_SIGNAL_PARAM_ARM9, (HW_MMEMCHECKER_MAIN - HW_PXI_SIGNAL_PARAM_ARM9)); + MI_CpuClearFast((void*)HW_ROM_HEADER_BUF, (HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF)); + + /* + FromBrom関連 + */ + if ( !OSi_FromBromToMenu() ) + { + OS_Terminate(); + } + + // ブートタイプの変更 + ( (OSBootInfo *)OS_GetBootInfo() )->boot_type = OS_BOOTTYPE_NAND; +} + +/*************************************************************** + PostInit + + 各種初期化 +***************************************************************/ +static void PostInit(void) +{ + // アリーナ設定 + { + static u32 arena[ 0x400 / sizeof(u32) ]; + OS_SetMainArenaLo( arena ); + OS_SetMainArenaHi( &arena[ 0x400 / sizeof(u32) ] ); + } + // RSA用ヒープ設定 + SVC_InitSignHeap( &acPool, (void*)HW_FIRM_RSA_BUF, HW_FIRM_RSA_BUF_SIZE ); + // FS/FATFS初期化 + FS_InitFIRM(); +} + +/*************************************************************** + TryResolveSrl + + ランチャーSRLを解決する + 1) sdmc:/menu.srl があればそれを選択 + 2) 最初に見つかった sdmc:/***.srl を選択 + 3) 失敗 +***************************************************************/ +#define MENU_FILE "sdmc:/menu.srl" +#define MENU_DIR "sdmc:/" +static BOOL TryResolveSrl(void) +{ + FSPathInfo info; + FSFile dir; + FSDirectoryEntryInfo entry; + + MI_CpuClearFast( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + + // 1) sdmc:/menu.srl があればそれを選択 + if ( FS_GetPathInfo( MENU_FILE, &info ) && (info.attributes & FS_ATTRIBUTE_IS_DIRECTORY) == 0 ) + { + STD_CopyString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, MENU_FILE ); + return TRUE; + } + + // 2) 最初に見つかった sdmc:/***.srl を選択 + FS_InitFile( &dir ); + if ( FS_OpenDirectory( &dir, MENU_DIR, 0 ) ) + { + while ( FS_ReadDirectory( &dir, &entry ) ) + { + u32 len = entry.longname_length; + if ( (entry.attributes & FS_ATTRIBUTE_IS_DIRECTORY) == 0 + && len < HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE - STD_GetStringLength( MENU_DIR ) + && len > 4 + // postfix + && entry.longname[len-4] == '.' + && (entry.longname[len-3] == 's' || entry.longname[len-3] == 'S') + && (entry.longname[len-2] == 'r' || entry.longname[len-2] == 'R') + && (entry.longname[len-1] == 'l' || entry.longname[len-1] == 'L')) + { + int offset; + FS_CloseDirectory( &dir ); + offset = STD_CopyLString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF, MENU_DIR, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE ); + offset += STD_CopyLString( (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF + offset, entry.longname, HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE - offset ); + return TRUE; + } + } + FS_CloseDirectory( &dir ); + } + + // 3) 失敗 + return FALSE; +} + +/*************************************************************** + CheckHeader + + ヘッダがシステムメニューとして問題ないかチェック +***************************************************************/ +static BOOL CheckHeader(void) +{ + ROM_Header_Short* const rhs = (ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF; + // イニシャルコードなど + OS_TPrintf("Initial Code : %08X (%.4s)\n", *(u32*)rhs->game_code, rhs->game_code); + OS_TPrintf("Platform Code : %02X\n", rhs->platform_code); + OS_TPrintf("Codec Mode : %s\n", rhs->exFlags.codec_mode ? "TWL" : "NITRO"); + OS_TPrintf("Sigunature : %s\n", rhs->enable_signature ? "AVAILABLE" : "NOT AVAILABLE"); + OS_TPrintf("AES Encryption : %s\n", rhs->enable_aes ? "AVAILABLE" : "NOT AVAILABLE"); + if ( rhs->enable_aes ) + { + OS_TPrintf("AES Key Type : %s\n", ( rhs->developer_encrypt_old || rhs->exFlags.developer_encrypt ) ? "FOR DEVELOPMENT" : "FOR PRODUCT"); + } + // エントリポイント + OS_TPrintf("ARM9 Entry point : %08X\n", rhs->main_entry_address); + OS_TPrintf("ARM7 Entry point : %08X\n", rhs->sub_entry_address); + // ロード範囲 + OS_TPrintf("ARM9 ROM address : %08X\n", rhs->main_rom_offset); + OS_TPrintf("ARM9 RAM address : %08X\n", rhs->main_ram_address); + OS_TPrintf("ARM9 size : %08X\n", rhs->main_size); + OS_TPrintf("ARM7 ROM address : %08X\n", rhs->sub_rom_offset); + OS_TPrintf("ARM7 RAM address : %08X\n", rhs->sub_ram_address); + OS_TPrintf("ARM7 size : %08X\n", rhs->sub_size); + OS_TPrintf("ARM9 LTD ROM address: %08X\n", rhs->main_ltd_rom_offset); + OS_TPrintf("ARM9 LTD RAM address: %08X\n", rhs->main_ltd_ram_address); + OS_TPrintf("ARM9 LTD size : %08X\n", rhs->main_ltd_size); + OS_TPrintf("ARM7 LTD ROM address: %08X\n", rhs->sub_ltd_rom_offset); + OS_TPrintf("ARM7 LTD RAM address: %08X\n", rhs->sub_ltd_ram_address); + OS_TPrintf("ARM7 LTD size : %08X\n", rhs->sub_ltd_size); + // 順序ほぼ最適化済み +#ifdef FIRM_USE_PRODUCT_KEYS + if ( rhs->platform_code != PLATFORM_CODE_TWL_LIMITED || // TWL Limited only + !rhs->enable_signature || // Should be use ROM header signature +#else + if ( // no check +#endif + !rhs->exFlags.codec_mode || // TWL mode only + // should be in main memory + HW_TWL_MAIN_MEM > (u32)rhs->main_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->main_ltd_ram_address || + HW_TWL_MAIN_MEM > (u32)rhs->sub_ltd_ram_address || + // should be in static area without Limited region + (u32)rhs->main_ram_address > (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address > (u32)rhs->sub_entry_address || + // should be in main memory (end address) + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ram_address + rhs->main_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ram_address + rhs->sub_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->main_ltd_ram_address + rhs->main_ltd_size || + HW_FIRM_FATFS_COMMAND_BUFFER <= (u32)rhs->sub_ltd_ram_address + rhs->sub_ltd_size || + // should be in static area without Limited region (end address) + (u32)rhs->main_ram_address + rhs->main_size <= (u32)rhs->main_entry_address || + (u32)rhs->sub_ram_address + rhs->sub_size <= (u32)rhs->sub_entry_address || + 0 ) + { + OS_TPrintf("Invalid ROM header for SDMC Launcher!\n"); + return FALSE; + } + return TRUE; +} + +/*************************************************************** + EraseAll + + 不正終了しました + いろいろ消してください + DSモードにして終わるのがよいか? +***************************************************************/ +static void EraseAll(void) +{ + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); +#ifdef SDK_FINALROM + MI_CpuClearFast( (void*)HW_TWL_ROM_HEADER_BUF, HW_TWL_ROM_HEADER_BUF_SIZE ); + MI_CpuClearFast( (void*)HW_ROM_HEADER_BUF, HW_ROM_HEADER_BUF_END-HW_ROM_HEADER_BUF ); + OS_BootFromFIRM(); +#endif +} + +static void myInit(void); +static void myVBlankIntr(void); + +void TwlMain( void ) +{ +#define X_OFF 2 + s16 y = 2; +#ifdef PROFILE_ENABLE + // 0: bootrom + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + + PreInit(); +#ifdef PROFILE_ENABLE + // 1: before Init + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); +#endif + + myInit(); +#ifdef PROFILE_ENABLE + // 2: before OS_InitTick + profile[pf_cnt++] = OS_TicksToMicroSecondsBROM32(OS_GetTick()); + + OS_InitTick(); +#endif + + PostInit(); + // 3: after PostInit + PUSH_PROFILE(); + + //---- clear screen buffer + ClearScreen(); + PrintString( X_OFF, y, FONT_CYAAN, "SDMC Launcher (N)" ); + PrintString( X_OFF+18, y++, FONT_YELLOW, "%s", __DATE__ ); + PrintString( X_OFF+21, y++, FONT_YELLOW, "%s", __TIME__ ); + OS_WaitVBlankIntr(); + y++; + + PrintString( X_OFF, y++, FONT_WHITE, "Initialized." ); + y++; + PrintString( X_OFF, y++, FONT_WHITE, "Finding SRL..." ); + OS_WaitVBlankIntr(); + + if ( !TryResolveSrl() ) + { + goto end; + } + PrintString( 0, y++, FONT_GREEN, "%30.32s", (char*)HW_TWL_FS_BOOT_SRL_PATH_BUF + STD_GetStringLength( MENU_DIR ) ); + // 4: after FS_ResolveSrl + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_SET_PATH ); + // 5: after PXI + PUSH_PROFILE(); + + PrintString( X_OFF, y++, FONT_WHITE, "Loading header..." ); + OS_WaitVBlankIntr(); + + if ( !FS_LoadHeader( &acPool, rsa_key_user, rsa_key_sys, rsa_key_secure ) || !CheckHeader() ) + { + OS_TPrintf("Failed to call FS_LoadHeader() and/or CheckHeader().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 6: after FS_LoadHeader + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_HEADER ); + // 7: after PXI + PUSH_PROFILE(); + + PrintString( X_OFF, y++, FONT_WHITE, "Loading static data..." ); + OS_WaitVBlankIntr(); + + if ( !FS_LoadStatic( NULL ) ) + { + OS_TPrintf("Failed to call FS_LoadStatic().\n"); + goto end; + } + PrintString( X_OFF+20, y++, FONT_GREEN, "Done." ); + // 8: after FS_LoadStatic + PUSH_PROFILE(); + + PXI_NotifyID( FIRM_PXI_ID_DONE_STATIC ); + // 9: after PXI + PUSH_PROFILE(); + + OS_WaitVBlankIntr(); + +#ifdef PROFILE_ENABLE + { + int i; + OS_TPrintf("\n[ARM9] Begin\n"); + for (i = 0; i < PROFILE_MAX; i++) + { +// OS_TPrintf("0x%08X\n", profile[i]); + if ( !profile[i] ) break; + OS_TPrintf("%2d: %7d usec", i, profile[i]); + if (i) + { + OS_TPrintf(" ( %7d usec )\n", profile[i]-profile[i-1]); + } + else + { + OS_TPrintf("\n"); + } + } + OS_TPrintf("\n[ARM9] End\n"); + PXI_NotifyID( FIRM_PXI_ID_NULL ); + } +#endif + + MI_CpuClearFast( OSi_GetFromFirmAddr(), sizeof(OSFromFirmBuf) ); + PrintString( X_OFF, y++, FONT_WHITE, "Booting..." ); + OS_WaitVBlankIntr(); + OS_BootFromFIRM(); + +end: + PrintString( X_OFF+20, y, FONT_RED, "Failed." ); + OS_WaitVBlankIntr(); + EraseAll(); + + // failed + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + PXI_NotifyID( FIRM_PXI_ID_ERR ); + OS_Terminate(); +} + + +//---------------------------------------------------------------- +// myInit +// +void myInit(void) +{ + //---- init + OS_InitFIRM(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- backdrop + *(u16*)HW_PLTT = GX_RGB(0,0,8); + *(u16*)HW_DB_PLTT = GX_RGB(0,0,8); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, myVBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +//---------------------------------------------------------------- +// myVBlankIntr +// vblank interrupt handler +// +static void myVBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/nandfirm/sdmc-launcher/ARM9/screen.c b/build/nandfirm/sdmc-launcher/ARM9/screen.c new file mode 100644 index 00000000..8e20145a --- /dev/null +++ b/build/nandfirm/sdmc-launcher/ARM9/screen.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - SPI - demos - pm-1 + File: screen.c + + Copyright 2003-2006 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. + + $Log: screen.c,v $ + Revision 1.3 2006/01/18 02:12:28 kitase_hirotake + do-indent + + Revision 1.2 2005/02/28 05:26:12 yosizaki + do-indent. + + Revision 1.1 2004/08/07 01:59:51 yada + modified much + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +//u16 gScreen2[ 32 * 32 ]; + +// ** these code are refer to rtc sample. thanks. +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/nandfirm/sdmc-launcher/Makefile b/build/nandfirm/sdmc-launcher/Makefile new file mode 100644 index 00000000..b4724afb --- /dev/null +++ b/build/nandfirm/sdmc-launcher/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = sdmc_launcher-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nand +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/sdmc_launcher9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/sdmc_launcher7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nand.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = nandfirm.nandsf + +LDIRT_CLEAN += $(wildcard *.nand) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/nandfirm/sdmc-launcher/nandfirm.nandsf b/build/nandfirm/sdmc-launcher/nandfirm.nandsf new file mode 100644 index 00000000..0cb73cd2 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/nandfirm.nandsf @@ -0,0 +1,24 @@ +#NANDSF --- Nandfirm Spec File + +VERSION : 0xffff570000000000 # GENERATE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +MIRROR_OFS: 0x80000 + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : FALSE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : FALSE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +ARM9_X2 : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x01fe00 diff --git a/build/nandfirm/sdmc-launcher/readme.txt b/build/nandfirm/sdmc-launcher/readme.txt new file mode 100644 index 00000000..b1b1973e --- /dev/null +++ b/build/nandfirm/sdmc-launcher/readme.txt @@ -0,0 +1,5 @@ +注意事項 + +起動するアプリがromアーカイブを使用する場合、 +NAライブラリをリンクしておく必要があります。 +(単純にリンクするライブラリに追加するだけです) diff --git a/build/nandfirm/sdmc-launcher/wram_regs/Makefile b/build/nandfirm/sdmc-launcher/wram_regs/Makefile new file mode 100644 index 00000000..8de72ccf --- /dev/null +++ b/build/nandfirm/sdmc-launcher/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - nandfirm - sdmc-launcher +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/nandfirm/sdmc-launcher/wram_regs/wram_regs.c b/build/nandfirm/sdmc-launcher/wram_regs/wram_regs.c new file mode 100644 index 00000000..7e727571 --- /dev/null +++ b/build/nandfirm/sdmc-launcher/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - nandfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/norfirm/Makefile b/build/norfirm/Makefile new file mode 100644 index 00000000..e49922b3 --- /dev/null +++ b/build/norfirm/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - firmware +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + firm-dev \ + norfirm-print \ + norfirm-empty \ + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/firm-dev/ARM7/Makefile b/build/norfirm/firm-dev/ARM7/Makefile new file mode 100644 index 00000000..45677a3c --- /dev/null +++ b/build/norfirm/firm-dev/ARM7/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - firm-dev +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +FIRM_ONLY_JTAG = TRUE + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = firm_dev7.tef + +SRCS = \ + main.c \ + +CRT0_O = crt0_firm.o +ifdef FIRM_ONLY_JTAG +CRT0_O += crt0_jtag.o +endif + +#SRCDIR = # using default +#LCFILE = # using default + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/firm-dev/ARM7/main.c b/build/norfirm/firm-dev/ARM7/main.c new file mode 100644 index 00000000..f4121c63 --- /dev/null +++ b/build/norfirm/firm-dev/ARM7/main.c @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm-print + File: main.c + + Copyright 2007 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 "reboot.h" + +//#define PRINT_DEBUG +//#define FIRM_ENABLE_BACKLIGHT + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +void TwlSpMain( void ) +{ + OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick())); + + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + +#ifdef FIRM_ENABLE_BACKLIGHT +// MIi_CpuClearFast( 0, (void*)HW_TWL_ROM_HEADER_BUF, HW_MAIN_MEM_SYSTEM_END - HW_TWL_ROM_HEADER_BUF ); // include HW_MAIN_MEM_SHARED + + OS_InitFIRM(); + + OS_TPrintf( "\nARM7 starts.\n" ); + + OS_EnableInterrupts(); + OS_EnableIrq(); + + PM_InitFIRM(); + PMi_SetParams( REG_PMIC_BL_BRT_A_ADDR, PMIC_BACKLIGHT_BRIGHT_MAX, PMIC_BL_BRT_A_MASK ); + PMi_SetParams( REG_PMIC_BL_BRT_B_ADDR, PMIC_BACKLIGHT_BRIGHT_MAX, PMIC_BL_BRT_B_MASK ); + PM_BackLightOn( TRUE ); + + OS_TPrintf( "\nARM7 ends.\n" ); +#endif // FIRM_ENABLE_BACKLIGHT + + REBOOT_DisableInterruptsAndProtectionUnit(); + reg_SCFG_JTAG = REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK | REG_SCFG_JTAG_DSPJE_MASK; + while (1) + { + } +// OS_Terminate(); +} + diff --git a/build/norfirm/firm-dev/ARM9/Makefile b/build/norfirm/firm-dev/ARM9/Makefile new file mode 100644 index 00000000..57ee070b --- /dev/null +++ b/build/norfirm/firm-dev/ARM9/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - firm-dev +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +FIRM_ONLY_JTAG = TRUE + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = firm_dev9.srl + +SRCS = main.c + +CRT0_O = crt0_firm.o +ifdef FIRM_ONLY_JTAG +CRT0_O += crt0_jtag.o +endif + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/firm_dev7.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/firm-dev/ARM9/main.c b/build/norfirm/firm-dev/ARM9/main.c new file mode 100644 index 00000000..24f86234 --- /dev/null +++ b/build/norfirm/firm-dev/ARM9/main.c @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm-print + File: main.c + + Copyright 2007 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 "reboot.h" + +//#define PRINT_DEBUG +//#define FIRM_ENABLE_BACKLIGHT + +#ifndef PRINT_DEBUG +#undef OS_TPrintf +#define OS_TPrintf(...) ((void)0) +#endif // PRINT_DEBUG + +void TwlMain( void ) +{ + OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick())); + + MIi_CpuClearFast( 0, (void*)OSi_GetFromBromAddr(), sizeof(OSFromBromBuf) ); + +#ifdef FIRM_ENABLE_BACKLIGHT + OS_InitFIRM(); + + OS_TPrintf( "\nARM9 starts.\n" ); + OS_TPrintf( "\nARM9 ends.\n" ); +#endif // FIRM_ENABLE_BACKLIGHT + + REBOOT_DisableInterruptsAndProtectionUnit(); + while (1) + { + } +} + diff --git a/build/norfirm/firm-dev/Makefile b/build/norfirm/firm-dev/Makefile new file mode 100644 index 00000000..9ea4eec9 --- /dev/null +++ b/build/norfirm/firm-dev/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - norfirm - firm-dev +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = firm_dev-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nor +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/firm_dev9.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/firm_dev7.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nor.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = norfirm.norsf + +LDIRT_CLEAN += $(wildcard *.nor) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/firm-dev/norfirm.norsf b/build/norfirm/firm-dev/norfirm.norsf new file mode 100644 index 00000000..24108f0b --- /dev/null +++ b/build/norfirm/firm-dev/norfirm.norsf @@ -0,0 +1,25 @@ +#NORSF --- Norfirm Spec File + +VERSION : GENERATE + +BOOT_NAND : TRUE # TRUE or FALSE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : TRUE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : TRUE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +NCD_ROMOFS : 0x01fe00 + +BAUDRATE : 8M # 4M or 8M +ARM9_X2 : TRUE # TRUE or FALSE diff --git a/build/norfirm/firm-dev/wram_regs/Makefile b/build/norfirm/firm-dev/wram_regs/Makefile new file mode 100644 index 00000000..04fed484 --- /dev/null +++ b/build/norfirm/firm-dev/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - norfirm-print +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/firm-dev/wram_regs/wram_regs.c b/build/norfirm/firm-dev/wram_regs/wram_regs.c new file mode 100644 index 00000000..4d052220 --- /dev/null +++ b/build/norfirm/firm-dev/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/norfirm/norfirm-empty/Makefile b/build/norfirm/norfirm-empty/Makefile new file mode 100644 index 00000000..6c5a1ae7 --- /dev/null +++ b/build/norfirm/norfirm-empty/Makefile @@ -0,0 +1,50 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - norfirm - norfirm-empty +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + +TARGET_FIRM_BIN = norfirm_empty.nor +BINDIR = . +MAKEFIRM_ARM9 = +MAKEFIRM_ARM7 = +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nor.der +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = norfirm-BB.norsf + +LDIRT_CLEAN += $(TARGETS) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/norfirm/norfirm-empty/norfirm-BB.norsf b/build/norfirm/norfirm-empty/norfirm-BB.norsf new file mode 100644 index 00000000..4c3329a2 --- /dev/null +++ b/build/norfirm/norfirm-empty/norfirm-BB.norsf @@ -0,0 +1,8 @@ +#NORSF --- Norfirm Spec File + +VERSION : GENERATE + +BOOT_NAND : TRUE # TRUE or FALSE + +NCD_ROMOFS : 0x01fe00 + diff --git a/build/norfirm/norfirm-print/ARM7/Makefile b/build/norfirm/norfirm-print/ARM7/Makefile new file mode 100644 index 00000000..53b0578c --- /dev/null +++ b/build/norfirm/norfirm-print/ARM7/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - norfirm-print +# File: Makefile +# +# Copyright 2007 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:$ +#---------------------------------------------------------------------------- + +TWL_PROC = ARM7 + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = twl_norfirm7_print.tef + +CRT0_O = crt0_firm.o + +SRCS = \ + main.c \ + +#SRCDIR = # using default +#LCFILE = # using default + +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/norfirm-print/ARM7/main.c b/build/norfirm/norfirm-print/ARM7/main.c new file mode 100644 index 00000000..13134a0f --- /dev/null +++ b/build/norfirm/norfirm-print/ARM7/main.c @@ -0,0 +1,31 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm-print + File: main.c + + Copyright 2007 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 + + +void TwlSpMain( void ) +{ + OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick())); + + OS_InitFIRM(); + + OS_TPrintf( "\nARM7 starts.\n" ); + OS_TPrintf( "\nARM7 ends.\n" ); + + OS_Terminate(); +} + diff --git a/build/norfirm/norfirm-print/ARM9/Makefile b/build/norfirm/norfirm-print/ARM9/Makefile new file mode 100644 index 00000000..6f5d8a9f --- /dev/null +++ b/build/norfirm/norfirm-print/ARM9/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - norfirm-print +# File: Makefile +# +# Copyright 2007 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:$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +LINCLUDES = ../include + +#---------------------------------------------------------------------------- + +TARGET_BIN = twl_norfirm9_print.srl + +SRCS = main.c + +CRT0_O = crt0_firm.o + +MAKEROM_ARM7 = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/twl_norfirm7_print.tef +MAKEROM_ARM7_BASE = $(basename $(MAKEROM_ARM7)) + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/norfirm-print/ARM9/main.c b/build/norfirm/norfirm-print/ARM9/main.c new file mode 100644 index 00000000..08f1fdb1 --- /dev/null +++ b/build/norfirm/norfirm-print/ARM9/main.c @@ -0,0 +1,31 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm-print + File: main.c + + Copyright 2007 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 + + +void TwlMain( void ) +{ + OS_TPrintf( "\nNOR Boot time is %d msec.\n", OS_TicksToMilliSecondsBROM32(OS_GetTick())); + + OS_InitFIRM(); + + OS_TPrintf( "\nARM9 starts.\n" ); + OS_TPrintf( "\nARM9 ends.\n" ); + + OS_Terminate(); +} + diff --git a/build/norfirm/norfirm-print/Makefile b/build/norfirm/norfirm-print/Makefile new file mode 100644 index 00000000..0c895204 --- /dev/null +++ b/build/norfirm/norfirm-print/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - norfirm - norfirm-print +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + wram_regs \ + ARM7 \ + ARM9 \ + +TARGET_FIRM_BIN = norfirm_print-$(TWL_BUILD_TYPE)$(CODEGEN_ARCH).nor +BINDIR = . +MAKEFIRM_ARM9 = ARM9/bin/$(TWL_BUILDTYPE_ARM9)/twl_norfirm9_print.tef +MAKEFIRM_ARM7 = ARM7/bin/$(TWL_BUILDTYPE_ARM7)/twl_norfirm7_print.tef +MAKEFIRM_RSA_PRVKEY = $(TWL_KEYSDIR)/rsa/private_nor.der +LDEPENDS_BIN += wram_regs/wram_regs.rbin + +#MAKEFIRM_FLAGS += -p +FIRM_SPEC = norfirm-BB.norsf + +LDIRT_CLEAN += $(wildcard *.nor) \ + rsa_public.sbin \ + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build: $(TARGET_BIN) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/norfirm-print/norfirm-BB.norsf b/build/norfirm/norfirm-print/norfirm-BB.norsf new file mode 100644 index 00000000..24108f0b --- /dev/null +++ b/build/norfirm/norfirm-print/norfirm-BB.norsf @@ -0,0 +1,25 @@ +#NORSF --- Norfirm Spec File + +VERSION : GENERATE + +BOOT_NAND : TRUE # TRUE or FALSE + +RSA_KEY : $(MAKEFIRM_RSA_PRVKEY) +OUT_KEY : rsa_public.sbin + +WRAM_RBIN: ./wram_regs/wram_regs.rbin + +DECOMP_PROC : ARM9 # ARM9 or ARM7 + +ARM9_COMP : TRUE # TRUE or FALSE, should be before ARM9_SBIN +ARM9_SBIN : $(MAKEFIRM_ARM9).TWL.FLX.sbin +ARM9_ELF : $(MAKEFIRM_ARM9).tef + +ARM7_COMP : TRUE # TRUE or FALSE, should be before ARM7_SBIN +ARM7_SBIN : $(MAKEFIRM_ARM7).TWL.FLX.sbin +ARM7_ELF : $(MAKEFIRM_ARM7).tef + +NCD_ROMOFS : 0x01fe00 + +BAUDRATE : 8M # 4M or 8M +ARM9_X2 : TRUE # TRUE or FALSE diff --git a/build/norfirm/norfirm-print/wram_regs/Makefile b/build/norfirm/norfirm-print/wram_regs/Makefile new file mode 100644 index 00000000..04fed484 --- /dev/null +++ b/build/norfirm/norfirm-print/wram_regs/Makefile @@ -0,0 +1,57 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlFirm - tools - norfirm-print +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +override TARGET_FINALROM := TRUE +override TARGET_RELEASE := +override TARGET_DEBUG := + +SUBDIRS = + +LINCLUDES = ../include + + +#---------------------------------------------------------------------------- + +TARGET_BIN = wram_regs.rbin + +SRCS = \ + wram_regs.c \ + +#SRCDIR = # using default +#LCFILE = # using default + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +INSTALL_DIR = . +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/norfirm/norfirm-print/wram_regs/wram_regs.c b/build/norfirm/norfirm-print/wram_regs/wram_regs.c new file mode 100644 index 00000000..4d052220 --- /dev/null +++ b/build/norfirm/norfirm-print/wram_regs/wram_regs.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - tools - norfirm + File: wram_regs.c + + Copyright 2007 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 + +MIHeader_WramRegs wram_regs_init = +{ + // ARM9 + { + REG_MI_MBK_A0_FIELD( 1, MI_WRAM_A_OFFSET_0KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A1_FIELD( 1, MI_WRAM_A_OFFSET_64KB , MI_WRAM_ARM9 ), + REG_MI_MBK_A2_FIELD( 1, MI_WRAM_A_OFFSET_128KB, MI_WRAM_ARM9 ), + REG_MI_MBK_A3_FIELD( 1, MI_WRAM_A_OFFSET_192KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_B0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_B4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), +// REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + REG_MI_MBK_B7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM9 ), + }, + { + REG_MI_MBK_C0_FIELD( 1, MI_WRAM_BC_OFFSET_0KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C1_FIELD( 1, MI_WRAM_BC_OFFSET_32KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C2_FIELD( 1, MI_WRAM_BC_OFFSET_64KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C3_FIELD( 1, MI_WRAM_BC_OFFSET_96KB , MI_WRAM_ARM7 ), + REG_MI_MBK_C4_FIELD( 1, MI_WRAM_BC_OFFSET_128KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C5_FIELD( 1, MI_WRAM_BC_OFFSET_160KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C6_FIELD( 1, MI_WRAM_BC_OFFSET_192KB, MI_WRAM_ARM7 ), + REG_MI_MBK_C7_FIELD( 1, MI_WRAM_BC_OFFSET_224KB, MI_WRAM_ARM7 ), + }, + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, HW_WRAM_AREA_HALF ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ) + ), +/* + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), +*/ + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_A_SIZE ), // joint to WRAM-A + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, MI_WRAM_MAP_NULL ) + ), + + // ARM7 + REG_MI_MBK6_FIELD( REG_WRAM_MAP_CONV_ADDR( 6, A, EADDR, MI_WRAM_MAP_NULL ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 6, A, SADDR, MI_WRAM_MAP_NULL ) + ), + REG_MI_MBK7_FIELD( REG_WRAM_MAP_CONV_ADDR( 7, B, EADDR, HW_WRAM_AREA + HW_WRAM_B_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 7, B, SADDR, HW_WRAM_AREA ) + ), + REG_MI_MBK8_FIELD( REG_WRAM_MAP_CONV_ADDR( 8, C, EADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE ), + MI_WRAM_IMAGE_256KB, + REG_WRAM_MAP_CONV_ADDR( 8, C, SADDR, HW_WRAM_AREA_HALF - HW_WRAM_SIZE - HW_WRAM_C_SIZE ) + ), + + // WRAM Lock + { + 0, + 0, + 0, + }, + + // WRAM-0/1 + 3, + + // VRAM-C + 7, + // VRAM-D + 7, +}; + diff --git a/build/systemMenu_RED/DSHashTable/DSHashTable.bin b/build/systemMenu_RED/DSHashTable/DSHashTable.bin new file mode 100644 index 00000000..19e3829e Binary files /dev/null and b/build/systemMenu_RED/DSHashTable/DSHashTable.bin differ diff --git a/build/systemMenu_RED/DSHashTable/DSHashTableAdHoc.bin b/build/systemMenu_RED/DSHashTable/DSHashTableAdHoc.bin new file mode 100644 index 00000000..00d501fd Binary files /dev/null and b/build/systemMenu_RED/DSHashTable/DSHashTableAdHoc.bin differ diff --git a/build/systemMenu_RED/DSHashTable/DSHashTableEx.bin b/build/systemMenu_RED/DSHashTable/DSHashTableEx.bin new file mode 100644 index 00000000..db71aaa2 Binary files /dev/null and b/build/systemMenu_RED/DSHashTable/DSHashTableEx.bin differ diff --git a/build/systemMenu_RED/DSHashTable/Makefile b/build/systemMenu_RED/DSHashTable/Makefile new file mode 100644 index 00000000..514822b9 --- /dev/null +++ b/build/systemMenu_RED/DSHashTable/Makefile @@ -0,0 +1,69 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +override TARGET_PLATFORM := TWL +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.DSHashTable + +MY_DATA = $(DS_HASH_TABLE_DATA) +MY_DATA_EX = $(DS_HASH_TABLE_EX_DATA) +MY_DATA_ADHOC = $(DS_HASH_TABLE_ADHOC_DATA) +MY_APPEND = revision.bin +MY_DATA2 = data.bin + +MY_TITLE = $(DS_HASH_TABLE_TITLE) + +#---------------------------------------------------------------------------- +MY_TAD = $(MY_TITLE)-$(DS_HASH_TABLE_VERSION)-$(DS_HASH_TABLE_EX_VERSION).tad + +#INSTALL_TARGETS = $(MY_TAD) +#INSTALL_DIR = + +LDIRT_CLEAN = $(MY_TAD) $(MY_APPEND) $(MY_DATA2) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(MY_TAD) + +$(MY_TAD): $(MY_DATA2) + $(MAKETAD) $(call empath,$<) $(DS_HASH_TABLE_MAKETAD_OPTION) -o $@ + +$(MY_DATA2): $(MY_DATA) $(MY_DATA_EX) $(MY_DATA_ADHOC) $(MY_APPEND) + cat $(MY_DATA) $(MY_DATA_EX) $(MY_DATA_ADHOC) $(MY_APPEND) > $@ + +$(MY_APPEND):: + @if test -e $(SYSMENU_ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(SYSMENU_ROOT)) | grep 'Revision' | sed s/[^0-9]//g > $(MY_APPEND); \ + else \ + date > $(MY_APPEND); \ + fi + @if test -e $(ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(ROOT)) | grep 'Revision' | sed s/[^0-9]//g >> $(MY_APPEND); \ + else \ + echo "" >> $(MY_APPEND); \ + fi + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/DSHashTable/commondefs.DSHashTable b/build/systemMenu_RED/DSHashTable/commondefs.DSHashTable new file mode 100644 index 00000000..8cbc866f --- /dev/null +++ b/build/systemMenu_RED/DSHashTable/commondefs.DSHashTable @@ -0,0 +1,43 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +DS_HASH_TABLE_TITLE_NAME := DSHashTable +DS_HASH_TABLE_EX_TITLE_NAME := DSHashTableEx +DS_HASH_TABLE_ADHOC_TITLE_NAME:= DSHashTableAdHoc +DS_HASH_TABLE_DATA_DIR := $(SYSMENU_ROOT)/build/systemMenu_RED/DSHashTable +DS_HASH_TABLE_DATA := $(DS_HASH_TABLE_DATA_DIR)/$(DS_HASH_TABLE_TITLE_NAME).bin +DS_HASH_TABLE_EX_DATA := $(DS_HASH_TABLE_DATA_DIR)/$(DS_HASH_TABLE_EX_TITLE_NAME).bin +DS_HASH_TABLE_ADHOC_DATA := $(DS_HASH_TABLE_DATA_DIR)/$(DS_HASH_TABLE_ADHOC_TITLE_NAME).bin +DS_HASH_TABLE_TITLE := HNHA +DS_HASH_TABLE_TITLE_ID_HI := 0003000F +DS_HASH_TABLE_TITLE_ID_LO := $(shell perl -e 'printf "%02X%02X%02X%02X", unpack("C4", "'$(DS_HASH_TABLE_TITLE)'")') +DS_HASH_TABLE_TITLE_ID := $(DS_HASH_TABLE_TITLE_ID_HI)$(DS_HASH_TABLE_TITLE_ID_LO) + +DS_HASH_TABLE_GROUP_ID := 3031 + +DS_HASH_TABLE_VERSION := $(shell perl -e 'open IN, "$(DS_HASH_TABLE_DATA)"; binmode IN; seek IN, 132, 0; read IN, $$buf, 2; print unpack "S", $$buf; close IN') +DS_HASH_TABLE_EX_VERSION := $(shell perl -e 'open IN, "$(DS_HASH_TABLE_EX_DATA)"; binmode IN; seek IN, 132, 0; read IN, $$buf, 2; print unpack "S", $$buf; close IN') + +#DS_HASH_TABLE_MAJOR_VERSION := $(shell expr $(DS_HASH_TABLE_VERSION) / 256) +#DS_HASH_TABLE_MINOR_VERSION := $(shell expr $(DS_HASH_TABLE_VERSION) % 256) + +DS_HASH_TABLE_MAJOR_VERSION := 1 +DS_HASH_TABLE_MINOR_VERSION := 0 + +DS_HASH_TABLE_MAKETAD_OPTION := -s -d $(DS_HASH_TABLE_TITLE_ID) $(DS_HASH_TABLE_GROUP_ID) $(DS_HASH_TABLE_MAJOR_VERSION) $(DS_HASH_TABLE_TITLE_NAME) \ + -v $(DS_HASH_TABLE_MINOR_VERSION) -p diff --git a/build/systemMenu_RED/DS_DownloadPlay/ARM9/ARM9-TS.lsf b/build/systemMenu_RED/DS_DownloadPlay/ARM9/ARM9-TS.lsf new file mode 100644 index 00000000..1b0a503a --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/ARM9/ARM9-TS.lsf @@ -0,0 +1,70 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-BB.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x02800000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) +} + +Overlay bm_mainp +{ + After $(TARGET_NAME) + Object $(OBJDIR)/DS_Setting.o $(OBJDIR)/settingMenu.o $(OBJDIR)/rtcSet.o $(OBJDIR)/langSelect.o \ + $(OBJDIR)/tpCalib.o $(OBJDIR)/ownerInfo.o $(OBJDIR)/AgbLcdSel.o $(OBJDIR)/autoBoot.o \ + $(OBJDIR)/unicode.o $(OBJDIR)/misc.o \ + $(OBJDIR)/DS_DownloadPlay.o \ + $(OBJDIR)/DS_Chat.o +} + +Overlay ipl2_data +{ + After bm_mainp + Object ./font/f12han.o +} + + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After ipl2_data + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_RED/DS_DownloadPlay/ARM9/Makefile b/build/systemMenu_RED/DS_DownloadPlay/ARM9/Makefile new file mode 100644 index 00000000..8f151f07 --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/ARM9/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_BIN = dlplay.srl + +TITLEID_LO = HNDA + +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +SRCS = main.c mainFunc.c DS_DownloadPlay.c + +LINCLUDES = $(ROOT)/build/libraries/spi/arm9/include \ + $(ROOT)/build/libraries/mb/common/include \ + +LLIBRARY_DIRS = +LLIBRARIES = +LDEPENDS_NEF = + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.sys.exe + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/DS_DownloadPlay/ARM9/main.rsf b/build/systemMenu_RED/DS_DownloadPlay/ARM9/main.rsf new file mode 100644 index 00000000..3417e588 --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/ARM9/main.rsf @@ -0,0 +1,141 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.c b/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.c new file mode 100644 index 00000000..87d6276d --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.c @@ -0,0 +1,1618 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_DownloadPlay.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +// ※※※ mb_private.hのPRINT_DEBUGを"1"にしていると、ダウンロード後に正常にブートできなくなっているので、注意。 + +#include +#include // ここはとするのはOK? +#include +#include "mb_child.h" +#include "mb_private.h" + + +#include "misc.h" +#include "DS_Setting.h" +#include "DS_DownloadPlay.h" + +// define data------------------------------------------ +#define PARENT_VIEW_NUM 4 // 親機情報リストの一画面表示数 +#define PLIST_X 1 // 親機情報リストの表示X位置 +#define PLIST_Y 4 // 親機情報リストの表示Y位置 +#define MB_DMA_NO 2 // マルチブート用DMA番号 +#define PRG_NEXT_SEQ_QUE_NUM 4 // 次のプログラムシーケンスを格納するキューの数 +#define MY_GGID 0x00000000 // マルチブート用GGID +#define G_INTRO_X 1 // ゲーム内容説明表示X位置 +#define G_INTRO_Y 4 // ゲーム内容説明表示Y位置 +#define G_MEMBER_X 1 // 通信メンバー表示X位置 +#define G_MEMBER_Y 10 // 通信メンバー表示Y位置 +#define MSG_VIEW_COUNT 75 // メッセージ表示Vカウント数 +#define MSG_BLINK_COUNT 12 // メッセージ点滅カウント数 + +#define NINLOGO_LOAD_1D_CHAR // Nintendoロゴデータを1Dマッピングキャラクタでロードする。 + + // プログラムシーケンス +typedef enum PrgSeq { + PSEQ_READY = 0, + PSEQ_INIT, + PSEQ_INITIALIZING, + PSEQ_ENDING, + PSEQ_END, + PSEQ_CANCELLED, + PSEQ_DISCONNECTED_BY_PARENT, + PSEQ_SCANNING, + PSEQ_CONNECTING, + PSEQ_CONNECT_SUCCEEDED, + PSEQ_CONNECT_FAILED, + PSEQ_REQ_REFUSED, + PSEQ_MEMBER_FULL, + PSEQ_DOWNLOAD_READY, + PSEQ_DOWNLOADING, + PSEQ_DOWNLOAD_COMPLETED, + PSEQ_DOWNLOAD_FAILED, + PSEQ_BOOT_REQ_WAIT, + PSEQ_BOOT_READY, + PSEQ_BOOT_START, + PSEQ_BOOT_FAILED +}PrgSeq; + +static char *str_prgSeq[] = { + "PSEQ_READY", + "PSEQ_INIT", + "PSEQ_INITIALIZING", + "PSEQ_ENDING", + "PSEQ_END", + "PSEQ_CANCELLED", + "PSEQ_DISCONNECTED_BY_PARENT", + "PSEQ_SCANNING", + "PSEQ_CONNECTING", + "PSEQ_CONNECT_SUCCEEDED", + "PSEQ_CONNECT_FAILED", + "PSEQ_REQ_REFUSED", + "PSEQ_MEMBER_FULL", + "PSEQ_DOWNLOAD_READY", + "PSEQ_DOWNLOADING", + "PSEQ_DOWNLOAD_COMPLETED", + "PSEQ_DOWNLOAD_FAILED", + "PSEQ_BOOT_REQ_WAIT", + "PSEQ_BOOT_READY", + "PSEQ_BOOT_START", + "PSEQ_BOOT_FAILED", +}; + + + // 親機情報発見時間データ +typedef struct FindTime { + BOOL find; // 発見したかどうか + int vcount; // 発見時間 +}FindTime; + + // メッセージ表示ステータス +typedef struct MsgViewStatus { + u16 handle; + u16 vcount; + u16 flag; + u16 color; + const u8 *str; + int (*nextProcessp)(void); +}MsgViewStatus; + + // 次プログラムシーケンスを格納用キュー +typedef struct PrgNextSeqQue { + BOOL lock; + u8 pad; + u8 num; + u8 top; + u8 bottom; + PrgSeq seq[ PRG_NEXT_SEQ_QUE_NUM ]; +}PrgNextSeqQue; + + +// extern data------------------------------------------ +extern void MBw_SetMaxScanTime( u16 time ); +extern int MBw_GetScanChannel( void ); +extern void UnCompNintendoLogo( u16 *NintendoLogoDatap, u16 *dstp, u32 *temp ); + +// function's prototype declaration--------------------- + // メインシーケンス +static void SEQ_DSDL_init( void ); +static int SEQ_DSDL_Connect( void ); +static int SEQ_DSDL_Download( void ); +static BOOL CheckNextSeq_Connect( void ); +static BOOL CheckNextSeq_Download( void ); + // 無線コールバック +static void CallbackChild_MB( u32 status, void *arg ); // マルチブート用コールバック関数 + // 表示系 +static void DispTopScreen( void ); +static void DispScanStatus( void ); +static void DispParentNum( void ); +static void DispParentList( void ); +static void DispGameIntroduction( void ); +static void DispPlayMember( void ); +static void DispParentGameInfo( u32 view_no, u32 listNo, BOOL drawFixedDataFlag ); +static void ClearDispParentGameInfo( u32 view_no, u32 listNo ); +static void DispGameIntroduction_Core( u32 listNo ); +static void DispPlayMember_Core( u32 listNo ); +static void ClearDispGameIntroduction( void ); +static void ClearDispPlayMember( void ); +static void DecimalToString( u8 *dstp, const void *valuep, u8 drawLength, u8 size ); +static void InitParentFindTime( void ); +static void CountParentFindTime( void ); +static BOOL CheckParentFindTime( u32 index ); +static void CountAndDispTotalTime( void ); +static void SetIconOBJ( u32 index ); +static void ClearIconOBJ( u32 index ); +static void SetDispMessage( u16 color, const u8 *str ); +static BOOL DispMessage( void ); +static void SetBlinkMessage( u16 color, const u8 *str ); +static void DispBlinkMessage( void ); + // Nintendoロゴ表示 +static void InitDispNintendoLogo( void ); +static BOOL DispNintendoLogo( void ); + // その他 +static void SetMyUserInfo( MBUserInfo *my ); +static BOOL IsScanLock( void ); + // 割り込み +static void VBlankIntr_WDL( void ); + // シーケンスキュー処理 +static void InitPrgNextSeqQue( void ); +static BOOL SetPrgNextSeqQue( PrgSeq seq ); +static BOOL GetPrgNextSeqQue( PrgSeq *seqp ); +static void LockPrgNextSeqQue( void ); +static void UnlockPrgNextSeqQue( void ); +static BOOL IsEmptyPrgNextSeqQue( void ); + +void SearchPatchAddress( void ); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static int (*wdProcess)( void ); // 現在実行中のプロセスへのポインタ +static int csrC; // メニューのカーソル位置 +static int csrC_old; // メニューの前カーソル位置 +static PrgSeq prgSeq; // プログラムシーケンス +static PrgNextSeqQue nextSeq; // 次のプログラムシーケンスを格納するキュー +static BOOL end_flag; // 終了フラグ +static MsgViewStatus msgStat; // メッセージ表示ステータス +static MBUserInfo myUser; // 自分のユーザー情報 +static u16 tgid = 0; +static u16 tp_touch_count = 0; +static u32 gameInfoLostCount = 0; +// 親機リストの表示に使用 +static int unrenewalFlag; +static int total_vcount; +static int time_ms; // 親機発見時間ms +static int time_sec; // 親機発見時間sec +static u16 msgHandle; // メッセージ表示ハンドル +static u16 dispGameInfoFlag; // 既に表示したゲーム情報をビットで示す。 +static u16 dispIntroFlag; // ゲームの詳細データ描画フラグ +static u16 dispMemberFlag; // ゲームの詳細データ描画フラグ +static u16 gameName[ MB_GAME_NAME_LENGTH + 1 ]; // 親機ゲームネーム +static u16 userName[ MB_USER_NAME_LENGTH + 1 ]; // 親機ユーザーネーム +static u16 gameIntroduction[2][ MB_GAME_INTRO_LENGTH / 2 + 1 ]; + // 親機ゲーム内容説明 +static u16 playMember[ MB_MEMBER_MAX_NUM ][ MB_USER_NAME_LENGTH + 1]; + // 通信メンバー名リスト +static u8 parentListNo[ PARENT_VIEW_NUM ][ 4 ] ATTRIBUTE_ALIGN(2); + // 親機リスト番号 +static u32 objVramBuff[ (MB_ICON_DATA_SIZE * PARENT_VIEW_NUM + 0x20) / sizeof(u32) ] ATTRIBUTE_ALIGN(32); +static FindTime findTime[ MB_GAME_INFO_RECV_LIST_NUM ]; // 親機発見時間データ +static GXOamAttr oamBakM[ 128 ] ATTRIBUTE_ALIGN(32); // OAM バックアップ + +static const MbBeaconRecvStatus *mbrsp; + +// MBライブラリ用ワーク +static u32 mbwork[ MB_CHILD_SYSTEM_BUF_SIZE / sizeof(u32) ]; + +// Nintendoロゴ表示 +static int loop_count; +static u32 ninLogoBuff[ 0x700 / sizeof(u32) ]; + +static MBDownloadFileInfo dlfileinfo; +static u8 output_buffer[ AUTH_BUFFER_LEN ]; + +// const data ----------------------------------------- + // 表示用文字列 +static const u8 str_sura[] ATTRIBUTE_ALIGN(2) = "/"; +static const u8 str_period[] ATTRIBUTE_ALIGN(2) = "."; +static const u8 str_sec[] ATTRIBUTE_ALIGN(2) = "sec"; +static const u8 str_disconnected[] ATTRIBUTE_ALIGN(2) = "disconnected by parent."; +static const u8 str_connect_succeeded[] ATTRIBUTE_ALIGN(2) = "connect succeeded."; +static const u8 str_connect_failed[] ATTRIBUTE_ALIGN(2) = "connect failed."; +static const u8 str_req_refused[] ATTRIBUTE_ALIGN(2) = "req refused."; +static const u8 str_member_full[] ATTRIBUTE_ALIGN(2) = "member full."; +static const u8 str_downloading[] ATTRIBUTE_ALIGN(2) = "DOWNLOADING...."; +static const u8 str_download_completed[] ATTRIBUTE_ALIGN(2) = "download completed."; +static const u8 str_download_cancelled[] ATTRIBUTE_ALIGN(2) = "download cancelled."; + + // メニュー関数用 親機リストuカ字列リスト +static u8 *str_parentListNo[] ATTRIBUTE_ALIGN(2) = { + parentListNo[0], + parentListNo[1], + parentListNo[2], + parentListNo[3], +}; + + // メニュー関数用 メニュー構成データ +static const MenuComponent childModeSel = { + PARENT_VIEW_NUM, // 項目数 + PLIST_X, // X位置(キャラ数) + PLIST_Y, // Y位置( 〃  ) + 0, // 次の項目へのX位置キャラ数 + 4, // 次の項目へのY位置キャラ数 + 3, + WHITE, // 非選択色 + HIGHLIGHT_Y, // 選択色 + (const u8 **)&str_parentListNo, // メニュー項目文字列リスト +}; + + +//====================================================== +// メインループ +//====================================================== + +// 無線マルチブートのメインループ +int DS_DownloadPlayMain(void) +{ + SEQ_DSDL_init(); + + wdProcess = SEQ_DSDL_Connect; + + OS_TPrintf("MbBeaconRecvStatus:%d\n", sizeof(MbBeaconRecvStatus) ); + + while(1) { + OS_WaitIrq(1, OS_IE_V_BLANK); + ReadKeyPad(); + mf_KEYPAD_rapid(); + + mbrsp = MB_GetBeaconRecvStatus(); + + if( wdProcess != NULL ) { + if(wdProcess()) { + return 0; + } + } + + //// ここから //// + { + static int touch = 0; + TPData tmp1 ATTRIBUTE_ALIGN(32); + TPData tmp2 ATTRIBUTE_ALIGN(32); + + while (TP_RequestRawSampling(&tmp1) != 0) {} + TP_GetCalibratedPoint(&tmp2, &tmp1); + + if (tmp2.touch != touch) + { + tp_touch_count++; + (void)DrawDecimalSJIS( 16, 0, RED, &tp_touch_count, 4, 2 ); + OS_Printf("touch change %d validity = %d\n", tmp2.touch, tmp2.validity); + touch = tmp2.touch; + } + } + //// ここまで //// + +// if (SYSM_IsCardPulledOut()) { // カード抜け検出 + if ( 0 ) { + OS_Printf("Card is pulled out.\n"); +#ifdef __DEBUG + OS_Terminate(); +#endif + } + + if (PAD_DetectFold() == TRUE) { // スリープモードへの遷移 +// SYSM_GoSleepMode(); + } + + OS_PrintServer(); // ARM7からのプリントデバッグを処理する + } + return 0; +} + + +//====================================================== +// 無線マルチブート(初期化) +//====================================================== + +// 無線マルチブートの初期化 +static void SEQ_DSDL_init(void) +{ + GXS_SetVisiblePlane( GX_PLANEMASK_NONE ); + GX_SetVisiblePlane ( GX_PLANEMASK_NONE ); + + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr_WDL); + GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + + // NITROカードのROM内登録データのクリア + MI_CpuClearFast( (void *)HW_ROM_HEADER_BUF, 0x160 ); + + // サブスクリーンのクリア + MI_CpuClearFast( bgBakS, sizeof(bgBakS) ); + MI_CpuFillFast ( (void *)HW_OAM, 192 , HW_OAM_SIZE ); + MI_CpuFillFast ( (void *)oamBakS, 192 , sizeof(oamBakS) ); // 192でフィルしないと、未使用OBJが(0, 0)にキャラNo.0で全部表示されてしまう。 + + // メインスクリーンのクリア + MI_CpuClearFast( (void *)HW_BG_VRAM, 0x10000 ); + MI_CpuClearFast( (void *)HW_OBJ_VRAM, 0x8000 ); + MI_CpuClearFast( bgBakM, sizeof(bgBakM) ); + MI_CpuFillFast ( (void *)oamBakM, 192 , sizeof(oamBakM) ); // 192でフィルしないと、未使用OBJが(0, 0)にキャラNo.0で全部表示されてしまう。 + MI_CpuFillFast ( (void *)HW_OAM, 192 , HW_OAM_SIZE ); + MI_CpuCopyFast ( myPlttData, (void *)HW_BG_PLTT, sizeof(myPlttData) ); // BGパレット セット + + ClearAllStringSJIS(); + + (void)DrawStringSJIS ( 1, 0, WHITE, (const u8 *)"NICKNAME="); + (void)DrawStringSJIS ( 1, 2, LIGHTGREEN, (const u8 *)"PARENT NUM ="); +// (void)DrawStringSJIS ( 1, 22, LIGHTGREEN, (const u8 *)"GINFO LOST COUNT ="); + (void)DrawStringSJISEx( 26, 2, CYAN, str_period, PARENT_VIEW_NUM); + (void)DrawStringSJISEx( 29, 2, CYAN, str_sec, PARENT_VIEW_NUM); + + InitPrgNextSeqQue(); + unrenewalFlag = 0; + end_flag = FALSE; + prgSeq = PSEQ_INIT; + msgHandle = 0x8000; + dispGameInfoFlag = 0; + dispIntroFlag = 0; + dispMemberFlag = 0; + csrC_old = 2; // 最初はわざと違う値にしておく + csrC = 0; + { + int i; + for( i = 0; i < PARENT_VIEW_NUM; i++ ) { + parentListNo[i][2] = '.'; + parentListNo[i][3] = 0x00; + } + } + SetMyUserInfo( &myUser ); // MBUserInfoをNITRO設定データから読み出してセット + { + // ニックネーム表示 + u16 nickname[ MB_USER_NAME_LENGTH + 1 ]; + ExUTF16_LEtoSJIS_BE( (u8 *)nickname, (u16 *)myUser.name, myUser.nameLength ); + nickname[ myUser.nameLength ] = 0; + (void)DrawStringSJIS( 8, 0, WHITE, (const u8 *)nickname ); + } + + InitParentFindTime(); // 親機発見時間変数のクリア + + while( (SYSM_GetBootFlag() & BFLG_WM_INITIALIZED) == 0 ) {} + + LOADER_Init( NULL ); + + GXS_SetVisiblePlane( GX_PLANEMASK_OBJ | GX_PLANEMASK_BG1 ); + GX_SetVisiblePlane ( GX_PLANEMASK_OBJ | GX_PLANEMASK_BG1 ); +} + + +// TOPスクリーンへの表示 +static void DispTopScreen( void ) +{ + SetTargetScreenSJIS( TOP_SCREEN ); + ClearAllStringSJIS(); + (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"WIRELESS DOWNLOAD"); + (void)DrawStringSJIS( G_INTRO_X, G_INTRO_Y, LIGHTGREEN, (const u8 *)"GAME INTRODUCTION"); + (void)DrawStringSJIS( G_MEMBER_X, G_MEMBER_Y, LIGHTGREEN, (const u8 *)"MEMBER LIST"); + SetTargetScreenSJIS( BOTTOM_SCREEN ); +} + + +//====================================================== +// 無線マルチブート(親機サーチ 〜 接続) +//====================================================== + +// 無線マルチブートの接続シーケンス +static int SEQ_DSDL_Connect(void) +{ + // 現在のprgSeqに応じた処理 + BOOL getSeqFlag = CheckNextSeq_Connect(); + + switch ( prgSeq ) { + case PSEQ_INIT: // 子機モードの開始(ライブラリの初期化〜StartScanまでの流れを実行) + if ( MB_Init( mbwork, &myUser, MY_GGID, tgid, MB_DMA_NO ) != WM_ERRCODE_SUCCESS ) { + OS_Printf("MB init failed.\n"); + break; + } + MB_CommSetChildStateCallback( CallbackChild_MB ); + if ( MB_StartChild() != WM_ERRCODE_SUCCESS ) { + OS_Printf("MB start failed.\n"); + break; + } + tgid++; + DispTopScreen(); + prgSeq = PSEQ_INITIALIZING; + break; + + case PSEQ_INITIALIZING: + break; + + case PSEQ_SCANNING: // スキャン中は随時、次シーケンスチェックを行う。 + case PSEQ_ENDING: + if( !getSeqFlag ) { + return 0; + } + break; + + case PSEQ_CONNECTING: // 接続中はキー入力を受け付けずにリターンする。(次シーケンスチェックは行う) + return 0; + + case PSEQ_CONNECT_SUCCEEDED: // メッセージ表示後、ダウンロードシーケンスに移行。 + if( DispMessage() ) { + UnlockPrgNextSeqQue(); // シーケンスロック解除 + wdProcess = SEQ_DSDL_Download; + } + return 0; + + case PSEQ_CONNECT_FAILED: // メッセージ表示後、スキャン再開。(スキャン再開そのものは、ライブラリが自動で行う。) + if( DispMessage() ) { + UnlockPrgNextSeqQue(); // シーケンスロック解除 + prgSeq = PSEQ_SCANNING; + } + break; + + case PSEQ_DISCONNECTED_BY_PARENT: // 切断検出メッセージ表示設定。 + if( DispMessage() ) { + UnlockPrgNextSeqQue(); // シーケンスロック解除 + prgSeq = PSEQ_INIT; + } + break; + + case PSEQ_CANCELLED: // 終了 + return 0; + + default: + break; + } + + + // カーソル移動 + if(pad.trg & PAD_KEY_DOWN){ // カーソルの移動 + if( ++csrC == MB_GAME_INFO_RECV_LIST_NUM ){ + csrC = 0; + } + } + if(pad.trg & PAD_KEY_UP){ + if( --csrC & 0x80 ){ + csrC = MB_GAME_INFO_RECV_LIST_NUM - 1; + } + } + DrawMenu((u16)(csrC & (PARENT_VIEW_NUM - 1)), &childModeSel); // リスト番号(カーソル)の表示 + DispParentNum(); // 発見親機数の表示 + DispParentList(); // 親機リストの表示 + DispScanStatus(); // WMスキャン状態の表示 + CountAndDispTotalTime(); // トータル時間のカウント&表示 + CountParentFindTime(); // 親機発見時間のカウント + + + // 親機への接続 + if(pad.trg & PAD_BUTTON_A) { + if( mbrsp->usefulGameInfoFlag & (0x0001 << csrC) ) { + if( MB_CommDownloadRequest( csrC ) == WM_ERRCODE_SUCCESS ) { // 接続開始 + OS_Printf("start conntct to parent.\n"); + prgSeq = PSEQ_CONNECTING; + }else { + OS_Printf("this parent info is invalid.\n"); + } + } + }else if(pad.trg & PAD_BUTTON_B) { // 終了開始 + if( prgSeq == PSEQ_SCANNING ) { + OS_Printf("MB End start\n"); + prgSeq = PSEQ_ENDING; +// end_flag = TRUE; + MB_End(); + } + }else if( pad.trg & PAD_BUTTON_R ) { + unrenewalFlag ^= 0x01; +// MB_SetUnrenewalGameInfoFlag( (BOOL)unrenewalFlag ); + } + + csrC_old = csrC; // 旧カーソル位置の退避 + return 0; +} + + +// 次シーケンスのチェック(コールバックでメインループとは非同期に返される次シーケンスへの移行をメインループのプログラム進行に合わせる。) +static BOOL CheckNextSeq_Connect(void) +{ + PrgSeq seq; + // MBコールバックによって、シーケンスが移行していた場合の処理 + if( GetPrgNextSeqQue( &seq) ) { // MBコールバックによって、シーケンスが移行していた場合の処理 + prgSeq = seq; + OS_Printf("prgSeq = %s\n", str_prgSeq[ prgSeq ]); + + switch( seq ) { + case PSEQ_SCANNING: + { +/* + u8 *ver = MBw_GetWLVersion(); + (void)DrawStringSJIS( 21, 0, WHITE, (const u8 *)"WL ver=" ); + (void)DrawStringSJIS( 26, 0, WHITE, (const u8 *)ver ); +*/ + } + break; + + case PSEQ_CONNECT_SUCCEEDED: // 接続成功メッセージ表示設定。 + SetDispMessage( YELLOW, str_connect_succeeded ); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + case PSEQ_CONNECT_FAILED: // 接続失敗メッセージ表示設定。 + SetDispMessage( RED, str_connect_failed); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + case PSEQ_DISCONNECTED_BY_PARENT: // 切断検出メッセージ表示設定。 + SetDispMessage( RED, str_disconnected); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + case PSEQ_CANCELLED: // 終了 + { + u32 i; + for( i = 0; i < PARENT_VIEW_NUM; i++ ) { + ClearIconOBJ( i ); // 全アイコンの消去 + } +// if( end_flag ) { +// ClearAllStringSJIS(); +// SetTargetScreenSJIS( TOP_SCREEN ); +// ClearAllStringSJIS(); +// SetTargetScreenSJIS( BOTTOM_SCREEN ); +// (void)DrawStringSJIS( 11, 11, WHITE, (const u8 *)"しゅうりょうしました。"); +// }else { + prgSeq = PSEQ_INIT; +// } + } + return FALSE; + } + } + return TRUE; // シーケンス移行がなかった場合もしくはFALSEリターンのシーケンスでなかった場合はTRUEリターン。 +} + + +//====================================================== +// 無線マルチブート(ダウンロード) +//====================================================== + +// 無線マルチブートのファイルダウンロードシーケンス +static int SEQ_DSDL_Download(void) +{ + static int count_old = 0; + // 現在のprgSeqに応じた処理 + BOOL getSeqFlag = CheckNextSeq_Download(); + + switch(prgSeq) { + + case PSEQ_REQ_REFUSED: + case PSEQ_MEMBER_FULL: // メッセージ表示後、一旦終了して初期化からやり直し。 + if( DispMessage() ) { + UnlockPrgNextSeqQue(); // シーケンスロック解除 + prgSeq = PSEQ_ENDING; + wdProcess = SEQ_DSDL_Connect; + MB_End(); + } + break; + + // ダウンロードファイル情報を受信し、ダウンロード準備ができた状態 + case PSEQ_DOWNLOAD_READY: +// if (pad.trg & PAD_BUTTON_A) { // ダウンロード開始 + OS_Printf("Start download.\n"); + ClearStringSJIS_handle(msgHandle); + (void)MB_CommStartDownload(); + SetBlinkMessage( YELLOW, str_downloading ); +// } + break; + + // ダウンロード中 + case PSEQ_DOWNLOADING: + if( getSeqFlag ) { + DispBlinkMessage(); + msgHandle = msgStat.handle; + + if( 1 ) { + u16 percent = MB_GetChildProgressPercentage(); + msgHandle = DrawDecimalSJIS( 16, 21, WHITE, &percent ,3, 2 ); + } + } + break; + + // ダウンロード完了 + case PSEQ_DOWNLOAD_COMPLETED: + if( DispMessage() ) { + { + msgHandle = DrawStringSJIS( 4, 21, LIGHTGREEN, "Sign Digest...."); + if ( ACSignDigest ( output_buffer, &dlfileinfo ) ) { + ClearStringSJIS_handle( msgHandle ); + msgHandle = DrawStringSJIS( 4, 21, LIGHTGREEN, "Digest SUCCEEDED."); + }else { + ClearStringSJIS_handle( msgHandle ); + msgHandle = DrawStringSJIS( 4, 21, RED, "Digest FAILED."); + } + { + int i; + for ( i = 0; i < 120; i++ ) { + SVC_WaitVBlankIntr(); + } + } + ClearStringSJIS_handle( msgHandle ); + } + UnlockPrgNextSeqQue(); // シーケンスロック解除 + prgSeq = PSEQ_BOOT_REQ_WAIT; + msgHandle = DrawStringSJIS( 4, 21, WHITE, "Waiting BOOT-REQ from parent."); + } + break; + + // 親機からのブート許可待ち + case PSEQ_BOOT_REQ_WAIT: + break; + + // ダウンロードが完了し、ブート準備ができた状態 +// case PSEQ_BOOT_READY: +// (void)LOADER_Start(); // ここでARM7によって、ダウンロードプログラムの再配置を行う。 +// return 1; // "1"でリターンすることで、無線マルチブートのメインループから抜けてIPL2に処理を戻す。 + + // 親機からのブート要求受信により、起動可否チェックを行う。(Nintendoロゴ表示&チェック) + case PSEQ_BOOT_READY: + if( DispNintendoLogo() ) { + if( SYSM_CheckNinLogo( (u16 *)SYSM_GetCardRomHeader()->nintendo_logo ) ) { + prgSeq = PSEQ_BOOT_START; + }else { + SetDispMessage( RED, (const u8 *)"Illegal game data."); + prgSeq = PSEQ_BOOT_FAILED; + } + } + break; + + // ブート開始 + case PSEQ_BOOT_START: + ClearStringSJIS_handle(msgHandle); + + SearchPatchAddress(); + + (void)LOADER_Start(); // ここでARM7によって、ダウンロードプログラムの再配置を行う。 + return 1; // "1"でリターンすることで、無線マルチブートのメインループから抜けてIPL2に処理を戻す。 + + // ブート失敗 + // 親機によって、接続が切断された状態 + // キャンセルをした場合 + case PSEQ_BOOT_FAILED: + case PSEQ_DISCONNECTED_BY_PARENT: + case PSEQ_CANCELLED: + if( DispMessage() ) { // 指定メッセージを一定期間表示 + UnlockPrgNextSeqQue(); // シーケンスロック解除 + ClearStringSJIS_handle( msgHandle ); + prgSeq = PSEQ_INIT; + wdProcess = SEQ_DSDL_Connect; + } + break; + + default: + break; + } + + // Bボタンで終了処理を行う + if( pad.trg & PAD_BUTTON_B ) { + MB_End(); // キャンセル時は、親機サーチ状態からやり直す。 + } + + DrawMenu((u16)(csrC & (PARENT_VIEW_NUM - 1)), &childModeSel); // リスト番号(カーソル)の表示 + DispParentNum(); // 発見親機数の表示 + DispParentList(); // 親機リストの表示 + DispScanStatus(); // WMスキャン状態の表示 + CountAndDispTotalTime(); // トータル時間のカウント&表示 + CountParentFindTime(); // 親機発見時間のカウント + return 0; +} + + +// 次シーケンスのチェック(コールバックでメインループとは非同期に返される次シーケンスへの移行をメインループのプログラム進行に合わせる。) +static BOOL CheckNextSeq_Download(void) +{ + PrgSeq seq; + + // MBコールバックによって、シーケンスが移行していた場合の処理 + if( GetPrgNextSeqQue( &seq) ) { + prgSeq = seq; + OS_Printf("prgSeq = %s\n", str_prgSeq[ prgSeq ]); + + switch( seq ) { + + case PSEQ_REQ_REFUSED: // 接続拒否メッセージ表示設定 + SetDispMessage( RED, str_req_refused); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + case PSEQ_MEMBER_FULL: // メンバーFULLメッセージ表示設定。 + SetDispMessage( RED, str_member_full); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + case PSEQ_DOWNLOAD_READY: // ダウンロード準備完了 + ClearStringSJIS_handle( msgHandle ); + { + msgHandle = DrawStringSJIS( 4, 21, WHITE, "Sign Decript...."); + if ( ACSignDecrpto( output_buffer, &dlfileinfo ) ) { + ClearStringSJIS_handle( msgHandle ); + msgHandle = DrawStringSJIS( 4, 21, LIGHTGREEN, "Decript SUCCEEDED."); + }else { + ClearStringSJIS_handle( msgHandle ); + msgHandle = DrawStringSJIS( 4, 21, RED, "Decript FAILED."); + } + { + int i; + for ( i = 0; i < 120; i++ ) { + SVC_WaitVBlankIntr(); + } + } + ClearStringSJIS_handle( msgHandle ); + } + + msgHandle = DrawStringSJIS( 4, 21, WHITE, "PUSH [A] TO DOWNLOAD."); + break; + + case PSEQ_DOWNLOAD_COMPLETED: // ダウンロード完了 + ClearStringSJIS_handle( msgHandle ); + SetDispMessage( YELLOW, str_download_completed ); + LockPrgNextSeqQue(); // シーケンスロック + return FALSE; + +// case PSEQ_BOOT_READY: // ブート準備完了 +// ClearStringSJIS_handle( msgHandle ); +// break; + + case PSEQ_BOOT_READY: // ブート準備完了 + ClearStringSJIS_handle( msgHandle ); + InitDispNintendoLogo(); + break; + + case PSEQ_CANCELLED: + ClearStringSJIS_handle( msgHandle ); + SetDispMessage( RED, str_download_cancelled ); + LockPrgNextSeqQue(); // シーケンスロック + return FALSE; + + case PSEQ_DISCONNECTED_BY_PARENT: // 切断検出メッセージ表示設定。 + ClearStringSJIS_handle( msgHandle ); + SetDispMessage( RED, str_disconnected ); + LockPrgNextSeqQue(); // prgSeqをロックする。 + return FALSE; + + default: + break; + } + } + return TRUE; +} + + +//====================================================== +// コールバック +//====================================================== + +// 子機モードでのコールバック +static void CallbackChild_MB( u32 status, void *arg ) +{ + switch (status) + { + case MB_COMM_CSTATE_INIT_COMPLETE: // 初期化完了 + OS_Printf("CB: init completed.\n"); + (void)SetPrgNextSeqQue( PSEQ_SCANNING ); + break; + +// case MB_COMM_CSTATE_END_COMPLETE: // マルチブート終了 +// OS_Printf("CB: end completed.\n"); +// (void)SetPrgNextSeqQue( PSEQ_END ); +// break; + + case MB_COMM_CSTATE_REQ_REFUSED: // 親機からのエントリー拒否 + OS_Printf("CB: request refused.\n"); + (void)SetPrgNextSeqQue( PSEQ_REQ_REFUSED ); + break; + + case MB_COMM_CSTATE_MEMBER_FULL: // ゲームが定員に達した + OS_Printf("CB: member full.\n"); + (void)SetPrgNextSeqQue( PSEQ_MEMBER_FULL ); + break; + + case MB_COMM_CSTATE_CONNECT: // 親機への接続成功 + OS_Printf("CB: connected.\n"); + (void)SetPrgNextSeqQue( PSEQ_CONNECT_SUCCEEDED ); + break; + + case MB_COMM_CSTATE_CONNECT_FAILED: // 親機への接続失敗 + OS_Printf("CB: connect failed!\n"); + (void)SetPrgNextSeqQue( PSEQ_CONNECT_FAILED ); + break; + + case MB_COMM_CSTATE_DLINFO_ACCEPTED: // 親機からダウンロード情報を受信 + OS_Printf("CB: dlinfo accepted.\n"); + (void)SetPrgNextSeqQue( PSEQ_DOWNLOAD_READY ); + MI_CpuCopy16( (void *)arg, (void *)&dlfileinfo, sizeof( MBDownloadFileInfo ) ) ; + break; + + case MB_COMM_CSTATE_RECV_PROCEED: // 受信開始 + OS_Printf("CB: recv proceed.\n"); + (void)SetPrgNextSeqQue( PSEQ_DOWNLOADING ); + break; + + case MB_COMM_CSTATE_RECV_COMPLETE: // 受信成功 + OS_Printf("CB: recv completed.\n"); + (void)SetPrgNextSeqQue( PSEQ_DOWNLOAD_COMPLETED ); + break; + + case MB_COMM_CSTATE_BOOT_READY: // ブート準備完了 + OS_Printf("CB: boot ready.\n"); +// SYSMi_GetWork()->mb_flag = 1; +// SYSMi_GetWork()->mb_ggid = *(u32 *)( MB_GetBeaconRecvStatus()->list[ pCwork->connectTargetNo ].bssDesc.gameInfo.ggid ); +// SYSMi_GetWork()->mb_ggid = MB_GetBeaconRecvStatus()->list[ pCwork->connectTargetNo ].gameInfo.ggid; + (void)SetPrgNextSeqQue( PSEQ_BOOT_READY ); + break; + + case MB_COMM_CSTATE_CANCELLED: // ダウンロードキャンセル + OS_Printf("CB: download cancel.\n"); + (void)SetPrgNextSeqQue( PSEQ_CANCELLED ); + break; + + case MB_COMM_CSTATE_DISCONNECTED_BY_PARENT: // 親機からの切断通知 + OS_Printf("CB: disconnected by parent!\n"); + (void)SetPrgNextSeqQue( PSEQ_DISCONNECTED_BY_PARENT ); + break; + + case MB_COMM_CSTATE_GAMEINFO_LOST: + gameInfoLostCount++; + break; + } +} + + +//====================================================== +// 表示系サブルーチン +//====================================================== + +// スキャン状態の表示 +static void DispScanStatus(void) +{ +#if 0 + int channel = MBw_GetScanChannel(); + + (void)DrawHexSJIS( 13, 2, WHITE, &channel, 2); + if( IsScanLock() ) { // スキャンロック中なら、その時間を表示 + (void)DrawStringSJIS( 15, 2, RED, (const u8 *)"LOCK"); + (void)DrawHexSJIS ( 19, 2, WHITE, &mbrsp->nowLockTimeCount, 4); + }else { + (void)DrawStringSJIS( 15, 2, RED, (const u8 *)" "); + } +#endif +} + + +// 発見した親機数の表示 +static void DispParentNum(void) +{ + int i; + int num = 0; + + for (i = 0; i < MB_GAME_INFO_RECV_LIST_NUM; i++) { // 親機数のカウント + if( mbrsp->usefulGameInfoFlag & (0x0001 << i) ) num++; + } + (void)DrawDecimalSJIS( 10, 2, LIGHTGREEN, &num, 2, 4); +} + + +// 親機情報リストの表示 +static void DispParentList(void) +{ + u32 i; + u32 listNo = (u32)( csrC & ~(PARENT_VIEW_NUM - 1) ); // 現在表示中のリストの先頭を算出(~表示数でマスク) + u32 listNo_old = (u32)( csrC_old & ~(PARENT_VIEW_NUM - 1) ); // 前回表示したリストの先頭を算出 + +// (void)DrawDecimalSJISEx( 15, 22, WHITE, &gameInfoLostCount, 8, 4, 0); + + // ゲーム内容説明の表示 + DispGameIntroduction(); + + // 通信メンバーの表示 + DispPlayMember(); + + // 親機リストの表示 + for( i = 0; i < PARENT_VIEW_NUM; i++ ) { + if( (listNo != listNo_old) || !(mbrsp->usefulGameInfoFlag & (0x0001 << listNo)) ){ + if( dispGameInfoFlag & (0x0001 << listNo_old) ) { // 表示リスト位置が変更 or 該当親機が有効でなくなった場合、前回表示データが既に表示済みならクリアする。 + ClearDispParentGameInfo( i, listNo_old); + dispGameInfoFlag ^= 0x0001 << listNo_old; + } + } + + if( mbrsp->usefulGameInfoFlag & (0x0001 << listNo) ) { // 該当リストbフデータが有効で、かつ未表示なら表示する。 + DispParentGameInfo( i, listNo , !(dispGameInfoFlag & (0x0001 << listNo)) ); + dispGameInfoFlag |= 0x0001 << listNo; + } + if( csrC != csrC_old ) { + DecimalToString( parentListNo[i], &listNo, 2, 2); // ビュー画面の先頭リストナンバーからを文字列バッファに入れる。 + } + listNo++; + listNo_old++; + } +} + + +// ゲーム内容説明の表示 +static void DispGameIntroduction( void ) +{ + BOOL clear = FALSE; + + if( ( ( csrC != csrC_old ) && ( dispIntroFlag & (0x0001 << csrC_old) ) ) + || ( !(mbrsp->usefulGameInfoFlag & (0x0001 << csrC)) && ( dispIntroFlag & (0x0001 << csrC) ) ) ) { + ClearDispGameIntroduction(); // カーソルが動いて、前カーソル位置の詳細表示を行っていたか、 + dispIntroFlag = 0; + clear = TRUE; + } + + if( (mbrsp->usefulGameInfoFlag & (0x0001 << csrC)) && !( dispIntroFlag & (0x0001 << csrC) ) ) { + if ( !clear ){ // 現在カーソル位置のゲーム情報が有効で、まだ詳細表示を行っていなかったら表示。 + ClearDispGameIntroduction(); + } + DispGameIntroduction_Core( (u32)csrC ); + dispIntroFlag = (u16)( 0x0001 << csrC ); // カーソルが移動された時か、現在位置のゲーム情報が未表示の時にのみ表示 or クリアを行う。 + } +} + + +// 通信メンバーのクリア&表示 +static void DispPlayMember( void ) +{ + BOOL clear = FALSE; + + if( ( ( csrC != csrC_old ) && ( dispMemberFlag & (0x0001 << csrC_old) ) ) + || ( !(mbrsp->validGameInfoFlag & (0x0001 << csrC)) && ( dispMemberFlag & (0x0001 << csrC) ) ) ) { + ClearDispPlayMember(); // カーソル位置のゲーム詳細情報を表示していて、そのゲーム情報が無効になったらクリア。 + dispMemberFlag = 0; + clear = TRUE; + } + + if( (mbrsp->validGameInfoFlag & (0x0001 << csrC)) && !( dispMemberFlag & (0x0001 << csrC) ) ) { + if ( !clear ){ // 現在カーソル位置のゲーム情報が有効で、まだ詳細表示を行っていなかったら表示。 + ClearDispPlayMember(); + } + DispPlayMember_Core( (u32)csrC ); + dispMemberFlag = (u16)( 0x0001 << csrC ); // カーソルが移動された時か、現在位置のゲーム情報が未表示の時にのみ表示 or クリアを行う。 + } +} + + +// 指定された親機情報の表示 +static void DispParentGameInfo( u32 view_no, u32 listNo, BOOL drawFixedDataFlag) +{ + if(drawFixedDataFlag) { // 変化しない情報の表示 + + MI_CpuClear16( gameName, MB_GAME_NAME_LENGTH * 2 ); + MI_CpuClear16( userName, MB_USER_NAME_LENGTH * 2 ); + ExUTF16_LEtoSJIS_BE( (u8 *)gameName, (u16 *)mbrsp->list[ listNo ].gameInfo.fixed.gameName, MB_GAME_NAME_LENGTH * 2 ); + ExUTF16_LEtoSJIS_BE( (u8 *)userName, (u16 *)mbrsp->list[ listNo ].gameInfo.fixed.parent.name, (u16)( mbrsp->list[ listNo ].gameInfo.fixed.parent.nameLength * 2)); +// MI_CpuCopy16( mbrsp->list[ listNo ].gameInfo.fixed.gameName, gameName, MB_GAME_NAME_LENGTH * 2); +// MI_CpuCopy16( mbrsp->list[ listNo ].gameInfo.fixed.parent.name, userName, mbrsp->list[ listNo ].gameInfo.fixed.parent.nameLength * 2); + gameName[ MB_GAME_NAME_LENGTH ] = 0; + userName[ mbrsp->list[ listNo ].gameInfo.fixed.parent.nameLength ] = 0; + + (void)ClearStringSJISEx( gameName, view_no); + (void)ClearStringSJISEx( userName, view_no); + (void)DrawStringSJISEx( 9, (PLIST_Y + (int)view_no*4), WHITE, gameName, view_no); + (void)DrawStringSJISEx( 9, (PLIST_Y + (int)view_no*4 + 2), WHITE, userName, view_no); + + (void)DrawStringSJISEx( 26, (PLIST_Y + (int)view_no*4), YELLOW, str_sura, view_no); + (void)DrawDecimalSJIS ( 27, (PLIST_Y + (int)view_no*4), YELLOW, &mbrsp->list[ listNo ].gameInfo.fixed.maxPlayerNum, 2, 1); + + // 親機発見時間の表示 + (void)CheckParentFindTime( listNo ); // ここで親機を発見しているかを再確認しておく。 + time_ms = (int)findTime[listNo].vcount * 17; + time_sec = time_ms / 1000; + time_ms = (time_ms % 1000) / 10; + (void)DrawDecimalSJISEx( 23, (PLIST_Y + (int)view_no*4 + 2), CYAN, &time_sec, 4, 4, view_no); + (void)DrawDecimalSJISEx( 27, (PLIST_Y + (int)view_no*4 + 2), CYAN, &time_ms, 2, 4, view_no); + (void)DrawStringSJISEx ( 26, (PLIST_Y + (int)view_no*4 + 2), CYAN, str_period, view_no); + (void)DrawStringSJISEx ( 29, (PLIST_Y + (int)view_no*4 + 2), CYAN, str_sec, view_no); + + SetIconOBJ( listNo ); // アイコンの表示 + } + { // 変化する情報(現メンバー数・親機寿命カウントの表示) + (void)DrawDecimalSJIS( 24, (PLIST_Y + (int)view_no*4), YELLOW, &mbrsp->list[ listNo ].gameInfo.volat.nowPlayerNum, 2, 1); + (void)DrawHexSJIS ( 19, (PLIST_Y + (int)view_no*4 + 2), CYAN, &mbrsp->list[ listNo ].lifetimeCount, 4); + { + u16 color = RED; + if ( mbrsp->validGameInfoFlag & ( 0x0001 << listNo ) ) { + color = CYAN; + } + (void)DrawHexSJIS ( 19, (PLIST_Y + (int)view_no*4), color, &mbrsp->list[ listNo ].gameInfo.seqNoVolat, 2); + } + } +} + + +// 指定された親機情報の表示クリア +static void ClearDispParentGameInfo( u32 view_no, u32 listNo) +{ + // ※これらの変数のアドレスは、DispParentGameInfo側のものと一致してないと、表示をクリアすることができないので注意。(自動変数で表示するときはアドレスが変わってしまう) + // (これはDrawStringSJIS関数の仕様) + ClearStringSJISEx( gameName, view_no ); // ゲーム名 + ClearStringSJISEx( userName, view_no ); // ユーザー名 + ClearStringSJISEx( &time_sec, view_no ); // 親機発見時間sec + ClearStringSJISEx( &time_ms, view_no ); // 親機発見時間ms + ClearStringSJISEx( (void *)str_sura, view_no ); // "/" + ClearStringSJISEx( (void *)str_period, view_no ); // "." + ClearStringSJISEx( (void *)str_sec, view_no ); // "sec" + ClearStringSJIS ( (void *)&mbrsp->list[ listNo ].lifetimeCount ); // 親機寿命カウント + ClearStringSJIS ( (void *)&mbrsp->list[ listNo ].gameInfo.volat.nowPlayerNum ); // プレイ人数 + ClearStringSJIS ( (void *)&mbrsp->list[ listNo ].gameInfo.fixed.maxPlayerNum ); // 最大プレイ人数 + ClearStringSJIS ( (void *)&mbrsp->list[ listNo ].gameInfo.seqNoVolat ); // 最大プレイ人数 + + ClearIconOBJ( listNo ); // アイコンの消去 +} + + +// ゲーム内容説明の表示(実処理) +static void DispGameIntroduction_Core( u32 listNo ) +{ + int i; + const u16 *strp = mbrsp->list[ listNo ].gameInfo.fixed.gameIntroduction; + u16 *dstp; + u16 gameIntroTmp[ MB_GAME_INTRO_LENGTH / 2 + 1 ]; + + MI_CpuClear16( gameIntroduction[0], (MB_GAME_INTRO_LENGTH / 2 + 1) * sizeof(u16) ); + MI_CpuClear16( gameIntroduction[1], (MB_GAME_INTRO_LENGTH / 2 + 1) * sizeof(u16) ); + + dstp = gameIntroTmp; + for ( i = 0; i < MB_GAME_INTRO_LENGTH / 2; i++ ) { // バイト単位でのコピーなので、1行分は、MB_GAME_INTRO_LENGTH/2*2。 + if( ( *strp == NULL) || ( *strp == 0x000a ) ) { + *dstp++ = 0x0000; + }else { + *dstp++ = *strp++; + } + } + ExUTF16_LEtoSJIS_BE( (u8 *)gameIntroduction[ 0 ], gameIntroTmp, MB_GAME_INTRO_LENGTH / 2 ); + + if( *strp == 0x000a ) { + strp++; + } + + dstp = gameIntroTmp; + for ( i = 0; i < MB_GAME_INTRO_LENGTH / 2; i++ ) { + if( ( *strp == NULL) || ( *strp == 0x000a ) ) { + *dstp++ = 0x00; + }else { + *dstp++ = *strp++; + } + } + ExUTF16_LEtoSJIS_BE( (u8 *)gameIntroduction[ 1 ], gameIntroTmp, MB_GAME_INTRO_LENGTH / 2 + 1 ); + + ClearDispGameIntroduction(); + + SetTargetScreenSJIS( TOP_SCREEN ); + (void)DrawStringSJIS( ( G_INTRO_X + 1 ), ( G_INTRO_Y + 2 ), WHITE, (const u8 *)gameIntroduction[0] ); + (void)DrawStringSJIS( ( G_INTRO_X + 1 ), ( G_INTRO_Y + 4 ), WHITE, (const u8 *)gameIntroduction[1] ); + SetTargetScreenSJIS( BOTTOM_SCREEN ); +} + + +// ゲーム内容説明表示のクリア +static void ClearDispGameIntroduction( void ) +{ + SetTargetScreenSJIS( TOP_SCREEN ); + ClearStringSJIS( (void *)gameIntroduction[0] ); + ClearStringSJIS( (void *)gameIntroduction[1] ); + SetTargetScreenSJIS( BOTTOM_SCREEN ); +} + + +// 通信メンバーの表示(実処理) +static void DispPlayMember_Core( u32 listNo ) +{ + int n, count_x; + u16 nameLength; + int pos_x, pos_y; + const MBUserInfo *memberp = &mbrsp->list[ listNo ].gameInfo.volat.member[ 0 ]; + u16 *dstp; + + SetTargetScreenSJIS( TOP_SCREEN ); + + MI_CpuClear16( playMember, sizeof(playMember) ); + count_x = 0; + pos_x = G_MEMBER_X + 1; + pos_y = G_MEMBER_Y + 2; + for ( n = 0; n < MB_MEMBER_MAX_NUM; n++ ) { + + if( memberp->nameLength > MB_USER_NAME_LENGTH ) { // 名前長のチェック + nameLength = MB_USER_NAME_LENGTH; + }else { + nameLength = memberp->nameLength; + } + dstp = playMember[ n ]; + if( mbrsp->list[ listNo ].gameInfo.volat.nowPlayerFlag & (0x0002 << n ) ) { + + ExUTF16_LEtoSJIS_BE( (u8 *)dstp, (u16 *)memberp->name, nameLength ); + playMember[ n ][ nameLength ] = 0; + (void)DrawStringSJIS( pos_x, pos_y, WHITE, (const u8 *)playMember[ n ] ); + }else { + MI_CpuCopy16( (void *)"----------", (void *)playMember[ n ], MB_USER_NAME_LENGTH + 1); + (void)DrawStringSJIS( pos_x, pos_y, WHITE, playMember[ n ] ); + } + memberp++; + + if( ++count_x == 3 ) { // 表示位置の算出 + pos_x -= 20; + pos_y += 2; + count_x = 0; + }else { + pos_x += 10; + } + } + + SetTargetScreenSJIS( BOTTOM_SCREEN ); +} + + +// 通信メンバー表示のクリア +static void ClearDispPlayMember( void ) +{ + int i; + + SetTargetScreenSJIS( TOP_SCREEN ); + for( i = 0; i < MB_MEMBER_MAX_NUM + 1; i++ ) { + ClearStringSJIS( (void *)playMember[ i ] ); + } + SetTargetScreenSJIS( BOTTOM_SCREEN ); +} + + +// 10進データを文字列に変換 +static void DecimalToString(u8 *dstp, const void *valuep, u8 drawLength, u8 size) +{ + u16 count; + u32 mask, divisor, target; + + mask = 0xff; + while(--size > 0) { + mask = (mask << 8) | 0xff; + } + target=(*(u32 *)valuep) & mask; + count=10; + divisor=1000000000; + while(count) { + CP_SetDiv32_32(target, divisor); + if (count <= drawLength) { + *dstp++ = (u8)(CP_GetDivResult32()+0x0030); + } + target=(u32)CP_GetDivRemainder32(); + CP_SetDiv32_32(divisor, 10); + divisor=(u32)CP_GetDivResult32(); + count--; + } +} + + +// 親機発見時間変数のクリア +static void InitParentFindTime( void ) +{ + int i; + for( i = 0; i < MB_GAME_INFO_RECV_LIST_NUM; i++) { + findTime[i].find = FALSE; + findTime[i].vcount = 0; + } + total_vcount = 0; +} + + +// 親機発見時間のカウント +static void CountParentFindTime( void ) +{ + u32 i; + + for( i = 0; i < MB_GAME_INFO_RECV_LIST_NUM; i++ ) { + if( !CheckParentFindTime( i ) ) { + findTime[i].vcount = total_vcount; // 親機情報が見つかるまでカウント + } + } +} + + +// 親機情報が揃ったかどうかチェックして、発見時間カウントを停止する。 +static BOOL CheckParentFindTime( u32 index ) +{ + if( mbrsp->validGameInfoFlag & (0x01 << index) ) { // 親機情報が発見されたなら、カウントを停止する。 + findTime[ index ].find = TRUE; + } + return findTime[ index ].find; +} + + +// トータル時間のカウント&表示 +static void CountAndDispTotalTime( void ) +{ + total_vcount++; + time_ms = total_vcount * 17; + time_sec = time_ms / 1000; + time_ms = (time_ms % 1000) / 10; + (void)DrawDecimalSJISEx( 23, 2, CYAN, &time_sec, 4, 4, PARENT_VIEW_NUM); + (void)DrawDecimalSJISEx( 27, 2, CYAN, &time_ms, 2, 4, PARENT_VIEW_NUM); +} + + +// アイコンOBJのロード +static void SetIconOBJ( u32 index ) +{ + u16 view_no = (u16)( index & 0x03 ); + const MBIconInfo *iconp = &mbrsp->list[ index ].gameInfo.fixed.icon; + + GXS_LoadOBJPltt( iconp->palette, (u32)( MB_ICON_PALETTE_SIZE * view_no ), MB_ICON_PALETTE_SIZE ); + MI_CpuCopyFast( iconp->data, (void *)((u32)objVramBuff + 0x20 + MB_ICON_DATA_SIZE * view_no), MB_ICON_DATA_SIZE ); + G2_SetOBJAttr( (GXOamAttr*)&oamBakS[ view_no ], // OAM pointer + 8 * (PLIST_X + 3), // X position + 8 * PLIST_Y + (view_no * 32), // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x32, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 1 + view_no * 16, // charactor + view_no, // palette + 0); // affine +} + +// アイコンOBJのクリア +static void ClearIconOBJ( u32 index ) +{ + u16 view_no = (u16)( index & 0x03 ); + u16 *oamp = (u16 *)&oamBakS[ view_no ]; + + *oamp++ = 192; // Y座標を画面外に。(オール0クリアではダメ) + *oamp++ = 0; + *oamp++ = 0; + *oamp = 0; +} + + +// メッセージ表示のセット +static void SetDispMessage( u16 color, const u8 *str ) +{ + msgStat.vcount = MSG_VIEW_COUNT; + msgStat.color = color; + msgStat.str = str; +} + + +// メッセージ表示 +static BOOL DispMessage(void) +{ + if( msgStat.vcount == MSG_VIEW_COUNT ) { + msgStat.handle = DrawStringSJIS( 4, 21, msgStat.color, msgStat.str ); + } + + if ( --msgStat.vcount == 0 ) { + ClearStringSJIS_handle( msgStat.handle ); + return TRUE; + } + return FALSE; +} + + +// メッセージ表示のセット(点滅表示) +static void SetBlinkMessage( u16 color, const u8 *str ) +{ + msgStat.vcount = MSG_BLINK_COUNT; + msgStat.flag = 1; + msgStat.color = color; + msgStat.str = str; +} + + +// メッセージ表示 +static void DispBlinkMessage( void ) +{ + if( ( msgStat.vcount == MSG_BLINK_COUNT ) && msgStat.flag ) { + msgStat.handle = DrawStringSJIS( 4, 21, msgStat.color, msgStat.str ); + } + + if ( --msgStat.vcount == 0 ) { + ClearStringSJIS_handle( msgStat.handle ); + msgStat.flag ^= 0x01; + msgStat.vcount = MSG_BLINK_COUNT; + } +} + + +//============================================================================= +// Nintendoロゴ表示 +//============================================================================= + +// Nintendoロゴ表示の初期化 +static void InitDispNintendoLogo( void ) +{ + int i; + u16 *palettep = (u16 *)(HW_OBJ_PLTT + 0x20 * 15 ) + 1; // パレット15のカラー1に。 + *palettep++ = 0x7fff; + *palettep = 0x1111; + + // TOP画面の全表示クリア + SetTargetScreenSJIS( TOP_SCREEN ); + ClearAllStringSJIS(); + SetTargetScreenSJIS( BOTTOM_SCREEN ); + + // 画面上に受信したゲームのNintendoロゴを表示する。 +#ifdef NINLOGO_LOAD_1D_CHAR + // 1Dマッピングでのロード&表示 + GX_SetOBJVRamModeChar( GX_OBJVRAMMODE_CHAR_1D_32K ); + SYSM_LoadNintendoLogo1D( (u16 *)SYSM_GetCardRomHeader()->nintendo_logo, (u16 *)( HW_OBJ_VRAM + 0x40 ), 1, ninLogoBuff ); +// SYSM_LoadNintendoLogo1D( (u16 *)SYSROM9_NINLOGO_ADR, (u16 *)( HW_OBJ_VRAM + 0x40 ), 1, ninLogoBuff ); + + for ( i = 0; i < 3; i++ ) { + G2_SetOBJAttr( &oamBakM[ 10 + i ], // OAM pointer + 72 + 32 * i, // X position + 88, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x8, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0x2 + i * 4, // charactor + 15, // palette + 0); // affine + } + { + G2_SetOBJAttr( &oamBakM[ 13 ], // OAM pointer + 72 + 32 * 3, // X position + 88, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_8x8, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0x2 + 3 * 4, // charactor + 15, // palette + 0); // affine + } + for ( i = 0; i < 3; i++ ) { + G2_SetOBJAttr( &oamBakM[ 14 + i ], // OAM pointer + 72 + 32 * i, // X position + 96, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x8, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0x0f + i * 4, // charactor + 15, // palette + 0); // affine + } + { + G2_SetOBJAttr( &oamBakM[ 17 ], // OAM pointer + 72 + 32 * 3, // X position + 96, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_8x8, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0xf + 3 * 4, // charactor + 15, // palette + 0); // affine + } +#else + // 2Dマッピングでのロード&表示 + GX_SetOBJVRamModeChar( GX_OBJVRAMMODE_CHAR_2D ); + SYSM_LoadNintendoLogo2D( (u16 *)SYSM_GetCardRomHeader()->nintendo_logo, (u16 *)( HW_OBJ_VRAM + 0x40 ), 1, ninLogoBuff ); +// SYSM_LoadNintendoLogo2D( (u16 *)SYSROM9_NINLOGO_ADR, (u16 *)( HW_OBJ_VRAM + 0x40 ), 1, ninLogoBuff ); + + for ( i = 0; i < 4; i++ ) { + G2_SetOBJAttr( &oamBakM[11 + i], // OAM pointer + 72 + 32 * i, // X position + 88, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x16, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0x2 + i * 4, // charactor + 15, // palette + 0); // affine + } +#endif + + loop_count = 120; +} + + +// Nintendoロゴ表示 +static BOOL DispNintendoLogo( void ) +{ + if( --loop_count == 0 ) { + { + int i; + for ( i = 0; i < 4; i++ ) { + G2_SetOBJPosition( &oamBakM[ 11 + i ], 0, 192 ); + } + } + return TRUE; + } + return FALSE; +} + + +//============================================================================= +// その他サブルーチン +//============================================================================= + +// 自分のユーザー情報をNITRO設定データから読み出してセット +static void SetMyUserInfo( MBUserInfo *my ) +{ + NvNickname *nickname = NCD_GetNickname(); + + MI_CpuCopy16( nickname->str, my->name, (u32)( nickname->length * 2 ) ); + my->nameLength = nickname->length; + my->playerNo = 0; // とりあえず0にする。 + my->favoriteColor = NCD_GetFavoriteColor(); +} + + +// 現在スキャンロック中かどうかを取得する。 +static BOOL IsScanLock(void) +{ + return mbrsp->nowScanTargetFlag ? TRUE : FALSE; +} + + +//============================================================================= +// 割り込みルーチン +//============================================================================= + +// Vブランク割り込み +static void VBlankIntr_WDL(void) +{ + // OAM, BG-VRAMの更新 + DC_FlushRange (oamBakM, sizeof(oamBakM)); + DC_FlushRange (oamBakS, sizeof(oamBakS)); + DC_FlushRange (bgBakM, sizeof(bgBakM)); + DC_FlushRange (bgBakS, sizeof(bgBakS)); + DC_FlushRange (objVramBuff, sizeof(objVramBuff)); + MI_CpuCopyFast(oamBakM, (void*)HW_OAM, sizeof(oamBakM)); + MI_CpuCopyFast(oamBakS, (void*)HW_DB_OAM, sizeof(oamBakS)); + MI_CpuCopyFast(bgBakM, (void*)(HW_BG_VRAM + 0xf000), sizeof(bgBakM)); + MI_CpuCopyFast(bgBakS, (void*)(HW_DB_BG_VRAM + 0xf000), sizeof(bgBakS)); + MI_CpuCopyFast(objVramBuff, (void*)HW_DB_OBJ_VRAM, sizeof(objVramBuff)); + //---- 割り込みチェックフラグ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + +//============================================================================= +// プログラムシーケンスキュー処理 +//============================================================================= + +// キュー初期化 +static void InitPrgNextSeqQue( void ) +{ + MI_CpuClear16( &nextSeq, sizeof(nextSeq) ); +} + + +// 次のPrgSeqをキューにセットする。 +static BOOL SetPrgNextSeqQue( PrgSeq seq ) +{ + BOOL preIRQ = OS_DisableIrq(); + BOOL retval = FALSE; + + if( nextSeq.num != PRG_NEXT_SEQ_QUE_NUM ) { + nextSeq.seq[ nextSeq.bottom ] =seq; + nextSeq.num++; + nextSeq.bottom++; + if( nextSeq.bottom == PRG_NEXT_SEQ_QUE_NUM ) { + nextSeq.bottom = 0; + } + retval = TRUE; + } + (void)OS_RestoreIrq( preIRQ ); + return retval; +} + + +// 次のPrgSeqをキューから取り出す +static BOOL GetPrgNextSeqQue( PrgSeq *seqp ) +{ + BOOL preIRQ = OS_DisableIrq(); + BOOL retval = FALSE; + + if( ( !nextSeq.lock ) && ( nextSeq.num != 0 ) ) { // キューがロックされておらず、かつ次Seqが存在するなら、キューから取り出し。 + *seqp = nextSeq.seq[ nextSeq.top ]; + nextSeq.num--; + nextSeq.top++; + if( nextSeq.top == PRG_NEXT_SEQ_QUE_NUM ) { + nextSeq.top = 0; + } + retval = TRUE; + } + (void)OS_RestoreIrq( preIRQ ); + return retval; +} + + +// キューをロックする。(ロック中はGetPrgNextSeqQueで次Seqを取り出せなくなります。) +static void LockPrgNextSeqQue(void) +{ + nextSeq.lock = TRUE; +} + + +// キューのロック解除。 +static void UnlockPrgNextSeqQue(void) +{ + nextSeq.lock = FALSE; +} + +// キューが空か? +static BOOL IsEmptyPrgNextSeqQue(void) +{ + return nextSeq.num ? FALSE : TRUE; +} + + + +static const u32 searchCode[] = { + 0xe59f1028, + 0xe59f2028, + 0xe1d200b0, + 0xe2100001, + 0x1afffffc, + 0xe1d100b0, + 0xe3500006, + 0x0afffff9, + 0xe1d100b0, + 0xe3500005, + 0x0afffff6, + 0xe12fff1e, + 0x04808214, + 0x0480819c, +}; + + +void SearchPatchAddress( void ) +{ + MBDownloadFileInfo *dlfinfo = (MBDownloadFileInfo *)MB_DOWNLOAD_FILEINFO_ADDRESS; + BOOL find = FALSE; + u32 *tgtp = (u32 *)MB_ARM7_STATIC_RECV_BUFFER; + u32 size = dlfinfo->seg[ 2 ].size >> 2; + + while( size-- ) { + if( *tgtp++ == searchCode[0] ) { + u32 *srcp = (u32 *)&searchCode[ 1 ]; + u32 *checkp = tgtp ; + int i = sizeof( searchCode ) / sizeof(u32) - 1; + while( i-- ) { + if( *srcp++ != *checkp++ ) break; + } + if( i < 0 ) { + u32 addr = (u32)tgtp - 0x04 + 0x18; + OS_TPrintf("Found! -> 0x%08x\n", addr ); + find = TRUE; + } + } + } + if( !find ) { + OS_TPrintf("Not found.\n"); + } +} + diff --git a/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.h b/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.h new file mode 100644 index 00000000..1c9a8f83 --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/ARM9/src/DS_DownloadPlay.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_DownloadPlay.h + + Copyright 2007 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 __DS_DOWNLOAD_PLAY_H__ +#define __DS_DOWNLOAD_PLAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +int DS_DownloadPlayMain( void ); + + +#ifdef __cplusplus +} +#endif + +#endif // __DS_DOWNLOAD_PLAY_H__ diff --git a/build/systemMenu_RED/DS_DownloadPlay/Makefile b/build/systemMenu_RED/DS_DownloadPlay/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/DS_DownloadPlay/banner/Makefile b/build/systemMenu_RED/DS_DownloadPlay/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_RED/DS_DownloadPlay/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_RED/DS_DownloadPlay/banner/banner_v3.bsf b/build/systemMenu_RED/DS_DownloadPlay/banner/banner_v3.bsf new file mode 100644 index 00000000..8209887b Binary files /dev/null and b/build/systemMenu_RED/DS_DownloadPlay/banner/banner_v3.bsf differ diff --git a/build/systemMenu_RED/DS_DownloadPlay/banner/icon/gameIcon.bmp b/build/systemMenu_RED/DS_DownloadPlay/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..9c18b2e5 Binary files /dev/null and b/build/systemMenu_RED/DS_DownloadPlay/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lcf.template b/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lcf.template new file mode 100644 index 00000000..ab5ad204 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lcf.template @@ -0,0 +1,1060 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.NITRO (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN.NITRO (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX.NITRO (RW) : ORIGIN = AFTER(dummy.MAIN_EX.NITRO,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + + check.ITCM (RW) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check + check.MAIN.NITRO (RW) : ORIGIN = 0x02000000, LENGTH = 0x0f80000 > main.nitro.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.TWL (RW) : ORIGIN = 0x0d000000, LENGTH = 0x0 + arena.MAIN.TWL (RW) : ORIGIN = AFTER(,,), LENGTH = 0x0 + arena.MAIN_EX.TWL (RW) : ORIGIN = AFTER(dummy.MAIN_EX.TWL,,,), LENGTH = 0x0 + + check.MAIN.TWL (RW) : ORIGIN = 0x02000000, LENGTH = 0x0f80000 > main.twl.check + + binary.MODULE_FILES (RW) : ORIGIN = 0, LENGTH = 0x0 > component.files +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + libsyscall.a (.text) + OBJECT(_start,*) + crt0.FLX.TWL.o (.text) + crt0.FLX.TWL.o (.rodata) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); # Fit to cache line + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + + SDK_LTDOVERLAYTABLE_DIGEST =.; + . = . + 20; + SDK_LTDOVERLAYTABLE_DIGEST_END =.; + SDK_OVERLAYTABLE_DIGEST =.; + . = . + 20; + SDK_OVERLAYTABLE_DIGEST_END =.; + SDK_OVERLAY_DIGEST =.; + . = . + * 20; + . = . + * 20; + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x02fe0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_AUTOLOAD..SINIT_START = .; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_AUTOLOAD..SINIT_END = .; + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(32); + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + . = ALIGN(32); + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW SDK_OVERLAY_DIGEST - ADDR(.); + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_OVERLAY..DATA_END =.; + . = ALIGN(32); + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # compressed state + + + } > F + + ############################ ARENA ################################## + .dummy.MAIN_EX.NITRO: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.NITRO + + .arena.MAIN.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN.NITRO + + .arena.MAIN_EX.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + + } > arena.MAIN_EX.NITRO + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + + } > arena.DTCM + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + + } > check.ITCM + + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + . = . + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + + .check.MAIN.NITRO: + { + . = SDK_SECTION_ARENA_START; + + } > check.MAIN.NITRO + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = SDK_STATIC_BSS_END; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02400000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDAUTOLOAD__ID =; + SDK_LTDAUTOLOAD..ID =; + SDK_LTDAUTOLOAD..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START = .; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDAUTOLOAD..SINIT_END = .; + #:::::::::: text/rodata + SDK_LTDAUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_LTDAUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_LTDAUTOLOAD..DATA_END =.; + . = ALIGN(32); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..TEXT_SIZE = SDK_LTDAUTOLOAD..TEXT_END - SDK_LTDAUTOLOAD..TEXT_START; + SDK_LTDAUTOLOAD..DATA_SIZE = SDK_LTDAUTOLOAD..DATA_END - SDK_LTDAUTOLOAD..DATA_START; + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_LTDAUTOLOAD..BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDOVERLAY__ID =; + SDK_LTDOVERLAY..ID =; + SDK_LTDOVERLAY..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDOVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDOVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDOVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDOVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_LTDOVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_LTDOVERLAY..DATA_END =.; + . = ALIGN(32); + SDK_LTDOVERLAY..END =.; + + SDK_LTDOVERLAY..TEXT_SIZE = SDK_LTDOVERLAY..TEXT_END - SDK_LTDOVERLAY..TEXT_START; + SDK_LTDOVERLAY..DATA_SIZE = SDK_LTDOVERLAY..DATA_END - SDK_LTDOVERLAY..DATA_START; + SDK_LTDOVERLAY..SIZE = SDK_LTDOVERLAY..END - SDK_LTDOVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDOVERLAY..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_LTDOVERLAY..BSS_END =.; + + SDK_LTDOVERLAY..BSS_SIZE = SDK_LTDOVERLAY..BSS_END - SDK_LTDOVERLAY..BSS_START; + + } >> + + + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # compressed state + + + } > L + + ############################ ARENA ################################## + .dummy.MAIN_EX.TWL: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.TWL + + .arena.MAIN.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_ARENA_LO =.; + + } > arena.MAIN.TWL + + .arena.MAIN_EX.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_EX_ARENA_LO =.; + + } > arena.MAIN_EX.TWL + + .check.MAIN.TWL: + { + . = SDK_LTDMAIN_ARENA_LO; + + } > check.MAIN.TWL + + ############################ OTHERS ################################# + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + + } > binary.MODULE_FILES + +} diff --git a/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lsf b/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lsf new file mode 100644 index 00000000..e45a994c --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lsf @@ -0,0 +1,48 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-BB.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x02680200 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/Makefile b/build/systemMenu_RED/Launcher/ARM9/Makefile new file mode 100644 index 00000000..0da71295 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/Makefile @@ -0,0 +1,191 @@ + +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +# ※コンパイルスイッチの都合上、../../../libraries_sysmenu/sysmenu は有効にしておく +SUBDIRS = \ + ../../../libraries_sysmenu/sysmenu \ + ../../../libraries_sysmenu/boot \ + ../../../libraries_sysmenu/hotsw \ + ../../../libraries_sysmenu/util \ +# ../../../libraries_sysmenu/sharedFont \ +# ../../../libraries_sysmenu/reloc_info \ +# ../../../libraries_sysmenu/mcu \ +# ../../../libraries_sysmenu/ds \ +# $(ROOT)/build/libraries/reboot \ + +#---------------------------------------------------------------------------- +# コンポーネント選択 ( hyena or jackal ) + +export DEFAULT_COMP_ARM7 = jackal + +COMPONENT_DIR = $(call empath,$(TWL_IPL_RED_ROOT))/build/components/$(DEFAULT_COMP_ARM7).TWL +SUBDIRS += $(COMPONENT_DIR) +WRAM_MAP_FILE = $(COMPONENT_DIR)/wram_regs/wram_regs.rbin + +#---------------------------------------------------------------------------- + +# ランチャーのビルドスイッチ設定インクルード +include $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher + + +# MAKEROM SWITCH ※最終ROM作成時は、全てFALSEにセットする +SYSM_USE_WLANFIRM_LOCAL_PUBKEY ?= TRUE + +# MAKEROM SWITCH ※最終ROM作成時は、全てTRUEにセットする +SYSM_DISABLE_DEBUG ?= FALSE + + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TARGET_CODEGEN ?= THUMB +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +#※REDランチャーはデバッガ対応の都合上、TITLEID_LO=HNAA, CARD_REGION=ALLとしています。 +# UIGランチャーでは、リージョンに合わせてTITLEID_LO, CARD_REGIONを設定してください。 +################################################################## +TITLEID_LO = HNAA +CARD_REGION = ALL +################################################################## + + +TARGET_BIN = $(TITLEID_LO).tad + +LCFILE_SPEC = ARM9-TS.lsf +LCFILE_TEMPLATE = ARM9-TS.lcf.template +ROM_SPEC = main.rsf + +LOGO_DIR = Logo +MISC_DIR = ../../misc + +BG_DIR = ../../data + +SRCS_LOGO = logoDemo.c logoData.c +SRCS = main.c launcher.c sound.c loadWlanFirm.c \ + loadSharedFont.c scanWDS.c \ + $(addprefix $(LOGO_DIR)/, $(SRCS_LOGO)) \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c \ + $(BG_DIR)/BGData_Launcher.c \ + ../../MachineSettings/ARM9/src/getSysMenuVersion.c + +LINCLUDES = $(MISC_DIR)/include \ + $(SRCDIR)/$(LOGO_DIR) \ + $(ROOT)/build/libraries/wm/common.TWL/inc \ + $(ROOT)/build/libraries/wm/ARM9.TWL/nwm/inc \ + $(ROOT)/build/libraries/reboot/common/include \ + ../../MachineSettings/ARM9/src + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + liberrorlog$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont_launcher$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libreboot$(TWL_LIBSUFFIX).a \ + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +ADDRESS_DTCM = 0x0e000000 + + +#---------------------------------------------------------------------------- +# Append Flags + + +MAKEROM_FLAGS += -F \ + -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' \ + -DWRAM_MAP_FILE='$(WRAM_MAP_FILE)' + +MAKETAD_OPTION += -s + +ifeq ($(SYSM_DO_NOT_SHOW_LAUNCHER),TRUE) +MACRO_FLAGS += -DSYSM_DO_NOT_SHOW_LAUNCHER +endif + +ifeq ($(SYSM_DISABLE_WDS_SCAN),TRUE) +MACRO_FLAGS += -DSYSM_DISABLE_WDS_SCAN +endif + +ifeq ($(SYSM_DISABLE_WLFIRM_LOAD),TRUE) +MACRO_FLAGS += -DSYSM_DISABLE_WLFIRM_LOAD +endif + +ifeq ($(SYSM_IGNORE_WLFIRM_SIGNCHECK),TRUE) +MACRO_FLAGS += -DSYSM_IGNORE_WLFIRM_SIGNCHECK +endif + +ifneq ($(DHT_TEST),) +MACRO_FLAGS += -DDHT_TEST +MAKEROM_FLAGS += -DDS_HASH_TABLE_FILE=DSHashTable.bin +else +MAKEROM_FLAGS += -DDS_HASH_TABLE_DIR=data +endif + +ifeq ($(DEFAULT_COMP_ARM7),hyena) +MACRO_FLAGS += -DUSE_HYENA_COMPONENT +endif + +ifeq ($(SYSM_USE_WLANFIRM_LOCAL_PUBKEY),TRUE) +MACRO_FLAGS += -DSYSM_USE_WLANFIRM_LOCAL_PUBKEY +endif + +ifeq ($(SYSM_BUILD_FOR_PRODUCTION_TEST),TRUE) +MACRO_FLAGS += -DSYSM_BUILD_FOR_PRODUCTION_TEST +endif + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +# ローカルでビルドしたlibsharedfont_launcherを使用するので、SDKのlibsharedfontは除外する。 +GLIBRARIES := $(filter-out libsharedfont$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) + +MAKEROM = $(SYSMENU_TOOLSDIR)/bin/makerom.TWL.launcher.exe + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher b/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher new file mode 100644 index 00000000..ef26975c --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/commondefs.launcher @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.launcher - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +ifneq ($(SYSM_UPDATER_RELEASE),TRUE) + +# COMPILE SWITCH ※最終ROM作成時は、全てFALSEにセットする。SUBDIRのビルド時にも影響するようexportで環境変数設定する。 +export SYSM_DO_NOT_SHOW_LAUNCHER = FALSE +export SYSM_DISABLE_WDS_SCAN = FALSE +export SYSM_DISABLE_WLFIRM_LOAD = FALSE +export SYSM_DISABLE_INITIAL_SETTINGS = TRUE +export SYSM_IGNORE_WLFIRM_SIGNCHECK = FALSE +export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE + +endif + diff --git a/build/systemMenu_RED/Launcher/ARM9/main.rsf b/build/systemMenu_RED/Launcher/ARM9/main.rsf new file mode 100644 index 00000000..e3cd8f4c --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/main.rsf @@ -0,0 +1,226 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + + # + # TITLE NAME: Your product name within 12bytes + # + _GameCode $(TITLEID_LO) + + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMappingDirect $(WRAM_MAP_FILE) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion $(CARD_REGION) + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SCFG: scfg lock [TRUE/FALSE] + # + LockSCFG FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # NANDAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + + # + # DisableDebug :最終ROMでは、アプリジャンプされた際にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch FALSE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile FALSE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../data + Root /data + File NTR_IPL_font_m.NFTR NoCardBanner.bnr EmptyBanner.bnr NoBanner.bnr fanfare.32.wav bandbrothers_arm7flx_patch.sbin +} diff --git a/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c new file mode 100644 index 00000000..4c42364c --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoData.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: logoData.c + + Copyright 2007 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 "misc.h" + +// define data----------------------------------------------------------- + +// extern data----------------------------------------------------------- + +// function's prototype-------------------------------------------------- +void LoadLogoData( void ); + +// global variable------------------------------------------------------- + +// static variable------------------------------------------------------- + +// const data------------------------------------------------------------ + +static const u8 Nin_Char_Diff_Huff[] ATTRIBUTE_ALIGN( 2 ) = { + 0x24, 0xff, 0xae, 0x51, 0x69, 0x9a, 0xa2, 0x21, 0x3d, 0x84, 0x82, 0x0a, 0x84, 0xe4, 0x09, 0xad, + 0x11, 0x24, 0x8b, 0x98, 0xc0, 0x81, 0x7f, 0x21, 0xa3, 0x52, 0xbe, 0x19, 0x93, 0x09, 0xce, 0x20, + 0x10, 0x46, 0x4a, 0x4a, 0xf8, 0x27, 0x31, 0xec, 0x58, 0xc7, 0xe8, 0x33, 0x82, 0xe3, 0xce, 0xbf, + 0x85, 0xf4, 0xdf, 0x94, 0xce, 0x4b, 0x09, 0xc1, 0x94, 0x56, 0x8a, 0xc0, 0x13, 0x72, 0xa7, 0xfc, + 0x9f, 0x84, 0x4d, 0x73, 0xa3, 0xca, 0x9a, 0x61, 0x58, 0x97, 0xa3, 0x27, 0xfc, 0x03, 0x98, 0x76, + 0x23, 0x1d, 0xc7, 0x61, 0x03, 0x04, 0xae, 0x56, 0xbf, 0x38, 0x84, 0x00, 0x40, 0xa7, 0x0e, 0xfd, + 0xff, 0x52, 0xfe, 0x03, 0x6f, 0x95, 0x30, 0xf1, 0x97, 0xfb, 0xc0, 0x85, 0x60, 0xd6, 0x80, 0x25, + 0xa9, 0x63, 0xbe, 0x03, 0x01, 0x4e, 0x38, 0xe2, 0xf9, 0xa2, 0x34, 0xff, 0xbb, 0x3e, 0x03, 0x44, + 0x78, 0x00, 0x90, 0xcb, 0x88, 0x11, 0x3a, 0x94, 0x65, 0xc0, 0x7c, 0x63, 0x87, 0xf0, 0x3c, 0xaf, + 0xd6, 0x25, 0xe4, 0x8b, 0x38, 0x0a, 0xac, 0x72, 0x21, 0xd4, 0xf8, 0x07, 0x56, 0xcf, 0x00, 0x00, +}; + + +// ============================================================================ +// ロゴデータロード +// ============================================================================ +void LoadLogoData(void) +{ + *(vu16 *)( HW_OBJ_PLTT + 0x1e ) = 0x7c00; // OBJパレットセット + *(vu16 *)HW_BG_PLTT = 0xffff; // バックドロップを「白」にする。 + + SYSM_LoadNintendoLogo2D( (u16 *)Nin_Char_Diff_Huff, (u16 *)( HW_OBJ_VRAM + 0x0000 ), 0xf ); + + G2_SetOBJAttr( + (GXOamAttr *)HW_OAM, + 71, + 88, + 2, + GX_OAM_MODE_NORMAL, + FALSE, + GX_OAM_EFFECT_NONE, + GX_OAM_SHAPE_64x32, + GX_OAM_COLORMODE_16, + 0, // charNo. + 0, // paletteNo. + 0 + ); + G2_SetOBJAttr( + (GXOamAttr *)HW_OAM + 1, + 71 + 64, + 88, + 2, + GX_OAM_MODE_NORMAL, + FALSE, + GX_OAM_EFFECT_NONE, + GX_OAM_SHAPE_64x32, + GX_OAM_COLORMODE_16, + 8, // charNo. + 0, // paletteNo. + 0 + ); +} diff --git a/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.c b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.c new file mode 100644 index 00000000..a93a280b --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.c @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: logoDemo.c + + Copyright 2007 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 "logoDemo.h" +#include "misc.h" + +// define data-------------------------------------------------------- + +#define LOGO_DISP_FRAME 60 // ロゴ表示フレーム数 + +// ロゴ表示ステータス構造体 +typedef struct LogoStatus { + s32 state; + s32 value_A; + s32 value_B; + s32 mainCounter; +}LogoStatus; + +// extern data-------------------------------------------------------- +extern void LoadLogoData( void ); + +// function's prototype----------------------------------------------- + +// static variables--------------------------------------------------- +static LogoStatus s_logo = { 0, 0, 0, 0 }; + +// const data--------------------------------------------------------- + +void LogoInit( void ) +{ + if( SYSM_IsLogoDemoSkip() ) { + return; + } + + // 画面OFF + GX_DispOff(); + GXS_DispOff(); + + // VRAM割り当て&クリア + GX_SetBankForOBJ( GX_VRAM_OBJ_128_A ); //  〃     OBJ用 + GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D ); + MI_CpuClearFast( (void *)HW_OBJ_VRAM, 0x1000 ); // OBJ-VRAM クリア + MI_DmaFill32( 3, (void *)HW_OAM, 192, HW_OAM_SIZE ); // OAM クリア + + // 画面設定 + GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_2, GX_BG0_AS_2D ); + GX_SetOBJVRamModeChar( GX_OBJVRAMMODE_CHAR_2D ); + G2_SetBlendAlpha( GX_BLEND_PLANEMASK_OBJ, GX_BLEND_PLANEMASK_BD, s_logo.value_A, s_logo.value_B ); + GX_SetVisiblePlane( GX_PLANEMASK_OBJ ); + + // ロゴデータロード + LoadLogoData(); + + s_logo.state = 1; + s_logo.mainCounter = 0; + s_logo.value_A = 0; + s_logo.value_B = 16; + G2_ChangeBlendAlpha( s_logo.value_A, s_logo.value_B ); + + // メイン画面のみON + GX_DispOn(); +} + + +// ロゴメイン +int LogoMain() +{ + if( SYSM_IsLogoDemoSkip() ) { + return 1; + } + + switch( s_logo.state ) { + case 1: // Nintendoロゴフェードイン + if( s_logo.mainCounter++ < 16 ){ // Nintendoロゴ 表示 + G2_ChangeBlendAlpha( ++s_logo.value_A, --s_logo.value_B ); + }else { + s_logo.mainCounter = 0; + s_logo.state++; + } + break; + + + case 2: // Nintendoロゴ表示 + if( s_logo.mainCounter++ == LOGO_DISP_FRAME ) { + s_logo.mainCounter = 0; + s_logo.state++; + } + break; + + case 3: // Nintendoロゴフェードアウト + if( s_logo.mainCounter++ < 16 ) { + G2_ChangeBlendAlpha( --s_logo.value_A, ++s_logo.value_B ); + }else { + return 1; + } + break; + + default: + break; + } + + return 0; +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.h b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.h new file mode 100644 index 00000000..4e68c2e8 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/Logo/logoDemo.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: logoDemo.h + + Copyright 2007 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 _LOGO_DEMO_H +#define _LOGO_DEMO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern void LogoInit( void ); +extern int LogoMain( void ); +extern void SetLogoEnable( BOOL enable ); +extern BOOL IsLogoEnable( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* _LOGO_DEMO_H */ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/launcher.c b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c new file mode 100644 index 00000000..29ca2e37 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/launcher.c @@ -0,0 +1,871 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: launcher.c + + Copyright 2007 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 "misc.h" +#include "launcher.h" +#include "sound.h" +#include +#include +#include + + +// define data------------------------------------------ + +// バックライトボタン関係 +#define B_LIGHT_DW_BUTTON_TOP_X ( 191 ) +#define B_LIGHT_DW_BUTTON_TOP_Y ( 0 ) +#define B_LIGHT_DW_BUTTON_BOTTOM_X ( B_LIGHT_DW_BUTTON_TOP_X + 11 ) +#define B_LIGHT_DW_BUTTON_BOTTOM_Y ( B_LIGHT_DW_BUTTON_TOP_Y + 13 ) +#define B_LIGHT_UP_BUTTON_TOP_X ( 235 ) +#define B_LIGHT_UP_BUTTON_TOP_Y ( 0 ) +#define B_LIGHT_UP_BUTTON_BOTTOM_X ( B_LIGHT_UP_BUTTON_TOP_X + 11 ) +#define B_LIGHT_UP_BUTTON_BOTTOM_Y ( B_LIGHT_UP_BUTTON_TOP_Y + 13 ) + +// スクロールバー関係 +#define BAR_ZERO_X ( (WINDOW_WIDTH - ((ITEM_SIZE + ITEM_INTERVAL) * (LAUNCHER_TITLE_LIST_NUM - 1) + ITEM_SIZE)) / 2 - 3) +#define BAR_ZERO_Y (WINDOW_HEIGHT - 32 + 1) +#define BAR_HEIGHT 14 +#define BAR_WIDTH 14 //((ITEM_SIZE + ITEM_INTERVAL) * 4 + ITEM_SIZE + 2) +#define BAR_LOOSENESS 2 +#define ITEMDOT_PER_FRAME ((double)(ITEM_SIZE + ITEM_INTERVAL) / (double)FRAME_PER_SELECT) +#define FRAME_PER_ITEMDOT ((double)FRAME_PER_SELECT / (double)(ITEM_SIZE + ITEM_INTERVAL)) +#define BAR_OFFSET 0 // 表示に"■"テキストを使っているので、タッチ座標を補正する目的のOFFSET +#define ITEM_SIZE 2 +#define ITEM_INTERVAL 3 + +// バナー表示関係 +#define DOT_PER_FRAME ((BANNER_WIDTH + BANNER_INTERVAL) / FRAME_PER_SELECT) // 割り切れないと動きがカクカクするはず +#define FRAME_PER_SELECT 14 // バナーからバナーへの移動にかかるフレーム数 +#define BANNER_FAR_LEFT_POS (WINDOW_WIDTH/2 - BANNER_WIDTH*5/2 - BANNER_INTERVAL * 2) +#define BANNER_TOP (WINDOW_HEIGHT/2 + 4) +#define WINDOW_WIDTH 256 +#define WINDOW_HEIGHT 192 +#define BANNER_WIDTH 32 +#define BANNER_HEIGHT 32 +#define BANNER_INTERVAL 24 +#define TITLE_V_CENTER 47 + +#define MAX_SHOW_BANNER 6 + +#define MAX_LOAD_IMAGES 128 + +// フェードアウト関係 +#define FADE_COUNT_PER_ALPHA ((FADE_COUNT_MAX - FADE_START) / ALPHA_MAX) +#define FADE_COUNT_MAX 62 +#define ALPHA_MAX 31 +#define FADE_START 31 + +// extern data------------------------------------------ + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_scr_data2[32 * 32]; + +// function's prototype declaration--------------------- +static void LoadBannerFiles( void ); +static void BannerInit( void ); +static void SetDefaultBanner( TitleProperty *titleprop ); +static void SetAffineAnimation( BOOL (*flipparam)[4] ); +static void SetOAMAttr( void ); +static void BannerDraw( int selected, TitleProperty *titleprop); +static BOOL SelectCenterFunc( u16 *csr, TPData *tgt ); +static BOOL SelectFunc( u16 *csr, TPData *tgt ); +static void ProcessBackLightPads( void ); +static TitleProperty *ProcessPads( TitleProperty *pTitleList ); +static void MoveByScrollBar(); +static void DrawScrollBar(); +static void DrawBackLightSwitch(void); + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- +static int s_csr = 0; // 画面中央座標と、リストの一番最初にあるバナーの中央座標との距離を + // 移動するのに必要なフレーム数で表すための変数 +static int csr_v = 0; // s_csrの速度的変数 + +static TWLBannerFile *empty_banner; +static TWLBannerFile *nobanner_banner; +static TWLBannerFile *no_card_banner; +static GXOamAttr banner_oam_attr[MAX_SHOW_BANNER+10];// アフィンパラメータ埋める関係で少し大きめ +static int selected = 0; +static int bar_left = BAR_ZERO_X; +static fx32 s_selected_banner_size; +static BOOL s_wavstop = FALSE; + +static BOOL s_launcher_initialized = FALSE; + +//static StreamInfo strm; // stream info + +// const data ----------------------------------------- +//const char filename[] = "data/fanfare.32.wav"; + +//=============================================== +// Launcher.c +//=============================================== + +//====================================================== +// ランチャー +//====================================================== + +static void LoadBannerFiles( void ) +{ + // デフォルトバナーファイルの読み込み。最終的にリブートしてしまうので、解放処理は無し + u32 size = CMN_LoadFile( (void **)&empty_banner, "data/EmptyBanner.bnr", &g_allocator); + NNS_G2D_ASSERT( size > 0 ); + size = CMN_LoadFile( (void **)&nobanner_banner, "data/NoBanner.bnr", &g_allocator); + NNS_G2D_ASSERT( size > 0 ); + size = CMN_LoadFile( (void **)&no_card_banner, "data/NoCardBanner.bnr", &g_allocator); + NNS_G2D_ASSERT( size > 0 ); +} + +// パレットの読み込みやOBJ関係の初期化 +static void BannerInit( void ) +{ + int l; + LoadBannerFiles(); + + MI_DmaFill32(3, banner_oam_attr, 192, sizeof(banner_oam_attr)); // let out of the screen if not display + + // OBJModeの設定 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_128K); // 2D mapping mode + + //OBJATTRの初期化……表示前には値を弄る + for(l=0;lv1.gameName[ LCFG_TSD_GetLanguage() ]; + if( !my_EqualNString( old_gameName, str, BANNER_LANG_LENGTH ) ) + { + NNSG2dChar *str = ((TWLBannerFile *)titleprop[selected].pBanner)->v1.gameName[ LCFG_TSD_GetLanguage() ]; + NNSG2dTextRect rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str ); + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, 0, 24, WINDOW_WIDTH, 48 ); + PutStringUTF16( (WINDOW_WIDTH-rect.width)>>1, TITLE_V_CENTER - (rect.height>>1), TXT_COLOR_BLACK, str ); + MI_CpuCopy8( str, old_gameName, BANNER_LANG_LENGTH * 2 ); + } + + if(fadecount < (FADE_COUNT_MAX - FADE_START)) { + fadecount += 1; + G2_ChangeBlendAlpha( ALPHA_MAX-((fadecount)/FADE_COUNT_PER_ALPHA), (fadecount)/FADE_COUNT_PER_ALPHA ); + } +} + +// ランチャーの初期化 +void LauncherInit( TitleProperty *pTitleList ) +{ +#pragma unused( pTitleList ) + if(s_launcher_initialized) + { + return; + } + + s_launcher_initialized = TRUE; + InitBG(); // BG初期化 + + GX_DispOff(); + GXS_DispOff(); + + ChangeUserColor( LCFG_TSD_GetUserColor() ); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + // フェードアウト用BGデータ作成とロード + SVC_CpuClear( 0x0004, &bg_scr_data2, sizeof(bg_scr_data2), 16 ); + DC_FlushRange(&bg_scr_data2, sizeof(bg_scr_data2)); + GX_LoadBG2Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG2Scr(bg_scr_data2, 0, sizeof(bg_scr_data2)); + + DrawBackLightSwitch(); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, L"SYSTEM MENU" ); + PrintfSJIS( 128, 0, TXT_COLOR_BLUE, "IPL:%s", g_strIPLSvnRevision ); + PrintfSJIS( 128, 12, TXT_COLOR_BLUE, "SDK:%s", g_strSDKSvnRevision ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + GX_SetVisiblePlane( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 | GX_PLANEMASK_OBJ ); + G2_SetBlendAlpha(GX_BLEND_PLANEMASK_BG2, + GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_OBJ, ALPHA_MAX,0); + + GX_DispOn(); + GXS_DispOn(); + + // streamInfo初期化 + //FS_InitFile(&strm.file); + //strm.isPlay = FALSE; + + BannerInit(); +} + +// ROMのローディング中のランチャーフェードアウト +BOOL LauncherFadeout( TitleProperty *pTitleList ) +{ + static int fadecount = 0; + + // 描画関係 + + // 輝度表示 + DrawBackLightSwitch(); + + DrawScrollBar( pTitleList ); + + BannerDraw( selected, pTitleList ); + + // 描画少し追加 + { + MtxFx22 mtx; + static double wa; + double s = sin(wa*2.2); + double c = cos(wa*2.2); + mtx._00 = (fx32)((s_selected_banner_size*c) * (1.0 + wa)); + mtx._01 = (fx32)((s_selected_banner_size*s) * (1.0 + wa)); + mtx._10 = (fx32)((s_selected_banner_size*-s) * (1.0 + wa)); + mtx._11 = (fx32)((s_selected_banner_size*c) * (1.0 + wa)); + + //if( c!=0 ) mtx._00 = (fx32)((s_selected_banner_size/c) * (1.0 + wa)); + //else mtx._00 = 0x8fff; + //mtx._01 = 0; + //mtx._10 = 0; + //mtx._11 = (fx32)(s_selected_banner_size * (1.0 + wa)); + G2_SetOBJAffine((GXOamAffine *)(&banner_oam_attr[0]), &mtx); + wa += 0.1; + } + + // OAMをVRAMへロード + DC_FlushRange(&banner_oam_attr, sizeof(banner_oam_attr)); + GX_LoadOAM(&banner_oam_attr, 0, sizeof(banner_oam_attr)); + + // RTC情報の取得&表示 + GetAndDrawRTCData( &g_rtcDraw, FALSE ); + + // フェードアウトのカウント処理 + if(fadecount >= FADE_START) + { + G2_ChangeBlendAlpha( (fadecount-FADE_START)/FADE_COUNT_PER_ALPHA, ALPHA_MAX-((fadecount-FADE_START)/FADE_COUNT_PER_ALPHA) ); + } + if(fadecount < FADE_COUNT_MAX) { + fadecount++; + return FALSE; + }else { + // ディスプレイOFFにしないと起動時にノイズが表示される + GX_DispOff(); + GXS_DispOff(); + return TRUE; + } +} + +// ProcessPadsのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectCenterFunc( u16 *csr, TPData *tgt ) +{ + // 単純な実装例 + int x = WINDOW_WIDTH/2 - BANNER_WIDTH; + int y = BANNER_TOP - BANNER_HEIGHT/2; + if(WithinRangeTP( x, y, x+BANNER_WIDTH*2, y+BANNER_HEIGHT*2, tgt )) + { + *csr = (u16)1; + return TRUE; + } + + return FALSE; +} + +static BOOL SelectFunc( u16 *csr, TPData *tgt ) +{ + int l; + + for(l=0; l<2; l++) + { + int x = 1*8 + l*28*8; + int y = 20*8; + if(WithinRangeTP( x, y, x+16, y+16, tgt )) + { + *csr = (u16)l; + return TRUE; + } + } + return FALSE; +} + +static void ProcessBackLightPads( void ) +{ + static BOOL up_bl_bak = FALSE; + static BOOL dw_bl_bak = FALSE; + BOOL up_bl_trg = FALSE; + BOOL dw_bl_trg = FALSE; + u8 brightness = 0; + + if(tpd.disp.touch) { + BOOL up_bl = WithinRangeTP( B_LIGHT_UP_BUTTON_TOP_X, B_LIGHT_UP_BUTTON_TOP_Y, + B_LIGHT_UP_BUTTON_BOTTOM_X, B_LIGHT_UP_BUTTON_BOTTOM_Y, &tpd.disp ); + BOOL dw_bl = WithinRangeTP( B_LIGHT_DW_BUTTON_TOP_X, B_LIGHT_DW_BUTTON_TOP_Y, + B_LIGHT_DW_BUTTON_BOTTOM_X, B_LIGHT_DW_BUTTON_BOTTOM_Y, &tpd.disp ); + up_bl_trg = ( up_bl && tpd.disp.touch && !up_bl_bak ) ; + dw_bl_trg = ( dw_bl && tpd.disp.touch && !dw_bl_bak ) ; + up_bl_bak = tpd.disp.touch; + dw_bl_bak = tpd.disp.touch; + }else { + up_bl_bak = FALSE; + dw_bl_bak = FALSE; + } + + if( (pad.trg & PAD_KEY_UP) || up_bl_trg ) { + (void)UTL_GetBacklightBrightness( &brightness ); + if( ++brightness > BACKLIGHT_BRIGHTNESS_MAX ) { + brightness = BACKLIGHT_BRIGHTNESS_MAX; + } + (void)UTL_SetBacklightBrightness( brightness ); + } + if( ( pad.trg & PAD_KEY_DOWN) || dw_bl_trg ) { + (void)UTL_GetBacklightBrightness( &brightness ); + if( --brightness < 0 ) { + brightness = 0; + } + (void)UTL_SetBacklightBrightness( brightness ); + } +} + +static TitleProperty *ProcessPads( TitleProperty *pTitleList ) +{ + SelectSomethingFunc func[1]={SelectCenterFunc}; + BOOL tp_select = FALSE; + u16 dummy; + u16 tp_lr = 3; + TitleProperty *ret = NULL; + // バックライト関係のキー処理 + ProcessBackLightPads(); + + // その他のキー処理 + if( tpd.disp.touch ) + { + int x = WINDOW_WIDTH/2 - BANNER_WIDTH; + int y = BANNER_TOP - BANNER_HEIGHT/2; + if(WithinRangeTP( x, y, x+BANNER_WIDTH*2, y+BANNER_HEIGHT*2, &tpd.disp )) + { + s_wavstop = TRUE; + }else + { + s_wavstop = FALSE; + } + (void) SelectFunc( &tp_lr, &tpd.disp ); + }else + { + s_wavstop = FALSE; + } + + if( (pad.cont & (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_X )) == (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_X ) ) { + OS_DoApplicationJump( NULL, OS_APP_JUMP_NORMAL ); + } + + if(pad.cont & PAD_KEY_RIGHT || tp_lr == 1){ // バナー選択 + if(csr_v == 0) csr_v = 1; + } + if( pad.cont & PAD_KEY_LEFT || tp_lr == 0){ + if(csr_v == 0) csr_v = -1; + } + s_csr += csr_v; + if((LAUNCHER_TITLE_LIST_NUM-1)*FRAME_PER_SELECT < s_csr) s_csr = (LAUNCHER_TITLE_LIST_NUM-1)*FRAME_PER_SELECT; + if( s_csr < 0 ) s_csr = 0; + + selected = (s_csr + FRAME_PER_SELECT/2)/FRAME_PER_SELECT; + if(s_csr%FRAME_PER_SELECT == 0){ + csr_v = 0; + + // バナーが中央にあるときだけ決定可能 + tp_select = SelectSomethingByTP(&dummy, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( pTitleList[selected].flags.isValid ) + { + //PlayStream(&strm, filename); + ret = &pTitleList[selected]; + // ブートするアプリのindex番号とTitleIDを本体設定に保存する。(実際の保存は、SYSMライブラリがブート時に行います。) + LCFG_TSD_SetLastTimeBootSoftIndex( (u8)selected ); + LCFG_TSD_SetLastTimeBootSoftTitleID ( pTitleList[selected].titleID ); + } + } + } + + // HOTSW許可・抑制テスト + { + static BOOL hotswEnable = TRUE; + + if( pad.trg & PAD_BUTTON_X ){ + hotswEnable ^= TRUE; + + // 活線挿抜許可・抑制 + HOTSW_EnableHotSWAsync( hotswEnable ); + + // 活線挿抜が指定した状態になるまでポーリング + while(HOTSW_isEnableHotSW() != hotswEnable){ + // do nothing + } + + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, 0, 175, 100, 13 ); + } + if(hotswEnable){ + PutStringUTF16( 0, 175, TXT_COLOR_BLUE, L"HotSw Enable" ); + } + else{ + PutStringUTF16( 0, 175, TXT_COLOR_RED, L"HotSw Disable" ); + } + } + + return ret; +} + +// スクロールバーによるスクロール +static void MoveByScrollBar( void ) +{ + static double vx = 0; + static int last_move_dir = 0; + static int last_bar_left; + + // スクロールバーによるスクロール + { + static BOOL holding = FALSE; + static BOOL ground_holding = FALSE; + static int dx; + static const int list_len = 4; + static int list_x[list_len]; + int l; + + if( !ground_holding && !holding && vx == 0) + { + bar_left = (int)(BAR_ZERO_X + (ITEMDOT_PER_FRAME * s_csr)); + } + + // 慣性移動 + if(vx!=0) + { + bar_left += (int)vx; + s_csr = (u16)((bar_left - BAR_ZERO_X) * FRAME_PER_ITEMDOT); + vx = vx * 0.9; + if(vx*vx < 1) + { + vx = 0; + } + } + + if(tpd.disp.touch) + { + if(holding) + { + if ( tpd.disp.x - dx < bar_left - BAR_LOOSENESS) + { + bar_left = tpd.disp.x - dx + BAR_LOOSENESS; + } + else if ( tpd.disp.x - dx > bar_left + BAR_LOOSENESS) + { + bar_left = tpd.disp.x - dx - BAR_LOOSENESS; + } + s_csr = (u16)((bar_left - BAR_ZERO_X) * FRAME_PER_ITEMDOT); + + // 移動履歴追記 + for( l=0; l bar_left ? 1 : -1 ); + s_csr = (u16)((bar_left - BAR_ZERO_X) * FRAME_PER_ITEMDOT); + } + else if( WithinRangeTP(BAR_ZERO_X+BAR_OFFSET, BAR_ZERO_Y+BAR_OFFSET,BAR_ZERO_X + (ITEM_SIZE + ITEM_INTERVAL) * (LAUNCHER_TITLE_LIST_NUM),BAR_ZERO_Y+BAR_OFFSET+BAR_HEIGHT,&tpd.disp) ) + { + ground_holding = TRUE; + } + } + else + { + int det = s_csr % FRAME_PER_SELECT; + if(holding) + { + holding = FALSE; + + // 移動履歴から速度算出 + for( l=1; l last_bar_left ? 1 : -1); + last_bar_left = bar_left; +} + +static void DrawScrollBar( TitleProperty *pTitleList ) +{ + int l; + static int col_count = 0; + static int col_count_d = 1; + static const int COL_FLAME_MAX = 30; + static const int COL_NUM = 15; + static const int COL_DIV = (COL_FLAME_MAX / COL_NUM); + int colc_cold; + static int oldx; + + col_count += col_count_d; + if(col_count < 0) + { + col_count = 0; + col_count_d = 1; + } + if(COL_FLAME_MAX <= col_count) + { + col_count = COL_FLAME_MAX - 1; + col_count_d = -1; + } + + colc_cold = col_count/COL_DIV; + + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, oldx, BAR_ZERO_Y, 12, 13 ); + for(l=0; l +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- + +// global variables-------------------------------------------------- + +// function---------------------------------------------------------- +void LauncherInit( TitleProperty *pTitleList ); + +BOOL LauncherFadeout( TitleProperty *pTitleList ); +TitleProperty *LauncherMain( TitleProperty *pTitleList ); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.c b/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.c new file mode 100644 index 00000000..a74b929c --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.c @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.c + + Copyright 2007 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 "launcher.h" +#include "misc.h" +#include "loadSharedFont.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define FONT_LOAD_THREAD_PRIO 13 +#define THREAD_STACK_SIZE 1024 + +// function's prototype------------------------------------------------------- + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- +static u64 s_fontLoadThreadStack[THREAD_STACK_SIZE / sizeof(u64)]; +static OSThread s_fontLoadThread; +static OSTick s_fontLoadStartTick; +static u8 *s_pFontBuffer[ SHARED_FONT_MAX ]; // 読み込みはテストなのでロード先はstatic変数にしている。 +static BOOL s_isStarted = FALSE; + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// 共有フォントロード +// ============================================================================ +BOOL LoadSharedFontInit( void ) +{ + u8 *pBuffer; + int size; + + s_fontLoadStartTick = OS_GetTick(); + + // ロードスレッド生成 + OS_CreateThread(&s_fontLoadThread, + LoadSharedFontThread, + NULL, + s_fontLoadThreadStack + THREAD_STACK_SIZE / sizeof(u64), + THREAD_STACK_SIZE, FONT_LOAD_THREAD_PRIO); + + // フォントロード準備 + if( !OS_InitSharedFont() ) { + OS_TPrintf( "OS_InitSharedFont failed.\n" ); + return FALSE; + } + size = OS_GetSharedFontTableSize(); + if( size < 0 ) { + OS_TPrintf( "OS_GetSharedTableSize failed.\n" ); + return FALSE; + } + + pBuffer = SYSM_Alloc( (u32)size ); + if( pBuffer == NULL ) { + OS_TPrintf( "malloc failed.\n" ); + return FALSE; + } + if( !OS_LoadSharedFontTable( pBuffer ) ) { + OS_TPrintf( "OS_LoadSharedTable failed.\n" ); + return FALSE; + } + + // ロードスレッド起動 + OS_WakeupThreadDirect(&s_fontLoadThread); + s_isStarted = TRUE; + return TRUE; +} + + +void LoadSharedFontThread( void *arg ) +{ +#pragma unused(arg) + BOOL retval = TRUE; + OSSharedFontIndex i; + + for( i = OS_SHARED_FONT_WW_L; i < OS_SHARED_FONT_MAX; i++ ) { + int size; + + OS_TPrintf( "%s read.\n", OS_GetSharedFontName( i ) ); + + size = OS_GetSharedFontSize( i ); + if( size < 0 ) { + OS_TPrintf( "OS_GetSharedFontSize failed.\n" ); + retval = FALSE; + break; + } + + // FSのキャッシュが怪しそうなので、とりあえずアラインメントをとっておく。 + size = MATH_ROUNDUP( size, SYSM_ALIGNMENT_LOAD_MODULE ); + + s_pFontBuffer[ i ] = SYSM_Alloc( (u32)size ); + if( s_pFontBuffer[ i ] == NULL ) { + OS_TPrintf( "malloc failed.\n" ); + retval = FALSE; + break; + } + + if( !OS_LoadSharedFont( i, s_pFontBuffer[ i ] ) ) { + OS_TPrintf( "OS_LoadSharedFont failed.\n" ); + retval = FALSE; + break; + } + } + + + OS_TPrintf( "Shared Font load time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - s_fontLoadStartTick ) ); + + if( retval ) { + OS_TPrintf( "Shared Font load succeeded.\n" ); + }else { + OS_TPrintf( "Shared Font load failed.\n" ); + UTL_SetFatalError( FATAL_ERROR_SHARED_FONT ); + } +} + + +BOOL IsFinishedLoadSharedFont( void ) +{ + if( s_isStarted ) { + return OS_IsThreadTerminated( &s_fontLoadThread ); + }else { + return TRUE; + } +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.h b/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.h new file mode 100644 index 00000000..53c6a6ec --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/loadSharedFont.h @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.h + + Copyright 2007 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 __LOAD_SHARED_FONT_H__ +#define __LOAD_SHARED_FONT_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- +// global variables-------------------------------------------------- +// function---------------------------------------------------------- +BOOL LoadSharedFontInit( void ); +void LoadSharedFontThread( void *arg ); +BOOL IsFinishedLoadSharedFont( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __LOAD_SHARED_FONT_H__ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.c b/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.c new file mode 100644 index 00000000..0d7906c4 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.c @@ -0,0 +1,706 @@ +/*---------------------------------------------------------------------------* + Project: TWL_RED_IPL - + File: loadWlanFirm.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 + +#include "nwm_common_private.h" +#include "nwm_arm9_private.h" + +#include "loadWlanFirm.h" +#include "scanWDS.h" + +/* + definitions + */ + +/* LCFGの無線ファームバージョンをタイトルIDとしてそのまま使う場合 */ +#define USE_LCFG_STRING 0 + +/* 無線FWダウンロード処理にかかる時間を計測する。 */ +#define MEASURE_WIRELESS_INITTIME 0 + +/* 無線FWファイルの各エリアについて読み込み時間を計測する。 */ +#define MEASURE_READ_FWFILE_TIME 0 + +/* 無線FW認証処理にかかる時間を計測する。 */ +#define MEASURE_VERIFY_SIGN_TIME 0 + +/* ハッシュ比較の情報を出力する。 */ +#define REPORT_HASH_COMPARISON 0 + +/* Index of public key for WLAN firm */ +#define WLANFIRM_PUBKEY_INDEX 1 +#define SIGN_LENGTH 128 + +#define SIGNHEAP_SIZE 0x01000 + + +/* + internal variables + */ +static BOOL s_isHotStartWLFirm; +static volatile BOOL s_isFinished; +static volatile WLANFirmResult s_result = WLANFIRM_RESULT_UNFINISHED; +static u32* pNwmBuf; +static u8* pFwBuffer = 0; +#if (MEASURE_WIRELESS_INITTIME == 1) +static OSTick startTick = 0; +#endif +static OSMessageQueue mesq; +static OSMessage mesAry[1]; + +static u8 fwType; // must be in main memory + +/* + internal functions + */ +static void InstallFirmCallback(void* arg); +static BOOL GetFirmwareFilepath(char *path); +static s32 ReadFirmwareSecurityArea(char *path, u8 *buffer, s32 bufSize); +static s32 ReadFirmwareHeader(char *path, u8 *buffer, s32 bufSize); +static s32 ReadFirmwareBinary(char *path, u32 offset, u8 *buffer, s32 bufSize); +static BOOL VerifyWlanfirmSignature(u8* buffer, u32 length); +static BOOL CheckHash(const u8* hash, const u8* buffer, u32 length); +#if (REPORT_HASH_COMPARISON == 1) +static void PrintDigest(u8 *digest); +#endif +static BOOL GetWlanFirmwareInstallResult(WLANFirmResult *pResult); + + +void InstallFirmCallback(void* arg) +{ + NWMCallback *cb = (NWMCallback*)arg; + WLANFirmResult result; + + if (cb->retcode == NWM_RETCODE_SUCCESS) { +#if (MEASURE_WIRELESS_INITTIME == 1) + OS_TPrintf("[Wlan Firm] LoadTime=%dmsec\n", OS_TicksToMilliSeconds(OS_GetTick() - startTick)); +#endif + OS_TPrintf("[Wlan Firm] Wlan firmware has been installed successfully!\n"); + result = WLANFIRM_RESULT_SUCCESS; + } else { // in case of failure + OS_TPrintf("[Wlan Firm] FW download Timeout Error!\n"); + result = WLANFIRM_RESULT_FAILURE; + } + + if (pFwBuffer) { + SYSM_Free( pFwBuffer ); + pFwBuffer = 0; + } + if (pNwmBuf) + { + NWM_End(); + SYSM_Free( pNwmBuf ); + pNwmBuf = 0; + } + /* メッセージキューにFWダウンロードの結果を通知 */ + if (FALSE == OS_SendMessage(&mesq, (OSMessage)result, OS_MESSAGE_NOBLOCK)) + { + // queue溢れはありえないハズだが、発生した場合は無線の不具合とみなしFATALにする。 +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + UTL_SetFatalError( FATAL_ERROR_WLANFIRM_LOAD ); +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + s_isFinished = TRUE; + } + +} + +BOOL GetFirmwareFilepath(char *path) +{ + u8 title[4] = { 'H','N','C','A' }; + +#if( USE_LCFG_STRING == 0 ) + char *title0 = "HNCA"; +#endif + u32 titleID_hi; + u32 titleID_lo; + u64 titleID = 0; + + +#if( USE_LCFG_STRING == 0 ) + { + int i; + if( title[0] == 0 ) { + for( i = 0 ; i < 4 ; i++ ) { + title[i] = (u8)*title0++; + } + } + } +#endif + + + titleID_hi = (( 3 /* Nintendo */ << 16) | 8 /* CHANNEL_DATA_ONLY */ | 4 /* CHANNEL_CARD */ | 2 /* isLaunch */ | 1 /* isSystem */); + + titleID_lo = ((u32)( title[0] ) & 0xff) << 24; + titleID_lo |= ((u32)( title[1] )& 0xff) << 16; + titleID_lo |= ((u32)( title[2] )& 0xff) << 8; + titleID_lo |= (u32)( title[3] ) & 0xff; + + titleID = ((u64)(titleID_hi) << 32) | (u64)titleID_lo; + + // OS_TPrintf( "[Wlan Firm] titleID = 0x%08x%08x\n", titleID_hi, titleID_lo); + + if( NAM_OK == NAM_GetTitleBootContentPathFast(path, titleID) ) { + OS_TPrintf( "[Wlan Firm] File = %s\n", path); + } + else { + OS_TPrintf( "[Wlan Firm] Error: NAM_GetTitleBootContentPathFast titleID = 0x%08x0x%08x\n",titleID_hi, titleID_lo); + return FALSE; + } + + return TRUE; + +} + +s32 ReadFirmwareSecurityArea(char *path, u8 *buffer, s32 bufSize) +{ + return ReadFirmwareBinary(path, 0, buffer, bufSize); +} + +s32 ReadFirmwareHeader(char *path, u8 *buffer, s32 bufSize) +{ + return ReadFirmwareBinary(path, NWM_FW_SECURITY_AREA_SIZE, buffer, bufSize); +} + +s32 ReadFirmwareBinary(char *path, u32 offset, u8 *buffer, s32 bufSize) +{ + FSFile file[1]; + s32 flen; +#if (MEASURE_READ_FWFILE_TIME == 1) + OSTick rstart = OS_GetTick(); +#endif + + FS_InitFile( file ); + + if (!FS_OpenFileEx(file, path, FS_FILEMODE_R)) { + OS_TWarning("FS_OpenFileEx(%s) failed.\n", path); + return -1; + } + + if( FALSE == FS_SeekFile(file, (s32)(offset), FS_SEEK_SET) ) { + OS_TWarning("FS_SeekFile failed.\n"); + return -1; + } + + flen = FS_ReadFile(file, buffer, bufSize); + if( flen == -1 ) { + OS_TWarning("FS_ReadFile failed.\n"); + return -1; + } + + (void)FS_CloseFile(file); + +#if (MEASURE_READ_FWFILE_TIME == 1) + OS_TPrintf("[Wlan Firm] Read Firmware Time[OFS:0x%08X, SIZE:0x%08X]=%dmsec\n", + offset, bufSize, OS_TicksToMilliSeconds(OS_GetTick() - rstart)); +#endif + + return flen; +} + +#ifdef SYSM_USE_WLANFIRM_LOCAL_PUBKEY +static const u8 s_pubkey9_1[ 0x80 ] = { + 0xb6, 0x18, 0xd8, 0x61, 0x28, 0xcb, 0x5c, 0x6f, 0x05, 0xfc, 0xd7, 0x09, 0x18, 0x3f, 0xb2, 0xd0, + 0x6b, 0x7d, 0xee, 0xd9, 0x98, 0xdc, 0x4f, 0xdd, 0xc1, 0xa8, 0x59, 0x18, 0xfb, 0xb0, 0x65, 0xbd, + 0x65, 0x80, 0x9c, 0xc7, 0x68, 0xa1, 0x4e, 0xdc, 0x18, 0xaa, 0x7b, 0xcb, 0xb9, 0xa0, 0x7c, 0xfc, + 0x1f, 0xab, 0x86, 0x5d, 0xed, 0x9c, 0x2c, 0x5c, 0x6d, 0x07, 0xd9, 0xfc, 0xc2, 0x9b, 0x7a, 0x9d, + 0x7c, 0x3a, 0x73, 0x33, 0xb7, 0xe8, 0x04, 0x86, 0x81, 0xc8, 0x5c, 0x7d, 0xb3, 0x95, 0x7d, 0xc9, + 0xec, 0x66, 0x07, 0x2f, 0x8b, 0xb2, 0x6d, 0x13, 0xc4, 0x6c, 0xf0, 0xba, 0x27, 0x82, 0x33, 0x18, + 0xd4, 0x31, 0x6a, 0xb2, 0xad, 0xbc, 0x37, 0x06, 0x6a, 0x2e, 0xe9, 0x73, 0x5f, 0x3a, 0x57, 0xc7, + 0xd7, 0xf8, 0x8e, 0xc1, 0xb9, 0x3d, 0x3f, 0xd4, 0xe5, 0x27, 0x6f, 0xb4, 0x00, 0x8b, 0xb7, 0x19, +}; +#endif // SYSM_USE_WLANFIRM_LOCAL_PUBKEY + +BOOL VerifyWlanfirmSignature(u8* buffer, u32 length) +{ +#pragma unused(length) + NWMFirmSecurityArea *hdr = (NWMFirmSecurityArea*)buffer; + u8 *pPubkey; + u8 *pSign; + u8 *txt; + u32 txtlen; + u8 txtDigest[SVC_SHA1_DIGEST_SIZE]; + u8 signDigest[SVC_SHA1_DIGEST_SIZE]; + SVCSHA1Context sctx; + SVCSignHeapContext rctx; + u8* signHeap; +#if (MEASURE_VERIFY_SIGN_TIME == 1) + OSTick vstart = OS_GetTick(); +#endif + +#ifdef SYSM_USE_WLANFIRM_LOCAL_PUBKEY + // ランチャー経由でのデバッガ起動では、鍵情報を受け取ることができない。 + // よってリリースビルドの時は、デバッグ動作を優先して鍵を自分で持つ。 + pPubkey = (u8 *)s_pubkey9_1; +#else + pPubkey = OSi_GetFromFirmAddr()->rsa_pubkey[WLANFIRM_PUBKEY_INDEX]; +#endif + pSign = (u8*)hdr->sign; + + txt = (u8*)hdr->hash; + txtlen = (u32)NWM_FW_SECURITY_AREA_SIZE - SIGN_LENGTH; /* 署名を除いたSecurity Areaのサイズ */ + + /* calculate SHA-1 digest */ + SVC_SHA1Init( &sctx ); + SVC_SHA1Update( &sctx, (const void*)txt, txtlen); + SVC_SHA1GetHash( &sctx, txtDigest ); + +#if (REPORT_HASH_COMPARISON == 1) + OS_TPrintf("[Wlan Firm] Wlan Firm digest: "); + PrintDigest((u8*)txtDigest); +#endif + + /* decrypt according to RSA security */ + signHeap = SYSM_Alloc( SIGNHEAP_SIZE ); + SVC_InitSignHeap( &rctx, signHeap, SIGNHEAP_SIZE); + + MI_CpuClear8( signDigest, SVC_SHA1_DIGEST_SIZE ); + + if (FALSE == SVC_DecryptSign( &rctx, signDigest, (const void*)pSign, (const void*)pPubkey )) + { + OS_TPrintf("[Wlan Firm] !!!! Wlan Firmware authentication has failed !!!!\n"); + +#ifdef SYSM_IGNORE_WLFIRM_SIGNCHECK + OS_TPrintf("[Wlan Firm] But this failure is ignored.\n"); + if ( 0 ) +#endif + { + SYSM_Free(signHeap); + return FALSE; + } + } + + SYSM_Free(signHeap); + +#if (REPORT_HASH_COMPARISON == 1) + OS_TPrintf("[Wlan Firm] Decrypted digest: "); + PrintDigest((u8*)signDigest); +#endif + + /* verify digest */ + if (FALSE == SVC_CompareSHA1( (const void*)txtDigest, (const void*)signDigest )) + { + OS_TPrintf("[Wlan Firm] !!!! Digest verification failed !!!!\n"); +#ifdef SYSM_IGNORE_WLFIRM_SIGNCHECK + OS_TPrintf("[Wlan Firm] But this failure is ignored.\n"); + if ( 0 ) +#endif + { + return FALSE; + } + } + +#if (MEASURE_VERIFY_SIGN_TIME == 1) + OS_TPrintf("[Wlan Firm] Verify signature Time=%dmsec\n", OS_TicksToMilliSeconds(OS_GetTick() - vstart)); +#endif + + return TRUE; + +} + +BOOL CheckHash(const u8* hash, const u8* buffer, u32 length) +{ + u8 txtDigest[SVC_SHA1_DIGEST_SIZE]; + SVCSHA1Context sctx; +#if (MEASURE_VERIFY_SIGN_TIME == 1) + OSTick vstart = OS_GetTick(); +#endif + +#if (REPORT_HASH_COMPARISON == 1) + OS_TPrintf("[Wlan Firm] Digest to compare: "); + PrintDigest((u8*)hash); +#endif + + /* calculate SHA-1 digest */ + SVC_SHA1Init( &sctx ); + SVC_SHA1Update( &sctx, (const void*)buffer, length); + SVC_SHA1GetHash( &sctx, txtDigest ); + +#if (REPORT_HASH_COMPARISON == 1) + OS_TPrintf("[Wlan Firm] Calculated digest: "); + PrintDigest((u8*)txtDigest); +#endif + + /* verify digest */ + if (FALSE == SVC_CompareSHA1( (const void*)hash, (const void*)txtDigest )) + { +#if (MEASURE_VERIFY_SIGN_TIME == 1) + OS_TPrintf("[Wlan Firm] Verify digest Time=%dmsec\n", OS_TicksToMilliSeconds(OS_GetTick() - vstart)); +#endif + return FALSE; + } +#if (MEASURE_VERIFY_SIGN_TIME == 1) + OS_TPrintf("[Wlan Firm] Verify digest Time=%dmsec\n", OS_TicksToMilliSeconds(OS_GetTick() - vstart)); +#endif + return TRUE; +} + +#if (REPORT_HASH_COMPARISON == 1) +void PrintDigest(u8 *digest) +{ + int i; + + for (i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) + { + OS_TPrintf("%02X ", digest[i]); + } + OS_TPrintf("\n"); +} +#endif + + +BOOL InstallWlanFirmware( BOOL isHotStartWLFirm ) +{ + NWMRetCode err; + NWMFirmDataParam *pFdParam = (NWMFirmDataParam *)NWM_PARAM_FWDATA_ADDRESS; + u8 *pSecBuf = NULL; + u8 *pHdrBuf = NULL; + + ROM_Header_Short *header = ( ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + +#if defined(SYSM_DISABLE_WLFIRM_LOAD) + return TRUE; +#endif // SYSM_DISABLE_WLFIRM_LOAD + + if( header->titleID_Lo[3] == '4' ) + { + OS_TPrintf("[Wlan Firm] This is DEV_UIG_Launcher. Wireless firmware download skipped.\n"); + s_isFinished = TRUE; + s_result = WLANFIRM_RESULT_SUCCESS; + return TRUE; + } + + s_isFinished = FALSE; + pNwmBuf = NULL; + pFwBuffer = NULL; + + OS_InitMessageQueue(&mesq, mesAry, sizeof(mesAry)/sizeof(mesAry[0])); + + /* Read FW type from NVRAM (retry till success) */ + while (NVRAM_RESULT_SUCCESS != NVRAMi_Read(NWM_NVR_FWTYPE_OFFSET_ADDRESS, sizeof(fwType), &fwType )) + { + OS_SpinWait( 256 ); + } + + if (fwType == 0xFF) + { + // NVRAMの該当領域が0xFF(何も書かれていない)の場合は、fwType=0として扱う。 + OS_TWarning("Firmware Type has not been found in NVRAM.\n"); + fwType = 0; + } + + pFdParam->fwType = fwType; + + OS_TPrintf("[Wlan Firm] FWtype is %d\n", fwType); + + /* + FWDATAパラメータの正当性チェック(HotStartの場合) + FALSEならCold扱いでFWロードを行う。 + */ + if (TRUE == isHotStartWLFirm && FALSE == NWMi_CheckFirmDataParamIntegrity()) { + OS_TPrintf("[Wlan Firm] FirmDataParam doesn't exist.\n"); + OS_TPrintf("[Wlan Firm] Reinstall firmware as ColdStart.\n"); + isHotStartWLFirm = FALSE; + } + + s_isHotStartWLFirm = isHotStartWLFirm; + + /* HotStart/ColdStartのチェック */ + if (TRUE == isHotStartWLFirm) // HOT START + { + pNwmBuf = SYSM_Alloc( NWM_SYSTEM_BUF_SIZE ); + if (!pNwmBuf) { + OS_TWarning("Error: Couldn't allocate memory for NWM.\n"); + goto instfirm_error; + } + +#if (MEASURE_WIRELESS_INITTIME == 1) + startTick = OS_GetTick(); +#endif + + // HotStart + OS_TPrintf("[Wlan Firm] Start InstallFirmware (HOT START)\n"); + NWMi_InitForLauncher(pNwmBuf, NWM_SYSTEM_BUF_SIZE, 3); /* 3 -> DMA no. */ + err = NWMi_InstallFirmware(InstallFirmCallback, NULL, 0, FALSE); + + } else { // COLD START + s32 flen = 0; + char path[256]; + u32 fwOffset, fwLen, hdrLen; + u8 *pHash = NULL; + + // Get Filepath + if (FALSE == GetFirmwareFilepath(path)) { + goto instfirm_error; + } + + /* ------------------------------------ + Stage 1 -- Security Area の署名認証 + ------------------------------------ */ + + // Read Security area of WLAN firm + /* Allocate security area buffer from heap. */ + pSecBuf = SYSM_Alloc( NWM_FW_SECURITY_AREA_SIZE ); + + if (!pSecBuf) { + OS_TWarning("[Wlan Firm] Error: Couldn't allocate memory for Security Area.\n"); + goto instfirm_error; + } + + flen = ReadFirmwareSecurityArea(path, pSecBuf, NWM_FW_SECURITY_AREA_SIZE); + + if ( 0 >= flen ) + { + OS_TPrintf("[Wlan Firm] Error: Couldn't read wlan firmware security area.\n"); + goto instfirm_error; + } + + // Check signature data + if (FALSE == VerifyWlanfirmSignature(pSecBuf, (u32)flen)) + { + OS_TPrintf("[Wlan Firm] Error: This Wlan Firmware is quite illegal!\n"); + OS_TPrintf("[Wlan Firm] It has never been installed.\n"); + goto instfirm_error; + } + + /* ------------------------------------ + Stage 2 -- Header Area のHashチェック + ------------------------------------ */ + + hdrLen = ((NWMFirmSecurityArea*)pSecBuf)->hdrLen; + + /* Allocate header area buffer from heap. */ + pHdrBuf = SYSM_Alloc( hdrLen ); + + if (!pHdrBuf) { + OS_TWarning("[Wlan Firm] Error: Couldn't allocate memory for Header area.\n"); + goto instfirm_error; + } + + // Read header of WLAN firm + flen = ReadFirmwareHeader(path, pHdrBuf, (s32)hdrLen); + + if ( 0 >= flen ) + { + OS_TPrintf("[Wlan Firm] Error: Couldn't read wlan firmware header.\n"); + goto instfirm_error; + } + + pHash = (u8*)pSecBuf + SIGN_LENGTH; + + OS_TPrintf("[Wlan Firm] Check hash of Header Area.\n"); + if (FALSE == CheckHash((const u8*)pHash, (const u8*)pHdrBuf, hdrLen)) + { + OS_TPrintf("[Wlan Firm] Error: Header Hash data is illegal.\n"); + goto instfirm_error; + } + OS_TPrintf("[Wlan Firm] Header Area CheckHash ok.\n"); + + // Free Security area buffer + SYSM_Free( pSecBuf ); + pSecBuf = NULL; + + /* ------------------------------------ + Stage 3 -- FW image Area のHashチェック + ------------------------------------ */ + + // Find corresponding FW image + fwOffset = NWMi_GetFirmImageOffset(pHdrBuf, (u32)fwType); + fwLen = NWMi_GetFirmImageLength(pHdrBuf, (u32)fwType); + + if (fwOffset == 0 || fwLen == 0) { + OS_TPrintf("[Wlan Firm] Error: Couldn't get FW image.\n"); + goto instfirm_error; + } + + /* Allocate FW buffer from heap. */ + pFwBuffer = SYSM_Alloc( fwLen ); + if (!pFwBuffer) { + OS_TWarning("[Wlan Firm] Error: Couldn't allocate memory for FW image.\n"); + goto instfirm_error; + } + + // Read FW image + flen = ReadFirmwareBinary(path, fwOffset, pFwBuffer, (s32)fwLen); + + if ( 0 >= flen ) + { + OS_TPrintf("[Wlan Firm] Error: Couldn't read wlan firmware.\n"); + goto instfirm_error; + } + + // Compare hashes + pHash = NWMi_GetFirmImageHashAddress(pHdrBuf, (u32)fwType); + if (pHash == NULL) + { + OS_TPrintf("[Wlan Firm] Error: Couldn't get hash of wlan firmware image.\n"); + goto instfirm_error; + } + + OS_TPrintf("[Wlan Firm] Check hash of FW image.\n"); + if (FALSE == CheckHash((const u8*)pHash, (const u8*)pFwBuffer, fwLen)) + { + OS_TPrintf("[Wlan Firm] Error: FW image Hash data is illegal.\n"); + goto instfirm_error; + } + OS_TPrintf("[Wlan Firm] FW image CheckHash ok.\n"); + + // Free Header area buffer + SYSM_Free( pHdrBuf ); + pHdrBuf = NULL; + + pNwmBuf = SYSM_Alloc( NWM_SYSTEM_BUF_SIZE ); + if (!pNwmBuf) { + OS_TWarning("Error: Couldn't allocate memory for NWM.\n"); + goto instfirm_error; + } + + // Start FW installation + NWMi_InitForLauncher(pNwmBuf, NWM_SYSTEM_BUF_SIZE, 3); /* 3 -> DMA no. */ + +#if (MEASURE_WIRELESS_INITTIME == 1) + startTick = OS_GetTick(); +#endif + + OS_TPrintf("[Wlan Firm] Start InstallFirmware (COLD START)\n"); + err = NWMi_InstallFirmware(InstallFirmCallback, pFwBuffer, (u32)flen, TRUE); + + } + + // APIの実行結果が OPERATING 以外の場合、エラーとして処理する。 + if (err != NWM_RETCODE_OPERATING) + { + goto instfirm_error; + } + + /* + 無線ロード処理の完了は、IsWlanFirmwareInstalledでチェックする。 + */ + + return TRUE; + + /* エラー処理 */ +instfirm_error: + // Heapから確保した各バッファのクリア + + // Free Security area buffer + if (pSecBuf) + { + SYSM_Free( pSecBuf ); + pSecBuf = NULL; + } + // Free Header area buffer + if (pHdrBuf) + { + SYSM_Free( pHdrBuf ); + pHdrBuf = NULL; + } + + // Free firmware buffer + if (pFwBuffer) + { + SYSM_Free( pFwBuffer ); + pFwBuffer = NULL; + } + + // Free NWM buffer + if (pNwmBuf) + { + NWM_End(); + SYSM_Free( pNwmBuf ); + pNwmBuf = NULL; + } + + // インストール開始すらできなかった時は、FATALエラー +#ifdef SDK_RELEASE + PMi_SetWirelessLED( PM_WIRELESS_LED_OFF ); +#endif + s_isFinished = TRUE; + +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + UTL_SetFatalError( FATAL_ERROR_WLANFIRM_AUTH ); +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + return FALSE; +} + +static BOOL GetWlanFirmwareInstallResult(WLANFirmResult *pResult) +{ + OSMessage msg; + BOOL retval; + + retval = OS_ReadMessage(&mesq, &msg, OS_MESSAGE_NOBLOCK); + + *pResult = (WLANFirmResult)msg; + + return retval; +} + +// 無線ファームロード完了? +BOOL PollingInstallWlanFirmware( void ) +{ +#if defined(SYSM_DISABLE_WLFIRM_LOAD) + return TRUE; +#endif // SYSM_DISABLE_WLFIRM_LOAD + + if ( !s_isFinished ) { + WLANFirmResult result; + if( GetWlanFirmwareInstallResult( &result ) ) { + if( result == WLANFIRM_RESULT_SUCCESS ) { + OS_TPrintf( "WLFIRM load finished.\n" ); + s_result = result; + s_isFinished = TRUE; // 正常終了 + }else { + // ロード失敗 + if( !s_isHotStartWLFirm ) { + // ColdStartの無線ファームロードなら、FATALエラー +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + UTL_SetFatalError( FATAL_ERROR_WLANFIRM_LOAD ); +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST +#ifdef SDK_RELEASE + PMi_SetWirelessLED( PM_WIRELESS_LED_OFF ); +#endif + // ここがスレッドセーフでなかったため、s_isFinishedがTRUEになってから、s_isFinishedがTRUEになってから、s_resultがセットされる間に + // スレッドスイッチが発生して、他スレッドからPollingInstallWlanFirmware+GetWlanFirmwareInstallFinalResultをリードすると、 + // 前回のs_resultの値が取得されてしまっていた。 + // ここで、DSアプリからのHWリセット時は、HotStartに失敗してからColdスタートになるので、s_resultに一時的にFAILが入るが、 + // このタイミングで上記状態になると、ファームロードは成功しているのに失敗判定されてしまうことになる。 + s_result = result; + s_isFinished = TRUE; + }else { + // そうでない場合は、ColdStartロードで再度実行。 + (void)InstallWlanFirmware( FALSE ); + OS_TPrintf( "WLFIRM HotStart load failed... Start retry.\n" ); + } + } + + } + } + return s_isFinished; +} + + +WLANFirmResult GetWlanFirmwareInstallFinalResult( void ) +{ + return s_result; +} diff --git a/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.h b/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.h new file mode 100644 index 00000000..644d8765 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.h @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TWL_RED_IPL - + File: loadWlanFirm.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:: 2008-02-15#$ + $Rev: 677 $ + $Author: sato_masaki $ + *---------------------------------------------------------------------------*/ + +#ifndef __LAUNCHER_WIRELESS_H__ +#define __LAUNCHER_WIRELESS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + WLANFIRM_RESULT_UNFINISHED = 0, + WLANFIRM_RESULT_SUCCESS = 1, + WLANFIRM_RESULT_FAILURE = 2 +} WLANFirmResult; + +/* + + InstallWlanFirmware + + 引数 :BOOL isForceLoad : TRUE->強制ファームロード, FALSE->ファームロードせずリスタート + 返り値:TRUE … 無線ファームウェアインストールの非同期処理中 +     FALSE … 無線ファームウェアインストールに失敗した + */ + +BOOL InstallWlanFirmware( BOOL isHotStartWLFirm ); + + +/* + + PollingInstallWlanFirmware + + 引数 :なし + 返り値:TRUE … 無線ファームウェアインストール処理が完了 + FALSE … 無線ファームウェアインストール処理が未完了 + */ + +BOOL PollingInstallWlanFirmware( void ); + + +/* + + GetWlanFirmwareInstallFinalResult + + 引数 :なし + 返り値:WLANFIRM_RESULT_UNFINISHED … 無線ファームウェアインストール処理が未完了 + WLANFIRM_RESULT_SUCCESS … 無線ファームウェアインストール処理が成功 + WLANFIRM_RESULT_FAILURE … 無線ファームウェアインストール処理が失敗 + */ +WLANFirmResult GetWlanFirmwareInstallFinalResult( void ); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_WIRELESS_H__ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/main.c b/build/systemMenu_RED/Launcher/ARM9/src/main.c new file mode 100644 index 00000000..76a0e06a --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/main.c @@ -0,0 +1,779 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "launcher.h" +#include "misc.h" +#include "logoDemo.h" +#include "sound.h" +#include "loadWlanFirm.h" +#include "loadSharedFont.h" +#include "scanWDS.h" + +#include +#include +#include "getSysMenuVersion.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define INIT_DEVICES_LIKE_UIG_LAUNCHER + +// デバッグ用時間計測スイッチ +#define MEASURE_TIME 1 +#if ( MEASURE_TIME == 1 ) +#define MEASURE_START(tgt) ( tgt = OS_GetTick() ) +#define MEASURE_RESULT(tgt,str) OS_TPrintf( str, OS_TicksToMilliSeconds( OS_GetTick() - tgt ) ) +#else +#define MEASURE_START(tgt) ((void) 0) +#define MEASURE_RESULT(tgt,str) ((void) 0) +#endif + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); +static void deleteTmp(); +void SYSM_DeleteTempDirectory( TitleProperty *pBootTitle ); +static BOOL IsCommandSelected(void); +static void PrintPause(void); +static void PrintError(void); +static void PrintSystemMenuVersion( void ); +static void CreateDummyWrapFile( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- +static TitleProperty *sp_titleList; + +static u64 s_strmThreadStack[THREAD_STACK_SIZE / sizeof(u64)]; +static OSThread s_strmThread; +static StreamInfo s_strm; // stream info + +// const data------------------------------------------------------------------ + +const char filename[] = "data/fanfare.32.wav"; + +static const char *fatal_error_msg[FATAL_ERROR_MAX] = +{ + "UNDEFINED", + "NAND", + "HWINFO_NORMAL", + "HWINFO_SECURE", + "TWLSETTINGS", + "SHARED_FONT", + "WLANFIRM_AUTH", + "WLANFIRM_LOAD", + "TITLE_LOAD_FAILED", + "TITLE_POINTER_ERROR", + "AUTHENTICATE_FAILED", + "ENTRY_ADDRESS_ERROR", + "TITLE_BOOTTYPE_ERROR", + "SIGN_DECRYPTION_FAILED", + "SIGN_COMPARE_FAILED", + "HEADER_HASH_CALC_FAILED", + "TITLEID_COMPARE_FAILED", + "VALID_SIGN_FLAG_OFF", + "CHECK_TITLE_LAUNCH_RIGHTS_FAILED", + "MODULE_HASH_CHECK_FAILED", + "MODULE_HASH_CALC_FAILED", + "MEDIA_CHECK_FAILED", + "DL_MAGICCODE_CHECK_FAILED", + "DL_SIGN_DECRYPTION_FAILED", + "DL_HASH_CALC_FAILED", + "DL_SIGN_COMPARE_FAILED", + "WHITELIST_INITDB_FAILED", + "WHITELIST_NOTFOUND", + "DHT_PHASE1_FAILED", + "DHT_PHASE2_FAILED", + "LANDING_TMP_JUMP_FLAG_OFF", + "TWL_BOOTTYPE_UNKNOWN", + "NTR_BOOTTYPE_UNKNOWN", + "PLATFORM_UNKNOWN", + "LOAD_UNFINISHED", + "LOAD_OPENFILE_FAILED", + "LOAD_MEMALLOC_FAILED", + "LOAD_SEEKFILE_FAILED", + "LOAD_READHEADER_FAILED", + "LOAD_LOGOCRC_ERROR", + "LOAD_READDLSIGN_FAILED", + "LOAD_RELOCATEINFO_FAILED", + "LOAD_READMODULE_FAILED", + "NINTENDO_LOGO_CHECK_FAILED", + "SYSMENU_VERSION", + "DHT_PHASE1_CALC_FAILED", + "LOAD_UNKNOWN_BOOTTYPE", + "LOAD_AUTH_HEADER_FAILED", + "LOAD_NEVER_STARTED", + "EJECT_CARD_AFTER_LOAD_START", + "TITLEID_COMPARE_FAILED_NTR", + "DHT_PHASE3_FAILED", + "DHT_PHASE4_FAILED" +}; + +//#define DEBUG_LAUNCHER_DUMP +#ifdef DEBUG_LAUNCHER_DUMP +// デバグ用。SDに0x02ffc000から0x02ffe000までdump.datというダンプを吐く +static void debugWriteToSD( void ) +{ + FSFile dest; + FS_InitFile( &dest ); + (void)FS_CreateFile("sdmc:/dump.dat", FS_PERMIT_W | FS_PERMIT_R); + if ( !FS_OpenFileEx( &dest, "sdmc:/dump.dat", FS_FILEMODE_W ) ) return; + FS_WriteFile( &dest, (void *)0x02ffc000, 0x2000 ); + if ( !FS_CloseFile( &dest ) ) return; + OS_TPrintf( "debugWriteToSD:ok\n"); +} +#endif + +#ifdef INIT_DEVICES_LIKE_UIG_LAUNCHER + +static int CreateDspSlotBitmap(int slot_num) +{ + int i, bitmap; + bitmap = 0; + + for (i=0; iflags.isLogoSkip ) + { + SYSM_MakeNandTitleListMakerInfoAsync(); // アプリに引き渡すタイトルリスト作成用情報の作成 + }else + { + SYSM_MakeNandTitleListMakerInfo(); + } + } + // end時間計測5 + MEASURE_RESULT( start, "GetNandTitleList : %dms\n" ); + + // start時間計測6 + MEASURE_START(start); + + // 「ダイレクトブートでない」もしくは + // 「ダイレクトブートだが、ロゴデモ表示」の時、各種リソースのロード------------ +#ifndef SYSM_BUILD_FOR_PRODUCTION_TEST + if( !pBootTitle || + ( pBootTitle && !SYSM_IsLogoDemoSkip() ) ) { + u32 timestamp; + if( !LoadSharedFontInit() ) { // 共有フォントのロード + UTL_SetFatalError( FATAL_ERROR_SHARED_FONT ); + } + timestamp = OS_GetSharedFontTimestamp(); + if( timestamp > 0 ) OS_TPrintf( "SharedFont timestamp : %08x\n", timestamp ); + } +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + + // end時間計測6 + MEASURE_RESULT( start, "GetSharedFont : %dms\n" ); + + // 開始ステートの判定-------------- + + // start時間計測7 + MEASURE_START(start); + + if( pBootTitle ) { + // ダイレクトブートなら、ロゴ、ランチャーを飛ばしてロード開始 + if( pBootTitle->flags.isLogoSkip ) { + state = LOAD_START; + }else { + state = LOGODEMO_INIT; + } + direct_boot = TRUE; + }else if( SYSM_IsLogoDemoSkip() ) { + // ロゴデモスキップが指定されていたら、ランチャー起動 + state = LAUNCHER_INIT; + }else { + // 何もないなら、ロゴデモ起動 + state = LOGODEMO_INIT; + } + +// ランチャー画面を絶対表示しないバージョン + if( SYSM_IsLauncherHidden() ) + { + if(direct_boot == FALSE) + { + state = STOP; + }else + { + state = LOAD_START; + } + } + +#ifdef SYSM_BUILD_FOR_PRODUCTION_TEST + if( !pBootTitle || + ( pBootTitle && ( pBootTitle->flags.bootType != LAUNCHER_BOOTTYPE_ROM ) ) + ) { + state = STOP; + } +#endif // SYSM_BUILD_FOR_PRODUCTION_TEST + + // チャンネルをロックする + SND_LockChannel((1 << L_CHANNEL) | (1 << R_CHANNEL), 0); + + /* ストリームスレッドの起動 */ + OS_CreateThread(&s_strmThread, + StrmThread, + NULL, + s_strmThreadStack + THREAD_STACK_SIZE / sizeof(u64), + THREAD_STACK_SIZE, STREAM_THREAD_PRIO); + OS_WakeupThreadDirect(&s_strmThread); + + // end時間計測7 + MEASURE_RESULT( start, "time 7 (etc...) : %dms\n" ); + + // start時間計測8 + MEASURE_START(start); + + // 無線ファームウェアを無線モジュールにダウンロードする。 + if( FALSE == InstallWlanFirmware( SYSM_IsHotStart() ) ) { + OS_TPrintf( "ERROR: Wireless firmware download failed!\n" ); + } + + // end時間計測8 + MEASURE_RESULT( start, "Load WlanFirm Time : %dms\n" ); + + if( UTL_IsFatalError() ) { + // FATALエラー処理 + PrintError(); // エラー表示 + state = STOP; + goto MAIN_LOOP_START; // state を STOP にして強制的にメインループ開始 + } + + // end 時間計測total + MEASURE_RESULT( allstart, "Total Time : %dms\n" ); + +MAIN_LOOP_START: + + // メインループ-------------------- + while( 1 ) { + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + // ARM7コマンド応答受信 + while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) + { + } + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + switch( state ) { + case LOGODEMO_INIT: + LogoInit(); + // 音鳴らすテスト + FS_InitFile(&s_strm.file); + s_strm.isPlay = FALSE; + PlayStream(&s_strm, filename); + + state = LOGODEMO; + break; + case LOGODEMO: + if( IsFinishedLoadSharedFont() && // 通常ブート時は、フォントロード終了をここでチェック + LogoMain() && + SYSM_isNandTitleListReady() // NANDタイトル取得完了かどうかチェック + ) { + // :::::::::::::::::::::::::::::::::::::::::::::: + // SystemMenuバージョンetc.の読み込み + // :::::::::::::::::::::::::::::::::::::::::::::: + + // NANDタイトルリスト取得が完了した時点で、その情報をもとにSystemMenuVersionデータにアクセスするための制御情報をセットする。 + SYSM_SetSystemMenuVersionControlData(); + PrintSystemMenuVersion(); + + if( !direct_boot ) { + sp_titleList = SYSM_GetTitlePropertyList();// TitlePropertyListの取得 + state = LAUNCHER_INIT; + }else { + state = LOAD_START; + } + // ロゴデモが終了した場合は、HotBootフラグ抑制を解除する。 + OSi_SetEnableHotBoot( TRUE ); + } + break; + case LAUNCHER_INIT: + LauncherInit( NULL ); + state = LAUNCHER; + break; + case LAUNCHER: + pBootTitle = LauncherMain( sp_titleList ); + if( pBootTitle ) { + state = LOAD_START; + } + break; + case LOAD_START: + if( IsFinishedLoadSharedFont() // ダイレクトブートの時は、フォントロード終了をここでチェック + && PollingInstallWlanFirmware() +#ifndef SYSM_DISABLE_WDS_SCAN // アプリブート前にWDSスキャンは終了しておく必要がある + && ( WDS_WrapperStopScan() != WDSWRAPPER_ERRCODE_OPERATING ) +#endif // SYSM_DISABLE_WDS_SCAN + ) { + SYSM_StartLoadTitle( pBootTitle ); + state = LOADING; + start = OS_GetTick(); + // 念のため必ず通るパスでもショートカット起動、HotBootフラグ抑制を解除しておく。 + OSi_SetEnableHotBoot( TRUE ); + } + break; + case LOADING: + // ここでロード前ホワイトリストチェック失敗メッセージをポーリングし、受け取ったらstateをLOAD_PAUSEに + if( SYSM_IsLoadTitlePaused() ) + { + state = LOAD_PAUSE; + PrintPause(); + } + if( SYSM_IsLoadTitleFinished() ) { + SYSM_StartAuthenticateTitle( pBootTitle ); + state = AUTHENTICATE; + } + if( !direct_boot ) + { + (void)LauncherFadeout( sp_titleList ); // ダイレクトブートでないときはフェードアウトも行う + } + if( ( end == 0 ) && + SYSM_IsLoadTitleFinished() ) { + end = OS_GetTick(); + OS_TPrintf( "Load Time : %dms\n", OS_TicksToMilliSeconds( end - start ) ); + } + break; + case LOAD_PAUSE: + // ロード前ホワイトリストチェック失敗で一時停止中 + // 強制起動するか中止するかの選択がされたらLOADINGに戻る + if( IsCommandSelected() ) + { + state = LOADING; + } + break; + case AUTHENTICATE: + if( ( direct_boot || ( !direct_boot && LauncherFadeout( sp_titleList ) ) ) && + SYSM_IsAuthenticateTitleFinished() + ) { + // メインループ開始から検証終了までの間に起きたFATALの処理 + if( UTL_IsFatalError() ) { + // FATALエラー処理 + // [TODO:]クリアしたほうが良いデータ(鍵など)があれば消す + PrintError(); // エラー表示 + state = STOP; + break; // state を STOP にして break し、 Boot させない + } + +#ifndef SYSM_DISABLE_WDS_SCAN + // Nintendoスポットブート時は、アプリ間パラメータにビーコン情報をセットする。 + if( STD_CompareNString( (char *)&pBootTitle->titleID + 1, "JNH", 3 ) == 0 ) + { + (void)WDS_WrapperSetArgumentParam(); + } +#endif // SYSM_DISABLE_WDS_SCAN + + state = BOOT; + } + break; + case BOOT: +#ifndef SYSM_DISABLE_WDS_SCAN + // アプリブート前にWDSスキャンは終了しておく必要がある + if( ( WDS_WrapperCleanup() != WDSWRAPPER_ERRCODE_OPERATING ) && + IsClearnupWDSWrapper() ) +#endif // SYSM_DISABLE_WDS_SCAN + { + SYSM_TryToBootTitle( pBootTitle ); // never return. + } + break; + case STOP: // 停止 + OS_Terminate(); + break; + } + + // カードアプリリストの取得(スレッドで随時カード挿抜を通知されるものをメインループで取得) + { + BOOL changed; + sp_titleList = SYSM_GetCardTitleList( &changed ); + if( changed ) + { + OS_TPrintf( "Change CARD status.\n" ); + } + } + + // 無線ファームロードのポーリング + if( PollingInstallWlanFirmware() && + ( GetWlanFirmwareInstallFinalResult() == WLANFIRM_RESULT_SUCCESS ) // ロード成功 + ) { + // 下記条件を満たすなら、WDSスキャン開始 +#ifndef SYSM_DISABLE_WDS_SCAN + if( !isStartScanWDS && // WDSスキャン開始済みでない + !direct_boot && // ダイレクトブートでない + !LCFG_THW_IsForceDisableWireless() && // 無線強制OFFでない + LCFG_TSD_IsAvailableWireless() // 無線ON + ) { + InitializeWDS(); // 初期化と動作開始を兼ねている。(失敗しても止まりはしないので、気にしない) + isStartScanWDS = TRUE; + } +#endif // SYSM_DISABLE_WDS_SCAN + } + + // コマンドフラッシュ + (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + +#ifndef DISABLE_SLEEP + // スリープモードへの遷移 + //(無線ファームのロード完了はアプリ側でチェックしてもらう方針) + //(蓋開き状態とデバッガ接続中のキャンセルはデフォルトで行う) + if ( PollingInstallWlanFirmware() ) + { + UTL_GoSleepMode(); + } +#endif // DISABLE_SLEEP + } +} + +static BOOL IsCommandSelected(void) +{ + static BOOL left = FALSE; + if( !( pad.cont & ( PAD_BUTTON_A | PAD_BUTTON_B ) ) ) + { + left = TRUE; + } + + if( left && ( pad.trg & PAD_BUTTON_A ) ) + { + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PrintfSJIS( 1, 25, TXT_COLOR_RED,"Resume Loading....\n" ); + SYSM_ResumeLoadingThread( TRUE ); + left = FALSE; + return TRUE; + }else if( left && ( pad.trg & PAD_BUTTON_B ) ) + { + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PrintfSJIS( 1, 25, TXT_COLOR_RED,"Please Wait....\n" ); + SYSM_ResumeLoadingThread( FALSE ); + left = FALSE; + return TRUE; + } + return FALSE; +} + +static void PrintPause(void) +{ + LauncherInit( NULL ); + GX_SetVisiblePlane( GX_PLANEMASK_BG0 ); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + G2_ChangeBlendAlpha( 0, 31 ); + PrintfSJIS( 1, 25, TXT_COLOR_RED,"WhiteList Check Failed.\n" ); + PrintfSJIS( 1, 40, TXT_COLOR_RED,"Prease Select Command." ); + PrintfSJIS( 1, 55, TXT_COLOR_RED,"A : Force to Launch" ); + PrintfSJIS( 1, 70, TXT_COLOR_RED," or" ); + PrintfSJIS( 1, 85, TXT_COLOR_RED,"B : Stop And Show Error Message" ); + GX_DispOn(); + GXS_DispOn(); +} + +static void PrintError( void ) +{ + u64 error_code; + int l; + int count = 0; + LauncherInit( NULL ); + GX_SetVisiblePlane( GX_PLANEMASK_BG0 ); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + G2_ChangeBlendAlpha( 0, 31 ); + PrintfSJIS( 128, 0, TXT_COLOR_BLUE, "IPL:%s", g_strIPLSvnRevision ); + PrintfSJIS( 128, 12, TXT_COLOR_BLUE, "SDK:%s", g_strSDKSvnRevision ); + error_code = UTL_GetFatalError(); + PrintfSJIS( 2, 25, TXT_COLOR_RED,"ERROR! - 0x%016llx\n", error_code ); + ERRORLOG_Write(error_code); + for(l=0;l<64;l++) + { + if( error_code & 0x1 ) + { + PrintfSJIS( 2, 50+count*13, TXT_COLOR_RED,"%s\n", fatal_error_msg[l] ); + count++; + } + error_code = error_code >> 1; + } + GX_DispOn(); + GXS_DispOn(); +} + + +// システムメニューバージョンのプリント +static void PrintSystemMenuVersion( void ) +{ + u8 *pBuffer = SYSM_Alloc( NA_VERSION_DATA_WORK_SIZE ); + + if( pBuffer && + ReadSystemMenuVersionData( pBuffer, NA_VERSION_DATA_WORK_SIZE ) ) { + // リード成功 + }else { + // FATALエラー + UTL_SetFatalError( FATAL_ERROR_TWLSETTINGS ); + } + SYSM_Free( pBuffer ); + + // バージョン情報の表示 + { + char str_ver[ TWL_SYSMENU_VER_STR_LEN / sizeof(u16) ]; + int len = sizeof(str_ver); + MI_CpuClear8( str_ver, sizeof(str_ver) ); + OS_TPrintf( "SystemMenuVersionData\n" ); + // 文字列 + if( STD_ConvertStringUnicodeToSjis( str_ver, &len, GetSystemMenuVersionString(), NULL, NULL ) == STD_RESULT_SUCCESS ) { + OS_TPrintf( " Version(str) : %s\n", str_ver ); + } + // 数値 + OS_TPrintf( " Version(num) : %d.%d\n", GetSystemMenuMajorVersion(), GetSystemMenuMinorVersion() ); + // ユーザー領域MAXサイズの表示 + OS_TPrintf( " TotalUserAreadSize : 0x%08x\n", FSi_GetTotalUserAreaSize() ); + // EULA URLの表示 + OS_TPrintf( " EULA URL : %s\n", GetEULA_URL() ); + // NUP HostNameの表示 + OS_TPrintf( " NUP HostName : %s\n", GetNUP_HostName() ); + // SystemMenuVersion情報のタイムスタンプの取得 + OS_TPrintf( " Timestamp : %08x\n", GetSystemMenuVersionTimeStamp() ); + } +} + + +// ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの) +static void CreateDummyWrapFile( void ) +{ + const char *path = "nand:/shared2/launcher/wrap.bin"; + + if( FS_CreateFileAuto( path, FS_PERMIT_R | FS_PERMIT_W ) ) { + FSFile file; + if( FS_OpenFileEx( &file, path, FS_FILEMODE_RW ) ) { + (void)FS_SetFileLength( &file, 16 * 1024 ); + FS_CloseFile( &file ); + } + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.c b/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.c new file mode 100644 index 00000000..c4d0327f --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.c @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: scanWDS.c + + Copyright 2007 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 "scanWDS.h" + +#define WDS_THREAD_PRIO 15 +#define WDS_DMA_NO 3 + +char *callbackstring[] = { + "WDSWRAPPER_CALLBACK_INITIALIZE", + "WDSWRAPPER_CALLBACK_CLEANUP", + "WDSWRAPPER_CALLBACK_STARTSCAN", + "WDSWRAPPER_CALLBACK_STARTSCAN2", + "WDSWRAPPER_CALLBACK_STOPSCAN", +}; + +static BOOL s_isStarted = FALSE; +static BOOL s_isClearnup = FALSE; + +// WDSWrapper終了? +BOOL IsClearnupWDSWrapper( void ) +{ + if( s_isStarted ) { + return s_isClearnup; + }else { + return TRUE; + } +} + + +// WDSWrapper用コールバック関数 +void Callback_WDSWrapper( void *ptr ) +{ + WDSWrapperCallbackParam *callback = (WDSWrapperCallbackParam *)ptr; + WDS_PRINTF("Callback_WDSWrapper: %s %d ", callbackstring[callback->callback], callback->errcode ); + + switch( callback->callback ) { + case WDSWRAPPER_CALLBACK_INITIALIZE: + s_isStarted = TRUE; + s_isClearnup = FALSE; + break; + case WDSWRAPPER_CALLBACK_STARTSCAN2: + // n秒間隔のビーコン間欠スキャン一回分が完了 + // ビーコンを受け取っていないという結果が出た場合、強調表示を消します + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_FAILURE ) + WDS_PRINTF( "強調表示を消します" ); + else { + WDS_PRINTF( "強調表示をつけます" ); + } + break; + case WDSWRAPPER_CALLBACK_STARTSCAN: + // n秒間隔のビーコン間欠スキャン一回分が完了 + // ビーコンを受け取っている場合のみ強調表示を付けます + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_SUCCESS ) + WDS_PRINTF( "強調表示をつけます" ); + break; + case WDSWRAPPER_CALLBACK_STOPSCAN: + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_FAILURE ) + OS_TPrintf( "強調表示を消します" ); + else { + OS_TPrintf( "強調表示をつけます" ); + } + break; + case WDSWRAPPER_CALLBACK_CLEANUP: + s_isStarted = FALSE; + s_isClearnup = TRUE; + break; + } + + WDS_PRINTF( "\n" ); +} + +// Sleepコールバック関数 +void Callback_WDSPreSleep( void *ptr ) +{ +#pragma unused( ptr ) + WDS_WrapperCleanup(); + while ( WDS_WrapperCheckThreadRunning() == WDSWRAPPER_ERRCODE_SUCCESS ) + { + OS_Sleep( 100 ); + } +} + +void Callback_WDSPostSleep( void *ptr ) +{ +#pragma unused( ptr ) + WDSWrapperInitializeParam param; + + // WDSWrapper初期化と動作開始 + param.threadprio = WDS_THREAD_PRIO; + param.dmano = WDS_DMA_NO; + param.callback = Callback_WDSWrapper; + param.alloc = SYSM_Alloc; + param.free = SYSM_Free; + (void)WDS_WrapperInitialize( param ); +} + +// 初期化関数 +void InitializeWDS( void ) +{ + static BOOL isInitialized = FALSE; + + { + WDSWrapperInitializeParam param; + param.threadprio = WDS_THREAD_PRIO; + param.dmano = WDS_DMA_NO; + param.callback = Callback_WDSWrapper; + param.alloc = SYSM_Alloc; + param.free = SYSM_Free; + (void)WDS_WrapperInitialize( param ); // 初期化と動作開始を兼ねている。(失敗しても止まりはしないので、気にしない) + } + + if ( ! isInitialized ) + { + static PMSleepCallbackInfo preCbInfo; + static PMSleepCallbackInfo postCbInfo; + PM_SetSleepCallbackInfo( &preCbInfo, Callback_WDSPreSleep, NULL ); + PM_PrependPreSleepCallback( &preCbInfo ); + PM_SetSleepCallbackInfo( &postCbInfo, Callback_WDSPostSleep, NULL ); + PM_AppendPostSleepCallback( &postCbInfo ); + } + isInitialized = TRUE; +} + diff --git a/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.h b/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.h new file mode 100644 index 00000000..773a4bc7 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/scanWDS.h @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: scanWDS.h + + Copyright 2007 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 __SCAN_WDS_H__ +#define __SCAN_WDS_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- +//#define ENABLE_WDS_PRINTF 1 + +// global variables-------------------------------------------------- + +// function---------------------------------------------------------- +void InitializeWDS( void ); +BOOL IsClearnupWDSWrapper( void ); +void Callback_WDSWrapper( void *ptr ); +void Callback_WDSPreSleep( void *ptr ); +void Callback_WDSPostSleep( void *ptr ); + +#ifdef ENABLE_WDS_PRINTF +#define WDS_PRINTF OS_TPrintf +#else +#define WDS_PRINTF(...) ((void) 0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __SCAN_WDS_H__ diff --git a/build/systemMenu_RED/Launcher/ARM9/src/sound.c b/build/systemMenu_RED/Launcher/ARM9/src/sound.c new file mode 100644 index 00000000..1f0efc25 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/sound.c @@ -0,0 +1,349 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: sound.c + + Copyright 2007 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 "sound.h" + +static BOOL ReadWaveFormat(StreamInfo * strm); +static void ReadStrmData(StreamInfo * strm); +static void SoundAlarmHandler(void *arg); +static void VBlankIntr(void); + +static u16 Cont; +static u16 Trg; +static OSMessageQueue msgQ; +static OSMessage msgBuf[1]; + +static u8 strm_lbuf[STRM_BUF_SIZE] ATTRIBUTE_ALIGN(32); +static u8 strm_rbuf[STRM_BUF_SIZE] ATTRIBUTE_ALIGN(32); +static u8 strm_tmp[STRM_BUF_PAGESIZE * 2] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: PlayStream + + Description: ストリーム再生を再生 + + Arguments: strm - ストリームオブジェクト + filename - ストリーム再生するファイル名 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PlayStream(StreamInfo * strm, const char *filename) +{ + int timerValue; + u32 alarmPeriod; + + // 再生中であれば停止する + if (strm->isPlay) + { + u32 tag; + StopStream(strm); + tag = SND_GetCurrentCommandTag(); + (void)SND_FlushCommand(SND_COMMAND_NOBLOCK | SND_COMMAND_IMMEDIATE); + SND_WaitForCommandProc(tag); // 停止を待つ + } + + // ファイル走査 + if (FS_IsFile(&strm->file)) + (void)FS_CloseFile(&strm->file); + if ( ! FS_OpenFile(&strm->file, filename) ) { + OS_Panic("Error: failed to open file %s\n", filename); + } + if (!ReadWaveFormat(strm)) + { + OS_Panic("Error: failed to read wavefile\n"); + } + + strm->isPlay = TRUE; + + /* パラメータ設定 */ + timerValue = SND_TIMER_CLOCK / strm->format.sampleRate; + alarmPeriod = timerValue * STRM_BUF_PAGESIZE / 32U; + alarmPeriod /= (strm->format.bitPerSample == 16) ? sizeof(s16) : sizeof(s8); + + // 初期ストリームデータ読み込み + (void)FS_SeekFile(&strm->file, (s32)strm->beginPos, FS_SEEK_SET); + strm->bufPage = 0; + ReadStrmData(strm); + ReadStrmData(strm); + + // チャンネルとアラームをセットアップ + SND_SetupChannelPcm(L_CHANNEL, + (strm->format.bitPerSample == + 16) ? SND_WAVE_FORMAT_PCM16 : SND_WAVE_FORMAT_PCM8, strm_lbuf, + SND_CHANNEL_LOOP_REPEAT, 0, STRM_BUF_SIZE / sizeof(u32), 127, + SND_CHANNEL_DATASHIFT_NONE, timerValue, 0); + SND_SetupChannelPcm(R_CHANNEL, + (strm->format.bitPerSample == + 16) ? SND_WAVE_FORMAT_PCM16 : SND_WAVE_FORMAT_PCM8, + (strm->format.channels == 1) ? strm_lbuf : strm_rbuf, + SND_CHANNEL_LOOP_REPEAT, 0, STRM_BUF_SIZE / sizeof(u32), 127, + SND_CHANNEL_DATASHIFT_NONE, timerValue, 127); + SND_SetupAlarm(ALARM_NUM, alarmPeriod, alarmPeriod, SoundAlarmHandler, strm); + SND_StartTimer((1 << L_CHANNEL) | (1 << R_CHANNEL), 0, 1 << ALARM_NUM, 0); +} + +/*---------------------------------------------------------------------------* + Name: StopStream + + Description: ストリーム再生を停止 + + Arguments: strm - ストリームオブジェクト + + Returns: None. + *---------------------------------------------------------------------------*/ +void StopStream(StreamInfo * strm) +{ + SND_StopTimer((1 << L_CHANNEL) | (1 << R_CHANNEL), 0, 1 << ALARM_NUM, 0); + if (FS_IsFile(&strm->file)) + (void)FS_CloseFile(&strm->file); + strm->isPlay = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: StrmThread + + Description: ストリームスレッド + + Arguments: arg - ユーザーデータ(未使用) + + Returns: None. + *---------------------------------------------------------------------------*/ +void StrmThread(void * /*arg */ ) +{ + OSMessage message; + + OS_InitMessageQueue(&msgQ, msgBuf, 1); + + while (1) + { + (void)OS_ReceiveMessage(&msgQ, &message, OS_MESSAGE_BLOCK); + (void)ReadStrmData((StreamInfo *) message); + } +} + +/*---------------------------------------------------------------------------* + Name: SoundAlarmHandler + + Description: アラームコールバック関数 + + Arguments: arg - ストリームオブジェクト + + Returns: None. + *---------------------------------------------------------------------------*/ +static void SoundAlarmHandler(void *arg) +{ + (void)OS_SendMessage(&msgQ, (OSMessage)arg, OS_MESSAGE_NOBLOCK); +} + +/*---------------------------------------------------------------------------* + Name: ReadStrmData + + Description: ストリームデータ読み込み関数 + ファイルからバッファの1ページ分のストリームデータを読み込む + + Arguments: strm - ストリームオブジェクト + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadStrmData(StreamInfo * strm) +{ + int i; + s32 readSize; + u8 *lbuf, *rbuf; + + // ストリームが終端に達している + if (strm->dataSize <= 0) + { + StopStream(strm); + return; + } + + // バッファのページ設定 + if (strm->bufPage == 0) + { + lbuf = strm_lbuf; + rbuf = strm_rbuf; + strm->bufPage = 1; + } + else + { + lbuf = strm_lbuf + STRM_BUF_PAGESIZE; + rbuf = strm_rbuf + STRM_BUF_PAGESIZE; + strm->bufPage = 0; + } + + // データ読み込み + if (strm->format.channels == 1) + { + // モノラル + readSize = FS_ReadFile(&strm->file, + strm_tmp, + (strm->dataSize < + STRM_BUF_PAGESIZE) ? strm->dataSize : STRM_BUF_PAGESIZE); + if (readSize == -1) + OS_Panic("read file end\n"); + + if (strm->format.bitPerSample == 16) + { + // 16bitデータ + for (i = 0; i < readSize / sizeof(s16); i++) + { + ((s16 *)lbuf)[i] = ((s16 *)strm_tmp)[i]; + } + for (; i < STRM_BUF_PAGESIZE / sizeof(s16); i++) + { + ((s16 *)lbuf)[i] = 0; // ストリームの終端に達した場合、残りを0で埋める + } + } + else + { + // 8bitデータ + for (i = 0; i < readSize / sizeof(s8); i++) + { + ((s8 *)lbuf)[i] = (s8)((s16)strm_tmp[i] - 128); + } + for (; i < STRM_BUF_PAGESIZE / sizeof(s8); i++) + { + ((s8 *)lbuf)[i] = 0; + } + } + } + else + { + // ステレオ + readSize = FS_ReadFile(&strm->file, + strm_tmp, + (strm->dataSize < + STRM_BUF_PAGESIZE * 2) ? strm->dataSize : STRM_BUF_PAGESIZE * 2); + if (readSize == -1) + OS_Panic("read file end\n"); + + if (strm->format.bitPerSample == 16) + { + // 16bitデータ + for (i = 0; i < (readSize / 2) / sizeof(s16); i++) + { + ((s16 *)lbuf)[i] = ((s16 *)strm_tmp)[2 * i]; + ((s16 *)rbuf)[i] = ((s16 *)strm_tmp)[2 * i + 1]; + } + for (; i < STRM_BUF_PAGESIZE / sizeof(s16); i++) + { + ((s16 *)lbuf)[i] = 0; + ((s16 *)rbuf)[i] = 0; + } + } + else + { + // 8bitデータ + for (i = 0; i < (readSize / 2) / sizeof(s8); i++) + { + ((s8 *)lbuf)[i] = (s8)((s16)strm_tmp[2 * i] - 128); + ((s8 *)rbuf)[i] = (s8)((s16)strm_tmp[2 * i + 1] - 128); + } + for (; i < STRM_BUF_PAGESIZE / sizeof(s8); i++) + { + ((s8 *)lbuf)[i] = 0; + ((s8 *)rbuf)[i] = 0; + } + } + } + + strm->dataSize -= readSize; + + return; +} + + +/*---------------------------------------------------------------------------* + Name: ReadWaveFormat + + Description: WAVEフォーマットのデータのヘッダとデータ列の先頭位置、データサイズを取得 + + Arguments: strm - ストリームオブジェクト + + Returns: 読み取りに成功したらTRUE、失敗したらFALSE + *---------------------------------------------------------------------------*/ +static BOOL ReadWaveFormat(StreamInfo * strm) +{ + u32 tag; + s32 size; + BOOL fFmt = FALSE, fData = FALSE; + + (void)FS_SeekFileToBegin(&strm->file); + + (void)FS_ReadFile(&strm->file, &tag, 4); + if (tag != FOURCC_RIFF) + return FALSE; + + (void)FS_ReadFile(&strm->file, &size, 4); + + (void)FS_ReadFile(&strm->file, &tag, 4); + if (tag != FOURCC_WAVE) + return FALSE; + + while (size > 0) + { + s32 chunkSize; + if (FS_ReadFile(&strm->file, &tag, 4) == -1) + { + return FALSE; + } + if (FS_ReadFile(&strm->file, &chunkSize, 4) == -1) + { + return FALSE; + } + + switch (tag) + { + case FOURCC_fmt: + if (FS_ReadFile(&strm->file, (u8 *)&strm->format, chunkSize) == -1) + { + return FALSE; + } + fFmt = TRUE; + break; + case FOURCC_data: + strm->beginPos = FS_GetPosition(&strm->file); + strm->dataSize = chunkSize; + (void)FS_SeekFile(&strm->file, chunkSize, FS_SEEK_CUR); + fData = TRUE; + break; + default: + (void)FS_SeekFile(&strm->file, chunkSize, FS_SEEK_CUR); + break; + } + if (fFmt && fData) + { + return TRUE; // fmt と data を読み終えたら強制終了 + } + + size -= chunkSize; + } + + if (size != 0) + return FALSE; + return TRUE; +} + +//-------------------------------------------------------------------------------- +// Vブランク割り込み処理 +// +static void VBlankIntr(void) +{ + // 割り込みチェックフラグ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} diff --git a/build/systemMenu_RED/Launcher/ARM9/src/sound.h b/build/systemMenu_RED/Launcher/ARM9/src/sound.h new file mode 100644 index 00000000..353da4d0 --- /dev/null +++ b/build/systemMenu_RED/Launcher/ARM9/src/sound.h @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: sound.h + + Copyright 2007 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 __LAUNCHER_SOUND_H__ +#define __LAUNCHER_SOUND_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- + +#define MAKE_FOURCC(cc1, cc2, cc3, cc4) (u32)((cc1) | (cc2 << 8) | (cc3 << 16) | (cc4 << 24)) + +#define FOURCC_RIFF MAKE_FOURCC('R', 'I', 'F', 'F') +#define FOURCC_WAVE MAKE_FOURCC('W', 'A', 'V', 'E') +#define FOURCC_fmt MAKE_FOURCC('f', 'm', 't', ' ') +#define FOURCC_data MAKE_FOURCC('d', 'a', 't', 'a') + +#define L_CHANNEL 4 +#define R_CHANNEL 5 +#define ALARM_NUM 0 +#define STREAM_THREAD_PRIO 12 +#define THREAD_STACK_SIZE 1024 +#define STRM_BUF_PAGESIZE 1024*32 +#define STRM_BUF_SIZE STRM_BUF_PAGESIZE*2 + +// WAVフォーマットヘッダ +typedef struct WaveFormat +{ + u16 format; + u16 channels; + s32 sampleRate; + u32 dataRate; + u16 blockAlign; + u16 bitPerSample; +} +WaveFormat; + +// ストリームオブジェクト +typedef struct StreamInfo +{ + FSFile file; + WaveFormat format; + u32 beginPos; + s32 dataSize; + u32 bufPage; + BOOL isPlay; +} +StreamInfo; + +// global variables-------------------------------------------------- + +// function---------------------------------------------------------- + +void PlayStream(StreamInfo * strm, const char *filename); +void StopStream(StreamInfo * strm); +void StrmThread(void *arg); + + +#ifdef __cplusplus +} +#endif + +#endif // __LAUNCHER_H__ diff --git a/build/systemMenu_RED/Launcher/Makefile b/build/systemMenu_RED/Launcher/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_RED/Launcher/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/Launcher/banner/Makefile b/build/systemMenu_RED/Launcher/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_RED/Launcher/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_RED/Launcher/banner/banner_v3.bsf b/build/systemMenu_RED/Launcher/banner/banner_v3.bsf new file mode 100644 index 00000000..975188c4 Binary files /dev/null and b/build/systemMenu_RED/Launcher/banner/banner_v3.bsf differ diff --git a/build/systemMenu_RED/Launcher/banner/icon/gameIcon.bmp b/build/systemMenu_RED/Launcher/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..da2dda86 Binary files /dev/null and b/build/systemMenu_RED/Launcher/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_RED/MachineSettings/ARM9/Makefile b/build/systemMenu_RED/MachineSettings/ARM9/Makefile new file mode 100644 index 00000000..0bdeca14 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/Makefile @@ -0,0 +1,116 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - SystemMenuRED - MachineSettings +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = \ + $(ROOT)/build/libraries/os/ARM9.TWL/Makefile.sharedFont + +#---------------------------------------------------------------------------- + + +# COMPILE SWITCH ※最終ROM作成時は、全てFALSEにセットする。 +SYSM_OUTSIDE_UI ?= FALSE + +# MAKEROM SWITCH ※最終ROM作成時は、TRUEにする +SYSM_DISABLE_DEBUG ?= FALSE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TARGET_CODEGEN ?= THUMB +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +#※RED本体設定はデバッガ対応の都合上、TITLEID_LO=HNAA, CARD_REGION=ALLとしています。 +# UIG本体設定では、リージョンに合わせてTITLEID_LO, CARD_REGIONを設定してください。 +################################################################## +TITLEID_LO = HNBA +CARD_REGION = ALL +################################################################## + +TARGET_BIN = $(TITLEID_LO).tad + +ROM_HEADER_DIR = $(SYSMENU_ROOT)/RomHeader/$(TITLEID_LO) +SMALL_TITLEID = $(shell echo $(TITLEID_LO) | tr '[A-Z]' '[a-z]' ) +ROM_HEADER_TEMPLATE = $(ROM_HEADER_DIR)/rom_header_$(SMALL_TITLEID).template.sbin +LIBSYSCALL = $(ROM_HEADER_DIR)/libsyscall.a + +ROM_SPEC = main.rsf + +MISC_DIR = ../../misc + +BG_DIR = ../../data + +SRCS = main.c MachineSetting.c \ + setRTC.c selectLanguage.c calibrationTP.c setOwnerInfo.c selectCountry.c \ + setParentalControl.c setFreeSoftBox.c setWireless.c cleanupMachine.c \ + setEULA.c getSysMenuVersion.c \ + CountryNameMappingData.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c \ + $(BG_DIR)/BGData_MachineSettings.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +MAKETAD_OPTION += -s + +# libsysmenu.a は、RED本体設定でSVNのリビジョンを取得するためだけに使用しているので、 +# UIG本体設定でリンクする必要はありません。 +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(SYSM_OUTSIDE_UI),TRUE) +MACRO_FLAGS += -DOUTSIDE_UI +endif + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo_SYSMENU/$(TWL_BUILDTYPE_ARM7)/armadillo_SYSMENU +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/MachineSettings/ARM9/main.rsf b/build/systemMenu_RED/MachineSettings/ARM9/main.rsf new file mode 100644 index 00000000..b605daea --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/main.rsf @@ -0,0 +1,229 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # +################################################################ + + WramMapping MAP_TS_SCR + +################################################################ + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion $(CARD_REGION) + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # NANDAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、アプリジャンプされた際にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile FALSE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/CountryNameMappingData.c b/build/systemMenu_RED/MachineSettings/ARM9/src/CountryNameMappingData.c new file mode 100644 index 00000000..87e1ed7f --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/CountryNameMappingData.c @@ -0,0 +1,302 @@ +#include "misc.h" + +const u16 *const s_pStrCountryName[] = { + (const u16 *)L"UNDEFINED", + (const u16 *)L"JAPAN", // 日本 + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // USAリージョン + (const u16 *)L"Anguilla", // アンギラ + (const u16 *)L"ANTIGUA_AND_BARBUDA", // アンティグア・バーブーダ + (const u16 *)L"ARGENTINA", // アルゼンチン + (const u16 *)L"ARUBA", // アルバ + (const u16 *)L"BAHAMAS", // バハマ + (const u16 *)L"BARBADOS", // バルバドス + (const u16 *)L"BELIZE", // ベリーズ + (const u16 *)L"BOLIVIA", // ボリビア + (const u16 *)L"BRAZIL", // ブラジル + (const u16 *)L"BRITISH_VIRGIN_ISLANDS", // 英領ヴァージン諸島 + (const u16 *)L"CANADA", // カナダ + (const u16 *)L"CAYMAN_ISLANDS", // ケイマン諸島 + (const u16 *)L"CHILE", // チリ + (const u16 *)L"COLOMBIA", // コロンビア + (const u16 *)L"COSTA_RICA", // コスタリカ + (const u16 *)L"DOMINICA", // ドミニカ国 + (const u16 *)L"DOMINICAN_REPUBLIC", // ドミニカ共和国 + (const u16 *)L"ECUADOR", // エクアドル + (const u16 *)L"EL_SALVADOR", // エルサルバドル + (const u16 *)L"FRENCH_GUIANA", // フランス領ギアナ + (const u16 *)L"GRENADA", // グレナダ + (const u16 *)L"GUADELOUPE", // グアドループ + (const u16 *)L"GUATEMALA", // グアテマラ + (const u16 *)L"GUYANA", // ガイアナ + (const u16 *)L"HAITI", // ハイチ + (const u16 *)L"HONDURAS", // ホンジュラス + (const u16 *)L"JAMAICA", // ジャマイカ + (const u16 *)L"MARTINIQUE", // マルティニーク + (const u16 *)L"MEXICO", // メキシコ + (const u16 *)L"MONTSERRAT", // モントセラト + (const u16 *)L"NETHERLANDS_ANTILLES", // オランダ領アンティル + (const u16 *)L"NICARAGUA", // ニカラグア + (const u16 *)L"PANAMA", // パナマ + (const u16 *)L"PARAGUAY", // パラグアイ + (const u16 *)L"PERU", // ペルー + (const u16 *)L"ST_KITTS_AND_NEVIS", // セントキッツ・ネイビス + (const u16 *)L"ST_LUCIA", // セントルシア + (const u16 *)L"ST_VINCENT(略)GRENADINES", // セントビンセント・グレナディーン + (const u16 *)L"SURINAME", // スリナム + (const u16 *)L"TRINIDAD_AND_TOBAGO", // トリニダード・トバゴ + (const u16 *)L"TURKS_AND_CAICOS_ISLANDS", // タークス・カイコス諸島 + (const u16 *)L"UNITED_STATES", // アメリカ + (const u16 *)L"URUGUAY", // ウルグアイ + (const u16 *)L"US_VIRGIN_ISLANDS", // 米領バージン諸島 + (const u16 *)L"VENEZUELA", // ベネズエラ + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // EUR", NAL リージョン + (const u16 *)L"ALBANIA", // アルバニア + (const u16 *)L"AUSTRALIA", // オーストラリア + (const u16 *)L"AUSTRIA", // オーストリア + (const u16 *)L"BELGIUM", // ベルギー + (const u16 *)L"BOSNIA_AND_HERZEGOVINA", // ボスニア・ヘルツェゴビナ + (const u16 *)L"BOTSWANA", // ボツワナ + (const u16 *)L"BULGARIA", // ブルガリア + (const u16 *)L"CROATIA", // クロアチア + (const u16 *)L"CYPRUS", // キプロス + (const u16 *)L"CZECH_REPUBLIC", // チェコ + (const u16 *)L"DENMARK", // デンマーク + (const u16 *)L"ESTONIA", // エストニア + (const u16 *)L"FINLAND", // フィンランド + (const u16 *)L"FRANCE", // フランス + (const u16 *)L"GERMANY", // ドイツ + (const u16 *)L"GREECE", // ギリシャ + (const u16 *)L"HUNGARY", // ハンガリー + (const u16 *)L"ICELAND", // アイスランド + (const u16 *)L"IRELAND", // アイルランド + (const u16 *)L"ITALY", // イタリア + (const u16 *)L"LATVIA", // ラトビア + (const u16 *)L"LESOTHO", // レソト + (const u16 *)L"LIECHTENSTEIN", // リヒテンシュタイン + (const u16 *)L"LITHUANIA", // リトアニア + (const u16 *)L"LUXEMBOURG", // ルクセンブルク + (const u16 *)L"MACEDONIA", // マケドニア + (const u16 *)L"MALTA", // マルタ + (const u16 *)L"MONTENEGRO", // モンテネグロ + (const u16 *)L"MOZAMBIQUE", // モザンビーク + (const u16 *)L"NAMIBIA", // ナミビア + (const u16 *)L"NETHERLANDS", // オランダ + (const u16 *)L"NEW_ZEALAND", // ニュージーランド + (const u16 *)L"NORWAY", // ノルウェー + (const u16 *)L"POLAND", // ポーランド + (const u16 *)L"PORTUGAL", // ポルトガル + (const u16 *)L"ROMANIA", // ルーマニア + (const u16 *)L"RUSSIA", // ロシア + (const u16 *)L"SERBIA", // セルビア + (const u16 *)L"SLOVAKIA", // スロバキア + (const u16 *)L"SLOVENIA", // スロベニア + (const u16 *)L"SOUTH_AFRICA", // 南アフリカ + (const u16 *)L"SPAIN", // スペイン + (const u16 *)L"SWAZILAND", // スワジランド + (const u16 *)L"SWEDEN", // スウェーデン + (const u16 *)L"SWITZERLAND", // スイス + (const u16 *)L"TURKEY", // トルコ + (const u16 *)L"UNITED_KINGDOM", // イギリス + (const u16 *)L"ZAMBIA", // ザンビア + (const u16 *)L"ZIMBABWE", // ジンバブエ + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // TWNリージョン + (const u16 *)L"TAIWAN", // 台湾 + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // KORリージョン + (const u16 *)L"SOUTH_KOREA", // 韓国 + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // HKGリージョン(Wiiの国リストに存在) + (const u16 *)L"HONG_KONG", // ホンコン + (const u16 *)L"MACAU", // マカオ + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // ASIリージョン(Wiiの国リストに存在) + (const u16 *)L"INDONESIA", // インドネシア + + // USAリージョン + (const u16 *)L"SINGAPORE", // シンガポール + + // ASIリージョン(再び) + (const u16 *)L"THAILAND", // タイ + (const u16 *)L"PHILIPPINES", // フィリピン + (const u16 *)L"MALAYSIA", // マレーシア + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // 未定義リージョン(IQueリージョン?) + (const u16 *)L"CHINA", // 中国 + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + // USAリージョン + (const u16 *)L"UAE", // アラブ首長国連邦 + + // 未定義リージョン + (const u16 *)L"INDIA", // インド + (const u16 *)L"EGYPT", // エジプト + (const u16 *)L"OMAN", // オマーン + (const u16 *)L"QATAR", // カタール + (const u16 *)L"KUWAIT", // クウェート + (const u16 *)L"SAUDI_ARABIA", // サウジアラビア + (const u16 *)L"SYRIA", // シリア + (const u16 *)L"BAHRAIN", // バーレーン + (const u16 *)L"JORDAN", // ヨルダン + + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//180 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//190 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//200 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//210 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//220 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//230 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//240 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY",//250 + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + (const u16 *)L"DUMMY", + + (const u16 *)L"OTHERS", + (const u16 *)L"UNKNOWN" +}; + +const u32 region_country_mapping[OS_TWL_REGION_MAX] = +{ + LCFG_TWL_COUNTRY_MAPPING_JAPAN, + LCFG_TWL_COUNTRY_MAPPING_AMERICA, + LCFG_TWL_COUNTRY_MAPPING_EUROPE, + LCFG_TWL_COUNTRY_MAPPING_AUSTRALIA, + LCFG_TWL_COUNTRY_MAPPING_CHINA, + LCFG_TWL_COUNTRY_MAPPING_KOREA +}; \ No newline at end of file diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c new file mode 100644 index 00000000..75687c21 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c @@ -0,0 +1,388 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mainMenu.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ + + // キャンセルボタンLCD領域 +#define CANCEL_BUTTON_TOP_X ( 12 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + 5 * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + 2 * 8 ) + // OKボタンLCD領域 +#define OK_BUTTON_TOP_X ( 22 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + 2 * 8 ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + 2 * 8 ) + +// メインメニューの項目数(※ピクトチャット起動テストは除いておく) +#ifdef OUTSIDE_UI +#define SETTING_MENU_ELEMENT_NUM 5 // 社外用 +#else // !OUTSIDE_UI +#define SETTING_MENU_ELEMENT_NUM 10 // 社内用 +#endif // OUTSIDE_UI + +// extern data------------------------------------------ + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static u16 s_csr = 0; +static const u16 *s_pStrSetting[ SETTING_MENU_ELEMENT_NUM ]; // メインメニュー用文字テーブルへのポインタリスト + +// const data ----------------------------------------- + + +//=============================================== +// mainMenu.c +//=============================================== +static const u16 *const s_pStrSettingElemTbl[ SETTING_MENU_ELEMENT_NUM ][ LCFG_TWL_LANG_CODE_MAX ] = { + { + (const u16 *)L"言語", + (const u16 *)L"LANGUAGE", + (const u16 *)L"LANGUAGE(F)", + (const u16 *)L"LANGUAGE(G)", + (const u16 *)L"LANGUAGE(I)", + (const u16 *)L"LANGUAGE(S)", + (const u16 *)L"LANGUAGE(C)", + (const u16 *)L"LANGUAGE(K)", + }, + { + (const u16 *)L"日付 & 時刻", + (const u16 *)L"DATE & TIME", + (const u16 *)L"DATE & TIME(F)", + (const u16 *)L"DATE & TIME(G)", + (const u16 *)L"DATE & TIME(I)", + (const u16 *)L"DATE & TIME(S)", + (const u16 *)L"DATE & TIME(C)", + (const u16 *)L"DATE & TIME(K)", + }, + { + (const u16 *)L"ユーザー情報", + (const u16 *)L"USER INFORMATION", + (const u16 *)L"USER INFORMATION(F)", + (const u16 *)L"USER INFORMATION(G)", + (const u16 *)L"USER INFORMATION(I)", + (const u16 *)L"USER INFORMATION(S)", + (const u16 *)L"USER INFORMATION(C)", + (const u16 *)L"USER INFORMATION(K)", + }, + { + (const u16 *)L"タッチパネル補正", + (const u16 *)L"TOUCH PANEL", + (const u16 *)L"TOUCH PANEL(F)", + (const u16 *)L"TOUCH PANEL(G)", + (const u16 *)L"TOUCH PANEL(I)", + (const u16 *)L"TOUCH PANEL(S)", + (const u16 *)L"TOUCH PANEL(C)", + (const u16 *)L"TOUCH PANEL(K)", + }, + { + (const u16 *)L"無線設定", + (const u16 *)L"WIRELESS", + (const u16 *)L"WIRELESS(F)", + (const u16 *)L"WIRELESS(G)", + (const u16 *)L"WIRELESS(I)", + (const u16 *)L"WIRELESS(S)", + (const u16 *)L"WIRELESS(C)", + (const u16 *)L"WIRELESS(K)", + }, +#ifndef OUTSIDE_UI + { + (const u16 *)L"本体のクリーンアップ", + (const u16 *)L"MACHINE CLEAN UP", + (const u16 *)L"MACHINE CLEAN UP(F)", + (const u16 *)L"MACHINE CLEAN UP(G)", + (const u16 *)L"MACHINE CLEAN UP(I)", + (const u16 *)L"MACHINE CLEAN UP(S)", + (const u16 *)L"MACHINE CLEAN UP(C)", + (const u16 *)L"MACHINE CLEAN UP(K)", + }, + { + (const u16 *)L"国設定", + (const u16 *)L"COUNTRY", + (const u16 *)L"COUNTRY(F)", + (const u16 *)L"COUNTRY(G)", + (const u16 *)L"COUNTRY(I)", + (const u16 *)L"COUNTRY(S)", + (const u16 *)L"COUNTRY(C)", + (const u16 *)L"COUNTRY(K)", + }, + { + (const u16 *)L"ペアレンタルコントロール", + (const u16 *)L"PARENTAL CONTROL", + (const u16 *)L"PARENTAL CONTROL(F)", + (const u16 *)L"PARENTAL CONTROL(G)", + (const u16 *)L"PARENTAL CONTROL(I)", + (const u16 *)L"PARENTAL CONTROL(S)", + (const u16 *)L"PARENTAL CONTROL(C)", + (const u16 *)L"PARENTAL CONTROL(K)", + }, + { + (const u16 *)L"EULA", + (const u16 *)L"EULA", + (const u16 *)L"EULA(F)", + (const u16 *)L"EULA(G)", + (const u16 *)L"EULA(I)", + (const u16 *)L"EULA(S)", + (const u16 *)L"EULA(C)", + (const u16 *)L"EULA(K)", + }, + { + (const u16 *)L"フリーソフトBOX", + (const u16 *)L"FREESOFT BOX", + (const u16 *)L"FREESOFT BOX(F)", + (const u16 *)L"FREESOFT BOX(G)", + (const u16 *)L"FREESOFT BOX(I)", + (const u16 *)L"FREESOFT BOX(S)", + (const u16 *)L"FREESOFT BOX(C)", + (const u16 *)L"FREESOFT BOX(K)", + }, +#endif // OUTSIE_UI +#if 0 + { + (const u16 *)L"ピクトチャット起動テスト", + (const u16 *)L"PICTOCHAT", + (const u16 *)L"PICTOCHAT(F)", + (const u16 *)L"PICTOCHAT(G)", + (const u16 *)L"PICTOCHAT(I)", + (const u16 *)L"PICTOCHAT(S)", + (const u16 *)L"PICTOCHAT(C)", + (const u16 *)L"PICTOCHAT(K)", + }, +#endif +}; + +static MenuPos s_settingPos[] = { + { TRUE, 4 * 8, 2 * 8 }, + { TRUE, 4 * 8, 4 * 8 }, + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 4 * 8, 16 * 8 }, + { TRUE, 4 * 8, 18 * 8 }, + { TRUE, 4 * 8, 20 * 8 }, +}; + + +static const MenuParam s_settingParam = { + SETTING_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[ 0 ], + (const u16 **)&s_pStrSetting, +}; + +//====================================================== +// メインメニュー +//====================================================== + +// メインメニューの初期化 +void MachineSettingInit( void ) +{ + int i; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + PrintfSJIS( 0, 0, TXT_COLOR_BLUE, "MACHINE SETTINGS IPL:%s SDK:%s", g_strIPLSvnRevision, g_strSDKSvnRevision ); + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i = 0; i < SETTING_MENU_ELEMENT_NUM; i++ ) { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + ChangeUserColor( LCFG_TSD_GetUserColor() ); + DrawMenu( s_csr, &s_settingParam ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + g_pNowProcess = MachineSettingMain; +} + +// メインメニュー +int MachineSettingMain( void ) +{ + BOOL tp_select; + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++s_csr == SETTING_MENU_ELEMENT_NUM ) { + s_csr=0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_csr & 0x80 ) { + s_csr=SETTING_MENU_ELEMENT_NUM - 1; + } + } + tp_select = SelectMenuByTP( &s_csr, &s_settingParam ); + DrawMenu( s_csr, &s_settingParam ); + +#if 0 + if( pad.trg & PAD_BUTTON_START ) { + OS_DoApplicationJump( NULL, OS_APP_JUMP_NORMAL ); + u8 *pBuffer = Alloc( LCFG_READ_TEMP ); + g_isValidTSD = FALSE; + if( pBuffer) { + g_isValidTSD = LCFG_ReadTWLSettings( (u8 (*)[ LCFG_READ_TEMP ] )pBuffer ); + Free( pBuffer ); + if( g_isValidTSD ) { + OS_TPrintf( "TSD Read succeeded.\n" ); + }else { + OS_TPrintf( "TSD Read failed.\n" ); + PrintfSJIS( 0, 22*8, TXT_COLOR_RED, "TSD Read failed.\n" ); + } + } + } +#endif + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( s_settingPos[ s_csr ].enable ) { + switch( s_csr ) { + case 0: + SelectLanguageInit(); + g_pNowProcess = SelectLanguageMain; + break; + case 1: + SetRTCInit(); + g_pNowProcess = SetRTCMain; + break; + case 2: + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + break; + case 3: + TP_CalibrationInit(); + g_pNowProcess = TP_CalibrationMain; + break; + case 4: + SetWirelessInit(); + g_pNowProcess = SetWirelessMain; + break; + case 5: + CleanupMachineInit(); + g_pNowProcess = CleanupMachineMain; + break; + case 6: + SelectCountryInit(); + g_pNowProcess = SelectCountryMain; + break; + case 7: + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + break; + case 8: + SetEULAInit(); + g_pNowProcess = SetEULAMain; + break; + case 9: + SetFreeSoftBoxInit(); + g_pNowProcess = SetFreeSoftBoxMain; + break; + } + } + } + + // とりあえずバックライト輝度変更をここで確認。 + if( pad.trg & PAD_BUTTON_R) { + u8 brightness; + (void)UTL_GetBacklightBrightness( &brightness ); + if( ++brightness > BACKLIGHT_BRIGHTNESS_MAX ) { + brightness = BACKLIGHT_BRIGHTNESS_MAX; + } + (void)UTL_SetBacklightBrightness( brightness ); + } + if( pad.trg & PAD_BUTTON_L ) { + u8 brightness; + (void)UTL_GetBacklightBrightness( &brightness ); + if( --brightness < 0 ) { + brightness = 0; + } + (void)UTL_SetBacklightBrightness( brightness ); + } + return 0; +} + + +// OK / CANCELボタンの描画 +void DrawOKCancelButton(void) +{ + (void)PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL"); + (void)PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"OK"); +} + + +// OK or CANCELボタン押下チェック +void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel) +{ + *tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); + *tp_ok = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp ); +} + + +//--------------------------------------------------------- +// +// 設定終了 +// +//--------------------------------------------------------- + + +// 本体設定データのライト +BOOL MY_WriteTWLSettings( void ) +{ + BOOL retval = FALSE; + u8 *pBuffer = Alloc( LCFG_WRITE_TEMP ); + if( pBuffer != NULL ) { + // *********************************************************** + // RED本体設定では、初回起動シーケンスもフラッシュ壊れシーケンスもないので、とりあえず何でも設定したらシーケンスを終了するようにする。 + LCFG_TSD_SetFlagFinishedInitialSetting( TRUE ); + LCFG_TSD_SetFlagFinishedInitialSetting_Launcher( TRUE ); + LCFG_TSD_SetFlagFinishedBrokenTWLSettings( TRUE ); + // *********************************************************** + + retval = LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + Free( pBuffer ); + } + return retval; +} diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.h b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.h new file mode 100644 index 00000000..74f53bb4 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.h @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: MachineSetting.h + + Copyright 2007 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 __MACHINE_SETTING_H__ +#define __MACHINE_SETTING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + + +// define data---------------------------------------------------------- +#define TP_CSR_TOUCH_COUNT 2 // TPカーソルのチャタリング吸収のためのカウント値 +#define TP_CSR_DETACH_COUNT 2 // TPカーソルを「選択」と判定するTPデタッチからのカウント値 + +#define HANDLE_MENU 48 +#define HANDLE_RTC_VIEW 240 +#define HANDLE_OK_BUTTON 255 +#define HANDLE_CANCEL_BUTTON 256 + +// 数値入力インターフェース用ワーク(void InputDecimal()で使用) +typedef struct InputNumParam { + u16 pos_x; // 入力値の表示X位置 + u16 pos_y; // 〃     Y位置 + int up_count; + int down_count; + int keta_max; // 最大桁 + int value_min; // 入力値の最小 + int value_max; // 入力値の最大 + int y_offset; // タッチパネル入力の基準位置からのYオフセット +}InputNumParam; + +// global variable------------------------------------------------------ +extern NNSFndAllocator g_allocator; +extern int (*g_pNowProcess)( void ); +extern BOOL g_isValidTSD; + +// function------------------------------------------------------------- +extern void MachineSettingInit( void ); +extern int MachineSettingMain( void ); +extern void SetOwnerInfoInit( void ); +extern int SetOwnerInfoMain( void ); +extern void SetRTCInit( void ); +extern int SetRTCMain( void ); +extern void SelectLanguageInit( void ); +extern int SelectLanguageMain( void ); +extern void TP_CalibrationInit( void ); +extern int TP_CalibrationMain( void ); +extern void SelectRegionInit( void ); +extern int SelectRegionMain( void ); +extern void SelectCountryInit( void ); +extern int SelectCountryMain( void ); +extern void SetParentalControlInit( void ); +extern int SetParentalControlMain( void ); +extern void SetWirelessInit( void ); +extern int SetWirelessMain( void ); +extern void SetFreeSoftBoxInit( void ); +extern int SetFreeSoftBoxMain( void ); +extern void CleanupMachineInit( void ); +extern int CleanupMachineMain( void ); +extern void SetEULAInit( void ); +extern int SetEULAMain( void ); + +extern void DrawOKCancelButton( void ); +extern void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel); +extern void InputDecimal(int *tgtp, InputNumParam *inpp); + +extern void ClearRTC( void ); +extern BOOL MY_WriteTWLSettings( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __MACHINE_SETTING_H__ diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c b/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c new file mode 100644 index 00000000..116f6e9a --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/calibrationTP.c @@ -0,0 +1,530 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: calibrationTP.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ + // OKボタンLCD領域 +#define OK_BUTTON_TOP_X ( 2 * 8 ) +#define OK_BUTTON_TOP_Y ( 20 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + 8 * 8 ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + 4 * 8 ) + + // キャンセルボタンLCD領域 +#define CANCEL_BUTTON_TOP_X ( 11 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 20 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + 8 * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + 4 * 8 ) + + // リトライボタンLCD領域 +#define RETRY_BUTTON_TOP_X ( 20 * 8 ) +#define RETRY_BUTTON_TOP_Y ( 20 * 8 ) +#define RETRY_BUTTON_BOTTOM_X ( RETRY_BUTTON_TOP_X + 8 * 8 ) +#define RETRY_BUTTON_BOTTOM_Y ( RETRY_BUTTON_TOP_Y + 4 * 8 ) + + // キャリブレーション用OBJデータ +const u16 bitmapOBJPoint[8 * 8 * 5]; + + // 各種キャラクタデータサイズ +#define IMAGE_DATA (bitmapOBJPoint) +#define IMAGE_DATA_SIZE (sizeof(bitmapOBJPoint)) +#define MY_CHAR_SIZE (sizeof(myChar)) + + // NITRO-LCDサイズ +#define DISP_X_SIZE 256 +#define DISP_Y_SIZE 192 + +enum { + INIT=0, + INTERVAL_0, + CALIBRATE_1, + INTERVAL_1, + CALIBRATE_2, + INTERVAL_2, + CHECK_PARAM, + INTERVAL_3, + GET_POINT +}; + + // キャリブレーション設定ワーク +typedef struct CalibWork { + u32 seq; + u16 release_count; + u16 touch_count; + u16 last_x; + u16 last_y; + TPData sample[2]; + LCFGTWLTPCalibData calibTemp; +}CalibWork; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static void DisplayInit(); +static BOOL GetSamplePointNow(TPData *data); +static BOOL WaitPanelReleaseNow( void ); +static void ReturnMenu(void); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static CalibWork *s_pTPC; +static GXOamAttr s_oamBak[ 128 ] ATTRIBUTE_ALIGN(32); // OAM バックアップ + +// const data ----------------------------------------- + +//====================================================== +// function's description +//====================================================== + +/*---------------------------------------------------------------------------* + Name: SetPoint8x8 + + Description: Display a 8x8 OBJ on indicated point. + + Arguments: x - position X. + y - position Y. + + Returns: None. + *---------------------------------------------------------------------------*/ +static inline void SetPoint8x8(u16 pos_x, u16 pos_y) +{ + G2_SetOBJAttr( &s_oamBak[0], // OAM number + pos_x - 4, // X position + pos_y - 4, // Y position + 0, // Priority + GX_OAM_MODE_BITMAPOBJ, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_8x8, // 8x8 size + GX_OAM_COLOR_16, // 16 color + 0x60, // charactor + 15, // alpha + 0); +} + + +/*---------------------------------------------------------------------------* + Name: SetPoint16x16 + + Description: Display a 16x16 OBJ on indicated point. + + Arguments: x - position X. + y - position Y. + + Returns: None. + *---------------------------------------------------------------------------*/ +static inline void SetPoint16x16(u16 pos_x, u16 pos_y) +{ + G2_SetOBJAttr( &s_oamBak[0], // OAM number + pos_x - 8, // X position + pos_y - 8, // Y position + 0, // Priority + GX_OAM_MODE_BITMAPOBJ, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_16x16, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 0x61, // charactor + 15, // alpha + 0); +} + + +/*---------------------------------------------------------------------------* + Name: DisplayInit + + Description: Graphics Initialization + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DisplayInit() +{ + MI_CpuClearFast( (void *)HW_OAM, 0x20 ); + MI_CpuClearFast( s_oamBak, sizeof(s_oamBak) ); + GX_SetOBJVRamModeBmp( GX_OBJVRAMMODE_BMP_1D_128K ); // 2D mapping OBJ + /* Load charactor bitmap data */ + GX_LoadOBJ( (const void *)IMAGE_DATA, 0x3000 /* 0 */, IMAGE_DATA_SIZE ); // Transfer OBJ bitmap data to VRAM +} + + +/*---------------------------------------------------------------------------* + Name: GetSamplePointNow + + Description: Get touched point by OneTime Sampling. + This function use TP_RequestSampling() and TP_WaitRawResult() + + Arguments: None. + + Returns: data - getton TouchPanel data. + BOOL - if touched and got point this function returns TRUE. + else FALSE. + *---------------------------------------------------------------------------*/ +static BOOL GetSamplePointNow(TPData *data) +{ + TPData temp; + + enum { + OK_COUNT = 4, OK_RANGE = 50 + }; + + // Detect a point pushed during definite time. + while (TP_RequestRawSampling( &temp )) { }; + + if (! temp.touch ) { + s_pTPC->touch_count = 0; + return FALSE; + } + + if ( temp.validity != TP_VALIDITY_VALID ) { + s_pTPC->touch_count = 0; + return FALSE; + } + + OS_Printf("( %d, %d )\n", temp.x, temp.y); + + s_pTPC->touch_count++; + if ( s_pTPC->touch_count == 1 ) { + s_pTPC->last_x = temp.x; + s_pTPC->last_y = temp.y; + return FALSE; + } + + // if jump point from last frame, reset count. + if ( (s32)(s_pTPC->last_x - temp.x) < - OK_RANGE || + (s32)(s_pTPC->last_x - temp.x) > OK_RANGE ) + { + s_pTPC->touch_count = 1; + s_pTPC->last_x = temp.x; + s_pTPC->last_y = temp.y; + return FALSE; + } + + if ( (s32)(s_pTPC->last_y - temp.y) < - OK_RANGE || + (s32)(s_pTPC->last_y - temp.y) > OK_RANGE ) + { + s_pTPC->touch_count = 1; + s_pTPC->last_x = temp.x; + s_pTPC->last_y = temp.y; + return FALSE; + } + + // if the point pressed during OK_COUNT, detect finish. + if ( s_pTPC->touch_count == OK_COUNT ) { + data->x = (u16) ( (temp.x + s_pTPC->last_x) / 2 ); + data->y = (u16) ( (temp.y + s_pTPC->last_y) / 2 ); + data->touch = TP_TOUCH_ON; + data->validity = TP_VALIDITY_VALID; + s_pTPC->touch_count=0; + return TRUE; + } + + s_pTPC->last_x = temp.x; + s_pTPC->last_y = temp.y; + return FALSE; +} + + +/*---------------------------------------------------------------------------* + Name: WaitPanelReleaseNow + + Description: Wait to released TouchPanel, using OneTime Sampling. + This function is using TP_RequestSampling() and TP_WaitRawResult(). + + Arguments: None. + + Returns: BOOL - if TouchPanel is released , this returns TRUE. + else FALSE. + + *---------------------------------------------------------------------------*/ +static BOOL WaitPanelReleaseNow( void ) +{ + TPData temp; + + enum { + INTERVAL_CNT = 10 + }; + + while (TP_RequestRawSampling( &temp )) { + SVC_WaitByLoop(0x400); + }; + + if ( temp.touch ) { + s_pTPC->release_count = 0; + return FALSE; + } + + s_pTPC->release_count++; + if ( s_pTPC->release_count >= INTERVAL_CNT ) { + s_pTPC->release_count = 0; + return TRUE; + } else { + return FALSE; + } +} + + +/*---------------------------------------------------------------------------* + Name: TP_Calibration + + Description: Initialization and main loop + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +int TP_CalibrationMain( void ) +{ + BOOL tp_ok = FALSE; + BOOL tp_cancel = FALSE; + BOOL tp_retry = FALSE; + + switch (s_pTPC->seq) { + case INIT: + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, + 0 * 8 , 20 * 8, 32 * 8, 4 * 8 ); + s_pTPC->seq = INTERVAL_0; + PutStringUTF16( 2 * 8, 21 * 8, TXT_COLOR_CYAN, (const u16 *)L"[B]:CANCEL" ); + break; + + case INTERVAL_0: + // wait release TouchPanel + if ( WaitPanelReleaseNow() ) { + s_pTPC->seq = CALIBRATE_1; + } + break; + + case CALIBRATE_1: + // detect first point. + SetPoint8x8( 32, 32 ); + if ( GetSamplePointNow( &s_pTPC->sample[ 0 ] ) ) { + OS_Printf( "OK! ( %d, %d )\n", s_pTPC->sample[0].x, s_pTPC->sample[0].y ); + s_pTPC->seq = INTERVAL_1; + } + break; + + case INTERVAL_1: + // wait release TouchPanel + if ( WaitPanelReleaseNow() ) { + s_pTPC->seq = CALIBRATE_2; + } + break; + + case CALIBRATE_2: + // detect second point. + SetPoint8x8( DISP_X_SIZE - 32, DISP_Y_SIZE - 32 ); + if ( GetSamplePointNow( &s_pTPC->sample[ 1 ] ) ) { + TPCalibrateParam calibrate; + + OS_Printf( "OK! ( %d, %d )\n", s_pTPC->sample[1].x, s_pTPC->sample[1].y ); + // Calculate and set calibration parameter from two detected point. + (void)TP_CalcCalibrateParam( + &calibrate, + s_pTPC->sample[0].x, s_pTPC->sample[0].y, 32, 32, + s_pTPC->sample[1].x, s_pTPC->sample[1].y, DISP_X_SIZE - 32, DISP_Y_SIZE - 32 ); + TP_SetCalibrateParam( &calibrate ); + + OS_Printf( "Calibrate param: \n" ); + OS_Printf( "\tx = %d, xDotSize = %d\n", calibrate.x0, calibrate.xDotSize / 0x100 ); + OS_Printf( "\ty = %d, yDotSize = %d\n", calibrate.y0, calibrate.yDotSize / 0x100 ); + OS_Printf( "Check calibrate param\n" ); + + s_pTPC->seq = INTERVAL_2; + } + break; + + case INTERVAL_2: + // Wait release TouchPanel + if ( WaitPanelReleaseNow() ) { + s_pTPC->seq = CHECK_PARAM; + } + break; + + case CHECK_PARAM: + // Verify Calibrattion Parameter. + SetPoint8x8( DISP_X_SIZE / 2, DISP_Y_SIZE / 2 ); + if ( GetSamplePointNow( &tpd.raw ) ) { + TP_GetUnCalibratedPoint( &tpd.disp.x, &tpd.disp.y, DISP_X_SIZE / 2, DISP_Y_SIZE / 2 ); + s_pTPC->seq = GET_POINT; + + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_NULL, + 2 * 8 , 21 * 8, 10 * 8, 2 * 8 ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L" OK "); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L" CANCEL "); + PutStringUTF16( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L" RETRY "); + PutStringUTF16( OK_BUTTON_TOP_X + 2 * 8, OK_BUTTON_TOP_Y + 2 * 8, TXT_COLOR_CYAN, (const u16 *)L"[A]"); + PutStringUTF16( CANCEL_BUTTON_TOP_X + 2 * 8, CANCEL_BUTTON_TOP_Y + 2 * 8, TXT_COLOR_CYAN, (const u16 *)L"[B]"); + PutStringUTF16( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y + 2 * 8, TXT_COLOR_CYAN, (const u16 *)L"[START]"); + { + s32 xRange, yRange; + xRange = tpd.raw.x - tpd.disp.x; + yRange = tpd.raw.y - tpd.disp.y; + OS_TPrintf( "OK! ( %d, %d )\n", tpd.raw.x, tpd.raw.y ); + OS_TPrintf( "Raw ( %d, %d )\n", tpd.disp.x, tpd.disp.y ); + OS_TPrintf( "\txRange = %d, yRange = %d\n", xRange, yRange ); + } + } + break; + + case GET_POINT: + // Draw Marker by calibrated point. + while ( TP_RequestRawSampling( &tpd.raw ) ) { + SVC_WaitByLoop( 0x400 ); + } + TP_GetCalibratedPoint( &tpd.disp, &tpd.raw ); + + if ( tpd.raw.touch ) { + SetPoint16x16( tpd.disp.x, tpd.disp.y ); + + // [OK] [CANCEL] [RETRY]ボタン押下チェック + tp_ok = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp ); + tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); + tp_retry = WithinRangeTP( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y, + RETRY_BUTTON_BOTTOM_X, RETRY_BUTTON_BOTTOM_Y, &tpd.disp ); + + if( tpd.raw.validity==TP_VALIDITY_VALID ) { + OS_TPrintf( "( %3d, %3d ) -> ( %4d, %4d )\n", tpd.disp.x, tpd.disp.y, tpd.raw.x, tpd.raw.y ); + } + } + + if( ( pad.trg & PAD_BUTTON_A ) || tp_ok ) { + s_pTPC->calibTemp.data.raw_x1 = s_pTPC->sample[0].x; + s_pTPC->calibTemp.data.raw_y1 = s_pTPC->sample[0].y; + s_pTPC->calibTemp.data.dx1 = 32; + s_pTPC->calibTemp.data.dy1 = 32; + s_pTPC->calibTemp.data.raw_x2 = s_pTPC->sample[1].x; + s_pTPC->calibTemp.data.raw_y2 = s_pTPC->sample[1].y; + s_pTPC->calibTemp.data.dx2 = DISP_X_SIZE - 32; + s_pTPC->calibTemp.data.dy2 = DISP_Y_SIZE - 32; + + LCFG_TSD_SetTPCalibration( &s_pTPC->calibTemp ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + + ReturnMenu(); + return 0; + }else if( ( pad.trg & PAD_BUTTON_START ) || tp_retry ) { + s_pTPC->seq = INIT; + } + break; + } + + /* flush cache of OAM buffers to main memory */ + DC_FlushRange( s_oamBak, sizeof(s_oamBak) ); + GX_LoadOAM( s_oamBak, 0, sizeof(s_oamBak) ); + MI_DmaFill32( 3, s_oamBak, 192, sizeof(s_oamBak) ); // Clear OAM buffer + + // Bボタンキャンセル + if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ){ + // キャリブレーションを設定前の状態に戻す。 + { + TPCalibrateParam calibrate; + LCFG_TSD_GetTPCalibration( &s_pTPC->calibTemp ); + (void)TP_CalcCalibrateParam( + &calibrate, + s_pTPC->calibTemp.data.raw_x1, s_pTPC->calibTemp.data.raw_y1, (u16)s_pTPC->calibTemp.data.dx1, (u16)s_pTPC->calibTemp.data.dy1, + s_pTPC->calibTemp.data.raw_x2, s_pTPC->calibTemp.data.raw_y2, (u16)s_pTPC->calibTemp.data.dx2, (u16)s_pTPC->calibTemp.data.dy2 ); + TP_SetCalibrateParam( &calibrate ); + } + ReturnMenu(); + return 0; + } + + return 0; +} + + +// メニューに戻る +static void ReturnMenu( void ) +{ + // キャリブレーション用変数の開放 + Free( s_pTPC ); + s_pTPC = NULL; + OS_Printf("Free :CalibWork\n"); + MachineSettingInit(); +} + + +// キャリブレーション設定の初期化 +void TP_CalibrationInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"TOUCH PANEL CALIBRATION" ); + + DisplayInit(); + + s_pTPC = Alloc( sizeof(CalibWork) ); // キャリブレーション用変数の確保 + if( s_pTPC == NULL ) { + OS_Panic("ARM9- Fail to allocate memory...\n"); + } + SVC_CpuClear( 0x0000, s_pTPC, sizeof(CalibWork), 16 ); + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + s_pTPC->seq = INIT; +} + + +// タッチパネル設定ポイント キャラデータ +const u16 bitmapOBJPoint[8 * 8 * 5] = { + 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, // 0 char + 0xFC00, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0xFC00, // 0 char + 0xFC00, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0xFC00, // 0 char + 0xFC00, 0xFC00, 0xFC00, 0x801F, 0x801F, 0xFC00, 0xFC00, 0xFC00, // 0 char + 0xFC00, 0xFC00, 0xFC00, 0x801F, 0x801F, 0xFC00, 0xFC00, 0xFC00, // 0 char + 0xFC00, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0xFC00, // 0 char + 0xFC00, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0xFC00, // 0 char + 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, // 0 char + + 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, // 1 char + 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, // 1 char + 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, // 1 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 1 char + + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 2 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 2 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 2 char + 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x801F, 0x801F, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, // 2 char + + 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x801F, 0x801F, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, // 3 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 3 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 3 char + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 3 char + + 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 4 char + 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, // 4 char + 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, // 4 char + 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, // 4 char +}; + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/cleanupMachine.c b/build/systemMenu_RED/MachineSettings/ARM9/src/cleanupMachine.c new file mode 100644 index 00000000..133c7cd7 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/cleanupMachine.c @@ -0,0 +1,310 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: cleanupMachine.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// NANDの初期化処理(擬似フォーマット) +// +// <例外処理> +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// 戻るボタン領域 +#define RETURN_BUTTON_TOP_X ( 2 * 8 ) +#define RETURN_BUTTON_TOP_Y ( 21 * 8 ) +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + (8 * 8) ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// YES/NOボタン領域 +#define YES_BUTTON_TOP_X ( 8 * 8 ) +#define YES_BUTTON_TOP_Y ( 8 * 8 ) +#define YES_BUTTON_BOTTOM_X ( YES_BUTTON_TOP_X + (3 * 8) ) +#define YES_BUTTON_BOTTOM_Y ( YES_BUTTON_TOP_Y + (2 * 8) ) +#define NOT_BUTTON_TOP_X ( 18 * 8 ) +#define NOT_BUTTON_TOP_Y ( 8 * 8 ) +#define NOT_BUTTON_BOTTOM_X ( NOT_BUTTON_TOP_X + (2 * 8) ) +#define NOT_BUTTON_BOTTOM_Y ( NOT_BUTTON_TOP_Y + (2 * 8) ) + +#define KEY_OK 0xffff +#define KEY_RETURN 0xfffe +#define KEY_YES 0xfffd +#define KEY_NOT 0xfffc + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +typedef enum +{ + MS_FORMATMACHINE_SELECT, // ユーザ選択中 + MS_FORMATMACHINE_PROCESSING, // 処理中 + MS_FORMATMACHINE_ERROR, // エラー発生 + MS_FORMATMACHINE_SUCCESS // 成功 +} eState; +static BOOL sbInit = FALSE; // 初期化するかどうか +static eState sState = MS_FORMATMACHINE_SELECT; // 現在の実行状態 + +// const data----------------------------------- + +// ++ メインメニュー + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +// 戻るボタン専用SelectSomethingFuncの実装 +static BOOL SelectReturnFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, + RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_RETURN; + return ret; +} + +// OKボタン専用SelectSomethingFuncの実装 +static BOOL SelectOKFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OK; + return ret; +} + +// ON/OFFボタン専用SelectSomethingFuncの実装 +static BOOL SelectYESFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( YES_BUTTON_TOP_X, YES_BUTTON_TOP_Y, + YES_BUTTON_BOTTOM_X, YES_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_YES; + return ret; +} +static BOOL SelectNOTFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( NOT_BUTTON_TOP_X, NOT_BUTTON_TOP_Y, + NOT_BUTTON_BOTTOM_X, NOT_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_NOT; + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawCleanupMachineScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"MACHINE CLEAN UP" ); + + PutStringUTF16( 4*8, 4*8, TXT_COLOR_BLUE, (const u16 *)L"Start Cleaning?" ); + if( sbInit ) + { + PutStringUTF16( YES_BUTTON_TOP_X-1*8, YES_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L">YES<" ); + PutStringUTF16( NOT_BUTTON_TOP_X-1*8, NOT_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L" NO" ); + } + else + { + PutStringUTF16( YES_BUTTON_TOP_X-1*8, YES_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L" YES" ); + PutStringUTF16( NOT_BUTTON_TOP_X-1*8, NOT_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L">NO<" ); + } + + // 実行状況によって表示が異なる + switch( sState ) + { + case MS_FORMATMACHINE_SELECT: + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + break; + + case MS_FORMATMACHINE_PROCESSING: + PutStringUTF16( 4*8, 12*8, TXT_COLOR_GREEN, (const u16*)L"In Processing..." ); + break; + + case MS_FORMATMACHINE_ERROR: + PutStringUTF16( 4*8, 12*8, TXT_UCOLOR_G0, (const u16*)L"In Processing..." ); + PutStringUTF16( 4*8, 14*8, TXT_COLOR_RED, (const u16*)L"ERROR!" ); + PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + break; + + case MS_FORMATMACHINE_SUCCESS: + PutStringUTF16( 4*8, 12*8, TXT_UCOLOR_G0, (const u16*)L"In Processing..." ); + PutStringUTF16( 4*8, 14*8, TXT_COLOR_GREEN, (const u16*)L"Completed!" ); + PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + break; + + default: + DEBUGPRINT( "invalid state\n" ); + break; + } +} + +// 初期化 +void CleanupMachineInit( void ) +{ + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawCleanupMachineScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + + sbInit = FALSE; + sState = MS_FORMATMACHINE_SELECT; // 初期状態 +} + +// メニューから呼ばれるメイン +int CleanupMachineMain( void ) +{ + SelectSomethingFunc funcSelect[3]={SelectOKFunc, SelectYESFunc, SelectNOTFunc}; + SelectSomethingFunc funcFinish[1]={SelectReturnFunc}; + BOOL tpCommit = FALSE; + static u16 commit; + + ReadTP(); + + // タッチできるボタンは実行状況によって異なる + switch( sState ) + { + case MS_FORMATMACHINE_SELECT: + if( (pad.trg & PAD_KEY_LEFT) || (pad.trg & PAD_KEY_RIGHT) ) + { + sbInit = !sbInit; + } + tpCommit = SelectSomethingByTP( &commit, funcSelect, 3 ); // 選択とOKのみ + if( tpCommit && (commit==KEY_YES) ) + { + sbInit = TRUE; + } + else if( tpCommit && (commit == KEY_NOT) ) + { + sbInit = FALSE; + } + + if( (pad.trg & PAD_BUTTON_A) || (tpCommit && (commit == KEY_OK)) ) + { + if( sbInit ) + { + sState = MS_FORMATMACHINE_PROCESSING; // 遷移 + } + else + { + MachineSettingInit(); + return 0; + } + } + break; + + case MS_FORMATMACHINE_PROCESSING: + // 選択を受け付けない + if( !NAMUT_FormatCore(FALSE,TRUE) ) // 初期化実行 + { + sState = MS_FORMATMACHINE_ERROR; + } + else + { + sState = MS_FORMATMACHINE_SUCCESS; + } + break; + + case MS_FORMATMACHINE_ERROR: + case MS_FORMATMACHINE_SUCCESS: + tpCommit = SelectSomethingByTP( &commit, funcFinish, 1 ); // Returnのみ + if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_RETURN)) ) + { + MachineSettingInit(); + return 0; + } + break; + } + + // 再描画 + DrawCleanupMachineScene(); + return 0; +} + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.c b/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.c new file mode 100644 index 00000000..ce351689 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.c @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setWireless.c + + Copyright 2007 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 "getSysMenuVersion.h" + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + + +// define data---------------------------------- +#define FS_VERSION_FILE "verdata:/version.bin" +#define FS_EULA_URL_FILE "verdata:/eula_url.bin" +#define FS_NUP_HOSTNAME_FILE "verdata:/nup_host.bin" +#define FS_TIMESTAMP_FILE "verdata:/time_stamp.bin" + +typedef struct SystemMenuVersion { + u16 major; + u16 minor; + u16 str[ TWL_SYSMENU_VER_STR_LEN / sizeof(u16) ]; +}SystemMenuVersion; + +// extern data---------------------------------- +// function's prototype------------------------- +// static variable------------------------------ +static BOOL s_isRead = FALSE; +static SystemMenuVersion s_version; +static u8 s_eulaURL[ TWL_EULA_URL_LEN ]; +static u8 s_nupHostName[ TWL_NUP_HOSTNAME_LEN ]; +static u32 s_timestamp; + +// const data----------------------------------- + + +// システムメニューバージョンのリード +BOOL ReadSystemMenuVersionData( void *pWork, u32 workSize ) +{ + BOOL retval = TRUE; + + // 既にリード実行済みなら何もせず終了 + if( s_isRead ) { + return TRUE; + } + s_isRead = TRUE; + + // SystemMenuVersionのマウント(認証含む) + if( !NA_LoadVersionDataArchive( pWork, workSize ) ) { + return FALSE; + } + + // ついでにユーザー領域MAXサイズも読み込んでおく + (void)FSi_GetTotalUserAreaSize(); + + // バージョンの読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if (!FS_OpenFileEx(&file, FS_VERSION_FILE, FS_FILEMODE_R)) { + return FALSE; + } + + len = FS_ReadFile(&file, &s_version, (s32)sizeof(s_version)); + FS_CloseFile(&file); + + if (len < 0) { + retval = FALSE; + } + } + + // EULA URLの読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if (!FS_OpenFileEx(&file, FS_EULA_URL_FILE, FS_FILEMODE_R)) { + return FALSE; + } + + len = FS_ReadFile(&file, s_eulaURL, (s32)sizeof(s_eulaURL)); + FS_CloseFile(&file); + + if (len < 0) { + retval = FALSE; + } + } + + // NUP HOST NAME の読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if (!FS_OpenFileEx(&file, FS_NUP_HOSTNAME_FILE, FS_FILEMODE_R)) { + return FALSE; + } + + len = FS_ReadFile(&file, s_nupHostName, (s32)sizeof(s_nupHostName)); + FS_CloseFile(&file); + + if (len < 0) { + retval = FALSE; + } + } + + // タイムスタンプ の読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if (!FS_OpenFileEx(&file, FS_TIMESTAMP_FILE, FS_FILEMODE_R)) { + return FALSE; + } + + len = FS_ReadFile(&file, &s_timestamp, (s32)sizeof(s_timestamp)); + FS_CloseFile(&file); + + if (len < 0) { + retval = FALSE; + } + } + + // SystemMenuVersionのアンマウント + if( !NA_UnloadVersionDataArchive() ) { + return FALSE; + } + + return retval; +} + + +// バージョン文字列の取得 +const u16 *GetSystemMenuVersionString( void ) +{ + return s_isRead ? s_version.str : NULL; +} + + +// メジャーバージョンの取得 +u16 GetSystemMenuMajorVersion( void ) +{ + return s_isRead ? s_version.major : (u16)65535; +} + + +// マイナーバージョンの取得 +u16 GetSystemMenuMinorVersion( void ) +{ + return s_isRead ? s_version.minor : (u16)65535; +} + + +// EULA URLの取得 +const u8 *GetEULA_URL( void ) +{ + return s_isRead ? s_eulaURL : NULL; +} + + +// NUP HostNameの取得 +const u8 *GetNUP_HostName( void ) +{ + return s_isRead ? s_nupHostName : NULL; +} + + +// SystemMenuVersion情報のタイムスタンプの取得 +u32 GetSystemMenuVersionTimeStamp( void ) +{ + return s_isRead ? s_timestamp : (u32)0; +} diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.h b/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.h new file mode 100644 index 00000000..d9368a9f --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/getSysMenuVersion.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: MachineSetting.h + + Copyright 2007 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 __GET_SYSMENU_VERSION_H__ +#define __GET_SYSMENU_VERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + + +// define data---------------------------------------------------------- +#define TWL_SYSMENU_VER_STR_LEN 28 // システムメニューバージョン文字列MAX bytes +#define TWL_EULA_URL_LEN 128 +#define TWL_NUP_HOSTNAME_LEN 64 + +// システムメニューバージョン情報もろもろのリード +extern BOOL ReadSystemMenuVersionData( void *pWork, u32 workSize ); + + +// バージョン文字列の取得 +extern const u16 *GetSystemMenuVersionString( void ); + + +// メジャーバージョンの取得 +extern u16 GetSystemMenuMajorVersion( void ); + + +// マイナーバージョンの取得 +extern u16 GetSystemMenuMinorVersion( void ); + +// EULA URLの取得 +extern const u8 *GetEULA_URL( void ); + +// NUP HostNameの取得 +extern const u8 *GetNUP_HostName( void ); + +// SystemMenuVersion情報のタイムスタンプの取得 +extern u32 GetSystemMenuVersionTimeStamp( void ); + + +#ifdef __cplusplus +} +#endif + +#endif // __GET_SYSMENU_VERSION_H__ diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/main.c b/build/systemMenu_RED/MachineSettings/ARM9/src/main.c new file mode 100644 index 00000000..291c01bc --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/main.c @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" +#include "getSysMenuVersion.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- +int (*g_pNowProcess)( void ); +BOOL g_isValidTSD; +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + OS_InitTick(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + SEA_Init(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + FS_Init( FS_DMA_NOT_USE ); + + SND_Init(); + SNDEX_Init(); + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + // NAMライブラリ初期化 + NAM_Init( Alloc, Free ); // NAMUTライブラリがNAMライブラリを使用している + NAMUT_Init( Alloc, Free ); + + // ※本来ならランチャーからのパラメータチェックを行い、 + // 初回起動シーケンスに入るパスがある + + { + OS_TPrintf( "LCFGTWLOwnerInfo : 0x%04x\n", sizeof(LCFGTWLOwnerInfo) ); + OS_TPrintf( "LCFGTWLParentalControl : 0x%04x\n", sizeof(LCFGTWLParentalControl) ); + OS_TPrintf( "LCFGTWLSettingsData : 0x%04x\n", sizeof(LCFGTWLSettingsData) ); + } + + (void) NAMUT_PrintInstalledTitleETicketType(); + + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルの読み込み + // :::::::::::::::::::::::::::::::::::::::::::::: + g_isValidTSD = TRUE; + { + u8 *pBuffer = Alloc( LCFG_READ_TEMP ); + if( pBuffer ) { + // NANDからTWL本体設定データをリード + BOOL isRead = LCFG_ReadTWLSettings( (u8 (*)[LCFG_READ_TEMP])pBuffer ); + + // リード失敗ファイルが存在する場合は、ファイルをリカバリ + if( LCFG_RecoveryTWLSettings() ) { + if( isRead ) { + // ミラーデータのうち、一方でもリードできていたなら何もしない。 + }else { + // リードに完全に失敗していた場合は、フラッシュ壊れシーケンスへ。 + LCFG_TSD_SetFlagFinishedBrokenTWLSettings( FALSE ); + (void)LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); // LCFG_READ_TEMP > LCFG_WRITE_TEMP なので、pBufferをそのまま流用 + } + }else { + // リカバリ失敗時は、FALTALエラー + UTL_SetFatalError( FATAL_ERROR_TWLSETTINGS ); + g_isValidTSD = FALSE; + } + Free( pBuffer ); + }else { + // メモリ確保ができなかった時は、FATALエラー + g_isValidTSD = FALSE; + } + } + + UTL_CaribrateTP( LCFG_TSD_GetTPCalibrationPtr() ); + + // :::::::::::::::::::::::::::::::::::::::::::::: + // SystemMenuバージョンetc.の読み込み + // :::::::::::::::::::::::::::::::::::::::::::::: + { + u8 *pBuffer = Alloc( NA_VERSION_DATA_WORK_SIZE ); + + if( pBuffer && + ReadSystemMenuVersionData( pBuffer, NA_VERSION_DATA_WORK_SIZE ) ) { + // リード成功 + }else { + // FATALエラー + UTL_SetFatalError( FATAL_ERROR_TWLSETTINGS ); + } + Free( pBuffer ); + } + + // バージョン情報の表示 + { + char str_ver[ TWL_SYSMENU_VER_STR_LEN / sizeof(u16) ]; + int len = sizeof(str_ver); + OS_TPrintf( "SystemMenuVersionData\n" ); + // 文字列 + if( STD_ConvertStringUnicodeToSjis( str_ver, &len, GetSystemMenuVersionString(), NULL, NULL ) == STD_RESULT_SUCCESS ) { + OS_TPrintf( " Version(str) : %s\n", str_ver ); + } + // 数値 + OS_TPrintf( " Version(num) : %d.%d\n", GetSystemMenuMajorVersion(), GetSystemMenuMinorVersion() ); + // ユーザー領域MAXサイズの表示 + OS_TPrintf( " TotalUserAreadSize : 0x%08x\n", FSi_GetTotalUserAreaSize() ); + // EULA URLの表示 + OS_TPrintf( " EULA URL : %s\n", GetEULA_URL() ); + // NUP HostNameの表示 + OS_TPrintf( " NUP HostName : %s\n", GetNUP_HostName() ); + // SystemMenuVersion情報のタイムスタンプの取得 + OS_TPrintf( " Timestamp : %08x\n", GetSystemMenuVersionTimeStamp() ); + } + InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + MachineSettingInit(); + // メインループ---------------------------- + while ( 1 ) { + OS_WaitIrq( 1, OS_IE_V_BLANK ); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + + (void)g_pNowProcess(); + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/selectCountry.c b/build/systemMenu_RED/MachineSettings/ARM9/src/selectCountry.c new file mode 100644 index 00000000..f0875659 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/selectCountry.c @@ -0,0 +1,335 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SelectCountry.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( (CANCEL_BUTTON_TOP_X + 8 ) * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( (CANCEL_BUTTON_TOP_Y + 2 ) * 8 ) + +#define MENU_DISPLAY_SIZE 7 + +// スクロールバー関係 +#define BAR_ZERO_X 230 +#define BAR_ZERO_Y 48 +#define BAR_HEIGHT_MAX 107 +#define BAR_HEIGHT_MIN SQUARE_SIZE +#define BAR_WIDTH SQUARE_SIZE +#define BAR_BUTTON_HEIGHT SQUARE_SIZE +#define BAR_BUTTON_WIDTH SQUARE_SIZE +#define SQUARE_SIZE 11 +#define BAR_LOOSENESS 2 +#define BAR_OFFSET 2 // 表示に"■"テキストを使っているので、タッチ座標を補正する目的のOFFSET + +// ボタン長押しでのカーソル自動移動関係 +#define START_AUTOMOVE_COUNT 30 +#define AUTOMOVE_INTERVAL 5 + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static LCFGTWLCountryCode s_countryCode; // 国コード +static OSTWLRegion s_regionCode; // リージョン + +static u16 s_list_start, s_list_end; +static u16 s_menu_display_start; + +static const u16 *s_pStrCountry[MENU_DISPLAY_SIZE]; + +static int s_list_size; +static int s_bar_height; +static double s_dots_per_item; + +// const data ----------------------------------------- +extern const u16 *const s_pStrCountryName[]; +extern const u32 region_country_mapping[OS_TWL_REGION_MAX]; + +static MenuPos s_countryPos[MENU_DISPLAY_SIZE] = { + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 4 * 8, 16 * 8 }, + { TRUE, 4 * 8, 18 * 8 }, +}; + +static MenuParam countrySel = { + MENU_DISPLAY_SIZE, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_countryPos[ 0 ], + (const u16 **)&s_pStrCountry, +}; + +//====================================================== +// function's description +//====================================================== + +// スクロールメニューの初期化 +static void InitScrollMenuList( void ) +{ + int l; + // メニューに表示する国名リスト全体の最初と最後をマッピングデータから取得 + s_list_start = (u16)(region_country_mapping[s_regionCode] >> 16); + s_list_end = (u16)(region_country_mapping[s_regionCode]); + if(s_list_start > s_list_end) OS_Panic("selectCountry.c:s_list_start>s_list_end!"); + + s_list_size = s_list_end - s_list_start + 1; + + // 画面に表示する最大項目数よりも、国名リストが小さいか? + countrySel.num = (MENU_DISPLAY_SIZE < s_list_size) ? MENU_DISPLAY_SIZE : s_list_size ; + + // 設定されていた国名コードがリスト範囲に入っていなければデフォルト値にする + if(s_countryCode < s_list_start || s_list_end < s_countryCode) + { + s_countryCode = (LCFGTWLCountryCode)s_list_start; + } + + // 実際に表示する範囲の調整 + s_menu_display_start = s_countryCode; + if(s_countryCode + countrySel.num - 1 > s_list_end) + { + s_menu_display_start = (u16)(s_list_end + 1 - countrySel.num); + } + + // 実際に表示する国名のみリスト化 + for(l=0; l= LCFG_TWL_COUNTRY_MAX ) ) { + s_countryCode = (LCFGTWLCountryCode)0; + }else { + s_countryCode = LCFG_TSD_GetCountry(); + } + + // スクロールメニューの初期化 + InitScrollMenuList(); + + DrawMenu( (u16)(s_countryCode - s_menu_display_start), &countrySel ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + +// キー入力によるカーソル移動の処理 +static void MoveCursorByKey( void ) +{ + BOOL pad_cont = FALSE; + static int pad_count = 0; + + if( pad.cont & PAD_KEY_DOWN ) { // カーソルの移動 + if(pad_count == 0 || (pad_count>=START_AUTOMOVE_COUNT && pad_count%AUTOMOVE_INTERVAL==0)) + if( s_countryCode < s_list_end ) s_countryCode++; + pad_cont = TRUE; + } + if( pad.cont & PAD_KEY_UP ) { + if(pad_count == 0 || (pad_count>=START_AUTOMOVE_COUNT && pad_count%AUTOMOVE_INTERVAL==0)) + if( s_countryCode > s_list_start ) s_countryCode--; + pad_cont = TRUE; + } + if( pad_cont ) pad_count++; + else pad_count = 0; + pad_cont = FALSE; + + // キー入力後、表示される項目の調整 + if( s_countryCode < s_menu_display_start ) s_menu_display_start = s_countryCode; + else if( s_menu_display_start + countrySel.num - 1 < s_countryCode ) s_menu_display_start = (u16)(s_countryCode - countrySel.num + 1); +} + +// 簡易スクロールバーのボタンによるスクロール +static void MoveCursorByScrollBarButton( void ) +{ + static int tpd_count = 0; + BOOL tpd_cont = FALSE; + + if(tpd.disp.touch) + { + if( WithinRangeTP(BAR_ZERO_X,BAR_ZERO_Y+BAR_HEIGHT_MAX+BAR_OFFSET,BAR_ZERO_X+BAR_BUTTON_WIDTH,BAR_ZERO_Y+BAR_HEIGHT_MAX+BAR_OFFSET+BAR_BUTTON_HEIGHT,&tpd.disp) ) {//down + if(tpd_count == 0 || (tpd_count>=START_AUTOMOVE_COUNT && tpd_count%AUTOMOVE_INTERVAL==0)) + if( s_countryCode < s_list_end ) s_menu_display_start++; + tpd_cont = TRUE; + } + if( WithinRangeTP(BAR_ZERO_X,BAR_ZERO_Y-BAR_BUTTON_HEIGHT+BAR_OFFSET,BAR_ZERO_X+BAR_BUTTON_WIDTH,BAR_ZERO_Y+BAR_OFFSET,&tpd.disp) ) {//up + if(tpd_count == 0 || (tpd_count>=START_AUTOMOVE_COUNT && tpd_count%AUTOMOVE_INTERVAL==0)) + if( s_countryCode > s_list_start ) s_menu_display_start--; + tpd_cont = TRUE; + } + } + if( tpd_cont ) tpd_count++; + else tpd_count = 0; + tpd_cont = FALSE; +} + +// 簡易スクロールバーによるスクロール +static void MoveCursorByScrollBar( void ) +{ + // 簡易スクロールバーのボタンによるスクロール + MoveCursorByScrollBarButton(); + + // 簡易スクロールバーによるスクロール + { + static BOOL holding = FALSE; + static int dy; + int bar_top = (int)(BAR_ZERO_Y+s_dots_per_item * (s_menu_display_start - s_list_start)); + if(tpd.disp.touch) + { + if(holding) + { + if ( tpd.disp.y - dy < bar_top - BAR_LOOSENESS) + { + bar_top = tpd.disp.y - dy + BAR_LOOSENESS; + } + else if ( tpd.disp.y - dy > bar_top + BAR_LOOSENESS) + { + bar_top = tpd.disp.y - dy - BAR_LOOSENESS; + } + s_menu_display_start = (u16)(((bar_top - BAR_ZERO_Y)/s_dots_per_item) + s_list_start); + } + else if(WithinRangeTP(BAR_ZERO_X, bar_top+BAR_OFFSET,BAR_ZERO_X + BAR_WIDTH,bar_top+BAR_OFFSET+s_bar_height,&tpd.disp)) + { + holding = TRUE; + dy = tpd.disp.y - bar_top; + } + } + else + { + holding = FALSE; + } + } + + // タッチパッドによるスクロール後、表示される項目の調整 + if( s_menu_display_start + countrySel.num - 1 > s_list_end ) s_menu_display_start = (u16)(s_list_end - countrySel.num + 1); + if( s_menu_display_start < s_list_start ) s_menu_display_start = s_list_start; + if( s_countryCode < s_menu_display_start ) s_countryCode = (LCFGTWLCountryCode)s_menu_display_start; + else if( s_menu_display_start + countrySel.num - 1 < s_countryCode ) s_countryCode = (LCFGTWLCountryCode)(s_menu_display_start + countrySel.num - 1); +} + +// 国選択画面の描画処理 +static void DrawCountryMain( void ) +{ + int l; + // 実際に表示する国名のみリスト化 + for(l=0; l +#include "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( (CANCEL_BUTTON_TOP_X + 8 ) * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( (CANCEL_BUTTON_TOP_Y + 2 ) * 8 ) + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static int s_lang; // 言語選択肢の何番目を選択しているか + +static const u16* s_pStrLanguage[LCFG_TWL_LANG_CODE_MAX]; +static LCFGTWLLangCode s_langCodeList[LCFG_TWL_LANG_CODE_MAX]; + +// const data ----------------------------------------- + +static const u16 *const s_pStrLanguageData[LCFG_TWL_LANG_CODE_MAX] = { + (const u16 *)L"日本語", + (const u16 *)L"English ", + (const u16 *)L"Francais", + (const u16 *)L"Deutsch ", + (const u16 *)L"Italiano", + (const u16 *)L"Espanol ", + (const u16 *)L"中国語(仮)", + (const u16 *)L"韓国語(仮)" +}; + +static MenuPos s_languagePos[LCFG_TWL_LANG_CODE_MAX] = { + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 4 * 8, 16 * 8 }, + { TRUE, 4 * 8, 18 * 8 }, + { TRUE, 4 * 8, 20 * 8 } +}; + +static MenuParam langSel = { + LCFG_TWL_LANG_CODE_MAX, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_languagePos[ 0 ], + (const u16 **)&s_pStrLanguage, +}; + + +//====================================================== +// function's description +//====================================================== + +// 言語設定の初期化 +void SelectLanguageInit( void ) +{ + int l; + u16 temp_langCode = 0; + BOOL in_list_flag = FALSE; + int lang_count = 0; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"LANGUAGE SELECT" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL" ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + // 言語の取得 + if( !g_isValidTSD || + ( LCFG_TSD_GetLanguage() >= LCFG_TWL_LANG_CODE_MAX ) ) { + temp_langCode = LCFG_TWL_LANG_ENGLISH; + }else { + temp_langCode = LCFG_TSD_GetLanguage(); + } + + // リージョン-言語マッピング情報から、現在のリージョンで選択できる言語をリストアップ + s_lang = 0; + for(l=0; l +#include "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( (CANCEL_BUTTON_TOP_X + 8 ) * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( (CANCEL_BUTTON_TOP_Y + 2 ) * 8 ) + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static TWLRegion s_regionCode; // リージョン + +// const data ----------------------------------------- +static const u16 *const s_pStrRegion[] = { + (const u16 *)L"NCL", + (const u16 *)L"NOA", + (const u16 *)L"NOE", + (const u16 *)L"NAL ", + (const u16 *)L"IQue", + (const u16 *)L"NOK ", +}; + +static MenuPos s_regionPos[] = { + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 4 * 8, 16 * 8 }, +}; + +static const MenuParam regionSel = { + 6, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_regionPos[ 0 ], + (const u16 **)&s_pStrRegion, +}; + +TWLLangCode default_lang_list[TWL_REGION_MAX] = +{ + TWL_LANG_JAPANESE, + TWL_LANG_ENGLISH, + TWL_LANG_ENGLISH, + TWL_LANG_ENGLISH, + TWL_LANG_SIMP_CHINESE, + TWL_LANG_KOREAN +}; + +TWLCountryCode default_country_list[TWL_REGION_MAX] = +{ + TWL_COUNTRY_JAPAN, + TWL_COUNTRY_Anguilla, + TWL_COUNTRY_ALBANIA, + TWL_COUNTRY_ALBANIA, + TWL_COUNTRY_CHINA, + TWL_COUNTRY_SOUTH_KOREA +}; + +//====================================================== +// function's description +//====================================================== + +// リージョン設定の初期化 +void SelectRegionInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"REGION SELECT" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL" ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // リージョンの取得 + s_regionCode = (TWLRegion)THW_GetRegion(); + + DrawMenu( (u16)s_regionCode, ®ionSel ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + + +// リージョン選択 +int SelectRegionMain( void ) +{ + BOOL tp_select,tp_cancel = FALSE; + + ReadTP(); // TP入力の取得 + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ) { // カーソルの移動 + if( ++s_regionCode == TWL_REGION_MAX ) { + s_regionCode = (TWLRegion)0; + } + } + if( pad.trg & PAD_KEY_UP ) { + if( --s_regionCode < 0 ) { + s_regionCode = (TWLRegion)( TWL_REGION_MAX - 1 ); + } + } + tp_select = SelectMenuByTP( (u16 *)&s_regionCode, ®ionSel ); + DrawMenu( (u16)s_regionCode, ®ionSel ); + + // [CANCEL]ボタン押下チェック + if( tpd.disp.touch ) { + tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); + } + + if( ( pad.trg & PAD_BUTTON_A ) || tp_select ) { // メニュー項目への分岐 + // :::::::::::::::::::::::::::::::::::::::::::::: + // HWセキュア情報ファイルへの書き込み(暗号化なし) + // :::::::::::::::::::::::::::::::::::::::::::::: + THW_SetRegion( s_regionCode ); + (void)THW_WriteSecureInfo( NULL ); + + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + TSD_SetLanguage( default_lang_list[s_regionCode] ); // デフォルト言語に強制設定 + TSD_SetCountry( default_country_list[s_regionCode] ); // デフォルト国に強制設定 + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + + MachineSettingInit(); + return 0; + }else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { + MachineSettingInit(); + return 0; + } + + return 0; +} + + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setEULA.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setEULA.c new file mode 100644 index 00000000..608bd26d --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setEULA.c @@ -0,0 +1,640 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setEULA.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// 以下のEULA設定 +// ++ agree/not agreeフラグ +// ++ agree eula version +// <例外処理> +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// ON/OFFボタン領域 +#define ON_BUTTON_TOP_X ( 6 * 8 ) +#define ON_BUTTON_TOP_Y ( 8 * 8 ) +#define ON_BUTTON_BOTTOM_X ( ON_BUTTON_TOP_X + (2 * 8) ) +#define ON_BUTTON_BOTTOM_Y ( ON_BUTTON_TOP_Y + (2 * 8) ) +#define OFF_BUTTON_TOP_X ( 18 * 8 ) +#define OFF_BUTTON_TOP_Y ( 8 * 8 ) +#define OFF_BUTTON_BOTTOM_X ( OFF_BUTTON_TOP_X + (3 * 8) ) +#define OFF_BUTTON_BOTTOM_Y ( OFF_BUTTON_TOP_Y + (2 * 8) ) + +// UP/DOWNボタン領域 +#define UP_BUTTON_TOP_X ( 21 * 8 ) +#define UP_BUTTON_TOP_Y ( 7 * 8 ) +#define UP_BUTTON_BOTTOM_X ( UP_BUTTON_TOP_X + (2 * 8) ) +#define UP_BUTTON_BOTTOM_Y ( UP_BUTTON_TOP_Y + (2 * 8) ) +#define DOWN_BUTTON_TOP_X ( 21 * 8 ) +#define DOWN_BUTTON_TOP_Y ( 13 * 8 ) +#define DOWN_BUTTON_BOTTOM_X ( DOWN_BUTTON_TOP_X + (2 * 8) ) +#define DOWN_BUTTON_BOTTOM_Y ( DOWN_BUTTON_TOP_Y + (2 * 8) ) + + +// 項目の総数 +#define MS_EULA_NUMOF_ELEMENTS 2 + +// ソフトウェアキーボードのパラメータ +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe +#define KEY_PREVPAGE 0xfffd +#define KEY_SUCCPAGE 0xfffc +#define KEY_ON 0xfffb +#define KEY_OFF 0xfffa +#define KEY_UP 0xfff9 +#define KEY_DOWN 0xfff8 +#define MULTI_KEY_UP 0xffe0 +#define MULTI_KEY_DOWN 0xffd0 +#define MASK_MULTI_KEY 0xfff0 + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + +static void SetAgreeEULAInit( void ); +static int SetAgreeEULAMain( void ); +static void SetAgreedVersionInit( void ); +static int SetAgreedVersionMain( void ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +// メニューで使用 +static u16 sCursorMenu = 0; + +// 特定のモードでのみ使用 +static BOOL sbAgreeEULA = FALSE; +static u8 sAgreedVersion; + +// const data----------------------------------- + +// ++ メインメニュー + +static const u16 *s_pStrSetting[ MS_EULA_NUMOF_ELEMENTS ]; // メインメニュー用文字テーブルへのポインタリスト + +static const u16 *const s_pStrSettingElemTbl[ MS_EULA_NUMOF_ELEMENTS ][ LCFG_TWL_LANG_CODE_MAX ] = { + + { + (const u16 *)L"EULAへの同意", + (const u16 *)L"Agree to EULA", + (const u16 *)L"Agree to EULA(F)", + (const u16 *)L"Agree to EULA(G)", + (const u16 *)L"Agree to EULA(I)", + (const u16 *)L"Agree to EULA(S)", + (const u16 *)L"Agree to EULA(C)", + (const u16 *)L"Agree to EULA(K)", + }, + { + (const u16 *)L"同意したバージョン", + (const u16 *)L"Agreed version", + (const u16 *)L"Agreed version(F)", + (const u16 *)L"Agreed version(G)", + (const u16 *)L"Agreed version(I)", + (const u16 *)L"Agreed version(S)", + (const u16 *)L"Agreed version(C)", + (const u16 *)L"Agreed version(K)", + }, +}; + +// 表示位置 +static MenuPos s_settingPos[] = { + + { TRUE, 2 * 8, 6 * 8 }, + { TRUE, 2 * 8, 10 * 8 }, +}; + +// 表示パラメータ +static const MenuParam s_settingParam = +{ + MS_EULA_NUMOF_ELEMENTS, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[0], + (const u16 **)&s_pStrSetting, +}; + + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +// キャンセルボタン専用SelectSomethingFuncの実装 +static BOOL SelectCancelFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_CANCEL; + return ret; +} + +// OKボタン専用SelectSomethingFuncの実装 +static BOOL SelectOKFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OK; + return ret; +} + +// ON/OFFボタン専用SelectSomethingFuncの実装 +static BOOL SelectONFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, + ON_BUTTON_BOTTOM_X, ON_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_ON; + return ret; +} +static BOOL SelectOFFFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, + OFF_BUTTON_BOTTOM_X, OFF_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OFF; + return ret; +} + +// UP/DOWNボタンの長押しとトリガを検出する +static BOOL DetectTouchUD( u16 *csr ) +{ + BOOL curr[2] = {FALSE, FALSE}; // 0:UP/1:DOWN + static BOOL prev[2] = {FALSE, FALSE}; // トリガ検出のために前の状態を記憶させる + BOOL trg[2] = {FALSE, FALSE}; + BOOL rep[2] = {FALSE, FALSE}; // 長押し + static u8 count[2] = {0, 0}; // 何フレーム連続で押されているか + BOOL ret = FALSE; + u16 i; + + for( i=0; i < 2; i++ ) + { + switch(i) + { + case 0: + curr[i] = WithinRangeTP( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, + UP_BUTTON_BOTTOM_X, UP_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + case 1: + curr[i] = WithinRangeTP( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, + DOWN_BUTTON_BOTTOM_X, DOWN_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + default: + break; + } + + // はじめて押されたかどうか + if( !prev[i] && curr[i] ) + { + trg[i] = TRUE; + } + // 長押しカウント + if( curr[i] ) + { + if( trg[i] ) + { + count[i] = 1; + } + else if( count[i] > 25 ) + { + count[i] = 25 - 10; + rep[i] = TRUE; + } + else + { + (count[i])++; + } + } + else // 押されていないとき + { + count[i] = 0; + } + prev[i] = curr[i]; // 状態を記憶 + } + + if(trg[0] || rep[0]) + { + *csr = KEY_UP; + ret = TRUE; + } + else if(trg[1] || rep[1]) + { + *csr = KEY_DOWN; + ret = TRUE; + } + else + { + ret = FALSE; + } + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawEULAMenuScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"EULA" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + // メニュー項目 + DrawMenu( sCursorMenu, &s_settingParam ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得して表示 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + PutStringUTF16( 21*8, s_settingPos[0].y, TXT_UCOLOR_G0, + LCFG_TSD_IsAgreeEULA() ? (const u16*)L"Agree":(const u16*)L"Not agree" ); + PrintfSJIS( 21*8, s_settingPos[1].y, TXT_UCOLOR_G0, "%d", + LCFG_TSD_GetAgreedEULAVersion() ); +} + +// 初期化 +void SetEULAInit( void ) +{ + int i; + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i=0; i < MS_EULA_NUMOF_ELEMENTS; i++ ) + { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawEULAMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// メニューから呼ばれるメイン +int SetEULAMain( void ) +{ + SelectSomethingFunc func[1]={SelectCancelFunc}; + BOOL tp_select; + BOOL tpCommit = FALSE; + u16 padrep; + static u16 commit; + + ReadTP(); + + padrep = DetectPadRepeat(); // 長押し検出 + + // メニューからの項目選択 + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++sCursorMenu >= MS_EULA_NUMOF_ELEMENTS ) { + sCursorMenu = 0; + } + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + if( --sCursorMenu & 0x80 ) { + sCursorMenu = (u16)(MS_EULA_NUMOF_ELEMENTS - 1); + } + } + tp_select = SelectMenuByTP( &sCursorMenu, &s_settingParam ); + + // 特殊ボタンタッチ + tpCommit = SelectSomethingByTP( &commit, func, 1 ); + + // メニューへの分岐 + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( (s_settingParam.pos[sCursorMenu]).enable ) { + switch( sCursorMenu ) + { + case 0: + SetAgreeEULAInit(); + g_pNowProcess = SetAgreeEULAMain; + break; + case 1: + SetAgreedVersionInit(); + g_pNowProcess = SetAgreedVersionMain; + break; + } + } // if( (s_settingParam.pos[sCursorMenu]).enable ) + } // if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + MachineSettingInit(); + return 0; + } + + // 再描画 + DrawEULAMenuScene(); + return 0; +} + +//========================================================= +// +// EULA同意/非同意のセット +// +//========================================================= + +// 描画処理 +static void DrawSetAgreeEULAScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"Agree EULA" ); + + if( !sbAgreeEULA ) + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Not agree" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Agree" ); + } + else + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Not agree" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Agree" ); + } + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); +} + +// 初期化 +static void SetAgreeEULAInit( void ) +{ + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sbAgreeEULA = LCFG_TSD_IsAgreeEULA(); + + DrawSetAgreeEULAScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAgreeEULAMain( void ) +{ + SelectSomethingFunc func[4]={SelectCancelFunc, SelectOKFunc, SelectONFunc, SelectOFFFunc }; + u16 commit; + BOOL tp_touch = FALSE; + + ReadTP(); + + // キーによる選択 + if( (pad.trg & PAD_KEY_LEFT) || (pad.trg & PAD_KEY_RIGHT) ) + { + sbAgreeEULA = !sbAgreeEULA; + } + + // タッチによる選択 + tp_touch = SelectSomethingByTP( &commit, func, 4 ); + if( tp_touch && (commit == KEY_ON) ) + { + sbAgreeEULA = TRUE; + } + else if( tp_touch && (commit == KEY_OFF) ) + { + sbAgreeEULA = FALSE; + } + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tp_touch && (commit == KEY_OK)) ) + { + LCFG_TSD_SetFlagAgreeEULA( sbAgreeEULA ); + if( !sbAgreeEULA ) { + LCFG_TSD_SetAgreedEULAVersion( 1 ); + } + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + OS_TPrintf( "AgreeEULA : %s\n", OS_IsAgreeEULA() ? "Agree" : "Not agree" ); + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tp_touch && (commit == KEY_CANCEL)) ) + { + SetEULAInit(); // キャンセルのときセットしない + g_pNowProcess = SetEULAMain; + return 0; + } + + DrawSetAgreeEULAScene(); + return 0; +} + + +//========================================================= +// +// 同意EULAバージョンのセット +// +//========================================================= + +// 描画処理 +static void DrawSetAgreedVersionScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"AGREED EULA VERSION" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconDown ); + PutStringUTF16( 4*8, 10*8, TXT_UCOLOR_G0, (const u16 *)L"Agreed EULA ver." ); + PrintfSJIS( 20*8, 10*8, TXT_COLOR_GREEN, "%3d", sAgreedVersion ); +} + +// 初期化 +static void SetAgreedVersionInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sAgreedVersion = LCFG_TSD_GetAgreedEULAVersion(); + + DrawSetAgreedVersionScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAgreedVersionMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + u16 padrep; + + ReadTP(); + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchUD( &csrUD ); + + padrep = DetectPadRepeat(); // キーの長押し検出 + + // 変更 + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) || (tpUD && (csrUD == KEY_UP)) ) + { + --sAgreedVersion; + if( sAgreedVersion == 0 ) { + sAgreedVersion = 255; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) || (tpUD && (csrUD == KEY_DOWN)) ) + { + ++sAgreedVersion; + if( sAgreedVersion == 0 ) { + sAgreedVersion = 1; + } + } + if(pad.trg & PAD_BUTTON_START) + { + sAgreedVersion = 1; + } + + // 決定 + if( pad.trg & PAD_BUTTON_A || (tpCommit && (csrCommit == KEY_OK)) ) + { + LCFG_TSD_SetAgreedEULAVersion( sAgreedVersion ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + OS_TPrintf( "Agreed EULA version : %d\n", OS_GetAgreedEULAVersion ); + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + + // 再描画 + DrawSetAgreedVersionScene(); + return 0; +} + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setFreeSoftBox.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setFreeSoftBox.c new file mode 100644 index 00000000..faa092a7 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setFreeSoftBox.c @@ -0,0 +1,555 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setFreeSoftBox.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// 以下のフリーソフトBOXの設定 +// ++ フリーソフトBOX数 +// ++ (連動して使用ソフトBOX数が設定される) +// +// <例外処理> +// ++ 本来はフリーソフトBOX数+使用ソフトBOX数=max値となるが初期状態では両方とも0である可能性がある +// -> フリーソフトBOX数を本UIを用いて設定されるまで値はセットされない +// -- キャンセルされたときには値はセットされないので上式は満たされないままとなる +// -- 設定が正しいかどうかを知らせるため上式が満たされないとき赤色の文字で値を表示する +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// ON/OFFボタン領域 +#define ON_BUTTON_TOP_X ( 8 * 8 ) +#define ON_BUTTON_TOP_Y ( 8 * 8 ) +#define ON_BUTTON_BOTTOM_X ( ON_BUTTON_TOP_X + (2 * 8) ) +#define ON_BUTTON_BOTTOM_Y ( ON_BUTTON_TOP_Y + (2 * 8) ) +#define OFF_BUTTON_TOP_X ( 18 * 8 ) +#define OFF_BUTTON_TOP_Y ( 8 * 8 ) +#define OFF_BUTTON_BOTTOM_X ( OFF_BUTTON_TOP_X + (3 * 8) ) +#define OFF_BUTTON_BOTTOM_Y ( OFF_BUTTON_TOP_Y + (2 * 8) ) + +// UP/DOWNボタン領域 +#define UP_BUTTON_TOP_X ( 21 * 8 ) +#define UP_BUTTON_TOP_Y ( 7 * 8 ) +#define UP_BUTTON_BOTTOM_X ( UP_BUTTON_TOP_X + (2 * 8) ) +#define UP_BUTTON_BOTTOM_Y ( UP_BUTTON_TOP_Y + (2 * 8) ) +#define DOWN_BUTTON_TOP_X ( 21 * 8 ) +#define DOWN_BUTTON_TOP_Y ( 13 * 8 ) +#define DOWN_BUTTON_BOTTOM_X ( DOWN_BUTTON_TOP_X + (2 * 8) ) +#define DOWN_BUTTON_BOTTOM_Y ( DOWN_BUTTON_TOP_Y + (2 * 8) ) + + +// 項目の総数 +#define MS_FREESOFTBOX_NUMOF_ELEMENTS 1 + +// ソフトウェアキーボードのパラメータ +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe +#define KEY_PREVPAGE 0xfffd +#define KEY_SUCCPAGE 0xfffc +#define KEY_ON 0xfffb +#define KEY_OFF 0xfffa +#define KEY_UP 0xfff9 +#define KEY_DOWN 0xfff8 +#define MULTI_KEY_UP 0xffe0 +#define MULTI_KEY_DOWN 0xffd0 +#define MASK_MULTI_KEY 0xfff0 + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + +static void SetFreeSoftBoxCountInit( void ); +static int SetFreeSoftBoxCountMain( void ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +// メニューで使用 +static u16 sCursorMenu = 0; + +// 特定のモードでのみ使用 +static u8 sFreeSoftBoxCount = 0; // フリーソフトBOX数 +static u8 sInstalledSoftBoxCount = 0; // 使用ソフトBOX数 + +// const data----------------------------------- + +// ++ メインメニュー + +static const u16 *s_pStrSetting[ MS_FREESOFTBOX_NUMOF_ELEMENTS ]; // メインメニュー用文字テーブルへのポインタリスト + +static const u16 *const s_pStrSettingElemTbl[ MS_FREESOFTBOX_NUMOF_ELEMENTS ][ LCFG_TWL_LANG_CODE_MAX ] = { + + { + (const u16 *)L"フリーソフトBOX数", + (const u16 *)L"FreeSoft Box Count", + (const u16 *)L"FreeSoft Box Count(F)", + (const u16 *)L"FreeSoft Box Count(G)", + (const u16 *)L"FreeSoft Box Count(I)", + (const u16 *)L"FreeSoft Box Count(S)", + (const u16 *)L"FreeSoft Box Count(C)", + (const u16 *)L"FreeSoft Box Count(K)", + }, +}; + +// ++ 補足表示 +static const u16 *const s_pStrInstalledSoftBox[ LCFG_TWL_LANG_CODE_MAX ] = +{ + (const u16 *)L"使用ソフトBOX数", + (const u16 *)L"InstalledSoft Box Count", + (const u16 *)L"InstalledSoft Box Count(F)", + (const u16 *)L"InstalledSoft Box Count(G)", + (const u16 *)L"InstalledSoft Box Count(I)", + (const u16 *)L"InstalledSoft Box Count(S)", + (const u16 *)L"InstalledSoft Box Count(C)", + (const u16 *)L"InstalledSoft Box Count(K)", +}; + +// 表示位置 +static MenuPos s_settingPos[] = { + + { TRUE, 2 * 8, 6 * 8 }, +}; + +// 表示パラメータ +static const MenuParam s_settingParam = +{ + MS_FREESOFTBOX_NUMOF_ELEMENTS, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[0], + (const u16 **)&s_pStrSetting, +}; + + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +// キャンセルボタン専用SelectSomethingFuncの実装 +static BOOL SelectCancelFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_CANCEL; + return ret; +} + +// OKボタン専用SelectSomethingFuncの実装 +static BOOL SelectOKFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OK; + return ret; +} + +/* +// UP/DOWNボタン専用SelectSomethingFuncの実装 +static BOOL SelectUPFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, + UP_BUTTON_BOTTOM_X, UP_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_UP; + return ret; +} +static BOOL SelectDOWNFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, + DOWN_BUTTON_BOTTOM_X, DOWN_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_DOWN; + return ret; +} +*/ +// UP/DOWNボタンの長押しとトリガを検出する +static BOOL DetectTouchUD( u16 *csr ) +{ + BOOL curr[2] = {FALSE, FALSE}; // 0:UP/1:DOWN + static BOOL prev[2] = {FALSE, FALSE}; // トリガ検出のために前の状態を記憶させる + BOOL trg[2] = {FALSE, FALSE}; + BOOL rep[2] = {FALSE, FALSE}; // 長押し + static u8 count[2] = {0, 0}; // 何フレーム連続で押されているか + BOOL ret = FALSE; + u16 i; + + for( i=0; i < 2; i++ ) + { + switch(i) + { + case 0: + curr[i] = WithinRangeTP( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, + UP_BUTTON_BOTTOM_X, UP_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + case 1: + curr[i] = WithinRangeTP( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, + DOWN_BUTTON_BOTTOM_X, DOWN_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + default: + break; + } + + // はじめて押されたかどうか + if( !prev[i] && curr[i] ) + { + trg[i] = TRUE; + } + // 長押しカウント + if( curr[i] ) + { + if( trg[i] ) + { + count[i] = 1; + } + else if( count[i] > 25 ) + { + count[i] = 25 - 10; + rep[i] = TRUE; + } + else + { + (count[i])++; + } + } + else // 押されていないとき + { + count[i] = 0; + } + prev[i] = curr[i]; // 状態を記憶 + } + + if(trg[0] || rep[0]) + { + *csr = KEY_UP; + ret = TRUE; + } + else if(trg[1] || rep[1]) + { + *csr = KEY_DOWN; + ret = TRUE; + } + else + { + ret = FALSE; + } + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawFreeSoftBoxMenuScene( void ) +{ + u8 installCount, freeCount; + BOOL bRegular = FALSE; + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"FREESOFT BOX" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + // メニュー項目 + DrawMenu( sCursorMenu, &s_settingParam ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得して表示 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // フリーソフトBOX数 + freeCount = LCFG_TSD_GetFreeSoftBoxCount(); + installCount = LCFG_TSD_GetInstalledSoftBoxCount(); + bRegular = (installCount + freeCount) == LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX; // 満たされるべき式 + PrintfSJIS( 27*8, s_settingPos[0].y, (bRegular)?TXT_UCOLOR_G0:TXT_COLOR_RED, "%2d", freeCount ); // 値が不正のとき赤色で表示 + PutStringUTF16( 1*8, s_settingPos[0].y+4*8, TXT_UCOLOR_G0, (const u16 *)L"(" ); // 補足情報 + PutStringUTF16( 29*8, s_settingPos[0].y+4*8, TXT_UCOLOR_G0, (const u16 *)L")" ); + PutStringUTF16( s_settingPos[0].x, s_settingPos[0].y+4*8, TXT_UCOLOR_G0, s_pStrInstalledSoftBox[ LCFG_TSD_GetLanguage() ] ); + PrintfSJIS( 27*8, s_settingPos[0].y+4*8, (bRegular)?TXT_UCOLOR_G0:TXT_COLOR_RED, "%2d", installCount ); +} + +// 初期化 +void SetFreeSoftBoxInit( void ) +{ + int i; + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i=0; i < MS_FREESOFTBOX_NUMOF_ELEMENTS; i++ ) + { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawFreeSoftBoxMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// メニューから呼ばれるメイン +int SetFreeSoftBoxMain( void ) +{ + SelectSomethingFunc func[1]={SelectCancelFunc}; + BOOL tp_select; + BOOL tpCommit = FALSE; + u16 padrep; + static u16 commit; + + ReadTP(); + + padrep = DetectPadRepeat(); // 長押し検出 + + // メニューからの項目選択 + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++sCursorMenu >= MS_FREESOFTBOX_NUMOF_ELEMENTS ) { + sCursorMenu = 0; + } + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + if( --sCursorMenu & 0x80 ) { + sCursorMenu = (u16)(MS_FREESOFTBOX_NUMOF_ELEMENTS - 1); + } + } + tp_select = SelectMenuByTP( &sCursorMenu, &s_settingParam ); + + // 特殊ボタンタッチ + tpCommit = SelectSomethingByTP( &commit, func, 1 ); + + // メニューへの分岐 + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( (s_settingParam.pos[sCursorMenu]).enable ) { + switch( sCursorMenu ) + { + case 0: + SetFreeSoftBoxCountInit(); + g_pNowProcess = SetFreeSoftBoxCountMain; + break; + } + } // if( (s_settingParam.pos[sCursorMenu]).enable ) + } // if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + MachineSettingInit(); + return 0; + } + + // 再描画 + DrawFreeSoftBoxMenuScene(); + return 0; +} + +//========================================================= +// +// フリーソフトBOX数の選択 (数値選択) +// +//========================================================= + +// 描画処理 +static void DrawSetFreeSoftBoxCountScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"FREESOFT BOX COUNT" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconDown ); + PutStringUTF16( 6*8, 10*8, TXT_UCOLOR_G0, (const u16 *)L"FreeSoft Box" ); + PrintfSJIS( 21*8, 10*8, TXT_COLOR_GREEN, "%2d", sFreeSoftBoxCount ); + PutStringUTF16( 2*8, 18*8, TXT_UCOLOR_G0, (const u16 *)L"(" ); + PutStringUTF16( 24*8, 18*8, TXT_UCOLOR_G0, (const u16 *)L")" ); + PutStringUTF16( 4*8, 18*8, TXT_UCOLOR_G0, (const u16 *)L"InstalledSoft Box" ); + PrintfSJIS( 21*8, 18*8, TXT_UCOLOR_G0, "%2d", sInstalledSoftBoxCount ); +} + +// 初期化 +static void SetFreeSoftBoxCountInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sFreeSoftBoxCount = LCFG_TSD_GetFreeSoftBoxCount(); + sInstalledSoftBoxCount = (u8)(LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - sFreeSoftBoxCount); + + DrawSetFreeSoftBoxCountScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetFreeSoftBoxCountMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + u16 padrep; + + ReadTP(); + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchUD( &csrUD ); + + padrep = DetectPadRepeat(); // キーの長押し検出 + + // 変更 + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) || (tpUD && (csrUD == KEY_UP)) ) + { + if( (++sFreeSoftBoxCount) > LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX ) + { + sFreeSoftBoxCount = 0; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) || (tpUD && (csrUD == KEY_DOWN)) ) + { + if( (--sFreeSoftBoxCount) & 0x80 ) + { + sFreeSoftBoxCount = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX; + } + } + + // フリーソフト数が変わると使用ソフト数も変わる + sInstalledSoftBoxCount = (u8)(LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX - sFreeSoftBoxCount); + + // 決定 + if( pad.trg & PAD_BUTTON_A || (tpCommit && (csrCommit == KEY_OK)) ) + { + LCFG_TSD_SetFreeSoftBoxCount( sFreeSoftBoxCount ); + LCFG_TSD_SetInstalledSoftBoxCount( sInstalledSoftBoxCount ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + SetFreeSoftBoxInit(); + g_pNowProcess = SetFreeSoftBoxMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + SetFreeSoftBoxInit(); + g_pNowProcess = SetFreeSoftBoxMain; + return 0; + } + + // 再描画 + DrawSetFreeSoftBoxCountScene(); + return 0; +} + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c new file mode 100644 index 00000000..4f42d88e --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setOwnerInfo.c @@ -0,0 +1,1080 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: ownerInfo.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 + +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +#define USER_INFO_MENU_ELEMENT_NUM 4 // ユーザ情報メニューの項目数 + +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe + +typedef enum NameOrComment +{ + NOC_NAME, + NOC_COMMENT +}NameOrComment; + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- +static void SetNicknameInit( void ); +static int SetNicknameMain( void ); +static void SetBirthdayInit( void ); +static int SetBirthdayMain( void ); +static void SetUserColorInit( void ); +static int SetUserColorMain( void ); +static void SetCommentInit( void ); +static int SetCommentMain( void ); +static u8 MY_StrLen( const u16 *pStr ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう +static u16 s_csr = 0; +static const u16 *s_pStrSetting[ USER_INFO_MENU_ELEMENT_NUM ]; // メインメニュー用文字テーブルへのポインタリスト +static int s_char_mode = 0; +static u16 s_key_csr = 0; +static u8 s_color_csr = 0; +static BOOL s_birth_csr = FALSE; +static LCFGTWLDate s_temp_birthday; +static u16 s_temp_name[ LCFG_TWL_NICKNAME_LENGTH + 1 ]; +static u16 s_temp_comment[ LCFG_TWL_COMMENT_LENGTH + 1 ]; +static u8 s_temp_name_length; +static u8 s_temp_comment_length; + +// const data----------------------------------- +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; + +static const u16 *const s_pStrSettingElemTbl[ USER_INFO_MENU_ELEMENT_NUM ][ LCFG_TWL_LANG_CODE_MAX ] = { + { + (const u16 *)L"ユーザーネーム", + (const u16 *)L"NICKNAME", + (const u16 *)L"NICKNAME(F)", + (const u16 *)L"NICKNAME(G)", + (const u16 *)L"NICKNAME(I)", + (const u16 *)L"NICKNAME(S)", + }, + { + (const u16 *)L"誕生日", + (const u16 *)L"BIRTHDAY", + (const u16 *)L"BIRTHDAY(F)", + (const u16 *)L"BIRTHDAY(G)", + (const u16 *)L"BIRTHDAY(I)", + (const u16 *)L"BIRTHDAY(S)", + }, + { + (const u16 *)L"ユーザーカラー", + (const u16 *)L"USER COLOR", + (const u16 *)L"USER COLOR(F)", + (const u16 *)L"USER COLOR(G)", + (const u16 *)L"USER COLOR(I)", + (const u16 *)L"USER COLOR(S)", + }, + { + (const u16 *)L"コメント", + (const u16 *)L"COMMENT", + (const u16 *)L"COMMENT(F)", + (const u16 *)L"COMMENT(G)", + (const u16 *)L"COMMENT(I)", + (const u16 *)L"COMMENT(S)", + }, +}; + +static MenuPos s_settingPos[] = { + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, +}; + + +static const MenuParam s_settingParam = { + USER_INFO_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[ 0 ], + (const u16 **)&s_pStrSetting, +}; + +static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = { + L"かな", + L"カナ", + L"英数", + }; + +static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; + +static const u16 str_button_del[] = L"ADEL"; +static const u16 str_button_space[] = L"SPACE"; +static const u16 str_button_ok[] = L"OK"; +static const u16 str_button_cancel[] = L"CANCEL"; + +static const u16 *str_button[] = { + (const u16 *)str_button_del, + (const u16 *)str_button_space, + NULL, + NULL, + (const u16 *)str_button_ok, + (const u16 *)str_button_cancel, + }; + +//====================================================== +// オーナー情報編集 +//====================================================== + +static void SetSoftKeyboardButton(int mode) +{ + int l; + int count = 0; + for(l=0; lmonth, LCFG_TSD_GetBirthdayPtr()->day); + // カラー + color = LCFG_TSD_GetUserColor(); + PutStringUTF16( 128 , 12*8, TXT_UCOLOR_G0, L"■" ); + // コメント + SVC_CpuCopy( LCFG_TSD_GetCommentPtr(), tempbuf, 13 * 2, 16 ); + *(tempbuf+13)='\n'; + SVC_CpuCopy( LCFG_TSD_GetCommentPtr()+13, tempbuf+14, 13 * 2, 16 ); + *(tempbuf+LCFG_TWL_COMMENT_LENGTH+1)=0; + PutStringUTF16( 128-78 , 16*8 , TXT_UCOLOR_G0, tempbuf ); +} + +// オーナー情報編集の初期化 +void SetOwnerInfoInit( void ) +{ + int i; + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i = 0; i < USER_INFO_MENU_ELEMENT_NUM; i++ ) { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawOwnerInfoMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// オーナー情報編集メニュー +int SetOwnerInfoMain( void ) +{ + static u16 dummy = 0; + SelectSomethingFunc func[1]={SelectCancelFunc}; + BOOL tp_select,tp_cancel = FALSE; + + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++s_csr == USER_INFO_MENU_ELEMENT_NUM ) { + s_csr=0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_csr & 0x80 ) { + s_csr=USER_INFO_MENU_ELEMENT_NUM - 1; + } + } +#if 0 + if( pad.trg & PAD_BUTTON_SELECT ) { + u16 *pPhoto = (u16 *)LCFG_TSD_GetOwnerInfoPtr()->facePhoto; + int i; + for( i = 0; i < 64*64; i++ ) { + *pPhoto++ = (u16)i; + } + } +#endif + tp_select = SelectMenuByTP( &s_csr, &s_settingParam ); + + DrawOwnerInfoMenuScene(); + + // [CANCEL]ボタンチェック + tp_cancel = SelectSomethingByTP(&dummy, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( s_settingPos[ s_csr ].enable ) { + switch( s_csr ) { + case 0: + SetNicknameInit(); + g_pNowProcess = SetNicknameMain; + break; + case 1: + SetBirthdayInit(); + g_pNowProcess = SetBirthdayMain; + break; + case 2: + SetUserColorInit(); + g_pNowProcess = SetUserColorMain; + break; + case 3: + SetCommentInit(); + g_pNowProcess = SetCommentMain; + break; + } + } + }else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { + MachineSettingInit(); + return 0; + } + return 0; +} + +// ソフトウェアキー関係 +// キーの表示 +static void DrawCharKeys( void ) +{ + int l; + u16 code; + + for( l=0; l= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, s ); + } + } + } +} + +// 一文字削除 +static void DeleteACharacter( NameOrComment noc ) +{ + u16 *buf; + u8 *length; + if(noc == NOC_NAME) + { + buf = s_temp_name; + length = &s_temp_name_length; + }else if(noc == NOC_COMMENT) + { + buf = s_temp_comment; + length = &s_temp_comment_length; + }else + { + //unknown + return; + } + + if(*length > 0) buf[--(*length)] = CHAR_USCORE; +} + + +// 選択中文字キー・特殊キーで決定した時の挙動 +static void PushKeys( u16 code, NameOrComment noc ) +{ + u16 *buf; + u8 *length; + u16 max_length; + if(noc == NOC_NAME) + { + buf = s_temp_name; + length = &s_temp_name_length; + max_length = LCFG_TWL_NICKNAME_LENGTH; + }else if(noc == NOC_COMMENT) + { + buf = s_temp_comment; + length = &s_temp_comment_length; + max_length = LCFG_TWL_COMMENT_LENGTH; + }else + { + //unknown + return; + } + + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + // 特殊キー + switch(code) + { + case VAR_BUTTON1_: + case VAR_BUTTON2_: + SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); + break; + case DEL_BUTTON_: + DeleteACharacter(noc); + break; + case SPACE_BUTTON_: + if(*length < max_length) buf[(*length)++] = L' '; + break; + case OK_BUTTON_: + SVC_CpuClear(0, buf + *length, (max_length - *length) * 2, 16);// ゼロクリア + if(noc == NOC_NAME) { + LCFG_TSD_SetNickname( buf ); + }else if(noc == NOC_COMMENT) { + LCFG_TSD_SetComment( buf ); + } + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + // セーブ後にキャンセル処理と合流 + case CANCEL_BUTTON_: + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + break; + default:// unknown code + break; + } + } + else + { + // 普通キー + if(*length < max_length) buf[(*length)++] = code; + } +} + +// PadDetectOnKeyのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectSoftwareKeyFunc( u16 *csr, TPData *tgt ) +{ + // まずは候補となる座標(カーソル単位)を取得 + int csrx; + int csry; + int csrxy; + int a; + int b; + NNSG2dTextRect rect; + u16 code; + BOOL ret; + + csrx = tgt->x - CLIST_LT_X; + csrx = csrx - (CLIST_SEGMENT_INTERVAL*(csrx/(CLIST_MARGIN*CLIST_KEY_PER_SEGMENT+CLIST_SEGMENT_INTERVAL))); + csrx = csrx / CLIST_MARGIN; + csry = (tgt->y - CLIST_LT_Y) / CLIST_MARGIN; + if(csrx < 0 ) return FALSE; + + if ( csrx >= KEY_PER_LINE ) csrx = KEY_PER_LINE - 1; + csrxy = csrx + csry * KEY_PER_LINE; + + if ( csrxy < 0 || csrxy >= CHAR_LIST_CHAR_NUM) return FALSE;// 明らかにはみ出した + + // 候補座標のキーコード取得 + code = char_tbl[s_char_mode][csrxy]; + if(code == EOM_) return FALSE; + + // 候補座標の領域取得 + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + // rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, s ); + // 文字幅じゃかなり判定が厳しい……ギリギリまでとってみる + rect.width = CLIST_MARGIN; + rect.height = CLIST_MARGIN; + } + a = CLIST_LT_X + CLIST_MARGIN*(csrxy%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((csrxy%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT); + b = CLIST_LT_Y + CLIST_MARGIN*(csrxy/KEY_PER_LINE); + + // 候補座標の領域にタッチ座標が含まれているかチェック + ret = WithinRangeTP( a, b, a+rect.width, b+rect.height, tgt ); + + if(ret) + { + *csr = (u16)csrxy; + } + return ret; +} + +// ソフトウェアキー上でのキーパッド及びタッチパッド処理 +// 先にReadTPしておくこと。 +static void PadDetectOnKey( NameOrComment noc ) +{ + SelectSomethingFunc func[1]; + BOOL tp_select = FALSE; + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_RIGHT ){ // カーソルの移動 + do + { + if(s_key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_key_csr++; + else s_key_csr -= KEY_PER_LINE-1; + if( s_key_csr == CHAR_LIST_CHAR_NUM ) s_key_csr -= s_key_csr%KEY_PER_LINE; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_LEFT ){ + do + { + if(s_key_csr%KEY_PER_LINE != 0) s_key_csr--; + else s_key_csr += KEY_PER_LINE-1; + if( s_key_csr & 0x8000 ) s_key_csr = KEY_PER_LINE-1; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + do + { + s_key_csr += KEY_PER_LINE; + if( s_key_csr >= CHAR_LIST_CHAR_NUM ) s_key_csr -= KEY_PER_LINE*(s_key_csr/KEY_PER_LINE); + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( pad.trg & PAD_KEY_UP ){ + do + { + if( s_key_csr < KEY_PER_LINE ) s_key_csr += (CHAR_LIST_CHAR_NUM/KEY_PER_LINE)*KEY_PER_LINE; + else s_key_csr -= KEY_PER_LINE; + if( s_key_csr >= CHAR_LIST_CHAR_NUM ) s_key_csr -= KEY_PER_LINE; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + + func[0] = (SelectSomethingFunc)SelectSoftwareKeyFunc; + tp_select = SelectSomethingByTP(&s_key_csr, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // キーが押された + PushKeys( char_tbl[s_char_mode][s_key_csr], noc ); + }else if( pad.trg & PAD_BUTTON_B ) { + DeleteACharacter(noc); + } +} + +// ニックネーム編集画面の描画処理 +static void DrawSetNicknameScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"NICKNAME" ); + PutStringUTF16( 128-60 , 21 , TXT_UCOLOR_G0, s_temp_name ); + DrawCharKeys(); +} + +// ニックネーム編集の初期化 +static void SetNicknameInit( void ) +{ + SetSoftKeyboardButton(0); + s_key_csr = KEY_START; + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // ニックネーム用テンポラリバッファの初期化 + LCFG_TSD_GetNickname( s_temp_name ); + s_temp_name_length = MY_StrLen( s_temp_name ); + if( s_temp_name_length < LCFG_TWL_NICKNAME_LENGTH ) { + SVC_CpuClear(CHAR_USCORE, &s_temp_name[ s_temp_name_length ], + ( LCFG_TWL_NICKNAME_LENGTH - s_temp_name_length ) * 2, 16); + } + + DrawSetNicknameScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// ニックネーム編集メイン +static int SetNicknameMain( void ) +{ + ReadTP(); + + PadDetectOnKey(NOC_NAME); + + // 描画処理 + DrawSetNicknameScene(); + + return 0; +} + +// 誕生日編集画面の表示 +static void DrawSetBirthdayScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"BIRTHDAY" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( 128-36+16, 11*8, TXT_COLOR_BLACK, (const u16 *)L"月   日" ); + PrintfSJIS( 128-36, 11*8, (s_birth_csr ? TXT_COLOR_GREEN : TXT_COLOR_BLACK), "%d", s_temp_birthday.month / 10); + PrintfSJIS( 128-28, 11*8, (s_birth_csr ? TXT_COLOR_GREEN : TXT_COLOR_BLACK), "%d", s_temp_birthday.month % 10); + PrintfSJIS( 128+12, 11*8, (!s_birth_csr ? TXT_COLOR_GREEN : TXT_COLOR_BLACK), "%d", s_temp_birthday.day / 10); + PrintfSJIS( 128+20, 11*8, (!s_birth_csr ? TXT_COLOR_GREEN : TXT_COLOR_BLACK), "%d", s_temp_birthday.day % 10); +} + +// SetBirthdayMainのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectBirthdayFunc( u16 *csr, TPData *tgt ) +{ + int l; + + // 単純な実装例 + // 有効範囲全部について押されたかどうかの確認 + // 有効範囲の区分が多い時は、タッチパッドの座標から確認範囲を絞るのが望ましい + for(l=0; l<4; l++) + { + int x = 12*8 + (l%2)*6*8; + int y = 8*8 + (l/2)*6*8; + if(WithinRangeTP( x, y, x+16, y+16, tgt )) + { + *csr = (u16)l; + return TRUE; + } + } + + return FALSE; +} + +// 誕生日編集の初期化 +static void SetBirthdayInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 誕生日 + LCFG_TSD_GetBirthday( &s_temp_birthday ); + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_birth_scr_data, 0, sizeof(bg_birth_scr_data)); + + DrawSetBirthdayScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +static void CheckDate( void ) +{ + u8 maxday; + if( s_temp_birthday.month == 0 ) s_temp_birthday.month = 12; + if( s_temp_birthday.month == 13 ) s_temp_birthday.month = 1; + maxday = (u8)UTL_GetDayNum( 2000, s_temp_birthday.month ); + if( s_temp_birthday.day == 0 ) s_temp_birthday.day = maxday; + if( s_temp_birthday.day > maxday ) s_temp_birthday.day = 1; +} + +// 押している間数字が一定スピードで変化するような処理 +static void Birthday_AutoNumScrollByTP( void ) +{ + static u16 first_csr = 0xffff; + u16 temp_csr; + static int same_count = 0; + + if( tpd.disp.touch ) + { + BOOL t = SelectBirthdayFunc( &temp_csr, &tpd.disp ); + if( t ) + { + if(same_count == 0) // count start + { + first_csr = temp_csr; + same_count = 1; + }else if(first_csr == temp_csr) + { + if( same_count == 1 || (same_count > 29 && same_count%10==0)) + { + switch(temp_csr) + { + case 0: + s_birth_csr = TRUE; + s_temp_birthday.month--; + break; + case 1: + s_birth_csr = FALSE; + s_temp_birthday.day--; + break; + case 2: + s_birth_csr = TRUE; + s_temp_birthday.month++; + break; + case 3: + s_birth_csr = FALSE; + s_temp_birthday.day++; + break; + default: + break; + } + } + same_count++; + } + } + }else // touch==0 + { + same_count = 0; + first_csr = 0xffff; + } +} + +// 誕生日編集メイン +static int SetBirthdayMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tp_touch = FALSE; + u16 temp_ok_cancel; + + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ + (*(s_birth_csr ? &s_temp_birthday.month : &s_temp_birthday.day))++; + } + if( pad.trg & PAD_KEY_UP ){ + (*(s_birth_csr ? &s_temp_birthday.month : &s_temp_birthday.day))--; + } + if( pad.trg & (PAD_KEY_RIGHT | PAD_KEY_LEFT)){ // カーソルの移動 + s_birth_csr = !s_birth_csr; + } + + // 日付チェック + CheckDate(); + + // TPチェック + tp_touch = SelectSomethingByTP(&temp_ok_cancel, func, 2 ); + // TPでボタンを押している間数字が一定スピードで変化するような処理 + Birthday_AutoNumScrollByTP(); + + // 日付チェック + CheckDate(); + + DrawSetBirthdayScene(); + + if( pad.trg & PAD_BUTTON_A || (tp_touch && temp_ok_cancel == KEY_OK) ) { + LCFG_TSD_SetBirthday(&s_temp_birthday); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + return 0; + }else if( ( pad.trg & PAD_BUTTON_B ) || (tp_touch && temp_ok_cancel == KEY_CANCEL) ) { + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + return 0; + } + return 0; +} + +static void DrawColorSample( void ) +{ + int l; + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"USER COLOR" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + for(l=0;l<16;l++) //16色 + { + PutStringUTF16( 88 + 24 * (l%4), 54 + 24 * (l/4), TXT_UCOLOR_GRAY + l, (const u16 *)L"■" ); + } + for(l=0;l<4;l++) + { + PutStringUTF16( 83 + 24 * (s_color_csr%4) + 10*(l%2), 49 + 24 * (s_color_csr/4) + 10*(l/2), TXT_UCOLOR_G0, (const u16 *)L"■" ); + } +} + +// SetUserColorMainのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectColorFunc( u16 *csr, TPData *tgt ) +{ + // まずは候補となる座標(カーソル単位)を取得 + int csrx; + int csry; + int csrxy; + int a; + int b; + BOOL ret; + + csrx = (tgt->x - 88) / 24; + csry = (tgt->y - 54) / 24; + if(csrx < 0 ) return FALSE; + + if ( csrx >= 4 ) csrx = 3; + csrxy = csrx + csry * 4; + + if ( csrxy < 0 || csrxy >= 16) return FALSE;// はみ出した + + a = 88 + csrx * 24; + b = 54 + csry * 24; + + // 候補座標の領域にタッチ座標が含まれているかチェック + ret = WithinRangeTP( a, b, a+11, b+11, tgt ); + + if(ret) + { + *csr = (u16)csrxy; + } + return ret; +} + +// ユーザーカラー編集の初期化 +static void SetUserColorInit( void ) +{ + DrawColorSample(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // ユーザーカラー + s_color_csr = LCFG_TSD_GetUserColor(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// ユーザーカラー編集メイン +static int SetUserColorMain( void ) +{ + SelectSomethingFunc func[3]={SelectColorFunc, SelectCancelFunc, SelectOKFunc}; + BOOL tp_touch = FALSE; + u16 temp_csr; + + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + s_color_csr += 4; + if(s_color_csr >= 16) s_color_csr -= 16; + } + if( pad.trg & PAD_KEY_UP ){ + if(s_color_csr < 4) s_color_csr += 16; + s_color_csr -= 4; + } + if( pad.trg & PAD_KEY_RIGHT ){ + s_color_csr += 1; + if(s_color_csr%4 == 0) s_color_csr -= 4; + } + if( pad.trg & PAD_KEY_LEFT ){ + if(s_color_csr%4 == 0) s_color_csr += 4; + s_color_csr -= 1; + } + temp_csr = s_color_csr; + + // TPチェック + tp_touch = SelectSomethingByTP(&temp_csr, func, 3 ); + if ((temp_csr != KEY_OK && temp_csr != KEY_CANCEL)){ + s_color_csr = (u8)temp_csr; + } + + if( ( pad.trg & PAD_BUTTON_A ) || (tp_touch && temp_csr == KEY_OK) ) { // 色決定 + LCFG_TSD_SetUserColor( (u8 )s_color_csr ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + return 0; + }else if( ( pad.trg & PAD_BUTTON_B ) || (tp_touch && temp_csr == KEY_CANCEL) ) { + ChangeUserColor( LCFG_TSD_GetUserColor() ); // パレット色を元にもどす + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + return 0; + } + + ChangeUserColor( s_color_csr ); + DrawColorSample(); + + return 0; +} + +// コメント編集画面の描画処理 +static void DrawSetCommentScene( void ) +{ + u16 tempbuf[LCFG_TWL_COMMENT_LENGTH+2]; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"COMMENT" ); + SVC_CpuCopy( s_temp_comment, tempbuf, 13 * 2, 16 ); + *(tempbuf+13)='\n'; + SVC_CpuCopy( s_temp_comment+13, tempbuf+14, 13 * 2, 16 ); + *(tempbuf+LCFG_TWL_COMMENT_LENGTH+1)=0; + PutStringUTF16( 128-78 , 15 , TXT_UCOLOR_G0, tempbuf ); + DrawCharKeys(); +} + +// コメント編集の初期化 +static void SetCommentInit( void ) +{ + SetSoftKeyboardButton(0); + s_key_csr = KEY_START; + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // コメント用テンポラリバッファの初期化 + LCFG_TSD_GetComment( s_temp_comment ); + s_temp_comment_length = MY_StrLen( s_temp_comment ); + if( s_temp_comment_length < LCFG_TWL_COMMENT_LENGTH ) { + SVC_CpuClear(CHAR_USCORE, &s_temp_comment[ s_temp_comment_length ], + ( LCFG_TWL_COMMENT_LENGTH - s_temp_comment_length ) * 2, 16); + } + + DrawSetCommentScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// コメント編集メイン +static int SetCommentMain( void ) +{ + ReadTP(); + + PadDetectOnKey(NOC_COMMENT); + + // 描画処理 + DrawSetCommentScene(); + + return 0; +} + + +// UTF16の文字列長算出 +static u8 MY_StrLen( const u16 *pStr ) +{ + u8 len = 0; + while( *pStr++ ) { + ++len; + if( len == 255 ) { + break; + } + } + return len; +} + +//====================================================== +// ソフトウェアキーボード用キャラテーブル +//====================================================== + +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { + { // ひらがな + L'あ', L'い', L'う', L'え', L'お', + L'か', L'き', L'く', L'け', L'こ', DEL_BUTTON_, + L'さ', L'し', L'す', L'せ', L'そ', + L'た', L'ち', L'つ', L'て', L'と', SPACE_BUTTON_, + L'な', L'に', L'ぬ', L'ね', L'の', + L'は', L'ひ', L'ふ', L'へ', L'ほ', EOM_, + + L'ま', L'み', L'む', L'め', L'も', + L'や', EOM_, L'ゆ', EOM_, L'よ', VAR_BUTTON1_, + L'ら', L'り', L'る', L'れ', L'ろ', + L'わ', EOM_, EOM_, L'を', L'ん', VAR_BUTTON2_, + L'ぁ', L'ぃ', L'ぅ', L'ぇ', L'ぉ', + L'ゃ', EOM_, L'ゅ', EOM_, L'ょ', EOM_, + + L'が', L'ぎ', L'ぐ', L'げ', L'ご', + L'ざ', L'じ', L'ず', L'ぜ', L'ぞ', EOM_, + L'だ', L'ぢ', L'づ', L'で', L'ど', + L'ば', L'び', L'ぶ', L'べ', L'ぼ', OK_BUTTON_, + L'ぱ', L'ぴ', L'ぷ', L'ぺ', L'ぽ', + L'っ', L'、', L'。', L'!', L'?', EOM_, + + L'「', L'」', L'〜', EOM_, L'ー', + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // カタカナ + L'ア', L'イ', L'ウ', L'エ', L'オ', + L'カ', L'キ', L'ク', L'ケ', L'コ', DEL_BUTTON_, + L'サ', L'シ', L'ス', L'セ', L'ソ', + L'タ', L'チ', L'ツ', L'テ', L'ト', SPACE_BUTTON_, + L'ナ', L'ニ', L'ヌ', L'ネ', L'ノ', + L'ハ', L'ヒ', L'フ', L'ヘ', L'ホ', EOM_, + + L'マ', L'ミ', L'ム', L'メ', L'モ', + L'ヤ', EOM_, L'ユ', EOM_, L'ヨ', VAR_BUTTON1_, + L'ラ', L'リ', L'ル', L'レ', L'ロ', + L'ワ', EOM_, L'ヲ', EOM_, L'ン', VAR_BUTTON2_, + L'ァ', L'ィ', L'ゥ', L'ェ', L'ォ', + L'ャ', EOM_, L'ュ', EOM_, L'ョ', EOM_, + + L'ガ', L'ギ', L'グ', L'ゲ', L'ゴ', + L'ザ', L'ジ', L'ズ', L'ゼ', L'ゾ', EOM_, + L'ダ', L'ヂ', L'ヅ', L'デ', L'ド', + L'バ', L'ビ', L'ブ', L'ベ', L'ボ', OK_BUTTON_, + L'パ', L'ピ', L'プ', L'ペ', L'ポ', + L'ッ', L'、', L'。', L'!', L'ー', EOM_, + + L'「', L'」', L'〜', EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // 英数 + // 'A'から順にUTF-16文字コード(リトルエンディアン)で代入していく + 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, + 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, DEL_BUTTON_, + 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, SPACE_BUTTON_, + 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, + 0x005a, EOM_, EOM_, EOM_, EOM_, EOM_, + // 'a'から順 + 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, + 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, VAR_BUTTON1_, + 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, VAR_BUTTON2_, + 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, + 0x007a, EOM_, EOM_, EOM_, EOM_, EOM_, + // '0'から順 + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, + 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, EOM_, + // 特殊文字 + // '!' '&' '/' + 0x0021, EOM_, 0x0026, EOM_, 0x002f, + // ',' '.' '-' + 0x002c, EOM_, 0x002e, EOM_, 0x002d, OK_BUTTON_, + // ''' '"' + 0x0027, EOM_, 0x2033, EOM_, EOM_, + // '@' '(' ')' + 0x0040, EOM_, 0x0028, EOM_, 0x0029, EOM_, + + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, +}; + + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setParentalControl.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setParentalControl.c new file mode 100644 index 00000000..e9ed6966 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setParentalControl.c @@ -0,0 +1,2468 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setParentalControl.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// 以下のペアレンタルコントロール情報の設定 +// ++ レーティング制限のON/OFF +// ++ レーティング年齢 +// ++ レーティング団体 +// ++ 暗証番号(4桁の数字:asciiで格納) +// ++ 秘密の質問ID (質問内容が決定していないのでIDで指定) +// ++ 秘密の質問への回答(日本リージョンのみ文字数制限が半分になる:日本語3--32文字/その他6--64文字) +// +// <例外処理> +// ++ 暗証番号はasciiなので初期状態ではascii以外が格納されている可能性がある +// -> 各桁がasciiの範囲外のときメニュー画面/設定画面では '*' を表示 +// -- 設定画面では4桁すべてに正当な値が入力されるまでOKボタンを押せない(キャンセルは可能) +// ++ 秘密の質問への回答は日本リージョンだけ文字数制限が小さいので +// 文字数制限(32文字)以上の文字列が格納されている場合がある(他のリージョンから日本へリージョン変更したときなど) +// -> 設定画面では33文字目以降を切り捨てて32文字(制限ぎりぎり)の文字列とする +// -- 設定画面で決定ボタンが押されたときに33文字目以降を0クリアして登録する +// -- 設定画面でキャンセルされたときは元の文字列のままである +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// 改ページボタン領域 +#define PREVPAGE_BUTTON_TOP_X ( 2 * 8 ) +#define PREVPAGE_BUTTON_TOP_Y ( 2 * 8 ) +#define PREVPAGE_BUTTON_BOTTOM_X ( PREVPAGE_BUTTON_TOP_X + (2 * 8) + (9 * 8) ) +#define PREVPAGE_BUTTON_BOTTOM_Y ( PREVPAGE_BUTTON_TOP_Y + (2 * 8) ) +#define SUCCPAGE_BUTTON_TOP_X ( 18 * 8 ) +#define SUCCPAGE_BUTTON_TOP_Y ( 2 * 8 ) +#define SUCCPAGE_BUTTON_BOTTOM_X ( SUCCPAGE_BUTTON_TOP_X + (2 * 8) + (9 * 8) ) +#define SUCCPAGE_BUTTON_BOTTOM_Y ( SUCCPAGE_BUTTON_TOP_Y + (2 * 8) ) + +// ON/OFFボタン領域 +#define ON_BUTTON_TOP_X ( 8 * 8 ) +#define ON_BUTTON_TOP_Y ( 8 * 8 ) +#define ON_BUTTON_BOTTOM_X ( ON_BUTTON_TOP_X + (2 * 8) ) +#define ON_BUTTON_BOTTOM_Y ( ON_BUTTON_TOP_Y + (2 * 8) ) +#define OFF_BUTTON_TOP_X ( 18 * 8 ) +#define OFF_BUTTON_TOP_Y ( 8 * 8 ) +#define OFF_BUTTON_BOTTOM_X ( OFF_BUTTON_TOP_X + (3 * 8) ) +#define OFF_BUTTON_BOTTOM_Y ( OFF_BUTTON_TOP_Y + (2 * 8) ) + +// UP/DOWNボタン領域 +#define UP_BUTTON_TOP_X ( 8 * 8 ) +#define UP_BUTTON_TOP_Y ( 6 * 8 ) +#define UP_BUTTON_BOTTOM_X ( UP_BUTTON_TOP_X + (2 * 8) + (2 * 8) ) +#define UP_BUTTON_BOTTOM_Y ( UP_BUTTON_TOP_Y + (2 * 8) ) +#define DOWN_BUTTON_TOP_X ( 8 * 8 ) +#define DOWN_BUTTON_TOP_Y ( 14 * 8 ) +#define DOWN_BUTTON_BOTTOM_X ( DOWN_BUTTON_TOP_X + (2 * 8) + (4 * 8) ) +#define DOWN_BUTTON_BOTTOM_Y ( DOWN_BUTTON_TOP_Y + (2 * 8) ) + +// 複数のUP/DOWNボタン領域 +#define MULTI_UP_BUTTON_OFFSET_X ( 6 * 8 ) // 左端からのスペース +#define MULTI_UP_BUTTON_OFFSET_Y ( 6 * 8 ) +#define MULTI_UP_BUTTON_WIDTH_X ( 2 * 8 ) // ボタン幅 +#define MULTI_UP_BUTTON_WIDTH_Y ( 2 * 8 ) +#define MULTI_UP_BUTTON_INTERVAL_X ( 4 * 8 ) // 左右のボタン間隔(横に並べるのでXだけでよい) +#define MULTI_DOWN_BUTTON_OFFSET_X (MULTI_UP_BUTTON_OFFSET_X) +#define MULTI_DOWN_BUTTON_OFFSET_Y (14 * 8 ) +#define MULTI_DOWN_BUTTON_WIDTH_X ( 2 * 8 ) +#define MULTI_DOWN_BUTTON_WIDTH_Y ( 2 * 8 ) +#define MULTI_DOWN_BUTTON_INTERVAL_X (MULTI_UP_BUTTON_INTERVAL_X) + +// RESTRICT/NOT RESTRICTボタン領域 +#define RESTRICT_BUTTON_TOP_X ( 8 * 8 ) +#define RESTRICT_BUTTON_TOP_Y ( 10 * 8 ) +#define RESTRICT_BUTTON_BOTTOM_X ( RESTRICT_BUTTON_TOP_X + (8 * 8) ) +#define RESTRICT_BUTTON_BOTTOM_Y ( RESTRICT_BUTTON_TOP_Y + (2 * 8) ) +#define NOTRESTRICT_BUTTON_TOP_X ( 8 * 8 ) +#define NOTRESTRICT_BUTTON_TOP_Y ( 6 * 8 ) +#define NOTRESTRICT_BUTTON_BOTTOM_X ( NOTRESTRICT_BUTTON_TOP_X + (12 * 8) ) +#define NOTRESTRICT_BUTTON_BOTTOM_Y ( NOTRESTRICT_BUTTON_TOP_Y + ( 2 * 8) ) + + +// ページ数 +#define MS_PARENTAL_NUMOF_PAGES 3 + +// 項目の総数 +#define MS_PARENTAL_NUMOF_ELEMENTS 12 + +// ソフトウェアキーボードのパラメータ +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe +#define KEY_PREVPAGE 0xfffd +#define KEY_SUCCPAGE 0xfffc +#define KEY_ON 0xfffb +#define KEY_OFF 0xfffa +#define KEY_UP 0xfff9 +#define KEY_DOWN 0xfff8 +#define KEY_RESTRICT 0xfff7 +#define KEY_NOTRESTRICT 0xfff6 +#define MULTI_KEY_UP 0xffe0 +#define MULTI_KEY_DOWN 0xffd0 +#define MASK_MULTI_KEY 0xfff0 + +// 改行が必要なときの一行での表示文字数/何回改行するか +#define MS_PARENTAL_ANS_COL 16 +#define MS_PARENTAL_ANS_NUMOF_ROWS (LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX / MS_PARENTAL_ANS_COL - 1) + +// ソフトウェアキーボードを使用するモード +typedef enum eUseSoftKey +{ + USE_SOFTKEY_COMMON, // 不使用 + USE_SOFTKEY_ANSWER // 秘密の質問に対する回答 +}eUseSoftKey; + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + +static void SetRatingOgnInit( void ); +static int SetRatingOgnMain( void ); +static void SetRatingLockInit( void ); +static int SetRatingLockMain( void ); +static void SetRatingAgeInit( void ); +static int SetRatingAgeMain( void ); +static void SetSecretQuestionIDInit( void ); +static int SetSecretQuestionIDMain( void ); +static void SetAnswerInit( void ); +static int SetAnswerMain( void ); +static void SetPasswordInit( void ); +static int SetPasswordMain( void ); +static u8 MY_StrLen( const u16 *pStr ); +static void SetDrawnPageElement( void ); +static void SetBroadOnSettingInit( void ); +static int SetBroadOnSettingMain( void ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +// メニューで使用 +static u16 sCursorMenu = 0; + +// 流用 +static int s_char_mode = 0; // ソフトウェアキーボードの文字種別(かな/カナ/英数) +static u16 s_key_csr = 0; // 現在のキー位置 + +// 特定のモードでのみ使用 +static u8 sCurrentPage = 0; // ページ番号 +static BOOL sbInitPage = TRUE; // メニューに戻るときに1ページ目に戻すかどうか +static BOOL sbRatingLock = FALSE; // レーティング制限 +static u8 sRatingAge=0; // レーティング年齢 +static u16 sRatingOgnFirstIndex=0; // 団体リストのオフセット(テーブルの何番目から団体リストとして使用するか) +static u16 sCursorRatingOgn=0; // オフセットからの位置(リストから何番目の団体が選択されているか) +static u8 sRegion=0; // 本体のリージョン +static u16 spBufAnswer[ LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX + 1 ]; // 秘密の質問に対する回答 +static u8 sCurrentLenAnswer; +static u8 sBufSizeAnswer; +static u8 sMinLenAnswer; // -- 文字制限 +static u8 sMaxLenAnswer; +static u8 spBufPassword[ LCFG_TWL_PCTL_PASSWORD_LENGTH + 1 ]; // パスワード +static u16 sCursorPassword=0; +static BOOL sbValidPassword=FALSE; +static u8 sSecretQuestionID=0; +static BOOL sbEnableOKButton = FALSE; +static u8 sBroadOnMenu = 0; +static BOOL sbBroadOnSetting = FALSE; + +// const data----------------------------------- + +// ++ メインメニュー + +static const u16 *s_pStrSetting[ MS_PARENTAL_NUMOF_ELEMENTS ]; // メインメニュー用文字テーブルへのポインタリスト + +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM]; // ソフトウェアキーボードの文字配列 + +static const u16 *const s_pStrSettingElemTbl[ MS_PARENTAL_NUMOF_ELEMENTS ][ LCFG_TWL_LANG_CODE_MAX ] = { + + // ページ1 + { + (const u16 *)L"ペアレンタルコントロール", + (const u16 *)L"PARENTAL CONTROL", + (const u16 *)L"PARENTAL CONTROL(F)", + (const u16 *)L"PARENTAL CONTROL(G)", + (const u16 *)L"PARENTAL CONTROL(I)", + (const u16 *)L"PARENTAL CONTROL(S)", + (const u16 *)L"PARENTAL CONTROL(C)", + (const u16 *)L"PARENTAL CONTROL(K)", + }, + { + (const u16 *)L"レーティング対象年齢", + (const u16 *)L"RATING TARGET AGE", + (const u16 *)L"RATING TARGET AGE(F)", + (const u16 *)L"RATING TARGET AGE(G)", + (const u16 *)L"RATING TARGET AGE(I)", + (const u16 *)L"RATING TARGET AGE(S)", + (const u16 *)L"RATING TARGET AGE(C)", + (const u16 *)L"RATING TARGET AGE(K)", + }, + { + (const u16 *)L"レーティング団体", + (const u16 *)L"RATING ORGANIZATION", + (const u16 *)L"RATING ORGANIZATION(F)", + (const u16 *)L"RATING ORGANIZATION(G)", + (const u16 *)L"RATING ORGANIZATION(I)", + (const u16 *)L"RATING ORGANIZATION(S)", + (const u16 *)L"RATING ORGANIZATION(C)", + (const u16 *)L"RATING ORGANIZATION(K)", + }, + // ページ2 + { + (const u16 *)L"暗証番号", + (const u16 *)L"PASSWORD", + (const u16 *)L"PASSWORD(F)", + (const u16 *)L"PASSWORD(G)", + (const u16 *)L"PASSWORD(I)", + (const u16 *)L"PASSWORD(S)", + (const u16 *)L"PASSWORD(C)", + (const u16 *)L"PASSWORD(K)", + }, + { + (const u16 *)L"秘密の質問ID", + (const u16 *)L"SECRET QUESTION ID", + (const u16 *)L"SECRET QUESTION ID(F)", + (const u16 *)L"SECRET QUESTION ID(G)", + (const u16 *)L"SECRET QUESTION ID(I)", + (const u16 *)L"SECRET QUESTION ID(S)", + (const u16 *)L"SECRET QUESTION ID(C)", + (const u16 *)L"SECRET QUESTION ID(K)", + }, + { + (const u16 *)L"秘密の質問への回答", + (const u16 *)L"ANSWER FOR SECRET QUESTION", + (const u16 *)L"ANSWER FOR SECRET QUESTION(F)", + (const u16 *)L"ANSWER FOR SECRET QUESTION(G)", + (const u16 *)L"ANSWER FOR SECRET QUESTION(I)", + (const u16 *)L"ANSWER FOR SECRET QUESTION(S)", + (const u16 *)L"ANSWER FOR SECRET QUESTION(C)", + (const u16 *)L"ANSWER FOR SECRET QUESTION(K)", + }, + + // ページ3 + { + (const u16 *)L"ピクトチャット起動", + (const u16 *)L"PictoChat Boot", + (const u16 *)L"PictoChat Boot(F)", + (const u16 *)L"PictoChat Boot(G)", + (const u16 *)L"PictoChat Boot(I)", + (const u16 *)L"PictoChat Boot(S)", + (const u16 *)L"PictoChat Boot(C)", + (const u16 *)L"PictoChat Boot(K)", + }, + { + (const u16 *)L"DSダウンロード起動", + (const u16 *)L"DSDownload Boot", + (const u16 *)L"DSDownload Boot(F)", + (const u16 *)L"DSDownload Boot(G)", + (const u16 *)L"DSDownload Boot(I)", + (const u16 *)L"DSDownload Boot(S)", + (const u16 *)L"DSDownload Boot(C)", + (const u16 *)L"DSDownload Boot(K)", + }, + { + (const u16 *)L"ブラウザ起動", + (const u16 *)L"Browser Boot", + (const u16 *)L"Browser Boot(F)", + (const u16 *)L"Browser Boot(G)", + (const u16 *)L"Browser Boot(I)", + (const u16 *)L"Browser Boot(S)", + (const u16 *)L"Browser Boot(C)", + (const u16 *)L"Browser Boot(K)", + }, + { + (const u16 *)L"Wiiポイント", + (const u16 *)L"Wii Point", + (const u16 *)L"Wii Point(F)", + (const u16 *)L"Wii Point(G)", + (const u16 *)L"Wii Point(I)", + (const u16 *)L"Wii Point(S)", + (const u16 *)L"Wii Point(C)", + (const u16 *)L"Wii Point(K)", + }, + { + (const u16 *)L"写真交換", + (const u16 *)L"Photo Exchange", + (const u16 *)L"Photo Exchange(F)", + (const u16 *)L"Photo Exchange(G)", + (const u16 *)L"Photo Exchange(I)", + (const u16 *)L"Photo Exchange(S)", + (const u16 *)L"Photo Exchange(C)", + (const u16 *)L"Photo Exchange(K)", + }, + { + (const u16 *)L"UGC", + (const u16 *)L"UGC", + (const u16 *)L"UGC(F)", + (const u16 *)L"UGC(G)", + (const u16 *)L"UGC(I)", + (const u16 *)L"UGC(S)", + (const u16 *)L"UGC(C)", + (const u16 *)L"UGC(K)", + }, +}; + +// 表示位置 +static MenuPos s_settingPos[] = { + // ページ1 + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + + // ページ2 + { TRUE, 3 * 8, 6 * 8 }, + { TRUE, 3 * 8, 8 * 8 }, + { TRUE, 3 * 8, 10 * 8 }, + + // ページ3 + { TRUE, 2 * 8, 6 * 8 }, + { TRUE, 2 * 8, 8 * 8 }, + { TRUE, 2 * 8, 10 * 8 }, + { TRUE, 2 * 8, 12 * 8 }, + { TRUE, 2 * 8, 14 * 8 }, + { TRUE, 2 * 8, 16 * 8 }, +}; + +// 各ページの表示項目数 +static const int sNumOfPageElements[] = +{ + 3, + 3, + 6, +}; + +// 表示パラメータ +static MenuParam s_settingParam = +{ + 3, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[0], + (const u16 **)&s_pStrSetting, +}; + +// ++ ソフトウェアキーボード + +static const u16 *str_button_char[CHAR_LIST_MODE_NUM] = +{ + L"かな", + L"カナ", + L"英数", +}; + +static u16 next_char_mode[CHAR_LIST_MODE_NUM-1]; + +static const u16 str_button_del[] = L"ADEL"; +static const u16 str_button_space[] = L"SPACE"; +static const u16 str_button_ok[] = L"OK"; +static const u16 str_button_cancel[] = L"CANCEL"; + +static const u16 *str_button[] = +{ + (const u16 *)str_button_del, + (const u16 *)str_button_space, + NULL, + NULL, + (const u16 *)str_button_ok, + (const u16 *)str_button_cancel, +}; + +// ++ レーティング団体の選択 + +// リージョンの文字列 +static const u16 *sppRegionCharTable[] = +{ + (const u16*)L"JAPAN", + (const u16*)L"AMERICA", + (const u16*)L"EUROPE", + (const u16*)L"AUSTRALIA", + (const u16*)L"CHINA", + (const u16*)L"KOREA", +}; + +// レーティングリストのオフセット(リストの先頭にUNDEFINEDがあるため) +static const u16 sRatingOgnIndexOffset = 0; // 1がリストの先頭index + +// レーティング団体 +static const u16 *sppRatingOgnCharTable[] = +{ + (const u16*)L"CERO", //LCFG_TWL_PCTL_OGN_CERO = 0, // 日本 + (const u16*)L"ESRB", //LCFG_TWL_PCTL_OGN_ESRB = 1, // アメリカ + (const u16*)L"RESERVED2", //LCFG_TWL_PCTL_OGN_RESERVED2 = 2, // + (const u16*)L"USK", //LCFG_TWL_PCTL_OGN_USK = 3, // ドイツ + (const u16*)L"PEGI GENERAL", //LCFG_TWL_PCTL_OGN_PEGI_GEN = 4, // 欧州 + (const u16*)L"RESERVED5", //LCFG_TWL_PCTL_OGN_RESERVED5 = 5, // + (const u16*)L"PEGI PORTUGAL", //LCFG_TWL_PCTL_OGN_PEGI_PRT = 6, // ポルトガル + (const u16*)L"PEGI BBFC", //LCFG_TWL_PCTL_OGN_PEGI_BBFC = 7, // イギリス + (const u16*)L"OFLC", //LCFG_TWL_PCTL_OGN_OFLC = 8, // オーストラリア、ニュージーランド + (const u16*)L"GRB", //LCFG_TWL_PCTL_OGN_GRB = 9, // 韓国 +}; + +// 表示位置のリスト +static MenuPos spRatingOgnPosTable[] = +{ + { TRUE, 10 * 8, 8 * 8 }, // 日本 + { TRUE, 10 * 8, 8 * 8 }, // アメリカ + { TRUE, 10 * 8, 8 * 8 }, + { TRUE, 10 * 8, 10 * 8 }, + { TRUE, 10 * 8, 12 * 8 }, // 欧州 + { TRUE, 10 * 8, 14 * 8 }, + { TRUE, 10 * 8, 16 * 8 }, + { TRUE, 10 * 8, 18 * 8 }, + { TRUE, 10 * 8, 8 * 8 }, // オーストラリア + { TRUE, 10 * 8, 8 * 8 }, // 韓国 +}; + +// リージョンごとの団体数 +static const int spNumOfRatingOgnsTable[] = +{ + 1, // 日本 + 1, // アメリカ + 6, // 欧州 + 1, // オーストラリア + 0, // 中国 + 1, // 韓国 +}; + +static const int sIndexFirstOgnTable[] = { + 0, + 1, + 2, + 8, + 0, + 9, +}; + +// ここに表示したい(選択させたい)リストをコピーする +static const u16 *sppRatingOgnCharList[ LCFG_TWL_PCTL_OGN_MAX ]; + +// 表示/選択関数に渡すパラメータ +static MenuParam sRatingOgnMenuParam = +{ + 1, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &spRatingOgnPosTable[0], + (const u16 **)&sppRatingOgnCharList, +}; + +// ++ BroadOn用の設定項目 +enum +{ + MS_BROADON_PICTOCHAT = 0, + MS_BROADON_DS_DOWNLOAD = 1, + MS_BROADON_BROWSER = 2, + MS_BROADON_WIIPOINT = 3, + MS_BROADON_PHOTO_EXCHANGE = 4, + MS_BROADON_UGC = 5 +}; + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +static void SetSoftKeyboardButton(int mode) +{ + int l; + int count = 0; + for(l=0; l 25 ) + { + count[i] = 25 - 10; + rep[i] = TRUE; + } + else + { + (count[i])++; + } + } + else // 押されていないとき + { + count[i] = 0; + } + prev[i] = curr[i]; // 状態を記憶 + } + + if(trg[0] || rep[0]) + { + *csr = KEY_UP; + ret = TRUE; + } + else if(trg[1] || rep[1]) + { + *csr = KEY_DOWN; + ret = TRUE; + } + else + { + ret = FALSE; + } + return ret; +} +/* +// UP/DOWN複数個ボタン専用SelectSomethingFuncの実装 +static BOOL SelectMultiUPDOWNFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + int topX, topY, bottomX, bottomY; + int i; + for( i=0; i < 4; i++ ) // 左から順に + { + // UPボタン + topX = MULTI_UP_BUTTON_OFFSET_X + (MULTI_UP_BUTTON_WIDTH_X * i) + (MULTI_UP_BUTTON_INTERVAL_X * i); + bottomX = topX + MULTI_UP_BUTTON_WIDTH_X; + topY = MULTI_UP_BUTTON_OFFSET_Y; + bottomY = topY + MULTI_UP_BUTTON_WIDTH_Y; + ret = WithinRangeTP( topX, topY, bottomX, bottomY, tgt ); + if(ret) + { + *csr = (u16)(MULTI_KEY_UP | i); // ボタンの種類 + 番号 + break; + } + + // DOWNボタン + topX = MULTI_DOWN_BUTTON_OFFSET_X + (MULTI_DOWN_BUTTON_WIDTH_X * i) + (MULTI_DOWN_BUTTON_INTERVAL_X * i); + bottomX = topX + MULTI_DOWN_BUTTON_WIDTH_X; + topY = MULTI_DOWN_BUTTON_OFFSET_Y; + bottomY = topY + MULTI_DOWN_BUTTON_WIDTH_Y; + ret = WithinRangeTP( topX, topY, bottomX, bottomY, tgt ); + if(ret) + { + *csr = (u16)(MULTI_KEY_DOWN | i); + break; + } + } + return ret; +} +*/ +// UP/DOWN複数個ボタンの長押しとトリガを検出する +static BOOL DetectTouchMultiUD( u16 *csr ) +{ + BOOL curr[8] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; // 0--3:UP/4--8:DOWN + static BOOL prev[8] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; + BOOL trg[8] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; + BOOL rep[8] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}; + static u8 count[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + BOOL ret = FALSE; + int topX, topY, bottomX, bottomY; + int i; + + for( i=0; i < 8; i++ ) + { + if( i < 4 ) + { + // UPボタン + topX = MULTI_UP_BUTTON_OFFSET_X + (MULTI_UP_BUTTON_WIDTH_X * i) + (MULTI_UP_BUTTON_INTERVAL_X * i); + bottomX = topX + MULTI_UP_BUTTON_WIDTH_X; + topY = MULTI_UP_BUTTON_OFFSET_Y; + bottomY = topY + MULTI_UP_BUTTON_WIDTH_Y; + curr[i] = WithinRangeTP( topX, topY, bottomX, bottomY, &tpd.disp ); + } + else + { + int pos = i - 4; + + // DOWNボタン + topX = MULTI_DOWN_BUTTON_OFFSET_X + (MULTI_DOWN_BUTTON_WIDTH_X * pos) + (MULTI_DOWN_BUTTON_INTERVAL_X * pos); + bottomX = topX + MULTI_DOWN_BUTTON_WIDTH_X; + topY = MULTI_DOWN_BUTTON_OFFSET_Y; + bottomY = topY + MULTI_DOWN_BUTTON_WIDTH_Y; + curr[i] = WithinRangeTP( topX, topY, bottomX, bottomY, &tpd.disp ); + } + + // はじめて押されたかどうか + if( !prev[i] && curr[i] ) + { + trg[i] = TRUE; + } + // 長押しカウント + if( curr[i] ) + { + if( trg[i] ) + { + count[i] = 1; + } + else if( count[i] > 25 ) + { + count[i] = 25 - 10; + rep[i] = TRUE; + } + else + { + (count[i])++; + } + } + else // 押されていないとき + { + count[i] = 0; + } + prev[i] = curr[i]; // 状態を記憶 + } + + ret = FALSE; + for( i=0; i < 8; i++ ) + { + if( (i<4) && (trg[i] || rep[i]) ) + { + *csr = (u16)(MULTI_KEY_UP | i); + ret = TRUE; + break; + } + else if( (i>=4) && (trg[i] || rep[i]) ) + { + *csr = (u16)(MULTI_KEY_DOWN | (i-4)); + ret = TRUE; + break; + } + } + return ret; +} + +// RESTRICT/NOT RESTRICTボタン専用SelectSomethingFuncの実装 +static BOOL SelectRESTRICTFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( RESTRICT_BUTTON_TOP_X, RESTRICT_BUTTON_TOP_Y, + RESTRICT_BUTTON_BOTTOM_X, RESTRICT_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_RESTRICT; + return ret; +} +static BOOL SelectNOTRESTRICTFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( NOTRESTRICT_BUTTON_TOP_X, NOTRESTRICT_BUTTON_TOP_Y, + NOTRESTRICT_BUTTON_BOTTOM_X, NOTRESTRICT_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_NOTRESTRICT; + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawParentalControlMenuScene( void ) +{ + u16 utf16Button[2]; + int x,y,i; + u16 buf[2] = {0,0}; + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PARENTAL CONTROL" ); + PrintfSJIS( 25*8, 0, TXT_COLOR_BLUE, "%d/3", sCurrentPage+1 ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + if( sCurrentPage > 0 ) + { + utf16Button[0] = 0xE004; + utf16Button[1] = 0; + PutStringUTF16( PREVPAGE_BUTTON_TOP_X, PREVPAGE_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)utf16Button ); + PutStringUTF16( PREVPAGE_BUTTON_TOP_X+2*8, PREVPAGE_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Prev Page" ); + } + if( sCurrentPage < (MS_PARENTAL_NUMOF_PAGES-1) ) + { + utf16Button[0] = 0xE005; + utf16Button[1] = 0; + PutStringUTF16( SUCCPAGE_BUTTON_TOP_X, SUCCPAGE_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Next Page" ); + PutStringUTF16( SUCCPAGE_BUTTON_TOP_X+9*8, SUCCPAGE_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)utf16Button ); + } + // メニュー項目 + DrawMenu( sCursorMenu, &s_settingParam ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得して表示 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + switch( sCurrentPage ) // ページ別に表示項目が変わる + { + case 0: + // ペアレンタルコントロール制限のON/OFF + PutStringUTF16( 23*8, s_settingPos[0].y, TXT_UCOLOR_G0, + LCFG_TSD_IsSetParentalControl() ? L"ON" : L"OFF" ); + // レーティング年齢 + PrintfSJIS( 23*8, s_settingPos[1].y, TXT_UCOLOR_G0, "%d", LCFG_TSD_GetPCTLRatingAge() ); + // レーティング団体 + PutStringUTF16( 6*8, 2*8+s_settingPos[2].y, TXT_UCOLOR_G0, + sppRatingOgnCharTable[ LCFG_TSD_GetPCTLRatingOgn() ] ); + break; + + case 1: + // 暗証番号 + for( i=0; i < LCFG_TWL_PCTL_PASSWORD_LENGTH; i++ ) + { + const char *pPassword = LCFG_TSD_GetPCTLPasswordPtr(); + if( ('0' <= pPassword[i]) && (pPassword[i] <= '9') ) + { + PrintfSJIS( 23*8+i*8, s_settingPos[3].y, TXT_UCOLOR_G0, "%c", pPassword[i] ); + } + else + { + PrintfSJIS( 23*8+i*8, s_settingPos[3].y, TXT_UCOLOR_G0, "*" ); + } + } + //PrintfSJIS( 23*8, s_settingPos[3].y, TXT_UCOLOR_G0, "%s", LCFG_TSD_GetPCTLPasswordPtr() ); + // 秘密の質問ID + PrintfSJIS( 23*8, s_settingPos[4].y, TXT_UCOLOR_G0, "%d", LCFG_TSD_GetPCTLSecretQuestionID() ); + // 秘密の質問への回答 + for( y=0; y < (MS_PARENTAL_ANS_NUMOF_ROWS+1); y++ ) // 1行ごとに表示 + { + const u16 *pAnswer = LCFG_TSD_GetPCTLSecretAnswerPtr(); + for( x=0; x < MS_PARENTAL_ANS_COL; x++ ) // 1文字ずつ表示(半角/全角混ざっても等間隔で表示したいため) + { + buf[0] = pAnswer[MS_PARENTAL_ANS_COL*y + x]; + buf[1] = 0; + PutStringUTF16( 4*8 + 12*x, s_settingPos[5].y + 2*8*y + 2*8, TXT_UCOLOR_G0, buf ); + } + } + break; + + case 2: + PutStringUTF16( 17*8, 6*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictPictoChatBoot() ? L"Restricted" : L"Not Restricted" ); + PutStringUTF16( 17*8, 8*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictDSDownloadBoot() ? L"Restricted" : L"Not Restricted" ); + PutStringUTF16( 17*8, 10*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictBrowserBoot() ? L"Restricted" : L"Not Restricted" ); + PutStringUTF16( 17*8, 12*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictWiiPoint() ? L"Restricted" : L"Not Restricted" ); + PutStringUTF16( 17*8, 14*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictPhotoExchange() ? L"Restricted" : L"Not Restricted" ); + PutStringUTF16( 17*8, 16*8, TXT_UCOLOR_G0, + LCFG_TSD_IsRestrictUGC() ? L"Restricted" : L"Not Restricted" ); + break; + } +} + +// 表示項目をページごとにセット +static void SetDrawnPageElement( void ) +{ + int index; + int page; + int i; + + // 先頭の項目のindexを調べる + index = 0; + for( page=0; page < sCurrentPage; page++ ) + { + index = index + sNumOfPageElements[page]; + } + + //DEBUGPRINT( "current page is %d\n", sCurrentPage ); + //DEBUGPRINT( "index is %d\n", index ); + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + s_settingParam.num = sNumOfPageElements[ sCurrentPage ]; + s_settingParam.pos = &(s_settingPos[ index ]); + for( i=0; i < sNumOfPageElements[ sCurrentPage ]; i++,index++ ) + { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ index ][ LCFG_TSD_GetLanguage() ]; + } +} + +// 初期化 +void SetParentalControlInit( void ) +{ + // ページの初期化 + if( sbInitPage ) // 特別にFALSEが指定されたときだけページをそのままにする + { + sCurrentPage = 0; + } + sbInitPage = TRUE; + SetDrawnPageElement(); + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawParentalControlMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// メニューから呼ばれるメイン +int SetParentalControlMain( void ) +{ + SelectSomethingFunc func[3]={SelectCancelFunc, SelectPrevPageFunc, SelectSuccPageFunc}; + BOOL tp_select; + BOOL tpCommit = FALSE; + u16 padrep; + static u16 commit; + + ReadTP(); + + padrep = DetectPadRepeat(); // 長押し検出 + + // ページが変わってカーソルがはみ出していたら修正 + if( sCursorMenu >= (u16)sNumOfPageElements[ sCurrentPage ] ) + { + sCursorMenu = (u16)(sNumOfPageElements[ sCurrentPage ] - 1); + } + + // メニューからの項目選択 + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++sCursorMenu >= (u16)sNumOfPageElements[ sCurrentPage ] ) { + sCursorMenu = 0; + } + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + if( --sCursorMenu & 0x80 ) { + sCursorMenu = (u16)(sNumOfPageElements[ sCurrentPage ] - 1); + } + } + tp_select = SelectMenuByTP( &sCursorMenu, &s_settingParam ); + + // 特殊ボタンタッチ + tpCommit = SelectSomethingByTP( &commit, func, 3 ); + + // メニューへの分岐 + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( (s_settingParam.pos[sCursorMenu]).enable ) { + switch( sCurrentPage ) + { + case 0: + switch( sCursorMenu ) + { + case 0: + SetRatingLockInit(); + g_pNowProcess = SetRatingLockMain; + break; + case 1: + SetRatingAgeInit(); + g_pNowProcess = SetRatingAgeMain; + break; + case 2: + SetRatingOgnInit(); + g_pNowProcess = SetRatingOgnMain; + break; + } + break; + + case 1: + switch( sCursorMenu ) + { + case 0: + SetPasswordInit(); + g_pNowProcess = SetPasswordMain; + break; + case 1: + SetSecretQuestionIDInit(); + g_pNowProcess = SetSecretQuestionIDMain; + break; + case 2: + SetAnswerInit(); + g_pNowProcess = SetAnswerMain; + break; + case 3: + break; + } + break; + + case 2: + // すべてON/OFF設定なので設定関数を共通化してフラグで設定項目切り替え + switch( sCursorMenu ) + { + case 0: + sBroadOnMenu = MS_BROADON_PICTOCHAT; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + case 1: + sBroadOnMenu = MS_BROADON_DS_DOWNLOAD; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + case 2: + sBroadOnMenu = MS_BROADON_BROWSER; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + case 3: + sBroadOnMenu = MS_BROADON_WIIPOINT; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + case 4: + sBroadOnMenu = MS_BROADON_PHOTO_EXCHANGE; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + case 5: + sBroadOnMenu = MS_BROADON_UGC; + SetBroadOnSettingInit(); + g_pNowProcess = SetBroadOnSettingMain; + break; + } + break; + + } // switch( sCurrentPage ) + } // if( (s_settingParam.pos[sCursorMenu]).enable ) + } // if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + MachineSettingInit(); + return 0; + } + else if( (pad.trg & PAD_BUTTON_L) || (tpCommit && (commit == KEY_PREVPAGE)) ) + { + if( sCurrentPage > 0 ) + { + sCurrentPage--; + } + } + else if( (pad.trg & PAD_BUTTON_R) || (tpCommit && (commit == KEY_SUCCPAGE)) ) + { + if( sCurrentPage < (MS_PARENTAL_NUMOF_PAGES -1) ) + { + sCurrentPage++; + } + } + + // 再描画 + SetDrawnPageElement(); + DrawParentalControlMenuScene(); + return 0; +} + +//========================================================= +// +// ソフトウェアキーボード +// +//========================================================= + +// キーの表示 +static void DrawCharKeys( void ) +{ + int l; + u16 code; + + for( l=0; l= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + if( !sbEnableOKButton && (s_key_csr == l) && (code == OK_BUTTON_) ) + { + color = TXT_COLOR_RED; // OKさせないときは色を変える + } + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + PutStringUTF16( CLIST_LT_X + CLIST_MARGIN*(l%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((l%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT) , + CLIST_LT_Y + CLIST_MARGIN*(l/KEY_PER_LINE) , color, s ); + } + } + } +} + +// 一文字削除 +static void DeleteACharacter( eUseSoftKey noc ) +{ + u16 *buf; + u8 *length; + if(noc == USE_SOFTKEY_COMMON) + { + } + else if(noc == USE_SOFTKEY_ANSWER) + { + buf = spBufAnswer; + length = &sCurrentLenAnswer; + } + else + { + //unknown + return; + } + + if(*length > 0) buf[--(*length)] = CHAR_USCORE; +} + + +// 選択中文字キー・特殊キーで決定した時の挙動 +static void PushKeys( u16 code, eUseSoftKey noc ) +{ + u16 *buf; + u8 *length; + u16 min_length; + u16 max_length; + u16 bufsize; + if(noc == USE_SOFTKEY_COMMON) + { + // unused + return; + } + else if(noc == USE_SOFTKEY_ANSWER) + { + buf = spBufAnswer; + length = &sCurrentLenAnswer; + // 最大長は言語によって異なる + min_length = sMinLenAnswer; + max_length = sMaxLenAnswer; + bufsize = sBufSizeAnswer; + } + else + { + //unknown + return; + } + + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + // 特殊キー + switch(code) + { + case VAR_BUTTON1_: + case VAR_BUTTON2_: + SetSoftKeyboardButton(next_char_mode[code - VAR_BUTTON1_]); + break; + case DEL_BUTTON_: + DeleteACharacter(noc); + break; + case SPACE_BUTTON_: + if(*length < max_length) buf[(*length)++] = L' '; + break; + case OK_BUTTON_: + if( *length >= min_length ) // 最小文字数に満たないときはOKできない + { + //DEBUGPRINT( "OK: length = %d, min_length = %d, max_length = %d\n", *length, min_length, max_length ); + + // 上限とバッファサイズが異なるときに中間のデータを0クリアしておいたほうが安全 + SVC_CpuClear(0, buf + *length, (bufsize - *length) * 2, 16 ); // 文字数の上限までではなくバッファの最後まで0クリア + + // デバッグ用 + //for( i=0; i < bufsize; i++ ) + //{ + // DEBUGPRINT( "%04x", buf[i] ); + // if( ((i+1)%16) == 0 ) DEBUGPRINT( ",\n" ); + // else if( (i+1) == bufsize ) DEBUGPRINT( "\n" ); + // else DEBUGPRINT( "," ); + //} + + if(noc == USE_SOFTKEY_COMMON) + { + } + else if(noc == USE_SOFTKEY_ANSWER) + { + LCFG_TSD_SetPCTLSecretAnswer( buf ); + } + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + } + break; + case CANCEL_BUTTON_: + sbInitPage = FALSE; // ページをそのままにしておく + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + break; + default:// unknown code + break; + } + } + else + { + // 普通キー + if(*length < max_length) buf[(*length)++] = code; + } +} + +// PadDetectOnKeyのSelectSomethingByTPで使うSelectSomethingFuncの実装 +static BOOL SelectSoftwareKeyFunc( u16 *csr, TPData *tgt ) +{ + // まずは候補となる座標(カーソル単位)を取得 + int csrx; + int csry; + int csrxy; + int a; + int b; + NNSG2dTextRect rect; + u16 code; + BOOL ret; + + csrx = tgt->x - CLIST_LT_X; + csrx = csrx - (CLIST_SEGMENT_INTERVAL*(csrx/(CLIST_MARGIN*CLIST_KEY_PER_SEGMENT+CLIST_SEGMENT_INTERVAL))); + csrx = csrx / CLIST_MARGIN; + csry = (tgt->y - CLIST_LT_Y) / CLIST_MARGIN; + if(csrx < 0 ) return FALSE; + + if ( csrx >= KEY_PER_LINE ) csrx = KEY_PER_LINE - 1; + csrxy = csrx + csry * KEY_PER_LINE; + + if ( csrxy < 0 || csrxy >= CHAR_LIST_CHAR_NUM) return FALSE;// 明らかにはみ出した + + // 候補座標のキーコード取得 + code = char_tbl[s_char_mode][csrxy]; + if(code == EOM_) return FALSE; + + // 候補座標の領域取得 + if( (code >= CODE_BUTTON_TOP_) && (code < CODE_BUTTON_BOTTOM_) ) + { + int x = code - CODE_BUTTON_TOP_; + rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, str_button[x] ); + } + else + { + u16 s[2]; + s[0] = code; + s[1] = 0; + // rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, s ); + // 文字幅じゃかなり判定が厳しい……ギリギリまでとってみる + rect.width = CLIST_MARGIN; + rect.height = CLIST_MARGIN; + } + a = CLIST_LT_X + CLIST_MARGIN*(csrxy%KEY_PER_LINE) + CLIST_SEGMENT_INTERVAL*((csrxy%KEY_PER_LINE)/CLIST_KEY_PER_SEGMENT); + b = CLIST_LT_Y + CLIST_MARGIN*(csrxy/KEY_PER_LINE); + + // 候補座標の領域にタッチ座標が含まれているかチェック + ret = WithinRangeTP( a, b, a+rect.width, b+rect.height, tgt ); + + if(ret) + { + *csr = (u16)csrxy; + } + return ret; +} + +// ソフトウェアキー上でのキーパッド及びタッチパッド処理 +// 先にReadTPしておくこと。 +static void PadDetectOnKey( eUseSoftKey noc ) +{ + SelectSomethingFunc func[1]; + BOOL tp_select = FALSE; + u16 padrep; + + // 長押し検出 + padrep = DetectPadRepeat(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( (pad.trg & PAD_KEY_RIGHT) || (padrep & PAD_KEY_RIGHT) ){ // カーソルの移動 + do + { + if(s_key_csr%KEY_PER_LINE != KEY_PER_LINE-1) s_key_csr++; + else s_key_csr -= KEY_PER_LINE-1; + if( s_key_csr == CHAR_LIST_CHAR_NUM ) s_key_csr -= s_key_csr%KEY_PER_LINE; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( (pad.trg & PAD_KEY_LEFT) || (padrep & PAD_KEY_LEFT) ){ + do + { + if(s_key_csr%KEY_PER_LINE != 0) s_key_csr--; + else s_key_csr += KEY_PER_LINE-1; + if( s_key_csr & 0x8000 ) s_key_csr = KEY_PER_LINE-1; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + do + { + s_key_csr += KEY_PER_LINE; + if( s_key_csr >= CHAR_LIST_CHAR_NUM ) s_key_csr -= KEY_PER_LINE*(s_key_csr/KEY_PER_LINE); + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + do + { + if( s_key_csr < KEY_PER_LINE ) s_key_csr += (CHAR_LIST_CHAR_NUM/KEY_PER_LINE)*KEY_PER_LINE; + else s_key_csr -= KEY_PER_LINE; + if( s_key_csr >= CHAR_LIST_CHAR_NUM ) s_key_csr -= KEY_PER_LINE; + } + while(char_tbl[s_char_mode][s_key_csr]==EOM_); + } + + func[0] = (SelectSomethingFunc)SelectSoftwareKeyFunc; + tp_select = SelectSomethingByTP(&s_key_csr, func, 1 ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // キーが押された + PushKeys( char_tbl[s_char_mode][s_key_csr], noc ); + }else if( pad.trg & PAD_BUTTON_B ) { + DeleteACharacter(noc); + } +} + +/* +// 押している間数字が一定スピードで変化するような処理 +static void Birthday_AutoNumScrollByTP( void ) +{ + static u16 first_csr = 0xffff; + u16 temp_csr; + static int same_count = 0; + + if( tpd.disp.touch ) + { + BOOL t = SelectBirthdayFunc( &temp_csr, &tpd.disp ); + if( t ) + { + if(same_count == 0) // count start + { + first_csr = temp_csr; + same_count = 1; + }else if(first_csr == temp_csr) + { + if( same_count == 1 || (same_count > 29 && same_count%10==0)) + { + switch(temp_csr) + { + case 0: + s_birth_csr = TRUE; + s_temp_birthday.month++; + break; + case 1: + s_birth_csr = FALSE; + s_temp_birthday.day++; + break; + case 2: + s_birth_csr = TRUE; + s_temp_birthday.month--; + break; + case 3: + s_birth_csr = FALSE; + s_temp_birthday.day--; + break; + default: + break; + } + } + same_count++; + } + } + }else // touch==0 + { + same_count = 0; + first_csr = 0xffff; + } +} +*/ + +//========================================================= +// +// レーティング団体の設定 (リストからの選択) +// +//========================================================= + +// 描画処理 +static void DrawSetRatingOgnScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"RATING ORGANIZATION" ); + + PutStringUTF16( 4*8, 4*8, TXT_UCOLOR_G0, (const u16 *)L"Region: " ); + PutStringUTF16( 12*8, 4*8, TXT_UCOLOR_G0, sppRegionCharTable[ sRegion ] ); + PutStringUTF16( 4*8, 6*8, TXT_UCOLOR_G0, (const u16 *)L"Organization List: " ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + + DrawMenu( sCursorRatingOgn, &sRatingOgnMenuParam ); +} + +// 初期化 +static void SetRatingOgnInit( void ) +{ + int i; + LCFGTWLRatingOgn ogn; + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + ogn = LCFG_TSD_GetPCTLRatingOgn(); + sRegion = OS_GetRegion(); + + // リージョンにあわせて選択させる団体リストをつくる(国別のほうがいいかも) + sRatingOgnFirstIndex = (u16)sIndexFirstOgnTable[ sRegion ]; + DEBUGPRINT( "ogn index = %d\n", sRatingOgnFirstIndex ); + sRatingOgnMenuParam.num = spNumOfRatingOgnsTable[ sRegion ]; // リストのメンバ数 + sRatingOgnMenuParam.pos = &(spRatingOgnPosTable[ sRatingOgnFirstIndex ]); // 表示位置 + for( i=0; i < spNumOfRatingOgnsTable[ sRegion ]; i++ ) + { + sppRatingOgnCharList[i] = sppRatingOgnCharTable[ (int)sRatingOgnFirstIndex + i ]; // 表示文字列 + } + + // カーソル位置を決定 + if( (ogn < sRatingOgnFirstIndex) || ((sRatingOgnFirstIndex + spNumOfRatingOgnsTable[ sRegion ] - 1) < ogn) ) + { + sCursorRatingOgn = 0; // はみ出ているときは補正 + } + else + { + sCursorRatingOgn = (u16)(ogn - sRatingOgnFirstIndex); + } + + DrawSetRatingOgnScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetRatingOgnMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + u16 commit; + BOOL tpSelect = FALSE; + BOOL tpCommit = FALSE; + + ReadTP(); + + // 選択 + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++sCursorRatingOgn >= (u16)spNumOfRatingOgnsTable[ sRegion ] ) { + sCursorRatingOgn = 0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --sCursorRatingOgn & 0x8000 ) { + sCursorRatingOgn = (u16)(spNumOfRatingOgnsTable[ sRegion ] - 1); + } + } + tpSelect = SelectMenuByTP( &sCursorRatingOgn, &sRatingOgnMenuParam ); + + // 決定ボタンチェック + tpCommit = SelectSomethingByTP( &commit, func, 2 ); + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tpCommit && (commit == KEY_OK)) ) + { + LCFG_TSD_SetPCTLRatingOgn( (LCFGTWLRatingOgn)(sRatingOgnFirstIndex + sCursorRatingOgn) ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + SetParentalControlInit(); // キャンセルのときセットしない + g_pNowProcess = SetParentalControlMain; + return 0; + } + + DrawSetRatingOgnScene(); + return 0; +} + +//========================================================= +// +// レーティング制限のON/OFF (ON/OFFスイッチ切り替え) +// +//========================================================= + +// 描画処理 +static void DrawSetRatingLockScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"RATING LOCK" ); + + if( sbRatingLock ) + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"ON" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"OFF" ); + } + else + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"ON" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"OFF" ); + } + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); +} + +// 初期化 +static void SetRatingLockInit( void ) +{ + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sbRatingLock = LCFG_TSD_IsSetParentalControl(); + + DrawSetRatingLockScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetRatingLockMain( void ) +{ + SelectSomethingFunc func[4]={SelectCancelFunc, SelectOKFunc, SelectONFunc, SelectOFFFunc }; + u16 commit; + BOOL tp_touch = FALSE; + + ReadTP(); + + // キーによる選択 + if( (pad.trg & PAD_KEY_LEFT) || (pad.trg & PAD_KEY_RIGHT) ) + { + sbRatingLock = !sbRatingLock; + } + + // タッチによる選択 + tp_touch = SelectSomethingByTP( &commit, func, 4 ); + if( tp_touch && (commit == KEY_ON) ) + { + sbRatingLock = TRUE; + } + else if( tp_touch && (commit == KEY_OFF) ) + { + sbRatingLock = FALSE; + } + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tp_touch && (commit == KEY_OK)) ) + { + LCFG_TSD_SetFlagParentalControl( sbRatingLock ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tp_touch && (commit == KEY_CANCEL)) ) + { + SetParentalControlInit(); // キャンセルのときセットしない + g_pNowProcess = SetParentalControlMain; + return 0; + } + + DrawSetRatingLockScene(); + return 0; +} + +//========================================================= +// +// レーティング年齢の選択 (数値選択) +// +//========================================================= + +// 描画処理 +static void DrawSetRatingAgeScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"RATING TARGET AGE" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( UP_BUTTON_TOP_X+2*8, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"UP" ); + PutStringUTF16( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconDown ); + PutStringUTF16( DOWN_BUTTON_TOP_X+2*8, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"DOWN" ); + PutStringUTF16( 8*8, 10*8, TXT_UCOLOR_G0, (const u16 *)L"Age" ); + PrintfSJIS( 12*8, 10*8, TXT_COLOR_GREEN, "%d", sRatingAge ); +} + +// 初期化 +static void SetRatingAgeInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sRatingAge = LCFG_TSD_GetPCTLRatingAge(); + + DrawSetRatingAgeScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetRatingAgeMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + u16 padrep; + + ReadTP(); + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchUD( &csrUD ); + + padrep = DetectPadRepeat(); // キーの長押し検出 + + // 変更 + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) || (tpUD && (csrUD == KEY_UP)) ) + { + if( (--sRatingAge) > LCFG_TWL_PCTL_RATING_AGE_MAX ) + { + sRatingAge = 0; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) || (tpUD && (csrUD == KEY_DOWN)) ) + { + if( (++sRatingAge) & 0x80 ) + { + sRatingAge = LCFG_TWL_PCTL_RATING_AGE_MAX; + } + } + + // 決定 + if( pad.trg & PAD_BUTTON_A || (tpCommit && (csrCommit == KEY_OK)) ) + { + LCFG_TSD_SetPCTLRatingAge( sRatingAge ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + + // 再描画 + DrawSetRatingAgeScene(); + return 0; +} + +//========================================================= +// +// 秘密の質問IDの選択 (数値選択) +// +//========================================================= + +// 描画処理 +static void DrawSetSecretQuestionIDScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"SECRET QUESTION ID" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( UP_BUTTON_TOP_X+2*8, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"UP" ); + PutStringUTF16( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconDown ); + PutStringUTF16( DOWN_BUTTON_TOP_X+2*8, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"DOWN" ); + PutStringUTF16( 8*8, 10*8, TXT_UCOLOR_G0, (const u16 *)L"No." ); + PrintfSJIS( 12*8, 10*8, TXT_COLOR_GREEN, "%d", sSecretQuestionID ); +} + +// 初期化 +static void SetSecretQuestionIDInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sSecretQuestionID = LCFG_TSD_GetPCTLSecretQuestionID(); + + DrawSetSecretQuestionIDScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetSecretQuestionIDMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + u16 rep; + + ReadTP(); + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchUD( &csrUD ); + + rep = DetectPadRepeat(); + + // 変更 + if( (pad.trg & PAD_KEY_UP) || (rep & PAD_KEY_UP) || (tpUD && (csrUD == KEY_UP)) ) + { + if( (--sSecretQuestionID) > LCFG_TWL_PCTL_SECRET_QUESTION_ID_MAX ) + { + sSecretQuestionID = 0; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (rep & PAD_KEY_DOWN) || (tpUD && (csrUD == KEY_DOWN)) ) + { + if( (++sSecretQuestionID) & 0x80 ) + { + sSecretQuestionID = LCFG_TWL_PCTL_SECRET_QUESTION_ID_MAX; + } + } + + // 決定 + if( pad.trg & PAD_BUTTON_A || (tpCommit && (csrCommit == KEY_OK)) ) + { + LCFG_TSD_SetPCTLSecretQuestionID( sSecretQuestionID ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + + // 再描画 + DrawSetSecretQuestionIDScene(); + return 0; +} + +//========================================================= +// +// 秘密の質問への回答 (ソフトウェアキーボード入力) +// +//========================================================= + +// 描画処理 +static void DrawSetAnswerScene( void ) +{ + //u16 tempbuf[MS_PARENTAL_ANS_COL*2+2]; // 改行分 + NULL文字分 + int row; + int color; + int i; + u16 buf[2] = {0,0}; // 1文字ずつ表示する + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"ANSWER FOR A SECRET QUESTION" ); + + // 文字数が最小文字数より短いときOKさせない + if( sCurrentLenAnswer < sMinLenAnswer ) + { + color = TXT_UCOLOR_RED; // 表示色も変える + sbEnableOKButton = FALSE; + } + else + { + color = TXT_UCOLOR_G0; + sbEnableOKButton = TRUE; + } + // 何行目から表示するか決定 + if( sCurrentLenAnswer <= (MS_PARENTAL_ANS_COL*2) ) + { + row = 0; + } + else + { + row = 2; + } + for( i=0; i < MS_PARENTAL_ANS_COL; i++ ) // 1文字ずつ表示(等間隔で表示したいため) + { + buf[0] = spBufAnswer[MS_PARENTAL_ANS_COL*row + i]; + buf[1] = 0; + PutStringUTF16( 4*8 + 12*i, 15, color, buf ); // 1行目 + buf[0] = spBufAnswer[MS_PARENTAL_ANS_COL*(row+1) + i]; + PutStringUTF16( 4*8 + 12*i, 31, color, buf ); // 2行目 + } + + DrawCharKeys(); +} + +// 初期化 +static void SetAnswerInit( void ) +{ + //int i=0; + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // コメント用テンポラリバッファの初期化 + LCFG_TSD_GetPCTLSecretAnswer( spBufAnswer ); + sCurrentLenAnswer = LCFG_TSD_GetPCTLSecretAnswerLength(); + + // 日本版だけ文字制限が変わる + sRegion = OS_GetRegion(); // 日本版だけ入力の仕様が変わる + if( sRegion == OS_TWL_REGION_JAPAN ) + { + SetSoftKeyboardButton(0); // 日本語が設定されているときだけデフォルトのキーボードを変える + sMinLenAnswer = LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MIN >> 1; + sMaxLenAnswer = LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX >> 1; + } + else + { + SetSoftKeyboardButton(2); + sMinLenAnswer = LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MIN; // 6 + sMaxLenAnswer = LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX; // 64 + } + s_key_csr = KEY_START; + sBufSizeAnswer = LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX + 1; // 64 + 1 = 65 + + // 文字列の例外処理 + if( sCurrentLenAnswer > sMaxLenAnswer ) // 上限が32文字なのにそれ以上のとき/上限が64文字でも65文字目が0でないとき + { + sCurrentLenAnswer = sMaxLenAnswer; // 文字列長を切り詰めて上限以降を取り扱えないようにする + SVC_CpuClear( 0, &spBufAnswer[ sMaxLenAnswer ], (sBufSizeAnswer - sMaxLenAnswer) * 2, 16 ); // 上限以降をすべて0クリア + } + + //DEBUGPRINT( "-- for debug\n" ); + //for( i=0; i < sBufSizeAnswer; i++ ) + //{ + // DEBUGPRINT( "%04x", spBufAnswer[i] ); + // if( ((i+1)%16) == 0 ) DEBUGPRINT( ",\n" ); + // else if( (i+1) == sBufSizeAnswer ) DEBUGPRINT( "\n" ); + // else DEBUGPRINT( "," ); + //} + //DEBUGPRINT( "currentlen = %d, maxlen = %d, clear size = %d\n", sCurrentLenAnswer, sMaxLenAnswer, (sBufSizeAnswer - sMaxLenAnswer) ); + + // 表示文字列の生成 + if( sCurrentLenAnswer < LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX ) + { + SVC_CpuClear( CHAR_USCORE, &spBufAnswer[ sCurrentLenAnswer ], // "_"をつめる + (LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX - sCurrentLenAnswer) * 2, 16); + } + spBufAnswer[ LCFG_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX ] = 0; // 終端処理 + + DrawSetAnswerScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAnswerMain( void ) +{ + ReadTP(); + PadDetectOnKey(USE_SOFTKEY_ANSWER); + + DrawSetAnswerScene(); + + return 0; +} + + +// UTF16の文字列長算出 +static u8 MY_StrLen( const u16 *pStr ) +{ + u8 len = 0; + while( *pStr++ ) { + ++len; + if( len == 255 ) { + break; + } + } + return len; +} + +//========================================================= +// +// パスワード (複数数値選択) +// +//========================================================= + +// 描画処理 +static void DrawSetPasswordScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + int posUpX, posUpY, posDownX, posDownY; + int i; + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PASSWORD" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, (sbValidPassword)?TXT_UCOLOR_G0:TXT_UCOLOR_RED, (const u16 *)L"@OK" ); // 不正なときOKさせない + + for( i=0; i < LCFG_TWL_PCTL_PASSWORD_LENGTH; i++ ) + { + posUpX = MULTI_UP_BUTTON_OFFSET_X + (MULTI_UP_BUTTON_WIDTH_X*i) + (MULTI_UP_BUTTON_INTERVAL_X*i); + posUpY = MULTI_UP_BUTTON_OFFSET_Y; + posDownX = MULTI_DOWN_BUTTON_OFFSET_X + (MULTI_DOWN_BUTTON_WIDTH_X*i) + (MULTI_DOWN_BUTTON_INTERVAL_X*i); + posDownY = MULTI_DOWN_BUTTON_OFFSET_Y; + PutStringUTF16( posUpX, posUpY, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( posDownX, posDownY, TXT_UCOLOR_G0, (const u16 *)iconDown ); + if( (spBufPassword[i] < 0) || (9 < spBufPassword[i]) ) + { + PrintfSJIS( posUpX, posUpY+4*8,(sCursorPassword == i)?TXT_COLOR_GREEN:TXT_COLOR_BLACK, "*" ); // 例外処理 + } + else + { + PrintfSJIS( posUpX, posUpY+4*8,(sCursorPassword == i)?TXT_COLOR_GREEN:TXT_COLOR_BLACK, "%d", spBufPassword[i] ); + } + } +} + +// 初期化 +static void SetPasswordInit( void ) +{ + int i; + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + LCFG_TSD_GetPCTLPassword( spBufPassword ); + sbValidPassword = TRUE; + for( i=0; i < LCFG_TWL_PCTL_PASSWORD_LENGTH; i++ ) + { + if( ('0' <= spBufPassword[i]) && (spBufPassword[i] <= '9' ) ) + { + spBufPassword[i] = (u8)(spBufPassword[i] - '0'); // 計算しやすいように文字コードから数値に直しておく + } + else + { + spBufPassword[i] = 0xFF; // 不正 + sbValidPassword = FALSE; + } + } + sCursorPassword = 0; // カーソルは設定のたびに先頭になる + + DrawSetPasswordScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetPasswordMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + int i; + u16 padrep; + + ReadTP(); + + padrep = DetectPadRepeat(); + + // 左右キーで桁を移動 + if( pad.trg & PAD_KEY_RIGHT ) + { + if( ++sCursorPassword > (LCFG_TWL_PCTL_PASSWORD_LENGTH - 1) ) // 現在選択されている桁の値を変更 + { + sCursorPassword = 0; + } + } + if( pad.trg & PAD_KEY_LEFT ) + { + if( --sCursorPassword & 0x80 ) + { + sCursorPassword = (LCFG_TWL_PCTL_PASSWORD_LENGTH - 1); + } + } + + // 十字キーで各桁の値を変更 + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ) + { + if( --(spBufPassword[sCursorPassword]) > 9 ) // 現在選択されている桁の値を変更 + { + spBufPassword[sCursorPassword] = 0; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ) + { + if( ++(spBufPassword[sCursorPassword]) & 0x80 ) + { + (spBufPassword[sCursorPassword]) = 9; + } + } + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchMultiUD( &csrUD ); + + // タッチパネルで各桁の値を変更 + if( tpUD && ((csrUD & MASK_MULTI_KEY) == MULTI_KEY_UP) ) + { + sCursorPassword = (u16)(csrUD & ~MASK_MULTI_KEY); // 桁を特定 + if( --(spBufPassword[sCursorPassword]) > 9 ) + { + spBufPassword[sCursorPassword] = 0; + } + } + if( tpUD && ((csrUD & MASK_MULTI_KEY) == MULTI_KEY_DOWN) ) + { + sCursorPassword = (u16)(csrUD & ~MASK_MULTI_KEY); + if( ++(spBufPassword[sCursorPassword]) & 0x80 ) + { + (spBufPassword[sCursorPassword]) = 9; + } + } + + // すべての値が正当かどうかチェック + sbValidPassword = TRUE; + for( i=0; i < LCFG_TWL_PCTL_PASSWORD_LENGTH; i++ ) + { + if( !((0 <= spBufPassword[i])&&(spBufPassword[i] <= 9)) ) + { + sbValidPassword = FALSE; + break; + } + } + + // 決定 + if( ((pad.trg & PAD_BUTTON_A) || (tpCommit && (csrCommit == KEY_OK))) && sbValidPassword ) // 正当じゃないときはコミット不可 + { + for( i=0; i < LCFG_TWL_PCTL_PASSWORD_LENGTH; i++ ) + { + spBufPassword[i] = (u8)(spBufPassword[i] + '0'); // 文字コードに直しておく + } + LCFG_TSD_SetPCTLPassword( spBufPassword ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + + // 再描画 + DrawSetPasswordScene(); + return 0; +} + +//========================================================= +// +// BroadOn用設定 (複数のON/OFFスイッチ切り替え) +// +//========================================================= + +// 描画処理 +static void DrawSetBroadOnSettingScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + switch( sBroadOnMenu ) // 複数の設定画面をフラグで切り替える + { + case MS_BROADON_PICTOCHAT: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PICTOCHAT BOOT" ); + break; + case MS_BROADON_DS_DOWNLOAD: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"DS DOWNLOAD BOOT" ); + break; + case MS_BROADON_BROWSER: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"BROWSER BOOT" ); + break; + case MS_BROADON_WIIPOINT: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"WII POINT USING" ); + break; + case MS_BROADON_PHOTO_EXCHANGE: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"PHOTO EXCHANGE USING" ); + break; + case MS_BROADON_UGC: + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"UGC USING" ); + break; + } + + if( sbBroadOnSetting ) + { + PutStringUTF16( NOTRESTRICT_BUTTON_TOP_X, NOTRESTRICT_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Not Restrict" ); + PutStringUTF16( RESTRICT_BUTTON_TOP_X, RESTRICT_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Restrict" ); + } + else + { + PutStringUTF16( NOTRESTRICT_BUTTON_TOP_X, NOTRESTRICT_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Not Restrict" ); + PutStringUTF16( RESTRICT_BUTTON_TOP_X, RESTRICT_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Restrict" ); + } + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); +} + +// 初期化 +static void SetBroadOnSettingInit( void ) +{ + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + switch( sBroadOnMenu ) + { + case MS_BROADON_PICTOCHAT: + sbBroadOnSetting = LCFG_TSD_IsRestrictPictoChatBoot(); + break; + case MS_BROADON_DS_DOWNLOAD: + sbBroadOnSetting = LCFG_TSD_IsRestrictDSDownloadBoot(); + break; + case MS_BROADON_BROWSER: + sbBroadOnSetting = LCFG_TSD_IsRestrictBrowserBoot(); + break; + case MS_BROADON_WIIPOINT: + sbBroadOnSetting = LCFG_TSD_IsRestrictWiiPoint(); + break; + case MS_BROADON_PHOTO_EXCHANGE: + sbBroadOnSetting = LCFG_TSD_IsRestrictPhotoExchange(); + break; + case MS_BROADON_UGC: + sbBroadOnSetting = LCFG_TSD_IsRestrictUGC(); + break; + } + + DrawSetBroadOnSettingScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetBroadOnSettingMain( void ) +{ + SelectSomethingFunc func[4]={SelectCancelFunc, SelectOKFunc, SelectRESTRICTFunc, SelectNOTRESTRICTFunc }; + u16 commit; + BOOL tp_touch = FALSE; + + ReadTP(); + + // キーによる選択 + if( (pad.trg & PAD_KEY_DOWN) || (pad.trg & PAD_KEY_UP) ) + { + sbBroadOnSetting = !sbBroadOnSetting; + } + + // タッチによる選択 + tp_touch = SelectSomethingByTP( &commit, func, 4 ); + if( tp_touch && (commit == KEY_RESTRICT) ) + { + sbBroadOnSetting = TRUE; + } + else if( tp_touch && (commit == KEY_NOTRESTRICT) ) + { + sbBroadOnSetting = FALSE; + } + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tp_touch && (commit == KEY_OK)) ) + { + switch( sBroadOnMenu ) + { + case MS_BROADON_PICTOCHAT: + LCFG_TSD_SetRestrictPictoChatBoot( sbBroadOnSetting ); + break; + case MS_BROADON_DS_DOWNLOAD: + LCFG_TSD_SetRestrictDSDownloadBoot( sbBroadOnSetting ); + break; + case MS_BROADON_BROWSER: + LCFG_TSD_SetRestrictBrowserBoot( sbBroadOnSetting ); + break; + case MS_BROADON_WIIPOINT: + LCFG_TSD_SetRestrictWiiPoint( sbBroadOnSetting ); + break; + case MS_BROADON_PHOTO_EXCHANGE: + LCFG_TSD_SetRestrictPhotoExchange( sbBroadOnSetting ); + break; + case MS_BROADON_UGC: + LCFG_TSD_SetRestrictUGC( sbBroadOnSetting ); + break; + } + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + sbInitPage = FALSE; + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tp_touch && (commit == KEY_CANCEL)) ) + { + sbInitPage = FALSE; + SetParentalControlInit(); // キャンセルのときセットしない + g_pNowProcess = SetParentalControlMain; + return 0; + } + + DrawSetBroadOnSettingScene(); + return 0; +} + + +//====================================================== +// ソフトウェアキーボード用キャラテーブル +//====================================================== + +static const u16 char_tbl[CHAR_LIST_MODE_NUM][CHAR_LIST_CHAR_NUM] = { + { // ひらがな + L'あ', L'い', L'う', L'え', L'お', + L'か', L'き', L'く', L'け', L'こ', DEL_BUTTON_, + L'さ', L'し', L'す', L'せ', L'そ', + L'た', L'ち', L'つ', L'て', L'と', SPACE_BUTTON_, + L'な', L'に', L'ぬ', L'ね', L'の', + L'は', L'ひ', L'ふ', L'へ', L'ほ', EOM_, + + L'ま', L'み', L'む', L'め', L'も', + L'や', EOM_, L'ゆ', EOM_, L'よ', VAR_BUTTON1_, + L'ら', L'り', L'る', L'れ', L'ろ', + L'わ', EOM_, EOM_, L'を', L'ん', VAR_BUTTON2_, + L'ぁ', L'ぃ', L'ぅ', L'ぇ', L'ぉ', + L'ゃ', EOM_, L'ゅ', EOM_, L'ょ', EOM_, + + L'が', L'ぎ', L'ぐ', L'げ', L'ご', + L'ざ', L'じ', L'ず', L'ぜ', L'ぞ', EOM_, + L'だ', L'ぢ', L'づ', L'で', L'ど', + L'ば', L'び', L'ぶ', L'べ', L'ぼ', OK_BUTTON_, + L'ぱ', L'ぴ', L'ぷ', L'ぺ', L'ぽ', + L'っ', L'、', L'。', L'!', L'?', EOM_, + + L'「', L'」', L'〜', EOM_, L'ー', + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // カタカナ + L'ア', L'イ', L'ウ', L'エ', L'オ', + L'カ', L'キ', L'ク', L'ケ', L'コ', DEL_BUTTON_, + L'サ', L'シ', L'ス', L'セ', L'ソ', + L'タ', L'チ', L'ツ', L'テ', L'ト', SPACE_BUTTON_, + L'ナ', L'ニ', L'ヌ', L'ネ', L'ノ', + L'ハ', L'ヒ', L'フ', L'ヘ', L'ホ', EOM_, + + L'マ', L'ミ', L'ム', L'メ', L'モ', + L'ヤ', EOM_, L'ユ', EOM_, L'ヨ', VAR_BUTTON1_, + L'ラ', L'リ', L'ル', L'レ', L'ロ', + L'ワ', EOM_, L'ヲ', EOM_, L'ン', VAR_BUTTON2_, + L'ァ', L'ィ', L'ゥ', L'ェ', L'ォ', + L'ャ', EOM_, L'ュ', EOM_, L'ョ', EOM_, + + L'ガ', L'ギ', L'グ', L'ゲ', L'ゴ', + L'ザ', L'ジ', L'ズ', L'ゼ', L'ゾ', EOM_, + L'ダ', L'ヂ', L'ヅ', L'デ', L'ド', + L'バ', L'ビ', L'ブ', L'ベ', L'ボ', OK_BUTTON_, + L'パ', L'ピ', L'プ', L'ペ', L'ポ', + L'ッ', L'、', L'。', L'!', L'ー', EOM_, + + L'「', L'」', L'〜', EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, + + { // 英数 + // 'A'から順にUTF-16文字コード(リトルエンディアン)で代入していく + 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, + 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, DEL_BUTTON_, + 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, SPACE_BUTTON_, + 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, + 0x005a, EOM_, EOM_, EOM_, EOM_, EOM_, + // 'a'から順 + 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, + 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, VAR_BUTTON1_, + 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, VAR_BUTTON2_, + 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, + 0x007a, EOM_, EOM_, EOM_, EOM_, EOM_, + // '0'から順 + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, + 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, EOM_, + // 特殊文字 + // '!' '&' '/' + 0x0021, EOM_, 0x0026, EOM_, 0x002f, + // ',' '.' '-' + 0x002c, EOM_, 0x002e, EOM_, 0x002d, OK_BUTTON_, + // ''' '"' + 0x0027, EOM_, 0x2033, EOM_, EOM_, + // '@' '(' ')' + 0x0040, EOM_, 0x0028, EOM_, 0x0029, EOM_, + + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, CANCEL_BUTTON_, + EOM_, EOM_, EOM_, EOM_, EOM_, + EOM_, EOM_, EOM_, EOM_, EOM_, + }, +}; + + diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c new file mode 100644 index 00000000..bb16f64f --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setRTC.c @@ -0,0 +1,545 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setRTC.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ + +//#define __RTC_MINUTE_OFFSET // この定義が有効な場合はrtcOffsetは分オフセットで算出されます。また、無効な場合は秒オフセットとなります。 + + // RETURNボタンLCD領域 +#define RETURN_BUTTON_TOP_X ( 2 * 8 ) +#define RETURN_BUTTON_TOP_Y ( 21 * 8 ) +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 6 * 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 * 8 ) + + // 日付データLCD領域 +#define DATE_TOP_Y ( 10 * 8 ) +#define YEAR_TOP_X ( 5 * 8 ) +#define MONTH_TOP_X ( YEAR_TOP_X + 5 * 8 ) +#define DAY_TOP_X ( MONTH_TOP_X + 3 * 8 ) + + // 時刻データLCD領域 +#define TIME_TOP_Y ( DATE_TOP_Y ) +#define HOUR_TOP_X ( DAY_TOP_X + 5 * 8 ) +#define MINUTE_TOP_X ( HOUR_TOP_X + 3 * 8 ) +#define SECOND_TOP_X ( MINUTE_TOP_X + 3 * 8 ) + + // 文字入力タッチパネル用カウンタ +#define S_UPDOWN_COUNT_MAX 16 + // 数値入力タッチパネル用カウンタ +#define D_DOWN_COUNT_MAX -50 +#define D_UP_COUNT_MAX 50 + + + // 日付時刻入力シーケンス用ワーク +typedef struct DateTimeParam { + int seq; // シーケンス番号 + int *pTgt; // 入力対象の変数へのポインタ + RTCDate Date; + RTCTime Time; + RTCDate Date_old; + RTCTime Time_old; +}DateTimeParam; + + + // RTC設定シーケンス用ワーク +typedef struct SetRtcWork { + int csr; // カーソル位置 + s64 rtcOffset[ 2 ]; // RTCオフセット値([0]:設定変更前の値、[1]:変更後の値) + DateTimeParam dtp; // 日付時刻入力シーケンス用ワーク + InputNumParam inp; // 数値入力インターフェース用ワーク +}SetRtcWork; + + +typedef struct DateTimeWidth { + int year; + int month; + int day; + int hour; + int minute; + int second; +}DateTimeWidth; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +RTCWeek CalcWeekFromDate( u32 year, u32 month, u32 day ); +void InputDecimal(int *pTgt, InputNumParam *inpp); + +static void InputRtcDateTimeInit( int start ); +static int InputRtcDateTimeMain( void ); + +static void SelectString( int *pTgt, const u8 **const pStrp, InputNumParam *inpp); +static void BcdToHex(int *bcdp); +static void HexToBcd(int *hexp); +static BOOL CheckLeapYear( u32 year ); +static void DrawDateTime( RTCDate *pDate, RTCTime *pTime, int color ); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static SetRtcWork *s_pWork; // RTC設定用ワーク +// const data ----------------------------------------- + +//====================================================== +// 日付&時刻設定 +//====================================================== + +// RTC設定シーケンスの初期化 +void SetRTCInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"DATE & TIME SET" ); + PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L" RETURN " ); + + s_pWork = Alloc( sizeof(SetRtcWork) ); // RTC設定用ワークの確保 + if( s_pWork == NULL ) { + OS_Panic( "ARM9- Fail to allocate memory...\n" ); + } + + SVC_CpuClear( 0x0000, s_pWork, sizeof(SetRtcWork), 16 ); + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + RTC_GetDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time ); + s_pWork->dtp.Date.year += 2000; + + PrintfSJIS ( YEAR_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%04d", s_pWork->dtp.Date.year ); + PrintfSJIS ( MONTH_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Date.month ); + PrintfSJIS ( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Date.day ); + PrintfSJIS ( HOUR_TOP_X, TIME_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Time.hour ); + PrintfSJIS ( MINUTE_TOP_X, TIME_TOP_Y, TXT_COLOR_BLACK, "%02d", s_pWork->dtp.Time.minute ); + + DrawDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time, TXT_COLOR_BLACK ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + + +// 指定した日付・時刻の表示 +static void DrawDateTime( RTCDate *pDate, RTCTime *pTime, int color ) +{ + PrintfSJIS( YEAR_TOP_X, DATE_TOP_Y, color, "%04d", pDate->year ); + PrintfSJIS( MONTH_TOP_X, DATE_TOP_Y, color, "%02d", pDate->month ); + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, color, "%02d", pDate->day ); + PrintfSJIS( HOUR_TOP_X, TIME_TOP_Y, color, "%02d", pTime->hour ); + PrintfSJIS( MINUTE_TOP_X, TIME_TOP_Y, color, "%02d", pTime->minute ); + PutStringUTF16( YEAR_TOP_X + 4 * 8, DATE_TOP_Y, color, L"/" ); + PutStringUTF16( MONTH_TOP_X + 2 * 8, DATE_TOP_Y, color, L"/" ); + PutStringUTF16( HOUR_TOP_X + 2 * 8, TIME_TOP_Y, color, L":" ); +} + + +// RTC設定シーケンス +int SetRTCMain( void ) +{ + BOOL tp_set = FALSE; + BOOL tp_return = FALSE; + + ReadTP(); // TP入力の取得 + + if(tpd.disp.touch) { + tp_set = WithinRangeTP( YEAR_TOP_X, DATE_TOP_Y, // [RTC設定]領域押下チェック + SECOND_TOP_X, DATE_TOP_Y + 16, &tpd.disp ); + // [RETURN]ボタン押下チェック + tp_return = WithinRangeTP( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, + RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y, &tpd.disp ); + } + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( ( pad.trg & PAD_BUTTON_A ) || tp_set ) { // RTC設定開始 + InputRtcDateTimeInit( 1 ); + g_pNowProcess = InputRtcDateTimeMain; + }else if( ( pad.trg & PAD_BUTTON_B ) || tp_return ) { // メニューに戻る + Free( s_pWork ); // RTC設定用ワークの解放 + s_pWork = NULL; + MachineSettingInit(); + } +#ifdef SYSM_DEBUG_ + else if( pad.trg & PAD_BUTTON_START ) { + ClearRTC(); + OS_Printf( "RTC offset in NVRAM is ZERO clear!\n" ); + } +#endif /* SYSM_DEBUG_ */ + + return 0; +} + + +//====================================================== +// 日付&時刻入力処理 +//====================================================== + +// 日付時刻入力初期化 +static void InputRtcDateTimeInit( int start ) +{ + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, + RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, 256 - RETURN_BUTTON_TOP_X, 2 * 8 ); + if( start ) { + DrawOKCancelButton(); + s_pWork->dtp.seq = 0; + }else { + PutStringUTF16( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"RETURN" ); + } + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); +} + + +// 日付時刻入力 +static int InputRtcDateTimeMain( void ) +{ + BOOL tp_ok = FALSE; + BOOL tp_cancel = FALSE; + int new_seq, y_base, abs_y_offset; + + enum { // 日付時刻入力シーケンス番号 + SEQ_INIT=0, + SEQ_YEAR_INIT=2, SEQ_YEAR_SET, + SEQ_MONTH_INIT, SEQ_MONTH_SET, + SEQ_DAY_INIT, SEQ_DAY_SET, + SEQ_HOUR_INIT, SEQ_HOUR_SET, + SEQ_MINUTE_INIT, SEQ_MINUTE_SET, + SEQ_END, + SEQ_CANCEL=64 + }; + + ReadTP(); // タッチパネル入力の取得 + CheckOKCancelButton( &tp_ok, &tp_cancel ); // [OK],[CANCEL]ボタン押下チェック + + s_pWork->inp.y_offset = 0; + + if( tpd.disp.touch ) { // [CANCEL]ボタン押下チェック + if( ( s_pWork->dtp.seq & 0x01 ) && ( s_pWork->dtp.seq < SEQ_END ) ) { // SEQ_**_SETの時のみ有効 + new_seq = s_pWork->dtp.seq; + y_base = DATE_TOP_Y + 6; + + // 入力項目移動のチェック + if( WithinRangeTP( YEAR_TOP_X, DATE_TOP_Y, SECOND_TOP_X, DATE_TOP_Y + 12, &tpd.disp ) ) { + if( tpd.disp.x < YEAR_TOP_X + 32 ) { + new_seq = SEQ_YEAR_SET; + }else if( ( tpd.disp.x >= MONTH_TOP_X ) && ( tpd.disp.x < MONTH_TOP_X + 16 ) ) { + new_seq = SEQ_MONTH_SET; + }else if( ( tpd.disp.x >= DAY_TOP_X ) && ( tpd.disp.x < DAY_TOP_X + 16 ) ) { + new_seq = SEQ_DAY_SET; + }else if( ( tpd.disp.x >= HOUR_TOP_X ) && ( tpd.disp.x < HOUR_TOP_X + 16 ) ) { + new_seq = SEQ_HOUR_SET; + }else if( ( tpd.disp.x >= MINUTE_TOP_X ) && ( tpd.disp.x < MINUTE_TOP_X + 16 ) ) { + new_seq = SEQ_MINUTE_SET; + } + } + if( s_pWork->dtp.seq != new_seq ) { + s_pWork->dtp.seq = new_seq - 1; + }else if( WithinRangeTP( s_pWork->inp.pos_x, y_base - 40, + s_pWork->inp.pos_x + s_pWork->inp.keta_max * 8, y_base + 60, &tpd.disp ) ) { + // 入力値の増減 + s_pWork->inp.y_offset = tpd.disp.y - y_base; + abs_y_offset = ( s_pWork->inp.y_offset >= 0 ) ? s_pWork->inp.y_offset : -s_pWork->inp.y_offset; + if( abs_y_offset <= 6 ) { + s_pWork->inp.y_offset = 0; + }else if( abs_y_offset <= 20 ){ + s_pWork->inp.y_offset >>= 2; + }else if( abs_y_offset <= 40 ){ + s_pWork->inp.y_offset >>= 1; + } + } + } + } + + // タッチパネル or キー入力によって、カーソル位置が動いた時に、元の位置のカーソルを消す。 + if( ( s_pWork->dtp.seq > 0 ) && ( ( s_pWork->dtp.seq & 0x01 ) == 0 ) ) { // SEQ_INITの時は実行しない + PrintfSJIS( s_pWork->inp.pos_x, s_pWork->inp.pos_y, TXT_COLOR_BLACK, "%02d", *s_pWork->dtp.pTgt ); + } + + // 各シーケンスの処理 + switch(s_pWork->dtp.seq){ + + case SEQ_INIT: + MI_CpuCopy32( &s_pWork->dtp.Date, &s_pWork->dtp.Date_old, sizeof(RTCDate) ); + MI_CpuCopy32( &s_pWork->dtp.Time, &s_pWork->dtp.Time_old, sizeof(RTCTime) ); + + s_pWork->dtp.seq = SEQ_YEAR_INIT; + // ※SEQ_INITは直通でSEQ_YEAR_INITへ + + case SEQ_YEAR_INIT: + s_pWork->inp.pos_x = YEAR_TOP_X; + s_pWork->inp.pos_y = DATE_TOP_Y; + s_pWork->inp.keta_max = 4; + s_pWork->inp.value_max = 2099; + s_pWork->inp.value_min = 2000; +// s_pWork->inp.value_min = 2004; +// if(s_pWork->dtp.Date.year < 2004) { +// s_pWork->dtp.Date.year = 2004; +// } + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.year; + break; + + case SEQ_MONTH_INIT: + s_pWork->inp.pos_x = MONTH_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 12; + s_pWork->inp.value_min = 1; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.month; + break; + + case SEQ_DAY_INIT: + s_pWork->inp.pos_x = DAY_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = (int)UTL_GetDayNum( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month ); + // 年・月をもとにその月の日数を算出する。 + s_pWork->inp.value_min = 1; + if(s_pWork->dtp.Date.day > s_pWork->inp.value_max) { + s_pWork->dtp.Date.day = (u32)s_pWork->inp.value_max; + } + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Date.day; + break; + + case SEQ_HOUR_INIT: + s_pWork->inp.pos_x = HOUR_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 23; + s_pWork->inp.value_min = 0; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Time.hour; + break; + + case SEQ_MINUTE_INIT: + s_pWork->inp.pos_x = MINUTE_TOP_X; + s_pWork->inp.keta_max = 2; + s_pWork->inp.value_max = 59; + s_pWork->inp.value_min = 0; + s_pWork->dtp.pTgt = (int *)&s_pWork->dtp.Time.minute; + break; + + case SEQ_YEAR_SET: + case SEQ_MONTH_SET: + case SEQ_DAY_SET: + case SEQ_HOUR_SET: + case SEQ_MINUTE_SET: + InputDecimal( s_pWork->dtp.pTgt, &s_pWork->inp ); + + // 年月日入力ならば、曜日を再計算 + if( ( s_pWork->dtp.seq == SEQ_YEAR_SET ) || + ( s_pWork->dtp.seq == SEQ_MONTH_SET ) || + ( s_pWork->dtp.seq == SEQ_DAY_SET ) ) { + s_pWork->dtp.Date.week = CalcWeekFromDate( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month, s_pWork->dtp.Date.day ); + } + + // 年・月入力ならば、日数を算出して、現在の入力日が日数を超えていたら修正する。 + if( ( s_pWork->dtp.seq == SEQ_YEAR_SET ) || + ( s_pWork->dtp.seq == SEQ_MONTH_SET ) ) { + u32 dayNum = UTL_GetDayNum( s_pWork->dtp.Date.year, s_pWork->dtp.Date.month ); + if( dayNum < s_pWork->dtp.Date.day ) { + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_WHITE, "%02d", s_pWork->dtp.Date.day ); + PrintfSJIS( DAY_TOP_X, DATE_TOP_Y, TXT_COLOR_BLACK, "%02d", dayNum ); + s_pWork->dtp.Date.day = dayNum; + } + } + break; + + case SEQ_END: + s_pWork->dtp.Time.second = 0; + { + RTCDate date; // +-2000を処理するのが面倒なので、別バッファにコピーして処理 + MI_CpuCopy32( &s_pWork->dtp.Date, &date, sizeof(RTCDate) ); + date.year -= 2000; + // オフセット計算→日付のセットの順で実行する。 + LCFG_TSD_SetRTCOffset( UTL_CalcRTCOffset( &date, &s_pWork->dtp.Time ) ); + (void)RTC_SetDateTime( &date, &s_pWork->dtp.Time ); + } + + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } + + // 上画面の表示更新 + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + g_pNowProcess = SetRTCMain; + InputRtcDateTimeInit( 0 ); // 日付入力画面のクリア + return 0; + + case SEQ_CANCEL: + // 日付・時刻表示を元の値に戻して表示更新 + DrawDateTime( &s_pWork->dtp.Date, &s_pWork->dtp.Time, TXT_COLOR_WHITE ); + DrawDateTime( &s_pWork->dtp.Date_old, &s_pWork->dtp.Time_old, TXT_COLOR_BLACK ); + MI_CpuCopy32( &s_pWork->dtp.Date_old, &s_pWork->dtp.Date, sizeof(RTCDate) ); + MI_CpuCopy32( &s_pWork->dtp.Time_old, &s_pWork->dtp.Time, sizeof(RTCTime) ); + g_pNowProcess = SetRTCMain; + InputRtcDateTimeInit( 0 ); // 日付入力画面のクリア + return 0; + } + + if( s_pWork->dtp.seq & 0x01 ) { // SEQ_**_SETの時のみ有効 + if( ( pad.trg & PAD_BUTTON_A ) || tp_ok ) { + s_pWork->dtp.seq = SEQ_END; // Aボタンで決定 + }else if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { // Bボタンでキャンセル + s_pWork->dtp.seq = SEQ_CANCEL; + }else if( pad.trg & PAD_KEY_LEFT ) { + if( s_pWork->dtp.seq == SEQ_YEAR_SET ) { + s_pWork->dtp.seq = SEQ_MINUTE_INIT; + }else { + s_pWork->dtp.seq -= 3; + } + }else if( pad.trg & PAD_KEY_RIGHT ) { + if( s_pWork->dtp.seq == SEQ_MINUTE_SET ) { + s_pWork->dtp.seq = SEQ_YEAR_INIT; + }else { + s_pWork->dtp.seq++; + } + } + }else { // SEQ_**_INITの時のみ有効 + s_pWork->dtp.seq++; + } + return 0; +} + + +/* +// うるう年の判定 (うるう年:1、通常の年:0リターン) +BOOL CheckLeapYear( u32 year) +{ + if((year & 0x03) == 0) { // うるう年は、「4で割り切れ かつ 100で割り切れない年」 + CP_SetDiv32_32(year, 100); // 「400で割り切れる年」 + if(CP_GetDivRemainder32() != 0) { + return TRUE; + }else { + CP_SetDiv32_32(year, 400); + if(CP_GetDivRemainder32() == 0) { + return TRUE; + } + } + } + return FALSE; +} +*/ + +// 日付から曜日を求める。 +RTCWeek CalcWeekFromDate( u32 year, u32 month, u32 day ) +{ + if( month == 1 || month == 2 ){ + year--; + month += 12; + } + return (RTCWeek)( ( year + year/4 - year/100 + year/400 + (13*month + 8)/5 + day) % 7 ); +} + + +/* +// 文字列によるパラメータ選択 +static void SelectString(int *pTgt, const u8 **const ppStr, InputNumParam *pInp ) +{ + BOOL value_up = FALSE; + BOOL value_down = FALSE; + const u8 *pStr_old = *pTgt; + + if( pInp->y_offset == 0 ) { + pInp->up_count = S_UPDOWN_COUNT_MAX; + }else { + pInp->up_count ++; + if( pInp->up_count > S_UPDOWN_COUNT_MAX ) { + pInp->up_count = 0; + if( pInp->y_offset < 0 ) value_up = TRUE; + else value_down = TRUE; + } + } + + if( ( pad.trg & PAD_KEY_DOWN ) || value_down ) { // 表示文字列切り替え + if( ++ *pTgt > pInp->value_max ) { + *pTgt = 0; + } + }else if( ( pad.trg & PAD_KEY_UP ) || value_up ) { + if( -- *pTgt & 0x8000 ) { + *pTgt = pInp->value_max; + } + } + + PutStringUTF16( pInp->pos_x, pInp->pos_y, TXT_COLOR_WHITE, pStr_old ); // 旧文字列を消去 + PutStringUTF16( pInp->pos_x, pInp->pos_y, TXT_COLOR_BLACK, ppStr[ *pTgt ] ); // 現在選択している文字列を表示 +} +*/ + +// 10進数数値入力 +void InputDecimal( int *pTgt, InputNumParam *pInp ) +{ + BOOL value_up = FALSE; + BOOL value_down = FALSE; + int old = *pTgt; + + if( pInp->y_offset == 0 ) { + pInp->up_count = D_UP_COUNT_MAX; + pInp->down_count = D_DOWN_COUNT_MAX; + }else if( pInp->y_offset < 0 ) { + pInp->down_count += pInp->y_offset; + if( pInp->down_count < D_DOWN_COUNT_MAX ) { + pInp->down_count = 0; + value_down = TRUE; + } + }else { // y_offset > 0 + pInp->up_count += pInp->y_offset; + if( pInp->up_count > D_UP_COUNT_MAX ) { + pInp->up_count = 0; + value_up = TRUE; + } + } + + // キー入力に応じて対象値を増減 + if( value_down || + ( pad.trg & PAD_KEY_UP ) || + ( ( pad.cont & PAD_KEY_UP ) && ( pad.cont & PAD_BUTTON_R ) ) ) { + if( --*pTgt < pInp->value_min ) { + *pTgt = pInp->value_max; + } + }else if( value_up || + ( pad.trg & PAD_KEY_DOWN ) || + ( ( pad.cont & PAD_KEY_DOWN ) && ( pad.cont & PAD_BUTTON_R ) ) ) { + if( ++*pTgt > pInp->value_max ) { + *pTgt = pInp->value_min; + } + } + + PrintfSJIS( pInp->pos_x, pInp->pos_y, TXT_COLOR_WHITE, "%02d", old ); + PrintfSJIS( pInp->pos_x, pInp->pos_y, TXT_COLOR_GREEN, "%02d", *pTgt ); + // 対象値をハイライト表示 +} + + +// RTC設定のクリア +void ClearRTC( void ) +{ + RTCDate date = { 0, 1, 1, RTC_WEEK_SUNDAY }; + RTCTime time = { 0, 0, 0 }; + (void)RTC_SetDateTime( &date, &time ); + LCFG_TSD_SetRTCOffset( 0 ); + LCFG_TSD_SetRTCLastSetYear( 0 ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) { + OS_TPrintf( "TWL settings write failed.\n" ); + } +} diff --git a/build/systemMenu_RED/MachineSettings/ARM9/src/setWireless.c b/build/systemMenu_RED/MachineSettings/ARM9/src/setWireless.c new file mode 100644 index 00000000..7089164f --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/ARM9/src/setWireless.c @@ -0,0 +1,460 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setWireless.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// 以下の無線の設定 +// ++ ON/OFFフラグ +// +// <例外処理> +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// ON/OFFボタン領域 +#define ON_BUTTON_TOP_X ( 8 * 8 ) +#define ON_BUTTON_TOP_Y ( 8 * 8 ) +#define ON_BUTTON_BOTTOM_X ( ON_BUTTON_TOP_X + (2 * 8) ) +#define ON_BUTTON_BOTTOM_Y ( ON_BUTTON_TOP_Y + (2 * 8) ) +#define OFF_BUTTON_TOP_X ( 18 * 8 ) +#define OFF_BUTTON_TOP_Y ( 8 * 8 ) +#define OFF_BUTTON_BOTTOM_X ( OFF_BUTTON_TOP_X + (3 * 8) ) +#define OFF_BUTTON_BOTTOM_Y ( OFF_BUTTON_TOP_Y + (2 * 8) ) + +// UP/DOWNボタン領域 +#define UP_BUTTON_TOP_X ( 21 * 8 ) +#define UP_BUTTON_TOP_Y ( 7 * 8 ) +#define UP_BUTTON_BOTTOM_X ( UP_BUTTON_TOP_X + (2 * 8) ) +#define UP_BUTTON_BOTTOM_Y ( UP_BUTTON_TOP_Y + (2 * 8) ) +#define DOWN_BUTTON_TOP_X ( 21 * 8 ) +#define DOWN_BUTTON_TOP_Y ( 13 * 8 ) +#define DOWN_BUTTON_BOTTOM_X ( DOWN_BUTTON_TOP_X + (2 * 8) ) +#define DOWN_BUTTON_BOTTOM_Y ( DOWN_BUTTON_TOP_Y + (2 * 8) ) + + +// 項目の総数 +#define MS_WIRELESS_NUMOF_ELEMENTS 1 + +// ソフトウェアキーボードのパラメータ +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe +#define KEY_PREVPAGE 0xfffd +#define KEY_SUCCPAGE 0xfffc +#define KEY_ON 0xfffb +#define KEY_OFF 0xfffa +#define KEY_UP 0xfff9 +#define KEY_DOWN 0xfff8 +#define MULTI_KEY_UP 0xffe0 +#define MULTI_KEY_DOWN 0xffd0 +#define MASK_MULTI_KEY 0xfff0 + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + +static void SetAvailableWirelessInit( void ); +static int SetAvailableWirelessMain( void ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +// メニューで使用 +static u16 sCursorMenu = 0; + +// 特定のモードでのみ使用 +static BOOL sbAvailableWireless = FALSE; + +// const data----------------------------------- + +// ++ メインメニュー + +static const u16 *s_pStrSetting[ MS_WIRELESS_NUMOF_ELEMENTS ]; // メインメニュー用文字テーブルへのポインタリスト + +static const u16 *const s_pStrSettingElemTbl[ MS_WIRELESS_NUMOF_ELEMENTS ][ LCFG_TWL_LANG_CODE_MAX ] = { + + { + (const u16 *)L"無線の使用", + (const u16 *)L"Available Wireless", + (const u16 *)L"Available Wireless(F)", + (const u16 *)L"Available Wireless(G)", + (const u16 *)L"Available Wireless(I)", + (const u16 *)L"Available Wireless(S)", + (const u16 *)L"Available Wireless(C)", + (const u16 *)L"Available Wireless(K)", + }, +}; + +// 表示位置 +static MenuPos s_settingPos[] = { + + { TRUE, 2 * 8, 6 * 8 }, +}; + +// 表示パラメータ +static const MenuParam s_settingParam = +{ + MS_WIRELESS_NUMOF_ELEMENTS, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[0], + (const u16 **)&s_pStrSetting, +}; + + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +// キャンセルボタン専用SelectSomethingFuncの実装 +static BOOL SelectCancelFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_CANCEL; + return ret; +} + +// OKボタン専用SelectSomethingFuncの実装 +static BOOL SelectOKFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OK; + return ret; +} + +// ON/OFFボタン専用SelectSomethingFuncの実装 +static BOOL SelectONFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, + ON_BUTTON_BOTTOM_X, ON_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_ON; + return ret; +} +static BOOL SelectOFFFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, + OFF_BUTTON_BOTTOM_X, OFF_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OFF; + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawWirelessMenuScene( void ) +{ + BOOL bFlg; + u16 color; + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"WIRELESS" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + // メニュー項目 + DrawMenu( sCursorMenu, &s_settingParam ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得して表示 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // 無線強制OFF + color = OS_IsForceDisableWireless() ? TXT_COLOR_RED : TXT_COLOR_BLUE; + bFlg = LCFG_TSD_IsAvailableWireless(); + PutStringUTF16( 25*8, s_settingPos[0].y, color, + (bFlg)?(const u16*)L"ON":(const u16*)L"OFF" ); // 値が不正のとき赤色で表示 +} + +// 初期化 +void SetWirelessInit( void ) +{ + int i; + + // 無線強制OFFフラグが有効な時は、無線有効フラグを強制的にOFFにする。 + if( OS_IsForceDisableWireless() && + LCFG_TSD_IsAvailableWireless() ) { + OS_TPrintf( "Warning : AvailableWireless flag is different value.\n" ); + LCFG_TSD_SetFlagAvailableWireless( FALSE ); + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + } + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i=0; i < MS_WIRELESS_NUMOF_ELEMENTS; i++ ) + { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawWirelessMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// メニューから呼ばれるメイン +int SetWirelessMain( void ) +{ + SelectSomethingFunc func[1]={SelectCancelFunc}; + BOOL tp_select; + BOOL tpCommit = FALSE; + u16 padrep; + static u16 commit; + + ReadTP(); + + padrep = DetectPadRepeat(); // 長押し検出 + + // メニューからの項目選択 + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++sCursorMenu >= MS_WIRELESS_NUMOF_ELEMENTS ) { + sCursorMenu = 0; + } + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + if( --sCursorMenu & 0x80 ) { + sCursorMenu = (u16)(MS_WIRELESS_NUMOF_ELEMENTS - 1); + } + } + tp_select = SelectMenuByTP( &sCursorMenu, &s_settingParam ); + + // 特殊ボタンタッチ + tpCommit = SelectSomethingByTP( &commit, func, 1 ); + + // メニューへの分岐 + if( !OS_IsForceDisableWireless() && + ( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) + ) { // メニュー項目への分岐 + if( (s_settingParam.pos[sCursorMenu]).enable ) { + switch( sCursorMenu ) + { + case 0: + SetAvailableWirelessInit(); + g_pNowProcess = SetAvailableWirelessMain; + break; + } + } // if( (s_settingParam.pos[sCursorMenu]).enable ) + } // if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + MachineSettingInit(); + return 0; + } + + // 再描画 + DrawWirelessMenuScene(); + return 0; +} + +//========================================================= +// +// ワイアレス通信のON/OFF (ON/OFFスイッチ切り替え) +// +//========================================================= + +// 描画処理 +static void DrawSetAvailableWirelessScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"AVAILABLE WIRELESS" ); + + if( sbAvailableWireless ) + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"ON" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"OFF" ); + } + else + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"ON" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"OFF" ); + } + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); +} + +// 初期化 +static void SetAvailableWirelessInit( void ) +{ + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sbAvailableWireless = LCFG_TSD_IsAvailableWireless(); + + DrawSetAvailableWirelessScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAvailableWirelessMain( void ) +{ + SelectSomethingFunc func[4]={SelectCancelFunc, SelectOKFunc, SelectONFunc, SelectOFFFunc }; + u16 commit; + BOOL tp_touch = FALSE; + + ReadTP(); + + // キーによる選択 + if( (pad.trg & PAD_KEY_LEFT) || (pad.trg & PAD_KEY_RIGHT) ) + { + sbAvailableWireless = !sbAvailableWireless; + } + + // タッチによる選択 + tp_touch = SelectSomethingByTP( &commit, func, 4 ); + if( tp_touch && (commit == KEY_ON) ) + { + sbAvailableWireless = TRUE; + } + else if( tp_touch && (commit == KEY_OFF) ) + { + sbAvailableWireless = FALSE; + } + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tp_touch && (commit == KEY_OK)) ) + { + LCFG_TSD_SetFlagAvailableWireless( sbAvailableWireless ); + PMi_SetWirelessLED( sbAvailableWireless ? PM_WIRELESS_LED_ON : PM_WIRELESS_LED_OFF ); // 無線LEDも即座に変更 + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + OS_TPrintf( "AvailableWireless : %s\n", OS_IsAvailableWireless() ? "TRUE" : "FALSE " ); + SetWirelessInit(); + g_pNowProcess = SetWirelessMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tp_touch && (commit == KEY_CANCEL)) ) + { + SetWirelessInit(); // キャンセルのときセットしない + g_pNowProcess = SetWirelessMain; + return 0; + } + + DrawSetAvailableWirelessScene(); + return 0; +} + diff --git a/build/systemMenu_RED/MachineSettings/Makefile b/build/systemMenu_RED/MachineSettings/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/MachineSettings/banner/Makefile b/build/systemMenu_RED/MachineSettings/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_RED/MachineSettings/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_RED/MachineSettings/banner/banner_v3.bsf b/build/systemMenu_RED/MachineSettings/banner/banner_v3.bsf new file mode 100644 index 00000000..c5a4f1d1 Binary files /dev/null and b/build/systemMenu_RED/MachineSettings/banner/banner_v3.bsf differ diff --git a/build/systemMenu_RED/MachineSettings/banner/icon/gameIcon.bmp b/build/systemMenu_RED/MachineSettings/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..1a7a4012 Binary files /dev/null and b/build/systemMenu_RED/MachineSettings/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_RED/Makefile b/build/systemMenu_RED/Makefile new file mode 100644 index 00000000..5a04ea14 --- /dev/null +++ b/build/systemMenu_RED/Makefile @@ -0,0 +1,38 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS_P = \ + launcher \ + MachineSettings \ + PictoChat \ + wlanfirm \ + sharedFont \ + DSHashTable \ + sysmenuVersion + #DS_DownloadPlay + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/PictoChat/ARM9/Makefile b/build/systemMenu_RED/PictoChat/ARM9/Makefile new file mode 100644 index 00000000..69661def --- /dev/null +++ b/build/systemMenu_RED/PictoChat/ARM9/Makefile @@ -0,0 +1,64 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +TITLEID_LO = HNEA + +TARGET_BIN = $(TITLEID_LO).tad + +ROM_SPEC = main.rsf + +MISC_DIR = ../../misc + +SRCS = main.c PictoChat.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifeq ($(ENABLE_AES),TRUE) +MAKEROM_FLAGS += -a +endif + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.sys.exe + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/PictoChat/ARM9/main.rsf b/build/systemMenu_RED/PictoChat/ARM9/main.rsf new file mode 100644 index 00000000..2bd25038 --- /dev/null +++ b/build/systemMenu_RED/PictoChat/ARM9/main.rsf @@ -0,0 +1,185 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile FALSE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.c b/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.c new file mode 100644 index 00000000..e2c466e1 --- /dev/null +++ b/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.c @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.c + + Copyright 2007 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 "misc.h" +#include "PictoChat.h" + +// define data------------------------------------------ +#define RETURN_BUTTON_TOP_X 2 +#define RETURN_BUTTON_TOP_Y 21 +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- + +// const data ----------------------------------------- + +//====================================================== +// ピクトチャット +//====================================================== + +// ピクトチャットの初期化 +void PictoChatInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"PictoChat"); + PutStringUTF16( 4 * 8, 8 * 8, TXT_COLOR_BLACK, (const u16 *)L"Under Construction..."); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + + +// ピクトチャットのメインループ +void PictoChatMain(void) +{ + BOOL tp_cancel = FALSE; + + ReadTP(); // タッチパネル入力の取得 + + // [RETURN]ボタン押下チェック + if(tpd.disp.touch) { + tp_cancel = WithinRangeTP( RETURN_BUTTON_TOP_X * 8, RETURN_BUTTON_TOP_Y * 8 - 4, + RETURN_BUTTON_BOTTOM_X * 8, RETURN_BUTTON_BOTTOM_Y * 8 - 4, &tpd.disp ); + } + + if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { +// SYSM_RebootLauncher(); + } + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); +} + + diff --git a/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.h b/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.h new file mode 100644 index 00000000..eaea9196 --- /dev/null +++ b/build/systemMenu_RED/PictoChat/ARM9/src/PictoChat.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.h + + Copyright 2007 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 __DS_CHAT_H__ +#define __DS_CHAT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void PictoChatInit( void ); +void PictoChatMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __DS_CHAT_H__ diff --git a/build/systemMenu_RED/PictoChat/ARM9/src/main.c b/build/systemMenu_RED/PictoChat/ARM9/src/main.c new file mode 100644 index 00000000..837e94d0 --- /dev/null +++ b/build/systemMenu_RED/PictoChat/ARM9/src/main.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "PictoChat.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + InitBG(); + PictoChatInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + PictoChatMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/systemMenu_RED/PictoChat/Makefile b/build/systemMenu_RED/PictoChat/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_RED/PictoChat/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/PictoChat/banner/Makefile b/build/systemMenu_RED/PictoChat/banner/Makefile new file mode 100644 index 00000000..474d571c --- /dev/null +++ b/build/systemMenu_RED/PictoChat/banner/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_RED/PictoChat/banner/banner_v3.bsf b/build/systemMenu_RED/PictoChat/banner/banner_v3.bsf new file mode 100644 index 00000000..d595b6d3 Binary files /dev/null and b/build/systemMenu_RED/PictoChat/banner/banner_v3.bsf differ diff --git a/build/systemMenu_RED/PictoChat/banner/icon/gameIcon.bmp b/build/systemMenu_RED/PictoChat/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5fe5ee2c Binary files /dev/null and b/build/systemMenu_RED/PictoChat/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_RED/PictoChat/banner/icon/msk_pictchat_icon.bin b/build/systemMenu_RED/PictoChat/banner/icon/msk_pictchat_icon.bin new file mode 100644 index 00000000..5b2734aa Binary files /dev/null and b/build/systemMenu_RED/PictoChat/banner/icon/msk_pictchat_icon.bin differ diff --git a/build/systemMenu_RED/PictoChat/banner/test-utf16_v3.TWL.bsf b/build/systemMenu_RED/PictoChat/banner/test-utf16_v3.TWL.bsf new file mode 100644 index 00000000..1049cbbd Binary files /dev/null and b/build/systemMenu_RED/PictoChat/banner/test-utf16_v3.TWL.bsf differ diff --git a/build/systemMenu_RED/data/BGData_Launcher.c b/build/systemMenu_RED/data/BGData_Launcher.c new file mode 100644 index 00000000..98f6e82f --- /dev/null +++ b/build/systemMenu_RED/data/BGData_Launcher.c @@ -0,0 +1,71 @@ +// BGキャラクタ +u32 bg_char_data[8 * 6] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000,// 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x11111111, 0x44444444, 0x77777777, 0x99999999,// 0001h + 0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xcccccccc, + 0xdddddddd, 0xdddddddd, 0xdddddddd, 0xeeeeeeee,// 0002h + 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, + 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee,// 0003h + 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, + 0x11111111, 0x11111111, 0x11111111, 0x11111111,// 0004h + 0x11111111, 0x11111111, 0x11111111, 0x11111111, + 0xeeeeeeee, 0xeeeeee11, 0xeeeeee11, 0xeeee11ee,// 0005h(\) + 0xeeee11ee, 0xee11eeee, 0xee11eeee, 0x11eeeeee, +}; + + +// BGスクリーンデータ1 +u16 bg_scr_data[32 * 32]= +{ + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,//0 + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001, + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,//1 + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//2 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,//3 + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001, + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,//4 + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//5 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//6 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,//7 + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802, + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,//8 + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//9 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//10 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//11 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//12 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//13 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//14 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//15 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//16 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//17 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//18 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//19 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1405,0x1405,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//20 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1005,0x1005,0x1003, + 0x1003,0x1c05,0x1c05,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//21 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1805,0x1805,0x1003, + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,//22 + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802, + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,//23 + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801, +};// Bueeer eor screen data(背景の枠) + +u16 bg_scr_data2[32 * 32];//スクリーンデータ2 \ No newline at end of file diff --git a/build/systemMenu_RED/data/BGData_MachineSettings.c b/build/systemMenu_RED/data/BGData_MachineSettings.c new file mode 100644 index 00000000..529bf33c --- /dev/null +++ b/build/systemMenu_RED/data/BGData_MachineSettings.c @@ -0,0 +1,122 @@ +// BGキャラクタ +u32 bg_char_data[8 * 6] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000,// 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x11111111, 0x44444444, 0x77777777, 0x99999999,// 0001h + 0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xcccccccc, + 0xdddddddd, 0xdddddddd, 0xdddddddd, 0xeeeeeeee,// 0002h + 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,// 0003h + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,// 0004h(右上^) + 0xfffffff1, 0xfffffff1, 0xfffff11f, 0xfffff11f, + 0xfff11fff, 0xfff11fff, 0xf11fffff, 0xf11fffff,// 0005h(右下^) + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +}; + + +// BGスクリーンデータ1 +u16 bg_birth_scr_data[32 * 32]= +{ + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,//0 + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001, + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,//1 + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//2 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//3 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//4 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//5 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//6 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//7 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1404,0x1004,0x1003,0x1003,//8 + 0x1003,0x1003,0x1404,0x1004,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1405,0x1005,0x1003,0x1003,//9 + 0x1003,0x1003,0x1405,0x1005,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//10 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//11 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//12 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//13 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1c05,0x1805,0x1003,0x1003,//14 + 0x1003,0x1003,0x1c05,0x1805,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1c04,0x1804,0x1003,0x1003,//15 + 0x1003,0x1003,0x1c04,0x1804,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//16 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//17 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//18 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//19 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//20 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//21 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,//22 + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802, + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,//23 + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801, +};// Buffer for screen data(背景の枠) + +// BGスクリーンデータ1 +u16 bg_scr_data[32 * 32]= +{ + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,//0 + 0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001, + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,//1 + 0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002,0x1002, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//2 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//3 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//4 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//5 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//6 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//7 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//8 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//9 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//10 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//11 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//12 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//13 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//14 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//15 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//16 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//17 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//18 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//19 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//20 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,//21 + 0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003,0x1003, + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,//22 + 0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802,0x1802, + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,//23 + 0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801,0x1801, +};// Buffer for screen data(誕生日設定のBG) \ No newline at end of file diff --git a/build/systemMenu_RED/data/EmptyBanner.bnr b/build/systemMenu_RED/data/EmptyBanner.bnr new file mode 100644 index 00000000..9a4757f3 Binary files /dev/null and b/build/systemMenu_RED/data/EmptyBanner.bnr differ diff --git a/build/systemMenu_RED/data/NTR_IPL_font_l.NFTR b/build/systemMenu_RED/data/NTR_IPL_font_l.NFTR new file mode 100644 index 00000000..b6fe11e0 Binary files /dev/null and b/build/systemMenu_RED/data/NTR_IPL_font_l.NFTR differ diff --git a/build/systemMenu_RED/data/NTR_IPL_font_m.NFTR b/build/systemMenu_RED/data/NTR_IPL_font_m.NFTR new file mode 100644 index 00000000..03ba3a48 Binary files /dev/null and b/build/systemMenu_RED/data/NTR_IPL_font_m.NFTR differ diff --git a/build/systemMenu_RED/data/NTR_IPL_font_s.NFTR b/build/systemMenu_RED/data/NTR_IPL_font_s.NFTR new file mode 100644 index 00000000..59591f8b Binary files /dev/null and b/build/systemMenu_RED/data/NTR_IPL_font_s.NFTR differ diff --git a/build/systemMenu_RED/data/NoBanner.bnr b/build/systemMenu_RED/data/NoBanner.bnr new file mode 100644 index 00000000..6d640e83 Binary files /dev/null and b/build/systemMenu_RED/data/NoBanner.bnr differ diff --git a/build/systemMenu_RED/data/NoCardBanner.bnr b/build/systemMenu_RED/data/NoCardBanner.bnr new file mode 100644 index 00000000..60afadeb Binary files /dev/null and b/build/systemMenu_RED/data/NoCardBanner.bnr differ diff --git a/build/systemMenu_RED/data/bandbrothers_arm7flx_patch.sbin b/build/systemMenu_RED/data/bandbrothers_arm7flx_patch.sbin new file mode 100644 index 00000000..10848717 Binary files /dev/null and b/build/systemMenu_RED/data/bandbrothers_arm7flx_patch.sbin differ diff --git a/build/systemMenu_RED/data/fanfare.32.wav b/build/systemMenu_RED/data/fanfare.32.wav new file mode 100644 index 00000000..eb6cc56b Binary files /dev/null and b/build/systemMenu_RED/data/fanfare.32.wav differ diff --git a/build/systemMenu_RED/misc/include/cmn.h b/build/systemMenu_RED/misc/include/cmn.h new file mode 100644 index 00000000..9640c416 --- /dev/null +++ b/build/systemMenu_RED/misc/include/cmn.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mainFunc.c + + Copyright 2007 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 CMN_H_ +#define CMN_H_ + + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +// define data--------------------------------------------- +#define ARY_SIZEOF(ary) ( sizeof(ary) / sizeof( (ary)[0] ) ) +#define ROUNDUP_DIV(a, b) (( (a) + ((b) - 1) ) / (b)) + + +// function------------------------------------------------ +void CMN_InitAllocator( NNSFndAllocator* pAllocator ); +void CMN_InitFileSystem( NNSFndAllocator* pAllocator ); +void CMN_ClearVram( void ); +u32 CMN_LoadFile(void** ppFile, const char* fpath, NNSFndAllocator* pAlloc); +void CMN_UnloadFile(void* pFile, NNSFndAllocator* pAlloc); +NNSFndArchive* CMN_LoadArchive(const char* name, const char* path, NNSFndAllocator* pAllocator); +void CMN_RemoveArchive(NNSFndArchive* archive, NNSFndAllocator* pAllocator); + + +#ifdef __cplusplus +}/* extern "C" */ +#endif + +#endif // CMN_H_ + diff --git a/build/systemMenu_RED/misc/include/misc.h b/build/systemMenu_RED/misc/include/misc.h new file mode 100644 index 00000000..16716c5b --- /dev/null +++ b/build/systemMenu_RED/misc/include/misc.h @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: misc.h + + Copyright 2007 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 __MISC_H__ +#define __MISC_H__ + +#include +#include + +#define NNS_G2D_UNICODE +#include +#include +#include +#include + +#include "cmn.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// define data---------------------------------------------------------- +#define TP_CSR_TOUCH_COUNT 2 // TPカーソルのチャタリング吸収のためのカウント値 +#define TP_CSR_DETACH_COUNT 2 // TPカーソルを「選択」と判定するTPデタッチからのカウント値 + +// DrawText での左上寄せ +#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT) + +// TXTColorPalette の色名 256色パレットへのロードを想定 +enum +{ + // パレット0 TXT_CPALETTE_MAIN + TXT_COLOR_NULL=0, + TXT_COLOR_WHITE, + TXT_COLOR_BLACK, + TXT_COLOR_RED, + TXT_COLOR_GREEN, + TXT_COLOR_BLUE, + TXT_COLOR_CYAN, + TXT_COLOR_MAGENTA, + TXT_COLOR_YELLOW, + + // ユーザーカラーグラデーションパレット領域 + TXT_UCOLOR_GNULL=16, + TXT_UCOLOR_G0, + TXT_UCOLOR_G1, + TXT_UCOLOR_G2, + TXT_UCOLOR_G3, + TXT_UCOLOR_G4, + TXT_UCOLOR_G5, + TXT_UCOLOR_G6, + TXT_UCOLOR_G7, + TXT_UCOLOR_G8, + TXT_UCOLOR_G9, + TXT_UCOLOR_G10, + TXT_UCOLOR_G11, + TXT_UCOLOR_G12, + TXT_UCOLOR_G13, + TXT_UCOLOR_GWHITE, + + // ユーザーカラーサンプル領域 + TXT_UCOLOR_GRAY=32, + TXT_UCOLOR_BROWN, + TXT_UCOLOR_RED, + TXT_UCOLOR_PINK, + TXT_UCOLOR_ORANGE, + TXT_UCOLOR_YELLOW, + TXT_UCOLOR_LIMEGREEN, + TXT_UCOLOR_GREEN, + TXT_UCOLOR_DARKGREEN, + TXT_UCOLOR_SEAGREEN, + TXT_UCOLOR_TURQUOISE, + TXT_UCOLOR_BLUE, + TXT_UCOLOR_DARKBLUE, + TXT_UCOLOR_PURPLE, + TXT_UCOLOR_VIOLET, + TXT_UCOLOR_MAGENTA, + + // パレット TXT_CPALETTE_4BPP + TXT_COLOR_4BPP_NULL=48, + TXT_COLOR_4BPP_BG=49, + TXT_COLOR_4BPP_TEXT=49 +}; + +// 時計表示場所 +#define RTC_DATE_TOP_X ( 9 * 8 ) +#define RTC_DATE_TOP_Y ( 10 * 8 ) +#define RTC_TIME_TOP_X ( 12 * 8 ) +#define RTC_TIME_TOP_Y ( 12 * 8 ) + + +// キーデータワーク +typedef struct { + u16 trg; // トリガ入力 + u16 cont; // ベタ 入力 +}KeyWork; + + +// タッチパネルワーク +typedef struct { + int detached; // 今回のデータ入力でタッチが離れたことを示す。 + TPData disp; // 今回の入力値(LCD座標) + TPData raw; // 今回の入力値(TP 座標) + TPData last; // 前回の入力値(LCD座標) +}TpWork; + + +// メニュー要素座標 +typedef struct MenuPos { + BOOL enable; + int x; + int y; +}MenuPos; + + +// メニュー構成パラメータ構造体 +typedef struct MenuParam { + int num; + int normal_color; + int select_color; + int disable_color; + MenuPos *pos; + const u16 **str_elem; +}MenuParam; + + +// RTCデータ表示位置ワーク +typedef struct RTCDrawProperty { + BOOL isTopLCD; + int date_x; + int date_y; + int time_x; + int time_y; + int vcount; + RTCDate date; + RTCTime time; + RTCDate date_old; + RTCTime time_old; +}RTCDrawProperty; + +typedef BOOL (*SelectSomethingFunc)( u16 *csr, TPData *tgt ); + +// global variables-------------------------------------------------- +extern TpWork tpd; // タッチパネルデータ +extern KeyWork pad; // キーパッド入力データ +extern const u8 *const g_strWeek[ 7 ]; // 曜日文字列 +extern RTCDrawProperty g_rtcDraw; + +extern NNSFndAllocator g_allocator; // メモリアロケータ +extern NNSG2dFont gFont; // フォント +extern NNSG2dCharCanvas gCanvas; // CharCanvas +extern NNSG2dTextCanvas gTextCanvas; // TextCanvas +extern NNSG2dCharCanvas gCanvasSub; // CharCanvasSub +extern NNSG2dTextCanvas gTextCanvasSub; // TextCanvasSub + +// function------------------------------------------------------------- +void InitAllocator( void ); +void *Alloc( u32 size ); +void Free( void *pBuffer ); +void InitBG( void ); +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ); +void PutStringUTF16 ( int x, int y, int color, const u16 *strUTF16 ); +void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ); +void PrintfSJIS ( int x, int y, int color, const char *fmt, ... ); +void PrintfSJISSub( int x, int y, int color, const char *fmt, ... ); +void ReadKeyPad( void ); +void ReadTP( void ); +void DrawMenu( u16 nowCsr, const MenuParam *pMenu ); +BOOL SelectSomethingByTP( u16 *nowCsr, SelectSomethingFunc func[], int funcnum ); +BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ); +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ); +void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ); +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); +void DrawRTCData( RTCDrawProperty *pRTCDraw ); +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); +void ChangeUserColor( u8 col ); + +#ifdef __cplusplus +} +#endif + +#endif // __MISC_H__ diff --git a/build/systemMenu_RED/misc/src/cmn.c b/build/systemMenu_RED/misc/src/cmn.c new file mode 100644 index 00000000..6cc10d44 --- /dev/null +++ b/build/systemMenu_RED/misc/src/cmn.c @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mainFunc.c + + Copyright 2007 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 "cmn.h" + + +/*---------------------------------------------------------------------------* + Name: CMN_InitFileSystem + + Description: ファイルシステムを有効にします。 + また、ファイルテーブルをメモリに読み込みます。 + + Arguments: pAllocator: 有効なアロケータへのポインタ。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +// ファイルシステム準備 +void CMN_InitFileSystem( NNSFndAllocator* pAllocator ) +{ + SDK_NULL_ASSERT( pAllocator ); + + // ARM7との通信FIFO割り込み許可 + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + + // ファイルテーブルキャッシュ + if( pAllocator != NULL ) + { + const u32 need_size = FS_GetTableSize(); + void *p_table = NNS_FndAllocFromAllocator( pAllocator, need_size ); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } +} + + + +/*---------------------------------------------------------------------------* + Name: CMN_ClearVram + + Description: VRAM をクリアします。 + VRAM が全て未割り当てでなければなりません。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +// VRAMクリア +void CMN_ClearVram( void ) +{ + //--------------------------------------------------------------------------- + // All VRAM banks to LCDC + //--------------------------------------------------------------------------- + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + + //--------------------------------------------------------------------------- + // Clear all LCDC space + //--------------------------------------------------------------------------- + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //--------------------------------------------------------------------------- + // Disable the banks on LCDC + //--------------------------------------------------------------------------- + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); // clear the standard palette + + MI_CpuFillFast((void*)HW_DB_OAM, 192, HW_DB_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette +} + + + +/*---------------------------------------------------------------------------* + Name: CMN_LoadFile + + Description: ファイルをメモリにロードします。 + ファイルデータが不要になった場合は + CMN_UnloadFile( *ppFile, pAlloc ) でファイルデータを + 解放します。 + + Arguments: ppFile: ファイルをロードしたメモリアドレスを受け取る + バッファへのポインタ。 + fpath: ロードするファイルのパス + pAlloc: アロケータへのポインタ + + Returns: ロードしたファイルのファイルサイズを返します。 + 0 の場合はファイルロードに失敗した事を表します。 + この場合 *ppFile の値は無効です。 + *---------------------------------------------------------------------------*/ +u32 CMN_LoadFile(void** ppFile, const char* fpath, NNSFndAllocator* pAlloc) +{ + BOOL bSuccess; + FSFile f; + u32 length; + u32 read; + + SDK_NULL_ASSERT( ppFile ); + SDK_NULL_ASSERT( fpath ); + SDK_NULL_ASSERT( pAlloc ); + + FS_InitFile(&f); + + bSuccess = FS_OpenFile(&f, fpath); + if( ! bSuccess ) + { + OS_Warning("file (%s) not found", fpath); + return 0; + } + + length = FS_GetLength(&f); + *ppFile = NNS_FndAllocFromAllocator(pAlloc, length); + if( *ppFile == NULL ) + { + OS_Warning("cant allocate memory for file: %s", fpath); + return 0; + } + + read = (u32)FS_ReadFile(&f, *ppFile, (s32)length); + if( read != length ) + { + OS_Warning("fail to load file: %s", fpath); + NNS_FndFreeToAllocator(pAlloc, *ppFile); + return 0; + } + + bSuccess = FS_CloseFile(&f); + if( ! bSuccess ) + { + OS_Warning("fail to close file: %s", fpath); + } + + return length; +} + + + +/*---------------------------------------------------------------------------* + Name: CMN_UnloadFile + + Description: ファイルデータを解放します。 + + Arguments: pFile: ファイルデータへのポインタ + pAlloc: ファイルロードに用いたアロケータへのポインタ + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void CMN_UnloadFile(void* pFile, NNSFndAllocator* pAlloc) +{ + NNS_FndFreeToAllocator(pAlloc, pFile); +} + + + +/*---------------------------------------------------------------------------* + Name: CMN_LoadArchive + + Description: パス名で指定されたアーカイブをメモリに読み込み、ファイルシス + テムにマウントします。 + アーカイブが不要になった場合は + CMN_RemoveArchive( 返り値, pAllocator ) でアーカイブを + 解放します。 + + Arguments: name: アーカイブをファイルシステム上で識別する為の名前。 + path: アーカイブのパス名。 + pAllocator: アロケータへのポインタ + + Returns: アーカイブのロードに成功すれば、NNSFndArchive 構造体へのポイ + ンタを返します。失敗した場合には、NULLを返します。 + *---------------------------------------------------------------------------*/ +NNSFndArchive* +CMN_LoadArchive(const char* name, const char* path, NNSFndAllocator* pAllocator) +{ + FSFile file; + NNSFndArchive* archive = NULL; + + SDK_NULL_ASSERT(name); + SDK_NULL_ASSERT(path); + SDK_NULL_ASSERT(pAllocator); + + FS_InitFile(&file); + if (FS_OpenFile(&file, path)) + { + u32 binarySize = FS_GetLength(&file); + u32 memorySize = MATH_ROUNDUP(sizeof(NNSFndArchive), 16) + MATH_ROUNDUP(binarySize, 16); + + u8* memory = (u8*)NNS_FndAllocFromAllocator(pAllocator, memorySize); + + if (memory != NULL) + { + u8* binary = memory + MATH_ROUNDUP(sizeof(NNSFndArchive), 16); + + if ((u32)FS_ReadFile(&file, binary, (s32)binarySize) == binarySize) + { + if (NNS_FndMountArchive((NNSFndArchive*)memory, name, binary)) + { + archive = (NNSFndArchive*)memory; + } + } + } + (void)FS_CloseFile(&file); + } + return archive; +} + + + +/*---------------------------------------------------------------------------* + Name: CMN_RemoveArchive + + Description: 指定されたアーカイブをメモリから削除します。 + + 指定されたアーカイブをファイルシステムからアンマウントし、ア + ーカイブが読み込まれていたメモリを解放します。 + + Arguments: archive: NNSアーカイブ構造体へのポインタ。 + pAllocator: アーカイブロードに用いたアロケータへのポインタ。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void +CMN_RemoveArchive(NNSFndArchive* archive, NNSFndAllocator* pAllocator) +{ + SDK_NULL_ASSERT(archive); + SDK_NULL_ASSERT(pAllocator); + + (void)NNS_FndUnmountArchive(archive); + NNS_FndFreeToAllocator(pAllocator, archive); +} + diff --git a/build/systemMenu_RED/misc/src/misc.c b/build/systemMenu_RED/misc/src/misc.c new file mode 100644 index 00000000..2e81ed3b --- /dev/null +++ b/build/systemMenu_RED/misc/src/misc.c @@ -0,0 +1,759 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: misc.c + + Copyright 2007 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 "misc.h" + +// define data----------------------------------------------------------------- +#define NTR_IPL_FONT_DATA "data/NTR_IPL_font_m.NFTR" + +#define STRING_LENGTH_MAX 256 + +#define GRAY(x) GX_RGB(x, x, x) + +enum +{ + TXT_CPALETTE_MAIN, + TXT_CPALETTE_USERCOLOR, + TXT_CPALETTE_USERCOLORSAMPLE, + TXT_CPALETTE_4BPP, + TXT_NUM_CPALEETE +}; + +// デモ共通のカラーパレット +GXRgb TXTColorPalette[TXT_NUM_CPALEETE * 16] = +{ + GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), GX_RGB( 0, 0, 0), GX_RGB(31, 0, 0),// 基本文字色 + GX_RGB( 0, 31, 0), GX_RGB( 0, 0, 31), GX_RGB( 0, 31, 31), GX_RGB(31, 0, 31), + GX_RGB(31, 31, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), + GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), + + GX_RGB( 0, 0, 0), GX_RGB(12, 16, 19), GX_RGB(23, 9, 0), GX_RGB(31, 0, 3),// ユーザーカラー領域 + GX_RGB(31, 17, 31), GX_RGB(31, 18, 0), GX_RGB(30, 28, 0), GX_RGB(21, 31, 0), + GX_RGB( 0, 20, 7), GX_RGB( 9, 27, 17), GX_RGB( 6, 23, 30), GX_RGB( 0, 11, 30), + GX_RGB( 0, 0, 18), GX_RGB(17, 0, 26), GX_RGB(26, 0, 29), GX_RGB(31, 0, 18), + + GX_RGB(12, 16, 19), GX_RGB(23, 9, 0), GX_RGB(31, 0, 3), GX_RGB(31, 17, 31),// ユーザーカラーのサンプル領域 + GX_RGB(31, 18, 0), GX_RGB(30, 28, 0), GX_RGB(21, 31, 0), GX_RGB( 0, 31, 0), + GX_RGB( 0, 20, 7), GX_RGB( 9, 27, 17), GX_RGB( 6, 23, 30), GX_RGB( 0, 11, 30), + GX_RGB( 0, 0, 18), GX_RGB(17, 0, 26), GX_RGB(26, 0, 29), GX_RGB(31, 0, 18), + + GRAY(31), GRAY(29), GRAY(27), GRAY(25), + GRAY(23), GRAY(21), GRAY(19), GRAY(17), + GRAY(15), GRAY(14), GRAY(12), GRAY(10), + GRAY( 8), GRAY( 6), GRAY( 3), GRAY( 0), +}; + +// グラデパレットを作るためのマクロ +#define MAKECOLOR(r,g,b) GX_RGB( 0, 0, 0), GX_RGB(r, g, b), MC(r,g,b,1), MC(r,g,b,2),\ + MC(r,g,b,3), MC(r,g,b,4), MC(r,g,b,5), MC(r,g,b,6),\ + MC(r,g,b,7), MC(r,g,b,8), MC(r,g,b,9), MC(r,g,b,10),\ + MC(r,g,b,11), MC(r,g,b,12), MC(r,g,b,13), GX_RGB(31, 31, 31) + +#define MC(r,g,b,i) GX_RGB(r+((31-r)*i)/14, g+((31-g)*i)/14, b+((31-b)*i)/14) + +// ユーザーカラーパレット切り替え用 +GXRgb TempPalette[16 * 16] = +{ + MAKECOLOR(12, 16, 19), + MAKECOLOR(23, 9, 0), + MAKECOLOR(31, 0, 3), + MAKECOLOR(31, 17, 31), + MAKECOLOR(31, 18, 0), + MAKECOLOR(30, 28, 0), + MAKECOLOR(21, 31, 0), + MAKECOLOR( 0, 31, 0), + MAKECOLOR( 0, 20, 7), + MAKECOLOR( 9, 27, 17), + MAKECOLOR( 6, 23, 30), + MAKECOLOR( 0, 11, 30), + MAKECOLOR( 0, 0, 18), + MAKECOLOR(17, 0, 26), + MAKECOLOR(26, 0, 29), + MAKECOLOR(31, 0, 18), +}; + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位) +#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位) +#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位) +#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位) + +#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位) +#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位) + +#define CHARACTER_OFFSET 0 // 使用するキャラクタ列の開始番号 + +// RTCデータ表示位置ワーク +typedef struct RtcDrawPos{ + int date_x; + int date_y; + int time_x; + int time_y; +}RtcDrawPos; + +// function's prototype------------------------------------------------------- +static BOOL WaitDetachTP( void ); +static void StartDetachTP( void ); +static void InitScreen( void ); +static void InitCanvas( void ); + +// global variable------------------------------------------------------------- +KeyWork pad; // キーパッド入力データ +TpWork tpd; // タッチパネル入力データ +NNSFndAllocator g_allocator; // メモリアロケータ +NNSG2dFont gFont; // フォント +NNSG2dCharCanvas gCanvas; // CharCanvas +NNSG2dTextCanvas gTextCanvas; // TextCanvas +NNSG2dCharCanvas gCanvasSub; // CharCanvas +NNSG2dTextCanvas gTextCanvasSub; // TextCanvas + +// static variable------------------------------------------------------------- +static int s_detach_count; +static RtcDrawPos s_rtcPos; +static RTCDate s_rtcDate; +static RTCTime s_rtcTime; +static u16 s_vcount; + +static char s_strBuffer[ STRING_LENGTH_MAX * 2 ] ATTRIBUTE_ALIGN(2); +static u16 s_strBufferUTF16[ STRING_LENGTH_MAX ]; + +// const data------------------------------------------------------------------ + +// 曜日データ表示用文字コード +const u8 *const g_strWeek[] ATTRIBUTE_ALIGN(2) = { + (const u8 *)"SUN", + (const u8 *)"MON", + (const u8 *)"TUE", + (const u8 *)"WED", + (const u8 *)"THU", + (const u8 *)"FRI", + (const u8 *)"SAT", +}; + + +// ============================================================================ +// メモリ管理 +// ============================================================================ + +// アロケータの初期化 +void InitAllocator( void ) +{ + // ※暫定対策 FS_Init内でハッシュチェック用のヒープを確保しているため、 + // ユーザーヒープの確保前にFS_Initを行う必要がある。 + + // ファイルシステム初期化 + FS_Init( FS_DMA_NOT_USE ); + + { + NNSFndAllocator *pAllocator = &g_allocator; + u32 arenaLow = MATH_ROUNDUP ( (u32)OS_GetMainArenaLo(), 16 ); + u32 arenaHigh = MATH_ROUNDDOWN( (u32)OS_GetMainArenaHi(), 16 ); + u32 heapSize = arenaHigh - arenaLow; + void* heapMemory = OS_AllocFromMainArenaLo( heapSize, 16 ); + NNSFndHeapHandle heapHandle; + SDK_NULL_ASSERT( pAllocator ); + + heapHandle = NNS_FndCreateExpHeap( heapMemory, heapSize ); + SDK_ASSERT( heapHandle != NNS_FND_HEAP_INVALID_HANDLE ); + + NNS_FndInitAllocatorForExpHeap( pAllocator, heapHandle, 32 ); + } +} + + +// メモリ割り当て +void *Alloc( u32 size ) +{ + return NNS_FndAllocFromAllocator( &g_allocator, size ); +} + + +// メモリ解放 +void Free( void *pBuffer ) +{ + NNS_FndFreeToAllocator( &g_allocator, pBuffer ); +} + + +// ============================================================================ +// 画面設定 +// ============================================================================ + +// BG初期化 +void InitBG(void) +{ + // 画面OFF + GX_DispOff(); + GXS_DispOff(); + + // VRAMの割り当てを全て解除 + GX_DisableBankForBG(); + GX_DisableBankForOBJ(); + GX_DisableBankForSubBG(); + GX_DisableBankForSubOBJ(); + + // メイン2Dエンジンの出力を下画面に + GX_SetDispSelect( GX_DISP_SELECT_SUB_MAIN ); + + // メインLCD + { + // VRAM割り当て + GX_SetBankForBG ( GX_VRAM_BG_128_A ); + GX_SetBankForOBJ( GX_VRAM_OBJ_128_B ); + + MI_CpuClearFast( (void *)HW_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_OBJ_VRAM, 0x20000 ); // OBJ-VRAM クリア + MI_DmaFill32( 3, (void *)HW_OAM, 192, HW_OAM_SIZE ); // OAM クリア + + // カラーパレットを設定 + GX_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); + + // BGモード設定 + GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D ); + + GX_SetBGScrOffset ( GX_BGSCROFFSET_0x10000 ); + GX_SetBGCharOffset( GX_BGCHAROFFSET_0x00000 ); + } + // サブLCD + { + // VRAM割り当て + GX_SetBankForSubBG ( GX_VRAM_SUB_BG_128_C ); // VRAM-C for BGs + GX_SetBankForSubOBJ( GX_VRAM_SUB_OBJ_128_D ); // VRAM-D for BGs + + MI_CpuClearFast( (void *)HW_DB_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_DB_OBJ_VRAM, 0x20000 ); // OBJ -VRAM クリア + + // カラーパレットを設定 + GXS_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); + + // BGモード設定 + GXS_SetGraphicsMode( GX_BGMODE_0 ); // BGMODE is 0 + } + InitScreen(); + InitCanvas(); +} + + +// スクリーン初期化 +static void InitScreen( void ) +{ + // メイン画面 BG 0 を設定 + G2_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_256, // カラーモード 256色 + GX_BG_SCRBASE_0xf800, // スクリーンベース + GX_BG_CHARBASE_0x00000, // キャラクタベース + GX_BG_EXTPLTT_01 // 拡張パレットスロット + ); + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xe800, // screen base offset + 0x0000 is the address for BG #1 screen + GX_BG_CHARBASE_0x10000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + G2_SetBG2ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xd800, // screen base offset + 0x0000 is the address for BG #1 screen + GX_BG_CHARBASE_0x14000 // character base offset + 0x04000 is the address for BG #0 characters + ); + GX_SetVisiblePlane( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + G2_SetBG2Priority(0); + G2_SetBG0Priority(1); + G2_SetBG1Priority(2); + + // サブ画面 BG 0 を設定 + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xf800, // screen base offset + 0x0000 is the address for BG #0 screen + GX_BG_CHARBASE_0x00000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); // display only BG #0 +} + + +// 文字列描画の初期化 +static void InitCanvas( void ) +{ + CMN_InitFileSystem( &g_allocator ); + + // フォントを読み込みます + { + void* pFontFile; + u32 size = CMN_LoadFile( &pFontFile, NTR_IPL_FONT_DATA, &g_allocator); + NNS_G2D_ASSERT( size > 0 ); + NNS_G2dFontInitUTF16(&gFont, pFontFile); +// NNS_G2dPrintFont(&gFont); + } + + { + // CharCanvas の初期化 + NNS_G2dCharCanvasInitForBG( + &gCanvas, + (GXCharFmt256*)G2_GetBG0CharPtr() + CHARACTER_OFFSET, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_256 + ); + + // TextCanvasの初期化 + NNS_G2dTextCanvasInit( + &gTextCanvas, + &gCanvas, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + + // スクリーンを設定 + NNS_G2dMapScrToCharText( + G2_GetBG0ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + TXT_CPALETTE_MAIN + ); + } + { + // CharCanvas の初期化 + NNS_G2dCharCanvasInitForBG( + &gCanvasSub, + (GXCharFmt16*)G2S_GetBG0CharPtr() + CHARACTER_OFFSET, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_16 + ); + + // TextCanvasの初期化 + NNS_G2dTextCanvasInit( + &gTextCanvasSub, + &gCanvasSub, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + + // スクリーンを設定 + NNS_G2dMapScrToCharText( + G2S_GetBG0ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + TXT_CPALETTE_MAIN + ); + } +} + + +// UTF16での直接文字表示 +void PutStringUTF16( int x, int y, int color, const u16 *strUTF16 ) +{ + NNS_G2dTextCanvasDrawText( &gTextCanvas, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + strUTF16 ); +} + +void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ) +{ + NNS_G2dTextCanvasDrawText( &gTextCanvasSub, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + strUTF16 ); +} + + +// 書式付きで作成した文字列を表示した場合の幅を取得する +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + return NNS_G2dTextCanvasGetTextWidth( pCanvas, s_strBufferUTF16 ); +} + + +// SJISでPrintf形式で文字表示(内部でUTF16に変換) +void PrintfSJIS( int x, int y, int color, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + NNS_G2dTextCanvasDrawText(&gTextCanvas, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + s_strBufferUTF16 ); +} + +void PrintfSJISSub( int x, int y, int color, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + NNS_G2dTextCanvasDrawText(&gTextCanvasSub, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + s_strBufferUTF16 ); +} + + +// キー入力読み出し-------------------------------- +void ReadKeyPad(void) +{ + u16 readData = PAD_Read(); + pad.trg = (u16)(readData & (readData ^ pad.cont)); // トリガ 入力 + pad.cont = readData; // ベタ 入力 +} + + +// タッチパネルデータの取得----------------------- +void ReadTP(void) +{ + TP_GetCalibratedPoint( &tpd.last, &tpd.raw ); // 前回のTPデータを退避 + + if( TP_RequestRawSampling(&tpd.raw) ) { // タッチパネルのサンプリング + SVC_CpuClear(0x0000, &tpd.raw, sizeof(tpd.raw), 16); // SPI-busyでデータ取得に失敗した時は”データなし”でリターン。 + return; + } + TP_GetCalibratedPoint( &tpd.disp, &tpd.raw ); // TP座標からLCD座標に変換。 + + if( !WaitDetachTP() ) { // TPデタッチ待ちを行う。 + SVC_CpuClear(0x0000, &tpd.disp, sizeof(tpd.disp), 16); // SPI-busyでデータ取得に失敗した時は”データなし”でリターン。 + return; + } +#if 0 + if(tpd.disp.touch) { // 現在のTPデータを表示 + switch ( tpd.disp.validity ) { + case TP_VALIDITY_VALID: + OS_Printf("( %3d, %3d ) -> ( %3d, %3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_X: + OS_Printf("( *%3d, %3d ) -> ( *%3d, %3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_Y: + OS_Printf("( %3d, *%3d ) -> ( %3d, *%3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_XY: + OS_Printf("( *%3d, *%3d ) -> ( *%3d, *%3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + } + } +#endif +} + + +// TPデタッチを待つ +static BOOL WaitDetachTP( void ) +{ + // s_detach_countが始動していたら、カウント判定。 + if(s_detach_count > 0) { + if(tpd.disp.touch == 0) { // TPが押されていなければ、カウント進行し規定値で再入力を受け付ける。 + s_detach_count--; + }else { + s_detach_count = TP_CSR_DETACH_COUNT; + } + return FALSE; + } + return TRUE; +} + + +// TPデタッチ待ちの開始 +static void StartDetachTP( void ) +{ + s_detach_count = TP_CSR_DETACH_COUNT; +} + + +//====================================================== +// メニュー制御 +//====================================================== + +// メニュー描画 +void DrawMenu( u16 nowCsr, const MenuParam *pMenu ) +{ + int i; + int color; + + for( i = 0; i < pMenu->num; i++ ) { + if(i == nowCsr) { + if( !pMenu->pos[ i ].enable ) { + color = pMenu->disable_color; + }else { + color = pMenu->select_color; + } + }else { + color = pMenu->normal_color; + } + PutStringUTF16( pMenu->pos[ i ].x, pMenu->pos[ i ].y, color, (pMenu->str_elem)[ i ] ); + } +} + +// タッチパネルによる選択を行う関数・汎用版。 +// 主にチャタリングを吸収する程度の機能を持つ。 +// SelectSomethingFunc型の関数ポインタfuncには、次に示す条件を満たす関数を作り、リストにしてセットして使う。 +// 1.要素上でタッチしていればTRUEを返し、そうでなければFALSEを返す。 +// 2.第一引数に与えたポインタの指す変数にカーソル位置を入れて返す。 +BOOL SelectSomethingByTP( u16 *nowCsr, SelectSomethingFunc func[], int funcnum ) +{ + int i; + static u16 detach_count = 0; + static u16 csr_old = 0xffff; + static u16 same_csr_count = 0; + + // detach_countが始動していたら、カウント判定。 + if( detach_count > 0 ) { + if( tpd.disp.touch == 0 ) { // TPが押されていなければ、カウント進行し、TP_CSR_DETACH_COUNTカウントでメニュー選択 + if( ++detach_count == TP_CSR_DETACH_COUNT ) { + detach_count = 0; + same_csr_count = 0; + *nowCsr = csr_old; + return TRUE; + }else { + return FALSE; + } + } + } + detach_count=0; // detachカウント値のクリア + + for( i = 0; i < funcnum; i++ ) { + if( tpd.disp.touch ) { // タッチパネルがタッチされているなら、 + u16 csr; + if( func[i]( &csr, &tpd.disp ) ) { // funcは要素上にタッチされていればTRUEを返し、カーソル位置も返してくれる関数 + if( tpd.disp.validity == TP_VALIDITY_VALID ) { // カーソルをその要素に移動 + if( csr_old == csr ) { + if( same_csr_count < TP_CSR_TOUCH_COUNT ) { + same_csr_count++; + } + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + *nowCsr = csr; + } + return FALSE; + }else { + csr_old = csr; + } + break; + } + }else { + } + }else { // touch==0 + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + detach_count = 1; + break; + } + } + } + same_csr_count = 0; + return FALSE; +} + +// タッチパネルによるメニュー選択 +BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ) +{ + u16 i; + static u16 detach_count = 0; + static u16 csr_old = 0xff; + static u16 same_csr_count = 0; + + // detach_countが始動していたら、カウント判定。 + if( detach_count > 0 ) { + if( tpd.disp.touch == 0 ) { // TPが押されていなければ、カウント進行し、10カウントでメニュー選択 + if( ++detach_count == TP_CSR_DETACH_COUNT ) { + detach_count = 0; + return TRUE; + }else { + return FALSE; + } + } + } + detach_count=0; // detachカウント値のクリア + + for( i = 0; i < pMenu->num; i++ ) { + if( tpd.disp.touch ) { // タッチパネルがメニューの要素上でタッチされているなら、 + NNSG2dTextRect rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, (pMenu->str_elem)[ i ] ); + u16 top_x = (u16)( pMenu->pos[ i ].x ); // メニュー要素のLCD座標を算出 + u16 top_y = (u16)( pMenu->pos[ i ].y ); + u16 bottom_x = (u16)( top_x + rect.width ); + u16 bottom_y = (u16)( top_y + rect.height ); + + + if( WithinRangeTP( top_x, top_y, bottom_x, bottom_y, &tpd.disp ) ) { + if( tpd.disp.validity == TP_VALIDITY_VALID ) { // カーソルをその要素に移動 + if( csr_old == i ) { + if( same_csr_count < TP_CSR_TOUCH_COUNT ) { + same_csr_count++; + } + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + *nowCsr = i; + } + return FALSE; + }else { + csr_old = i; + } + break; + } + }else { + } + }else { // touch==0 + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + detach_count = 1; + break; + } + } + } + same_csr_count = 0; + return FALSE; +} + + +// 現在のタッチパネル座標が指定領域内にあるかどうかを返す。 +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ) +{ + if( ( tgt->x >= top_x ) && + ( tgt->x <= bottom_x ) && + ( tgt->y >= top_y ) && + ( tgt->y <= bottom_y ) ) { + return TRUE; + }else { + return FALSE; + } +} + + +// バナーアイコンOBJのロード +void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ) +{ + GXS_LoadOBJPltt( bannerp->pltt, 15, BANNER_PLTT_SIZE ); + MI_CpuCopyFast( bannerp->image, (void *)(HW_DB_OBJ_VRAM + 0x20), BANNER_IMAGE_SIZE ); + G2_SetOBJAttr( pDstOAM, // OAM pointer + 32, // X position + 32, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x32, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 1, // charactor + 15, // palette + 0); // affine +} + + +//=============================================== +// RTCアクセスルーチン +//=============================================== + +// RTCデータの取得 +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( forceGetFlag || ( pRTCDraw->vcount++ == 59 ) ) { + pRTCDraw->vcount = 0; + MI_CpuCopy16( &pRTCDraw->date, &pRTCDraw->date_old, sizeof(RTCDate) ); + MI_CpuCopy16( &pRTCDraw->time, &pRTCDraw->time_old, sizeof(RTCTime) ); + (void)RTC_GetDateTime( &pRTCDraw->date, &pRTCDraw->time ); + return TRUE; + } + return FALSE; +} + + +// RTCデータの表示 +void DrawRTCData( RTCDrawProperty *pRTCDraw ) +{ + void (*pPrintFunc)( int x, int y, int color, const char *fmt, ... ) = + ( pRTCDraw->isTopLCD ) ? PrintfSJISSub : PrintfSJIS; + + // 前RTC情報の消去 + { + u32 year = pRTCDraw->date_old.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_WHITE, "%04d/%02d/%02d[%3s]", + year, + pRTCDraw->date_old.month, + pRTCDraw->date_old.day, + g_strWeek[ pRTCDraw->date_old.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_WHITE, "%02d:%02d:%02d", + pRTCDraw->time_old.hour, + pRTCDraw->time_old.minute, + pRTCDraw->time_old.second + ); + } + // RTC情報の表示 + { + u32 year = pRTCDraw->date.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_BLACK, "%d/%02d/%02d[%3s]", + year, + pRTCDraw->date.month, + pRTCDraw->date.day, + g_strWeek[ pRTCDraw->date.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_BLACK, "%02d:%02d:%02d", + pRTCDraw->time.hour, + pRTCDraw->time.minute, + pRTCDraw->time.second + ); + } +} + +// RTCデータの取得&表示 +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( GetRTCData( pRTCDraw, forceGetFlag ) ) { + DrawRTCData( pRTCDraw ); + } +} + +// ユーザーカラー領域の切り替え +void ChangeUserColor( u8 col ) +{ + int l; + if(col > 15) return; + for(l=0;l<16;l++) + { + TXTColorPalette[16+l] = TempPalette[16 * col + l]; + } + GX_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); +} diff --git a/build/systemMenu_RED/sharedFont/CN/TBF1-cn_l.NFTR b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_l.NFTR new file mode 100644 index 00000000..999e8a11 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_l.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/CN/TBF1-cn_m.NFTR b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_m.NFTR new file mode 100644 index 00000000..362783b3 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_m.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/CN/TBF1-cn_s.NFTR b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_s.NFTR new file mode 100644 index 00000000..db6d5241 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/CN/TBF1-cn_s.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/KR/TBF1-kr_l.NFTR b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_l.NFTR new file mode 100644 index 00000000..4e2dd193 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_l.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/KR/TBF1-kr_m.NFTR b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_m.NFTR new file mode 100644 index 00000000..bd102651 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_m.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/KR/TBF1-kr_s.NFTR b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_s.NFTR new file mode 100644 index 00000000..7c7d1f0e Binary files /dev/null and b/build/systemMenu_RED/sharedFont/KR/TBF1-kr_s.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/Makefile b/build/systemMenu_RED/sharedFont/Makefile new file mode 100644 index 00000000..8e0f515b --- /dev/null +++ b/build/systemMenu_RED/sharedFont/Makefile @@ -0,0 +1,96 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +SUBDIRS = + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# WW,CN,KRから選択 +FONT_REGION = WW +FONT_DIR = $(FONT_REGION) + +ifeq ($(FONT_REGION),WW) +FONT_TIMESTAMP = 08073100 +FONT_REGION_CODE = 0 +FONTS = $(FONT_DIR)/TBF1_l.NFTR \ + $(FONT_DIR)/TBF1_m.NFTR \ + $(FONT_DIR)/TBF1_s.NFTR +endif # REGION=WW + +ifeq ($(FONT_REGION),CN) +FONT_TIMESTAMP = 09033000 +FONT_REGION_CODE = 4 +FONTS = NULL \ + NULL \ + NULL \ + $(FONT_DIR)/TBF1-cn_l.NFTR \ + $(FONT_DIR)/TBF1-cn_m.NFTR \ + $(FONT_DIR)/TBF1-cn_s.NFTR \ + NULL \ + NULL \ + NULL +endif # REGION=CN + +ifeq ($(FONT_REGION),KR) +FONT_TIMESTAMP = 09033100 +FONT_REGION_CODE = 5 +FONTS = NULL \ + NULL \ + NULL \ + NULL \ + NULL \ + NULL \ + $(FONT_DIR)/TBF1-kr_l.NFTR \ + $(FONT_DIR)/TBF1-kr_m.NFTR \ + $(FONT_DIR)/TBF1-kr_s.NFTR +endif # REGION=KR + +FONT_RSC = $(FONTS) + +FONT_ORG_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont/WW +FONT_ORG_RSC = $(addprefix $(FONT_ORG_DIR)/, $(FONTS)) + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +FONT_TABLE = TWLFontTable.dat +FONT_TABLE_WITH_TIMESTAMP = TWLFontTable_$(FONT_REGION)_$(FONT_TIMESTAMP).dat +endif + +GEN_FONT_TABLE = $(SYSMENU_TOOLSDIR)/bin/genFontTable.plx + +#---------------------------------------------------------------------------- + +LDIRT_CLEAN = $(FONT_TABLE_WITH_TIMESTAMP) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(FONT_TABLE) $(FONT_TABLE_WITH_TIMESTAMP) + +# compress sharedFonts and them in local directory +$(FONT_TABLE): $(FONT_RSC) $(GEN_FONT_TABLE) ./Makefile + $(GEN_FONT_TABLE) $(FONT_TIMESTAMP) $(FONT_REGION_CODE) $(FONT_RSC) + +$(FONT_TABLE_WITH_TIMESTAMP): $(FONT_TABLE) + cp $< $@ + +NULL: + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sharedFont/TWLFontTable.dat b/build/systemMenu_RED/sharedFont/TWLFontTable.dat new file mode 100644 index 00000000..9d42be0e Binary files /dev/null and b/build/systemMenu_RED/sharedFont/TWLFontTable.dat differ diff --git a/build/systemMenu_RED/sharedFont/WW/TBF1_l.NFTR b/build/systemMenu_RED/sharedFont/WW/TBF1_l.NFTR new file mode 100644 index 00000000..7c453a78 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TBF1_l.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/TBF1_m.NFTR b/build/systemMenu_RED/sharedFont/WW/TBF1_m.NFTR new file mode 100644 index 00000000..5dbd37a3 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TBF1_m.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/TBF1_s.NFTR b/build/systemMenu_RED/sharedFont/WW/TBF1_s.NFTR new file mode 100644 index 00000000..f4054938 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/TBF1_s.NFTR differ diff --git a/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_l.bmp b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_l.bmp new file mode 100644 index 00000000..58d518f2 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_l.bmp differ diff --git a/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_m.bmp b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_m.bmp new file mode 100644 index 00000000..a401ec5d Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_m.bmp differ diff --git a/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_s.bmp b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_s.bmp new file mode 100644 index 00000000..3f694558 Binary files /dev/null and b/build/systemMenu_RED/sharedFont/WW/bmp/TBF1_s.bmp differ diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile b/build/systemMenu_RED/sysmenuVersion/Makefile new file mode 100644 index 00000000..8c8ccd5c --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +# バージョンファイルとTADを生成する +# TWL_IPL_RED_PRIVATE_ROOTが設定されていない場合は +# 既存のバージョンファイルからTADのみ生成する + +# 現在、製品版の証明書を含んだものは生成しない + + +override TARGET_PLATFORM := TWL + +SUBMAKES = Makefile.A Makefile.J Makefile.E Makefile.P Makefile.U Makefile.C Makefile.K + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.A b/build/systemMenu_RED/sysmenuVersion/Makefile.A new file mode 100644 index 00000000..d3be136b --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.A @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.A + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.C b/build/systemMenu_RED/sysmenuVersion/Makefile.C new file mode 100644 index 00000000..90b4f874 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.C @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.C + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.E b/build/systemMenu_RED/sysmenuVersion/Makefile.E new file mode 100644 index 00000000..3af8d32c --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.E @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.E + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.J b/build/systemMenu_RED/sysmenuVersion/Makefile.J new file mode 100644 index 00000000..949d68a1 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.J @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.J + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.K b/build/systemMenu_RED/sysmenuVersion/Makefile.K new file mode 100644 index 00000000..88be0f8b --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.K @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.K + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.P b/build/systemMenu_RED/sysmenuVersion/Makefile.P new file mode 100644 index 00000000..e6618439 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.P @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.P + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/Makefile.U b/build/systemMenu_RED/sysmenuVersion/Makefile.U new file mode 100644 index 00000000..32f7e39e --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/Makefile.U @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM := TWL + +TARGET_FIRM = SYSTEMMENU +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.sysmenuVersion +include ./commondefs.sysmenuVersion.local + +#--------------------------------------------------------- +# リージョン固有パラメータ + +include ./defs.sysmenuVersion.U + + +do-build : $(TARGET_BIN) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +include ./modulerules.sysmenuVersion + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.A.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.A.dat new file mode 100644 index 00000000..6944ff95 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.A.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.C.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.C.dat new file mode 100644 index 00000000..070c8a53 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.C.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.E.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.E.dat new file mode 100644 index 00000000..084095cc Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.E.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.J.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.J.dat new file mode 100644 index 00000000..c4d12543 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.J.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.K.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.K.dat new file mode 100644 index 00000000..a0f92aa0 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.K.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.P.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.P.dat new file mode 100644 index 00000000..51083172 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.P.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.U.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.U.dat new file mode 100644 index 00000000..8ee062d0 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.dev.U.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.A.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.A.dat new file mode 100644 index 00000000..97cf4e79 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.A.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.C.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.C.dat new file mode 100644 index 00000000..83b8cbaf Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.C.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.E.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.E.dat new file mode 100644 index 00000000..c999b121 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.E.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.J.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.J.dat new file mode 100644 index 00000000..d97bb89e Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.J.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.K.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.K.dat new file mode 100644 index 00000000..37815b1c Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.K.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.P.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.P.dat new file mode 100644 index 00000000..273aeb4e Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.P.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.U.dat b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.U.dat new file mode 100644 index 00000000..ae87c0bc Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/SysmenuVersion.prod.U.dat differ diff --git a/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion b/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion new file mode 100644 index 00000000..d34dab84 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.sysmenuVersion +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン共通パラメータ + +# ユーザー領域サイズ(=128MB) +USER_AREA_SIZE = 134217728 + +# NUPホストネーム +NUP_HOSTNAME = nus.t.shop.nintendowifi.net:443 + +# EULAのURL +EULA_URL = https://cfh.t.app.nintendowifi.net/eula/ + +# バージョン文字列 +ifndef FIRM_USE_PRODUCT_KEYS +DEV_STRING = _dev +endif +STR_VERSION = $(SYSMENU_VERSION_MAJOR).$(SYSMENU_VERSION_MINOR)$(SYSMENU_VERSION_STRING_REGION)$(DEV_STRING) + +#--------------------------------------------------------- +# 外部使用変数 + +ifeq ($(FIRM_USE_PRODUCT_KEYS),TRUE) +SYSMENU_VERSION_TARGET = prod +else +SYSMENU_VERSION_TARGET = dev +endif + +SYSMENU_VERSION_REGION_HEX_CODE = $(shell perl -e 'printf "%x", unpack( c ,$(SYSMENU_VERSION_REGION) )') + +SYSMENU_VERSION_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/sysmenuVersion +SYSMENU_VERSION_FILE = SysmenuVersion.$(SYSMENU_VERSION_TARGET).$(SYSMENU_VERSION_REGION).dat +SYSMENU_VERSION_MAKETAD_OPTION += -s -d 0003000F484E4C$(SYSMENU_VERSION_REGION_HEX_CODE) 3031 0 SYSM_VERSION -v $(SYSMENU_VERSION_TAD_VERSION) -p + +SYSMENU_VERSION_REGION ?= A diff --git a/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion.local b/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion.local new file mode 100644 index 00000000..03459f33 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion.local @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.sysmenuVersion.local +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# 内部使用変数 + +GEN_VERSION_PARAM = $(SYSMENU_VERSION_TARGET) $(SYSMENU_VERSION_TIMESTAMP) $(STR_VERSION) $(SYSMENU_VERSION_MAJOR) $(SYSMENU_VERSION_MINOR) \ + $(USER_AREA_SIZE) $(NUP_HOSTNAME) $(EULA_URL) $(SYSMENU_VERSION_FILE) + +GEN_VERSION_FILE = $(SYSMENU_TOOLSDIR)/bin/genVersion.plx + +VERSION_TITLEID_LO = HNL$(SYSMENU_VERSION_REGION) +VERSION_TAD = $(BINDIR)/$(VERSION_TITLEID_LO)_$(SYSMENU_VERSION_MAJOR)_$(SYSMENU_VERSION_MINOR)_$(SYSMENU_VERSION_TIMESTAMP).$(SYSMENU_VERSION_TARGET).tad + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) + VERSION_DAT = $(SYSMENU_VERSION_FILE) +endif + +BINDIR = $(SYSMENU_VERSION_TARGET).out/$(VERSION_TITLEID_LO) +TARGET_BIN = $(VERSION_TAD) + +LDIRT_CLEAN += $(VERSION_DAT) $(VERSION_TAD) $(BINDIR)/properties $(BINDIR) diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.A b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.A new file mode 100644 index 00000000..0097ca6d --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.A @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = A +SYSMENU_VERSION_STRING_REGION = ALL +SYSMENU_VERSION_TIMESTAMP = 09040300 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.C b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.C new file mode 100644 index 00000000..98973ec0 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.C @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = C +SYSMENU_VERSION_STRING_REGION = C +SYSMENU_VERSION_TIMESTAMP = 09062301 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +STR_VERSION = $(SYSMENU_VERSION_MAJOR).$(SYSMENU_VERSION_MINOR).1$(SYSMENU_VERSION_STRING_REGION)$(DEV_STRING) + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.E b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.E new file mode 100644 index 00000000..75e70e9a --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.E @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = E +SYSMENU_VERSION_STRING_REGION = U +SYSMENU_VERSION_TIMESTAMP = 09040300 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.J b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.J new file mode 100644 index 00000000..7de0a8ea --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.J @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = J +SYSMENU_VERSION_STRING_REGION = J +SYSMENU_VERSION_TIMESTAMP = 09040300 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.K b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.K new file mode 100644 index 00000000..e9ee52cb --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.K @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = K +SYSMENU_VERSION_STRING_REGION = K +SYSMENU_VERSION_TIMESTAMP = 09062301 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +STR_VERSION = $(SYSMENU_VERSION_MAJOR).$(SYSMENU_VERSION_MINOR).1$(SYSMENU_VERSION_STRING_REGION)$(DEV_STRING) + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.P b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.P new file mode 100644 index 00000000..0534ec45 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.P @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = P +SYSMENU_VERSION_STRING_REGION = E +SYSMENU_VERSION_TIMESTAMP = 09040300 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.U b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.U new file mode 100644 index 00000000..9a02b778 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.U @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.systemmenuVersion.A - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#--------------------------------------------------------- +# リージョン固有パラメータ + +SYSMENU_VERSION_REGION = U +SYSMENU_VERSION_STRING_REGION = A +SYSMENU_VERSION_TIMESTAMP = 09040300 +SYSMENU_VERSION_MAJOR = 1 +SYSMENU_VERSION_MINOR = 4 +SYSMENU_VERSION_TAD_VERSION = 4 + +do-build : $(TARGET_BIN) + diff --git a/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-cert.der b/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-cert.der new file mode 100644 index 00000000..35b61809 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-cert.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-prvkey.der b/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-prvkey.der new file mode 100644 index 00000000..6533a70a Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/dev/.twl-nup-prvkey.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-cert.der b/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-cert.der new file mode 100644 index 00000000..a47113ad Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-cert.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-prvkey.der b/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-prvkey.der new file mode 100644 index 00000000..c07dda00 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/dev/.twl-shop-prvkey.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/dev/NintendoCA-G2.der b/build/systemMenu_RED/sysmenuVersion/dev/NintendoCA-G2.der new file mode 100644 index 00000000..56696aa8 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/dev/NintendoCA-G2.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/modulerules.sysmenuVersion b/build/systemMenu_RED/sysmenuVersion/modulerules.sysmenuVersion new file mode 100644 index 00000000..5e363614 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/modulerules.sysmenuVersion @@ -0,0 +1,25 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: modulerules.sysmenuVersion +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +$(VERSION_DAT): ./Makefile ./commondefs.sysmenuVersion + $(GEN_VERSION_FILE) $(GEN_VERSION_PARAM) + +$(VERSION_TAD) : $(SYSMENU_VERSION_FILE) + mkdir -p $(BINDIR) + $(MAKETAD) $(call empath,$<) $(SYSMENU_VERSION_MAKETAD_OPTION) -o $@ + diff --git a/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-cert.der b/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-cert.der new file mode 100644 index 00000000..40be0190 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-cert.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-prvkey.der b/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-prvkey.der new file mode 100644 index 00000000..cfb2b340 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/prod/.twl-nup-prvkey.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-cert.der b/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-cert.der new file mode 100644 index 00000000..813892c6 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-cert.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-prvkey.der b/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-prvkey.der new file mode 100644 index 00000000..73b149db Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/prod/.twl-shop-prvkey.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/prod/NintendoCA-G2.der b/build/systemMenu_RED/sysmenuVersion/prod/NintendoCA-G2.der new file mode 100644 index 00000000..56696aa8 Binary files /dev/null and b/build/systemMenu_RED/sysmenuVersion/prod/NintendoCA-G2.der differ diff --git a/build/systemMenu_RED/sysmenuVersion/verList.txt b/build/systemMenu_RED/sysmenuVersion/verList.txt new file mode 100644 index 00000000..4141c731 --- /dev/null +++ b/build/systemMenu_RED/sysmenuVersion/verList.txt @@ -0,0 +1,31 @@ +システムメニューバージョンデータリスト + + + tad ver. sysMenu ver. timestamp +HNAJ 0 1.0 08090900 +HNAE 0 1.0 08090900 +HNAP 0 1.0 08090900 +HNAU 0 1.0 08090900 + +HNAJ 1 1.1 08091200 +HNAE 1 1.1 08091200 +HNAP 1 1.1 08091200 +HNAU 1 1.1 08091200 + +HNAJ 2 1.2 08112700 +HNAE 2 1.2 08112700 +HNAP 2 1.2 08112700 +HNAU 2 1.2 08112700 + +HNAJ 3 1.3 08112800 +HNAE 3 1.3 08112800 +HNAP 3 1.3 08112800 +HNAU 3 1.3 08112800 + +HNAJ 4 1.4 09040300 +HNAE 4 1.4 09040300 +HNAP 4 1.4 09040300 +HNAU 4 1.4 09040300 +HNAC 4 1.4 09040300 +HNAK 4 1.4 09040300 + diff --git a/build/systemMenu_RED/wlanfirm/Makefile b/build/systemMenu_RED/wlanfirm/Makefile new file mode 100644 index 00000000..8cb22382 --- /dev/null +++ b/build/systemMenu_RED/wlanfirm/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +override TARGET_PLATFORM := TWL +TWL_NANDAPP = TRUE + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include ./commondefs.wlanfirm + + +MY_TITLE = HNCA + +#---------------------------------------------------------------------------- +MY_TAD = $(MY_TITLE)_v$(MY_WLANFIRM_VERSION_MAJOR)_$(MY_WLANFIRM_VERSION_MINOR)_fw$(MY_FW_VERSION).tad + +#INSTALL_TARGETS = +#INSTALL_DIR = + +LDIRT_CLEAN = $(MY_TAD) properties + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(MY_TAD) + +$(MY_TAD): $(MY_WLANFIRM) + $(MAKETAD) $(call empath,$<) $(WLANFIRM_MAKETAD_OPTION) -o $@ + +#===== End of Makefile ===== diff --git a/build/systemMenu_RED/wlanfirm/commondefs.wlanfirm b/build/systemMenu_RED/wlanfirm/commondefs.wlanfirm new file mode 100644 index 00000000..875d1392 --- /dev/null +++ b/build/systemMenu_RED/wlanfirm/commondefs.wlanfirm @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: commondefs.wlanfirm - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +MY_WLANFIRM_ROOT = $(TWLWIRELESS_ROOT)/binfile +MY_WLANFIRM_ROOT_CYG = $(call eupath,$(MY_WLANFIRM_ROOT)) + +# MY_WLANFIRMは、開発実機用TAD作成時に外部から別ファイルが指定されるので、"?="指定にしておく +MY_WLANFIRM ?= $(MY_WLANFIRM_ROOT_CYG)/nwm_firm.bin + +# FWファイルの先頭から160バイト目に入っているバージョン情報を取得 +MY_WLANFIRM_VERSION_MAJOR = $(shell perl -e "open(IN,'$(MY_WLANFIRM)');binmode(IN);seek(IN, 160 + 0, 0);read(IN, \$$buf, 1);print unpack("C", \$$buf);close(IN);") +MY_WLANFIRM_VERSION_MINOR = $(shell perl -e "open(IN,'$(MY_WLANFIRM)');binmode(IN);seek(IN, 160 + 1, 0);read(IN, \$$buf, 1);print unpack("C", \$$buf);close(IN);") + +MY_FW_VERSION = $(shell perl -e \ + "open(IN,'$(MY_WLANFIRM)'); \ + binmode(IN); \ + seek(IN, 160 + 4, 0); \ + read(IN, \$$tmp, 4); \ + \$$fwofs = unpack(\"I1\", \$$tmp); \ + seek(IN, \$$fwofs + 1, 0); \ + read(IN, \$$tmp, 1); \ + \$$hwnum = unpack(\"C1\", \$$tmp); \ + seek(IN, \$$fwofs + 2, 0); \ + read(IN, \$$tmp, 2); \ + \$$hwofs = unpack(\"S1\", \$$tmp); \ + seek(IN, \$$fwofs + \$$hwofs + \$$hwnum*8, 0); \ + read(IN, \$$tmp, 4); \ + \$$tmp = unpack(\"N\", \$$tmp); \ + \$$tmp = pack(\"V\", \$$tmp); \ + \$$fwver = unpack(\"H8\", \$$tmp); \ + print \$$fwver; \ + close(IN);" \ + ) + +WLANFIRM_MAKETAD_OPTION += -s -d 0003000F484E4341 3031 $(MY_WLANFIRM_VERSION_MAJOR) WIRELESS_FW -v $(MY_WLANFIRM_VERSION_MINOR) -p + diff --git a/build/systemMenu_mastering/Makefile b/build/systemMenu_mastering/Makefile new file mode 100644 index 00000000..71ab3b6e --- /dev/null +++ b/build/systemMenu_mastering/Makefile @@ -0,0 +1,223 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +#DO_MASTERING = TRUE + +TARGET_FIRM = SYSTEMMENU + +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion + +ifeq ($(TWL_IPL_RED_PRIVATE_ROOT),) +override DO_MASTERING = +endif + +ifeq ($(DO_MASTERING),TRUE) +OUT_DIR = prod +MASTER = .master +MAKETAD_OPTION += -p +else +OUT_DIR = dev +MASTER = +endif + +NAND_INITIALIZER_NAME = NandInitializerProduction +SYSMENU_DIR = ../systemMenu_RED +SRL_DIR = srl +NEWDIRS += $(OUT_DIR)/$(SRL_DIR) + +TARGETS = $(OUT_DIR)/HNAA \ + $(OUT_DIR)/HNBA \ + $(OUT_DIR)/HNCA \ + $(OUT_DIR)/HNHA \ + $(OUT_DIR)/HNLA \ + $(OUT_DIR)/HNLJ \ + $(OUT_DIR)/HNLE \ + $(OUT_DIR)/HNLP \ + $(OUT_DIR)/HNLU \ + $(OUT_DIR)/TWLFontTable.dat \ + $(OUT_DIR)/menu_launcher-$(TWL_BUILD_TYPE).nand \ + $(OUT_DIR)/$(NAND_INITIALIZER_NAME)-$(TWL_BUILD_TYPE)$(MASTER).srl + +MAKEROM_FLAGS += -p + +#---------------------------------------------------------------------------- + +LDIRT_CLEAN = $(TARGETS) \ + $(OUT_DIR) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(TARGETS) + +#MASTERING = $(TWL_IPL_RED_PRIVATE_ROOT)/tools/bin/mastering.TWL.exe +MASTERING = $(TWL_IPL_RED_PRIVATE_ROOT)/build/tools/mastering.TWL/mastering.TWL.exe + +MASTERING_FLAGS = -t + +#--------------------------- +#ランチャー +#--------------------------- +$(OUT_DIR)/HNAA : $(SYSMENU_DIR)/Launcher/ARM9/bin/$(TWL_BUILDTYPE)/HNAA.nand.srl +ifneq ($(DO_MASTERING),) + $(MASTERING) $(MASTERING_FLAGS) $< $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) +else + cp $< $(OUT_DIR)/$(SRL_DIR) +endif +ifeq ($(DO_MASTERING),TRUE) + $(SYSMENU_TOOLSDIR)/bin/makeTitleIdDir.plx $< $(OUT_DIR) | \ + xargs -iarg $(MAKETAD) -s $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) $(MAKETAD_FLAGS) -o arg/$(notdir $(basename $<))-$(TWL_BUILD_TYPE)$(MASTER).tad $(MAKETAD_OPTION) + ls $@ | xargs -iarg mv $@/arg/properties $@ +else + $(MAKETAD) -s $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) $(MAKETAD_FLAGS) -o $(OUT_DIR)/$(notdir $(basename $<))-$(TWL_BUILD_TYPE)$(MASTER).tad $(MAKETAD_OPTION) +endif + + +#--------------------------- +#本体設定 +#--------------------------- +$(OUT_DIR)/HNBA : $(SYSMENU_DIR)/MachineSettings/ARM9/bin/$(TWL_BUILDTYPE)/HNBA.nand.srl +ifneq ($(DO_MASTERING),) + $(MASTERING) $(MASTERING_FLAGS) $< $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) +else + cp $< $(OUT_DIR)/$(SRL_DIR) +endif +ifeq ($(DO_MASTERING),TRUE) + $(SYSMENU_TOOLSDIR)/bin/makeTitleIdDir.plx $< $(OUT_DIR) | \ + xargs -iarg $(MAKETAD) -s $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) $(MAKETAD_FLAGS) -o arg/$(notdir $(basename $<))-$(TWL_BUILD_TYPE)$(MASTER).tad $(MAKETAD_OPTION) + ls $@ | xargs -iarg mv $@/arg/properties $@ +else + $(MAKETAD) -s $(OUT_DIR)/$(SRL_DIR)/$(notdir $<) $(MAKETAD_FLAGS) -o $(OUT_DIR)/$(notdir $(basename $<))-$(TWL_BUILD_TYPE)$(MASTER).tad $(MAKETAD_OPTION) +endif + + +#--------------------------- +#無線ファーム +#--------------------------- +# [TODO] 無線ファームからバージョンを取得して、バージョン番号でディレクトリを作成する。 +$(OUT_DIR)/HNCA : $(call eupath,$(shell find $(SYSMENU_DIR)/wlanfirm -name 'HNCA*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $(OUT_DIR)/$(notdir $(basename $@)) + mkdir -p $(OUT_DIR)/$(notdir $(basename $@))/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +#--------------------------- +#ホワイトリスト +#--------------------------- +# [TODO] TADからバージョンを取得して、バージョン番号でディレクトリを作成する。 +$(OUT_DIR)/HNHA : $(call eupath,$(shell find $(SYSMENU_DIR)/DSHashTable/ -name 'HNHA*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $(OUT_DIR)/$(notdir $(basename $@)) + mkdir -p $(OUT_DIR)/$(notdir $(basename $@))/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +#--------------------------- +#システムメニューバージョン +#--------------------------- +# [TODO] TADからバージョンを取得して、バージョン番号でディレクトリを作成する。 +# FIRM_USE_PRODUCT_KEYS = TRUE の時のみPROD用のシステムメニューバージョンを取得します。 +$(OUT_DIR)/HNLA : $(call eupath,$(shell find $(SYSMENU_DIR)/sysmenuVersion/$(OUT_DIR).out/HNLA -name 'HNL*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $@ + mkdir -p $@/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +$(OUT_DIR)/HNLJ : $(call eupath,$(shell find $(SYSMENU_DIR)/sysmenuVersion/$(OUT_DIR).out/HNLJ -name 'HNL*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $@ + mkdir -p $@/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +$(OUT_DIR)/HNLE : $(call eupath,$(shell find $(SYSMENU_DIR)/sysmenuVersion/$(OUT_DIR).out/HNLE -name 'HNL*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $@ + mkdir -p $@/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +$(OUT_DIR)/HNLP : $(call eupath,$(shell find $(SYSMENU_DIR)/sysmenuVersion/$(OUT_DIR).out/HNLP -name 'HNL*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $@ + mkdir -p $@/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +$(OUT_DIR)/HNLU : $(call eupath,$(shell find $(SYSMENU_DIR)/sysmenuVersion/$(OUT_DIR).out/HNLU -name 'HNL*.tad' -type f)) +ifeq ($(DO_MASTERING),TRUE) + mkdir -p $@ + mkdir -p $@/V0 + cp $< ./$@/V0/ + cp $(dir $<)/properties ./$@ +else + cp $< $(OUT_DIR) +endif + +#--------------------------- +#共有フォント +#--------------------------- +$(OUT_DIR)/TWLFontTable.dat: $(call eupath,$(shell find $(SYSMENU_DIR)/sharedFont -name 'TWLFontTable_*.dat' -type f)) + cp $< ./$(OUT_DIR)/ + + +#--------------------------- +#NANDファーム +#--------------------------- +$(OUT_DIR)/menu_launcher-$(TWL_BUILD_TYPE).nand: $(call eupath,$(shell find ../nandfirm/menu-launcher -name 'menu_launcher-$(TWL_BUILD_TYPE)*.nand' -type f)) + cp $< ./$(OUT_DIR)/ + + +#--------------------------- +#NandInitializerProduction +#--------------------------- +$(OUT_DIR)/$(NAND_INITIALIZER_NAME)-$(TWL_BUILD_TYPE)$(MASTER).srl: ../systemMenu_tools/$(NAND_INITIALIZER_NAME)/ARM9.TWL/bin/$(TWL_BUILDTYPE)/$(NAND_INITIALIZER_NAME).srl +ifneq ($(DO_MASTERING),) + $(MASTERING) -s $(MASTERING_FLAGS) $< $@ +else + cp $< $@ +endif + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/FontWriter/ARM9.TWL/Makefile b/build/systemMenu_tools/FontWriter/ARM9.TWL/Makefile new file mode 100644 index 00000000..c3bc3a3f --- /dev/null +++ b/build/systemMenu_tools/FontWriter/ARM9.TWL/Makefile @@ -0,0 +1,130 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializer +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# NandInitializerRedから一部の機能を削除するために定義を追加します。 +MACRO_FLAGS += -DNAND_INITIALIZER_LIMITED_MODE +#============================================================================ +#============================================================================ +# FontWriter用としてビルドする場合定義します。(要:Make Clean) +MACRO_FLAGS += -DTWL_FONT_WRITER +#============================================================================ +#============================================================================ +# tadを作成する場合はTRUEを指定 +FONT_WRITER_TAD = FALSE +#============================================================================ + + +SYSM_DISABLE_DEBUG = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0FWA +#TARGET_TAD = + +ifeq ($(FONT_WRITER_TAD),TRUE) +TWL_NANDAPP = TRUE +TARGET_BIN = FontWriter.tad +MAKETAD_OPTION += -s +FONT_WRITER_MEDIA = NAND +else +TARGET_BIN = FontWriter.srl +FONT_WRITER_MEDIA = GameCard +endif + +LCFILE_SPEC = ../../NandInitializerRed/ARM9.TWL/ARM9-TS.lsf +ROM_SPEC = ./main.rsf + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).TWL.FLX.sbin + +SRCS = ./local_src/main.c \ + ./local_src/process_write_data.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + cursor.c \ + process_fade.c + +LINCLUDES = ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + ../../common/ARM9/include + +SRCDIR = ../../NandInitializerRed/ARM9.TWL/src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' \ + -DFONT_WRITER_MEDIA='$(FONT_WRITER_MEDIA)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +# インストール設定 +#ifeq ($(TWL_BUILD_TYPE),FINALROM) +#INSTALL_DIR = $(ROOT)/bin/ARM9-TS/Rom +#INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).srl +#endif + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/main.c b/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/main.c new file mode 100644 index 00000000..292caf75 --- /dev/null +++ b/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/main.c @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: main.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 "process_write_data.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 ); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static Process sProcess; +static FSEventHook sSDHook; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitTick(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); /* 独自PXI初期化 */ +#endif + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // SDカードの挿抜イベント監視コールバック設定 +// FS_RegisterEventHook("sdmc", &sSDHook, SDEvents, NULL); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // 初期シーケンス設定 + sProcess = WriteDataProcess0; + + 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"); + + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain); + + + while (1) + { + kamiPadRead(); + + // コマンドフラッシュ +// (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // ARM7コマンド応答受信 +// while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) +// { +// } + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + sProcess = sProcess(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + diff --git a/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/process_write_data.c b/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/process_write_data.c new file mode 100644 index 00000000..1aaafafc --- /dev/null +++ b/build/systemMenu_tools/FontWriter/ARM9.TWL/local_src/process_write_data.c @@ -0,0 +1,468 @@ +/*---------------------------------------------------------------------------* + 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, + NUM_OF_MENU_SELECT +}; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define DOT_OF_MENU_SPACE 16 +#define CURSOR_ORIGIN_X 32 +#define CURSOR_ORIGIN_Y 56 +#define CURSOR_ORIGIN_Y_INDIVIDUALLY 40 +#define CHAR_OF_MENU_SPACE 2 +#define CHAR_OF_MENU_SPACE_INDIVIDUALLY 1 + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +#define DOT_OF_MENU_SPACE 16 +#define DOT_OF_MENU_SPACE_INDIVIDUALLY 8 + +#define FILE_NUM_MAX 256 +#define VIEW_LINES_MAX 16 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static s8 sMenuSelectNo; +static s32 sMenuSelectNoIndividually; + +static char sFilePath[FILE_NUM_MAX][FS_ENTRY_LONGNAME_MAX]; + +static u8 sFileNum; + +static s32 sDatListViewOffset; + +static s32 sLines; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL WriteFontData(void); +static BOOL WriteDummyData(const char* nandpath); +static BOOL WriteCertData(void); +static void ShowDatList(void); + +void* WriteDataProcess0(void); +void* WriteDataProcess1(void); +void* WriteDataProcess2(void); +void* WriteDataProcess3(void); +void* WriteDataProcess4(void); +void* WriteDataProcess5(void); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* WriteDataProcess0(void) +{ + int i; + + // 配列クリア + MI_CpuClear8( sFilePath, sizeof(sFilePath) ); + + // ファイル数初期化 + sFileNum = 0; + + // 表示オフセット初期化 + sDatListViewOffset = 0; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "FONT WRITER"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 6, FONT_COLOR_BLACK, "+-------------------+-----+"); + kamiFontPrintf(3, 7, FONT_COLOR_BLACK, "l Serch SD Card l l"); + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "+-------------------+-----+"); + + // 背景全クリア + 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) +{ + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y + sMenuSelectNo * DOT_OF_MENU_SPACE)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + FADE_OUT_RETURN( WriteDataProcess2 ); + } + + return WriteDataProcess1; +} + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス2 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* WriteDataProcess2(void) +{ + FSFile dir; + + // SDカードのルートディレクトリを検索 + if ( !FS_OpenDirectory(&dir, "sdmc:/", FS_FILEMODE_R | FS_FILEMODE_W) ) + { + kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory(sdmc:/)\n"); + } + else + { + FSDirectoryEntryInfo info[1]; + OS_Printf("[%s]:\n", "sdmc:/"); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "------ font file List -----\n"); + + // .dat を探してファイル名を保存しておく + 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, ".dat") || !STD_CompareString( pExtension, ".DAT") ) + { + 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); + + if (++sFileNum >= FILE_NUM_MAX) + { + break; + } + } + } + } + } + (void)FS_CloseDirectory(&dir); + + kamiFontPrintfConsole(CONSOLE_ORANGE, "--------------------------\n"); + +// DumpTadInfo(); + } + ShowDatList(); + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + FADE_IN_RETURN( WriteDataProcess3 ); +} + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス3 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* WriteDataProcess3(void) +{ + + // 選択メニューの変更 + if ( kamiPadIsRepeatTrigger(PAD_KEY_UP) ) + { + if (--sMenuSelectNoIndividually < 0) + { + sMenuSelectNoIndividually = sFileNum - 1; + if (sFileNum > VIEW_LINES_MAX) + { + sDatListViewOffset = sFileNum - VIEW_LINES_MAX; + } + else + { + sDatListViewOffset = 0; + } + } + if (sMenuSelectNoIndividually < sDatListViewOffset) + { + sDatListViewOffset--; + } + } + else if ( kamiPadIsRepeatTrigger(PAD_KEY_DOWN) ) + { + if (++sMenuSelectNoIndividually > sFileNum - 1) + { + sMenuSelectNoIndividually = 0; + sDatListViewOffset = 0; + } + if ((sMenuSelectNoIndividually - sDatListViewOffset) > VIEW_LINES_MAX - 1) + { + sDatListViewOffset++; + } + + } + + // カーソル配置 + SetCursorPos((u16)CURSOR_ORIGIN_X, (u16)(CURSOR_ORIGIN_Y_INDIVIDUALLY + (sMenuSelectNoIndividually - sDatListViewOffset) * DOT_OF_MENU_SPACE_INDIVIDUALLY)); + + // 決定 + if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + return WriteDataProcess4; + } + // ひとつ前のメニューへ戻る + else if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + FADE_OUT_RETURN( WriteDataProcess0 ); + } + + return WriteDataProcess3; +} + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス4 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* WriteDataProcess4(void) +{ + BOOL ret; + + if (STD_GetStringLength(sFilePath[sMenuSelectNoIndividually])) + { + // 個別インポート + ret = WriteFontData(); + } + else + { + // リターン + return WriteDataProcess0; + } + + // 今回の結果を表示 + if ( ret == TRUE ) + { + kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_GREEN, "OK"); + kamiFontPrintfConsoleEx(CONSOLE_GREEN, "Write Font Success!\n"); + } + else + { + kamiFontPrintf(26, (s16)(5+sMenuSelectNoIndividually*CHAR_OF_MENU_SPACE_INDIVIDUALLY), FONT_COLOR_RED, "NG"); + kamiFontPrintfConsoleEx(CONSOLE_RED, "Write Font Error!\n"); + } + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + return WriteDataProcess3; +} + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +static BOOL WriteFontData(void) +{ + FSFile 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]; + + // フルパスを作成 + MakeFullPathForSD(sFilePath[sMenuSelectNoIndividually], full_path); + + // 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; +} + +/*---------------------------------------------------------------------------* + Name: ShowDatList + + Description: .dad のリストを表示する + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ShowDatList(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "FONT WRITER"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 4, FONT_COLOR_BLACK, "+--------------------+----+"); + if (sFileNum > 15) { sLines = VIEW_LINES_MAX; } + else { sLines = sFileNum; } + for (i=0;i +#include +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +#include "misc.h" +#include "HWInfoWriter.h" +#include "hwi.h" + +// define data------------------------------------------ +#define WRITER_ELEMENT_NUM 7 +#define MSG_X 3 +#define MSG_Y 18 + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static void WriteHWInfoFile( u8 region, BOOL isDisableWireless ); +static void DeleteHWInfoFile( void ); +static void DispMessage( int x, int y, u16 color, const u16 *pMsg ); + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- +static u16 s_csr; +static u8 *s_pPrivKeyBuffer = NULL; +static LCFGReadResult (*s_pReadSecureInfoFunc)( void ); +static BOOL s_isReadTSD; +static u8 s_region_old; +static BOOL s_isDisableWireless; + +// const data ----------------------------------------- +static const u16 *const s_pStrWriter[ WRITER_ELEMENT_NUM ] = { + (const u16 *)L"Write HW Info REGION=JAPAN", + (const u16 *)L"Write HW Info REGION=AMERICA", + (const u16 *)L"Write HW Info REGION=EUROPE", + (const u16 *)L"Write HW Info REGION=AUSTRALIA", + (const u16 *)L"Write HW Info REGION=CHINA", + (const u16 *)L"Write HW Info REGION=KOREA", + (const u16 *)L"Delete HW Info", +}; + +static MenuPos s_writerPos[] = { + { TRUE, 3 * 8, 4 * 8 }, + { TRUE, 3 * 8, 6 * 8 }, + { TRUE, 3 * 8, 8 * 8 }, + { TRUE, 3 * 8, 10 * 8 }, + { TRUE, 3 * 8, 12 * 8 }, + { TRUE, 3 * 8, 14 * 8 }, + { TRUE, 3 * 8, 16 * 8 }, +}; + + +static const MenuParam s_writerParam = { + WRITER_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_writerPos[ 0 ], + (const u16 **)&s_pStrWriter, +}; + +static const char *strRegion[] = { + "JAPAN", + "AMERICA", + "EUROPE", + "AUSTRALIA", + "CHINA", + "KOREA", +}; + + +//====================================================== +// HW情報ライター +//====================================================== +const char *pWireless[] = { + "Enable Wireless", + "Force disable Wireless", +}; + +// HW情報ライターの初期化 +void HWInfoWriterInit( void ) +{ + + GX_DispOff(); + GXS_DispOff(); + + InitBG(); + + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"HW Info Writer"); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + { + char *pMode = NULL; + switch ( HWI_Init( Alloc, Free ) ) { + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + pMode = "No"; + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + pMode = "Pro"; + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + pMode = "Dev"; + break; + } + PrintfSJIS( 14 * 8, 0 * 8, TXT_COLOR_RED, "[%s Signature MODE]", pMode ); + } + + // 無線強制ON/OFF情報の表示 + s_isDisableWireless = OS_IsForceDisableWireless(); + PrintfSJIS( 3 * 8, 2 * 8, TXT_COLOR_BLACK, pWireless[ s_isDisableWireless ] ); + + OS_TPrintf( "region = %d\n", OS_GetRegion() ); + PrintfSJISSub( 2 * 8, 16 * 8, TXT_COLOR_BLACK, "Region = %s", strRegion[ OS_GetRegion() ] ); + PrintfSJISSub( 2 * 8, 18 * 8, TXT_COLOR_BLACK, "SerialNo = %s", LCFG_THW_GetSerialNoPtr() ); + if ( 1 ) + { + int i; + u8 titleID_Lo[ 4 ]; + u8 gameCode[ 5 ] = { 0, 0, 0, 0, 0 }; + LCFG_THW_GetLauncherTitleID_Lo( titleID_Lo ); + for( i = 0; i < 4; i++ ) gameCode[ i ] = titleID_Lo[ 4 - i - 1 ]; + PrintfSJISSub( 2 * 8, 20 * 8, TXT_COLOR_BLACK, "LauncherTitleID_Lo = %s", gameCode ); + } + s_region_old = OS_GetRegion(); + s_csr = 0; + DrawMenu( s_csr, &s_writerParam ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + + +// HW情報ライターのメインループ +void HWInfoWriterMain( void ) +{ + // カーソル移動 + if( pad.trg & PAD_KEY_DOWN ){ + if( ++s_csr == WRITER_ELEMENT_NUM ) { + s_csr = 0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_csr & 0x8000 ) { + s_csr = WRITER_ELEMENT_NUM - 1; + } + } + DrawMenu( s_csr, &s_writerParam ); + + if( pad.trg & PAD_BUTTON_START ) { + PrintfSJIS( 3 * 8, 2 * 8, TXT_COLOR_WHITE, pWireless[ s_isDisableWireless ] ); + s_isDisableWireless ^= 0x01; + PrintfSJIS( 3 * 8, 2 * 8, TXT_COLOR_BLACK, pWireless[ s_isDisableWireless ] ); + } + + // 実行 + if( pad.trg == PAD_BUTTON_A ) { + if( s_csr == WRITER_ELEMENT_NUM - 1 ) { + OS_TPrintf( "Delete start.\n" ); + (void)DeleteHWInfoFile(); + }else { + OS_TPrintf( "Write start.\n" ); + WriteHWInfoFile( (u8)s_csr, s_isDisableWireless ); + } + } + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); +} + + +// HW情報全体のライト +static void WriteHWInfoFile( u8 region, BOOL isDisableWireless ) +{ + static const u16 *pMsgSecureWriting = (const u16 *)L"Writing Secure File..."; + static const u16 *pMsgNormalWriting = (const u16 *)L"Writing Normal File..."; + static const u16 *pMsgHWIDSignWriting = (const u16 *)L"Writing HWID Sign File..."; + static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; + static const u16 *pMsgFailed = (const u16 *)L"Failed!"; + + // ------------------------------------- + // セキュアファイルのライト + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureWriting ); + + if( HWI_WriteHWSecureInfoFile( region, NULL, isDisableWireless, FALSE ) ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); + } + + // ------------------------------------- + // ノーマルファイルのライト (移行可能なユニークIDのためセキュアファイルの後でライトする) + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalWriting ); + + if( HWI_WriteHWNormalInfoFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + } + + // ------------------------------------- + // HWID署名ファイルのライト + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_BLACK, pMsgHWIDSignWriting ); + + if( HWI_WriteHWIDSignFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_RED, pMsgFailed ); + } + + // リージョンの更新を言語コードに反映させる。(必ずセキュアファイルのライト後に実行) + HWI_ModifyLanguage( region ); + + // メッセージを一定時間表示して消去 + DispMessage( 0, 0, TXT_COLOR_NULL, NULL ); + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, + MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 ); + + PrintfSJISSub( 2 * 8, 16 * 8, TXT_COLOR_WHITE, "Region = %s", strRegion[ s_region_old ] ); + PrintfSJISSub( 2 * 8, 16 * 8, TXT_COLOR_BLACK, "Region = %s", strRegion[ LCFG_THW_GetRegion() ] ); + s_region_old = LCFG_THW_GetRegion(); +} + +// HWInfoファイルの削除 +static void DeleteHWInfoFile( void ) +{ + static const u16 *pMsgSecureDeleting = (const u16 *)L"Deteting Secure File..."; + static const u16 *pMsgNormalDeleting = (const u16 *)L"Deleting Normal File..."; + static const u16 *pMsgHWIDSignDeleting = (const u16 *)L"Deteting HWID Sign File."; + static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; + static const u16 *pMsgFailed = (const u16 *)L"Failed!"; + + // ------------------------------------- + // セキュアファイルの削除 + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureDeleting ); + if( HWI_DeleteHWSecureInfoFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); + } + + // ------------------------------------- + // ノーマルファイルの削除 + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + } + + // ------------------------------------- + // HWID署名ファイルの削除 + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_BLACK, pMsgHWIDSignDeleting ); + if( HWI_DeleteHWIDSignFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 4 ) * 8, TXT_COLOR_RED, pMsgFailed ); + } + + DispMessage( 0, 0, TXT_COLOR_NULL, NULL ); + NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE, + MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 ); +} + +// メッセージ表示 +static void DispMessage( int x, int y, u16 color, const u16 *pMsg ) +{ + OSTick start = OS_GetTick(); + // メッセージ表示 + if( pMsg ) { + (void)PutStringUTF16( x, y, color, pMsg ); + } + // ウェイト + while( OS_TicksToSeconds( OS_GetTick() - start ) < 2 ) { + OS_SpinWait( 0x1000 ); + } + // メッセージ消去 + if( pMsg ) { + (void)PutStringUTF16( x, y, TXT_COLOR_WHITE, pMsg ); + } +} diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.h b/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.h new file mode 100644 index 00000000..6da61e86 --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.h + + Copyright 2007 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 __HW_INFO_WRITER__ +#define __HW_INFO_WRITER__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void HWInfoWriterInit( void ); +void HWInfoWriterMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __HW_INFO_WRITER__ diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c new file mode 100644 index 00000000..80325139 --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c @@ -0,0 +1,709 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: HWInfoWriterLib.c + + Copyright 2007 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 "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +#include "hwi.h" + +// define data------------------------------------------ +#ifdef FIRM_USE_PRODUCT_KEYS // 鍵選択スイッチ +#define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo.der" // 製品用秘密鍵 +#define HWID_PRIVKEY_PATH "rom:key/private_HWID.der" +#else +#define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo_dev.der" // 開発用秘密鍵 +#define HWID_PRIVKEY_PATH "rom:key/private_HWID_dev.der" +#endif + +// extern data------------------------------------------ +const LCFGTWLHWNormalInfo *LCFG_THW_GetDefaultNormalInfo( void ); +const LCFGTWLHWSecureInfo *LCFG_THW_GetDefaultSecureInfo( void ); +const LCFGTWLHWNormalInfo *LCFG_THW_GetNormalInfo( void ); +const LCFGTWLHWSecureInfo *LCFG_THW_GetSecureInfo( void ); + +// function's prototype declaration--------------------- +static HwiInitResult ReadPrivateKey( void **ppBuffer, u32 *pKeyFileLen, char *pPath ); +static void VerifyHWInfo( void ); +static BOOL VerifyData( const u8 *pTgt, const u8 *pOrg, u32 len ); +static BOOL CheckHWID_Signature( BOOL isPrintf ); +static BOOL ReadHWInfoFile( void ); +static BOOL ReadTWLSettings( void ); +static u8 HWIi_CalcCheckCode(u8 src[8]); + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static void *s_pPrivKeyBuffer = NULL; +static void *s_pPrivKeyBufferHWID = NULL; +static u32 s_privKeyBufferLen; +static u32 s_privKeyBufferLenHWID; +static void *(*spAlloc)( u32 length ); +static void (*spFree)( void *ptr ); + +// const data ----------------------------------------- + +static const u32 s_langBitmapList[ OS_TWL_REGION_MAX ] = { + LCFG_TWL_LANG_BITMAP_JAPAN, + LCFG_TWL_LANG_BITMAP_AMERICA, + LCFG_TWL_LANG_BITMAP_EUROPE, + LCFG_TWL_LANG_BITMAP_AUSTRALIA, + LCFG_TWL_LANG_BITMAP_CHINA, + LCFG_TWL_LANG_BITMAP_KOREA, +}; + +static char *strLanguage[] = { + (char *)"LANG_JAPANESE", + (char *)"LANG_ENGLISH", + (char *)"LANG_FRENCH", + (char *)"LANG_GERMAN", + (char *)"LANG_ITALIAN", + (char *)"LANG_SPANISH", + (char *)"LANG_CHINESE", + (char *)"LANG_KOREAN", +}; + +static const char *strLauncherGameCode[] = { + "HNAJ", + "HNAE", + "HNAP", + "HNAU", + "HNAC", + "HNAK", +}; + +static const char regionAsciiForSerialNo[] = { + 'J', // 日本 + 'W', // 米国 + 'E', // 欧州 + 'A', // 豪州 + 'C', // 中国 + 'K' // 韓国 +}; + +//====================================================== +// HW情報ライター +//====================================================== + +/*---------------------------------------------------------------------------* + Name: HWI_Init + + Description: HW情報ライターの初期化 + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +HwiInitResult HWI_Init( void *(*pAlloc)( u32 ), void (*pFree)( void * ) ) +{ + HwiInitResult result; + + spAlloc = pAlloc; + spFree = pFree; + + CRYPTO_SetMemAllocator( pAlloc, pFree, NULL ); + + result = ReadPrivateKey( &s_pPrivKeyBuffer, &s_privKeyBufferLen, HWINFO_PRIVKEY_PATH ); + if( result != HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE ) { + result = ReadPrivateKey( &s_pPrivKeyBufferHWID, &s_privKeyBufferLenHWID, HWID_PRIVKEY_PATH ); + } + ReadHWInfoFile(); +// VerifyHWInfo(); + (void)CheckHWID_Signature( TRUE ); + + // ※LanguageBitmapを判定で使用するので、必ずReadHWInfoの後で実行する必要がある。 + ReadTWLSettings(); + + return result; +} + + +// TWL設定データのリード +static BOOL ReadTWLSettings( void ) +{ + u8 *pBuffer = spAlloc( LCFG_READ_TEMP ); + BOOL result; + if( pBuffer ) { + result = LCFG_ReadTWLSettings( (u8 (*)[ LCFG_READ_TEMP ] )pBuffer ); + // Readに失敗した場合ファイルのリカバリ生成を試みる + if (!result) + { + OS_TPrintf( "TSD read failed. Retry onece more.\n" ); + result = LCFG_RecoveryTWLSettings(); + } + spFree( pBuffer ); + } + if( result ) { + OS_TPrintf( "TSD read succeeded.\n" ); + }else { + OS_TPrintf( "TSD read failed.\n" ); + } + + return result; +} + +// 秘密鍵のリード +static HwiInitResult ReadPrivateKey( void **ppBuffer, u32 *pKeyFileLen, char *pPath ) +{ + BOOL result = FALSE; + FSFile file; + OSTick start = OS_GetTick(); + + FS_InitFile( &file ); + if( !FS_OpenFileEx( &file, pPath, FS_FILEMODE_R ) ) + { + OS_TPrintf( "PrivateKey read failed.\n" ); + } + else + { + *pKeyFileLen = FS_GetFileLength( &file ); + if( *pKeyFileLen > 0 ) { + *ppBuffer = spAlloc( *pKeyFileLen ); + if( FS_ReadFile( &file, *ppBuffer, (s32)*pKeyFileLen ) == *pKeyFileLen ) { + OS_TPrintf( "PrivateKey read succeeded.\n" ); + result = TRUE; + }else { + OS_TPrintf( "PrivateKey read failed.\n" ); + } + } + FS_CloseFile( &file ); + } + + if( !result && *ppBuffer ) { + spFree( *ppBuffer ); + *ppBuffer = NULL; + } +// OS_TPrintf( "PrivKey read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); + + if (result) { +#ifdef FIRM_USE_PRODUCT_KEYS + return HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE; +#else + return HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE; +#endif + }else { + return HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE; + } +} + +// HW情報全体のリード +static BOOL ReadHWInfoFile( void ) +{ + LCFGReadResult retval; + BOOL result = TRUE; + + retval = LCFGi_THW_ReadSecureInfo(); + if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { + + // HWノーマル情報、HWセキュア情報をメモリに展開しておく + MI_CpuCopyFast( LCFGi_GetHWN(), (void *)HW_PARAM_TWL_HW_NORMAL_INFO, sizeof(LCFGTWLHWNormalInfo) ); + MI_CpuCopyFast( LCFGi_GetHWS(), (void *)HW_HW_SECURE_INFO, HW_HW_SECURE_INFO_END - HW_HW_SECURE_INFO ); + + OS_TPrintf( "HW Secure Info read succeeded.\n" ); + }else { + result = FALSE; + OS_TPrintf( "HW Secure Info read failed.\n" ); + } + + retval = LCFGi_THW_ReadNormalInfo(); + if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { + OS_TPrintf( "HW Normal Info read succeeded.\n" ); + }else { + result = FALSE; + OS_TPrintf( "HW Normal Info read failed.\n" ); + } + + return result; +} + +// HWInfoファイルのベリファイ +static void VerifyHWInfo( void ) +{ + if( VerifyData( (const u8 *)LCFG_THW_GetSecureInfo(), (const u8 *)LCFG_THW_GetDefaultSecureInfo(), sizeof(LCFGTWLHWSecureInfo) ) ) { + OS_TPrintf( "HW secure Info verify succeeded.\n" ); + }else { + OS_TPrintf( "HW secure Info verify failed.\n" ); + } + if( VerifyData( (const u8 *)LCFG_THW_GetNormalInfo(), (const u8 *)LCFG_THW_GetDefaultNormalInfo(), sizeof(LCFGTWLHWNormalInfo) ) ) { + OS_TPrintf( "HW normal Info verify succeeded.\n" ); + }else { + OS_TPrintf( "HW normal Info verify failed.\n" ); + } +} + + +// メモリ上のデータベリファイ +static BOOL VerifyData( const u8 *pTgt, const u8 *pOrg, u32 len ) +{ + while( len-- ) { + if( *pTgt++ != *pOrg++ ) { + return FALSE; + } + } + return TRUE; +} + + +// HWID署名の確認 +static BOOL CheckHWID_Signature( BOOL isPrintf ) +{ + u8 sign[ LCFG_TWL_HWID_SIGN_LENGTH ]; + if( !LCFG_ReadHWID_Signature( sign ) || + !LCFG_CheckHWID_Signature( sign ) + ) { + if( isPrintf ) OS_TPrintf( "HWID Signature check failed.\n" ); + return FALSE; + }else { + if( isPrintf ) OS_TPrintf( "HWID Signature check succeeded.\n" ); + return TRUE; + } +} + + +/*---------------------------------------------------------------------------* + Name: HWI_ModifyLanguage + + Description: 言語コードをリージョン値に合わせて修正する。 + + Arguments: + + Returns: BOOL + *---------------------------------------------------------------------------*/ +BOOL HWI_ModifyLanguage( u8 region ) +{ +#pragma unused( region ) + u32 langBitmap = LCFG_THW_GetValidLanguageBitmap(); + u8 nowLanguage = LCFG_TSD_GetLanguage(); + u8 installedSoftBoxCount; + u8 freeSoftBoxCount; + BOOL result = TRUE; + + if( langBitmap & ( 0x0001 << nowLanguage ) ) { + OS_TPrintf( "Language no change.\n" ); + }else { + int i; + for( i = 0; i < LCFG_TWL_LANG_CODE_MAX; i++ ) { + if( langBitmap & ( 0x0001 << i ) ) { + break; + } + } + LCFG_TSD_SetLanguage( (LCFGTWLLangCode)i ); + OS_TPrintf( "Language Change \"%s\" -> \"%s\"\n", + strLanguage[ nowLanguage ], strLanguage[ LCFG_TSD_GetLanguage() ] ); + } + + // 国コードもクリアしておく。 + LCFG_TSD_SetCountry( LCFG_TWL_COUNTRY_UNDEFINED ); + + // ペアレンタルコントロール情報もクリアしておく + MI_CpuClearFast( (void *)LCFG_TSD_GetPCTLPtr(), sizeof(LCFGTWLParentalControl) ); + + // ソフトボックスカウントを更新 + if (!NAMUT_GetSoftBoxCount(&installedSoftBoxCount, &freeSoftBoxCount)) + { + return FALSE; + } + + // LCFGライブラリの静的変数に対する更新 + LCFG_TSD_SetInstalledSoftBoxCount( installedSoftBoxCount ); + LCFG_TSD_SetFreeSoftBoxCount( freeSoftBoxCount ); + + // regionが変わった場合は、LANGUAGE_BITMAPも必ず変わるので、それをNTR側に反映させるために必ずTWL設定データの書き込みも行う。 + { + u8 *pBuffer = spAlloc( LCFG_WRITE_TEMP ); + if( pBuffer ) + { + int i; + // TWLCFG0.datとTWLCFG1.datの両方について生成/書き込みを行うため2回実行する + for (i=0;i<2;i++) + { + // 内部変数を変更せずにリード状態(s_rdResult)をFALSEにするためにベリファイする + (void)LCFGi_TSD_VerifySettings( (u8 (*)[ sizeof(LCFGTWLSettingsData) ])pBuffer ); + + if (!LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer )) + { + // NANDをフォーマットした直後でTWL設定ファイルが存在しない場合は書き込みに失敗するため + // TWL設定ファイルをリカバリ生成して再チャレンジする + if (!LCFG_RecoveryTWLSettings() && !LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer )) + { + result = FALSE; + OS_TPrintf("Fail! LCFG_WriteTWLSettings()\n"); + } + } + } + spFree( pBuffer ); + } + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWI_WriteHWNormalInfoFile + + Description: HWノーマルInfoファイルのライト + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ + +const u8 s_serialNo_mask[] = { + 0x82, 0xb7, 0x0e, 0xf3, 0xad, 0x0a, 0x35, 0x85, + 0xaa, 0x84, 0xae, 0x14, 0xe7, 0x06, 0xd5, 0x00, +}; + +BOOL HWI_WriteHWNormalInfoFile( void ) +{ + LCFGTWLHWNormalInfo Info; + LCFGReadResult result; + + result = LCFGi_THW_ReadNormalInfo(); + if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { + if( !LCFGi_THW_RecoveryNormalInfo( result ) ) { + OS_TPrintf( "HW Normal Info Recovery failed.\n" ); + return FALSE; + } + } + + Info.rtcAdjust = LCFG_THW_GetRTCAdjust(); + { + int i; + u8 serialNo[ LCFG_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN ]; + + MI_CpuClear8( serialNo, LCFG_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN ); + OS_GetSerialNo( serialNo ); + + for( i = 0; i < LCFG_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN; i++ ) { + Info.movableUniqueID[ i ] = (u8)( serialNo[ i ] ^ s_serialNo_mask[ i ] ); + } + } + + if (!LCFGi_THW_WriteNormalInfoDirect( &Info )) + { + OS_TPrintf( "HW Normal Info Write failed.\n" ); + return FALSE; + } + + // MMEMのシステム領域にセット + MI_CpuCopyFast( LCFGi_GetHWN(), (void *)HW_PARAM_TWL_HW_NORMAL_INFO, sizeof(LCFGTWLHWNormalInfo) ); + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: HWI_WriteHWSecureInfoFile + + Description: HWセキュアInfoファイルのライト + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL HWI_WriteHWSecureInfoFile( u8 region, const u8 *pSerialNo, BOOL isDisableWireless, BOOL logoDemoSkipForce ) +{ + BOOL isWrite = TRUE; + LCFGReadResult result; + u8 old_region; + + // ファイルのリード + result = LCFGi_THW_ReadSecureInfo(); + + // リードに失敗したらリカバリ + if( result != LCFG_TSF_READ_RESULT_SUCCEEDED ) { + if( !LCFGi_THW_RecoverySecureInfo( result ) ) { + OS_TPrintf( "HW Secure Info Recovery failed.\n" ); + isWrite = FALSE; + } + } + + LCFG_THW_SetFlagForceDisableWireless( isDisableWireless ); + LCFG_THW_SetFlagForceLogoDemoSkip( logoDemoSkipForce ); + + // 旧リージョンを保存 + old_region = OS_GetRegion(); + + // リージョンのセット + LCFG_THW_SetRegion( region ); + + // 対応言語ビットマップのセット + LCFG_THW_SetValidLanguageBitmap( s_langBitmapList[ region ] ); + + // シリアルNo.のセット + if( pSerialNo != NULL ) + { + LCFG_THW_SetSerialNo( pSerialNo ); + } + else + { + // 量産工程でないとシリアルNo.は用意できないので、ここではMACアドレスをもとに適当な値をセットする。 + u8 buffer[ 12 ] = "SERIAL"; // 適当な文字列をMACアドレスと結合してSHA1を取り、仮SerialNoとする。 + u8 serialNoOld[ SVC_SHA1_DIGEST_SIZE ]; + u8 serialNoNew[ SVC_SHA1_DIGEST_SIZE ]; + u8 sha1_buffer[ SVC_SHA1_DIGEST_SIZE ]; + int i,j; + int len; + int offset; + + if ( region == OS_TWL_REGION_AMERICA ) + { + len = LCFG_TWL_HWINFO_SERIALNO_LEN_AMERICA; + offset = LCFG_TWL_HWINFO_SERIALNO_UNIQUE_OFFSET_AMERICA; + } + else + { + len = LCFG_TWL_HWINFO_SERIALNO_LEN_OTHERS; + offset = LCFG_TWL_HWINFO_SERIALNO_UNIQUE_OFFSET_OTHERS; + } + + // 現在のシリアルNo取得 + OS_GetSerialNo( serialNoOld ); + + // 新しいシリアルNoをクリアしておく + MI_CpuClear8( serialNoNew, sizeof(serialNoNew) ); + + // シリアルNoの先頭が'T'(量産用)または'V'(開発用)でなければ不正なので仮のシリアルNo.を作成する + if ( serialNoOld[0] != 'T' && serialNoOld[0] != 'V') + { + // 1バイト目は量産用なら'T'、その他なら'V' + if (SCFG_ReadBondingOption() == SCFG_OP_PRODUCT) + { + serialNoNew[0] = 'T'; + } + else + { + serialNoNew[0] = 'V'; + } + // 2バイト目はリージョン別ASCII + serialNoNew[1] = (u8)regionAsciiForSerialNo[region]; + // 米国リージョン以外は3バイト目にEMS(仮シリアルNo.なので任天堂の'N') + if ( region != OS_TWL_REGION_AMERICA ) + { + serialNoNew[2] = 'N'; + } + + // 数字8桁 + OS_GetMacAddress( buffer + 6 ); + SVC_CalcSHA1( sha1_buffer, buffer, sizeof(buffer) ); + for( i=offset,j=0; i < len-1; i++,j++ ) { + serialNoNew[ i ] = (u8)( ( sha1_buffer[ j ] % 10 ) + 0x30 ); + } + + // チェックコード取得 + serialNoNew[len-1] = HWIi_CalcCheckCode(&serialNoNew[offset]); + + // 仮シリアルNo.であることの印として14バイト目を'K'とする + serialNoNew[13] = 'K'; + } + // シリアルNoの先頭が'T'(量産用)または'V'(開発用)である場合ユニーク数字8桁はそのままで他を変更する + else + { + // 1バイト目は量産用なら'T'、その他なら'V' + if (SCFG_ReadBondingOption() == SCFG_OP_PRODUCT) + { + serialNoNew[0] = 'T'; + } + else + { + serialNoNew[0] = 'V'; + } + // 2バイト目はリージョン別ASCII + serialNoNew[1] = (u8)regionAsciiForSerialNo[region]; + // 米国リージョン以外は3バイト目にEMS + if ( region != OS_TWL_REGION_AMERICA ) + { + // EMS情報が存在するなら引き継ぐ + if ( old_region != OS_TWL_REGION_AMERICA ) + { + serialNoNew[2] = serialNoOld[2]; + } + // EMS情報が存在しないため仮に任天堂の'N'とする + else + { + serialNoNew[2] = 'N'; + } + } + + // ユニーク数字をコピー + if ( old_region == OS_TWL_REGION_AMERICA ) + { + MI_CpuCopy( &serialNoOld[LCFG_TWL_HWINFO_SERIALNO_UNIQUE_OFFSET_AMERICA], &serialNoNew[offset], LCFG_TWL_HWINFO_SERIALNO_UNIQUE_LENGTH ); + } + else + { + MI_CpuCopy( &serialNoOld[LCFG_TWL_HWINFO_SERIALNO_UNIQUE_OFFSET_OTHERS], &serialNoNew[offset], LCFG_TWL_HWINFO_SERIALNO_UNIQUE_LENGTH ); + } + + // チェックコード取得 + serialNoNew[len-1] = HWIi_CalcCheckCode(&serialNoNew[offset]); + + // 14バイト目は旧から新へコピー + serialNoNew[13] = serialNoOld[13]; + } + + OS_TPrintf( "serialNo : %s\n", serialNoNew ); + + LCFG_THW_SetSerialNo( serialNoNew ); + } + + // ランチャーTitleID_Loのセット + { + int i; + u8 titleID_Lo[4]; + for( i = 0; i < 4; i++ ) titleID_Lo[ i ] = (u8)strLauncherGameCode[ region ][ 4 - i - 1 ]; + LCFG_THW_SetLauncherTitleID_Lo( (const u8 *)titleID_Lo ); + } + + // ライト + if( isWrite && + !LCFGi_THW_WriteSecureInfo( s_pPrivKeyBuffer, s_privKeyBufferLen ) ) { + isWrite = FALSE; + OS_TPrintf( "HW Secure Info Write failed.\n" ); + } + + // MMEMのシステム領域にセット + MI_CpuCopyFast( LCFGi_GetHWS(), (void *)HW_HW_SECURE_INFO, HW_HW_SECURE_INFO_END - HW_HW_SECURE_INFO ); + + return isWrite; +} + +/*---------------------------------------------------------------------------* + Name: HWI_WriteHWIDSignFile + + Description: HWID署名ファイルのライト + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL HWI_WriteHWIDSignFile( void ) +{ + BOOL retval = TRUE; + + (void)FS_DeleteFile( (char *)LCFG_TWL_HWID_SIGN_PATH ); + if( !FS_CreateFile( LCFG_TWL_HWID_SIGN_PATH, FS_PERMIT_R | FS_PERMIT_W ) ) { + OS_TPrintf( "file create error. %s\n", LCFG_TWL_HWID_SIGN_PATH ); + } + retval &= LCFG_WriteHWID_Signature( s_pPrivKeyBufferHWID, s_privKeyBufferLenHWID ); + retval &= CheckHWID_Signature( FALSE ); + if( !retval ) { + OS_TPrintf( "HWID Signature Write failed.\n" ); + } + return retval; +} + +/*---------------------------------------------------------------------------* + Name: HWI_DeleteHWNormalInfoFile + + Description: HWノーマルInfoファイルの消去 + + Arguments: None + + Returns: BOOL + *---------------------------------------------------------------------------*/ +BOOL HWI_DeleteHWNormalInfoFile( void ) +{ + if (FS_DeleteFile( (char *)LCFG_TWL_HWINFO_NORMAL_PATH )) + { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + return TRUE; + } + else + { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + return FALSE; + } +} + +/*---------------------------------------------------------------------------* + Name: HWI_DeleteHWSecureInfoFile + + Description: HWセキュアInfoファイルの消去 + + Arguments: None + + Returns: BOOL + *---------------------------------------------------------------------------*/ +BOOL HWI_DeleteHWSecureInfoFile( void ) +{ + if (FS_DeleteFile( (char *)LCFG_TWL_HWINFO_SECURE_PATH )) + { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + return TRUE; + } + else + { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + return FALSE; + } +} + +/*---------------------------------------------------------------------------* + Name: HWI_DeleteHWIDSignFile + + Description: HWID署名ファイルの消去 + + Arguments: None + + Returns: BOOL + *---------------------------------------------------------------------------*/ +BOOL HWI_DeleteHWIDSignFile( void ) +{ + if (FS_DeleteFile( (char *)LCFG_TWL_HWID_SIGN_PATH )) + { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWID_SIGN_PATH ); + return TRUE; + } + else + { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWID_SIGN_PATH ); + return FALSE; + } +} + +/*---------------------------------------------------------------------------* + Name: HWIi_CalcCheckCode + + Description: シリアル番号の数字8桁のチェックコードを計算します + + Arguments: Ascii 数字文字列 + + Returns: Ascii 数字 + *---------------------------------------------------------------------------*/ +static u8 HWIi_CalcCheckCode(u8 src[8]) +{ + // モジュラス10 ウェイト3・1(M10W31) + int temp = (src[7] - '0')*3 + + (src[6] - '0')*1 + + (src[5] - '0')*3 + + (src[4] - '0')*1 + + (src[3] - '0')*3 + + (src[2] - '0')*1 + + (src[1] - '0')*3 + + (src[0] - '0')*1; + temp %= 10; + if (temp > 0) + { + temp = 10-temp; + } + + return (u8)('0' + temp); +} + diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.h b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.h new file mode 100644 index 00000000..b5ab0192 --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.h + + Copyright 2007 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 __HWI_LIB__ +#define __HWI_LIB__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +typedef enum +{ + HWI_INIT_FAILURE, + HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE, + HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE, + HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE +} +HwiInitResult; + +HwiInitResult HWI_Init( void *(*pAlloc)( u32 ), void (*pFree)( void * ) ); +BOOL HWI_ModifyLanguage( u8 region ); +BOOL HWI_WriteHWNormalInfoFile( void ); +BOOL HWI_WriteHWSecureInfoFile( u8 region, const u8 *pSerialNo, BOOL isDisableWireless, BOOL logoDemoSkipForce ); +BOOL HWI_WriteHWIDSignFile( void ); +BOOL HWI_DeleteHWNormalInfoFile( void ); +BOOL HWI_DeleteHWSecureInfoFile( void ); +BOOL HWI_DeleteHWIDSignFile( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __HWI_LIB__ diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/main.c b/build/systemMenu_tools/HWInfoWriter/ARM9/src/main.c new file mode 100644 index 00000000..baf0473b --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/main.c @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "HWInfoWriter.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + // 初期化---------------------------------- + OS_Init(); + OS_InitTick(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + // SoftBoxCountを調べるのにNAM/NAMUTを使用する + NAM_Init( Alloc, Free ); + NAMUT_Init( Alloc, Free ); + + // メインループ---------------------------- + HWInfoWriterInit(); + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + ReadKeyPad(); // キー入力の取得 + + HWInfoWriterMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/systemMenu_tools/HWInfoWriter/Makefile b/build/systemMenu_tools/HWInfoWriter/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/HWInfoWriter/banner/Makefile b/build/systemMenu_tools/HWInfoWriter/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/HWInfoWriter/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/HWInfoWriter/banner/banner_v3.bsf b/build/systemMenu_tools/HWInfoWriter/banner/banner_v3.bsf new file mode 100644 index 00000000..f097cd88 Binary files /dev/null and b/build/systemMenu_tools/HWInfoWriter/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/HWInfoWriter/banner/icon/gameIcon.bmp b/build/systemMenu_tools/HWInfoWriter/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5fe5ee2c Binary files /dev/null and b/build/systemMenu_tools/HWInfoWriter/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_tools/ImportJump/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..d266cb78 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: ImportJump +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/Makefile b/build/systemMenu_tools/ImportJump/ARM9.TWL/Makefile new file mode 100644 index 00000000..ef576c63 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/Makefile @@ -0,0 +1,106 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: ImportJump +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0IJA +#TARGET_TAD = + +TARGET_BIN = ImportJump.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).TWL.FLX.sbin + +SRCS = main.c \ + font_data.c \ + graphics.c \ + kami_font.c \ + import.c \ + hwi.c + +LINCLUDES = ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + $(ROOT)/build/libraries/fs/common/include + +SRCDIR = src \ + ../../HWInfoWriter/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/include/ImportJump.h b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/ImportJump.h new file mode 100644 index 00000000..b29ee37d --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/ImportJump.h @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: 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 IMPORT_JUMP_H_ +#define IMPORT_JUMP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _ImportJumpSetting +{ + u32 magicCode; // = TWLD + u32 clearPublicSaveData :1; // publicセーブデータをクリアする(デフォルトOFF) + u32 clearPrivateSaveData :1; // privareセーブデータをクリアする(デフォルトOFF) + u32 clearSubBannerFile:1; // サブバナーファイルをクリアする(デフォルトOFF) + u32 importTad:1; // パスで指定されたTADファイルをインポートするか(TADの更新有無に依存) + u32 rsv :28; // 予約 + u32 tadRomOffset; // TADをロードしたエミュレーションROMオフセット + u32 tadLength; // TADファイルの長さ +} ImportJump; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define IMPORT_TAD_ROM_OFS 0x00800000 +#define IMPORT_JUMP_SETTING_OFS (IMPORT_TAD_ROM_OFS - CARD_ROM_PAGE_SIZE) + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +ImportJump* GetImportJumpSetting( void ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* IMPORT_JUMP_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/include/graphics.h b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..69dd0c35 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/graphics.h @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/include/import.h b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/import.h new file mode 100644 index 00000000..8d1f599d --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/import.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: 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 + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +BOOL kamiImportTad(NAMTitleId* pTitleID); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_IMPORT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/include/kami_font.h b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..50e23822 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/include/kami_font.h @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/main.rsf b/build/systemMenu_tools/ImportJump/ARM9.TWL/main.rsf new file mode 100644 index 00000000..35d468dc --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/main.rsf @@ -0,0 +1,224 @@ +#---------------------------------------------------------------------------- +# Project: ImportJump +# File: main.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMではデバッグできないようにTRUEにする必要があります。 + # + DisableDebug TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +} diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/font_data.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..8f414c57 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/graphics.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..7a7a1b9d --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/graphics.c @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(3); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuad + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fey, 0); + + G3_Color( color ); + G3_Vtx(fsx, fey, 1); + } + G3_End(); +} + diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c new file mode 100644 index 00000000..52be8ceb --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/import.c @@ -0,0 +1,339 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: process_import.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 "import.h" +#include "TWLHWInfo_api.h" +#include "graphics.h" +#include "ImportJump.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define THREAD_STACK_SIZE (16*1024) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static void* spStack; +static u32 sCurrentProgress; +static vu8 sNowImport = FALSE; +static ImportJump sImportJumpSetting; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* arg); +static void Destructor(void* arg); +void ProgressDraw(f32 ratio); + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: kamiImportTad + + Description: .tad ファイルインポート + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL kamiImportTad(NAMTitleId* pTitleID) +{ + NAMTadInfo tadInfo; + NAMTitleInfo titleInfoTmp; + OSThread thread; + s32 nam_result; + FSFile file; + char savePublicPath[FS_ENTRY_LONGNAME_MAX]; + char savePrivatePath[FS_ENTRY_LONGNAME_MAX]; + char subBannerPath[FS_ENTRY_LONGNAME_MAX]; + + // 製品用CPUではインポート不可に + if ( !((*(u8*)(OS_CHIPTYPE_DEBUGGER_ADDR) & OS_CHIPTYPE_DEBUGGER_MASK)) ) + { + OS_Warning(" Fail : Production CPU\n"); + return FALSE; + } + + // ファイル初期化 + FS_InitFile(&file); + + // CARD-ROM 領域を一時的なファイルとみなしそのファイルを開きます。 + if (!FS_CreateFileFromRom(&file, GetImportJumpSetting()->tadRomOffset, GetImportJumpSetting()->tadLength)) + { + OS_Warning(" Fail : FS_CreateFileFromRom\n"); + return FALSE; + } + + // tadファイルの情報取得 + if (NAM_ReadTadInfoWithFile(&tadInfo, &file) != NAM_OK) + { + OS_Warning(" Fail! : NAM_ReadTadInfo\n"); + return FALSE; + } + + // titleIDを保存しておく + *pTitleID = tadInfo.titleInfo.titleId; + + // Data Only なら失敗 + if (tadInfo.titleInfo.titleId & TITLE_ID_DATA_ONLY_FLAG_MASK) + { + OS_Warning(" Fail! : DATA_ONLY_FLAG is specified in rsf file\n"); + return FALSE; + } + + // freeSoftBoxCountに空きがなければインポートしない + { + u8 installed, free; + if (!NAMUT_GetSoftBoxCount(&installed, &free)) + { + OS_Warning(" Fail! : Can not get soft box count\n"); + return FALSE; + } + if (free == 0) + { + OS_Warning(" Fail! : NAND FreeSoftBoxCount == 0\n"); + return FALSE; + } + } + + // TADファイルが更新されている場合に限りインポート処理を行う + // NandInitializerによって消去されている可能性もあるので確認する + if (GetImportJumpSetting()->importTad == 1 || NAM_ReadTitleInfo(&titleInfoTmp, tadInfo.titleInfo.titleId) != NAM_OK) + { +/* + // 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開始 + nam_result = NAM_ImportTadWithFile( &file ); + + // 進捗スレッドの自力終了を待つ + while (sNowImport){}; + + if ( nam_result == NAM_OK ) + { + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + if (!NAMUT_UpdateSoftBoxCount()) + { + OS_Warning(" Fail! : Update Soft Box Count\n"); + } + } + else + { + kamiFontPrintfMain( 4, 20, 1, "Import was failed! 0x%x", nam_result); + kamiFontLoadScreenData(); + OS_Warning(" Fail! : NAM Result Code = 0x%x\n", nam_result); + return FALSE; + } + } + + // セーブデータクリア処理 + if (GetImportJumpSetting()->clearPublicSaveData || GetImportJumpSetting()->clearPrivateSaveData) + { + // セーブファイルパス取得 + if ( NAM_GetTitleSaveFilePath(savePublicPath, savePrivatePath, tadInfo.titleInfo.titleId) != NAM_OK ) + { + OS_Warning(" Fail! NAM_GetTitleSaveFilePath\n"); + } + else + { + // publicセーブデータFFクリア&フォーマット + if (GetImportJumpSetting()->clearPublicSaveData && tadInfo.titleInfo.publicSaveSize > 0) + { + if (NAMUTi_ClearSavedataPublic(savePublicPath, tadInfo.titleInfo.titleId) == FALSE) + { + OS_Warning(" Fail! NAMUTi_ClearSavedataPublic\n"); + } + } + + // privateセーブデータFFクリア&フォーマット + if (GetImportJumpSetting()->clearPrivateSaveData && tadInfo.titleInfo.privateSaveSize > 0) + { + if (NAMUTi_ClearSavedataPrivate(savePrivatePath, tadInfo.titleInfo.titleId) == FALSE) + { + OS_Warning(" Fail! NAMUTi_ClearSavedataPrivate\n"); + } + } + } + } + + // サブバナークリア処理 + if (GetImportJumpSetting()->clearSubBannerFile) + { + // サブバナーパス取得 + if ( NAM_GetTitleBannerFilePath(subBannerPath, tadInfo.titleInfo.titleId) != NAM_OK ) + { + OS_Warning(" Fail! NAM_GetTitleBannerFilePath\n"); + } + else + { + // サブバナー破壊 + if (NAMUTi_DestroySubBanner(subBannerPath) == FALSE) + { + OS_Warning(" Fail! NAMUTi_DestroySubBanner\n"); + } + } + } + + return TRUE; +} + +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; + + kamiFontPrintfMain( 4, 9, 8, "Now Importing..."); + kamiFontLoadScreenData(); + + 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: ProgressDraw + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +void ProgressDraw(f32 ratio) +{ + s16 x = (s16)(30 + (226 - 30)*ratio); + + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // グリーンバー + DrawQuad( 30, 90, x, 95, GX_RGB(12, 25, 12)); + + // グレーバー + DrawQuad( 30, 90, 226, 95, GX_RGB(28, 28, 28)); + + // グレーダイアログ + DrawQuad( 20, 60, 236, 110, GX_RGB(25, 25, 25)); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} + +/*---------------------------------------------------------------------------* + Name: GetImportJumpSetting + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +ImportJump* GetImportJumpSetting( void ) +{ + static BOOL inited = FALSE; + + if ( ! inited ) + { + // 開発用CPUでのみリード + if ( *(u8*)(OS_CHIPTYPE_DEBUGGER_ADDR) & OS_CHIPTYPE_DEBUGGER_MASK ) + { + u16 id = (u16)OS_GetLockID(); + CARD_LockRom( id ); + CARD_ReadRom( MI_DMA_NOT_USE, (void*)IMPORT_JUMP_SETTING_OFS, &sImportJumpSetting, sizeof(ImportJump) ); + CARD_UnlockRom( id ); + } + inited = TRUE; + } + + return &sImportJumpSetting; +} diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/kami_font.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..e3ba97eb --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/kami_font.c @@ -0,0 +1,392 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/systemMenu_tools/ImportJump/ARM9.TWL/src/main.c b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/main.c new file mode 100644 index 00000000..92476058 --- /dev/null +++ b/build/systemMenu_tools/ImportJump/ARM9.TWL/src/main.c @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------* + Project: ImportJump + File: main.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 + +#include "kami_font.h" +#include "import.h" +#include "graphics.h" +#include "hwi.h" +#include "ImportJump.h" + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static NAMTitleId titleId; +char sTadPath[FS_ENTRY_LONGNAME_MAX]; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + NAMTitleId titleID; + + // OS_Initより前に実行する + { + // SRLの後方に配置したTADファイルにアクセス可能にするために + // カードアクセスのハッシュチェックを無効化する + ROM_Header_Short *th = (ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + ROM_Header_Short *dh = (ROM_Header_Short *)HW_ROM_HEADER_BUF; + th->enable_signature = FALSE; + dh->enable_signature = FALSE; + // デバッガ情報を読み取るため拡張メモリを有効にする + OS_EnableMainExArena(); + } + + OS_Init(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + TP_Init(); + RTC_Init(); + + InitAllocation(); + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // magicCodeが異なる場合は停止 + if (STD_CompareNString( (char *)&GetImportJumpSetting()->magicCode, "TWLD", 4 )) + { + OS_Warning(" Magic Code Wrong!\n"); + while(1){}; + } + + // HWInfo関連の前準備 + // InstalledSoftBoxCount, FreeSoftBoxCount の更新のために必要 + switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) + { + case HWI_INIT_FAILURE: + OS_Warning(" Fail! : HWI_INIT()"); + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + break; + } + + // 前回起動したソフトのplatformCodeがNITROだとアプリジャンプに失敗する。 + // デバッガ動作時はランチャーが前回起動したソフトのplatformCode & TitleID を + // 更新しないためImportJump自身が更新しておく。NANDへの反映はkamiImportTad() + // の中で行われる。 + LCFG_TSD_SetLastTimeBootSoftPlatform( PLATFORM_CODE_TWL_LIMITED ); + LCFG_TSD_SetLastTimeBootSoftTitleID( OS_GetTitleId() ); + + // TADのインポート開始 + if (kamiImportTad(&titleID)) + { + // アプリジャンプのためにジャンプ可能リストに直接追加する + OSTitleIDList *list = ( OSTitleIDList * )HW_OS_TITLE_ID_LIST; + list->TitleID[0] = titleID; + list->appJumpFlag[0] = 0x01; + list->num = 1; + + // アプリジャンプ + OS_DoApplicationJump( titleID, OS_APP_JUMP_NORMAL ); + } + + // アプリジャンプに成功したならここへは到達しない + while(1){}; +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} diff --git a/build/systemMenu_tools/ImportJump/Makefile b/build/systemMenu_tools/ImportJump/Makefile new file mode 100644 index 00000000..c350a78e --- /dev/null +++ b/build/systemMenu_tools/ImportJump/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: ImportJump +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/Makefile b/build/systemMenu_tools/Makefile new file mode 100644 index 00000000..b7769a9b --- /dev/null +++ b/build/systemMenu_tools/Makefile @@ -0,0 +1,36 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS_P = \ + HWInfoWriter \ + NandInitializerRed \ + NandInitializerProduction \ + NandInitializer \ + ImportJump \ + nandfirmVersionChecker + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializer/ARM9.TWL/Makefile b/build/systemMenu_tools/NandInitializer/ARM9.TWL/Makefile new file mode 100644 index 00000000..5ebd7445 --- /dev/null +++ b/build/systemMenu_tools/NandInitializer/ARM9.TWL/Makefile @@ -0,0 +1,153 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializer +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# NandInitializerRedから一部の機能を削除するために定義を追加します。 +MACRO_FLAGS += -DNAND_INITIALIZER_LIMITED_MODE +#============================================================================ +#============================================================================ +# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING +#============================================================================ +#============================================================================ +# NightlyBuild 用に自動実行させる場合定義します。(要:Make Clean) +#USE_FOR_NIGHTLY_AUTO_TEST = TRUE + +ifdef USE_FOR_NIGHTLY_AUTO_TEST +MACRO_FLAGS += -DUSE_FOR_NIGHTLY_AUTO_TEST +endif +#============================================================================ + +ifdef USE_FOR_NIGHTLY_AUTO_TEST +SYSM_DISABLE_DEBUG = FALSE +else +SYSM_DISABLE_DEBUG = TRUE +endif + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NIA +#TARGET_TAD = + +ifdef USE_FOR_NIGHTLY_AUTO_TEST +TARGET_BIN = NandInitializerForAutoTest.srl +else +TARGET_BIN = NandInitializer.srl +endif + +LCFILE_SPEC = ../../NandInitializerRed/ARM9.TWL/ARM9-TS.lsf +ROM_SPEC = ./main.rsf + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).TWL.FLX.sbin + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + cursor.c \ + process_format.c \ + process_topmenu.c \ + process_hw_info.c \ + process_wireless_setting.c \ + process_fade.c \ + hwi.c \ + debugger_hw_reset_control.c + +LINCLUDES = ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + ../../common/ARM9/include + +SRCDIR = ../../NandInitializerRed/ARM9.TWL/src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +# インストール設定 +ifeq ($(TWL_BUILD_TYPE),FINALROM) +INSTALL_DIR = $(ROOT)/bin/ARM9-TS/Rom +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).srl +endif + +ifdef USE_FOR_NIGHTLY_AUTO_TEST +ifeq ($(TWL_BUILD_TYPE),RELEASE) +INSTALL_DIR = $(ROOT)/bin/ARM9-TS/Release +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).srl +endif +endif + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializer/ARM9.TWL/main.rsf b/build/systemMenu_tools/NandInitializer/ARM9.TWL/main.rsf new file mode 100644 index 00000000..02690a62 --- /dev/null +++ b/build/systemMenu_tools/NandInitializer/ARM9.TWL/main.rsf @@ -0,0 +1,224 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +} diff --git a/build/systemMenu_tools/NandInitializer/Makefile b/build/systemMenu_tools/NandInitializer/Makefile new file mode 100644 index 00000000..3f2e28d3 --- /dev/null +++ b/build/systemMenu_tools/NandInitializer/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializer/banner/Makefile b/build/systemMenu_tools/NandInitializer/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/NandInitializer/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/NandInitializer/banner/banner_v3.bsf b/build/systemMenu_tools/NandInitializer/banner/banner_v3.bsf new file mode 100644 index 00000000..746f3f40 Binary files /dev/null and b/build/systemMenu_tools/NandInitializer/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/NandInitializer/banner/icon/gameIcon.bmp b/build/systemMenu_tools/NandInitializer/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..34909746 Binary files /dev/null and b/build/systemMenu_tools/NandInitializer/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/NandInitializerProduction/ARM7.TWL/Makefile b/build/systemMenu_tools/NandInitializerProduction/ARM7.TWL/Makefile new file mode 100644 index 00000000..af17b0e1 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerProduction/ARM7.TWL/Makefile @@ -0,0 +1,89 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = crt0.SCFG_NOLOCK.c \ + main.c \ + kami_pxi.c \ + formatter.c \ + mcu_firm.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = ../../NandInitializerRed/ARM7.TWL/$(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCFG_NOLOCK.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/os/common/include \ + $(ROOT)/build/libraries/init/common/include \ + $(TWL_IPL_RED_ROOT)/include \ + ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM7.TWL/include \ + ../../common/ARM7/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCDIR = ../../NandInitializerRed/ARM7.TWL/src \ + ../../common/ARM7/src + +LLIBRARY_DIRS += $(TWL_IPL_RED_ROOT)/lib/ARM7-TS/$(TWL_BUILD_DIR) \ + ./obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libreloc_info_sp$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerProduction/ARM9.TWL/Makefile b/build/systemMenu_tools/NandInitializerProduction/ARM9.TWL/Makefile new file mode 100644 index 00000000..d4b72f6c --- /dev/null +++ b/build/systemMenu_tools/NandInitializerProduction/ARM9.TWL/Makefile @@ -0,0 +1,158 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializer +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# NandInitializerRedと同様の動作をしますが自動フォーマットが強制的に実行され停止します。 +MACRO_FLAGS += -DAUTO_FORMAT_MODE +#============================================================================ +#============================================================================ +# NandInitializer.iniで指定されたRegionと本体Regionが異なる場合実行を停止します。 +#MACRO_FLAGS += -DREGION_LIMITATION +#============================================================================ +#============================================================================ +# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。(要:Make Clean) +MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING +#============================================================================ +#============================================================================ +# 各種データを書き込み可能にする場合定義します。(要:Make Clean) +# 具体的には TWLFontTable.dat wrap.bin cert.sys の3つです。 +MACRO_FLAGS += -DUSE_WRITE_VARIOUS_DATA +#============================================================================ +#============================================================================ +# dev.kpを書き込み可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DWRITE_DEVKP_ENABLE +#============================================================================ +#============================================================================ +# マリクラデバッグ用として作成する場合定義します。(要:Make Clean) +# ・自動処理において"nand:/shared2/launcher/wrap.bin"を作成します。 +# ・自動処理において開発用CLSの証明書(cert.sys)を書き込みます。 +# ・自動処理の最後に本体初期化を行います。 +MACRO_FLAGS += -DMARIOCLUB_VERSION +#============================================================================ + +SYSM_DISABLE_DEBUG = FALSE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NPA +#TARGET_TAD = + +TARGET_BIN = NandInitializerProduction.srl +LCFILE_SPEC = ../../NandInitializerRed/ARM9.TWL/ARM9-TS.lsf +ROM_SPEC = ../../NandInitializerRed/ARM9.TWL/main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.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 \ + process_error.c \ + hwi.c \ + debugger_hw_reset_control.c \ + sort_title.c + +LINCLUDES = ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + ../../common/ARM9/include + +SRCDIR = ../../NandInitializerRed/ARM9.TWL/src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a \ + liberrorlog$(TWL_LIBSUFFIX).a + + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +#INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerProduction/Makefile b/build/systemMenu_tools/NandInitializerProduction/Makefile new file mode 100644 index 00000000..d593101e --- /dev/null +++ b/build/systemMenu_tools/NandInitializerProduction/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerProduction/banner/Makefile b/build/systemMenu_tools/NandInitializerProduction/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerProduction/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/NandInitializerProduction/banner/banner_v3.bsf b/build/systemMenu_tools/NandInitializerProduction/banner/banner_v3.bsf new file mode 100644 index 00000000..26686f94 Binary files /dev/null and b/build/systemMenu_tools/NandInitializerProduction/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/NandInitializerProduction/banner/icon/gameIcon.bmp b/build/systemMenu_tools/NandInitializerProduction/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..34909746 Binary files /dev/null and b/build/systemMenu_tools/NandInitializerProduction/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/Makefile b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/Makefile new file mode 100644 index 00000000..330b89f4 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/Makefile @@ -0,0 +1,90 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = crt0.SCFG_NOLOCK.c \ + main.c \ + kami_pxi.c \ + formatter.c \ + mcu_firm.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCFG_NOLOCK.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES += $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/os/common/include \ + $(TWL_IPL_RED_ROOT)/include \ + ../common/include \ + $(ROOT)/build/libraries/init/common/include \ + ../../common/ARM7/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCDIR += ../../common/ARM7/src + +LLIBRARY_DIRS += $(TWL_IPL_RED_ROOT)/lib/ARM7-TS/$(TWL_BUILD_DIR) \ + ./obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libreloc_info_sp$(TWL_LIBSUFFIX).a + +LLIBRARIES += libpm_sp.SYSMENU$(TWL_LIBSUFFIX).a +GLIBRARIES := $(filter-out libpm_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/armadillo.lsf b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/armadillo.lsf new file mode 100644 index 00000000..abe99fa6 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/armadillo.lsf @@ -0,0 +1,89 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + Object $(OBJDIR)/mcu_firm.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp.SYSMENU$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a + Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + Library libhotsw_sp$(LIBSUFFIX).a + Library libreloc_info_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/include/kami_pxi.h b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..cbce8090 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/crt0.SCFG_NOLOCK.c b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/crt0.SCFG_NOLOCK.c new file mode 100644 index 00000000..84ea2ede --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/crt0.SCFG_NOLOCK.c @@ -0,0 +1,798 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.SCR.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 +#ifndef SDK_FINALROM +#include +#endif +#include "boot_sync.h" + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); + +/*---------------------------------------------------------------------------* + 外部参照 + *---------------------------------------------------------------------------*/ +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); +extern void SDK_WRAM_ARENA_LO(void); + +/* 外部関数参照 */ +extern void OS_IrqHandler(void); +#ifndef SDK_NOINIT +extern void _fp_init(void); +extern void __call_static_initializers(void); +#endif + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* .rodata セクションに配置するロードに必要な情報 */ +void* const _start_ModuleParams[] = +{ + (void*)0, + (void*)0, + (void*)0, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, + (void*)0, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +/*---------------------------------------------------------------------------* + Name: Stop + Description: プログラムを停止する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_Stop[2] = +{ + 0xef000006, /* @1: swi #6 ; SVC_Halt */ + 0xeafffffd /* b @1 ; ループ */ +}; + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。同時に指定バッファの 0 クリアを行う。スタック内で動作させ + ることを想定している為、スタックを一切使用しない。 + Arguments: r0 - 0 クリアするバッファの先頭アドレス。 + 4 バイトアラインされたアドレスである必要がある。 + r1 - 上位 8 bit: ARM9 に伝えるフェーズ番号。 + 下位 24 bit: 0 クリアするバッファのサイズ。 + 4 の倍数である必要がある。 + r2 - 同期用フェーズ管理変数へのポインタ。 + r3 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[10] = +{ + 0xe59fc01c, /* @1: ldr r12, [pc, #28] ; 下位 24 bit マスクを用意 */ + 0xe111000c, /* tst r1, r12 ; クリアバッファ残サイズをチェック */ + 0xe3a0c000, /* mov r12, #0 ; クリア用変数を用意 */ + 0x1480c004, /* strne r12, [r0], #4 ; 4 バイトクリア */ + 0x12411004, /* subne r1, r1, #4 ; クリアバッファ残サイズ -= 4 */ + 0x1afffff9, /* bne @1 ; 残サイズが 0 になるまでループ */ + 0xe1a01c21, /* mov r1, r1, LSR #24 ; フェーズ管理変数の更新値を用意 */ + 0xe1c210b0, /* strh r1, [r2] ; フェーズ管理変数を更新 */ + 0xe12fff13, /* bx r3 ; Main 関数へジャンプ */ + 0x00fffffc /* 0x00fffffc */ +}; + + +/*---------------------------------------------------------------------------* + 内部関数プロトタイプ + *---------------------------------------------------------------------------*/ +static void INITi_CheckSysConfig(void); +static void INITi_DetectMainMemorySize(void); +static void INITi_Stop(void); +static void INITi_DoAutoload(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif + +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] + + /* SCFG 設定を確認 */ + bl INITi_CheckSysConfig + + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + + /* ランチャーから渡された情報を退避 */ + ldr r3, =SDK_WRAM_ARENA_LO + sub r2, r3, #0x40 + ldr r1, =HW_LAUNCHER_DELIVER_PARAM_BUF +@001: + cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @001 + + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 // sizeof(microcode_ShakeHand) +@002: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @002 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for IRQ stack check code + mov r0, #HW_PSR_SYS_MODE // System mode + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for SYS stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC セグメントの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + /* メインメモリサイズを調査 */ + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + /* デバッグ出力ウィンドウを設定 */ + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7 << 8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR << 8) + strh r0, [r1, #2] +#endif + + /* IRQ 割込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@0f0: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + sub r2, sp, #40 + mov r3, sp +@0f1: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @0f1 + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =SDK_STATIC_START + bic r0, r0, #0x00000003 + ldr r1, =SDK_STATIC_BSS_END + sub r1, r1, r0 + add r1, r1, #3 + bic r1, r1, #0x00000003 + bic r1, r1, #0xff000000 + mov r2, #BOOT_SYNC_PHASE_4 + mov r2, r2, LSL #24 + orr r1, r1, r2 + ldr r2, =HW_BOOT_SYNC_PHASE + ldr r3, =TwlSpMain + ldr lr, =HW_RESET_VECTOR + sub r12, sp, #40 + bx r12 + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CheckSysConfig + Description: SCFG 関連 I/O レジスタの内容を確認する。 + A7-SCFG ブロックがアクセス有効な場合には、ローダーが行う設定処 + 理を代行した上でアクセスを無効化する。 + ARM7 専用 WRAM 内にローダーが展開している I/O レジスタ情報を確 + 認した上でメインメモリ上の共有領域にコピーする。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CheckSysConfig(void) +{ + /* A7-SCFG のアクセス可否判定 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + ldr r2, =HW_PRV_WRAM_SYSRV + tst r0, #REG_SCFG_EXT_CFG_MASK + beq @invalid + +@valid: + /* ARM7 Secure-ROM 切り離し */ + ldr r1, =REG_A7ROM_ADDR + ldrb r0, [r1] + orr r0, r0, #REG_SCFG_A7ROM_SEC_MASK + strb r0, [r1] + + /* ARM9 Secure-ROM 切り離し */ + ldr r1, =REG_A9ROM_ADDR + ldrb r0, [r1] + orr r0, r0, #REG_SCFG_A9ROM_SEC_MASK + strb r0, [r1] + + /* NITRO 無線を有効化 */ + ldr r1, =REG_WL_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_WL_OFFB_MASK + strh r0, [r1] + + /* ROM 設定、NITRO 無線設定、ボンディングオプション情報を WRAM に展開 */ + ldr r3, =REG_OP_ADDR // SCFG-OP + ldrb r1, [r3] + and r0, r1, #(REG_SCFG_OP_OP1_MASK | REG_SCFG_OP_OP0_MASK) + ldr r3, =REG_A9ROM_ADDR // SCFG-ROM:0~7 + ldrb r1, [r3] + and r3, r1, #(REG_SCFG_A9ROM_RSEL_MASK | REG_SCFG_A9ROM_SEC_MASK) + orr r0, r0, r3, LSL #(HWi_WSYS08_ROM_ARM9RSEL_SHIFT - REG_SCFG_A9ROM_RSEL_SHIFT) + ldr r3, =REG_A7ROM_ADDR // SCFG-ROM:8~15 + ldrb r1, [r3] + and r3, r1, #(REG_SCFG_A7ROM_RSEL_MASK | REG_SCFG_A7ROM_FUSE_MASK) + orr r0, r0, r3, LSL #(HWi_WSYS08_ROM_ARM7RSEL_SHIFT - REG_SCFG_A7ROM_RSEL_SHIFT) + ldr r3, =REG_WL_ADDR // SCFG-WL + ldrb r1, [r3] + and r3, r1, #REG_SCFG_WL_OFFB_MASK + orr r0, r0, r3, LSL #(HWi_WSYS08_WL_OFFB_SHIFT - REG_SCFG_WL_OFFB_SHIFT) + strb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + + /* 各新規ブロックへクロックを供給 */ + ldr r1, =REG_CLK_ADDR + ldrh r0, [r1] + ldr r3, =REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK | REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK + orr r0, r0, r3 + strh r0, [r1] + + /* JTAG 情報を WRAM に展開 */ + ldr r3, =REG_JTAG_ADDR // SCFG-JTAG + ldrh r1, [r3] + and r0, r1, #(REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK) + and r3, r1, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r3, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] + + /* 各拡張機能を有効化 */ + ldr r1, =REG_EXT_ADDR // SCFG_EXT + ldr r0, [r1] + ldr r3, =REG_SCFG_EXT_WRAM_MASK | REG_SCFG_EXT_GPIO_MASK | REG_SCFG_EXT_I2C_MASK | REG_SCFG_EXT_I2S_MASK | REG_SCFG_EXT_MIC_MASK | REG_SCFG_EXT_SD2_MASK | REG_SCFG_EXT_SD1_MASK | REG_SCFG_EXT_AES_MASK | REG_SCFG_EXT_DMAC_MASK + orr r0, r0, r3 + orr r0, r0, #(REG_SCFG_EXT_DSEL_MASK | REG_SCFG_EXT_INTC_MASK) + bic r0, r0, #REG_SCFG_EXT_MC_B_MASK + str r0, [r1] + + /* 各拡張機能の制御設定内容を WRAM に展開 */ + str r0, [r2, #HWi_WSYS04_WRAMOFFSET] + + /* メモリーカード I/F のスロット選択 */ + ldr r1, =REG_MC1_ADDR // SCFG_MC1 + ldr r0, [r1] + bic r0, r0, #REG_MI_MC1_SWP_MASK + str r0, [r1] + + /* WRAM-A/B/C が ARM7 に割り当たっていることを確認 */ + ldr r1, =REG_MBK1_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK2_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK3_ADDR + ldr r0, [r1] + ldr r3, =0x9d999591 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK4_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK5_ADDR + ldr r0, [r1] + ldr r3, =0x9d999591 + cmp r0, r3 + blne INITi_Stop + + /* WRAM-A/B/C のメモリマップを設定 */ + ldr r1, =REG_MBK6_ADDR + ldr r0, =0x080037c0 + str r0, [r1] + ldr r1, =REG_MBK7_ADDR + ldr r0, =0x07c03780 + str r0, [r1] + ldr r1, =REG_MBK8_ADDR + ldr r0, =0x07803740 + str r0, [r1] + ldr r1, =REG_MBK9_ADDR + ldr r0, =0x00ffff0f + str r0, [r1] + + /* A7-SCFG ブロックへのアクセスを無効化 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] +/* bic r0, r0, #REG_SCFG_EXT_CFG_MASK */ + str r0, [r1] + +@invalid: + /* ROM 設定、NITRO 無線設定内容を確認 */ + ldrb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + and r0, r0, #(HWi_WSYS08_ROM_ARM7RSEL_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK | HWi_WSYS08_ROM_ARM9SEC_MASK) + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + blne INITi_Stop + + /* SCFG レジスタ設定情報を共有領域にコピー */ + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + Description: メインメモリサイズを調査する。 + 調査結果は (u16*)HW_MMEMCHECER_SUB に格納される。 + 格納される値は [OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32B] + NOTE: プラットフォームが NITRO の場合は考慮していない。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void +INITi_DetectMainMemorySize(void) +{ + ldr r2, =HW_MMEMCHECKER_SUB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + + /* OSi_CHECKNUM1 (0x55) 書き込みテスト */ + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@1 subs r2, r2, #4 + bcs @1 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @check_smix + + /* OSi_CHECKNUM2 (0xaa) を 書き込みテスト */ + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@2 subs r2, r2, #4 + bcs @2 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@check_smix: + /* SMIX レジスタを調査 */ + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + /* 調査結果を格納 */ + ldr r2, =HW_MMEMCHECKER_SUB + strb r0, [r2] + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Stop + Description: プログラムを停止する。ARM7 専用 WRAM に Halt を繰り返すループ + 関数をコピーし、コピーした関数を実行する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_Stop(void) +{ + ldr r1, =microcode_Stop + ldr r2, =HW_PRV_WRAM + add r3, r2, #8 // sizeof(microcode_Stop) +@copy_loop: + ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @copy_loop + +@stop_loop: + ldr r0, =HW_PRV_WRAM + mov lr, pc + bx r0 + b @stop_loop + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + NITRO 互換オートロードセグメントは存在せず、TWL 専用セグメント + のみが存在するという前提。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ + +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + + /* オートロードを実施 */ +@000: + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_LTDAUTOLOAD_START +@001: + cmp r12, r3 + bge @010 + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = sizeo of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} + b @001 + + /* オートロードリスト・オートロード元バッファをクリア */ +@010: + ldr r1, =_start_LtdModuleParams + ldr r12, [r1] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r1, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r0, [r1, #8] // r0 = SDK_LTDAUTOLOAD_START +@011: + cmp r12, r3 + bge @0f0 + mov r1, #0 // r1 = clear value + str r1, [r12], #4 + ldr r2, [r12] // r2 = size of fixed section + str r1, [r12], #4 + str r1, [r12], #4 + str r1, [r12], #4 + bl INITi_Fill32 + b @011 + +@0f0: + /* オートロード完了コールバック呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + +#ifndef SDK_NOINIT + +static asm void +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* 退避場所先頭から空き場所を調査 */ + ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 +@002: + /* 空き場所にテーブルをコピー */ + ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* テーブルに管理されているポインタを一つずつ呼び出し */ + ldr r0, [r1] + cmp r0, #0 + beq @002 + stmfd sp!, {r1} + mov lr, pc + bx r0 + ldmfd sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 +@002: + ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 32 bit 単位でコピーを行う。スタックを 36 バイト消費するが、 + レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 32 bit 単位でバッファ内容を指定データで埋める。スタックを 36 + バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +#include diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/kami_pxi.c b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..0a2ead75 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,358 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include "mcu_firm.h" +#include +#include +#include +#include +#include +#include + +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); +extern BOOL sdmcFormatNandLog( BOOL verify_flag); +extern void sdmcGetCID( SDMC_PORT_NO port, u32* dest); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_MCU_WRITE_FIRM: + case KAMI_MCU_IO: + case KAMI_ARM7_IO: + case KAMI_CDC_GO_DSMODE: + case KAMI_CLEAR_NAND_ERRORLOG: + case KAMI_GET_CAMERA_MODULE_TYPE: + case KAMI_GET_NAND_CID: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_MCU_WRITE_FIRM: + { + void* buffer; + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[1]); + + if ( MCU_WriteFirm( buffer ) ) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_MCU_IO: + { + BOOL is_read; + u32 reg_no; + u32 write; + u32 read; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(®_no, &kamiWork.data[1]); + KAMI_UNPACK_U32(&write, &kamiWork.data[5]); + + if (is_read) + { + read = MCU_ReadRegister( (u8)reg_no ); + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u8), (u8*)&read ); + } + else + { + MCU_WriteRegister( (u8)reg_no, (u8)write ); + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + } + break; + + case KAMI_ARM7_IO: + { + BOOL is_read; + u32 addr; + u32 write; + u32 read; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&addr, &kamiWork.data[1]); + KAMI_UNPACK_U32(&write, &kamiWork.data[5]); + + if (is_read) + { + read = *(u32 *)addr; + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u32), (u8*)&read ); + } + else + { + *(u32 *)addr = write; + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + } + break; + + case KAMI_CDC_GO_DSMODE: + { + CDC_Init(); // IIRなどのパラメータ初期化のため + CDC_GoDsMode(); + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + break; + + case KAMI_CLEAR_NAND_ERRORLOG: + { + if (sdmcFormatNandLog(TRUE)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_GET_CAMERA_MODULE_TYPE: + { + CameraModuleTypes types; + if (CAMERAi_IsSharpModule(CAMERA_SELECT_IN)) + { + types.in = CAMERA_MODULE_TYPE_SHARP; + } + else if (CAMERAi_IsMicronModule(CAMERA_SELECT_IN)) + { + types.in = CAMERA_MODULE_TYPE_MICRON; + } + else + { + types.in = CAMERA_MODULE_TYPE_UNKNOWN; + } + if (CAMERAi_IsSharpModule(CAMERA_SELECT_OUT)) + { + types.out = CAMERA_MODULE_TYPE_SHARP; + } + else if (CAMERAi_IsMicronModule(CAMERA_SELECT_OUT)) + { + types.out = CAMERA_MODULE_TYPE_MICRON; + } + else + { + types.out = CAMERA_MODULE_TYPE_UNKNOWN; + } + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(CameraModuleTypes), (u8*)&types); + } + break; + + case KAMI_GET_NAND_CID: + { + u8 buffer[16]; + sdmcGetCID( SDMC_PORT_NAND, (u32*)buffer); + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(buffer), (u8*)buffer ); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/main.c b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/main.c new file mode 100644 index 00000000..b2a99285 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM7.TWL/src/main.c @@ -0,0 +1,654 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "kami_pxi.h" +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM 3 + +/* カードチャタリングカウンタ */ +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSHeapHandle hh); +static void InitializeCardPower(void); +static void InitializeCdc(void); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); +#endif + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA + FS_Init(FS_DMA_NOT_USE); // FS for CARD + FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS + InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + + if (OSi_IsCodecTwlMode() == TRUE) + { + InitializeCdc(); // CODEC + CAMERA_Init(); // カメラ + } + + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC + WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + InitializeCardPower(); // カード電源ON(検査プログラム用) + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} + +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: hh - 利用可能なヒープのハンドルを指定。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSHeapHandle hh) +{ + NwmspInit nwmInit; + + /* [TODO] 確保しているヒープ領域が新無線一式が必要としているメモリ量以上かのチェックが必要 */ + + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + + nwmInit.dmaNo = DMA_NO_NWM; + nwmInit.drvHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.drvHeap.handle = hh; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.wpaHeap.handle = hh; + + NWMSP_Init(&nwmInit); +} + +/*---------------------------------------------------------------------------* + Name: InitializeCardPower + Description: カード電源をONする。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCardPower(void) +{ + // チャッタリングカウンタの値を設定 + reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC1_CC_MASK) | + (CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT)); + + // チャタリングカウンタ分待つことによりCDETが0になる + OS_SpinWait( OS_MSEC_TO_CPUCYC(200) ); + + // カードスロット1電源ON + HOTSWi_TurnCardPowerOn(1); +} + +/*---------------------------------------------------------------------------* + Name: InitializeCdc + Description: CDCライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCdc(void) +{ + u32 spiLockId; + + spiLockId = (u32)OS_GetLockID(); + if (spiLockId == OS_LOCK_ID_ERROR) + { + OS_Warning("OS_GetLockID failed.\n"); + } + + /* CODEC 初期化 */ + SPI_Lock(spiLockId); + CDC_Init(); + SPI_Unlock(spiLockId); +} + +//#ifdef WM_PRECALC_ALLOWEDCHANNEL +//extern u16 WMSP_GetAllowedChannel(u16 bitField); +//#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } +/* +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +*/ +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..27b5d91f --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-12-05#$ +# $Rev: 2840 $ +# $Author: yosizaki $ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/Makefile b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/Makefile new file mode 100644 index 00000000..d8fc2b67 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/Makefile @@ -0,0 +1,147 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializerRed +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。(要:Make Clean) +MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING +#============================================================================ +#============================================================================ +# 各種データを書き込み可能にする場合定義します。(要:Make Clean) +# 具体的には TWLFontTable.dat wrap.bin cert.sys の3つです。 +MACRO_FLAGS += -DUSE_WRITE_VARIOUS_DATA +#============================================================================ +#============================================================================ +# dev.kpを書き込み可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DWRITE_DEVKP_ENABLE +#============================================================================ +#============================================================================ +# マリクラデバッグ用として作成する場合定義します。(要:Make Clean) +# ・自動処理において"nand:/shared2/launcher/wrap.bin"を作成します。 +# ・自動処理において開発用CLSの証明書(cert.sys)を書き込みます。 +# ・自動処理の最後に本体初期化を行います。 +#MACRO_FLAGS += -DMARIOCLUB_VERSION +#============================================================================ + +SYSM_DISABLE_DEBUG = FALSE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NRA +#TARGET_TAD = + +TARGET_BIN = NandInitializerRed.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.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 \ + ../../common/ARM9/include + +SRCDIR = src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a \ + liberrorlog$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/cursor.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/cursor.h new file mode 100644 index 00000000..7af9f41a --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/cursor.h @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/graphics.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..ddd8c4f6 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/graphics.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_font.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..d9855fd0 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_font.h @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 +#define BG_COLOR_BROWN 11 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_pxi.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..6d7d9db0 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult ExeFormat(FormatMode format_mode); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiMcuWriteFirm(void* buffer ); +KAMIResult kamiMcuIo(u32 reg_no, void* buffer, u32 value, BOOL is_read); +KAMIResult kamiARM7Io(u32 addr, u32* buffer, u32 value, BOOL is_read); +KAMIResult kamiCDC_GoDsMode( void ); +KAMIResult kamiClearNandErrorLog( void ); +KAMIResult kamiGetCameraModuleTypesAsync( CameraModuleTypes *pTypes, KAMICallback callback, void* arg ); +KAMIResult kamiGetCameraModuleTypes( CameraModuleTypes *pTypes ); +KAMIResult kamiGetNandCID( void* buffer ); + +// (重要) +// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。 +// +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} +static KAMIResult kamiMcuRead(u8 reg_no, void* buffer) +{ + return kamiMcuIo((u32)reg_no, buffer, 0, TRUE); +} +static KAMIResult kamiMcuWrite(u8 reg_no, u8 value) +{ + return kamiMcuIo((u32)reg_no, NULL, (u32)value, FALSE); +} +static KAMIResult kamiARM7Read(u32 addr, void* buffer) +{ + return kamiARM7Io(addr, buffer, 0, TRUE); +} +static KAMIResult kamiARM7Write(u32 addr, u8 value) +{ + return kamiARM7Io(addr, NULL, value, FALSE); +} + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_write_nandfirm.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_write_nandfirm.h new file mode 100644 index 00000000..90fe68bd --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/kami_write_nandfirm.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/keypad.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_auto.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_auto.h new file mode 100644 index 00000000..117bfa89 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_auto.h @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------* + 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, +#ifdef USE_WRITE_VARIOUS_DATA + AUTO_PROCESS_MENU_VARIOUS_DATA_1, +#endif // USE_WRITE_VARIOUS_DATA + +#ifndef TWL_CAPTURE_VERSION + AUTO_PROCESS_MENU_HARDWARE_INFO, +#endif // TWL_CAPTURE_VERSION +#ifdef USE_WRITE_VARIOUS_DATA + AUTO_PROCESS_MENU_VARIOUS_DATA_2, +#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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_error.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_error.h new file mode 100644 index 00000000..c0a0f0f4 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_error.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + 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_ERROR_H_ +#define PROCESS_ERROR_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* errorProcess(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_ERROR_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_eticket.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_eticket.h new file mode 100644 index 00000000..16b81232 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_eticket.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_fade.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_fade.h new file mode 100644 index 00000000..a1694237 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_fade.h @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_format.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_format.h new file mode 100644 index 00000000..507d198d --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_format.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_hw_info.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_hw_info.h new file mode 100644 index 00000000..01ee1293 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_hw_info.h @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------* + 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); + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ + +extern BOOL GetNandInitializerSetting(u8* region, u8* wireless, u8* logodemoskip); +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, BOOL logoDemoSkipForce ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_import.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_import.h new file mode 100644 index 00000000..3f3a1f6f --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_import.h @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_mcu.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_mcu.h new file mode 100644 index 00000000..f68c6dfb --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_mcu.h @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_nandfirm.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_nandfirm.h new file mode 100644 index 00000000..62bbf06a --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_nandfirm.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_norfirm.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_norfirm.h new file mode 100644 index 00000000..6e05fbb5 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_norfirm.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_topmenu.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_topmenu.h new file mode 100644 index 00000000..36d00836 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_topmenu.h @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_wireless_setting.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_wireless_setting.h new file mode 100644 index 00000000..a3f9f8d8 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_wireless_setting.h @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_write_data.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_write_data.h new file mode 100644 index 00000000..87d3313b --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/process_write_data.h @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + 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* WriteDataProcessPre0(void); +void* WriteDataProcessAfter0(void); +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/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/sort_title.h b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/sort_title.h new file mode 100644 index 00000000..50e1f415 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/include/sort_title.h @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/main.rsf b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/main.rsf new file mode 100644 index 00000000..836d36f3 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/main.rsf @@ -0,0 +1,232 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2008-01-07#$ +# $Rev: 436 $ +# $Author: yosiokat $ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 2G + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SCFG: scfg lock [TRUE/FALSE] + # + LockSCFG FALSE + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +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) +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/cursor.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/cursor.c new file mode 100644 index 00000000..1847a62f --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/cursor.c @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/font_data.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..aa1ba501 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 茶 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(25, 15, 15), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/graphics.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..1de138e9 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/graphics.c @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(0); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_font.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..fb3818b6 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_pxi.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..9d4f7b3e --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,684 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0)) + { + return; + } +} + + + +/////////////////////////////////////////////////////////////////// + +//typedef void (*KAMICallback)(KAMIResult result, void *arg); +/* +void CDC_ReadCallback(KAMIResult result, void* arg); +void CDC_ReadCallback(KAMIResult result, void* arg) +{ + +} +*/ + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +KAMIResult ExeFormat(FormatMode format_mode) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiMcuWriteFirm + + Description: MCUファーム更新関数 + + Arguments: buffer : new mcu data buffer + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiMcuWriteFirm(void* buffer ) +{ + OSIntrMode enabled; + u8 data[4+2]; // 3の倍数 + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &buffer); + + if (KamiSendPxiCommand(KAMI_MCU_WRITE_FIRM, 5, (u8)0)) + { + for (i = 0; i < 4; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: MCUアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiMcuIo(u32 reg_no, void* buffer, u32 value, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + if (is_read) + { + kamiWork.data = (u8*)buffer; + } + else + { + kamiWork.data = 0; + } + + // データ作成 + KAMI_PACK_U32(&data[0], ®_no); + KAMI_PACK_U32(&data[4], &value); + + if (KamiSendPxiCommand(KAMI_MCU_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + + +/*---------------------------------------------------------------------------* + Name: ARM7アクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiARM7Io(u32 addr, u32* buffer, u32 value, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + if (is_read) + { + kamiWork.data = (u8*)buffer; + } + else + { + kamiWork.data = 0; + } + + // データ作成 + KAMI_PACK_U32(&data[0], &addr); + KAMI_PACK_U32(&data[4], &value); + + if (KamiSendPxiCommand(KAMI_ARM7_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiCDC_GoDsMode + + Description: CODECをDSモードへ遷移させる関数 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiCDC_GoDsMode( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CDC_GO_DSMODE, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiClearNandErrorLog + + Description: NVRAMのNANDエラー情報をクリアします。 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiClearNandErrorLog( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetCameraModuleTypesAsync + + Description: カメラモジュールタイプを取得します(非同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetCameraModuleTypesAsync( CameraModuleTypes *pTypes, KAMICallback callback, void* arg ) +{ + OSIntrMode enabled; + + if (pTypes == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = callback; + kamiWork.arg = arg; + kamiWork.data = (u8*)pTypes; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_CAMERA_MODULE_TYPE, 0, 0)) + { + return KAMI_RESULT_SUCCESS; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetCameraModuleTypes + + Description: カメラモジュールタイプを取得します(同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetCameraModuleTypes( CameraModuleTypes *pTypes ) +{ + OSIntrMode enabled; + + if (pTypes == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pTypes; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_CAMERA_MODULE_TYPE, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetNandCID + + Description: NANDのCIDを取得します。 + + Arguments: buffer : 16バイトバッファ + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetNandCID(void* buffer ) +{ + OSIntrMode enabled; + u8 data[4+2]; // 3の倍数 + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)buffer; + + if (KamiSendPxiCommand(KAMI_GET_NAND_CID, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + PXI関連 + *---------------------------------------------------------------------------*/ + +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c new file mode 100644 index 00000000..cac9c5ee --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/kami_write_nandfirm.c @@ -0,0 +1,332 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/keypad.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/main.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/main.c new file mode 100644 index 00000000..dca169a8 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/main.c @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: main.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 "process_format.h" +#include "process_topmenu.h" +#include "graphics.h" +#include "keypad.h" +#include "kami_pxi.h" +#include "process_fade.h" +#include "process_hw_info.h" +#include "process_error.h" +#include "hwi.h" + +#define SCRAMBLE_MASK 0x00406000 + +extern void HWInfoWriterInit( void ); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static Process sProcess; +static FSEventHook sSDHook; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitTick(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); /* 独自PXI初期化 */ +#endif + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // SDカードの挿抜イベント監視コールバック設定 +// FS_RegisterEventHook("sdmc", &sSDHook, SDEvents, NULL); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // 初期シーケンス設定 + sProcess = TopmenuProcess0; + + 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"); + +#ifdef TWL_CAPTURE_VERSION + // memory-launcher経由で立ち上がるTWLCaptureSystemWriterでは + // RED_LAUNCHER_VERが0でフォーマットに失敗するので強制的に書き換える + MI_StoreLE8((void*)HW_TWL_RED_LAUNCHER_VER, 1); +#endif + +#ifdef AUTO_FORMAT_MODE +// 検査工程ではNANDが初期化されていないがその状態でFATにアクセスすると +// 問題があるため強制的にフォーマットを行う 2008/06/18 +// ExeFormat(FORMAT_MODE_QUICK); +// +// Secure情報を読み込む前にフォーマットしてしまうとSecure情報が消えてしまう。 +// そうするとシリアルNoが書き換わってしまうのでこの処理はなくす。 +// 検査工程と異なりNandInitializerが実行される段階ではフォーマット済みなはず。 +// 仮に未フォーマットであったとしてもBadFormat扱いとなる。2009/03/05 +#endif + + // 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 + +#ifdef REGION_LIMITATION +{ + static u8 tempRegion; + static u8 tempWireless; + static u8 tempLogodemoskip; + BOOL result; + + result = GetNandInitializerSetting(&tempRegion, &tempWireless, &tempLogodemoskip); + + if (!result || OS_GetRegion() != tempRegion) + { + sProcess = errorProcess; + } +} +#endif // REGION_LIMITATION + + while (1) + { + kamiPadRead(); + + // コマンドフラッシュ +// (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // ARM7コマンド応答受信 +// while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) +// { +// } + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + sProcess = sProcess(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_auto.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_auto.c new file mode 100644 index 00000000..de233414 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_auto.c @@ -0,0 +1,296 @@ +/*---------------------------------------------------------------------------* + 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 "kami_font.h" +#include "kami_pxi.h" +#include "process_error.h" +#include "process_fade.h" +#include "cursor.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: eTicket プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* errorProcess(void) +{ + int i; + + // 文字列全クリア + kamiFontClear(); + + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "ERROR"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // メニュー一覧 + kamiFontPrintf(3, 8, FONT_COLOR_BLACK, "The region specified in"); + kamiFontPrintf(3, 9, FONT_COLOR_BLACK, "nandinitializer.ini is "); + kamiFontPrintf(3, 10, FONT_COLOR_BLACK, "not equal to the region"); + kamiFontPrintf(3, 11, FONT_COLOR_BLACK, "of this machine. "); + + kamiFontPrintf(3, 13, FONT_COLOR_BLACK, " or "); + kamiFontPrintf(3, 15, FONT_COLOR_BLACK, "nandinitializer.ini is "); + kamiFontPrintf(3, 16, FONT_COLOR_BLACK, "not exist."); + + // 背景全クリア + for (i=0;i<24;i++) + { + kamiFontFillChar( i, BG_COLOR_RED, BG_COLOR_RED ); + } + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + return errorProcess; +} diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_eticket.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_eticket.c new file mode 100644 index 00000000..931c03e8 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_eticket.c @@ -0,0 +1,276 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_eticket.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_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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_fade.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_fade.c new file mode 100644 index 00000000..29681ec4 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_fade.c @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_format.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_format.c new file mode 100644 index 00000000..92cfa168 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_format.c @@ -0,0 +1,442 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c new file mode 100644 index 00000000..450c8ff5 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c @@ -0,0 +1,501 @@ +/*---------------------------------------------------------------------------* + 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 sLogoDemoSkipForce; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL WriteHWNormalInfoFile( void ); +static BOOL WriteHWSecureInfoFile( u8 region ); +//static BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 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, (u8 *)&sLogoDemoSkipForce)) + { + // 設定の取得に失敗した場合はデフォルト設定(REGION_JAPAN/WIRELESS_ENABLE) + sMenuSelectNo = 0; + sWirelessForceOff = FALSE; + sLogoDemoSkipForce = 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, sLogoDemoSkipForce ); + + // 全リージョンの結果をクリア + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_nandfirm.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_nandfirm.c new file mode 100644 index 00000000..f290ae1f --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_nandfirm.c @@ -0,0 +1,281 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_norfirm.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_norfirm.c new file mode 100644 index 00000000..1f705273 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_norfirm.c @@ -0,0 +1,415 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_topmenu.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_topmenu.c new file mode 100644 index 00000000..282d639c --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_topmenu.c @@ -0,0 +1,255 @@ +/*---------------------------------------------------------------------------* + 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( WriteDataProcessPre0 ); +#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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_wireless_setting.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_wireless_setting.c new file mode 100644 index 00000000..c9deb014 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_wireless_setting.c @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------* + 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, 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, FALSE ); + 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_write_data.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_write_data.c new file mode 100644 index 00000000..395e78c4 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_write_data.c @@ -0,0 +1,534 @@ +/*---------------------------------------------------------------------------* + 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" +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +enum { + MENU_CERT=0, + MENU_WRAP, + MENU_FONT, + + +#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; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +void WriteDataProcessDrawMenu(void); +static BOOL WriteFontData(void); +static BOOL WriteDummyData(const char* nandpath); +static BOOL WriteCertData(void); + +/*---------------------------------------------------------------------------* + プロセス関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス0 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + + +void* WriteDataProcessPre0(void) +{ + WriteDataProcessDrawMenu(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + // オート実行用 + if (gAutoFlag) + { + sMenuSelectNo = MENU_CERT; + FADE_IN_RETURN( WriteDataProcess2 ); + } +#endif + + + FADE_IN_RETURN( WriteDataProcess1 ); +} + +void* WriteDataProcessAfter0(void) +{ + WriteDataProcessDrawMenu(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + // オート実行用 + if (gAutoFlag) + { +#ifdef MARIOCLUB_VERSION + sMenuSelectNo = MENU_WRAP; +#else // MARIOCLUB_VERSION + sMenuSelectNo = MENU_FONT; +#endif // MARIOCLUB_VERSION + FADE_IN_RETURN( WriteDataProcess2 ); + } +#endif + +// NEVER REACHED + FADE_IN_RETURN( WriteDataProcess1 ); +} + + +void WriteDataProcessDrawMenu(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 CERT.SYS 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 FONT DATA 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); + +} + +/*---------------------------------------------------------------------------* + Name: WriteData プロセス1 + + Description: + + Arguments: None. + + Returns: next sequence + *---------------------------------------------------------------------------*/ + +void* WriteDataProcess1(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 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 = TRUE; + s16 y_pos = (s16)(7 + sMenuSelectNo * CHAR_OF_MENU_SPACE); + + switch( sMenuSelectNo ) + { + case MENU_CERT: +#ifdef MARIOCLUB_VERSION + result = WriteCertData(); + + // sysmenu.logの生成をこのタイミングで行っておく + ERRORLOG_Init(OS_AllocFromMain, OS_FreeToMain); +#endif //MARIOCLUB_VERSION + break; + case MENU_WRAP: + // ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの) + result = WriteDummyData(WRAP_DATA_FILE_PATH_IN_NAND); + break; + case MENU_FONT: + result = WriteFontData(); + 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_CERT: +#ifdef MARIOCLUB_VERSION + if (total_result) + { + gAutoProcessResult[AUTO_PROCESS_MENU_VARIOUS_DATA_1] = AUTO_PROCESS_RESULT_SUCCESS; + FADE_OUT_RETURN( AutoProcess1 ); + } + else + { + gAutoProcessResult[AUTO_PROCESS_MENU_VARIOUS_DATA_1] = AUTO_PROCESS_RESULT_FAILURE; + FADE_OUT_RETURN( AutoProcess2); + } +#else //MARIOCLUB_VERSION + FADE_OUT_RETURN( AutoProcess1 ); +#endif //MARIOCLUB_VERSION + + /* NOTREACHED */ + case MENU_WRAP: + sMenuSelectNo++; + return WriteDataProcess2; + case MENU_FONT: +#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_2] = AUTO_PROCESS_RESULT_SUCCESS; + FADE_OUT_RETURN( AutoProcess1 ); + } + else + { + gAutoProcessResult[AUTO_PROCESS_MENU_VARIOUS_DATA_2] = 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/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/sort_title.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/sort_title.c new file mode 100644 index 00000000..9f7caf5a --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/sort_title.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/NandInitializerRed/Makefile b/build/systemMenu_tools/NandInitializerRed/Makefile new file mode 100644 index 00000000..d593101e --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/NandInitializerRed/banner/Makefile b/build/systemMenu_tools/NandInitializerRed/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/NandInitializerRed/banner/banner_v3.bsf b/build/systemMenu_tools/NandInitializerRed/banner/banner_v3.bsf new file mode 100644 index 00000000..a86a720b Binary files /dev/null and b/build/systemMenu_tools/NandInitializerRed/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/NandInitializerRed/banner/icon/gameIcon.bmp b/build/systemMenu_tools/NandInitializerRed/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..34909746 Binary files /dev/null and b/build/systemMenu_tools/NandInitializerRed/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/NandInitializerRed/common/include/fifo.h b/build/systemMenu_tools/NandInitializerRed/common/include/fifo.h new file mode 100644 index 00000000..9873e242 --- /dev/null +++ b/build/systemMenu_tools/NandInitializerRed/common/include/fifo.h @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera-test - include + File: fifo.h + + Copyright 2007 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 TWL_KAMI_TEST_FIFO_H_ +#define TWL_KAMI_TEST_FIFO_H_ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + + +typedef enum KamiCommand +{ + KAMI_TEST_COMMAND, + KAMI_EXE_FORMAT, + KAMI_NAND_IO, + KAMI_MCU_IO, + KAMI_MCU_WRITE_FIRM, + KAMI_ARM7_IO, + KAMI_CDC_GO_DSMODE, + KAMI_CLEAR_NAND_ERRORLOG, + KAMI_GET_CAMERA_MODULE_TYPE, + KAMI_GET_NAND_CID +} +KamiCommand; + + +typedef enum CameraModuleType +{ + CAMERA_MODULE_TYPE_UNKNOWN, + CAMERA_MODULE_TYPE_SHARP, + CAMERA_MODULE_TYPE_MICRON +} +CameraModuleType; + + +typedef struct CameraModuleTypes +{ + CameraModuleType in; + CameraModuleType out; +} +CameraModuleTypes; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/NandInitializerRed/data/cert.sys b/build/systemMenu_tools/NandInitializerRed/data/cert.sys new file mode 100644 index 00000000..3d40f56a Binary files /dev/null and b/build/systemMenu_tools/NandInitializerRed/data/cert.sys differ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..5b7335b2 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,58 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Object $(NANDFIRM_OBJ) (.data) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/Makefile b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/Makefile new file mode 100644 index 00000000..e5def126 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/Makefile @@ -0,0 +1,73 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - FatalErrorChecker +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +SUBDIRS = + +SRCS = main.c \ + keypad.c \ + font.c \ + screen.c \ + ../../../NandInitializerRed/ARM9.TWL/src/kami_pxi.c + +TITLEID_LO = 0J0A + +#ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/rom_header_$(call toLower,$(TITLEID_LO)).template.sbin +#LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/libsyscall.a + +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' +# -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +LCFILE_SPEC = ARM9-TS.lsf + +LINCLUDES += $(MISC_DIR)/include \ + ../../NandInitializerRed/ARM9.TWL/include \ + ../../NandInitializerRed/common/include \ + ./include + +ROM_SPEC = main.rsf + +TARGET_BIN = SystemLogReader.srl + +LLIBRARIES += liberrorlog$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifeq ($(FIRM_USE_PRODUCT_KEYS),TRUE) + MAKELCF_FLAGS += -DNANDFIRM_OBJ=./nandfirm/nandfirm.prod.o +else + MAKELCF_FLAGS += -DNANDFIRM_OBJ=./nandfirm/nandfirm.dev.o +endif + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +DEFAULT_MAKEROM_ARM7_BASE = ../../NandInitializerRed/ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/font.h b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/font.h new file mode 100644 index 00000000..9e703b04 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/font.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/keypad.h b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/screen.h b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/screen.h new file mode 100644 index 00000000..7e55f3e1 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +#define CONSOLE_BLACK 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 +#define CONSOLE_BLUE 3 +#define CONSOLE_YELLOW 4 +#define CONSOLE_WHITE 15 + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/main.rsf b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/main.rsf new file mode 100644 index 00000000..e501ed52 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/main.rsf @@ -0,0 +1,245 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "SysLogReader" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # +# RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + LockSCFG TRUE + + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media GameCard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.dev.o b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.dev.o new file mode 100644 index 00000000..56d447e4 Binary files /dev/null and b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.dev.o differ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.prod.o b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.prod.o new file mode 100644 index 00000000..7d818096 Binary files /dev/null and b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/nandfirm/nandfirm.prod.o differ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/font.c b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/font.c new file mode 100644 index 00000000..c5c4bf70 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/font.c @@ -0,0 +1,580 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/keypad.c b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/main.c b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/main.c new file mode 100644 index 00000000..ceec4076 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/main.c @@ -0,0 +1,628 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - Tests - FatalErrorChecker + File: main.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 "keypad.h" +#include "font.h" +#include "screen.h" +#include + +#define BUFSIZE 256 + +#define FATAL_ERROR_MAX 51 +#define SCREEN_WIDTH 32 +#define RESULT_LINE_OFFSET 6 + +#define DST_LOGFILE_PATH "sdmc:/" +#define ERRORLOG_LOGFILE_PATH "nand:/sys/log/sysmenu.log" + +#define NAND_BLOCK_BYTE 0x200 +#define NAND_START_OFFSET 0x200 +#define NANDFIRM_FILE_START_OFFSET 0x200 + +// nandfirm格納先のシンボル +extern void* nandfirm_begin; +extern void* nandfirm_end; +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ +static char * FatalErrorCode[FATAL_ERROR_MAX]; +static BOOL resetConsoleFlag; +static s16 lineoffset; +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); +static BOOL deleteLogfile( void ); +static void control(); +static void removeLC( char *dst, const char *src ); +static BOOL copyLogToSD( void ); +static void doProc(); +static BOOL writebackFirm( void ); +static int convertLF( char *dst, char *src ); +static void drawMenu( void ); +static void myInit(void); +static void printConsole(char *text, ...); +static void printConsoleErr(char *text, ...); +static u64 parseRedError(const ErrorLogEntry *entry); +static BOOL putRedError( FSFile *dst, u64 code ); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + char tst[] = "\n\n\n\n\na"; + u8 bootmode = 0x3; + // OS_InitのなかでCard_Initが呼ばれる前に、Boottypeを無理やりNANDにする + //MI_CpuMove( &bootmode, (void*) 0x02fffc40, 1 ); + + myInit(); + KamiPxiInit(); + CARD_Enable(TRUE); + // FS_Initの後の方が良い模様 + InitAllocation(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + ERRORLOG_Init( OS_AllocFromMain, OS_FreeToMain ); + + + resetConsoleFlag = TRUE; + + drawMenu(); + doProc(); + + printConsole("process finished."); + OS_WaitVBlankIntr(); + ERRORLOG_End(); + OS_Terminate(); +} + +static void control() +{ + if( kamiPadIsTrigger( PAD_BUTTON_A ) ) + { + drawMenu(); + doProc(); + } +} + +// 一連の自動化作業を実行する +static void doProc() +{ + // 空行挿入 + lineoffset++; + + printConsole( "Copying logfile ..." ); + + if( copyLogToSD() ) + { + // コピー成功時にだけログファイルの削除を行う + deleteLogfile(); + } + + writebackFirm(); +} +// srcから改行を取り除いてdstに引き渡す +static void removeLC( char *dst, const char *src ) +{ + char *idx; + STD_StrCpy( dst, src ); + + while( ( idx = STD_StrChr( dst, '\n' )) != NULL ) + { + *idx = ' '; + } +} + + +static BOOL deleteLogfile( void ) +{ + + if( !FS_DeleteFile( ERRORLOG_LOGFILE_PATH ) ) + { + printConsoleErr( "Delete Failed." ); + printConsoleErr( "func: FS_DeleteFile" ); + printConsoleErr( "errorCode : %d", FS_GetArchiveResultCode( ERRORLOG_LOGFILE_PATH ) ); + + return FALSE; + } + + printConsole( "Delete Succeeded." ); + return TRUE; +} + +static BOOL copyLogToSD( void ) +{ + FSFile src, dst; + // 書き込みサイズは、最悪で読み込んだサイズの倍のになる可能性がある + BOOL result = TRUE; + int idxlog; + int sizelog; + char buf[BUFSIZE + 1]; + char winbuf[BUFSIZE*2 +1]; + s32 readSize; + s32 writeSize = 0; + char filename[BUFSIZE+1]; + u8 *lcfgbuf; + u8 serial[OS_TWL_HWINFO_SERIALNO_LEN_MAX]; + + buf[BUFSIZE] = '\0'; + + FS_InitFile( &dst ); + printConsole("Reading serial number..."); + lcfgbuf = OS_Alloc( LCFG_READ_TEMP ); + + if( LCFG_ReadTWLSettings( (u8 (*)[LCFG_READ_TEMP]) lcfgbuf ) && LCFG_ReadHWSecureInfo() ) + { + LCFG_THW_GetSerialNo( (u8*)serial ); + STD_TSNPrintf( filename , BUFSIZE, "sdmc:/%s.log", serial); + } + else + { + printConsoleErr( "failed to read Serial."); + return FALSE; + } + + + + // まずファイルを削除 + FS_DeleteFile( filename ); + + if( ! FS_CreateFile( filename, FS_PERMIT_R | FS_PERMIT_W ) ) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_CreateFile" ); + printConsoleErr( "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + + // ファイル作成に成功 + if( !FS_OpenFileEx( &dst , filename, FS_FILEMODE_RW )) + { + // 作成したファイルをopenできなかった場合 + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_OpenFile / FS_SetFileLength" ); + printConsoleErr( "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + + // サイズ変更が終わったら、念のためファイルサイズ変更不可なRWLモードで開きなおしておく + // →改行文字の置換やログの置換に伴いファイルサイズ可変長に変更 + /* + FS_CloseFile( &dst ); + + if( !FS_OpenFileEx( &dst, DST_LOGFILE_PATH, FS_FILEMODE_RW ) ) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_OpenFile dst" ); + printConsoleErr( "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + */ + if( !FS_OpenFileEx( &src, ERRORLOG_LOGFILE_PATH, FS_FILEMODE_R ) ) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_OpenFile src" ); + printConsoleErr( "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + result = FALSE; + goto ERRORPATH; + } + + if( !FS_SeekFileToBegin( &src )) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_SeekFileToBegin" ); + result = FALSE; + goto ERRORPATH; + } + + sizelog = ERRORLOG_GetNum(); + idxlog = 0; + while( ( readSize = FS_ReadFile( &src, buf, 256 )) > 0 && + idxlog < sizelog ) + { + int size; + const ErrorLogEntry *entry = ERRORLOG_Read( idxlog++ ); + u64 errorcode; + + // 改行文字を置換しておく + size = convertLF( winbuf, buf ); + + if( FS_WriteFile( &dst, winbuf, size ) < 0 ) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_WriteFile" ); + result = FALSE; + goto ERRORPATH; + } + + // 最上位ビットが立っていたらマッチングしてない + if(!((errorcode = parseRedError(entry)) & (0x1ULL << 63))) + { + if(!putRedError(&dst, errorcode)) + { + result = FALSE; + goto ERRORPATH; + } + } + + } + +ERRORPATH: + + if( !FS_CloseFile( &src )) + { + printConsoleErr( "Copy Failed!" ); + printConsoleErr( "func: FS_CloseFile(src)" ); + } + + + if( !FS_CloseFile( &dst )) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_CloseFile(dst)" ); + } + printConsole( "Copy Succeeded." ); + + return result; + +} + +// ログファイルの書き出しが終わった後に、ROMの指定された位置に格納されたnandfirmを本体に書き戻す +static BOOL writebackFirm( void ) +{ + u8 *pBuf; + u32 allocSize; + u32 fileSize = (u32)(&nandfirm_end) - (u32)(&nandfirm_begin); + u32 nandfirmSize = fileSize - NANDFIRM_FILE_START_OFFSET; + u32 writeBlock; + + if( 800*1024 < fileSize ) + { + printConsoleErr( "too large file size." ); + return FALSE; + } + + // 書き込みサイズは512バイトのブロック単位なのでそれに配慮 + allocSize = MATH_ROUNDUP(fileSize, 512); + printConsole( "fileBegin: %08x", &nandfirm_begin ); + printConsole( "fileEnd: %08x", &nandfirm_end ); + printConsole( "fileSize: %08x", fileSize ); + printConsole( "allocsize: %08x", allocSize ); + pBuf = OS_Alloc(allocSize); + if(pBuf == NULL) + { + printConsoleErr( "Alloc failed." ); + return FALSE; + } + + // データの読み出し + MI_CpuClear8(pBuf, allocSize); + DC_FlushRange(pBuf, allocSize); + MI_CpuCopy8( &nandfirm_begin, pBuf, fileSize); + printConsole( "read firm succeeded." ); + //CARD_ReadRom( MI_DMA_NOT_USE, nandfirm_begin, pBuf, fileSize); + + // データの書き出し + writeBlock = nandfirmSize/NAND_BLOCK_BYTE + (nandfirmSize % NAND_BLOCK_BYTE != 0); + printConsole( "Blocksize : %08x", writeBlock ); + DC_FlushRange(pBuf, allocSize); + printConsole( "nandfirm writing..." ); + kamiNandWrite( NAND_START_OFFSET/NAND_BLOCK_BYTE, pBuf+NANDFIRM_FILE_START_OFFSET, writeBlock); + // まだ書き込まないで出力だけする + printConsole( "write firm succeeded." ); + OS_Free(pBuf); + + return TRUE; +} +static void drawMenu( void ) +{ + lineoffset = 0; + ClearScreen(); +/* printConsole( "SystemLog Reader" ); + printConsole( "+-----------------------------+" ); + printConsole( "l A Button : Copy log to SD l" ); + printConsole( "+-----------------------------+" ); + */ + printConsole( "+--------------------+" ); + printConsole( "l System Log Reader l" ); + printConsole( "+--------------------+" ); + lineoffset++; +} + +// LFをLFCRに置換して書き戻す +// dstは最悪時でsrcの二倍の領域が必要 +int convertLF( char *dst, char *src ) +{ + char *head = src, *tail; + int writesize = 0; + + tail = STD_StrChr( src, '\n' ); + + while( tail != NULL ) + { + *tail = '\0'; + writesize += STD_StrLCpy( &dst[writesize], head,BUFSIZE ); + dst[writesize] = 0x0d; + dst[writesize+1] = 0x0a; + writesize += 2; + + head = tail + 1; + tail = STD_StrChr( head, '\n' ); + } + + writesize += STD_StrLCpy( &dst[writesize], head, BUFSIZE ); + + return writesize; +} + +// RedErrorの類ならエラーコードを、そうでなければ最上位ビットを立てて返す +static u64 parseRedError(const ErrorLogEntry *entry) +{ + u64 errorcode; + + if(entry->isLauncherError) + { + // REDFormatのログだったらそのまま出力すればいいので拒否 + return 0x1ULL << 63; + } + + if (STD_TSScanf(entry->errorStr,"%*s [l.%*d] RED FATAL %16llx (%*16llx)", &errorcode) == 1|| + STD_TSScanf(entry->errorStr,"%*s [l.%*d] BOOT %16llx (%*16llx)", &errorcode) == 1 ) + { + return errorcode; + } + + // マッチしなかった場合 + return 0x1ULL << 63; +} + + +static BOOL putRedError( FSFile *dst, u64 code ) +{ + char buf[BUFSIZE]; + u8 counter = 0; + + // codeのどこかにビットが立っている限りシフトし続ける + while(code) + { + // 末尾のビットが立っていたらcounter番目のエラーが発生している + if( code & 0x1 ) + { + STD_TSNPrintf(buf, BUFSIZE, "err: %s\r\n", FatalErrorCode[counter]); + + if( FS_WriteFile( dst, buf, STD_StrLen(buf) ) < 0 ) + { + printConsoleErr( "Copy Failed." ); + printConsoleErr( "func: FS_WriteFile" ); + return FALSE; + } + } + + counter++; + code >>= 1; + } + + return TRUE; +} +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +static void printConsole(char *text, ...) +{ + va_list arglist; + + va_start( arglist, text); + PrintString( 0, lineoffset++, CONSOLE_WHITE, text, arglist) ; +} + +static void printConsoleErr(char *text, ...) +{ + va_list arglist; + + va_start( arglist, text); + PrintString( 0, lineoffset++, CONSOLE_RED, text, arglist) ; +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSytem init + FS_Init(FS_DMA_NOT_USE); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + +static char * FatalErrorCode[] = { + "FATAL_ERROR_UNDEFINED", + "FATAL_ERROR_NAND", + "FATAL_ERROR_HWINFO_NORMAL", + "FATAL_ERROR_HWINFO_SECURE", + "FATAL_ERROR_TWLSETTINGS", + "FATAL_ERROR_SHARED_FONT", + "FATAL_ERROR_WLANFIRM_AUTH", + "FATAL_ERROR_WLANFIRM_LOAD", + "FATAL_ERROR_TITLE_LOAD_FAILED", + "FATAL_ERROR_TITLE_POINTER_ERROR", + "FATAL_ERROR_AUTHENTICATE_FAILED", + "FATAL_ERROR_ENTRY_ADDRESS_ERROR", + "FATAL_ERROR_TITLE_BOOTTYPE_ERROR", + "FATAL_ERROR_SIGN_DECRYPTION_FAILED", + "FATAL_ERROR_SIGN_COMPARE_FAILED", + "FATAL_ERROR_HEADER_HASH_CALC_FAILED", + "FATAL_ERROR_TITLEID_COMPARE_FAILED", + "FATAL_ERROR_VALID_SIGN_FLAG_OFF", + "FATAL_ERROR_CHECK_TITLE_LAUNCH_RIGHTS_FAILED", + "FATAL_ERROR_MODULE_HASH_CHECK_FAILED", + "FATAL_ERROR_MODULE_HASH_CALC_FAILED", + "FATAL_ERROR_MEDIA_CHECK_FAILED", + "FATAL_ERROR_DL_MAGICCODE_CHECK_FAILED", + "FATAL_ERROR_DL_SIGN_DECRYPTION_FAILED", + "FATAL_ERROR_DL_HASH_CALC_FAILED", + "FATAL_ERROR_DL_SIGN_COMPARE_FAILED", + "FATAL_ERROR_WHITELIST_INITDB_FAILED", + "FATAL_ERROR_WHITELIST_NOTFOUND", + "FATAL_ERROR_DHT_PHASE1_FAILED", + "FATAL_ERROR_DHT_PHASE2_FAILED", + "FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF", + "FATAL_ERROR_TWL_BOOTTYPE_UNKNOWN", + "FATAL_ERROR_NTR_BOOTTYPE_UNKNOWN", + "FATAL_ERROR_PLATFORM_UNKNOWN", + "FATAL_ERROR_LOAD_UNFINISHED", + "FATAL_ERROR_LOAD_OPENFILE_FAILED", + "FATAL_ERROR_LOAD_MEMALLOC_FAILED", + "FATAL_ERROR_LOAD_SEEKFILE_FAILED", + "FATAL_ERROR_LOAD_READHEADER_FAILED", + "FATAL_ERROR_LOAD_LOGOCRC_ERROR", + "FATAL_ERROR_LOAD_READDLSIGN_FAILED", + "FATAL_ERROR_LOAD_RELOCATEINFO_FAILED", + "FATAL_ERROR_LOAD_READMODULE_FAILED", + "FATAL_ERROR_NINTENDO_LOGO_CHECK_FAILED", + "FATAL_ERROR_SYSMENU_VERSION", + "FATAL_ERROR_DHT_PHASE1_CALC_FAILED", + "FATAL_ERROR_LOAD_UNKNOWN_BOOTTYPE", + "FATAL_ERROR_LOAD_AUTH_HEADER_FAILED", + "FATAL_ERROR_LOAD_NEVER_STARTED", + "FATAL_ERROR_EJECT_CARD_AFTER_LOAD_START", + "FATAL_ERROR_TITLEID_COMPARE_FAILED_NTR", +}; + diff --git a/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/screen.c b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/screen.c new file mode 100644 index 00000000..5b7b735e --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/ARM9.TWL/src/screen.c @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/systemMenu_tools/SystemLogReader/Makefile b/build/systemMenu_tools/SystemLogReader/Makefile new file mode 100644 index 00000000..bc9c1ea3 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ../NandInitializerRed/ARM7.TWL \ + ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemLogReader/banner/Makefile b/build/systemMenu_tools/SystemLogReader/banner/Makefile new file mode 100644 index 00000000..01bd65f4 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/systemMenu_tools/SystemLogReader/banner/banner_v3.bsf b/build/systemMenu_tools/SystemLogReader/banner/banner_v3.bsf new file mode 100644 index 00000000..1702579f Binary files /dev/null and b/build/systemMenu_tools/SystemLogReader/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/SystemLogReader/banner/icon/gameicon.bmp b/build/systemMenu_tools/SystemLogReader/banner/icon/gameicon.bmp new file mode 100644 index 00000000..4253022e Binary files /dev/null and b/build/systemMenu_tools/SystemLogReader/banner/icon/gameicon.bmp differ diff --git a/build/systemMenu_tools/SystemLogReader/make.rb b/build/systemMenu_tools/SystemLogReader/make.rb new file mode 100755 index 00000000..c52e6a31 --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/make.rb @@ -0,0 +1,95 @@ +#!ruby +# build TwlIPL Root -> build nandfirm -> convert nandfirm -> +# build systemlogreader -> build gcdfirm +# 実行時引数に"dev"を渡すと開発ビルド(default)、"prod"を渡すと量産ビルドを生成 + +def putex(str) + # puts command and execute + puts "execute : " + str + system str +end + + +def buildgcd(buildtype, prodopt, shortbuild) + puts "buildtype : #{buildtype}" + puts "**shortbuild**" if shortbuild + + unless shortbuild + # build TwlIPL Root + Dir.chdir(ENV['TWL_IPL_RED_ROOT']) do + putex "make -f Makefile.full clean; " + + "makesp CYGPATH_NOCMD=TRUE -j 2 -f Makefile.full TWL_FINALROM=TRUE #{prodopt}" + end + + # build nandfirm + Dir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/nandfirm/menu-launcher") do + putex "make clean; make TWL_FINALROM=TRUE #{prodopt}" + nandfirm = Dir.glob("menu_launcher*#{buildtype}.nand") + if nandfirm.none? + puts "build nandfirm failed." + exit + else + nandfirm = nandfirm[0] + end + + + putex "$TWLSDK_ROOT/tools/bin/bin2obj.TWL.exe #{nandfirm} nandfirm.#{buildtype}.o " + + "-b nandfirm_begin -e nandfirm_end" + putex "cp nandfirm.#{buildtype}.o #{Rootdir}/ARM9.TWL/nandfirm/" + end + end + + # build systemlogreader + putex "makesp CYGPATH_NOCMD=TRUE -j 2 clean; makesp CYGPATH_NOCMD=TRUE -j 2 TWL_FINALROM=TRUE #{prodopt}" + Dir.chdir(Rootdir + "/ARM9.TWL/bin/ARM9-TS.LTD.thumb/Rom") do + if buildtype == "dev" + putex 'cp ./SystemLogReader.srl $TWL_IPL_RED_ROOT/build/gcdfirm/memory-launcher-writer/' + else + # 量産用の場合はsrlにマスタリングをかける + putex "mastering.TWL.exe SystemLogReader.srl SystemLogReader.srl.master -s -t" + putex "cp ./SystemLogReader.srl.master $TWL_IPL_RED_ROOT/build/gcdfirm/memory-launcher-writer/SystemLogReader.srl" + end + end + + # build memory_launcher + Dir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/nandfirm/memory-launcher") do + putex "make clean; make TWL_FINALROM=TRUE #{prodopt}" + end + + # build memorylauncherwriter + Dir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/gcdfirm/memory-launcher-writer") do + putex "make clean; make TWL_FINALROM=TRUE #{prodopt}" + putex "cp ./memory_launcher_writer-FINALROM.gcd " + + "$TWL_IPL_RED_ROOT/build/systemMenu_tools/SystemLogReader/memory_launcher_writer-FINALROM.#{buildtype}.gcd -f" + end +end + + +Rootdir = ENV['TWL_IPL_RED_ROOT'] + '/build/systemMenu_tools/SystemLogReader' +prodopt = "" +shortbuild = false + +# default buildtype = dev +if ARGV.none? || ARGV.include?('dev') + build = ["dev"] + opt = ["FIRM_USE_PRODUCT_KEYS="] +elsif ARGV.include?("prod") + build = ["prod"] + opt = ["FIRM_USE_PRODUCT_KEYS=TRUE"] +elsif ARGV.include? "full" + build = ["dev", "prod"] + opt = ["FIRM_USE_PRODUCT_KEYS=", "FIRM_USE_PRODUCT_KEYS=TRUE"] +else + puts "invalid arguments." + exit +end + +if ARGV.include? "short" + shortbuild = true +end + +p build.zip(opt) +build.zip(opt).each do |b,op| + buildgcd(b,op,shortbuild) +end + diff --git a/build/systemMenu_tools/SystemLogReader/readme.txt b/build/systemMenu_tools/SystemLogReader/readme.txt new file mode 100644 index 00000000..f59bc22b --- /dev/null +++ b/build/systemMenu_tools/SystemLogReader/readme.txt @@ -0,0 +1,153 @@ +SystemLogReader + 2008.11.20 任天堂株式会社 開発技術部 + + + +<概要> + 本ツールは、本体内蔵メモリに格納しているシステムのエラーログをSDカードに取り +出すものです。 + 本ツールは、何らかの不具合によってシステムメニューが起動しない状態になった場 +合でもエラーログを取り出すことができます。但し、下記の場合には、エラーログを取 +り出すことが出来ません。 + ・CPUやメインメモリなど、プログラムの動作にに必須のHWが破損している場合。 + ・NANDのファイルシステム破損している場合。 + ・エラーログファイルが破損している場合。 + + なお、エラーログは、PC上のテキストエディタで確認することができます。 + + + +<構成> +memory_launcher_writer-FINALROM.prod.gcd (SystemLogReadrファイル) + + + +<用意するもの> +・磁石(正常な本体の動作中にXボタン付近の所定位置に配置すると、スリープがかかる + 位の磁力があるもの) +・DSフラッシュカード +・IS-NITRO-DEBUGGER + + + +<使い方> + +1.プログラムの書き込み + 1−1. +  IS-NITRO-DEBUGGERを起動して、「読み込み」コマンドの「BIN」を開き、 +   「読み込み後にリセットを行う」 +   「読み込み後に両方のプロセッサを実行する」 +  のチェックを外します。 + ※IS-TWL-DEBUGGERでは書き込みを行うことができません。 + 1−2. +  memory_launcher_writer-FINALROM.prod.gcdファイルをエミュレーションメモリの +  アドレス0x00000000に読み込みます。 + 1−3. +  DSフラッシュカードをIS-NITRO-DEBUGGERのカードスロットに挿入します。 +  (TWLフラッシュカードへの書き込みはまだサポートされていません。) + 1−4. +  「ツール」−「DSフラッシュカード」を選択し、書き込みサイズを「ユーザー指定」 +  で16MBitに指定して書き込みを行います。 + + + +2.起動 + 2−1. +  1.でSystemLogReaderを書き込んだDSフラッシュカードを本体のカードスロットに +  挿入します。また、SDカードを本体のSDカードスロットに挿入します。 + 2−2. +  磁石を本体Xボタン付近の正常な本体の場合にスリープがかかる位置に配置し、 +  「SELECTボタン+STARTボタン+Xボタン」 +  を押しながら電源投入します。 + 2−3. +  "NAND FIRM WRITER"を経由して"System Log Writer"が起動し、SDカードにエラーロ +  グファイルを出力して停止します。 +  ※起動したプログラム上でエラーログを確認することはできません。 + + + +3.出力ファイル + 「本体シリアルナンバー.log」の形式でSDカードのルートに本体から取り出したエラ +ーログファイルが作成されます。 + なお、本体内蔵メモリの本体シリアルNo.を格納しているファイルが破損していた場合 +は、本体に関係なく「.log」というファイル名となります。 + + + +4.エラーログの内容 + エラーログは、下記のようなフォーマットで最大64個まで格納されています。 + 日付、時刻は本体のRTCの値となるため、エラーが発生した実時間とは一致しない可能 +性があります。 + + |-----------------------------------------------------------------| + |  #FFT 日付[曜日] 時刻 | + |  title: エラーが発生したプログラムのイニシャルコード | + |  エラー内容の詳細 | + |-----------------------------------------------------------------| + + なお、エラーログは、システムメニューが不正なプログラムを起動しようとした際や +無線通信に失敗した際にもログを残すようになっていますので、全てのログが不具合解 +析に有用であるとは限りません。 + + 下記にサービスセンターで有用と思われるエラーログの例を挙げます。 + + + ・無線モジュール不具合 +  #FFT 00-01-29[SAT] 00:02:07 +  title: HNAJ +  menuRedIplManager.cpp [l.466] WLFIRM 2 (00030015484e424a) + + + ・カメラモジュール不具合(下記以外の"CAMERA **"含む) +  #FFT 00-01-01[SAT] 00:12:08 +  title: HNAJ +  menuCameraManager.cpp [l.369] CAMERA INIT 8 + + + ・NAND劣化不具合 +  #FFT 00-01-29[SAT] 00:02:07 +  title: HNAJ +  menuSystem.cpp [l.709] RED FATAL 0000000000000002 (BT 00030015484e424a) + err:FATAL_ERROR_NAND + + + ・本体内蔵メモリのHWノーマル情報破損 +  #FFT 00-01-01[SAT] 00:12:08 +  title: HNAJ +  menuSystem.cpp [l.709] RED FATAL 0000000000000004 (BT 00030015484e424a) +  err:FATAL_ERROR_HWINFO_NORMAL + + + ・本体内蔵メモリのHWセキュア情報破損 +  #FFT 00-01-01[SAT] 00:12:08 +  title: HNAJ +  menuSystem.cpp [l.709] RED FATAL 0000000000000008 (BT 00030015484e424a) +  err:FATAL_ERROR_HWINFO_SECURE + + + ・本体内蔵メモリの本体設定データ破損 +  #FFT 00-01-01[SAT] 00:12:08 +  title: HNAJ +  menuSystem.cpp [l.709] RED FATAL 0000000000000010 (BT 00030015484e424a) +  err:FATAL_ERROR_TWLSETTINGS + + + ・本体内蔵メモリの無線ファームファイル破損 +  #FFT 00-01-01[SAT] 00:12:08 +  title: HNAJ +  menuSystem.cpp [l.709] RED FATAL 0000000000000040 (BT 00030015484e424a) +  err:FATAL_ERROR_WLANFIRM_AUTH + + + ・本体内蔵メモリの共有フォントファイル破損 +  #FFT 00-01-03[MON] 17:56:18 +  title: HNBJ +  stgSystem.cpp [l.704] + + + +=============================================================================== +更新履歴 + +2008.11.20 初版発行 + diff --git a/build/systemMenu_tools/SystemUpdater/ARM7.TWL/Makefile b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/Makefile new file mode 100644 index 00000000..e333b1fc --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/Makefile @@ -0,0 +1,74 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = main.c \ + kami_pxi.c \ + formatter.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCR.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + ../common/include \ + ../../common/ARM7/include + +SRCDIR += ../../common/ARM7/src + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdater/ARM7.TWL/armadillo.lsf b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/armadillo.lsf new file mode 100644 index 00000000..177f5206 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/armadillo.lsf @@ -0,0 +1,86 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a +# Library libwm_sp$(LIBSUFFIX).a +# Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM7.TWL/include/kami_pxi.h b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..cbce8090 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/kami_pxi.c b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..c3caa3f1 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include +#include +#include +#include +#include + +typedef unsigned char byte; /* Don't change */ +typedef unsigned short word; /* Don't change */ +typedef unsigned long dword; /* Don't change */ +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); +extern BOOL sdmcFormatNandLog( BOOL verify_flag); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_CLEAR_NAND_ERRORLOG: + case KAMI_GET_IS_TOOL_TYPE: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_CLEAR_NAND_ERRORLOG: + { + if (sdmcFormatNandLog(TRUE)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_GET_IS_TOOL_TYPE: + { + IsToolType type = IS_TOOL_TYPE_ERROR; + u8 temp = I2C_ReadRegister( I2C_SLAVE_DEBUGGER, 0); + if (temp != (u8)(-1)) // 赤箱、キャプチャ以外は通信エラー + { + if (temp == 0x44) + { + type = IS_TOOL_TYPE_DEBUGGER; + } + else if (temp == 0x43) + { + type = IS_TOOL_TYPE_CAPTURE; + } + } + + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(IsToolType), (u8*)&type); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/main.c b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/main.c new file mode 100644 index 00000000..a68e6750 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM7.TWL/src/main.c @@ -0,0 +1,576 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "kami_pxi.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM 3 + +/* カードチャタリングカウンタ */ +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA + FS_Init(FS_DMA_NOT_USE); // FS for CARD + FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS +// InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + CDC_InitLib(); // CODECライブラリ初期化 + CAMERA_Init(); // カメラ + + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC +// WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + +/////////////// +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); +#endif +/////////////// + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} + +//#ifdef WM_PRECALC_ALLOWEDCHANNEL +//extern u16 WMSP_GetAllowedChannel(u16 bitField); +//#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } +/* +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +*/ +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..35e3fba0 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile new file mode 100644 index 00000000..0d9dd0cc --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/Makefile @@ -0,0 +1,124 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ + +# COMPILE SWITCH for build SystemUpdater +IGNORE_VERSION_CHECK ?= FALSE + +# MAKEROM SWITCH for build SystemUpdater +SYSM_DISABLE_DEBUG ?= TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0SUA +#TARGET_TAD = + +TARGET_BIN = SystemUpdater.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + font_data.c \ + graphics.c \ + kami_font.c \ + import.c \ + hwi.c \ + kami_pxi.c \ + kami_write_nandfirm.c \ + hw_info.c \ + keypad.c \ + kami_copy_file.c \ + debugger_hw_reset_control.c \ + debugger_card_rom.c + +LINCLUDES = include \ + ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + $(ROOT)/build/libraries/fs/common/include \ + ../../common/ARM9/include + +SRCDIR = src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +ifeq ($(IGNORE_VERSION_CHECK),TRUE) +MACRO_FLAGS += -DIGNORE_VERSION_CHECK +endif + + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/graphics.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..f76dfeb1 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/graphics.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawResult(BOOL result); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/hw_info.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/hw_info.h new file mode 100644 index 00000000..1c43c56e --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/hw_info.h @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------* + 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 HW_INFO_H_ +#define HW_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + wirelessForceOff : 無線強制OFFならTRUEを指定 + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ); + + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL DeleteHWInfoFile( void ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h new file mode 100644 index 00000000..8c04f1f6 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/import.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: 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 + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +s32 kamiImportTad(int no, int total, const char* path); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_IMPORT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h new file mode 100644 index 00000000..73d3cc67 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_copy_file.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: kami_copy_file.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_COPY_FILE_H_ +#define KAMI_COPY_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +#define WRAP_DATA_FILE_PATH_IN_NAND "nand:/shared2/launcher/wrap.bin" + +BOOL kamiCopyFile(char* srcPath, char* dstPath); +BOOL kamiWriteWrapData(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_COPY_FILE_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_font.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..ad5095e2 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_font.h @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_pxi.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..c05de9d4 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiClearNandErrorLog( void ); +KAMIResult kamiGetIsToolType( IsToolType *pType ); + +// (重要) +// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。 +// +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h new file mode 100644 index 00000000..90fe68bd --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/SystemUpdater/ARM9.TWL/include/keypad.h b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf new file mode 100644 index 00000000..94516096 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/main.rsf @@ -0,0 +1,230 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: main.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + # ========= SystemUpdaterは特別な鍵を使う ========= + #CommonClientKey TRUE + CommonClientKeyForDebugger TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(UPDATER_HOST_ROOT_DIR) + Root /data + File HNAA.tad HNBA.tad HNCA.tad HNHA.tad HNLA.tad \ + menu_launcher.nand TWLFontTable.dat cert.sys + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/font_data.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..54031a91 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/graphics.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..0064e83d --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/graphics.c @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(3); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuad + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fey, 0); + + G3_Color( color ); + G3_Vtx(fsx, fey, 0); + } + G3_End(); +} + diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c new file mode 100644 index 00000000..de37e203 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: 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 "hwi.h" +#include "hw_info.h" +// +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +// +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +BOOL WriteHWNormalInfoFile( void ); +BOOL WriteHWSecureInfoFile( u8 region ); +BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) +{ + static const char *pMsgSecureWriting = "Writing Secure File..."; + static const char *pMsgNormalWriting = "Writing Normal File..."; + static const char *pMsgSignWriting = "Writing Sign File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + u32 installedSoftBoxCount = 0; + BOOL result = TRUE; + + // セキュアファイルのライト + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff, FALSE ) ) { // とりあえず無線は有効で。 +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む) + if( HWI_WriteHWNormalInfoFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // HWID署名ファイルのライト + if( HWI_WriteHWIDSignFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // CFGデータの修正 + if (!HWI_ModifyLanguage( region )) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" ); + result = FALSE; + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL DeleteHWInfoFile( void ) +{ + static const char *pMsgNormalDeleting = "Deleting Normal File..."; + static const char *pMsgSecureDeleting = "Deteting Secure File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + BOOL result = TRUE; + + // ノーマルファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting ); + if( HWI_DeleteHWSecureInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + return result; +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c new file mode 100644 index 00000000..b422e173 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/import.c @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_import.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 "import.h" +#include "hw_info.h" +#include "TWLHWInfo_api.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define THREAD_STACK_SIZE (16*1024) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u32 sCurrentProgress; +static vu8 sNowImport = FALSE; +static vu8 sProgress = FALSE; +static u8 sStack[THREAD_STACK_SIZE]; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* arg); +static void Destructor(void* arg); +void ProgressDraw(f32 ratio); + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: kamiImportTad + + Description: .tad ファイルインポート + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ + +s32 kamiImportTad(int no, int total, const char* path) +{ + NAMTadInfo tadInfo; + OSThread thread; + s32 nam_result; + + kamiFontPrintfMain( 4, 9, 8, "Now Updating... %d / %d", no, total ); + kamiFontLoadScreenData(); + + // tadファイルの情報取得 + nam_result = NAM_ReadTadInfo(&tadInfo, path); + if ( nam_result != NAM_OK ) + { + return nam_result; + } + + // 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; + + // 進捗スレッド作成 + MI_CpuClear8(sStack, THREAD_STACK_SIZE); + OS_CreateThread(&thread, ProgressThread, NULL, + (void*)((u32)sStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_GetCurrentThread()->priority - 1); + OS_WakeupThreadDirect(&thread); + + // Import開始 + nam_result = NAM_ImportTad( path ); + + // インポート開始フラグを下げる + sNowImport = FALSE; + + // 進捗スレッドの自力終了を待つ + while (sProgress){}; + + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + (void)NAMUT_UpdateSoftBoxCount(); + + return nam_result; +} + +/*---------------------------------------------------------------------------* + Name: ProgressThread + + Description: .tad ファイルインポートの進捗を表示するスレッド。 + 進捗が100%に達すると処理を抜ける。 + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* /*arg*/) +{ + u32 currentSize; + u32 totalSize = 0; + u32 totalSizeBk = 0; + + sProgress = TRUE; + + while (sNowImport) + { + 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(); + } + + sProgress = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: ProgressDraw + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ + +void ProgressDraw(f32 ratio) +{ + s16 x = (s16)(30 + (226 - 30)*ratio); + + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // グリーンバー + DrawQuad( 30, 90, x, 95, GX_RGB(12, 25, 12)); + + // グレーバー + DrawQuad( 30, 90, 226, 95, GX_RGB(28, 28, 28)); + + // グレーダイアログ + DrawQuad( 20, 60, 236, 110, GX_RGB(25, 25, 25)); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c new file mode 100644 index 00000000..899f3a56 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_copy_file.c @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_copy_file.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_copy_file.h" + +/*---------------------------------------------------------------------------* + マクロ + *---------------------------------------------------------------------------*/ + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +BOOL kamiCopyFile(char* srcPath, char* dstPath) +{ + 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, srcPath); + if (!open_is_ok) + { + OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath); + 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", srcPath); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ROMファイルクローズ + FS_CloseFile(&file); + + // 一旦対象データを削除する +// (void)FS_DeleteFile(dstPath); + + // ターゲットファイル作成 + if (!FS_CreateFileAuto(dstPath, FS_PERMIT_R | FS_PERMIT_W)) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath); + result = FALSE; + } + else + { + // ターゲットファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W); + if (!open_is_ok) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath); + result = FALSE; + } + // ターゲットファイルへ書き込み + 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; +} + +// ダミーのDSメニューラッピング用ファイル作成(UIGランチャーが作っているもの) +BOOL kamiWriteWrapData(void) +{ + FSFile file; + BOOL open_is_ok; + const int FATFS_CLUSTER_SIZE = 16 * 1024; + + // 既に存在するなら何もしない + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, WRAP_DATA_FILE_PATH_IN_NAND); + if (open_is_ok) + { + FS_CloseFile(&file); + OS_Printf("%s is already exist.\n", WRAP_DATA_FILE_PATH_IN_NAND); + return TRUE; + } + + if( FS_CreateFileAuto( WRAP_DATA_FILE_PATH_IN_NAND, FS_PERMIT_R | FS_PERMIT_W ) ) + { + FSFile file; + if( FS_OpenFileEx( &file, WRAP_DATA_FILE_PATH_IN_NAND, FS_FILEMODE_RW ) ) + { + (void)FS_SetFileLength( &file, FATFS_CLUSTER_SIZE ); + FS_CloseFile( &file ); + return TRUE; + } + } + + return FALSE; +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_font.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..fb3818b6 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_pxi.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..f3ce7f2a --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,370 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0)) + { + return; + } +} + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 12, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiClearNandErrorLog + + Description: NVRAMのNANDエラー情報をクリアします。 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiClearNandErrorLog( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetIsToolType + + Description: IS-TWL-DEBUGGER or CAPTURE を取得します(同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetIsToolType( IsToolType *pType ) +{ + OSIntrMode enabled; + + if (pType == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pType; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_IS_TOOL_TYPE, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + PXI関連 + *---------------------------------------------------------------------------*/ + +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c new file mode 100644 index 00000000..cac9c5ee --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c @@ -0,0 +1,332 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/SystemUpdater/ARM9.TWL/src/keypad.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c new file mode 100644 index 00000000..30f7d5be --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/main.c @@ -0,0 +1,783 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: main.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 // atoi +#include +#include +#include +#include +#include +#include +#include "kami_pxi.h" +#include "kami_font.h" +#include "kami_write_nandfirm.h" +#include "kami_copy_file.h" +#include "import.h" +#include "hw_info.h" +#include "graphics.h" +#include "hwi.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" + +#define SCRAMBLE_MASK 0x00406000 + +extern const char *g_strIPLSvnRevision; +extern const char *g_strSDKSvnRevision; + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _SystemUpdaterLog +{ + int magic_code; + int sdk_version; + int ipl_version; + int reserve[5]; +} SystemUpdaterLog; + +typedef struct _CopyFileList +{ + char* srcPath; + char* dstPath; +} CopyFileList; + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log" +#define NAND_FIRM_PATH_IN_ROM "rom:/data/menu_launcher.nand" + +#define SYSTEM_UPDATER_MAGIC_CODE 44001111 + +// リトライ回数 +#define MAX_RETRY_COUNT 2 + +static const char* ImportTadFileList[] = +{ + "rom:/data/HNAA.tad", + "rom:/data/HNBA.tad", + "rom:/data/HNCA.tad", + "rom:/data/HNHA.tad", + "rom:/data/HNLA.tad", +}; + +static const CopyFileList sCopyFileList[] = +{ + { "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" }, + { "rom:/data/cert.sys", "nand:/sys/cert.sys" } +}; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static NAMTitleId titleId; +static s16 printLine; +static vu8 sIsFormatFinish; +static u8 sFormatResult; +static s32 sLockId; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); +static BOOL IgnoreRemoval(void); +static void DrawWaitButtonA(void); +static void DrawInvalidConsole(void); +static void DrawCancel(void); +static void DrawAlready(SystemUpdaterLog* log); +static void DrawResult(BOOL result); +static void FormatCallback(KAMIResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + BOOL result; + BOOL hw_info_result; + BOOL nand_firm_result; + int tadNum; + int i,j; + + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitThread(); + OS_InitTick(); + OS_InitAlarm(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + TP_Init(); + RTC_Init(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + InitAllocation(); + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); // SoftBoxCountの計算に必要 + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + // メインスレッドのカードロックID取得 + sLockId = OS_GetLockID(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // コンソールチェック + { + u32 console = OS_GetRunningConsoleType(); + enum { IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN }; + int running = UNKNOWN; + BOOL isAdapter; + u16 batLevel; + + // SystemUpdaterはデバッグ不可で作成されるためOS_CONSOLE_TWLが取得される + // 赤箱にカードを挿してSystemUpdaterを実行した場合も同様(但しOS_CONSOLE_TWLTYPE_RETAILにはならない) + // デバッガかどうかの判定はメモリサイズチェックにより行う + // 念のためOS_CONSOLE_TWLTYPE_RETAILでないことも確認する + + if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB) + { + if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_DEBUGGER) + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_ERROR) // TSボードプラス + 旧仕様デバッガ + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + } + } + else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + else + { + running = TWL; + } + } + + switch (running) + { + case IS_TWL_DEBUGGER: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER."); + break; + case IS_TWL_CAPTURE: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE."); + break; + case TWL: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on TWL CONSOLE."); + break; + case UNKNOWN: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on UNKNOWN."); + break; + } + +#ifdef SYSM_BUILD_FOR_DEBUGGER + // デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない + if (running != IS_TWL_DEBUGGER) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on TWL-CONSOLE. "); + DrawInvalidConsole(); + } +#else + // 実機向けSystemUpdaterはデバッガでは動作させない + if (running == IS_TWL_DEBUGGER) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on IS-TWL-DEBUGGER."); + DrawInvalidConsole(); + } +#endif // SYSM_BUILD_FOR_DEBUGGER + + // UNKNOWNは動作させない + if (running == UNKNOWN) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on UNKNOWN CONSOLE."); + DrawInvalidConsole(); + } + + // 電池残量が少なければ動作させない + while (PM_GetBatteryLevel( &batLevel ) != PM_RESULT_SUCCESS) + { + OS_Sleep(1); + } + while (PM_GetACAdapter( &isAdapter ) != PM_RESULT_SUCCESS) + { + OS_Sleep(1); + } + if (((batLevel <= 2) && ! isAdapter) || + (batLevel <= 1)) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute if battery is low. "); + DrawInvalidConsole(); + } + } + + // (更新可能条件) + // 1.ログが存在しない + // 2.ログが存在し、ログに記載のマジックコードが不正(初版SystemUpdater実行後の状態) + // 2.ログが存在し、ログに記載のマジックコードが正しくかつログに記載の + // SDK & IPL のバージョンが SystemUpdater のそれ以下である + +#ifdef IGNORE_VERSION_CHECK + if( 0 ) +#endif // IGNORE_VERSION_CHECK + { + SystemUpdaterLog log; + FSFile file; + FS_InitFile( &file ); + + if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_R) == TRUE) + { + DC_InvalidateRange(&log, sizeof(log)); + + if (FS_ReadFile(&file, &log, sizeof(log)) == sizeof(log)) + { + // ログリード成功 + OS_Printf("[%d, %d]\n", log.sdk_version, log.ipl_version); + + // 初版SystemUpdater実行状態でないことをマジックコードで判別する + if (log.magic_code == SYSTEM_UPDATER_MAGIC_CODE) + { + // マジックコード、SDKバージョン、IPLバージョンの確認 + if (log.sdk_version > atoi(g_strSDKSvnRevision) || + log.ipl_version > atoi(g_strIPLSvnRevision)) + { + // 更新不可 + DrawAlready(&log); + } + } + } + else + { + // ログリード失敗 + OS_Warning("Failure! FS_ReadFile"); + } + + FS_CloseFile(&file); + } + } + + // Aボタン待ち + DrawWaitButtonA(); + + // TWLの更新処理を実行中です + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE); + CARD_UnlockRom((u16)sLockId); + + // ISデバッガのハードウェアリセットを禁止する + DEBUGGER_HwResetDisable(); + + // HWInfo関連の前準備 + switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) + { + case HWI_INIT_FAILURE: + OS_Warning(" Fail! : HWI_INIT()"); + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + break; + } + + result = TRUE; + + // フォーマット実行 + sIsFormatFinish = FALSE; + ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback); + kamiFontPrintfMain( 7, 11, 8, "Now Format..."); + while(!sIsFormatFinish){}; + if (sFormatResult) + { + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "NAND Format Success."); + } + else + { + kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "NAND Format Failure!"); + } + kamiFontPrintfMain( 7, 11, 8, " "); + + // フォーマット後はESに必要なファイルがなくなっているため + // ES_InitLibを呼び出すことで作成しておく + NAM_End( NULL, NULL ); + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + + // 全ハードウェア情報の更新 + for (i=0;isdk_version, log->ipl_version ); + kamiFontPrintfMain( 3, 13, 1, "--------------------------"); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28)); + + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + + OS_WaitVBlankIntr(); + } +} + +/*---------------------------------------------------------------------------* + Name: DrawResult + + Description: 処理結果を表示します。 + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DrawResult(BOOL result) +{ + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // "Now Updating.." を消去 + kamiFontPrintfMain( 0, 9, 7, " "); + + if (result) + { + kamiFontPrintfMain( 9, 10, 7, "Update Success!"); + // グリーンダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12)); + } + else + { + kamiFontPrintfMain( 9, 10, 7, "Update Failure!"); + // レッドダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0)); + } + + kamiFontLoadScreenData(); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} + +/*---------------------------------------------------------------------------* + Name: FormatCallback + + Description: フォーマットコールバック + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void FormatCallback(KAMIResult result, void* /*arg*/) +{ + if ( result == KAMI_RESULT_SUCCESS_TRUE ) + { + sFormatResult = TRUE; + } + else + { + sFormatResult = FALSE; + } + + sIsFormatFinish = TRUE; +} diff --git a/build/systemMenu_tools/SystemUpdater/Makefile b/build/systemMenu_tools/SystemUpdater/Makefile new file mode 100644 index 00000000..25273783 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/Makefile @@ -0,0 +1,78 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher +MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings +WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm +DS_HASH_TABLE = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/DSHashTable +SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont +NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher + +# systemMenuデータの作成をスキップする場合はTRUEを指定 +SKIP_CREATE_DATA = FALSE +# 実際に書き込みたいファイルの置かれているdataフォルダを指定(絶対パスorARM9/からの相対パス) +export UPDATER_HOST_ROOT_DIR = ../data + +ifeq ($(SKIP_CREATE_DATA),FALSE) +SUBDIRS = $(LAUNCHER_DIR) \ + $(MACHINESETTINGS_DIR) \ + $(WLANFIRM_DIR) \ + $(DS_HASH_TABLE) \ + $(SHARED_FONT_DIR) \ + $(NANDFIRM_DIR) \ + data \ + banner \ + ARM7.TWL \ + ARM9.TWL +else +SUBDIRS = banner \ + ARM7.TWL \ + ARM9.TWL +endif + +# COMPILE SWITCH for build SystemMenu + +export SYSM_UPDATER_RELEASE = TRUE + +export SYSM_DO_NOT_SHOW_LAUNCHER = TRUE +export SYSM_DISABLE_WDS_SCAN = FALSE +export SYSM_IGNORE_WLFIRM_SIGNCHECK = FALSE +export SYSM_DISABLE_WLFIRM_LOAD = FALSE +export SYSM_DISABLE_INITIAL_SETTINGS = TRUE +export SYSM_OUTSIDE_UI = TRUE + +export SYSM_DEV_WHITELIST_CHECK_SKIP = TRUE + +export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE + +# MAKEROM SWITCH for build SystemMenu +export SYSM_DISABLE_DEBUG = TRUE +export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdater/banner/Makefile b/build/systemMenu_tools/SystemUpdater/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/SystemUpdater/banner/banner_v3.bsf b/build/systemMenu_tools/SystemUpdater/banner/banner_v3.bsf new file mode 100644 index 00000000..d1c48580 Binary files /dev/null and b/build/systemMenu_tools/SystemUpdater/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/SystemUpdater/banner/icon/gameIcon.bmp b/build/systemMenu_tools/SystemUpdater/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..7bba6103 Binary files /dev/null and b/build/systemMenu_tools/SystemUpdater/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/SystemUpdater/common/include/fifo.h b/build/systemMenu_tools/SystemUpdater/common/include/fifo.h new file mode 100644 index 00000000..892475dd --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/common/include/fifo.h @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater - include + File: fifo.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 TWL_KAMI_TEST_FIFO_H_ +#define TWL_KAMI_TEST_FIFO_H_ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + + +typedef enum KamiCommand +{ + KAMI_TEST_COMMAND, + KAMI_EXE_FORMAT, + KAMI_NAND_IO, + KAMI_CLEAR_NAND_ERRORLOG, + KAMI_GET_IS_TOOL_TYPE +} +KamiCommand; + +typedef enum _IsToolType +{ + IS_TOOL_TYPE_ERROR, + IS_TOOL_TYPE_DEBUGGER, + IS_TOOL_TYPE_CAPTURE +} +IsToolType; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdater/data/Makefile b/build/systemMenu_tools/SystemUpdater/data/Makefile new file mode 100644 index 00000000..1b28da31 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdater/data/Makefile @@ -0,0 +1,88 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TWL_ARCHGEN = LIMITED + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(SYSMENU_ROOT)/build/systemMenu_RED/wlanfirm/commondefs.wlanfirm +include $(SYSMENU_ROOT)/build/systemMenu_RED/DSHashTable/commondefs.DSHashTable +include $(SYSMENU_ROOT)/build/systemMenu_RED/sysmenuVersion/commondefs.sysmenuVersion +include $(SYSMENU_ROOT)/build/systemMenu_RED/sysmenuVersion/defs.sysmenuVersion.A + +# SystemUpdaterでインポートするTADは専用のmaketadでTAD化します。 +MAKETAD := $(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/maketad.updater.exe + +MAKETAD_OPTION += -s + +#---------------------------------------------------------------------------- + +LDIRT_CLEAN = HNAA.tad \ + HNBA.tad \ + HNCA.tad \ + HNHA.tad \ + HNLA.tad \ + menu_launcher.nand \ + TWLFontTable.dat \ + properties + +#---------------------------------------------------------------------------- + +IPL_REVISION := $(shell LANG=C svn info $(call empath,$(FIRM_ROOT)) | grep 'Revision' | sed s/[^0-9]//g) +SDK_REVISION := $(shell LANG=C svn info $(call empath,$(ROOT)) | grep 'Revision' | sed s/[^0-9]//g) + +ifeq ($(FIRM_USE_PRODUCT_KEYS),TRUE) +FIRM_MODE = prod +else +FIRM_MODE = dev +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : HNAA.tad \ + HNBA.tad \ + HNCA.tad \ + HNHA.tad \ + HNLA.tad \ + menu_launcher.nand \ + TWLFontTable.dat + +# maketad.updaterで作られたTADが他のフォルダに残らないように、ここでTAD化処理する。 + +HNAA.tad: ../../../systemMenu_RED/Launcher/ARM9/bin/$(TWL_BUILDARCH_ARM9)/$(TWL_BUILD_DIR)/HNAA.nand.srl + $(MAKETAD) $< $(MAKETAD_OPTION) -o $@ + +HNBA.tad: ../../../systemMenu_RED/MachineSettings/ARM9/bin/$(TWL_BUILDARCH_ARM9)/$(TWL_BUILD_DIR)/HNBA.nand.srl + $(MAKETAD) $< $(MAKETAD_OPTION) -o $@ + +HNCA.tad: $(MY_WLANFIRM) + $(MAKETAD) $(call empath,$<) $(WLANFIRM_MAKETAD_OPTION) -o $@ + +HNHA.tad: $(DS_HASH_TABLE_DATA) + $(MAKETAD) $(call empath,$<) $(DS_HASH_TABLE_MAKETAD_OPTION) -o $@ + +HNLA.tad: $(SYSMENU_VERSION_DIR)/$(SYSMENU_VERSION_FILE) + $(MAKETAD) $(call empath,$<) $(SYSMENU_VERSION_MAKETAD_OPTION) -o $@ + +menu_launcher.nand: ../../../nandfirm/menu-launcher/menu_launcher-$(TWL_BUILD_TYPE)-$(IPL_REVISION)-$(SDK_REVISION).$(FIRM_MODE).nand + cp $< ./$@ + +TWLFontTable.dat: ../../../systemMenu_RED/sharedFont/TWLFontTable_????????.dat + cp $< ./$@ + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdater/data/cert.sys b/build/systemMenu_tools/SystemUpdater/data/cert.sys new file mode 100644 index 00000000..3d40f56a Binary files /dev/null and b/build/systemMenu_tools/SystemUpdater/data/cert.sys differ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/Makefile b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/Makefile new file mode 100644 index 00000000..e333b1fc --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/Makefile @@ -0,0 +1,74 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = main.c \ + kami_pxi.c \ + formatter.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCR.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + ../common/include \ + ../../common/ARM7/include + +SRCDIR += ../../common/ARM7/src + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/armadillo.lsf b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/armadillo.lsf new file mode 100644 index 00000000..177f5206 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/armadillo.lsf @@ -0,0 +1,86 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a +# Library libwm_sp$(LIBSUFFIX).a +# Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/include/kami_pxi.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..cbce8090 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/kami_pxi.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..c3caa3f1 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include +#include +#include +#include +#include + +typedef unsigned char byte; /* Don't change */ +typedef unsigned short word; /* Don't change */ +typedef unsigned long dword; /* Don't change */ +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); +extern BOOL sdmcFormatNandLog( BOOL verify_flag); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_CLEAR_NAND_ERRORLOG: + case KAMI_GET_IS_TOOL_TYPE: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_CLEAR_NAND_ERRORLOG: + { + if (sdmcFormatNandLog(TRUE)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_GET_IS_TOOL_TYPE: + { + IsToolType type = IS_TOOL_TYPE_ERROR; + u8 temp = I2C_ReadRegister( I2C_SLAVE_DEBUGGER, 0); + if (temp != (u8)(-1)) // 赤箱、キャプチャ以外は通信エラー + { + if (temp == 0x44) + { + type = IS_TOOL_TYPE_DEBUGGER; + } + else if (temp == 0x43) + { + type = IS_TOOL_TYPE_CAPTURE; + } + } + + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(IsToolType), (u8*)&type); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/main.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/main.c new file mode 100644 index 00000000..a68e6750 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM7.TWL/src/main.c @@ -0,0 +1,576 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "kami_pxi.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM 3 + +/* カードチャタリングカウンタ */ +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA + FS_Init(FS_DMA_NOT_USE); // FS for CARD + FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS +// InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + CDC_InitLib(); // CODECライブラリ初期化 + CAMERA_Init(); // カメラ + + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC +// WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + +/////////////// +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); +#endif +/////////////// + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} + +//#ifdef WM_PRECALC_ALLOWEDCHANNEL +//extern u16 WMSP_GetAllowedChannel(u16 bitField); +//#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } +/* +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +*/ +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/ARM9-TS.lsf b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..35e3fba0 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/Makefile b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/Makefile new file mode 100644 index 00000000..d57914a5 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/Makefile @@ -0,0 +1,187 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#TWL_NANDAPP = TRUE + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ + +# SystemMenuファイルの置かれているフォルダを指定(相対もしくは絶対) +UPDATER_HOST_ROOT_DIR = ./v1_3 + +# JPリージョンしか選択できなくする場合はTRUEを指定 +JP_REGION_ONLY ?= FALSE + +# 中韓リージョンを選択できなくする場合はTRUEを指定 +DISABLE_CK_REGION ?= TRUE + +# COMPILE SWITCH for build SystemUpdater(TRUEにすると、ダミーdev.kpを生成しないようになります。) +FOR_LOTCHECK ?= FALSE + +# COMPILE SWITCH for build SystemUpdater +IGNORE_VERSION_CHECK ?= FALSE +SKIP_WRITE_HWINFO ?= FALSE +USE_NORMAL_COMMON_KEY ?= FALSE + +# MAKEROM SWITCH for build SystemUpdater +SYSM_DISABLE_DEBUG ?= TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0SUA +#TARGET_TAD = + +TARGET_BIN = SystemUpdater.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + font.c \ + font_data.c \ + graphics.c \ + kami_font.c \ + hwi.c \ + kami_pxi.c \ + kami_write_nandfirm.c \ + hw_info.c \ + keypad.c \ + kami_copy_file.c \ + debugger_hw_reset_control.c \ + debugger_card_rom.c \ + process_select_region.c \ + process_cancel.c \ + process_check_log.c \ + process_note.c \ + process_check_console.c \ + process_format.c \ + process_hwinfo.c \ + process_log.c \ + process_finish.c \ + process_import.c \ + process_write_font.c \ + process_write_cert.c \ + process_write_dummy.c \ + process_nandfirm.c \ + process_namut_format.c \ + process_delete_other_region_sysmenu.c \ + fade.c \ + sort_title.c + +LINCLUDES = include \ + ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + $(ROOT)/build/libraries/fs/common/include \ + ../../common/ARM9/include + +SRCDIR = src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifeq ($(SKIP_WRITE_HWINFO),TRUE) +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='' \ + -DHWID_PRIVKEY='' +else +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif +endif + +ifeq ($(JP_REGION_ONLY),TRUE) +MACRO_FLAGS += -DJP_REGION_ONLY +endif + +ifeq ($(DISABLE_CK_REGION),TRUE) +MACRO_FLAGS += -DDISABLE_CK_REGION +endif + +ifeq ($(FOR_LOTCHECK),TRUE) +MACRO_FLAGS += -DFOR_LOTCHECK +endif + +ifeq ($(IGNORE_VERSION_CHECK),TRUE) +MACRO_FLAGS += -DIGNORE_VERSION_CHECK +endif + +ifeq ($(SKIP_WRITE_HWINFO),TRUE) +MACRO_FLAGS += -DSKIP_WRITE_HWINFO +endif + +ifeq ($(USE_NORMAL_COMMON_KEY),TRUE) +MAKEROM_FLAGS += -DComClientKey='TRUE' \ + -DComClientKeyDebugger='FALSE' +else +MAKEROM_FLAGS += -DComClientKey='FALSE' \ + -DComClientKeyDebugger='TRUE' +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' \ + -DUPDATER_HOST_ROOT_DIR='$(UPDATER_HOST_ROOT_DIR)' + +MAKETAD_OPTION += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/font.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/font.h new file mode 100644 index 00000000..1bf23fb5 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/font.h @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_NNS_FONT_H_ +#define KAMI_NNS_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include +#include +#include +#include +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +// 文字列描画関数が扱う文字をUnicodeにする +#define NNS_G2D_UNICODE + +#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位) +#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位) +#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位) +#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位) + +#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位) +#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位) + +#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号 + +// DrawText での左上寄せ +#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +// TXTColorPalette の色名 16色パレットへのロードを想定 +enum +{ + // パレット0 TXT_CPALETTE_MAIN + TXT_COLOR_WHITE=0, // 0 + TXT_COLOR_BLACK, // 1 + TXT_COLOR_GREEN, // 2 + TXT_COLOR_RED, // 3 + TXT_COLOR_WHITE_BASE_START, // 4 + TXT_COLOR_WHITE_BASE, // 5 + TXT_COLOR_BLACK_BASE_START = TXT_COLOR_WHITE_BASE_START+4, // 8 + TXT_COLOR_BLACK_BASE = TXT_COLOR_WHITE_BASE+4, // 9 + TXT_COLOR_FREE_BASE_START = TXT_COLOR_BLACK_BASE_START+4, // 12 + TXT_COLOR_FREE_BASE = TXT_COLOR_BLACK_BASE+4 // 13 +}; + +/*---------------------------------------------------------------------------* + 外部変数宣言 + *---------------------------------------------------------------------------*/ + +extern NNSG2dFont gFont; // フォント +extern NNSG2dCharCanvas gCanvas; // CharCanvas +extern NNSG2dTextCanvas gTextCanvas; // TextCanvas +extern NNSG2dCharCanvas gCanvas2; // CharCanvas +extern NNSG2dTextCanvas gTextCanvas2; // TextCanvas + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitFont(void); +void UpdateFreePltt(u16 color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_NNS_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/graphics.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..c7fe3eef --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/graphics.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawQuadWithColors(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color1, GXRgb color2); +void DrawQuadWithAlpha(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color, s16 alpha); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/hw_info.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/hw_info.h new file mode 100644 index 00000000..1c43c56e --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/hw_info.h @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------* + 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 HW_INFO_H_ +#define HW_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + wirelessForceOff : 無線強制OFFならTRUEを指定 + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ); + + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL DeleteHWInfoFile( void ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_copy_file.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_copy_file.h new file mode 100644 index 00000000..76714aa3 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_copy_file.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: kami_copy_file.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_COPY_FILE_H_ +#define KAMI_COPY_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +BOOL kamiCopyFile(char* srcPath, char* dstPath); +BOOL kamiCreateDummyData(const char* path); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_COPY_FILE_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_font.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..ad5095e2 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_font.h @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_global.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_global.h new file mode 100644 index 00000000..e0c2ec13 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_global.h @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_global.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_GROBAL_H_ +#define KAMI_GROBAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _SystemUpdaterLog +{ + int magic_code; + int sdk_version; + int ipl_version; + int reserve[5]; +} SystemUpdaterLog; + +typedef enum +{ + IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN +} RunningConsole; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SYSTEM_UPDATER_NAME L"SystemUpdater ver.1.3" +#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log" +#define SYSTEM_UPDATER_MAGIC_CODE 44001111 + +/*---------------------------------------------------------------------------* + グローバル変数宣言 + *---------------------------------------------------------------------------*/ + +extern const char *g_strIPLSvnRevision; +extern const char *g_strSDKSvnRevision; +extern s32 gLockId; +extern const u16* sRegionStringArray[OS_TWL_REGION_MAX]; +extern OSTWLRegion gRegion; +extern BOOL gIsDeleteNMenuAndNandFiler; + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ +extern void ProcessSelectRegion(void); +extern void ProcessCancel(const char* string); +extern void ProcessCheckLog(void); +extern void ProcessNote(void); +extern void ProcessCheckConsole(void); +extern BOOL ProcessFormat(void); +extern BOOL ProcessHwinfo(void); +extern void ProcessLog(void); +extern void ProcessFinish(BOOL result); +extern BOOL ProcessImport( void *(*alloc)(unsigned long), void (*free)(void *) ); +extern BOOL ProcessWriteFont(void); +extern BOOL ProcessWriteCert(void); +extern BOOL ProcessWriteDummy(void); +extern BOOL FadeOutTick(void); +extern BOOL FadeInTick(void); +extern BOOL FadeInMaster(void); +extern RunningConsole GetConsole(void); +extern BOOL ProcessNandfirm(void); +extern BOOL ProcessNamutFormat(void); +extern BOOL ProcessDeleteOtherResionSysmenu(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_GROBAL_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_pxi.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..c05de9d4 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiClearNandErrorLog( void ); +KAMIResult kamiGetIsToolType( IsToolType *pType ); + +// (重要) +// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。 +// +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_write_nandfirm.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_write_nandfirm.h new file mode 100644 index 00000000..90fe68bd --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/kami_write_nandfirm.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/keypad.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/sort_title.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/sort_title.h new file mode 100644 index 00000000..bce41688 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/include/sort_title.h @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdaterRegionSelect + 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 ].index = counter; + + counter++; + } + + SortTitle( sTitleSortSet, counter, qsortBuf ); + + // ソート完了 + // 例えば、ソートされた順に要素を表示する場合は次のようにする。 + for( i=0; i + +/*===========================================================================*/ + +typedef struct { + OSTitleId titleID; + u32 index; +} 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/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/main.rsf b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/main.rsf new file mode 100644 index 00000000..0ff0aecb --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/main.rsf @@ -0,0 +1,267 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: main.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + # ========= SystemUpdaterは特別な鍵を使う ========= + CommonClientKey $(ComClientKey) + CommonClientKeyForDebugger $(ComClientKeyDebugger) + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(UPDATER_HOST_ROOT_DIR) + Root /data + File * + HostRoot ../data + Root /local + File tbf_ww_s.NFTR cert.sys + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE + ESRB FREE + USK FREE + PEGI_GEN FREE + PEGI_PRT FREE + PEGI_BBFC FREE + OFLC FREE + GRB FREE +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/fade.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/fade.c new file mode 100644 index 00000000..6c397505 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/fade.c @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: 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 "kami_global.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static int brightness = 0; +static int master_brightness = -16; +static int counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +BOOL FadeOutTick(void) +{ + if ( brightness < 16) + { +// if (++counter == 2) +// { + counter = 0; + G2_SetBlendBrightness( GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1, ++brightness ); +// } + return FALSE; + } + return TRUE; +} + +BOOL FadeInTick(void) +{ + if ( brightness > 0) + { +// if (++counter == 2) +// { + counter = 0; + G2_SetBlendBrightness( GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1, --brightness ); +// } + return FALSE; + } + return TRUE; +} + +BOOL FadeInMaster(void) +{ + if ( master_brightness < 0) + { + if (++counter == 2) + { + counter = 0; + GX_SetMasterBrightness( ++master_brightness ); + } + return FALSE; + } + return TRUE; +} + diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font.c new file mode 100644 index 00000000..24e659e4 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font.c @@ -0,0 +1,313 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: main.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 "font.h" +#include "kami_global.h" + +// 文字列描画関数が扱う文字をUnicodeにする +#define NNS_G2D_UNICODE + +#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位) +#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位) +#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位) +#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位) + +#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位) +#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位) + +#define CHARACTER_OFFSET 1 // 使用するキャラクタ列の開始番号 + +// DrawText での左上寄せ +#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +NNSG2dFont gFont; // フォント +NNSG2dCharCanvas gCanvas; // CharCanvas +NNSG2dCharCanvas gCanvas2; // CharCanvas +NNSG2dTextCanvas gTextCanvas; // TextCanvas +NNSG2dTextCanvas gTextCanvas2; // TextCanvas + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ +const int max_colors = 32; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +// バックドロップ色(白) + 黒 + 緑 + 赤 + 最大フォント階調数 (32階調まで) +static u16 colorPalette[1 + 1 + 1 + 1 + max_colors*5] = +{ + GX_RGB(31, 31, 31), GX_RGB(0, 0, 0), GX_RGB(0, 31, 0), GX_RGB(31, 0, 0) +}; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +static u32 LoadFile(void** ppFile, const char* fpath); + +/*---------------------------------------------------------------------------* + Name: LoadFile + + Description: ファイルをメモリにロードします。 + ファイルデータが不要になった場合は + CMN_UnloadFile( *ppFile, pAlloc ) でファイルデータを + 解放します。 + + Arguments: ppFile: ファイルをロードしたメモリアドレスを受け取る + バッファへのポインタ。 + fpath: ロードするファイルのパス + pAlloc: アロケータへのポインタ + + Returns: ロードしたファイルのファイルサイズを返します。 + 0 の場合はファイルロードに失敗した事を表します。 + この場合 *ppFile の値は無効です。 + *---------------------------------------------------------------------------*/ +static u32 LoadFile(void** ppFile, const char* fpath) +{ + BOOL bSuccess; + FSFile f; + u32 length; + u32 read; + + SDK_NULL_ASSERT( ppFile ); + SDK_NULL_ASSERT( fpath ); + + FS_InitFile(&f); + + bSuccess = FS_OpenFile(&f, fpath); + if( ! bSuccess ) + { + OS_Warning("file (%s) not found", fpath); + return 0; + } + + length = FS_GetLength(&f); + *ppFile = OS_AllocFromMain(length); + if( *ppFile == NULL ) + { + OS_Warning("cant allocate memory for file: %s", fpath); + return 0; + } + + read = (u32)FS_ReadFile(&f, *ppFile, (s32)length); + if( read != length ) + { + OS_Warning("fail to load file: %s", fpath); + OS_FreeToMain(*ppFile); + return 0; + } + + bSuccess = FS_CloseFile(&f); + if( ! bSuccess ) + { + OS_Warning("fail to close file: %s", fpath); + } + + return length; +} + +/*---------------------------------------------------------------------------* + Name: InitCanvas + + Description: 文字列描画の初期化をします。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitCanvas(void) +{ + GXCharFmt16* pCharBase = (GXCharFmt16*)G2_GetBG1CharPtr(); + GXCharFmt16* pCharBase2 = (GXCharFmt16*)G2_GetBG2CharPtr(); + int cOffset = CHARACTER_OFFSET; + + // フォントを読み込みます + { +// 他のデモと同じように TXT_LoadFont を使ってもフォントを読み込めます。 +// このデモでは NNS_G2dFontInitUTF16 を使う場合を示しています。 +// TXT_LoadFont( &gFont, "/data/fontu16.NFTR" ); + + void* pFontFile; + u32 size; + + size = LoadFile( &pFontFile, "/local/tbf_ww_s.NFTR" ); + NNS_G2D_ASSERT( size > 0 ); + + NNS_G2dFontInitUTF16(&gFont, pFontFile); + NNS_G2dPrintFont(&gFont); + } + + // CharCanvas の初期化 + NNS_G2dCharCanvasInitForBG( + &gCanvas, + pCharBase + cOffset, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_16 + ); + NNS_G2dCharCanvasInitForBG( + &gCanvas2, + pCharBase2 + cOffset, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_16 + ); + + // TextCanvasの初期化 + NNS_G2dTextCanvasInit( + &gTextCanvas, + &gCanvas, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + NNS_G2dTextCanvasInit( + &gTextCanvas2, + &gCanvas2, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + + // スクリーンを設定 + NNS_G2dMapScrToCharText( + G2_GetBG1ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + 0 + ); + NNS_G2dMapScrToCharText( + G2_GetBG2ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + 0 + ); + + // パレットをロード + { + // ロードしたフォントに応じてカラーパレットを作成 + { + const int nColors = MATH_IMin((1 << NNS_G2dFontGetBpp(&gFont)), max_colors); + int i; + + // 白地用パレット 31,20,10, 0 + for( i = 0; i < nColors; ++i ) + { + int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1)); + + colorPalette[i+TXT_COLOR_WHITE_BASE_START] = GX_RGB(level, level, level); + } + + // 黒地用パレット 0, 10, 20, 31 + for( i = 0; i < nColors; ++i ) + { + int level = ((i) * (max_colors - 1) / (nColors - 1)); + + colorPalette[i+TXT_COLOR_BLACK_BASE_START] = GX_RGB(level, level, level); + } + + // 水色地用パレット + for( i = 0; i < nColors; ++i ) + { + int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1)); + + colorPalette[i+TXT_COLOR_FREE_BASE_START] = GX_RGB((int)(level*0.7), (int)(level*0.9), level); + } + } + + // カラーパレットをロード + GX_LoadBGPltt(colorPalette, 0, sizeof(colorPalette)); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateFreePltt + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void UpdateFreePltt(u16 color) +{ + const int nColors = MATH_IMin((1 << NNS_G2dFontGetBpp(&gFont)), max_colors); + s32 i; + + // フリーパレット + for( i = 0; i < nColors; ++i ) + { + int level = ((nColors - 1 - i) * (max_colors - 1) / (nColors - 1)); + + colorPalette[i+TXT_COLOR_FREE_BASE_START] = + GX_RGB( (int)(level*((color & GX_RGBA_R_MASK)>>GX_RGBA_R_SHIFT)/32.0), + (int)(level*((color & GX_RGBA_G_MASK)>>GX_RGBA_G_SHIFT)/32.0), + (int)(level*((color & GX_RGBA_B_MASK)>>GX_RGBA_B_SHIFT)/32.0)); + } + + // カラーパレットをロード + GX_LoadBGPltt(colorPalette, 0, sizeof(colorPalette)); +} + +/*---------------------------------------------------------------------------* + Name: InitFont + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void InitFont(void) +{ + InitCanvas(); + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClear(&gCanvas, TXT_COLOR_WHITE); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClear(&gCanvas2, TXT_COLOR_WHITE); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 0, 256, 30); + + NNS_G2dTextCanvasDrawText(&gTextCanvas2, 55, 6, + TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, + (const char *)SYSTEM_UPDATER_NAME + ); +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font_data.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..67d1cff4 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/graphics.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..a6ecba8c --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/graphics.c @@ -0,0 +1,292 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(3); + G2_SetBG1Priority(2); + G2_SetBG2Priority(1); + G2_SetBG3Priority(0); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2_SetBG2ControlText( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x4000 , + GX_BG_CHARBASE_0x08000 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード +// GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); +// GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); +// GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); +// GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); +// GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + +// GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); +// GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_SetMasterBrightness(-16); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuad + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fey, 0); + + G3_Color( color ); + G3_Vtx(fsx, fey, 0); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuadWithColors + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuadWithColors(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color1, GXRgb color2) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color1 ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color2 ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color2 ); + G3_Vtx(fex, fey, 0); + + G3_Color( color1 ); + G3_Vtx(fsx, fey, 0); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuad + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuadWithAlpha(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color, s16 alpha) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, alpha, 0); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fey, 0); + + G3_Color( color ); + G3_Vtx(fsx, fey, 0); + } + G3_End(); +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/hw_info.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/hw_info.c new file mode 100644 index 00000000..b44da148 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/hw_info.c @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: 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 "hwi.h" +#include "hw_info.h" +// +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +// +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +BOOL WriteHWNormalInfoFile( void ); +BOOL WriteHWSecureInfoFile( u8 region ); +BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) +{ + static const char *pMsgSecureWriting = "Writing Secure File...\n"; + static const char *pMsgNormalWriting = "Writing Normal File...\n"; + static const char *pMsgSignWriting = "Writing Sign File...\n"; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + u32 installedSoftBoxCount = 0; + BOOL result = TRUE; + + // セキュアファイルのライト + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff, FALSE ) ) { // とりあえず無線は有効で。 +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む) + if( HWI_WriteHWNormalInfoFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // HWID署名ファイルのライト + if( HWI_WriteHWIDSignFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // CFGデータの修正 + if (!HWI_ModifyLanguage( region )) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" ); + result = FALSE; + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL DeleteHWInfoFile( void ) +{ + static const char *pMsgNormalDeleting = "Deleting Normal File...\n"; + static const char *pMsgSecureDeleting = "Deteting Secure File...\n"; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + BOOL result = TRUE; + + // ノーマルファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting ); + if( HWI_DeleteHWSecureInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + return result; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_copy_file.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_copy_file.c new file mode 100644 index 00000000..8aa1de7b --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_copy_file.c @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_copy_file.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_copy_file.h" + +/*---------------------------------------------------------------------------* + マクロ + *---------------------------------------------------------------------------*/ + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +BOOL kamiCopyFile(char* srcPath, char* dstPath) +{ + 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, srcPath); + if (!open_is_ok) + { + OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath); + 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", srcPath); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ROMファイルクローズ + FS_CloseFile(&file); + + // 一旦対象データを削除する + (void)FS_DeleteFile(dstPath); + + // ターゲットファイル作成 + if (!FS_CreateFileAuto(dstPath, FS_PERMIT_R | FS_PERMIT_W)) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath); + result = FALSE; + } + else + { + // ターゲットファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W); + if (!open_is_ok) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath); + result = FALSE; + } + // ターゲットファイルへ書き込み + 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; +} + +// ダミーファイル作成 +BOOL kamiCreateDummyData(const char* path) +{ + FSFile file; + BOOL open_is_ok; + const int FATFS_CLUSTER_SIZE = 16 * 1024; + + // 既に存在するなら何もしない + FS_InitFile(&file); + open_is_ok = FS_OpenFile(&file, path); + if (open_is_ok) + { + FS_CloseFile(&file); + OS_Printf("%s is already exist.\n", path); + return TRUE; + } + + if( FS_CreateFileAuto( path, FS_PERMIT_R | FS_PERMIT_W ) ) + { + FSFile file; + if( FS_OpenFileEx( &file, path, FS_FILEMODE_RW ) ) + { + (void)FS_SetFileLength( &file, FATFS_CLUSTER_SIZE ); + FS_CloseFile( &file ); + return TRUE; + } + } + + return FALSE; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_font.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..cfb7262c --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ +// DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +// GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataSub[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataSub[32], sFontScreenDataSub, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataSub[32*23], sizeof(u16)*32); + } +} + diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_pxi.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..f3ce7f2a --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,370 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0)) + { + return; + } +} + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 12, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiClearNandErrorLog + + Description: NVRAMのNANDエラー情報をクリアします。 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiClearNandErrorLog( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetIsToolType + + Description: IS-TWL-DEBUGGER or CAPTURE を取得します(同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetIsToolType( IsToolType *pType ) +{ + OSIntrMode enabled; + + if (pType == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pType; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_IS_TOOL_TYPE, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + PXI関連 + *---------------------------------------------------------------------------*/ + +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_write_nandfirm.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_write_nandfirm.c new file mode 100644 index 00000000..cac9c5ee --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/kami_write_nandfirm.c @@ -0,0 +1,332 @@ +/*---------------------------------------------------------------------------* + 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/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/keypad.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/main.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/main.c new file mode 100644 index 00000000..f7989cbe --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/main.c @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: main.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_pxi.h" +#include "kami_font.h" +#include "kami_copy_file.h" +#include "graphics.h" +#include "hwi.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "font.h" +#include "kami_global.h" + +#define SCRAMBLE_MASK 0x00406000 + +extern void InitFont(void); + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +s32 gLockId; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); +static BOOL IgnoreRemoval(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + BOOL result; + + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitThread(); + OS_InitTick(); + OS_InitAlarm(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + InitAllocation(); + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); // SoftBoxCountの計算に必要 + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + kamiFontPrintfConsole(FONT_COLOR_GREEN, "Log Window:\n"); + + // メインスレッドのカードロックID取得 + gLockId = OS_GetLockID(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // フォント初期化 + InitFont(); + + // コンソールチェック + ProcessCheckConsole(); + + // ログ情報確認 + ProcessCheckLog(); + + // リージョン選択 + ProcessSelectRegion(); + + // Note表示 + ProcessNote(); + + // TWLの更新処理を実行中です + CARD_LockRom((u16)gLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE); + CARD_UnlockRom((u16)gLockId); + + // ISデバッガのハードウェアリセットを禁止する + DEBUGGER_HwResetDisable(); + + // HWInfo関連の前準備 + switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) + { + case HWI_INIT_FAILURE: + kamiFontPrintfConsole(FONT_COLOR_RED, " Fail! : HWI_INIT()\n"); + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + break; + } + + result = TRUE; + + // NANDのフォーマットが古ければフォーマット + result &= ProcessFormat(); + + // 全ハードウェア情報の更新 + result &= ProcessHwinfo(); + + // フォントの書き込み + result &= ProcessWriteFont(); + + // cert.sysの書き込み + result &= ProcessWriteCert(); + + // ダミーファイルの生成 + result &= ProcessWriteDummy(); + + // TADのインポート開始 + result &= ProcessImport( OS_AllocFromMain, OS_FreeToMain ); + + // 選択リージョン以外のSystemMenuの消去を行う + result &= ProcessDeleteOtherResionSysmenu(); + + // NANDファームのインストール開始 + result &= ProcessNandfirm(); + + // 本体初期化を行う + result &= ProcessNamutFormat(); + + // 更新ログを作成してVersionDownを防ぐ + if (result) + { + ProcessLog(); + } + + // ISデバッガのハードウェアリセットを許可する + DEBUGGER_HwResetEnable(); + + // 結果表示 + ProcessFinish( result ); +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ +// kamiFontLoadScreenData(); + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_cancel.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_cancel.c new file mode 100644 index 00000000..fcad5dec --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_cancel.c @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_cancel.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 "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessCancel + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessCancel(const char* string) +{ + // キャンセルされました + CARD_LockRom((u16)gLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_CANCELED); + CARD_UnlockRom((u16)gLockId); + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, string); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + FadeInTick(); + FadeInMaster(); + } +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console.c new file mode 100644 index 00000000..afe9a391 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console.c @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: check_console.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_global.h" +#include "kami_font.h" +#include "kami_pxi.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ +static RunningConsole sRunning = UNKNOWN; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ +static RunningConsole CheckConsole(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------* + Name: ProcessCheckConsole + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void ProcessCheckConsole(void) +{ + BOOL isAdapter; + u16 batLevel; + + sRunning = CheckConsole(); + + switch (sRunning) + { + case IS_TWL_DEBUGGER: + kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER.\n"); + break; + case IS_TWL_CAPTURE: + kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE.\n"); + break; + case TWL: + kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on TWL CONSOLE.\n"); + break; + case UNKNOWN: + kamiFontPrintfConsole( FONT_COLOR_GREEN, "Running on UNKNOWN.\n"); + break; + } +/* +#ifdef SYSM_BUILD_FOR_DEBUGGER + // デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない + if (sRunning != IS_TWL_DEBUGGER) + { + ProcessCancel((const char *) + L" Sorry,\n" + L" This SystemUpdater can not\n" + L" execute on TWL-CONSOLE. " + ); + } +#else + // 実機向けSystemUpdaterはデバッガでは動作させない + if (sRunning == IS_TWL_DEBUGGER) + { + ProcessCancel((const char *) + L" Sorry,\n" + L" This SystemUpdater can not\n" + L" execute on IS-TWL-DEBUGGER. " + ); + } +#endif // SYSM_BUILD_FOR_DEBUGGER +*/ + // UNKNOWNは動作させない + if (sRunning == UNKNOWN) + { + ProcessCancel((const char *) + L" Sorry,\n" + L" This SystemUpdater can not\n" + L" execute on UNKNOWN CONSOLE. " + ); + } + + // 電池残量が少なければ動作させない + while (PM_GetBatteryLevel( &batLevel ) != PM_RESULT_SUCCESS) + { + OS_Sleep(1); + } + while (PM_GetACAdapter( &isAdapter ) != PM_RESULT_SUCCESS) + { + OS_Sleep(1); + } + if (((batLevel <= 2) && ! isAdapter) || + (batLevel <= 1)) + { + ProcessCancel((const char *) + L" Sorry,\n" + L" This SystemUpdater can not\n" + L" execute if battery is low. " + ); + } + + kamiFontLoadScreenData(); +} + +/*---------------------------------------------------------------------------* + Name: CheckConsole + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static RunningConsole CheckConsole(void) +{ + u32 console = OS_GetRunningConsoleType(); + RunningConsole running = UNKNOWN; + + // SystemUpdaterはデバッグ不可で作成されるためOS_CONSOLE_TWLが取得される + // 赤箱にカードを挿してSystemUpdaterを実行した場合も同様(但しOS_CONSOLE_TWLTYPE_RETAILにはならない) + // デバッガかどうかの判定はメモリサイズチェックにより行う + // 念のためOS_CONSOLE_TWLTYPE_RETAILでないことも確認する + + if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB) + { + if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_DEBUGGER) + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_ERROR) // TSボードプラス + 旧仕様デバッガ + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + } + } + else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + else + { + running = TWL; + } + } + + return running; +} + +/*---------------------------------------------------------------------------* + Name: GetConsole + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +RunningConsole GetConsole(void) +{ + return sRunning; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_log.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_log.c new file mode 100644 index 00000000..e2ab7491 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_log.c @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_check_log.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 // atoi +#include +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void DrawAlready(SystemUpdaterLog* log); + +/*---------------------------------------------------------------------------* + Name: ProcessCheckLog + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessCheckLog(void) +{ + // (更新可能条件) + // 1.ログが存在しない + // 2.ログが存在し、ログに記載のマジックコードが不正(初版SystemUpdater実行後の状態) + // 2.ログが存在し、ログに記載のマジックコードが正しくかつログに記載の + // SDK & IPL のバージョンが SystemUpdater のそれ以下である + +#ifdef IGNORE_VERSION_CHECK + if( 0 ) +#endif // IGNORE_VERSION_CHECK + { + SystemUpdaterLog log; + FSFile file; + FS_InitFile( &file ); + + if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_R) == TRUE) + { + DC_InvalidateRange(&log, sizeof(log)); + + if (FS_ReadFile(&file, &log, sizeof(log)) == sizeof(log)) + { + // ログリード成功 + OS_Printf("[%d, %d]\n", log.sdk_version, log.ipl_version); + + // 初版SystemUpdater実行状態でないことをマジックコードで判別する + if (log.magic_code == SYSTEM_UPDATER_MAGIC_CODE) + { + // マジックコード、SDKバージョン、IPLバージョンの確認 + if (log.sdk_version > atoi(g_strSDKSvnRevision) || + log.ipl_version > atoi(g_strIPLSvnRevision)) + { + // 更新不可 + DrawAlready(&log); + } + } + } + else + { + // ログリード失敗 + OS_Warning("Failure! FS_ReadFile"); + } + + FS_CloseFile(&file); + } + } +} + +/*---------------------------------------------------------------------------* + Name: DrawAlready + + Description: Alreadyを表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DrawAlready(SystemUpdaterLog* log) +{ + char string1[256]; + u16 string2[256]; + + MI_CpuClear8(string1, sizeof(string1)); + MI_CpuClear8(string2, sizeof(string2)); + + // 既にアップデート済み + CARD_LockRom((u16)gLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_ALREADY); + CARD_UnlockRom((u16)gLockId); + + STD_TSPrintf(string1, "This machine has already\nbeen updated.\n\n ver: %d %d", log->sdk_version, log->ipl_version); + STD_ConvertStringSjisToUnicode(string2, NULL, string1, NULL, NULL); + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 48, 58, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char *)string2); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + FadeInTick(); + FadeInMaster(); + } +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_delete_other_region_sysmenu.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_delete_other_region_sysmenu.c new file mode 100644 index 00000000..7f5cc8fc --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_delete_other_region_sysmenu.c @@ -0,0 +1,291 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_delete_tad.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 "hw_info.h" +#include "TWLHWInfo_api.h" +#include "graphics.h" +#include "kami_global.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define TITLE_ID_MUST_ERASE_NUM 3 +#define TITLE_ID_LIST_NUM OS_TWL_REGION_MAX + +#define TITLE_ID_HND_NUM 3 +#define TITLE_ID_HNE_NUM 3 + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +BOOL gIsDeleteNMenuAndNandFiler = FALSE; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static const u64 sTitleIdListMust[TITLE_ID_MUST_ERASE_NUM] = +{ + 0x00030017484e4141, // ALL HNAA + 0x00030015484e4241, // ALL HNBA + 0x0003000f484e4c41, // ALL HNLA +}; + +static const u64 sTitleIdListHNA[TITLE_ID_LIST_NUM] = +{ + 0x00030017484e414A, // Japan HNAJ + 0x00030017484e4145, // America HNAE + 0x00030017484e4150, // Europe HNAP + 0x00030017484e4155, // Australia HNAU + 0x00030017484e4143, // China HNAC + 0x00030017484e414B, // Korea HNAK + +}; + +static const u64 sTitleIdListHNB[TITLE_ID_LIST_NUM] = +{ + 0x00030015484e424A, // Japan HNBJ + 0x00030015484e4245, // America HNBE + 0x00030015484e4250, // Europe HNBP + 0x00030015484e4255, // Australia HNBU + 0x00030015484e4243, // China HNBC + 0x00030015484e424B, // Korea HNBK +}; + +static const u64 sTitleIdListHND[TITLE_ID_HND_NUM] = +{ + 0x00030005484e4441, // ALL HNDA + 0x00030005484e4443, // China HNDC + 0x00030005484e444B, // Korea HNDK +}; + +static const u64 sTitleIdListHNE[TITLE_ID_HNE_NUM] = +{ + 0x00030005484e4541, // ALL HNEA + 0x00030005484e4543, // China HNEC + 0x00030005484e454B, // Korea HNEK +}; + +static const u64 sTitleIdListHNL[TITLE_ID_LIST_NUM] = +{ + 0x0003000f484e4c4A, // Japan HNLJ + 0x0003000f484e4c45, // America HNLE + 0x0003000f484e4c50, // Europe HNLP + 0x0003000f484e4c55, // Australia HNLU + 0x0003000f484e4c43, // China HNLC + 0x0003000f484e4c4B, // Korea HNLK +}; + +static const u64 sTitleIdListHNI[TITLE_ID_LIST_NUM] = +{ + 0x00030005484e494A, // Japan HNIJ + 0x00030005484e4945, // America HNIE + 0x00030005484e4950, // Europe HNIP + 0x00030005484e4955, // Australia HNIU + 0x00030005484e4943, // China HNIC + 0x00030005484e494B, // Korea HNIK +}; + +static const u64 sTitleIdListHNK[TITLE_ID_LIST_NUM] = +{ + 0x00030005484e4B4A, // Japan HNKJ + 0x00030005484e4B45, // America HNKE + 0x00030005484e4B50, // Europe HNKP + 0x00030005484e4B55, // Australia HNKU + 0x00030005484e4B43, // China HNKC + 0x00030005484e4B4B, // Korea HNKK +}; + + +static const u64 sTitleIdListHNF[TITLE_ID_LIST_NUM] = +{ + 0x00030015484E464A, // Japan HNFJ + 0x00030015484E4645, // America HNFE + 0x00030015484E4650, // Europe HNFP + 0x00030015484E4655, // Australia HNFU + 0x00030015484E4643, // China HNFC + 0x00030015484E464B, // Korea HNFK +}; + +static const u64 sTitleIdListHNJ[TITLE_ID_LIST_NUM] = +{ + 0x00030005484E4A4A, // Japan HNJJ + 0x00030005484E4A45, // America HNJE + 0x00030005484E4A50, // Europe HNJP + 0x00030005484E4A55, // Australia HNJU + 0x00030005484E4A43, // China HNJC + 0x00030005484E4A4B, // Korea HNJK +}; + + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ +static BOOL DeleteTitle(u64 titleId); + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessDeleteOtherResionSysmenu + + Description: 選択リージョン以外のSystemMenuを消去する。 + ユーザーアプリは本体初期化の際に消去される。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessDeleteOtherResionSysmenu(void) +{ + s32 i; + BOOL ret = TRUE; + s32 ww_or_ck = 0; + + // ランチャーと本体設定とSysMenuバージョンのALL版は全て消去する + for (i=0;i +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessNote + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessFinish(BOOL result) +{ + // TWLの更新処理が完了しました + CARD_LockRom((u16)gLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_FINISHED); + CARD_UnlockRom((u16)gLockId); + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + if (result) + { + UpdateFreePltt(GX_RGB(0, 21, 0)); + NNS_G2dTextCanvasDrawText(&gTextCanvas, 78, 72, + TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"Update Success!"); + } + else + { + UpdateFreePltt(GX_RGB(31, 0, 0)); + NNS_G2dTextCanvasDrawText(&gTextCanvas, 78, 72, + TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"Update Failure!"); + } + + while(1) + { + if (result) + { + DrawQuad( 0, 30, 256, 131, GX_RGB(0, 21, 0)); + } + else + { + DrawQuad( 0, 30, 256, 131, GX_RGB(31, 0, 0)); + } + + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + FadeInTick(); + } +} + diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_format.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_format.c new file mode 100644 index 00000000..ec89bd78 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_format.c @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + 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 // atoi +#include +#include +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_pxi.h" +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ +#define CORRECT_NAND_ARCHIVE_SIZE 0xcde0000 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ +static vu8 sIsFormatFinish; +static u8 sFormatResult; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void FormatCallback(KAMIResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: ProcessFormat + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessFormat(void) +{ + FSArchiveResource resource; + + // L & R & Start & Select ボタン押しで強制フォーマット + if (!(kamiPadIsPress(PAD_BUTTON_L) && kamiPadIsPress(PAD_BUTTON_R) && + kamiPadIsPress(PAD_BUTTON_START) && kamiPadIsPress(PAD_BUTTON_SELECT))) + { + // 既に最新フォーマットであればフォーマットしない + if (FS_GetArchiveResource("nand:/", &resource)) + { + if (resource.totalSize == CORRECT_NAND_ARCHIVE_SIZE) + { + return TRUE; + } + } + } + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 74, 72, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"Now Format Nand.." + ); + + // フォーマット実行 + sIsFormatFinish = FALSE; + ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + FadeInTick(); + + if (sIsFormatFinish) break; + } + + if (sFormatResult) + { + kamiFontPrintfConsole(FONT_COLOR_GREEN, "NAND Format Success.\n"); + } + else + { + kamiFontPrintfConsole(FONT_COLOR_RED, "NAND Format Failure!\n"); + } + + // フォーマット後はESに必要なファイルがなくなっているため + // ES_InitLibを呼び出すことで作成しておく + NAM_End( NULL, NULL ); + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + + while (!FadeOutTick()) + { + OS_WaitVBlankIntr(); + } + + return sFormatResult; +} + + +/*---------------------------------------------------------------------------* + Name: FormatCallback + + Description: フォーマットコールバック + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void FormatCallback(KAMIResult result, void* /*arg*/) +{ + if ( result == KAMI_RESULT_SUCCESS_TRUE ) + { + sFormatResult = TRUE; + } + else + { + sFormatResult = FALSE; + } + + sIsFormatFinish = TRUE; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_hwinfo.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_hwinfo.c new file mode 100644 index 00000000..58a72a7b --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_hwinfo.c @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_hwinfo.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 // atoi +#include +#include +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_pxi.h" +#include "kami_font.h" +#include "hw_info.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessHwinfo + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessHwinfo(void) +{ + const int MAX_RETRY_COUNT = 2; + BOOL hw_info_result; + int i; + +#ifdef SKIP_WRITE_HWINFO + return TRUE; +#endif + + // 全ハードウェア情報の更新 + for (i=0;i +#include +#include +#include +#include +#include +#include +#include "kami_font.h" +#include "hw_info.h" +#include "TWLHWInfo_api.h" +#include "graphics.h" +#include "kami_global.h" +#include "font.h" +#include "sort_title.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define THREAD_STACK_SIZE (16*1024) + +#define DIR_NUM 3 +#define FULLPATH_LEN ( FS_ENTRY_LONGNAME_MAX+6 ) + +static const char* sDirectoryNameRegion[] = +{ + "japan", + "america", + "europe", + "australia", + "china", + "korea" +}; + +static const char* sDirectoryNameConsole[] = +{ + "debugger", // IS_TWL_DEBUGGER + "standalone", // IS_TWL_CAPTURE + "standalone", // TWL + "" // UNKNOWN +}; + +typedef struct { + u8 dirNameIndex; + char fileName[FS_ENTRY_LONGNAME_MAX]; +} ImportFileInfo; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u32 sCurrentProgress; +static vu8 sNowImport = FALSE; +static vu8 sProgress = FALSE; +static u8 sStack[THREAD_STACK_SIZE]; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static s32 kamiImportTad(const char* path, BOOL erase); +static void ProgressThread(void* arg); +static void Destructor(void* arg); +void ProgressDraw(f32 ratio); +BOOL ImportDirectoryTad(char* directory); + +static u32 CountTadInDir( char (*dir_path)[FULLPATH_LEN], u32 dir_num ); +static BOOL MakeList( char (*dir)[FULLPATH_LEN], u32 dir_max, ImportFileInfo *info, TitleSortSet *sortset ); +static BOOL ImportTadFromList( char (*dir)[FULLPATH_LEN], ImportFileInfo *info, TitleSortSet *sortset, u32 import_max ); + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessImport + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessImport( void *(*alloc)(unsigned long), void (*free)(void *) ) +{ + const s32 MAX_RETRY_COUNT = 2; + BOOL result = TRUE; + char directory[DIR_NUM][FULLPATH_LEN]; + s32 i=0; + s32 j=0; + u32 fileCount = 0; + ImportFileInfo *importFileInfoList = NULL; + TitleSortSet *titleSortSetList = NULL; + void *sortBuf = NULL; + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)L"Now Import.."); + + while(!FadeInTick()) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + } + + STD_TSNPrintf(directory[0], sizeof(directory[0]), "rom:/data/%s/%s/", sDirectoryNameConsole[GetConsole()], sDirectoryNameRegion[gRegion]); + STD_TSNPrintf(directory[1], sizeof(directory[1]), "rom:/data/common/%s/", sDirectoryNameRegion[gRegion]); + STD_TSNPrintf(directory[2], sizeof(directory[2]), "rom:/data/common/"); + + // ディレクトリ内の TAD ファイル数をカウントする + fileCount = CountTadInDir(directory, DIR_NUM); + + // ファイル名+ディレクトリインデックス配列、TitleSortInfo 配列を確保 + importFileInfoList = alloc( sizeof(ImportFileInfo) * fileCount ); + titleSortSetList = alloc( sizeof(TitleSortSet) * fileCount ); + + // 情報を読み込む + result &= MakeList( directory, DIR_NUM, importFileInfoList, titleSortSetList); + + // TitleSortInfoをソート + sortBuf = alloc( MATH_QSortStackSize( fileCount ) ); + SortTitle( titleSortSetList, fileCount, sortBuf ); + + // インポート + result &= ImportTadFromList( directory, importFileInfoList, titleSortSetList, fileCount ); + + // もはや必要ないリストの解放 + free( importFileInfoList ); + free( titleSortSetList ); + + while (!FadeOutTick()) + { + OS_WaitVBlankIntr(); + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: CountTadInDir + + Description: リストで指定したディレクトリにある TAD の総数を返します。 + + Arguments: dir_list,dir_max + + Returns: u32 + *---------------------------------------------------------------------------*/ +static u32 CountTadInDir( char (*dir_list)[FULLPATH_LEN], u32 dir_max ) +{ + int l; + u32 count = 0; + for( l=0; lattributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0) + { + char* pExtension; + // 拡張子のチェック + pExtension = STD_SearchCharReverse( info->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".tad") || !STD_CompareString( pExtension, ".TAD") ) + { + count++; + } + } + } + } + FS_CloseDirectory( &dir ); + } + return count; +} + +/*---------------------------------------------------------------------------* + Name: MakeList + + Description: リストで指定したディレクトリから ImportTadFromList + を行うのに必要なリストを作成します。 + + Arguments: dir_list, dir_max, info, sortset + + Returns: BOOL + *---------------------------------------------------------------------------*/ +static BOOL MakeList( char (*dir_list)[FULLPATH_LEN], u32 dir_max, ImportFileInfo *info, TitleSortSet *sortset ) +{ + int l; + u32 count = 0; + BOOL result = TRUE; + + for( l=0; lattributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0) + { + char* pExtension; + // 拡張子のチェック + pExtension = STD_SearchCharReverse( fsinfo->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".tad") || !STD_CompareString( pExtension, ".TAD") ) + { + NAMTadInfo tadInfo; + char fullPath[FULLPATH_LEN]; + + // フルパス作成 + STD_TSNPrintf(fullPath, sizeof(fullPath), "%s/%s", dirName, fsinfo->longname); + + // TAD情報取得 + // tadファイルの情報取得 + if (NAM_ReadTadInfo(&tadInfo, fullPath) != NAM_OK) + { + // 失敗したらエラーを表示して次のファイルへ、結果はFalse + kamiFontPrintfConsole(CONSOLE_RED, "Error NAM_ReadTadInfo()\n"); + kamiFontPrintfConsole(CONSOLE_RED, "file : %s\n",fsinfo->longname); + result = FALSE; + continue; + } + + // ImportFileInfo と TitleSortSet に情報を転載 + info[count].dirNameIndex = (u8)l; + STD_TSNPrintf(info[count].fileName, FS_ENTRY_LONGNAME_MAX, fsinfo->longname); + sortset[count].index = count; + sortset[count].titleID = tadInfo.titleInfo.titleId; + + count++; + } + } + } + } + } + return result; +} + +/*---------------------------------------------------------------------------* + Name: ImportTadFromList + + Description: MakeList で得たリストの情報に従って TAD をインポートします。 + + Arguments: dir_list, info, sortset, import_max + + Returns: BOOL + *---------------------------------------------------------------------------*/ +static BOOL ImportTadFromList( char (*dir_list)[FULLPATH_LEN], ImportFileInfo *info, TitleSortSet *sortset, u32 import_max ) +{ + int l; + int j; + BOOL result = TRUE; + s32 listNo=0; + + for( l=0; lattributes & (FS_ATTRIBUTE_DOS_DIRECTORY | FS_ATTRIBUTE_IS_DIRECTORY)) == 0) + { + char* pExtension; + + // 拡張子のチェック + pExtension = STD_SearchCharReverse( info->longname, '.'); + if (pExtension) + { + if (!STD_CompareString( pExtension, ".tad") || !STD_CompareString( pExtension, ".TAD") ) + { + + STD_TSPrintf(string1, "List %d ", ++listNo); + STD_ConvertStringSjisToUnicode(string2, NULL, string1, NULL, NULL); + + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 60, 256, 20); + NNS_G2dTextCanvasDrawText(&gTextCanvas, 40, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)L"Now Import.."); + NNS_G2dTextCanvasDrawText(&gTextCanvas, 135, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*)string2); + + STD_TSNPrintf(full_path, sizeof(full_path), "%s/%s", directory, info->longname); +// kamiFontPrintfConsole(CONSOLE_GREEN, " %s\n", full_path); + + // MAX_RETRY_COUNTまでリトライする + for (j=0; jpriority - 1); + OS_WakeupThreadDirect(&thread); + + // Import開始 + nam_result = NAM_ImportTad( path ); + + // インポート開始フラグを下げる + sNowImport = FALSE; + + // 進捗スレッドの自力終了を待つ + while (sProgress){}; + + // きちんと表示する + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + (void)NAMUT_UpdateSoftBoxCount(); + + return nam_result; +} + +/*---------------------------------------------------------------------------* + Name: ProgressThread + + Description: .tad ファイルインポートの進捗を表示するスレッド。 + 進捗が100%に達すると処理を抜ける。 + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* /*arg*/) +{ + u32 currentSize; + u32 totalSize = 0; + u32 totalSizeBk = 0; + + sProgress = TRUE; + + while (sNowImport) + { + 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ブランク待ち + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + } + + sProgress = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: ProgressDraw + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ + +void ProgressDraw(f32 ratio) +{ + s16 x = (s16)(30 + (226 - 30)*ratio); + + // グリーンバー + DrawQuadWithColors( 30, 86, x, 95, GX_RGB(22, 31, 22), GX_RGB(12, 25, 12)); + + // グレーバー + DrawQuad( 30, 86, 226, 95, GX_RGB(28, 28, 28)); +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_log.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_log.c new file mode 100644 index 00000000..6db3f294 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_log.c @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_log.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 // atoi +#include +#include "font.h" +#include "kami_font.h" +#include "kami_global.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessLog + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessLog(void) +{ + SystemUpdaterLog log; + + (void)FS_DeleteFile(SYSTEM_UPDATER_LOG_PATH); + + if (FS_CreateFileAuto(SYSTEM_UPDATER_LOG_PATH, FS_PERMIT_R | FS_PERMIT_W)) + { + FSFile file; + FS_InitFile( &file ); + if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_W)) + { + log.magic_code = SYSTEM_UPDATER_MAGIC_CODE; + log.sdk_version = atoi(g_strSDKSvnRevision); + log.ipl_version = atoi(g_strIPLSvnRevision); + + DC_FlushRange(&log, sizeof(log)); + + if (FS_WriteFile(&file, (void*)&log, sizeof(log) ) == -1) + { + kamiFontPrintfConsole(FONT_COLOR_RED, "Failure : FS_WriteFile\n"); + } + FS_CloseFile(&file); + } + } + else + { + kamiFontPrintfConsole(FONT_COLOR_RED, "Failure : FS_CreateFileAuto\n"); + } +} + diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_namut_format.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_namut_format.c new file mode 100644 index 00000000..579e3fd0 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_namut_format.c @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_namut_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 // atoi +#include +#include +#include +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_pxi.h" +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessNamutFormat + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessNamutFormat(void) +{ + BOOL result; + + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 50, 72, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"Format System Memory.." + ); + + while(!FadeInTick()) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + } + + result = NAMUT_Format(); + + while (!FadeOutTick()) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + } + + return result; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_nandfirm.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_nandfirm.c new file mode 100644 index 00000000..66b65ff2 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_nandfirm.c @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + 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 // atoi +#include +#include +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_pxi.h" +#include "kami_font.h" +#include "hw_info.h" +#include "kami_write_nandfirm.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessNandfirm + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessNandfirm(void) +{ + FSFile dir; + FSDirectoryEntryInfo info[1]; + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + const int MAX_RETRY_COUNT = 2; + BOOL result = FALSE; + BOOL find = FALSE; + int i; + + // 適切なディレクトリを開く + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/"); + + FS_InitFile(&dir); + if (!FS_OpenDirectory(&dir, full_path, FS_FILEMODE_R)) + { + kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory()\n"); + return FALSE; + } + + // .nandファイルを検索してインポート + 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, ".nand") || !STD_CompareString( pExtension, ".NAND") ) + { + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/%s", info->longname); + find = TRUE; + break; + } + } + } + } + + if (find) + { + for (i=0;i +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessNote + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessNote(void) +{ + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + +// NNS_G2dTextCanvasDrawText(&gTextCanvas, 20, 40, +// TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, +// (const char *)L"Please Select System Menu Region." +// ); + + NNS_G2dTextCanvasDrawText(&gTextCanvas2, 60, 140, + TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, + (const char *) + L"\xe000 ok! start update.\n" + L"\xe001 cancel.\n" + ); +/* + NNS_G2dTextCanvasDrawText(&gTextCanvas, 50, 40, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L" -- Note --" + ); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 44, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"・All data in nand flash \n" + L" memory will be lost." + ); +*/ + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 80, 50, + TXT_COLOR_FREE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + sRegionStringArray[gRegion] + ); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 44, 80, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"・Do not shut down while\n" + L" update is processing." + ); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + kamiPadRead(); + + if (FadeInTick()) + { + if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + while (!FadeOutTick()) + { + OS_WaitVBlankIntr(); + } + ProcessCancel((const char *)L"\n Update was Canceled."); + } + else if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + // Aボタンを押したときにSELECTボタンも押していた場合 + // NMenuとNandFilerのインポートをスキップして、削除する + if (kamiPadIsPress(PAD_BUTTON_SELECT)) + { + gIsDeleteNMenuAndNandFiler = TRUE; + } + while (!FadeOutTick()) + { + OS_WaitVBlankIntr(); + } + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + return; + } + } + DrawQuadWithColors( 0, 50, 128, 62, GX_RGB(31, 31, 31), GX_RGB(22, 28, 31)); + DrawQuadWithColors( 128, 50, 256, 62, GX_RGB(22, 28, 31), GX_RGB(31, 31, 31)); + + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + OS_WaitVBlankIntr(); + } +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_select_region.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_select_region.c new file mode 100644 index 00000000..12bd5f77 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_select_region.c @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_select_region.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 "font.h" +#include "graphics.h" +#include "keypad.h" +#include "kami_global.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" + +#ifdef DISABLE_CK_REGION +#define SELECT_MAX OS_TWL_REGION_CHINA +#else +#define SELECT_MAX OS_TWL_REGION_MAX +#endif + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +OSTWLRegion gRegion = OS_TWL_REGION_JAPAN; + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +static const u16 POS_Y_JAPAN = 44; +static const u16 POS_Y_AMERICA = 56; +static const u16 POS_Y_EUROPE = 68; +static const u16 POS_Y_AUSTRALIA = 80; +static const u16 POS_Y_CHINA = 92; +static const u16 POS_Y_KOREA = 104; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static const u16 sPosArray[OS_TWL_REGION_MAX] = +{ + POS_Y_JAPAN, + POS_Y_AMERICA, + POS_Y_EUROPE, + POS_Y_AUSTRALIA, + POS_Y_CHINA, + POS_Y_KOREA +}; + +const u16* sRegionStringArray[OS_TWL_REGION_MAX] = +{ + L"region Japan", + L"region America", + L"region Europe", + L"region Australia", + L"region China", + L"region Korea" +}; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessSelectRegion + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void ProcessSelectRegion(void) +{ + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); +#ifndef JP_REGION_ONLY + NNS_G2dTextCanvasDrawText(&gTextCanvas2, 60, 140, + TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, + (const char *) + L"\xe006 change region.\n" + L"\xe000 choice.\n" + L"\xe001 cancel.\n" + ); +#else // JP_REGION_ONLY + NNS_G2dTextCanvasDrawText(&gTextCanvas2, 60, 140, + TXT_COLOR_BLACK_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, + (const char *) + L"\n" + L"\xe000 choice.\n" + L"\xe001 cancel.\n" + ); + +#endif // JP_REGION_ONLY + + // 液晶を見てください。 + CARD_LockRom((u16)gLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_LOOK_SCREEN); + CARD_UnlockRom((u16)gLockId); + +#ifndef JP_REGION_ONLY + gRegion = OS_GetRegion(); + // 中韓リージョンの本体に中韓非対応 Updater を使うと飛び越えるので対応 + if (gRegion >= SELECT_MAX) + { + gRegion = OS_TWL_REGION_JAPAN; + } +#endif // JP_REGION_ONLY + + while(1) + { +#ifndef JP_REGION_ONLY + s32 i; +#endif // JP_REGION_ONLY + + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + kamiPadRead(); + +#ifdef SKIP_WRITE_HWINFO + if (FadeInMaster()) + { + break; + } +#else + if (FadeInMaster()) + { + +#ifndef JP_REGION_ONLY + if (kamiPadIsRepeatTrigger(PAD_KEY_DOWN)) + { + if (++gRegion >= SELECT_MAX) + { + gRegion = OS_TWL_REGION_JAPAN; + } + } + else if (kamiPadIsRepeatTrigger(PAD_KEY_UP)) + { + if (--gRegion < OS_TWL_REGION_JAPAN) + { + gRegion = (OSTWLRegion)(SELECT_MAX-1); + } + } +#endif // JP_REGION_ONLY + + if (kamiPadIsTrigger(PAD_BUTTON_B)) + { + while (!FadeOutTick()) + { + OS_WaitVBlankIntr(); + } + ProcessCancel((const char *)L"\n Update was Canceled."); + } + else if (kamiPadIsTrigger(PAD_BUTTON_A)) + { + break; + } + } +#endif + +#ifndef JP_REGION_ONLY + for (i=0;i +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_copy_file.h" +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _CopyFileList +{ + char* srcPath; + char* dstPath; +} CopyFileList; + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +static const CopyFileList sCertList = +{ + "rom:/local/cert.sys", "nand:/sys/cert.sys" +}; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessWriteCert + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessWriteCert(void) +{ + BOOL ret; + + ret = kamiCopyFile(sCertList.srcPath, sCertList.dstPath); + + if (ret) + { + kamiFontPrintfConsole(FONT_COLOR_GREEN, "Write Data2 Success.\n"); + } + else + { + kamiFontPrintfConsole(FONT_COLOR_RED, "Write Data2 Failure!\n"); + } + + OS_WaitVBlankIntr(); + kamiFontLoadScreenData(); + return ret; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_write_dummy.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_write_dummy.c new file mode 100644 index 00000000..a76e5ebe --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_write_dummy.c @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_write_dummy.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 "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_copy_file.h" +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ +#ifdef FOR_LOTCHECK +#define DUMMY_FILE_NUM 1 +#else +#define DUMMY_FILE_NUM 2 +#endif +static const char* sDummyFileList[DUMMY_FILE_NUM] = +{ + "nand:/shared2/launcher/wrap.bin", // ないと本体初期化でこける +#ifndef FOR_LOTCHECK + "nand:/sys/dev.kp" // ないとアプリ管理画面が表示されない +#endif +}; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessWriteDummy + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessWriteDummy(void) +{ + BOOL ret = TRUE; + s32 i; + + for (i=0;i +#include "font.h" +#include "graphics.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "kami_global.h" +#include "kami_copy_file.h" +#include "kami_font.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _CopyFileList +{ + char* srcPath; + char* dstPath; +} CopyFileList; + +/*---------------------------------------------------------------------------* + グローバル変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ +/* +static const CopyFileList sCopyFileList[] = +{ + { "rom:/data/TWLFontTable.dat", "nand:sys/TWLFontTable.dat" }, + { "rom:/data/cert.sys", "nand:/sys/cert.sys" } +}; +*/ +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: ProcessWriteFont + + Description: + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +BOOL ProcessWriteFont(void) +{ + FSFile dir; + FSDirectoryEntryInfo info[1]; + char full_path[FS_ENTRY_LONGNAME_MAX+6]; + BOOL find = FALSE; + BOOL result = TRUE; + +/* + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas, TXT_COLOR_WHITE, 0, 30, 256, 100); + OS_WaitVBlankIntr(); + NNS_G2dCharCanvasClearArea(&gCanvas2, TXT_COLOR_BLACK, 0, 130, 256, 62); + OS_WaitVBlankIntr(); + + NNS_G2dTextCanvasDrawText(&gTextCanvas, 84, 60, + TXT_COLOR_WHITE_BASE, TXT_DRAWTEXT_FLAG_DEFAULT, (const char*) + L"Write Files.." + ); +*/ + + // 適切なディレクトリを開く + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/"); + + FS_InitFile(&dir); + if (!FS_OpenDirectory(&dir, full_path, FS_FILEMODE_R)) + { + kamiFontPrintfConsole(CONSOLE_RED, "Error FS_OpenDirectory()\n"); + return FALSE; + } + + // .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 (gRegion < OS_TWL_REGION_CHINA && + !STD_SearchString( info->longname, "_CN_" ) && + !STD_SearchString( info->longname, "_KR_" )) + { + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/%s", info->longname); + find = TRUE; + break; + } + // 中 + else if (gRegion == OS_TWL_REGION_CHINA && STD_SearchString( info->longname, "_CN_" )) + { + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/%s", info->longname); + find = TRUE; + break; + } + // 韓 + else if (gRegion == OS_TWL_REGION_KOREA && STD_SearchString( info->longname, "_KR_" )) + { + STD_TSNPrintf(full_path, sizeof(full_path), "rom:/data/common/%s", info->longname); + find = TRUE; + break; + } + + } + } + } + } + + if (find) + { + if (kamiCopyFile(full_path, "nand:sys/TWLFontTable.dat")) + { + kamiFontPrintfConsole(FONT_COLOR_GREEN, "Write Data1 Success.\n"); + } + else + { + result = FALSE; + kamiFontPrintfConsole(FONT_COLOR_RED, "Write Data1 Failure!\n"); + } + } + + OS_WaitVBlankIntr(); + kamiFontLoadScreenData(); + return result; +} diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/sort_title.c b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/sort_title.c new file mode 100644 index 00000000..c3c7e8e3 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/sort_title.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdaterRegionSelect + 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/systemMenu_tools/SystemUpdaterRegionSelect/Makefile b/build/systemMenu_tools/SystemUpdaterRegionSelect/Makefile new file mode 100644 index 00000000..589dbbb3 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner \ + ARM7.TWL \ + ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/Makefile b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/banner_v3.bsf b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/banner_v3.bsf new file mode 100644 index 00000000..d1c48580 Binary files /dev/null and b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/icon/gameIcon.bmp b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..7bba6103 Binary files /dev/null and b/build/systemMenu_tools/SystemUpdaterRegionSelect/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/common/include/fifo.h b/build/systemMenu_tools/SystemUpdaterRegionSelect/common/include/fifo.h new file mode 100644 index 00000000..892475dd --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/common/include/fifo.h @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater - include + File: fifo.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 TWL_KAMI_TEST_FIFO_H_ +#define TWL_KAMI_TEST_FIFO_H_ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + + +typedef enum KamiCommand +{ + KAMI_TEST_COMMAND, + KAMI_EXE_FORMAT, + KAMI_NAND_IO, + KAMI_CLEAR_NAND_ERRORLOG, + KAMI_GET_IS_TOOL_TYPE +} +KamiCommand; + +typedef enum _IsToolType +{ + IS_TOOL_TYPE_ERROR, + IS_TOOL_TYPE_DEBUGGER, + IS_TOOL_TYPE_CAPTURE +} +IsToolType; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/data/cert.sys b/build/systemMenu_tools/SystemUpdaterRegionSelect/data/cert.sys new file mode 100644 index 00000000..3d40f56a Binary files /dev/null and b/build/systemMenu_tools/SystemUpdaterRegionSelect/data/cert.sys differ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/data/tbf_ww_s.NFTR b/build/systemMenu_tools/SystemUpdaterRegionSelect/data/tbf_ww_s.NFTR new file mode 100644 index 00000000..f4054938 Binary files /dev/null and b/build/systemMenu_tools/SystemUpdaterRegionSelect/data/tbf_ww_s.NFTR differ diff --git a/build/systemMenu_tools/SystemUpdaterRegionSelect/readme.txt b/build/systemMenu_tools/SystemUpdaterRegionSelect/readme.txt new file mode 100644 index 00000000..66c363b0 --- /dev/null +++ b/build/systemMenu_tools/SystemUpdaterRegionSelect/readme.txt @@ -0,0 +1,80 @@ + +/*-----------------------------------------------------*/ +/* 対応SDKについて */ +/*-----------------------------------------------------*/ + +**** SDK側は UIGブランチを使用してください **** + + +/*-----------------------------------------------------*/ +/* データフォルダの構成について */ +/*-----------------------------------------------------*/ + +以下のディレクトリ構成でsystemMenuを用意して +ARM9/Makefileの UPDATER_HOST_ROOT_DIR変数で指定してください。 + +xxxxx + +common + l +$ + l +america/* + l +australia/* + l +china/* + l +europe/* + l +japan/* + l +korea/* + l + +debugger + l +america/# + l +australia/# + l +china/# + l +europe/# + l +japan/# + l +korea/# + l + +standalone + +america/# + +australia/# + +china/# + +europe/# + +japan/# + +korea/# + + +配置図: + # -> ランチャーと本体設定のtad (開発機用とデバッガ用で内容が異なるもの) + * -> 上記以外でALLリージョンでないtad + $ -> 上記以外のtad 及び nandファーム 及び フォントデータ + + +/*-----------------------------------------------------*/ +/* コンパイルスイッチについて */ +/*-----------------------------------------------------*/ + + +-----------------------+--------+--------------------+----------------------------------------+ + l l 通常 l Lot Check Group 用 l 説明 l + +-----------------------+--------+--------------------+----------------------------------------+ + l IGNORE_VERSION_CHECK l FALSE l TRUE l TRUEならバージョンダウン可能 l + +-----------------------+--------+--------------------+----------------------------------------+ + l SKIP_WRITE_HWINFO l FALSE l TRUE l TRUEならハードウェア情報を更新しない l + +-----------------------+--------+--------------------+----------------------------------------+ + l USE_NORMAL_COMMON_KEY l FALSE l TRUE l TRUEなら通常のcommon client key を使用 l + +-----------------------+--------+--------------------+----------------------------------------+ + +※ [通常]は開発者へリリースする目的のもの +※ [Lot Check Group 用]はSystemMenuのロットチェックでネットワークアップデートのテストを + 行うために一旦SystemMenuを古いものに入れ替えるためのもの + + +-----------------------+----------------------------------------------------------------------+ + l l 説明 l + +-----------------------+----------------------------------------------------------------------+ + l JP_REGION_ONLY l 書き込みリージョンの選択肢をJPに限定する場合はTRUEを選択します l + l l この際、japanでないリージョン以下のデータは不要です + +-----------------------+----------------------------------------------------------------------+ + +/*-----------------------------------------------------*/ +/* フォントデータついて */ +/*-----------------------------------------------------*/ + +中国フォントのファイル名は ***_CN_***.dat としてください。 +韓国フォントのファイル名は ***_KR_***.dat としてください。 +日米欧豪フォントのファイル名には、 "_CN_" 及び "_KR_" を含めないでください。 \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile new file mode 100644 index 00000000..b306a550 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/Makefile @@ -0,0 +1,154 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializer +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# NandInitializerRedと同様の動作をしますが自動フォーマットが強制的に実行され停止します。 +MACRO_FLAGS += -DAUTO_FORMAT_MODE +#============================================================================ +#============================================================================ +# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING +#============================================================================ +#============================================================================ +# 各種データを書き込み可能にする場合定義します。(要:Make Clean) +# 具体的には TWLFontTable.dat wrap.bin cert.sys の3つです。 +#MACRO_FLAGS += -DUSE_WRITE_VARIOUS_DATA +#============================================================================ +#============================================================================ +# dev.kpを書き込み可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DWRITE_DEVKP_ENABLE +#============================================================================ +#============================================================================ +# マリクラデバッグ用として作成する場合定義します。(要:Make Clean) +# ・自動処理において"nand:/shared2/launcher/wrap.bin"を作成します。 +# ・自動処理において開発用CLSの証明書(cert.sys)を書き込みます。 +# ・自動処理の最後に本体初期化を行います。 +#MACRO_FLAGS += -DMARIOCLUB_VERSION +#============================================================================ + +MACRO_FLAGS += -DTWL_CAPTURE_VERSION + +SYSM_DISABLE_DEBUG = FALSE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NOA +#TARGET_TAD = + +TARGET_BIN = TWLCaptureSystemWriter.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../../NandInitializerRed/ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + kami_write_nandfirm.c \ + cursor.c \ + process_format.c \ + process_topmenu.c \ + process_eticket.c \ + process_import_twlc.c \ + process_nandfirm_twlc.c \ + process_norfirm.c \ + process_auto.c \ + process_fade.c \ + process_mcu.c \ + process_wireless_setting.c \ + hwi.c \ + debugger_hw_reset_control.c + +LINCLUDES = ./include \ + ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + ../../common/ARM9/include + +SRCDIR = ./src \ + ../../NandInitializerRed/ARM9.TWL/src \ + ../../HWInfoWriter/ARM9/src \ + ../../common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifdef FIRM_USE_PRODUCT_KEYS +DATA_DIR = prod +else +DATA_DIR = dev +endif + +MAKELCF_FLAGS += -DNANDFIRM_OBJ=./data/$(DATA_DIR)/nandfirm.o \ + -DHNAA_OBJ=./data/$(DATA_DIR)/HNAA.o \ + -DHNBA_OBJ=./data/$(DATA_DIR)/HNBA.o \ + -DHNCA_OBJ=./data/$(DATA_DIR)/HNCA.o \ + -DHNHA_OBJ=./data/$(DATA_DIR)/HNHA.o \ + -DHNLA_OBJ=./data/$(DATA_DIR)/HNLA.o + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +#INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## new file mode 100644 index 00000000..b0a0b372 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/##about## @@ -0,0 +1,10 @@ +ここ以下にdevとprod用のnandfirmとHNAA,HNBA,HNCA,HNHA,HNLAをオブジェクトファイル化した + +nandfirm.o +hnaa.o +hnba.o +hnca.o +hnha.o +hnla.o + +を配置する \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o new file mode 100644 index 00000000..145084bf Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNAA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o new file mode 100644 index 00000000..e687b896 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNBA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o new file mode 100644 index 00000000..93faa273 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNCA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o new file mode 100644 index 00000000..c5786100 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNHA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o new file mode 100644 index 00000000..8565c92b Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/HNLA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o new file mode 100644 index 00000000..459cb429 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/dev/nandfirm.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o new file mode 100644 index 00000000..587fe350 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNAA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o new file mode 100644 index 00000000..79ed40f4 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNBA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o new file mode 100644 index 00000000..d3887188 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNCA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o new file mode 100644 index 00000000..383c8226 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNHA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o new file mode 100644 index 00000000..3b208339 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/HNLA.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o new file mode 100644 index 00000000..7d818096 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/data/prod/nandfirm.o differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h new file mode 100644 index 00000000..0d28f694 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_import_twlc.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_import_twlc.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_TWLC +#define PROCESS_IMPORT_TWLC + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* ImportProcessTWLC0(void); +void* ImportProcessTWLC1(void); +void* ImportProcessTWLC2(void); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // PROCESS_IMPORT_TWLC \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h new file mode 100644 index 00000000..058e2222 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/include/process_nandfirm_twlc.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_nandfirm_twlc.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_TWLC +#define PROCESS_NANDFIRM_TWLC + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void* NandfirmProcessTWLC0(void); +void* NandfirmProcessTWLC1(void); +void* NandfirmProcessTWLC2(void); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // PROCESS_NANDFIRM_TWLC \ No newline at end of file diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf new file mode 100644 index 00000000..13e4cbcc --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/main.rsf @@ -0,0 +1,245 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "SysLogReader" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # +# RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + LockSCFG TRUE + + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media GameCard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) + +} diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c new file mode 100644 index 00000000..e8174fc7 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/ARM9.TWL/src/process_import_twlc.c @@ -0,0 +1,391 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: process_import_twlc.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 "kami_pxi.h" +#include "kami_font.h" +#include "process_topmenu.h" +#include "process_import_twlc.h" +#include "process_auto.h" +#include "process_fade.h" +#include "cursor.h" +#include "keypad.h" +#include "common_utility.h" + +#define NUM_IMPORT_TAD 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +// tad格納先のシンボル +extern void *hnaa_begin, *hnaa_end, *hnba_begin, *hnba_end, *hnca_begin, *hnca_end, + *hnha_begin, *hnha_end, *hnla_begin, *hnla_end; + +static char* sFilename[] = {"HNAA", "HNBA", "HNCA", "HNHA", "HNLA" }; +static void* spFileBegin[] = { &hnaa_begin, &hnba_begin, &hnca_begin, &hnha_begin, &hnla_begin}; +static void* spFileEnd[] = { &hnaa_end, &hnba_end, &hnca_end, &hnha_end, &hnla_end}; + +static vu8 sNowImport = FALSE; +static void* spStack; +static u32 sCurrentProgress; +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + + +BOOL ImportTadTWLC(void* symbolBegin, void* symbolEnd); +static void ProgressThread(void*); +static void Destructor(void* /*arg*/); +void ProgressInit(void); +void ProgressDraw(f32 ratio); +static BOOL DumpTadInfo(FSFile *pInfo); + + +void* ImportProcessTWLC0(void) +{ + 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, "+--------------------+----+"); + + // 背景全クリア + 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 ); + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + FADE_IN_RETURN( ImportProcessTWLC1 ); +} + +void* ImportProcessTWLC1(void) +{ + // オート実行用 + if (gAutoFlag) + { + return ImportProcessTWLC2; + } + + // can't reach + return ImportProcessTWLC1; +} + +static void* ImportProcessTWLC2(void) +{ + int i; + BOOL result = TRUE; + + kamiFontPrintf(25, 5, FONT_COLOR_BLACK, "WAIT"); + + for (i=0;ipriority -1); + + OS_SetThreadDestructor(&thread, Destructor); + OS_WakeupThreadDirect(&thread); + + // Import開始 + OS_Printf( "Import Start.\n" ); + kamiFontPrintfConsole(CONSOLE_ORANGE, "Import Start.\n"); + nam_result = NAM_ImportTadWithFile(&file); + + // インポートが終わるまで待つ + while(sNowImport){}; + OS_WaitVBlankIntr(); + + if(nam_result != NAM_OK) + { + goto error_proc; + } + + + kamiFontPrintfConsole(CONSOLE_ORANGE, "Import finished.\n"); + FS_CloseFile(&file); + NAMUT_UpdateSoftBoxCount(); + + return TRUE; + +error_proc: + // エラーの事後処理 + kamiFontPrintfConsole(CONSOLE_RED, "\nfail! errorcode: %d.\n", nam_result) ; + FS_CloseFile(&file); + NAMUT_UpdateSoftBoxCount(); + return FALSE; +} + +/*---------------------------------------------------------------------------* + 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; +} +static void Destructor(void* /*arg*/) +{ + OS_Free(spStack); +} + +/*---------------------------------------------------------------------------* + 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 "kami_pxi.h" +#include "kami_font.h" +#include "process_topmenu.h" +#include "process_nandfirm_twlc.h" +#include "process_import_twlc.h" +#include "process_auto.h" +#include "process_fade.h" +#include "cursor.h" +#include "keypad.h" +#include "kami_write_nandfirm.h" +#include "common_utility.h" + +#define NAND_BLOCK_BYTE 0x200 +#define NAND_START_OFFSET 0x200 +#define NANDFIRM_FILE_START_OFFSET 0x200 + +// nandfirm格納先シンボル +extern void* nandfirm_begin; +extern void* nandfirm_end; + +static BOOL writebackFirm( void ); + +void* NandfirmProcessTWLC0( void ) +{ + int i; + + kamiFontClear(); + // バージョン表示 + kamiFontPrintf(2, 1, FONT_COLOR_BLACK, "Import NandFirm from SD"); + kamiFontPrintf(0, 2, FONT_COLOR_BLACK, "--------------------------------"); + + // 背景全クリア + 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 ); + + // メニュー一覧 + kamiFontPrintf((s16)3, (s16)4, FONT_COLOR_BLACK, "+--------------------+----+"); + kamiFontPrintf((s16)3, (s16)5, FONT_COLOR_BLACK, "l %-16.16s l l", "included_file"); + kamiFontPrintf((s16)3, (s16)6, FONT_COLOR_BLACK, "l RETURN l l"); + kamiFontPrintf((s16)3, (s16)7, FONT_COLOR_BLACK, "+--------------------+----+"); + + // カーソル消去 + SetCursorPos((u16)200, (u16)200); + + FADE_IN_RETURN( NandfirmProcessTWLC1 ); +} + +void* NandfirmProcessTWLC1(void) +{ + BOOL ret; + + ret = writebackFirm(); + + if( ret ) + { + gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_SUCCESS; + kamiFontPrintfConsole(CONSOLE_ORANGE, "nandfirm write succeeded.") ; + FADE_OUT_RETURN(AutoProcess1); + } + else + { + gAutoProcessResult[AUTO_PROCESS_MENU_IMPORT_NANDFIRM] = AUTO_PROCESS_RESULT_FAILURE; + kamiFontPrintfConsole(CONSOLE_RED, "nandfirm write failed.") ; + FADE_OUT_RETURN(AutoProcess2); + } + + +} + + +static BOOL writebackFirm( void ) +{ + u8 *pBuf; + u32 allocSize; + u32 fileSize = (u32)(&nandfirm_end) - (u32)(&nandfirm_begin); + u32 nandfirmSize = fileSize - NANDFIRM_FILE_START_OFFSET; + u32 writeBlock; + BOOL ret = TRUE; + + if( 800*1024 < fileSize ) + { + kamiFontPrintfConsole(CONSOLE_RED, "too large file size." ); + return FALSE; + } + + // 書き込みサイズは512バイトのブロック単位なのでそれに配慮 + allocSize = MATH_ROUNDUP(fileSize, 512); + pBuf = OS_Alloc(allocSize); + if(pBuf == NULL) + { + kamiFontPrintfConsole(CONSOLE_RED, "Alloc failed." ); + return FALSE; + } + + // データの読み出し + MI_CpuClear8(pBuf, allocSize); + DC_FlushRange(pBuf, allocSize); + MI_CpuCopy8( &nandfirm_begin, pBuf, fileSize); + + // データの書き出し + writeBlock = fileSize/NAND_BLOCK_BYTE + (fileSize % NAND_BLOCK_BYTE != 0); + DC_FlushRange(pBuf, allocSize); + kamiFontPrintfConsole(CONSOLE_ORANGE, "nandfirm writing..." ); + kamiNandWrite( NAND_START_OFFSET/NAND_BLOCK_BYTE, pBuf+NANDFIRM_FILE_START_OFFSET, writeBlock); + /* + // 書き込み後のCRCチェックを一応やっておく + pVerifyBuf = OS_Alloc(allocSize); + if (kamiNandRead(NAND_START_OFFSET/NAND_BLOCK_BYTE, pVerifyBuf, writeBlock ) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(pVerifyBuf, allocSize); + + crc1 = SVC_GetCRC16( 0xffff, pBuf, fileSize ); + crc2 = SVC_GetCRC16( 0xffff, pVerifyBuf, fileSize ); + if(crc1 != crc2) + { + ret = FALSE; + } + + OS_Free(pVerifyBuf);*/ + OS_Free(pBuf); + + return ret; +} diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile new file mode 100644 index 00000000..bc9c1ea3 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ../NandInitializerRed/ARM7.TWL \ + ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt b/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt new file mode 100644 index 00000000..32ddc564 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/about.txt @@ -0,0 +1,40 @@ +##概要 + +量産ベースで動作するTWLCaptureの生産工程で使用する書込みツール + +NandInitializerの機能をベースに +・sdmcブートではなくmemory-launcherからのブートを前提 +(同ディレクトリからtadを検索するのではなく、objectファイルとしてromに内包) +・書き込むtadはhnaa,hnba,hnca,hnha,hnlaに決め打ち +・HWInfoなどを書き込まない + +といった変更を施したもの + + +##つかいかた + +1. 以下の配置で書き込みたいtadファイルとnandfirmを入れる + +-ARM9.TWL---include + |-src + --data---dev---HNAA.tad(開発ビルド用tad) + | |-HNBA.tad + | |-HNCA.tad + | |-HNHA.tad + | |-HNLA.tad + | --nandfirm.nand + | + --prod---HNAA.tad(量産用ビルドtad,要mastering,cls) + |-HNBA.tad + |-HNCA.tad + |-HNHA.tad + |-HNLA.tad + --nandfirm.nand + +2. ./make.rb [dev/prod/full] + + +・もし該当するtad/nandファイルが無ければ既に配置してある.oファイルを利用する。 + + +※あとでちゃんとしたMakefileを書く予定 diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile new file mode 100644 index 00000000..01bd65f4 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf new file mode 100644 index 00000000..8d127a7a Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp new file mode 100644 index 00000000..e7d5d619 Binary files /dev/null and b/build/systemMenu_tools/TWLCaptureSystemWriter/banner/icon/gameicon.bmp differ diff --git a/build/systemMenu_tools/TWLCaptureSystemWriter/make.rb b/build/systemMenu_tools/TWLCaptureSystemWriter/make.rb new file mode 100755 index 00000000..37dd2176 --- /dev/null +++ b/build/systemMenu_tools/TWLCaptureSystemWriter/make.rb @@ -0,0 +1,159 @@ +#!ruby +# build TwlIPL Root -> build nandfirm -> convert nandfirm -> +# build systemlogreader -> build gcdfirm +# 実行時引数に"dev"を渡すと開発ビルド(default)、"prod"を渡すと量産ビルドを生成 + +# mastering.TWL.exeにパスが通っている環境 +#MASTERING = "mastering" +# mastering.TWL.exeにパスが通っていない環境 +MASTERING = ENV['TWL_IPL_RED_PRIVATE_ROOT'] + "/tools/bin/mastering.TWL.exe -i " + + ENV['TWL_IPL_RED_PRIVATE_ROOT'] + "/tools/bin/mastering.TWL.ini -s -t" + +BIN2OBJ = ENV['TWLSDK_ROOT'] + '/tools/bin/bin2obj.TWL.exe' +TARGET_BIN = "TWLCaptureSystemWriter" +INCLUDE_FILE = ['HNAA', 'HNBA', 'HNCA', 'HNHA', 'HNLA', 'nandfirm'] +ROOT_DIR = ENV['TWL_IPL_RED_ROOT'] + "/build/systemMenu_tools/#{TARGET_BIN}" +def putex(str) + # puts command and execute + puts 'execute : ' + str + system str +end + +def namesafix(basename) + if basename == 'nandfirm' + return 'nand' + else + return 'tad' + end +end + +# .tad/.nandを探す +def checkOriginalFile(basename) + return Dir.entries(".").include?("#{basename}.#{namesafix(basename)}") +end + +def checkObjectFile(basename) + return Dir.entries(".").include?("#{basename}.o") +end + +def convertToObj(basename) + putex("#{BIN2OBJ} -b #{basename.downcase}_begin -e #{basename.downcase}_end #{basename}.#{namesafix(basename)} #{basename}.o") +end + +def build_TWLIPLTree(prodopt) + Dir.chdir(ENV['TWL_IPL_RED_ROOT']) do + putex "make -f Makefile.full clean; " + + "makesp CYGPATH_NOCMD=TRUE -j 2 -f Makefile.full TWL_FINALROM=TRUE #{prodopt}" + end +end + +def build_target(buildtype, prodopt) + # build target + putex "makesp CYGPATH_NOCMD=TRUE -j 2 clean; makesp CYGPATH_NOCMD=TRUE -j 2 TWL_FINALROM=TRUE #{prodopt}" + Dir.chdir(ROOT_DIR + "/ARM9.TWL/bin/ARM9-TS.LTD.thumb/Rom") do + if buildtype == "dev" + putex "cp ./#{TARGET_BIN}.srl $TWL_IPL_RED_ROOT/build/gcdfirm/memory-launcher-writer/" + else + # 量産用の場合はsrlにマスタリングをかける + putex "#{MASTERING} #{TARGET_BIN}.srl #{TARGET_BIN}.srl.master -s -t" + putex "cp ./#{TARGET_BIN}.srl.master $TWL_IPL_RED_ROOT/build/gcdfirm/memory-launcher-writer/#{TARGET_BIN}.srl" + end + end +end + +def build_nandfirm(prodopt) + + kDir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/nandfirm/menu-launcher") do + putex "make clean; make TWL_FINALROM=TRUE #{prodopt}" + nandfirm = Dir.glob("menu_launcher*#{buildtype}.nand") + if nandfirm.none? + puts "build nandfirm failed." + exit + else + nandfirm = nandfirm[0] + end + putex "$TWLSDK_ROOT/tools/bin/bin2obj.TWL.exe #{nandfirm} nandfirm.#{buildtype}.o " + + "-b nandfirm_begin -e nandfirm_end" + putex "cp nandfirm.#{buildtype}.o #{ROOT_DIR}/ARM9.TWL/nandfirm/" + end +end + +def build_includeFile(buildtype) + Dir.chdir(ROOT_DIR + "/ARM9.TWL/data/#{buildtype}") do + INCLUDE_FILE.each do |f| + if checkOriginalFile f + convertToObj f + elsif checkObjectFile f + puts "WARNING(#{f}): original file notfound. using object file in existence." + else + puts "ERROR(#{f}): both tad/nand file and object file is not found." + exit + end + end + end +end + +def mainproc(buildtype, shortbuild) + prodopt = buildtype == "dev"? "FIRM_USE_PRODUCT_KEYS=" : "FIRM_USE_PRODUCT_KEYS=TRUE" + puts "buildtype : #{buildtype}" + puts "**shortbuild**" if shortbuild + + # build TwlIPL Root + unless shortbuild + build_TWLIPLTree(prodopt) + end + + build_includeFile buildtype + build_target buildtype, prodopt + build_gcdfirm(buildtype, prodopt) + +end + + +def build_gcdfirm(buildtype, prodopt) + + # build memory_launcher + Dir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/nandfirm/memory-launcher") do + putex "make clean; make TWL_FINALROM=TRUE #{prodopt}" + end + + # build memorylauncherwriter + Dir.chdir(ENV['TWL_IPL_RED_ROOT'] + "/build/gcdfirm/memory-launcher-writer") do + putex "make clean; make TWL_FINALROM=TRUE APPEND_SRL=#{TARGET_BIN}.srl #{prodopt} " + putex "cp ./memory_launcher_writer-FINALROM.gcd " + + "$TWL_IPL_RED_ROOT/build/systemMenu_tools/#{TARGET_BIN}/memory_launcher_writer-FINALROM.#{buildtype}.gcd -f" + end +end + +#=== main === + + +shortbuild = false + +# default buildtype = dev +if ARGV.none? || ARGV.include?('dev') + build = ["dev"] +elsif ARGV.include?("prod") + build = ["prod"] +elsif ARGV.include? "full" + build = ["dev", "prod"] +else + puts "invalid arguments." + exit +end + +if ARGV.include? "short" + # build=fullでshortbuildは無効 + if ARGV.include? "full" + puts 'build "full" needs to re-build TWLIPL tree.' + exit + else + shortbuild = true + end +end + + +build.each do |b| + mainproc(b,shortbuild) +end + diff --git a/build/systemMenu_tools/common/ARM7/include/formatter.h b/build/systemMenu_tools/common/ARM7/include/formatter.h new file mode 100644 index 00000000..57d44d93 --- /dev/null +++ b/build/systemMenu_tools/common/ARM7/include/formatter.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: formatter.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 NAND_INITIALIZER_FORMATTER_H_ +#define NAND_INITIALIZER_FORMATTER_H_ + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +BOOL ExeFormat(FormatMode format_mode); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* NAND_INITIALIZER_FORMATTER_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/common/ARM7/include/mcu_firm.h b/build/systemMenu_tools/common/ARM7/include/mcu_firm.h new file mode 100644 index 00000000..6bd31836 --- /dev/null +++ b/build/systemMenu_tools/common/ARM7/include/mcu_firm.h @@ -0,0 +1,22 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - mcu + File: mcu_firm.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$ + *---------------------------------------------------------------------------*/ +#ifndef TWL_IPL_MCU_WRITEFIRM_H_ +#define TWL_IPL_MCU_WRITEFIRM_H_ + +BOOL MCU_WriteFirm(const unsigned char* hex); + +#endif diff --git a/build/systemMenu_tools/common/ARM7/src/formatter.c b/build/systemMenu_tools/common/ARM7/src/formatter.c new file mode 100644 index 00000000..07d3e013 --- /dev/null +++ b/build/systemMenu_tools/common/ARM7/src/formatter.c @@ -0,0 +1,390 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: formatter.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 +#include +#include "formatter.h" + +extern BOOL FATFSi_nandFillPartition( int partition_no, u32* buf, u32 blocks); + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct FileProperty { + u32 length; + const char *path; +}FileProperty; + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define ERROR_RETURN() { OS_TPrintf("FATAL ERROR OCCURED %s %s\n", __FILE__, __LINE__); return 0; } + +//------- 重要 -------- +#define PARTITION_RAW_SIZE 1024 // 1*1024 +#define PARTITION_0_SIZE 210944 // 206*1024 +#define PARTITION_1_SIZE 33536 // 32.75*1024 +#define NAND_FAT_PARTITION_NUM 3 // FATパーティション数(RAWパーティションを除く) + // 実際には PARTITION 0&1 の2つだけですが3を指定します。 + // 最終PARTISIONのサイズ指定は無視され残りサイズが適用されるためです。 + // PARTISION2 には残りサイズが適用されますが使用しないため + // フォーマットは行いません。 + +// const data-------------------------------------------------------- +#define FS_READ_BLOCK_SIZE ( 2 * 1024 ) +#define FATFS_CLUSTER_SIZE ( 16 * 1024 ) + +static const char *s_pDirList0[] = { + (const char *)"nand:/sys", + (const char *)"nand:/title", + (const char *)"nand:/ticket", + (const char *)"nand:/shared1", + (const char *)"nand:/shared2", + (const char *)"nand:/import", + (const char *)"nand:/tmp", + NULL, +}; + +static const char *s_pDirList1[] = { + (const char *)"nand2:/photo", + NULL, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static BOOL CreateDirectory( const char *pDrive, const char **ppDirList ); +static BOOL CheckDirectory ( const char *pDrive, const char **ppDirList ); +static BOOL CreateFile( const FileProperty *pFileList ); +static BOOL CheckFile ( const FileProperty *pFileList ); +static int MY_ReadFile( FATFSFileHandle file, void *pBuffer, int length ); + +/*---------------------------------------------------------------------------* + Name: ExeFormat + + Description: Nandのフォーマットを行います + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL +ExeFormat(FormatMode format_mode) +{ + u32 *init_datbuf; + const int INIT_DATA_BUFFER_SIZE = 512*16; + int nand_fat_partition_num; + + init_datbuf = OS_AllocFromSubPrivWram( INIT_DATA_BUFFER_SIZE ); + if( init_datbuf == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + + MI_CpuFill8( init_datbuf, 0xFF, INIT_DATA_BUFFER_SIZE); + + // NANDをフォーマット + { + u8 drive_nand; + u8 drive_nand2; + char drive_nand_path[4]; + char drive_nand2_path[4]; + + /* パーティションサイズをプロンプトから設定 */ + u32 partition_MB_size[5]; + partition_MB_size[0] = PARTITION_RAW_SIZE; // RAW領域 + partition_MB_size[1] = PARTITION_0_SIZE; // FAT0領域 + partition_MB_size[2] = PARTITION_1_SIZE; // FAT1領域 + nand_fat_partition_num = NAND_FAT_PARTITION_NUM; + + // nand&nand2のドライブ割り当てを調べる + { + const OSMountInfo *info; + + // ランチャーから起動していない場合はshared領域を参照。 + if (*(const u8 *)HW_TWL_RED_LAUNCHER_VER == 0) + { + info = OS_GetMountInfo(); + } + // 環境が新ランチャーへ移行しているならそちらを参照。 + else + { + extern const u8 SDK_MOUNT_INFO_TABLE[]; + info = (const OSMountInfo *)SDK_MOUNT_INFO_TABLE; + } + + for (; *info->drive; ++info) + { + if (!STD_CompareNString( "nand2", info->archiveName, 5 )) + { + drive_nand2 = *(info->drive); + STD_TSPrintf(drive_nand2_path, "%c:", drive_nand2); + } + else if (!STD_CompareNString( "nand", info->archiveName, 4 )) + { + drive_nand = *(info->drive); + STD_TSPrintf(drive_nand_path, "%c:", drive_nand); + } + } + } + + // nand nand2 ドライブアンマウント + FATFS_UnmountDrive( drive_nand_path ); + FATFS_UnmountDrive( drive_nand2_path ); + + // NANDのパーティションを指定 + // sizeInMB : パーティションサイズをメガバイト単位で格納した配列 + // partitions : パーティション総数 + if (FATFSi_SetNANDPartitionsKiroBytes(partition_MB_size, nand_fat_partition_num)) + { + // マウント + if (FATFS_MountDrive(drive_nand_path, FATFS_MEDIA_TYPE_NAND, 0)) + { + // デフォルトドライブ設定 + if (!FATFS_SetDefaultDrive(drive_nand_path)) + { + return FALSE; + } + // 指定のパスが指すドライブを含むメディア全体を初期化 + else if(!FATFS_FormatMedia(drive_nand_path)) + { + return FALSE; + } + // パーティション内を指定バッファの内容でフィルする + else if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( 0, init_datbuf, INIT_DATA_BUFFER_SIZE)) + { + return FALSE; + } + // 指定のパスが指すドライブ全体を初期化 + else if(!FATFS_FormatDrive(drive_nand_path)) + { + return FALSE; + } + else + { + // FAT1パーティションの初期化 + if(!FATFS_MountDrive(drive_nand2_path, FATFS_MEDIA_TYPE_NAND, (u32)1)) + { + return FALSE; + } + if (format_mode == FORMAT_MODE_FULL && !FATFSi_nandFillPartition( 1, init_datbuf, INIT_DATA_BUFFER_SIZE)) + { + return FALSE; + } + else if (!FATFS_FormatDrive(drive_nand2_path)) + { + return FALSE; + } + } + } + } + } + + // メモリ解放 + OS_FreeToSubPrivWram( init_datbuf ); + + // ディレクトリ生成&チェック + if (!CreateDirectory( "nand:", s_pDirList0 )) { return FALSE; } + if (!CheckDirectory ( "nand:", s_pDirList0 )) { return FALSE; } + if (!CreateDirectory( "nand2:", s_pDirList1 )) { return FALSE; } + if (!CheckDirectory ( "nand2:", s_pDirList1 )) { return FALSE; } + + // ファイル生成&チェック +// if (!CreateFile( &s_fileList[0] )) { return FALSE; } +// if (!CheckFile ( &s_fileList[0] )) { return FALSE; } + + // 成功 + return TRUE; +} + + +// ディレクトリ作成 +static BOOL CreateDirectory( const char *pDrive, const char **ppDirList ) +{ + // デフォルトドライブの指定 + OS_TPrintf( "\nCreate directory : %s\n", pDrive ); + if( !FATFS_SetDefaultDrive( pDrive ) ) { + ERROR_RETURN(); + } + + // 指定されたディレクトリをルートに作成 + while( *ppDirList ) { + OS_TPrintf( " %s...", *ppDirList ); + if( !FATFS_CreateDirectory( *ppDirList, "rwxrwxrwx") ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + OS_TPrintf( "ok.\n" ); + ppDirList++; + } + + return TRUE; +} + + +// ディレクトリ存在チェック +static BOOL CheckDirectory( const char *pDrive, const char **ppDirList ) +{ + // デフォルトドライブの指定 + OS_TPrintf( "\nCheck directory : %s\n", pDrive ); + if( !FATFS_SetDefaultDrive( pDrive ) ) { + ERROR_RETURN(); + } + + // 指定されたディレクトリをチェック + while( *ppDirList ) { + FATFSDirectoryHandle dir = FATFS_OpenDirectory( *ppDirList, "rw"); + OS_TPrintf( " %s...", *ppDirList ); + if( dir ) { + OS_TPrintf( "ok.\n" ); + (void)FATFS_CloseDirectory( dir ); + }else { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + ppDirList++; + } + + return TRUE; +} + + +// ファイル作成 +static BOOL CreateFile( const FileProperty *pFileList ) +{ + const FileProperty *pTemp = pFileList; + u32 length = 0; + u8 *pBuffer; + + // ファイルリスト中の最大サイズのバッファを確保し、"0"埋め + while( pTemp->path ) { + if( length < pTemp->length ) { + length = pTemp->length; + } + pTemp++; + } + pBuffer = OS_AllocFromSubPrivWram( length ); + if( pBuffer == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + MI_CpuClearFast( pBuffer, length ); + + OS_TPrintf( "\nCreate File :\n" ); + + // 指定されたファイルを作成して、"0"埋め + while( pFileList->path ) { + FATFSFileHandle file; + + OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length ); + // ファイル生成 + if( !FATFS_CreateFile( pFileList->path, TRUE, "rw\0rw\0rw\0" ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイルオープン + file = FATFS_OpenFile( pFileList->path, "w" ); + if( !file ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル長変更 + if( !FATFS_SetFileLength( file, (int)pFileList->length ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル書き込み + if( !FATFS_WriteFile( file, pBuffer, (int)pFileList->length ) ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイルクローズ + (void)FATFS_CloseFile( file ); + OS_TPrintf( "ok.\n" ); + pFileList++; + } + // メモリ解放 + OS_FreeToSubPrivWram( pBuffer ); + + return TRUE; +} + + +// ファイルチェック +static BOOL CheckFile( const FileProperty *pFileList ) +{ + // デフォルトドライブの指定 + OS_TPrintf( "\nCheck File :\n" ); + + // 指定されたディレクトリをルートに作成 + while( pFileList->path ) { + FATFSFileHandle file; + u32 *pBuffer; + int i; + + OS_TPrintf( " %s, %dbytes...", pFileList->path, pFileList->length ); + // ファイルオープン + file = FATFS_OpenFile( pFileList->path, "r+" ); + if( !file ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイル長チェック + if( FATFS_GetFileLength( file ) != pFileList->length ) { + OS_TPrintf( "ng. length = %d\n", FATFS_GetFileLength( file ) ); + ERROR_RETURN(); + } + // バッファ メモリ確保 + pBuffer = OS_AllocFromSubPrivWram( pFileList->length ); + if( pBuffer == NULL ) { + OS_TPrintf( "memory allocate error.\n" ); + ERROR_RETURN(); + } + // ファイル読み込み + if( + FATFS_ReadFile( file, pBuffer, (int)pFileList->length ) + != pFileList->length ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + // ファイルベリファイ + for( i = 0; i < pFileList->length / sizeof(u32); i++ ) { + if( pBuffer[ i ] != 0 ) { + OS_TPrintf( "ng.\n" ); + ERROR_RETURN(); + } + } + // メモリ解放 + OS_FreeToSubPrivWram( pBuffer ); + // ファイルクローズ + (void)FATFS_CloseFile( file ); + OS_TPrintf( "ok.\n" ); + pFileList++; + } + + return TRUE; +} diff --git a/build/systemMenu_tools/common/ARM7/src/mcu_firm.c b/build/systemMenu_tools/common/ARM7/src/mcu_firm.c new file mode 100644 index 00000000..fb3889bf --- /dev/null +++ b/build/systemMenu_tools/common/ARM7/src/mcu_firm.c @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - mcu + File: mcu_firm.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 "mcu_firm.h" + +//#define PRINT_DEBUG +//#define PRINT_DEBUG_MINI // rough version + +#ifdef PRINT_DEBUG +#include +#define DBG_PRINTF OS_TPrintf +#undef PRINT_DEBUG_MINI // because of the alternative option +#define DBG_PRINT_PROFILE_INIT OSTick debug, d +#define DBG_PRINT_PROFILE_BEGIN() (debug = OS_GetTick()) +#define DBG_PRINT_PROFILE_END() (d=(int)OS_TicksToMilliSeconds(OS_GetTick()-debug), (d ? OS_TPrintf("(%d msec)\n", d) : (void)0)) +#else +#define DBG_PRINTF( ... ) ((void)0) +#define DBG_PRINT_PROFILE_INIT +#define DBG_PRINT_PROFILE_BEGIN() ((void)0) +#define DBG_PRINT_PROFILE_END() ((void)0) +#endif +#ifdef PRINT_DEBUG_MINI +#include +#define DBG_PRINT_FUNC() OS_TPrintf("%s(0x%02X, 0x%02X);\n", __func__, I2CiDeviceAddrTable[id], reg) +#define DBG_PRINT_FUNC1(data) OS_TPrintf("%s(0x%02X, 0x%02X, 0x%02X);\n", __func__, I2CiDeviceAddrTable[id], reg, (data)) +#define DBG_PRINT_ERR() OS_TPrintf(" Failed(%d) @ %d\n", error, r) +#else +#define DBG_PRINT_FUNC() ((void)0) +#define DBG_PRINT_FUNC1(data) ((void)0) +//#define DBG_PRINT_ERR() ((void)0) +#define DBG_PRINT_ERR() OS_TPrintf("%s: I2C Error (0x%X, 0x%X) %d/%d.\n", __func__, I2CiDeviceAddrTable[id], reg, r+1, RETRY_COUNT); +//#define DBG_PRINT_ERR() OS_TPanic("%s: I2C Error (0x%X, 0x%X) %d/%d.\n", __func__, I2CiDeviceAddrTable[id], reg, r+1, RETRY_COUNT); +#endif + + +static const u8 I2CiDeviceAddrTable[I2C_SLAVE_NUM] = + { + I2C_ADDR_CAMERA_MICRON_IN, + I2C_ADDR_CAMERA_MICRON_OUT, + I2C_ADDR_CAMERA_SHARP_IN, + I2C_ADDR_CAMERA_SHARP_OUT, + I2C_ADDR_MICRO_CONTROLLER, + I2C_ADDR_DEBUG_LED, + I2C_ADDR_DEBUGGER, + }; + +static BOOL slowRate = 0; + +static inline void I2Ci_Start( void ) +{ + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | // 割り込み禁止は IE にて行うことで仕様統一 + (I2C_WRITE << REG_OS_I2C_CNT_RW_SHIFT) | + (0 << REG_OS_I2C_CNT_ACK_SHIFT) | + (1 << REG_OS_I2C_CNT_START_SHIFT)); +} + +static inline void I2Ci_Continue( I2CReadWrite rw ) +{ + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (rw << REG_OS_I2C_CNT_RW_SHIFT) | + (rw << REG_OS_I2C_CNT_ACK_SHIFT)); +} + +static inline void I2Ci_Stop( I2CReadWrite rw ) +{ + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (rw << REG_OS_I2C_CNT_RW_SHIFT) | + (0 << REG_OS_I2C_CNT_ACK_SHIFT) | + (1 << REG_OS_I2C_CNT_STOP_SHIFT)); +} + +static inline void I2Ci_StopPhase1( I2CReadWrite rw ) +{ + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (rw << REG_OS_I2C_CNT_RW_SHIFT) | + (0 << REG_OS_I2C_CNT_ACK_SHIFT)); +} +static inline void I2Ci_StopPhase2( void ) +{ + reg_OS_I2C_CNT = (u8)((1 << REG_OS_I2C_CNT_E_SHIFT) | + (1 << REG_OS_I2C_CNT_I_SHIFT) | + (1 << REG_OS_I2C_CNT_STOP_SHIFT) | + (1 << REG_OS_I2C_CNT_NT_SHIFT)); +} + +static inline void I2Ci_WaitEx( void ) // support slowRate +{ + DBG_PRINT_PROFILE_INIT; + I2Ci_Wait(); + DBG_PRINT_PROFILE_BEGIN(); + SVC_WaitByLoop(slowRate); + DBG_PRINT_PROFILE_END(); +} + +static inline void I2Ci_StopEx( I2CReadWrite rw ) // support slowRate +{ + if (slowRate) + { + I2Ci_StopPhase1(rw); + I2Ci_Wait(); + SVC_WaitByLoop(slowRate); + I2Ci_StopPhase2(); + } + else + { + I2Ci_Stop(rw); + } +} + +static inline void I2Ci_SetData( u8 data ) +{ + DBG_PRINTF("%02X", data); + reg_OS_I2C_DAT = data; +} + +static inline BOOL I2Ci_GetResult( void ) +{ + I2Ci_Wait(); + DBG_PRINTF("%c", (reg_OS_I2C_CNT & REG_OS_I2C_CNT_ACK_MASK) ? '.' : '*'); + return (BOOL)((reg_OS_I2C_CNT & REG_OS_I2C_CNT_ACK_MASK) >> REG_OS_I2C_CNT_ACK_SHIFT); +} + +static inline BOOL I2Ci_SendStart( I2CSlave id ) +{ + DBG_PRINTF("\n"); + I2Ci_Wait(); + I2Ci_SetData( (u8)(I2CiDeviceAddrTable[id] | I2C_WRITE) ); + I2Ci_Start(); + return I2Ci_GetResult(); +} + +static inline BOOL I2Ci_SendMiddle( u8 data ) +{ + I2Ci_WaitEx(); + I2Ci_SetData( data ); + I2Ci_Continue( I2C_WRITE ); + return I2Ci_GetResult(); +} + +static inline BOOL I2Ci_SendLast( u8 data ) +{ + I2Ci_WaitEx(); + I2Ci_SetData( data ); + I2Ci_StopEx( I2C_WRITE ); + return I2Ci_GetResult(); +} + +#define SLOW_RATE_DEFAULT 0x50 +#define SLOW_RATE_SHORT 0x140 +#define SLOW_RATE_LONG (HW_CPU_CLOCK_ARM7 / 13) // 300msec +#define SLOW_RATE_ENTER (HW_CPU_CLOCK_ARM7 / 160) // 25msec + +BOOL MCU_WriteFirm(const unsigned char* hex) +{ + BOOL result = TRUE; + + if ( !hex ) + { + return FALSE; // no data + } + + I2C_Lock(); + + slowRate = SLOW_RATE_DEFAULT; + + // start phase + result &= I2Ci_SendStart( I2C_SLAVE_MICRO_CONTROLLER ); + result &= I2Ci_SendMiddle( 0x77 ); // free register 7 + result &= I2Ci_SendMiddle( 0x4A ); // goto firm writing mode + + slowRate = SLOW_RATE_LONG; + + // main phase + while ( hex[0] == ':' ) // ':'から始まっている限りループする + { + int isContinue = MI_CpuComp8( hex, ":00000001FF", 11); // データ終端チェック + + // 最初の1文字 (':'のはず) + result &= I2Ci_SendMiddle( *hex++ ); + + slowRate = SLOW_RATE_SHORT; + + // 通常出力 + do + { + I2Ci_SendMiddle( *hex ); + } + while ( *hex++ != '\n' ); + + slowRate = SLOW_RATE_ENTER; + + if ( !isContinue ) // 最終行だった + { + break; + } + } + + // stop phase (only 2nd call) + I2Ci_WaitEx(); + I2Ci_StopPhase2(); + + I2C_Unlock(); + + return result; +} + diff --git a/build/systemMenu_tools/common/ARM9/include/common_utility.h b/build/systemMenu_tools/common/ARM9/include/common_utility.h new file mode 100644 index 00000000..f1a03d77 --- /dev/null +++ b/build/systemMenu_tools/common/ARM9/include/common_utility.h @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - Tools + File: common_utility.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 COMMON_UTILITY_H_ +#define COMMON_UTILITY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: MakeFullPathForSD + + Description: SDアーカイブ用のフルパスを作成します。 + + Arguments: + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void MakeFullPathForSD(char* file_name, char* full_path) +{ + STD_CopyString( full_path, "sdmc:/" ); + STD_ConcatenateString( full_path, file_name ); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* COMMON_UTILITY_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/common/ARM9/include/debugger_card_rom.h b/build/systemMenu_tools/common/ARM9/include/debugger_card_rom.h new file mode 100644 index 00000000..6475db43 --- /dev/null +++ b/build/systemMenu_tools/common/ARM9/include/debugger_card_rom.h @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: debugger_card_rom.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 DEBUGGER_HW_CARD_ROM_H_ +#define DEBUGGER_HW_CARD_ROM_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEBUGGER_COMMAND_LOOK_SCREEN 0x00000001 +#define DEBUGGER_COMMAND_ALREADY 0x00000002 +#define DEBUGGER_COMMAND_NOW_UPDATE 0x00000003 +#define DEBUGGER_COMMAND_CANCELED 0x00000004 +#define DEBUGGER_COMMAND_FINISHED 0x00000005 + +/*---------------------------------------------------------------------------* + Name: CARDi_ReadRomIDCoreEx + + Description: カード ID の読み出し。 + + Arguments: dontCare : gRD_IDの don't care ビットにセットする値 + + Returns: カード ID + *---------------------------------------------------------------------------*/ +u32 CARDi_ReadRomIDCoreEx(u32 dontCare); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* DEBUGGER_HW_CARD_ROM_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/common/ARM9/include/debugger_hw_reset_control.h b/build/systemMenu_tools/common/ARM9/include/debugger_hw_reset_control.h new file mode 100644 index 00000000..763e7109 --- /dev/null +++ b/build/systemMenu_tools/common/ARM9/include/debugger_hw_reset_control.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: debugger_hw_reset_control.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 DEBUGGER_HW_RESET_CONTROL_H_ +#define DEBUGGER_HW_RESET_CONTROL_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: DEBUGGER_HwResetDisable + + Description: IS-TWL-DEBUGGERでのハードウェアリセットを禁止します。 + この機能はデバッガディゼーブルフラグを指定したSRL + でのみ有効です。内部動作としては、5秒毎にカードアクセスを + 行うスレッドを生成起動しています。IS-TWL-DEBUGGERは + カードアクセスを監視していて10秒間カードアクセスがない + 場合にハードウェアリセットを許可する仕組みになっています。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void DEBUGGER_HwResetDisable( void ); + +/*---------------------------------------------------------------------------* + Name: DEBUGGER_HwResetEnable + + Description: IS-TWL-DEBUGGERでのハードウェアリセットを許可します。 + この機能はデバッガディゼーブルフラグを指定したSRL + でのみ有効です。実際にハードウェアリセットが可能になるには + 最大で10秒かかります。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void DEBUGGER_HwResetEnable( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* DEBUGGER_HW_RESET_CONTROL_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/common/ARM9/src/debugger_card_rom.c b/build/systemMenu_tools/common/ARM9/src/debugger_card_rom.c new file mode 100644 index 00000000..f129cd6f --- /dev/null +++ b/build/systemMenu_tools/common/ARM9/src/debugger_card_rom.c @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: debugger_card_rom.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 "debugger_card_rom.h" + +/*---------------------------------------------------------------------------*/ +/* constants */ + +#define CARD_COMMAND_ID 0x07000000 +#define CARD_COMMAND_MASK 0x07000000 +#define CARD_RESET_HI 0x20000000 +#define CARD_COMMAND_OP_G_READID 0xB8 + +/*---------------------------------------------------------------------------* + Name: CARDi_GetRomFlag + + Description: カードコマンドコントロールパラメータを取得 + + Arguments: flag カードデバイスへ発行するコマンドのタイプ + (CARD_COMMAND_PAGE / CARD_COMMAND_ID / + CARD_COMMAND_STAT / CARD_COMMAND_REFRESH) + + Returns: カードコマンドコントロールパラメータ + *---------------------------------------------------------------------------*/ +SDK_INLINE u32 CARDi_GetRomFlag(u32 flag) +{ + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + return (u32)(flag | REG_MI_MCCNT1_START_MASK | CARD_RESET_HI | (rom_ctrl & ~CARD_COMMAND_MASK)); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_SetRomOp + + Description: カードコマンド設定 + + Arguments: command コマンド + offset 転送ページ数 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CARDi_SetRomOp(u32 command, u32 offset) +{ + u32 cmd1 = (u32)((offset >> 8) | (command << 24)); + u32 cmd2 = (u32)((offset << 24)); + // 念のため前回のROMコマンドの完了待ち。 + while ((reg_MI_MCCNT1 & REG_MI_MCCNT1_START_MASK) != 0) + { + } + // マスターイネーブル。 + reg_MI_MCCNT0 = (u16)(REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_I_MASK | + (reg_MI_MCCNT0 & ~REG_MI_MCCNT0_SEL_MASK)); + // コマンド設定。 + reg_MI_MCCMD0 = MI_HToBE32(cmd1); + reg_MI_MCCMD1 = MI_HToBE32(cmd2); +} + +/*---------------------------------------------------------------------------* + Name: CARDi_ReadRomIDCoreEx + + Description: カード ID の読み出し。 + + Arguments: dontCare : gRD_IDの don't care ビットにセットする値 + + Returns: カード ID + *---------------------------------------------------------------------------*/ +u32 CARDi_ReadRomIDCoreEx(u32 dontCare) +{ + u8 op = CARD_COMMAND_OP_G_READID; + + CARDi_SetRomOp(op, dontCare); + reg_MI_MCCNT1 = (u32)(CARDi_GetRomFlag(CARD_COMMAND_ID) & ~REG_MI_MCCNT1_L1_MASK); + while ((reg_MI_MCCNT1 & REG_MI_MCCNT1_RDY_MASK) == 0) + { + } + return reg_MI_MCD1; +} + diff --git a/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c b/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c new file mode 100644 index 00000000..a1f50733 --- /dev/null +++ b/build/systemMenu_tools/common/ARM9/src/debugger_hw_reset_control.c @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: debugger_hw_reset_control.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 "debugger_hw_reset_control.h" + +extern u32 CARDi_ReadRomIDCore(void); + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +#define OS_THREAD_PRIORITY_IS_TWL_DEBUGGER_HW_RESET_CONTROL 15 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +vu8 sHwResetEnable = TRUE; +OSThread sThread; +u32 sStack[1024]; +static s32 sLockId; + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ +static void CardAccessThread(void* arg); + +/*---------------------------------------------------------------------------* + Name: CardAccessThread + + Description: 5行毎にダミーのカードアクセスを行います。 + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CardAccessThread(void* arg) +{ +#pragma unused(arg) + + while (!sHwResetEnable) + { + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCore(); + CARD_UnlockRom((u16)sLockId); + + // 5秒間スリープ + OS_Sleep(5000); + } +} + +/*---------------------------------------------------------------------------* + Name: DEBUGGER_HwResetDisable + + Description: IS-TWL-DEBUGGERでのハードウェアリセットを禁止します。 + この機能はデバッガディゼーブルフラグを指定したSRL + でのみ有効です。内部動作としては、5秒毎にカードアクセスを + 行うスレッドを生成起動しています。IS-TWL-DEBUGGERは + カードアクセスを監視していて10秒間カードアクセスがない + 場合にハードウェアリセットを許可する仕組みになっています。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void DEBUGGER_HwResetDisable( void ) +{ + if (sLockId == 0) + { + sLockId = OS_GetLockID(); + } + + if (sHwResetEnable) + { + sHwResetEnable = FALSE; + + OS_CreateThread(&sThread, CardAccessThread, NULL, + (void*)((u32)sStack + sizeof(sStack)), sizeof(sStack), + OS_THREAD_PRIORITY_IS_TWL_DEBUGGER_HW_RESET_CONTROL); + OS_WakeupThreadDirect(&sThread); + } +} + +/*---------------------------------------------------------------------------* + Name: DEBUGGER_HwResetEnable + + Description: IS-TWL-DEBUGGERでのハードウェアリセットを許可します。 + この機能はデバッガディゼーブルフラグを指定したSRL + でのみ有効です。実際にハードウェアリセットが可能になるには + 最大で10秒かかります。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void DEBUGGER_HwResetEnable( void ) +{ + if (!sHwResetEnable) + { + sHwResetEnable = TRUE; + OS_WakeupThreadDirect(&sThread); + while (!OS_IsThreadTerminated(&sThread)){} + } +} diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/Makefile b/build/systemMenu_tools/devkpDelete/ARM9.TWL/Makefile new file mode 100644 index 00000000..5417e51d --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +# nandapp にする場合はこの辺とかのコメントをはずす +# rsfの方もmediaをNandにする + +# TWL_NANDAPP = TRUE + + +SRCS = main.c font.c screen.c keypad.c +LINCLUDES = ./include +SRCDIR = ./src +TARGET_BIN = NewApp.srl +# TARGET_BIN = NewApp.tad +ROM_SPEC = main.rsf + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +DEFAULT_MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +# MAKETAD_OPTION += -s +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/font.h b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/font.h new file mode 100644 index 00000000..9e703b04 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/font.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/keypad.h b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/screen.h b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/screen.h new file mode 100644 index 00000000..7e55f3e1 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +#define CONSOLE_BLACK 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 +#define CONSOLE_BLUE 3 +#define CONSOLE_YELLOW 4 +#define CONSOLE_WHITE 15 + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/main.rsf b/build/systemMenu_tools/devkpDelete/ARM9.TWL/main.rsf new file mode 100644 index 00000000..f8b5be91 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/main.rsf @@ -0,0 +1,198 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "devkpdelete" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + Secure TRUE + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 014A + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 1 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 128K +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/font.c b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/font.c new file mode 100644 index 00000000..c5c4bf70 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/font.c @@ -0,0 +1,580 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/keypad.c b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/main.c b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/main.c new file mode 100644 index 00000000..1f4a2703 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/main.c @@ -0,0 +1,173 @@ + +#include +#include +#include "font.h" +#include "screen.h" +#include "keypad.h" + +#define DEVKP_PATH "nand:/sys/dev.kp" + +void VBlankIntr(void); +void myInit(void); +BOOL isDamyDevkp(); +BOOL deleteDevkp(); + +s16 drawLine = 0; + +void TwlMain( void ) +{ + myInit(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + PrintString(0, drawLine++, CONSOLE_WHITE, "Press A key To delete dev.kp"); + + while(1){ + kamiPadRead(); + + if(kamiPadIsTrigger(PAD_BUTTON_A)){ + + if (! isDamyDevkp() ) + { + PrintString(0, drawLine++, CONSOLE_RED, "Dev.kp is not damy or existed."); + break; + } + + if ( !deleteDevkp() ) + { + FSResult res = FS_GetArchiveResultCode(DEVKP_PATH); + PrintString(0, drawLine++, CONSOLE_RED, "Delete Failed. Err:%03x", res); + break; + } + + PrintString(0, drawLine++, CONSOLE_WHITE, "Delete Succeeded."); + } + + + } + + OS_WaitVBlankIntr(); + OS_Terminate(); +} + +static BOOL deleteDevkp() +{ + return FS_DeleteFile(DEVKP_PATH); +} + +static BOOL isDamyDevkp() +{ + FSFile file; + u32 filesize; + + // ファイルサイズだけ取得する + + if( ! FS_OpenFileEx(&file, DEVKP_PATH, FS_FILEMODE_R)) + { + FSResult res = FS_GetArchiveResultCode(DEVKP_PATH); + PrintString(0, drawLine++, CONSOLE_RED, "File Open Failed. err:%03x",res); + return FALSE; + } + + filesize = FS_GetFileLength(&file); + + FS_CloseFile(&file); + + return + filesize == 16384 || filesize == 5 ? + TRUE : + FALSE ; +} + +static void +VBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + + +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSytem init + FS_Init(FS_DMA_NOT_USE); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + diff --git a/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/screen.c b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/screen.c new file mode 100644 index 00000000..ce2df03b --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/ARM9.TWL/src/screen.c @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/systemMenu_tools/devkpDelete/Makefile b/build/systemMenu_tools/devkpDelete/Makefile new file mode 100644 index 00000000..063c7eaf --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/devkpDelete/banner/Makefile b/build/systemMenu_tools/devkpDelete/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/devkpDelete/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/devkpDelete/banner/banner_v3.bsf b/build/systemMenu_tools/devkpDelete/banner/banner_v3.bsf new file mode 100644 index 00000000..9474941b Binary files /dev/null and b/build/systemMenu_tools/devkpDelete/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/devkpDelete/banner/icon/gameIcon.bmp b/build/systemMenu_tools/devkpDelete/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5f20b0d8 Binary files /dev/null and b/build/systemMenu_tools/devkpDelete/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile new file mode 100644 index 00000000..af17b0e1 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM7.TWL/Makefile @@ -0,0 +1,89 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = crt0.SCFG_NOLOCK.c \ + main.c \ + kami_pxi.c \ + formatter.c \ + mcu_firm.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = ../../NandInitializerRed/ARM7.TWL/$(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCFG_NOLOCK.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/os/common/include \ + $(ROOT)/build/libraries/init/common/include \ + $(TWL_IPL_RED_ROOT)/include \ + ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM7.TWL/include \ + ../../common/ARM7/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCDIR = ../../NandInitializerRed/ARM7.TWL/src \ + ../../common/ARM7/src + +LLIBRARY_DIRS += $(TWL_IPL_RED_ROOT)/lib/ARM7-TS/$(TWL_BUILD_DIR) \ + ./obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libreloc_info_sp$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile new file mode 100644 index 00000000..d6f354d8 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/Makefile @@ -0,0 +1,72 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_tools - nandfirmVersionChecker +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SYSM_DISABLE_DEBUG = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NVA +#TARGET_TAD = + +TARGET_BIN = nandfirmVersionChecker.srl + +LCFILE_SPEC = ../../NandInitializerRed/ARM9.TWL/ARM9-TS.lsf +ROM_SPEC = ./main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c + +LINCLUDES = ../../NandInitializerRed/common/include \ + ../../NandInitializerRed/ARM9.TWL/include + +SRCDIR = ./src \ + ../../NandInitializerRed/ARM9.TWL/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf new file mode 100644 index 00000000..14b62bdc --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/main.rsf @@ -0,0 +1,221 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL +} diff --git a/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c new file mode 100644 index 00000000..b408f3bc --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/ARM9.TWL/src/main.c @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandfirmVersionChecker + File: main.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 "kami_font.h" +#include "graphics.h" +#include "keypad.h" +#include "kami_pxi.h" + +#define SCRAMBLE_MASK 0x00406000 +#define NAND_BLOCK_SIZE 0x200 + +extern void HWInfoWriterInit( void ); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static FSEventHook sSDHook; +static u8 tempBuf[NAND_BLOCK_SIZE]; +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitTick(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + kamiFontPrintfConsole( CONSOLE_ORANGE, "+------------------------------+"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "l nandfirm Version Checker l"); + kamiFontPrintfConsole( CONSOLE_ORANGE, "+------------------------------+\n"); + + DC_FlushRange(tempBuf, sizeof(tempBuf)); + + // ブロック単位、バイト単位、ブロック単位 + if (kamiNandRead(1, tempBuf, 1) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(tempBuf, NAND_BLOCK_SIZE); + + { + NANDHeaderLow* header = (NANDHeaderLow *)tempBuf; + u32 offsetbyte = header->sub_rom_offset + header->sub_size; + u32 offsetblock = offsetbyte / NAND_BLOCK_SIZE; + + // ブロック単位、バイト単位、ブロック単位 + if (kamiNandRead(offsetblock, tempBuf, 1) == KAMI_RESULT_SEND_ERROR) + { + kamiFontPrintfConsoleEx(1, "kamiNandRead ... %s!\n", "ERROR"); + } + DC_FlushRange(tempBuf, NAND_BLOCK_SIZE); + + if (tempBuf[0] != 0) + { + kamiFontPrintfConsole( CONSOLE_ORANGE, "%s\n", tempBuf); + } + else + { + kamiFontPrintfConsole( CONSOLE_ORANGE, "OLD Version\n"); + } + } + + while (1) + { + kamiPadRead(); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + diff --git a/build/systemMenu_tools/nandfirmVersionChecker/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/Makefile new file mode 100644 index 00000000..a2c33b15 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile b/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/nandfirmVersionChecker/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf b/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf new file mode 100644 index 00000000..746f3f40 Binary files /dev/null and b/build/systemMenu_tools/nandfirmVersionChecker/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp b/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..daa57a80 Binary files /dev/null and b/build/systemMenu_tools/nandfirmVersionChecker/banner/icon/gameIcon.bmp differ diff --git a/build/systemMenu_tools/setEULA/ARM9/Makefile b/build/systemMenu_tools/setEULA/ARM9/Makefile new file mode 100644 index 00000000..b8c8140c --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/Makefile @@ -0,0 +1,103 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - SystemMenuRED - MachineSettings +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = \ + $(ROOT)/build/libraries/os/ARM9.TWL/Makefile.sharedFont + +#---------------------------------------------------------------------------- + + +# MAKEROM SWITCH ※最終ROM作成時は、TRUEにする +SYSM_DISABLE_DEBUG ?= TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TARGET_CODEGEN ?= THUMB +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +#※RED本体設定はデバッガ対応の都合上、TITLEID_LO=HNAA, CARD_REGION=ALLとしています。 +# UIG本体設定では、リージョンに合わせてTITLEID_LO, CARD_REGIONを設定してください。 +################################################################## +TITLEID_LO = 001A +CARD_REGION = ALL +################################################################## + +TARGET_BIN = setEULA.srl + +ROM_HEADER_DIR = $(SYSMENU_ROOT)/RomHeader/$(TITLEID_LO) +SMALL_TITLEID = $(shell echo $(TITLEID_LO) | tr '[A-Z]' '[a-z]' ) +ROM_HEADER_TEMPLATE = $(ROM_HEADER_DIR)/rom_header_$(SMALL_TITLEID).template.sbin +LIBSYSCALL = $(ROM_HEADER_DIR)/libsyscall.a + +ROM_SPEC = main.rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +BG_DIR = ../../../systemMenu_RED/data + +SRCS = main.c MachineSetting.c setEULA.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c \ + $(BG_DIR)/BGData_MachineSettings.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +MAKETAD_OPTION += -s + +# libsysmenu.a は、RED本体設定でSVNのリビジョンを取得するためだけに使用しているので、 +# UIG本体設定でリンクする必要はありません。 +SYSMENU_LIBS = \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + +SDK_APPEND_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(SYSM_OUTSIDE_UI),TRUE) +MACRO_FLAGS += -DOUTSIDE_UI +endif + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/setEULA/ARM9/main.rsf b/build/systemMenu_tools/setEULA/ARM9/main.rsf new file mode 100644 index 00000000..71a76e58 --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/main.rsf @@ -0,0 +1,209 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # +################################################################ + + WramMapping MAP_TS_SCR + +################################################################ + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion $(CARD_REGION) + + # + # NANDAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、アプリジャンプされた際にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile FALSE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.c b/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.c new file mode 100644 index 00000000..8467f2c4 --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.c @@ -0,0 +1,269 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mainMenu.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// define data------------------------------------------ + + // キャンセルボタンLCD領域 +#define CANCEL_BUTTON_TOP_X ( 12 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + 5 * 8 ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + 2 * 8 ) + // OKボタンLCD領域 +#define OK_BUTTON_TOP_X ( 22 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + 2 * 8 ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + 2 * 8 ) + +// メインメニューの項目数(※ピクトチャット起動テストは除いておく) +#ifdef OUTSIDE_UI +#define SETTING_MENU_ELEMENT_NUM 5 // 社外用 +#else // !OUTSIDE_UI +#define SETTING_MENU_ELEMENT_NUM 10 // 社内用 +#endif // OUTSIDE_UI + +// extern data------------------------------------------ + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- + +// static variable ------------------------------------- +static u16 s_csr = 0; +static const u16 *s_pStrSetting[ SETTING_MENU_ELEMENT_NUM ]; // メインメニュー用文字テーブルへのポインタリスト + +// const data ----------------------------------------- + + +//=============================================== +// mainMenu.c +//=============================================== +static const u16 *const s_pStrSettingElemTbl[ SETTING_MENU_ELEMENT_NUM ][ LCFG_TWL_LANG_CODE_MAX ] = { + { + (const u16 *)L"EULA", + (const u16 *)L"EULA", + (const u16 *)L"EULA(F)", + (const u16 *)L"EULA(G)", + (const u16 *)L"EULA(I)", + (const u16 *)L"EULA(S)", + (const u16 *)L"EULA(C)", + (const u16 *)L"EULA(K)", + }, +}; + +static MenuPos s_settingPos[] = { + { TRUE, 4 * 8, 2 * 8 }, + { TRUE, 4 * 8, 4 * 8 }, + { TRUE, 4 * 8, 6 * 8 }, + { TRUE, 4 * 8, 8 * 8 }, + { TRUE, 4 * 8, 10 * 8 }, + { TRUE, 4 * 8, 12 * 8 }, + { TRUE, 4 * 8, 14 * 8 }, + { TRUE, 4 * 8, 16 * 8 }, + { TRUE, 4 * 8, 18 * 8 }, + { TRUE, 4 * 8, 20 * 8 }, +}; + + +static const MenuParam s_settingParam = { + SETTING_MENU_ELEMENT_NUM, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[ 0 ], + (const u16 **)&s_pStrSetting, +}; + +//====================================================== +// メインメニュー +//====================================================== + +// メインメニューの初期化 +void MachineSettingInit( void ) +{ + int i; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + PrintfSJIS( 0, 0, TXT_COLOR_BLUE, "Set EULA", g_strIPLSvnRevision, g_strSDKSvnRevision ); + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i = 0; i < SETTING_MENU_ELEMENT_NUM; i++ ) { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + ChangeUserColor( LCFG_TSD_GetUserColor() ); + DrawMenu( s_csr, &s_settingParam ); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + g_pNowProcess = MachineSettingMain; +} + +// メインメニュー +int MachineSettingMain( void ) +{ + BOOL tp_select; + ReadTP(); + + //-------------------------------------- + // キー入力処理 + //-------------------------------------- + if( pad.trg & PAD_KEY_DOWN ){ // カーソルの移動 + if( ++s_csr == SETTING_MENU_ELEMENT_NUM ) { + s_csr=0; + } + } + if( pad.trg & PAD_KEY_UP ){ + if( --s_csr & 0x80 ) { + s_csr=SETTING_MENU_ELEMENT_NUM - 1; + } + } + tp_select = SelectMenuByTP( &s_csr, &s_settingParam ); + DrawMenu( s_csr, &s_settingParam ); + + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( s_settingPos[ s_csr ].enable ) { +/* + switch( s_csr ) { + case 0: + SelectLanguageInit(); + g_pNowProcess = SelectLanguageMain; + break; + case 1: + SetRTCInit(); + g_pNowProcess = SetRTCMain; + break; + case 2: + SetOwnerInfoInit(); + g_pNowProcess = SetOwnerInfoMain; + break; + case 3: + TP_CalibrationInit(); + g_pNowProcess = TP_CalibrationMain; + break; + case 4: + SetWirelessInit(); + g_pNowProcess = SetWirelessMain; + break; + case 5: + CleanupMachineInit(); + g_pNowProcess = CleanupMachineMain; + break; + case 6: + SelectCountryInit(); + g_pNowProcess = SelectCountryMain; + break; + case 7: + SetParentalControlInit(); + g_pNowProcess = SetParentalControlMain; + break; + case 8: + SetEULAInit(); + g_pNowProcess = SetEULAMain; + break; + + case 9: + SetFreeSoftBoxInit(); + g_pNowProcess = SetFreeSoftBoxMain; + break; + } +*/ + } + } + + // とりあえずバックライト輝度変更をここで確認。 + if( pad.trg & PAD_BUTTON_R) { + u8 brightness; + (void)UTL_GetBacklightBrightness( &brightness ); + if( ++brightness > BACKLIGHT_BRIGHTNESS_MAX ) { + brightness = BACKLIGHT_BRIGHTNESS_MAX; + } + (void)UTL_SetBacklightBrightness( brightness ); + } + if( pad.trg & PAD_BUTTON_L ) { + u8 brightness; + (void)UTL_GetBacklightBrightness( &brightness ); + if( --brightness < 0 ) { + brightness = 0; + } + (void)UTL_SetBacklightBrightness( brightness ); + } + return 0; +} + + +// OK / CANCELボタンの描画 +void DrawOKCancelButton(void) +{ + (void)PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"CANCEL"); + (void)PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_COLOR_CYAN, (const u16 *)L"OK"); +} + + +// OK or CANCELボタン押下チェック +void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel) +{ + *tp_cancel = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp ); + *tp_ok = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp ); +} + + +//--------------------------------------------------------- +// +// 設定終了 +// +//--------------------------------------------------------- + + +// 本体設定データのライト +BOOL MY_WriteTWLSettings( void ) +{ + BOOL retval = FALSE; + u8 *pBuffer = Alloc( LCFG_WRITE_TEMP ); + if( pBuffer != NULL ) { + // *********************************************************** + // RED本体設定では、初回起動シーケンスもフラッシュ壊れシーケンスもないので、とりあえず何でも設定したらシーケンスを終了するようにする。 + LCFG_TSD_SetFlagFinishedInitialSetting( TRUE ); + LCFG_TSD_SetFlagFinishedInitialSetting_Launcher( TRUE ); + LCFG_TSD_SetFlagFinishedBrokenTWLSettings( TRUE ); + // *********************************************************** + + retval = LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ] )pBuffer ); + Free( pBuffer ); + } + return retval; +} diff --git a/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.h b/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.h new file mode 100644 index 00000000..68692120 --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/src/MachineSetting.h @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: MachineSetting.h + + Copyright 2007 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 __MACHINE_SETTING_H__ +#define __MACHINE_SETTING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + + +// define data---------------------------------------------------------- +#define TP_CSR_TOUCH_COUNT 2 // TPカーソルのチャタリング吸収のためのカウント値 +#define TP_CSR_DETACH_COUNT 2 // TPカーソルを「選択」と判定するTPデタッチからのカウント値 + +#define HANDLE_MENU 48 +#define HANDLE_RTC_VIEW 240 +#define HANDLE_OK_BUTTON 255 +#define HANDLE_CANCEL_BUTTON 256 + +// 数値入力インターフェース用ワーク(void InputDecimal()で使用) +typedef struct InputNumParam { + u16 pos_x; // 入力値の表示X位置 + u16 pos_y; // 〃     Y位置 + int up_count; + int down_count; + int keta_max; // 最大桁 + int value_min; // 入力値の最小 + int value_max; // 入力値の最大 + int y_offset; // タッチパネル入力の基準位置からのYオフセット +}InputNumParam; + +// global variable------------------------------------------------------ +extern NNSFndAllocator g_allocator; +extern int (*g_pNowProcess)( void ); +extern BOOL g_isValidTSD; + +// function------------------------------------------------------------- +extern void MachineSettingInit( void ); +extern int MachineSettingMain( void ); +extern void SetEULAInit( void ); +extern int SetEULAMain( void ); + +extern void DrawOKCancelButton( void ); +extern void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel); +extern void InputDecimal(int *tgtp, InputNumParam *inpp); + +extern BOOL MY_WriteTWLSettings( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __MACHINE_SETTING_H__ diff --git a/build/systemMenu_tools/setEULA/ARM9/src/main.c b/build/systemMenu_tools/setEULA/ARM9/src/main.c new file mode 100644 index 00000000..eb946492 --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/src/main.c @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- +int (*g_pNowProcess)( void ); +BOOL g_isValidTSD; +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + OS_InitTick(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + FS_Init( FS_DMA_NOT_USE ); + + SND_Init(); + SNDEX_Init(); + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + // ※本来ならランチャーからのパラメータチェックを行い、 + // 初回起動シーケンスに入るパスがある + + { + OS_TPrintf( "LCFGTWLOwnerInfo : 0x%04x\n", sizeof(LCFGTWLOwnerInfo) ); + OS_TPrintf( "LCFGTWLParentalControl : 0x%04x\n", sizeof(LCFGTWLParentalControl) ); + OS_TPrintf( "LCFGTWLSettingsData : 0x%04x\n", sizeof(LCFGTWLSettingsData) ); + } + + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルの読み込み + // :::::::::::::::::::::::::::::::::::::::::::::: + g_isValidTSD = FALSE; + { + u8 *pBuffer = Alloc( LCFG_READ_TEMP ); + if( pBuffer ) { + // NANDからTWL本体設定データをリード + if( LCFG_ReadTWLSettings( (u8 (*)[LCFG_READ_TEMP])pBuffer ) ) { + g_isValidTSD = TRUE; + } + Free( pBuffer ); + } + } + + UTL_CaribrateTP( LCFG_TSD_GetTPCalibrationPtr() ); + + InitBG(); + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + MachineSettingInit(); + SetEULAInit(); + g_pNowProcess = SetEULAMain; + // メインループ---------------------------- + while ( 1 ) { + OS_WaitIrq( 1, OS_IE_V_BLANK ); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + + (void)g_pNowProcess(); + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/systemMenu_tools/setEULA/ARM9/src/setEULA.c b/build/systemMenu_tools/setEULA/ARM9/src/setEULA.c new file mode 100644 index 00000000..0081ce9e --- /dev/null +++ b/build/systemMenu_tools/setEULA/ARM9/src/setEULA.c @@ -0,0 +1,641 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: setEULA.c + + Copyright 2007 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 "misc.h" +#include "MachineSetting.h" + +// +// <処理> +// 以下のEULA設定 +// ++ agree/not agreeフラグ +// ++ agree eula version +// <例外処理> +// + +// テスト表示 +#if 1 +#define DEBUGPRINT OS_TPrintf +#else +#define DEBUGPRINT(...) ((void)0) +#endif + +// define data---------------------------------- + +// ソフトウェアキーボードLCD領域 +#define CLIST_LT_X 23 +#define CLIST_LT_Y 50 +#define CLIST_MARGIN 14 +#define CLIST_KEY_PER_SEGMENT 5 +#define CLIST_SEGMENT_INTERVAL 7 + +// キャンセルボタン領域 +#define CANCEL_BUTTON_TOP_X ( 2 * 8 ) +#define CANCEL_BUTTON_TOP_Y ( 21 * 8 ) +#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + (8 * 8) ) +#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + (2 * 8) ) + +// OKボタン領域 +#define OK_BUTTON_TOP_X ( 26 * 8 ) +#define OK_BUTTON_TOP_Y ( 21 * 8 ) +#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + (4 * 8) ) +#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + (2 * 8) ) + +// ON/OFFボタン領域 +#define ON_BUTTON_TOP_X ( 6 * 8 ) +#define ON_BUTTON_TOP_Y ( 8 * 8 ) +#define ON_BUTTON_BOTTOM_X ( ON_BUTTON_TOP_X + (2 * 8) ) +#define ON_BUTTON_BOTTOM_Y ( ON_BUTTON_TOP_Y + (2 * 8) ) +#define OFF_BUTTON_TOP_X ( 18 * 8 ) +#define OFF_BUTTON_TOP_Y ( 8 * 8 ) +#define OFF_BUTTON_BOTTOM_X ( OFF_BUTTON_TOP_X + (3 * 8) ) +#define OFF_BUTTON_BOTTOM_Y ( OFF_BUTTON_TOP_Y + (2 * 8) ) + +// UP/DOWNボタン領域 +#define UP_BUTTON_TOP_X ( 21 * 8 ) +#define UP_BUTTON_TOP_Y ( 7 * 8 ) +#define UP_BUTTON_BOTTOM_X ( UP_BUTTON_TOP_X + (2 * 8) ) +#define UP_BUTTON_BOTTOM_Y ( UP_BUTTON_TOP_Y + (2 * 8) ) +#define DOWN_BUTTON_TOP_X ( 21 * 8 ) +#define DOWN_BUTTON_TOP_Y ( 13 * 8 ) +#define DOWN_BUTTON_BOTTOM_X ( DOWN_BUTTON_TOP_X + (2 * 8) ) +#define DOWN_BUTTON_BOTTOM_Y ( DOWN_BUTTON_TOP_Y + (2 * 8) ) + + +// 項目の総数 +#define MS_EULA_NUMOF_ELEMENTS 2 + +// ソフトウェアキーボードのパラメータ +#define CHAR_LIST_CHAR_NUM 120 +#define CHAR_LIST_MODE_NUM 3 + +// 特殊キーコード +#define EOM_ (u16)0xe050 +#define CODE_BUTTON_TOP_ (u16)0xe051 +#define DEL_BUTTON_ (u16)0xe051 +#define SPACE_BUTTON_ (u16)0xe052 +#define VAR_BUTTON1_ (u16)0xe053 +#define VAR_BUTTON2_ (u16)0xe054 +#define OK_BUTTON_ (u16)0xe055 +#define CANCEL_BUTTON_ (u16)0xe056 +#define CODE_BUTTON_BOTTOM_ (u16)0xe057 + +#define CHAR_USCORE L'_' +#define KEY_PER_LINE 11 + +#define KEY_START 109 //ソフトウェアキーのカーソルデフォルト位置はキャンセルキー + +#define KEY_OK 0xffff +#define KEY_CANCEL 0xfffe +#define KEY_PREVPAGE 0xfffd +#define KEY_SUCCPAGE 0xfffc +#define KEY_ON 0xfffb +#define KEY_OFF 0xfffa +#define KEY_UP 0xfff9 +#define KEY_DOWN 0xfff8 +#define MULTI_KEY_UP 0xffe0 +#define MULTI_KEY_DOWN 0xffd0 +#define MASK_MULTI_KEY 0xfff0 + +// extern data---------------------------------- + +extern u32 bg_char_data[8 * 6]; +extern u16 bg_scr_data[32 * 32]; +extern u16 bg_birth_scr_data[32 * 32]; + +// function's prototype------------------------- + +static void SetAgreeEULAInit( void ); +static int SetAgreeEULAMain( void ); +static void SetAgreedVersionInit( void ); +static int SetAgreedVersionMain( void ); + +// static variable------------------------------ +// 一時的にしか使わない物をstaticにしているので +// 少しでもダイエットしたい時はWork扱いにしてAlloc→Freeしましょう + +// メニューで使用 +static u16 sCursorMenu = 0; + +// 特定のモードでのみ使用 +static BOOL sbAgreeEULA = FALSE; +static u8 sAgreedVersion; + +// const data----------------------------------- + +// ++ メインメニュー + +static const u16 *s_pStrSetting[ MS_EULA_NUMOF_ELEMENTS ]; // メインメニュー用文字テーブルへのポインタリスト + +static const u16 *const s_pStrSettingElemTbl[ MS_EULA_NUMOF_ELEMENTS ][ LCFG_TWL_LANG_CODE_MAX ] = { + + { + (const u16 *)L"EULAへの同意", + (const u16 *)L"Agree to EULA", + (const u16 *)L"Agree to EULA(F)", + (const u16 *)L"Agree to EULA(G)", + (const u16 *)L"Agree to EULA(I)", + (const u16 *)L"Agree to EULA(S)", + (const u16 *)L"Agree to EULA(C)", + (const u16 *)L"Agree to EULA(K)", + }, + { + (const u16 *)L"同意したバージョン", + (const u16 *)L"Agreed version", + (const u16 *)L"Agreed version(F)", + (const u16 *)L"Agreed version(G)", + (const u16 *)L"Agreed version(I)", + (const u16 *)L"Agreed version(S)", + (const u16 *)L"Agreed version(C)", + (const u16 *)L"Agreed version(K)", + }, +}; + +// 表示位置 +static MenuPos s_settingPos[] = { + + { TRUE, 2 * 8, 6 * 8 }, + { TRUE, 2 * 8, 10 * 8 }, +}; + +// 表示パラメータ +static const MenuParam s_settingParam = +{ + MS_EULA_NUMOF_ELEMENTS, + TXT_COLOR_BLACK, + TXT_COLOR_GREEN, + TXT_COLOR_RED, + &s_settingPos[0], + (const u16 **)&s_pStrSetting, +}; + + +//========================================================= +// +// ボタンのタッチ処理 +// +//========================================================= + +// キャンセルボタン専用SelectSomethingFuncの実装 +static BOOL SelectCancelFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, + CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_CANCEL; + return ret; +} + +// OKボタン専用SelectSomethingFuncの実装 +static BOOL SelectOKFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, + OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OK; + return ret; +} + +// ON/OFFボタン専用SelectSomethingFuncの実装 +static BOOL SelectONFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, + ON_BUTTON_BOTTOM_X, ON_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_ON; + return ret; +} +static BOOL SelectOFFFunc( u16 *csr, TPData *tgt ) +{ + BOOL ret; + ret = WithinRangeTP( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, + OFF_BUTTON_BOTTOM_X, OFF_BUTTON_BOTTOM_Y, tgt ); + if(ret) *csr = KEY_OFF; + return ret; +} + +// UP/DOWNボタンの長押しとトリガを検出する +static BOOL DetectTouchUD( u16 *csr ) +{ + BOOL curr[2] = {FALSE, FALSE}; // 0:UP/1:DOWN + static BOOL prev[2] = {FALSE, FALSE}; // トリガ検出のために前の状態を記憶させる + BOOL trg[2] = {FALSE, FALSE}; + BOOL rep[2] = {FALSE, FALSE}; // 長押し + static u8 count[2] = {0, 0}; // 何フレーム連続で押されているか + BOOL ret = FALSE; + u16 i; + + for( i=0; i < 2; i++ ) + { + switch(i) + { + case 0: + curr[i] = WithinRangeTP( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, + UP_BUTTON_BOTTOM_X, UP_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + case 1: + curr[i] = WithinRangeTP( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, + DOWN_BUTTON_BOTTOM_X, DOWN_BUTTON_BOTTOM_Y, &tpd.disp ); + break; + default: + break; + } + + // はじめて押されたかどうか + if( !prev[i] && curr[i] ) + { + trg[i] = TRUE; + } + // 長押しカウント + if( curr[i] ) + { + if( trg[i] ) + { + count[i] = 1; + } + else if( count[i] > 25 ) + { + count[i] = 25 - 10; + rep[i] = TRUE; + } + else + { + (count[i])++; + } + } + else // 押されていないとき + { + count[i] = 0; + } + prev[i] = curr[i]; // 状態を記憶 + } + + if(trg[0] || rep[0]) + { + *csr = KEY_UP; + ret = TRUE; + } + else if(trg[1] || rep[1]) + { + *csr = KEY_DOWN; + ret = TRUE; + } + else + { + ret = FALSE; + } + return ret; +} + +// パッドのキーの長押しを検出(ReadPad()を呼び出しているループ内で呼ばれる必要がある) +static u16 DetectPadRepeat( void ) +{ + static u8 repcount[12]; // 各キーが長押しされているフレーム数 + u16 rep = 0; + int i; + + for( i=0; i < 12; i++ ) // 全部のキーについて + { + if( pad.trg & ((u16)(0x0001 << i)) ) // 押されたらカウントし始める + { + repcount[i] = 1; + } + else if( pad.cont & ((u16)(0x0001 << i)) ) + { + if( repcount[i] > 25 ) // ある一定以上のフレーム数押されていたら長押しされていたと判定 + { + rep = (u16)(rep | (u16)(0x0001 << i)); + repcount[i] = 25 - 10; + } + else + { + repcount[i]++; + } + } + else + { + repcount[i] = 0; + } + } + return rep; +} + +//========================================================= +// +// メインメニュー +// +//========================================================= + +// 描画 +static void DrawEULAMenuScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"Set EULA" ); +// PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ARETURN" ); + // メニュー項目 + DrawMenu( sCursorMenu, &s_settingParam ); + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得して表示 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + PutStringUTF16( 21*8, s_settingPos[0].y, TXT_UCOLOR_G0, + LCFG_TSD_IsAgreeEULA() ? (const u16*)L"Agree":(const u16*)L"Not agree" ); + PrintfSJIS( 21*8, s_settingPos[1].y, TXT_UCOLOR_G0, "%d", + LCFG_TSD_GetAgreedEULAVersion() ); +} + +// 初期化 +void SetEULAInit( void ) +{ + int i; + + // NITRO設定データのlanguageに応じたメインメニュー構成言語の切り替え + for( i=0; i < MS_EULA_NUMOF_ELEMENTS; i++ ) + { + s_pStrSetting[ i ] = s_pStrSettingElemTbl[ i ][ LCFG_TSD_GetLanguage() ]; + } + + // BGデータのロード処理 + GX_LoadBG1Char(bg_char_data, 0, sizeof(bg_char_data)); + GX_LoadBG1Scr(bg_scr_data, 0, sizeof(bg_scr_data)); + + DrawEULAMenuScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// メニューから呼ばれるメイン +int SetEULAMain( void ) +{ + SelectSomethingFunc func[1]={SelectCancelFunc}; + BOOL tp_select; + BOOL tpCommit = FALSE; + u16 padrep; + static u16 commit; + + ReadTP(); + + padrep = DetectPadRepeat(); // 長押し検出 + + // メニューからの項目選択 + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) ){ // カーソルの移動 + if( ++sCursorMenu >= MS_EULA_NUMOF_ELEMENTS ) { + sCursorMenu = 0; + } + } + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) ){ + if( --sCursorMenu & 0x80 ) { + sCursorMenu = (u16)(MS_EULA_NUMOF_ELEMENTS - 1); + } + } + tp_select = SelectMenuByTP( &sCursorMenu, &s_settingParam ); + + // 特殊ボタンタッチ + tpCommit = SelectSomethingByTP( &commit, func, 1 ); + + // メニューへの分岐 + if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) { // メニュー項目への分岐 + if( (s_settingParam.pos[sCursorMenu]).enable ) { + switch( sCursorMenu ) + { + case 0: + SetAgreeEULAInit(); + g_pNowProcess = SetAgreeEULAMain; + break; + case 1: + SetAgreedVersionInit(); + g_pNowProcess = SetAgreedVersionMain; + break; + } + } // if( (s_settingParam.pos[sCursorMenu]).enable ) + } // if( ( pad.trg & PAD_BUTTON_A ) || ( tp_select ) ) +/* + else if( (pad.trg & PAD_BUTTON_B) || (tpCommit && (commit == KEY_CANCEL)) ) + { + MachineSettingInit(); + return 0; + } +*/ + // 再描画 + DrawEULAMenuScene(); + return 0; +} + +//========================================================= +// +// EULA同意/非同意のセット +// +//========================================================= + +// 描画処理 +static void DrawSetAgreeEULAScene( void ) +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"Agree EULA" ); + + if( !sbAgreeEULA ) + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Not agree" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Agree" ); + } + else + { + PutStringUTF16( ON_BUTTON_TOP_X, ON_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16*)L"Not agree" ); + PutStringUTF16( OFF_BUTTON_TOP_X, OFF_BUTTON_TOP_Y, TXT_COLOR_GREEN, (const u16*)L"Agree" ); + } + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); +} + +// 初期化 +static void SetAgreeEULAInit( void ) +{ + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sbAgreeEULA = LCFG_TSD_IsAgreeEULA(); + + DrawSetAgreeEULAScene(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAgreeEULAMain( void ) +{ + SelectSomethingFunc func[4]={SelectCancelFunc, SelectOKFunc, SelectONFunc, SelectOFFFunc }; + u16 commit; + BOOL tp_touch = FALSE; + + ReadTP(); + + // キーによる選択 + if( (pad.trg & PAD_KEY_LEFT) || (pad.trg & PAD_KEY_RIGHT) ) + { + sbAgreeEULA = !sbAgreeEULA; + } + + // タッチによる選択 + tp_touch = SelectSomethingByTP( &commit, func, 4 ); + if( tp_touch && (commit == KEY_ON) ) + { + sbAgreeEULA = TRUE; + } + else if( tp_touch && (commit == KEY_OFF) ) + { + sbAgreeEULA = FALSE; + } + + // 決定 + if( (pad.trg & PAD_BUTTON_A) || (tp_touch && (commit == KEY_OK)) ) + { + LCFG_TSD_SetFlagAgreeEULA( sbAgreeEULA ); + if( !sbAgreeEULA ) { + LCFG_TSD_SetAgreedEULAVersion( 1 ); + } + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + OS_TPrintf( "AgreeEULA : %s\n", OS_IsAgreeEULA() ? "Agree" : "Not agree" ); + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + else if( (pad.trg & PAD_BUTTON_B) || (tp_touch && (commit == KEY_CANCEL)) ) + { + SetEULAInit(); // キャンセルのときセットしない + g_pNowProcess = SetEULAMain; + return 0; + } + + DrawSetAgreeEULAScene(); + return 0; +} + + +//========================================================= +// +// 同意EULAバージョンのセット +// +//========================================================= + +// 描画処理 +static void DrawSetAgreedVersionScene( void ) +{ + u16 iconUp[2] = {0xE01B, 0}; + u16 iconDown[2] = {0xE01C, 0}; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_NULL ); + PutStringUTF16( 0, 0, TXT_COLOR_BLUE, (const u16 *)L"AGREED EULA VERSION" ); + PutStringUTF16( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"ACANCEL" ); + PutStringUTF16( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)L"@OK" ); + PutStringUTF16( UP_BUTTON_TOP_X, UP_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconUp ); + PutStringUTF16( DOWN_BUTTON_TOP_X, DOWN_BUTTON_TOP_Y, TXT_UCOLOR_G0, (const u16 *)iconDown ); + PutStringUTF16( 4*8, 10*8, TXT_UCOLOR_G0, (const u16 *)L"Agreed EULA ver." ); + PrintfSJIS( 20*8, 10*8, TXT_COLOR_GREEN, "%3d", sAgreedVersion ); +} + +// 初期化 +static void SetAgreedVersionInit( void ) +{ + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + // あらかじめTWL設定データファイルから読み込み済みの設定を取得 + // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + sAgreedVersion = LCFG_TSD_GetAgreedEULAVersion(); + + DrawSetAgreedVersionScene(); + + SVC_CpuClear( 0x0000, &tpd, sizeof(TpWork), 16 ); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); +} + +// 表示プロセスとして呼び出されるメイン +static int SetAgreedVersionMain( void ) +{ + SelectSomethingFunc func[2]={SelectCancelFunc, SelectOKFunc}; + BOOL tpCommit = FALSE; + BOOL tpUD = FALSE; + u16 csrCommit; + u16 csrUD; + u16 padrep; + + ReadTP(); + + // TPチェック + tpCommit = SelectSomethingByTP( &csrCommit, func, 2 ); + tpUD = DetectTouchUD( &csrUD ); + + padrep = DetectPadRepeat(); // キーの長押し検出 + + // 変更 + if( (pad.trg & PAD_KEY_UP) || (padrep & PAD_KEY_UP) || (tpUD && (csrUD == KEY_UP)) ) + { + --sAgreedVersion; + if( sAgreedVersion == 0 ) { + sAgreedVersion = 255; + } + } + if( (pad.trg & PAD_KEY_DOWN) || (padrep & PAD_KEY_DOWN) || (tpUD && (csrUD == KEY_DOWN)) ) + { + ++sAgreedVersion; + if( sAgreedVersion == 0 ) { + sAgreedVersion = 1; + } + } + if(pad.trg & PAD_BUTTON_START) + { + sAgreedVersion = 1; + } + + // 決定 + if( pad.trg & PAD_BUTTON_A || (tpCommit && (csrCommit == KEY_OK)) ) + { + LCFG_TSD_SetAgreedEULAVersion( sAgreedVersion ); + // :::::::::::::::::::::::::::::::::::::::::::::: + // TWL設定データファイルへの書き込み + // :::::::::::::::::::::::::::::::::::::::::::::: + if( !MY_WriteTWLSettings() ) + { + OS_TPrintf( "TWL settings write failed.\n" ); + } + OS_TPrintf( "Agreed EULA version : %d\n", OS_GetAgreedEULAVersion() ); + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + else if( ( pad.trg & PAD_BUTTON_B ) || (tpCommit && (csrCommit == KEY_CANCEL)) ) + { + SetEULAInit(); + g_pNowProcess = SetEULAMain; + return 0; + } + + // 再描画 + DrawSetAgreedVersionScene(); + return 0; +} + diff --git a/build/systemMenu_tools/setEULA/Makefile b/build/systemMenu_tools/setEULA/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/systemMenu_tools/setEULA/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/systemMenu_tools/setEULA/banner/Makefile b/build/systemMenu_tools/setEULA/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/systemMenu_tools/setEULA/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/systemMenu_tools/setEULA/banner/banner_v3.bsf b/build/systemMenu_tools/setEULA/banner/banner_v3.bsf new file mode 100644 index 00000000..c5a4f1d1 Binary files /dev/null and b/build/systemMenu_tools/setEULA/banner/banner_v3.bsf differ diff --git a/build/systemMenu_tools/setEULA/banner/icon/gameIcon.bmp b/build/systemMenu_tools/setEULA/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..1a7a4012 Binary files /dev/null and b/build/systemMenu_tools/setEULA/banner/icon/gameIcon.bmp differ diff --git a/build/tests/AppVersionViewer/ARM9/Makefile b/build/tests/AppVersionViewer/ARM9/Makefile new file mode 100644 index 00000000..5e20a362 --- /dev/null +++ b/build/tests/AppVersionViewer/ARM9/Makefile @@ -0,0 +1,150 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 0 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = FALSE +INVISIBLE_SCFG = TRUE +GAMECODE = 0BZA +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=N -DVERSION_VIEWER=TRUE +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCDIR = $(DISP_INFO)/ARM9/src + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c \ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_NAME = AppVersionViewer +TARGET_BIN = $(TARGET_NAME).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + liberrorlog$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont_launcher$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE) +OBJDIR = ./obj/$(TWL_BUILDTYPE) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = $(DISP_INFO)/ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/AppVersionViewer/ARM9/main.rsf b/build/tests/AppVersionViewer/ARM9/main.rsf new file mode 100644 index 00000000..36a4c3fe --- /dev/null +++ b/build/tests/AppVersionViewer/ARM9/main.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + + # TITLE NAME: Your product name within 12bytes + # + TitleName "DispInfo" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess $(DISPINFO_SDACCESS) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess $(DISPINFO_NANDACCESS) + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + LockSCFG $(DISPINFO_LOCKSCFG) + HwAESSlotA_SSLClientCert $(DISPINFO_AES) + DisableDebug TRUE + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + #Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType $(DISPINFO_APPTYPE) +# AppType SYSTEM + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media $(DISPINFO_MEDIA) +# Media NAND + # + # Data only title : [TRUE/FALSE] + # don't have to edit + ##DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure $(DISPINFO_SECURE) +# Secure TRUE + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(DISPINFO_GAMECODE) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile FALSE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/tests/AppVersionViewer/banner/Makefile b/build/tests/AppVersionViewer/banner/Makefile new file mode 100644 index 00000000..a6a3b396 --- /dev/null +++ b/build/tests/AppVersionViewer/banner/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/icon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/AppVersionViewer/banner/banner_v3.bsf b/build/tests/AppVersionViewer/banner/banner_v3.bsf new file mode 100644 index 00000000..d3ede19a Binary files /dev/null and b/build/tests/AppVersionViewer/banner/banner_v3.bsf differ diff --git a/build/tests/AppVersionViewer/banner/icon/icon.bmp b/build/tests/AppVersionViewer/banner/icon/icon.bmp new file mode 100644 index 00000000..b2ddda22 Binary files /dev/null and b/build/tests/AppVersionViewer/banner/icon/icon.bmp differ diff --git a/build/tests/CalcHMAC_forBroadOn/Makefile b/build/tests/CalcHMAC_forBroadOn/Makefile new file mode 100644 index 00000000..755280bf --- /dev/null +++ b/build/tests/CalcHMAC_forBroadOn/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CalcHMAC_forBroadOn +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +SRCS = CalcHMAC_forBroadOn.c + +TARGET_BIN = CalcHMAC_forBroadOn.srl + +TITLEID_LO = 0BRA + +ROM_SPEC = main.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +LINCLUDES = $(ROOT)/build/libraries/lcfg/ARM9.TWL/include +LLIBRARIES = liblcfg$(TWL_LIBSUFFIX).a + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_IPL_RED_PRIVATE_ROOT)/keys/rsa' \ + -DCARD_REGION='$(CARD_REGION)' + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CalcHMAC_forBroadOn/main.rsf b/build/tests/CalcHMAC_forBroadOn/main.rsf new file mode 100644 index 00000000..e35eb49e --- /dev/null +++ b/build/tests/CalcHMAC_forBroadOn/main.rsf @@ -0,0 +1,171 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 2G + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) +} diff --git a/build/tests/CalcHMAC_forBroadOn/src/CalcHMAC_forBroadOn.c b/build/tests/CalcHMAC_forBroadOn/src/CalcHMAC_forBroadOn.c new file mode 100644 index 00000000..9019ea4e --- /dev/null +++ b/build/tests/CalcHMAC_forBroadOn/src/CalcHMAC_forBroadOn.c @@ -0,0 +1,368 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK + File: main.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 "TWLStoreFile.h" + +// define data------------------------------------------------------------------ +#define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo.der" // 製品用秘密鍵 +#define RSA_KEY_LENGTH_1024 RSA_KEY_LENGTH +#define HWINFO_S_BODY_SIZE 0x1C + +#define PATH_K00A317_JP "sdmc:/hwinfo_s/HWInfo_S.K00A317_JP.dat" +#define PATH_K00A317_US "sdmc:/hwinfo_s/HWInfo_S.K00A317_US.dat" +#define PATH_K00A317_EU "sdmc:/hwinfo_s/HWInfo_S.K00A317_EU.dat" +#define PATH_K00A317_AU "sdmc:/hwinfo_s/HWInfo_S.K00A317_AU.dat" +#define PATH_K00A319_JP "sdmc:/hwinfo_s/HWInfo_S.K00A319_JP.dat" +#define PATH_K00A319_US "sdmc:/hwinfo_s/HWInfo_S.K00A319_US.dat" +#define PATH_K00A319_EU "sdmc:/hwinfo_s/HWInfo_S.K00A319_EU.dat" +#define PATH_K00A319_AU "sdmc:/hwinfo_s/HWInfo_S.K00A319_AU.dat" + +//------------------------------------------------------------------------------ +extern s32 CRYPTO_RSA_Sign_custom(CRYPTORSASignContext *context, CRYPTORSASignParam *param); + +//------------------------------------------------------------------------------ +static u8 s_privKey[ 4096 ] ATTRIBUTE_ALIGN(32); +static TSFHeader s_header; + +/*----------------------------------------------------------------------------*/ +static const u64 FuseID_K00A317 = 0x08a1080105112134LLU; +static const u64 FuseID_K00A319 = 0x08a1080105112122LLU; + +/*----------------------------------------------------------------------------*/ +static const u8 HWINFO_S_K00A317_JP[HWINFO_S_BODY_SIZE] = +{ + 0x01, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x00, /* region */ + 'T', 'J', 'N', '5', '6', '3', '2', '0', + '4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */ + 'J', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A317_US[HWINFO_S_BODY_SIZE] = +{ + 0x26, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x01, /* region */ + 'T', 'N', '5', '6', '3', '2', '0', '4', + '0', '2', '0', 0x00, 0x00, 'K', 0x00, /* serialNo */ + 'E', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A317_EU[HWINFO_S_BODY_SIZE] = +{ + 0x3E, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x02, /* region */ + 'T', 'E', 'N', '5', '6', '3', '2', '0', + '4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */ + 'P', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A317_AU[HWINFO_S_BODY_SIZE] = +{ + 0x02, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x03, /* region */ + 'T', 'A', 'N', '5', '6', '3', '2', '0', + '4', '0', '2', '0', 0x00, 'K', 0x00, /* serialNo */ + 'U', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + + +/*----------------------------------------------------------------------------*/ +static const u8 HWINFO_S_K00A319_JP[HWINFO_S_BODY_SIZE] = +{ + 0x01, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x00, /* region */ + 'T', 'J', 'N', '3', '5', '3', '8', '9', + '0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */ + 'J', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A319_US[HWINFO_S_BODY_SIZE] = +{ + 0x26, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x01, /* region */ + 'T', 'N', '3', '5', '3', '8', '9', '0', + '3', '3', '4', 0x00, 0x00, 'K', 0x00, /* serialNo */ + 'E', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A319_EU[HWINFO_S_BODY_SIZE] = +{ + 0x3E, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x02, /* region */ + 'T', 'E', 'N', '3', '5', '3', '8', '9', + '0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */ + 'P', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +static const u8 HWINFO_S_K00A319_AU[HWINFO_S_BODY_SIZE] = +{ + 0x02, 0x00, 0x00, 0x00, /* validLanguageBitmap */ + 0x00, 0x00, 0x00, 0x00, /* flags, rsv */ + 0x03, /* region */ + 'T', 'A', 'N', '3', '5', '3', '8', '9', + '0', '3', '3', '4', 0x00, 'K', 0x00, /* serialNo */ + 'U', 'A', 'N', 'H' /* launcherTitleID_Lo */ +}; + +//================================================================================ + +static void CalcHWSecureInfoHMAC( void *pDstHMAC, const void* body, u64 fuseID ) +{ + u8 key[SVC_SHA1_DIGEST_SIZE]; + int i; + SVC_CalcSHA1(key, &fuseID, sizeof(u64)); + SVC_CalcHMACSHA1( pDstHMAC, body, HWINFO_S_BODY_SIZE, key, SVC_SHA1_DIGEST_SIZE); + + OS_TPrintf( "key : " ); + for( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) { + OS_TPrintf( "%02x", key[ i ] ); + } + OS_TPrintf( "\n" ); + OS_TPrintf( "hmac: " ); + for( i = 0; i < SVC_SHA1_DIGEST_SIZE; i++ ) { + OS_TPrintf( "%02x", ((u8 *)pDstHMAC)[ i ] ); + } + OS_TPrintf( "\n" ); + + return; +} + +// 署名算出(BERエンコードなし) +static BOOL CalcSignature( void *pDstSign, const void *pSrc, u32 len, const u8 *pPrivKeyDER, u32 keyFileLen, u32 keyLen ) +{ + CRYPTORSASignContext context; + CRYPTORSASignInitParam initParam; + CRYPTORSASignParam param; + int result_len; + + initParam.key = (void*)pPrivKeyDER; + initParam.key_len = keyFileLen; + if( CRYPTO_RSA_SignInit(&context, &initParam) != 0 ) { + return FALSE; + } + + param.in = (void *)pSrc; + param.in_len = len; + param.out = pDstSign; + param.out_size = keyLen; + + result_len = CRYPTO_RSA_Sign_custom(&context, ¶m); + if( result_len != keyLen ) { + return FALSE; + } + + return CRYPTO_RSA_SignTerminate(&context) == 0 ? TRUE : FALSE; +} + + +static BOOL LCFGi_THW_WriteSecureInfoCustom( char *pPath, const LCFGTWLHWSecureInfo *pSrcInfo, u64 fuseID, const u8 *pPrivKeyDER, u32 keyFileLen ) +{ + TSFHeader header; + + // ヘッダ初期化 + MI_CpuClear8( &header, sizeof(TSFHeader) ); + header.version = LCFG_TWL_HWINFO_SECURE_VERSION; + header.bodyLength = sizeof( LCFGTWLHWSecureInfo ); + + // ヘッダ署名算出 + { + u8 hmac_sha1[ SVC_SHA1_DIGEST_SIZE ]; + CalcHWSecureInfoHMAC( hmac_sha1, pSrcInfo, fuseID ); + if( !CalcSignature( (void *)header.digest.rsa, hmac_sha1, SVC_SHA1_DIGEST_SIZE, pPrivKeyDER, keyFileLen, RSA_KEY_LENGTH_1024 ) ) { + return FALSE; + } + } + + // ファイル生成 + (void)FS_CreateFileAuto( pPath, FS_PERMIT_R | FS_PERMIT_W ); + { +#define HWINFO_FILE_LEN ( 16 * 1024 ) + FSFile file[1]; + char *pBuffer = OS_Alloc( HWINFO_FILE_LEN ); + + if( !FS_OpenFileEx( file, pPath, FS_FILEMODE_RW ) ) { + return FALSE; + } + if( FS_SetFileLength( file, HWINFO_FILE_LEN ) != FS_RESULT_SUCCESS ) { + (void)FS_CloseFile( file ); + return FALSE; + } + if( pBuffer ) { + MI_CpuFillFast( pBuffer, 0xffffffff, HWINFO_FILE_LEN ); + (void)FS_WriteFile( file, pBuffer, HWINFO_FILE_LEN ); + } + (void)FS_CloseFile( file ); + } + + // ライト + if( !LCFGi_TSF_WriteFile( pPath, &header, (const void *)pSrcInfo, NULL ) ) { + return FALSE; + } + return TRUE; +} + + +// 秘密鍵のリード +static BOOL ReadPrivateKey( void *pBuffer, u32 *pKeyFileLen, char *pPath ) +{ + BOOL retval = TRUE; + FSFile file; + + FS_InitFile( &file ); + if( !FS_OpenFileEx( &file, pPath, FS_FILEMODE_R ) ) + { + OS_TPrintf( "PrivateKey read failed.\n" ); + retval = FALSE; + }else { + *pKeyFileLen = FS_GetFileLength( &file ); + if( *pKeyFileLen > 0 ) { + if( FS_ReadFile( &file, pBuffer, (s32)*pKeyFileLen ) == *pKeyFileLen ) { + OS_TPrintf( "PrivateKey read succeeded.\n" ); + }else { + OS_TPrintf( "PrivateKey read failed.\n" ); + retval = FALSE; + } + } + FS_CloseFile( &file ); + } + return retval; +} + +/*---------------------------------------------------------------------------* + Name: InitAllocSystem + + Description: ヒープを作成して OS_Alloc が使えるようにします。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitAllocSystem() +{ + void* newArenaLo; + OSHeapHandle hHeap; + + // メインアリーナのアロケートシステムを初期化 + newArenaLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetMainArenaLo(newArenaLo); + + // メインアリーナ上にヒープを作成 + hHeap = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); +} + +extern u64 g_HWInfoFuseROM; +extern char *g_pHwInfoPath; + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + BOOL retval; + u32 keyLen; + + OS_Init(); + InitAllocSystem(); + (void)OS_SetIrqMask(0); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + FS_Init( FS_DMA_NOT_USE ); + CRYPTO_SetMemAllocator( OS_AllocFromMain, OS_FreeToMain, NULL ); + + OS_TPrintf("---- HMAC over HWInfo_S for PROD boards @ BroadOn ----\n"); + + if( !ReadPrivateKey( s_privKey, &keyLen, HWINFO_PRIVKEY_PATH ) ) { + OS_TPrintf("PrivateKey read failed.\n"); + }else { + OS_TPrintf("TS-Board: K00A317\n"); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_JP, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_JP, FuseID_K00A317, s_privKey, keyLen ); + OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_US, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_US, FuseID_K00A317, s_privKey, keyLen ); + OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_EU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_EU, FuseID_K00A317, s_privKey, keyLen ); + OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A317_AU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A317_AU, FuseID_K00A317, s_privKey, keyLen ); + OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" ); + + OS_TPrintf("TS-Board: K00A319\n"); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_JP, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_JP, FuseID_K00A319, s_privKey, keyLen ); + OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_US, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_US, FuseID_K00A319, s_privKey, keyLen ); + OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_EU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_EU, FuseID_K00A319, s_privKey, keyLen ); + OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" ); + retval = LCFGi_THW_WriteSecureInfoCustom( PATH_K00A319_AU, (const LCFGTWLHWSecureInfo *)HWINFO_S_K00A319_AU, FuseID_K00A319, s_privKey, keyLen ); + OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" ); + } +#if 0 + OS_TPrintf("---- Verify phase ----\n"); + { + OS_TPrintf("TS-Board: K00A317\n"); + g_HWInfoFuseROM = FuseID_K00A317; + g_pHwInfoPath = PATH_K00A317_JP; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A317_US; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A317_EU; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A317_AU; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" ); + + OS_TPrintf("TS-Board: K00A319\n"); + g_HWInfoFuseROM = FuseID_K00A319; + g_pHwInfoPath = PATH_K00A319_JP; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" JP: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A319_US; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" US: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A319_EU; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" EU: %s\n", retval ? "succeeded" : "failed" ); + g_pHwInfoPath = PATH_K00A319_AU; + retval = LCFG_ReadHWSecureInfo(); + OS_TPrintf(" AU: %s\n", retval ? "succeeded" : "failed" ); + } +#endif + OS_Terminate(); +} diff --git a/build/tests/CheckCardAccess/Makefile b/build/tests/CheckCardAccess/Makefile new file mode 100644 index 00000000..a9bcdf87 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.off Makefile.normal Makefile.game + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.game b/build/tests/CheckCardAccess/Makefile.game new file mode 100644 index 00000000..336eafb1 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.game @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.game +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_game +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = game_mode.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.normal b/build/tests/CheckCardAccess/Makefile.normal new file mode 100644 index 00000000..267b70f0 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.normal @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.normal +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_normal +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = normal_mode.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/Makefile.off b/build/tests/CheckCardAccess/Makefile.off new file mode 100644 index 00000000..4585c909 --- /dev/null +++ b/build/tests/CheckCardAccess/Makefile.off @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardAccess +# File: Makefile.off +# +# 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +TARGET_NAME = finalize_check_slotpoweroff +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad + +SRCS = ./src/main.c ./src/font.c + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +ROM_SPEC = slot_power_off.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +.PHONY: build_time + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardAccess/game_mode.rsf b/build/tests/CheckCardAccess/game_mode.rsf new file mode 100644 index 00000000..f8d2dba8 --- /dev/null +++ b/build/tests/CheckCardAccess/game_mode.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C5A/rom_header_0c5a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + GameCardNitroMode TRUE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/normal_mode.rsf b/build/tests/CheckCardAccess/normal_mode.rsf new file mode 100644 index 00000000..888fbd4d --- /dev/null +++ b/build/tests/CheckCardAccess/normal_mode.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C4A/rom_header_0c4a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + GameCardOn TRUE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/slot_power_off.rsf b/build/tests/CheckCardAccess/slot_power_off.rsf new file mode 100644 index 00000000..b0013f6f --- /dev/null +++ b/build/tests/CheckCardAccess/slot_power_off.rsf @@ -0,0 +1,243 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + # RomHeaderTemplate ../rh/0C3A/rom_header_0c3a.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile "banner_LTD/banner.bnr" + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 4CDA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckCardAccess/src/font.c b/build/tests/CheckCardAccess/src/font.c new file mode 100644 index 00000000..9500697a --- /dev/null +++ b/build/tests/CheckCardAccess/src/font.c @@ -0,0 +1,579 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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 "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CheckCardAccess/src/font.h b/build/tests/CheckCardAccess/src/font.h new file mode 100644 index 00000000..b4a94093 --- /dev/null +++ b/build/tests/CheckCardAccess/src/font.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // FONT_H_ diff --git a/build/tests/CheckCardAccess/src/hotswTypes.h b/build/tests/CheckCardAccess/src/hotswTypes.h new file mode 100644 index 00000000..02d0843e --- /dev/null +++ b/build/tests/CheckCardAccess/src/hotswTypes.h @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: type.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_TYPES_H__ +#define __HOTSW_TYPES_H__ + +#include +#include +#include "romSpec.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +static inline void HOTSW_WaitCardCtrl(void) +{ + while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){} +} + +// Define ------------------------------------------------------------------- +// --- Boot Segment +#define BOOT_SEGMENT_SIZE 0x1000 + +// --- Secure Segment +#define SECURE_SEGMENT_START 0x4000 +#define SECURE_SEGMENT_SIZE 0x4000 +#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE) + +// --- TWL Card +#define TWLCARD_BORDER_OFFSET 0x80000 + +// --- Page / Segment (Byte) +#define PAGE_SIZE 0x200 +#define ONE_SEGMENT_SIZE 0x1000 + +// --- Page / Segment (Word) +#define PAGE_WORD_SIZE 0x80 +#define ONE_SEGMENT_WORD_SIZE 0x400 + +// --- Rom Emulation +#define ROM_EMULATION_DATA_SIZE 0x20 + +// --- Thread +#define HOTSW_THREAD_STACK_SIZE (1024 * 2) +#define HOTSW_DMA_MSG_NUM 8 +#define HOTSW_INSERT_MSG_NUM 16 +#define HOTSW_PULLED_MSG_NUM 16 +#define HOTSW_CTRL_MSG_NUM 8 +#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM) +#define HOTSW_POLLING_CTRL_BUFFER_NUM 4 + +// --- Card Control Reg 0 +#define HOTSW_E2PROM_CTRL_MASK 0x00ff + +// --- Card Control Reg 1 +#define START_FLG_MASK 0x80000000 +#define READY_FLG_MASK 0x00800000 + +#define LATENCY1_SHIFT 0 +#define LATENCY1_MASK 0x00001fff + +#define DS_SHIFT 13 +#define DS_MASK 0x00002000 + +#define SE_SHIFT 14 +#define SE_MASK 0x00004000 + +#define SCR_SHIFT 15 +#define SCR_MASK 0x00008000 + +#define LATENCY2_SHIFT 16 +#define LATENCY2_MASK 0x003f0000 + +#define CS_SHIFT 22 +#define CS_MASK 0x00400000 + +#define RDY_SHIFT 23 +#define RDY_MASK 0x00800000 + +#define PC_SHIFT 24 +#define PC_MASK 0x07000000 + +#define CT_SHIFT 27 +#define CT_MASK 0x08000000 + +#define TRM_SHIFT 28 +#define TRM_MASK 0x10000000 + +#define RESB_SHIFT 29 +#define RESB_MASK 0x20000000 + +#define WR_SHIFT 30 +#define WR_MASK 0x40000000 + +#define START_SHIFT 31 +#define START_MASK 0x80000000 + +#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク +#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク + +// --- Page Count +#define PAGE_0 0x0UL << PC_SHIFT +#define PAGE_1 0x1UL << PC_SHIFT +#define PAGE_2 0x2UL << PC_SHIFT +#define PAGE_4 0x3UL << PC_SHIFT +#define PAGE_8 0x4UL << PC_SHIFT +#define PAGE_16 0x5UL << PC_SHIFT +#define PAGE_32 0x6UL << PC_SHIFT +#define PAGE_STAT 0x7UL << PC_SHIFT + + +// union --------------------------------------------------------------------- +typedef union +{ + u64 dw; + u8 b[8]; +} Cmd64; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_TYPES_H__ \ No newline at end of file diff --git a/build/tests/CheckCardAccess/src/main.c b/build/tests/CheckCardAccess/src/main.c new file mode 100644 index 00000000..a449884a --- /dev/null +++ b/build/tests/CheckCardAccess/src/main.c @@ -0,0 +1,768 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - CARD - hotswDebug + File: main_finalize.c + + Copyright 2007 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. + *---------------------------------------------------------------------------*/ + +#include +#include +#include "DEMO.h" +#include "hotswTypes.h" +#include "font.h" + +#define SDK_MAKERCODE '10' +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) + +#define MY_TEMP_BUFFER_SIZE 0x80000 +#define GAME_FIELD_START_ADDRESS 0x8000 + +#define ONE_SEGMENT_PAGE_NUM 8 + +#define READY_MASK 0x00800000 +#define CARD_COMMAND_MASK 0x07000000 + +#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF) +#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER) +#define MY_ROMHEADER_NAND ((ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF) + +// --------------------------------------------------------------- +// HMACSHA1の鍵 +static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = { + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24 +}; + +static u32 rhBuf[BOOT_SEGMENT_SIZE/sizeof(u32)]; +static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)]; + +static u16 card_lock_id; +static BOOL error, flxhash, ltdhash, romheader; +static BOOL isTwlApplication; +static BOOL isTwlCard; +static ROM_Header_Short *rh; + +static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE); + +// --------------------------------------------------------------- +static void CheckMirrorImage(void); +static int CompRomHeaderForNTR(void* buf); +static void CheckRomHeader(void); +static BOOL CheckHashValue(void* buf, u32 size, void* digest); +static void MY_LoadCard_arm7Static(void); +static void MY_LoadCard_arm7LtdStatic(void); +static void CheckBackupDevice(void); +static void ShowResult(void); +static void debugMessage(void); + +static void ReadBootSegNormal(void* buf); +static void SetCommand(Cmd64 *cndLE); +static void ReadPageGame(u32 start_addr, void* buf, u32 size); +static void ReadCardData(void* dest, s32 offset, s32 length); + +static void VBlankIntr (void); +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...); +static void VolumeSwitchCallback(SNDEXResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: メイン エントリポイント. + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + CARDRomHeader *card_header = (void*)CARD_GetRomHeader(); + + OS_Init(); + OS_InitTick(); + CARD_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + if ( card_header->maker_code == SDK_MAKERCODE ) + { + CARD_Enable(TRUE); + } + + /* 表示設定初期化 */ + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE); + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31 + GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0 + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + MI_CpuClearFast((void*)screen, sizeof(screen)); + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* 割込み設定 */ + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* LCD 表示開始 */ + GX_DispOn(); + GXS_DispOn(); + + PrintString(0, 0, 0xc, "+++ Card Access Check +++"); + + // NANDアプリがHYBの場合 + if(MY_ROMHEADER_NAND->platform_code == 0x02){ + PrintString(0, 2, 0x5, ""); + } + else if(MY_ROMHEADER_NAND->platform_code == 0x03){ + PrintString(0, 2, 0x6, ""); + } + + // カードアプリタイプを判別。使うRom Header Buffer を切替える + if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){ + PrintString(0, 5, 0xf, "- TWL Application -"); + isTwlApplication = TRUE; + rh = MY_ROMHEADER_TWL; + } + else{ + PrintString(0, 5, 0xf, "- NTR Application -"); + isTwlApplication = FALSE; + rh = MY_ROMHEADER_NTR; + } + + // カードタイプの判別 + isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE; + + // 注:rhの初期化が終わってから呼び出す +// debugMessage(); + + // フラグの初期化 + error = FALSE; + flxhash = TRUE; + ltdhash = TRUE; + romheader = TRUE; + + // ロックIDを取得しておく + card_lock_id = (u16)OS_GetLockID(); + + if(isTwlApplication){ + MY_LoadCard_arm7Static(); + MY_LoadCard_arm7LtdStatic(); + } + else{ + CheckMirrorImage(); + } + + CheckRomHeader(); + CheckBackupDevice(); + + ShowResult(); + + while(1){ +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckMirrorImage + + Description: + + Gameモード時 → Gameコマンド OK + Normalコマンド All 1 + + Normalモード時 → Gameコマンド All 1 + Normalコマンド OK + + SlotPowerOff時 → Gameコマンド All 0 + Normalコマンド All 0 + *---------------------------------------------------------------------------*/ +static void CheckMirrorImage(void) +{ + u32 buf1[PAGE_SIZE/sizeof(u32)]; + u32 buf2[PAGE_SIZE/sizeof(u32)]; + u32 buf_ff[PAGE_SIZE/sizeof(u32)]; + u32 buf_00[PAGE_SIZE/sizeof(u32)]; + + MI_CpuFill8( buf_ff, 0xff, sizeof(buf_ff) ); + MI_CpuFill8( buf_00, 0x0, sizeof(buf_00) ); + + CARD_LockRom(card_lock_id); + + // GameモードのコマンドでKey Table領域とGame領域読む + ReadCardData(buf1, (s32)0x1000, (s32)PAGE_SIZE); + ReadCardData(buf2, (s32)0x8000, (s32)PAGE_SIZE); + + CARD_UnlockRom(card_lock_id); + + // GameモードでKey Table領域からGame領域のイメージが読めてなかったら、不明なモード + if(MI_CpuComp8( buf1, buf2, PAGE_SIZE )){ + error = TRUE; + PrintString(0, 7, 0x1, "Unknown Mode"); + } + else{ + // 同じデータでも ALL 1(GameMode時) or ALL 0(SlotPowerOff時)ならちゃんと読めてないので、Normalモード + if(!MI_CpuComp8( buf_ff, buf2, PAGE_SIZE ) || !MI_CpuComp8( buf_00, buf2, PAGE_SIZE )){ + flxhash = FALSE; + ltdhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + // Key Table領域読んで、Game領域のイメージが出てたらGameモード + else{ + flxhash = TRUE; + ltdhash = FALSE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + } +} + + +/*---------------------------------------------------------------------------* + Name: CheckRomHeader + + Description: + *---------------------------------------------------------------------------*/ +static void CheckRomHeader(void) +{ + int result; + u8* pBuf = (u8 *)rhBuf; + u8* romHeader = (u8 *)rh; + + CARD_LockRom(card_lock_id); + + ReadBootSegNormal(pBuf); + + CARD_UnlockRom(card_lock_id); + + // 実際に読んだRom HeaderとIPLで読んだRom Headerを比較 + if(isTwlApplication){ + result = MI_CpuComp8( pBuf, romHeader, HW_TWL_CARD_ROM_HEADER_BUF_SIZE ); + } + else{ + result = CompRomHeaderForNTR(pBuf); + } + + // 結果 + if(result){ + romheader = FALSE; + PrintString(0, 11, 0x1, "Boot Segment : Not Accessible"); + } + else{ + romheader = TRUE; + PrintString(0, 11, 0x8, "Boot Segment : Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +static int CompRomHeaderForNTR(void* buf){ + u8* pBuf = (u8 *)buf; + u8* romHeader = (u8 *)rh; + u32 remainSize = HW_CARD_ROM_HEADER_SIZE; + + while(remainSize){ + // マスクRomコントロール情報が変わってるので、そこは飛ばす。 + if((HW_CARD_ROM_HEADER_SIZE - remainSize) == 0x60){ + pBuf += 4; + romHeader += 4; + remainSize -= 4; + } + if(*pBuf == *romHeader){ + remainSize--; + } + else{ +// OS_TPrintf("Error (adr:0x%08x)\n", HW_CARD_ROM_HEADER_SIZE - remainSize); +// OS_TPrintf("read : 0x%02x real : 0x%02x\n", *pBuf, *romHeader); + break; + } + pBuf++; + romHeader++; + } + + return (int)remainSize; +} + + +/*---------------------------------------------------------------------------* + Name: CheckHashValue + + Description: モジュールハッシュチェック + *---------------------------------------------------------------------------*/ +static BOOL CheckHashValue(void* buf, u32 size, void* digest) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + buf, + size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, digest ); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7Static + + Description: ARM7常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7Static(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(checkBuf, rh->sub_size, (void *)rh->sub_static_digest); + + if(result){ + flxhash = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + else{ + flxhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7LtdStatic + + Description: ARM7拡張常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7LtdStatic(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(checkBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest); + + if(result){ + ltdhash = TRUE; + PrintString(0, 9, 0x8, "Ltd Area : Accessible"); + } + else{ + ltdhash = FALSE; + PrintString(0, 9, 0x1, "Ltd Area : Not Accessible"); + } + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: CheckBackupDevice + + Description: Backup Device へのアクセスチェック + + 注:EEPROM 512 kbのサブ基盤と使って検査する + *---------------------------------------------------------------------------*/ +static void CheckBackupDevice(void) +{ + BOOL identify; + static CARDResult last_result = CARD_RESULT_SUCCESS; + + CARD_LockBackup(card_lock_id); + + identify = CARD_IdentifyBackup(CARD_BACKUP_TYPE_EEPROM_512KBITS); + if (!identify) + { + PrintString(0, 13, 0x1, "Backup Device Identify Error..."); + error = TRUE; + CARD_UnlockBackup(card_lock_id); + return; + } + + { + u32 pos = 0; + static u8 tmp_buf[65536]; + int i; + const u32 page_size = CARD_GetBackupPageSize(); + const u32 total_size = CARD_GetBackupTotalSize(); + + for (i = 0; i < page_size; ++i) + { + tmp_buf[i] = (u8)(pos * 3 + i); + } + + if (!CARD_IsBackupEeprom()){ + PrintString(0, 13, 0x1, "Please Use EEPROM..."); + error = TRUE; + return; + } + + PrintString(0, 13, 0xf, "Backup Device Check Start..."); +// DEMO_DrawFlip(); + + while(pos < total_size){ + CARD_WriteAndVerifyEepromAsync(pos, tmp_buf, page_size, NULL, NULL); + + (void)CARD_WaitBackupAsync(); + last_result = CARD_GetResultCode(); + + pos += page_size; + + if (last_result != CARD_RESULT_SUCCESS){ + break; + } + } + + if (last_result != CARD_RESULT_SUCCESS){ + PrintString(0, 14, 0x1, "Backup Device : Not Accessible"); + error = TRUE; + } + else{ + PrintString(0, 14, 0x8, "Backup Device : Accessible"); + } + } + + CARD_UnlockBackup(card_lock_id); + +// DEMO_DrawFlip(); + OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: ReadBootSegNormal + + Description: ノーマルモードのBoot Segment読み込み + *---------------------------------------------------------------------------*/ +#define TIME_OUT 1000 + +static void ReadBootSegNormal(void* buf) +{ + u32 i, loop, pc, size, counter; + u64 page = 0; + Cmd64 cndLE; + BOOL isType1; + + OSTick start; + + isType1 = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_1TROM_MASK) ? FALSE : TRUE; + + if(isType1){ + loop = 0x1UL; + pc = 0x4UL; + size = BOOT_SEGMENT_SIZE; + } + else{ + loop = ONE_SEGMENT_PAGE_NUM; + pc = 0x1UL; + size = PAGE_SIZE; + } + + counter = 0; + + HOTSW_WaitCardCtrl(); + + for(i=0; i TIME_OUT){ + return; + } + } + *((u32 *)buf + counter++) = reg_MI_MCD1_A; + } + + page++; + + OS_SpinWait( 100 ); + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_SetCommand + + Description: 引数で与えられたコマンドのエンディアンを変えてレジスタにセットする + *---------------------------------------------------------------------------*/ +static void SetCommand(Cmd64 *cndLE) +{ + Cmd64 cndBE; + + // ビッグエンディアンに直す + cndBE.b[7] = cndLE->b[0]; + cndBE.b[6] = cndLE->b[1]; + cndBE.b[5] = cndLE->b[2]; + cndBE.b[4] = cndLE->b[3]; + cndBE.b[3] = cndLE->b[4]; + cndBE.b[2] = cndLE->b[5]; + cndBE.b[1] = cndLE->b[6]; + cndBE.b[0] = cndLE->b[7]; + + // MCCMD レジスタ設定 + reg_MI_MCCMD0_A = *(u32*)cndBE.b; + reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4]; +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: ゲームモードで、指定されたページを指定バッファに指定サイズ分を読み込む + *---------------------------------------------------------------------------*/ +static void ReadPageGame(u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + OSTick start; + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + HOTSW_WaitCardCtrl(); + + for(i=0; i TIME_OUT){ + return; + } + } + *((u32 *)buf + counter++) = reg_MI_MCD1_A; + } + } + + OS_SpinWait( 100 ); +} + + +/*---------------------------------------------------------------------------* + Name: ReadCardData + + Description: カードから中途半端なサイズ(page途中)のデータを読み出す関数 + エラーコードを返す + *---------------------------------------------------------------------------*/ +static void ReadCardData(void* dest, s32 offset, s32 length) +{ + static u8 page_buffer[512]; + u32 page_offset = (u32)(offset & -512); + u32 buffer_offset = (u32)(offset % 512); + u32 valid_length = 512 - buffer_offset; + u32 remain_length; + + // 開始アドレスがページの途中 + if ( offset % 512 ) + { + ReadPageGame(page_offset, page_buffer, 512); + + MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length)); + + dest = (u8*)dest + valid_length; + offset += valid_length; + length -= valid_length; + if ( length < 0) + { + return; + } + } + + remain_length = (u32)(length % 512); + ReadPageGame((u32)offset, dest, (u32)(length - remain_length)); + + // ケツがページ途中 + if( remain_length ){ + dest = (u8*)dest + (length - remain_length); + offset += length - remain_length; + + ReadPageGame((u32)offset, page_buffer, 512); + + MI_CpuCopy8(page_buffer, dest, remain_length); + } +} + + +/*---------------------------------------------------------------------------* + Name: ShowResult + + Description: Result表示 + *---------------------------------------------------------------------------*/ +static void ShowResult(void) +{ + PrintString(0, 16, 0xf, "-- Result --"); + + if(romheader && !flxhash && !ltdhash){ + PrintString(0, 18, 0x4, "Normal Mode"); + } + else if((!romheader && flxhash && !ltdhash) || + (!romheader && flxhash && ltdhash && !isTwlCard)){ + PrintString(0, 18, 0x5, "Game Mode"); + } + else if(!romheader && !flxhash && !ltdhash){ + PrintString(0, 18, 0x6, "Slot Power Off"); + } + else{ + PrintString(0, 18, 0x1, "Unknown Mode"); + } + + if(error){ + PrintString(0, 20, 0x1, "Backup Device Error"); + } + +// DEMO_DrawFlip(); +// OS_WaitVBlankIntr(); +} + + +/*---------------------------------------------------------------------------* + Name: debugMessage + + Description: + *---------------------------------------------------------------------------*/ +static void debugMessage(void) +{ + PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset); + PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset); + + OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset); + OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size); + OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset); + OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size); +} + + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みベクトル。 + *---------------------------------------------------------------------------*/ +static void VBlankIntr (void) +{ + /* 仮想スクリーンを VRAM に反映 */ + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* IRQ チェックフラグをセット */ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + palette - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *((u16*)(&temp[32])) = 0x0000; + for (i = 0; ; i++) + { + if (temp[i] == 0x00) + { + break; + } + screen[((y * 32) + x + i) % (32 * 32)] = (u16)((palette << 12) | temp[i]); + } +} \ No newline at end of file diff --git a/build/tests/CheckCardAccess/src/romSpec.h b/build/tests/CheckCardAccess/src/romSpec.h new file mode 100644 index 00000000..cb96f899 --- /dev/null +++ b/build/tests/CheckCardAccess/src/romSpec.h @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: romSpec.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 __HOTSW_ROMSPEC_H__ +#define __HOTSW_ROMSPEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// ROM memory map + +#define HOTSW_PAGE_SIZE 0x200 // 512B +#define HOTSW_BOOT_SEG_SIZE 0x1000 // 4KB +#define HOTSW_LOAD_TABLE_SIZE 0x2000 // 8KB +#define HOTSW_KEYTABLE_AREA_SIZE 0x3000 // 12KB +#define HOTSW_KEYTABLE2_AREA_SIZE 0x3000 // 12KB +#define HOTSW_SECURE_AREA_SIZE 0x4000 // 16KB +#define HOTSW_SECURE2_AREA_SIZE 0x4000 // 16KB +#define HOTSW_ROMEMU_INFO_SIZE 0x20 + +#define HOTSW_BOOTSEGMENT_AREA_OFS 0x0000 // 0KB +#define HOTSW_KEYTABLE_AREA_OFS 0x1000 // 4KB +#define HOTSW_SECURE_AREA_OFS 0x4000 // 16KB +#define HOTSW_GAME_AREA_OFS 0x8000 // 32KB +#define HOTSW_SECURE2_AREA_OFS 0x3000 // 12KB +#define HOTSW_GAME2_AREA_OFS 0x7000 // 28KB +#define HOTSW_ROMEMU_INFO_OFS (HOTSW_SECURE_AREA_OFS - HOTSW_PAGE_SIZE + 0x160) + + +// ROM ID + +#define HOTSW_ROMID_1TROM_MASK 0x80000000UL +#define HOTSW_ROMID_TWLROM_MASK 0x40000000UL +#define HOTSW_ROMID_RFSSUP_MASK 0x20000000UL +#define HOTSW_ROMID_SIZE_MASK 0x0000ff00UL + +// ROM STATUS + +#define HOTSW_ROMST_RFS_WARN_L1_MASK 0x00000004UL +#define HOTSW_ROMST_RFS_WARN_L2_MASK 0x00000008UL +#define HOTSW_ROMST_RFS_READY_MASK 0x00000020UL + + +// NORMAL command + +#define HSWOP_N_OP_MASK 0xff00000000000000ULL +#define HSWOP_N_OP_SIZE 8 + +#define HSWOP_N_OP_RD_ID 0x9000000000000000ULL +#define HSWOP_N_OP_RD_PAGE 0x0000000000000000ULL +#define HSWOP_N_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_N_OP_LD_TABLE 0x9f00000000000000ULL +#define HSWOP_N_OP_RD_CACHE_START 0x5800000000000000ULL +#define HSWOP_N_OP_RD_CACHE 0x6000000000000000ULL +#define HSWOP_N_OP_RD_CACHE_LAST 0x6800000000000000ULL +#define HSWOP_N_OP_RD_STAT 0xd600000000000000ULL +#define HSWOP_N_OP_RFS_BLK 0xb500000000000000ULL +#define HSWOP_N_OP_CHG_MODE 0x3c00000000000000ULL +#define HSWOP_N_OP_CHG2_MODE 0x3d00000000000000ULL + +#define HSWOP_N_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_N_RD_PAGE_PAD 0x00fffffeff00ffffULL +#define HSWOP_N_CHG_MODE_PAD 0x00000000f00000ffULL +#define HSWOP_N_CHG2_MODE_PAD HSWOP_N_CHG_MODE_PAD + +#define HSWOP_N_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_N_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_N_RD_PAGE_ADDR_MASK 0x00fffffe00000000ULL + +#define HSWOP_N_VAE_SHIFT 32 +#define HSWOP_N_VAE_SIZE 24 +#define HSWOP_N_VAE_MASK 0x00ffffff00000000ULL + +#define HSWOP_N_VBI_SHIFT 8 +#define HSWOP_N_VBI_SIZE 20 +#define HSWOP_N_VBI_MASK 0x000000000fffff00ULL + + +// SECURE command + +#define HSWOP_S_OP_MASK 0xf000000000000000ULL +#define HSWOP_S_OP_SIZE 4 + +#define HSWOP_S_OP_RD_ID 0x1000000000000000ULL +#define HSWOP_S_OP_RD_SEG 0x2000000000000000ULL +#define HSWOP_S_OP_PNG_ON 0x4000000000000000ULL +#define HSWOP_S_OP_PNG_OFF 0x6000000000000000ULL +#define HSWOP_S_OP_CHG_MODE 0xa000000000000000ULL + +#define HSWOP_S_VA_SHIFT HSWOP_S_VB_SIZE +#define HSWOP_S_VA_SIZE 24 +#define HSWOP_S_VA_MASK 0x00000ffffff00000ULL + +#define HSWOP_S_VB_SHIFT 0 +#define HSWOP_S_VB_SIZE 20 +#define HSWOP_S_VB_MASK 0x00000000000fffffULL + +#define HSWOP_S_VC_SHIFT (HSWOP_S_VA_SIZE + HSWOP_S_VB_SIZE) +#define HSWOP_S_VC_SIZE 16 +#define HSWOP_S_VC_MASK 0x0ffff00000000000ULL + +#define HSWOP_S_VD_SHIFT HSWOP_S_VA_SHIFT +#define HSWOP_S_VD_SIZE HSWOP_S_VA_SIZE +#define HSWOP_S_VD_MASK HSWOP_S_VA_MASK + + +// GAME command + +#define HSWOP_G_OP_MASK 0xff00000000000000ULL +#define HSWOP_G_OP_SIZE 8 + +#define HSWOP_G_OP_RD_ID 0xb800000000000000ULL +#define HSWOP_G_OP_RD_UID 0xb900000000000000ULL +#define HSWOP_G_OP_RD_PAGE 0xb700000000000000ULL +#define HSWOP_G_OP_WR_PAGE 0x8000000000000000ULL +#define HSWOP_G_OP_RD_CACHE_START HSWOP_N_OP_RD_CACHE_START +#define HSWOP_G_OP_RD_CACHE HSWOP_N_OP_RD_CACHE +#define HSWOP_G_OP_RD_CACHE_LAST HSWOP_N_OP_RD_CACHE_LAST +#define HSWOP_G_OP_RD_STAT HSWOP_N_OP_RD_STAT +#define HSWOP_G_OP_RFS_BLK HSWOP_N_OP_RFS_BLK + +#define HSWOP_G_RD_ID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_UID_PAD 0x00ffffffffffffffULL +#define HSWOP_G_RD_PAGE_PAD 0x00f0000000ffffffULL + +#define HSWOP_G_RD_PAGE_ADDR_SHIFT 33 +#define HSWOP_G_RD_PAGE_ADDR_SIZE 23 +#define HSWOP_G_RD_PAGE_ADDR_MASK 0x000ffffe00000000ULL + + +#ifdef __cplusplus +} /* extern "C" */ + +#endif + +/* __HOTSW_ROMSPEC_H__ */ +#endif diff --git a/build/tests/CheckCardMode/Makefile b/build/tests/CheckCardMode/Makefile new file mode 100644 index 00000000..f63e8dc8 --- /dev/null +++ b/build/tests/CheckCardMode/Makefile @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckCardMode +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL + +SRCS = ./src/main.c ./src/font.c + +TARGET_BIN = card_mode_check.srl + +MACRO_FLAGS += -DMY_TARGET_NAME=\"$(basename $(TARGET_BIN))\" + +#------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckCardMode/src/font.c b/build/tests/CheckCardMode/src/font.c new file mode 100644 index 00000000..9500697a --- /dev/null +++ b/build/tests/CheckCardMode/src/font.c @@ -0,0 +1,579 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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 "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CheckCardMode/src/font.h b/build/tests/CheckCardMode/src/font.h new file mode 100644 index 00000000..b4a94093 --- /dev/null +++ b/build/tests/CheckCardMode/src/font.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: font.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 FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // FONT_H_ diff --git a/build/tests/CheckCardMode/src/hotswTypes.h b/build/tests/CheckCardMode/src/hotswTypes.h new file mode 100644 index 00000000..02d0843e --- /dev/null +++ b/build/tests/CheckCardMode/src/hotswTypes.h @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - HOTSW - include + File: type.h + + Copyright 2007-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. + *---------------------------------------------------------------------------*/ +#ifndef __HOTSW_TYPES_H__ +#define __HOTSW_TYPES_H__ + +#include +#include +#include "romSpec.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +static inline void HOTSW_WaitCardCtrl(void) +{ + while( reg_MI_MCCNT1_A & REG_MI_MCCNT1_START_MASK ){} +} + +// Define ------------------------------------------------------------------- +// --- Boot Segment +#define BOOT_SEGMENT_SIZE 0x1000 + +// --- Secure Segment +#define SECURE_SEGMENT_START 0x4000 +#define SECURE_SEGMENT_SIZE 0x4000 +#define SECURE_SEGMENT_END (SECURE_SEGMENT_START + SECURE_SEGMENT_SIZE) + +// --- TWL Card +#define TWLCARD_BORDER_OFFSET 0x80000 + +// --- Page / Segment (Byte) +#define PAGE_SIZE 0x200 +#define ONE_SEGMENT_SIZE 0x1000 + +// --- Page / Segment (Word) +#define PAGE_WORD_SIZE 0x80 +#define ONE_SEGMENT_WORD_SIZE 0x400 + +// --- Rom Emulation +#define ROM_EMULATION_DATA_SIZE 0x20 + +// --- Thread +#define HOTSW_THREAD_STACK_SIZE (1024 * 2) +#define HOTSW_DMA_MSG_NUM 8 +#define HOTSW_INSERT_MSG_NUM 16 +#define HOTSW_PULLED_MSG_NUM 16 +#define HOTSW_CTRL_MSG_NUM 8 +#define HOTSW_MSG_BUFFER_NUM (HOTSW_INSERT_MSG_NUM + HOTSW_PULLED_MSG_NUM + HOTSW_CTRL_MSG_NUM) +#define HOTSW_POLLING_CTRL_BUFFER_NUM 4 + +// --- Card Control Reg 0 +#define HOTSW_E2PROM_CTRL_MASK 0x00ff + +// --- Card Control Reg 1 +#define START_FLG_MASK 0x80000000 +#define READY_FLG_MASK 0x00800000 + +#define LATENCY1_SHIFT 0 +#define LATENCY1_MASK 0x00001fff + +#define DS_SHIFT 13 +#define DS_MASK 0x00002000 + +#define SE_SHIFT 14 +#define SE_MASK 0x00004000 + +#define SCR_SHIFT 15 +#define SCR_MASK 0x00008000 + +#define LATENCY2_SHIFT 16 +#define LATENCY2_MASK 0x003f0000 + +#define CS_SHIFT 22 +#define CS_MASK 0x00400000 + +#define RDY_SHIFT 23 +#define RDY_MASK 0x00800000 + +#define PC_SHIFT 24 +#define PC_MASK 0x07000000 + +#define CT_SHIFT 27 +#define CT_MASK 0x08000000 + +#define TRM_SHIFT 28 +#define TRM_MASK 0x10000000 + +#define RESB_SHIFT 29 +#define RESB_MASK 0x20000000 + +#define WR_SHIFT 30 +#define WR_MASK 0x40000000 + +#define START_SHIFT 31 +#define START_MASK 0x80000000 + +#define SCRAMBLE_MASK 0x1040e000 // スクランブル関係のフラグマスク +#define SECURE_COMMAND_SCRAMBLE_MASK 0x00406000 // CS SE DSのマスク + +// --- Page Count +#define PAGE_0 0x0UL << PC_SHIFT +#define PAGE_1 0x1UL << PC_SHIFT +#define PAGE_2 0x2UL << PC_SHIFT +#define PAGE_4 0x3UL << PC_SHIFT +#define PAGE_8 0x4UL << PC_SHIFT +#define PAGE_16 0x5UL << PC_SHIFT +#define PAGE_32 0x6UL << PC_SHIFT +#define PAGE_STAT 0x7UL << PC_SHIFT + + +// union --------------------------------------------------------------------- +typedef union +{ + u64 dw; + u8 b[8]; +} Cmd64; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __HOTSW_TYPES_H__ \ No newline at end of file diff --git a/build/tests/CheckCardMode/src/main.c b/build/tests/CheckCardMode/src/main.c new file mode 100644 index 00000000..4bd9f8d9 --- /dev/null +++ b/build/tests/CheckCardMode/src/main.c @@ -0,0 +1,535 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - CARD - hotswDebug + File: main.c + + Copyright 2007 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. + *---------------------------------------------------------------------------*/ + +#include +#include +#include "DEMO.h" +#include "hotswTypes.h" +#include "font.h" + +#define SDK_MAKERCODE '10' +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) + +#define MY_TEMP_BUFFER_SIZE 0x80000 +#define GAME_FIELD_START_ADDRESS 0x8000 + +#define READY_MASK 0x00800000 +#define CARD_COMMAND_MASK 0x07000000 + +#define MY_ROMHEADER_TWL ((ROM_Header_Short *)HW_TWL_CARD_ROM_HEADER_BUF) +#define MY_ROMHEADER_NTR ((ROM_Header_Short *)HW_CARD_ROM_HEADER) + +// --------------------------------------------------------------- +// HMACSHA1の鍵 +static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = { + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24 +}; + +static u32 checkBuf[MY_TEMP_BUFFER_SIZE/sizeof(u32)] ATTRIBUTE_ALIGN(16); + +static ROM_Header_Short *rh; +static BOOL isTwlApplication; +static BOOL isTwlCard; +static BOOL flxhash, ltdhash, mirrorimage; +static u16 card_lock_id; + +static u16 screen[32 * 32] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE); + +// --------------------------------------------------------------- +static BOOL CheckHashValue(void* buf, u32 size, void* digest); +static void MY_LoadCard_arm7Static(void); +static void MY_LoadCard_arm7LtdStatic(void); +static void debugMessage(void); +static void ShowResult(void); + +static void SetCommand(Cmd64 *cndLE); +static void ReadIDGame(void); +static void ReadPageGame(u32 start_addr, void* buf, u32 size); +static void ReadCardData(void* dest, s32 offset, s32 length); +static void isGameModeForNTR(void); + +static void VBlankIntr (void); +static void PrintString (s16 x, s16 y, u8 palette, char *text, ...); +static void VolumeSwitchCallback(SNDEXResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: メイン エントリポイント. + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + CARDRomHeader *card_header = (void*)CARD_GetRomHeader(); + + OS_Init(); + OS_InitTick(); + CARD_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + if ( card_header->maker_code == SDK_MAKERCODE ) + { + CARD_Enable(TRUE); + } + + /* 表示設定初期化 */ + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + MI_CpuFillFast((void*)HW_OAM, GX_LCD_SIZE_Y, HW_OAM_SIZE); + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, GX_LCD_SIZE_Y, HW_DB_OAM_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, // SCR ベースブロック 31 + GX_BG_CHARBASE_0x00000, // CHR ベースブロック 0 + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + MI_CpuClearFast((void*)screen, sizeof(screen)); + DC_FlushRange(screen, sizeof(screen)); + GX_LoadBG0Scr(screen, 0, sizeof(screen)); + + /* 割込み設定 */ + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* LCD 表示開始 */ + GX_DispOn(); + GXS_DispOn(); + + PrintString(0, 0, 0xa, "***** Card Mode Check *****"); + + // カードアプリタイプを判別。使うRom Header Buffer を切替える + if(MY_ROMHEADER_NTR->platform_code & PLATFORM_CODE_FLAG_TWL){ + PrintString(0, 2, 0xf, "- TWL Application -"); + isTwlApplication = TRUE; + rh = MY_ROMHEADER_TWL; + } + else{ + PrintString(0, 2, 0xf, "- NTR Application -"); + isTwlApplication = FALSE; + rh = MY_ROMHEADER_NTR; + } + + OS_Printf("Buf Adr : 0x%08x\n", checkBuf); + + // カードタイプの判別 + isTwlCard = (*(vu32 *)(HW_BOOT_CHECK_INFO_BUF) & HOTSW_ROMID_TWLROM_MASK) ? TRUE : FALSE; + + // 注:rhの初期化が終わってから呼び出す + debugMessage(); + + // フラグの初期化 + flxhash = FALSE; + ltdhash = FALSE; + mirrorimage = FALSE; + + // ロックIDを取得しておく + card_lock_id = (u16)OS_GetLockID(); + + if(isTwlApplication){ + MY_LoadCard_arm7Static(); + MY_LoadCard_arm7LtdStatic(); + } + else{ + isGameModeForNTR(); + } + + ShowResult(); + + while(1){ + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } +} + + +/*---------------------------------------------------------------------------* + Name: ShowResult + + Description: + *---------------------------------------------------------------------------*/ +static void ShowResult(void) +{ + PrintString(0, 13, 0xf, "-- Result --"); + + if(flxhash && ltdhash){ + if(isTwlCard){ + PrintString(0, 15, 0x6, "Game2 Mode"); + } + else{ + PrintString(0, 15, 0x5, "Game Mode"); + } + } + else if(mirrorimage){ + PrintString(0, 15, 0x5, "Game Mode"); + } + else{ + PrintString(0, 15, 0x1, "Unknown Mode"); + } +} + + +/*---------------------------------------------------------------------------* + Name: debugMessage + + Description: + *---------------------------------------------------------------------------*/ +static void debugMessage(void) +{ + PrintString(0, 4, 0xf, "amr7 NmlRomOfs : 0x%08x", rh->sub_rom_offset); + PrintString(0, 5, 0xf, "amr7 LtdRomOfs : 0x%08x", rh->sub_ltd_rom_offset); + + OS_TPrintf("amr7 NmlRomOfs : 0x%08x\n", rh->sub_rom_offset); + OS_TPrintf("amr7 NmlSize : 0x%08x\n", rh->sub_size); + OS_TPrintf("amr7 LtdRomOfs : 0x%08x\n", rh->sub_ltd_rom_offset); + OS_TPrintf("amr7 LtdSize : 0x%08x\n", rh->sub_ltd_size); +} + + +/*---------------------------------------------------------------------------* + Name: CheckHashValue + + Description: モジュールハッシュチェック + *---------------------------------------------------------------------------*/ +static BOOL CheckHashValue(void* buf, u32 size, void* digest) +{ + u8 sha1data[DIGEST_SIZE_SHA1]; + BOOL retval = TRUE; + + // クリア + MI_CpuClear8(sha1data, sizeof(sha1data)); + + // ARM7常駐モジュールのHash値照合 + SVC_CalcHMACSHA1( sha1data, + buf, + size, + s_digestDefaultKey, + sizeof(s_digestDefaultKey) ); + + return SVC_CompareSHA1( sha1data, digest ); +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7Static + + Description: ARM7常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7Static(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_rom_offset, (s32)rh->sub_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(pBuf, rh->sub_size, (void *)rh->sub_static_digest); + + if(result){ + flxhash = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } + else{ + flxhash = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: MY_LoadCard_arm7LtdStatic + + Description: ARM7拡張常駐モジュール 読み出し・ハッシュチェック + *---------------------------------------------------------------------------*/ +static void MY_LoadCard_arm7LtdStatic(void) +{ + BOOL result; + u32* pBuf = checkBuf; + + CARD_LockRom(card_lock_id); + + ReadCardData(pBuf, (s32)rh->sub_ltd_rom_offset, (s32)rh->sub_ltd_size); + + CARD_UnlockRom(card_lock_id); + + result = CheckHashValue(pBuf, rh->sub_ltd_size, (void *)rh->sub_ltd_static_digest); + + if(result){ + ltdhash = TRUE; + PrintString(0, 9, 0x8, "Ltd Area : Accessible"); + } + else{ + ltdhash = FALSE; + PrintString(0, 9, 0x1, "Ltd Area : Not Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: isGameModeForNTR + + Description: Gameモードかどうか判定する + *---------------------------------------------------------------------------*/ +static void isGameModeForNTR(void) +{ + u32 buf1[PAGE_SIZE/sizeof(u32)]; + u32 buf2[PAGE_SIZE/sizeof(u32)]; + int result; + + /* Rom Header領域を読んで、Game領域のイメージが出てたらGameモード */ + ReadCardData(buf1, (s32)0, (s32)PAGE_SIZE); + ReadCardData(buf2, (s32)GAME_FIELD_START_ADDRESS, (s32)PAGE_SIZE); + + result = MI_CpuComp8( buf1, buf2, PAGE_SIZE ); + + if(result){ + mirrorimage = FALSE; + PrintString(0, 7, 0x1, "Flx Area : Not Accessible"); + } + else{ + mirrorimage = TRUE; + PrintString(0, 7, 0x8, "Flx Area : Accessible"); + } +} + + +/*---------------------------------------------------------------------------* + Name: HOTSWi_SetCommand + + Description: 引数で与えられたコマンドのエンディアンを変えてレジスタにセットする + *---------------------------------------------------------------------------*/ +static void SetCommand(Cmd64 *cndLE) +{ + Cmd64 cndBE; + + // ビッグエンディアンに直す + cndBE.b[7] = cndLE->b[0]; + cndBE.b[6] = cndLE->b[1]; + cndBE.b[5] = cndLE->b[2]; + cndBE.b[4] = cndLE->b[3]; + cndBE.b[3] = cndLE->b[4]; + cndBE.b[2] = cndLE->b[5]; + cndBE.b[1] = cndLE->b[6]; + cndBE.b[0] = cndLE->b[7]; + + // MCCMD レジスタ設定 + reg_MI_MCCMD0_A = *(u32*)cndBE.b; + reg_MI_MCCMD1_A = *(u32*)&cndBE.b[4]; +} + + +/*---------------------------------------------------------------------------* + Name: ReadIDGame + + Description: ゲームモードでIDを読み込む + *---------------------------------------------------------------------------*/ +static void ReadIDGame(void) +{ + u32 id; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + + // リトルエンディアンで作って + cndLE.dw = HSWOP_G_OP_RD_ID; + + // MCCMD レジスタ設定 + SetCommand(&cndLE); + + // MCCNT0 レジスタ設定 + reg_MI_MCCNT0_A = (u16)((reg_MI_MCCNT0_A & 0x00ff) | REG_MI_MCCNT0_E_MASK); + + // MCCNT1 レジスタ設定 + reg_MI_MCCNT1_A = rom_ctrl | START_MASK | PAGE_1; + + while(reg_MI_MCCNT1_A & START_MASK){ + while(!(reg_MI_MCCNT1_A & READY_MASK)){} + id = reg_MI_MCD1_A; + } + + OS_Printf("Card ID : 0x%08x\n", id); + + OS_SpinWait( 100 ); +} + + +/*---------------------------------------------------------------------------* + Name: ReadPageGame + + Description: ゲームモードで、指定されたページを指定バッファに指定サイズ分を読み込む + + CT=150ns Pagecount=1page Latency=RomHeaderで指定の値 + *---------------------------------------------------------------------------*/ +static void ReadPageGame(u32 start_addr, void* buf, u32 size) +{ + u32 loop, counter=0; + u64 i, page; + Cmd64 cndLE; + u32 rom_ctrl = *(vu32 *)(HW_CARD_ROM_HEADER + 0x60); + + rom_ctrl = rom_ctrl & ~CARD_COMMAND_MASK; + page = (u32)(start_addr / PAGE_SIZE); + loop = (u32)(size / PAGE_SIZE); + loop = (size % PAGE_SIZE) ? loop + 1 : loop; + + for(i=0; i +#include + +#define HASH_PATH "/sign/DSHashTable.bin" + +/* + このサンプルはテスト用であり、CARD関数の代わりにFS関数で + DHTライブラリが実装されている前提である +*/ + +#define ROM_PATH "/srl" + +#define DS_HASH_TABLE_NUMS 3000 +#define DS_HASH_TABLE_SIZE (sizeof(DHTHeader) + DS_HASH_TABLE_NUMS * sizeof(DHTDatabase)) + +/* + DHTファイル読み込み先 +*/ +static u8 dht_buffer[DS_HASH_TABLE_SIZE] ATTRIBUTE_ALIGN(32); +static DHTFile *const dht = (DHTFile*)dht_buffer; +/* + Phase2用バッファ +*/ +static DHTPhase2Work p2work; + +/* + 実際にはアドレス固定 +*/ +#include +static ROM_Header_Short rom_header ATTRIBUTE_ALIGN(32); // 使うのは DHT_DS_HEADER_SIZE だけ +static u8 rom_arm9[3*1024*1024] ATTRIBUTE_ALIGN(32); +static u8 rom_arm7[1024*1024] ATTRIBUTE_ALIGN(32); +#include + +/* + デバイスアクセスAPI +*/ +#if 1 +// FS版 (arg == FSFile*) +static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg) +{ + FSFile* fp = arg; + s32 result; + if ( !FS_SeekFile(fp, offset, FS_SEEK_SET) ) + { + OS_TPrintf("Cannot seek to the offset (%d bytes).\n", offset); + return FALSE; + } + result = FS_ReadFile(fp, dest, length); + if ( result != length ) + { + OS_TPrintf("Cannot read the data (%d bytes).\n", length); + return FALSE; + } + return TRUE; +} +static BOOL ReadImageEx(SVCHMACSHA1Context* ctx, s32 offset, s32 length, void* arg) +{ + if ( !ReadImage(p2work.buffer, offset, length, arg) ) + { + return FALSE; + } + DHT_CheckHashPhase2ExUpdate(ctx, p2work.buffer, length); + return TRUE; +} +#else +#ifdef SDK_ARM9 +#define PAGE_SIZE 512 +// CARD版 (arg == dma no) +static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg) +{ + u32 dma = (u32)arg; + CARD_ReadRom(dma, (void*)offset, dest, (u32)length); + return TRUE; +} +#else +// HOTSW版 (arg == CardBootData* cdb) +#include +#include +static BOOL ReadImage(void* dest, s32 offset, s32 length, void* arg) +{ + HotSwState retval; + if ( offset % 512 ) + { + static u8 page_buffer[512]; + u32 page_offset = (u32)(offset & -512); + u32 buffer_offset = (u32)(offset % 512); + u32 valid_length = 512 - buffer_offset; + retval = ReadPageGame((CardBootData*)arg, page_offset, page_buffer, 512); + if (retval != HOTSW_SUCCESS) + { + return FALSE; + } + MI_CpuCopy8(page_buffer + buffer_offset, dest, (length < valid_length ? length : valid_length)); + dest = (u8*)dest + valid_length; + offset += valid_length; + length -= valid_length; + if ( length < 0) + { + return TRUE; + } + } + retval = ReadPageGame((CardBootData*)arg, (u32)offset, dest, (u32)length); + return (retval == HOTSW_SUCCESS); +} +#endif +#endif + +static void VBlankIntr( void ) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +/* + 検証本番のうち、実際にはオーバーヘッドにならない処理 +*/ +static BOOL CheckValidation(FSFile* fp) +{ + const DHTDatabase *db; + s32 result; + + // ヘッダの読み込み + result = FS_ReadFile(fp, &rom_header, DHT_DS_HEADER_SIZE); + if ( result != DHT_DS_HEADER_SIZE ) + { + OS_TPrintf("Cannot read ROM header.\n"); + return FALSE; + } + // ARM9部分 + if ( rom_header.main_size > sizeof(rom_arm9) ) + { + OS_TPrintf("Too large main size (%d > %d).\n", rom_header.main_size, sizeof(rom_arm9)); + return FALSE; + } + if ( !FS_SeekFile(fp, (s32)rom_header.main_rom_offset, FS_SEEK_SET) ) + { + OS_TPrintf("Cannot seek to ARM9 static.\n"); + return FALSE; + } + result = FS_ReadFile(fp, rom_arm9, (s32)rom_header.main_size); + if ( result != rom_header.main_size ) + { + OS_TPrintf("Cannot read ARM9 static.\n"); + return FALSE; + } + // ARM7部分 + if ( rom_header.sub_size > sizeof(rom_arm7) ) + { + OS_TPrintf("Too large sub size (%d > %d).\n", rom_header.sub_size, sizeof(rom_arm7)); + return FALSE; + } + if ( !FS_SeekFile(fp, (s32)rom_header.sub_rom_offset, FS_SEEK_SET) ) + { + OS_TPrintf("Cannot seek to ARM7 static.\n"); + return FALSE; + } + result = FS_ReadFile(fp, rom_arm7, (s32)rom_header.sub_size); + if ( result != rom_header.sub_size ) + { + OS_TPrintf("Cannot read ARM7 static.\n"); + return FALSE; + } + + // データベースの検索 + db = DHT_GetDatabase(dht, &rom_header); + if ( !db ) + { + return FALSE; + } +//OS_TPrintf("FOUND: 0x%08X: %.4s(%d)\n", db, db->game_code, db->rom_version); + // ハッシュ計算 (1) - 隠蔽可能なはず + if ( !DHT_CheckHashPhase1(db->hash[0], &rom_header, rom_arm9, rom_arm7) ) + { + return FALSE; + } + // ハッシュ計算 (2) - 隠蔽は難しいか + if ( !DHT_CheckHashPhase2(db->hash[1], &rom_header, &p2work, ReadImage, fp) ) + { + // ハッシュ計算 (2ex) - 隠蔽は難しいか (失敗した場合も見ておく) + if ( !DHT_CheckHashPhase2Ex(db->hash[1], &rom_header, (DHTPhase2ExWork*)&p2work, ReadImage, ReadImageEx, fp) ) + { + return FALSE; + } + return FALSE; + } + // ハッシュ計算 (2ex) - 隠蔽は難しいか + if ( !DHT_CheckHashPhase2Ex(db->hash[1], &rom_header, (DHTPhase2ExWork*)&p2work, ReadImage, ReadImageEx, fp) ) + { + return FALSE; + } + + return TRUE; +} + +void TwlMain(void) +{ + OS_Init(); + OS_InitTick(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + FS_Init(FS_DMA_NOT_USE); + { + FSFile file; + if ( !FS_OpenFileEx(&file, HASH_PATH, FS_FILEMODE_R) ) + { + OS_TPanic("Cannot open %s.\n", HASH_PATH); + } + // 署名ロード + if ( !DHT_PrepareDatabase(dht, &file) ) + { + OS_TPanic("Cannot prepare the database.\n"); + } + FS_CloseFile(&file); + } + + // 本番 + { + FSFile dir; + FSDirectoryEntryInfo info; + BOOL result; + result = FS_OpenDirectory(&dir, ROM_PATH, FS_FILEMODE_R); + if ( !result ) + { + OS_TPanic("Cannot open " ROM_PATH ".\n"); + } + while ( FS_ReadDirectory(&dir, &info) ) + { + FSFile file; + OSTick begin; + char path[FS_ENTRY_LONGNAME_MAX+sizeof(ROM_PATH)+1]; + if ( info.attributes & FS_ATTRIBUTE_IS_DIRECTORY ) + { + OS_TPrintf("%s is directory.\n", info.longname); + continue; + } + STD_CopyString(path, ROM_PATH "/"); + STD_ConcatenateString(path, info.longname); + if (!FS_OpenFileEx(&file, path, FS_FILEMODE_R)) + { + OS_TPrintf("Cannot open %s.\n", path); + continue; + } + OS_TPrintf("\nTrying %s...\n", path); + begin = OS_GetTick(); + if ( !CheckValidation(&file) ) + { + OS_TPrintf("Failed. %d msec (includes loading static data).\n", (int)OS_TicksToMilliSeconds(OS_GetTick()-begin)); + } + else + { + OS_TPrintf("Success. %d msec (includes loading static data).\n", (int)OS_TicksToMilliSeconds(OS_GetTick()-begin)); + } + FS_CloseFile(&file); + } + FS_CloseDirectory(&dir); + } + + OS_TPrintf("\nDone.\n"); + OS_Terminate(); +} + diff --git a/build/tests/CheckPreloadParameters/Makefile b/build/tests/CheckPreloadParameters/Makefile new file mode 100644 index 00000000..15e918ad --- /dev/null +++ b/build/tests/CheckPreloadParameters/Makefile @@ -0,0 +1,39 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_PLATFORM = TWL + +SRCS = main.c +TARGET_BIN = main.tad + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckPreloadParameters/banner/Makefile b/build/tests/CheckPreloadParameters/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/tests/CheckPreloadParameters/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/CheckPreloadParameters/banner/banner_v3.bsf b/build/tests/CheckPreloadParameters/banner/banner_v3.bsf new file mode 100644 index 00000000..86449213 Binary files /dev/null and b/build/tests/CheckPreloadParameters/banner/banner_v3.bsf differ diff --git a/build/tests/CheckPreloadParameters/banner/icon/gameIcon.bmp b/build/tests/CheckPreloadParameters/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..8ec56f1c Binary files /dev/null and b/build/tests/CheckPreloadParameters/banner/icon/gameIcon.bmp differ diff --git a/build/tests/CheckPreloadParameters/src/main.c b/build/tests/CheckPreloadParameters/src/main.c new file mode 100644 index 00000000..7f4f7499 --- /dev/null +++ b/build/tests/CheckPreloadParameters/src/main.c @@ -0,0 +1,457 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - CheckPreloadParameters + File: main.c + + Copyright 2007 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 + +void VBlankIntr(void); + +OSOwnerInfoEx s_owner; +static char *s_strCountry[ 256 ]; +static char *s_strRegion[ OS_TWL_REGION_MAX ]; +static char *s_strUserColor[ OS_FAVORITE_COLOR_MAX ]; +static char *s_strRatingOgn[ OS_TWL_PCTL_OGN_MAX ]; +static char *s_strLanguage[ OS_LANGUAGE_CODE_MAX ]; + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + char string[ 256 ]; + int srcLen, dstLen; + OS_Init(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + OS_GetOwnerInfoEx( &s_owner ); + OS_TPrintf( "Language : %02x %s\n", s_owner.language, s_strLanguage[ s_owner.language ] ); + OS_TPrintf( "UserColor : %02x %s\n", s_owner.favoriteColor, s_strUserColor[ s_owner.favoriteColor ] ); + OS_TPrintf( "Birthday : %02d/%02d\n", s_owner.birthday.month, s_owner.birthday.day ); + { + MI_CpuClear8( string, sizeof(string) ); + srcLen = (int)s_owner.nickNameLength; + dstLen = sizeof(string); + STD_ConvertStringUnicodeToSjis( string, &dstLen, s_owner.nickName, &srcLen, NULL ); + OS_TPrintf( "Nickname : %s\n", string ); + + MI_CpuClear8( string, sizeof(string) ); + srcLen = (int)s_owner.commentLength; + dstLen = sizeof(string); + STD_ConvertStringUnicodeToSjis( string, &dstLen, s_owner.comment, &srcLen, NULL ); + OS_TPrintf( "Comment : %s\n", string ); + } + OS_TPrintf( "Country : %s\n", s_strCountry[ s_owner.country ] ); + + OS_TPrintf( "IsAgreeEULA : %s\n", OS_IsAgreeEULA() ? "Agree" : "Not agree" ); + OS_TPrintf( "AgreedEULAVersion : %d\n", OS_GetAgreedEULAVersion() ); + OS_TPrintf( "ROMHeaderEULAVersion : %d\n", OS_GetROMHeaderEULAVersion() ); + + OS_TPrintf( "AvailableWireless : %s\n", OS_IsAvailableWireless() ? "TRUE" : "FALSE" ); + PMi_SetWirelessLED( OS_IsAvailableWireless() ? PM_WIRELESS_LED_ON : PM_WIRELESS_LED_OFF ); + + { + const LCFGTWLParentalControl *pPC = (const LCFGTWLParentalControl *)OS_GetParentalControlInfoPtr(); + + OS_TPrintf( "ParentalControls :\n"); + OS_TPrintf( " isSetParentalControl : %s\n", pPC->flags.isSetParentalControl ? "TRUE" : "FALSE" ); + OS_TPrintf( " PictoChat : %s\n", pPC->flags.pictoChat ? "TRUE" : "FALSE" ); + OS_TPrintf( " DS Download : %s\n", pPC->flags.dsDownload ? "TRUE" : "FALSE" ); + OS_TPrintf( " Browser : %s\n", pPC->flags.browser ? "TRUE" : "FALSE" ); + OS_TPrintf( " WiiPoint : %s\n", pPC->flags.wiiPoint ? "TRUE" : "FALSE" ); + OS_TPrintf( " PhotoExchange : %s\n", pPC->flags.photoExchange ? "TRUE" : "FALSE" ); + OS_TPrintf( " UGC : %s\n", pPC->flags.ugc ? "TRUE" : "FALSE" ); + OS_TPrintf( " RatingOgn : %s\n", pPC->ogn < LCFG_TWL_PCTL_OGN_MAX ? s_strRatingOgn[ pPC->ogn ] : s_strRatingOgn[ LCFG_TWL_PCTL_OGN_MAX ] ); + OS_TPrintf( " RatingAge : %d\n", pPC->ratingAge ); + OS_TPrintf( " SecretQ ID : %d\n", pPC->secretQuestionID ); + OS_TPrintf( " Password : %s\n", pPC->password ); + MI_CpuClear8( string, sizeof(string) ); + srcLen = (int)pPC->secretAnswerLength; + dstLen = sizeof(string); + STD_ConvertStringUnicodeToSjis( string, &dstLen, pPC->secretAnswer, &srcLen, NULL ); + OS_TPrintf( " SecretAnswer : %s\n", string ); + } + + { + int i; + const u8 *p = OS_GetMovableUniqueIDPtr(); + OS_TPrintf( "MovableUniqueID :" ); + for( i = 0; i < OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN; i++ ) { + if( ( i & 0x0f ) == 0 ) { + OS_TPrintf( "\n" ); + } + OS_TPrintf( " %02x,", *p++ ); + } + OS_TPrintf( "\n" ); + } + OS_TPrintf( "ForceDisableWireless : %s\n", OS_IsForceDisableWireless() ? "TRUE" : "FALSE" ); + OS_TPrintf( "Region : %02x %s\n", OS_GetRegion(), ( OS_GetRegion() == 0xff ) ? "Invalid" : s_strRegion[ OS_GetRegion() ] ); + { + u8 string[ 16 ]; + OS_GetSerialNo( string ); + OS_TPrintf( "SerialNo : %s\n", string ); + } + + OS_TPrintf("***End of demo\n"); + OS_Terminate(); +} + + + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + + +static char *s_strRegion[] = { + "JAPAN", + "AMERICA", + "EUROPA", + "AUSTRALIA", + "CHINA", + "KOREA", +}; + +static char *s_strUserColor[] = { + "GRAY ", + "BROWN ", + "RED ", + "PINK ", + "ORANGE ", + "YELLOW ", + "LIME_GREEN", + "GREEN ", + "DARK_GREEN", + "SEA_GREEN ", + "TURQUOISE ", + "BLUE ", + "DARK_BLUE ", + "PURPLE ", + "VIOLET ", + "MAGENTA ", +}; + +static char *s_strLanguage[] = { + "JAPANESE", + "ENGLISH", + "FRENCH", + "GERMAN", + "ITALIAN", + "SPANISH", + "CHINESE", + "KOREAN", +}; + +static char *s_strRatingOgn[] = { + "CERO", + "ESRB", + "RESERVED2", + "USK", + "PEGI_GENERAL", + "RESERVED5", + "PEGI_PORTUGAL", + "PEGI_BBFC", + "OFLC", + "GRB", + "RESERVED_A", + "RESERVED_B", + "RESERVED_C", + "RESERVED_D", + "RESERVED_E", + "UNKNOWN", +}; + +static char *s_strCountry[] = { + "UNDEFINED ", // 未設定 + "JAPAN ", // 日本 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "Anguilla ", // アンギラ + "ANTIGUA_AND_BARBUDA", // アンティグア・バーブーダ + "ARGENTINA ", // アルゼンチン + "ARUBA", // アルバ + "BAHAMAS", // バハマ + "BARBADOS", // バルバドス + "BELIZE", // ベリーズ + "BOLIVIA", // ボリビア + "BRAZIL", // ブラジル + "BRITISH_VIRGIN_ISLANDS", // 英領ヴァージン諸島 + "CANADA", // カナダ + "CAYMAN_ISLANDS", // ケイマン諸島 + "CHILE ", // チリ + "COLOMBIA", // コロンビア + "COSTA_RICA", // コスタリカ + "DOMINICA", // ドミニカ国 + "DOMINICAN_REPUBLIC", // ドミニカ共和国 + "ECUADOR", // エクアドル + "EL_SALVADOR", // エルサルバドル + "FRENCH_GUIANA", // フランス領ギアナ + "GRENADA", // グレナダ + "GUADELOUPE", // グアドループ + "GUATEMALA ", // グアテマラ + "GUYANA", // ガイアナ + "HAITI", // ハイチ + "HONDURAS", // ホンジュラス + "JAMAICA", // ジャマイカ + "MARTINIQUE", // マルティニーク + "MEXICO", // メキシコ + "MONTSERRAT", // モントセラト + "NETHERLANDS_ANTILLES", // オランダ領アンティル + "NICARAGUA", // ニカラグア + "PANAMA ", // パナマ + "PARAGUAY", // パラグアイ + "PERU", // ペルー + "ST_KITTS_AND_NEVIS", // セントキッツ・ネイビス + "ST_LUCIA", // セントルシア + "ST_VINCENT_AND_THE_GRENADINES", // セントビンセント・グレナディーン + "SURINAME", // スリナム + "TRINIDAD_AND_TOBAGO", // トリニダード・トバゴ + "TURKS_AND_CAICOS_ISLANDS", // タークス・カイコス諸島 + "UNITED_STATES", // アメリカ + "URUGUAY ", // ウルグアイ + "US_VIRGIN_ISLANDS", // 米領バージン諸島 + "VENEZUELA", // ベネズエラ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "ALBANIA ", // アルバニア + "AUSTRALIA", // オーストラリア + "AUSTRIA", // オーストリア + "BELGIUM", // ベルギー + "BOSNIA_AND_HERZEGOVINA", // ボスニア・ヘルツェゴビナ + "BOTSWANA", // ボツワナ + "BULGARIA ", // ブルガリア + "CROATIA", // クロアチア + "CYPRUS", // キプロス + "CZECH_REPUBLIC", // チェコ + "DENMARK", // デンマーク + "ESTONIA", // エストニア + "FINLAND", // フィンランド + "FRANCE", // フランス + "GERMANY", // ドイツ + "GREECE", // ギリシャ + "HUNGARY ", // ハンガリー + "ICELAND", // アイスランド + "IRELAND", // アイルランド + "ITALY", // イタリア + "LATVIA", // ラトビア + "LESOTHO", // レソト + "LIECHTENSTEIN", // リヒテンシュタイン + "LITHUANIA", // リトアニア + "LUXEMBOURG", // ルクセンブルク + "MACEDONIA", // マケドニア + "MALTA ", // マルタ + "MONTENEGRO", // モンテネグロ + "MOZAMBIQUE", // モザンビーク + "NAMIBIA", // ナミビア + "NETHERLANDS", // オランダ + "NEW_ZEALAND", // ニュージーランド + "NORWAY", // ノルウェー + "POLAND", // ポーランド + "PORTUGAL", // ポルトガル + "ROMANIA", // ルーマニア + "RUSSIA ", // ロシア + "SERBIA", // セルビア + "SLOVAKIA", // スロバキア + "SLOVENIA", // スロベニア + "SOUTH_AFRICA", // 南アフリカ + "SPAIN", // スペイン + "SWAZILAND", // スワジランド + "SWEDEN", // スウェーデン + "SWITZERLAND", // スイス + "TURKEY", // トルコ + "UNITED_KINGDOM ", // イギリス + "ZAMBIA", // ザンビア + "ZIMBABWE", // ジンバブエ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "TAIWAN ", // 台湾 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "SOUTH_KOREA ", // 韓国 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "HONG_KONG ", // ホンコン + "MACAU", // マカオ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "INDONESIA ", // インドネシア + "SINGAPORE ", // シンガポール + "THAILAND ", // タイ + "PHILIPPINES", // フィリピン + "MALAYSIA", // マレーシア + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "CHINA ", // 中国 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UAE ", // アラブ首長国連邦 + "INDIA ", // インド + "EGYPT ", // エジプト + "OMAN", // オマーン + "QATAR", // カタール + "KUWAIT", // クウェート + "SAUDI_ARABIA", // サウジアラビア + "SYRIA", // シリア + "BAHRAIN", // バーレーン + "JORDAN", // ヨルダン + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "OTHERS ", + "UNKNOWN ", +}; + diff --git a/build/tests/CheckSharedFont/Makefile b/build/tests/CheckSharedFont/Makefile new file mode 100644 index 00000000..2087d1e2 --- /dev/null +++ b/build/tests/CheckSharedFont/Makefile @@ -0,0 +1,42 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - FS - overlay +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_BIN = main.srl + +SRCS = main.c loadSharedFont.c + +LLIBRARIES += libsharedfont$(TWL_LIBSUFFIX).a libna$(TWL_LIBSUFFIX).a + +ROM_SPEC = ROM-TS_nand.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CheckSharedFont/ROM-TS_nand.rsf b/build/tests/CheckSharedFont/ROM-TS_nand.rsf new file mode 100644 index 00000000..546adb61 --- /dev/null +++ b/build/tests/CheckSharedFont/ROM-TS_nand.rsf @@ -0,0 +1,263 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [0 - 255] + # + #AgreeEULAVersion 0 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization [0 - 31, ALWAYS, FREE] + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / ALWAYS / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/CheckSharedFont/src/loadSharedFont.c b/build/tests/CheckSharedFont/src/loadSharedFont.c new file mode 100644 index 00000000..6d858c85 --- /dev/null +++ b/build/tests/CheckSharedFont/src/loadSharedFont.c @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.c + + Copyright 2007 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 "loadSharedFont.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define FONT_LOAD_THREAD_PRIO 13 +#define THREAD_STACK_SIZE 1024 + +// function's prototype------------------------------------------------------- + +// global variable------------------------------------------------------------- +BOOL g_isSucceededLoad[ OS_SHARED_FONT_CN_KR_MAX + 1 ]; + +const char *str_fontname[ OS_SHARED_FONT_CN_KR_MAX + 1 ] = { + "SHARE_FONT_WW_L", + "SHARE_FONT_WW_M", + "SHARE_FONT_WW_S", + "SHARE_FONT_CN_L", + "SHARE_FONT_CN_M", + "SHARE_FONT_CN_S", + "SHARE_FONT_KR_L", + "SHARE_FONT_KR_M", + "SHARE_FONT_KR_S", + "SHARE_FONT_CN_KR_MAX", +}; + +// static variable------------------------------------------------------------- +static u64 s_fontLoadThreadStack[THREAD_STACK_SIZE / sizeof(u64)]; +static OSThread s_fontLoadThread; +static OSTick s_fontLoadStartTick; +static u8 *s_pFontBuffer[ OS_SHARED_FONT_CN_KR_MAX + 1 ]; // 読み込みはテストなのでロード先はstatic変数にしている。 +static BOOL s_isStarted = FALSE; + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// 共有フォントロード +// ============================================================================ +BOOL LoadSharedFontInit( void ) +{ + u8 *pBuffer; + int size; + + s_fontLoadStartTick = OS_GetTick(); + + // ロードスレッド生成 + OS_CreateThread(&s_fontLoadThread, + LoadSharedFontThread, + NULL, + s_fontLoadThreadStack + THREAD_STACK_SIZE / sizeof(u64), + THREAD_STACK_SIZE, FONT_LOAD_THREAD_PRIO); + + // フォントロード準備 + if( !OS_InitSharedFont() ) { + OS_TPrintf( "OS_InitSharedFont failed.\n" ); + return FALSE; + } + size = OS_GetSharedFontTableSize(); + if( size < 0 ) { + OS_TPrintf( "OS_GetSharedTableSize failed.\n" ); + return FALSE; + } + + pBuffer = OS_Alloc( (u32)size ); + if( pBuffer == NULL ) { + OS_TPrintf( "malloc failed.\n" ); + return FALSE; + } + if( !OS_LoadSharedFontTable( pBuffer ) ) { + OS_TPrintf( "OS_LoadSharedTable failed.\n" ); + return FALSE; + } + + // ロードスレッド起動 + OS_WakeupThreadDirect(&s_fontLoadThread); + s_isStarted = TRUE; + return TRUE; +} + + +void LoadSharedFontThread( void *arg ) +{ +#pragma unused(arg) + BOOL retval = TRUE; + OSSharedFontIndex i; + + for( i = OS_SHARED_FONT_WW_L; i < OS_SHARED_FONT_CN_KR_MAX + 1; i++ ) { + int size; + + OS_TPrintf( "%s read.\n", str_fontname[ i ] ); + + size = OS_GetSharedFontSize( i ); + if( size < 0 ) { + OS_TPrintf( " get font size failed.\n" ); + retval = FALSE; + } + + // FSのキャッシュが怪しそうなので、とりあえずアラインメントをとっておく。 + size = MATH_ROUNDUP( size, 32 ); + + s_pFontBuffer[ i ] = OS_Alloc( (u32)size ); + if( s_pFontBuffer[ i ] == NULL ) { + OS_TPrintf( " malloc failed.\n" ); + retval = FALSE; + } + + if( OS_LoadSharedFont( i, s_pFontBuffer[ i ] ) ) { + OS_TPrintf( " load succeeded.\n" ); + g_isSucceededLoad[ i ] = TRUE; + }else { + OS_TPrintf( " load failed.\n" ); + g_isSucceededLoad[ i ] = FALSE; + retval = FALSE; + } + } + OS_TPrintf( "Shared Font load time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - s_fontLoadStartTick ) ); +} + + +BOOL IsFinishedLoadSharedFont( void ) +{ + if( s_isStarted ) { + return OS_IsThreadTerminated( &s_fontLoadThread ); + }else { + return TRUE; + } +} + diff --git a/build/tests/CheckSharedFont/src/loadSharedFont.h b/build/tests/CheckSharedFont/src/loadSharedFont.h new file mode 100644 index 00000000..fb350e47 --- /dev/null +++ b/build/tests/CheckSharedFont/src/loadSharedFont.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.h + + Copyright 2007 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 __LOAD_SHARED_FONT_H__ +#define __LOAD_SHARED_FONT_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- +// global variables-------------------------------------------------- +extern BOOL g_isSucceededLoad[ OS_SHARED_FONT_CN_KR_MAX + 1 ]; +extern const char *str_fontname[ OS_SHARED_FONT_CN_KR_MAX + 1 ]; + +// function---------------------------------------------------------- +BOOL LoadSharedFontInit( void ); +void LoadSharedFontThread( void *arg ); +BOOL IsFinishedLoadSharedFont( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __LOAD_SHARED_FONT_H__ diff --git a/build/tests/CheckSharedFont/src/main.c b/build/tests/CheckSharedFont/src/main.c new file mode 100644 index 00000000..0d2f9185 --- /dev/null +++ b/build/tests/CheckSharedFont/src/main.c @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - FS - overlay + File: main.c + + Copyright 2007 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 "DEMO.h" +#include "loadSharedFont.h" + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: アプリケーションメインエントリ + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + + OS_Init(); + OS_InitTick(); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + { + OSHeapHandle hh; + void *tmp; + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_TPanic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); + } + + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); + + FS_Init(FS_DMA_NOT_USE); + + OS_TPrintf("--------------------------------\n" + "Shared Font sample.\n"); + + if( LoadSharedFontInit() ) { + + while( !IsFinishedLoadSharedFont() ) { + OS_WaitVBlankIntr(); + } + + // 結果表示 + { + int i; + int ox = 10; + int oy = 60; + DEMOFillRect(0, 0, GX_LCD_SIZE_X, GX_LCD_SIZE_Y, DEMO_RGB_CLEAR); + DEMOSetBitmapTextColor(GX_RGBA(0, 31, 0, 1)); + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMODrawFrame(ox, oy, 240, 10 + ( OS_SHARED_FONT_CN_KR_MAX + 1 ) * 10, GX_RGBA( 0, 31, 0, 1)); + for (i = 0; i < OS_SHARED_FONT_CN_KR_MAX + 1; ++i) + { + DEMODrawText(ox + 10, oy + 5 + i * 10, "%s load %s", + str_fontname[ i ], g_isSucceededLoad[ i ] ? "suceeded" : "failed"); + } + } + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } + + OS_Terminate(); +} + + diff --git a/build/tests/CreateDevKp/ARM9/Makefile b/build/tests/CreateDevKp/ARM9/Makefile new file mode 100644 index 00000000..d776bcac --- /dev/null +++ b/build/tests/CreateDevKp/ARM9/Makefile @@ -0,0 +1,60 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 0 +TARGET_NAME = CreateDevKP +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = CDKP +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main.rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/CreateDevKp/ARM9/main.rsf b/build/tests/CreateDevKp/ARM9/main.rsf new file mode 100644 index 00000000..af290caa --- /dev/null +++ b/build/tests/CreateDevKp/ARM9/main.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_0.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/CreateDevKp/ARM9/src/RomTypeTest.c b/build/tests/CreateDevKp/ARM9/src/RomTypeTest.c new file mode 100644 index 00000000..ec236dca --- /dev/null +++ b/build/tests/CreateDevKp/ARM9/src/RomTypeTest.c @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.c + + Copyright 2007 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 "misc.h" +#include "RomTypeTest.h" + +// define data------------------------------------------ +#define RETURN_BUTTON_TOP_X 2 +#define RETURN_BUTTON_TOP_Y 21 +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) + +#define ENABLE_CONTENT 0 +#define ENABLE_SHARED2 0 + +#if (ENABLE_CONTENT == 1) +#define CTRUE TRUE +#else +#define CTRUE FALSE +#endif + +#if (ENABLE_SHARED2 == 1) +#define STRUE TRUE +#else +#define STRUE FALSE +#endif + +#define TEST_NUM 15 + +typedef enum AccessPermission { + PERMISSION_NA = 0, + PERMISSION_RO, + PERMISSION_RW, + PERMISSION_ERROR, + PERMISSION_MAX +} +AccessPermission; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static AccessPermission RWExTestCore( char *path, char *testfile ); +static AccessPermission SRLTest( void ); +static AccessPermission ContentTest( void ); +static void FinalizeRWTest( FSFile *file, char* filename ); +static AccessPermission RWTestCore( char *path, char *testfile ); +static AccessPermission RWTest( char *path ); +static void TestFSPermission( void ); + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- + +// const data ----------------------------------------- + +static BOOL CreateFile( void ) +{ + int len; + FSFile file[1]; + + FS_InitFile( file ); + + // ファイル作成テスト + if ( FS_CreateFile("nand:/sys/dev.kp", FS_PERMIT_R | FS_PERMIT_W) ) + { + // ファイルオープン + if ( !FS_OpenFileEx( file, "nand:/sys/dev.kp", FS_FILEMODE_W ) ) + { + // ファイルオープン失敗 + OS_TPrintf("%s:open failed.\n","nand:/sys/dev.kp"); + return FALSE; + } + // ファイルライト + len = FS_WriteFile( file, "test", 5); + if( len != 5 ) + { + // ライト失敗 + OS_TPrintf("%s:write failed.\n","nand:/sys/dev.kp"); + return FALSE; + } + // ファイルクローズ + if( !FS_CloseFile( file ) ) + { + // クローズ失敗 + OS_TPrintf("%s:close failed.\n","nand:/sys/dev.kp"); + return FALSE; + } + }else + { + OS_TPrintf("%s:create failed.\n","nand:/sys/dev.kp"); + return FALSE; + } + + return TRUE; +} + +// テストプログラムの初期化 +void RomTypeTestInit( void ) +{ + BOOL res; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + + PrintfSJIS( 1 * 8, 9 * 8, TXT_COLOR_BLACK, "CreateFile"); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + res = CreateFile(); + + if(res) + { + PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLACK, (const u16 *)L"Succeed." ); + }else + { + PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLACK, (const u16 *)L"NG." ); + } + +} + + diff --git a/build/tests/CreateDevKp/ARM9/src/RomTypeTest.h b/build/tests/CreateDevKp/ARM9/src/RomTypeTest.h new file mode 100644 index 00000000..39905e52 --- /dev/null +++ b/build/tests/CreateDevKp/ARM9/src/RomTypeTest.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: RomTypeTest.h + + Copyright 2007 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 __ROM_TYPE_TEST_H__ +#define __ROM_TYPE_TEST_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// define data---------------------------------------------------------- + +void RomTypeTestInit( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __ROM_TYPE_TEST_H__ diff --git a/build/tests/CreateDevKp/ARM9/src/main.c b/build/tests/CreateDevKp/ARM9/src/main.c new file mode 100644 index 00000000..4b651a3c --- /dev/null +++ b/build/tests/CreateDevKp/ARM9/src/main.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "RomTypeTest.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + InitBG(); + RomTypeTestInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/CreateDevKp/Makefile b/build/tests/CreateDevKp/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/tests/CreateDevKp/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/CreateDevKp/banner/Makefile b/build/tests/CreateDevKp/banner/Makefile new file mode 100644 index 00000000..97c32d52 --- /dev/null +++ b/build/tests/CreateDevKp/banner/Makefile @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 0 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/CreateDevKp/banner/icon/gameIcon.bmp b/build/tests/CreateDevKp/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5fe5ee2c Binary files /dev/null and b/build/tests/CreateDevKp/banner/icon/gameIcon.bmp differ diff --git a/build/tests/CreateDevKp/banner/icon/msk_pictchat_icon.bin b/build/tests/CreateDevKp/banner/icon/msk_pictchat_icon.bin new file mode 100644 index 00000000..5b2734aa Binary files /dev/null and b/build/tests/CreateDevKp/banner/icon/msk_pictchat_icon.bin differ diff --git a/build/tests/CreateDevKp/banner/test-utf16_0_v3.TWL.bsf b/build/tests/CreateDevKp/banner/test-utf16_0_v3.TWL.bsf new file mode 100644 index 00000000..347fe362 Binary files /dev/null and b/build/tests/CreateDevKp/banner/test-utf16_0_v3.TWL.bsf differ diff --git a/build/tests/CustomSystemUpdater/ARM7.TWL/Makefile b/build/tests/CustomSystemUpdater/ARM7.TWL/Makefile new file mode 100644 index 00000000..3aec1362 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM7.TWL/Makefile @@ -0,0 +1,74 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = main.c \ + kami_pxi.c \ + formatter.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCR.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + ../common/include \ + ../../../systemMenu_tools/common/ARM7/include \ + +SRCDIR += ../../../systemMenu_tools/common/ARM7/src + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/tests/CustomSystemUpdater/ARM7.TWL/armadillo.lsf b/build/tests/CustomSystemUpdater/ARM7.TWL/armadillo.lsf new file mode 100644 index 00000000..177f5206 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM7.TWL/armadillo.lsf @@ -0,0 +1,86 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a +# Library libwm_sp$(LIBSUFFIX).a +# Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/tests/CustomSystemUpdater/ARM7.TWL/include/kami_pxi.h b/build/tests/CustomSystemUpdater/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..cbce8090 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM7.TWL/src/kami_pxi.c b/build/tests/CustomSystemUpdater/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..c3caa3f1 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include +#include +#include +#include +#include + +typedef unsigned char byte; /* Don't change */ +typedef unsigned short word; /* Don't change */ +typedef unsigned long dword; /* Don't change */ +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); +extern BOOL sdmcFormatNandLog( BOOL verify_flag); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_CLEAR_NAND_ERRORLOG: + case KAMI_GET_IS_TOOL_TYPE: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_CLEAR_NAND_ERRORLOG: + { + if (sdmcFormatNandLog(TRUE)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_GET_IS_TOOL_TYPE: + { + IsToolType type = IS_TOOL_TYPE_ERROR; + u8 temp = I2C_ReadRegister( I2C_SLAVE_DEBUGGER, 0); + if (temp != (u8)(-1)) // 赤箱、キャプチャ以外は通信エラー + { + if (temp == 0x44) + { + type = IS_TOOL_TYPE_DEBUGGER; + } + else if (temp == 0x43) + { + type = IS_TOOL_TYPE_CAPTURE; + } + } + + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(IsToolType), (u8*)&type); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/tests/CustomSystemUpdater/ARM7.TWL/src/main.c b/build/tests/CustomSystemUpdater/ARM7.TWL/src/main.c new file mode 100644 index 00000000..a68e6750 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM7.TWL/src/main.c @@ -0,0 +1,576 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "kami_pxi.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM 3 + +/* カードチャタリングカウンタ */ +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA + FS_Init(FS_DMA_NOT_USE); // FS for CARD + FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS +// InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + CDC_InitLib(); // CODECライブラリ初期化 + CAMERA_Init(); // カメラ + + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC +// WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + +/////////////// +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); +#endif +/////////////// + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} + +//#ifdef WM_PRECALC_ALLOWEDCHANNEL +//extern u16 WMSP_GetAllowedChannel(u16 bitField); +//#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } +/* +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +*/ +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/ARM9-TS.lsf b/build/tests/CustomSystemUpdater/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..35e3fba0 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile b/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile new file mode 100644 index 00000000..08a2e0c7 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/Makefile @@ -0,0 +1,150 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ + +# COMPILE SWITCH for build SystemUpdater +IGNORE_VERSION_CHECK ?= TRUE + +# MAKEROM SWITCH for build SystemUpdater +SYSM_DISABLE_DEBUG ?= TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0SUA +#TARGET_TAD = + +TARGET_BIN = CustomSystemUpdater_$(SYSM_REGION).srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = ../ARM7.TWL/bin/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + font_data.c \ + graphics.c \ + kami_font.c \ + import.c \ + hwi.c \ + kami_pxi.c \ + kami_write_nandfirm.c \ + hw_info.c \ + keypad.c \ + kami_copy_file.c \ + debugger_hw_reset_control.c \ + debugger_card_rom.c + +LINCLUDES = include \ + ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + $(ROOT)/build/libraries/fs/common/include \ + ../../../systemMenu_tools/common/ARM9/include \ + +SRCDIR = src \ + ../../../systemMenu_tools/HWInfoWriter/ARM9/src \ + ../../../systemMenu_tools/common/ARM9/src \ + +#LCFILE = # using default + +DATA_ROOT = ../data +ROMSET_FILE = ../romset +ROM_CHECKER = ../romchecker.rb + +SUMAKER = ../sumaker.rb custom +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +ifeq ($(IGNORE_VERSION_CHECK),TRUE) +MACRO_FLAGS += -DIGNORE_VERSION_CHECK +endif + + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +#INSTALL_DIR = $(SDK_NMENU_DATADIR) +INSTALL_DIR = ../bin + +#---------------------------------------------------------------------------- + + +#include $(ROMSET_FILE) + +.PHONY: build_time check_rom sumaker + +check_rom: +ifeq ($(DISABLE_ROMCHECK),) + $(ROM_CHECKER) $(ROMSET) $(SYSM_REGION) + $(ROM_CHECKER) $(ROMSET) VERUP +endif +#ifeq ($(DISABLE_ROMCHECK),) +# $(ROM_CHECKER) $(DATA_ROOT)/$(ROMSET) +#endif + +build_time: + echo -n "#define BUILD_TIME \"`date \"+%Y/%m/%d %H:%M:%S\"`\"" > include/build_time.h + +sumaker: + $(SUMAKER) $(ROMSET) $(SYSM_REGION) + +do-build: sumaker check_rom build_time $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/graphics.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..f76dfeb1 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/graphics.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); +void DrawResult(BOOL result); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/hw_info.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/hw_info.h new file mode 100644 index 00000000..1c43c56e --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/hw_info.h @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------* + 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 HW_INFO_H_ +#define HW_INFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + wirelessForceOff : 無線強制OFFならTRUEを指定 + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ); + + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL DeleteHWInfoFile( void ); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* HW_INFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/import.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/import.h new file mode 100644 index 00000000..8c04f1f6 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/import.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: 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 + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +s32 kamiImportTad(int no, int total, const char* path); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PROCESS_IMPORT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_copy_file.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_copy_file.h new file mode 100644 index 00000000..d2fb008c --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_copy_file.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: kami_copy_file.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_COPY_FILE_H_ +#define KAMI_COPY_FILE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +BOOL kamiCopyFile(char* srcPath, char* dstPath); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_COPY_FILE_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_font.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..ad5095e2 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_font.h @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_pxi.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..c05de9d4 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiClearNandErrorLog( void ); +KAMIResult kamiGetIsToolType( IsToolType *pType ); + +// (重要) +// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。 +// +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h new file mode 100644 index 00000000..90fe68bd --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/kami_write_nandfirm.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + 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/CustomSystemUpdater/ARM9.TWL/include/keypad.h b/build/tests/CustomSystemUpdater/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/font_data.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..54031a91 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555(31, 31, 31), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555( 5, 5, 5), RGB555(31, 31, 31),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/graphics.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..0064e83d --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/graphics.c @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(3); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} + +/*---------------------------------------------------------------------------* + Name: DrawQuad + + Description: 四角ポリゴンを描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawQuad(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_QUADS); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fsy, 0); + + G3_Color( color ); + G3_Vtx(fex, fey, 0); + + G3_Color( color ); + G3_Vtx(fsx, fey, 0); + } + G3_End(); +} + diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/hw_info.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/hw_info.c new file mode 100644 index 00000000..ed50cbac --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/hw_info.c @@ -0,0 +1,147 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater + File: 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 "hwi.h" +#include "hw_info.h" +// +#include "TWLHWInfo_api.h" +#include "TWLSettings_api.h" +// +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +BOOL WriteHWNormalInfoFile( void ); +BOOL WriteHWSecureInfoFile( u8 region ); +BOOL DeleteHWInfoFile( void ); + +/*---------------------------------------------------------------------------* + Name: HW情報全体のライト + + Description: + + Arguments: region : + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) +{ + static const char *pMsgSecureWriting = "Writing Secure File..."; + static const char *pMsgNormalWriting = "Writing Normal File..."; + static const char *pMsgSignWriting = "Writing Sign File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + u32 installedSoftBoxCount = 0; + BOOL result = TRUE; + + // セキュアファイルのライト + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。 +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む) + if( HWI_WriteHWNormalInfoFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // HWID署名ファイルのライト + if( HWI_WriteHWIDSignFile() ) { +// kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // CFGデータの修正 + if (!HWI_ModifyLanguage( region )) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "Fail! Write TWLSettings\n" ); + result = FALSE; + } + + return result; +} + +/*---------------------------------------------------------------------------* + Name: HWInfoファイルの削除 + + Description: + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ + +BOOL DeleteHWInfoFile( void ) +{ + static const char *pMsgNormalDeleting = "Deleting Normal File..."; + static const char *pMsgSecureDeleting = "Deteting Secure File..."; + static const char *pMsgSucceeded = "Success!\n"; + static const char *pMsgFailed = "Failed!\n"; + BOOL result = TRUE; + + // ノーマルファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_NORMAL_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + // セキュアファイル + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureDeleting ); + if( HWI_DeleteHWSecureInfoFile() ) { + OS_TPrintf( "%s delete succeeded.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); + }else { + OS_TPrintf( "%s delete failed.\n", (char *)LCFG_TWL_HWINFO_SECURE_PATH ); + kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); + result = FALSE; + } + + return result; +} diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/import.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/import.c new file mode 100644 index 00000000..b422e173 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/import.c @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: process_import.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 "import.h" +#include "hw_info.h" +#include "TWLHWInfo_api.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define THREAD_STACK_SIZE (16*1024) + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u32 sCurrentProgress; +static vu8 sNowImport = FALSE; +static vu8 sProgress = FALSE; +static u8 sStack[THREAD_STACK_SIZE]; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* arg); +static void Destructor(void* arg); +void ProgressDraw(f32 ratio); + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: kamiImportTad + + Description: .tad ファイルインポート + + Arguments: no + + Returns: None. + *---------------------------------------------------------------------------*/ + +s32 kamiImportTad(int no, int total, const char* path) +{ + NAMTadInfo tadInfo; + OSThread thread; + s32 nam_result; + + kamiFontPrintfMain( 4, 9, 8, "Now Updating... %d / %d", no, total ); + kamiFontLoadScreenData(); + + // tadファイルの情報取得 + nam_result = NAM_ReadTadInfo(&tadInfo, path); + if ( nam_result != NAM_OK ) + { + return nam_result; + } + + // 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; + + // 進捗スレッド作成 + MI_CpuClear8(sStack, THREAD_STACK_SIZE); + OS_CreateThread(&thread, ProgressThread, NULL, + (void*)((u32)sStack + THREAD_STACK_SIZE), THREAD_STACK_SIZE, OS_GetCurrentThread()->priority - 1); + OS_WakeupThreadDirect(&thread); + + // Import開始 + nam_result = NAM_ImportTad( path ); + + // インポート開始フラグを下げる + sNowImport = FALSE; + + // 進捗スレッドの自力終了を待つ + while (sProgress){}; + + // InstalledSoftBoxCount, FreeSoftBoxCount の値を現在のNANDの状態に合わせて更新します。 + (void)NAMUT_UpdateSoftBoxCount(); + + return nam_result; +} + +/*---------------------------------------------------------------------------* + Name: ProgressThread + + Description: .tad ファイルインポートの進捗を表示するスレッド。 + 進捗が100%に達すると処理を抜ける。 + + Arguments: arg - 使用しない。 + + Returns: None. + *---------------------------------------------------------------------------*/ + +static void ProgressThread(void* /*arg*/) +{ + u32 currentSize; + u32 totalSize = 0; + u32 totalSizeBk = 0; + + sProgress = TRUE; + + while (sNowImport) + { + 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(); + } + + sProgress = FALSE; +} + +/*---------------------------------------------------------------------------* + Name: ProgressDraw + + Description: インポートの進捗を表示します + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ + +void ProgressDraw(f32 ratio) +{ + s16 x = (s16)(30 + (226 - 30)*ratio); + + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // グリーンバー + DrawQuad( 30, 90, x, 95, GX_RGB(12, 25, 12)); + + // グレーバー + DrawQuad( 30, 90, 226, 95, GX_RGB(28, 28, 28)); + + // グレーダイアログ + DrawQuad( 20, 60, 236, 110, GX_RGB(25, 25, 25)); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_copy_file.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_copy_file.c new file mode 100644 index 00000000..c9365276 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_copy_file.c @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_copy_file.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_copy_file.h" + +/*---------------------------------------------------------------------------* + マクロ + *---------------------------------------------------------------------------*/ + +#define ROUND_UP(value, alignment) \ + (((u32)(value) + (alignment-1)) & ~(alignment-1)) + +/*---------------------------------------------------------------------------* + 処理関数定義 + *---------------------------------------------------------------------------*/ + +BOOL kamiCopyFile(char* srcPath, char* dstPath) +{ + 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, srcPath); + if (!open_is_ok) + { + OS_Printf("FS_OpenFile(\"%s\") ... ERROR!\n", srcPath); + 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", srcPath); + FS_CloseFile(&file); + OS_Free(pTempBuf); + return FALSE; + } + + // ROMファイルクローズ + FS_CloseFile(&file); + + // 一旦対象データを削除する + (void)FS_DeleteFile(dstPath); + + // ターゲットファイル作成 + if (!FS_CreateFile(dstPath, FS_PERMIT_R | FS_PERMIT_W)) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_CreateFile(%s) failed.\n", dstPath); + result = FALSE; + } + else + { + // ターゲットファイルオープン + FS_InitFile(&file); + open_is_ok = FS_OpenFileEx(&file, dstPath, FS_FILEMODE_W); + if (!open_is_ok) + { + kamiFontPrintfConsoleEx(CONSOLE_RED, "FS_OpenFile(%s) failed.\n", dstPath); + 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; +} + diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_font.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..fb3818b6 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_pxi.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..f3ce7f2a --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,370 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0)) + { + return; + } +} + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 12, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiClearNandErrorLog + + Description: NVRAMのNANDエラー情報をクリアします。 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiClearNandErrorLog( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetIsToolType + + Description: IS-TWL-DEBUGGER or CAPTURE を取得します(同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetIsToolType( IsToolType *pType ) +{ + OSIntrMode enabled; + + if (pType == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pType; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_IS_TOOL_TYPE, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + PXI関連 + *---------------------------------------------------------------------------*/ + +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c new file mode 100644 index 00000000..cac9c5ee --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/kami_write_nandfirm.c @@ -0,0 +1,332 @@ +/*---------------------------------------------------------------------------* + 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/CustomSystemUpdater/ARM9.TWL/src/keypad.c b/build/tests/CustomSystemUpdater/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/tests/CustomSystemUpdater/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/tests/CustomSystemUpdater/Makefile b/build/tests/CustomSystemUpdater/Makefile new file mode 100644 index 00000000..9ae3341f --- /dev/null +++ b/build/tests/CustomSystemUpdater/Makefile @@ -0,0 +1,123 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = THUMB +override TWL_ARCHGEN = LIMITED + + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +#.PHONY: no_rom_set +#no_rom_set: +# echo "Usage: make ROMSET=dirname" +# +#ifeq ($(ROMSET),) +# no_rom_set +#endif +# + +# リージョンが指定されてなかったら全部やる +ifeq ($(REGION),) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: do-something +clean: do-something +clobber: do-something +install: do-something +do-build: MY_GOAL= +clean: MY_GOAL=clean +clobber: MY_GOAL=clobber +install: MY_GOAL=install + +do-something: + -$(REMAKE) TWLSDK_PLATFORM=TWL REGION=JPN ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + -$(REMAKE) TWLSDK_PLATFORM=TWL REGION=AUS ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + -$(REMAKE) TWLSDK_PLATFORM=TWL REGION=USA ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL) + -rm `find . -name "*autogen*"` + -$(REMAKE) TWLSDK_PLATFORM=TWL REGION=EUR ROMSET=$(ROMSET) DISABLE_ROMCHECK=$(DISABLE_ROMCHECK) SKIP_SUBDIR=FALSE $(MY_GOAL) +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +else + +LAUNCHER_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/Launcher +MACHINESETTINGS_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/MachineSettings +WLANFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/wlanfirm +DS_HASH_TABLE = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/DSHashTable +SHARED_FONT_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont +NANDFIRM_DIR = $(TWL_IPL_RED_ROOT)/build/nandfirm/menu-launcher + + + +# 既存データを使用する場合はTRUEを指定 +SKIP_CREATE_DATA = TRUE + +ifeq ($(SKIP_CREATE_DATA),FALSE) +SUBDIRS = $(LAUNCHER_DIR) \ + $(MACHINESETTINGS_DIR) \ + $(WLANFIRM_DIR) \ + $(DS_HASH_TABLE) \ + $(SHARED_FONT_DIR) \ + $(NANDFIRM_DIR) \ + data \ + banner \ + ARM7.TWL \ + ARM9.TWL +else +SUBDIRS = banner \ + ARM7.TWL \ + ARM9.TWL +endif + +# CustomSystemUpdater +export SYSM_REGION = $(REGION) +export ROMSET := $(ROMSET) +export DISABLE_ROMCHECK := $(DISABLE_ROMCHECK) + +# COMPILE SWITCH for build SystemMenu + +export SYSM_UPDATER_RELEASE = TRUE + +export SYSM_DO_NOT_SHOW_LAUNCHER = TRUE +export SYSM_DISABLE_WDS_SCAN = FALSE +export SYSM_IGNORE_WLFIRM_SIGNCHECK = FALSE +export SYSM_DISABLE_WLFIRM_LOAD = FALSE +export SYSM_DISABLE_INITIAL_SETTINGS = TRUE +export SYSM_OUTSIDE_UI = TRUE + +export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE + +# MAKEROM SWITCH for build SystemMenu +export SYSM_DISABLE_DEBUG = FALSE +export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +endif + +#===== End of Makefile ===== diff --git a/build/tests/CustomSystemUpdater/banner/Makefile b/build/tests/CustomSystemUpdater/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/tests/CustomSystemUpdater/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/CustomSystemUpdater/banner/banner_AUS.bnr b/build/tests/CustomSystemUpdater/banner/banner_AUS.bnr new file mode 100644 index 00000000..4828a00d Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/banner_AUS.bnr differ diff --git a/build/tests/CustomSystemUpdater/banner/banner_EUR.bnr b/build/tests/CustomSystemUpdater/banner/banner_EUR.bnr new file mode 100644 index 00000000..c4d8d0fc Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/banner_EUR.bnr differ diff --git a/build/tests/CustomSystemUpdater/banner/banner_JPN.bnr b/build/tests/CustomSystemUpdater/banner/banner_JPN.bnr new file mode 100644 index 00000000..4480b5e0 Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/banner_JPN.bnr differ diff --git a/build/tests/CustomSystemUpdater/banner/banner_USA.bnr b/build/tests/CustomSystemUpdater/banner/banner_USA.bnr new file mode 100644 index 00000000..110376b6 Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/banner_USA.bnr differ diff --git a/build/tests/CustomSystemUpdater/banner/banner_v3.bsf b/build/tests/CustomSystemUpdater/banner/banner_v3.bsf new file mode 100644 index 00000000..d1c48580 Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/banner_v3.bsf differ diff --git a/build/tests/CustomSystemUpdater/banner/icon/gameIcon.bmp b/build/tests/CustomSystemUpdater/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..7bba6103 Binary files /dev/null and b/build/tests/CustomSystemUpdater/banner/icon/gameIcon.bmp differ diff --git a/build/tests/CustomSystemUpdater/common/include/fifo.h b/build/tests/CustomSystemUpdater/common/include/fifo.h new file mode 100644 index 00000000..892475dd --- /dev/null +++ b/build/tests/CustomSystemUpdater/common/include/fifo.h @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SystemUpdater - include + File: fifo.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 TWL_KAMI_TEST_FIFO_H_ +#define TWL_KAMI_TEST_FIFO_H_ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + + +typedef enum KamiCommand +{ + KAMI_TEST_COMMAND, + KAMI_EXE_FORMAT, + KAMI_NAND_IO, + KAMI_CLEAR_NAND_ERRORLOG, + KAMI_GET_IS_TOOL_TYPE +} +KamiCommand; + +typedef enum _IsToolType +{ + IS_TOOL_TYPE_ERROR, + IS_TOOL_TYPE_DEBUGGER, + IS_TOOL_TYPE_CAPTURE +} +IsToolType; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/CustomSystemUpdater/custom_base.yaml b/build/tests/CustomSystemUpdater/custom_base.yaml new file mode 100644 index 00000000..7624d9d2 --- /dev/null +++ b/build/tests/CustomSystemUpdater/custom_base.yaml @@ -0,0 +1,10 @@ +--- +:DataPath: . +:NandFirm: nandfirm_rcplus.nand +:TargetPath: . +:TemplatePath: template +:RSF: ARM9.TWL/main.rsf +:TadFiles: +:SRC: ARM9.TWL/src/main.c +:FontFile: TWLFontTable.dat +:Region: EUR diff --git a/build/tests/CustomSystemUpdater/default.yaml b/build/tests/CustomSystemUpdater/default.yaml new file mode 100644 index 00000000..de8a0c89 --- /dev/null +++ b/build/tests/CustomSystemUpdater/default.yaml @@ -0,0 +1,14 @@ +--- +:SRC: ARM9.TWL/src/main.c +:FontFile: TWLFontTable.dat +:DataPath: data +:NandFirm: menu_launcher.nand +:TargetPath: . +:TemplatePath: template +:RSF: ARM9.TWL/main.rsf +:TadFiles: +- HNAA.tad +- HNBA.tad +- HNCA.tad +- HNLA.tad +- HNHA.tad diff --git a/build/tests/CustomSystemUpdater/makecsu.sh b/build/tests/CustomSystemUpdater/makecsu.sh new file mode 100755 index 00000000..c8a17d1f --- /dev/null +++ b/build/tests/CustomSystemUpdater/makecsu.sh @@ -0,0 +1,36 @@ +#!/bin/sh +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: autoupload.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +gen_updater(){ +#ruby sumaker.rb custom $1 $2 +make ROMSET=$1 REGION=$2 +rm `find . -name "*autogen*"` +} + + +if [ $# -lt 1 ]; +then + echo "Usage: makecsu vername" + exit +fi + + +gen_updater $1 JPN +gen_updater $1 USA +gen_updater $1 AUS +gen_updater $1 EUR diff --git a/build/tests/CustomSystemUpdater/romchecker.rb b/build/tests/CustomSystemUpdater/romchecker.rb new file mode 100755 index 00000000..18da809c --- /dev/null +++ b/build/tests/CustomSystemUpdater/romchecker.rb @@ -0,0 +1,207 @@ +#!/bin/ruby +#---------------------------------------------------------------------------- +# Project: TwlSDK +# File: romchecker.rb +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +ALL_REGION = [ + "C", "D", "E", "H", +] + +FIX_REGION = [ + "A", "B", "F", "G", "I", "J", "K", "L", +] + +HEADER = "HN" + +ROM_DATA = { + "#{HEADER}A" => ["Launcher", "00030017"], + "#{HEADER}B" => ["本体設定", "00030015"], + "#{HEADER}C" => ["無線ファーム", "0003000f"], + "#{HEADER}D" => ["DSダウンロードプレイ", "00030005"], + "#{HEADER}E" => ["ピクトチャット", "00030005"], + "#{HEADER}F" => ["ショップ", "00030015"], + "#{HEADER}G" => ["フルブラウザ", "00030004"], + "#{HEADER}H" => ["DSハッシュリスト", "0003000f"], + "#{HEADER}I" => ["写真帳", "00030005"], + "#{HEADER}J" => ["ホットスポット", "00030005"], + "#{HEADER}K" => ["DSサウンド", "00030005"], + "#{HEADER}L" => ["バージョンデータ", "0003000f"], +} + +REGION_DIRS = { + "AUS" => ["aus", "U"], + "EUR" => ["euro", "P"], + "JPN" => ["jp", "J"], + "USA" => ["usa", "E"], + "VERUP" => ["verup", "UPJE"], +} + +REG_PATH = /[a-zA-Z0-9\.\-_]+\/[a-zA-Z0-9\.\-_*]+\z/ +NAND_FIRM = "*.nand" +FONT_DATA = "*.dat" + +# ファイルを検索し、ROM内に含まれるべきかどうかを判定する +# 条件に一致したファイル名の配列の要素数で判定 +# 0 個 ファイルがない +# 1 個 正常っぽい +# 2 個以上 バージョン違いや、リージョン違いが混ざっている +def check_pickuped(path, print_success) + ret = true + files = Dir.glob(path) + p_path = path.slice(REG_PATH) + #p files + case + when files.size == 0 + $stdout.printf( "NG:#{p_path} -- #{p_path} is not included ***********\n") + ret = false + when files.size == 1 && print_success + $stdout.printf( "OK:#{files[0].slice(REG_PATH)}\n") + when files.size >= 2 + $stdout.printf("NG:") + files.each{|file| + $stdout.printf( "#{file.slice(REG_PATH)} ") + } + $stdout.printf("-- Too many files are included ***********\n") + ret = false + end + ret +end + +def add_rom_list(rom_list, code, region, version, size) + rom_list << [code, region, version, size] +end + +def make_rom_list(target_dir, region) + region_dir = REGION_DIRS[region][0] + region_codes = (REGION_DIRS[region][1] + "A").unpack("A" * (REGION_DIRS[region][1].size + 1)) + #p region_codes + # 出力用リスト + rom_list = [] + + (ALL_REGION + FIX_REGION).each{|app_code| + region_codes.each{|region_code| + search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}#{region_code}*.tad") + files = Dir.glob(search_path) + files.each{|tad| + add_rom_list(rom_list, "#{HEADER}#{app_code}", region_code, get_rom_version(tad), File.stat(tad).size) + } + } + } + write_rom_list(rom_list, "rom_list_#{region}.txt") +end + +def write_rom_list(rom_list, file_name) + region_name = { + "A" => "ALL", "E" => "USA", "U" => "AUS", "J" => "JPN", "P" => "EUR" + } + out = "" + sp = [8, 20, 10, 17, 10, 14] + line = "" + sp.each{|s| + line += "+#{"-" * s}" + } + line += "+\n" + out += line + out += sprintf("|%#{sp[0]}s|%-#{sp[1]}s|%#{sp[2]}s|%-#{sp[3]}s|%#{sp[4]}s|%#{sp[5]}s|\n", + "コード", "名前", "リージョン", "タイトルID", "バージョン", "ファイルサイズ") + out += line + rom_list.each{|rom| + rom_data = ROM_DATA[rom[0]] + size = (rom[3].to_s).reverse.scan(/.{1,3}/).join(",").reverse + out += sprintf("|%#{sp[0]}s|%-#{sp[1]}s|%-#{sp[2]}s|%8s %8x|%#{sp[4]}s|%#{sp[5]}s|\n", + rom[0] + rom[1], rom_data[0],region_name[rom[1]], rom_data[1], (rom[0] + rom[1]).unpack("N")[0], rom[2], size); + } + out += line + File.open(file_name, "w") {|file| + file.puts out + } +end + +def get_rom_version(path) + files = Dir.glob(path) + files[0].slice(/v[0-9]+/).delete("v") +end + +def check(target_dir, region) + ret = true + if REGION_DIRS[region] == nil + puts "Invalid region, [JPN, USA, EUR, AUS, VERUP]" + return false + end + region_dir = REGION_DIRS[region][0] + region_code = REGION_DIRS[region][1] + + # 出力用リスト + rom_list = [] + + ALL_REGION.each{|app_code| + # オールリージョンのロムが含まれているかのチェック + search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}A*.tad") + #if ret &= check_pickuped(search_path, false) + #add_rom_list(rom_list, "#{HEADER}#{app_code}", "A", get_rom_version(search_path)) + #end + check_pickuped(search_path, false) + } + FIX_REGION.each{|app_code| + # 各リージョン固有のロムが含まれているかのチェック + search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}#{region_code}*.tad") + #if ret &= check_pickuped(search_path, false) + #add_rom_list(rom_list, "#{HEADER}#{app_code}", region_code, get_rom_version(search_path)) + #end + ret &= check_pickuped(search_path, false) + } + (ALL_REGION + FIX_REGION).each{|app_code| + # HNxy が 各リージョンごと1つだけ存在するかのチェック + # HNxA と HNxU など、aとuが混在していたりするとここでひっかかる + search_path = File.join(target_dir, region_dir, "#{HEADER}#{app_code}*.tad") + ret &= check_pickuped(search_path, false) + } + + # nand firm, font のチェック + search_path = File.join(target_dir, region_dir, NAND_FIRM) + ret &= check_pickuped(search_path, false) + search_path = File.join(target_dir, region_dir, FONT_DATA) + ret &= check_pickuped(search_path, false) + $stdout.printf("\n") + + # CSUに含まれているロムの一覧を書き出す +# write_rom_list(rom_list, "rom_list_#{region}.txt") + +# make_rom_list(target_dir, region) + + ret +end + +# こっからメイン + +if ARGV.size < 2 + p "Usage: #{__FILE__} targetdir region" + exit -1 +end + +# カレントディレクトリの変更 +Dir.chdir(File.dirname(File.expand_path(__FILE__))) + + +target = ARGV[0] +region = ARGV[1] +make_rom_list(target, region) +if region == "VERUP" + exit 0 +else + exit check(target,region) ? 0 : -1 +end + diff --git a/build/tests/CustomSystemUpdater/sumaker.rb b/build/tests/CustomSystemUpdater/sumaker.rb new file mode 100755 index 00000000..8d630ebf --- /dev/null +++ b/build/tests/CustomSystemUpdater/sumaker.rb @@ -0,0 +1,212 @@ +#!/bin/ruby +#---------------------------------------------------------------------------- +# Project: TwlSDK +# File: sumaker.rb +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +require "yaml" +require "fileutils" +require "tempfile" + +DEFAULT_CONFIG = "default.yaml" +CUSTOM_CONFIG = "custom.yaml" + +FILE_MATCH = /[a-zA-Z0-9\-_\.]+\z/ + +REGION = { + "JPN" => "OS_TWL_REGION_JAPAN", + "EUR" => "OS_TWL_REGION_EUROPE", + "AUS" => "OS_TWL_REGION_AUSTRALIA", + "USA" => "OS_TWL_REGION_AMERICA", +} + +REGION_PATH = { + "JPN" => "jp", + "EUR" => "euro", + "AUS" => "aus", + "USA" => "usa", +} + +# デフォルト設定の作成 +def make_default_config + config = { + :TadFiles => [ + "HNAA.tad", + "HNBA.tad", + "HNCA.tad", + "HNLA.tad", + "HNHA.tad", + ], + :FontFile => "TWLFontTable.dat", + :NandFirm => "menu_launcher.nand", + :TargetPath => ".", + :TemplatePath => "template", + :RSF => "ARM9.TWL/main.rsf", + :SRC => "ARM9.TWL/src/main.c", + :DataPath => ".", + :Region => "JPN", + } + write_config(DEFAULT_CONFIG, config) + +end + +# ファイル名にスクリプトを置いてあるディレクトリをくっつける +def calc_path(filename) +# File.join(File.dirname(File.expand_path(__FILE__)), filename) +filename +end + +# コンフィグファイルを読んで展開 +def read_config(filename) + YAML.load(File.read(calc_path(filename))) +end + +# コンフィグのライト +def write_config(filename, data) + File.open(calc_path(filename), "w") {|file| + file.write data.to_yaml + } +end + +# データ内の文字列を置き換える +def replace_data(src, mark, data) + while src.index(/%#{mark}%/) != nil do + src = src.sub(/%#{mark}%/, data) + end + src +end + + +# ファイルを書き込む +def write_data(filename, data) + temp = Tempfile.new("temp") + temp.puts data + temp.close + FileUtils.cp(temp.path, calc_path(filename)) +end + +# main.rsfの書き換え +def make_rsf(config) + tadlist = config[:TadFiles].dup + tadlist << config[:FontFile] << config[:NandFirm] + tadlist = tadlist.join(" ") + src = File.read(File.join(config[:TemplatePath], config[:RSF])) + #src = File.read(config[:TemplatePath] + "/" + config[:RSF]) + src = replace_data(src, "datapath", config[:DataPath]) + src = replace_data(src, "regionname", config[:Region]) + write_data(File.join(config[:TargetPath], config[:RSF]), replace_data(src, "filelist", tadlist)) + #write_data(config[:TargetPath] + "/" + config[:RSF], replace_data(src, "filelist", tadlist)) +end + +# main.c の書き換え +def make_main(config) + filelist = config[:TadFiles] + data = [] + for t in filelist do + data.push("\t\"rom:/data/" + t + "\", \n") + end + data = data.join + #src = File.read(config[:TemplatePath] + "/" + config[:SRC]) + src = File.read(File.join(config[:TemplatePath], config[:SRC])) + mod = replace_data(src, "tadlist", data) + mod = replace_data(mod, "nandfirm", config[:NandFirm]) + mod = replace_data(mod, "fontfile", config[:FontFile]) + + # region + region_name = (config[:Region] != nil) ? config[:Region] : "JPN" + region = (REGION[region_name] != nil) ? REGION[region_name] : REGION["JPN"] + mod = replace_data(mod, "region", region) + mod = replace_data(mod, "regionname", region_name) + #write_data(config[:TargetPath] + "/" + config[:SRC], mod) + write_data(File.join(config[:TargetPath], config[:SRC]), mod) + +end + +# SystemUpdaterを作成する +def make_updater(filename) + config = read_config(filename) + make_rsf(config) + make_main(config) +end + +# ディレクトリ内のtadを検索 +def pickup_files(target_dir, name) + Dir.glob(target_dir + name) +end + + +# こっからメイン + +#sumaker mode [filename] + +if ARGV.size == 0 + p "Usage: sumaker mode [filename]" + exit +end + +mode = ARGV[0] + +case mode +when "default" then + # デフォルト設定で作成 + make_default_config + make_updater(DEFAULT_CONFIG) +when "custom" then + if ARGV.size < 3 + p "Usage: sumaker custom target_dir region" + exit -1 + end + # カスタム設定で作成 + config = "custom_base.yaml" + region = ARGV[2] + + # カレントディレクトリ変更 + Dir.chdir(File.dirname(File.expand_path(__FILE__))) + + + # ベースコンフィグに、dataディレクトリ内のtadとnandを追加 + config = read_config(config) + if config[:TadFiles] == nil + config[:TadFiles] = [] + end + + + #config[:DataPath] += "/#{ARGV[1]}/#{REGION_PATH[region]}" + config[:DataPath] = File.join(config[:DataPath], ARGV[1], REGION_PATH[region]) + config[:Region] = region + tads = pickup_files(config[:DataPath], "/*.tad") + nand = pickup_files(config[:DataPath], "/*.nand") + font = pickup_files(config[:DataPath], "/*.dat") +# フォントファイル名変更 + system("mv #{font} #{File.join(config[:DataPath], "TWLFontTable")}.dat") + font = pickup_files(config[:DataPath], "/*.dat") + + if nand.size > 0 + config[:NandFirm] = nand[0].slice(FILE_MATCH) + end + if font.size > 0 + config[:FontFile] = font[0].slice(FILE_MATCH) + end + for tad in tads do + tad = tad.slice(FILE_MATCH) + config[:TadFiles] << tad + end + config[:TadFiles] = config[:TadFiles].uniq + write_config(CUSTOM_CONFIG, config) + make_updater(CUSTOM_CONFIG) + + exit 0 +end + diff --git a/build/tests/CustomSystemUpdater/template/ARM9.TWL/main.rsf b/build/tests/CustomSystemUpdater/template/ARM9.TWL/main.rsf new file mode 100644 index 00000000..1e5df836 --- /dev/null +++ b/build/tests/CustomSystemUpdater/template/ARM9.TWL/main.rsf @@ -0,0 +1,229 @@ +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: main.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + RomSize 64M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_%regionname%.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + # ========= SystemUpdaterは特別な鍵を使う ========= + CommonClientKey TRUE + #CommonClientKeyForDebugger TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../%datapath% + Root /data + File %filelist% + HostRoot $(PRIVKEY_PATH) + Root /key + File $(HWINFO_PRIVKEY) $(HWID_PRIVKEY) +} diff --git a/build/tests/CustomSystemUpdater/template/ARM9.TWL/src/main.c b/build/tests/CustomSystemUpdater/template/ARM9.TWL/src/main.c new file mode 100644 index 00000000..0825e574 --- /dev/null +++ b/build/tests/CustomSystemUpdater/template/ARM9.TWL/src/main.c @@ -0,0 +1,765 @@ +/*---------------------------------------------------------------------------* + Project: SystemUpdater + File: main.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 // atoi +#include +#include +#include +#include +#include +#include +#include "kami_pxi.h" +#include "kami_font.h" +#include "kami_write_nandfirm.h" +#include "kami_copy_file.h" +#include "import.h" +#include "hw_info.h" +#include "graphics.h" +#include "hwi.h" +#include "keypad.h" +#include "debugger_hw_reset_control.h" +#include "debugger_card_rom.h" +#include "build_time.h" + +#define SCRAMBLE_MASK 0x00406000 + +extern const char *g_strIPLSvnRevision; +extern const char *g_strSDKSvnRevision; + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct _SystemUpdaterLog +{ + int magic_code; + int sdk_version; + int ipl_version; + int reserve[5]; +} SystemUpdaterLog; + +typedef struct _CopyFileList +{ + char* srcPath; + char* dstPath; +} CopyFileList; + +/*---------------------------------------------------------------------------* + 内部定数定義 + *---------------------------------------------------------------------------*/ + +#define SYSTEM_UPDATER_LOG_PATH "nand:/sys/log/updater.log" +#define NAND_FIRM_PATH_IN_ROM "rom:/data/%nandfirm%" + +#define SYSTEM_UPDATER_MAGIC_CODE 44001111 + +// リトライ回数 +#define MAX_RETRY_COUNT 2 + +static const char* ImportTadFileList[] = +{ +%tadlist% +}; + +static const CopyFileList sCopyFileList[] = +{ + { "rom:/data/%fontfile%", "nand:sys/%fontfile%" } +}; + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static NAMTitleId titleId; +static s16 printLine; +static vu8 sIsFormatFinish; +static u8 sFormatResult; +static s32 sLockId; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); +static BOOL IgnoreRemoval(void); +static void DrawWaitButtonA(void); +static void DrawInvalidConsole(void); +static void DrawCancel(void); +static void DrawAlready(SystemUpdaterLog* log); +static void DrawResult(BOOL result); +static void FormatCallback(KAMIResult result, void* arg); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + BOOL result; + BOOL hw_info_result; + BOOL nand_firm_result; + int tadNum; + int i,j; + + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitThread(); + OS_InitTick(); + OS_InitAlarm(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + TP_Init(); + RTC_Init(); + + KamiPxiInit(); /* 独自PXI初期化 */ + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + InitAllocation(); + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain ); // SoftBoxCountの計算に必要 + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + // メインスレッドのカードロックID取得 + sLockId = OS_GetLockID(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // コンソールチェック + { + u32 console = OS_GetRunningConsoleType(); + enum { IS_TWL_DEBUGGER=0, IS_TWL_CAPTURE, TWL, UNKNOWN }; + int running = UNKNOWN; + + // SystemUpdaterはデバッグ不可で作成されるためOS_CONSOLE_TWLが取得される + // 赤箱にカードを挿してSystemUpdaterを実行した場合も同様(但しOS_CONSOLE_TWLTYPE_RETAILにはならない) + // デバッガかどうかの判定はメモリサイズチェックにより行う + // 念のためOS_CONSOLE_TWLTYPE_RETAILでないことも確認する + + if ((console & OS_CONSOLE_SIZE_MASK) == OS_CONSOLE_SIZE_32MB) + { + if ((console & OS_CONSOLE_TWLTYPE_MASK) != OS_CONSOLE_TWLTYPE_RETAIL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_DEBUGGER) + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_ERROR) // TSボードプラス + 旧仕様デバッガ + { + running = IS_TWL_DEBUGGER; + } + else if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + } + } + else if ((console & OS_CONSOLE_MASK) == OS_CONSOLE_TWL) + { + IsToolType type; + kamiGetIsToolType(&type); + if (type == IS_TOOL_TYPE_CAPTURE) + { + running = IS_TWL_CAPTURE; + } + else + { + running = TWL; + } + } + + switch (running) + { + case IS_TWL_DEBUGGER: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_DEBUGGER."); + break; + case IS_TWL_CAPTURE: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on IS_TWL_CAPTURE."); + break; + case TWL: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on TWL CONSOLE."); + break; + case UNKNOWN: + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "Running on UNKNOWN."); + break; + } + +#ifdef SYSM_BUILD_FOR_DEBUGGER + // デバッガ向けSystemUpdaterは実機とキャプチャでは動作させない + if (running != IS_TWL_DEBUGGER) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on TWL-CONSOLE. "); + DrawInvalidConsole(); + } +#else + // 実機向けSystemUpdaterはデバッガでは動作させない + if (running == IS_TWL_DEBUGGER) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on IS-TWL-DEBUGGER."); + DrawInvalidConsole(); + } +#endif // SYSM_BUILD_FOR_DEBUGGER + + // UNKNOWNはは動作させない + if (running == UNKNOWN) + { + kamiFontPrintfMain( 2, 9, 3, " Sorry, "); + kamiFontPrintfMain( 2, 10, 3, " This SystemUpdater can not "); + kamiFontPrintfMain( 2, 11, 3, " execute on UNKNOWN CONSOLE."); + DrawInvalidConsole(); + } + } + + // (更新可能条件) + // 1.ログが存在しない + // 2.ログが存在し、ログに記載のマジックコードが不正(初版SystemUpdater実行後の状態) + // 2.ログが存在し、ログに記載のマジックコードが正しくかつログに記載の + // SDK & IPL のバージョンが SystemUpdater のそれ以下である + +#ifdef IGNORE_VERSION_CHECK + if( 0 ) +#endif // IGNORE_VERSION_CHECK + { + SystemUpdaterLog log; + FSFile file; + FS_InitFile( &file ); + + if (FS_OpenFileEx(&file, SYSTEM_UPDATER_LOG_PATH, FS_FILEMODE_R) == TRUE) + { + DC_InvalidateRange(&log, sizeof(log)); + + if (FS_ReadFile(&file, &log, sizeof(log)) == sizeof(log)) + { + // ログリード成功 + OS_Printf("[%d, %d]\n", log.sdk_version, log.ipl_version); + + // 初版SystemUpdater実行状態でないことをマジックコードで判別する + if (log.magic_code == SYSTEM_UPDATER_MAGIC_CODE) + { + // マジックコード、SDKバージョン、IPLバージョンの確認 + if (log.sdk_version > atoi(g_strSDKSvnRevision) || + log.ipl_version > atoi(g_strIPLSvnRevision)) + { + // 更新不可 + DrawAlready(&log); + } + } + } + else + { + // ログリード失敗 + OS_Warning("Failure! FS_ReadFile"); + } + + FS_CloseFile(&file); + } + } + + // Aボタン待ち + DrawWaitButtonA(); + + // TWLの更新処理を実行中です + CARD_LockRom((u16)sLockId); + (void)CARDi_ReadRomIDCoreEx(DEBUGGER_COMMAND_NOW_UPDATE); + CARD_UnlockRom((u16)sLockId); + + // ISデバッガのハードウェアリセットを禁止する + DEBUGGER_HwResetDisable(); + + // HWInfo関連の前準備 + switch (HWI_Init( OS_AllocFromMain, OS_FreeToMain )) + { + case HWI_INIT_FAILURE: + OS_Warning(" Fail! : HWI_INIT()"); + break; + case HWI_INIT_SUCCESS_PRO_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_DEV_SIGNATURE_MODE: + break; + case HWI_INIT_SUCCESS_NO_SIGNATRUE_MODE: + break; + } + + result = TRUE; + + // 完全に消去 + NAMUT_Format(); + + // フォーマット実行 + sIsFormatFinish = FALSE; + ExeFormatAsync(FORMAT_MODE_QUICK, FormatCallback); + kamiFontPrintfMain( 7, 11, 8, "Now Format..."); + while(!sIsFormatFinish){}; + if (sFormatResult) + { + kamiFontPrintf( 0, printLine++, FONT_COLOR_GREEN, "NAND Format Success."); + } + else + { + kamiFontPrintf( 0, printLine++, FONT_COLOR_RED, "NAND Format Failure!"); + } + kamiFontPrintfMain( 7, 11, 8, " "); + + // フォーマット後はESに必要なファイルがなくなっているため + // ES_InitLibを呼び出すことで作成しておく + NAM_End( NULL, NULL ); + NAM_Init( OS_AllocFromMain, OS_FreeToMain ); + + // 全ハードウェア情報の更新 + for (i=0;isdk_version, log->ipl_version ); + kamiFontPrintfMain( 3, 13, 1, "--------------------------"); + + while(1) + { + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + DrawQuad( 10, 50, 246, 128, GX_RGB(28, 28, 28)); + + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + + OS_WaitVBlankIntr(); + } +} + +/*---------------------------------------------------------------------------* + Name: DrawResult + + Description: 処理結果を表示します。 + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DrawResult(BOOL result) +{ + // 3D初期化 + G3X_Reset(); + G3_Identity(); + G3_PolygonAttr(GX_LIGHTMASK_NONE, GX_POLYGONMODE_DECAL, GX_CULL_NONE, 0, 31, 0); + + // "Now Updating.." を消去 + kamiFontPrintfMain( 0, 9, 7, " "); + + if (result) + { + kamiFontPrintfMain( 9, 10, 7, "Update Success!"); + // グリーンダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(12, 25, 12)); + } + else + { + kamiFontPrintfMain( 9, 10, 7, "Update Failure!"); + // レッドダイアログ + DrawQuad( 50, 50, 206, 120, GX_RGB(31, 0, 0)); + } + + kamiFontLoadScreenData(); + + // 3Dスワップ + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); +} + +/*---------------------------------------------------------------------------* + Name: FormatCallback + + Description: フォーマットコールバック + + Arguments: + + Returns: None. + *---------------------------------------------------------------------------*/ +static void FormatCallback(KAMIResult result, void* /*arg*/) +{ + if ( result == KAMI_RESULT_SUCCESS_TRUE ) + { + sFormatResult = TRUE; + } + else + { + sFormatResult = FALSE; + } + + sIsFormatFinish = TRUE; +} diff --git a/build/tests/CustomSystemUpdater/work/aftercls.sh b/build/tests/CustomSystemUpdater/work/aftercls.sh new file mode 100755 index 00000000..2ec65c6e --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/aftercls.sh @@ -0,0 +1,48 @@ +#!/bin/sh +#! bash -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: aftercls.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +AQUA='//10.116.1.5' +CLSED_PATH="${AQUA}/TWL_debug/sysmenu/rom/debug_rom/CLS_processed" +DAILY_CLSED_DIR=`date +'%Y%m%d'`_cls + +if [ $# -lt 1 ]; +then + echo "input target dir name" + exit +fi + +echo "tocsu.sh" +./tocsu.sh $1 + +echo "toaqua.rb" +./toaqua.rb $1 + +# Aquaへコピー +echo "Copying to Aqua" +cp -r $1_foraqua ${CLSED_PATH}/${DAILY_CLSED_DIR} + +# Shop ROM のコピー +shopdir="${AQUA}/TWL_debug/shop/rom/cls/${DAILY_CLSED_DIR}" +/bin/mkdir ${shopdir} +/bin/cp $1_foraqua/verup/tad/shop* ${shopdir} + +# NZV ROM のコピー +nzvdir="${AQUA}/TWL_debug/nintendo_spot/rom/clsprocessed/"`date +'%Y%m%d'` +/bin/mkdir ${nzvdir} +/bin/cp -r $1/HNJ* ${nzvdir} \ No newline at end of file diff --git a/build/tests/CustomSystemUpdater/work/cls.sh b/build/tests/CustomSystemUpdater/work/cls.sh new file mode 100755 index 00000000..d58e276f --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/cls.sh @@ -0,0 +1,51 @@ +#!/bin/sh +#! bash -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: conv2svnDir.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +move_data_to_tmp() { + tmp=tmp/$1 + install -d $tmp + for src in `find $1 -name v* -type d` + do + mv $src $tmp + done +} + +do_cls() { + tmp=tmp/$1 + for target in `find $tmp -name v* -type d | sort -t / -n -k 3.2` + do + cp -rp $target $1 + t=`echo "$target" | cut -c 5-` + if [ -f $t/*.cls ]; then + echo "$t:Already cls processed" + else + genLic $1 + fi +# genLic $1 + done +} + +for app in `find . -maxdepth 1 -mindepth 1 -type d` +do + name=`echo "$app" | cut -c 3-` + move_data_to_tmp $name + do_cls $name +done + +rm -rf tmp diff --git a/build/tests/CustomSystemUpdater/work/mkcls.py b/build/tests/CustomSystemUpdater/work/mkcls.py new file mode 100644 index 00000000..668f22af --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/mkcls.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import sys, os, struct +import string, random +import re, shutil, binascii + +def roundup(val, align): + return int((val+align-1)/align)*align + +def randstr(n): + words = ''.join([string.digits,string.letters,'.','+']) + return ''.join(random.choice(words) for i in xrange(n)) + +def main(): + try: + tadfile = sys.argv[1] + except: + print '%s : please specfy the tad file' % (sys.argv[0]) + exit(-1) + + #--- parse *.tad + fin = open(tadfile, 'rb') + try: + tadData = fin.read() + except: + fin.close() + start, end = 0, struct.calcsize('>l2sh6l') + (hdrSize, tadType, tadVersion, certSize, crlSize, ticketSize, tmdSize, + contentSize, metaSize) = struct.unpack('>l2sh6l', tadData[start:end]) + certOffset = roundup(hdrSize, 64) + crlOffset = roundup(certOffset + certSize, 64) + ticketOffset = roundup(crlOffset + crlSize, 64) + tmdOffset = roundup(ticketOffset + ticketSize, 64) + contentOffset = roundup(tmdOffset + tmdSize, 64) + metaOffset = roundup(contentOffset + contentSize, 64) + fileSize = roundup(metaOffset + metaSize, 64) + + #print '-'*20+'\n' + #print ' hdrSize %s\n' % hdrSize, + #print ' tadType %s\n' % tadType, + #print ' tadVersion, %s\n' % tadVersion, + #print ' certSize, %s\n' % certSize, + #print ' crlSize, %s\n' % crlSize, + #print ' ticketSize, %s\n' % ticketSize, + #print ' tmdSize, %s\n' % tmdSize, + #print ' contentSize, %s\n' % contentSize, + #print ' metaSize %s' + #print '\n'+'-'*20 + #open("cert.bin", 'wb').write(tadData[certOffset:certOffset+certSize]) + #open("crl.bin", 'wb').write(tadData[crlOffset:crlOffset+crlSize]) + #open("ticket.bin", 'wb').write(tadData[ticketOffset:ticketOffset+ticketSize]) + #open("tmd.bin", 'wb').write(tadData[tmdOffset:tmdOffset+tmdSize]) + #open("content.bin", 'wb').write(tadData[contentOffset:contentOffset+contentSize]) + #open("meta.bin", 'wb').write(tadData[metaOffset:metaOffset+metaSize]) + + #--- parse TMD + tmd = tadData[tmdOffset:tmdOffset+tmdSize] + + #--- RSA2048 signature + (sigB, sigE) = (0, struct.calcsize('>i256s60s64s')) + (IOSCCertSigType, IOSCRsaSig2048, IOSCSigDummy, IOSCName)\ + = struct.unpack('>i256s60s64s', tmd[sigB:sigE]) + + #print "=== RSA2048 signature ===============" + #print "IOSCCertSigType : %x" % IOSCCertSigType + #print "IOSCRsaSig2048 : %s" % IOSCRsaSig2048 + #print "IOSCSigDummy : %s" % IOSCSigDummy + #print "IOSCName : %s" % IOSCName + + #--- ESTitleMetaHeader + (tmhB, tmhE) = (sigE, sigE+struct.calcsize('>4B5iH62si3H')) + (version, + caCrlVersion, + signerCrlVersion, + dummy, + sysVersion_H, + sysVersion_L, + titleId_H, + titleId_L, + titleType, + groupID, + reserved, + accessRights, + titleVersion, + numContents, + bootIndex) = struct.unpack('>4B5iH62si3H',tmd[tmhB:tmhE]) + + print "=== ESTitleMetaHeader ===============" + #print ('version : %d ') % version + #print ('caCrlVersion : %d ') % caCrlVersion + #print ('signerCrlVersion : %d ') % signerCrlVersion + #print ('dummy : %s ') % dummy + #print ('sysVersion_H : %x ') % sysVersion_H + #print ('sysVersion_L : %x ') % sysVersion_L + print ('titleId_H : %08x ') % titleId_H + print ('titleId_L : %08x ') % titleId_L + #print ('titleType : %x ') % titleType + print ('groupID : %x ') % groupID + #print ('reserved[62] : %s ') % reserved + #print ('accessRights : %d ') % accessRights + print ('titleVersion : %d ') % titleVersion + #print ('numContents : %d ') % numContents + #print ('bootIndex : %d ') % bootIndex + + #--- make directory for cls + tadpath = os.path.dirname(tadfile) + gamecode = binascii.unhexlify('%x'%titleId_L) + keycode = gamecode[:3] + sysdic = { 'HNA':'menu', + 'HNB':'setting', + 'HNC':'wfirm', + 'HND':'dlplay', + 'HNE':'pchat', + 'HNF':'shop', + 'HNG':'browser', + 'HNH':'whlist', + 'HNI':'photo', + 'HNJ':'nzv', + 'HNK':'sound', + 'HNL':'verdata', + } + try: + suffix = sysdic.get(keycode) + if suffix: + clsdir = ''.join(['./',gamecode,'-',suffix]) + else: + clsdir = ''.join(['./',gamecode]) + os.mkdir(clsdir) + except: + print '%s : can not create dir %s' % (sys.argv[0],clsdir) + + #--- write properties + properties = open(''.join([clsdir,'/properties']),'w') + properties.write('TITLE_ID\t\t\t\t%08x%08x\n' % (titleId_H, titleId_L)) + properties.write('TITLE_NAME\t\t\t\t%s\n' % gamecode) + properties.write('TITLE_TYPE\t\t\t\t%s\n' % 'TWL_SYS') + properties.write('PASSWORD\t\t\t\t%s\n' % randstr(64)) + properties.write('ALLOW_COMMON_TICKET\t\t%s\n' % '1') + + #--- make version dir + verdir = ''.join([clsdir,'/v',str(titleVersion)]) + try: + os.mkdir(verdir) + except: + print '%s : can not create dir %s' % (sys.argv[0],verdir) + else: + shutil.copy(tadfile,verdir) + +if __name__ == '__main__': + sys.exit(main() or 0) \ No newline at end of file diff --git a/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh b/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh new file mode 100755 index 00000000..98479574 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh @@ -0,0 +1,55 @@ +#!/bin/sh +#! bash -f + +#---- commands +LS='/bin/ls' +ECHO='/bin/echo' +HEAD='/bin/head' +FIND='/bin/find' +COPY='/bin/cp' +DATE='/bin/date' +XARGS='/bin/xargs' +MKDIR='/bin/mkdir' +CHDIR='cd' + +#---- values +aqua_server='//10.116.1.5' +debug_dir="${aqua_server}/TWL_debug/sysmenu/rom/debug_rom" +redroms="${debug_dir}/sd.roms.template*" +clsbase="${debug_dir}/CLS_base" +datedir=`${DATE} +%Y%m%d` +regions='jp usa euro aus' + +#---- call pickup_tad.pl +${ECHO} "===== getting latest apps files =====" +perl ./pickup_tad.pl + +#---- gets the latest sd.roms.template roms +#redrom_dir=`${LS} -d --full-time ${redroms} | sort -k 7,10 | tail -n 1` +redrom_dir=`${LS} -dt ${redroms} | ${HEAD} -n 1` +${ECHO} -e "===== getting sd.roms.template* rom files =====" +${ECHO} -e "sd.roms.template dir : ${redrom_dir}" +${ECHO} -e "copy *.(tad|dat|nand) file -> ${datedir} dir\n" +${FIND} ${redrom_dir} -regextype posix-egrep -regex ".*.(tad|dat|nand)" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null + +#---- gets the cls base roms +${ECHO} -e "===== getting sd.roms.template* rom files =====" +${ECHO} -e "CLS_base dir : ${clsbase}" +${ECHO} -e "copy *.tad file -> ${datedir} dir" +${FIND} ${clsbase} -name "*.tad" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null + +#---- call mkcls.py +${ECHO} -e "===== create forcls dirs =====" +${MKDIR} ${datedir}_forcls +${CHDIR} ${datedir}_forcls +${FIND} ../${datedir} -name "*.tad" -exec ../mkcls.py {} \; + +${ECHO} -e "===== copy *.nand *.dat files -> (jp|usa|euro|aus) dirs =====\n" +for region in ${regions} +do + ${MKDIR} ${region} + ${COPY} ../${datedir}/*.nand ${region} + ${COPY} ../${datedir}/*.dat ${region} +done + +${COPY} ../cls.sh ./ \ No newline at end of file diff --git a/build/tests/CustomSystemUpdater/work/pickup_tad.pl b/build/tests/CustomSystemUpdater/work/pickup_tad.pl new file mode 100755 index 00000000..b003899e --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/pickup_tad.pl @@ -0,0 +1,146 @@ +#!/usr/bin/perl -w -I/usr/local/bin +use File::Copy; +use File::Copy::Recursive qw(fcopy rcopy dircopy); +use Class::Struct; +use POSIX 'strftime'; +use File::Find; + +require "util.pl"; + +my @apps = ("download_play", + "full_browser", + "nintendo_spot", + "photo", + "pictchat", + "shop", + "sound", + "sysmenu"); + +my $flgDate = 0; + +my $i; +my $date_dir = ""; +my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $str_today = sprintf("%04d%02d%02d", $year+1900, $mon+1, $mday); +my $flghelp = 0; +my $err; +my @list_tad; + + +for ($i = 0; $i < $#ARGV+1; $i++) { + + my $opt = $ARGV[$i]; + + if ( $opt eq "-d" ) { + $flgDate = 1; + unless ( $#ARGV <= $i ) { + #$date_dir = $aqua_dir."/SD_".$ARGV[$i+1]; + $str_today = $ARGV[$i+1]; + $err = [ 1, "Not date (\"$date_dir\") !!"] if ( $date_dir !~ /[0-9]{8}/ ); + $i++; + + } else { + $err = [1,"No argument after -d !!"]; + } + } elsif ( $opt eq "-h" ) { + &show_help; + exit 0; + } else { + print "Unknown option: $opt\n"; + &show_help; + exit 1; + } + do { + print "*** Error *** : $err->[1]"; + exit 1; + } if ( $err->[0] ); +} + +# each application directory +foreach $app ( @apps ) +{ + my $dir_date; + #$dir_app = sprintf('//Aqua/TWL_debug/%s/rom/tad', $app); +$dir_app = sprintf('//10.116.1.5/TWL_debug/%s/rom/tad', $app); + $dir_app_date = &search_date_dir($dir_app); + + print "* $dir_app\n - $dir_app_date\n\n"; + + find( sub + { + do { + push @list_tad, $File::Find::name }if (/\.tad$/); + }, $dir_app_date + ); + #foreach ( @list_tad ) { print " * $_\n"; } +} + +#print "Date: $date_dir\n"; + +# Actually not today +mkdir($str_today); + +# copy to the local date directory +foreach ( @list_tad ) { + print("$_\n"); + copy($_, $str_today); +} + +# +exit 0; + +#----------------------------------------------------------------------- +# name : show_help +# function : +#----------------------------------------------------------------------- +sub show_help +{ +print <<__MSG_HELP__; +Usage: +\$ perl pickup_tad.pl [-d yyyymmdd] +__MSG_HELP__ +} + +#----------------------------------------------------------------------- +# name : search_date_dir +# function : +#----------------------------------------------------------------------- +sub search_date_dir +{ + my $root_dir; + my $date_dir; + my $prefix = ($#_<1) ? "" : $_[1]; + my $full_prefix; + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + + $year += 1900; + $mon += 1; + + $root_dir = ( $#_ < 0 ) ? "." : $_[0]; + + $full_prefix = $root_dir."/".$prefix; + $date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday); + + # search directory on going back date + while ( $year >= 2000 ) { + if ( -e "$date_dir" and -d "$date_dir") { + return "$date_dir"; + } else { + $mday -= 1; + $date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday); + } + do { + $mday = 31; # constant + $mon -= 1; + unless ( $mon ) { + $mon = 12; + $year -= 1; + } + } unless ( $mday ) ; + } + print "*** Error *** : Can't find the date directory !!\n"; + return 0; +} + +__END__ + diff --git a/build/tests/CustomSystemUpdater/work/toaqua.rb b/build/tests/CustomSystemUpdater/work/toaqua.rb new file mode 100755 index 00000000..3840ed68 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/toaqua.rb @@ -0,0 +1,92 @@ +#!/bin/ruby +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: toaqua.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +require "find" +require "fileutils" + +REGION_DIR = { + "U" => ["aus"], + "E" => ["usa"], + "J" => ["jp"], + "P" => ["euro"], + "A" => ["aus", "usa", "jp", "euro"], +} + +VERUP_DIR = "verup" +VERUP_CLS = "#{VERUP_DIR}/cls" +VERUP_TAD = "#{VERUP_DIR}/tad" + +def proc(target_dir, output_dir) + Find.find(target_dir){ |path| + next unless File.file?(path) && (/[a-z0-9A-Z]{4}-.*v[0-9]+\.tad\.out/ =~ path) != nil +# p path + src = path + + # ディレクトリ内のtadファイルの.tadより前を取り出す + dest = "" + version = "" + Find.find(File.split(src)[0]){|tad| + # .tad が見つかった + if (/.*\.tad\z/ =~ tad) != nil + dest = File.split(tad)[1] + end + if (/.*\.cls\z/ =~ tad) != nil + p tad + version = tad.slice(/v[0-9]+/) + end + } + dest = /\.tad/.match(dest).pre_match + "-" + version + ".tad" + # リージョンを判別してコピー + regions = REGION_DIR[File.split(src)[1][3..3]] + for region in regions do + if version != "v0" + p version + p src + system("cp #{src} #{[output_dir, "#{VERUP_TAD}", dest].join("/")}") + system("cp #{src.sub(/\.tad\.out/, ".cls")} #{[output_dir, "#{VERUP_CLS}", dest.sub(/\.tad/, ".cls")].join("/")}") + else + system("cp #{src} #{[output_dir, region, dest].join("/")}") + end + end + } + +end + +# こっからメイン + +if ARGV.size < 1 + $stdout.printf("Usage:#{__FILE__} target_clsed_dir output_dir") + exit -1 +end +src = ARGV[0].sub(/\/\z/, "") +out = "#{src}_foraqua" +system("mkdir #{out}") +system("mkdir #{out}/aus") +system("mkdir #{out}/usa") +system("mkdir #{out}/euro") +system("mkdir #{out}/jp") +system("mkdir #{out}/#{VERUP_DIR}") +system("mkdir #{out}/#{VERUP_CLS}") +system("mkdir #{out}/#{VERUP_TAD}") + +system("cp -rf #{src}/aus #{out}") +system("cp -rf #{src}/usa #{out}") +system("cp -rf #{src}/euro #{out}") +system("cp -rf #{src}/jp #{out}") + +proc(src, out) + diff --git a/build/tests/CustomSystemUpdater/work/tocls.sh b/build/tests/CustomSystemUpdater/work/tocls.sh new file mode 100755 index 00000000..b7725bb5 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/tocls.sh @@ -0,0 +1,51 @@ +#!/bin/sh +#! bash -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: conv2svnDir.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + +if [ $# -lt 1 ]; +then + echo "input target dir name" + exit +fi + +target=`echo $1 | sed -e 's/\/$//'` +target=$target"_forcls" +echo $target + +mkdir $target +cd $target +find ../$1 -name "*.tad" -exec ../mkcls.py {} \; +cp ../cls.sh ./ + +# nandファームと、フォントを一応リージョン毎にコピー +mkdir jp +mkdir aus +mkdir usa +mkdir euro + +cp `find ../$1/jp -name "*.nand"` jp +cp `find ../$1/jp -name "*.nand"` aus +cp `find ../$1/jp -name "*.nand"` usa +cp `find ../$1/jp -name "*.nand"` euro +cp `find ../$1/jp -name "*.dat"` jp +cp `find ../$1/jp -name "*.dat"` aus +cp `find ../$1/jp -name "*.dat"` usa +cp `find ../$1/jp -name "*.dat"` euro + + diff --git a/build/tests/CustomSystemUpdater/work/tocsu.sh b/build/tests/CustomSystemUpdater/work/tocsu.sh new file mode 100755 index 00000000..c4d9ea7d --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/tocsu.sh @@ -0,0 +1,66 @@ +#!/bin/sh +#! bash -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools +# File: tocsu.sh +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + + + +if [ $# -lt 1 ]; +then + echo "input target dir name" + exit +fi + + +target=`echo $1 | sed -e 's/\/$//'` +target=$target"_forcsu" +echo $target + + +tmp=`echo $1 | sed -e 's/\/$//'`_tmp +mkdir $target +cd $target + +mkdir jp +mkdir aus +mkdir usa +mkdir euro + +cp -rf ../$1/jp . +cp -rf ../$1/aus . +cp -rf ../$1/usa . +cp -rf ../$1/euro . + +mkdir verup +mkdir $tmp + +find ../$1 -name "*.out" -exec cp {} $tmp \; + +find $tmp -regex "[^/]*/...[jaJA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s jp/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > jp.sh +find $tmp -regex "[^/]*/...[uaUA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s aus/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > aus.sh +find $tmp -regex "[^/]*/...[paPA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s euro/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > euro.sh +find $tmp -regex "[^/]*/...[eaEA].*v0\.tad\.out" | gawk -F/ '{printf("cp %s usa/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > usa.sh +find $tmp -regex "[^/]*/.*v[^0][0-9]*\.tad\.out" | gawk -F/ '{printf("cp %s verup/%s\n",$0, $2)}' | sed -e 's/\.out$//g' > verup.sh + +./jp.sh +./aus.sh +./euro.sh +./usa.sh +./verup.sh + +mv $tmp ../ +rm -rf *.sh diff --git a/build/tests/CustomSystemUpdater/work/util.pl b/build/tests/CustomSystemUpdater/work/util.pl new file mode 100755 index 00000000..e6d9a075 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/util.pl @@ -0,0 +1,110 @@ + +package util; + +#----------------------------------------------------------------------- +# name : get_title_version +# function : get the title version from the specified tad file +#----------------------------------------------------------------------- +sub get_title_version { + + my $titleVersion = 0 ; + my $cmdPython = "/usr/bin/python.exe"; + my $scrpPython = "/usr/local/bin/mkcls.py"; + $tad = $_[0]; + + open(PY, "$cmdPython $scrpPython $tad | ") or die "$!"; + $titleVersion = $1 if ( =~ /([0-9]{1,})/) ; + close(PY); + + $titleVersion; +} + +#----------------------------------------------------------------------- +# name : get_nlist +# function : get the list of the specified directory except "." and ".." +#----------------------------------------------------------------------- +sub get_nlist { + my $dirname = ( $#_ < 0) ? "." : $_[0]; + my @list; + + unless ( opendir(DIR, "$dirname") ) { + print "Can't open directory: $dirname\n"; + return ""; + } + + foreach $node ( readdir(DIR) ) { + push(@list, $node) unless ( $node =~ /^\.{1,2}$/ ); + } + closedir(DIR); + + @list; +} + + +#----------------------------------------------------------------------- +# name : fecheck +# function : check the specified file existence (Error if no file) +#----------------------------------------------------------------------- +sub fecheck { + my $filename = $_[0]; + unless ( -e $filename ) { +print < + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/include/font.h b/build/tests/DisableDebugFlgChecker/include/font.h new file mode 100644 index 00000000..d4f23ed2 --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.h + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/include/screen.h b/build/tests/DisableDebugFlgChecker/include/screen.h new file mode 100644 index 00000000..4b758ee9 --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/include/screen.h @@ -0,0 +1,67 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.h + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +// フォントの色 +#define COLOR_BLACK 0x10 +#define COLOR_RED 0x11 +#define COLOR_GREEN 0x12 +#define COLOR_BLUE 0x13 +#define COLOR_YELLOW 0x14 +#define COLOR_PURPLE 0x15 +#define COLOR_L_BLUE 0x16 +#define COLOR_D_RED 0x17 +#define COLOR_D_GREEN 0x18 +#define COLOR_D_BLUE 0x19 +#define COLOR_D_YELLOW 0x1a +#define COLOR_D_PURPLE 0x1b +#define COLOR_D_L_BLUE 0x1c +#define COLOR_GRAY 0x1d +#define COLOR_D_GRAY 0x1e +#define COLOR_WHITE 0x1f + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/main.rsf b/build/tests/DisableDebugFlgChecker/main.rsf new file mode 100644 index 00000000..2a3fe85c --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/main.rsf @@ -0,0 +1,244 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2008-09-04#$ +# $Rev: 2394 $ +# $Author: aoki_ryoma $ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "FatalChecker" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + # BannerFile ../banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + LockSCFG FALSE + + DisableDebug TRUE + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media gamecard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 0G6A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/tests/DisableDebugFlgChecker/src/common.c b/build/tests/DisableDebugFlgChecker/src/common.c new file mode 100644 index 00000000..c1b7c958 --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/src/common.c @@ -0,0 +1,156 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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:: 2008-08-25#$ + $Rev: 8074 $ + $Author: nishimoto_takashi $ + *---------------------------------------------------------------------------*/ +#include "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + CARD_Init(); // 新規追加 + CARD_Enable(TRUE); // 新規追加 + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitHeap(void) +{ + void* tempLo; + OSHeapHandle hh; + + // メインメモリ上のアリーナにヒープをひとつ作成 + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + // ヒープ作成に失敗した場合は異常終了 + OS_Panic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/src/font.c b/build/tests/DisableDebugFlgChecker/src/font.c new file mode 100644 index 00000000..ebc10e7b --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005-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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/src/main.c b/build/tests/DisableDebugFlgChecker/src/main.c new file mode 100644 index 00000000..41e7deaf --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/src/main.c @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-2 + File: main.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:: 2008-09-03#$ + $Rev: 8251 $ + $Author: nishimoto_takashi $ + *---------------------------------------------------------------------------*/ +#include +#include +#include + +#include "application_jump_private.h" +#include "common.h" +#include "screen.h" + +#define DMA_NO_FS 1 +#define CHECK_APP_NUM 10 +#define REGION_NUM 4 + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +static u8 gRegion; + +static u8 gDisableDebugFlg[CHECK_APP_NUM]; +static BOOL gError[CHECK_APP_NUM]; +static NAMTitleInfo gInfo[CHECK_APP_NUM]; + +static NAMTitleId titleID[CHECK_APP_NUM] = { + 0x00030017484e4100, // ランチャ + 0x00030015484e4200, // 本体設定 + 0x00030005484e4441, // DSダウンロードプレイ all region + 0x00030005484e4541, // ピクトチャット all region + 0x00030015484e4600, // ショップ + 0x00030005484e4900, // カメラ + 0x00030005484e4a00, // ゾーン + 0x00030005484e4b00, // サウンド + 0x00030015344e4641, // NandFiler all region + 0x0003001534544E41, // TwlNMenu all region +}; + +const static u32 regioncode[REGION_NUM] = { + 0x4A, // 日本 + 0x45, // アメリカ + 0x50, // 欧州 + 0x55, // オーストラリア +}; + +// スペースの都合MAX 7文字で +char *gAppName[CHECK_APP_NUM] = { + "Menu", + "Setting", + "DL play", + "PctChat", + "Shop", + "Camera", + "NinZone", + "Sound", + "NFiler", + "NMenu" +}; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void DrawScene(void); +static void* AllocForNAM(u32 size); +static void FreeForNAM(void* ptr); +static void CheckDisableDebugFlg(void); +/*---------------------------------------------------------------------------*/ + + +void TwlMain(void) +{ + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + FS_Init(DMA_NO_FS); + NAM_Init(AllocForNAM, FreeForNAM); + + ClearScreen(); + + gRegion = OS_GetRegion(); + + OS_TPrintf("Region : %d\n", gRegion); + + CheckDisableDebugFlg(); + + while(TRUE) + { + // 画面描画 + DrawScene(); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // 画面クリア + ClearScreen(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + +static void CheckDisableDebugFlg(void) +{ + char file_path[FS_ENTRY_LONGNAME_MAX]; + u8 buf[0x1000]; + u32 i; + + for(i=0; is.disable_debug){ + gDisableDebugFlg[i] = '1'; + } + else{ + gDisableDebugFlg[i] = '0'; + } + OS_TPrintf("DisableFlg( %c )", gDisableDebugFlg[i]); + + // ファイルクローズ + bSuccess = FS_CloseFile(&f); + + OS_TPrintf(" File Read/Close Success\n"); + gError[i] = FALSE; + } + else{ + OS_TPrintf(" ng \n"); + gError[i] = TRUE; + gDisableDebugFlg[i] = '-'; + } + + // tadバージョンの取得 + if( NAM_ReadTitleInfo( &gInfo[i], titleID[i] ) != NAM_OK ) + { + OS_TPrintf("[0x%08x] ReadTitleInfo failed...\n", titleID[i]); + } + } +} + + +static void DrawScene(void) +{ + s32 i; + u8 color; + u8 *p; + u8 hi, lo; + BOOL success = TRUE; + + for(i=0; i> 8); + lo = (u8)(gInfo[i].version & 0xff); + + PutMainScreen(20, 8+i, color, "%d.%d", hi, lo); + } + else + { + PutMainScreen(20, 8+i, color, "---", gInfo[i].version); + } + + if(gDisableDebugFlg[i] == '0') + { + PutMainScreen(28, 8+i, 0xf1, "NG"); + } + } + PutMainScreen( 0,18, color, "-------------------------------"); +} + + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: Vブランク割込みハンドラ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグ47をセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static void* AllocForNAM(u32 size) +{ + void* ptr; + ptr = OS_AllocFromMain(size); + + if (ptr == NULL) + { + OS_Panic("alloc failed."); + } + + return ptr; + +} + +static void FreeForNAM(void* ptr) +{ + OS_FreeToMain(ptr); +} + + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DisableDebugFlgChecker/src/screen.c b/build/tests/DisableDebugFlgChecker/src/screen.c new file mode 100644 index 00000000..c00a4a75 --- /dev/null +++ b/build/tests/DisableDebugFlgChecker/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/DispOwnerInfo/Makefile b/build/tests/DispOwnerInfo/Makefile new file mode 100644 index 00000000..24f22784 --- /dev/null +++ b/build/tests/DispOwnerInfo/Makefile @@ -0,0 +1,97 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: debugIPL2 +# File: Makefile +# +# Copyright 2003,2004 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. +# +# $Log: Makefile,v $ +# Revision 1.10.2.1 2006/02/01 05:10:42 yosiokat +# ビルドソースにIPLType.cを追加。 +# +# Revision 1.10 2005/04/14 05:53:29 yosiokat +# NITRO設定データ関係を強制的に中国版にするスイッチFORCE_CHINAを追加。 +# +# Revision 1.9 2005/04/07 02:23:25 yosiokat +# リリースタイム更新用のルール追加。 +# +# Revision 1.8 2005/04/06 02:19:03 yosiokat +# ソースのcheckFontData.cをcheckIPL2Font.cに変更。 +# +# Revision 1.7 2005/04/05 08:05:14 yosiokat +# BUILD_MAINTEスイッチによって、共通ソースからDebugToolForIPL2とMaintenanceToolForIPL2 +# をビルドできるよう変更。 +# +# Revision 1.6 2005/03/31 05:45:12 yosiokat +# rev.1.5は間違いNitroConfigData.cに戻す。 +# +# Revision 1.5 2005/03/31 05:44:17 yosiokat +# NitroConfigData.cをnitroConfigData.cに戻す。 +# +# Revision 1.4 2005/03/28 09:34:12 yosiokat +# バナー追加。 +# +# Revision 1.3 2005/03/09 04:44:11 yosiokat +# 機能追加。 +# +# Revision 1.2 2004/09/23 11:27:45 yosiokat +# small fix. +# +# Revision 1.1.1.1 2004/08/31 06:20:24 Yosiokat +# no message +# +# +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +SUBDIRS = banner + +#---------------------------------------------------------------------------- + +TARGET_NEF = DispOwnerInfo.nef +TARGET_BIN = DispOwnerInfo.srl + +SRCS = main.c initFunc.c font.c data.c dispNCD.c myFunc.c myChar.c + +FONT_DIR = font +FONTS = f08han.dat f08zen.dat f10han.dat f10zen.dat f12han.dat f12zen.dat f16han.dat f16zen.dat +FONT_DATAS = $(addprefix $(FONT_DIR)/, $(FONTS)) +FONT_OBJS = $(FONT_DATAS:.dat=.o) + +ROM_SPEC = main.rsf + +#LCFILE_SPEC = # using default +#SRCDIR = # using default + +# makerom settings +MAKEROM_ROMROOT = ./data +MAKEROM_ROMFILES = *.bin + +LINCLUDES += include +LLIBRARY_DIRS += mlib/$(NITRO_LIBTYPE) $(FONT_DIR) +LLIBRARIES += libfnt.a $(FONTS:.dat=.o) + +LDIRT_CLEAN = $(FONT_DIR)/*.o + +include $(NITROSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(FONT_OBJS) $(TARGETS) + +include $(NITROSDK_ROOT)/build/buildtools/modulerules + +$(TARGETS) : $(MAKEROM_ARM7) + +$(FONT_DIR)/%.o : $(FONT_DIR)/%.dat + $(CW_BINDIR)/BinToElf.exe $< -aligndata 4 -endian little -output $@ + + +#===== End of Makefile ===== diff --git a/build/tests/DispOwnerInfo/banner/Makefile b/build/tests/DispOwnerInfo/banner/Makefile new file mode 100644 index 00000000..c0dd732c --- /dev/null +++ b/build/tests/DispOwnerInfo/banner/Makefile @@ -0,0 +1,73 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: NitroSDK - tools +# File: Makefile +# +# Copyright 2003,2004 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. +# +# $Log: Makefile,v $ +# Revision 1.3 2005/04/14 05:58:28 yosiokat +# NITRO設定データ関係を強制的に中国版にするスイッチFORCE_CHINAを追加。 +# +# Revision 1.2 2005/04/02 10:00:08 yosiokat +# BUILD_MAINTE=TRUE時には、バナータイトルを変えるようにする。 +# +# Revision 1.1 2005/03/28 09:36:16 yosiokat +# バナー追加。 +# +# Revision 1.2 2004/10/18 05:37:51 yasu +# Fix how to make banners +# +# Revision 1.1 2004/09/21 02:02:53 yasu +# Demo for building final rom +# +# Revision 1.1 2004/09/17 09:10:59 yasu +# Build default banner file for SDK demos +# +# $NoKeywords: $ +#--------------------------------------------------------------------------- +include $(NITROSDK_ROOT)/build/buildtools/commondefs + +BANNER_ICON = myGameIcon.bmp +BANNER_SPEC = myGameBanner.bsf +TARGETS = myGameBanner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(NITROSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -d -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +#---------------------------------------------------------------------------- +# test +#---------------------------------------------------------------------------- +#include $(NITROSDK_ROOT)/build/buildtools/commondefs.emtype.ISD + +test: $(TARGETS) + $(ADDBANNER) $(TARGETS) $(TARGETS:.bnr=.srl) +ifdef ISD_NITLOAD + $(ISD_NITLOAD) $(TARGETS:.bnr=.srl) +endif + +# diff --git a/build/tests/DispOwnerInfo/banner/myGameBanner.bsf b/build/tests/DispOwnerInfo/banner/myGameBanner.bsf new file mode 100644 index 00000000..3c65700e Binary files /dev/null and b/build/tests/DispOwnerInfo/banner/myGameBanner.bsf differ diff --git a/build/tests/DispOwnerInfo/banner/myGameIcon.bmp b/build/tests/DispOwnerInfo/banner/myGameIcon.bmp new file mode 100644 index 00000000..0b2bcfd1 Binary files /dev/null and b/build/tests/DispOwnerInfo/banner/myGameIcon.bmp differ diff --git a/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bncmp b/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bncmp new file mode 100644 index 00000000..29754732 Binary files /dev/null and b/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bncmp differ diff --git a/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bnfr b/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bnfr new file mode 100644 index 00000000..36525719 Binary files /dev/null and b/build/tests/DispOwnerInfo/data/NITRO_LC_Font_s.bnfr differ diff --git a/build/tests/DispOwnerInfo/font/f08han.dat b/build/tests/DispOwnerInfo/font/f08han.dat new file mode 100644 index 00000000..11a56ec7 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f08han.dat differ diff --git a/build/tests/DispOwnerInfo/font/f08zen.dat b/build/tests/DispOwnerInfo/font/f08zen.dat new file mode 100644 index 00000000..c36ef492 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f08zen.dat differ diff --git a/build/tests/DispOwnerInfo/font/f10han.dat b/build/tests/DispOwnerInfo/font/f10han.dat new file mode 100644 index 00000000..8917e0f0 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f10han.dat differ diff --git a/build/tests/DispOwnerInfo/font/f10zen.dat b/build/tests/DispOwnerInfo/font/f10zen.dat new file mode 100644 index 00000000..256b04c1 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f10zen.dat differ diff --git a/build/tests/DispOwnerInfo/font/f12han.dat b/build/tests/DispOwnerInfo/font/f12han.dat new file mode 100644 index 00000000..08bd466f Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f12han.dat differ diff --git a/build/tests/DispOwnerInfo/font/f12zen.dat b/build/tests/DispOwnerInfo/font/f12zen.dat new file mode 100644 index 00000000..ee38836d Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f12zen.dat differ diff --git a/build/tests/DispOwnerInfo/font/f16han.dat b/build/tests/DispOwnerInfo/font/f16han.dat new file mode 100644 index 00000000..6477fda3 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f16han.dat differ diff --git a/build/tests/DispOwnerInfo/font/f16zen.dat b/build/tests/DispOwnerInfo/font/f16zen.dat new file mode 100644 index 00000000..2e1f78f7 Binary files /dev/null and b/build/tests/DispOwnerInfo/font/f16zen.dat differ diff --git a/build/tests/DispOwnerInfo/include/fnt.h b/build/tests/DispOwnerInfo/include/fnt.h new file mode 100644 index 00000000..3f9d6b63 --- /dev/null +++ b/build/tests/DispOwnerInfo/include/fnt.h @@ -0,0 +1,9 @@ +#ifndef FNT_H_ +#define FNT_H_ + +#include "fnt/fnt_enum.h" +#include "fnt/fnt_struct.h" +#include "fnt/fnt_func.h" +#include "fnt/fnt_data.h" + +#endif // FNT_H_ diff --git a/build/tests/DispOwnerInfo/include/fnt/fnt_data.h b/build/tests/DispOwnerInfo/include/fnt/fnt_data.h new file mode 100644 index 00000000..e4a7f162 --- /dev/null +++ b/build/tests/DispOwnerInfo/include/fnt/fnt_data.h @@ -0,0 +1,32 @@ +extern u8 NITRO_LC_Font_t_bncmp[]; +extern u8 NITRO_LC_Font_t_bncmp_end[]; +extern u8 NITRO_LC_Font_t_bnfr[]; +extern u8 NITRO_LC_Font_t_bnfr_end[]; +extern u8 NITRO_LC_Font_s_bncmp[]; +extern u8 NITRO_LC_Font_s_bncmp_end[]; +extern u8 NITRO_LC_Font_s_bnfr[]; +extern u8 NITRO_LC_Font_s_bnfr_end[]; +extern u8 NITRO_LC_Font_Chinese_t_bncmp[]; +extern u8 NITRO_LC_Font_Chinese_t_bncmp_end[]; +extern u8 NITRO_LC_Font_Chinese_t_bnfr[]; +extern u8 NITRO_LC_Font_Chinese_t_bnfr_end[]; +extern u8 NITRO_LC_Font_Chinese_s_bncmp[]; +extern u8 NITRO_LC_Font_Chinese_s_bncmp_end[]; +extern u8 NITRO_LC_Font_Chinese_s_bnfr[]; +extern u8 NITRO_LC_Font_Chinese_s_bnfr_end[]; +extern u8 NITRO_LC_Font_Hangul_t_bncmp[]; +extern u8 NITRO_LC_Font_Hangul_t_bncmp_end[]; +extern u8 NITRO_LC_Font_Hangul_t_bnfr[]; +extern u8 NITRO_LC_Font_Hangul_t_bnfr_end[]; +extern u8 NITRO_LC_Font_Hangul_s_bncmp[]; +extern u8 NITRO_LC_Font_Hangul_s_bncmp_end[]; +extern u8 NITRO_LC_Font_Hangul_s_bnfr[]; +extern u8 NITRO_LC_Font_Hangul_s_bnfr_end[]; +extern u8 NITRO_LC_Font_s_NAT_WW_bncmp[]; +extern u8 NITRO_LC_Font_s_NAT_WW_bncmp_end[]; +extern u8 NITRO_LC_Font_s_NAT_WW_bnfr[]; +extern u8 NITRO_LC_Font_s_NAT_WW_bnfr_end[]; +extern u8 NITRO_LC_Font_s_NAT_KR_bncmp[]; +extern u8 NITRO_LC_Font_s_NAT_KR_bncmp_end[]; +extern u8 NITRO_LC_Font_s_NAT_KR_bnfr[]; +extern u8 NITRO_LC_Font_s_NAT_KR_bnfr_end[]; diff --git a/build/tests/DispOwnerInfo/include/fnt/fnt_enum.h b/build/tests/DispOwnerInfo/include/fnt/fnt_enum.h new file mode 100644 index 00000000..e78252fc --- /dev/null +++ b/build/tests/DispOwnerInfo/include/fnt/fnt_enum.h @@ -0,0 +1,35 @@ +#ifndef FNT_ENUM_H_ +#define FNT_ENUM_H_ + +enum tFntDrawContextType +{ + FNT_DCTYPE_4BITS, + FNT_DCTYPE_8BITS, + FNT_DCTYPE_LAST +}; + +enum tFntPosXOrigin +{ + FNT_POSX_ORIGIN_LEFT, + FNT_POSX_ORIGIN_CENTER, + FNT_POSX_ORIGIN_RIGHT, + FNT_POSX_ORIGIN_LAST +}; + +enum tFntPosYOrigin +{ + FNT_POSY_ORIGIN_TOP, + FNT_POSY_ORIGIN_CENTER, + FNT_POSY_ORIGIN_BOTTOM, + FNT_POSY_ORIGIN_LAST +}; + +enum tFntTextHAlign +{ + FNT_H_ALIGN_LEFT, + FNT_H_ALIGN_CENTER, + FNT_H_ALIGN_RIGHT, + FNT_H_ALIGN_LAST +}; + +#endif // FNT_ENUM_H_ diff --git a/build/tests/DispOwnerInfo/include/fnt/fnt_func.h b/build/tests/DispOwnerInfo/include/fnt/fnt_func.h new file mode 100644 index 00000000..196749b5 --- /dev/null +++ b/build/tests/DispOwnerInfo/include/fnt/fnt_func.h @@ -0,0 +1,50 @@ +#ifndef FNT_FUNC_H_ +#define FNT_FUNC_H_ + +// fnt_utils.c +extern int fnt_GetLeftFromOrigin( tFntPosition posx, int width ); +extern int fnt_GetTopFromOrigin ( tFntPosition posy, int height ); + +// fnt_font.c +extern void fnt_CreateFont ( tFntEntry* font, const void* fontRsrc, const void* cmapRsrc ); +extern void fnt_CreateDrawContext( tFntDrawContext* dc, u16* canvas, u16 width, u16 height, int type, tFntEntry* font ); + +extern void fnt_DrawLetter ( tFntEntry* font, tFntDrawContext* dc, s32 x, s32 y, u16 letter, int palette ); +extern void fnt_DrawLetterGlyph( tFntEntry* font, tFntDrawContext* dc, s32 x, s32 y, u16 glyph, int palette ); +extern void fnt_DrawString ( tFntEntry* font, tFntDrawContext* dc, tFntPosition posx, tFntPosition posy, int step_x, int step_y, const u16* str, int palette ); +extern int fnt_GetLetterWidth ( tFntEntry* font, u16 letter ); +extern int fnt_GetLetterOffset( tFntEntry* font, u16 letter ); +extern void fnt_DrawLetterGlyphFast( tFntEntry* font, tFntDrawContext* dc, s32 x, s32 y, u16 glyph, int palette ); +extern BOOL fnt_SetDefaultLetter( tFntEntry* font, u16 letter ); + +extern const u16* fnt_GetLineWidth ( tFntEntry* font, const u16* str, int* pwidth, int step_x ); +extern int fnt_GetStringWidth ( tFntEntry* font, const u16* str, int step_x ); +extern int fnt_GetStringHeight( tFntEntry* font, const u16* str, int step_y ); + +extern void fnt_ClearRect( tFntDrawContext* dc, u16 x, u16 y, u16 height, u16 width ); + + +// fnt_layout.c +extern void fnt_DrawMessage ( tFntDrawContext* dc, tFntMessage* message, const u16* mes_data ); +extern void fnt_DrawLetterLayout( tFntDrawContext* dc, const void* layout ); +extern tFntMessage* fnt_GetFntMessage ( const void* layout, int index ); +extern const u16* fnt_GetMessage ( const void* layout, int index ); +extern int fnt_GetMessageNum ( const void* layout ); +extern int fnt_LoadCelltoOam ( const void* celldata, GXOamAttr* poam, tFntPosition posx, tFntPosition posy, int cell_index ); +extern int fnt_DrawCellLayout ( const void* celldata, const void* layout, GXOamAttr* poam ); + +// fnt_celldata.c +extern int fnt_GetCellOamNum ( const void* celldata, int index ); +extern tFntCellCharInfo* fnt_GetCellCharInfo ( const void* celldata, int index ); +extern tFntCellCharOam* fnt_GetCellOam ( const void* celldata, int index ); +extern const void* fnt_GetCellObjChar ( const void* celldata ); +extern u32 fnt_GetCellObjCharSizeAll( const void* celldata ); +extern int fnt_GetCellCharVramMode ( const void* celldata ); +extern int fnt_GetCellCharNameShift ( const void* celldata ); + +// fnt_touch.c +extern int fnt_GetFntRegionNum ( const void* base ); +extern tFntRegion* fnt_GetFntRegion ( const void* base, int index ); +extern int fnt_GetHitFntRegionIndex( const void* base, int x, int y ); + +#endif // FNT_FUNC_H_ diff --git a/build/tests/DispOwnerInfo/include/fnt/fnt_struct.h b/build/tests/DispOwnerInfo/include/fnt/fnt_struct.h new file mode 100644 index 00000000..9ff11878 --- /dev/null +++ b/build/tests/DispOwnerInfo/include/fnt/fnt_struct.h @@ -0,0 +1,224 @@ +#ifndef FNT_STRUCT_H_ +#define FNT_STRUCT_H_ + +/** -------------------------------------------------------------------- + セル情報構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntCellInfo +{ + u16 width : 5; // 最大32 + u16 height : 5; // 最大32 + u16 dummy : 6; +} tFntCellInfo; + +/** -------------------------------------------------------------------- + 幅情報構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntWidthEntry +{ + u16 offset : 8; // オフセット(書きはじめまでのピクセル数) + u16 width : 8; // 幅 +} tFntWidthEntry; + +/** -------------------------------------------------------------------- + フォントCMAPの連続領域用構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntCtEntry +{ + u16 start; + u16 end; +} tFntCtEntry; + +/** -------------------------------------------------------------------- + フォント管理構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntEntry +{ + const u16* font_image; // フォントイメージへのポインタ + const u16* cmap; // コード->glyph変換用cmapへのポインタ + tFntCtEntry* ctmap; // コード->glyph変換用cmapへのポインタ + tFntWidthEntry* width_table; // 幅テーブル + u16 glyph_num; // glyph数 + u16 default_glyph; // 見つからなかったときに使われる文字のglyph + s16 cell_size; // 一文字のセルサイズ(ワード単位) + tFntCellInfo cell_info; // セルの情報 + u16 cmap_num; // glyph_comp == 1のときのcmapの数 + u16 ctmap_num; // glyph_comp == 1のときのctmapの数 + u32 glyph_sort : 1; // グリフがソートされているかどうか + u32 glyph_comp : 1; // グリフの連続されている部分が圧縮されているかどうか +} tFntEntry; + +/** -------------------------------------------------------------------- + 描画する先のデバイスコンテキスト管理構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntDrawContext +{ + u16* canvas; + u16 width; + u16 height; + u16 canvas_type; + u8 pad[2]; + tFntEntry* font; +} tFntDrawContext; + + +/** -------------------------------------------------------------------- + レイアウト表示用の構造体 + ----------------------------------------------------------------------*/ +/** -------------------------------------------------------------------- + レイアウトヘッダー + ----------------------------------------------------------------------*/ +typedef struct tagFntLayoutHeader +{ + u8 name[4]; + u16 version; + u16 table_num; +} tFntLayoutHeader; + +/** -------------------------------------------------------------------- + CMAPヘッダー + ----------------------------------------------------------------------*/ +typedef struct tagFntCmapHeader +{ + u32 ct_offset; + u32 cm_offset; +} tFntCmapHeader; + +/** -------------------------------------------------------------------- + レイアウト表示のためのメッセージ構造体 + ----------------------------------------------------------------------*/ +typedef struct tagFntPosition +{ + s16 pos : 12; + u16 pos_origin : 2; + u16 text_align : 2; +} tFntPosition; // この宣言でも、2Bytesにきちんと収まる。処理系によっては、sizeof()でチェックすること。 + + + + +/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + 文字レイアウトを表示するための構造体。 + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/** -------------------------------------------------------------------- + メッセージ構造体 + + メッセージデータは、 + tFntLayoutHeader header; + tFntMessage message[header.table_num]; + で構成されます。 + ----------------------------------------------------------------------*/ +typedef struct tagFntMessage +{ + // 位置 + tFntPosition x; + tFntPosition y; + + // 文字間隔 + s16 spacing_x : 8; + s16 spacing_y : 8; + + // 色 + u16 color : 8; + u16 palette : 4; + u16 font : 4; + + // メッセージへのオフセット + u32 offset; +} tFntMessage; + + + + +/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + OBJのセルを扱うための構造体 + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/** -------------------------------------------------------------------- + セル情報構造体 + + セルデータは、 + tFntLayoutHeader header; + tFntCell cell[header.table_num]; + で構成されます。 + ----------------------------------------------------------------------*/ +typedef struct tagFntCell +{ + // 位置 + tFntPosition x; + tFntPosition y; + + // セルキャラクタへのインデックス + u32 cell_index; +} tFntCell; + +/** -------------------------------------------------------------------- + セルキャラクタ情報構造体 + + セルキャラクタデータは、 + tFntLayoutHeader header; + tFntCellCharHeader char_header; + tFntCellCharInfo cellchar_info[header.table_num]; + tFntCellCharOam cellchar_oam[]; + u16 char_data[]; + で構成されます。 + ----------------------------------------------------------------------*/ +/** -------------------------------------------------------------------- + セルキャラクタヘッダ + ----------------------------------------------------------------------*/ +typedef struct tagFntCellCharHeader +{ + u32 cell_offset; // tFntCellChar配列へのオフセット + u32 oam_offset; // tFntOamChar配列へのオフセット + u32 char_offset; // キャラクタデータへのオフセット + u32 char_size; // キャラクタデータのサイズ + u32 char_mode : 3; // OBJVRAMMODE_CHAR_1DのEXOBJフラグ +} tFntCellCharHeader; + +/** -------------------------------------------------------------------- + セルキャラクタ情報 + ----------------------------------------------------------------------*/ +typedef struct tagFntCellCharInfo +{ + u16 width : 8; // セルの大きさ情報。 + u16 height : 8; + u16 oam_index; // oam_offset[oam_index] から、 + u16 oam_num; // oam_num分だけのoamを使用します。 +} tFntCellCharInfo; + +/** -------------------------------------------------------------------- + OAM情報 + ----------------------------------------------------------------------*/ +typedef struct tagFntCellCharOam +{ + GXOamAttr attr; // CharNameの部分は、使用しません。(ロード位置をユーザ定義にするため。) + u16 char_index; // キャラクタデータのインデックス。 + u16 char_num; // キャラクタデータの数。(最大、64ぐらい) +} tFntCellCharOam; + + + + +/** ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + タッチの場所を取得するための構造体 + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +/** -------------------------------------------------------------------- + リージョン情報 + ----------------------------------------------------------------------*/ +typedef struct tagFntRegion +{ + // 位置 + tFntPosition x; + tFntPosition y; + + // サイズ + u16 width : 8; // セルの大きさ情報。 + u16 height : 8; +} tFntRegion; + +#endif // FNT_STRUCT_H_ diff --git a/build/tests/DispOwnerInfo/main.rsf b/build/tests/DispOwnerInfo/main.rsf new file mode 100644 index 00000000..cc22e856 --- /dev/null +++ b/build/tests/DispOwnerInfo/main.rsf @@ -0,0 +1,41 @@ +# +# Nitro ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).sbin" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin" + OverlayTable "$(MAKEROM_ARM9:r)_table.sbin" + Nef "$(MAKEROM_ARM9:r).nef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7:r).sbin" + OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin" + OverlayTable "$(MAKEROM_ARM7:r)_table.sbin" + Nef "$(MAKEROM_ARM7:r).nef" +} + +Property +{ + BannerFile ./banner/myGameBanner.bnr +# ForChina TRUE +# ForKorea TRUE +# RomSpeedType MROM +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + + Align 512 + Padding 0xFF + + HostRoot data + Root /data + File *.bncmp *.bnfr +} + diff --git a/build/tests/DispOwnerInfo/mlib/ARM9-TS/Release/libfnt.a b/build/tests/DispOwnerInfo/mlib/ARM9-TS/Release/libfnt.a new file mode 100644 index 00000000..8a3c5675 Binary files /dev/null and b/build/tests/DispOwnerInfo/mlib/ARM9-TS/Release/libfnt.a differ diff --git a/build/tests/DispOwnerInfo/mlib/ARM9-TS/Rom/libfnt.a b/build/tests/DispOwnerInfo/mlib/ARM9-TS/Rom/libfnt.a new file mode 100644 index 00000000..6d345064 Binary files /dev/null and b/build/tests/DispOwnerInfo/mlib/ARM9-TS/Rom/libfnt.a differ diff --git a/build/tests/DispOwnerInfo/readme.txt b/build/tests/DispOwnerInfo/readme.txt new file mode 100644 index 00000000..13d1e7b0 --- /dev/null +++ b/build/tests/DispOwnerInfo/readme.txt @@ -0,0 +1,28 @@ +コンポーネントの中韓対応情報 + +WW版のみ:rev.1より + + サンプル NitroSDK 2.00 : rev.1.34 + +中国対応:rev.1.35より + サンプル NitroSDK 2.01 : rev.1.38 + +韓国対応:rev.1.43より + サンプル TwlSDK 5.1PR1 : rev.* + + + +ビルド方法 + +NitroSDK2.00, 2.01は、CW1.00fcでビルドしてください。 +TwlSDK5.1PR1は、CW1.02でビルドしてください。また、TWLSDK_PLATFORM=NITROの環境でビルドしてください。 + +作成するバイナリの種類 +下記組み合わせでバイナリを作成します。 + +SDK | WW | CN | KR | +-------------|----|----|----| +NitroSDK2.00 | ○ | × | × | +NitroSDK2.01 | ○ | ○ | × | +TwlSDK5.1PR1 | ○ | ○ | ○ | + diff --git a/build/tests/DispOwnerInfo/src/NitroConfigData.h b/build/tests/DispOwnerInfo/src/NitroConfigData.h new file mode 100644 index 00000000..23ff02f9 --- /dev/null +++ b/build/tests/DispOwnerInfo/src/NitroConfigData.h @@ -0,0 +1,679 @@ +/********************************************************************/ +/* NitroConfigData.h */ +/* NITRO-IPL */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + NITR設定データ定義 ヘッダ + + + $Log: NitroConfigData.h,v $ + Revision 1.4.2.2.4.1.4.1 2007/01/22 07:36:16 yosiokat + NAT-IPL2への対応。 + + Revision 1.4.2.5 2006/06/26 02:57:54 yosiokat + ・言語コードを韓国語に対応させる。 + ・一部の定義データの名称変更。 + + Revision 1.4.2.4 2006/02/06 11:34:56 yosiokat + NCD_GetIPL2BM7RomAddr関数の追加。 + + Revision 1.4.2.3 2006/02/06 08:27:19 yosiokat + IPL2バージョンの定義をIPLType.hの定義値を使うよう変更。 + + Revision 1.4.2.2 2005/10/31 08:49:57 yosiokat + USG_BACKLIGHT_DEFAULTを"2"に変更。 + + Revision 1.4.2.1 2005/10/25 08:14:41 yosiokat + USG対応のため、以下の変更を行う。 + ・NitroConfigData構造体にbackLightBrightnessを追加。 + ・IPL2_TYPE判定用の定数定義にUSGのものを追加。 + + Revision 1.4 2005/04/01 05:45:04 yosiokat + 最新版に更新。 + + Revision 1.3 2005/03/31 06:06:54 yosiokat + NitroConfigDataアクセス関数の全面改定。 + + Revision 1.31.2.2 2005/03/16 00:36:01 yosiokat + 言語コードの中国語追加に伴うNitroConfigDataExの新設とNitroConfigDataの取扱いの変更。 + + Revision 1.31.2.1 2005/03/11 11:08:56 yosiokat + 中国語の追加。 + + Revision 1.31 2005/02/15 02:38:27 yosiokat + NCD_CorrectDataの削除。 + + Revision 1.30 2005/02/07 11:12:03 yosiokat + NCD_CorrectDataの追加。 + + Revision 1.29 2004/09/25 10:42:54 Yosiokat + NvOption内のrsv領域にrtcOffset算出用パラメータrtcLastSetYearを保存するよう変更。 + + Revision 1.28 2004/09/16 07:02:51 Yosiokat + オーナー情報のニックネーム、好きな色、誕生日をクリアするNCD_ClearOwnerInfoの追加。 + + Revision 1.27 2004/09/01 09:18:35 Yosiokat + ・NvOptionにdestroyFlashFlagを追加。 + ・上記アクセス関数NCD_GetDestroyFlash、NCD_SetDestroyFlashを追加。 + + Revision 1.26 2004/08/31 09:52:38 Yosiokat + small fix. + + Revision 1.25 2004/08/27 12:36:08 Yosiokat + IPL2_BUILD_をSDK_SMALL_BUILDに変更。 + + Revision 1.24 2004/08/25 09:27:41 Yosiokat + ・必要なくなった下記要素をrsvに変更。(フォーマットの互換を保つため、データは詰めない) + NvAlarm.second + NvAlarm.enableWeek + NvOption.detectPullOutCardFlag + NvOption.detectPullOutCtrdgFlag + NvOption.timezone + + Revision 1.23 2004/08/25 05:12:20 Yosiokat + ブランチタグred_ipl2_2004_08_24_pp2_isdbg_fixとのマージ。 + + Revision 1.22 2004/08/25 01:28:23 Yosiokat + ・NvOption.backLightOffFlagがビットフィールドになっていなかったのを修正。 + ・NvOption.input_birthdayフラグを追加。アクセス関数NCD_GetInputBirthday、NCD_SetInputBirthday + ・NCDStoreを32byte単位のサイズになるよう調整。(キャッシュラインにあわせる) + + Revision 1.21 2004/08/23 08:24:23 Yosiokat + バックライトON,OFFフラグをIPl2_workから再度NitroConfigDataに戻す。 + + Revision 1.20 2004/08/19 06:06:02 yosiokat + NitroConfigDataにビットフィールドが使われているため、他コンパイラで問題が出る可能性がある。 + とりあえず、SDK_CWが定義されていなければ、ヘッダを切ってエラーを出させることで、他コンパイラで問題がないかを確認できるようにしておく。 + + Revision 1.19 2004/08/18 07:33:00 Yosiokat + ・NCD_FAVORITE_COLOR_MAX_NUM追加。 + ・NitroConfigData.option.input_favoriteColor追加。 + + Revision 1.18 2004/08/17 05:44:19 Nakasima + ・topLcdBackLightOffをNitroConfigDataからIPL2_workへ移動。 + ・detectPullOutFlagを削除し、detectPullOutCardFlaとdetectPullOutCtrdgFlagを追加。 + + Revision 1.17 2004/08/16 10:13:09 Yosiokat + pullCardFlagをdetectPullOutFlagに変更。 + + Revision 1.16 2004/08/16 10:09:34 Yosiokat + NvOptionにpullCardFlagを追加。 + + Revision 1.15 2004/08/13 07:41:30 Yosiokat + ・NvOwnerInfoからsexを削除。 + ・NvOptionからbottomLcdBackLightOffを削除。 + ・NvOptionにautoBootFlagを追加。 + ・NCD_SetSex, NCD_GetSexを削除。 + ・NCD_GetRtcClockAdjust、NCD_GetAutoBootFlag、NCD_SetRtcClockAdjust、NCD_SetAutoBootFlagの追加。 + + Revision 1.14 2004/07/29 04:53:18 Yosiokat + 構造体のパディングを明示的に追加。 + + Revision 1.13 2004/07/18 10:55:13 Yosiokat + NITRO設定データのセット関数を用意。 + + Revision 1.12 2004/07/17 09:00:14 Yosiokat + ・構造体サイズのコメント修正。 + + Revision 1.11 2004/07/15 12:47:33 Yosiokat + ・オーナー情報の誕生日の「年」を削除。 + + Revision 1.10 2004/07/15 12:26:43 Yosiokat + ・NITRO設定データのフォーマットを変更。 + ・オーナー情報を以下のように変更。 +  a)ニックネーム長を10に変更。 +  b)コメントデータを追加 +  c)血液型データを削除。 +  d)好きな色データを追加。(中身は未定) + e)性別データをビットフィールドに。 + ・アラーム情報を追加。 + ・タッチパネルキャリブレーション情報の各要素を詳細に定義。 + ・その他の情報をオプション情報にまとめる。(言語コードもビットフィールドとしてここに入れる。) + + Revision 1.9 2004/07/13 00:20:15 Yosiokat + ・small fix. + + Revision 1.8 2004/07/05 02:29:23 Yosiokat + 言語コードをFRENCHに修正。 + + Revision 1.7 2004/06/28 01:56:17 Yosiokat + ・バックライトON,OFF設定の値を追加。 + ・TP、言語設定、RTC、オーナー情報の入力済みフラグを追加。 + ・バージョンを"3"に。 + + Revision 1.6 2004/06/14 04:55:10 yosiokat + NitroConfigDataのrtcOffsetをintからs64に変更。 + これに伴いNCDフォーマットのバージョンを"2"に変更。 + + Revision 1.5 2004/06/07 10:51:58 Yosiokat + オーナー情報のニックネームをSJISからUnicode(UTF16)に変更したため、バージョンを1に上げる。 + + Revision 1.4 2004/05/21 06:12:17 Yosiokat + ヘッダのC++対応部分で「};」のセミコロンがエラーになっていたので、削除。 + + Revision 1.3 2004/05/21 05:37:46 Yosiokat + TPキャリブレーションをNVRAMに保存するデータにLCDの左上ポイント+LCDの右下ポイントを含めるよう変更。(サイズが8->12byteへ) + また、SDKにconfig.hの名前でNitroConfigData.hと同一ファイルが入っていたので、これをインクルードしないよう、Makefileでコンパイル時にIPL2_BUILD_シンボルを与えるよう変更。 + + Revision 1.2 2004/05/19 08:25:28 yosiokat + 更新ログの追加。 + + +*/ + + +#ifndef NITRO_CONFIG_DATA_H_ +#define NITRO_CONFIG_DATA_H_ +#if defined(SDK_CW) // NitroConfigDataにビットフィールドを使っているので、コンパイラ依存で不具合が発生する可能性がある。 + // よって、CW以外のコンパイラの場合は、このヘッダを無効にしてエラーを出させるようにして再確認する。 +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +#define USING_COMPONENT // IPL2上ではないので、このスイッチを有効に。 + + +// define data ------------------------------------ +#define NITRO_CONFIG_DATA_VERSION 5 // NITRO設定データフォーマットバージョン +#define NITRO_CONFIG_DATA_EX_VERSION 1 // 拡張NITRO設定データフォーマットバージョン +#define NCD_NICKNAME_LENGTH 10 // ニックネーム長 +#define NCD_COMMENT_LENGTH 26 // コメント長 +#define NCD_FAVORITE_COLOR_MAX_NUM 16 // 好きな色の最大数 + +#define NCD_ROM_ADDR_SHIFT 3 // IPL2ヘッダのNitroConfigData格納アドレスのシフト値 +#define FONT_ROM_ADDR_SHIFT 2 // IPL2ヘッダのフォントデータ格納アドレスのシフト値 +#define NCD_SYS_RSV_SIZE 1024 // システム予約領域サイズ +#define NCD_APP_RSV_SIZE 512 // アプリ 予約領域サイズ + // NCD_SYS_RSV_ROM_ADDR = ncd_rom_addr - NCD_SYS_RSV_SIZE + // NCD_APP_RSV_ROM_ADDR = ncd_rom_addr - NCD_SYS_RSV_SIZE - NCD_APP_RSV_SIZE +#define USG_BACKLIGHT_DEFAULT 2 // USGのバックライトデフォルト値 + + +// 言語設定コード +typedef enum NvLangCode{ + LANG_JAPANESE =0, // 日本語 + LANG_ENGLISH, // 英語 + LANG_FRENCH, // フランス語 + LANG_GERMAN, // ドイツ語 + LANG_ITALIAN, // イタリア語 + LANG_SPANISH, // スペイン語 + LANG_CHINESE, // 中国語 + LANG_HANGUL, // 韓国語 + LANG_CODE_MAX +}NvLangCode; + +#define LANG_CODE_MAX_WW LANG_CHINESE // 中国版以前の通常版IPL2でのLANG_CODE_MAX + +#define LANG_BITMAP_WW ( ( 0x0001 << LANG_JAPANESE ) \ + | ( 0x0001 << LANG_ENGLISH ) \ + | ( 0x0001 << LANG_FRENCH ) \ + | ( 0x0001 << LANG_GERMAN ) \ + | ( 0x0001 << LANG_ITALIAN ) \ + | ( 0x0001 << LANG_SPANISH ) ) // 通常版での対応言語ビットマップ + +#define LANG_BITMAP_CN ( ( 0x0001 << LANG_ENGLISH ) \ + | ( 0x0001 << LANG_FRENCH ) \ + | ( 0x0001 << LANG_GERMAN ) \ + | ( 0x0001 << LANG_ITALIAN ) \ + | ( 0x0001 << LANG_SPANISH ) \ + | ( 0x0001 << LANG_CHINESE ) ) // 中国版での対応言語ビットマップ + +#define LANG_BITMAP_KR ( ( 0x0001 << LANG_JAPANESE ) \ + | ( 0x0001 << LANG_ENGLISH ) \ + | ( 0x0001 << LANG_FRENCH ) \ + | ( 0x0001 << LANG_GERMAN ) \ + | ( 0x0001 << LANG_SPANISH ) \ + | ( 0x0001 << LANG_HANGUL ) ) // 韓国版での対応言語ビットマップ + +// 日付データ +typedef struct NvDate{ + u8 month; // 月:01〜12 + u8 day; // 日:01〜31 +}NvDate; // 2byte + +// ニックネーム +typedef struct NvNickname{ + u16 str[NCD_NICKNAME_LENGTH]; // ニックネーム(Unicode(UTF16)で最大10文字、終端コードなし) + u8 length; // 文字数 + u8 rsv; +}NvNickname; // 22byte + +// コメント +typedef struct NvComment{ + u16 str[NCD_COMMENT_LENGTH]; //コメント(Unicode(UTF16)で最大26文字、終端コードなし) + u8 length; // 文字数 + u8 rsv; +}NvComment; // 54byte + +// オーナー情報 +typedef struct NvOwnerInfo{ + u8 favoriteColor : 4; // 好きな色 + u8 rsv : 4; // 予約。 + NvDate birthday; // 生年月日 + u8 pad; + NvNickname nickname; // ニックネーム + NvComment comment; // コメント +}NvOwnerInfo; // 80byte + +// IPL用目覚まし時計データ +typedef struct NvAlarm{ + u8 hour; // アラーム時:00〜23 + u8 minute; // アラーム分:00〜59 + u8 rsv1; // 予約 + u8 pad; + u16 alarmOn : 1; // アラームON,OFF(0:OFF, 1:ON) + u16 rsv2 : 15; // 予約 +}NvAlarm; // 6byte + +// タッチパネルキャリブレーションデータ +typedef struct NvTpCalibData{ + u16 raw_x1; // 第1キャリブレーション点のTP取得値X + u16 raw_y1; //     〃        TP取得値Y + u8 dx1; //     〃        LCD座標 X + u8 dy1; //     〃        LCD座標 Y + u16 raw_x2; // 第2キャリブレーション点のTP取得値X + u16 raw_y2; //     〃        TP取得値Y + u8 dx2; //     〃        LCD座標 X + u8 dy2; //     〃        LCD座標 Y +}NvTpCalibData; // 12byte + +// オプション情報 +typedef struct NvOption{ + u16 language : 3; // 言語コード(LANG_SPANISHまでの標準言語コードが入る) + u16 agbLcd : 1; // AGBモードで起動する時にどちらのLCDで起動するか?(0:TOP,1:BOTTOM) + u16 backLightBrightness : 2; // バックライト輝度データ + u16 autoBootFlag : 1; // 起動シーケンスで、メニュー停止なしで自動起動するかどうか?(0:OFF, 1:ON) + u16 backLightOffFlag : 1; // バックライトON,OFFフラグ(0:ON, 1:OFF) + u16 rsv2 : 1; // 予約。 + u16 destroyFlashFlag : 1; // フラッシュ壊れシーケンス中フラグ + u16 input_birthday : 1; // 誕生日が入力されたか? + u16 input_favoriteColor : 1; // 好きな色が入力されたか? + u16 input_tp : 1; // タッチパネルがキャリブレーションされたか?( 〃 ) + u16 input_language : 1; // 言語入力がされたか?  (0:未設定, 1:設定済み) + u16 input_rtc : 1; // RTC設定がされたか? ( 〃      ) + u16 input_nickname : 1; // ニックネームが入力されたか? ( 〃      ) + u8 rtcLastSetYear; // RTCの前回設定年 + u8 rtcClockAdjust; // RTCクロック調整値 + s64 rtcOffset; // RTC設定時のオフセット値(ユーザーがRTC設定を変更する度にその値に応じて増減します。) +}NvOption; // 12byte + +// NITRO各種設定データ +typedef struct NitroConfigData{ + u8 version; // フラッシュ格納データフォーマットのバージョン + u8 pad; + NvOwnerInfo owner; // オーナー情報 + NvAlarm alarm; // IPL用目覚まし時計データ + NvTpCalibData tp; // タッチパネルキャリブレーションデータ + NvOption option; // オプション +}NitroConfigData; // 112byte + +// NITRO各種設定データのNVRAM保存時フォーマット +typedef struct NCDStore{ + NitroConfigData ncd; // NITRO各種設定データ + u16 saveCount; // 0x00-0x7fをループしてカウントし、カウント値が新しいデータが有効。 + u16 crc16; // NITRO各種設定データの16bitCRC + u8 pad[ 128 - sizeof(NitroConfigData) - 4]; +}NCDStore; // 128byte // ※本来なら、saveCountとcrc16は256byteの最後に付加して、間にパディングを埋める方がいい。 + + +//---------------------------------------------- +// IPL2中国版での拡張フォーマット +//---------------------------------------------- +// 拡張NITRO設定データ +typedef struct NitroConfigDataEx{ + u8 version; // バージョン + u8 language; // 言語コード(LANG_CHINESE以降に拡張された値が入る。) + u16 valid_language_bitmap; // 本IPL2で有効な言語コードを示したビットマップ + u8 pad[ 256 - sizeof(NitroConfigData) - 4 - 4 - 2 ]; // 4:saveCount+crc16, 2:NCDEx.version+NCDEx.language, 2:crc16_ex +}NitroConfigDataEx; // 138bytes + +// NITRO各種設定データのNVRAM保存時フォーマット +typedef struct NCDStoreEx{ + NitroConfigData ncd; // NITRO各種設定データ + u16 saveCount; // 0x00-0x7fをループしてカウントし、カウント値が新しいデータが有効。 + u16 crc16; // NITRO各種設定データの16bitCRC + NitroConfigDataEx ncd_ex; + u16 crc16_ex; +}NCDStoreEx; // 256byte // ※本来なら、saveCountとcrc16は256byteの最後に付加して、間にパディングを埋める方がいい。 + + +typedef struct NCDTimeStamp { + u8 minute; + u8 hour; + u8 day; + u8 month; + u8 year; +}NCDTimeStamp; + + +//========================================================= +// NVRAMへのリードライト関数 +//========================================================= +#ifdef SDK_ARM9 +extern int NVRAMm_ReadNitroConfigData (NitroConfigData *dstp); +extern void NVRAMm_WriteNitroConfigData(NitroConfigData *dstp); +#endif + + +//========================================================= +// NITRO設定データへのアクセス関数 +//========================================================= +extern NitroConfigDataEx ncdEx; +extern u16 valid_lang_bitmap; + +#define GetNcdWorkAddr() ( (NitroConfigData *)( HW_NVRAM_USER_INFO ) ) +#define GetNcdExWorkAddr() ( &ncdEx ) + // NITRO設定データ領域のアドレス獲得 + +extern void NCD_ClearOwnerInfo( void ); // ニックネーム・誕生日・好きな色のクリア + +#ifdef USING_COMPONENT +extern void NCD_ReadIPL2Header ( void ); // IPL2ヘッダの読み出し。 +extern u8 NCD_GetIPL2Type ( void ); // IPL2タイプの取得。 +extern u16 NCD_GetIPL2TypeEx ( void ); // 拡張IPL2タイプの取得。 +extern u8 *NCD_GetIPL2Version ( void ); // IPL2バージョンの取得。 +extern u32 NCD_GetNCDRomAddr ( void ); // NCD格納ROMアドレスの取得。 +extern u32 NCD_GetSysRsvRomAddr( void ); // システム予約領域ROMアドレスの取得。 +extern u32 NCD_GetAppRsvRomAddr( void ); // アプリ 予約領域ROMアドレスの取得。 +extern u32 NCD_GetIPL2BM7RomAddr( void ); // ブートメニューARM7コードROMアドレスの取得。 +extern u32 NCD_GetIPL2DataRomAddr( void ); // IPL2データROMアドレスの取得。 +extern u32 NCD_GetFontBncmpRomAddr( void ); // フォントデータbncmpのROMアドレス取得。(中国版、日本向け試遊台版でのみ有効。) +extern u32 NCD_GetFontBnfrRomAddr( void ); // フォントデータbnfr のROMアドレス取得。(中国版、日本向け試遊台版でのみ有効。) +#endif + +//========================================================= +// データ取得 +//========================================================= + +//----------------------------------- +// オーナー情報全体の取得。 +static inline NvOwnerInfo *NCD_GetOwnerInfo(void) +{ + return &GetNcdWorkAddr()->owner; +} + +// 好きな色の取得。 +static inline u8 NCD_GetFavoriteColor(void) +{ + return (u8)GetNcdWorkAddr()->owner.favoriteColor; +} + +// 誕生日の取得。 +static inline NvDate *NCD_GetBirthday(void) +{ + return &GetNcdWorkAddr()->owner.birthday; +} + +// ニックネームの取得。 +static inline NvNickname *NCD_GetNickname(void) +{ + return &GetNcdWorkAddr()->owner.nickname; +} + +// コメントの取得。 +static inline NvComment *NCD_GetComment(void) +{ + return &GetNcdWorkAddr()->owner.comment; +} + + +//----------------------------------- +// アラーム情報の取得。 +static inline NvAlarm *NCD_GetAlarmData(void) +{ + return &GetNcdWorkAddr()->alarm; +} + + +//----------------------------------- +// タッチパネルキャリブレーションデータの取得。 +static inline NvTpCalibData *NCD_GetTPCalibration(void) +{ + return &GetNcdWorkAddr()->tp; +} + + +//----------------------------------- +// オプション情報の取得。 + +// 言語コードの取得 +static inline NvLangCode NCD_GetLanguageOrg(void) +{ + return (NvLangCode)GetNcdWorkAddr()->option.language; +} + +static inline NvLangCode NCD_GetLanguage(void) +{ + return (NvLangCode)GetNcdExWorkAddr()->language; +} + + +// RTCオフセット値の取得 +static inline s64 NCD_GetRtcOffset(void) +{ + return GetNcdWorkAddr()->option.rtcOffset; +} + +// RTCクロック調整値の取得 +static inline u8 NCD_GetRtcClockAdjust(void) +{ + return GetNcdWorkAddr()->option.rtcClockAdjust; +} + +// RTCの前回セットした年の取得 +static inline u8 NCD_GetRtcLastSetYear(void) +{ + return GetNcdWorkAddr()->option.rtcLastSetYear; +} + +// 起動シーケンスの自動起動ONか?(0:OFF, 1:ON) +static inline int NCD_GetAutoBootFlag(void) +{ + return (int)GetNcdWorkAddr()->option.autoBootFlag; +} + +// バックライトOFFか?(0:ON, 1:OFF) +static inline int NCD_GetBackLightOffFlag(void) +{ + return (int)GetNcdWorkAddr()->option.backLightOffFlag; +} + +// フラッシュ壊れシーケンス中かどうか? +static inline int NCD_GetDestroyFlash(void) +{ + return (int)GetNcdWorkAddr()->option.destroyFlashFlag; +} + +// 誕生日データがセットされているか? +static inline int NCD_GetInputBirthday(void) +{ + return (int)GetNcdWorkAddr()->option.input_birthday; +} + +// 好きな色データがセットされているか? +static inline int NCD_GetInputFavoriteColor(void) +{ + return (int)GetNcdWorkAddr()->option.input_favoriteColor; +} + +// TPキャリブレーションデータがセットされているか? +static inline int NCD_GetInputTP(void) +{ + return (int)GetNcdWorkAddr()->option.input_tp; +} + +// 言語コードがセットされているか? +static inline int NCD_GetInputLanguage(void) +{ + return (int)GetNcdWorkAddr()->option.input_language; +} + +// RTCデータがセットされているか? +static inline int NCD_GetInputRTC(void) +{ + return (int)GetNcdWorkAddr()->option.input_rtc; +} + +// オーナー情報のニックネームがセットされているか? +static inline int NCD_GetInputNickname(void) +{ + return (int)GetNcdWorkAddr()->option.input_nickname; +} + +//========================================================= +// データセット +//========================================================= +//----------------------------------- +// オーナー情報全体のセット。 +static inline void NCD_SetOwnerInfo(NvOwnerInfo *owinfop) +{ + SVC_CpuCopy( owinfop, &GetNcdWorkAddr()->owner, sizeof(NvOwnerInfo), 16); +} + +// 好きな色のセット。 +static inline void NCD_SetFavoriteColor(u8 favoriteColor) +{ + GetNcdWorkAddr()->owner.favoriteColor = favoriteColor; +} + +// 誕生日のセット。 +static inline void NCD_SetBirthday(NvDate *birthp) +{ + GetNcdWorkAddr()->owner.birthday.month = birthp->month; + GetNcdWorkAddr()->owner.birthday.day = birthp->day; +} + +// ニックネームのセット。 +static inline void NCD_SetNickname(NvNickname *namep) +{ + SVC_CpuCopy( namep, &GetNcdWorkAddr()->owner.nickname, sizeof(NvNickname), 16); +} + +// コメントのセット。 +static inline void NCD_SetComment(NvComment *commentp) +{ + SVC_CpuCopy( commentp, &GetNcdWorkAddr()->owner.comment, sizeof(NvComment), 16); +} + + +//----------------------------------- +// アラーム情報のセット。 +static inline void NCD_SetAlarmData(NvAlarm *alarmp) +{ + SVC_CpuCopy( alarmp, &GetNcdWorkAddr()->alarm, sizeof(NvAlarm), 16); +} + + +//----------------------------------- +// タッチパネルキャリブレーションデータのセット。 +static inline void NCD_SetTPCalibration(NvTpCalibData *tp_calibp) +{ + SVC_CpuCopy( tp_calibp, &GetNcdWorkAddr()->tp, sizeof(NvTpCalibData), 16); +} + + +//----------------------------------- +// オプション情報のセット。 + +// 言語コードのセット +#if 0 +static inline void NCD_SetLanguage(NvLangCode language) +{ + GetNcdExWorkAddr()->language = language; + GetNcdExWorkAddr()->valid_language_bitmap = LANG_BITMAP_CHINESE; + + if( language == LANG_CHINESE ) { + GetNcdWorkAddr()->option.language = LANG_ENGLISH; + }else { + GetNcdWorkAddr()->option.language = language; + } +} +#endif + +// RTCオフセット値のセット +static inline void NCD_SetRtcOffset(s64 rtcOffset) +{ + GetNcdWorkAddr()->option.rtcOffset = rtcOffset; +} + +// RTCクロック調整値のセット +static inline void NCD_SetRtcClockAdjust(u8 rtcClockAdjust) +{ + GetNcdWorkAddr()->option.rtcClockAdjust = rtcClockAdjust; +} + + +// RTCのLastSetYearへのセット +static inline void NCD_SetRtcLastSetYear(u8 rtcLastSetYear) +{ + GetNcdWorkAddr()->option.rtcLastSetYear = rtcLastSetYear; +} + + +// 起動シーケンスの自動起動ON,OFFフラグをセット。 +static inline void NCD_SetAutoBootFlag(BOOL autoBootFlag) +{ + GetNcdWorkAddr()->option.autoBootFlag = (u16)autoBootFlag; +} + +// バックライトON,OFFフラグをセット。 +static inline void NCD_SetBackLightOffFlag(BOOL backLightOffFlag) +{ + GetNcdWorkAddr()->option.backLightOffFlag = (u16)backLightOffFlag; +} + +// フラッシュ壊れシーケンス中かどうかのフラグセット。 +static inline void NCD_SetDestroyFlash(BOOL destroy) +{ + GetNcdWorkAddr()->option.destroyFlashFlag = (u16)destroy; +} + +// 誕生日データの入力済みフラグセット。 +static inline void NCD_SetInputBirthday(BOOL input) +{ + GetNcdWorkAddr()->option.input_birthday = (u16)input; +} + +// 好きな色データの入力済みフラグセット。 +static inline void NCD_SetInputFavoriteColor(BOOL input) +{ + GetNcdWorkAddr()->option.input_favoriteColor = (u16)input; +} + +// TPキャリブレーションデータの入力済みフラグセット。 +static inline void NCD_SetInputTP(BOOL input) +{ + GetNcdWorkAddr()->option.input_tp = (u16)input; +} + +// 言語コードの入力済みフラグセット。 +static inline void NCD_SetInputLanguage(BOOL input) +{ + GetNcdWorkAddr()->option.input_language = (u16)input; +} + +// RTCデータの入力済みフラグセット。 +static inline void NCD_SetInputRTC(BOOL input) +{ + GetNcdWorkAddr()->option.input_rtc = (u16)input; +} + +// オーナー情報のニックネームの入力済みフラグセット。 +static inline void NCD_SetInputNickname(BOOL input) +{ + GetNcdWorkAddr()->option.input_nickname = (u16)input; +} + + + +#ifdef __cplusplus +} +#endif + +#endif // SDK_CW +#endif // NITRO_CONFIG_DATA_H_ diff --git a/build/tests/DispOwnerInfo/src/data.c b/build/tests/DispOwnerInfo/src/data.c new file mode 100644 index 00000000..39420c0e --- /dev/null +++ b/build/tests/DispOwnerInfo/src/data.c @@ -0,0 +1,595 @@ +/********************************************************************/ +/* data.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + データ群 + + $Log: data.c,v $ + Revision 1.3 2005/04/02 07:43:18 yosiokat + IPL2フォント表示のためのデータ定義追加。 + + Revision 1.2 2005/03/31 06:01:14 yosiokat + インデント調整。 + + Revision 1.1 2004/08/31 06:20:24 Yosiokat + Initial revision + + +*/ + + + +#include +#include "data.h" + +// global variables---------------------------------------- +int (*nowProcess)(void); // 現在実行中のプロセス +GXOamAttr oamBakM[ 128 ]; // OAM バックアップ +GXOamAttr oamBakS[ 128 ]; // OAM バックアップ +u16 bgBakM[ 32*24 ]; // BG バックアップ +u16 bgBakS[ 32*24 ]; // BG バックアップ +TpWork tpd; // タッチパネルデータ +KeyWork pad; // キーパッド入力データ + + +// IPL2フォント表示用 +tFntEntry font_m; +tFntDrawContext context_m; +u16 canvas_m[ CANVAS_WIDTH * CANVAS_HEIGHT / 4 ] ATTRIBUTE_ALIGN(32); +u16 screen_m[ (CANVAS_WIDTH>>3) * (CANVAS_HEIGHT>>3) ] ATTRIBUTE_ALIGN(32); + +tFntEntry font_s; +tFntDrawContext context_s; +u16 canvas_s[ CANVAS_WIDTH * CANVAS_HEIGHT / 4 ] ATTRIBUTE_ALIGN(32); +u16 screen_s[ (CANVAS_WIDTH>>3) * (CANVAS_HEIGHT>>3) ] ATTRIBUTE_ALIGN(32); + +u16 s_Palette[] = { + 0x0000, 0x001f, 0x03e0, 0x03ff, + 0x7c00, 0x7c1f, 0x7fe0, 0x7fff, + 0x0000, 0x001f, 0x03e0, 0x03ff, + 0x7c00, 0x7c1f, 0x7fe0, 0x7fff, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +// 背景黒ベース +const u16 myPlttData[13][16] = { + {RGB555( 0, 0, 0), RGB555(31, 31, 31), RGB555(15, 15, 15), RGB555( 0, 0, 0),}, // White + {RGB555( 0, 0, 0), RGB555(31, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Red + {RGB555( 0, 0, 0), RGB555( 0, 19, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Green + {RGB555( 0, 0, 0), RGB555( 0, 11, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Blue + {RGB555( 0, 0, 0), RGB555(31, 31, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Yellow + {RGB555( 0, 0, 0), RGB555( 0, 31, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Cyan + {RGB555( 0, 0, 0), RGB555(31, 0, 31), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Purple + {RGB555( 0, 0, 0), RGB555( 0, 31, 0), RGB555( 0, 0, 0), RGB555( 0, 0, 0),}, // Light Green + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // HighLight Yellow + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 31, 31), RGB555( 0, 31, 31),}, // HighLight CYAN + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // HighLight WHITE + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555( 0, 11, 31), RGB555( 0, 11, 31),}, // HighLight BLUE + {RGB555( 0, 0, 0), RGB555( 0, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // HighLight RED +}; + + +/*---------------------- キャラクタデータ -------------------------*/ +/* +const u32 sampleCharData[8*0x100] = { + 0x00000000,0x00000000,0x00000000,0x00000000, // 0000h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x01010010,0x01010010,0x00000110, // 0001h + 0x00011010,0x01100010,0x00000010,0x00000010, + 0x00000000,0x01011010,0x01010010,0x00010010, // 0002h + 0x00100010,0x00100010,0x00100001,0x00100001, + 0x00000000,0x01010001,0x01010001,0x01111111, // 0003h + 0x00000001,0x00000001,0x00000001,0x01111110, + 0x00000000,0x01010000,0x01111111,0x00100000, // 0004h + 0x00100000,0x00010000,0x00001000,0x00000110, + 0x00000000,0x01010000,0x01010100,0x00001010, // 0005h + 0x00010001,0x00100001,0x01000000,0x00000000, + 0x00000000,0x01011000,0x01011000,0x01111111, // 0006h + 0x00001000,0x00101010,0x01001010,0x01001001, + 0x00000000,0x01010010,0x01101111,0x01010010, // 0007h + 0x00010010,0x00010010,0x00010010,0x00001001, + 0x00000000,0x01010010,0x01011111,0x00000100, // 0008h + 0x00011111,0x00001000,0x00000001,0x00011110, + 0x00000000,0x01010000,0x01011000,0x00000110, // 0009h + 0x00000001,0x00000110,0x00011000,0x00100000, + 0x00000000,0x01010000,0x01111101,0x00010001, // 000ah + 0x00010001,0x00010001,0x00010001,0x00001010, + 0x00000000,0x01010000,0x01011110,0x00100000, // 000bh + 0x00000000,0x00000001,0x00000001,0x00111110, + 0x00000000,0x01010100,0x01011111,0x00001000, // 000ch + 0x00010000,0x00000001,0x00000001,0x00011110, + 0x00000000,0x01010001,0x01010001,0x00000001, // 000dh + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x01010000,0x01111111,0x00011000, // 000eh + 0x00010100,0x00010100,0x00011000,0x00001100, + 0x00000000,0x01010010,0x01111111,0x00010010, // 000fh + 0x00010010,0x00000010,0x00000010,0x00111100, + 0x00000000,0x00001110,0x01010100,0x01010010, // 0010h + 0x00111111,0x00000100,0x00000100,0x00011000, + 0x00000000,0x01010100,0x01011111,0x00000100, // 0011h + 0x01110100,0x00000010,0x00001010,0x01110010, + 0x00000000,0x01010100,0x01011111,0x00000010, // 0012h + 0x00011110,0x00100001,0x00100000,0x00011110, + 0x00000000,0x01010000,0x01011100,0x00100011, // 0013h + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x01010000,0x01111111,0x00010000, // 0014h + 0x00001000,0x00001000,0x00001000,0x00110000, + 0x00000000,0x01010010,0x01010010,0x00001100, // 0015h + 0x00000010,0x00000001,0x00000001,0x00111110, + 0x00000000,0x01010001,0x01111101,0x00010001, // 0016h + 0x00010001,0x00111001,0x01010101,0x00011001, + 0x00000000,0x01010100,0x01010011,0x01110010, // 0017h + 0x00010001,0x00010001,0x00001010,0x00000100, + 0x00000000,0x01011110,0x01011000,0x00000100, // 0018h + 0x00101001,0x01010001,0x01010001,0x00001100, + 0x00000000,0x01010000,0x01011100,0x00010010, // 0019h + 0x00010010,0x00100001,0x01000000,0x00000000, + 0x00000000,0x01011101,0x01010001,0x00111101, // 001ah + 0x00010001,0x00011001,0x00110101,0x00001001, + 0x00000000,0x01110001,0x01011101,0x00110001, // 001bh + 0x00010001,0x00111001,0x01010101,0x00011001, + 0x00000000,0x01110100,0x01010011,0x00110010, // 001ch + 0x00010001,0x00010001,0x00001010,0x00000100, + 0x00000000,0x01101110,0x01011000,0x00100100, // 001dh + 0x00101001,0x01010001,0x01010001,0x00001100, + 0x00000000,0x01110000,0x01011100,0x00110010, // 001eh + 0x00010010,0x00100001,0x01000000,0x00000000, + 0x00000000,0x01111101,0x01010001,0x00111101, // 001fh + 0x00010001,0x00011001,0x00110101,0x00001001, + 0x00000000,0x00000000,0x00000000,0x00000000, // 0020h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00001000,0x00001000,0x00001000, // 0021h + 0x00001000,0x00001000,0x00000000,0x00001000, + 0x00000000,0x01101100,0x01001000,0x00100100, // 0022h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00100100,0x01111111,0x00100100, // 0023h + 0x00100100,0x01111111,0x00010010,0x00010010, + 0x00000000,0x00001000,0x01111110,0x00001001, // 0024h + 0x00111110,0x01001000,0x00111111,0x00001000, + 0x00000000,0x01000010,0x00100101,0x00010010, // 0025h + 0x00001000,0x00100100,0x01010010,0x00100001, + 0x00000000,0x00001110,0x00010001,0x00001001, // 0026h + 0x01000110,0x00101001,0x00110001,0x01001110, + 0x00000000,0x00011000,0x00010000,0x00001000, // 0027h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x01110000,0x00001000,0x00000100, // 0028h + 0x00000100,0x00000100,0x00001000,0x01110000, + 0x00000000,0x00000111,0x00001000,0x00010000, // 0029h + 0x00010000,0x00010000,0x00001000,0x00000111, + 0x00000000,0x00001000,0x01001001,0x00101010, // 002ah + 0x00011100,0x00101010,0x01001001,0x00001000, + 0x00000000,0x00001000,0x00001000,0x00001000, // 002bh + 0x01111111,0x00001000,0x00001000,0x00001000, + 0x00000000,0x00000000,0x00000000,0x00000000, // 002ch + 0x00000000,0x00001100,0x00001000,0x00000100, + 0x00000000,0x00000000,0x00000000,0x00000000, // 002dh + 0x01111111,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, // 002eh + 0x00000000,0x00000000,0x00000000,0x00001100, + 0x00000000,0x01000000,0x00100000,0x00010000, // 002fh + 0x00001000,0x00000100,0x00000010,0x00000001, + 0x00000000,0x00111110,0x01000001,0x01000001, // 0030h + 0x01000001,0x01000001,0x01000001,0x00111110, + 0x00000000,0x00011100,0x00010000,0x00010000, // 0031h + 0x00010000,0x00010000,0x00010000,0x00010000, + 0x00000000,0x00111110,0x01000001,0x01000000, // 0032h + 0x00111110,0x00000001,0x00000001,0x01111111, + 0x00000000,0x00111110,0x01000001,0x01000000, // 0033h + 0x00111110,0x01000000,0x01000001,0x00111110, + 0x00000000,0x00100000,0x00110000,0x00101000, // 0034h + 0x00100100,0x00100010,0x01111111,0x00100000, + 0x00000000,0x01111111,0x00000001,0x00111111, // 0035h + 0x01000000,0x01000000,0x01000001,0x00111110, + 0x00000000,0x00111110,0x00000001,0x00111111, // 0036h + 0x01000001,0x01000001,0x01000001,0x00111110, + 0x00000000,0x01111111,0x00100000,0x00100000, // 0037h + 0x00010000,0x00010000,0x00001000,0x00001000, + 0x00000000,0x00111110,0x01000001,0x01000001, // 0038h + 0x00111110,0x01000001,0x01000001,0x00111110, + 0x00000000,0x00111110,0x01000001,0x01000001, // 0039h + 0x01000001,0x01111110,0x01000000,0x00111110, + 0x00000000,0x00000000,0x00001100,0x00000000, // 003ah + 0x00000000,0x00000000,0x00001100,0x00000000, + 0x00000000,0x00000000,0x00001100,0x00000000, // 003bh + 0x00000000,0x00001100,0x00001000,0x00000100, + 0x00000000,0x01100000,0x00011000,0x00000110, // 003ch + 0x00000001,0x00000110,0x00011000,0x01100000, + 0x00000000,0x00000000,0x01111111,0x00000000, // 003dh + 0x00000000,0x00000000,0x01111111,0x00000000, + 0x00000000,0x00000011,0x00001100,0x00110000, // 003eh + 0x01000000,0x00110000,0x00001100,0x00000011, + 0x00000000,0x00111110,0x01000001,0x01000001, // 003fh + 0x00110000,0x00001000,0x00000000,0x00001000, + 0x00000000,0x00011100,0x00100010,0x01001001, // 0040h + 0x01010101,0x01010101,0x01010101,0x00111010, + 0x00000000,0x00001000,0x00010100,0x00010100, // 0041h + 0x00100010,0x00111110,0x01000001,0x01000001, + 0x00000000,0x00111111,0x01000001,0x01000001, // 0042h + 0x00111111,0x01000001,0x01000001,0x00111111, + 0x00000000,0x00111100,0x01000010,0x00000001, // 0043h + 0x00000001,0x00000001,0x01000010,0x00111100, + 0x00000000,0x00011111,0x00100001,0x01000001, // 0044h + 0x01000001,0x01000001,0x00100001,0x00011111, + 0x00000000,0x01111111,0x00000001,0x00000001, // 0045h + 0x01111111,0x00000001,0x00000001,0x01111111, + 0x00000000,0x01111111,0x00000001,0x00000001, // 0046h + 0x00111111,0x00000001,0x00000001,0x00000001, + 0x00000000,0x00111100,0x01000010,0x00000001, // 0047h + 0x01111001,0x01000001,0x01000010,0x00111100, + 0x00000000,0x01000001,0x01000001,0x01000001, // 0048h + 0x01111111,0x01000001,0x01000001,0x01000001, + 0x00000000,0x00111110,0x00001000,0x00001000, // 0049h + 0x00001000,0x00001000,0x00001000,0x00111110, + 0x00000000,0x01000000,0x01000000,0x01000000, // 004ah + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x01100001,0x00011001,0x00000101, // 004bh + 0x00000011,0x00000101,0x00011001,0x01100001, + 0x00000000,0x00000001,0x00000001,0x00000001, // 004ch + 0x00000001,0x00000001,0x00000001,0x01111111, + 0x00000000,0x01000001,0x01100011,0x01010101, // 004dh + 0x01001001,0x01000001,0x01000001,0x01000001, + 0x00000000,0x01000001,0x01000011,0x01000101, // 004eh + 0x01001001,0x01010001,0x01100001,0x01000001, + 0x00000000,0x00011100,0x00100010,0x01000001, // 004fh + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x00111111,0x01000001,0x01000001, // 0050h + 0x00111111,0x00000001,0x00000001,0x00000001, + 0x00000000,0x00011100,0x00100010,0x01000001, // 0051h + 0x01000001,0x01011001,0x00100010,0x01011100, + 0x00000000,0x00111111,0x01000001,0x01000001, // 0052h + 0x00111111,0x01000001,0x01000001,0x01000001, + 0x00000000,0x00111110,0x01000001,0x00000001, // 0053h + 0x00111110,0x01000000,0x01000001,0x00111110, + 0x00000000,0x01111111,0x00001000,0x00001000, // 0054h + 0x00001000,0x00001000,0x00001000,0x00001000, + 0x00000000,0x01000001,0x01000001,0x01000001, // 0055h + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x01000001,0x01000001,0x00100010, // 0056h + 0x00100010,0x00010100,0x00010100,0x00001000, + 0x00000000,0x01000001,0x01000001,0x01000001, // 0057h + 0x01001001,0x01010101,0x01100011,0x01000001, + 0x00000000,0x01000001,0x00100010,0x00010100, // 0058h + 0x00001000,0x00010100,0x00100010,0x01000001, + 0x00000000,0x01000001,0x00100010,0x00010100, // 0059h + 0x00001000,0x00001000,0x00001000,0x00001000, + 0x00000000,0x01111111,0x00100000,0x00010000, // 005ah + 0x00001000,0x00000100,0x00000010,0x01111111, + 0x00000000,0x01111100,0x00000100,0x00000100, // 005bh + 0x00000100,0x00000100,0x00000100,0x01111100, + 0x00000000,0x00100010,0x00010100,0x00111110, // 005ch + 0x00001000,0x00111110,0x00001000,0x00001000, + 0x00000000,0x00011111,0x00010000,0x00010000, // 005dh + 0x00010000,0x00010000,0x00010000,0x00011111, + 0x00000000,0x00001000,0x00010100,0x00100010, // 005eh + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, // 005fh + 0x00000000,0x00000000,0x00000000,0x01111111, + 0x00000000,0x00010000,0x00001000,0x00011000, // 0060h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00011110,0x00100001, // 0061h + 0x00111110,0x00100001,0x00100001,0x01011110, + 0x00000000,0x00000001,0x00000001,0x00111111, // 0062h + 0x01000001,0x01000001,0x01000001,0x00111111, + 0x00000000,0x00000000,0x00111100,0x01000010, // 0063h + 0x00000001,0x00000001,0x01000010,0x00111100, + 0x00000000,0x01000000,0x01000000,0x01111110, // 0064h + 0x01000001,0x01000001,0x01000001,0x01111110, + 0x00000000,0x00000000,0x00111110,0x01000001, // 0065h + 0x01111111,0x00000001,0x01000001,0x00111110, + 0x00000000,0x00110000,0x00001000,0x00001000, // 0066h + 0x01111111,0x00001000,0x00001000,0x00001000, + 0x00000000,0x00000000,0x01111110,0x01000001, // 0067h + 0x01000001,0x01111110,0x01000000,0x00111110, + 0x00000000,0x00000001,0x00000001,0x00000001, // 0068h + 0x00111111,0x01000001,0x01000001,0x01000001, + 0x00000000,0x00001000,0x00000000,0x00001000, // 0069h + 0x00001000,0x00001000,0x00001000,0x00001000, + 0x00000000,0x00100000,0x00000000,0x00100000, // 006ah + 0x00100000,0x00100001,0x00100001,0x00011110, + 0x00000000,0x00000001,0x00000001,0x01100001, // 006bh + 0x00011001,0x00000111,0x00011001,0x01100001, + 0x00000000,0x00001000,0x00001000,0x00001000, // 006ch + 0x00001000,0x00001000,0x00001000,0x00001000, + 0x00000000,0x00000000,0x00110111,0x01001001, // 006dh + 0x01001001,0x01001001,0x01001001,0x01001001, + 0x00000000,0x00000000,0x00111111,0x01000001, // 006eh + 0x01000001,0x01000001,0x01000001,0x01000001, + 0x00000000,0x00000000,0x00011100,0x00100010, // 006fh + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x00000000,0x00111101,0x01000011, // 0070h + 0x01000001,0x01000011,0x00111101,0x00000001, + 0x00000000,0x00000000,0x01011110,0x01100001, // 0071h + 0x01000001,0x01100001,0x01011110,0x01000000, + 0x00000000,0x00000000,0x00110001,0x00001101, // 0072h + 0x00000011,0x00000001,0x00000001,0x00000001, + 0x00000000,0x00000000,0x00111110,0x01000001, // 0073h + 0x00001110,0x00110000,0x01000001,0x00111110, + 0x00000000,0x00000100,0x00000100,0x01111111, // 0074h + 0x00000100,0x00000100,0x00000100,0x01111000, + 0x00000000,0x00000000,0x01000001,0x01000001, // 0075h + 0x01000001,0x01000001,0x01000001,0x01111110, + 0x00000000,0x00000000,0x01000001,0x01000001, // 0076h + 0x00100010,0x00100010,0x00010100,0x00001000, + 0x00000000,0x00000000,0x01000001,0x01000001, // 0077h + 0x01001001,0x00101010,0x00101010,0x00010100, + 0x00000000,0x00000000,0x00100001,0x00010010, // 0078h + 0x00001100,0x00001100,0x00010010,0x00100001, + 0x00000000,0x00000000,0x01000001,0x01000001, // 0079h + 0x00100010,0x00011100,0x00001000,0x00000110, + 0x00000000,0x00000000,0x00111111,0x00010000, // 007ah + 0x00001000,0x00000100,0x00000010,0x00111111, + 0x00000000,0x00001000,0x00011110,0x01100100, // 007bh + 0x00011000,0x00100100,0x00000100,0x01111000, + 0x00000000,0x00000000,0x00011110,0x00000100, // 007ch + 0x00011110,0x00110101,0x00101101,0x00010010, + 0x00000000,0x00000000,0x00000000,0x00010001, // 007dh + 0x00100001,0x00100001,0x00000001,0x00000010, + 0x00000000,0x00000000,0x00011100,0x00000000, // 007eh + 0x00011110,0x00100000,0x00100000,0x00011100, + 0x00000000,0x00000000,0x00011100,0x00000000, // 007fh + 0x00111110,0x00010000,0x00001100,0x00110010, + 0x00000000,0x00000000,0x00000100,0x00101111, // 0080h + 0x01000100,0x00011110,0x00100101,0x00010110, + 0x00000000,0x00000000,0x00001010,0x00011110, // 0081h + 0x00101011,0x00100010,0x00010100,0x00000100, + 0x00000000,0x00000000,0x00001000,0x00011101, // 0082h + 0x00101011,0x00101001,0x00011001,0x00000100, + 0x00000000,0x00000000,0x00001000,0x00111000, // 0083h + 0x00001000,0x00011110,0x00101001,0x00000110, + 0x00000000,0x00000000,0x00000000,0x00011100, // 0084h + 0x00100011,0x00100000,0x00100000,0x00011100, + 0x00000000,0x00000110,0x01001001,0x00110000, // 0085h + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000100,0x00111111,0x00000100, // 0086h + 0x00111110,0x01010101,0x01001101,0x00100110, + 0x00000000,0x00000000,0x00100001,0x01000001, // 0087h + 0x01000001,0x01000001,0x00000001,0x00000010, + 0x00000000,0x00111100,0x00000000,0x00111110, // 0088h + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x00011100,0x00000000,0x00111110, // 0089h + 0x00010000,0x00001000,0x00010100,0x01100010, + 0x00000000,0x00100100,0x01011111,0x00000100, // 008ah + 0x00111110,0x01000101,0x01000101,0x00100010, + 0x00000000,0x00100010,0x01001111,0x01010010, // 008bh + 0x01010010,0x00010010,0x00010010,0x00001001, + 0x00000000,0x00000100,0x00111110,0x00001000, // 008ch + 0x00111110,0x00010000,0x00000010,0x00111100, + 0x00000000,0x00100000,0x00011000,0x00000110, // 008dh + 0x00000001,0x00000110,0x00011000,0x00100000, + 0x00000000,0x00100000,0x01111101,0x00100001, // 008eh + 0x00100001,0x00100001,0x00100001,0x00010010, + 0x00000000,0x00011110,0x00100000,0x00000000, // 008fh + 0x00000000,0x00000001,0x00000001,0x00111110, + 0x00000000,0x00001000,0x01111111,0x00010000, // 0090h + 0x00100000,0x00000010,0x00000010,0x00111100, + 0x00000000,0x00000001,0x00000001,0x00000001, // 0091h + 0x01000001,0x01000001,0x00100010,0x00011100, + 0x00000000,0x00010000,0x01111111,0x00011000, // 0092h + 0x00010100,0x00010100,0x00011000,0x00001100, + 0x00000000,0x00100010,0x01111111,0x00100010, // 0093h + 0x00100010,0x00000010,0x00000010,0x01111100, + 0x00000000,0x00111100,0x00010000,0x00001100, // 0094h + 0x01111111,0x00001000,0x00001000,0x00110000, + 0x00000000,0x00000100,0x00011111,0x00000100, // 0095h + 0x01110100,0x00000010,0x00001010,0x01110010, + 0x00000000,0x00001000,0x01111111,0x00000100, // 0096h + 0x00111100,0x01000010,0x01000000,0x00111100, + 0x00000000,0x00000000,0x00011100,0x00100011, // 0097h + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x01111111,0x00010000,0x00001000, // 0098h + 0x00001000,0x00001000,0x00001000,0x00110000, + 0x00000000,0x00000010,0x00110010,0x00001100, // 0099h + 0x00000010,0x00000001,0x00000001,0x00111110, + 0x00000000,0x00100100,0x01001111,0x01000010, // 009ah + 0x00010001,0x00111100,0x00010010,0x00001100, + 0x00000000,0x00000010,0x01111010,0x01000010, // 009bh + 0x00000010,0x00000010,0x00001010,0x01110010, + 0x00000000,0x00100010,0x00111110,0x01010010, // 009ch + 0x01001011,0x01101101,0x01010101,0x00110010, + 0x00000000,0x00110010,0x01001011,0x01000110, // 009dh + 0x01000110,0x01110010,0x01001011,0x00110010, + 0x00000000,0x00011100,0x00101010,0x01001001, // 009eh + 0x01001001,0x01000101,0x01000101,0x00110010, + 0x00000000,0x00100001,0x01111101,0x00100001, // 009fh + 0x00100001,0x00111001,0x01100101,0x00011001, + 0x00000000,0x00000100,0x00100011,0x01100010, // 00a0h + 0x00100001,0x00100001,0x00010010,0x00001100, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00a1h + 0x00000000,0x00000100,0x00001010,0x00000100, + 0x00000000,0x01110000,0x00010000,0x00010000, // 00a2h + 0x00010000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00a3h + 0x00001000,0x00001000,0x00001000,0x00001110, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00a4h + 0x00000000,0x00000010,0x00000100,0x00000100, + 0x00000000,0x00000000,0x00000000,0x00011000, // 00a5h + 0x00011000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x01111111,0x01000000,0x01111111, // 00a6h + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x00000000,0x00111111,0x00100000, // 00a7h + 0x00010100,0x00001100,0x00000100,0x00000010, + 0x00000000,0x00000000,0x00100000,0x00100000, // 00a8h + 0x00010000,0x00001111,0x00001000,0x00001000, + 0x00000000,0x00000000,0x00000100,0x00111111, // 00a9h + 0x00100001,0x00100000,0x00010000,0x00001100, + 0x00000000,0x00000000,0x00000000,0x00111110, // 00aah + 0x00001000,0x00001000,0x00001000,0x01111111, + 0x00000000,0x00000000,0x00010000,0x00111111, // 00abh + 0x00011000,0x00010100,0x00010010,0x00011001, + 0x00000000,0x00000000,0x00000010,0x00111111, // 00ach + 0x00100010,0x00010010,0x00000100,0x00000100, + 0x00000000,0x00000000,0x00000000,0x00111110, // 00adh + 0x00100000,0x00100000,0x00100000,0x01111111, + 0x00000000,0x00000000,0x00111110,0x00100000, // 00aeh + 0x00111110,0x00100000,0x00100000,0x00111110, + 0x00000000,0x00000000,0x00100101,0x00101010, // 00afh + 0x00101010,0x00100000,0x00010000,0x00001110, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00b0h + 0x01111111,0x00000000,0x00000000,0x00000000, + 0x00000000,0x01111111,0x01000000,0x00101000, // 00b1h + 0x00011000,0x00001000,0x00001000,0x00000100, + 0x00000000,0x01000000,0x00100000,0x00011000, // 00b2h + 0x00010111,0x00010000,0x00010000,0x00010000, + 0x00000000,0x00001000,0x01111111,0x01000001, // 00b3h + 0x01000001,0x01000000,0x00100000,0x00011000, + 0x00000000,0x00000000,0x00111110,0x00001000, // 00b4h + 0x00001000,0x00001000,0x00001000,0x01111111, + 0x00000000,0x00100000,0x01111111,0x00110000, // 00b5h + 0x00101000,0x00100100,0x00100010,0x00110001, + 0x00000000,0x00000100,0x01111111,0x01000100, // 00b6h + 0x01000100,0x01000100,0x01000010,0x00100001, + 0x00000000,0x00000100,0x00111111,0x00001000, // 00b7h + 0x01111111,0x00010000,0x00010000,0x00010000, + 0x00000000,0x01111100,0x01000100,0x01000100, // 00b8h + 0x01000010,0x01000000,0x00100000,0x00011000, + 0x00000000,0x00000010,0x01111110,0x00100010, // 00b9h + 0x00100001,0x00100000,0x00010000,0x00001100, + 0x00000000,0x01111110,0x01000000,0x01000000, // 00bah + 0x01000000,0x01000000,0x01000000,0x01111110, + 0x00000000,0x00100010,0x01111111,0x00100010, // 00bbh + 0x00100010,0x00100000,0x00010000,0x00001100, + 0x00000000,0x00000011,0x00000100,0x01000011, // 00bch + 0x01000100,0x00100000,0x00011000,0x00000111, + 0x00000000,0x01111111,0x01000000,0x00100000, // 00bdh + 0x00010000,0x00011000,0x00100100,0x01000011, + 0x00000000,0x00000010,0x01111111,0x01000010, // 00beh + 0x00100010,0x00000010,0x00000010,0x01111100, + 0x00000000,0x01000001,0x01000010,0x01000000, // 00bfh + 0x00100000,0x00100000,0x00011000,0x00000110, + 0x00000000,0x01111110,0x01000010,0x01001110, // 00c0h + 0x01110001,0x01000000,0x00100000,0x00011000, + 0x00000000,0x01100000,0x00011110,0x00010000, // 00c1h + 0x01111111,0x00010000,0x00010000,0x00001100, + 0x00000000,0x01000101,0x01001010,0x01001010, // 00c2h + 0x01000000,0x00100000,0x00010000,0x00001110, + 0x00000000,0x00111110,0x00000000,0x01111111, // 00c3h + 0x00010000,0x00010000,0x00001000,0x00000110, + 0x00000000,0x00000010,0x00000010,0x00000110, // 00c4h + 0x00011010,0x01100010,0x00000010,0x00000010, + 0x00000000,0x00010000,0x00010000,0x01111111, // 00c5h + 0x00010000,0x00010000,0x00001000,0x00000110, + 0x00000000,0x00000000,0x00111110,0x00000000, // 00c6h + 0x00000000,0x00000000,0x00000000,0x01111111, + 0x00000000,0x01111110,0x01000000,0x01000100, // 00c7h + 0x00101000,0x00010000,0x00101000,0x01000110, + 0x00000000,0x00001000,0x01111111,0x00100000, // 00c8h + 0x00010000,0x00011100,0x01101011,0x00001000, + 0x00000000,0x01000000,0x01000000,0x01000000, // 00c9h + 0x00100000,0x00100000,0x00011000,0x00000111, + 0x00000000,0x00010010,0x00100010,0x00100010, // 00cah + 0x01000010,0x01000010,0x01000001,0x01000001, + 0x00000000,0x00000001,0x00000001,0x01111111, // 00cbh + 0x00000001,0x00000001,0x00000001,0x01111110, + 0x00000000,0x01111111,0x01000000,0x01000000, // 00cch + 0x01000000,0x00100000,0x00010000,0x00001110, + 0x00000000,0x00000000,0x00000100,0x00001010, // 00cdh + 0x00010001,0x00100001,0x01000000,0x00000000, + 0x00000000,0x00001000,0x00001000,0x01111111, // 00ceh + 0x00001000,0x00101010,0x01001010,0x01001001, + 0x00000000,0x01111111,0x01000000,0x01000000, // 00cfh + 0x00100010,0x00010100,0x00001000,0x00010000, + 0x00000000,0x00001110,0x01110000,0x00001110, // 00d0h + 0x01110000,0x00000110,0x00011000,0x01100000, + 0x00000000,0x00001000,0x00001000,0x00000100, // 00d1h + 0x00000100,0x00100010,0x01000010,0x01111111, + 0x00000000,0x01000000,0x01000000,0x00100100, // 00d2h + 0x00101000,0x00010000,0x00101100,0x01000011, + 0x00000000,0x01111111,0x00000100,0x01111111, // 00d3h + 0x00000100,0x00000100,0x00000100,0x01111000, + 0x00000000,0x00000010,0x01111111,0x01000010, // 00d4h + 0x00100010,0x00010100,0x00000100,0x00000100, + 0x00000000,0x00000000,0x00111110,0x00100000, // 00d5h + 0x00100000,0x00100000,0x00100000,0x01111111, + 0x00000000,0x01111110,0x01000000,0x01000000, // 00d6h + 0x01111110,0x01000000,0x01000000,0x01111110, + 0x00000000,0x00111110,0x00000000,0x01111111, // 00d7h + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x01000010,0x01000010,0x01000010, // 00d8h + 0x01000010,0x01000000,0x00100000,0x00011000, + 0x00000000,0x00001010,0x00001010,0x00001010, // 00d9h + 0x01001010,0x01001010,0x00101010,0x00011001, + 0x00000000,0x00000010,0x00000010,0x01000010, // 00dah + 0x01000010,0x00100010,0x00010010,0x00001110, + 0x00000000,0x01111111,0x01000001,0x01000001, // 00dbh + 0x01000001,0x01000001,0x01000001,0x01111111, + 0x00000000,0x01111111,0x01000001,0x01000001, // 00dch + 0x01000000,0x01000000,0x00100000,0x00011100, + 0x00000000,0x01000011,0x01000100,0x01000000, // 00ddh + 0x01000000,0x00100000,0x00010000,0x00001111, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00deh + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00000000,0x00000000,0x00000000, // 00dfh + 0x00000000,0x00000000,0x00000000,0x00000000, + 0x00000000,0x00011110,0x00001000,0x00000100, // 00e0h + 0x00101001,0x01010001,0x01010001,0x00001100, + 0x00000000,0x00000000,0x00001100,0x00010010, // 00e1h + 0x00010010,0x00100001,0x01000000,0x00000000, + 0x00000000,0x01111101,0x00100001,0x01111101, // 00e2h + 0x00100001,0x00111001,0x01100101,0x00011001, + 0x00000000,0x00111100,0x00010000,0x00111100, // 00e3h + 0x00010000,0x00011100,0x00110010,0x00001100, + 0x00000000,0x00001110,0x00101000,0x00101000, // 00e4h + 0x00111110,0x01100101,0x00100101,0x00010010, + 0x00000000,0x00000100,0x00101111,0x01000100, // 00e5h + 0x00000110,0x01000101,0x01000101,0x00111110, + 0x00000000,0x00100010,0x00100010,0x00111110, // 00e6h + 0x01010010,0x01010101,0x01001101,0x00100110, + 0x00000000,0x00000100,0x00011111,0x00000010, // 00e7h + 0x00011111,0x01000010,0x01000010,0x00111100, + 0x00000000,0x00010010,0x00111110,0x01010011, // 00e8h + 0x01000010,0x00100100,0x00000100,0x00000100, + 0x00000000,0x00001000,0x00111101,0x01001011, // 00e9h + 0x01001001,0x01001001,0x00111000,0x00000100, + 0x00000000,0x00001000,0x00111000,0x00001000, // 00eah + 0x00001000,0x00011110,0x00101001,0x00000110, + 0x00000000,0x00011000,0x00100000,0x00000100, // 00ebh + 0x00111010,0x01000110,0x01000000,0x00111000, + 0x00000000,0x01000010,0x01000010,0x01000010, // 00ech + 0x01000110,0x01000000,0x00100000,0x00011000, + 0x00000000,0x00111110,0x00010000,0x00111100, // 00edh + 0x01000011,0x01001100,0x01010010,0x00111100, + 0x00000000,0x00100010,0x00110011,0x00101010, // 00eeh + 0x00100110,0x00100010,0x00100011,0x01000010, + 0x00000000,0x00111110,0x00010000,0x00111100, // 00efh + 0x01000011,0x01000000,0x01000010,0x00111100, + 0x00000000,0x00000010,0x00111011,0x01000110, // 00f0h + 0x01000010,0x01000011,0x01000010,0x00110010, + 0x00000000,0x00000100,0x00000100,0x00000010, // 00f1h + 0x01000110,0x01000101,0x01000101,0x00111001, + 0x00000000,0x01010100,0x01111111,0x00100100, // 00f2h + 0x00100100,0x00100100,0x00100010,0x00010001, + 0x00000000,0x01010100,0x01011111,0x00000100, // 00f3h + 0x00111111,0x00001000,0x00001000,0x00001000, + 0x00000000,0x01011110,0x01100010,0x00100010, // 00f4h + 0x00100001,0x00100000,0x00010000,0x00001100, + 0x00000000,0x01010010,0x01111110,0x00100010, // 00f5h + 0x00100001,0x00100000,0x00010000,0x00001100, + 0x00000000,0x01010000,0x01111111,0x00100000, // 00f6h + 0x00100000,0x00100000,0x00100000,0x00111111, + 0x00000000,0x01010010,0x01010010,0x00111111, // 00f7h + 0x00010010,0x00010000,0x00010000,0x00001100, + 0x00000000,0x01010011,0x01010100,0x00100011, // 00f8h + 0x00100100,0x00010000,0x00001000,0x00000111, + 0x00000000,0x01010000,0x01011111,0x00010000, // 00f9h + 0x00001000,0x00001100,0x00010010,0x00100001, + 0x00000000,0x01010010,0x01111111,0x00100010, // 00fah + 0x00010010,0x00000010,0x00000010,0x00111100, + 0x00000000,0x01010001,0x01010010,0x00100000, // 00fbh + 0x00100000,0x00010000,0x00001000,0x00000110, + 0x00000000,0x01011110,0x01010010,0x00100110, // 00fch + 0x00111001,0x00100000,0x00010000,0x00001100, + 0x00000000,0x01010000,0x01011110,0x00010000, // 00fdh + 0x01111111,0x00010000,0x00010000,0x00001100, + 0x00000000,0x00100101,0x01001010,0x00101010, // 00feh + 0x00100000,0x00010000,0x00001000,0x00000111, + 0x00000000,0x01011110,0x01010000,0x00111111, // 00ffh + 0x00001000,0x00001000,0x00001000,0x00000110 +}; +*/ + + diff --git a/build/tests/DispOwnerInfo/src/data.h b/build/tests/DispOwnerInfo/src/data.h new file mode 100644 index 00000000..cdfa09ce --- /dev/null +++ b/build/tests/DispOwnerInfo/src/data.h @@ -0,0 +1,108 @@ +/********************************************************************/ +/* data.h */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + データ定義 ヘッダ +*/ + +#ifndef __DATA_H__ +#define __DATA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include + +// define data--------------------------------------------- + + // パレットカラー +#define WHITE ( 1 << 12 ) +#define RED ( 2 << 12 ) +#define GREEN ( 3 << 12 ) +#define BLUE ( 4 << 12 ) +#define YELLOW ( 5 << 12 ) +#define CYAN ( 6 << 12 ) +#define PURPLE ( 7 << 12 ) +#define LIGHTGREEN ( 8 << 12 ) +#define HIGHLIGHT_Y ( 9 << 12 ) +#define HIGHLIGHT_C ( 10 << 12 ) +#define HIGHLIGHT_W ( 11 << 12 ) +#define HIGHLIGHT_B ( 12 << 12 ) +#define HIGHLIGHT_R ( 13 << 12 ) + + +// fntライブラリのカラー指定 +#define FNT_BLACK 0 +#define FNT_RED 1 +#define FNT_LIGHT_GREEN 2 +#define FNT_YELLOW 3 +#define FNT_BLUE 4 +#define FNT_PURPLE 5 +#define FNT_VERMILION 6 +#define FNT_WHITE 7 +#define FNT_SYUIRO 8 +#define FNT_GREEN 9 +#define FNT_USER_COLOR 10 + + +#define CANVAS_WIDTH 256 // 文字表示キャンパス横ドット数 +#define CANVAS_HEIGHT 192 //    〃     縦ドット数 +#define LINE_DOT_NUM 10 + + + // キーデータワーク +typedef struct { + u16 trg; // トリガ入力 + u16 cont; // ベタ 入力 +}KeyWork; + + + // タッチパネルワーク +typedef struct { + int detached; // 今回のデータ入力でタッチが離れたことを示す。 + BOOL initial; // 初期化直後は、TPがデタッチされるまで、データ取得しないようにする。 + TPData disp; // 今回の入力値(LCD座標) + TPData raw; // 今回の入力値(TP 座標) + TPData last; // 前回の入力値(LCD座標) +}TpWork; + + +// global variables---------------------------------------- +extern int (*nowProcess)( void ); +extern GXOamAttr oamBakM[ 128 ]; // OAM バックアップ +extern GXOamAttr oamBakS[ 128 ]; // OAM バックアップ +extern u16 bgBakM[ 32*24 ]; // BG バックアップ +extern u16 bgBakS[ 32*24 ]; // BG バックアップ +extern TpWork tpd; // タッチパネルデータ +extern KeyWork pad; // キーパッド入力データ + +extern tFntEntry font_m; +extern tFntDrawContext context_m; +extern u16 canvas_m[ CANVAS_WIDTH * CANVAS_HEIGHT / 4 ] ATTRIBUTE_ALIGN(32); +extern u16 screen_m[ (CANVAS_WIDTH>>3) * (CANVAS_HEIGHT>>3) ] ATTRIBUTE_ALIGN(32); + +extern tFntEntry font_s; +extern tFntDrawContext context_s; +extern u16 canvas_s[ CANVAS_WIDTH * CANVAS_HEIGHT / 4 ] ATTRIBUTE_ALIGN(32); +extern u16 screen_s[ (CANVAS_WIDTH>>3) * (CANVAS_HEIGHT>>3) ] ATTRIBUTE_ALIGN(32); + +extern u16 s_Palette[ 0x10 ]; + +// global const data--------------------------------------- +extern const u16 myPlttData[13][16]; + + +// function------------------------------------------------ + + +#ifdef __cplusplus +} +#endif + +#endif // __DATA_H__ diff --git a/build/tests/DispOwnerInfo/src/dispNCD.c b/build/tests/DispOwnerInfo/src/dispNCD.c new file mode 100644 index 00000000..1efdbacb --- /dev/null +++ b/build/tests/DispOwnerInfo/src/dispNCD.c @@ -0,0 +1,282 @@ +/********************************************************************/ +/* dispNCD.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + NITRO設定データ表示 + + $Log: dispNCD.c,v $ + Revision 1.7.2.2.8.1 2007/01/22 07:36:16 yosiokat + NAT-IPL2への対応。 + + Revision 1.7.2.3 2006/06/26 04:09:02 yosiokat + DrawNCD_Elementの言語コードの表示判定部を修正。 + + Revision 1.7.2.2 2006/02/01 06:32:43 yosiokat + IPL2バージョン情報取得関数の整理。 + + Revision 1.7.2.1 2005/10/25 08:19:39 yosiokat + ・中国版かどうかの判定を関数IsIPLTypeChineseで行うよう変更。 + ・USG版の時に、バックライト輝度情報(0〜3)を表示するよう変更。 + + Revision 1.7 2005/04/14 05:53:47 yosiokat + NITRO設定データ関係を強制的に中国版にするスイッチFORCE_CHINAを追加。 + + Revision 1.6 2005/04/02 10:04:08 yosiokat + ユーザーカラーの色表示に対応。 + + Revision 1.5 2005/04/02 07:42:54 yosiokat + ユーザーネーム&コメントをIPL2フォントを使用して全て表示できるよう変更。 + + Revision 1.4 2005/04/01 05:47:24 yosiokat + NitroConfigDataEx対応IPL2の時には、言語コードをEx側も表示するよう変更。 + + Revision 1.3 2005/03/31 05:59:15 yosiokat + ・言語コードにCHINESE、UNKNOWNの追加。 + ・TPデータワークのクリアをInitTPData()に変更。 + + Revision 1.2 2005/03/09 04:44:39 yosiokat + 機能追加。 + + Revision 1.1.1.1 2004/08/31 06:20:24 Yosiokat + no message + + +*/ + +#include +#include "main.h" +#include "NitroConfigData.h" +#include "font.h" + +// define data------------------------------------------ +#define CANCEL_BUTTON_LT_X 2 +#define CANCEL_BUTTON_LT_Y 22 +#define CANCEL_BUTTON_RB_X (CANCEL_BUTTON_LT_X+8) +#define CANCEL_BUTTON_RB_Y (CANCEL_BUTTON_LT_Y+2) + +#define IPL2_GAIJI_SIKAKU 0x25a0 + +/* 本体情報 : 「お気に入りの色」定数 (GXRgb) */ +#define FAVORITE_COLOR_VALUE_GRAY GX_RGB(12,16,19) +#define FAVORITE_COLOR_VALUE_BROWN GX_RGB(23, 9, 0) +#define FAVORITE_COLOR_VALUE_RED GX_RGB(31, 0, 3) +#define FAVORITE_COLOR_VALUE_PINK GX_RGB(31,17,31) +#define FAVORITE_COLOR_VALUE_ORANGE GX_RGB(31,18, 0) +#define FAVORITE_COLOR_VALUE_YELLOW GX_RGB(30,28, 0) +#define FAVORITE_COLOR_VALUE_LIME_GREEN GX_RGB(21,31, 0) +#define FAVORITE_COLOR_VALUE_GREEN GX_RGB( 0,31, 0) +#define FAVORITE_COLOR_VALUE_DARK_GREEN GX_RGB( 0,20, 7) +#define FAVORITE_COLOR_VALUE_SEA_GREEN GX_RGB( 9,27,17) +#define FAVORITE_COLOR_VALUE_TURQUOISE GX_RGB( 6,23,30) +#define FAVORITE_COLOR_VALUE_BLUE GX_RGB( 0,11,30) +#define FAVORITE_COLOR_VALUE_DARK_BLUE GX_RGB( 0, 0,18) +#define FAVORITE_COLOR_VALUE_PURPLE GX_RGB(17, 0,26) +#define FAVORITE_COLOR_VALUE_VIOLET GX_RGB(26, 0,29) +#define FAVORITE_COLOR_VALUE_MAGENTA GX_RGB(31, 0,18) + + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static void DrawNCD_ElementName( void ); +static void DrawNCD_Element( void ); +static void DispUserNameAndComment( u16 color ); + +// global variable ------------------------------------- + +// static variable ------------------------------------- + +// const data ----------------------------------------- +static const u8 *str_lcd[] = { (const u8 *)"TOP", + (const u8 *)"BOTTOM" }; +static const u8 *str_onoff[] = { (const u8 *)"OFF", + (const u8 *)"ON" }; +static const u8 *str_inputFlags[] = { + (const u8 *)"NAME", + (const u8 *)"RTC ", + (const u8 *)"LANG", + (const u8 *)"TP ", + (const u8 *)"COL ", + (const u8 *)"BDAY", }; +static const u8 *str_language[] = { (const u8 *)"JAPANESE", + (const u8 *)"ENGLISH", + (const u8 *)"FRENCH", + (const u8 *)"GERMAN", + (const u8 *)"ITALIAN", + (const u8 *)"SPANISH", + (const u8 *)"CHINISE", + (const u8 *)"HANGUL", + (const u8 *)"UNKNOWN", +}; + +static const u8 *str_userColor[] = { + (const u8 *)"GRAY", + (const u8 *)"BROWN", + (const u8 *)"RED", + (const u8 *)"PINK", + (const u8 *)"ORANGE", + (const u8 *)"YELLOW", + (const u8 *)"LIME GREEN ", + (const u8 *)"GREEN", + (const u8 *)"DARK GREEN", + (const u8 *)"SEA GREEN", + (const u8 *)"TURQUOISE", + (const u8 *)"BLUE", + (const u8 *)"DARK BLUE", + (const u8 *)"PURPLE", + (const u8 *)"VIOLET", + (const u8 *)"MAGENTA", +}; + +static const u16 palette_userColor[] = { + FAVORITE_COLOR_VALUE_GRAY, + FAVORITE_COLOR_VALUE_BROWN, + FAVORITE_COLOR_VALUE_RED, + FAVORITE_COLOR_VALUE_PINK, + FAVORITE_COLOR_VALUE_ORANGE, + FAVORITE_COLOR_VALUE_YELLOW, + FAVORITE_COLOR_VALUE_LIME_GREEN, + FAVORITE_COLOR_VALUE_GREEN, + FAVORITE_COLOR_VALUE_DARK_GREEN, + FAVORITE_COLOR_VALUE_SEA_GREEN, + FAVORITE_COLOR_VALUE_TURQUOISE, + FAVORITE_COLOR_VALUE_BLUE, + FAVORITE_COLOR_VALUE_DARK_BLUE, + FAVORITE_COLOR_VALUE_PURPLE, + FAVORITE_COLOR_VALUE_VIOLET, + FAVORITE_COLOR_VALUE_MAGENTA, +}; + +static const u16 str_sikaku[] = L"■■■■"; + +//====================================================== +// NITRO設定データ表示 +//====================================================== + +// NITRO設定データ表示の初期化 +void SEQ_DispNCD_init( void ) +{ + GXS_SetVisiblePlane( GX_PLANEMASK_NONE ); + GX_SetVisiblePlane ( GX_PLANEMASK_NONE ); + + SVC_CpuClearFast( 0x0000, bgBakM, sizeof(bgBakM) ); + SVC_CpuClearFast( 0x0000, bgBakS, sizeof(bgBakS) ); + + ClearAllStringSJIS(); + +// (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"Disp OwnerInfo [Use SDK 2.00 W]" ); +// (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"Disp OwnerInfo [Use SDK 2.01 WC]" ); + (void)DrawStringSJIS( 1, 0, YELLOW, (const u8 *)"Disp OwnerInfo [Use SDK 5.01 PR1 WCK]" ); + + DrawNCD_ElementName(); + DrawNCD_Element(); + + GX_SetVisiblePlane ( GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 | GX_PLANEMASK_OBJ ); +} + + +// NITRO設定データの表示 +int SEQ_DispNCD( void ) +{ + BOOL tp_cancel = FALSE; + + return 0; +} + + +// NITRO設定データの要素名表示 +static void DrawNCD_ElementName( void ) +{ + { // TOP LCD + SetTargetScreenSJIS( BOTTOM_SCREEN ); + (void)DrawStringSJIS( 1, 4, CYAN , (const u8 *)"[OPTION]" ); + (void)DrawStringSJIS( 2, 6, LIGHTGREEN, (const u8 *)"Language :" ); + (void)DrawStringSJIS( 1, 8, CYAN , (const u8 *)"[OWNER]" ); + (void)DrawStringSJIS( 2, 10, LIGHTGREEN, (const u8 *)"fav color:" ); + (void)DrawStringSJIS( 2, 12, LIGHTGREEN, (const u8 *)"birthday :" ); + (void)DrawStringSJIS( 2, 14, LIGHTGREEN, (const u8 *)"nickname :" ); + (void)DrawStringSJIS( 2, 16, LIGHTGREEN, (const u8 *)"comment :" ); +// SetTargetScreenSJIS( BOTTOM_SCREEN ); + } +} + + +// NITRO設定データの各要素表示 +static void DrawNCD_Element( void ) +{ + const u8 *str; + OSOwnerInfo info; + OS_GetOwnerInfo( &info ); + + { // TOP LCD + SetTargetScreenSJIS( BOTTOM_SCREEN ); + if( info.language < LANG_CODE_MAX ) { + str = str_language[ info.language ]; + }else { + str = str_language[ LANG_CODE_MAX ]; + } + (void)DrawStringSJISEx( 12, 6, WHITE, str, 0 ); + +// SetTargetScreenSJIS( BOTTOM_SCREEN ); + } + { + int temp; + + // ユーザーカラー + { + tFntPosition x = (tFntPosition){ 12 * 8 , FNT_POSX_ORIGIN_LEFT, FNT_H_ALIGN_LEFT }; + tFntPosition y = (tFntPosition){ 11 * 8 + 4, FNT_POSY_ORIGIN_BOTTOM , 0 /*unused*/ }; + temp = info.favoriteColor; + fnt_DrawString( &font_s, &context_s, x, y, 1, 0, str_sikaku, FNT_USER_COLOR ); + (void)DrawDecimalSJIS( 18, 10, WHITE, &temp, 2, 4 ); + (void)DrawStringSJIS ( 20, 10, WHITE, str_userColor[ temp ] ); + GXS_LoadBGPltt( &palette_userColor[ temp ], FNT_USER_COLOR * 2, 2 ); + } + (void)DrawStringSJIS ( 14, 12, WHITE, (const u8 *)"/" ); + (void)DrawDecimalSJIS( 12, 12, WHITE, &info.birthday.month, 2, 1 ); + (void)DrawDecimalSJIS( 15, 12, WHITE, &info.birthday.day, 2, 1 ); + + // ユーザーネーム、コメント + DispUserNameAndComment( FNT_WHITE ); + + // ユーザーネーム長、コメント長 + (void)DrawDecimalSJIS ( 0, 14, YELLOW, &info.nickNameLength, 2, 1 ); + (void)DrawDecimalSJIS ( 0, 16, YELLOW, &info.commentLength, 2, 1 ); + } +} + + +static void DispUserNameAndComment( u16 color ) +{ + u16 color2 = ( color == FNT_BLACK ) ? (u16)FNT_BLACK : (u16)FNT_YELLOW; + u16 buff[ 256 ]; + tFntPosition x = (tFntPosition){ 12 * 8 , FNT_POSX_ORIGIN_LEFT, FNT_H_ALIGN_LEFT }; + tFntPosition y = (tFntPosition){ 15 * 8 + 4, FNT_POSY_ORIGIN_BOTTOM , 0 /*unused*/ }; + OSOwnerInfo info; + OS_GetOwnerInfo( &info ); + + // ユーザーネームの表示 + MI_CpuCopy16 ( info.nickName, buff, NCD_NICKNAME_LENGTH * 2 ); + buff[ NCD_NICKNAME_LENGTH ] = 0; + fnt_DrawString( &font_s, &context_s, x, y, 1, 0, buff, color2 ); + buff[ info.nickNameLength ] = 0; + fnt_DrawString( &font_s, &context_s, x, y, 1, 0, buff, color ); + + + // コメントの表示 + y.pos = 19 * 8 + 4; + MI_CpuCopy16( info.comment, buff, (u32)( info.commentLength * 2 ) ); + buff[ info.commentLength ] = 0; + if ( info.commentLength > 13 ) { // 2行にまたがる時。 + fnt_DrawString( &font_s, &context_s, x, y, 1, 0, &buff[13], color ); + } + buff[ 13 ] = 0; + y.pos -= 2 * 8; + fnt_DrawString( &font_s, &context_s, x, y, 1, 0, buff, color ); +} + + diff --git a/build/tests/DispOwnerInfo/src/font.c b/build/tests/DispOwnerInfo/src/font.c new file mode 100644 index 00000000..5d57afd5 --- /dev/null +++ b/build/tests/DispOwnerInfo/src/font.c @@ -0,0 +1,1094 @@ +/********************************************************************/ +/* font.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + フォント処理 + + + $Log: font.c,v $ + Revision 1.1 2004/08/31 06:20:24 Yosiokat + Initial revision + + + + + // **** old logs **** + + Revision 1.19 2004/08/25 02:21:40 Yosiokat + ・1.14のコメントは間違いのため、再コミット。 + ・small fix. + + Revision 1.18 2004/08/25 02:15:51 Yosiokat + タグred_ipl2_2004_08_24_pp2_isdbg_fixの削除。 + + Revision 1.17 2004/08/20 11:35:29 Yosiokat + small fix. + + Revision 1.16 2004/08/18 07:17:29 Yosiokat + 上下LCDをターゲットにして、別個に初期化できるよう変更。 + + Revision 1.15 2004/08/17 07:52:03 Yosiokat + ・SetTargetScreenSJISを追加して、上下LCDのどちらにも文字表示が可能になるよう変更。 + + Revision 1.14 2004/08/16 10:03:08 Yosiokat + GetStrEntryで範囲外のhandleが与えられた際にNULLを返すよう変更。 + + Revision 1.13 2004/08/13 07:32:58 Yosiokat + small fix. + + Revision 1.12 2004/08/13 04:33:18 Yosiokat + small fix. + + Revision 1.11 2004/08/10 07:02:10 yosiokat + small fix. + + Revision 1.10 2004/08/07 05:44:44 Yosiokat + ・SJIS文字列表示関数を引数でハンドルを指定しない仕様に変更する。 + ・上記変更に対応して、クリア関数も仕様変更。 + + Revision 1.9 2004/07/29 04:58:42 Yosiokat + 構造体のパディングを明示的に追加。 + + Revision 1.8 2004/07/13 00:31:48 Yosiokat + ・サブLCD側のVRAMを対象にするよう変更。 + + Revision 1.7 2004/06/15 13:09:10 Yosiokat + ・MY_PrintfをOS_Printfに。 + + Revision 1.6 2004/06/06 06:28:24 Yosiokat + OS_PrintfをOS_Printfに。 + + Revision 1.5 2004/06/06 02:39:31 Yosiokat + SJISコード判定用の定数定義をfont.hに移動。 + + Revision 1.4 2004/05/31 11:53:23 yosiokat + __DEBUGを__PRINTに変更。 + + Revision 1.3 2004/05/26 05:07:34 Yosiokat + DrawStringSJISで空文字列を指定した際に異常動作するバグを修正。 + + Revision 1.2 2004/05/26 01:16:57 Yosiokat + 文字制御をSJISベースに変更中。 + + Revision 1.1 2004/05/25 08:59:22 Yosiokat + 文字列をSJISで制御するように変更。 + + +*/ + + +#include +#include "font.h" +#include "data.h" + +// define data---------------------------------- +#define SEARCH_ENTRY_MAX_NUM 128 // 処理が重くなるのを防ぐための、エントリのサーチ回数上限 +#define NITRO_CHAR_SIZE 0x20 // NITRO標準キャラクタサイズ(4bitカラー) +#define CHAR_CODE_OFFSET (SJIS_CHAR_VRAM_OFFSET / NITRO_CHAR_SIZE) // キャラナンバーをスクリーンに転送する際のオフセット(BG_CHAR_VRAM+0x4000から始めているので、オフセットは0x200) +#define DRAW_CHAR_NUM_LIMIT (SJIS_CHAR_VRAM_SIZE / NITRO_CHAR_SIZE) // 1つの文字列で表示できるキャラクタ数の限界 + +#define HANDLE_INDEX 0x40000000 + +// フォント構成データ +typedef struct FontComponent { + u16 need_tate_dot; // 文字を表示するのに必要なキャラ単位のドット数 + u16 tate_dot; // 文字キャラの縦ドット数 + u16 yoko_dot; // 文字キャラの横ドット数 + u16 org_char_size; // 文字キャラのbyteサイズ + u32 org_row_size; // 文字キャラ + u32 start_adr; // キャラクタバイナリのスタートアドレス + u32 end_adr; // キャラクタバイナリのエンドアドレス +}FontComponent; + + +// VRAMキャラデータのメモリブロック動的確保リスト +typedef struct CharAllocListTag CharAllocList; +struct CharAllocListTag { + CharAllocList *next; // 次のメモリブロック確保構造体へのポインタ + u16 memTop; // キャラ割り当てテーブルcharAllocTblの占有ブロックの先頭ポイント + u16 memNum; // 確保したメモリブロックの数 +}CharAllocListTag; + + +// SJIS文字列表示のためのVRAMエントリデータ +typedef struct StrEntry { + const FontComponent *font; // 表示するフォントの構成要素 + u32 dataAddr; // データ元のアドレス(IDとして使用) + u32 *charMemp; // 動的に確保したVRAMメモリブロックへのポインタ + u16 charNum; // トータルのキャラ数 + u16 drawPos; // 表示位置(BGスクリーンバッファの先頭からの2byteオフセット) +}StrEntry; + + +// フォントの文字間隔詰め展開用データ +typedef struct FontPropotion { + u16 *leftp; // 現在の左側フォントデータへのポインタ + u16 *rightp; // 現在の右側フォントデータへのポインタ + u16 h_offset; // 16x16ドット単位のキャラクタデータ内の現在の横オフセット + u8 pad[2]; + u32 buff16x16[2][16/2]; +}FontPropotion; + +// インクリメント/インクリメントなしフラグ(SetScrDataで使用) +typedef enum IncFlag { + NO_INC, // インクリメントなし + INC_1 // 1インクリメント +}IncFlag; + +// extern data---------------------------- +extern void _binary_f12han_dat(void); +extern void _binary_f12han_dat_end(void); + + +// function's prototype declaration------------- +static void SetScrData(u16 code_top, StrEntry *sEntryp, IncFlag inc_flag); +static u16 MeasureStringCharWidth(const u8 *str); +static void SpreadStringCloser(u8 *str, StrEntry *sEntryp, u16 v_offset); +static void SetFirstFont(u8 **strpp, u16 v_offset, FontPropotion *fontProp); +static u8 * CloseFontChar(u8 **strpp, u16 v_offset, FontPropotion *fontProp); +static u32 CalcCharCodeAddress(u8 **strpp, const FontComponent **font); +static void SpreadFontZen(u16 bit0_color, u16 bit1_color, u8 *fromAdr, u32 *toAdr); +static void InitStrEntryTable( StrEntry **sEntrypp ); +static StrEntry *GetStrEntry( u16 handle ); +static StrEntry **GetStrEntryAddress( u16 handle ); +static int InsertStrEntry(u16 *handle, u16 charNum); +static int InsertStrEntry2(u16 handle, u16 charNum); +static u16 DeleteStrEntry( u16 handle); +static BOOL GetEmptyStrEntry(u32 dataAddr, u16 *handlep); +static u16 SearchStrEntry(u32 dataAddr); +static u8 * HexToDecimalString(const void *hexp, u8 *strp, u16 figure, u16 size); +static u8 * HexToString(const void *hexp, u8 *strp, u16 figure); +static void InitAllocSystemSJIS( TargetScreen target ); +static void *AllocMemoryFromVram( int size ); +static void FreeMemoryToVram( void *p ); + +static u16 DrawStringSJIS_Core(u16 x, u16 y, u16 color, const void *strp, int handleIndex); +static int CalcHandleIndex(u32 dataAddr, int index); + +// global variables----------------------------- + + +// static variables----------------------------- +static int font_init = 0; +static TargetScreen targetScreen = BOTTOM_SCREEN; +static const FontComponent *nowFontHan; +static StrEntry *entryTblS[ STR_ENTRY_MAX_NUM ]; +static StrEntry *entryTblM[ STR_ENTRY_MAX_NUM ]; +static StrEntry **entryTblp; +static u16 *bgBakp; + +// const data----------------------------------- +const u16 tbl_ASCII_to_SJIS[0x100]; +const FontComponent fontTypeTableHan[] = { + { 16, 12, 6, 12, 14*0xbc, (u32)&_binary_f12han_dat, (u32)&_binary_f12han_dat_end}, +}; + + +// functions description------------------------ + +//---------------------------------------------- +// API関数 +//---------------------------------------------- + +// フォントAPIの初期化 +void InitFont( TargetScreen target) +{ + if( font_init & (0x01 << target ) ) { // ターゲットが初期すみならリターン + return; + } + + InitAllocSystemSJIS( target ); // ターゲットのVRAMアリーナ初期化 + + if( target == TOP_SCREEN ) { // ターゲットのエントリを初期化 + InitStrEntryTable( &entryTblM[0] ); + }else { + InitStrEntryTable( &entryTblS[0] ); + } + + if( font_init == 0 ) { // まだ何も初期化されていないなら、スクリーンを初期設定に。 + SetTargetScreenSJIS( target ); + } + + SetFont( (FontType)0 ); + font_init |= 0x01 << target; +} + + +// 表示フォントの切り替え +void SetFont(FontType font) +{ + if(font >= FONT_TYPE_MAX) { + font = (FontType)0; + } + nowFontHan = &fontTypeTableHan[font]; +} + + +// 表示ターゲットスクリーンの切り替え +void SetTargetScreenSJIS( TargetScreen target ) +{ + targetScreen = target; + if( target == TOP_SCREEN ) { + entryTblp = &entryTblM[0]; + bgBakp = bgBakM; + }else { + entryTblp = &entryTblS[0]; + bgBakp = bgBakS; + } +} + + +// 指定されたSJIS文字列を表示する。(ハンドル指定なしでハンドル算出加算値付き) +static u16 DrawStringSJIS_Core(u16 x, u16 y, u16 color, const void *strp, int handleIndex) +{ + StrEntry *sEntryp; + int newEntry; + u16 handle; + u16 charNum; + u16 code; + u16 v_offset = 1; // ※v_offsetは引数にすることもできる。 + + InitFont( targetScreen ); + + // 空文字列チェック + if(*(u8 *)strp == 0x00) { + return 0; + } + + // 文字列表示に必要なキャラクタ数の測定 + charNum = MeasureStringCharWidth((const u8 *)strp); + if(charNum > DRAW_CHAR_NUM_LIMIT) { // 必要キャラクタ数が512以内ならメモリ確保。 + OS_Printf("SJIS-draw: str length max over.\n"); + return DSJIS_ERR_STR_LENGTH_TOO_LONG; + } + + // ハンドル取得 + if( !GetEmptyStrEntry( (u32)handleIndex, &handle ) ) { + OS_Printf("SJIS-draw: error StrEntry get failed.\n"); + return DSJIS_ERR_ENTRY_GET_FAILED; + } + + // 文字列エントリの登録 + newEntry = InsertStrEntry2( handle, charNum ); + if(newEntry < 0) { + OS_Printf("SJIS-draw: error StrEntry alloc failed.\n"); + return DSJIS_ERR_ENTRY_ALLOC_FAILED; + } + sEntryp = GetStrEntry(handle); // エントリへのポインタを格納 + sEntryp->dataAddr = (u32)handleIndex; + + // VRAMキャラメモリの動的確保 + if(newEntry > 0) { + sEntryp->charMemp = AllocMemoryFromVram( charNum * NITRO_CHAR_SIZE * 2 ); + // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 +// OS_Printf("alloc charMemp = %x\n",sEntryp->charMemp); + if( sEntryp->charMemp == NULL ) { // メモリ確保に失敗したら、エントリのメモリを解放してリターン + OS_Printf("VRAM char memory alloc failed.\n"); + OS_Free(sEntryp); + return DSJIS_ERR_CHAR_ALLOC_FAILED; + } + } + + // 文字列エントリの登録 + sEntryp->font = nowFontHan; // 現在のフォントタイプを格納 + sEntryp->drawPos = (u16)(x + y * 0x20); // 表示場所を格納。 + sEntryp->charNum = charNum; + + // 縦配置位置指定v_offsetの矯正 + if(v_offset) { + if(((nowFontHan->tate_dot & 0x07)== 0)) { // 縦8dot or 16dotの場合はv_offsetは0 + v_offset = 0; + }else { + if( (16 - nowFontHan->tate_dot) < v_offset ) { // それ以外の時は、縦16dotに収まる範囲に矯正 + v_offset = (u16)(16 - nowFontHan->tate_dot); + } + } + } + // 対象文字列のフォントデータをビット展開&キャラデータ詰めをおこなって、確保したVRAMキャラメモリに転送 + SpreadStringCloser((u8 *)strp, sEntryp, v_offset); + + // スクリーンデータに今回の文字列のキャラナンバーを書き込み + code = (u16)( (((u32)sEntryp->charMemp - (u32)G2_GetBG1CharPtr()) / NITRO_CHAR_SIZE) | color ); + SetScrData(code, sEntryp, INC_1); + + return handle; +} + +// ハンドルインデックスの算出 +static int CalcHandleIndex(u32 dataAddr, int index) +{ + if(index) { + index += HANDLE_INDEX + (int)dataAddr; // インデックスを加算した場合は、他のデータのアドレスと被らないよう、NITROメモリマップ外になるようオフセットを加算。 + }else { + index = (int)dataAddr; + } + return index; +} + + +// 指定されたSJIS文字列を表示する。(ハンドル指定なし) +u16 DrawStringSJIS(u16 x, u16 y, u16 color, const void *strp) +{ + return DrawStringSJIS_Core( x, y, color, strp, (int)strp); // index = strp でCoreをコール +} + + +// 指定された値を16進数で表示する。(ハンドル指定なし版) +u16 DrawHexSJIS(u16 x, u16 y, u16 color, const void *hexp, u16 figure) +{ + u8 buff[16]; + u8 *strp = HexToString(hexp, buff, figure); + return DrawStringSJIS_Core(x, y, color, strp, (int)hexp); +} + + +// 指定された値を10進数で表示する。(ハンドル指定なし版) +u16 DrawDecimalSJIS(u16 x, u16 y, u16 color, const void *hexp, u16 figure, u16 size) +{ + u8 buff[16]; + u8 *strp = HexToDecimalString(hexp, buff, figure, size); + return DrawStringSJIS_Core(x, y, color, strp, (int)hexp); +} + + +// 指定されたSJIS文字列を表示する。(ハンドル指定なしでハンドル算出加算値付き) +u16 DrawStringSJISEx(u16 x, u16 y, u16 color, const void *strp, int index) +{ + index = CalcHandleIndex( (u32)strp, index); + return DrawStringSJIS_Core( x, y, color, strp, index); // index を加算してCoreをコール +} + + +// 指定された値を16進数で表示する。(ハンドル指定なし版) +u16 DrawHexSJISEx(u16 x, u16 y, u16 color, const void *hexp, u16 figure, int index) +{ + u8 buff[16]; + u8 *strp = HexToString(hexp, buff, figure); + index = CalcHandleIndex( (u32)hexp, index); + return DrawStringSJIS_Core(x, y, color, strp, index); +} + + +// 指定された値を10進数で表示する。(ハンドル指定なし版) +u16 DrawDecimalSJISEx(u16 x, u16 y, u16 color, const void *hexp, u16 figure, u16 size, int index) +{ + u8 buff[16]; + u8 *strp = HexToDecimalString(hexp, buff, figure, size); + index = CalcHandleIndex( (u32)hexp, index); + return DrawStringSJIS_Core(x, y, color, strp, index); +} + + +// 指定コードから始まるスクリーンデータのセット +static void SetScrData(u16 code_top, StrEntry *sEntryp, IncFlag inc_flag) +{ + u16 i; + u16 lastPos; + u16 pos_l; + u16 *buffp_l; + u16 *buffp_h; + + lastPos = 0x800 >> 1; // バッファ最終位置 == BGスクリーンサイズ(0x800) + pos_l = (u16)(sEntryp->drawPos + 0x0020); // 下8dotキャラクタ表示位置 + buffp_h = bgBakp + sEntryp->drawPos; + buffp_l = buffp_h + 0x0020; + + for(i = 0; i < sEntryp->charNum; i++) { + *buffp_h++ = code_top; + code_top += inc_flag; + if(nowFontHan->need_tate_dot == 16) { // 必要縦ドットが16の場合(8ドット文字以外全部)、もう1キャラセット + *buffp_l++ = code_top; + } + code_top += inc_flag; + pos_l++; + if(pos_l == lastPos) { + break; + } + } +} + + +// 指定されたハンドルのSJIS文字列をクリアする。 +void ClearStringSJIS_handle(u16 handle) +{ + StrEntry *sEntryp; + + InitFont( targetScreen ); + + sEntryp = GetStrEntry(handle); + if(sEntryp == NULL) { + return; + } + + // スクリーンデータのクリア + SetScrData(0x0000, sEntryp, NO_INC); + + // キャラクタデータのクリア +// MI_CpuClearFast(sEntryp->charMemp, sEntryp->charNum * NITRO_CHAR_SIZE * 2); + // 動的に確保したVRAMキャラデータのクリア + FreeMemoryToVram( sEntryp->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 + (void)DeleteStrEntry(handle); +} + + +// 指定されたデータアドレスで表示しているSJIS文字列をクリアする。 +void ClearStringSJIS(void *datap) +{ + u16 handle = SearchStrEntry( (u32)datap ); + + if( handle > STR_ENTRY_MAX_NUM ) { + return; + } + ClearStringSJIS_handle(handle); +} + + +// 指定されたデータアドレスで表示しているSJIS文字列をクリアする。Ex系で描画したものを消す場合。 +void ClearStringSJISEx(void *datap, int handleIndex) +{ + u16 handle; + + handleIndex = CalcHandleIndex( (u32)datap, handleIndex); + + handle = SearchStrEntry( (u32)handleIndex ); + + if( handle > STR_ENTRY_MAX_NUM ) { + return; + } + ClearStringSJIS_handle(handle); +} + + + +// 現在登録されている全てのSJIS文字列をクリアする(動的メモリも全て解放) +void ClearAllStringSJIS(void) +{ + u16 handle; + + InitFont( targetScreen ); + + for(handle = 0; handle < STR_ENTRY_MAX_NUM; handle++) { + if( GetStrEntry( handle ) != NULL) { + ClearStringSJIS_handle(handle); + } + } +} + + +// 指定されたハンドルで表示されている文字列のカラーを変更。 +u16 ChangeColorSJIS(u16 handle, u16 new_color) +{ + int i; + u16 *buffp_l; + u16 *buffp_h; + StrEntry *sEntryp = GetStrEntry( handle ); // エントリへのポインタを格納 + + if((handle > STR_ENTRY_MAX_NUM) || (sEntryp == NULL)) { + return 0; + } + + buffp_h = bgBakp + sEntryp->drawPos; + buffp_l = buffp_h + 0x20; + for(i = 0; i < sEntryp->charNum; i++) { + *buffp_h = (u16)((*buffp_h & 0x0fff) | new_color); + *buffp_l = (u16)((*buffp_l & 0x0fff) | new_color); + buffp_h++; + buffp_l++; + } + return 1; +} + +//---------------------------------------------- +// 文字列エントリテーブルの処理 +//---------------------------------------------- + +// エントリテーブルの初期化 +static void InitStrEntryTable( StrEntry **sEntrypp ) +{ + u16 i; + for(i = 0; i < STR_ENTRY_MAX_NUM; i++) { + *sEntrypp++ = NULL; + } +} + + +// 指定されたハンドルのStrEntryポインタを返す +static StrEntry * GetStrEntry( u16 handle ) +{ + if ( handle >= STR_ENTRY_MAX_NUM ) { + return NULL; + }else { +// return entryTblS[ handle ]; + return entryTblp[ handle ]; + } +} + + +// 指定されたハンドルのStrEntryポインタへのポインタを返す +static StrEntry ** GetStrEntryAddress( u16 handle ) +{ + if ( handle >= STR_ENTRY_MAX_NUM ) { + return NULL; + }else { +// return &entryTblS[ handle ]; + return &entryTblp[ handle ]; + } +} + + +// StrEntryの登録 +static int InsertStrEntry(u16 *handle, u16 charNum) +{ + StrEntry **sEntrypp = GetStrEntryAddress( *handle ); + + if(*handle >= STR_ENTRY_MAX_NUM) { + return -1; + }else if(*handle > 0) { + if( *sEntrypp != NULL) { // 指定ハンドルに既にエントリがある場合は、確保メモリ量を新規メモリ量と比べて、 + if( charNum > (*sEntrypp)->charNum ) { // 再確保が必要な場合は、メモリ解放→再確保を行う。 +// OS_Printf("SJIS: same entry free to charMemory.\n"); +// OS_Printf("free charMemp = %x\n",(*sEntrypp)->charMemp); + SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア + FreeMemoryToVram( (*sEntrypp)->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 + return 1; + }else { + if( charNum < (*sEntrypp)->charNum ) { + SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア + } + return 0; // このエントリでは、キャラクタメモリを継続して使用 + } + } + } + + // *handle == 0 // 指定ハンドルが0の時は新しいハンドルを確保 + *handle = 0; + sEntrypp = GetStrEntryAddress( *handle ); + + for( ; *handle < STR_ENTRY_MAX_NUM; (*handle)++ ) { + if( *sEntrypp++ == NULL) { // NULLエントリを探す + break; + } + } + if(*handle == STR_ENTRY_MAX_NUM) { + return -1; // NULLエントリが見つからなかったら、エラー終了。 + } + + // StrEntryのメモリ確保 + *sEntrypp = (StrEntry *)OS_Alloc( sizeof(StrEntry) ); + if( *sEntrypp == NULL) { + OS_Printf("StrEntry allocate failed.\n"); + return -1; + }else { + return 1; + } +} + + +// エントリ挿入処理2 +static int InsertStrEntry2(u16 handle, u16 charNum) +{ + StrEntry **sEntrypp = GetStrEntryAddress( handle ); + + if( *sEntrypp != NULL) { // 指定ハンドルに既にエントリがある場合は、確保メモリ量を新規メモリ量と比べて、 + if( charNum > (*sEntrypp)->charNum ) { // 再確保が必要な場合は、メモリ解放→再確保を行う。 +// OS_Printf("SJIS: same entry free to charMemory.\n"); +// OS_Printf("free charMemp = %x\n",(*sEntrypp)->charMemp); + SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア + FreeMemoryToVram( (*sEntrypp)->charMemp ); // このエントリが確保していたキャラクタメモリの解放。 + return 1; + }else { + if( charNum < (*sEntrypp)->charNum ) { + SetScrData( 0x0000, *sEntrypp, NO_INC ); // スクリーンデータのクリア + } + return 0; // このエントリでは、キャラクタメモリを継続して使用 + } + } + + // StrEntryのメモリを新規確保 + *sEntrypp = (StrEntry *)OS_Alloc( sizeof(StrEntry) ); + if( *sEntrypp == NULL) { + OS_Printf("StrEntry allocate failed.\n"); + return -1; + }else { + return 1; + } +} + + +// 指定されたハンドルのStrEntry要素をエントリテーブルから削除 +static u16 DeleteStrEntry(u16 handle) +{ + StrEntry **sEntrypp = GetStrEntryAddress( handle ); + + if( *sEntrypp == NULL) { + return NULL; + } + + OS_Free( *sEntrypp ); + *sEntrypp = NULL; + + return handle; +} + + +// 空きエントリを探す(あんま効率よくない) +static BOOL GetEmptyStrEntry(u32 dataAddr, u16 *handlep) +{ + int i = SEARCH_ENTRY_MAX_NUM; // 処理が重くなるのを防ぐため、サーチ回数に制限を加える。 + u16 handle = (u16)( (dataAddr >> 2) & (STR_ENTRY_MAX_NUM - 1) ); + + while(i--) { + StrEntry *sEntryp = GetStrEntry( handle ); + if( sEntryp == NULL ) { + *handlep = handle; + return TRUE; // 新規ハンドル位置確保 + }else { + if( sEntryp->dataAddr == dataAddr ) { + *handlep = handle; + return TRUE; // 既存ハンドル位置発見 + } + handle = (u16)( (handle + 1) & (STR_ENTRY_MAX_NUM - 1) ); + } + } + return FALSE; +} + + +// 指定データのハンドルを探す(あんま効率よくない) +static u16 SearchStrEntry(u32 dataAddr) +{ + int i = SEARCH_ENTRY_MAX_NUM; // 処理が重くなるのを防ぐため、サーチ回数に制限を加える。 + u16 handle = (u16)( (dataAddr >> 2) & (STR_ENTRY_MAX_NUM - 1) ); + + while(i--) { + StrEntry *sEntryp = GetStrEntry( handle ); + if(sEntryp != NULL) { + if( sEntryp->dataAddr == dataAddr ) { + return handle; // 既存ハンドル位置発見 + } + } + handle = (u16)( (handle + 1) & (STR_ENTRY_MAX_NUM - 1) ); + } + return 0xffff; +} + + +//---------------------------------------------- +// キャラクタVRAMの動的確保処理 +//---------------------------------------------- + +// 文字列表示に必要なキャラクタ数の測定 +static u16 MeasureStringCharWidth(const u8 *str) +{ + u16 totalWidth = 0; // 文字列のトータルの横ドットサイズ + u16 charNum = 0; // 文字列表示に必要なキャラクタ数 + + // 文字列のトータルの横ドットサイズを算出 + while(*str) { // 各文字は SJIS か ASCII か? + if( ((*str >= SJIS_HIGHER_CODE1_MIN) && (*str <= SJIS_HIGHER_CODE1_MAX)) + || ((*str >= SJIS_HIGHER_CODE2_MIN) && (*str <= SJIS_HIGHER_CODE2_MAX)) ) { + str += 2; // SJIS文字 + totalWidth += nowFontHan->yoko_dot; + }else { + str++; // ASCII文字 + totalWidth += nowFontHan->yoko_dot; + } + } + // トータル横ドット数から、文字列の表示に必要なキャラクタ数を算出 + charNum = (u16)(totalWidth >> 3); + if(totalWidth & 0x0007) { + charNum = (u16)(charNum + 1); + } + + return charNum; +} + + +//---------------------------------------------- +// フォントデータ→NITROキャラデータへの変換関数群 +//---------------------------------------------- + +// 指定された文字列を指定メモリブロックに展開しながら転送(使用フォントによって文字詰めも行う) +static void SpreadStringCloser(u8 *strp, StrEntry *sEntryp, u16 v_offset) +{ + u32 charBuff[(NITRO_CHAR_SIZE * 4) / 4]; // 16x16キャラ2文字で4キャラ分のバッファ。(2文字展開して、文字詰めを行うため) + u8 *charMemp; + u8 *fromAdr; + u16 i; + u16 charNum; + FontPropotion fontPro; + + // Spread target string char data to WRAM pool + charNum = sEntryp->charNum; + charMemp = (u8 *)sEntryp->charMemp; + fontPro.h_offset = 0; + fontPro.leftp = (u16 *)0x0; + fontPro.rightp = (u16 *)0x0; + + while(1) { + // 隣接する2つの1bitフォントデータを16x16ドットキャラクタ配列にロード + if(fontPro.h_offset == 0) { + SetFirstFont(&strp, v_offset, &fontPro); // 表示文字列を16x16ドット単位に区切った時に先頭にくるキャラクタをロード + } + fromAdr = CloseFontChar(&strp, v_offset, &fontPro); // 上記キャラクタに隣接するキャラクタをロード + + // ロードした1bitフォントデータを4bitNITROキャラデータに展開 + SpreadFontZen(3, 1, fromAdr, (u32 *)charBuff); // キャラクタデータを4bitに展開。 + + // 展開したキャラデータをVRAMにコピー + fromAdr = (u8 *)charBuff; + for(i = 0; i < 2; i++) { // 生成した16x16ドット(4キャラ)分のデータを転送 + MI_CpuCopyFast(fromAdr, charMemp, (NITRO_CHAR_SIZE * 2)); + fromAdr += NITRO_CHAR_SIZE * 2; + charMemp+= NITRO_CHAR_SIZE * 2; + if(--charNum == 0) { + return; + } + } + } +} + + +// 最初のフォントデータをバッファにセット +static void SetFirstFont(u8 **strpp, u16 v_offset, FontPropotion *fontProp) +{ + u8 tate; + u8 *fontAdr; + u16 *firstp; + const FontComponent *fontComp; + + if(**strpp == 0x00) { + return; + } + + fontAdr = (u8 *)CalcCharCodeAddress(strpp, &fontComp); // 今回の文字のコードから、フォントデータ格納アドレスを算出。 + + MI_CpuClearFast(fontProp->buff16x16[0], 64); // 16x16ドット単位の一時展開バッファのクリア + + firstp = (u16 *)fontProp->buff16x16[0] + v_offset; + for(tate = 0; tate < fontComp->tate_dot - 1; tate++) { + *firstp = (u16)(*fontAdr++ << 8); + if(fontComp->yoko_dot > 8) { + *firstp |= *fontAdr++; + } + firstp++; + } + fontProp->h_offset = fontComp->yoko_dot; + fontProp->leftp = (u16 *)fontProp->buff16x16[0]; + fontProp->rightp = (u16 *)fontProp->buff16x16[1]; +} + + +// 隣接するフォントデータをバッファにセット +static u8 * CloseFontChar(u8 **strpp, u16 v_offset, FontPropotion *fontProp) +{ + u8 tate; + u8 *fontAdr; + u16 *temp; + u16 *leftp_tmp; + u16 *rightp_tmp; + const FontComponent *fontComp; + + while(fontProp->h_offset < 16) { + if(**strpp == 0x00) { + break; + } + + fontAdr = (u8 *)CalcCharCodeAddress(strpp, &fontComp); // 今回の文字のコードから、フォントデータ格納アドレスを算出。 + + leftp_tmp = fontProp->leftp + v_offset; // フォントデータを横ドット詰めしながらロード + rightp_tmp = fontProp->rightp + v_offset; + for(tate=0; tate < fontComp->tate_dot - 1; tate++) { + *rightp_tmp = (u16)(*fontAdr++ << 8); + if(fontComp->yoko_dot > 8) { + *rightp_tmp |= *fontAdr++; + } + + *leftp_tmp |= *rightp_tmp >> fontProp->h_offset; + *rightp_tmp <<= 16 - fontProp->h_offset; + leftp_tmp++; + rightp_tmp++; + } + fontProp->h_offset += fontComp->yoko_dot; + } + fontProp->h_offset -= 16; + temp = fontProp->leftp; + fontProp->leftp = fontProp->rightp; + fontProp->rightp = temp; + return (u8 *)temp; +} + + +// 文字コードに対応したフォントデータ格納アドレスを算出する。 +static u32 CalcCharCodeAddress(u8 **strpp, const FontComponent **font) +{ + u8 higher_code; + u8 lower_code; + u16 sjis_code; + u32 adr; + + // 対象文字が SJIS or ASCII かを判定 + higher_code = *(*strpp)++; + if( ((higher_code >= SJIS_HIGHER_CODE1_MIN) && (higher_code <= SJIS_HIGHER_CODE1_MAX)) + ||((higher_code >= SJIS_HIGHER_CODE2_MIN) && (higher_code <= SJIS_HIGHER_CODE2_MAX)) ) { // SJISか? + lower_code = *(*strpp)++; + *font = nowFontHan; + }else { // ASCII + sjis_code = tbl_ASCII_to_SJIS[higher_code]; + higher_code = (u8)(sjis_code >> 8); + lower_code = (u8)(sjis_code & 0x00ff); + *font = nowFontHan; + } + + // 文字コードからフォントデータアドレスを算出 + if(higher_code <= SJIS_HIGHER_CODE1_MIN + 3) { + higher_code -= 0x81; + }else if(higher_code <= SJIS_HIGHER_CODE1_MIN + 6) { + higher_code -= 0x83; + }else if(higher_code <= SJIS_HIGHER_CODE1_MAX) { + higher_code -= 0x84; + }else if(higher_code >= SJIS_HIGHER_CODE2_MIN) { + higher_code -= 0xc4; + } + + if(lower_code < 0x80) { + lower_code -= 0x40; + }else { + lower_code -= 0x41; + } + + adr = (*font)->start_adr + +((*font)->org_row_size) * higher_code + +((*font)->org_char_size+2) * lower_code + 2; + + return adr; +} + + +// 指定バッファの1bitフォントデータを4bitNITROキャラデータに展開。 +static void SpreadFontZen(u16 bit0_color, u16 bit1_color, u8 *fromAdr, u32 *toAdr) +{ + int i; + u8 tate; + u8 yoko; + u8 rd_data; + u32 wr_data; + u32 b0c; + u32 b1c; + u32 *toAdr_left; + u32 *toAdr_right; + + toAdr_left = toAdr; + toAdr_right = toAdr + 16; // toAdr + (16 * 4byte) + + for(tate = 0; tate < nowFontHan->need_tate_dot; tate++) { // キャラクタの縦ドット数だけ展開 + // 左右それぞれの8dotキャラを展開 + for(yoko = 0; yoko < 2; yoko++) { + wr_data = 0x00000000; // ライトデータ初期化 + + if(tate < nowFontHan->tate_dot) { + rd_data = *fromAdr++; // 左右8dotキャラの読み出し + b0c = (u32)bit0_color; // bit0 のカラー + b1c = (u32)bit1_color; // bit1 のカラー + + for(i = 0; i < 8; i++) { // 8dot分の各1bitの判定 + if(rd_data & 0x80) { + wr_data |= b1c; // "1"をカラー1へ + }else { + wr_data |= b0c; // "0"をカラー0へ + } + rd_data <<= 1; + b0c <<= 4; + b1c <<= 4; + } + } + + if(yoko==0) { + *toAdr_right++ = wr_data; // 32bit書きこみ + }else { + *toAdr_left++ = wr_data; + } + } + } +} + + +//---------------------------------------------- +// MALLOCシステムの初期化 +//---------------------------------------------- + +// VRAM上にヒープを作成。(アリーナにVRAMはないので、WRAM_MAIN, WRAM_SUBのアリーナで代用) +static void InitAllocSystemSJIS( TargetScreen target ) +{ + void* tempLo; + OSHeapHandle hh; + + // VRAM上にヒープを作成 + + if( target == TOP_SCREEN ) { + // メインLCD + OS_SetArenaLo( OS_ARENA_WRAM_MAIN, (void *)VRAM_M_ARENA_LO ); + OS_SetArenaHi( OS_ARENA_WRAM_MAIN, (void *)VRAM_M_ARENA_HI ); + tempLo = OS_InitAlloc( OS_ARENA_WRAM_MAIN, OS_GetWramMainArenaLo(), OS_GetWramMainArenaHi(), 1 ); + OS_SetArenaLo( OS_ARENA_WRAM_MAIN, tempLo ); + + hh = OS_CreateHeap( OS_ARENA_WRAM_MAIN, OS_GetWramMainArenaLo(), OS_GetWramMainArenaHi() ); + if(hh < 0) OS_Panic( "ARM9-MAIN LCD: Fail to create heap...\n" ); + OS_Printf( " arena lo = %x\n", OS_GetWramMainArenaLo() ); + OS_Printf( "WRAM arena hi = %x\n", OS_GetWramMainArenaHi() ); + hh = OS_SetCurrentHeap( OS_ARENA_WRAM_MAIN, hh ); + }else { // BOTTOM_SCREEN + // サブLCD + OS_SetArenaLo( OS_ARENA_WRAM_SUB, (void *)VRAM_S_ARENA_LO ); + OS_SetArenaHi( OS_ARENA_WRAM_SUB, (void *)VRAM_S_ARENA_HI ); + tempLo = OS_InitAlloc( OS_ARENA_WRAM_SUB, OS_GetWramSubArenaLo(), OS_GetWramSubArenaHi(), 1 ); + OS_SetArenaLo( OS_ARENA_WRAM_SUB, tempLo ); + + hh = OS_CreateHeap( OS_ARENA_WRAM_SUB, OS_GetWramSubArenaLo(), OS_GetWramSubArenaHi() ); + if(hh < 0) OS_Panic( "ARM9-SUB LCD: Fail to create heap...\n" ); + OS_Printf( "WRAM arena lo = %x\n", OS_GetWramSubArenaLo() ); + OS_Printf( "WRAM arena hi = %x\n", OS_GetWramSubArenaHi() ); + hh = OS_SetCurrentHeap( OS_ARENA_WRAM_SUB, hh ); + } +} + + +// VRAMへのキャラメモリ確保 +static void *AllocMemoryFromVram( int size ) +{ + if ( targetScreen == TOP_SCREEN ) { + return OS_AllocFromWramMain( size ); // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 + }else { + return OS_AllocFromWramSub ( size ); // ※縦も2キャラ分必要なので、NITRO_CHAR_SIZE*2 + } +} + + +// VRAMへのキャラメモリ解放 +static void FreeMemoryToVram( void *p ) +{ + if ( targetScreen == TOP_SCREEN ) { + OS_FreeToWramMain( p ); + }else { + OS_FreeToWramSub( p ); + } +} + + +//---------------------------------------------- +// 16進データを文字列に変換 +//---------------------------------------------- + +// メインメモリからでも大丈夫な形式での1byteのデータ読み出し。 +__inline static u16 ReadByteHWBus(const void *srcp) +{ + if((int)srcp & 0x00000001) return (u16)(*(u16 *)((int)srcp ^ 0x00000001) >> 8); + else return (u16)(*(u16 *)(srcp) & 0x00ff); +} + +// 16進データを10進文字列に変換 +static u8 *HexToDecimalString(const void *hexp, u8 *strp, u16 figure, u16 size) +{ + u16 i; + u32 target = 0; + + for(i = 0; i < size; i++) { + target |= ReadByteHWBus( ((u8 *)hexp)++ ) << (8 * i); + } + + strp += figure; + *strp-- = 0x00; + for(i = 0; i < figure; i++) { + CP_SetDiv32_32(target, 10); + *strp-- = (u8 )(CP_GetDivRemainder32() + 0x30); + target = (u32) CP_GetDivResult32(); + } + return (strp + 1); +} + + +// 16進データを16進文字列に変換 +static u8 *HexToString(const void *hexp, u8 *strp, u16 figure) +{ + u16 i; + u8 hex; + + strp += figure; + *strp-- = 0x00; + + for(i = 0; i < figure; i++){ + hex = (u8)ReadByteHWBus(hexp); + if(i & 0x01){ + hex = (u8)( (hex >> 4) & 0x0f); + ((u8 *)hexp)++; + }else{ + hex = (u8)( hex & 0x0f); + } + if(hex < 0x000a) hex += 0x30; + else hex += 0x41 - 0x0a; + *strp-- = hex; + } + return (strp + 1); +} + + +//---------------------------------------------- +// ASCII -> SJIS 変換テーブル +//---------------------------------------------- + +const u16 tbl_ASCII_to_SJIS[0x100] = { + // 00 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + // 10 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + // 20 + 0x8140,0x8149,0x8168,0x81f2,0x8190,0x8193,0x8195,0x8166, + 0x8169,0x816a,0x8196,0x817b,0x8143,0x817c,0x8144,0x815e, + // 30 + 0x824f,0x8250,0x8251,0x8252,0x8253,0x8254,0x8255,0x8256, + 0x8257,0x8258,0x8146,0x8147,0x8183,0x8181,0x8184,0x8148, + // 40 + 0x8197,0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266, + 0x8267,0x8268,0x8269,0x826a,0x826b,0x826c,0x826d,0x826e, + // 50 + 0x826f,0x8270,0x8271,0x8272,0x8273,0x8274,0x8275,0x8276, + 0x8277,0x8278,0x8279,0x816d,0x818f,0x816e,0x814f,0x8151, + // 60 + 0x8165,0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287, + 0x8288,0x8289,0x828a,0x828b,0x828c,0x828d,0x828e,0x828f, + // 70 + 0x8290,0x8291,0x8292,0x8293,0x8294,0x8295,0x8296,0x8297, + 0x8298,0x8299,0x829a,0x816f,0x8162,0x8170,0x8160,0x81fc, + + // 80 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + // 90 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + // a0 + 0x81fc,0x8142,0x8175,0x8176,0x8141,0x8145,0x8192,0x8340, + 0x8342,0x8344,0x8346,0x8348,0x8383,0x8385,0x8387,0x8362, + // b0 + 0x815b,0x8341,0x8343,0x8345,0x8347,0x8349,0x834a,0x834c, + 0x834e,0x8350,0x8352,0x8354,0x8356,0x8358,0x835a,0x835c, + // c0 + 0x835e,0x8360,0x8363,0x8365,0x8367,0x8369,0x836a,0x836b, + 0x836c,0x836d,0x836e,0x8371,0x8374,0x8377,0x837a,0x837d, + // d0 + 0x837e,0x837f,0x838a,0x8382,0x8384,0x8386,0x8388,0x8389, + 0x838a,0x838b,0x838c,0x838d,0x838f,0x8393,0x814a,0x814b, + + // e0 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + // f0 + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, + 0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc,0x81fc, +}; + diff --git a/build/tests/DispOwnerInfo/src/font.h b/build/tests/DispOwnerInfo/src/font.h new file mode 100644 index 00000000..3d13af9a --- /dev/null +++ b/build/tests/DispOwnerInfo/src/font.h @@ -0,0 +1,123 @@ +/********************************************************************/ +/* font.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + フォント処理ヘッダ + + + $Log: font.h,v $ + Revision 1.2 2005/03/09 04:44:39 yosiokat + 機能追加。 + + Revision 1.1.1.1 2004/08/31 06:20:24 Yosiokat + no message + + + + + // **** old logs **** + + Revision 1.7 2004/08/18 07:17:26 Yosiokat + 上下LCDをターゲットにして、別個に初期化できるよう変更。 + + Revision 1.6 2004/08/17 07:52:03 Yosiokat + ・SetTargetScreenSJISを追加して、上下LCDのどちらにも文字表示が可能になるよう変更。 + + Revision 1.5 2004/08/07 05:44:43 Yosiokat + ・SJIS文字列表示関数を引数でハンドルを指定しない仕様に変更する。 + ・上記変更に対応して、クリア関数も仕様変更。 + + Revision 1.4 2004/07/13 00:31:48 Yosiokat + ・サブLCD側のVRAMを対象にするよう変更。 + + Revision 1.3 2004/06/06 02:39:31 Yosiokat + SJISコード判定用の定数定義をfont.hに移動。 + + Revision 1.2 2004/05/26 01:16:57 Yosiokat + 文字制御をSJISベースに変更中。 + + Revision 1.1 2004/05/25 08:59:22 Yosiokat + 文字列をSJISで制御するように変更。 + + +*/ + +#ifndef __FONT_H_ +#define __FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// define data---------------------------------- +#define STR_ENTRY_MAX_NUM 256 // 登録可能な文字列データの最大個数 + +#define SJIS_CHAR_VRAM_OFFSET 0x100 // SJIS文字列キャラクタ用VRAMのオフセット値 +#define SJIS_CHAR_VRAM_SIZE (0x8000 + 0x20) //   〃          のサイズ(0x20はヒープのヘッダ) + +#define VRAM_M_ARENA_LO (HW_BG_VRAM + SJIS_CHAR_VRAM_OFFSET - 0x20) +#define VRAM_M_ARENA_HI (VRAM_M_ARENA_LO + SJIS_CHAR_VRAM_SIZE) +#define VRAM_S_ARENA_LO (HW_DB_BG_VRAM + SJIS_CHAR_VRAM_OFFSET - 0x20) +#define VRAM_S_ARENA_HI (VRAM_S_ARENA_LO + SJIS_CHAR_VRAM_SIZE) + // VRAMアリーナのLo & Hi + // SJISコード判定用の値 +#define SJIS_HIGHER_CODE1_MIN 0x81 +#define SJIS_HIGHER_CODE1_MAX 0x9f +#define SJIS_HIGHER_CODE2_MIN 0xe0 +#define SJIS_HIGHER_CODE2_MAX 0xea + +// 関数のエラーリターン値 +#define DSJIS_ERR_ENTRY_GET_FAILED 0x8000 +#define DSJIS_ERR_ENTRY_ALLOC_FAILED 0x8001 +#define DSJIS_ERR_CHAR_ALLOC_FAILED 0x8002 +#define DSJIS_ERR_STR_MEMORY_OVER 0x8003 +#define DSJIS_ERR_STR_LENGTH_TOO_LONG 0x8004 + +// SetTargetScreenSJISの引数target +typedef enum TargetScreen { + TOP_SCREEN =0, + BOTTOM_SCREEN +}TargetScreen; + +// フォント種類データ(SelectFontで指定) +typedef enum FontType{ // 全角  半角 + FONT12, // 12x12 & 12x 7dot + FONT_TYPE_MAX +}FontType; + + +// function's prototype declaration------------- + +void InitFont( TargetScreen target ); +void SetFont( FontType font ); +void SetTargetScreenSJIS( TargetScreen target ); +u16 ChangeColorSJIS( u16 handle, u16 new_color ); + +// 以下の表示関数は、データアドレスからデータハンドルを算出するので、ハンドルを引数で与えなくて良いが、同一アドレスのデータを複数場所に配置することができない。 +u16 DrawStringSJIS ( u16 x, u16 y, u16 color, const void *str ); +u16 DrawHexSJIS ( u16 x, u16 y, u16 color, const void *hexp, u16 figure ); +u16 DrawDecimalSJIS( u16 x, u16 y, u16 color, const void *hexp, u16 figure, u16 size ); + +// Ex系は、引数にindexを設けることで、上記関数で制限されている同一アドレスデータの複数場所配置に対応している。 +u16 DrawStringSJISEx ( u16 x, u16 y, u16 color, const void *strp, int index ); +u16 DrawHexSJISEx ( u16 x, u16 y, u16 color, const void *hexp, u16 figure, int index ); +u16 DrawDecimalSJISEx( u16 x, u16 y, u16 color, const void *hexp, u16 figure, u16 size, int index ); + +// 表示文字列クリア関数 +void ClearStringSJIS( void *datap ); +void ClearStringSJISEx( void *datap, int handleIndex ); +void ClearStringSJIS_handle( u16 handle ); +void ClearAllStringSJIS( void ); + + +#ifdef __cplusplus +} +#endif + +#endif // __FONT_H_ + diff --git a/build/tests/DispOwnerInfo/src/initFunc.c b/build/tests/DispOwnerInfo/src/initFunc.c new file mode 100644 index 00000000..ceb4211d --- /dev/null +++ b/build/tests/DispOwnerInfo/src/initFunc.c @@ -0,0 +1,149 @@ +/********************************************************************/ +/* initFunc.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + 初期化関数群 + + $Log: initFunc.c,v $ + Revision 1.2.10.1 2007/01/22 07:36:16 yosiokat + NAT-IPL2への対応。 + + Revision 1.2.2.1 2006/02/06 11:34:35 yosiokat + GetIPL2CRC16をUSG-IPL2-WW版でのコードのNVRAM格納フォーマットが変更されたことに + 対応させる。 + + Revision 1.2 2005/04/02 07:42:19 yosiokat + IPL2フォントを"s"に変更。 + + Revision 1.1 2005/04/02 06:41:18 yosiokat + main.cから起動時の初期化関数を分離。 + + +*/ + + +#include +#include "data.h" +#include "main.h" + +// define data--------------------------------------------- + +// extern data--------------------------------------------- + +// function's prototype------------------------------------ + +// global variables---------------------------------------- +u32 ipl2_crc32 = 0; + +// static variables---------------------------------------- + + +// const data---------------------------------------------- + + +// ================================================================== +/* function */ + +// 表示系初期化 +void InitDisp( void ) +{ + // メインLCD + { + GX_SetBankForBG ( GX_VRAM_BG_128_A ); //  〃     BG 用 + GX_SetBankForOBJ( GX_VRAM_OBJ_32_FG ); //  〃     OBJ用 + GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D ); + G2_SetBG1Control( GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 256 colors mode + GX_BG_SCRBASE_0xf000, // screen base offset + 0x0000 is the address for BG #0 screen + GX_BG_CHARBASE_0x00000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + G2_SetBG1Priority( 3 ); + G2_BG1Mosaic( FALSE ); + G2_SetBG2ControlText( GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, + GX_BG_CHARBASE_0x10000 + ); + G2_SetBG2Priority( 2 ); + G2_BG2Mosaic( FALSE ); + MI_CpuClearFast( (void *)HW_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_OBJ_VRAM, 0x8000 ); // OBJ-VRAM クリア + MI_CpuClearFast( (void *)HW_PLTT, HW_PLTT_SIZE ); // パレット クリア // NitroSDKではcrt0.cでクリアしている。 + MI_CpuFill32( (void *)HW_OAM, 192, HW_OAM_SIZE ); // OAM クリア // NitroSDKではcrt0.cでクリアしている。 + MI_CpuCopyFast( myPlttData, (void *)( HW_BG_PLTT + 2 * 16 ), sizeof(myPlttData) ); // BGパレット セット + MI_CpuCopyFast( myPlttData, (void *)( HW_BG_PLTT + 2 * 16 ), sizeof(myPlttData) ); // OBJパレット セット + } + // サブLCD + { + GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + GX_SetBankForSubBG ( GX_VRAM_SUB_BG_128_C ); // VRAM-C for BGs + GX_SetBankForSubOBJ( GX_VRAM_SUB_OBJ_128_D ); // VRAM-D for BGs + GXS_SetGraphicsMode( GX_BGMODE_0 ); // BGMODE is 0 + G2S_SetBG1Control( GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 256 colors mode + GX_BG_SCRBASE_0xf000, // screen base offset + 0x0000 is the address for BG #0 screen + GX_BG_CHARBASE_0x00000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + G2S_SetBG1Priority( 3 ); + G2S_BG1Mosaic( FALSE ); + G2S_SetBG2ControlText( GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, + GX_BG_CHARBASE_0x10000 + ); + G2S_SetBG2Priority( 2 ); + G2S_BG2Mosaic( FALSE ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 ); // display only BG #0 + MI_CpuFill32( (void *)HW_DB_OAM, 192, HW_OAM_SIZE ); // OAM クリア + MI_CpuClearFast( (void *)HW_DB_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_DB_OBJ_VRAM, 0x20000 ); // OBJ -VRAM クリア + MI_CpuCopyFast( myPlttData, (void *)( HW_DB_BG_PLTT + 2 * 16 ), sizeof(myPlttData) ); // BGパレット セット + MI_CpuCopyFast( myPlttData, (void *)( HW_DB_BG_PLTT + 2 * 16 ), sizeof(myPlttData) ); // OBJパレット セット + } +} + + +//--------------------------------------------------------------------------- +// IPL2フォント初期化 +//--------------------------------------------------------------------------- +void InitIPL2Font( void ) +{ + // フォントインスタンスの作成。 + // 描画用のキャラクタバッファを作成。 + fnt_CreateFont( &font_m, NITRO_LC_Font_s_bnfr, NITRO_LC_Font_s_bncmp ); + fnt_CreateDrawContext( &context_m, canvas_m, CANVAS_WIDTH, CANVAS_HEIGHT, FNT_DCTYPE_4BITS, &font_m ); + + fnt_CreateFont( &font_s, NITRO_LC_Font_s_bnfr, NITRO_LC_Font_s_bncmp ); + fnt_CreateDrawContext( &context_s, canvas_s, CANVAS_WIDTH, CANVAS_HEIGHT, FNT_DCTYPE_4BITS, &font_s ); + + InitIPL2FontBG(); +} + +//--------------------------------------------------------------------------- +// IPL2フォント表示用スクリーン&パレット初期化 +//--------------------------------------------------------------------------- +void InitIPL2FontBG( void ) +{ + int x, y; + + GX_LoadBGPltt ( s_Palette, 0, sizeof(s_Palette) ); + GXS_LoadBGPltt( s_Palette, 0, sizeof(s_Palette) ); + for ( y = 0 ; y < (CANVAS_HEIGHT >> 3) ; ++y ) { + for ( x = 0 ; x < (CANVAS_WIDTH >> 3) ; ++x ) { + screen_m[ y * 32 + x] = (u16)(y * 32 + x); + screen_s[ y * 32 + x] = (u16)(y * 32 + x); + } + } + DC_FlushRange ( screen_m, (CANVAS_WIDTH >> 3) * (CANVAS_HEIGHT >> 3) * 2 ); + GX_LoadBG2Scr ( screen_m, 0, (CANVAS_WIDTH >> 3) * (CANVAS_HEIGHT >> 3) * 2 ); + MI_CpuFillFast( canvas_m, 0, sizeof(canvas_m) ); + + DC_FlushRange ( screen_s, (CANVAS_WIDTH >> 3) * (CANVAS_HEIGHT >> 3) * 2 ); + GXS_LoadBG2Scr( screen_s, 0, (CANVAS_WIDTH >> 3) * (CANVAS_HEIGHT >> 3) * 2 ); + MI_CpuFillFast( canvas_s, 0, sizeof(canvas_s) ); +} diff --git a/build/tests/DispOwnerInfo/src/main.c b/build/tests/DispOwnerInfo/src/main.c new file mode 100644 index 00000000..4929f803 --- /dev/null +++ b/build/tests/DispOwnerInfo/src/main.c @@ -0,0 +1,167 @@ +/********************************************************************/ +/* main.c */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + メイン + + $Log: main.c,v $ + Revision 1.7 2005/04/06 08:26:57 yosiokat + IPL2フォントチェックでのメモリ確保サイズ増加に伴い、ヒープサイズを0x100000に増加。 + + Revision 1.6 2005/04/02 07:41:57 yosiokat + ・IPL2フォント表示に対応。 + ・起動時の初期化ルーチンをinitFunc.cに分離。 + + Revision 1.5 2005/04/01 05:46:48 yosiokat + デバッグ変数&表示追加。 + + Revision 1.4 2005/03/31 05:58:17 yosiokat + ・NVRAMアクセス関数を修正し、別ソースに分離。 + ・IPL2ヘッダ情報取得を専用関数を用いるよう変更。 + ・GetIPL2CRC16のNVRAMアクセス関数を変更。 + + Revision 1.3 2005/03/09 04:44:39 yosiokat + 機能追加。 + + Revision 1.2 2004/09/23 11:28:32 Yosiokat + 本体フラッシュに格納されているIPL2 verを表示するよう変更。 + + Revision 1.1.1.1 2004/08/31 06:20:24 Yosiokat + no message + + +*/ + + +#include +#include "data.h" +#include "main.h" + +// define data--------------------------------------------- + +// extern data--------------------------------------------- + +// function's prototype------------------------------------ +static void VBlankIntr( void ); + +// global variables---------------------------------------- + +// static variables---------------------------------------- + + +// const data---------------------------------------------- + + + +// ================================================================== +/* function */ + +static const char *isbn[4] = { "0-000000-00-0", "000-0000-000", "0000", " 000" }; + +// メイン +void NitroMain( void ) +{ + /* OS 初期化 */ + OS_InitPrintServer(); + OS_Init(); +// OS_InitChina(); // SDK 2.01の場合 +// OS_InitChina( isbn ); // SDK 5.1 の場合 + PXI_InitFifo(); + OS_InitThread(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + TP_Init(); + (void)RTC_Init(); + + /* GX 初期化 */ + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + /* Vブランク割込設定 */ + (void)OS_SetIrqFunction( OS_IE_V_BLANK, VBlankIntr ); + (void)OS_EnableIrqMask( OS_IE_V_BLANK ); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + (void)GX_VBlankIntr( TRUE ); + + { /* メモリ割り当ての初期化 */ + enum { MAIN_HEAP_SIZE = 0x100000 } ; + void *heapStart, *nstart; + int hh; + + nstart = OS_InitAlloc( OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 16 ); + OS_SetMainArenaLo( nstart ); + heapStart = OS_AllocFromMainArenaLo( (u32)MAIN_HEAP_SIZE, 32 ); + hh = OS_CreateHeap( OS_ARENA_MAIN, heapStart, (void*)( (u32)heapStart + MAIN_HEAP_SIZE ) ); + (void)OS_SetCurrentHeap( OS_ARENA_MAIN, hh ); + } + + { /* FS 初期化 */ + static u32 fs_tablework[0x100 / 4]; + FS_Init(FS_DMA_NOT_USE); + (void)FS_LoadTable(fs_tablework, sizeof(fs_tablework)); + } + + // Disp初期化 + InitDisp(); + InitIPL2Font(); + /* 表示開始 */ + GX_DispOn(); + GXS_DispOn(); + + // 初期メインループ関数の設定 + pad.cont = 0xffff; + + SEQ_DispNCD_init(); + nowProcess = SEQ_DispNCD; + + /* メインループ */ + while(1) { + SVC_WaitVBlankIntr(); + ReadKeyPad(); + + (void)nowProcess(); + + OS_PrintServer(); + } +} + + +// Vブランク割り込み処理 +static void VBlankIntr( void ) +{ + // OAM, BG-VRAMの更新 + DC_FlushRange ( oamBakM, sizeof(oamBakM) ); + DC_FlushRange ( oamBakS, sizeof(oamBakS) ); + DC_FlushRange ( bgBakM, sizeof(bgBakM) ); + DC_FlushRange ( bgBakS, sizeof(bgBakS) ); + MI_CpuCopyFast( oamBakM, (void*)HW_OAM, sizeof(oamBakM) ); + MI_CpuCopyFast( oamBakS, (void*)HW_DB_OAM, sizeof(oamBakS) ); + MI_CpuCopyFast( bgBakM, (void*)(HW_BG_VRAM + 0xf000), sizeof(bgBakM) ); + MI_CpuCopyFast( bgBakS, (void*)(HW_DB_BG_VRAM + 0xf000), sizeof(bgBakS) ); + + // BG2キャラクタに転送。 + DC_FlushRange ( context_m.canvas, sizeof( canvas_m ) ); + GX_LoadBG2Char ( context_m.canvas, 0, sizeof( canvas_m ) ); + DC_FlushRange ( context_s.canvas, sizeof( canvas_s ) ); + GXS_LoadBG2Char( context_s.canvas, 0, sizeof( canvas_s ) ); + + //---- 割り込みチェックフラグ + OS_SetIrqCheckFlag( OS_IE_V_BLANK ); +} + + +// キー入力データ読み出し +void ReadKeyPad( void ) +{ + u16 readData = PAD_Read(); + pad.trg = (u16)(readData & (readData ^ pad.cont)); // トリガ 入力 + pad.cont = readData; // ベタ 入力 +} + diff --git a/build/tests/DispOwnerInfo/src/main.h b/build/tests/DispOwnerInfo/src/main.h new file mode 100644 index 00000000..e654fccb --- /dev/null +++ b/build/tests/DispOwnerInfo/src/main.h @@ -0,0 +1,41 @@ +/********************************************************************/ +/* main.h */ +/* DebugForIPL2 */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + メイン定義 ヘッダ +*/ + +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include +#include "myFunc.h" + +// define data-------------------------------------------- +#define MSG_VIEW_COUNT 30 + + +// function----------------------------------------------- +extern void SEQ_DispNCD_init( void ); +extern int SEQ_DispNCD( void ); + +// プログラム起動時に使用 +extern void InitDisp( void ); +extern void InitIPL2Font( void ); +extern void InitIPL2FontBG( void ); +extern void ReadKeyPad( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __MAIN_H__ diff --git a/build/tests/DispOwnerInfo/src/myChar.c b/build/tests/DispOwnerInfo/src/myChar.c new file mode 100644 index 00000000..1787d52d --- /dev/null +++ b/build/tests/DispOwnerInfo/src/myChar.c @@ -0,0 +1,667 @@ +/********************************************************************/ +/* myChar.c */ +/* NITRO-IPL */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + キャラクタ&パレットデータ + + + $Log: myChar.c,v $ + Revision 1.1 2005/02/08 04:41:25 yosiokat + 新規追加。 + + Revision 1.2 2004/05/19 08:25:28 yosiokat + 更新ログの追加。 + + +*/ + +#include "myFunc.h" + +// パレットデータ-------------------------------------------------------------- + +// キャラクタデータ------------------------------------------------------------ +const u16 myChar[0x2800*8/16]={ + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //0 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //3 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //4 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //6 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //c + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //d + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //e + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //f + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //10 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //11 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //12 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //14 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //15 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //16 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //17 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //18 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //19 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1a + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1b + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1c + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1d + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1e + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //1f + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //20 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //21 + 0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x2333,0x3332, + 0x2113,0x3211,0x2113,0x3211,0x2123,0x3212,0x3213,0x3321, //22 + 0x3323,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x2133,0x3321,0x1113,0x3211,0x2123,0x3321, //23 + 0x2133,0x3321,0x1113,0x3211,0x2123,0x3321,0x3233,0x3332, + 0x3333,0x3333,0x1333,0x3332,0x1133,0x3211,0x1213,0x3322, //24 + 0x1123,0x3311,0x1233,0x2112,0x1113,0x3211,0x1223,0x3322, + 0x3333,0x3333,0x2133,0x2133,0x1213,0x3212,0x2123,0x3321, //25 + 0x1233,0x3212,0x2133,0x2121,0x3213,0x3212,0x3323,0x3323, + 0x3333,0x3333,0x1133,0x3331,0x2113,0x3212,0x1123,0x3321, //26 + 0x2113,0x2111,0x3213,0x3213,0x1123,0x2121,0x2233,0x3232, + 0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333, //27 + 0x3233,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //28 + 0x1333,0x3332,0x1333,0x3332,0x2333,0x3331,0x3333,0x3312, + 0x3333,0x3333,0x3133,0x3333,0x1233,0x3333,0x2333,0x3321, //29 + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333, + 0x3333,0x3333,0x1333,0x3332,0x1213,0x3212,0x1133,0x3321, //2a + 0x1233,0x3332,0x1133,0x3321,0x1213,0x3212,0x1323,0x3222, + 0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //2b + 0x1113,0x3211,0x1223,0x3222,0x1333,0x3332,0x2333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2c + 0x1133,0x3332,0x1133,0x3332,0x1233,0x3332,0x2133,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2d + 0x1113,0x3211,0x2223,0x3222,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //2e + 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x2233,0x3333, + 0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x3333,0x3321, //2f + 0x1333,0x3332,0x2133,0x3333,0x3213,0x3333,0x3323,0x3333, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //30 + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1333,0x3321,0x1133,0x3321,0x1233,0x3321, //31 + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //32 + 0x2113,0x3322,0x2113,0x3333,0x1113,0x2111,0x2223,0x3222, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x2112,0x1133,0x3211, //33 + 0x2233,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x3333,0x3211,0x1333,0x3211,0x2133,0x3211, //34 + 0x3213,0x3211,0x1113,0x2111,0x2223,0x3211,0x3333,0x3322, + 0x3333,0x3333,0x1113,0x3211,0x2213,0x3322,0x1113,0x3211, //35 + 0x2223,0x2112,0x3333,0x2113,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x1113,0x3211, //36 + 0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1113,0x2111,0x2223,0x2122,0x3333,0x3213, //37 + 0x3333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3332, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x1123,0x3211, //38 + 0x2113,0x2112,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //39 + 0x1123,0x2111,0x2233,0x2112,0x1133,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3a + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, //3b + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x2333,0x3321, + 0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x2133,0x3333, //3c + 0x2133,0x3333,0x1233,0x3333,0x2333,0x3321,0x3333,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //3d + 0x2233,0x3222,0x1133,0x3211,0x2233,0x3222,0x3333,0x3333, + 0x3333,0x3333,0x1333,0x3333,0x2333,0x3331,0x3333,0x3212, //3e + 0x3333,0x3213,0x3333,0x3321,0x1333,0x3332,0x2333,0x3333, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //3f + 0x3223,0x3211,0x1333,0x3321,0x2333,0x3332,0x1333,0x3321, + 0x3333,0x3333,0x1133,0x3321,0x2213,0x3212,0x1213,0x2121, //40 + 0x2113,0x2121,0x2113,0x2121,0x1213,0x3211,0x1123,0x2121, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //41 + 0x1113,0x2111,0x2113,0x2112,0x2113,0x2113,0x2223,0x2223, + 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //42 + 0x2113,0x2112,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2223, //43 + 0x2113,0x3333,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x2113,0x2113, //44 + 0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //45 + 0x2113,0x3222,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, + 0x3333,0x3333,0x1113,0x2111,0x2113,0x2222,0x1113,0x3211, //46 + 0x2113,0x3222,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x3322,0x2113,0x2111, //47 + 0x2113,0x2112,0x2113,0x2113,0x1123,0x2111,0x2233,0x3222, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1113,0x2111, //48 + 0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //49 + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113, //4a + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x3211,0x1113,0x3322, //4b + 0x1113,0x3331,0x2113,0x3311,0x2113,0x2112,0x2223,0x2223, + 0x3333,0x3333,0x2113,0x3333,0x2113,0x3333,0x2113,0x3333, //4c + 0x2113,0x3333,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, + 0x3333,0x3333,0x2133,0x2133,0x1113,0x1112,0x1113,0x1112, //4d + 0x1113,0x1111,0x2113,0x1121,0x2113,0x1121,0x3223,0x2232, + 0x3333,0x3333,0x2113,0x2113,0x1113,0x2112,0x1113,0x2112, //4e + 0x2113,0x2111,0x2113,0x2111,0x2113,0x2112,0x2223,0x2223, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //4f + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //50 + 0x2113,0x3322,0x2113,0x3333,0x2113,0x3333,0x2223,0x3333, + 0x3333,0x3333,0x1133,0x3211,0x2113,0x2112,0x2113,0x2113, //51 + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x2111, + 0x3333,0x3333,0x1113,0x3211,0x2113,0x2112,0x1113,0x3211, //52 + 0x2113,0x2112,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, + 0x3333,0x3333,0x1133,0x2111,0x2113,0x3222,0x1123,0x3331, //53 + 0x1233,0x3311,0x2333,0x2112,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x1113,0x2111,0x1223,0x3221,0x1333,0x3321, //54 + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //55 + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2113,0x2113, //56 + 0x2113,0x2113,0x2123,0x3213,0x1233,0x3321,0x2333,0x3332, + 0x3333,0x3333,0x2113,0x1121,0x2113,0x1121,0x2113,0x1121, //57 + 0x1113,0x1111,0x1123,0x2112,0x2133,0x2133,0x3233,0x3233, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x1123,0x3211, //58 + 0x1233,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223, + 0x3333,0x3333,0x2113,0x2113,0x2113,0x2113,0x2133,0x3213, //59 + 0x1133,0x3211,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x1113,0x2111,0x2223,0x2112,0x1333,0x3221, //5a + 0x1133,0x3332,0x2113,0x3333,0x1113,0x2111,0x2223,0x2222, + 0x3333,0x3333,0x1333,0x3321,0x1333,0x3322,0x1333,0x3332, //5b + 0x1333,0x3332,0x1333,0x3332,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x3313,0x3333,0x3123,0x3333,0x1233,0x3333, //5c + 0x2333,0x3331,0x3333,0x3312,0x3333,0x3123,0x3333,0x3233, + 0x3333,0x3333,0x1333,0x3321,0x2333,0x3321,0x3333,0x3321, //5d + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x1333,0x3332,0x2133,0x3321,0x3233,0x3322, //5e + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //5f + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2222, + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3332,0x2333,0x3321, //60 + 0x3333,0x3332,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2213,0x2112, //61 + 0x1123,0x2111,0x2113,0x2112,0x1123,0x2111,0x2233,0x2222, + 0x2113,0x3333,0x2113,0x3333,0x1113,0x3211,0x2113,0x2112, //62 + 0x2113,0x2113,0x2113,0x2113,0x1113,0x3211,0x2223,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //63 + 0x2113,0x3233,0x2113,0x2133,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x2113,0x3333,0x2113,0x1133,0x2111,0x2113,0x2112, //64 + 0x2113,0x2113,0x2113,0x2113,0x1123,0x2111,0x2233,0x2222, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //65 + 0x1113,0x2111,0x2113,0x3222,0x1123,0x2111,0x2233,0x3222, + 0x1333,0x3211,0x1133,0x3322,0x1113,0x3321,0x1123,0x3332, //66 + 0x1133,0x3332,0x1133,0x3332,0x1133,0x3332,0x2233,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //67 + 0x2113,0x2113,0x1123,0x2111,0x2213,0x2112,0x1133,0x3211, + 0x2113,0x3333,0x2113,0x3333,0x1113,0x3311,0x2113,0x2112, //68 + 0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, + 0x1333,0x3321,0x2333,0x3332,0x1333,0x3321,0x1333,0x3321, //69 + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3211,0x3333,0x3322,0x3333,0x3211,0x3333,0x3211, //6a + 0x3333,0x3211,0x3333,0x3211,0x3213,0x3211,0x1123,0x3321, + 0x2113,0x3333,0x2113,0x3213,0x2113,0x3211,0x1113,0x3321, //6b + 0x1113,0x3321,0x2113,0x3311,0x2113,0x2112,0x2223,0x3223, + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x1333,0x3321, //6c + 0x1333,0x3321,0x1333,0x3321,0x1333,0x3321,0x2333,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x1211,0x1121, //6d + 0x1211,0x1121,0x1211,0x1121,0x1211,0x1121,0x2322,0x2232, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //6e + 0x2113,0x2113,0x2113,0x2113,0x2113,0x2113,0x2223,0x2223, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2112, //6f + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x2113,0x2112, //70 + 0x2113,0x2113,0x1113,0x3211,0x2113,0x3322,0x2113,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x2111,0x2113,0x2112, //71 + 0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x3333,0x2113, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x2112,0x1133,0x2111, //72 + 0x1133,0x3222,0x1133,0x3332,0x1133,0x3332,0x2233,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x1113,0x3322, //73 + 0x1133,0x3211,0x2233,0x2111,0x1133,0x3211,0x2233,0x3322, + 0x1133,0x3332,0x1113,0x3321,0x1123,0x3332,0x1133,0x3332, //74 + 0x1133,0x3332,0x1133,0x3332,0x1233,0x3321,0x2333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //75 + 0x2113,0x2113,0x2113,0x2113,0x1123,0x3211,0x2233,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //76 + 0x2113,0x2113,0x2113,0x3213,0x1113,0x3321,0x2223,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1211,0x1121,0x1211,0x1121, //77 + 0x1211,0x1121,0x1211,0x1121,0x1111,0x2111,0x2222,0x3222, + 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //78 + 0x1123,0x3211,0x2113,0x2112,0x2113,0x2113,0x3223,0x3223, + 0x3333,0x3333,0x3333,0x3333,0x2113,0x2113,0x2113,0x2113, //79 + 0x2113,0x2113,0x1123,0x2111,0x2233,0x2112,0x1133,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3211, //7a + 0x1333,0x3321,0x1133,0x3332,0x1113,0x2111,0x2223,0x2222, + 0x3333,0x3333,0x3333,0x3321,0x1333,0x3332,0x1333,0x3332, //7b + 0x2133,0x3333,0x1333,0x3332,0x1333,0x3332,0x3333,0x3321, + 0x3333,0x3333,0x1333,0x3332,0x1333,0x3332,0x1333,0x3332, //7c + 0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x2333,0x3332, + 0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3321, //7d + 0x3333,0x3213,0x3333,0x3321,0x3333,0x3321,0x1333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3113,0x3333, //7e + 0x1221,0x2133,0x2332,0x3211,0x3333,0x3322,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //7f + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222, //80 + 0x2211,0x2222,0x2211,0x2222,0x2211,0x2222,0x2211,0x2222, + 0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222, //81 + 0x1111,0x2222,0x1111,0x2222,0x1111,0x2222,0x1111,0x2222, + 0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211, //82 + 0x1111,0x2211,0x1111,0x2211,0x1111,0x2211,0x1111,0x2211, + 0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111, //83 + 0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111,0x1111, + 0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222, //84 + 0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222, + 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //85 + 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, + 0x1333,0x3331,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, //86 + 0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //87 + 0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3333,0x2213, //88 + 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //89 + 0x1111,0x1111,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x1111,0x2222,0x2222, //8a + 0x1111,0x1111,0x1333,0x3331,0x1333,0x3331,0x1333,0x3331, + 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, //8b + 0x3333,0x1213,0x3333,0x1213,0x3333,0x1213,0x3333,0x1213, + 0x3133,0x3333,0x1133,0x3333,0x1133,0x3331,0x1133,0x3311, //8c + 0x1133,0x3321,0x1133,0x3332,0x2133,0x3333,0x3233,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3332, //8d + 0x2123,0x3213,0x1133,0x3321,0x1213,0x3212,0x2113,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //8e + 0x3333,0x3321,0x3213,0x3213,0x3213,0x3213,0x2133,0x3323, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //8f + 0x1133,0x3332,0x2213,0x3321,0x3323,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x2133,0x3333, //90 + 0x1113,0x3321,0x1223,0x3332,0x2133,0x3333,0x1213,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3312, //91 + 0x2123,0x3323,0x1113,0x3321,0x2113,0x3213,0x2113,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3213,0x3321, //92 + 0x1123,0x3211,0x2113,0x3212,0x1223,0x3322,0x1333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //93 + 0x1213,0x3321,0x1113,0x3212,0x1213,0x3211,0x1323,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //94 + 0x1333,0x3321,0x1133,0x3332,0x1213,0x3321,0x1123,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //95 + 0x1333,0x3321,0x2113,0x3212,0x3223,0x3213,0x1333,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //96 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //97 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //98 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //99 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9a + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9b + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9c + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9d + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9e + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //9f + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a0 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a1 + 0x3333,0x3333,0x1133,0x3321,0x2133,0x3321,0x1133,0x3321, + 0x3333,0x3333,0x1333,0x3211,0x1333,0x3322,0x1333,0x3332, //a2 + 0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a3 + 0x3333,0x3321,0x3333,0x3321,0x1133,0x3321,0x2233,0x3322, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a4 + 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //a5 + 0x1333,0x3332,0x2333,0x3332,0x3333,0x3333,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //a6 + 0x1113,0x2111,0x2223,0x2122,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x3321, //a7 + 0x2223,0x3321,0x2133,0x3321,0x2133,0x3332,0x3213,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //a8 + 0x1133,0x3332,0x2111,0x3333,0x2122,0x3333,0x2133,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1333,0x3332, //a9 + 0x1113,0x3211,0x2213,0x3212,0x3323,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //aa + 0x1133,0x3321,0x1233,0x3332,0x1333,0x3332,0x1113,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3321, //ab + 0x1113,0x3211,0x2223,0x3321,0x1333,0x3321,0x2113,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1213,0x3211, //ac + 0x2111,0x3212,0x2122,0x3323,0x1333,0x3332,0x1333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //ad + 0x1113,0x3321,0x2223,0x3321,0x3333,0x3321,0x1113,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3211, //ae + 0x2233,0x3212,0x1133,0x3211,0x2233,0x3212,0x1133,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //af + 0x1213,0x3212,0x2323,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //b0 + 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x3333,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //b1 + 0x2133,0x3213,0x2133,0x3321,0x2133,0x3332,0x3211,0x3333, + 0x3333,0x3333,0x3333,0x2133,0x3333,0x3213,0x1333,0x3321, //b2 + 0x2113,0x3321,0x3223,0x3321,0x3333,0x3321,0x3333,0x3321, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2213,0x2122, //b3 + 0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x3211,0x1223,0x3322, //b4 + 0x1333,0x3332,0x1333,0x3332,0x1333,0x3332,0x1111,0x2111, + 0x3333,0x3333,0x3333,0x3213,0x1113,0x2111,0x2223,0x3212, //b5 + 0x3333,0x3211,0x1333,0x3212,0x1333,0x3212,0x2113,0x3213, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x1223,0x2122, //b6 + 0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x2111,0x2223,0x3221, //b7 + 0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213, + 0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x3213,0x2133, //b8 + 0x3323,0x3213,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3213,0x3333,0x1113,0x2111,0x2213,0x3212, //b9 + 0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //ba + 0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111, + 0x3333,0x3333,0x3213,0x3213,0x1111,0x2111,0x2212,0x3212, //bb + 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x2113,0x2133,0x3223,0x2133, //bc + 0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x3212, //bd + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133, + 0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //be + 0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111, + 0x3333,0x3333,0x3333,0x3333,0x3213,0x2133,0x3213,0x2133, //bf + 0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x1133,0x2111,0x2133,0x2122,0x2133,0x2133, //c0 + 0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x3333,0x3333,0x3213,0x1113,0x3321,0x2223,0x3321, //c1 + 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1213,0x2132,0x1213,0x2132, //c2 + 0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //c3 + 0x2222,0x3221,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, + 0x3333,0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x3333, //c4 + 0x1133,0x3332,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333, + 0x3333,0x3333,0x3333,0x3321,0x1111,0x2111,0x2222,0x3221, //c5 + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x3322, //c6 + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1113,0x2111, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x3212, //c7 + 0x3133,0x3321,0x1233,0x3332,0x2133,0x3321,0x3211,0x3213, + 0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x2222,0x3212, //c8 + 0x3333,0x3321,0x1133,0x3212,0x1211,0x2132,0x1322,0x3232, + 0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213, //c9 + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3332,0x2113,0x3333, + 0x3333,0x3333,0x1333,0x3332,0x3333,0x3321,0x3213,0x3213, //ca + 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, + 0x3333,0x3333,0x3213,0x2133,0x3213,0x3211,0x1113,0x3322, //cb + 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cc + 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x2133,0x3333,0x1213,0x3332, //cd + 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, + 0x3333,0x3333,0x1333,0x3332,0x1111,0x2111,0x1222,0x3222, //ce + 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2222,0x2122, //cf + 0x3213,0x3213,0x2133,0x3321,0x1333,0x3332,0x3333,0x3321, + 0x3333,0x3333,0x3113,0x3333,0x1223,0x3311,0x2333,0x2122, //d0 + 0x1133,0x3231,0x2233,0x3212,0x1113,0x3322,0x2223,0x2111, + 0x3333,0x3333,0x1333,0x3332,0x2133,0x3333,0x3213,0x3333, //d1 + 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x1111,0x2111, + 0x3333,0x3333,0x3333,0x3213,0x3213,0x3213,0x2133,0x3321, //d2 + 0x1333,0x3332,0x1333,0x3332,0x2133,0x3321,0x3211,0x3213, + 0x3333,0x3333,0x3333,0x3333,0x1111,0x2111,0x2122,0x3222, //d3 + 0x1111,0x2111,0x2122,0x3222,0x2133,0x3333,0x1133,0x2111, + 0x3333,0x3333,0x2133,0x3333,0x1133,0x2111,0x2111,0x2122, //d4 + 0x2122,0x3213,0x2133,0x3323,0x1333,0x3332,0x1333,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x3321,0x2223,0x3321, //d5 + 0x3333,0x3321,0x3333,0x3321,0x3333,0x3321,0x1111,0x2111, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2223,0x2122, //d6 + 0x1113,0x2111,0x2223,0x2122,0x3333,0x2133,0x1113,0x2111, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x3322,0x1111,0x2111, //d7 + 0x2222,0x2122,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x3333,0x3213,0x3213,0x3213,0x3213,0x3213,0x3213, //d8 + 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x1333,0x3332,0x1213,0x3332,0x1213,0x3332, //d9 + 0x1213,0x2132,0x1213,0x2132,0x1213,0x3212,0x1321,0x3321, + 0x3333,0x3333,0x3213,0x3333,0x3213,0x3333,0x3213,0x3333, //da + 0x3213,0x3213,0x3213,0x3213,0x3213,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //db + 0x3213,0x2133,0x3213,0x2133,0x3213,0x2133,0x1113,0x2111, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2111,0x2213,0x2122, //dc + 0x3323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x1113,0x2132,0x2223,0x2133, //dd + 0x3333,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x1223,0x2122, //de + 0x1333,0x2132,0x2133,0x2133,0x2133,0x2133,0x3213,0x3213, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2223,0x3221, //df + 0x3333,0x3321,0x1113,0x1111,0x2223,0x2212,0x3333,0x3213, + 0x3333,0x1213,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e0 + 0x3213,0x3213,0x3323,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x1313,0x3213,0x2323,0x1113,0x2111,0x2213,0x3212, //e1 + 0x3321,0x3213,0x3332,0x3321,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x2122, //e2 + 0x3333,0x2133,0x3333,0x2133,0x3333,0x2133,0x1113,0x2111, + 0x3333,0x1313,0x3333,0x2323,0x3213,0x3213,0x1111,0x2111, //e3 + 0x2212,0x3212,0x3213,0x3213,0x3323,0x3321,0x1133,0x3332, + 0x3333,0x1313,0x3333,0x2323,0x2113,0x2133,0x3223,0x2133, //e4 + 0x2113,0x2133,0x3223,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x1313,0x3333,0x2323,0x1113,0x2111,0x2223,0x3212, //e5 + 0x3333,0x3321,0x3333,0x3321,0x1333,0x3212,0x2113,0x2133, + 0x3333,0x1313,0x2133,0x2323,0x1133,0x2111,0x2111,0x2122, //e6 + 0x2122,0x3213,0x2133,0x3323,0x2133,0x3333,0x1133,0x2111, + 0x3333,0x1313,0x3333,0x2323,0x3213,0x2133,0x3213,0x2133, //e7 + 0x2123,0x3213,0x3233,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2133,0x2122, //e8 + 0x1213,0x2111,0x2323,0x2122,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3321, //e9 + 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x1313,0x3333,0x2323,0x1213,0x2132,0x1213,0x2132, //ea + 0x2323,0x2133,0x3333,0x2133,0x3333,0x3213,0x1113,0x3321, + 0x3333,0x1313,0x3333,0x2323,0x1113,0x3211,0x2223,0x3322, //eb + 0x1111,0x2111,0x2222,0x3221,0x3333,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x2133,0x1313,0x2133,0x2323,0x2133,0x3333, //ec + 0x1133,0x3333,0x2133,0x3211,0x2133,0x3322,0x2133,0x3333, + 0x3333,0x1313,0x1333,0x2323,0x3333,0x3331,0x3213,0x3213, //ed + 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, + 0x3333,0x1313,0x3213,0x2323,0x3213,0x2111,0x1113,0x3222, //ee + 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1123,0x2111, + 0x3333,0x1313,0x3333,0x2323,0x1111,0x2111,0x2222,0x2122, //ef + 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x3333,0x1313,0x2133,0x2323,0x1213,0x3332, //f0 + 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, + 0x3333,0x1313,0x1333,0x2323,0x1111,0x2111,0x1222,0x3222, //f1 + 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x2111,0x2213,0x2122, //f2 + 0x3323,0x2133,0x3333,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3133,0x1333,0x1212,0x3333,0x2121,0x3213,0x3213, //f3 + 0x3213,0x3213,0x3321,0x2133,0x3321,0x2133,0x3321,0x2133, + 0x3333,0x3133,0x3213,0x1213,0x3213,0x2111,0x1113,0x3222, //f4 + 0x2213,0x3333,0x3213,0x3333,0x3213,0x3333,0x1133,0x2111, + 0x3333,0x3133,0x3333,0x1213,0x1111,0x2111,0x2222,0x2122, //f5 + 0x3333,0x3213,0x3333,0x3213,0x3333,0x3321,0x1113,0x3332, + 0x3333,0x3133,0x3333,0x1213,0x2133,0x2123,0x1213,0x3232, //f6 + 0x3321,0x3321,0x3332,0x3213,0x3333,0x2133,0x3333,0x3233, + 0x3333,0x3133,0x1333,0x1212,0x1111,0x2111,0x1222,0x3222, //f7 + 0x1213,0x3212,0x1213,0x2132,0x1321,0x2132,0x1321,0x2132, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //f8 + 0x1113,0x2113,0x1223,0x3221,0x2133,0x3332,0x1133,0x2111, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x2132, //f9 + 0x1113,0x3211,0x2121,0x2121,0x1321,0x2132,0x2113,0x3213, + 0x3333,0x3333,0x3213,0x3333,0x3213,0x3213,0x3213,0x2133, //fa + 0x3213,0x2133,0x3213,0x2133,0x1213,0x3232,0x2133,0x3333, + 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1333,0x3211, //fb + 0x2113,0x2122,0x3223,0x2133,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x1113,0x3211, //fc + 0x2223,0x3321,0x1333,0x3332,0x2133,0x3321,0x3213,0x2113, + 0x3333,0x3333,0x2133,0x2133,0x1133,0x2121,0x2113,0x3232, //fd + 0x1123,0x3211,0x2113,0x2122,0x2121,0x2133,0x2113,0x3213, + 0x3333,0x3333,0x3333,0x3321,0x2133,0x3213,0x1111,0x2132, //fe + 0x2122,0x2121,0x3213,0x3321,0x3321,0x3321,0x1132,0x3332, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //ff + 0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1133,0x3211, + 0x3333,0x3333,0x3333,0x3213,0x3333,0x3321,0x1333,0x3332, //100 + 0x2133,0x3333,0x1333,0x3332,0x3333,0x3321,0x3333,0x3213, + 0x3333,0x3333,0x3333,0x3213,0x1213,0x2111,0x2213,0x3212, //101 + 0x3213,0x3213,0x3213,0x3213,0x2133,0x3213,0x3233,0x3321, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2233,0x2122, //102 + 0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1133,0x2111, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2223,0x3321, //103 + 0x3333,0x3212,0x3333,0x3213,0x3213,0x3333,0x1123,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3213,0x3333,0x3213,0x3333, //104 + 0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1123,0x3321, + 0x3333,0x3333,0x3333,0x3321,0x1113,0x2111,0x2223,0x3221, //105 + 0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x3333,0x3333,0x3213,0x3321,0x1113,0x2111, //106 + 0x3211,0x3321,0x3212,0x3321,0x3213,0x2133,0x1133,0x3211, + 0x3333,0x3333,0x2133,0x2133,0x2133,0x2133,0x3233,0x3213, //107 + 0x1113,0x2111,0x1223,0x3222,0x2133,0x3333,0x1333,0x2111, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //108 + 0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x3321,0x2111, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3211,0x2123,0x3322, //109 + 0x1213,0x3311,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2211,0x2122, //10a + 0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x3333,0x3333,0x2113,0x1133,0x3211,0x2211,0x3321, //10b + 0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113, + 0x3333,0x3333,0x3213,0x3333,0x3213,0x2133,0x2133,0x3211, //10c + 0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111, + 0x3333,0x3333,0x2133,0x3333,0x1111,0x2112,0x2212,0x3223, //10d + 0x3213,0x3213,0x1321,0x3211,0x2132,0x2112,0x1333,0x3221, + 0x3333,0x3333,0x3333,0x3333,0x1213,0x2111,0x2213,0x3222, //10e + 0x3213,0x3333,0x3213,0x3333,0x3213,0x3321,0x2133,0x2113, + 0x3333,0x3333,0x3333,0x3321,0x3213,0x3321,0x1213,0x3211, //10f + 0x2113,0x2121,0x1121,0x2112,0x2121,0x2121,0x3213,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3213,0x3211,0x1211,0x2122, //110 + 0x2112,0x2133,0x3213,0x2111,0x3211,0x2121,0x3212,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x1133,0x3211,0x2113,0x2122, //111 + 0x2121,0x2133,0x2121,0x2133,0x2121,0x2133,0x3213,0x3213, + 0x3333,0x3333,0x3333,0x3213,0x1121,0x2111,0x2221,0x3212, //112 + 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, + 0x3333,0x3333,0x2133,0x3333,0x2111,0x3213,0x3212,0x2113, //113 + 0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, + 0x3333,0x3333,0x1133,0x3333,0x2233,0x3321,0x3333,0x3332, //114 + 0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x1133,0x3332, //115 + 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x2233, + 0x3333,0x3333,0x1321,0x2111,0x2321,0x3212,0x1321,0x2111, //116 + 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1113,0x3211, //117 + 0x2223,0x3321,0x1113,0x3321,0x2221,0x3211,0x1113,0x3322, + 0x3333,0x3333,0x1113,0x3321,0x1223,0x3332,0x2133,0x3213, //118 + 0x1113,0x3211,0x2121,0x2112,0x3211,0x3213,0x3322,0x3321, + 0x3333,0x3333,0x2133,0x3333,0x1111,0x3212,0x2122,0x2133, //119 + 0x2113,0x3333,0x2121,0x2133,0x3213,0x2133,0x1133,0x3211, + 0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11a + 0x1211,0x2132,0x1121,0x2132,0x2121,0x2133,0x3213,0x3213, + 0x3333,0x3333,0x1333,0x3332,0x1113,0x3321,0x2123,0x3332, //11b + 0x1113,0x3321,0x2123,0x2132,0x2133,0x2133,0x1333,0x3211, + 0x3333,0x3333,0x3333,0x3321,0x1213,0x3211,0x2113,0x2121, //11c + 0x3211,0x2132,0x2122,0x3213,0x2133,0x3323,0x1333,0x3332, + 0x3333,0x3333,0x1333,0x3332,0x1321,0x3211,0x1121,0x2122, //11d + 0x1211,0x2132,0x1321,0x2132,0x1332,0x3212,0x2133,0x3323, + 0x3333,0x3333,0x1333,0x3332,0x1333,0x3211,0x1333,0x3322, //11e + 0x1333,0x3332,0x1113,0x3321,0x1221,0x3212,0x2113,0x3323, + 0x3333,0x3333,0x1133,0x3321,0x2233,0x3332,0x2133,0x3211, //11f + 0x1213,0x2122,0x2113,0x2133,0x3223,0x2133,0x1333,0x3211, + 0x3333,0x3333,0x2133,0x3333,0x3213,0x3213,0x3213,0x3213, //120 + 0x2113,0x3213,0x3223,0x3213,0x3333,0x3321,0x1133,0x3332, + 0x3333,0x3333,0x1113,0x3211,0x2223,0x3321,0x1333,0x3211, //121 + 0x2113,0x2122,0x1221,0x2121,0x2132,0x2121,0x1333,0x3211, + 0x3333,0x3333,0x3333,0x3211,0x1213,0x3212,0x1211,0x3212, //122 + 0x2112,0x3213,0x3213,0x3213,0x3211,0x3213,0x3212,0x2133, + 0x3333,0x3333,0x1333,0x3211,0x2113,0x3321,0x1223,0x3332, //123 + 0x1133,0x3211,0x2211,0x2122,0x3322,0x2133,0x1333,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x3213,0x3311,0x1211,0x2122, //124 + 0x2112,0x2133,0x3213,0x2133,0x3211,0x2133,0x3212,0x3211, + 0x3333,0x3333,0x3333,0x3333,0x1333,0x3332,0x1333,0x3332, //125 + 0x2133,0x3333,0x1133,0x3332,0x1213,0x2132,0x3321,0x3211, + 0x3333,0x1313,0x3333,0x2323,0x2133,0x3213,0x1111,0x2132, //126 + 0x2122,0x2121,0x3213,0x3221,0x3321,0x3321,0x1132,0x3332, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //127 + 0x1133,0x2111,0x2233,0x3212,0x3313,0x3323,0x1123,0x3211, + 0x3333,0x1313,0x3333,0x2323,0x3333,0x3321,0x1333,0x3332, //128 + 0x2133,0x3333,0x1233,0x3333,0x2333,0x3331,0x3333,0x3312, + 0x3333,0x1313,0x3333,0x2323,0x1213,0x2111,0x3213,0x3213, //129 + 0x3213,0x3213,0x3213,0x3213,0x2123,0x3213,0x3233,0x3321, + 0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2233,0x2122, //12a + 0x3333,0x3213,0x3333,0x3323,0x3213,0x3333,0x1123,0x3111, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2223,0x3321, //12b + 0x3333,0x3212,0x3333,0x3213,0x3213,0x3323,0x1123,0x3211, + 0x3333,0x3333,0x3333,0x3131,0x3213,0x3232,0x3213,0x3333, //12c + 0x3213,0x3333,0x3213,0x3333,0x3213,0x3213,0x1133,0x3321, + 0x3333,0x1313,0x3333,0x2321,0x1113,0x2111,0x2223,0x3321, //12d + 0x1133,0x3321,0x2133,0x3321,0x1333,0x3321,0x1113,0x3332, + 0x3333,0x1313,0x3333,0x2323,0x3213,0x3321,0x1113,0x2111, //12e + 0x2211,0x3221,0x3212,0x3321,0x3213,0x2132,0x1133,0x3211, + 0x3333,0x1313,0x2133,0x2323,0x2133,0x2133,0x3233,0x3213, //12f + 0x1113,0x3111,0x1223,0x3222,0x2133,0x3333,0x1233,0x2111, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //130 + 0x3213,0x2111,0x3213,0x3222,0x1213,0x3332,0x2321,0x2111, + 0x3333,0x1313,0x1333,0x2322,0x1113,0x3211,0x2123,0x3322, //131 + 0x1213,0x3211,0x2113,0x2122,0x3223,0x2133,0x1333,0x3211, + 0x3333,0x1313,0x3333,0x2323,0x1133,0x3211,0x2211,0x2122, //132 + 0x3322,0x2133,0x3333,0x2133,0x3333,0x3213,0x1133,0x3321, + 0x3333,0x1313,0x3333,0x2323,0x1133,0x2111,0x2211,0x3221, //133 + 0x1322,0x3332,0x1333,0x3332,0x3333,0x3321,0x3333,0x2113, + 0x3333,0x1313,0x3213,0x2323,0x3213,0x2133,0x2133,0x3211, //134 + 0x1133,0x3322,0x2213,0x3333,0x3213,0x3333,0x1133,0x2111, + 0x3333,0x1313,0x3333,0x2323,0x1121,0x2111,0x2221,0x3212, //135 + 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, + 0x3333,0x1313,0x2133,0x2323,0x2111,0x3213,0x3212,0x2113, //136 + 0x3321,0x3213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, + 0x3333,0x1313,0x1133,0x2323,0x2233,0x3321,0x3333,0x3332, //137 + 0x1213,0x3332,0x2321,0x2121,0x3321,0x2121,0x1132,0x3232, + 0x3333,0x3333,0x3333,0x3131,0x3333,0x3232,0x1133,0x3332, //138 + 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233, + 0x3333,0x1313,0x1321,0x2321,0x2321,0x3212,0x1321,0x2111, //139 + 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, + 0x3333,0x3133,0x3333,0x1213,0x1121,0x2111,0x2221,0x3212, //13a + 0x3321,0x3213,0x1321,0x3211,0x2121,0x2112,0x1332,0x3221, + 0x3333,0x3133,0x2133,0x1213,0x2111,0x2123,0x3213,0x1113, //13b + 0x3321,0x2213,0x3321,0x3213,0x3321,0x3321,0x1113,0x3332, + 0x3333,0x3133,0x1133,0x1213,0x2233,0x2121,0x3333,0x3232, //13c + 0x1213,0x3332,0x3321,0x2121,0x3321,0x2121,0x1132,0x3232, + 0x3333,0x3313,0x3333,0x2121,0x3333,0x3212,0x1133,0x3322, //13d + 0x2213,0x3321,0x3321,0x3213,0x3332,0x2133,0x3333,0x3233, + 0x3333,0x3133,0x1321,0x1211,0x2321,0x2112,0x1321,0x2111, //13e + 0x2321,0x3212,0x1321,0x3211,0x2121,0x2112,0x1213,0x3221, + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, //13f + 0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333,0x3333, +}; diff --git a/build/tests/DispOwnerInfo/src/myFunc.c b/build/tests/DispOwnerInfo/src/myFunc.c new file mode 100644 index 00000000..eaa7679d --- /dev/null +++ b/build/tests/DispOwnerInfo/src/myFunc.c @@ -0,0 +1,361 @@ +/********************************************************************/ +/* myFunc.c */ +/* NITRO-IPL */ +/* */ +/* Copyright (C) 2003-2004 NINTENDO Co.,Ltd. */ +/********************************************************************/ +/* + 標準サブルーチン群 + + + $Log: myFunc.c,v $ + Revision 1.1.4.1 2006/02/01 06:29:37 yosiokat + mf_strcpyの仕様変更。 + + Revision 1.1 2005/02/08 04:41:25 yosiokat + 新規追加。 + + Revision 1.2 2004/05/19 08:25:28 yosiokat + 更新ログの追加。 + + +*/ + +#include "myFunc.h" + +// define data---------------------------------- +#define CHAR_INDEX 0x200 // キャラベース0x4000 + + +// function's prototype------------------------- +void mf_copyBuffer(u8 *srcp,u8 *dstp,u16 length); + +// extern data---------------------------------- +//extern u16 bgBakS[32*24]; // BG バックアップ +//extern u32 oamBakS[128*2]; // OAM バックアップ + + +// const data----------------------------------- +const u16 csr_charList1[] ={0x008c, 0x008c, 0x008c, 0x008c}; +const u8 str_time_period[]={" . ."}; + + +// global variable------------------------------ +MyTime myTime; +//KeyWork pad; + +// static variable------------------------------ +static u16 csr_animeCount, csr_animeCharNum; +static u16 key_rapid[4]; +static u16 blinkCount; +static u16 csr_pos_x, csr_pos_y, csr_add_y; + + +// ============================================================================ +// function's description +// ============================================================================ + +// BgBakオフセット値算出 +__inline static u16 *calcBgOffset(u16 pos_x,u16 pos_y) +{ + return bgBakS+pos_x+(pos_y<<5); +} + + +// メインメモリからでも大丈夫な形式での1byteのデータ読み出し。 +__inline static u16 ReadByteHWBus(const void *srcp) +{ + if((int)srcp & 0x00000001) return (u16)(*(u16 *)((int)srcp ^ 0x00000001) >> 8); + else return (u16)(*(u16 *)(srcp) & 0x00ff); +} + + +// 初期化 +void mf_init(void) +{ + mf_KEYPAD_initRapid(); + mf_CSR_init(0,0,0); + mf_BLINK_initCounter(); +} +/* +// キー入力読み出し +void mf_KEYPAD_read(void) +{ + u16 ReadData= PAD_Read(); + pad.trg = (u16)(ReadData & (ReadData ^ pad.cont)); // トリガ 入力 + pad.cont= ReadData; // ベタ 入力 +} +*/ + +// キー連射入力処理 初期化(十字キーのみ) +void mf_KEYPAD_initRapid(void) +{ + u16 *krp=key_rapid; + + *krp++=0; + *krp++=0; + *krp++=0; + *krp++=0; +} + + +// キー連射入力(十字キーのみ) +void mf_KEYPAD_rapid(void) +{ + u16 mask,i; + + for(i=0;i<4;i++){ + mask=(u16)(0x0001<<(i+4)); + if(pad.cont & mask){ + key_rapid[i]++; + if(key_rapid[i]==30) { + pad.trg|=mask; + key_rapid[i]=20; + } + }else{ + key_rapid[i]=0; + } + } +} + + +// 10進データ表示 +void mf_drawDecimal(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength,u8 size) +{ + u16 count,charCode; + u16 *dstp; + u32 mask,divisor,target; + + mask=0xff; + while(--size>0) mask=(mask<<8)|0xff; + target=(*(u32 *)valuep)&mask; + count=10; + divisor=1000000000; + dstp=calcBgOffset(pos_x,pos_y); + while(count) { + CP_SetDiv32_32(target, divisor); + if (count<=drawLength) { + charCode=(u16)(CP_GetDivResult32()+0x0030); + *dstp++ =(u16)( charCode | color | CHAR_INDEX ); + } + target=(u32)CP_GetDivRemainder32(); + CP_SetDiv32_32(divisor, 10); + divisor=(u32)CP_GetDivResult32(); + count--; + } +} + + +// 16進データ表示 +void mf_drawHex(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength) +{ + u16 count,charCode; + u16 *dstp=calcBgOffset(pos_x,pos_y)+drawLength-1; + + for(count=0;count>4) & 0x000f); + ((u8 *)valuep)++; + }else{ + charCode=(u16)( charCode & 0x000f); + } + if (charCode<0x000a) charCode+=0x0030; + else charCode+=0x0041-0x000a; + *dstp--=(u16)( charCode | color | CHAR_INDEX ); + } +} + + +// 1byte文字列データ表示(0x00〜0xffまでの1文字が1byteで良い文字列を描画する +void mf_drawString(u16 pos_x,u16 pos_y, u16 color, const u8 *strp) +{ + u16 data16; + u16 *dstp=calcBgOffset(pos_x,pos_y); + + while(1) { + data16=ReadByteHWBus(strp++); + if(data16==0) break; + *dstp++=(u16)( color | data16 | CHAR_INDEX ); + } +} + + +// 2byte文字列データ表示(0x0100以降の1文字に2byte必要な文字列を描画する +void mf_drawString2(u16 pos_x,u16 pos_y, u16 color, const u16 *strp) +{ + u16 *dstp=calcBgOffset(pos_x,pos_y); + + while(*strp) *dstp++ = (u16)( *strp++ | color | CHAR_INDEX ); +} + + +// 矩形BGクリア +void mf_clearRect(u16 pos_x,u16 pos_y,u8 height,u8 width) +{ + u16 i,j; + u16 *dstp=calcBgOffset(pos_x,pos_y); + + for(i=0;i +#include "data.h" + +// define data --------------------------------- + +// 時間計測構造体 +typedef struct { + int enable; + int frame; + int second; + int minute; + int hour; +}MyTime; + +// キーデータ・ワークエリア構造体 +//typedef struct { +// u16 trg; // トリガ入力 +// u16 cont; // ベタ 入力 +//}KeyWork; + + +// global variable------------------------------ +extern MyTime myTime; +//extern KeyWork pad; + + +// const data----------------------------------- +extern const u16 myChar[0x2800*8/16]; // キャラクターデータ + + +// function------------------------------------- +extern void mf_init(void); +extern void mf_KEYPAD_read(void); +extern void mf_KEYPAD_initRapid(void); +extern void mf_KEYPAD_rapid(void); +extern void mf_drawDecimal(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength,u8 size); +extern void mf_drawHex(u16 pos_x,u16 pos_y,u16 color,const void *valuep,u8 drawLength); +extern void mf_drawString(u16 pos_x,u16 pos_y,u16 color,const u8 *strp); +extern void mf_drawString2(u16 pos_x,u16 pos_y,u16 color,const u16 *strp); +extern void mf_clearRect(u16 pos_x,u16 pos_y,u8 height,u8 width); +extern void mf_CSR_init(u16 pos_x,u16 pos_y,u16 add_y); +extern void mf_CSR_moveAndAnime(int nowNum); +extern void mf_CSR_anime(const u16 *csr_charListp); +extern void mf_BLINK_initCounter(void); +extern void mf_BLINK_drawString(u16 pos_x,u16 pos_y,u16 color,const u8 *strp); +extern void mf_waitXframe(u16 frame); +extern void mf_TIME_init(void); +extern void mf_TIME_start(int init_flag); +extern void mf_TIME_stop(void); +extern void mf_TIME_count(void); +extern void mf_TIME_draw(u16 pos_x,u16 pos_y,u16 color); +extern u8* mf_strcpy(const u8 *str1p,u8 *str2p); +extern u8 mf_strcmp(const u8 *str1p,const u8 *str2p); + + +#ifdef __cplusplus + +#endif + +#endif // __MY_FUNC_H__ + diff --git a/build/tests/DisplaySystemInformation/ARM7/Makefile b/build/tests/DisplaySystemInformation/ARM7/Makefile new file mode 100644 index 00000000..eab0b68e --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/Makefile @@ -0,0 +1,85 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +TARGET_CODEGEN ?= ALL + +#---------------------------------------------------------------------------- +DISP_INFO = $(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation + +SRCS = overwriteRtc.c crt0.SCR.c main.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(TARGET_NAME).response.template + +CRT0_O = $(DISP_INFO)/ARM7/obj/ARM7-TS.LTD/Release/crt0.SCR.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +TWL_NO_STD_PCHDR = True + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +#-------------------------------- +# install target +#-------------------------------- +#INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ +# $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ +# $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ +# $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ +# $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +#INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(DISP_INFO)/common/include \ + $(TWLSDK_ROOT)/build/libraries/init/common/include + + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libsea_sp$(TWL_LIBSUFFIX).a \ + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM7/armadillo.lcf.template b/build/tests/DisplaySystemInformation/ARM7/armadillo.lcf.template new file mode 100644 index 00000000..6ae1bd6b --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/armadillo.lcf.template @@ -0,0 +1,400 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lcf.template +# +# 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + check.WORKRAM (RWX) : ORIGIN = 0x03740000, LENGTH = 0xd0000 > workram.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + + } > binary.STATIC_FOOTER + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + } > F + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD_TOP_START = 0x02f00000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_BSS_END = 0x03740000; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..START =.; + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + SDK_LTDAUTOLOAD_BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + SDK_MOUNT_INFO_TABLE = SDK_LTDAUTOLOAD_BSS_END; + SDK_LTDAUTOLOAD_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW SDK_MOUNT_INFO_TABLE; # address of the FS mount information table + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = 0x02ffc000; # メインメモリアリーナはサイズ 0 + SDK_SEA_KEY_STORE = SDK_LTDAUTOLOAD_BSS_END; + SDK_WRAM_ARENA_LO = SDK_LTDAUTOLOAD_BSS_END + 0x40; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = SDK_WRAM_ARENA_LO + 0x80 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM +} diff --git a/build/tests/DisplaySystemInformation/ARM7/armadillo.lsf b/build/tests/DisplaySystemInformation/ARM7/armadillo.lsf new file mode 100644 index 00000000..4519fc34 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/armadillo.lsf @@ -0,0 +1,85 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/overwriteRtc.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a + Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a +# Library libfs_sp$(LIBSUFFIX).a +# Library libcard_sp$(LIBSUFFIX).a +# Library libcamera_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/tests/DisplaySystemInformation/ARM7/armadillo.response.template b/build/tests/DisplaySystemInformation/ARM7/armadillo.response.template new file mode 100644 index 00000000..b68c3564 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/armadillo.response.template @@ -0,0 +1,22 @@ + + + + + -l + + + + + + + -l + + + + + + + + -l + + diff --git a/build/tests/DisplaySystemInformation/ARM7/src/main.c b/build/tests/DisplaySystemInformation/ARM7/src/main.c new file mode 100644 index 00000000..219de8c5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/src/main.c @@ -0,0 +1,632 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" + +#include "address.h" + + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM NWMSP_DMA_7 + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSHeapHandle hh); +static void DummyThread(void* arg); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + // OS初期化でARM9と同期する前にSCFGの情報を共有メモリに書き出す + // レジスタ情報をコピー + MI_CpuMove16( (void*)REG_ROM_ADDR, DISPINFO_SHARED_SCFG_REG_ADDR, DISPINFO_SHARED_SCFG_REG_SIZE ); + // WRAMに退避されてる分もコピー + MI_CpuMove16( (void*)HWi_WSYS04_ADDR, DISPINFO_SHARED_SCFG_WRAM_ADDR, DISPINFO_SHARED_SCFG_WRAM_SIZE ); + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA +// FS_Init(FS_DMA_NOT_USE); // FS for CARD +// FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS + InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + CDC_InitLib(); // CODEC +// if (OSi_IsCodecTwlMode() == TRUE) +// { +// CAMERA_Init(); // カメラ +// } + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC + WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + OSThread thread; + u32 stack[18]; + + /* ダミースレッド作成 */ + OS_CreateThread(&thread, DummyThread, NULL, + (void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&thread); + + /* FATFS 初期化 */ + /* [TODO] DMA は NOT_USE のままで良い? */ + if(!FATFS_Init(DMA_NO_FATFS, FATFS_DMA_NOT_USE, THREAD_PRIO_FATFS)) + { + /* do nothing */ + } + + /* ダミースレッド破棄 */ + OS_KillThread(&thread, NULL); +} + +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: hh - 利用可能なヒープのハンドルを指定。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSHeapHandle hh) +{ + NwmspInit nwmInit; + + /* [TODO] 確保しているヒープ領域が新無線一式が必要としているメモリ量以上かのチェックが必要 */ + + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + + nwmInit.dmaNo = DMA_NO_NWM; + nwmInit.drvHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.drvHeap.handle = hh; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.wpaHeap.handle = hh; + + NWMSP_Init(&nwmInit); +} + +/*---------------------------------------------------------------------------* + Name: DummyThread + Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの + スレッド。 + Arguments: arg - 使用しない。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +DummyThread(void* arg) +{ +#pragma unused(arg) + while (TRUE) + { + } +} + +#ifdef WM_PRECALC_ALLOWEDCHANNEL +extern u16 WMSP_GetAllowedChannel(u16 bitField); +#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } + +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/tests/DisplaySystemInformation/ARM7/src/overwriteRtc.c b/build/tests/DisplaySystemInformation/ARM7/src/overwriteRtc.c new file mode 100644 index 00000000..af04b9d0 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7/src/overwriteRtc.c @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: overwriteRtc.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 + +extern BOOL RTC_IsAvailablePxiCommand(u16 command); + +/*---------------------------------------------------------------------------* + Name: RTC_IsAvailablePxiCommand + + Description: PXI コマンドが有効な RTC 操作コマンドであるかどうか調査する。 + + Arguments: command - 調査するコマンド。 + + Returns: BOOL - 有効なコマンドである場合に TRUE を返す。処理できな + い無効なコマンドである場合には FALSE を返す。 + *---------------------------------------------------------------------------*/ +BOOL +RTC_IsAvailablePxiCommand(u16 command) +{ + switch (command) + { + case RTC_PXI_COMMAND_RESET: + case RTC_PXI_COMMAND_SET_HOUR_FORMAT: + case RTC_PXI_COMMAND_READ_DATETIME: + case RTC_PXI_COMMAND_READ_DATE: + case RTC_PXI_COMMAND_READ_TIME: + case RTC_PXI_COMMAND_READ_PULSE: + case RTC_PXI_COMMAND_READ_ALARM1: + case RTC_PXI_COMMAND_READ_ALARM2: + case RTC_PXI_COMMAND_READ_STATUS1: + case RTC_PXI_COMMAND_READ_STATUS2: + case RTC_PXI_COMMAND_READ_ADJUST: + case RTC_PXI_COMMAND_READ_FREE: + case RTC_PXI_COMMAND_WRITE_DATETIME: + case RTC_PXI_COMMAND_WRITE_DATE: + case RTC_PXI_COMMAND_WRITE_TIME: + case RTC_PXI_COMMAND_WRITE_PULSE: + case RTC_PXI_COMMAND_WRITE_ALARM1: + case RTC_PXI_COMMAND_WRITE_ALARM2: + case RTC_PXI_COMMAND_WRITE_STATUS1: + case RTC_PXI_COMMAND_WRITE_STATUS2: + case RTC_PXI_COMMAND_WRITE_ADJUST: + case RTC_PXI_COMMAND_WRITE_FREE: + return TRUE; + } + return FALSE; +} + diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/Makefile b/build/tests/DisplaySystemInformation/ARM7_armadillo/Makefile new file mode 100644 index 00000000..16d7b87c --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/Makefile @@ -0,0 +1,86 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +TARGET_CODEGEN ?= ALL + +#---------------------------------------------------------------------------- +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SRCS = overwriteRtc.c crt0.SCR.c main.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(TARGET_NAME).response.template + +CRT0_O = crt0.SCR.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +TWL_NO_STD_PCHDR = True + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +#-------------------------------- +# install target +#-------------------------------- +#INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ +# $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ +# $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ +# $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ +# $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +#INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include \ + $(DISP_INFO)/common/include \ + $(TWLSDK_ROOT)/build/libraries/init/common/include + +LLIBRARY_DIRS += $(DISP_INFO)/ARM7_armadillo/obj/$(TWL_BUILDTYPE_ARM7) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libsea_sp$(TWL_LIBSUFFIX).a \ + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lcf.template b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lcf.template new file mode 100644 index 00000000..6ae1bd6b --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lcf.template @@ -0,0 +1,400 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lcf.template +# +# 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + check.WORKRAM (RWX) : ORIGIN = 0x03740000, LENGTH = 0xd0000 > workram.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + + } > binary.STATIC_FOOTER + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + } > F + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD_TOP_START = 0x02f00000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_BSS_END = 0x03740000; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..START =.; + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + + + + + + + + + + + + + WRITEW 0; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + SDK_LTDAUTOLOAD_BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + SDK_MOUNT_INFO_TABLE = SDK_LTDAUTOLOAD_BSS_END; + SDK_LTDAUTOLOAD_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW SDK_MOUNT_INFO_TABLE; # address of the FS mount information table + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = 0x02ffc000; # メインメモリアリーナはサイズ 0 + SDK_SEA_KEY_STORE = SDK_LTDAUTOLOAD_BSS_END; + SDK_WRAM_ARENA_LO = SDK_LTDAUTOLOAD_BSS_END + 0x40; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = SDK_WRAM_ARENA_LO + 0x80 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM +} diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lsf b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lsf new file mode 100644 index 00000000..4519fc34 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.lsf @@ -0,0 +1,85 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/overwriteRtc.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a + Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a +# Library libfs_sp$(LIBSUFFIX).a +# Library libcard_sp$(LIBSUFFIX).a +# Library libcamera_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.response.template b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.response.template new file mode 100644 index 00000000..b68c3564 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/armadillo.response.template @@ -0,0 +1,22 @@ + + + + + -l + + + + + + + -l + + + + + + + + -l + + diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/src/crt0.SCR.c b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/crt0.SCR.c new file mode 100644 index 00000000..52d0ff28 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/crt0.SCR.c @@ -0,0 +1,714 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.SCR.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 +#ifndef SDK_FINALROM +#include +#endif +#include "boot_sync.h" + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); + +/*---------------------------------------------------------------------------* + 外部参照 + *---------------------------------------------------------------------------*/ +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); +extern void SDK_WRAM_ARENA_LO(void); + +/* 外部関数参照 */ +extern void OS_IrqHandler(void); +#ifndef SDK_NOINIT +extern void _fp_init(void); +extern void __call_static_initializers(void); +#endif + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* .rodata セクションに配置するロードに必要な情報 */ +void* const _start_ModuleParams[] = +{ + (void*)0, + (void*)0, + (void*)0, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, + (void*)0, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +/*---------------------------------------------------------------------------* + Name: Stop + Description: プログラムを停止する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_Stop[2] = +{ + 0xef000006, /* @1: swi #6 ; SVC_Halt */ + 0xeafffffd /* b @1 ; ループ */ +}; + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。同時に指定バッファの 0 クリアを行う。スタック内で動作させ + ることを想定している為、スタックを一切使用しない。 + Arguments: r0 - 0 クリアするバッファの先頭アドレス。 + 4 バイトアラインされたアドレスである必要がある。 + r1 - 上位 8 bit: ARM9 に伝えるフェーズ番号。 + 下位 24 bit: 0 クリアするバッファのサイズ。 + 4 の倍数である必要がある。 + r2 - 同期用フェーズ管理変数へのポインタ。 + r3 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[10] = +{ + 0xe59fc01c, /* @1: ldr r12, [pc, #28] ; 下位 24 bit マスクを用意 */ + 0xe111000c, /* tst r1, r12 ; クリアバッファ残サイズをチェック */ + 0xe3a0c000, /* mov r12, #0 ; クリア用変数を用意 */ + 0x1480c004, /* strne r12, [r0], #4 ; 4 バイトクリア */ + 0x12411004, /* subne r1, r1, #4 ; クリアバッファ残サイズ -= 4 */ + 0x1afffff9, /* bne @1 ; 残サイズが 0 になるまでループ */ + 0xe1a01c21, /* mov r1, r1, LSR #24 ; フェーズ管理変数の更新値を用意 */ + 0xe1c210b0, /* strh r1, [r2] ; フェーズ管理変数を更新 */ + 0xe12fff13, /* bx r3 ; Main 関数へジャンプ */ + 0x00fffffc /* 0x00fffffc */ +}; + + +/*---------------------------------------------------------------------------* + 内部関数プロトタイプ + *---------------------------------------------------------------------------*/ +static void INITi_CheckSysConfig(void); +static void INITi_DetectMainMemorySize(void); +static void INITi_Stop(void); +static void INITi_DoAutoload(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif + +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] + + /* SCFG 設定を確認 */ + bl INITi_CheckSysConfig + + /* ランチャーから渡された情報を退避 */ + ldr r3, =SDK_WRAM_ARENA_LO + sub r2, r3, #0x40 + ldr r1, =HW_LAUNCHER_DELIVER_PARAM_BUF +@001: + cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @001 + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 // sizeof(microcode_ShakeHand) +@002: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @002 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for IRQ stack check code + mov r0, #HW_PSR_SYS_MODE // System mode + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for SYS stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC セグメントの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + /* メインメモリサイズを調査 */ + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + /* デバッグ出力ウィンドウを設定 */ + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7 << 8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR << 8) + strh r0, [r1, #2] +#endif + + /* IRQ 割込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@0f0: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + sub r2, sp, #40 + mov r3, sp +@0f1: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @0f1 + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =SDK_STATIC_START + bic r0, r0, #0x00000003 + ldr r1, =SDK_STATIC_BSS_END + sub r1, r1, r0 + add r1, r1, #3 + bic r1, r1, #0x00000003 + bic r1, r1, #0xff000000 + mov r2, #BOOT_SYNC_PHASE_4 + mov r2, r2, LSL #24 + orr r1, r1, r2 + ldr r2, =HW_BOOT_SYNC_PHASE + ldr r3, =TwlSpMain + ldr lr, =HW_RESET_VECTOR + sub r12, sp, #40 + bx r12 + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CheckSysConfig + Description: SCFG 関連 I/O レジスタの内容を確認する。 + A7-SCFG ブロックがアクセス有効な場合には、ローダーが行う設定処 + 理を代行した上でアクセスを無効化する。 + ARM7 専用 WRAM 内にローダーが展開している I/O レジスタ情報を確 + 認した上でメインメモリ上の共有領域にコピーする。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CheckSysConfig(void) +{ + /* A7-SCFG のアクセス可否判定 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + ldr r2, =HW_PRV_WRAM_SYSRV + tst r0, #REG_SCFG_EXT_CFG_MASK + beq @invalid + + /* クロック供給情報、JTAG情報をWRAMに展開 */ +/* ldr r3, =REG_JTAG_ADDR // SCFG-JTAG + ldrh r1, [r3] + and r0, r1, #(REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK) + and r3, r1, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r3, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + + ldr r3, =REG_CLK_ADDR + ldrh r1, [r3] + and r3, r1, #(REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK) + orr r0, r0, r3, LSL #(HWi_WSYS09_CLK_SD1HCLK_SHIFT - REG_SCFG_CLK_SD1HCLK_SHIFT) + and r3, r1, #(REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK) + orr r0, r0, r3, LSR #(REG_SCFG_CLK_WRAMHCLK_SHIFT - HWi_WSYS09_CLK_WRAMHCLK_SHIFT) + + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] +*/ + + /* A7-SCFG ブロックへのアクセスを無効化 */ +// ldr r1, =REG_EXT_ADDR +// ldr r0, [r1] +// bic r0, r0, #REG_SCFG_EXT_CFG_MASK +// str r0, [r1] + +@invalid: + /* ROM 設定、NITRO 無線設定内容を確認 */ + ldrb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + and r0, r0, #(HWi_WSYS08_ROM_ARM7RSEL_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK | HWi_WSYS08_ROM_ARM9SEC_MASK) + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + blne INITi_Stop + + /* SCFG レジスタ設定情報を共有領域にコピー */ + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + Description: メインメモリサイズを調査する。 + 調査結果は (u16*)HW_MMEMCHECER_SUB に格納される。 + 格納される値は [OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32B] + NOTE: プラットフォームが NITRO の場合は考慮していない。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void +INITi_DetectMainMemorySize(void) +{ + ldr r2, =HW_MMEMCHECKER_SUB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + + /* OSi_CHECKNUM1 (0x55) 書き込みテスト */ + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@1 subs r2, r2, #4 + bcs @1 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @check_smix + + /* OSi_CHECKNUM2 (0xaa) を 書き込みテスト */ + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@2 subs r2, r2, #4 + bcs @2 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@check_smix: + /* SMIX レジスタを調査 */ + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + /* 調査結果を格納 */ + ldr r2, =HW_MMEMCHECKER_SUB + strb r0, [r2] + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Stop + Description: プログラムを停止する。ARM7 専用 WRAM に Halt を繰り返すループ + 関数をコピーし、コピーした関数を実行する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_Stop(void) +{ + ldr r1, =microcode_Stop + ldr r2, =HW_PRV_WRAM + add r3, r2, #8 // sizeof(microcode_Stop) +@copy_loop: + ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @copy_loop + +@stop_loop: + ldr r0, =HW_PRV_WRAM + mov lr, pc + bx r0 + b @stop_loop + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + NITRO 互換オートロードセグメントは存在せず、TWL 専用セグメント + のみが存在するという前提。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ + +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + + /* オートロードを実施 */ +@000: + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_LTDAUTOLOAD_START +@001: + cmp r12, r3 + bge @010 + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = sizeo of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} + b @001 + + /* オートロードリスト・オートロード元バッファをクリア */ +@010: + ldr r1, =_start_LtdModuleParams + ldr r12, [r1] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r1, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r0, [r1, #8] // r0 = SDK_LTDAUTOLOAD_START +@011: + cmp r12, r3 + bge @0f0 + mov r1, #0 // r1 = clear value + str r1, [r12], #4 + ldr r2, [r12] // r2 = size of fixed section + str r1, [r12], #4 + str r1, [r12], #4 + str r1, [r12], #4 + bl INITi_Fill32 + b @011 + +@0f0: + /* オートロード完了コールバック呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + +#ifndef SDK_NOINIT + +//static asm void +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* 退避場所先頭から空き場所を調査 */ + ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 +@002: + /* 空き場所にテーブルをコピー */ + ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* テーブルに管理されているポインタを一つずつ呼び出し */ + ldr r0, [r1] + cmp r0, #0 + beq @002 + stmfd sp!, {r1} + mov lr, pc + bx r0 + ldmfd sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 +@002: + ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 32 bit 単位でコピーを行う。スタックを 36 バイト消費するが、 + レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 32 bit 単位でバッファ内容を指定データで埋める。スタックを 36 + バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: NitroSpStartUp + Description: Hook for user start up. + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void +NitroSpStartUp(void) +{ +} + +#include diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/src/main.c b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/main.c new file mode 100644 index 00000000..219de8c5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/main.c @@ -0,0 +1,632 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" + +#include "address.h" + + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM NWMSP_DMA_7 + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSHeapHandle hh); +static void DummyThread(void* arg); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + // OS初期化でARM9と同期する前にSCFGの情報を共有メモリに書き出す + // レジスタ情報をコピー + MI_CpuMove16( (void*)REG_ROM_ADDR, DISPINFO_SHARED_SCFG_REG_ADDR, DISPINFO_SHARED_SCFG_REG_SIZE ); + // WRAMに退避されてる分もコピー + MI_CpuMove16( (void*)HWi_WSYS04_ADDR, DISPINFO_SHARED_SCFG_WRAM_ADDR, DISPINFO_SHARED_SCFG_WRAM_SIZE ); + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA +// FS_Init(FS_DMA_NOT_USE); // FS for CARD +// FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS + InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + CDC_InitLib(); // CODEC +// if (OSi_IsCodecTwlMode() == TRUE) +// { +// CAMERA_Init(); // カメラ +// } + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC + WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + OSThread thread; + u32 stack[18]; + + /* ダミースレッド作成 */ + OS_CreateThread(&thread, DummyThread, NULL, + (void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&thread); + + /* FATFS 初期化 */ + /* [TODO] DMA は NOT_USE のままで良い? */ + if(!FATFS_Init(DMA_NO_FATFS, FATFS_DMA_NOT_USE, THREAD_PRIO_FATFS)) + { + /* do nothing */ + } + + /* ダミースレッド破棄 */ + OS_KillThread(&thread, NULL); +} + +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: hh - 利用可能なヒープのハンドルを指定。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSHeapHandle hh) +{ + NwmspInit nwmInit; + + /* [TODO] 確保しているヒープ領域が新無線一式が必要としているメモリ量以上かのチェックが必要 */ + + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + + nwmInit.dmaNo = DMA_NO_NWM; + nwmInit.drvHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.drvHeap.handle = hh; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.wpaHeap.handle = hh; + + NWMSP_Init(&nwmInit); +} + +/*---------------------------------------------------------------------------* + Name: DummyThread + Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの + スレッド。 + Arguments: arg - 使用しない。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +DummyThread(void* arg) +{ +#pragma unused(arg) + while (TRUE) + { + } +} + +#ifdef WM_PRECALC_ALLOWEDCHANNEL +extern u16 WMSP_GetAllowedChannel(u16 bitField); +#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } + +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/tests/DisplaySystemInformation/ARM7_armadillo/src/overwriteRtc.c b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/overwriteRtc.c new file mode 100644 index 00000000..af04b9d0 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_armadillo/src/overwriteRtc.c @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: overwriteRtc.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 + +extern BOOL RTC_IsAvailablePxiCommand(u16 command); + +/*---------------------------------------------------------------------------* + Name: RTC_IsAvailablePxiCommand + + Description: PXI コマンドが有効な RTC 操作コマンドであるかどうか調査する。 + + Arguments: command - 調査するコマンド。 + + Returns: BOOL - 有効なコマンドである場合に TRUE を返す。処理できな + い無効なコマンドである場合には FALSE を返す。 + *---------------------------------------------------------------------------*/ +BOOL +RTC_IsAvailablePxiCommand(u16 command) +{ + switch (command) + { + case RTC_PXI_COMMAND_RESET: + case RTC_PXI_COMMAND_SET_HOUR_FORMAT: + case RTC_PXI_COMMAND_READ_DATETIME: + case RTC_PXI_COMMAND_READ_DATE: + case RTC_PXI_COMMAND_READ_TIME: + case RTC_PXI_COMMAND_READ_PULSE: + case RTC_PXI_COMMAND_READ_ALARM1: + case RTC_PXI_COMMAND_READ_ALARM2: + case RTC_PXI_COMMAND_READ_STATUS1: + case RTC_PXI_COMMAND_READ_STATUS2: + case RTC_PXI_COMMAND_READ_ADJUST: + case RTC_PXI_COMMAND_READ_FREE: + case RTC_PXI_COMMAND_WRITE_DATETIME: + case RTC_PXI_COMMAND_WRITE_DATE: + case RTC_PXI_COMMAND_WRITE_TIME: + case RTC_PXI_COMMAND_WRITE_PULSE: + case RTC_PXI_COMMAND_WRITE_ALARM1: + case RTC_PXI_COMMAND_WRITE_ALARM2: + case RTC_PXI_COMMAND_WRITE_STATUS1: + case RTC_PXI_COMMAND_WRITE_STATUS2: + case RTC_PXI_COMMAND_WRITE_ADJUST: + case RTC_PXI_COMMAND_WRITE_FREE: + return TRUE; + } + return FALSE; +} + diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/Makefile b/build/tests/DisplaySystemInformation/ARM7_racoon/Makefile new file mode 100644 index 00000000..bc239513 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/Makefile @@ -0,0 +1,82 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +TWL_NO_STD_PCHDR = True +TARGET_CODEGEN ?= ALL + +#---------------------------------------------------------------------------- + +SRCDIR += ./src + +SRCS = main.c initScfg.c + +TARGET_NAME = racoon + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(TARGET_NAME).response.template + +CRT0_O = crt0.LTD.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +ifeq ($(TWL_PLATFORM),BB) +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037e0000' +else +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' +endif + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + + +#-------------------------------- +# install target +#-------------------------------- +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include\ + $(DISP_INFO)/common/include +#LLIBRARIES += libwl_sp.TWL.LTD.a libsdio_hcd_twl$(TWL_LIBSUFFIX).a libsdio_busdriver$(TWL_LIBSUFFIX).a libsdio_lib$(TWL_LIBSUFFIX).a libARM7athdrv$(TWL_LIBSUFFIX).a +LLIBRARIES += libwl_sp.TWL.LTD.a +#LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ +# libcdc_sp$(TWL_LIBSUFFIX).a \ +# libtpex_sp$(TWL_LIBSUFFIX).a \ +# libmicex_sp$(TWL_LIBSUFFIX).a \ +# libsdio_hcd_twl$(TWL_LIBSUFFIX).a \ +# libsdio_busdriver$(TWL_LIBSUFFIX).a \ +# libsdio_lib$(TWL_LIBSUFFIX).a \ +# librompatch_sp$(TWL_LIBSUFFIX).a \ +# libARM7athdrv$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lcf.template b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lcf.template new file mode 100644 index 00000000..90b672ea --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lcf.template @@ -0,0 +1,935 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: racoon.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.WORKRAM (RWX) : ORIGIN = 0x037c0000, LENGTH = 0x50000 > workram.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.LTDMAIN (RWX) : ORIGIN = 0x02f88000, LENGTH = 0x74000 > ltdmain.check + check.RSVWRAM (RWX) : ORIGIN = 0x03040000, LENGTH = 0x08000 > rsvwram.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_STATIC_DATA_END =.; + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.WRAM.START = 0x037c0000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + + . = ALIGN(4); + SDK_AUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_AUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_MOUNT_INFO_TABLE = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_OVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ OTHERS ################################# + SDK_WRAM_ARENA_LO = SDK_AUTOLOAD_WRAM_BSS_END; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM: + { + . = . + SDK_AUTOLOAD_WRAM_BSS_END - SDK_AUTOLOAD.WRAM.START + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = 0x02f88000; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02e80000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDAUTOLOAD__ID =; + SDK_LTDAUTOLOAD..ID =; + SDK_LTDAUTOLOAD..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDAUTOLOAD..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDAUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(4); + SDK_LTDAUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_LTDAUTOLOAD..DATA_END =.; + . = ALIGN(4); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..TEXT_SIZE = SDK_LTDAUTOLOAD..TEXT_END - SDK_LTDAUTOLOAD..TEXT_START; + SDK_LTDAUTOLOAD..DATA_SIZE = SDK_LTDAUTOLOAD..DATA_END - SDK_LTDAUTOLOAD..DATA_START; + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDAUTOLOAD..BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDOVERLAY__ID =; + SDK_LTDOVERLAY..ID =; + SDK_LTDOVERLAY..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDOVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDOVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDOVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDOVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_LTDOVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_LTDOVERLAY..DATA_END =.; + . = ALIGN(4); + SDK_LTDOVERLAY..END =.; + + SDK_LTDOVERLAY..TEXT_SIZE = SDK_LTDOVERLAY..TEXT_END - SDK_LTDOVERLAY..TEXT_START; + SDK_LTDOVERLAY..DATA_SIZE = SDK_LTDOVERLAY..DATA_END - SDK_LTDOVERLAY..DATA_START; + SDK_LTDOVERLAY..SIZE = SDK_LTDOVERLAY..END - SDK_LTDOVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDOVERLAY..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_LTDOVERLAY..BSS_END =.; + + SDK_LTDOVERLAY..BSS_SIZE = SDK_LTDOVERLAY..BSS_END - SDK_LTDOVERLAY..BSS_START; + + } >> + + + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW SDK_MOUNT_INFO_TABLE; # address of the FS mount information table + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + .check.LTDMAIN: + { + . = SDK_SUBPRIV_ARENA_LO; + + } > check.LTDMAIN + + .check.RSVWRAM: + { + . = SDK_LTDAUTOLOAD.RSVWRAM.BSS_END; + + } > check.RSVWRAM + +} diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lsf b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lsf new file mode 100644 index 00000000..4a239534 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.lsf @@ -0,0 +1,231 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: racoon.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + Library $(CRT0_O) + Object $(OBJDIR)/initScfg.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address $(ADDRESS_LTDWRAM) + + Library libsubpsyscall.a \ + libsyscall_sp.twl.a \ + $(CW_LIBS) \ + libos_sp$(LIBSUFFIX).a \ + libmi_sp$(LIBSUFFIX).a \ + libpad_sp$(LIBSUFFIX).a \ + libpxi_sp$(LIBSUFFIX).a \ + libstd_sp$(LIBSUFFIX).a \ + libexi_sp$(LIBSUFFIX).a \ + libsnd_sp$(LIBSUFFIX).a \ + libspi_sp$(LIBSUFFIX).a \ + libpm_sp$(LIBSUFFIX).a \ + libmath_sp$(LIBSUFFIX).a \ + libscfg_sp$(LIBSUFFIX).a \ + libtp_sp$(LIBSUFFIX).a \ + libmic_sp$(LIBSUFFIX).a \ + libfs_sp$(LIBSUFFIX).a \ + libcard_sp$(LIBSUFFIX).a \ + libi2c_sp$(LIBSUFFIX).a \ + libcamera_sp$(LIBSUFFIX).a \ + libcdc_sp$(LIBSUFFIX).a \ + libsndex_sp$(LIBSUFFIX).a \ + libtpex_sp$(LIBSUFFIX).a \ + libmicex_sp$(LIBSUFFIX).a \ + libmcu_sp$(LIBSUFFIX).a \ + + Library libsdio_sp$(LIBSUFFIX).a + + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + + + Object * (.etable) + Object * (.wram) + Object * (.ltdwram) + Object $(OBJDIR)/main.o + + # caches in fatfs library, that should be on WRAM. + # 2007/12/11 OBJECT() による .bss シンボルのリンクがうまくいかないので、 + # 変数定義箇所に pragma で .ltdwram セクションに含まれるように暫定対策しました。 +# Object OBJECT( FATFSi___mem_drives_structures , libfatfs_sp$(LIBSUFFIX).a) (.bss) + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp$(LIBSUFFIX).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlCmdIf.o + Object OBJECT( RequestCmdTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WStop , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp$(LIBSUFFIX).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp$(LIBSUFFIX).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + + +} + +#-------- +Ltdautoload RSVWRAM +{ + Address 0x03040000 + Object * (.rsvwram) + Library libathdrv_sp$(LIBSUFFIX).a (.bss) + Library libathdrv_sp$(LIBSUFFIX).a (.data) + + ##### + # Sub-routines in TWL WIRELESS Driver , that should be on WRAM. + Object OBJECT( HTCSendPktCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCIssueSend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCTrySend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCSendPkt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCProcessCreditRpt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevRecvPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCProcessRecvHeader, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCRecvCompleteHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCRecvMessagePendingHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCAddReceivePkt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AR6KFreeIOPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AR6KAllocIOPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevRWCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevGetEventAsyncHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevCheckPendingRecvMsgsAsync, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevDsrHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HIFReadWrite, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( hifRWCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( hifIRQHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HIFAckInterrupt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_credit_distribute, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_alloc, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_alloc_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_put, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_push, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_pull, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_free, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_to_data, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_to_len, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_headroom, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_drv_return_netbuf, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ath_queue_remove_from_head, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ath_queue_insert_tail, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_alloc_cookie, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_driver_tx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_tx_complete, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_dix_2_dot3, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_data_hdr_add, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_data_hdr_remove, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_ibss_map_epid, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DL_ListInsertTail, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DL_ListRemove, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_control_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_cmd_send, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_control_tx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_implicit_create_pstream, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCAllocControlBuffer, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCFreeControlBuffer, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMILZData, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( bmiBufferSend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMIWriteMemory, libathdrv_sp$(LIBSUFFIX).a ) (.text) + + + # FATFS core symbols + Object OBJECT(FATFSi_lfi2text, libfatfs_sp$(LIBSUFFIX).a) (.text) # 360 BYTEs + Object OBJECT(FATFSi_pc_findin, libfatfs_sp$(LIBSUFFIX).a) (.text) # 904 BYTEs + Object OBJECT(FATFSi_pc_patcmp_vfat, libfatfs_sp$(LIBSUFFIX).a) (.text) # 436 BYTEs + Object OBJECT(FATFSi_pc_ascii_mfile, libfatfs_sp$(LIBSUFFIX).a) (.text) # 160 BYTEs + Object OBJECT(FATFSi_map_ascii_to_unicode, libfatfs_sp$(LIBSUFFIX).a) (.text) # 48 BYTEs + Object OBJECT(SDCARD_Intr_Thread, libfatfs_sp$(LIBSUFFIX).a) (.text) # 520 BYTEs + Object OBJECT(FATFSi_unicode_cmp_to_ascii_char, libfatfs_sp$(LIBSUFFIX).a) (.text) # 40 BYTEs + Object OBJECT(FATFSi_pc_read_blk, libfatfs_sp$(LIBSUFFIX).a) (.text) # 352 BYTEs +} + +#-------- +Ltdautoload LTDMAIN +{ + Address 0x02f88000 + + Object * (.ltdmain) + Library libwm_sp$(LIBSUFFIX).a \ + libnwm_sp$(LIBSUFFIX).a \ + libwvr_sp$(LIBSUFFIX).a \ + libwl_sp$(LIBSUFFIX).a + + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + + Library libfatfs_sp$(LIBSUFFIX).a \ + libaes_sp$(LIBSUFFIX).a + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) +} diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.response.template b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.response.template new file mode 100644 index 00000000..88b18081 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/racoon.response.template @@ -0,0 +1,40 @@ + + + + + -l + + + + + + + -l + + + + -og ,0 -ol + + + + + -l + + + + + + + + -l + + + + -og ,0 -ol + + + + + -l + + diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/src/initScfg.c b/build/tests/DisplaySystemInformation/ARM7_racoon/src/initScfg.c new file mode 100644 index 00000000..611fb1b1 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/src/initScfg.c @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: viewSystemInfo.h + + Copyright **** 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 + +extern void INIT_InitializeScfg(void); + +#include +/*---------------------------------------------------------------------------* + Name: INIT_InitializeScfg + + Description: ローダーが行う SCFG ブロックへの設定処理を代行する為の関数。 + crt0 内の弱シンボルを上書きする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +asm void +INIT_InitializeScfg(void) +{ + // SCFG enable? + ldr r2, =REG_EXT_ADDR + ldr r0, [r2] + tst r0, #REG_SCFG_EXT_CFG_MASK + beq @end + + /* NITRO 互換無線の送受信機能を動作 */ + ldr r1, =REG_WL_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_WL_OFFB_MASK + strh r0, [r1] + + /* 新規サウンドブロックへのクロック供給 */ + ldr r1, =REG_CLK_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_CLK_SNDMCLK_MASK + strh r0, [r1] + + /* ARM7 側の DMA には新 DMA 回路を採用 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + orr r0, r0, #REG_SCFG_EXT_DMAC_MASK + str r0, [r1] + + ldr r2, =HW_PRV_WRAM_SYSRV + //EXT(extentions) + ldr r3, =REG_EXT_ADDR + ldr r0, [r3] + str r0, [r2, #HWi_WSYS04_WRAMOFFSET] + //OPT(bonding option) + ldr r3, =REG_OP_ADDR + ldrb r0, [r3] + //A9ROM(ARM9 ROM) + ldr r3, =REG_A9ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A9ROM_RSEL_MASK | REG_SCFG_A9ROM_SEC_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM9RSEL_SHIFT - REG_SCFG_A9ROM_RSEL_SHIFT) + //A7ROM(ARM7 ROM) + ldr r3, =REG_A7ROM_ADDR + ldrb r1, [r3] + and r12,r1, #(REG_SCFG_A7ROM_RSEL_MASK | REG_SCFG_A7ROM_FUSE_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS08_ROM_ARM7RSEL_SHIFT - REG_SCFG_A7ROM_RSEL_SHIFT) + //DS-WL(DS wireless) + ldr r3, =REG_WL_ADDR + ldrb r1, [r3] + and r12,r1, #REG_SCFG_WL_OFFB_MASK + orr r0, r0, r12, LSL #(HWi_WSYS08_WL_OFFB_SHIFT - REG_SCFG_WL_OFFB_SHIFT) + strb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + //OPT(JTAG info) + ldr r3, =REG_JTAG_ADDR + ldrh r0, [r3] + and r12,r0, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r12, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + //CLK(only wram clock) + ldr r3, =REG_CLK_ADDR + ldrh r1, [r3] + and r12,r1, #(REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK) + orr r0, r0, r12, LSL #(HWi_WSYS09_CLK_SD1HCLK_SHIFT - REG_SCFG_CLK_SD1HCLK_SHIFT) + and r12,r1, #(REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK) + orr r0, r0, r12, LSR #(REG_SCFG_CLK_WRAMHCLK_SHIFT - HWi_WSYS09_CLK_WRAMHCLK_SHIFT) + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] + + /* A7-SCFG ブロックへのアクセスを無効化 */ +// ldr r1, =REG_EXT_ADDR +// ldr r0, [r1] +// bic r0, r0, #REG_SCFG_EXT_CFG_MASK +// str r0, [r1] + +@end: + bx lr +} +#include diff --git a/build/tests/DisplaySystemInformation/ARM7_racoon/src/main.c b/build/tests/DisplaySystemInformation/ARM7_racoon/src/main.c new file mode 100644 index 00000000..ccfd1a6d --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM7_racoon/src/main.c @@ -0,0 +1,992 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: main.c + + Copyright **** 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "address.h" + +#ifdef SDK_SEA +#include +#endif // ifdef SDK_SEA + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define WM_WL_HEAP_SIZE 0x2100 +#define ATH_DRV_HEAP_SIZE 0x5800 +#define WPA_HEAP_SIZE 0x1C00 + +#define MEM_TYPE_WRAM 0 +#define MEM_TYPE_MAIN 1 + +/* Priorities of each threads */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* [TODO] 以下は New WM 側に移行するほうが好ましい? */ +#define NWM_DMANO NWMSP_DMA_7 +#define THREAD_PRIO_NWM_COMMMAND 9 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_NWM_WPA 10 + +// ROM 内登録エリアの拡張言語コード +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(u8 memType); +static OSHeapHandle InitializeAllocateSystemCore(u8 memType); +#ifdef SDK_TWLHYB +static OSHeapHandle InitializeAllocateSystemCoreEx(u8 memType); +#endif +static void DummyThread(void* arg); +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp); +#endif +static void VBlankIntr(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSHeapHandle drvHeapHandle, OSHeapHandle wpaHeapHandle); +/*---------------------------------------------------------------------------* + 外部シンボル参照 + *---------------------------------------------------------------------------*/ +#ifdef SDK_TWLHYB +extern void SDK_LTDAUTOLOAD_LTDWRAM_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LTDMAIN_BSS_END(void); +#endif + + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void TwlSpMain(void) +{ + OSHeapHandle wramHeapHandle, mainHeapHandle; + + + // OS初期化でARM9と同期する前にSCFGの情報を共有メモリに書き出す + // レジスタ情報をコピー + MI_CpuMove16( (void*)REG_ROM_ADDR, DISPINFO_SHARED_SCFG_REG_ADDR, DISPINFO_SHARED_SCFG_REG_SIZE ); + // WRAMに退避されてる分もコピー + MI_CpuMove16( (void*)HWi_WSYS04_ADDR, DISPINFO_SHARED_SCFG_WRAM_ADDR, DISPINFO_SHARED_SCFG_WRAM_SIZE ); + + // OS 初期化 + OS_Init(); + PrintDebugInfo(); + + // NVRAM からユーザー情報読み出し + ReadUserInfo(); + + // ヒープ領域設定 + wramHeapHandle = InitializeAllocateSystem(MEM_TYPE_WRAM); + mainHeapHandle = InitializeAllocateSystem(MEM_TYPE_MAIN); + + // ボタン入力サーチ初期化 + (void)PAD_InitXYButton(); + + // 割り込み許可 + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // ファイルシステム初期化 + FS_Init(FS_DMA_NOT_USE); + FS_CreateReadServerThread(THREAD_PRIO_FS); + + if (OS_IsRunOnTwl() == TRUE) + { + InitializeFatfs(); // FATFS 初期化 +#ifndef SDK_SEA // !暫定処置! + // NWM 初期化 +#ifdef SDK_TWLLTD + InitializeNwm(mainHeapHandle, mainHeapHandle); // LIMITED モードでは 無線のヒープを MAIN から確保 +#else + InitializeNwm(wramHeapHandle, mainHeapHandle); // HYBRID モードでは 無線のヒープを WRAM から確保 +#endif +#endif // ifndef SDK_SEA + AES_Init(THREAD_PRIO_AES); // AES 初期化 + +#ifdef SDK_SEA + SEA_Init(THREAD_PRIO_SEA); +#endif // ifdef SDK_SEA + MCU_InitIrq(THREAD_PRIO_MCU); // MCU 初期化 + + CDC_InitLib(); // CODECライブラリ初期化 + } + + if (OSi_IsCodecTwlMode() == TRUE) + { + // カメラ初期化 + CAMERA_Init(); + /* CODEC が TWL モードでないとシャッター音を強制的に鳴らす + 機能が使用できません。この為、CODEC が TWL モードの場合 + にのみカメラライブラリを使用可能な状態にします。 */ + } + + // サウンド初期化 + SND_Init(THREAD_PRIO_SND); + if (OS_IsRunOnTwl() == TRUE) + { + SNDEX_Init(THREAD_PRIO_SNDEX); + } + + // RTC 初期化 + RTC_Init(THREAD_PRIO_RTC); + + // 旧無線初期化 +#ifndef SDK_SEA // !暫定処置! + WVR_Begin(wramHeapHandle); +#endif // ifdef SDK_SEA + + // SPI 初期化 + SPI_Init(THREAD_PRIO_SPI); + + + while (TRUE) + { + OS_Halt(); + + //---- check reset + if (OS_IsResetOccurred()) + { + //VIB_STOP + CTRDG_VibPulseEdgeUpdate(NULL); + + OS_ResetSystem(); + } + + //---- check pull out cartridge + CTRDG_CheckPullOut_Polling(); + +#ifndef SDK_SMALL_BUILD + //---- check pull out card + CARD_CheckPullOut_Polling(); +#endif + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + if(OS_IsRunOnTwl()) + { + OS_TPrintf("ARM7: This component is running on TWL.\n"); + } + else + { + OS_TPrintf("ARM7: This component is running on NITRO.\n"); + } +#ifdef SDK_SEA +#ifdef SDK_TWLLTD + OS_TPrintf("ARM7: This component is \"armadillo.TWL\"\n"); +#else /* ifdef SDK_TWLLTD */ +#error invalid parameter combination +#endif /* ifdef SDK_TWLLTD else */ +#else /* ifdef SDK_SEA */ +#ifdef SDK_TWLLTD + OS_TPrintf("ARM7: This component is \"racoon.TWL\"\n"); +#else /* ifdef SDK_TWLLTD */ +#ifdef SDK_WIRELESS_IN_VRAM + OS_TPrintf("ARM7: This component is \"ichneumon.TWL\"\n"); +#else /* ifdef SDK_WIRELESS_IN_VRAM */ + OS_TPrintf("ARM7: This component is \"mongoose.TWL\"\n"); +#endif /* ifdef SDK_WIRELESS_IN_VRAM else */ +#endif /* ifdef SDK_TWLLTD else */ +#endif /* ifdef SDK_SEA else */ +} + +#include +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。FATFS初期化関数内でスレッド休止 + する為、休止中動作するダミーのスレッドを立てる。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + OSThread thread; + u32 stack[18]; + + // ダミースレッド作成 + OS_CreateThread(&thread, DummyThread, NULL, + (void*)((u32)stack + (sizeof(u32) * 18)), sizeof(u32) * 18, OS_THREAD_PRIORITY_MAX); + OS_WakeupThreadDirect(&thread); + + + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } + + // ダミースレッド破棄 + OS_KillThread(&thread, NULL); +} +#include + +#include +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSHeapHandle drvHeapHandle, OSHeapHandle wpaHeapHandle) +{ + NwmspInit nwmInit; + + nwmInit.dmaNo = NWM_DMANO; + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + +#ifdef SDK_TWLLTD + nwmInit.drvHeap.id = OS_ARENA_MAIN_SUBPRIV; /* [TODO] */ +#else + nwmInit.drvHeap.id = OS_ARENA_WRAM_SUBPRIV; /* [TODO] */ +#endif + nwmInit.drvHeap.handle = drvHeapHandle; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = OS_ARENA_MAIN_SUBPRIV; /* [TODO] */ + nwmInit.wpaHeap.handle = wpaHeapHandle; + + NWMSP_Init(&nwmInit); + +} +#include + +#include +/*---------------------------------------------------------------------------* + Name: DummyThread + Description: FATFSライブラリ、CDCライブラリを初期化する際に立てるダミーの + スレッド。 + Arguments: arg - 使用しない。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +DummyThread(void* arg) +{ +#pragma unused(arg) + while (TRUE) + { + } +} +#include + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystem(u8 memType) +{ + + OSHeapHandle hh; + +#ifdef SDK_TWLHYB + if( OS_IsRunOnTwl() == TRUE) + { + hh = InitializeAllocateSystemCoreEx(memType); /* Hybrid を TWL で動作させる */ + } + else +#endif + { + hh = InitializeAllocateSystemCore(memType); /* Hybrid を DS で動作させる or Limited */ + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystemCore + Description: メモリ割当てシステムを初期化する。 + Hybrid を DS で動作させた場合、Limited を TWL で動作させた場合に動作 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystemCore(u8 memType) +{ + OSHeapHandle hh; + + /* MAIN */ + if(memType == MEM_TYPE_MAIN) + { + { + void* lo = (void*)OS_GetSubPrivArenaLo(); + void* hi = (void*)OS_GetSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + } + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_MAIN_SUBPRIV, hh); + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + #ifdef SDK_TWLLTD + { + if ((ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE) > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, ATH_DRV_HEAP_SIZE + WPA_HEAP_SIZE); + } + } + #endif + OS_TPrintf("ARM7: MAIN heap size is %d\n", heapSize); + } + } + + /* WRAM */ + if( memType == MEM_TYPE_WRAM) + { + { + void* lo = (void*)OS_GetWramSubPrivArenaLo(); + void* hi = (void*)OS_GetWramSubPrivArenaHi(); + + // アリーナを 0 クリア + MI_CpuClear8(lo, (u32)hi - (u32)lo); + + // メモリ割り当て初期化 + lo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, lo, hi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, lo); + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, lo, hi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + } + + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d\n", heapSize); + } + } + return hh; +} + +#ifdef SDK_TWLHYB +#include +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystemCoreEx + Description: メモリ割当てシステムを初期化する。 + Hybrid を TWL で動作させた場合に動作 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle InitializeAllocateSystemCoreEx(u8 memType) +{ + OSHeapHandle hh; + + if(memType == MEM_TYPE_MAIN) + { + { + void* basicLo = (void*)OS_GetSubPrivArenaLo(); + void* basicHi = (void*)OS_GetSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDMAIN_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_MAIN_MEM_SUB, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: MAIN arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: MAIN arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: MAIN arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: MAIN arena extraHi = %p\n", extraHi); +#endif + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_MAIN_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_MAIN_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_MAIN_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to create MAIN heap.\n"); + } + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + OS_TPrintf("ARM7: MAIN heap size is %d (before AddToHead)\n", heapSize); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_MAIN_SUBPRIV, hh, extraLo, extraHi); + } + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_MAIN_SUBPRIV, hh); + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_MAIN_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to MAIN create heap.\n"); + } + + if ((WPA_HEAP_SIZE) > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WPA_HEAP_SIZE); + } + OS_TPrintf("ARM7: MAIN heap size is %d\n", heapSize); + } + } + + if(memType == MEM_TYPE_WRAM) + { + { + void* basicLo = (void*)OS_GetWramSubPrivArenaLo(); + void* basicHi = (void*)OS_GetWramSubPrivArenaHi(); + void* extraLo = (void*)MATH_ROUNDUP((u32)SDK_LTDAUTOLOAD_LTDWRAM_BSS_END, 32); + void* extraHi = (void*)MATH_ROUNDDOWN(HW_WRAM_A_HYB_END, 32); + +#if SDK_DEBUG + // debug information + OS_TPrintf("ARM7: WRAM arena basicLo = %p\n", basicLo); + OS_TPrintf("ARM7: WRAM arena basicHi = %p\n", basicHi); + OS_TPrintf("ARM7: WRAM arena extraLo = %p\n", extraLo); + OS_TPrintf("ARM7: WRAM arena extraHi = %p\n", extraHi); +#endif + + // アリーナを 0 クリア + MI_CpuClear8(basicLo, (u32)basicHi - (u32)basicLo); + MI_CpuClear8(extraLo, (u32)extraHi - (u32)extraLo); + + // メモリ割り当て初期化 + if ((u32)basicLo < (u32)extraLo) + { + basicLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, basicLo, extraHi, 1); + // アリーナ下位アドレスを設定 + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, basicLo); + } + else + { + extraLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, extraLo, basicHi, 1); + } + + // ヒープ作成 + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, basicLo, basicHi); + + if (hh < 0) + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + if (WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE); + } + OS_TPrintf("ARM7: WRAM heap size is %d (before AddToHeap)\n", heapSize); + } + + // ヒープに拡張ブロックを追加 + OS_AddToHeap(OS_ARENA_WRAM_SUBPRIV, hh, extraLo, extraHi); + } + + // カレントヒープに設定 + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + // ヒープサイズの確認 + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if( heapSize <= 0) /* ヒープ領域の確保に失敗 */ + { + OS_Panic("ARM7: Failed to WRAM create heap.\n"); + } + + if (ATH_DRV_HEAP_SIZE + WM_WL_HEAP_SIZE > heapSize) + { + OS_Panic("Insufficient heap size. (0x%x < 0x%x)\n", heapSize, WM_WL_HEAP_SIZE + ATH_DRV_HEAP_SIZE ); + } + OS_TPrintf("ARM7: WRAM heap size is %d\n", heapSize); + } + } + + return hh; +} +#include +#endif + +#ifdef WM_PRECALC_ALLOWEDCHANNEL +extern u16 WMSP_GetAllowedChannel(u16 bitField); +#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } + +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile b/build/tests/DisplaySystemInformation/ARM9/Makefile new file mode 100644 index 00000000..e9e4bbbd --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile @@ -0,0 +1,44 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 Makefile.2 Makefile.3\ + Makefile.4 Makefile.5 Makefile.6 Makefile.7\ + Makefile.8 Makefile.9 Makefile.10 Makefile.11\ + Makefile.12 Makefile.13 Makefile.14 Makefile.15\ + Makefile.16 Makefile.17 +#SUBMAKES = Makefile.0 + + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +rb: + ruby makeMaking.rb + +do-build : + $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.0 b/build/tests/DisplaySystemInformation/ARM9/Makefile.0 new file mode 100644 index 00000000..cb3eda39 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.0 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 0 +IS_SECURE_APP = FALSE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = TRUE +GAMECODE = 0B0A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.1 b/build/tests/DisplaySystemInformation/ARM9/Makefile.1 new file mode 100644 index 00000000..80bab1c8 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.1 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 1 +IS_SECURE_APP = FALSE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = FALSE +GAMECODE = 0B1A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.10 b/build/tests/DisplaySystemInformation/ARM9/Makefile.10 new file mode 100644 index 00000000..0711243c --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.10 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 10 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = TRUE +INVISIBLE_SCFG = TRUE +GAMECODE = 0B8A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.11 b/build/tests/DisplaySystemInformation/ARM9/Makefile.11 new file mode 100644 index 00000000..27d1ce33 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.11 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 11 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = TRUE +INVISIBLE_SCFG = FALSE +GAMECODE = 0B9A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.12 b/build/tests/DisplaySystemInformation/ARM9/Makefile.12 new file mode 100644 index 00000000..b8fe42b3 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.12 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 12 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = FALSE +INVISIBLE_SCFG = TRUE +GAMECODE = 0BAA +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.13 b/build/tests/DisplaySystemInformation/ARM9/Makefile.13 new file mode 100644 index 00000000..93fd362c --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.13 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 13 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = FALSE +INVISIBLE_SCFG = FALSE +GAMECODE = 0BBA +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.14 b/build/tests/DisplaySystemInformation/ARM9/Makefile.14 new file mode 100644 index 00000000..2cdaeca5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.14 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 14 +IS_SECURE_APP = TRUE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = TRUE +INVISIBLE_SCFG = TRUE +GAMECODE = 022A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.15 b/build/tests/DisplaySystemInformation/ARM9/Makefile.15 new file mode 100644 index 00000000..91ea73d3 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.15 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 15 +IS_SECURE_APP = TRUE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = TRUE +INVISIBLE_SCFG = FALSE +GAMECODE = 023A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.16 b/build/tests/DisplaySystemInformation/ARM9/Makefile.16 new file mode 100644 index 00000000..0c7889df --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.16 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 16 +IS_SECURE_APP = TRUE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = FALSE +INVISIBLE_SCFG = TRUE +GAMECODE = 024A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.17 b/build/tests/DisplaySystemInformation/ARM9/Makefile.17 new file mode 100644 index 00000000..80892409 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.17 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 17 +IS_SECURE_APP = TRUE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = FALSE +INVISIBLE_SCFG = FALSE +GAMECODE = 025A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.2 b/build/tests/DisplaySystemInformation/ARM9/Makefile.2 new file mode 100644 index 00000000..e093bac7 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.2 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 2 +IS_SECURE_APP = FALSE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = TRUE +GAMECODE = 0B2A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.3 b/build/tests/DisplaySystemInformation/ARM9/Makefile.3 new file mode 100644 index 00000000..71dede94 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.3 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 3 +IS_SECURE_APP = FALSE +IS_NAND_APP = FALSE +NAND_ACCESS = FALSE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = FALSE +GAMECODE = 0B3A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.4 b/build/tests/DisplaySystemInformation/ARM9/Makefile.4 new file mode 100644 index 00000000..fbc31554 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.4 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 4 +IS_SECURE_APP = FALSE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = TRUE +GAMECODE = 020A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.5 b/build/tests/DisplaySystemInformation/ARM9/Makefile.5 new file mode 100644 index 00000000..e7c3a0ba --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.5 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 5 +IS_SECURE_APP = FALSE +IS_NAND_APP = TRUE +NAND_ACCESS = TRUE +AES_SLOT = DONTCARE +INVISIBLE_SCFG = FALSE +GAMECODE = 021A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.6 b/build/tests/DisplaySystemInformation/ARM9/Makefile.6 new file mode 100644 index 00000000..2d721c30 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.6 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 6 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = TRUE +INVISIBLE_SCFG = TRUE +GAMECODE = 0B4A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.7 b/build/tests/DisplaySystemInformation/ARM9/Makefile.7 new file mode 100644 index 00000000..1fc0debe --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.7 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 7 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = TRUE +INVISIBLE_SCFG = FALSE +GAMECODE = 0B5A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.8 b/build/tests/DisplaySystemInformation/ARM9/Makefile.8 new file mode 100644 index 00000000..5e6f23c9 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.8 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 8 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = FALSE +INVISIBLE_SCFG = TRUE +GAMECODE = 0B6A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/Makefile.9 b/build/tests/DisplaySystemInformation/ARM9/Makefile.9 new file mode 100644 index 00000000..96a07b8c --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/Makefile.9 @@ -0,0 +1,143 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### +FILE_IDX = 9 +IS_SECURE_APP = TRUE +IS_NAND_APP = FALSE +NAND_ACCESS = TRUE +AES_SLOT = FALSE +INVISIBLE_SCFG = FALSE +GAMECODE = 0B7A +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/filemove.rb b/build/tests/DisplaySystemInformation/ARM9/filemove.rb new file mode 100755 index 00000000..6fb1af4c --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/filemove.rb @@ -0,0 +1,23 @@ +#! ruby -Ks +startDir = "/cygdrive/c/home/TWL_IPL/build/tests/DisplaySystemInformation/ARM9/bin/ARM9-TS.LTD.thumb/Rom" +dstDir = "/cygdrive/c/home/TWL_IPL/build/tests/DisplaySystemInformation/ARM9/bin/ARM9-TS.LTD.thumb/roms" + +Dir::chdir "./bin/ARM9-TS.LTD.thumb/Rom" + +dirList = Dir::entries "." +`mkdir #{dstDir}` + +for dir in dirList + + puts "===== #{dir} =====" + Dir::chdir "./#{dir}" + + Dir::glob("./*.{tad,srl}").each {|f| + puts "cp #{f} #{dstDir}/" + `cp #{f} #{dstDir}/` + } + + + + Dir::chdir startDir +end diff --git a/build/tests/DisplaySystemInformation/ARM9/main_normal.rsf b/build/tests/DisplaySystemInformation/ARM9/main_normal.rsf new file mode 100644 index 00000000..10ed7d54 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/main_normal.rsf @@ -0,0 +1,250 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "DispInfo" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + #BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + BannerFile ../banner/$(DISPINFO_GAMECODE).bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess $(DISPINFO_SDACCESS) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess $(DISPINFO_NANDACCESS) + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + LockSCFG $(DISPINFO_LOCKSCFG) + +# AESSlotフラグはノーマルアプリでは利用できない + HwAESSlotA_SSLClientCert FALSE + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType $(DISPINFO_APPTYPE) + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media $(DISPINFO_MEDIA) + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure $(DISPINFO_SECURE) + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(DISPINFO_GAMECODE) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile FALSE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/tests/DisplaySystemInformation/ARM9/main_secure.rsf b/build/tests/DisplaySystemInformation/ARM9/main_secure.rsf new file mode 100644 index 00000000..3f2e6385 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/main_secure.rsf @@ -0,0 +1,247 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + + # TITLE NAME: Your product name within 12bytes + # + TitleName "DispInfo" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/$(DISPINFO_GAMECODE).bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess $(DISPINFO_SDACCESS) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess $(DISPINFO_NANDACCESS) + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + LockSCFG $(DISPINFO_LOCKSCFG) + HwAESSlotA_SSLClientCert $(DISPINFO_AES) + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + #Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType $(DISPINFO_APPTYPE) +# AppType SYSTEM + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media $(DISPINFO_MEDIA) +# Media NAND + # + # Data only title : [TRUE/FALSE] + # don't have to edit + ##DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure $(DISPINFO_SECURE) +# Secure TRUE + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(DISPINFO_GAMECODE) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile FALSE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/tests/DisplaySystemInformation/ARM9/makeConditions.txt b/build/tests/DisplaySystemInformation/ARM9/makeConditions.txt new file mode 100644 index 00000000..99e6ff33 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/makeConditions.txt @@ -0,0 +1,19 @@ +FILE_IDX IS_SECURE_APP IS_NAND_APP NAND_ACCESS AES_SLOT INVISIBLE_SCFG GAMECODE +0 0 0 1 D 1 0B0A +1 0 0 1 D 0 0B1A +2 0 0 0 D 1 0B2A +3 0 0 0 D 0 0B3A +4 0 1 1 D 1 020A +5 0 1 1 D 0 021A +6 1 0 1 1 1 0B4A +7 1 0 1 1 0 0B5A +8 1 0 1 0 1 0B6A +9 1 0 1 0 0 0B7A +10 1 0 0 1 1 0B8A +11 1 0 0 1 0 0B9A +12 1 0 0 0 1 0BAA +13 1 0 0 0 0 0BBA +14 1 1 1 1 1 022A +15 1 1 1 1 0 023A +16 1 1 1 0 1 024A +17 1 1 1 0 0 025A diff --git a/build/tests/DisplaySystemInformation/ARM9/makeFooter.txt b/build/tests/DisplaySystemInformation/ARM9/makeFooter.txt new file mode 100644 index 00000000..6231895a --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/makeFooter.txt @@ -0,0 +1,115 @@ +###################################### + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + + +MACRO_FLAGS += -DNAM_ENABLE=$(IS_SECURE_APP) -DDISPINFO_BIN_IDX=$(FILE_IDX) +TWL_NANDAPP = $(IS_NAND_APP) + +DISP_INFO = $(call eupath,$(TWL_IPL_RED_ROOT)/build/tests/DisplaySystemInformation) + +SUBDIRS = + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c viewSystemInfo.c drawFunc.c control.c\ + strResource.c misc.c util.c\ + get_versionData.c get_sysmenu.c get_scfg.c get_owner.c\ + get_hw.c get_parental.c get_other.c\ + get_secureUser.c get_font.c get_wl.c get_whitelist.c\ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include \ + $(DISP_INFO)/common/include \ + $(ES_ROOT)/twl/include + +TARGET_BIN = DispInfo_$(FILE_IDX).$(FILE_SUFFIX) + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + + + +#============================================================================= + +include $(TWLSDK_ROOT)/add-ins/es/commondefs.es +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifeq ($(IS_SECURE_APP),TRUE) + DEFAULT_COMP_ARM7 = armadillo + WRAM_MAP = MAP_TS_SCR + APPTYPE = SYSTEM + MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + ROM_SPEC = main_secure.rsf + MAKETAD_OPTION += -s +else + WRAM_MAP = $(MAKEROM_WRAM_MAPPING) + DEFAULT_COMP_ARM7 = racoon + APPTYPE = USER + ROM_SPEC = main_normal.rsf +endif + +ifeq ($(IS_NAND_APP),TRUE) + MEDIA = NAND + FILE_SUFFIX = tad +else + MEDIA = GAMECARD + FILE_SUFFIX = srl +endif + +ifeq ($(INVISIBLE_SCFG),TRUE) + SCFG_SUFFIX = LockSCFG +else + SCFG_SUFFIX = UnlockSCFG +endif + +BINDIR = ./bin/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) +OBJDIR = ./obj/$(TWL_BUILDTYPE)/DispInfo_$(FILE_IDX) + + +MAKEROM_FLAGS += -DDISPINFO_WRAM_MAP=$(WRAM_MAP) \ + -DDISPINFO_APPTYPE=$(APPTYPE) \ + -DDISPINFO_SECURE=$(IS_SECURE_APP) \ + -DDISPINFO_MEDIA=$(MEDIA) \ + -DDISPINFO_NANDACCESS=$(NAND_ACCESS) \ + -DDISPINFO_LOCKSCFG=$(INVISIBLE_SCFG) \ + -DDISPINFO_AES=$(AES_SLOT) \ + -DDISPINFO_GAMECODE=$(GAMECODE) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + + +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7_$(DEFAULT_COMP_ARM7)/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +#include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/ARM9/makeHeader.txt b/build/tests/DisplaySystemInformation/ARM9/makeHeader.txt new file mode 100644 index 00000000..0fcb308b --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/makeHeader.txt @@ -0,0 +1,21 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - DisplaySystemInformation +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +###################################### \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/makeMaking.rb b/build/tests/DisplaySystemInformation/ARM9/makeMaking.rb new file mode 100755 index 00000000..06b04a2a --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/makeMaking.rb @@ -0,0 +1,54 @@ +fHead = open("makeHeader.txt") +fFoot = open("makeFooter.txt") +contentHead = fHead.read +contentFoot = fFoot.read +fHead.close +fFoot.close + +fCond = open("makeConditions.txt") +numArg = 0 + +argList = Array.new +fCond.gets.split(/\s+/).each do |arg| + numArg += 1 + argList.push arg +end + +puts "argList" +puts argList + + +fileIdx = 0 + +while l = fCond.gets + next if l[0] == '#' + argIdx = 0 + + puts "file making: Makefile." + fileIdx.to_s + f = open("Makefile." + fileIdx.to_s, "w") + f.puts contentHead + + l.split(/\t+/).each do |value| + strVal = "TRUE" if value == "1" + strVal = "FALSE" if value == "0" + strVal = "DONTCARE" if value == "D" + + if argList[argIdx] == "GAMECODE" || argList[argIdx] == "FILE_IDX" + argSet = "#{argList[argIdx]}\t=\t#{value}" + else + argSet = "#{argList[argIdx]}\t=\t#{strVal}" + end + + f.puts argSet + + argIdx += 1 + end + + f.puts contentFoot + f.close + fileIdx += 1 +end + +fCond.close + +(0...fileIdx).each{ |i| print "Makefile.#{i} "} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/control.c b/build/tests/DisplaySystemInformation/ARM9/src/control.c new file mode 100644 index 00000000..d74e83d5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/control.c @@ -0,0 +1,425 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: control.c + + Copyright **** 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 "misc.h" +#include "drawFunc.h" +#include "control.h" +#include "strResource.h" +#include "viewSystemInfo.h" + +#define SAVE_COUNT_MASK 0x7f // saveCountの値の範囲をマスクする。(0x00-0x7f) + + +// TSFヘッダ +typedef struct TSFHeader{ + union digest { + u8 sha1[ SVC_SHA1_DIGEST_SIZE ]; // SHA-1ダイジェスト + u8 rsa[ RSA_KEY_LENGTH ]; // RSA署名 + u8 dst[ RSA_KEY_LENGTH ]; // 転送用の最大サイズ要素 + }digest; + u8 version; // データver. + u8 saveCount; // セーブカウント(ミラーリングしないファイルは使用しない) + u8 rsv[2]; // 予約 + u32 bodyLength; // データ長 +}TSFHeader; // 134bytes + +static const char *s_TSDPath[] = { + (const char *)"nand:/shared1/TWLCFG0.dat", + (const char *)"nand:/shared1/TWLCFG1.dat", +}; + + +static int selectLine[ROOTMENU_SIZE+1]; +BOOL resetUserData( void ); +BOOL breakUserData( u8 idx ); +BOOL resetRTC( void ); +static void TSDi_ClearSettingsDirect( LCFGTWLSettingsData *pTSD ); +static BOOL LCFGi_TSD_WriteSettingsDirectForRecovery( const LCFGTWLSettingsData *pSrcInfo, int index ); +static BOOL LCFGi_TSF_WriteFile( char *pPath, TSFHeader *pHeader, const void *pSrcBody, u8 *pSaveCount ); + + + +BOOL executeControl( int *line, int *changeLine, u8 *mode ) +{ + BOOL controlFlag = FALSE; + + // 上下で項目変更 + if( ( pad.trg & PAD_KEY_UP ) || ( pad.trg & PAD_KEY_DOWN ) ) + { + controlFlag = TRUE; + *changeLine = !*changeLine; + } + + if( ( pad.trg & PAD_BUTTON_A ) && *changeLine ) + { + BOOL result = TRUE; + controlFlag = TRUE; + + *mode |= MODE_RESULT_DISPLAY_MASK; + + switch( *line ) + { + case MENU_RESET_INFO: + result = resetUserData(); + break; + + case MENU_BREAK_DATA: + result &= breakUserData(0); + result &= breakUserData(1); + break; + + case MENU_RTC_RESET: + result = resetRTC(); + break; + } + + *mode = (u8) ((*mode & ~MODE_RESULT_MASK ) | ( result << MODE_RESULT_SHIFT) ); + } + + // Bでキャンセルして戻る + if( (pad.trg & PAD_BUTTON_B) || + ( ( pad.trg & PAD_BUTTON_A ) && !*changeLine) ) + { + controlFlag = TRUE; + *mode = 0; + } + + return controlFlag; +} + +ChangeCotnrolResult changeControl( int *menu, int *line, int *changeLine, u8 *mode ) +{ + int linemax = gAllInfo[*menu][*line].numKindName; + BOOL controlFlag = FALSE; + + if( !gAllInfo[*menu][*line].changable ) + { + // 何かの間違い + *mode = 0; + return CHANGE_CONTROL; + } + + // 上下で項目変更 + if( pad.trg & PAD_KEY_UP ) + { + controlFlag = TRUE; + + if( --(*changeLine) < 0 ) + { + // ラインをデクリメントした結果マイナスになったら一番最後へ + *changeLine = linemax - 1; + } + } + else if( pad.trg & PAD_KEY_DOWN ) + { + controlFlag = TRUE; + + if( ++(*changeLine) >= linemax ) + { + // ラインをインクリメントした結果、maxlineを超えたら最初へ + *changeLine = 0; + } + } + + if( pad.trg & PAD_BUTTON_A ) + { + switch( gAllInfo[*menu][*line].argType ) + { + case ARG_INT: + gAllInfo[*menu][*line].changeFunc.cInt(*changeLine); + break; + + case ARG_BOOL: + gAllInfo[*menu][*line].changeFunc.cBool(*changeLine); + break; + + case ARG_OTHER: + // 論理値でもintでも渡せない関数は残念な対応をする + if( *menu == MENU_SCFG_ARM7 && *line == SCFG_ARM9_RST_DSP ) + { + *changeLine == 0 ? SCFG_ReleaseResetDSP(): SCFG_ResetDSP(); + } + else if( *menu == MENU_SCFG_ARM7 && *line == SCFG_ARM9_EXT_PS ) + { + SCFGPsramBoundary idx = SCFG_PSRAM_BOUNDARY_4MB; + + switch(*changeLine) + { + case 0: + idx = SCFG_PSRAM_BOUNDARY_4MB; + break; + case 1: + idx = SCFG_PSRAM_BOUNDARY_16MB; + break; + case 2: + idx = SCFG_PSRAM_BOUNDARY_32MB; + break; + } + + SCFG_SetPsramBoundary( idx ); + + } + + else if( *menu == MENU_SCFG_ARM7 && *line == SCFG_ARM9_EXT_CFG ) + { + if( *changeLine == 0 ) + { + SCFG_SetConfigBlockInaccessible(); + } + } + + break; + } + + return CHANGE_VALUE_CHANGED; + } + + // Bでキャンセルして戻る + if( pad.trg & PAD_BUTTON_B ) + { + controlFlag = TRUE; + *mode = 0; + } + + return controlFlag ? CHANGE_CONTROL : CHANGE_NOTHING ; +} + + +BOOL control( int *menu, int *line, int *changeLine, u8 *mode ) +{ + int linemax = s_numMenu[*menu]; // 選択中ページの項目数 + BOOL controlFlag = FALSE; // 何か操作があったらTRUEになる + + // 上下で項目変更 + if( pad.trg & PAD_KEY_UP ) + { + controlFlag = TRUE; + + if( --(*line) < 0 ) + { + // ラインをデクリメントした結果マイナスになったら一番最後へ + *line = linemax - 1; + } + } + else if( pad.trg & PAD_KEY_DOWN ) + { + controlFlag = TRUE; + + if( ++(*line) >= linemax ) + { + // ラインをインクリメントした結果、maxlineを超えたら最初へ + *line = 0; + } + } + + // 左右でページ送り + if( pad.trg & PAD_KEY_RIGHT ) + { + controlFlag = TRUE; + *line += DISP_NUM_LINES - 2; + + if( *line >= linemax ) + { + *line = linemax - 1; + } + } + else if( pad.trg & PAD_KEY_LEFT ) + { + controlFlag = TRUE; + *line -= DISP_NUM_LINES - 2; + + if( *line < 0 ) + { + *line = 0; + } + } + + // Aボタン + if( pad.trg & PAD_BUTTON_A ) + { + if(*menu == MENU_ROOT) + { + controlFlag = TRUE; + + switch( *line ) + { + case MENU_ROOT : + case MENU_OWNER: + case MENU_PARENTAL: + case MENU_SECURE_USER: + case MENU_OTHER: + case MENU_NORMAL_HW: + case MENU_SECURE_HW: + case MENU_SCFG_ARM7: + case MENU_SCFG_ARM9: + case MENU_SYSMENU: + case MENU_FONT: + case MENU_WL: + case MENU_WHITE: + case MENU_VERSION: + // 今の画面の選択位置を記録 + selectLine[ROOTMENU_SIZE] = *line; + + // 次のメニュー画面を開く + *menu = *line; + *line = selectLine[*menu]; + break; + + case MENU_RESET_INFO: + case MENU_BREAK_DATA: + case MENU_RTC_RESET: + *mode |= MODE_EXECUTE_MASK; + *changeLine = 0; // デフォルト位置をcancelにしておく + break; + } + } + else if( *menu != MENU_VERSION && *menu != MENU_FONT && gAllInfo[*menu][*line].changable ) + { + controlFlag = TRUE; + + // 変更可能な項目は変更画面を開く + *mode |= MODE_CHANGE_MASK; + *changeLine = gAllInfo[*menu][*line].iValue; + } + + } + + if( pad.trg & PAD_BUTTON_B ) + { + if( *menu != MENU_ROOT ) + { + controlFlag = TRUE; + + // 設定値表示画面のときはルートに戻る + selectLine[*menu] = *line; + *menu = MENU_ROOT; + *line = selectLine[ROOTMENU_SIZE]; + } + } + + if( ( pad.trg & PAD_BUTTON_SELECT ) && *menu == MENU_SCFG_ARM7 ) + { + controlFlag = TRUE; + + // ARM7SCFGの表示データを切り替える + switchViewMode(); + } + + return controlFlag; +} + +BOOL resetUserData( void ) +// idx(0 or 1)番目のユーザデータをリセットする +{ + LCFGTWLTPCalibData calib; + // DisplayInitで一回Readしてるからいらんかった +// u8 *dataBuf = (u8*) Alloc (LCFG_READ_TEMP); + +// LCFG_ReadTWLSettings( (u8 (*)[ LCFG_READ_TEMP ])dataBuf ); + + // バックアップをつぶすために二回書き込む + LCFG_TSD_GetTPCalibration( &calib ); // TPキャリブレーションは残す。 + LCFG_ClearTWLSettings( LCFG_TSD_GetInstalledSoftBoxCount() ); + LCFG_TSD_SetTPCalibration( &calib ); + + if( ! LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ]) gBufLCFG ) ) + { + OS_TPrintf( "Write Setting failed.\n" ); + return FALSE; + } + + if( ! LCFG_WriteTWLSettings( (u8 (*)[ LCFG_WRITE_TEMP ]) gBufLCFG ) ) + { + OS_TPrintf( "Write Setting failed.\n" ); + return FALSE; + } + + OS_TPrintf("Clear Setting Succeeded.\n" ); + +// TSDi_ClearSettingsDirect( (LCFGTWLSettingsData *)(&dataBuf[ LCFG_TEMP_BUFFER_SIZE*idx ]) ); +// LCFGi_TSD_WriteSettingsDirectForRecovery( (LCFGTWLSettingsData *)&dataBuf[ LCFG_TEMP_BUFFER_SIZE*idx ], idx ); + + return TRUE; +} + +BOOL breakUserData( u8 idx ) +{ + // LCFG APIを使わずに、FSレベルでファイルを読んで、データを破壊してから書き戻す + FSFile file; + u8 *fileBuf = (u8*) Alloc ( LCFG_TEMP_BUFFER_SIZE ); + + FS_InitFile( &file ); + + if( !FS_OpenFileEx( &file, s_TSDPath[idx], FS_FILEMODE_R | FS_FILEMODE_W ) ) + { + OS_TPrintf("OpenFile failed. result: %d path: %s\n", FS_GetArchiveResultCode(&file), s_TSDPath[idx]); + return FALSE; + } + + // 適当にデータを壊す + MI_CpuFill8( fileBuf, 0xFF, LCFG_TEMP_BUFFER_SIZE ); + + // データの書き戻し + FS_SeekFileToBegin( &file ); + + if( FS_WriteFile( &file, fileBuf, LCFG_TEMP_BUFFER_SIZE ) == -1 ) + { + OS_TPrintf("writeFile failed. path: %s\n", s_TSDPath[idx]); + return FALSE; + } + + FS_CloseFile( &file ); + + OS_TPrintf("Breaking UserData Succeeded. path: %s\n", s_TSDPath[idx]); + return TRUE; +} + + +BOOL resetRTC( void ) +{ + RTCResult result; + RTCDate date; + RTCTime time; + + date.year = 0; + date.month = 1; + date.day = 1; + date.week = RTC_WEEK_SUNDAY; + + time.hour = 0; + time.minute = 0; + time.second = 0; + + // resultは成功したらゼロが返る + result = RTC_SetDate( &date ); + if( result != RTC_RESULT_SUCCESS ) + { + OS_TPrintf("RTC Date Reset Failed. err: %d", result ); + return FALSE; + } + + result |= RTC_SetTime( &time ); + if( result != RTC_RESULT_SUCCESS ) + { + OS_TPrintf("RTC Time Reset Failed. err: %d", result ); + return FALSE; + } + + return TRUE; +} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/control.h b/build/tests/DisplaySystemInformation/ARM9/src/control.h new file mode 100644 index 00000000..93598285 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/control.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: control.h + + Copyright **** 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 __DISPLAY_SYSTEM_CONTROL_H__ +#define __DISPLAY_SYSTEM_CONTROL_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum ChangeCotnrolResult{ + CHANGE_NOTHING, + CHANGE_CONTROL, + CHANGE_VALUE_CHANGED +} ChangeCotnrolResult; + +BOOL executeControl( int *line, int *changeLine, u8 *mode ); +ChangeCotnrolResult changeControl( int *menu, int *line, int *changeLine, u8 *changeMode ); +BOOL control( int *menu, int *line, int *changeLine, u8 *changeMode ); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.c b/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.c new file mode 100644 index 00000000..ea3c8eba --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.c @@ -0,0 +1,1085 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: drawFunc.c + Copyright **** 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 "drawFunc.h" +#include "getInformation.h" +#include "viewSystemInfo.h" +#include "misc.h" +#include "strResource.h" +#include "myIoreg_SCFG.h" + + + +// 描画関連 +#define HEADER_UP 0 +#define HEADER_LEFT 10 +#define PAGE_LEFT 160 +#define FOOTER_UP 110 +#define FOOTER_LEFT 10 +#define ALLOW_LEFT 0 + +#define AST_LEFT ( ALLOW_LEFT + LINE_OFFSET ) +#define KIND_UP 10 // 項目名の上座標 +#define KIND_LEFT ( AST_LEFT + 10 ) // 項目名の左座標 +#define VALUE_UP KIND_UP // 項目値の上座標 +#define VALUE_LEFT 140 // 項目値の左座標 +#define LINE_OFFSET 15 // 1行ごとのオフセット +#define ROW_OFFSET 15 // 長い項目が現れたときの段組用 + +#define REGISTER_NAME_LEFT 10 +#define REGISTER_NAME_UP 15 +#define REGISTER_DATA_LEFT 50 +#define REGISTER_DATA_UP 15 + +#define FOOTER_REGIST 0 +#define FOOTER_CONTROL1 1 +#define FOOTER_CONTROL2 2 +#define FOOTER_MENU 3 +#define FOOTER_LINES 4 + +#define CHANGE_ITEMNAME_UP 20 +#define CHANGE_ITEMNAME_LEFT 20 +#define CHANGE_VALUE_LEFT 80 +#define CHANGE_VALUE_UP 80 +#define CHANGE_ALLOW_LEFT (CHANGE_VALUE_LEFT - 15) +#define CHANGE_NOW_SETTING_UP 150 + +#define RESULT_LEFT CHANGE_ITEMNAME_LEFT +#define RESULT_UP CHANGE_NOW_SETTING_UP + + +#define SCROLL_MARGIN 2 // 画面端何行でスクロールするか + +#define UNIQUE_BUF 12 +#define BINARY_BUF 18 + +/* global variables -------------------- */ + +static int gDrawIdx[ROOTMENU_SIZE+1] = {0}; // 今何項目目から下を描画しているのか +static int gMenuLineSize[ROOTMENU_SIZE] = {}; // 各メニューの全体行数 +static const int gRegisterIdx[2][SCFG_ARM7_MENU_SIZE]; +static BOOL gSelectedARM7SCFGReg = TRUE; // ARM7SCFGでレジスタサイドの描画ならtrue,共有領域ならfalse + +/* function prototypes -------------------- */ + +void calibrateDrawIdx( int menu, int idx ); +void printData( int x, int y, int color, DispInfoEntry *entry ); +void printValue( int menu,int entryLine, int drawOffset, DispInfoEntry *entry ); +void printKindName( int menu, int entryLine, int drawOffset, int selected ); +void printBinary16( int x, int y, u16 value, int selected, int selectSize ); +void printBinary32( int x, int y, u32 value, int selected, int selectSize ); +void drawRegister( int menu, int selected ); +void drawChangeMode( DispInfoEntry *Entry, int changeLine ); +void drawExecuteMode( const char *command, int changeLine, u8 mode ); +void drawFontInfo( int idx, int drawLine, int selected ); +void drawVersion( int idx, int drawLine ,int selected ); +void printUniqueID( int drawLineOffset, char *uniqueId ); +int getPageNum( int valueIdx, const int* pageOffset ); +int countMenuLine( int menu ); +int countLinesDown( int menu, int idx ); + +void drawHeader( int menu, int line) +// 画面端に簡単な情報を表示する +{ + u16 buf[256]; + +#ifdef VERSION_VIEWER + PrintfSJISSub( HEADER_LEFT, HEADER_UP, TXT_COLOR_RED, "%s $Rev$" , "AppVesionViewer" ); +#else + PrintfSJISSub( HEADER_LEFT, HEADER_UP, TXT_COLOR_RED, "%s %d $Rev$" , "DisplaySystemInfo", DISPINFO_BIN_IDX ); +#endif + + if( menu != MENU_ROOT ) + { + swprintf(buf, 256, L"Root > %s", s_strRootMenu[menu] ); + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_MENU * LINE_OFFSET, TXT_COLOR_BLUE, buf ); + + swprintf(buf, 256, L"%d / %d", line+1 , s_numMenu[menu] ); + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_LINES * LINE_OFFSET, TXT_COLOR_BLUE, buf ); + } + else + { + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_MENU * LINE_OFFSET, TXT_COLOR_BLUE, (const u16 *)L"Root" ); + swprintf(buf, 256, L"%d / %d", line+1 , ROOTMENU_SIZE ); + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_LINES * LINE_OFFSET, TXT_COLOR_BLUE, buf ); + } + +#ifndef VERSION_VIEWER + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_CONTROL1 * LINE_OFFSET, TXT_COLOR_BLUE, (const u16 *)L" A: Decide B: Back "); + + if( menu == MENU_SCFG_ARM7 ) + { + PrintfSJISSub( FOOTER_LEFT, FOOTER_UP + FOOTER_REGIST * LINE_OFFSET, TXT_COLOR_RED, s_strSCFGViewMode[ gSelectedARM7SCFGReg ] ); + PutStringUTF16Sub( FOOTER_LEFT, FOOTER_UP + FOOTER_CONTROL2 * LINE_OFFSET, TXT_COLOR_BLUE, (const u16 *)L" Select: Switch Viewing Area" ); + } +#endif +} + +void printData( int x, int y, int color, DispInfoEntry *entry ) +{ + if( entry->isNumData ) + { + // 数値データだったらそのままプリント + PrintfSJIS( x, y, color, "%d", entry->iValue ); + } + else if( entry->isSjis ) + { + if( entry->str.sjis == s_strCorrect[0] ) + { + color = TXT_COLOR_RED; + } + + // SJIS文字列 + PrintfSJIS( x, y, color, "%s", entry->str.sjis ); + } + else + { + // UTF16文字列 + PutStringUTF16( x, y, color, entry->str.utf ); + } + +} + +int countMenuLine( int menu ) +{ + int i; + int sum = 0; + + for( i=0; ifromLCFG ) + { + // LCFG経由で取得したデータは青にする + txtColor = TXT_COLOR_BLUE; + } + + ////////////////////////////////////////////// + // 特殊描画を行う必要がある場合の処理はここ // + ////////////////////////////////////////////// + + if( menu == MENU_OWNER && entryLine == OWNER_COLOR ) + { + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawOffset, TXT_UCOLOR_GRAY + entry->iValue , "■" ); + printData( VALUE_LEFT + LINE_OFFSET , VALUE_UP + LINE_OFFSET*drawOffset, txtColor, entry ); + return; + } + + if( menu == MENU_NORMAL_HW && entryLine == NORMAL_HW_UNIQUE_ID ) + { + printUniqueID( drawOffset, entry->str.sjis ); + entry->numLines = 4; + return; + } + + if( menu == MENU_PARENTAL && entryLine == PARENTAL_PASSWORD ) + { + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawOffset, txtColor, "%04d", entry->iValue ); + return; + } + + if( menu == MENU_SYSMENU && entryLine == SYSMENU_VERSION_NUM ) + { + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawOffset, + txtColor, "%d.%d", entry->iValue >> 16, entry->iValue & 0xFFFF ); + return; + } + + if( ( menu == MENU_SYSMENU && entryLine == SYSMENU_TIMESTAMP )|| + ( menu == MENU_FONT && entryLine == FONT_TIMESTAMP )) + { + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawOffset, txtColor, "%08lx", entry->iValue ); + return; + } + + if( menu == MENU_SECURE_HW && entryLine == SECURE_HW_LAUNCHER_ID ) + { + char buf[5]; + + if( entry->iValue == 0 ) + { + // 情報が受け取れていない状態 + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET * (1 + drawOffset), txtColor, s_strNA ); + } + + MI_CpuCopy( &(entry->iValue), buf, 4 ); + buf[4] = '\0'; + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET * (1 + drawOffset), txtColor, "%s", buf ); + return; + } + + if( ( menu == MENU_SECURE_HW && entryLine == SECURE_HW_FUSE ) || + ( menu == MENU_OTHER && entryLine == OTHER_RTC_OFFSET ) || + ( menu == MENU_OTHER && entryLine == OTHER_TP_RSV ) ) + { + // 16文字を8文字の二段組みに変更 + char buf[9] = {0}; + STD_StrLCpy( buf, entry->str.sjis , 9 ); + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET * drawOffset, txtColor, "%s", buf ); + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET * (1+drawOffset), txtColor, "%s", &(entry->str.sjis[8]) ); + return; + } + + if( ( menu == MENU_SYSMENU && entryLine == SYSMENU_EULA_URL ) || + ( menu == MENU_SYSMENU && entryLine == SYSMENU_NUP_HOST )) + { + char buf[17] = {0}; + int i, lineOffset = 0; + + for( i = 0; i < STD_StrLen( entry->str.sjis ) ; i+=16 ) + { + STD_StrLCpy( buf, &(entry->str.sjis[i]), 17 ); + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET * ( drawOffset + lineOffset++), txtColor, "%s", buf ); + } + + entry->numLines = lineOffset > 0 ? lineOffset : 1; + return; + } + + if( ( menu == MENU_OWNER && entryLine == OWNER_COMMENT ) || + ( menu == MENU_PARENTAL && entryLine == PARENTAL_ANSWER )) + { + u16 buf[11] = {0}; + int i, lineOffset = 0; + + for( i = 0; i < wcslen( entry->str.utf ) ; i+=10 ) + { + MI_CpuCopy( &(entry->str.utf[i]), buf, 20 ); + PutStringUTF16( VALUE_LEFT, VALUE_UP + LINE_OFFSET * ( drawOffset + lineOffset++), txtColor, buf ); + } + + // 項目が空文字しかないときでも1行表示だけはされるようにする + entry->numLines = lineOffset > 0 ? lineOffset : 1; + + return; + } + + + ////////////////////////// + // 通常の項目描画はここ // + ////////////////////////// + + if( entry->isAligned ) + { + printData( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawOffset, txtColor, entry ); + } + else + { + // 項目名が長くて字下げが必要な場合 + printData( VALUE_LEFT, VALUE_UP + LINE_OFFSET* ( drawOffset + 1 ), txtColor, entry ); + } +} + +void drawRegister( int menu, int selected ) +{ +#ifndef VERSION_VIEWER + // SCFGレジスタのバイナリをサブ画面に描画する + int selectRegSize = 1; + int selectBitNum; + + if( menu == MENU_SCFG_ARM7 && selected < SCFG_ARM7_MI_SC1_CDET) + { + // ARM7の前半4つ + u32 regRom = 0; + u16 regClk = 0; + u16 regJtag = 0; + u32 regExt = 0; + selectBitNum = gRegisterIdx[0][selected]; + + regRom = MI_LoadLE32( &gArm7SCFGReg[DISP_REG_ROM_OFFSET - 0x4000] ); + regClk = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_CLK_OFFSET - 0x4000] ); + regJtag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_JTAG_OFFSET - 0x4000] ); + regExt = MI_LoadLE32( &gArm7SCFGReg[DISP_REG_EXT_OFFSET - 0x4000] ); + + if( selected == SCFG_ARM7_EXT_PS ) + { + selectRegSize = 2; + } + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP, TXT_COLOR_BLACK, s_strARM7RegisterName[0] ); + printBinary32( REGISTER_DATA_LEFT, REGISTER_DATA_UP, regRom, selectBitNum, selectRegSize); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 2*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[1] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 2*LINE_OFFSET, regClk, selectBitNum - 32, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 3*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[2] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 3*LINE_OFFSET, regJtag, selectBitNum - 48, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 4*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[3] ); + printBinary32( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 4*LINE_OFFSET, regExt, selectBitNum - 64, selectRegSize ); + } + else if( menu == MENU_SCFG_ARM7 && selected >= SCFG_ARM7_MI_SC1_CDET ) + { + // SCFGの後半4つ + u32 regMc1 = MI_LoadLE32( &gArm7SCFGReg[DISP_REG_MC_OFFSET - 0x4000] ); + u16 regMc2 = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_MC2_OFFSET - 0x4000] ); + u16 regOldWL = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_WL_OFFSET - 0x4000] ); + u16 regOption = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_OP_OFFSET - 0x4000] ); + selectBitNum = gRegisterIdx[0][selected]; + + if( selected == SCFG_ARM7_MI_SC1_MODE || + selected == SCFG_ARM7_MI_SC2_MODE || + selected == SCFG_ARM7_OP_FORM || + selected == SCFG_ARM7_OP_APP ) + { + selectRegSize = 2; + } + else if( selected == SCFG_ARM7_MI_CC || selected == SCFG_ARM7_MI_CA ) + { + selectRegSize = 16; + } + + // 描画 + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP, TXT_COLOR_BLACK, s_strARM7RegisterName[4] ); + printBinary32( REGISTER_DATA_LEFT, REGISTER_DATA_UP, regMc1, selectBitNum - 96, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 2*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[5]); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 2*LINE_OFFSET, regMc2, selectBitNum - 128, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 3*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[6] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 3*LINE_OFFSET, regOldWL, selectBitNum - 144, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 4*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM7RegisterName[7] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 4*LINE_OFFSET, regOption, selectBitNum - 160, selectRegSize ); + + } + else if( menu == MENU_SCFG_ARM9 ) + { + // ARM9側のSCFGレジスタセット + u16 regRom = MI_LoadLE16( (void*) (HW_IOREG + REG_A9ROM_OFFSET) ); + u16 regClk = MI_LoadLE16( (void*) (HW_IOREG + REG_CLK_OFFSET) ); + u16 regRst = MI_LoadLE16( (void*) (HW_IOREG + REG_RST_OFFSET) ); + u32 regExt = MI_LoadLE32( (void*) (HW_IOREG + REG_EXT_OFFSET) ); + u16 regMc = MI_LoadLE16( (void*) (HW_IOREG + REG_MC_OFFSET ) ); + selectBitNum = gRegisterIdx[1][selected]; + + if( selected == SCFG_ARM9_EXT_PS) + { + selectRegSize = 2; + } + + // 描画 + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP, TXT_COLOR_BLACK, s_strARM9RegisterName[0] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP, regRom, selectBitNum, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + LINE_OFFSET, TXT_COLOR_BLACK, s_strARM9RegisterName[1] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + LINE_OFFSET, regClk, selectBitNum - 16, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 2*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM9RegisterName[2] ); + printBinary16( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 2*LINE_OFFSET, regRst, selectBitNum - 32, selectRegSize ); + + PrintfSJISSub( REGISTER_NAME_LEFT, REGISTER_NAME_UP + 3*LINE_OFFSET, TXT_COLOR_BLACK, s_strARM9RegisterName[3] ); + printBinary32( REGISTER_DATA_LEFT, REGISTER_DATA_UP + 3*LINE_OFFSET, regExt, selectBitNum - 48, selectRegSize ); + + } +#endif // ifndef VERSION_VIEWER +} + +void printBinary32( int x, int y, u32 value, int selected, int selectSize ) +{ + printBinary16( x, y, (u16)(value >> 16), selected - 16, selectSize ); + printBinary16( x, y + LINE_OFFSET, (u16)(value & 0xFFFF), selected, selectSize ); +} + +void printBinary16( int x, int y, u16 value, int selected, int selectSize ) +{ + // 16ビットのバイナリをディスプレイに描画 + + int i; + int bitNum; + u16 buf[BINARY_BUF] = {0}; // 16bit + 1 space + 1 EOS + u16 mask = 0x8000; + + for( i = 0; i < BINARY_BUF; i++) + { + if( i%9 == 8 ) + { + buf[i] = L' '; + continue; + } + + if( value & mask ) + { + buf[i] = L'1'; + } + else + { + buf[i] = L'0'; + } + + mask = (u16)( mask >> 1 ); + } + + buf[BINARY_BUF] = L'\0'; + + PutStringUTF16Sub( x, y, TXT_COLOR_BLACK, buf ); + + if( selected >= 16 || selected < 0 ) + { + // 描画レジスタ内に選択項目に対応するビットがなければこれで終わり + return; + } + + // マスクをリセット + mask = 0x8000; + + // 今回の描画レジスタ内に選択項目に対応するビットがあるとき + // そのビットだけ赤字で表示する + for( i = 0, bitNum = 0; bitNum < 16; i++ ) + { + if( i == 8 ) + { + // 8ビット、8ビットの間の空白 + buf[i] = L' '; + continue; + } + + if( selected <= 15 - bitNum && 15 - bitNum < selected + selectSize ) + { + buf[i] = ( value & ( mask >> bitNum )) ? L'1': L'0' ; + } + else + { + buf[i] = L' '; + } + + bitNum++; + } + + PutStringUTF16Sub( x, y, TXT_COLOR_RED, buf ); +} + +void drawChangeMode( DispInfoEntry *entry, int changeLine ) +// 値変更画面の描画 +{ + int i; + + // 項目名 + PrintfSJIS( CHANGE_ITEMNAME_LEFT, CHANGE_ITEMNAME_UP, TXT_COLOR_RED, entry->kind ); + + if( entry->kindNameList != NULL ) + { + // BOOL値で変更設定する項目の場合は値一覧を選択肢として表示 + PrintfSJIS( CHANGE_ITEMNAME_LEFT, CHANGE_NOW_SETTING_UP, TXT_COLOR_BLACK, "Now Setting: %s", entry->kindNameList[entry->iValue] ); + + for( i = 0; i < entry->numKindName; i++ ) + { + int kindColor = TXT_COLOR_BLACK; + + if( i == changeLine ) + { + kindColor = TXT_COLOR_GREEN; + PutStringUTF16( CHANGE_ALLOW_LEFT, CHANGE_VALUE_UP + i*LINE_OFFSET, TXT_COLOR_BLACK, (const u16 *)L"→" ); + } + + PrintfSJIS( CHANGE_VALUE_LEFT, CHANGE_VALUE_UP + i*LINE_OFFSET, kindColor, entry->kindNameList[i] ); + } + } + +} + +void drawExecuteMode( const char *command, int changeLine, u8 mode ) +{ +#ifndef VERSION_VIEWER + int i; + + // 項目名 + PrintfSJIS( CHANGE_ITEMNAME_LEFT, CHANGE_ITEMNAME_UP, TXT_COLOR_RED, command ); + + for( i = 0; i < 2 ; i++ ) + { + int kindColor = TXT_COLOR_BLACK; + + if( i == changeLine ) + { + kindColor = TXT_COLOR_GREEN; + PutStringUTF16( CHANGE_ALLOW_LEFT, CHANGE_VALUE_UP + i*LINE_OFFSET, TXT_COLOR_BLACK, (const u16 *)L"→" ); + } + + PrintfSJIS( CHANGE_VALUE_LEFT, CHANGE_VALUE_UP + i*LINE_OFFSET, kindColor, s_strOK[i] ); + } + + if( mode & MODE_RESULT_DISPLAY_MASK ) + { + PrintfSJIS( RESULT_LEFT, RESULT_UP, TXT_COLOR_BLACK, s_strResult[ (mode & MODE_RESULT_MASK) >> MODE_RESULT_SHIFT ] ); + } +#endif // VERSION_VIEWER + +} + +void drawVersion( int idx, int drawLine ,int selected ) +{ + int kindColor = TXT_COLOR_BLACK; + u16 value = gContentsVersion[idx]; + + if( idx == selected) + { + // 選択項目はいろかえる + kindColor = TXT_COLOR_GREEN; + PutStringUTF16( ALLOW_LEFT, KIND_UP + LINE_OFFSET*drawLine, TXT_COLOR_BLACK, (const u16 *)L"→"); + } + + + // 項目名 + // gContentsTitle[i]は頭4バイトがイニシャルコードのビッグエンディアン記述、 + // お尻4バイトがアプリのフラグ + { + u64 id = gContentsTitle[idx]; + char buf[5] = {0}; + int i; + + for(i = 3; 0<=i; i-- ) + { + buf[i] = (char)(id & 0xFF) ; + id >>= 8; + } + + PrintfSJIS( KIND_LEFT, KIND_UP + LINE_OFFSET*drawLine , kindColor, "%s", buf ); + } + + // 値 + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLine , TXT_COLOR_BLACK, "%x.%x", value >> 8, value & 0xFF ); +} + +void drawFontInfo( int idx, int drawLine, int selected ) +{ +#ifndef VERSION_VIEWER + int color = TXT_COLOR_BLACK; + int fontIdx = idx / NUM_FONT_INFO; + int dataType = idx % NUM_FONT_INFO; + + static const char* s_strFontDataType[] = { + "name", + "size", + "hash" + }; + + // 種類名 + if( idx == selected) + { + color = TXT_COLOR_GREEN; + PutStringUTF16( ALLOW_LEFT, KIND_UP + LINE_OFFSET*drawLine, TXT_COLOR_BLACK, (const u16 *)L"→"); + } + + PrintfSJIS( KIND_LEFT, KIND_UP + LINE_OFFSET*drawLine , color, "font%d %s", fontIdx, s_strFontDataType[dataType] ); + + // 値 + switch( dataType ) + { + case 0: + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLine , TXT_COLOR_BLACK, (char*)gFontInfo[fontIdx].name ); + break; + + case 1: + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLine , TXT_COLOR_BLACK, "%d byte", gFontInfo[fontIdx].size ); + break; + + case 2: + if( gFontInfo[fontIdx].isHashOK ) + { + color = TXT_COLOR_BLACK; + } + else + { + color = TXT_COLOR_RED; + } + + PrintfSJIS( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLine , color, s_strCorrect[ gFontInfo[fontIdx].isHashOK ] ); + break; + } +#endif // ifdef VERSION_VIEWER +} +void drawMenu( int menu, int line, int changeLine, u8 mode ) +// 情報一覧を描画する +{ + int lineNum = 0; + int i=0; + + drawHeader( menu, line ); + drawRegister( menu, line ); + + if( mode & MODE_CHANGE_MASK ) + { + // 変更モード画面の描画 + drawChangeMode( &gAllInfo[menu][line], changeLine ); + return; + } + + if( mode & MODE_EXECUTE_MASK ) + { + drawExecuteMode( s_strMetaMenu[MENU_ROOT][line] , changeLine, mode ); + return; + } + + // 描画位置の調整 + if( line - gDrawIdx[menu] < SCROLL_MARGIN ) + { + gDrawIdx[menu] = line - SCROLL_MARGIN >= 0 ? line - SCROLL_MARGIN : 0; + } + else if( countLinesDown(menu, line) < SCROLL_MARGIN ) + { + calibrateDrawIdx( menu, line ); + } + + for( i = gDrawIdx[menu] ; i < s_numMenu[menu] && lineNum < DISP_NUM_LINES ; i++ ) + { + // 可変長項目なバージョン情報だけ特例処理 + if( menu == MENU_VERSION && VERSION_OTHER <= i ) + { + drawVersion( i - VERSION_OTHER, lineNum++, line - VERSION_OTHER ); + continue; + } + + if( menu == MENU_FONT && FONT_INFO <= i ) + { + drawFontInfo( i - FONT_INFO, lineNum++, line - FONT_INFO ); + continue; + } + + // 項目名の描画 + printKindName( menu, i, lineNum, line ); + + // 値の描画 + if( menu == MENU_SCFG_ARM7 && !gSelectedARM7SCFGReg ) + { + // ARM7のSCFGで共有領域側の値を表示してるときはオフセットを加える + printValue( menu, i, lineNum, &gAllInfo[menu][i + SCFG_ARM7_SHARED_OFFSET] ); + } + else if( menu != MENU_ROOT ) + { + printValue( menu, i, lineNum, &gAllInfo[menu][i] ); + } + + // 描画オフセットの更新 + lineNum += menu != MENU_ROOT ? gAllInfo[menu][i].numLines : 1; + } + + /* + // スクロールバーとか出す? + // 全体の行数を把握 + if( gMenuLineSize[menu] == 0 ) + { + gMenuLineSize[menu] = countMenuLine(menu); + } + */ +} + +int countLinesDown( int menu, int idx ) +// 選択項目より下側に何項目表示されているかカウント +{ + int i; + int lines = 0; + + for( i = gDrawIdx[menu]; lines < DISP_NUM_LINES && i < s_numMenu[menu] ; i++ ) + { + lines += ( menu == MENU_VERSION && VERSION_OTHER <= i ) || + ( menu == MENU_FONT && FONT_INFO <= i ) || + ( menu == MENU_ROOT ) ? + 1 : gAllInfo[menu][i].numLines; + } + + return (i-1) - idx; +} + +void calibrateDrawIdx( int menu, int idx ) +// 折り返し項目とかがあると描画位置がずれるので +// 下側に常に2項目表示されるように補正を行う +{ + int i; + int lines = 0; + + // まずは自分と下2項目の行数を探索 + for( i = 0; i <= 2 && i + idx < s_numMenu[menu] ; i++ ) + { + lines += ( menu == MENU_VERSION && VERSION_OTHER <= i+idx ) || + ( menu == MENU_FONT && FONT_INFO <= i+idx ) || + ( menu == MENU_ROOT ) ? + 1 : gAllInfo[menu][i + idx].numLines; + } + + // 自分より上方向へ探索 + for( i = 1; 0 <= idx - i && lines < DISP_NUM_LINES ; i++) + { + lines += ( menu == MENU_VERSION && VERSION_OTHER <= i+idx ) || + ( menu == MENU_FONT && FONT_INFO <= i+idx ) || + ( menu == MENU_ROOT ) ? + 1 : gAllInfo[menu][idx - i].numLines; + } + + // ループが一回余計に回る + i--; + + if( lines < DISP_NUM_LINES ) + { + // idx - iがゼロより小さくなった場合 + gDrawIdx[menu] = 0; + } + else if( lines == DISP_NUM_LINES ) + { + // 表示行数ちょうどはそのまま + gDrawIdx[menu] = idx - i; + } + else if( lines == DISP_NUM_LINES + 1 && gAllInfo[menu][ idx - i ].numLines != 1) + { + // 1行溢れてて、かつ一番上の項目が複数行描画だった場合はそのまま + gDrawIdx[menu] = idx - i; + } + else + { + // それ以外の場合は一番上の行を外す + gDrawIdx[menu] = idx - i + 1; + } + +} + +void switchViewMode( void ) +// ARM7SCFGのレジスタデータと共有領域データの表示内容を切り替える +{ + gSelectedARM7SCFGReg = !gSelectedARM7SCFGReg; +} + +/* +void drawKindName( int menu, int page, int line ) +// 項目名描画関数 +{ + int linenum = 0; + int offset = 0; + + if( menu == MENU_ROOT ) + { + // ルートメニューにはインデクスデータがないので、間隔をあけないことを前提に羅列するだけ + for(linenum = 0; linenum < ROOTMENU_SIZE ; linenum++) + { + if( linenum == line ) + { + // 選択中の項目は表示色かえて矢印表示 + PutStringUTF16( ALLOW_LEFT, KIND_UP + LINE_OFFSET*linenum, TXT_COLOR_BLACK, (const u16 *)L"→" ); + PutStringUTF16( KIND_LEFT, KIND_UP + LINE_OFFSET*linenum, TXT_COLOR_GREEN, s_strMetaMenu[MENU_ROOT][linenum]) ; + } + else + { + PutStringUTF16( KIND_LEFT, KIND_UP + LINE_OFFSET*linenum, TXT_COLOR_BLACK, s_strMetaMenu[MENU_ROOT][linenum]) ; + } + } + + } + else + { + for(linenum = s_pageOffset[menu][page] ; linenum < s_pageOffset[menu][page+1] ; linenum++) + { + if( linenum == s_pageOffset[menu][page] + line ) + { + // 選択中の項目は表示色かえて矢印表示 + PutStringUTF16( ALLOW_LEFT, KIND_UP + LINE_OFFSET * gMenuKindOffset[menu][linenum], + TXT_COLOR_BLACK, (const u16 *)L"→" ); + PutStringUTF16( KIND_LEFT, KIND_UP + LINE_OFFSET * gMenuKindOffset[menu][linenum], + TXT_COLOR_GREEN, s_strMetaMenu[menu][linenum]) ; + } + else + { + PutStringUTF16( KIND_LEFT, KIND_UP + LINE_OFFSET * gMenuKindOffset[menu][linenum], + TXT_COLOR_BLACK, s_strMetaMenu[menu][linenum]) ; + } + } + } +} + +void drawOwnerMenu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + // utf16で描画するものだけ分ける + if( valueIdx == OWNER_NICKNAME ) + { + kindOffset[valueIdx] = drawKindOffset; + PutStringUTF16( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, gUserName) ; + } + else if( valueIdx == OWNER_COMMENT ) + { + kindOffset[valueIdx] = drawKindOffset; + PutStringUTF16( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, gUserComment) ; + } + else if( valueIdx == OWNER_COLOR ) + { + kindOffset[valueIdx] = drawKindOffset; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_UCOLOR_G5, "■" ); + PrintfSJIS( VALUE_LEFT + LINE_OFFSET , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + + } + else + { + // sjisで描画するもの + kindOffset[valueIdx] = drawKindOffset; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + } + +} + +void drawParentalMenu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + // utf16で描画するものだけ分ける + if(valueIdx == PARENTAL_ANSWER) + { + kindOffset[valueIdx] = drawKindOffset; + PutStringUTF16( VALUE_LEFT, VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, gSecretAnswer) ; + } + else + { + // sjisで描画するもの + kindOffset[valueIdx] = drawKindOffset; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + } +} + + +void drawNormalHWMenu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + // 描画してついでにインデクス差分データをいれる + kindOffset[valueIdx] = drawKindOffset; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + +} + + +void drawSecureHWMenu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + // 複数行必要な項目があると描画位置がずれるため + // 描画オフセットを調整する処理が必要 + if( valueIdx >= SECURE_HW_FORCE_DISABLE && page == getPageNum( SECURE_HW_FORCE_DISABLE, pageOffset ) ) + { + drawLineOffset++; + } + + if( valueIdx > SECURE_HW_UNIQUE_ID && page == getPageNum( SECURE_HW_UNIQUE_ID, pageOffset ) ) + { + drawLineOffset += OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3 / UNIQUE_BUF; + } + + // 同じように項目名のオフセットも調整 + if( valueIdx > SECURE_HW_FORCE_DISABLE && page == getPageNum( SECURE_HW_FORCE_DISABLE, pageOffset ) ) + { + drawKindOffset++; + } + + if( valueIdx > SECURE_HW_UNIQUE_ID && page == getPageNum( SECURE_HW_UNIQUE_ID, pageOffset ) ) + { + drawKindOffset += OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3 / UNIQUE_BUF; + } + + + // 描画する、ついでにインデクスデータも入れる + if( valueIdx == SECURE_HW_UNIQUE_ID ) + { + kindOffset[valueIdx] = drawKindOffset; + printUniqueID(drawLineOffset); + } + else + { + kindOffset[valueIdx] = drawKindOffset; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + } +} + +void drawSCFGARM7Menu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + kindOffset[valueIdx] = linenum; +} + +void drawSCFGARM9Menu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + kindOffset[valueIdx] = drawKindOffset; + +} + +void drawVersionMenu( int page, int linenum, int valueIdx, char** info, int* kindOffset, const int* pageOffset ) +{ + int drawLineOffset = linenum, drawKindOffset = linenum; + + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET*drawLineOffset, TXT_COLOR_BLACK, info[valueIdx] ); + kindOffset[valueIdx] = drawKindOffset; + +} +*/ + +void printUniqueID( int drawLineOffset, char *uniqueId) +// ユニークIDを整形して出力 +{ + char buf[UNIQUE_BUF+1]; + int i; + + for( i=0; i * UNIQUE_BUF < OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3 ; i++) + { + strncpy(buf, &uniqueId[i * UNIQUE_BUF], UNIQUE_BUF); + buf[UNIQUE_BUF] = '\0'; + PrintfSJIS( VALUE_LEFT , VALUE_UP + LINE_OFFSET * (drawLineOffset + i), TXT_COLOR_BLACK, buf ); + } + +} + +int getPageNum( int valueIdx, const int* pageOffset ) +// valueIdxが何ページ目にあるかをpageOffsetから調べる +{ + int i; + + for( i=0; i < MAXITEM - 1; i++ ) + { + if( valueIdx > pageOffset[i] && valueIdx < pageOffset[i+1] ) + { + return i; + } + } + + return -1; +} + +const static int gRegisterIdx[2][SCFG_ARM7_MENU_SIZE] = { + // ARM7, ARM9のSCFGの各項目がレジスタにおいて対応しているのかをリストで記述 + + // ARM7 side + { + DISP_REG_SCFG_ROM_ARM9SEL_SHIFT, + DISP_REG_SCFG_ROM_ARM9RSEL_SHIFT, + DISP_REG_SCFG_ROM_ARM7SEL_SHIFT, + DISP_REG_SCFG_ROM_ARM7RSEL_SHIFT, + DISP_REG_SCFG_ROM_ARM7FUSE_SHIFT, + DISP_REG_SCFG_ROM_ROMWE_SHIFT, + + DISP_REG_SCFG_CLK_SD1HCLK_SHIFT + 32, + DISP_REG_SCFG_CLK_SD2HCLK_SHIFT + 32, + DISP_REG_SCFG_CLK_AESHCLK_SHIFT + 32, + DISP_REG_SCFG_CLK_WRAMHCLK_SHIFT + 32, + DISP_REG_SCFG_CLK_SNDMCLK_SHIFT + 32, + + DISP_REG_SCFG_JTAG_ARM7SEL_SHIFT + 48, + DISP_REG_SCFG_JTAG_CPUJE_SHIFT + 48, + DISP_REG_SCFG_JTAG_DSPJE_SHIFT + 48, + + DISP_REG_SCFG_EXT_DMA_SHIFT + 64, + DISP_REG_SCFG_EXT_SDMA_SHIFT + 64, + DISP_REG_SCFG_EXT_SND_SHIFT + 64, + DISP_REG_SCFG_EXT_MC_SHIFT + 64, + DISP_REG_SCFG_EXT_INTC_SHIFT + 64, + DISP_REG_SCFG_EXT_SPI_SHIFT + 64, + DISP_REG_SCFG_EXT_DSEL_SHIFT + 64, + DISP_REG_SCFG_EXT_SIO_SHIFT + 64, + DISP_REG_SCFG_EXT_LCDC_SHIFT + 64, + DISP_REG_SCFG_EXT_VRAM_SHIFT + 64, + DISP_REG_SCFG_EXT_PSRAM_SHIFT + 64, + DISP_REG_SCFG_EXT_DMAC_SHIFT + 64, + DISP_REG_SCFG_EXT_AES_SHIFT + 64, + DISP_REG_SCFG_EXT_SD1_SHIFT + 64, + DISP_REG_SCFG_EXT_SD2_SHIFT + 64, + DISP_REG_SCFG_EXT_MIC_SHIFT + 64, + DISP_REG_SCFG_EXT_I2S_SHIFT + 64, + DISP_REG_SCFG_EXT_I2C_SHIFT + 64, + DISP_REG_SCFG_EXT_GPIO_SHIFT + 64, + DISP_REG_SCFG_EXT_MC_B_SHIFT + 64, + DISP_REG_SCFG_EXT_WRAM_SHIFT + 64, + DISP_REG_SCFG_EXT_PUENABLE_SHIFT + 64, + DISP_REG_SCFG_EXT_CFG_SHIFT + 64, + + DISP_REG_MI_MC1_SL1_CDET_SHIFT + 96, + DISP_REG_MI_MC1_SL1_M0_SHIFT + 96, + DISP_REG_MI_MC1_SL2_CDET_SHIFT + 96, + DISP_REG_MI_MC1_SL2_M0_SHIFT + 96, + DISP_REG_MI_MC1_SWP_SHIFT + 96, + DISP_REG_MI_MC1_CC_SHIFT + 96, + + DISP_REG_MI_MC2_CA_SHIFT + 128, + + DISP_REG_SCFG_WL_OFFB_SHIFT + 144, + + DISP_REG_SCFG_OP_OP0_SHIFT + 160, + DISP_REG_SCFG_OP_OP0_SHIFT + 160 + }, + + // ARM9 side + { + REG_SCFG_A9ROM_SEC_SHIFT, + REG_SCFG_A9ROM_RSEL_SHIFT, + + REG_SCFG_CLK_CPUSPD_SHIFT + 16, + REG_SCFG_CLK_DSPHCLK_SHIFT + 16, + REG_SCFG_CLK_CAMHCLK_SHIFT + 16, + REG_SCFG_CLK_WRAMHCLK_SHIFT + 16, + REG_SCFG_CLK_CAMCKI_SHIFT + 16, + + REG_SCFG_RST_DSPRSTB_SHIFT + 32, + + REG_SCFG_EXT_DMA_SHIFT + 48, + REG_SCFG_EXT_GEO_SHIFT + 48, + REG_SCFG_EXT_REN_SHIFT + 48, + REG_SCFG_EXT_G2DE_SHIFT + 48, + REG_SCFG_EXT_DIV_SHIFT + 48, + REG_SCFG_EXT_MC_SHIFT + 48, + REG_SCFG_EXT_INTC_SHIFT + 48, + REG_SCFG_EXT_LCDC_SHIFT + 48, + REG_SCFG_EXT_VRAM_SHIFT + 48, + REG_SCFG_EXT_PSRAM_SHIFT + 48, + REG_SCFG_EXT_DMAC_SHIFT + 48, + REG_SCFG_EXT_CAM_SHIFT + 48, + REG_SCFG_EXT_DSP_SHIFT + 48, + REG_SCFG_EXT_MC_B_SHIFT + 48, + REG_SCFG_EXT_WRAM_SHIFT + 48, + REG_SCFG_EXT_CFG_SHIFT + 48, + + } +}; \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.h b/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.h new file mode 100644 index 00000000..50958e22 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/drawFunc.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: drawFunc.h + + Copyright **** 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 __DRAW_FUNC__ +#define __DRAW_FUNC__ + +#include +#include "strResource.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + + +// 各メニューサイズ + +#define DISP_NUM_LINES 11 // 一ページあたりの項目数 + +/* global variables ----------------- */ + +#define MAXITEM 50 +#define MAXPAGE 5 + +// 各項目を表示するときの行オフセット表 +extern int gMenuKindOffset[ROOTMENU_SIZE][MAXITEM]; + +/* function prototypes ----------------- */ + +void drawHeader( int menu, int line ); +void drawMenu( int menu, int line, int changeLine, u8 mode ); +void printResult( BOOL res ); +void switchViewMode( void ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/build/tests/DisplaySystemInformation/ARM9/src/getInformation.h b/build/tests/DisplaySystemInformation/ARM9/src/getInformation.h new file mode 100644 index 00000000..e861e041 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/getInformation.h @@ -0,0 +1,59 @@ + +#ifndef __DISPLAY_INFO_GETINFORMATION__ + +#include + +#define __DISPLAY_INFO_GETINFORMATION__ + +// 初回読み込みか否か +static BOOL firstRead; + +// NANDアプリ情報 +extern s32 gNumContents; +extern OSTitleId *gContentsTitle; +extern u16 *gContentsVersion; + +#ifndef VERSION_VIEWER + +#define TWL_SYSMENU_VER_STR_LEN 28 // システムメニューバージョン文字列MAX bytes +#define TWL_EULA_URL_LEN 128 +#define TWL_NUP_HOSTNAME_LEN 64 + +#define NUM_FONT_INFO 3 // フォント一つ当たりのメニュー数。名前、サイズ、ハッシュの三項目 + +typedef struct FontInfo{ + u8 *name; // お名前 + u32 size; // 大きさ + u8 *data; // データ本体 + u8 *hash; // データのハッシュ値 + BOOL isHashOK; // ハッシュ値が既知のものと一致するか +} FontInfo; + + + +// 共有フォント情報 +extern FontInfo gFontInfo[ OS_SHARED_FONT_MAX ]; + +// LCFGデータを読み込むためのバッファ +extern u8 *bufLCFG; + +#endif // ifndef VERSION_VIEWER + +void getVersions( void ); +void getContentsVersion( void ); + +#ifndef VERSION_VIEWER +void getSysmenuInfo( void ); +void getSCFGInfo( void ); +void getOwnerInfo( void ); +void getHWInfo( void ); +void getParentalInfo( void ); +void getOtherInfo( void ); +void getSecureUserInfo( void ); +void getFontInfo( void ); +void getWLInfo( void ); +void getWhiteListInfo( void ); + +#endif // ifndef VERSION_VIEWER + +#endif // ifdef __DISPLAY_INFO_GETINFORMATION__ \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_font.c b/build/tests/DisplaySystemInformation/ARM9/src/get_font.c new file mode 100644 index 00000000..843b8679 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_font.c @@ -0,0 +1,118 @@ +#include +#include + +#include "misc.h" +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" +#include "util.h" + +#define NUM_FONT_HASHDATA 3 + +const static char* s_strFontHash[] = { + "07381F6C1FF7421BA309196FA9FC750706B031AD", + "EF271DAD8B67EDB3DDE2655C6C35288D1334132D", + "28e68d0496ab28d7f082b70fc8f4f9081dee2ccc" +}; + +FontInfo gFontInfo[ OS_SHARED_FONT_MAX ]; + +void loadFontName( OSSharedFontIndex idx ); +void loadFont( OSSharedFontIndex idx ); +void releaseFont( OSSharedFontIndex idx ); +BOOL checkFontHash( OSSharedFontIndex idx ); + + +void getFontInfo( void ) +{ + u32 time; + int tableSize = 0; + u8 *tableBuf; + OSSharedFontIndex fontIdx; + + OS_InitSharedFont(); + + // フォントテーブルバッファの確保 + tableSize = OS_GetSharedFontTableSize(); + tableBuf = (u8*) Alloc ( (u32)tableSize ); + SDK_ASSERT( tableBuf ); + + time = OS_GetSharedFontTimestamp(); + OS_TPrintf("SharedFont Time Stamp %08lx\n", time ); + gAllInfo[MENU_FONT][FONT_TIMESTAMP].iValue = (int) time; + gAllInfo[MENU_FONT][FONT_TIMESTAMP].isNumData = TRUE; + + if( ! OS_LoadSharedFontTable( (void*)tableBuf ) ) + { + OS_TPrintf("Loading shared font table failed.\n"); + Free(tableBuf); + return; + } + + for( fontIdx = (OSSharedFontIndex) 0; fontIdx < OS_SHARED_FONT_MAX; fontIdx++ ) + { + loadFontName( fontIdx ); + + // サイズ取得 + gFontInfo[fontIdx].size = (u32) OS_GetSharedFontSize( (OSSharedFontIndex)fontIdx ); + + loadFont( fontIdx ); + gFontInfo[fontIdx].isHashOK = checkFontHash( fontIdx ); + releaseFont( fontIdx ); + } + + Free(tableBuf); + s_numMenu[MENU_FONT] = FONT_INFO + ( NUM_FONT_INFO * OS_SHARED_FONT_MAX ); +} + +void loadFontName( OSSharedFontIndex idx ) +{ + // 名前取得 + const u8* fontName = OS_GetSharedFontName( (OSSharedFontIndex)idx ); + int fontNameLength = STD_StrLen( (char*)fontName ); + + OS_TPrintf("fontname length: %d\n", fontNameLength ); + if( gFontInfo[idx].name == NULL ){ + // 名前のところにメモリが割り当てられてなかったりしたら + + gFontInfo[idx].name = (u8*) Alloc ( sizeof(u8) * (fontNameLength + 1) ); + } + + SDK_ASSERT( gFontInfo[idx].name ); + STD_StrLCpy( (char*)gFontInfo[idx].name, (char*)fontName, fontNameLength + 1 ); +} + +void loadFont( OSSharedFontIndex idx ) +{ + // でも別に普段必要なわけじゃないからメモリ確保のためにも + // ハッシュ値取り終わったら開放するようにするかな? + if( gFontInfo[idx].data == NULL ) + { + // データバッファにメモリが割り当てられてなかったり、 + // 小さかったりした場合は割り当てなおす。 + + gFontInfo[idx].data = (u8*) Alloc ( gFontInfo[idx].size ); + } + + SDK_ASSERT( gFontInfo[idx].data ); + OS_LoadSharedFont( idx, (void*)gFontInfo[idx].data ); +} + +void releaseFont( OSSharedFontIndex idx ) +{ + if( gFontInfo[idx].data != NULL ) + { + Free( gFontInfo[idx].data ); + } +} + +BOOL checkFontHash( OSSharedFontIndex idx ) +{ + u8 digestBuf[MATH_SHA1_DIGEST_SIZE], cmpBuf[MATH_SHA1_DIGEST_SIZE]; + + // 実態、検証用それぞれのハッシュを算出 + strToHexa( s_strFontHash[idx], cmpBuf, MATH_SHA1_DIGEST_SIZE ); + MATH_CalcSHA1( digestBuf, gFontInfo[idx].data , gFontInfo[idx].size ); + + return MI_CpuComp8( cmpBuf, digestBuf, MATH_SHA1_DIGEST_SIZE ) == 0; +} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_hw.c b/build/tests/DisplaySystemInformation/ARM9/src/get_hw.c new file mode 100644 index 00000000..ab1f42df --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_hw.c @@ -0,0 +1,108 @@ +#include +//#include +#include +#include + + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + +void getNormalHWInfo( void ); +void getSecureHWInfo( void ); + +void getHWInfo( void ) +{ + getNormalHWInfo(); + getSecureHWInfo(); +} + + +void getNormalHWInfo( void ) +{ + int value; + + + value = (int)LCFG_NSD_GetRTCClockAdjust(); + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_RTC_ADJUST].iValue = value; + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_RTC_ADJUST].isNumData = TRUE; + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_RTC_ADJUST].fromLCFG = TRUE; + + { + int i; + char ascii[] = "0123456789abcdef"; + const u8 *unq = OS_GetMovableUniqueIDPtr(); + // 16進で1バイトずつ詰めていく + // バッファが長さの3倍長なのは、データを"%02x-%02x-%02x..."に置換するため + for(i=0; i < OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3; i += 3, unq++ ) + { + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_UNIQUE_ID].str.sjis[i] = ascii[(*unq>>4) & 0x0f]; + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_UNIQUE_ID].str.sjis[i+1] = ascii[*unq & 0x0f]; + gAllInfo[MENU_NORMAL_HW][NORMAL_HW_UNIQUE_ID].str.sjis[i+2] = + (i+2) == (OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3 - 1) ? (char)'\0' : (char)'-' ; + OS_TPrintf("uniqid: %d\n", *unq); + } + } + +} + +void getSecureHWInfo( void ) +{ + int value; + + value = OS_IsForceDisableWireless(); + gAllInfo[MENU_SECURE_HW][SECURE_HW_FORCE_DISABLE].iValue = value; + gAllInfo[MENU_SECURE_HW][SECURE_HW_FORCE_DISABLE].str.sjis = s_strBool[ value ]; + gAllInfo[MENU_SECURE_HW][SECURE_HW_FORCE_DISABLE].isAligned = FALSE; + gAllInfo[MENU_SECURE_HW][SECURE_HW_FORCE_DISABLE].numLines = 2; + + value = OS_GetRegion(); + gAllInfo[MENU_SECURE_HW][SECURE_HW_REGION].iValue = value; + gAllInfo[MENU_SECURE_HW][SECURE_HW_REGION].str.sjis = s_strRegion[ value ]; + + { + u8 serialBuf[OS_TWL_HWINFO_SERIALNO_LEN_MAX]; + OS_GetSerialNo( serialBuf ); + snprintf( gAllInfo[MENU_SECURE_HW][SECURE_HW_SERIAL].str.sjis , OS_TWL_HWINFO_SERIALNO_LEN_MAX, "%s", serialBuf); + } + + { + u64 buf; + buf = OS_GetValidLanguageBitmap(); + OS_TPrintf("language bitmap : %lx\n", buf ); + snprintf( gAllInfo[MENU_SECURE_HW][SECURE_HW_LANGUAGE].str.sjis , + DISPINFO_BUFSIZE-1, "%08lx", OS_GetValidLanguageBitmap() ); + + + // fuseRomデータの読み出し + // secureなアプリ以外はハード的に切り離されるのでゼロになる + buf = SCFG_ReadFuseData(); + OS_TPrintf("fuse data : %016llx\n", buf); + snprintf( gAllInfo[MENU_SECURE_HW][SECURE_HW_FUSE].str.sjis , + DISPINFO_BUFSIZE-1, "%016llx", SCFG_ReadFuseData() ); + gAllInfo[MENU_SECURE_HW][SECURE_HW_FUSE].numLines = 2; + + } + + // ランチャのタイトルIDLoの取得 + if( LCFG_ReadHWSecureInfo() ) + { + const u8 *titleIDLo = LCFG_THW_GetLauncherTitleID_LoPtr(); + value = ( int )( titleIDLo[0] << 8*3 | + titleIDLo[1] << 8*2 | + titleIDLo[2] << 8*1 | + titleIDLo[3] << 8*0 ); + + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].iValue = value; + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].isNumData = TRUE; + } + else + { + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].str.sjis = s_strNA; + } + + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].isAligned = FALSE; + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].numLines = 2; + gAllInfo[MENU_SECURE_HW][SECURE_HW_LAUNCHER_ID].fromLCFG = TRUE; + +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_other.c b/build/tests/DisplaySystemInformation/ARM9/src/get_other.c new file mode 100644 index 00000000..2b53a7d1 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_other.c @@ -0,0 +1,69 @@ +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + +void getOtherInfo( void ) +{ + // この辺からマクロで生成した分 + s64 rtcoffset; + int value; + LCFGTWLTPCalibData tpdata; + + value = OS_IsAgreeEULA(); + gAllInfo[MENU_OTHER][OTHER_AGREE_EULA].iValue = value; + gAllInfo[MENU_OTHER][OTHER_AGREE_EULA].str.sjis = s_strBool[value]; + + gAllInfo[MENU_OTHER][OTHER_EULA_VERSION].iValue = OS_GetAgreedEULAVersion(); + gAllInfo[MENU_OTHER][OTHER_EULA_VERSION].isNumData = TRUE; + + value = OS_IsAvailableWireless(); + gAllInfo[MENU_OTHER][OTHER_WIRELESS].iValue = value; + gAllInfo[MENU_OTHER][OTHER_WIRELESS].str.sjis = s_strEnable[value]; + + rtcoffset = OS_GetOwnerRtcOffset(); + snprintf( gAllInfo[MENU_OTHER][OTHER_RTC_OFFSET].str.sjis, + DISPINFO_BUFSIZE-1, "%016llx", rtcoffset ); + gAllInfo[MENU_OTHER][OTHER_RTC_OFFSET].numLines = 2; + + LCFG_TSD_GetTPCalibration( &tpdata ); + gAllInfo[MENU_OTHER][OTHER_TP_RAWX1].iValue = tpdata.data.raw_x1; + gAllInfo[MENU_OTHER][OTHER_TP_RAWX1].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_RAWX1].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_RAWX2].iValue = tpdata.data.raw_x2; + gAllInfo[MENU_OTHER][OTHER_TP_RAWX2].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_RAWX2].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_DX1].iValue = tpdata.data.dx1; + gAllInfo[MENU_OTHER][OTHER_TP_DX1].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_DX1].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_DY1].iValue = tpdata.data.dy1; + gAllInfo[MENU_OTHER][OTHER_TP_DY1].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_DY1].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_RAWY1].iValue = tpdata.data.raw_y1; + gAllInfo[MENU_OTHER][OTHER_TP_RAWY1].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_RAWY1].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_RAWY2].iValue = tpdata.data.raw_y2; + gAllInfo[MENU_OTHER][OTHER_TP_RAWY2].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_RAWY2].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_DX2].iValue = tpdata.data.dx2; + gAllInfo[MENU_OTHER][OTHER_TP_DX2].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_DX2].fromLCFG = TRUE; + + gAllInfo[MENU_OTHER][OTHER_TP_DY2].iValue = tpdata.data.dy2; + gAllInfo[MENU_OTHER][OTHER_TP_DY2].isNumData = TRUE; + gAllInfo[MENU_OTHER][OTHER_TP_DY2].fromLCFG = TRUE; + + snprintf( gAllInfo[MENU_OTHER][OTHER_TP_RSV].str.sjis, + DISPINFO_BUFSIZE, "%016llx", MI_LoadLE64( tpdata.rsv ) ); + gAllInfo[MENU_OTHER][OTHER_TP_RSV].fromLCFG = TRUE; + + +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_owner.c b/build/tests/DisplaySystemInformation/ARM9/src/get_owner.c new file mode 100644 index 00000000..bc9246b4 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_owner.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + + +void getOwnerInfo( void ) +// オーナー情報周りを取得する +{ + OSOwnerInfoEx ownerInfo; + + OS_TPrintf( "...Owner Information\n"); + // 本体設定まわり + OS_GetOwnerInfoEx( &ownerInfo ); + + // 全体情報につめていく + // 泥臭すぎるやり方なのであとで考える + gAllInfo[MENU_OWNER][OWNER_LANGUAGE].str.sjis = s_strLanguage[ ownerInfo.language ]; + gAllInfo[MENU_OWNER][OWNER_LANGUAGE].iValue = ownerInfo.language; + + gAllInfo[MENU_OWNER][OWNER_COLOR].str.sjis = s_strUserColor[ ownerInfo.favoriteColor ]; + gAllInfo[MENU_OWNER][OWNER_COLOR].iValue = ownerInfo.favoriteColor; + + snprintf( gAllInfo[MENU_OWNER][OWNER_BIRTHDAY].str.sjis, DISPINFO_BUFSIZE-1, "%02d/%02d", ownerInfo.birthday.month, ownerInfo.birthday.day); + gAllInfo[MENU_OWNER][OWNER_BIRTHDAY].iValue = ownerInfo.birthday.month * 100 + ownerInfo.birthday.day; + + gAllInfo[MENU_OWNER][OWNER_COUNTRY].str.sjis = s_strCountry[ownerInfo.country]; + gAllInfo[MENU_OWNER][OWNER_COUNTRY].iValue = ownerInfo.country; + + wcsncpy( gAllInfo[MENU_OWNER][OWNER_NICKNAME].str.utf , ownerInfo.nickName, OS_OWNERINFO_NICKNAME_MAX + 1); + gAllInfo[MENU_OWNER][OWNER_NICKNAME].isSjis = FALSE; + wcsncpy( gAllInfo[MENU_OWNER][OWNER_COMMENT].str.utf , ownerInfo.comment, OS_OWNERINFO_COMMENT_MAX + 1 ); + gAllInfo[MENU_OWNER][OWNER_COMMENT].isSjis = FALSE; +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_parental.c b/build/tests/DisplaySystemInformation/ARM9/src/get_parental.c new file mode 100644 index 00000000..3e0021ca --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_parental.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + +void getParentalInfo( void ) +// ペアレンタルコントロール情報を取得する +{ + // ペアレンタルコントロールまわり + const LCFGTWLParentalControl *pPC = (const LCFGTWLParentalControl *) OS_GetParentalControlInfoPtr(); + + OS_TPrintf( "...Parental Control Information\n" ); + + gAllInfo[MENU_PARENTAL][PARENTAL_FLAG].str.sjis = s_strBool[ pPC->flags.isSetParentalControl ]; + gAllInfo[MENU_PARENTAL][PARENTAL_FLAG].iValue = (int) pPC->flags.isSetParentalControl; + + gAllInfo[MENU_PARENTAL][PARENTAL_PICTOCHAT].str.sjis = s_strBool[ pPC->flags.pictoChat ]; + gAllInfo[MENU_PARENTAL][PARENTAL_PICTOCHAT].iValue = (int) pPC->flags.pictoChat; + + gAllInfo[MENU_PARENTAL][PARENTAL_DOWNLOAD].str.sjis = s_strBool[ pPC->flags.dsDownload ]; + gAllInfo[MENU_PARENTAL][PARENTAL_DOWNLOAD].iValue = (int) pPC->flags.dsDownload; + + gAllInfo[MENU_PARENTAL][PARENTAL_BROWSER].str.sjis = s_strBool[ pPC->flags.browser ]; + gAllInfo[MENU_PARENTAL][PARENTAL_BROWSER].iValue = (int) pPC->flags.browser; + + gAllInfo[MENU_PARENTAL][PARENTAL_WIIPOINT].str.sjis = s_strBool[ pPC->flags.wiiPoint ]; + gAllInfo[MENU_PARENTAL][PARENTAL_WIIPOINT].iValue = (int) pPC->flags.wiiPoint; + + gAllInfo[MENU_PARENTAL][PARENTAL_PHOTO_EXCHANGE].str.sjis = s_strBool[ pPC->flags.photoExchange ]; + gAllInfo[MENU_PARENTAL][PARENTAL_PHOTO_EXCHANGE].iValue = (int) pPC->flags.photoExchange; + + gAllInfo[MENU_PARENTAL][PARENTAL_UGC].str.sjis = s_strBool[ pPC->flags.ugc ]; + gAllInfo[MENU_PARENTAL][PARENTAL_UGC].iValue = (int) pPC->flags.ugc; + + gAllInfo[MENU_PARENTAL][PARENTAL_ORGANIZATION].str.sjis = s_strRatingOrg[ pPC->ogn ]; + gAllInfo[MENU_PARENTAL][PARENTAL_ORGANIZATION].iValue = (int) pPC->ogn; + + gAllInfo[MENU_PARENTAL][PARENTAL_AGE].iValue = pPC->ratingAge; + gAllInfo[MENU_PARENTAL][PARENTAL_AGE].isNumData = TRUE; + + gAllInfo[MENU_PARENTAL][PARENTAL_QUESTION_ID].iValue = pPC->secretQuestionID; + gAllInfo[MENU_PARENTAL][PARENTAL_QUESTION_ID].isNumData = TRUE; + + gAllInfo[MENU_PARENTAL][PARENTAL_PASSWORD].iValue = atoi( pPC->password ) ; + gAllInfo[MENU_PARENTAL][PARENTAL_PASSWORD].isNumData = TRUE; + + wcsncpy( gAllInfo[MENU_PARENTAL][PARENTAL_ANSWER].str.utf , pPC->secretAnswer, OS_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX + 1); + gAllInfo[MENU_PARENTAL][PARENTAL_ANSWER].isSjis = FALSE; +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_scfg.c b/build/tests/DisplaySystemInformation/ARM9/src/get_scfg.c new file mode 100644 index 00000000..bd9b96e4 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_scfg.c @@ -0,0 +1,1137 @@ + +#include +#include "getInformation.h" +#include "viewSystemInfo.h" +#include "strResource.h" +#include "myIoreg_SCFG.h" +//#include "misc.h" + +void getSCFGARM9Info( void ); +void getSCFGARM7InfoReg( void ); +void getSCFGARM7InfoShared( void ); +void setSCFGAccessFlag( BOOL flag ); +void setPsramBoundaryFlag( int idx ); +void setDSPResetFlag( BOOL flag ); +BOOL scfgTotalCheck( void ); +void getTotalCheckResult( void ); +u64 getArm7CheckData( BOOL isSecure, BOOL isNandAccessable, BOOL isVisibleSCFG, BOOL isDebugger ); +u32 getArm9CheckData( void ); + +void getSCFGInfo( void ) +{ + getSCFGARM9Info(); + getSCFGARM7InfoReg(); + getSCFGARM7InfoShared(); + getTotalCheckResult(); +} + +void getSCFGARM9Info( void ) +// ARM9側で取得できるSCFG情報を取得する +// ARM9SCFGAPIはレジスタを直接参照しているので、APIを使ってもレジスタを直接見ても同じ値 +{ + int value; + + // ROM制御レジスタ + + // IsSecureRomAccessibleの返り値はレジスタビットが反転 + value = !SCFG_IsSecureRomAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_SEC].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_SEC].str.sjis = s_strJoint[ value ]; + + value = SCFG_GetSystemRomType() == SCFG_SYSTEM_ROM_FOR_NITRO; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_STATE].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_STATE].str.sjis = s_strRomMode[ value ]; + + // クロック制御レジスタ + value = SCFG_GetCpuSpeed(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].str.sjis = s_strCpuSpeed[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].changeFunc.cBool = SCFG_SetCpuSpeed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].kindNameList = s_strCpuSpeed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].numKindName = 2; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].changable = TRUE; + + value = SCFG_IsClockSuppliedToDSP(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].str.sjis = s_strSupply[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].changeFunc.cBool = SCFG_SupplyClockToDSP; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].kindNameList = s_strSupply; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].numKindName = 2; + + value = SCFG_IsClockSuppliedToCamera(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].str.sjis = s_strSupply[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].changeFunc.cBool = SCFG_SupplyClockToCamera; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].kindNameList = s_strSupply; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].numKindName = 2; + + value = SCFG_IsClockSuppliedToWram(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_WRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_WRAM].str.sjis = s_strSupply[ value ]; + + value = SCFG_IsCameraCKIClockEnable(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].changeFunc.cBool = SCFG_SetCameraCKIClock; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].numKindName = 2; + + // 新規ブロック制御レジスタ + value = ! SCFG_IsDSPReset(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].str.sjis = s_strBool[ !value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].kindNameList = s_strBool; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].changeFunc.cBool = setDSPResetFlag; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].numKindName = 2; + + // 拡張機能制御レジスタ + + value = SCFG_IsDmacFixed() ; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].changeFunc.cBool = SCFG_SetDmacFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].numKindName = 2; + + value = SCFG_IsGeometryFixed() ; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].changeFunc.cBool = SCFG_SetGeometryFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].numKindName = 2; + + value = SCFG_IsRendererFixed() ; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].changeFunc.cBool = SCFG_SetRendererFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].numKindName = 2; + + value = SCFG_Is2DEngineFixed() ; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].changeFunc.cBool = SCFG_Set2DEngineFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].numKindName = 2; + + value = SCFG_IsDividerFixed(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].changeFunc.cBool = SCFG_SetDividerFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].numKindName = 2; + + value = SCFG_IsCardFixed() ; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].changeFunc.cBool = SCFG_SetCardFixed; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].numKindName = 2; + + value = SCFG_IsIntcExpanded(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].changeFunc.cBool = SCFG_SetIntcExpanded; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].numKindName = 2; + + value = SCFG_IsLCDCExpanded(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].changeFunc.cBool = SCFG_SetLCDCExpanded; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].numKindName = 2; + + value = SCFG_IsVRAMExpanded(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].changeFunc.cBool = SCFG_SetVRAMExpanded; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].kindNameList = s_strEnable; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].numKindName = 2; + + { + u8 idx; + value = SCFG_GetPsramdBoundary(); + + if( value == SCFG_PSRAM_BOUNDARY_4MB ) + { + idx = 0; + } + else if ( value == SCFG_PSRAM_BOUNDARY_16MB ) + { + idx = 1; + } + else if ( value == SCFG_PSRAM_BOUNDARY_32MB ) + { + idx = 2; + } + + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].iValue = idx; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].str.sjis = s_strPSRAM[ idx ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].argType = ARG_INT; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].kindNameList = s_strPSRAM; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].numKindName = 3; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].changeFunc.cInt = setPsramBoundaryFlag; + } + + value = SCFG_IsNDmaAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].str.sjis = s_strAccess[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].changeFunc.cBool = SCFG_SetNDmaAccessible; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].kindNameList = s_strAccess; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].numKindName = 2; + + value = SCFG_IsCameraAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].str.sjis = s_strAccess[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].changeFunc.cBool = SCFG_SetCameraAccessible; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].kindNameList = s_strAccess; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].numKindName = 2; + + value = SCFG_IsDSPAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].str.sjis = s_strAccess[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].changeFunc.cBool = SCFG_SetDSPAccessible; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].kindNameList = s_strAccess; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].numKindName = 2; + + value = (reg_SCFG_EXT & REG_SCFG_EXT_MC_B_MASK) || 0; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MCB].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MCB].str.sjis = s_strAccess[ value ]; + + value = SCFG_IsWRAMAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_WRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_WRAM].str.sjis = s_strAccess[ value ]; + + value = SCFG_IsConfigBlockAccessible(); + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].iValue = value; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].str.sjis = s_strAccess[ value ]; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].changable = TRUE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].argType = ARG_BOOL; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].kindNameList = s_strAccess; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].changeFunc.cBool = setSCFGAccessFlag; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].numKindName = 2; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].numLines = 2; + +} + +void getSCFGARM7InfoReg( void ) +{ + // レジスタに直接格納されているほうのSCFGデータを取得 + + + int value; + + // ROM制御レジスタ(L)、(H) + { + // SECフラグはTRUE = 切り離し(アクセス不可), FALSE = 接続(アクセス可) + value = ( gArm7SCFGReg[DISP_REG_A9ROM_OFFSET - 0x4000] & DISP_REG_SCFG_A9ROM_SEC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_SEC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_SEC].str.sjis = s_strJoint[ value ]; + + value = ( gArm7SCFGReg[DISP_REG_A9ROM_OFFSET - 0x4000] & DISP_REG_SCFG_A9ROM_RSEL_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_RSEL].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_RSEL].str.sjis = s_strRomMode[ value ]; + + // SECフラグはTRUE = 切り離し(アクセス不可), FALSE = 接続(アクセス可) + value = ( gArm7SCFGReg[DISP_REG_A7ROM_OFFSET - 0x4000] & DISP_REG_SCFG_A7ROM_SEC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_SEC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_SEC].str.sjis = s_strJoint[ value ]; + + value = ( gArm7SCFGReg[DISP_REG_A7ROM_OFFSET - 0x4000] & DISP_REG_SCFG_A7ROM_RSEL_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_RSEL].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_RSEL].str.sjis = s_strRomMode[ value ]; + + // FuseROMフラグはTRUE = 切り離し(アクセス不可), FALSE = 接続(アクセス可) + value = ( gArm7SCFGReg[DISP_REG_A7ROM_OFFSET - 0x4000] & DISP_REG_SCFG_A7ROM_FUSE_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_FUSE].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_FUSE].str.sjis = s_strJoint[ value ]; + + value = ( gArm7SCFGReg[DISP_REG_ROMWE_OFFSET - 0x4000] & DISP_REG_SCFG_ROMWE_WE_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_WE].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_WE].str.sjis = s_strEnable[ value ]; + } + + // 新規ブロッククロック制御レジスタ + { + u16 flag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_CLK_OFFSET - 0x4000] ); + + value = ( flag & DISP_REG_SCFG_CLK_SD1HCLK_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD1].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD1].str.sjis = s_strSupply[ value ]; + + value = ( flag & DISP_REG_SCFG_CLK_SD2HCLK_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD2].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD2].str.sjis = s_strSupply[ value ]; + + value = ( flag & DISP_REG_SCFG_CLK_AESHCLK_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_AES].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_AES].str.sjis = s_strSupply[ value ]; + + value = ( flag & DISP_REG_SCFG_CLK_WRAMHCLK_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_WRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_WRAM].str.sjis = s_strSupply[ value ]; + + value = ( flag & DISP_REG_SCFG_CLK_SNDMCLK_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SND].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SND].str.sjis = s_strSupply[ value ]; + } + + // JTAG制御レジスタ + { + u16 flag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_JTAG_OFFSET - 0x4000] ); + + value = ( flag & DISP_REG_SCFG_JTAG_ARM7SEL_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_A7].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_A7].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_A7].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_A7].numLines = 2; + + value = ( flag & DISP_REG_SCFG_JTAG_CPUJE_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_CPU].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_CPU].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_JTAG_DSPJE_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_DSP].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_DSP].str.sjis = s_strEnable[ value ]; + } + + // 拡張機能制御レジスタ + { + u32 flag = MI_LoadLE32( &gArm7SCFGReg[DISP_REG_EXT_OFFSET - 0x4000] ); + + value = ( flag & DISP_REG_SCFG_EXT_DMA_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMA].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMA].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_SDMA_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SDMA].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SDMA].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_SND_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SND].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SND].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_MC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].numLines = 2; + + value = ( flag & DISP_REG_SCFG_EXT_INTC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].numLines = 2; + + value = ( flag & DISP_REG_SCFG_EXT_SPI_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SPI].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SPI].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_DSEL_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].numLines = 2; + + value = ( flag & DISP_REG_SCFG_EXT_SIO_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SIO].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SIO].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_LCDC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_LCDC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_LCDC].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_VRAM_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_VRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_VRAM].str.sjis = s_strEnable[ value ]; + + { + u8 idx = 0; + value = (int) ( (flag & DISP_REG_SCFG_EXT_PSRAM_MASK) >> DISP_REG_SCFG_EXT_PSRAM_SHIFT ); + + + if( value <= 1 ) + { + idx = 0; + } + else if ( value == 2 ) + { + idx = 1; + } + else if ( value == 3 ) + { + idx = 2; + } + + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PS].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PS].str.sjis = s_strPSRAM[idx]; + } + + value = ( flag & DISP_REG_SCFG_EXT_DMAC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMAC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMAC].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_AES_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_AES].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_AES].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_SD1_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD1].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD1].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_SD2_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD2].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD2].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_MIC_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MIC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MIC].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_I2S_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2S].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2S].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_I2C_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2C].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2C].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_GPIO_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_GPIO].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_GPIO].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_MC_B_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MCB].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MCB].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_WRAM_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_WRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_WRAM].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_PUENABLE_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PU].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PU].str.sjis = s_strEnable[ value ]; + + value = ( flag & DISP_REG_SCFG_EXT_CFG_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_CFG].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_CFG].str.sjis = s_strEnable[ value ]; + + } + + // メモリカード I/F 制御レジスタ + { + u16 flag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_MC_OFFSET - 0x4000] ); + + value = ( flag & DISP_REG_MI_MC_SL1_CDET_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_CDET].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_CDET].str.sjis = s_strBool[ value ]; + + value = ( flag & DISP_REG_MI_MC_SL2_CDET_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_CDET].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_CDET].str.sjis = s_strBool[ value ]; + + value = ( flag & DISP_REG_MI_MC_SWP_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SWP].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SWP].str.sjis = s_strBool[ value ]; + + value = (flag & DISP_REG_MI_MC_SL1_MODE_MASK) >> DISP_REG_MI_MC_SL1_MODE_SHIFT ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_MODE].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_MODE].str.sjis = s_strMCMode[value]; + + value = (flag & DISP_REG_MI_MC_SL2_MODE_MASK) >> DISP_REG_MI_MC_SL2_MODE_SHIFT; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_MODE].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_MODE].str.sjis = s_strMCMode[value]; + + flag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_MCCHAT_OFFSET - 0x4000] ); + value = (flag & DISP_REG_MI_MCCHAT_CC_MASK) >> DISP_REG_MI_MCCHAT_CC_SHIFT; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_CC].iValue = value; + snprintf( gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_CC].str.sjis , DISPINFO_BUFSIZE-1, "%04x", value); + + flag = MI_LoadLE16( &gArm7SCFGReg[DISP_REG_MC2_OFFSET - 0x4000] ); + value = (flag & DISP_REG_MI_MC2_CA_MASK ) >> DISP_REG_MI_MC2_CA_SHIFT; + ;gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_CA].iValue = value; + snprintf( gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_CA].str.sjis , DISPINFO_BUFSIZE-1, "%04x", value ); + } + + // 旧無線送受信制御レジスタ + { + u8 flag = gArm7SCFGReg[DISP_REG_WL_OFFSET - 0x4000]; + + value = ( flag & DISP_REG_SCFG_WL_OFFB_MASK ) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_WL_OFFB].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_WL_OFFB].str.sjis = s_strEnable[ value ]; + } + + // オプション端子読み出しレジスタ + { + + u8 flag = gArm7SCFGReg[DISP_REG_OP_OFFSET - 0x4000]; + value = (flag & DISP_REG_SCFG_OP_OPT_MASK) >> DISP_REG_SCFG_OP_OPT_SHIFT; + + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_OP_FORM].iValue = (value & 0x2) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_OP_FORM].str.sjis = value == 3 ? s_strRomForm[1] : s_strRomForm[0]; + + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_OP_APP].iValue = (value & 0x1) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_OP_APP].str.sjis = s_strRomApp[ value ]; + } +} + +void getSCFGARM7InfoShared( void ) +{ + // 共有領域に退避されたほうのSCFGデータを取得する + int value; + + // 拡張機能制御レジスタ (4byte) + { + u32 extData = MI_LoadLE32( &gArm7SCFGShared[HWi_WSYS04_OFFSET] ); + + value = (extData & DISP_REG_SCFG_EXT_DMA_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DMA].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DMA].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_SDMA_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SDMA].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SDMA].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_SND_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SND].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SND].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_MC_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MC].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MC].numLines = 2; + + value = (extData & DISP_REG_SCFG_EXT_INTC_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_INTC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_INTC].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_INTC].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_INTC].numLines = 2; + + value = (extData & DISP_REG_SCFG_EXT_SPI_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SPI].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SPI].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_DSEL_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DSEL].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DSEL].str.sjis = s_strEnable[ value ]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DSEL].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DSEL].numLines = 2; + + value = (extData & DISP_REG_SCFG_EXT_LCDC_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_LCDC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_LCDC].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_VRAM_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_VRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_VRAM].str.sjis = s_strEnable[ value ]; + + { + u8 idx = 0; + value = (int) ( (extData & HWi_WSYS04_EXT_PSRAM_MASK ) >> HWi_WSYS04_EXT_PSRAM_SHIFT ); + + if( value <= 1 ) + { + idx = 0; + } + else if ( value == 2 ) + { + idx = 1; + } + else if ( value == 3 ) + { + idx = 2; + } + + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_PS].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_PS].str.sjis = s_strPSRAM[idx]; + } + + value = (extData & DISP_REG_SCFG_EXT_DMAC_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DMAC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_DMAC].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_AES_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_AES].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_AES].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_SD1_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SD1].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SD1].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_SD2_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SD2].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_SD2].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_MIC_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MIC].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MIC].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_I2S_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_I2S].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_I2S].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_I2C_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_I2C].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_I2C].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_GPIO_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_GPIO].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_GPIO].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_MC_B_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MCB].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_MCB].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_WRAM_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_WRAM].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_WRAM].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_PUENABLE_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_PU].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_PU].str.sjis = s_strEnable[ value ]; + + value = (extData & DISP_REG_SCFG_EXT_CFG_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_CFG].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_EXT_CFG].str.sjis = s_strEnable[ value ]; + } + + // ボンディング、rom状態、旧無線レジスタ ( 1byte ) + { + u8 regData = gArm7SCFGShared[HWi_WSYS08_OFFSET]; + + value = (regData & HWi_WSYS08_OP_OPT_MASK) >> HWi_WSYS08_OP_OPT_SHIFT ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_OP_FORM].iValue = (value & 0x2) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_OP_FORM].str.sjis = value == 3 ? s_strRomForm[1] : s_strRomForm[0]; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_OP_APP].iValue = (value & 0x1) || 0 ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_OP_APP].str.sjis = s_strRomApp[ value ]; + + // rom制御 + value = ( regData & HWi_WSYS08_ROM_ARM9SEC_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM9_SEC ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM9_SEC ].str.sjis = s_strJoint[ value ] ; + + value = ( regData & HWi_WSYS08_ROM_ARM9RSEL_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM9_RSEL ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM9_RSEL ].str.sjis = s_strRomMode[value] ; + + value = ( regData & HWi_WSYS08_ROM_ARM7RSEL_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM7_RSEL ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM7_RSEL ].str.sjis = s_strRomMode[value] ; + + value = ( regData & HWi_WSYS08_ROM_ARM7FUSE_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM7_FUSE ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_ROM_ARM7_FUSE ].str.sjis = s_strJoint[ value ] ; + + // + value = ( regData & HWi_WSYS08_WL_OFFB_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_WL_OFFB ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_WL_OFFB ].str.sjis = s_strEnable[value] ; + + } + + // jtag、clkレジスタ ( 1byte ) + { + u8 regData = gArm7SCFGShared[HWi_WSYS09_OFFSET]; + + value = ( regData & HWi_WSYS09_JTAG_ARM7SEL_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_A7 ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_A7 ].str.sjis = s_strEnable[value] ; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_A7 ].isAligned = FALSE; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_A7 ].numLines = 2; + + value = ( regData & HWi_WSYS09_JTAG_CPUJE_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_CPU ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_CPU ].str.sjis = s_strEnable[value] ; + + value = ( regData & HWi_WSYS09_JTAG_DSPJE_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_DSP ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_JTAG_DSP ].str.sjis = s_strEnable[value] ; + + value = ( regData & HWi_WSYS09_CLK_SD1HCLK_MASK) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SD1 ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SD1 ].str.sjis = s_strSupply[value] ; + + value = ( regData & HWi_WSYS09_CLK_SD2HCLK_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SD2 ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SD2 ].str.sjis = s_strSupply[value] ; + + value = ( regData & HWi_WSYS09_CLK_AESHCLK_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_AES ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_AES ].str.sjis = s_strSupply[value] ; + + value = ( regData & HWi_WSYS09_CLK_WRAMHCLK_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_WRAM ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_WRAM].str.sjis = s_strSupply[value] ; + + value = ( regData & HWi_WSYS09_CLK_SNDMCLK_MASK ) || 0; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SND ].iValue = value; + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_SHARED_OFFSET + SCFG_ARM7_CLK_SND ].str.sjis = s_strSupply[value] ; + } +} + +void setDSPResetFlag( BOOL flag ) +{ + if( flag ) + { + SCFG_ResetDSP(); + } + else + { + SCFG_ReleaseResetDSP(); + } +} + +void setPsramBoundaryFlag( int idx ) +{ + SCFGPsramBoundary value; + + if( idx < 0 || 2 < idx ) + { + return; + } + + OS_TPrintf("call setPsramBoundary( %d )\n", idx ); + + switch( idx ) + { + case 0: + value = SCFG_PSRAM_BOUNDARY_4MB; + break; + + case 1: + value = SCFG_PSRAM_BOUNDARY_16MB; + break; + + case 2: + value = SCFG_PSRAM_BOUNDARY_32MB; + break; + } + + SCFG_SetPsramBoundary( value ); +} + +void setSCFGAccessFlag( BOOL flag ) +{ + // Inaccessible = falseなのでフラグ反転 + if( !flag ) + { + SCFG_SetConfigBlockInaccessible(); + } +} + +void getTotalCheckResult( void ) +{ + BOOL isSecure; + BOOL isNandAccessable; + BOOL isVisibleSCFG; + BOOL isDebugger; + u64 arm7res; + u32 arm9res; + + isDebugger = ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) || 0; + + switch( DISPINFO_BIN_IDX ) + { + case 0: + case 4: + isSecure = FALSE; + isNandAccessable = TRUE; + isVisibleSCFG = FALSE; + break; + + case 1: + case 5: + isSecure = FALSE; + isNandAccessable = TRUE; + isVisibleSCFG = TRUE; + break; + case 2: + isSecure = FALSE; + isNandAccessable = FALSE; + isVisibleSCFG = FALSE; + break; + case 3: + isSecure = FALSE; + isNandAccessable = FALSE; + isVisibleSCFG = TRUE; + break; + case 6: + case 8: + case 14: + case 16: + isSecure = TRUE; + isNandAccessable = TRUE; + isVisibleSCFG = FALSE; + break; + + case 7: + case 9: + case 15: + case 17: + isSecure = TRUE; + isNandAccessable = TRUE; + isVisibleSCFG = TRUE; + break; + + case 10: + case 12: + isSecure = TRUE; + isNandAccessable = FALSE; + isVisibleSCFG = FALSE; + break; + + case 11: + case 13: + isSecure = TRUE; + isNandAccessable = FALSE; + isVisibleSCFG = TRUE; + break; + + default: + // mast not come here + return; + } + + // SCFGデータの検証 + arm7res = getArm7CheckData( isSecure, isNandAccessable, isVisibleSCFG, isDebugger ); + arm9res = getArm9CheckData( ); + + + // 両方とも0が返ってくれば正解 + if( !arm7res && !arm9res ) + { + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_TOTAL_CHECK].str.sjis = s_strCorrect[TRUE]; + STD_StrLCpy( gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CHECK_ERROR7].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + STD_StrLCpy( gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CHECK_ERROR9].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + } + else + { + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_TOTAL_CHECK].str.sjis = s_strCorrect[FALSE]; + STD_TSNPrintf( gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CHECK_ERROR7].str.sjis, + DISPINFO_BUFSIZE, "%012llx", arm7res ); + STD_TSNPrintf( gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CHECK_ERROR9].str.sjis, + DISPINFO_BUFSIZE, "%08x", arm9res ); + + } +} +/* +BOOL scfgTotalCheck( BOOL isSecure, BOOL isNandAccessable, BOOL isVisibleSCFG, BOOL isDebugger ) +{ + // ARM7 check + + if( isVisibleSCFG && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_SEC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_RSEL].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_SEC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_RSEL].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_FUSE].iValue != isSecure && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_WE].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD1].iValue == isNandAccessable && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD2].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_AES].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_WRAM].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SND].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMA].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SDMA].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SND].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SPI].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SIO].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_LCDC].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_VRAM].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PS].iValue == 3 && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMAC].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_AES].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD1].iValue == isNandAccessable && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD2].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MIC].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2S].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2C].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_GPIO].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MCB].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_WRAM].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PU].iValue && + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_CFG].iValue ) + { + arm7res = TRUE; + } + else if( !isVisibleSCFG && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_SEC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_RSEL].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_SEC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_RSEL].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_FUSE].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_WE].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD1].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD2].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_AES].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_WRAM].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SND].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMA].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SDMA].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SND].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SPI].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SIO].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_LCDC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_VRAM].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PS].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMAC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_AES].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD1].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD2].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MIC].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2S].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2C].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_GPIO].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MCB].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_WRAM].iValue && + ! gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PU].iValue && + !gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_CFG].iValue ) + { + arm7res = TRUE; + } + else + { + arm7res = FALSE; + } + + + // arm9 check + // こっちはSCFGLockでも見える + if( gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_SEC].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_ROM_STATE].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CPU].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_DSP].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_WRAM].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_CLK_CAM_CKI].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_RST_DSP].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMA].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_GEO].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_REN].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_2DE].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DIV].iValue && + ! gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_MC].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_INTC].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_LCDC].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_VRAM].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_PS].iValue == 2 && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DMAC].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CAM].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_DSP].iValue && + gAllInfo[MENU_SCFG_ARM9][SCFG_ARM9_EXT_CFG].iValue ) + { + arm9res = TRUE; + } + else + { + arm9res = FALSE; + } + + return arm9res && arm7res; +}*/ + +u64 getArm7CheckData( BOOL isSecure, BOOL isNandAccessable, BOOL isVisibleSCFG, BOOL isDebugger ) +{ + // 規定値に全て一致していればゼロが帰る + // 一致していなければ、一致していない項目に対応したビットが立ったデータが帰る + + u64 result = 0; + + int correctValue[SCFG_ARM7_MENU_SIZE] = { + // ROM status + TRUE, FALSE, TRUE, FALSE, 0, FALSE, + // CLK + 0, TRUE, TRUE, TRUE, TRUE, + // JTAG + 0, 0, 0, + // EXP + FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, + TRUE, TRUE, TRUE, 3, TRUE, TRUE, 0, TRUE, + TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 0, + // MI + FALSE, 2, 0, FALSE, FALSE, 0x1998, 0x264c, + // old wireless + TRUE + // Bonding opは不定 + }; + + correctValue[SCFG_ARM7_ROM_ARM7_FUSE] = !isSecure; + correctValue[SCFG_ARM7_CLK_SD1] = isNandAccessable; + correctValue[SCFG_ARM7_JTAG_CPU] = isDebugger; + correctValue[SCFG_ARM7_JTAG_DSP] = isDebugger; + correctValue[SCFG_ARM7_JTAG_A7] = isDebugger; + correctValue[SCFG_ARM7_EXT_SD1] = isNandAccessable; + correctValue[SCFG_ARM7_EXT_CFG] = isVisibleSCFG; + correctValue[SCFG_ARM7_MI_SC2_CDET] = !isDebugger; + + if( isVisibleSCFG ) + { +/* result = + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_SEC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_ARM9_SEC) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM9_RSEL].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_ARM9_RSEL ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_SEC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_ARM7_SEC ) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_RSEL].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_ARM7_RSEL ) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_ARM7_FUSE].iValue != isSecure) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_ARM7_FUSE ) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_ROM_WE].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_ROM_WE ) | + + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD1].iValue == isNandAccessable) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_CLK_SD1 ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SD2].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_CLK_SD2 ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_AES].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_CLK_AES ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_WRAM].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_CLK_WRAM ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_CLK_SND].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_CLK_SND ) | + + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_CPU].iValue == isDebugger) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_JTAG_CPU ) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_DSP].iValue == isDebugger ) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_JTAG_DSP ) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_JTAG_A7].iValue == isDebugger ) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_JTAG_A7 ) | + + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMA].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_DMA ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SDMA].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SDMA ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SND].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SND ) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MC].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_MC ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_INTC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_INTC ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SPI].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SPI ) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DSEL].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_DSEL ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SIO].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SIO ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_LCDC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_LCDC ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_VRAM].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_VRAM ) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PS].iValue == 3) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_PS ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_DMAC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_DMAC ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_AES].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_AES ) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD1].iValue == isNandAccessable) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SD1 ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_SD2].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_SD2 ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MIC].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_MIC ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2S].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_I2S ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_I2C].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_I2C ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_GPIO].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_GPIO ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_MCB].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_MCB ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_WRAM].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_WRAM ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_PU].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_PU ) | + gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_EXT_CFG].iValue << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_EXT_CFG ) | + + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_CDET].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SC1_CDET) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC1_MODE].iValue == 2) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SC1_MODE) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_CDET].iValue != isDebugger ) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SC2_CDET) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SC2_MODE].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SC2_MODE) | + (!gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_SWP].iValue) << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SWP) | + (gAllInfo[MENU_SCFG_ARM7][SCFG_ARM7_MI_CC].iValue) == 0x1988) + << (SCFG_ARM7_MENU_SIZE - SCFG_ARM7_MI_SWP) | + ;*/ + int index; + + for( index = 0; index < SCFG_ARM7_MENU_SIZE ; index++ ) + { + if(SCFG_ARM7_OP_FORM <= index) + { + // この辺の値は開発機か量産機かで変わるので目視で判断 + //result |= 0 << index; + continue; + } + + OS_TPrintf("%d:%d:%d ", index, gAllInfo[MENU_SCFG_ARM7][index].iValue ,correctValue[index] ); + result |= ( gAllInfo[MENU_SCFG_ARM7][index].iValue != correctValue[index] ) << index; + } + + return result; + } + else + { + int index; + result = 0; + + for( index = 0; index < SCFG_ARM7_MENU_SIZE ; index++ ) + { + result |= ( gAllInfo[MENU_SCFG_ARM7][index].iValue ) << index; + } + + return result; + } + +} + +u32 getArm9CheckData( void ) +{ + u32 result = 0; + int index; + + int correctValue[SCFG_ARM9_MENU_SIZE] = { + // ROM status + TRUE, FALSE, + // CLK + TRUE, FALSE, TRUE, TRUE, FALSE, + // RST + FALSE, + // EXT + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + TRUE, TRUE, TRUE, 2, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE + }; + + for( index = 0; index < SCFG_ARM9_MENU_SIZE ; index++ ) + { + if( SCFG_ARM9_TOTAL_CHECK <= index) + { + //result |= 0 << index; + continue; + } + + OS_TPrintf("%d:%d ",gAllInfo[MENU_SCFG_ARM9][index].iValue ,correctValue[index] ); + result |= ( gAllInfo[MENU_SCFG_ARM9][index].iValue != correctValue[index] ) << index; + } + + OS_TPrintf("\nresult: %d\n", result); + return result; + +} + + \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_secureUser.c b/build/tests/DisplaySystemInformation/ARM9/src/get_secureUser.c new file mode 100644 index 00000000..f42a1ee0 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_secureUser.c @@ -0,0 +1,112 @@ +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + + +void getSecureUserInfo( void ) +{ + int value; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_INSTALLED_SOFTBOX].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INSTALLED_SOFTBOX].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INSTALLED_SOFTBOX].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_FREE_SOFTBOX].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_FREE_SOFTBOX].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_FREE_SOFTBOX].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_IDX].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_IDX].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_IDX].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_PLATFORM].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_PLATFORM].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_PLATFORM].fromLCFG = TRUE; + + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].isAligned = FALSE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].numLines = 2; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].fromLCFG = TRUE; + STD_StrCpy( gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].str.sjis, "0000" ); + + if( gLCFGAccessible ) + { + + value = LCFG_TSD_IsFinishedInitialSetting(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].str.sjis = s_strBool[ value ]; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].changable = TRUE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].changeFunc.cBool = LCFG_TSD_SetFlagFinishedInitialSetting; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].argType = ARG_BOOL; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].kindNameList = s_strBool; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_SETTINGS].numKindName = 2; + + value = LCFG_TSD_IsFinishedInitialSetting_Launcher(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].str.sjis = s_strBool[ value ]; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].changable = TRUE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].changeFunc.cBool = LCFG_TSD_SetFlagFinishedInitialSetting_Launcher; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].argType = ARG_BOOL; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].kindNameList = s_strBool; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INITIAL_LAUNCHER].numKindName = 2; + + value = LCFG_TSD_IsFinishedBrokenTWLSettings(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].str.sjis = s_strBool[ value ]; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].changable = TRUE; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].changeFunc.cBool = LCFG_TSD_SetFlagFinishedBrokenTWLSettings; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].argType = ARG_BOOL; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].kindNameList = s_strBool; + gAllInfo[MENU_SECURE_USER][SECURE_USER_BROKEN_SETTINGS].numKindName = 2; + + value = LCFG_TSD_GetInstalledSoftBoxCount(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_INSTALLED_SOFTBOX].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_INSTALLED_SOFTBOX].isNumData = TRUE; + + + value = LCFG_TSD_GetFreeSoftBoxCount(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_FREE_SOFTBOX].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_FREE_SOFTBOX].isNumData = TRUE; + + value = LCFG_TSD_GetLastTimeBootSoftIndex(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_IDX].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_IDX].isNumData = TRUE; + + value = LCFG_TSD_GetLastTimeBootSoftPlatform(); + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_PLATFORM].iValue = value; + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_PLATFORM].isNumData = TRUE; + + + { + u64 buf = LCFG_TSD_GetLastTimeBootSoftTitleID(); + + + if( buf ) + // bufが0だったら前回起動したアプリが設定されていない + { + u32 titleID = MI_LoadBE32( &buf ); + + OS_TPrintf("Lastboot ID: %x Title ID: %x\n", buf, titleID ); + + MI_CpuCopy( &titleID, gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].str.sjis, 4 ); + gAllInfo[MENU_SECURE_USER][SECURE_USER_LASTBOOT_ID].str.sjis[8] = '\0'; + } + } + } + + +} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_sysmenu.c b/build/tests/DisplaySystemInformation/ARM9/src/get_sysmenu.c new file mode 100644 index 00000000..78824d98 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_sysmenu.c @@ -0,0 +1,265 @@ +#include +#include +#include +#include +#include + +#include "getInformation.h" +#include "viewSystemInfo.h" +#include "strResource.h" +#include "misc.h" +#include "util.h" + + +#define FILE_VERSION "verdata:/version.bin" +#define FILE_EULA_URL "verdata:/eula_url.bin" +#define FILE_NUP_HOSTNAME "verdata:/nup_host.bin" +#define FILE_TIMESTAMP "verdata:/time_stamp.bin" + +#define FILE_SIGN_NUP_CERT "verdata:/.twl-nup-cert.der" +#define FILE_SIGN_NUP_PRV "verdata:/.twl-nup-prvkey.der" +#define FILE_SIGN_SHOP_CERT "verdata:/.twl-shop-cert.der" +#define FILE_SIGN_SHOP_PRV "verdata:/.twl-shop-prvkey.der" +#define FILE_SIGN_NINTENDO_CAG2 "verdata:/NintendoCA-G2.der" +#define NUM_FILE_SIGN 5 + + +typedef struct SystemMenuVersion { + u16 major; + u16 minor; + u16 str[ TWL_SYSMENU_VER_STR_LEN / sizeof(u16) ]; +}SystemMenuVersion; + +static char* s_strSignFilePath[] = { + FILE_SIGN_NUP_CERT, + FILE_SIGN_NUP_PRV, + FILE_SIGN_SHOP_CERT, + FILE_SIGN_SHOP_PRV, + FILE_SIGN_NINTENDO_CAG2, +}; + +static char* s_strSignHashDev[] = { + "01e03e86fe11c5172ba742045c63e65c2f058e99", + "7497940e3a3591d592b46ff99d75ebe102c27550", + "cf130c7674bae733f3b106109bb06cc0d6ac1a18", + "ab38a52a384ab63ea8397de6eae8a96d6c108888", + "c60b2a5cc90f0630cca33040df6b3378239f3bfa" +}; + +static char* s_strSignHashProd[] = { + "0626f8ac62baaa0b70c543a33962e54507d451d6", + "58c198c8099d579500cb5d9007bf81404a3c41fa", + "72445f08ab30a41aff9e20a2e64ca7d2b263765e", + "43a81069e6b6300dbe08d6fc3583d0c384a37996", + "c60b2a5cc90f0630cca33040df6b3378239f3bfa" +}; + + +void getSysmenuInfo( void ) +{ + u8 *pBuffer = (u8*) Alloc (NA_VERSION_DATA_WORK_SIZE); + + // numLineやallinedの設定が必要なのであえてエラーチェックはしない + NA_LoadVersionDataArchive( pBuffer, NA_VERSION_DATA_WORK_SIZE) ; + + + // バージョンの読み出し + { + FSFile file; + SystemMenuVersion bufVersion; + s32 len; + + FS_InitFile(&file); + + if ( FS_OpenFileEx(&file, FILE_VERSION, FS_FILEMODE_R)) + { + len = FS_ReadFile(&file, &bufVersion, sizeof(SystemMenuVersion)); + FS_CloseFile(&file); + + gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_NUM].iValue = (int)( bufVersion.major << 16 | bufVersion.minor ); + gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_NUM].isNumData = TRUE; + + wcsncpy( gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_STR].str.utf, bufVersion.str, TWL_SYSMENU_VER_STR_LEN ); + gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_STR].isSjis = FALSE; + } + else + { + // 成功しなかった場合はデータはN/A + gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_STR].str.sjis = s_strNA; + gAllInfo[MENU_SYSMENU][SYSMENU_VERSION_STR].isSjis = TRUE; + } + } + + // EULA URLの読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if ( FS_OpenFileEx(&file, FILE_EULA_URL, FS_FILEMODE_R)) { + len = FS_ReadFile(&file, gAllInfo[MENU_SYSMENU][SYSMENU_EULA_URL].str.sjis , TWL_EULA_URL_LEN) ; + FS_CloseFile(&file); + } + else + { + STD_StrLCpy( gAllInfo[MENU_SYSMENU][SYSMENU_EULA_URL].str.sjis, s_strNA, TWL_EULA_URL_LEN ); + } + } + + // NUP HOST NAME の読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if ( FS_OpenFileEx(&file, FILE_NUP_HOSTNAME, FS_FILEMODE_R)) { + len = FS_ReadFile(&file, gAllInfo[MENU_SYSMENU][SYSMENU_NUP_HOST].str.sjis, TWL_NUP_HOSTNAME_LEN); + FS_CloseFile(&file); + } + else + { + STD_StrLCpy( gAllInfo[MENU_SYSMENU][SYSMENU_NUP_HOST].str.sjis, s_strNA , TWL_NUP_HOSTNAME_LEN ); + } + + } + + // タイムスタンプ の読み出し + { + FSFile file; + s32 len; + + FS_InitFile(&file); + + if ( FS_OpenFileEx(&file, FILE_TIMESTAMP, FS_FILEMODE_R)) { + len = FS_ReadFile(&file, &gAllInfo[MENU_SYSMENU][SYSMENU_TIMESTAMP].iValue, sizeof(u32) ); + gAllInfo[MENU_SYSMENU][SYSMENU_TIMESTAMP].isNumData = TRUE; + FS_CloseFile(&file); + } + } + + // 署名の照合 + { + FSFile file[NUM_FILE_SIGN]; + u32 fileLen[NUM_FILE_SIGN], maxFileSize = 0; + u8 i; + u8 *srcBuf, *dstBuf, digestBuf[MATH_SHA1_DIGEST_SIZE], + cmpDigestDevBuf[MATH_SHA1_DIGEST_SIZE], cmpDigestProdBuf[MATH_SHA1_DIGEST_SIZE]; + + for( i=0 ; i < NUM_FILE_SIGN; i++ ) + { + // 最初にエントリの行数情報を設定しておく + gAllInfo[MENU_SYSMENU][i + SYSMENU_HASH_IDX].numLines = 2; + gAllInfo[MENU_SYSMENU][i + SYSMENU_HASH_IDX].isAligned = FALSE; + } + + for( i=0 ; i < NUM_FILE_SIGN; i++ ) + { + FS_InitFile( &file[i] ); + + // 署名されたファイルをそれぞれオープン + if( !FS_OpenFileEx( &file[i], s_strSignFilePath[i], FS_FILEMODE_R ) ) + { + // 開けなかったらNANDアクセス禁止状態なので戻る + OS_Printf("sysmenu info error: Openfile failed.\n" ); + return ; + } + + // ファイル容量をそれぞれ取得 + fileLen[i] = FS_GetFileLength( &file[i] ); + } + + // バッファを大きくしたり縮めたりしたくないので + // 一番大きいファイルと同じ大きさのバッファを確保してしまう + for( i=0 ; i < NUM_FILE_SIGN; i++ ) + { + if( maxFileSize < fileLen[i] ) + { + maxFileSize = fileLen[i]; + } + } + + srcBuf = (u8*) Alloc ( maxFileSize ); + dstBuf = (u8*) Alloc ( maxFileSize ); + + // それぞれのファイルに対して署名検証を行う + for( i=0 ; i < NUM_FILE_SIGN; i++ ) + { + u8 idx = (u8)(SYSMENU_HASH_IDX + i) ; + + OS_TPrintf("Checking signature...%s\n", s_strMetaMenu[MENU_SYSMENU][idx] ); + + // ファイル読み込み + FS_ReadFile( &file[i], srcBuf, (s32)fileLen[i] ); + OS_TPrintf("FileSize: %d byte HeadData: %02x%02x%02x\n", fileLen[i], srcBuf[0], srcBuf[1], srcBuf[2] ); + + if( SYSMENU_NUP_CERT <= idx && idx < SYSMENU_NINTENDO_CAG2 ) + { + s32 result; + + // SYSMENU_NUP_CERTからの4ファイルは暗号化されているので複合化する + result = NA_DecodeVersionData( srcBuf, fileLen[i] , dstBuf, fileLen[i] ); + + if( result < 0 ) + { + OS_TPrintf( "NA_DecodeVersionData() Failed. errCode: %d\n", result ); + continue; + } + + // 出コードするとファイルサイズが変わるっぽいので更新する + fileLen[i] = (u32)result; + + OS_TPrintf("Dacode VersionData... HeadData: %02x%02x%02x\n", dstBuf[0], dstBuf[1], dstBuf[2] ); + + // 複合化データからキャッシュを計算 + MATH_CalcSHA1( digestBuf, dstBuf, fileLen[i] ); + } + else + { + // それ以外はそのままハッシュを求める + MATH_CalcSHA1( digestBuf, srcBuf, fileLen[i] ); + } + + strToHexa( s_strSignHashDev[i] , cmpDigestDevBuf, MATH_SHA1_DIGEST_SIZE ); + strToHexa( s_strSignHashProd[i], cmpDigestProdBuf, MATH_SHA1_DIGEST_SIZE ); + + gAllInfo[MENU_SYSMENU][idx].numLines = 2; + gAllInfo[MENU_SYSMENU][idx].isAligned = FALSE; + + putBinary( cmpDigestDevBuf, MATH_SHA1_DIGEST_SIZE ); + putBinary( cmpDigestProdBuf, MATH_SHA1_DIGEST_SIZE ); + putBinary( digestBuf, MATH_SHA1_DIGEST_SIZE ); + + // ハッシュ値が一致したらcorrect,一致しなかったらincorrect + if( MI_CpuComp8( cmpDigestDevBuf, digestBuf, MATH_SHA1_DIGEST_SIZE ) == 0 ) + { + gAllInfo[MENU_SYSMENU][idx].str.sjis = + idx == SYSMENU_NINTENDO_CAG2 ? s_strCorrect[1] : s_strSysMenuKey[1]; + } + else if( MI_CpuComp8( cmpDigestProdBuf, digestBuf, MATH_SHA1_DIGEST_SIZE ) == 0 ) + { + gAllInfo[MENU_SYSMENU][idx].str.sjis = + idx == SYSMENU_NINTENDO_CAG2 ? s_strCorrect[1] : s_strSysMenuKey[2]; + } + else + { + gAllInfo[MENU_SYSMENU][idx].str.sjis = s_strSysMenuKey[0]; + } + + + } + + // バッファの開放 + Free( srcBuf ); + Free( dstBuf ); + } + + + // SystemMenuVersionのアンマウント + if( !NA_UnloadVersionDataArchive() ) { + return; + } + + Free(pBuffer); +} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_versionData.c b/build/tests/DisplaySystemInformation/ARM9/src/get_versionData.c new file mode 100644 index 00000000..d2269f89 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_versionData.c @@ -0,0 +1,55 @@ + +#include +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" +#include "misc.h" + +void getWirelessVersion( void ); +void getContentsVersion( void ); +void getSharedFontVersion( void ); + + +void getContentsVersion( void ) +// コンテンツリストをもとに各コンテンツのタイトルIDとバージョンを取得 +{ + NAMTitleInfo info; + int i; + + gNumContents = NAM_GetNumTitles(); + + if( gNumContents < 0 ) + { + // NAMが駄目だとか、NANDアクセスできないだとかの場合は終了 + return ; + } + + OS_TPrintf(" numContents: %d\n", gNumContents); + + if( gContentsTitle == NULL ) + { + // 初回処理の時はバッファを確保 + gContentsTitle = (NAMTitleId*) Alloc( sizeof(NAMTitleId) * gNumContents ); + gContentsVersion = (u16*) Alloc( sizeof(u16) * (u32)gNumContents); + SDK_ASSERT( gContentsTitle ); + SDK_ASSERT( gContentsVersion ); + } + + NAM_GetTitleList( gContentsTitle, (u32)gNumContents); + SDK_POINTER_ASSERT( gContentsTitle ); + SDK_POINTER_ASSERT( gContentsVersion ); + + for( i=0; i +#include +#include +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" +#include "util.h" +#include "misc.h" + +#define WHITELIST_TITLEID 0x0003000f484e4841 +#define DS_HASH_TABLE_SIZE (256*1024) + +void getWhitelistHash( void ); +void getNumDHTEntry( void ); +BOOL cmpHash( void *src1, void *src2 ); + +void getWhiteListInfo( void ) +{ + OS_TPrintf("...Whitelist Information\n"); + + getWhitelistHash(); + getNumDHTEntry(); +} + +void getWhitelistHash( void ) +{ + u32 tmdSize=0, fileSize; + ESTitleMeta *tmd; + + FSFile file; + char filePath[NAM_PATH_LEN+1]; + u8 *fileBuf, digestBuf[MATH_SHA1_DIGEST_SIZE]; + + + // ESライブラリを使ってハッシュ値を取得する + // 一回目の呼び出しでサイズを取得して二回目で値をもらう + ES_GetTmd( WHITELIST_TITLEID, NULL, &tmdSize ); + tmd = (ESTitleMeta*) Alloc ( tmdSize ); + SDK_ASSERT( tmd ); + ES_GetTmd( WHITELIST_TITLEID , tmd, &tmdSize ); + + if( tmd == NULL ) + { + OS_TPrintf("getting tmd hash failed.\n" ); + return; + } + + putBinary( (u8*)&tmd->contents[0].hash , MATH_SHA1_DIGEST_SIZE ); + + // ホワイトリストのファイルの実態を引っ張ってくる + FS_InitFile( &file ); + NAM_GetTitleBootContentPath( filePath , WHITELIST_TITLEID ); + + OS_TPrintf("filepath : %s\n", filePath ); + + if( ! FS_OpenFileEx( &file, filePath, FS_FILEMODE_R ) ) + { + OS_TPrintf("whitelist info error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(filePath) ); + return; + } + + fileSize = FS_GetFileLength( &file ); + + fileBuf = (u8*) Alloc ( fileSize ); + SDK_ASSERT( fileBuf ); + + if( fileSize != FS_ReadFile( &file, fileBuf, (s32)fileSize ) ) + { + OS_TPrintf("whitelist info error: FS_ReadFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(filePath) ); + return; + } + + MATH_CalcSHA1( digestBuf, fileBuf, fileSize ); + putBinary( digestBuf, MATH_SHA1_DIGEST_SIZE ); + + gAllInfo[MENU_WHITE][WHITE_HASH].str.sjis = s_strCorrect [ cmpHash( digestBuf, &tmd->contents[0].hash ) ]; + + FS_CloseFile( &file ); + Free( tmd ); + Free( fileBuf ); + +} + +void getNumDHTEntry( void ) +{ + DHTFile *dht; + FSFile file; + char filePath[NAM_PATH_LEN+1]; + + dht = (DHTFile*) Alloc (DS_HASH_TABLE_SIZE); + SDK_ASSERT(dht); + + FS_InitFile( &file ); + NAM_GetTitleBootContentPathFast( filePath , WHITELIST_TITLEID ); + + OS_TPrintf("DHTEntry reading...\n"); + + if( ! FS_OpenFileEx( &file, filePath, FS_FILEMODE_R ) ) + { + OS_TPrintf("whitelist info error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(filePath) ); + return; + } + +/* if( ! FS_SeekFile( &file, sizeof(ROM_Header), FS_SEEK_SET ) ) + { + OS_TPrintf("whitelist info error: FS_SeekFile() failed. FSResult: %d\n", FS_GetArchiveResultCode(filePath) ); + return; + } +*/ + if( ! DHT_PrepareDatabase( dht, &file ) ) + { + OS_TPrintf("whitelist info error: PrepareDatabase() failed.\n" ); + return; + } + + DC_FlushRange( dht, DHT_GetDatabaseLength( dht )); + OS_TPrintf(" dht.header.nums : %d\n", dht->header.nums); + + FS_CloseFile( &file ); + gAllInfo[MENU_WHITE][WHITE_NUM].iValue = (int)dht->header.nums; + gAllInfo[MENU_WHITE][WHITE_NUM].isNumData = TRUE; + + Free(dht); +} + +// 二つのハッシュを比較して一致してたら返す +// でもsrc2はビッグエンディアンやねん +BOOL cmpHash( void *src1, void *src2 ) +{ + u8 *u1 = (u8*)src1; + u8 *u2 = (u8*)src2; + + return MI_CpuComp8( u1, u2, MATH_SHA1_DIGEST_SIZE ) == 0 ; + +} \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/get_wl.c b/build/tests/DisplaySystemInformation/ARM9/src/get_wl.c new file mode 100644 index 00000000..5532d3e8 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/get_wl.c @@ -0,0 +1,142 @@ +#include +#include + +#include "viewSystemInfo.h" +#include "strResource.h" +#include "getInformation.h" + +#define WL_TITLEID 0x0003000F484E4341 + +#define WL_FW_LOADSIZE 0x10 +#define WL_FW_LOAD_OFFSET 0xa0 +#define WL_FW_VERSION_LO_IDX 0x1 +#define WL_FW_VERSION_HI_IDX 0x0 +#define WL_FW_VERSION_SIZE 0x2 +#define WL_NUM_FW_IDX 0x2 +#define WL_NUM_FW_SIZE 0x2 +#define WL_FW1_OFFSET_IDX 0x4 +#define WL_FW_TYPE_IDX 0xc +#define WL_FW_TYPE_SIZE 0x4 + +#define WL_FW2_OFFSET_IDX 0xc4 +#define WL_FW2_TYPE_IDX 0xcc + +#define WL_FW_SECTION_OFFSET 0x4 +#define WL_FW_VER_MINUSOFFSET 0x2c + +#define WL_FW_IDX_OFFSET 3 + + + + +void getWLInfo( void ) +{ + FSFile file; + char filePath[NAM_PATH_LEN+1]; + char filebuf[WL_FW_LOADSIZE]; + int res; + + FS_InitFile( &file ); + NAM_GetTitleBootContentPath( filePath , WL_TITLEID); // 無線ファームのファイルパスを取得 + OS_TPrintf("wireless firm path: %s\n", filePath ) ; + + if( FS_OpenFileEx( &file, filePath, FS_FILEMODE_R ) ) + { + int value; + s32 fwOffset, sectionOffset; + + /* + // バージョン情報の読み取り + FS_SeekFile( &file, WL_FW_VERSION_OFFSET, FS_SEEK_SET ); + res = FS_ReadFile( &file, filebuf, WL_FW_VERSION_SIZE ); + + if( res == WL_FW_VERSION_SIZE ) + { + snprintf( gAllInfo[MENU_WL][WL_VERSION].str.sjis, DISPINFO_BUFSIZE-1, "%d.%d", filebuf[0], filebuf[1] ); + gAllInfo[MENU_WL][WL_VERSION].iValue = filebuf[0] *100 + filebuf[1]; + } + + // ファームウェアの数の取得 + FS_SeekFile( &file, WL_NUM_FW, FS_SEEK_SET ); + res = FS_ReadFile( &file, filebuf, 2 ); + + if( res == WL_NUM_FW_SIZE ) + { + gAllInfo[MENU_WL][WL_NUM_FW].iValue = filebuf[0]; + gAllInfo[MENU_WL][WL_NUM_FW].isNumData = TRUE; + } + + // ファームタイプの取得 + FS_SeekFile( &file, WL_FW_TYPE_OFFSET, FS_SEEK_SET ); + res = FS_ReadFile( &file, filebuf, WL_FW_TYPE_SIZE ); + + if( res == WL_FW_TYPE_SIZE ) + { + int value = (int) MI_LoadLE32( filebuf ); + gAllInfo[MENU_WL][WL_FW_TYPE].iValue = value; + gAllInfo[MENU_WL][WL_FW_TYPE].str.sjis = s_strWLFWType[ value ]; + }*/ + + FS_SeekFile( &file, WL_FW_LOAD_OFFSET , FS_SEEK_SET); + res = FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE); + + if( res == WL_FW_LOADSIZE ) + { + int value; + + snprintf( gAllInfo[MENU_WL][WL_VERSION].str.sjis, DISPINFO_BUFSIZE-1, "%d.%d", + filebuf[WL_FW_VERSION_HI_IDX], filebuf[WL_FW_VERSION_LO_IDX] ); + + gAllInfo[MENU_WL][WL_NUM_FW].iValue = (int) MI_LoadLE8( &filebuf[WL_NUM_FW_IDX] ); + gAllInfo[MENU_WL][WL_NUM_FW].isNumData = TRUE; + + fwOffset = (s32)MI_LoadLE32( &filebuf[WL_FW1_OFFSET_IDX] ); + + value = (int) MI_LoadLE32( &filebuf[WL_FW_TYPE_IDX] ); + gAllInfo[MENU_WL][WL_FW1_TYPE].iValue = value; + gAllInfo[MENU_WL][WL_FW1_TYPE].str.sjis = s_strWLFWType[ value ]; + + FS_SeekFile( &file, fwOffset, FS_SEEK_SET ); + FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE ); + sectionOffset = (s32)MI_LoadLE32( &filebuf[WL_FW_SECTION_OFFSET] ); + + FS_SeekFile( &file, fwOffset + sectionOffset - WL_FW_VER_MINUSOFFSET, FS_SEEK_SET ); + FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE ); + snprintf( gAllInfo[MENU_WL][WL_FW1_VER].str.sjis, DISPINFO_BUFSIZE-1, "%08x", + MI_LoadLE32( filebuf ) ); + } + + if( gAllInfo[MENU_WL][WL_NUM_FW].iValue == 2 ) + { + FS_SeekFile( &file, WL_FW2_OFFSET_IDX, FS_SEEK_SET ); + FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE ); + fwOffset = (s32)MI_LoadLE32( filebuf ); + + value = (int) MI_LoadLE32( &filebuf[WL_FW2_TYPE_IDX - WL_FW2_OFFSET_IDX] ); + gAllInfo[MENU_WL][WL_FW2_TYPE].str.sjis = s_strWLFWType[ value ]; + + FS_SeekFile( &file, fwOffset, FS_SEEK_SET ); + FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE ); + sectionOffset = (s32)MI_LoadLE32( &filebuf[WL_FW_SECTION_OFFSET] ); + + FS_SeekFile( &file, fwOffset + sectionOffset - WL_FW_VER_MINUSOFFSET, FS_SEEK_SET ); + FS_ReadFile( &file, filebuf, WL_FW_LOADSIZE ); + snprintf( gAllInfo[MENU_WL][WL_FW2_VER].str.sjis, DISPINFO_BUFSIZE-1, "%08x", + MI_LoadLE32( filebuf ) ); + } + else + { + STD_StrLCpy( gAllInfo[MENU_WL][WL_FW2_VER].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + } + + FS_CloseFile( &file ); + } + else + { + // 読み込めなかったらとりあえずN/Aって入れておく + STD_StrLCpy( gAllInfo[MENU_WL][WL_VERSION].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + STD_StrLCpy( gAllInfo[MENU_WL][WL_FW2_VER].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + STD_StrLCpy( gAllInfo[MENU_WL][WL_FW1_VER].str.sjis, s_strNA, DISPINFO_BUFSIZE ); + } + +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/infodata.xls b/build/tests/DisplaySystemInformation/ARM9/src/infodata.xls new file mode 100644 index 00000000..b78857f8 Binary files /dev/null and b/build/tests/DisplaySystemInformation/ARM9/src/infodata.xls differ diff --git a/build/tests/DisplaySystemInformation/ARM9/src/main.c b/build/tests/DisplaySystemInformation/ARM9/src/main.c new file mode 100644 index 00000000..8df2ebd5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/main.c @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: main.c + + Copyright **** 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 "misc.h" +#include "viewSystemInfo.h" +#include "address.h" + +#define CANVAS0_WIDTH 15 +#define CANVAS0_HEIGHT 10 +#define CANVAS0_LEFT 10 +#define CANVAS0_TOP 10 + +#define CANVAS1_WIDTH 10 +#define CANVAS1_HEIGHT 10 +#define CANVAS1_LEFT 130 +#define CANVAS1_TOP 10 + +#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位) +#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位) +#define CHARACTER_OFFSET 1 + +///////////////////////////// + +void VBlankHandler( void ); + +///////////////////////////// + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ + + + +void TwlMain( void ) +{ + + OS_Init(); + OS_InitTick(); + OS_TPrintf("Initialize begin\n"); + + // ARM7側でメモリ内にセットされたSCFGのデータを確保 + MI_CpuMove16( DISPINFO_SHARED_SCFG_REG_ADDR, gArm7SCFGReg, DISPINFO_SHARED_SCFG_REG_SIZE ); + // WRAMに退避されてる分もコピー + MI_CpuMove16( DISPINFO_SHARED_SCFG_WRAM_ADDR, gArm7SCFGShared, DISPINFO_SHARED_SCFG_WRAM_SIZE ); + + //---- interrupt setting + OS_EnableIrq(); + OS_EnableInterrupts(); + + OS_InitSharedFont(); + GX_Init(); + + OS_SetIrqFunction( OS_IE_V_BLANK, VBlankHandler ); + OS_EnableIrqMask( OS_IE_V_BLANK ); + GX_VBlankIntr( TRUE ); + + OS_TPrintf("RTC Initilize...\n"); + RTC_Init(); + + OS_TPrintf("Allocator Initialize...\n"); + InitAllocator(); + CRYPTO_SetAllocator( Alloc, Free ); + +#if NAM_ENABLE + OS_TPrintf("NAM Initialize...\n"); + NAM_Init( Alloc, Free ); +#endif + + InitBG(); + OS_TPrintf("Initialize Finished\n"); + displayInfoInit(); + + OS_TPrintf("begin mainloop\n"); + + + // メインループ + while( 1 ) + { + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + + displayInfoMain(); // ビューア更新 + } + + OS_Terminate(); + +} + + +void VBlankHandler(void) +{ + OS_SetIrqCheckFlag( OS_IE_V_BLANK ); // Vブランク割込チェックのセット +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/misc.c b/build/tests/DisplaySystemInformation/ARM9/src/misc.c new file mode 100644 index 00000000..2e81ed3b --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/misc.c @@ -0,0 +1,759 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: misc.c + + Copyright 2007 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 "misc.h" + +// define data----------------------------------------------------------------- +#define NTR_IPL_FONT_DATA "data/NTR_IPL_font_m.NFTR" + +#define STRING_LENGTH_MAX 256 + +#define GRAY(x) GX_RGB(x, x, x) + +enum +{ + TXT_CPALETTE_MAIN, + TXT_CPALETTE_USERCOLOR, + TXT_CPALETTE_USERCOLORSAMPLE, + TXT_CPALETTE_4BPP, + TXT_NUM_CPALEETE +}; + +// デモ共通のカラーパレット +GXRgb TXTColorPalette[TXT_NUM_CPALEETE * 16] = +{ + GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), GX_RGB( 0, 0, 0), GX_RGB(31, 0, 0),// 基本文字色 + GX_RGB( 0, 31, 0), GX_RGB( 0, 0, 31), GX_RGB( 0, 31, 31), GX_RGB(31, 0, 31), + GX_RGB(31, 31, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), + GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), GX_RGB( 0, 0, 0), + + GX_RGB( 0, 0, 0), GX_RGB(12, 16, 19), GX_RGB(23, 9, 0), GX_RGB(31, 0, 3),// ユーザーカラー領域 + GX_RGB(31, 17, 31), GX_RGB(31, 18, 0), GX_RGB(30, 28, 0), GX_RGB(21, 31, 0), + GX_RGB( 0, 20, 7), GX_RGB( 9, 27, 17), GX_RGB( 6, 23, 30), GX_RGB( 0, 11, 30), + GX_RGB( 0, 0, 18), GX_RGB(17, 0, 26), GX_RGB(26, 0, 29), GX_RGB(31, 0, 18), + + GX_RGB(12, 16, 19), GX_RGB(23, 9, 0), GX_RGB(31, 0, 3), GX_RGB(31, 17, 31),// ユーザーカラーのサンプル領域 + GX_RGB(31, 18, 0), GX_RGB(30, 28, 0), GX_RGB(21, 31, 0), GX_RGB( 0, 31, 0), + GX_RGB( 0, 20, 7), GX_RGB( 9, 27, 17), GX_RGB( 6, 23, 30), GX_RGB( 0, 11, 30), + GX_RGB( 0, 0, 18), GX_RGB(17, 0, 26), GX_RGB(26, 0, 29), GX_RGB(31, 0, 18), + + GRAY(31), GRAY(29), GRAY(27), GRAY(25), + GRAY(23), GRAY(21), GRAY(19), GRAY(17), + GRAY(15), GRAY(14), GRAY(12), GRAY(10), + GRAY( 8), GRAY( 6), GRAY( 3), GRAY( 0), +}; + +// グラデパレットを作るためのマクロ +#define MAKECOLOR(r,g,b) GX_RGB( 0, 0, 0), GX_RGB(r, g, b), MC(r,g,b,1), MC(r,g,b,2),\ + MC(r,g,b,3), MC(r,g,b,4), MC(r,g,b,5), MC(r,g,b,6),\ + MC(r,g,b,7), MC(r,g,b,8), MC(r,g,b,9), MC(r,g,b,10),\ + MC(r,g,b,11), MC(r,g,b,12), MC(r,g,b,13), GX_RGB(31, 31, 31) + +#define MC(r,g,b,i) GX_RGB(r+((31-r)*i)/14, g+((31-g)*i)/14, b+((31-b)*i)/14) + +// ユーザーカラーパレット切り替え用 +GXRgb TempPalette[16 * 16] = +{ + MAKECOLOR(12, 16, 19), + MAKECOLOR(23, 9, 0), + MAKECOLOR(31, 0, 3), + MAKECOLOR(31, 17, 31), + MAKECOLOR(31, 18, 0), + MAKECOLOR(30, 28, 0), + MAKECOLOR(21, 31, 0), + MAKECOLOR( 0, 31, 0), + MAKECOLOR( 0, 20, 7), + MAKECOLOR( 9, 27, 17), + MAKECOLOR( 6, 23, 30), + MAKECOLOR( 0, 11, 30), + MAKECOLOR( 0, 0, 18), + MAKECOLOR(17, 0, 26), + MAKECOLOR(26, 0, 29), + MAKECOLOR(31, 0, 18), +}; + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- +#define CANVAS_WIDTH 32 // 文字描画域の幅 (キャラクタ単位) +#define CANVAS_HEIGHT 24 // 文字描画域の高さ (キャラクタ単位) +#define CANVAS_LEFT 0 // 文字描画域の位置X (キャラクタ単位) +#define CANVAS_TOP 0 // 文字描画域の位置Y (キャラクタ単位) + +#define TEXT_HSPACE 1 // 文字列描画時の文字間 (ピクセル単位) +#define TEXT_VSPACE 1 // 文字列描画時の行間 (ピクセル単位) + +#define CHARACTER_OFFSET 0 // 使用するキャラクタ列の開始番号 + +// RTCデータ表示位置ワーク +typedef struct RtcDrawPos{ + int date_x; + int date_y; + int time_x; + int time_y; +}RtcDrawPos; + +// function's prototype------------------------------------------------------- +static BOOL WaitDetachTP( void ); +static void StartDetachTP( void ); +static void InitScreen( void ); +static void InitCanvas( void ); + +// global variable------------------------------------------------------------- +KeyWork pad; // キーパッド入力データ +TpWork tpd; // タッチパネル入力データ +NNSFndAllocator g_allocator; // メモリアロケータ +NNSG2dFont gFont; // フォント +NNSG2dCharCanvas gCanvas; // CharCanvas +NNSG2dTextCanvas gTextCanvas; // TextCanvas +NNSG2dCharCanvas gCanvasSub; // CharCanvas +NNSG2dTextCanvas gTextCanvasSub; // TextCanvas + +// static variable------------------------------------------------------------- +static int s_detach_count; +static RtcDrawPos s_rtcPos; +static RTCDate s_rtcDate; +static RTCTime s_rtcTime; +static u16 s_vcount; + +static char s_strBuffer[ STRING_LENGTH_MAX * 2 ] ATTRIBUTE_ALIGN(2); +static u16 s_strBufferUTF16[ STRING_LENGTH_MAX ]; + +// const data------------------------------------------------------------------ + +// 曜日データ表示用文字コード +const u8 *const g_strWeek[] ATTRIBUTE_ALIGN(2) = { + (const u8 *)"SUN", + (const u8 *)"MON", + (const u8 *)"TUE", + (const u8 *)"WED", + (const u8 *)"THU", + (const u8 *)"FRI", + (const u8 *)"SAT", +}; + + +// ============================================================================ +// メモリ管理 +// ============================================================================ + +// アロケータの初期化 +void InitAllocator( void ) +{ + // ※暫定対策 FS_Init内でハッシュチェック用のヒープを確保しているため、 + // ユーザーヒープの確保前にFS_Initを行う必要がある。 + + // ファイルシステム初期化 + FS_Init( FS_DMA_NOT_USE ); + + { + NNSFndAllocator *pAllocator = &g_allocator; + u32 arenaLow = MATH_ROUNDUP ( (u32)OS_GetMainArenaLo(), 16 ); + u32 arenaHigh = MATH_ROUNDDOWN( (u32)OS_GetMainArenaHi(), 16 ); + u32 heapSize = arenaHigh - arenaLow; + void* heapMemory = OS_AllocFromMainArenaLo( heapSize, 16 ); + NNSFndHeapHandle heapHandle; + SDK_NULL_ASSERT( pAllocator ); + + heapHandle = NNS_FndCreateExpHeap( heapMemory, heapSize ); + SDK_ASSERT( heapHandle != NNS_FND_HEAP_INVALID_HANDLE ); + + NNS_FndInitAllocatorForExpHeap( pAllocator, heapHandle, 32 ); + } +} + + +// メモリ割り当て +void *Alloc( u32 size ) +{ + return NNS_FndAllocFromAllocator( &g_allocator, size ); +} + + +// メモリ解放 +void Free( void *pBuffer ) +{ + NNS_FndFreeToAllocator( &g_allocator, pBuffer ); +} + + +// ============================================================================ +// 画面設定 +// ============================================================================ + +// BG初期化 +void InitBG(void) +{ + // 画面OFF + GX_DispOff(); + GXS_DispOff(); + + // VRAMの割り当てを全て解除 + GX_DisableBankForBG(); + GX_DisableBankForOBJ(); + GX_DisableBankForSubBG(); + GX_DisableBankForSubOBJ(); + + // メイン2Dエンジンの出力を下画面に + GX_SetDispSelect( GX_DISP_SELECT_SUB_MAIN ); + + // メインLCD + { + // VRAM割り当て + GX_SetBankForBG ( GX_VRAM_BG_128_A ); + GX_SetBankForOBJ( GX_VRAM_OBJ_128_B ); + + MI_CpuClearFast( (void *)HW_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_OBJ_VRAM, 0x20000 ); // OBJ-VRAM クリア + MI_DmaFill32( 3, (void *)HW_OAM, 192, HW_OAM_SIZE ); // OAM クリア + + // カラーパレットを設定 + GX_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); + + // BGモード設定 + GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D ); + + GX_SetBGScrOffset ( GX_BGSCROFFSET_0x10000 ); + GX_SetBGCharOffset( GX_BGCHAROFFSET_0x00000 ); + } + // サブLCD + { + // VRAM割り当て + GX_SetBankForSubBG ( GX_VRAM_SUB_BG_128_C ); // VRAM-C for BGs + GX_SetBankForSubOBJ( GX_VRAM_SUB_OBJ_128_D ); // VRAM-D for BGs + + MI_CpuClearFast( (void *)HW_DB_BG_VRAM, 0x20000 ); // BG -VRAM クリア + MI_CpuClearFast( (void *)HW_DB_OBJ_VRAM, 0x20000 ); // OBJ -VRAM クリア + + // カラーパレットを設定 + GXS_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); + + // BGモード設定 + GXS_SetGraphicsMode( GX_BGMODE_0 ); // BGMODE is 0 + } + InitScreen(); + InitCanvas(); +} + + +// スクリーン初期化 +static void InitScreen( void ) +{ + // メイン画面 BG 0 を設定 + G2_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_256, // カラーモード 256色 + GX_BG_SCRBASE_0xf800, // スクリーンベース + GX_BG_CHARBASE_0x00000, // キャラクタベース + GX_BG_EXTPLTT_01 // 拡張パレットスロット + ); + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xe800, // screen base offset + 0x0000 is the address for BG #1 screen + GX_BG_CHARBASE_0x10000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + G2_SetBG2ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xd800, // screen base offset + 0x0000 is the address for BG #1 screen + GX_BG_CHARBASE_0x14000 // character base offset + 0x04000 is the address for BG #0 characters + ); + GX_SetVisiblePlane( GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1); + G2_SetBG2Priority(0); + G2_SetBG0Priority(1); + G2_SetBG1Priority(2); + + // サブ画面 BG 0 を設定 + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, // 256pix x 256pix text + GX_BG_COLORMODE_16, // use 16 colors mode + GX_BG_SCRBASE_0xf800, // screen base offset + 0x0000 is the address for BG #0 screen + GX_BG_CHARBASE_0x00000, // character base offset + 0x04000 is the address for BG #0 characters + GX_BG_EXTPLTT_01 // use BGExtPltt slot #0 if BGExtPltt is enabled + ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); // display only BG #0 +} + + +// 文字列描画の初期化 +static void InitCanvas( void ) +{ + CMN_InitFileSystem( &g_allocator ); + + // フォントを読み込みます + { + void* pFontFile; + u32 size = CMN_LoadFile( &pFontFile, NTR_IPL_FONT_DATA, &g_allocator); + NNS_G2D_ASSERT( size > 0 ); + NNS_G2dFontInitUTF16(&gFont, pFontFile); +// NNS_G2dPrintFont(&gFont); + } + + { + // CharCanvas の初期化 + NNS_G2dCharCanvasInitForBG( + &gCanvas, + (GXCharFmt256*)G2_GetBG0CharPtr() + CHARACTER_OFFSET, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_256 + ); + + // TextCanvasの初期化 + NNS_G2dTextCanvasInit( + &gTextCanvas, + &gCanvas, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + + // スクリーンを設定 + NNS_G2dMapScrToCharText( + G2_GetBG0ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + TXT_CPALETTE_MAIN + ); + } + { + // CharCanvas の初期化 + NNS_G2dCharCanvasInitForBG( + &gCanvasSub, + (GXCharFmt16*)G2S_GetBG0CharPtr() + CHARACTER_OFFSET, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_16 + ); + + // TextCanvasの初期化 + NNS_G2dTextCanvasInit( + &gTextCanvasSub, + &gCanvasSub, + &gFont, + TEXT_HSPACE, + TEXT_VSPACE + ); + + // スクリーンを設定 + NNS_G2dMapScrToCharText( + G2S_GetBG0ScrPtr(), + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CHARACTER_OFFSET, + TXT_CPALETTE_MAIN + ); + } +} + + +// UTF16での直接文字表示 +void PutStringUTF16( int x, int y, int color, const u16 *strUTF16 ) +{ + NNS_G2dTextCanvasDrawText( &gTextCanvas, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + strUTF16 ); +} + +void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ) +{ + NNS_G2dTextCanvasDrawText( &gTextCanvasSub, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + strUTF16 ); +} + + +// 書式付きで作成した文字列を表示した場合の幅を取得する +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + return NNS_G2dTextCanvasGetTextWidth( pCanvas, s_strBufferUTF16 ); +} + + +// SJISでPrintf形式で文字表示(内部でUTF16に変換) +void PrintfSJIS( int x, int y, int color, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + NNS_G2dTextCanvasDrawText(&gTextCanvas, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + s_strBufferUTF16 ); +} + +void PrintfSJISSub( int x, int y, int color, const char *fmt, ... ) +{ + int srcLen; + int dstLen = sizeof(s_strBufferUTF16); + va_list vlist; + va_start(vlist, fmt); + srcLen = STD_TVSNPrintf( s_strBuffer, sizeof(s_strBuffer), fmt, vlist); + va_end(vlist); + s_strBuffer[ srcLen ] = 0; + + (void)STD_ConvertStringSjisToUnicode( s_strBufferUTF16, &dstLen, s_strBuffer, &srcLen, NULL ); + s_strBufferUTF16[ dstLen ] = 0; + + NNS_G2dTextCanvasDrawText(&gTextCanvasSub, x, y, color, TXT_DRAWTEXT_FLAG_DEFAULT, + s_strBufferUTF16 ); +} + + +// キー入力読み出し-------------------------------- +void ReadKeyPad(void) +{ + u16 readData = PAD_Read(); + pad.trg = (u16)(readData & (readData ^ pad.cont)); // トリガ 入力 + pad.cont = readData; // ベタ 入力 +} + + +// タッチパネルデータの取得----------------------- +void ReadTP(void) +{ + TP_GetCalibratedPoint( &tpd.last, &tpd.raw ); // 前回のTPデータを退避 + + if( TP_RequestRawSampling(&tpd.raw) ) { // タッチパネルのサンプリング + SVC_CpuClear(0x0000, &tpd.raw, sizeof(tpd.raw), 16); // SPI-busyでデータ取得に失敗した時は”データなし”でリターン。 + return; + } + TP_GetCalibratedPoint( &tpd.disp, &tpd.raw ); // TP座標からLCD座標に変換。 + + if( !WaitDetachTP() ) { // TPデタッチ待ちを行う。 + SVC_CpuClear(0x0000, &tpd.disp, sizeof(tpd.disp), 16); // SPI-busyでデータ取得に失敗した時は”データなし”でリターン。 + return; + } +#if 0 + if(tpd.disp.touch) { // 現在のTPデータを表示 + switch ( tpd.disp.validity ) { + case TP_VALIDITY_VALID: + OS_Printf("( %3d, %3d ) -> ( %3d, %3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_X: + OS_Printf("( *%3d, %3d ) -> ( *%3d, %3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_Y: + OS_Printf("( %3d, *%3d ) -> ( %3d, *%3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + case TP_VALIDITY_INVALID_XY: + OS_Printf("( *%3d, *%3d ) -> ( *%3d, *%3d )\n", tpd.raw.x, tpd.raw.y, tpd.disp.x, tpd.disp.y); + break; + } + } +#endif +} + + +// TPデタッチを待つ +static BOOL WaitDetachTP( void ) +{ + // s_detach_countが始動していたら、カウント判定。 + if(s_detach_count > 0) { + if(tpd.disp.touch == 0) { // TPが押されていなければ、カウント進行し規定値で再入力を受け付ける。 + s_detach_count--; + }else { + s_detach_count = TP_CSR_DETACH_COUNT; + } + return FALSE; + } + return TRUE; +} + + +// TPデタッチ待ちの開始 +static void StartDetachTP( void ) +{ + s_detach_count = TP_CSR_DETACH_COUNT; +} + + +//====================================================== +// メニュー制御 +//====================================================== + +// メニュー描画 +void DrawMenu( u16 nowCsr, const MenuParam *pMenu ) +{ + int i; + int color; + + for( i = 0; i < pMenu->num; i++ ) { + if(i == nowCsr) { + if( !pMenu->pos[ i ].enable ) { + color = pMenu->disable_color; + }else { + color = pMenu->select_color; + } + }else { + color = pMenu->normal_color; + } + PutStringUTF16( pMenu->pos[ i ].x, pMenu->pos[ i ].y, color, (pMenu->str_elem)[ i ] ); + } +} + +// タッチパネルによる選択を行う関数・汎用版。 +// 主にチャタリングを吸収する程度の機能を持つ。 +// SelectSomethingFunc型の関数ポインタfuncには、次に示す条件を満たす関数を作り、リストにしてセットして使う。 +// 1.要素上でタッチしていればTRUEを返し、そうでなければFALSEを返す。 +// 2.第一引数に与えたポインタの指す変数にカーソル位置を入れて返す。 +BOOL SelectSomethingByTP( u16 *nowCsr, SelectSomethingFunc func[], int funcnum ) +{ + int i; + static u16 detach_count = 0; + static u16 csr_old = 0xffff; + static u16 same_csr_count = 0; + + // detach_countが始動していたら、カウント判定。 + if( detach_count > 0 ) { + if( tpd.disp.touch == 0 ) { // TPが押されていなければ、カウント進行し、TP_CSR_DETACH_COUNTカウントでメニュー選択 + if( ++detach_count == TP_CSR_DETACH_COUNT ) { + detach_count = 0; + same_csr_count = 0; + *nowCsr = csr_old; + return TRUE; + }else { + return FALSE; + } + } + } + detach_count=0; // detachカウント値のクリア + + for( i = 0; i < funcnum; i++ ) { + if( tpd.disp.touch ) { // タッチパネルがタッチされているなら、 + u16 csr; + if( func[i]( &csr, &tpd.disp ) ) { // funcは要素上にタッチされていればTRUEを返し、カーソル位置も返してくれる関数 + if( tpd.disp.validity == TP_VALIDITY_VALID ) { // カーソルをその要素に移動 + if( csr_old == csr ) { + if( same_csr_count < TP_CSR_TOUCH_COUNT ) { + same_csr_count++; + } + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + *nowCsr = csr; + } + return FALSE; + }else { + csr_old = csr; + } + break; + } + }else { + } + }else { // touch==0 + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + detach_count = 1; + break; + } + } + } + same_csr_count = 0; + return FALSE; +} + +// タッチパネルによるメニュー選択 +BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ) +{ + u16 i; + static u16 detach_count = 0; + static u16 csr_old = 0xff; + static u16 same_csr_count = 0; + + // detach_countが始動していたら、カウント判定。 + if( detach_count > 0 ) { + if( tpd.disp.touch == 0 ) { // TPが押されていなければ、カウント進行し、10カウントでメニュー選択 + if( ++detach_count == TP_CSR_DETACH_COUNT ) { + detach_count = 0; + return TRUE; + }else { + return FALSE; + } + } + } + detach_count=0; // detachカウント値のクリア + + for( i = 0; i < pMenu->num; i++ ) { + if( tpd.disp.touch ) { // タッチパネルがメニューの要素上でタッチされているなら、 + NNSG2dTextRect rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, (pMenu->str_elem)[ i ] ); + u16 top_x = (u16)( pMenu->pos[ i ].x ); // メニュー要素のLCD座標を算出 + u16 top_y = (u16)( pMenu->pos[ i ].y ); + u16 bottom_x = (u16)( top_x + rect.width ); + u16 bottom_y = (u16)( top_y + rect.height ); + + + if( WithinRangeTP( top_x, top_y, bottom_x, bottom_y, &tpd.disp ) ) { + if( tpd.disp.validity == TP_VALIDITY_VALID ) { // カーソルをその要素に移動 + if( csr_old == i ) { + if( same_csr_count < TP_CSR_TOUCH_COUNT ) { + same_csr_count++; + } + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + *nowCsr = i; + } + return FALSE; + }else { + csr_old = i; + } + break; + } + }else { + } + }else { // touch==0 + if( same_csr_count == TP_CSR_TOUCH_COUNT ) { + detach_count = 1; + break; + } + } + } + same_csr_count = 0; + return FALSE; +} + + +// 現在のタッチパネル座標が指定領域内にあるかどうかを返す。 +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ) +{ + if( ( tgt->x >= top_x ) && + ( tgt->x <= bottom_x ) && + ( tgt->y >= top_y ) && + ( tgt->y <= bottom_y ) ) { + return TRUE; + }else { + return FALSE; + } +} + + +// バナーアイコンOBJのロード +void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ) +{ + GXS_LoadOBJPltt( bannerp->pltt, 15, BANNER_PLTT_SIZE ); + MI_CpuCopyFast( bannerp->image, (void *)(HW_DB_OBJ_VRAM + 0x20), BANNER_IMAGE_SIZE ); + G2_SetOBJAttr( pDstOAM, // OAM pointer + 32, // X position + 32, // Y position + 0, // Priority + GX_OAM_MODE_NORMAL, // Bitmap mode + FALSE, // mosaic off + GX_OAM_EFFECT_NONE, // affine off + GX_OAM_SHAPE_32x32, // 16x16 size + GX_OAM_COLOR_16, // 16 color + 1, // charactor + 15, // palette + 0); // affine +} + + +//=============================================== +// RTCアクセスルーチン +//=============================================== + +// RTCデータの取得 +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( forceGetFlag || ( pRTCDraw->vcount++ == 59 ) ) { + pRTCDraw->vcount = 0; + MI_CpuCopy16( &pRTCDraw->date, &pRTCDraw->date_old, sizeof(RTCDate) ); + MI_CpuCopy16( &pRTCDraw->time, &pRTCDraw->time_old, sizeof(RTCTime) ); + (void)RTC_GetDateTime( &pRTCDraw->date, &pRTCDraw->time ); + return TRUE; + } + return FALSE; +} + + +// RTCデータの表示 +void DrawRTCData( RTCDrawProperty *pRTCDraw ) +{ + void (*pPrintFunc)( int x, int y, int color, const char *fmt, ... ) = + ( pRTCDraw->isTopLCD ) ? PrintfSJISSub : PrintfSJIS; + + // 前RTC情報の消去 + { + u32 year = pRTCDraw->date_old.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_WHITE, "%04d/%02d/%02d[%3s]", + year, + pRTCDraw->date_old.month, + pRTCDraw->date_old.day, + g_strWeek[ pRTCDraw->date_old.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_WHITE, "%02d:%02d:%02d", + pRTCDraw->time_old.hour, + pRTCDraw->time_old.minute, + pRTCDraw->time_old.second + ); + } + // RTC情報の表示 + { + u32 year = pRTCDraw->date.year + 2000; + pPrintFunc( pRTCDraw->date_x, pRTCDraw->date_y, TXT_COLOR_BLACK, "%d/%02d/%02d[%3s]", + year, + pRTCDraw->date.month, + pRTCDraw->date.day, + g_strWeek[ pRTCDraw->date.week ] + ); + pPrintFunc( pRTCDraw->time_x, pRTCDraw->time_y, TXT_COLOR_BLACK, "%02d:%02d:%02d", + pRTCDraw->time.hour, + pRTCDraw->time.minute, + pRTCDraw->time.second + ); + } +} + +// RTCデータの取得&表示 +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ) +{ + if( GetRTCData( pRTCDraw, forceGetFlag ) ) { + DrawRTCData( pRTCDraw ); + } +} + +// ユーザーカラー領域の切り替え +void ChangeUserColor( u8 col ) +{ + int l; + if(col > 15) return; + for(l=0;l<16;l++) + { + TXTColorPalette[16+l] = TempPalette[16 * col + l]; + } + GX_LoadBGPltt( TXTColorPalette, 0, sizeof(TXTColorPalette) ); +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/misc.h b/build/tests/DisplaySystemInformation/ARM9/src/misc.h new file mode 100644 index 00000000..ba7cd3bc --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/misc.h @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: misc.h + + Copyright 2007 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 __MISC_H__ +#define __MISC_H__ + +#include +#include + +#define NNS_G2D_UNICODE +#include +#include +#include +#include + +#include "cmn.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// define data---------------------------------------------------------- +#define TP_CSR_TOUCH_COUNT 2 // TPカーソルのチャタリング吸収のためのカウント値 +#define TP_CSR_DETACH_COUNT 2 // TPカーソルを「選択」と判定するTPデタッチからのカウント値 + +// DrawText での左上寄せ +#define TXT_DRAWTEXT_FLAG_DEFAULT (NNS_G2D_VERTICALORIGIN_TOP | NNS_G2D_HORIZONTALORIGIN_LEFT | NNS_G2D_HORIZONTALALIGN_LEFT) + +// TXTColorPalette の色名 256色パレットへのロードを想定 +enum +{ + // パレット0 TXT_CPALETTE_MAIN + TXT_COLOR_NULL=0, + TXT_COLOR_WHITE, + TXT_COLOR_BLACK, + TXT_COLOR_RED, + TXT_COLOR_GREEN, + TXT_COLOR_BLUE, + TXT_COLOR_CYAN, + TXT_COLOR_MAGENTA, + TXT_COLOR_YELLOW, + + // ユーザーカラーグラデーションパレット領域 + TXT_UCOLOR_GNULL=16, + TXT_UCOLOR_G0, + TXT_UCOLOR_G1, + TXT_UCOLOR_G2, + TXT_UCOLOR_G3, + TXT_UCOLOR_G4, + TXT_UCOLOR_G5, + TXT_UCOLOR_G6, + TXT_UCOLOR_G7, + TXT_UCOLOR_G8, + TXT_UCOLOR_G9, + TXT_UCOLOR_G10, + TXT_UCOLOR_G11, + TXT_UCOLOR_G12, + TXT_UCOLOR_G13, + TXT_UCOLOR_GWHITE, + + // ユーザーカラーサンプル領域 + TXT_UCOLOR_GRAY=32, + TXT_UCOLOR_BROWN, + TXT_UCOLOR_RED, + TXT_UCOLOR_PINK, + TXT_UCOLOR_ORANGE, + TXT_UCOLOR_YELLOW, + TXT_UCOLOR_LIMEGREEN, + TXT_UCOLOR_GREEN, + TXT_UCOLOR_DARKGREEN, + TXT_UCOLOR_SEAGREEN, + TXT_UCOLOR_TURQUOISE, + TXT_UCOLOR_BLUE, + TXT_UCOLOR_DARKBLUE, + TXT_UCOLOR_PURPLE, + TXT_UCOLOR_VIOLET, + TXT_UCOLOR_MAGENTA, + + // パレット TXT_CPALETTE_4BPP + TXT_COLOR_4BPP_NULL=48, + TXT_COLOR_4BPP_BG=49, + TXT_COLOR_4BPP_TEXT=49 +}; + +// 時計表示場所 +#define RTC_DATE_TOP_X ( 9 * 8 ) +#define RTC_DATE_TOP_Y ( 10 * 8 ) +#define RTC_TIME_TOP_X ( 12 * 8 ) +#define RTC_TIME_TOP_Y ( 12 * 8 ) + + +// キーデータワーク +typedef struct { + u16 trg; // トリガ入力 + u16 cont; // ベタ 入力 +}KeyWork; + + +// タッチパネルワーク +typedef struct { + int detached; // 今回のデータ入力でタッチが離れたことを示す。 + TPData disp; // 今回の入力値(LCD座標) + TPData raw; // 今回の入力値(TP 座標) + TPData last; // 前回の入力値(LCD座標) +}TpWork; + + +// メニュー要素座標 +typedef struct MenuPos { + BOOL enable; + int x; + int y; +}MenuPos; + + +// メニュー構成パラメータ構造体 +typedef struct MenuParam { + int num; + int normal_color; + int select_color; + int disable_color; + MenuPos *pos; + const u16 **str_elem; +}MenuParam; + + +// RTCデータ表示位置ワーク +typedef struct RTCDrawProperty { + BOOL isTopLCD; + int date_x; + int date_y; + int time_x; + int time_y; + int vcount; + RTCDate date; + RTCTime time; + RTCDate date_old; + RTCTime time_old; +}RTCDrawProperty; + +typedef BOOL (*SelectSomethingFunc)( u16 *csr, TPData *tgt ); + +// global variables-------------------------------------------------- +extern TpWork tpd; // タッチパネルデータ +extern KeyWork pad; // キーパッド入力データ +extern const u8 *const g_strWeek[ 7 ]; // 曜日文字列 +extern RTCDrawProperty g_rtcDraw; + +extern NNSFndAllocator g_allocator; // メモリアロケータ +extern NNSG2dFont gFont; // フォント +extern NNSG2dCharCanvas gCanvas; // CharCanvas +extern NNSG2dTextCanvas gTextCanvas; // TextCanvas +extern NNSG2dCharCanvas gCanvasSub; // CharCanvas +extern NNSG2dTextCanvas gTextCanvasSub; // TextCanvas + +// function------------------------------------------------------------- +void InitAllocator( void ); +void *Alloc( u32 size ); +void Free( void *pBuffer ); +void InitBG( void ); +int GetPrintfWidth( const NNSG2dTextCanvas *pCanvas, const char *fmt, ... ); +void PutStringUTF16 ( int x, int y, int color, const u16 *strUTF16 ); +void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 ); +void PrintfSJIS ( int x, int y, int color, const char *fmt, ... ); +void PrintfSJISSub( int x, int y, int color, const char *fmt, ... ); +void ReadKeyPad( void ); +void ReadTP( void ); +void DrawMenu( u16 nowCsr, const MenuParam *pMenu ); +BOOL SelectSomethingByTP( u16 *nowCsr, SelectSomethingFunc func[], int funcnum ); +BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu ); +BOOL WithinRangeTP( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt ); +void SetBannerIconOBJ( GXOamAttr *pDstOAM, BannerFileV1 *bannerp ); +BOOL GetRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); +void DrawRTCData( RTCDrawProperty *pRTCDraw ); +void GetAndDrawRTCData( RTCDrawProperty *pRTCDraw, BOOL forceGetFlag ); +void ChangeUserColor( u8 col ); + +#ifdef __cplusplus +} +#endif + +#endif // __MISC_H__ diff --git a/build/tests/DisplaySystemInformation/ARM9/src/myIoreg_SCFG.h b/build/tests/DisplaySystemInformation/ARM9/src/myIoreg_SCFG.h new file mode 100644 index 00000000..8961cca5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/myIoreg_SCFG.h @@ -0,0 +1,533 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: myIoreg_SCFG.h + + Copyright 2007 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. + + *---------------------------------------------------------------------------*/ + +// ARM9側で受け取ったARM7のSCFGを参照するために +// ARM9側なのにARM7依存のオフセット情報が必要... + + +// マクロ再定義を防ぐための苦肉の策 + +#ifndef __MY_IOREG_SCFG_H__ +#define __MY_IOREG_SCFG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definition of Register offsets, addresses and variables. + */ + + +/* ROM */ + +#define DISP_REG_ROM_OFFSET 0x4000 +#define DISP_REG_ROM_ADDR (HW_REG_BASE + DISP_REG_ROM_OFFSET) + +/* A9ROM */ + +#define DISP_REG_A9ROM_OFFSET 0x4000 +#define DISP_REG_A9ROM_ADDR (HW_REG_BASE + DISP_REG_A9ROM_OFFSET) + +/* A7ROM */ + +#define DISP_REG_A7ROM_OFFSET 0x4001 +#define DISP_REG_A7ROM_ADDR (HW_REG_BASE + DISP_REG_A7ROM_OFFSET) + +/* ROMWE */ + +#define DISP_REG_ROMWE_OFFSET 0x4002 +#define DISP_REG_ROMWE_ADDR (HW_REG_BASE + DISP_REG_ROMWE_OFFSET) + +/* CLK */ + +#define DISP_REG_CLK_OFFSET 0x4004 +#define DISP_REG_CLK_ADDR (HW_REG_BASE + DISP_REG_CLK_OFFSET) + +/* JTAG */ + +#define DISP_REG_JTAG_OFFSET 0x4006 +#define DISP_REG_JTAG_ADDR (HW_REG_BASE + DISP_REG_JTAG_OFFSET) + +/* EXT */ + +#define DISP_REG_EXT_OFFSET 0x4008 +#define DISP_REG_EXT_ADDR (HW_REG_BASE + DISP_REG_EXT_OFFSET) + +/* MC */ + +#define DISP_REG_MC_OFFSET 0x4010 +#define DISP_REG_MC_ADDR (HW_REG_BASE + DISP_REG_MC_OFFSET) + +/* MCCHAT */ + +#define DISP_REG_MCCHAT_OFFSET 0x4012 +#define DISP_REG_MCCHAT_ADDR (HW_REG_BASE + DISP_REG_MCCHAT_OFFSET) + +/* MC2 */ + +#define DISP_REG_MC2_OFFSET 0x4014 +#define DISP_REG_MC2_ADDR (HW_REG_BASE + DISP_REG_MC2_OFFSET) + + +/* WL */ + +#define DISP_REG_WL_OFFSET 0x4020 +#define DISP_REG_WL_ADDR (HW_REG_BASE + DISP_REG_WL_OFFSET) + +/* OP */ + +#define DISP_REG_OP_OFFSET 0x4024 +#define DISP_REG_OP_ADDR (HW_REG_BASE + DISP_REG_OP_OFFSET) + + +/* + * Definitions of Register fields + */ + + +/* ROM */ + +#define DISP_REG_SCFG_ROM_ROMWE_SHIFT 16 +#define DISP_REG_SCFG_ROM_ROMWE_SIZE 1 +#define DISP_REG_SCFG_ROM_ROMWE_MASK 0x00010000 + +#define DISP_REG_SCFG_ROM_ARM7FUSE_SHIFT 10 +#define DISP_REG_SCFG_ROM_ARM7FUSE_SIZE 1 +#define DISP_REG_SCFG_ROM_ARM7FUSE_MASK 0x00000400 + +#define DISP_REG_SCFG_ROM_ARM7RSEL_SHIFT 9 +#define DISP_REG_SCFG_ROM_ARM7RSEL_SIZE 1 +#define DISP_REG_SCFG_ROM_ARM7RSEL_MASK 0x00000200 + +#define DISP_REG_SCFG_ROM_ARM7SEL_SHIFT 8 +#define DISP_REG_SCFG_ROM_ARM7SEL_SIZE 1 +#define DISP_REG_SCFG_ROM_ARM7SEL_MASK 0x00000100 + +#define DISP_REG_SCFG_ROM_ARM9RSEL_SHIFT 1 +#define DISP_REG_SCFG_ROM_ARM9RSEL_SIZE 1 +#define DISP_REG_SCFG_ROM_ARM9RSEL_MASK 0x00000002 + +#define DISP_REG_SCFG_ROM_ARM9SEL_SHIFT 0 +#define DISP_REG_SCFG_ROM_ARM9SEL_SIZE 1 +#define DISP_REG_SCFG_ROM_ARM9SEL_MASK 0x00000001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_ROM_FIELD( romwe, arm7fuse, arm7rsel, arm7sel, arm9rsel, arm9sel ) \ + (u32)( \ + ((u32)(romwe) << DISP_REG_SCFG_ROM_ROMWE_SHIFT) | \ + ((u32)(arm7fuse) << DISP_REG_SCFG_ROM_ARM7FUSE_SHIFT) | \ + ((u32)(arm7rsel) << DISP_REG_SCFG_ROM_ARM7RSEL_SHIFT) | \ + ((u32)(arm7sel) << DISP_REG_SCFG_ROM_ARM7SEL_SHIFT) | \ + ((u32)(arm9rsel) << DISP_REG_SCFG_ROM_ARM9RSEL_SHIFT) | \ + ((u32)(arm9sel) << DISP_REG_SCFG_ROM_ARM9SEL_SHIFT)) +#endif + + +/* A9ROM */ + +#define DISP_REG_SCFG_A9ROM_RSEL_SHIFT 1 +#define DISP_REG_SCFG_A9ROM_RSEL_SIZE 1 +#define DISP_REG_SCFG_A9ROM_RSEL_MASK 0x02 + +#define DISP_REG_SCFG_A9ROM_SEC_SHIFT 0 +#define DISP_REG_SCFG_A9ROM_SEC_SIZE 1 +#define DISP_REG_SCFG_A9ROM_SEC_MASK 0x01 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_A9ROM_FIELD( rsel, sec ) \ + (u8)( \ + ((u32)(rsel) << DISP_REG_SCFG_A9ROM_RSEL_SHIFT) | \ + ((u32)(sec) << DISP_REG_SCFG_A9ROM_SEC_SHIFT)) +#endif + + +/* A7ROM */ + +#define DISP_REG_SCFG_A7ROM_FUSE_SHIFT 2 +#define DISP_REG_SCFG_A7ROM_FUSE_SIZE 1 +#define DISP_REG_SCFG_A7ROM_FUSE_MASK 0x04 + +#define DISP_REG_SCFG_A7ROM_RSEL_SHIFT 1 +#define DISP_REG_SCFG_A7ROM_RSEL_SIZE 1 +#define DISP_REG_SCFG_A7ROM_RSEL_MASK 0x02 + +#define DISP_REG_SCFG_A7ROM_SEC_SHIFT 0 +#define DISP_REG_SCFG_A7ROM_SEC_SIZE 1 +#define DISP_REG_SCFG_A7ROM_SEC_MASK 0x01 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_A7ROM_FIELD( fuse, rsel, sec ) \ + (u8)( \ + ((u32)(fuse) << DISP_REG_SCFG_A7ROM_FUSE_SHIFT) | \ + ((u32)(rsel) << DISP_REG_SCFG_A7ROM_RSEL_SHIFT) | \ + ((u32)(sec) << DISP_REG_SCFG_A7ROM_SEC_SHIFT)) +#endif + + +/* ROMWE */ + +#define DISP_REG_SCFG_ROMWE_WE_SHIFT 0 +#define DISP_REG_SCFG_ROMWE_WE_SIZE 1 +#define DISP_REG_SCFG_ROMWE_WE_MASK 0x0001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_ROMWE_FIELD( we ) \ + (u16)( \ + ((u32)(we) << DISP_REG_SCFG_ROMWE_WE_SHIFT)) +#endif + + +/* CLK */ + +#define DISP_REG_SCFG_CLK_SNDMCLK_SHIFT 8 +#define DISP_REG_SCFG_CLK_SNDMCLK_SIZE 1 +#define DISP_REG_SCFG_CLK_SNDMCLK_MASK 0x0100 + +#define DISP_REG_SCFG_CLK_WRAMHCLK_SHIFT 7 +#define DISP_REG_SCFG_CLK_WRAMHCLK_SIZE 1 +#define DISP_REG_SCFG_CLK_WRAMHCLK_MASK 0x0080 + +#define DISP_REG_SCFG_CLK_AESHCLK_SHIFT 2 +#define DISP_REG_SCFG_CLK_AESHCLK_SIZE 1 +#define DISP_REG_SCFG_CLK_AESHCLK_MASK 0x0004 + +#define DISP_REG_SCFG_CLK_SD2HCLK_SHIFT 1 +#define DISP_REG_SCFG_CLK_SD2HCLK_SIZE 1 +#define DISP_REG_SCFG_CLK_SD2HCLK_MASK 0x0002 + +#define DISP_REG_SCFG_CLK_SD1HCLK_SHIFT 0 +#define DISP_REG_SCFG_CLK_SD1HCLK_SIZE 1 +#define DISP_REG_SCFG_CLK_SD1HCLK_MASK 0x0001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_CLK_FIELD( sndmclk, wramhclk, aeshclk, sd2hclk, sd1hclk ) \ + (u16)( \ + ((u32)(sndmclk) << DISP_REG_SCFG_CLK_SNDMCLK_SHIFT) | \ + ((u32)(wramhclk) << DISP_REG_SCFG_CLK_WRAMHCLK_SHIFT) | \ + ((u32)(aeshclk) << DISP_REG_SCFG_CLK_AESHCLK_SHIFT) | \ + ((u32)(sd2hclk) << DISP_REG_SCFG_CLK_SD2HCLK_SHIFT) | \ + ((u32)(sd1hclk) << DISP_REG_SCFG_CLK_SD1HCLK_SHIFT)) +#endif + + +/* JTAG */ + +#define DISP_REG_SCFG_JTAG_DSPJE_SHIFT 8 +#define DISP_REG_SCFG_JTAG_DSPJE_SIZE 1 +#define DISP_REG_SCFG_JTAG_DSPJE_MASK 0x0100 + +#define DISP_REG_SCFG_JTAG_CPUJE_SHIFT 1 +#define DISP_REG_SCFG_JTAG_CPUJE_SIZE 1 +#define DISP_REG_SCFG_JTAG_CPUJE_MASK 0x0002 + +#define DISP_REG_SCFG_JTAG_ARM7SEL_SHIFT 0 +#define DISP_REG_SCFG_JTAG_ARM7SEL_SIZE 1 +#define DISP_REG_SCFG_JTAG_ARM7SEL_MASK 0x0001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_JTAG_FIELD( dspje, cpuje, arm7sel ) \ + (u16)( \ + ((u32)(dspje) << DISP_REG_SCFG_JTAG_DSPJE_SHIFT) | \ + ((u32)(cpuje) << DISP_REG_SCFG_JTAG_CPUJE_SHIFT) | \ + ((u32)(arm7sel) << DISP_REG_SCFG_JTAG_ARM7SEL_SHIFT)) +#endif + + +/* EXT */ + +#define DISP_REG_SCFG_EXT_CFG_SHIFT 31 +#define DISP_REG_SCFG_EXT_CFG_SIZE 1 +#define DISP_REG_SCFG_EXT_CFG_MASK 0x80000000 + +#define DISP_REG_SCFG_EXT_PUENABLE_SHIFT 28 +#define DISP_REG_SCFG_EXT_PUENABLE_SIZE 1 +#define DISP_REG_SCFG_EXT_PUENABLE_MASK 0x10000000 + +#define DISP_REG_SCFG_EXT_SD20_SHIFT 28 +#define DISP_REG_SCFG_EXT_SD20_SIZE 1 +#define DISP_REG_SCFG_EXT_SD20_MASK 0x10000000 + +#define DISP_REG_SCFG_EXT_NEWB_ACCESS_E_SHIFT 16 +#define DISP_REG_SCFG_EXT_NEWB_ACCESS_E_SIZE 10 +#define DISP_REG_SCFG_EXT_NEWB_ACCESS_E_MASK 0x03ff0000 + +#define DISP_REG_SCFG_EXT_WRAM_SHIFT 25 +#define DISP_REG_SCFG_EXT_WRAM_SIZE 1 +#define DISP_REG_SCFG_EXT_WRAM_MASK 0x02000000 + +#define DISP_REG_SCFG_EXT_MC_B_SHIFT 24 +#define DISP_REG_SCFG_EXT_MC_B_SIZE 1 +#define DISP_REG_SCFG_EXT_MC_B_MASK 0x01000000 + +#define DISP_REG_SCFG_EXT_GPIO_SHIFT 23 +#define DISP_REG_SCFG_EXT_GPIO_SIZE 1 +#define DISP_REG_SCFG_EXT_GPIO_MASK 0x00800000 + +#define DISP_REG_SCFG_EXT_I2C_SHIFT 22 +#define DISP_REG_SCFG_EXT_I2C_SIZE 1 +#define DISP_REG_SCFG_EXT_I2C_MASK 0x00400000 + +#define DISP_REG_SCFG_EXT_I2S_SHIFT 21 +#define DISP_REG_SCFG_EXT_I2S_SIZE 1 +#define DISP_REG_SCFG_EXT_I2S_MASK 0x00200000 + +#define DISP_REG_SCFG_EXT_MIC_SHIFT 20 +#define DISP_REG_SCFG_EXT_MIC_SIZE 1 +#define DISP_REG_SCFG_EXT_MIC_MASK 0x00100000 + +#define DISP_REG_SCFG_EXT_SD2_SHIFT 19 +#define DISP_REG_SCFG_EXT_SD2_SIZE 1 +#define DISP_REG_SCFG_EXT_SD2_MASK 0x00080000 + +#define DISP_REG_SCFG_EXT_SD1_SHIFT 18 +#define DISP_REG_SCFG_EXT_SD1_SIZE 1 +#define DISP_REG_SCFG_EXT_SD1_MASK 0x00040000 + +#define DISP_REG_SCFG_EXT_AES_SHIFT 17 +#define DISP_REG_SCFG_EXT_AES_SIZE 1 +#define DISP_REG_SCFG_EXT_AES_MASK 0x00020000 + +#define DISP_REG_SCFG_EXT_DMAC_SHIFT 16 +#define DISP_REG_SCFG_EXT_DMAC_SIZE 1 +#define DISP_REG_SCFG_EXT_DMAC_MASK 0x00010000 + +#define DISP_REG_SCFG_EXT_NITROB_EX_E_SHIFT 8 +#define DISP_REG_SCFG_EXT_NITROB_EX_E_SIZE 8 +#define DISP_REG_SCFG_EXT_NITROB_EX_E_MASK 0x0000ff00 + +#define DISP_REG_SCFG_EXT_PSRAM_SHIFT 14 +#define DISP_REG_SCFG_EXT_PSRAM_SIZE 2 +#define DISP_REG_SCFG_EXT_PSRAM_MASK 0x0000c000 + +#define DISP_REG_SCFG_EXT_VRAM_SHIFT 13 +#define DISP_REG_SCFG_EXT_VRAM_SIZE 1 +#define DISP_REG_SCFG_EXT_VRAM_MASK 0x00002000 + +#define DISP_REG_SCFG_EXT_LCDC_SHIFT 12 +#define DISP_REG_SCFG_EXT_LCDC_SIZE 1 +#define DISP_REG_SCFG_EXT_LCDC_MASK 0x00001000 + +#define DISP_REG_SCFG_EXT_SIO_SHIFT 11 +#define DISP_REG_SCFG_EXT_SIO_SIZE 1 +#define DISP_REG_SCFG_EXT_SIO_MASK 0x00000800 + +#define DISP_REG_SCFG_EXT_DSEL_SHIFT 10 +#define DISP_REG_SCFG_EXT_DSEL_SIZE 1 +#define DISP_REG_SCFG_EXT_DSEL_MASK 0x00000400 + +#define DISP_REG_SCFG_EXT_SPI_SHIFT 9 +#define DISP_REG_SCFG_EXT_SPI_SIZE 1 +#define DISP_REG_SCFG_EXT_SPI_MASK 0x00000200 + +#define DISP_REG_SCFG_EXT_INTC_SHIFT 8 +#define DISP_REG_SCFG_EXT_INTC_SIZE 1 +#define DISP_REG_SCFG_EXT_INTC_MASK 0x00000100 + +#define DISP_REG_SCFG_EXT_NITROB_MOD_E_SHIFT 0 +#define DISP_REG_SCFG_EXT_NITROB_MOD_E_SIZE 8 +#define DISP_REG_SCFG_EXT_NITROB_MOD_E_MASK 0x000000ff + +#define DISP_REG_SCFG_EXT_MC_SHIFT 7 +#define DISP_REG_SCFG_EXT_MC_SIZE 1 +#define DISP_REG_SCFG_EXT_MC_MASK 0x00000080 + +#define DISP_REG_SCFG_EXT_SND_SHIFT 2 +#define DISP_REG_SCFG_EXT_SND_SIZE 1 +#define DISP_REG_SCFG_EXT_SND_MASK 0x00000004 + +#define DISP_REG_SCFG_EXT_SDMA_SHIFT 1 +#define DISP_REG_SCFG_EXT_SDMA_SIZE 1 +#define DISP_REG_SCFG_EXT_SDMA_MASK 0x00000002 + +#define DISP_REG_SCFG_EXT_DMA_SHIFT 0 +#define DISP_REG_SCFG_EXT_DMA_SIZE 1 +#define DISP_REG_SCFG_EXT_DMA_MASK 0x00000001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_EXT_FIELD( cfg, puenable, sd20, newb_access_e, wram, mc_b, gpio, i2c, i2s, mic, sd2, sd1, aes, dmac, nitrob_ex_e, psram, vram, lcdc, sio, dsel, spi, intc, nitrob_mod_e, mc, snd, sdma, dma ) \ + (u32)( \ + ((u32)(cfg) << DISP_REG_SCFG_EXT_CFG_SHIFT) | \ + ((u32)(puenable) << DISP_REG_SCFG_EXT_PUENABLE_SHIFT) | \ + ((u32)(sd20) << DISP_REG_SCFG_EXT_SD20_SHIFT) | \ + ((u32)(newb_access_e) << DISP_REG_SCFG_EXT_NEWB_ACCESS_E_SHIFT) | \ + ((u32)(wram) << DISP_REG_SCFG_EXT_WRAM_SHIFT) | \ + ((u32)(mc_b) << DISP_REG_SCFG_EXT_MC_B_SHIFT) | \ + ((u32)(gpio) << DISP_REG_SCFG_EXT_GPIO_SHIFT) | \ + ((u32)(i2c) << DISP_REG_SCFG_EXT_I2C_SHIFT) | \ + ((u32)(i2s) << DISP_REG_SCFG_EXT_I2S_SHIFT) | \ + ((u32)(mic) << DISP_REG_SCFG_EXT_MIC_SHIFT) | \ + ((u32)(sd2) << DISP_REG_SCFG_EXT_SD2_SHIFT) | \ + ((u32)(sd1) << DISP_REG_SCFG_EXT_SD1_SHIFT) | \ + ((u32)(aes) << DISP_REG_SCFG_EXT_AES_SHIFT) | \ + ((u32)(dmac) << DISP_REG_SCFG_EXT_DMAC_SHIFT) | \ + ((u32)(nitrob_ex_e) << DISP_REG_SCFG_EXT_NITROB_EX_E_SHIFT) | \ + ((u32)(psram) << DISP_REG_SCFG_EXT_PSRAM_SHIFT) | \ + ((u32)(vram) << DISP_REG_SCFG_EXT_VRAM_SHIFT) | \ + ((u32)(lcdc) << DISP_REG_SCFG_EXT_LCDC_SHIFT) | \ + ((u32)(sio) << DISP_REG_SCFG_EXT_SIO_SHIFT) | \ + ((u32)(dsel) << DISP_REG_SCFG_EXT_DSEL_SHIFT) | \ + ((u32)(spi) << DISP_REG_SCFG_EXT_SPI_SHIFT) | \ + ((u32)(intc) << DISP_REG_SCFG_EXT_INTC_SHIFT) | \ + ((u32)(nitrob_mod_e) << DISP_REG_SCFG_EXT_NITROB_MOD_E_SHIFT) | \ + ((u32)(mc) << DISP_REG_SCFG_EXT_MC_SHIFT) | \ + ((u32)(snd) << DISP_REG_SCFG_EXT_SND_SHIFT) | \ + ((u32)(sdma) << DISP_REG_SCFG_EXT_SDMA_SHIFT) | \ + ((u32)(dma) << DISP_REG_SCFG_EXT_DMA_SHIFT)) +#endif + +/* MC1 */ + +#define DISP_REG_MI_MC1_CC_SHIFT 16 +#define DISP_REG_MI_MC1_CC_SIZE 16 +#define DISP_REG_MI_MC1_CC_MASK 0xffff0000 + +#define DISP_REG_MI_MC1_SWP_SHIFT 15 +#define DISP_REG_MI_MC1_SWP_SIZE 1 +#define DISP_REG_MI_MC1_SWP_MASK 0x00008000 + +#define DISP_REG_MI_MC1_SL2_STATUS_SHIFT 4 +#define DISP_REG_MI_MC1_SL2_STATUS_SIZE 4 +#define DISP_REG_MI_MC1_SL2_STATUS_MASK 0x000000f0 + +#define DISP_REG_MI_MC1_SL2_M1_SHIFT 7 +#define DISP_REG_MI_MC1_SL2_M1_SIZE 1 +#define DISP_REG_MI_MC1_SL2_M1_MASK 0x00000080 + +#define DISP_REG_MI_MC1_SL2_M0_SHIFT 6 +#define DISP_REG_MI_MC1_SL2_M0_SIZE 1 +#define DISP_REG_MI_MC1_SL2_M0_MASK 0x00000040 + +#define DISP_REG_MI_MC1_SL2_CDET_SHIFT 4 +#define DISP_REG_MI_MC1_SL2_CDET_SIZE 1 +#define DISP_REG_MI_MC1_SL2_CDET_MASK 0x00000010 + +#define DISP_REG_MI_MC1_SL1_STATUS_SHIFT 0 +#define DISP_REG_MI_MC1_SL1_STATUS_SIZE 4 +#define DISP_REG_MI_MC1_SL1_STATUS_MASK 0x0000000f + +#define DISP_REG_MI_MC1_SL1_M1_SHIFT 3 +#define DISP_REG_MI_MC1_SL1_M1_SIZE 1 +#define DISP_REG_MI_MC1_SL1_M1_MASK 0x00000008 + +#define DISP_REG_MI_MC1_SL1_M0_SHIFT 2 +#define DISP_REG_MI_MC1_SL1_M0_SIZE 1 +#define DISP_REG_MI_MC1_SL1_M0_MASK 0x00000004 + +#define DISP_REG_MI_MC1_SL1_CDET_SHIFT 0 +#define DISP_REG_MI_MC1_SL1_CDET_SIZE 1 +#define DISP_REG_MI_MC1_SL1_CDET_MASK 0x00000001 + + +/* MC */ + +#define DISP_REG_MI_MC_SWP_SHIFT 15 +#define DISP_REG_MI_MC_SWP_SIZE 1 +#define DISP_REG_MI_MC_SWP_MASK 0x8000 + +#define DISP_REG_MI_MC_SL2_MODE_SHIFT 6 +#define DISP_REG_MI_MC_SL2_MODE_SIZE 2 +#define DISP_REG_MI_MC_SL2_MODE_MASK 0x00c0 + +#define DISP_REG_MI_MC_SL2_CDET_SHIFT 4 +#define DISP_REG_MI_MC_SL2_CDET_SIZE 1 +#define DISP_REG_MI_MC_SL2_CDET_MASK 0x0010 + +#define DISP_REG_MI_MC_SL1_MODE_SHIFT 2 +#define DISP_REG_MI_MC_SL1_MODE_SIZE 2 +#define DISP_REG_MI_MC_SL1_MODE_MASK 0x000c + +#define DISP_REG_MI_MC_SL1_CDET_SHIFT 0 +#define DISP_REG_MI_MC_SL1_CDET_SIZE 1 +#define DISP_REG_MI_MC_SL1_CDET_MASK 0x0001 + +#ifndef SDK_ASM +#define DISP_REG_MI_MC_FIELD( swp, sl2_mode, sl2_cdet, sl1_mode, sl1_cdet ) \ + (u16)( \ + ((u32)(swp) << DISP_REG_MI_MC_SWP_SHIFT) | \ + ((u32)(sl2_mode) << DISP_REG_MI_MC_SL2_MODE_SHIFT) | \ + ((u32)(sl2_cdet) << DISP_REG_MI_MC_SL2_CDET_SHIFT) | \ + ((u32)(sl1_mode) << DISP_REG_MI_MC_SL1_MODE_SHIFT) | \ + ((u32)(sl1_cdet) << DISP_REG_MI_MC_SL1_CDET_SHIFT)) +#endif + +/* MCCHAT */ + +#define DISP_REG_MI_MCCHAT_CC_SHIFT 0 +#define DISP_REG_MI_MCCHAT_CC_SIZE 16 +#define DISP_REG_MI_MCCHAT_CC_MASK 0xffff + +#ifndef SDK_ASM +#define DISP_REG_MI_MCCHAT_FIELD( cc ) \ + (u16)( \ + ((u32)(cc) << DISP_REG_MI_MCCHAT_CC_SHIFT)) +#endif + + +/* MC2 */ + +#define DISP_REG_MI_MC2_CA_SHIFT 0 +#define DISP_REG_MI_MC2_CA_SIZE 16 +#define DISP_REG_MI_MC2_CA_MASK 0xffff + +#ifndef SDK_ASM +#define DISP_REG_MI_MC2_FIELD( ca ) \ + (u16)( \ + ((u32)(ca) << DISP_REG_MI_MC2_CA_SHIFT)) +#endif + + +/* WL */ + +#define DISP_REG_SCFG_WL_OFFB_SHIFT 0 +#define DISP_REG_SCFG_WL_OFFB_SIZE 1 +#define DISP_REG_SCFG_WL_OFFB_MASK 0x0001 + +#ifndef SDK_ASM +#define DISP_REG_SCFG_WL_FIELD( offb ) \ + (u16)( \ + ((u32)(offb) << DISP_REG_SCFG_WL_OFFB_SHIFT)) +#endif + + +/* OP */ + +#define DISP_REG_SCFG_OP_OP1_SHIFT 1 +#define DISP_REG_SCFG_OP_OP1_SIZE 1 +#define DISP_REG_SCFG_OP_OP1_MASK 0x0002 + +#define DISP_REG_SCFG_OP_OP0_SHIFT 0 +#define DISP_REG_SCFG_OP_OP0_SIZE 1 +#define DISP_REG_SCFG_OP_OP0_MASK 0x0001 + +#define DISP_REG_SCFG_OP_OPT_SHIFT 0 +#define DISP_REG_SCFG_OP_OPT_SIZE 2 +#define DISP_REG_SCFG_OP_OPT_MASK 0x0003 + +#ifndef SDK_ASM + +#define DISP_REG_SCFG_OP_FIELD( op1, op0, opt ) \ + (u16)( \ + ((u32)(op1) << DISP_REG_SCFG_OP_OP1_SHIFT) | \ + ((u32)(op0) << DISP_REG_SCFG_OP_OP0_SHIFT) | \ + ((u32)(opt) << DISP_REG_SCFG_OP_OPT_SHIFT)) +#endif + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_IOREG_SCFG_H_ */ +#endif diff --git a/build/tests/DisplaySystemInformation/ARM9/src/strResource.c b/build/tests/DisplaySystemInformation/ARM9/src/strResource.c new file mode 100644 index 00000000..9e70045d --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/strResource.c @@ -0,0 +1,726 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: strResource.c + + Copyright **** 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 "drawFunc.h" + + +// VERSION_MENU_SIZE、FONTMENU_SIZEだけコンテンツ数に応じて可変なのでconstではない + +#ifdef VERSION_VIEWER + +int s_numMenu[] = { + VERSIONMENU_SIZE, + ROOTMENU_SIZE +}; + +const char *s_strRootMenu[] = { + "<Installed Content Version>" +}; + + +const char **s_strMetaMenu[] = { + NULL, + s_strRootMenu +}; + +#else + +int s_numMenu[] = { + OWNERMENU_SIZE, + PARENTALMENU_SIZE, + SECURE_USER_MENU_SIZE, + OTHERMENU_SIZE, + NORMAL_HW_MENU_SIZE, + SECURE_HW_MENU_SIZE, + SCFG_ARM7_MENU_SIZE, + SCFG_ARM9_MENU_SIZE, + SYSMENU_MENU_SIZE, + FONTMENU_SIZE, + WLMENU_SIZE, + WHITEMENU_SIZE, + VERSIONMENU_SIZE, + 0, + 0, + 0, + ROOTMENU_SIZE +}; + +const char *s_strARM7RegisterName[] = { + "ROM", + "CLK", + "JTAG", + "EXP", + "MC1", + "MC2", + "DSWL", + "OPT", +}; + +const char *s_strARM9RegisterName[] = { + "ROM", + "CLK", + "RST", + "EXP", +}; + +const char *s_strSCFGViewMode[] = { + "", + "" +}; + +const char *s_strRootMenu[] = { + "<Owner>", + "<Parental control>", + "<Secure User Info>", + "<Other Info>", + "<Normal Hardware Info>", + "<Secure Hardware Info>", + "<SCFG Info (ARM7 side)>", + "<SCFG Info (ARM9 side)>", + "<SystemMenu Version>", + "<Shared Font>", + "<Wireless Firmware>", + "<Whitelist>", + "<Installed Content Version>", + "Reset HW Setting to Default", + "break HW Setting", + "Reset RTC Data" +}; + +const char *s_strOwnerMenu[] = { + "Language", + "Favorite color", + "Birthday", + "Country", + "Nickname", + "Comment" +}; + +const char *s_strParentalMenu[] = { + "Parental control", + "Picto Chat", + "ds Download", + "browser", + "Wii Point", + "Photo Exchange", + "UGC", + "Organization", + "Age", + "Password", + "Quastion id", + "Answer" +}; + +const char *s_strSecureUserMenu[] = { + "Finished Initial Setting(Setting)", + "Finished Initial Setting(Launcher)", + "Finished Broken Setting Sequence", + "Installed Softbox Count", + "Free Softbox Count", + "Last Boot Soft Index", + "Last Boot Soft Platform", + "Last Boot Soft ID" +}; + +const char *s_strOtherMenu[] = { + "Agree EULA", + "EULA Version", + "Wireless", + "RTC Offset", + "TP Calib raw x1", + "TP Calib raw y1", + "TP Calib dx1", + "TP Calib dy1", + "TP Calib raw x2", + "TP Calib raw y2", + "TP Calib dx2", + "TP Calib dy2", + "TP Calib RSV" +}; + +const char *s_strNormalHWMenu[] = { + "RTC Adjustment", + "Unique ID" +}; + +const char *s_strSecureHWMenu[] = { + "Force Disable Wireless", + "Region", + "Serial No", + "Language Bitmap", + "Fuse Data", + "Launcher TitleID Lo" +}; + +const char *s_strSCFGArm9Menu[] = { + "ARM9 SecureROM", + "Rom Status", + + "CPU Speed", + "DSP Clock", + "Camera Clock", + "WRAM Clock", + "Camera CKI", + + "DSP Reset Flag", + + "Fixed DMA", + "Fixed Geometry", + "Fixed Renderer", + "Fixed 2D Engine", + "Fixed Divider", + "Fixed Card I/F", + "Expanded VRAM", + "Expanded LCDC", + "Expanded INTC", + "PSRAM Boundary", + "New DMA Access", + "Camera Access", + "DSP Access", + "MemoryCard I/F", + "WRAM Access", + "CFG Block Access", + "All SCFG Check", + "SCFG Check Err7", + "SCFG Check Err9" +}; + +const char *s_strSCFGArm7Menu[] = { + + // rom制御 + "ARM9 SecureROM", + "ARM9 ROM Type", + "ARM7 SecureROM", + "ARM7 ROM Type", + "ARM7 FuseRom", + "Write Rom Area", + + // 新規ブロッククロック + "SD1 I/F Clock", + "SD2 I/F Clock", + "AES Clock", + "WRAM Clock", + "SND Clock", + + // JTAG + "Chain ARM7 to CPU JTAG", + "CPU JTAG", + "DSP JTAG", + + // 拡張機能 + "Fixed A7-DMAC1", + "Fixed Sound DMA", + "Fixed Sound", + "Fixed Memory Card", + "Expanded A7-INTC", + "Expanded SPI", + "Expanded Sound DMA", + "Expanded SIO", + "Expanded LCDC", + "Expanded VRAM", + "PSRAM Boundary", + "A7-DMAC2 Block", + "AES Block", + "SD1 I/F Block", + "SD2 I/F Block", + "Mic Block", + "I2S I/F Block", + "I2C I/F Block", + "GPIO Block", + "MemoryCard I/F", + "Shared WRAM", + "PU Resistance", + "ALL SCFG Block", + + // メモリカード I/F + "MC Slot1 DET", + "MC Slot1 Mode", + "MC Slot2 DET", + "MC Slot2 Mode", + "Swap MC1 MC2", + "Chatter. Count", + "MC Counter Data", + + // 旧無線 + "Old Wireless", + + // オプション端子読み出し + "Option Form", + "Option App for" +}; + +const char *s_strSystemMenu[] = { + "Timestamp", + "Version (numeric)", + "Version (string)", + "EULA URL", + "NUP Hostname", + + ".twl-nup-cert.der" , + ".twl-nup-prvkey.der", + ".twl-shop-cert.der", + ".twl-shop-prvkey.der", + "NintendoCA-G2.der" +}; + +const char *s_strFontMenu[] = { + "Timestamp", +}; + +const char *s_strWLMenu[] = { + "Version", + "Num of FW", + "FW1 type", + "FW1 version", + "FW2 type", + "FW2 version" +}; + +const char *s_strWhiteMenu[] = { + "Num of Entry", + "Tmd Hash" +}; + +const char **s_strMetaMenu[] = { + s_strOwnerMenu, + s_strParentalMenu, + s_strSecureUserMenu, + s_strOtherMenu, + s_strNormalHWMenu, + s_strSecureHWMenu, + s_strSCFGArm7Menu, + s_strSCFGArm9Menu, + s_strSystemMenu, + s_strFontMenu, + s_strWLMenu, + s_strWhiteMenu, + NULL, + NULL, + NULL, + NULL, + s_strRootMenu +}; + +char *s_strAccess[] = { + "Inaccessible", + "Accessible" +}; + +char *s_strJoint[] = { + "Jointed", + "DisJointed" +}; + +char *s_strSupply[] = { + "STOPPED", + "SUPPLIED" +}; + +char *s_strPSRAM[] = { + "4MB", + "16MB", + "32MB" +}; + +char *s_strRomMode[] = { + "TWL 64KB ROM", + "NITRO 8KB ROM" + +}; + +char *s_strCpuSpeed[] = { + "67.03 MHz", + "134.06 MHz" +}; + +char *s_strRomForm[] = { + "Included ROM", + "Downloaded PROM" +}; + +char *s_strRomApp[] = { + "Mass Product", + "Development 1", + "Development 2", + "PROM Download" +}; + +char *s_strWLFWType[] = { + "2in1 module 1.1", + "2in1 module 2.0", + "One Chip (M&M)" +}; + +char *s_strMCMode[] = { + "00", + "01", + "10", + "11" +}; + +char *s_strEnable[] = { + "DISABLED", + "ENABLED" +}; + +char *s_strResult[] = { + "Failed.", + "Succeeded.", + "" +}; + + + +char *s_strSysMenuKey[] = { + "Incorrect", + "correct: dev", + "correct: prod" +}; + +char *s_strBool[] = { + "FALSE", + "TRUE" +}; + + +char *s_strRatingOrg[] = { + "CERO", + "ESRB", + "BBFC", + "USK", + "PEGI general", + "PEGI Finland", + "PEGI Portugal", + "PEGI and BBFC Great Briten", + "OFLC", + "GRB" +}; + + char *s_strRegion[] = { + "JAPAN", + "AMERICA", + "EUROPA", + "AUSTRALIA", + "CHINA", + "KOREA", +}; + + char *s_strUserColor[] = { + "GRAY ", + "BROWN ", + "RED ", + "PINK ", + "ORANGE ", + "YELLOW ", + "LIME GREEN", + "GREEN ", + "DARK GREEN", + "SEA GREEN ", + "TURQUOISE ", + "BLUE ", + "DARK BLUE ", + "PURPLE ", + "VIOLET ", + "MAGENTA ", +}; + +char *s_strLanguage[] = { + "JAPANESE", + "ENGLISH", + "FRENCH", + "GERMAN", + "ITALIAN", + "SPANISH", + "CHINESE", + "KOREAN", +}; + +char *s_strCountry[] = { + "UNDEFINED ", // 未設定 + "JAPAN ", // 日本 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "Anguilla ", // アンギラ + "ANTIGUA_AND_BARBUDA", // アンティグア・バーブーダ + "ARGENTINA ", // アルゼンチン + "ARUBA", // アルバ + "BAHAMAS", // バハマ + "BARBADOS", // バルバドス + "BELIZE", // ベリーズ + "BOLIVIA", // ボリビア + "BRAZIL", // ブラジル + "BRITISH_VIRGIN_ISLANDS", // 英領ヴァージン諸島 + "CANADA", // カナダ + "CAYMAN_ISLANDS", // ケイマン諸島 + "CHILE ", // チリ + "COLOMBIA", // コロンビア + "COSTA_RICA", // コスタリカ + "DOMINICA", // ドミニカ国 + "DOMINICAN_REPUBLIC", // ドミニカ共和国 + "ECUADOR", // エクアドル + "EL_SALVADOR", // エルサルバドル + "FRENCH_GUIANA", // フランス領ギアナ + "GRENADA", // グレナダ + "GUADELOUPE", // グアドループ + "GUATEMALA ", // グアテマラ + "GUYANA", // ガイアナ + "HAITI", // ハイチ + "HONDURAS", // ホンジュラス + "JAMAICA", // ジャマイカ + "MARTINIQUE", // マルティニーク + "MEXICO", // メキシコ + "MONTSERRAT", // モントセラト + "NETHERLANDS_ANTILLES", // オランダ領アンティル + "NICARAGUA", // ニカラグア + "PANAMA ", // パナマ + "PARAGUAY", // パラグアイ + "PERU", // ペルー + "ST_KITTS_AND_NEVIS", // セントキッツ・ネイビス + "ST_LUCIA", // セントルシア + "ST_VINCENT_AND_THE_GRENADINES", // セントビンセント・グレナディーン + "SURINAME", // スリナム + "TRINIDAD_AND_TOBAGO", // トリニダード・トバゴ + "TURKS_AND_CAICOS_ISLANDS", // タークス・カイコス諸島 + "UNITED_STATES", // アメリカ + "URUGUAY ", // ウルグアイ + "US_VIRGIN_ISLANDS", // 米領バージン諸島 + "VENEZUELA", // ベネズエラ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "ALBANIA ", // アルバニア + "AUSTRALIA", // オーストラリア + "AUSTRIA", // オーストリア + "BELGIUM", // ベルギー + "BOSNIA_AND_HERZEGOVINA", // ボスニア・ヘルツェゴビナ + "BOTSWANA", // ボツワナ + "BULGARIA ", // ブルガリア + "CROATIA", // クロアチア + "CYPRUS", // キプロス + "CZECH_REPUBLIC", // チェコ + "DENMARK", // デンマーク + "ESTONIA", // エストニア + "FINLAND", // フィンランド + "FRANCE", // フランス + "GERMANY", // ドイツ + "GREECE", // ギリシャ + "HUNGARY ", // ハンガリー + "ICELAND", // アイスランド + "IRELAND", // アイルランド + "ITALY", // イタリア + "LATVIA", // ラトビア + "LESOTHO", // レソト + "LIECHTENSTEIN", // リヒテンシュタイン + "LITHUANIA", // リトアニア + "LUXEMBOURG", // ルクセンブルク + "MACEDONIA", // マケドニア + "MALTA ", // マルタ + "MONTENEGRO", // モンテネグロ + "MOZAMBIQUE", // モザンビーク + "NAMIBIA", // ナミビア + "NETHERLANDS", // オランダ + "NEW_ZEALAND", // ニュージーランド + "NORWAY", // ノルウェー + "POLAND", // ポーランド + "PORTUGAL", // ポルトガル + "ROMANIA", // ルーマニア + "RUSSIA ", // ロシア + "SERBIA", // セルビア + "SLOVAKIA", // スロバキア + "SLOVENIA", // スロベニア + "SOUTH_AFRICA", // 南アフリカ + "SPAIN", // スペイン + "SWAZILAND", // スワジランド + "SWEDEN", // スウェーデン + "SWITZERLAND", // スイス + "TURKEY", // トルコ + "UNITED_KINGDOM ", // イギリス + "ZAMBIA", // ザンビア + "ZIMBABWE", // ジンバブエ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "TAIWAN ", // 台湾 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "SOUTH_KOREA ", // 韓国 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "HONG_KONG ", // ホンコン + "MACAU", // マカオ + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "INDONESIA ", // インドネシア + "SINGAPORE ", // シンガポール + "THAILAND ", // タイ + "PHILIPPINES", // フィリピン + "MALAYSIA", // マレーシア + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "CHINA ", // 中国 + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UAE ", // アラブ首長国連邦 + "INDIA ", // インド + "EGYPT ", // エジプト + "OMAN", // オマーン + "QATAR", // カタール + "KUWAIT", // クウェート + "SAUDI_ARABIA", // サウジアラビア + "SYRIA", // シリア + "BAHRAIN", // バーレーン + "JORDAN", // ヨルダン + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "UNKNOWN", + "OTHERS ", + "UNKNOWN ", +}; + + +#endif // else VERSION_VIEWER + +char *s_strOK[] = { + "CANCEL", + "OK" +}; + +char *s_strCorrect[] = { + "Incorrect", + "Correct" +}; + +char s_strNA[] = { + "N/A" +}; diff --git a/build/tests/DisplaySystemInformation/ARM9/src/strResource.h b/build/tests/DisplaySystemInformation/ARM9/src/strResource.h new file mode 100644 index 00000000..97c8928f --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/strResource.h @@ -0,0 +1,293 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: strResource.h + + Copyright **** 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 __DISPLAY_INFO_RESOURCE__ +#define __DISPLAY_INFO_RESOURCE__ + +// メニューID +#ifdef VERSION_VIEWER + #define ROOTMENU_SIZE 1 + #define MENU_ROOT 1 + #define MENU_VERSION 0 + #define MENU_OWNER 10 + #define MENU_PARENTAL 11 + #define MENU_SECURE_USER 12 + #define MENU_OTHER 13 + #define MENU_NORMAL_HW 14 + #define MENU_SECURE_HW 15 + #define MENU_SCFG_ARM7 16 + #define MENU_SCFG_ARM9 17 + #define MENU_SYSMENU 18 + #define MENU_FONT 19 + #define MENU_WL 20 + #define MENU_WHITE 21 + #define MENU_RESET_INFO 22 + #define MENU_BREAK_DATA 23 + #define MENU_RTC_RESET 24 + +#else + #define ROOTMENU_SIZE 16 + + #define MENU_ROOT 16 + #define MENU_OWNER 0 + #define MENU_PARENTAL 1 + #define MENU_SECURE_USER 2 + #define MENU_OTHER 3 + #define MENU_NORMAL_HW 4 + #define MENU_SECURE_HW 5 + #define MENU_SCFG_ARM7 6 + #define MENU_SCFG_ARM9 7 + #define MENU_SYSMENU 8 + #define MENU_FONT 9 + #define MENU_WL 10 + #define MENU_WHITE 11 + #define MENU_VERSION 12 + #define MENU_RESET_INFO 13 + #define MENU_BREAK_DATA 14 + #define MENU_RTC_RESET 15 +#endif // else VERSION_VIEWER + +#define OWNERMENU_SIZE 6 + +#define OWNER_LANGUAGE 0 +#define OWNER_COLOR 1 +#define OWNER_BIRTHDAY 2 +#define OWNER_COUNTRY 3 +#define OWNER_NICKNAME 4 +#define OWNER_COMMENT 5 + +#define PARENTALMENU_SIZE 12 + +#define PARENTAL_FLAG 0 +#define PARENTAL_PICTOCHAT 1 +#define PARENTAL_DOWNLOAD 2 +#define PARENTAL_BROWSER 3 +#define PARENTAL_WIIPOINT 4 +#define PARENTAL_PHOTO_EXCHANGE 5 +#define PARENTAL_UGC 6 +#define PARENTAL_ORGANIZATION 7 +#define PARENTAL_AGE 8 +#define PARENTAL_PASSWORD 9 +#define PARENTAL_QUESTION_ID 10 +#define PARENTAL_ANSWER 11 + +#define SECURE_USER_MENU_SIZE 8 + +#define SECURE_USER_INITIAL_SETTINGS 0 +#define SECURE_USER_INITIAL_LAUNCHER 1 +#define SECURE_USER_BROKEN_SETTINGS 2 +#define SECURE_USER_INSTALLED_SOFTBOX 3 +#define SECURE_USER_FREE_SOFTBOX 4 +#define SECURE_USER_LASTBOOT_IDX 5 +#define SECURE_USER_LASTBOOT_PLATFORM 6 +#define SECURE_USER_LASTBOOT_ID 7 + +#define OTHERMENU_SIZE 13 + +#define OTHER_AGREE_EULA 0 +#define OTHER_EULA_VERSION 1 +#define OTHER_WIRELESS 2 +#define OTHER_RTC_OFFSET 3 +#define OTHER_TP_RAWX1 4 +#define OTHER_TP_RAWY1 5 +#define OTHER_TP_DX1 6 +#define OTHER_TP_DY1 7 +#define OTHER_TP_RAWX2 8 +#define OTHER_TP_RAWY2 9 +#define OTHER_TP_DX2 10 +#define OTHER_TP_DY2 11 +#define OTHER_TP_RSV 12 + +#define NORMAL_HW_MENU_SIZE 2 + +#define NORMAL_HW_RTC_ADJUST 0 +#define NORMAL_HW_UNIQUE_ID 1 + +#define SECURE_HW_MENU_SIZE 6 + +#define SECURE_HW_FORCE_DISABLE 0 +#define SECURE_HW_REGION 1 +#define SECURE_HW_SERIAL 2 +#define SECURE_HW_LANGUAGE 3 +#define SECURE_HW_FUSE 4 +#define SECURE_HW_LAUNCHER_ID 5 + +#define SCFG_ARM9_MENU_SIZE 27 + +#define SCFG_ARM9_ROM_SEC 0 +#define SCFG_ARM9_ROM_STATE 1 +#define SCFG_ARM9_CLK_CPU 2 +#define SCFG_ARM9_CLK_DSP 3 +#define SCFG_ARM9_CLK_CAM 4 +#define SCFG_ARM9_CLK_WRAM 5 +#define SCFG_ARM9_CLK_CAM_CKI 6 +#define SCFG_ARM9_RST_DSP 7 +#define SCFG_ARM9_EXT_DMA 8 +#define SCFG_ARM9_EXT_GEO 9 +#define SCFG_ARM9_EXT_REN 10 +#define SCFG_ARM9_EXT_2DE 11 +#define SCFG_ARM9_EXT_DIV 12 +#define SCFG_ARM9_EXT_MC 13 +#define SCFG_ARM9_EXT_INTC 14 +#define SCFG_ARM9_EXT_LCDC 15 +#define SCFG_ARM9_EXT_VRAM 16 +#define SCFG_ARM9_EXT_PS 17 +#define SCFG_ARM9_EXT_DMAC 18 +#define SCFG_ARM9_EXT_CAM 19 +#define SCFG_ARM9_EXT_DSP 20 +#define SCFG_ARM9_EXT_MCB 21 +#define SCFG_ARM9_EXT_WRAM 22 +#define SCFG_ARM9_EXT_CFG 23 +#define SCFG_ARM9_TOTAL_CHECK 24 +#define SCFG_ARM9_CHECK_ERROR7 25 +#define SCFG_ARM9_CHECK_ERROR9 26 + +#define SCFG_ARM7_MENU_SIZE 47 + +#define SCFG_ARM7_ROM_ARM9_SEC 0 +#define SCFG_ARM7_ROM_ARM9_RSEL 1 +#define SCFG_ARM7_ROM_ARM7_SEC 2 +#define SCFG_ARM7_ROM_ARM7_RSEL 3 +#define SCFG_ARM7_ROM_ARM7_FUSE 4 +#define SCFG_ARM7_ROM_WE 5 +#define SCFG_ARM7_CLK_SD1 6 +#define SCFG_ARM7_CLK_SD2 7 +#define SCFG_ARM7_CLK_AES 8 +#define SCFG_ARM7_CLK_WRAM 9 +#define SCFG_ARM7_CLK_SND 10 +#define SCFG_ARM7_JTAG_A7 11 +#define SCFG_ARM7_JTAG_CPU 12 +#define SCFG_ARM7_JTAG_DSP 13 +#define SCFG_ARM7_EXT_DMA 14 +#define SCFG_ARM7_EXT_SDMA 15 +#define SCFG_ARM7_EXT_SND 16 +#define SCFG_ARM7_EXT_MC 17 +#define SCFG_ARM7_EXT_INTC 18 +#define SCFG_ARM7_EXT_SPI 19 +#define SCFG_ARM7_EXT_DSEL 20 +#define SCFG_ARM7_EXT_SIO 21 +#define SCFG_ARM7_EXT_LCDC 22 +#define SCFG_ARM7_EXT_VRAM 23 +#define SCFG_ARM7_EXT_PS 24 +#define SCFG_ARM7_EXT_DMAC 25 +#define SCFG_ARM7_EXT_AES 26 +#define SCFG_ARM7_EXT_SD1 27 +#define SCFG_ARM7_EXT_SD2 28 +#define SCFG_ARM7_EXT_MIC 29 +#define SCFG_ARM7_EXT_I2S 30 +#define SCFG_ARM7_EXT_I2C 31 +#define SCFG_ARM7_EXT_GPIO 32 +#define SCFG_ARM7_EXT_MCB 33 +#define SCFG_ARM7_EXT_WRAM 34 +#define SCFG_ARM7_EXT_PU 35 +#define SCFG_ARM7_EXT_CFG 36 +#define SCFG_ARM7_MI_SC1_CDET 37 +#define SCFG_ARM7_MI_SC1_MODE 38 +#define SCFG_ARM7_MI_SC2_CDET 39 +#define SCFG_ARM7_MI_SC2_MODE 40 +#define SCFG_ARM7_MI_SWP 41 +#define SCFG_ARM7_MI_CC 42 +#define SCFG_ARM7_MI_CA 43 +#define SCFG_ARM7_WL_OFFB 44 +#define SCFG_ARM7_OP_FORM 45 +#define SCFG_ARM7_OP_APP 46 + +#define SCFG_ARM7_SHARED_OFFSET 47 + +#define SYSMENU_MENU_SIZE 10 + +#define SYSMENU_TIMESTAMP 0 +#define SYSMENU_VERSION_NUM 1 +#define SYSMENU_VERSION_STR 2 +#define SYSMENU_EULA_URL 3 +#define SYSMENU_NUP_HOST 4 + +#define SYSMENU_NUP_CERT 5 +#define SYSMENU_NUP_PRV 6 +#define SYSMENU_SHOP_CERT 7 +#define SYSMENU_SHOP_PRV 8 +#define SYSMENU_NINTENDO_CAG2 9 + +#define SYSMENU_HASH_IDX 5 + +#define FONTMENU_SIZE 1 + +#define FONT_TIMESTAMP 0 +#define FONT_INFO 1 + +#define WLMENU_SIZE 6 + +#define WL_VERSION 0 +#define WL_NUM_FW 1 +#define WL_FW1_TYPE 2 +#define WL_FW1_VER 3 +#define WL_FW2_TYPE 4 +#define WL_FW2_VER 5 + +#define WHITEMENU_SIZE 2 + +#define WHITE_NUM 0 +#define WHITE_HASH 1 + +#define VERSIONMENU_SIZE 0 + +#define VERSION_OTHER 0 + +extern int s_numMenu[]; +extern const char *s_strRootMenu[]; +extern const char *s_strOwnerMenu[]; +extern const char *s_strParentalMenu[]; +extern const char *s_strSecureUserMenu[]; +extern const char *s_strOtherMenu[]; +extern const char *s_strNormalHWMenu[]; +extern const char *s_strSecureHWMenu[]; +extern const char *s_strSCFGARM7Menu[]; +extern const char *s_strSCFGARM9Menu[]; +extern const char *s_strOtherMenu[]; +extern const char *s_strSystemMenu[]; +extern const char *s_strFontMenu[] ; +extern const char *s_strWLMenu[]; +extern const char *s_strWhiteMenu[]; +extern const char **s_strMetaMenu[]; +extern const char *s_strARM7RegisterName[]; +extern const char *s_strARM9RegisterName[]; +extern const char *s_strSCFGViewMode[]; + +extern char *s_strEnable[]; +extern char *s_strJoint[]; +extern char *s_strCorrect[]; +extern char *s_strSysMenuKey[]; +extern char *s_strSupply[]; +extern char *s_strRomMode[]; +extern char *s_strPSRAM[]; +extern char *s_strCpuSpeed[]; +extern char *s_strOK[]; +extern char *s_strWLFWType[]; +extern char *s_strResult[]; +extern char *s_strBool[]; +extern char *s_strAccess[]; +extern char *s_strRomApp[]; +extern char *s_strRomForm[]; +extern char *s_strMCMode[]; +extern char *s_strRatingOrg[]; +extern char *s_strRegion[]; +extern char *s_strUserColor[]; +extern char *s_strLanguage[]; +extern char *s_strCountry[]; +extern char s_strNA[]; + +#endif // ifndef __DISPLAY_INFO_RESOURCE__ \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/util.c b/build/tests/DisplaySystemInformation/ARM9/src/util.c new file mode 100644 index 00000000..95ece923 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/util.c @@ -0,0 +1,46 @@ +#include +#include "util.h" + +u8 ctoh( const char c ); + +void putBinary( u8 *src, u32 size ) +{ + int i; + for( i = 0; i < size; i++ ) + { + OS_TPrintf( "%x", src[i] ); + } + + OS_TPrintf( "\n" ); +} + +u8 ctoh( const char c ) +{ + if( '0' <= c && c <= '9' ) + { + return (u8) (c - '0'); + } + + if( 'a' <= c && c <= 'f' ) + { + return (u8) ((c - 'a') + 10); + } + + if( 'A' <= c && c <= 'F' ) + { + return (u8) ((c - 'A') + 10); + } + + return 0; +} + +void strToHexa( const char *src, u8 *dst, u32 length ) +// 受け取った文字列配列を16進配列へ変換 +// lengthは文字数ではなくバイト数なので注意 +{ + int i; + for( i = 0; i < length*2 ; i += 2 ) + { + dst[i/2] = (u8) ( (ctoh( src[i] ) << 4) | ctoh( src[i+1] ) ); + } +} diff --git a/build/tests/DisplaySystemInformation/ARM9/src/util.h b/build/tests/DisplaySystemInformation/ARM9/src/util.h new file mode 100644 index 00000000..dda95543 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/util.h @@ -0,0 +1,10 @@ + +#ifndef __DISPLAY_INFO_UTIL__ +#define __DISPLAY_INFO_UTIL__ + +#include + +void putBinary( u8 *src, u32 size ); +void strToHexa( const char *src, u8 *dst, u32 length ); + +#endif \ No newline at end of file diff --git a/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.c b/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.c new file mode 100644 index 00000000..88f1d520 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.c @@ -0,0 +1,317 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: viewSystemInfo.c + + Copyright **** 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 "misc.h" +#include "viewSystemInfo.h" +#include "strResource.h" +#include "control.h" + +#include "getInformation.h" + +/* function prototype ----------------------------- */ +void getAllInfo( void ); +void initInfo( void ); +void infoAlloc( DispInfoEntry *p, u8 index, u8 size, BOOL isSjis ); +void printAllInfo ( void ); +void getParentalInfo( void ); +void getOtherInfo( void ); + + +/* global variables ----------------------------- */ + +DispInfoEntry* gAllInfo[ROOTMENU_SIZE]; // それぞれのメニューごとに項目の中身を"文字列で"持つ配列 + +// コンテンツタイトル関係 +OSTitleId *gContentsTitle; // コンテンツタイトルの一覧 +s32 gNumContents; // gContentsTitleに含まれるタイトルの数 +u16 *gContentsVersion; // gContentsTitleそれぞれのバージョン情報 + +// ARM7側のSCFGデータを保持 +u8 gArm7SCFGReg[DISPINFO_SHARED_SCFG_REG_SIZE]; +u8 gArm7SCFGShared[DISPINFO_SHARED_SCFG_WRAM_SIZE]; + +// LCFGReadの結果 +BOOL gLCFGAccessible; +u8 * gBufLCFG; + +/* static data ---------------------------------- */ + + +/* function definition -------------------------- */ + +void displayInfoMain( void ) +{ + static int menu = MENU_ROOT; + static int line = 0; // 現在選択しているページナンバと行 + static int changeLine = 0; // changeMode用 + static BOOL firstCall = TRUE; // 最初の呼び出しか否か + + // 0: changemode 1: executemode 2: result on/off 3:(require 2=true) success/failed + static u8 modeFlag = 0; + + static BOOL isChangeMode = FALSE; + static BOOL executeMode = FALSE; + + BOOL repaintFlag = FALSE; + ChangeCotnrolResult changeResult = CHANGE_NOTHING; + + // 初回の呼び出し時は全ての情報を取得しなおす + if( firstCall ) + { + initInfo(); + getAllInfo(); + } + + if( modeFlag & MODE_CHANGE_MASK ) + { + changeResult = changeControl( &menu, &line, &changeLine, &modeFlag ); + } + else if( modeFlag & MODE_EXECUTE_MASK ) + { + repaintFlag |= executeControl( &line, &changeLine, &modeFlag ); + } + else + { + repaintFlag |= control( &menu, &line, &changeLine, &modeFlag ); + } + + if( changeResult == CHANGE_VALUE_CHANGED ) + { + // 値が更新されたときは全部取得しなおす + LCFG_WriteTWLSettings( (u8 (*) [LCFG_WRITE_TEMP] ) gBufLCFG ); + getAllInfo(); + } + + // パッド情報で選んでる場所とか情報とか更新 + if( changeResult == CHANGE_VALUE_CHANGED || changeResult == CHANGE_CONTROL || repaintFlag || firstCall ) + { + // 何か操作があったときはキャンバスクリアして描画しなおし + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + NNS_G2dCharCanvasClear( &gCanvasSub, TXT_COLOR_WHITE ); + // 情報一覧を描画する + drawMenu( menu, line, changeLine, modeFlag ); + + firstCall = FALSE; + } + +} + +void initInfo( void ) +// 固定文字列で対応できない項目に文字列領域を割り当てる +{ + +#ifndef VERSION_VIEWER + OS_TPrintf("buffer initialize\n"); + + // sjis (char) + infoAlloc( gAllInfo[MENU_OWNER], OWNER_BIRTHDAY, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SECURE_USER], SECURE_USER_LASTBOOT_ID, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SECURE_HW], SECURE_HW_LAUNCHER_ID, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_NORMAL_HW], NORMAL_HW_UNIQUE_ID, OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN*3 , TRUE ); + infoAlloc( gAllInfo[MENU_SECURE_HW], SECURE_HW_SERIAL , OS_TWL_HWINFO_SERIALNO_LEN_MAX + 1, TRUE ); + infoAlloc( gAllInfo[MENU_SECURE_HW], SECURE_HW_LANGUAGE, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SECURE_HW], SECURE_HW_FUSE, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SCFG_ARM7], SCFG_ARM7_MI_CC, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SCFG_ARM7], SCFG_ARM7_MI_CA, DISPINFO_BUFSIZE , TRUE ); + infoAlloc( gAllInfo[MENU_SCFG_ARM9], SCFG_ARM9_CHECK_ERROR7, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_SCFG_ARM9], SCFG_ARM9_CHECK_ERROR9, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_WL], WL_VERSION, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_WL], WL_FW1_VER, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_WL], WL_FW2_VER, DISPINFO_BUFSIZE, TRUE ); + infoAlloc( gAllInfo[MENU_OTHER], OTHER_RTC_OFFSET, DISPINFO_BUFSIZE, TRUE); + infoAlloc( gAllInfo[MENU_OTHER], OTHER_TP_RSV, DISPINFO_BUFSIZE, TRUE); + + + // utf(u16) + infoAlloc( gAllInfo[MENU_SYSMENU], SYSMENU_EULA_URL, TWL_EULA_URL_LEN + 1, FALSE ); + infoAlloc( gAllInfo[MENU_SYSMENU], SYSMENU_NUP_HOST, TWL_NUP_HOSTNAME_LEN + 1, FALSE ); + infoAlloc( gAllInfo[MENU_OWNER], OWNER_NICKNAME, OS_OWNERINFO_NICKNAME_MAX + 1 , FALSE ); + infoAlloc( gAllInfo[MENU_OWNER], OWNER_COMMENT, OS_OWNERINFO_COMMENT_MAX + 1 , FALSE ); + infoAlloc( gAllInfo[MENU_PARENTAL], PARENTAL_ANSWER, OS_TWL_PCTL_SECRET_ANSWER_LENGTH_MAX + 1 , FALSE ); + infoAlloc( gAllInfo[MENU_SYSMENU], SYSMENU_VERSION_STR, TWL_SYSMENU_VER_STR_LEN + 1, FALSE ); + + OS_TPrintf( "information alloc succeeded\n" ); +#endif +} + + +void infoAlloc( DispInfoEntry *p, u8 index, u8 size, BOOL isSjis ) +// initInfoの作業用関数。isSjis=trueだとcharを、falseならu16を割り当てる +{ + if( isSjis ) + { + p[index].str.sjis = (char*) Alloc (sizeof(char) * size); + SDK_ASSERT( p->str.sjis ); + p[index].str.sjis[size] = '\0'; + } + else + { + p[index].str.utf = (u16*) Alloc (sizeof(u16) * size); + SDK_ASSERT( p->str.utf ); + p[index].str.utf[size-1] = '\0'; + } + +} + + +void getAllInfo( void ) +// +{ + static BOOL firstRead = TRUE; + + OS_TPrintf("reflesh Information\n"); + +#ifndef VERSION_VIEWER + getOwnerInfo(); + getParentalInfo(); + getSecureUserInfo(); + getOtherInfo(); + getHWInfo(); + getSCFGInfo(); + getSysmenuInfo(); + getFontInfo(); + + if( firstRead ){ + getWLInfo(); + getWhiteListInfo(); + } +#endif + +#if NAM_ENABLE + if( firstRead ){ + getContentsVersion(); + } +#endif + + + printAllInfo(); + firstRead = FALSE; + OS_TPrintf("reflesh information finished\n"); +} + + +void displayInfoInit( void ) +{ + int loop1, loop2; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + OS_TPrintf(" size version: %d\n", s_numMenu[MENU_VERSION]); + // 全体情報を持つ配列をセット + // 可能なものは用意したstatic文字列へのポインタで対応 + // 必要なものだけあとでmallocする + for(loop1=0; loop1isNumData ) + { + OS_TPrintf("%d %d : %d\n", loop1, loop2, entry->iValue); + } + else if( entry->isSjis ) + { + OS_TPrintf("%d %d : %s\n", loop1, loop2, entry->str.sjis); + } + else + { + OS_TPrintf("%d %d : %s\n", loop1, loop2, entry->str.utf); + } + + } + } +} + + diff --git a/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.h b/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.h new file mode 100644 index 00000000..33bdef68 --- /dev/null +++ b/build/tests/DisplaySystemInformation/ARM9/src/viewSystemInfo.h @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: viewSystemInfo.h + + Copyright **** 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 __LOAD_VIEW_INFO__ +#define __LOAD_VIEW_INFO__ + +#include +#include "drawFunc.h" +#include "address.h" + +#define DISPINFO_BUFSIZE 64 + +#define MODE_CHANGE_MASK 0x1 +#define MODE_EXECUTE_MASK 0x2 +#define MODE_RESULT_DISPLAY_MASK 0x4 +#define MODE_RESULT_MASK 0x8 +#define MODE_RESULT_SHIFT 3 + +#ifdef __cplusplus +extern "C" { +#endif + +//////////////////////////////// + +typedef enum ChangeFuncArg{ + ARG_BOOL, + ARG_INT, + ARG_OTHER +} ChangeFuncArg; + +typedef struct DispInfoEntry +{ + BOOL isNumData; // 表示するときは数値データか文字列データか + BOOL isSjis; // UTF16で描画するデータだけFALSE isNumData=TRUEなら未定義 + BOOL isAligned; // 一列に表示できるならTRUE、字下げが必要ならFALSE + BOOL fromLCFG; // LCFGから取得したデータは色つけて表示 + int numLines; // 項目名、項目内容を表示するのに必要な行数 + + const char *kind; // 項目名 + + union { + char* sjis; + u16* utf; + } str; + + int iValue; // データの数値型表現(インデクスとか) + + BOOL changable; // その値が変更可能か否か + + // ここから先はchangableがtrueのエントリのみ設定される + ChangeFuncArg argType; // 値を変更するための関数の引数型 + + // 値を変更するための関数 + union { + void (*cBool)(bool); + void (*cInt)(int); + } changeFunc; + + char **kindNameList; // 項目名一覧の先頭へのポインタ + int numKindName; // 項目名一覧の長さ + +} DispInfoEntry; + + +//////////////////////////////// + +// 各種本体、ユーザ情報 +extern DispInfoEntry* gAllInfo[ROOTMENU_SIZE]; + +extern u8 gArm7SCFGReg[DISPINFO_SHARED_SCFG_REG_SIZE]; // ARM7からのデータ取得用バッファ +extern u8 gArm7SCFGShared[DISPINFO_SHARED_SCFG_WRAM_SIZE]; // ARM7からのデータ取得用バッファ + +extern BOOL gLCFGAccessible; +extern u8* gBufLCFG; + +//////////////////////////////// + +void displayInfoMain( void ); +void displayInfoInit( void ); + +//////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif // __LOAD_VIEW_INFO__ diff --git a/build/tests/DisplaySystemInformation/Makefile b/build/tests/DisplaySystemInformation/Makefile new file mode 100644 index 00000000..6c2cd85e --- /dev/null +++ b/build/tests/DisplaySystemInformation/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM7_armadillo ARM7_racoon ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/banner/MakeFooter.txt b/build/tests/DisplaySystemInformation/banner/MakeFooter.txt new file mode 100644 index 00000000..91571e63 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/MakeFooter.txt @@ -0,0 +1,29 @@ +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/MakeHeader.txt b/build/tests/DisplaySystemInformation/banner/MakeHeader.txt new file mode 100644 index 00000000..10cdc670 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/MakeHeader.txt @@ -0,0 +1,18 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + diff --git a/build/tests/DisplaySystemInformation/banner/Makefile b/build/tests/DisplaySystemInformation/banner/Makefile new file mode 100644 index 00000000..bfd869e7 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile @@ -0,0 +1,39 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = \ + Makefile.0B0A Makefile.0B1A Makefile.0B2A Makefile.0B3A \ + Makefile.020A Makefile.021A Makefile.0B4A Makefile.0B5A \ + Makefile.0B6A Makefile.0B7A Makefile.0B8A Makefile.0B9A \ + Makefile.0BAA Makefile.0BBA Makefile.022A Makefile.023A \ + Makefile.024A Makefile.025A + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.020A b/build/tests/DisplaySystemInformation/banner/Makefile.020A new file mode 100644 index 00000000..69b02397 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.020A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 020A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.021A b/build/tests/DisplaySystemInformation/banner/Makefile.021A new file mode 100644 index 00000000..bbc7f3ba --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.021A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 021A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.022A b/build/tests/DisplaySystemInformation/banner/Makefile.022A new file mode 100644 index 00000000..9222801e --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.022A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 022A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.023A b/build/tests/DisplaySystemInformation/banner/Makefile.023A new file mode 100644 index 00000000..adbe8786 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.023A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 023A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.024A b/build/tests/DisplaySystemInformation/banner/Makefile.024A new file mode 100644 index 00000000..80b12300 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.024A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 024A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.025A b/build/tests/DisplaySystemInformation/banner/Makefile.025A new file mode 100644 index 00000000..0d270f76 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.025A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 025A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B0A b/build/tests/DisplaySystemInformation/banner/Makefile.0B0A new file mode 100644 index 00000000..6a1317f5 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B0A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B0A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B1A b/build/tests/DisplaySystemInformation/banner/Makefile.0B1A new file mode 100644 index 00000000..8cd89489 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B1A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B1A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B2A b/build/tests/DisplaySystemInformation/banner/Makefile.0B2A new file mode 100644 index 00000000..7a5328be --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B2A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B2A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B3A b/build/tests/DisplaySystemInformation/banner/Makefile.0B3A new file mode 100644 index 00000000..9840501b --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B3A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B3A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B4A b/build/tests/DisplaySystemInformation/banner/Makefile.0B4A new file mode 100644 index 00000000..d5dc7e7e --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B4A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B4A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B5A b/build/tests/DisplaySystemInformation/banner/Makefile.0B5A new file mode 100644 index 00000000..39dd75c0 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B5A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B5A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B6A b/build/tests/DisplaySystemInformation/banner/Makefile.0B6A new file mode 100644 index 00000000..7ea49c4d --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B6A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B6A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B7A b/build/tests/DisplaySystemInformation/banner/Makefile.0B7A new file mode 100644 index 00000000..29b6af03 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B7A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B7A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B8A b/build/tests/DisplaySystemInformation/banner/Makefile.0B8A new file mode 100644 index 00000000..2792ec15 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B8A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B8A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0B9A b/build/tests/DisplaySystemInformation/banner/Makefile.0B9A new file mode 100644 index 00000000..57f5b803 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0B9A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0B9A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0BAA b/build/tests/DisplaySystemInformation/banner/Makefile.0BAA new file mode 100644 index 00000000..99da9ee9 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0BAA @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0BAA +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/Makefile.0BBA b/build/tests/DisplaySystemInformation/banner/Makefile.0BBA new file mode 100644 index 00000000..f270f2e2 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/Makefile.0BBA @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0BBA +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/DisplaySystemInformation/banner/banner020A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner020A_v3.bsf new file mode 100644 index 00000000..c7a40f7f Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner020A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner021A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner021A_v3.bsf new file mode 100644 index 00000000..69f00f12 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner021A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner022A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner022A_v3.bsf new file mode 100644 index 00000000..01d4f69c Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner022A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner023A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner023A_v3.bsf new file mode 100644 index 00000000..ce71e021 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner023A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner024A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner024A_v3.bsf new file mode 100644 index 00000000..74f6562f Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner024A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner025A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner025A_v3.bsf new file mode 100644 index 00000000..83d5343d Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner025A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B0A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B0A_v3.bsf new file mode 100644 index 00000000..cb327e33 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B0A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B1A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B1A_v3.bsf new file mode 100644 index 00000000..93165d66 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B1A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B2A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B2A_v3.bsf new file mode 100644 index 00000000..42fdbd71 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B2A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B3A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B3A_v3.bsf new file mode 100644 index 00000000..ce03f18c Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B3A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B4A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B4A_v3.bsf new file mode 100644 index 00000000..3a3bf323 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B4A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B5A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B5A_v3.bsf new file mode 100644 index 00000000..5a99c642 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B5A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B6A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B6A_v3.bsf new file mode 100644 index 00000000..df218cb7 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B6A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B7A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B7A_v3.bsf new file mode 100644 index 00000000..73ee7b0e Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B7A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B8A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B8A_v3.bsf new file mode 100644 index 00000000..e3f3f29b Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B8A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0B9A_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0B9A_v3.bsf new file mode 100644 index 00000000..1082fd89 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0B9A_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0BAA_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0BAA_v3.bsf new file mode 100644 index 00000000..eae1319c Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0BAA_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/banner0BBA_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner0BBA_v3.bsf new file mode 100644 index 00000000..e20c3b3b Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner0BBA_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/bannerOption.txt b/build/tests/DisplaySystemInformation/banner/bannerOption.txt new file mode 100644 index 00000000..9da03c6f --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/bannerOption.txt @@ -0,0 +1,19 @@ +#gamecode bannerStr +0B0A DisplayInfo_0 +0B1A DisplayInfo_1 +0B2A DisplayInfo_2 +0B3A DisplayInfo_3 +020A DisplayInfo_4 +021A DisplayInfo_5 +0B4A DisplayInfo_6 +0B5A DisplayInfo_7 +0B6A DisplayInfo_8 +0B7A DisplayInfo_9 +0B8A DisplayInfo_10 +0B9A DisplayInfo_11 +0BAA DisplayInfo_12 +0BBA DisplayInfo_13 +022A DisplayInfo_14 +023A DisplayInfo_15 +024A DisplayInfo_16 +025A DisplayInfo_17 diff --git a/build/tests/DisplaySystemInformation/banner/banner_v3.bsf b/build/tests/DisplaySystemInformation/banner/banner_v3.bsf new file mode 100644 index 00000000..74965f85 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/banner_v3.bsf differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/020A.bmp b/build/tests/DisplaySystemInformation/banner/icon/020A.bmp new file mode 100644 index 00000000..b6545ca6 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/020A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/021A.bmp b/build/tests/DisplaySystemInformation/banner/icon/021A.bmp new file mode 100644 index 00000000..142af23d Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/021A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/022A.bmp b/build/tests/DisplaySystemInformation/banner/icon/022A.bmp new file mode 100644 index 00000000..6a9ad050 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/022A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/023A.bmp b/build/tests/DisplaySystemInformation/banner/icon/023A.bmp new file mode 100644 index 00000000..33ed807f Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/023A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/024A.bmp b/build/tests/DisplaySystemInformation/banner/icon/024A.bmp new file mode 100644 index 00000000..7b135f8b Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/024A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/025A.bmp b/build/tests/DisplaySystemInformation/banner/icon/025A.bmp new file mode 100644 index 00000000..3e036a6d Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/025A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B0A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B0A.bmp new file mode 100644 index 00000000..3c3291e2 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B0A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B1A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B1A.bmp new file mode 100644 index 00000000..25552817 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B1A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B2A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B2A.bmp new file mode 100644 index 00000000..454a960e Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B2A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B3A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B3A.bmp new file mode 100644 index 00000000..fcd2a529 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B3A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B4A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B4A.bmp new file mode 100644 index 00000000..f7224bae Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B4A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B5A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B5A.bmp new file mode 100644 index 00000000..bda8474b Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B5A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B6A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B6A.bmp new file mode 100644 index 00000000..2d92ad53 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B6A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B7A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B7A.bmp new file mode 100644 index 00000000..400f5e2e Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B7A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B8A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B8A.bmp new file mode 100644 index 00000000..b2e14b09 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B8A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0B9A.bmp b/build/tests/DisplaySystemInformation/banner/icon/0B9A.bmp new file mode 100644 index 00000000..342bc36d Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0B9A.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0BAA.bmp b/build/tests/DisplaySystemInformation/banner/icon/0BAA.bmp new file mode 100644 index 00000000..d6c7d062 Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0BAA.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/0BBA.bmp b/build/tests/DisplaySystemInformation/banner/icon/0BBA.bmp new file mode 100644 index 00000000..70f2589d Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/0BBA.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/icon/gameIcon.bmp b/build/tests/DisplaySystemInformation/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..8ec56f1c Binary files /dev/null and b/build/tests/DisplaySystemInformation/banner/icon/gameIcon.bmp differ diff --git a/build/tests/DisplaySystemInformation/banner/makeMaker.rb b/build/tests/DisplaySystemInformation/banner/makeMaker.rb new file mode 100755 index 00000000..d3a74246 --- /dev/null +++ b/build/tests/DisplaySystemInformation/banner/makeMaker.rb @@ -0,0 +1,27 @@ +fFoot = open "MakeFooter.txt" +fHead = open "MakeHeader.txt" + +contentFoot = fFoot.read +contentHead = fHead.read + +fFoot.close +fHead.close + +gamecodeList = ["020A","021A","022A","023A","024A","025A", + "0B0A","0B1A","0B2A","0B3A","0B4A","0B5A", + "0B6A","0B7A","0B8A","0B9A","0BAA","0BBA", + ] +fileNameList = [] + +for gamecode in gamecodeList + + fileName = "Makefile.#{gamecode}" + fileNameList << fileName + f = open( fileName, "w") + f.puts contentHead + f.puts "GAMECODE\t=\t#{gamecode}" + f.puts contentFoot + f.close +end + +print fileNameList diff --git a/build/tests/DisplaySystemInformation/common/include/address.h b/build/tests/DisplaySystemInformation/common/include/address.h new file mode 100644 index 00000000..4eeaf221 --- /dev/null +++ b/build/tests/DisplaySystemInformation/common/include/address.h @@ -0,0 +1,28 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: main.c + + Copyright **** 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 __DISP_INFO_ADDRESS_H__ +#define __DISP_INFO_ADDRESS_H__ + +#include + +#define DISPINFO_SHARED_SCFG_REG_ADDR (void*)0x02fff000 +#define DISPINFO_SHARED_SCFG_REG_SIZE 0x26U +#define DISPINFO_SHARED_SCFG_WRAM_ADDR (void*)0x02fff030 +#define DISPINFO_SHARED_SCFG_WRAM_SIZE 0x06U + +#endif \ No newline at end of file diff --git a/build/tests/ETicketViewer/Makefile b/build/tests/ETicketViewer/Makefile new file mode 100644 index 00000000..09f6d439 --- /dev/null +++ b/build/tests/ETicketViewer/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - ETicketViewer +# File: Makefile +# +# 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: +#---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL + +TARGET_BIN = TicketViwer.srl + +INCDIR = ./include $(ROOT)/build/libraries/os/common/include +SRCDIR = ./src + +SRCS = main.c screen.c font.c common.c + +LLIBRARIES = liblcfg$(TWL_LIBSUFFIX).a \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +# libnamut$(TWL_LIBSUFFIX).a\ + +ROM_SPEC = ./ROM-TS_sys.rsf + +COMPONENT_NAME = armadillo_SYSMENU +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/$(COMPONENT_NAME)/$(TWL_BUILDTYPE_ARM7)/$(COMPONENT_NAME) +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== + + diff --git a/build/tests/ETicketViewer/ROM-TS_sys.rsf b/build/tests/ETicketViewer/ROM-TS_sys.rsf new file mode 100644 index 00000000..42fc65e3 --- /dev/null +++ b/build/tests/ETicketViewer/ROM-TS_sys.rsf @@ -0,0 +1,318 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2008-07-23#$ +# $Rev: 7566 $ +# $Author: yosiokat $ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./resource/rom_header_0tca.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + # PermitLandingNormalJump TRUE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + # PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotA_SSLClientCert: launcher deliver HW AES slot A setting [TRUE/FALSE] + # + #HwAESSlotA_SSLClientCert FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotB for Sign JPEG for Launcher: launcher deliver HW AES slot B setting for Sign JPEG for Launcher [TRUE/FALSE] + # + #HwAESSlotB_SignJPEGForLauncher FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + #Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media GameCard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode 0TCA + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode TRUE + + # + # Shared2 file size: [DISABLE/0-4194304/0K-4096K/0M-4M] + # + #Shared2File0Size Disable + #Shared2File1Size Disable + #Shared2File2Size Disable + #Shared2File3Size Disable + #Shared2File4Size Disable + #Shared2File5Size Disable +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/ETicketViewer/include/common.h b/build/tests/ETicketViewer/include/common.h new file mode 100644 index 00000000..90e2dd88 --- /dev/null +++ b/build/tests/ETicketViewer/include/common.h @@ -0,0 +1,67 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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:: 2008-08-30#$ + $Rev: 8166 $ + $Author: nishimoto_takashi $ + *---------------------------------------------------------------------------*/ +#ifndef COMMON_H_ +#define COMMON_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_START 25 // キーリピート開始までのフレーム数 +#define KEY_REPEAT_SPAN 10 // キーリピートの間隔フレーム数 + +/*---------------------------------------------------------------------------* + 構造体 定義 + *---------------------------------------------------------------------------*/ + +// キー入力情報 +typedef struct KeyInfo +{ + u16 cnt; // 未加工入力値 + u16 trg; // 押しトリガ入力 + u16 up; // 離しトリガ入力 + u16 rep; // 押し維持リピート入力 +} KeyInfo; + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +void InitCommon(void); + +void ReadKey(KeyInfo* pKey); + +void VBlankIntr(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* COMMON_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/include/font.h b/build/tests/ETicketViewer/include/font.h new file mode 100644 index 00000000..d4f23ed2 --- /dev/null +++ b/build/tests/ETicketViewer/include/font.h @@ -0,0 +1,41 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: font.h + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/include/screen.h b/build/tests/ETicketViewer/include/screen.h new file mode 100644 index 00000000..799a2b93 --- /dev/null +++ b/build/tests/ETicketViewer/include/screen.h @@ -0,0 +1,49 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.h + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus + +extern "C" { +#endif + +/*===========================================================================*/ +#include + +/*---------------------------------------------------------------------------* + 関数 定義 + *---------------------------------------------------------------------------*/ +void InitScreen(void); +void ClearScreen(void); +void ClearMainScreen(void); +void ClearSubScreen(void); +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...); +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...); +void UpdateScreen(void); + +/*===========================================================================*/ +#ifdef __cplusplus + +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/src/common.c b/build/tests/ETicketViewer/src/common.c new file mode 100644 index 00000000..c7b9821f --- /dev/null +++ b/build/tests/ETicketViewer/src/common.c @@ -0,0 +1,157 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest + File: common.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:: 2008-08-25#$ + $Rev: 8074 $ + $Author: nishimoto_takashi $ + *---------------------------------------------------------------------------*/ +#include "common.h" + +static void InitInterrupts(void); +static void InitHeap(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitCommon + + Description: 基本的な初期化関数をここで呼ぶ。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitCommon(void) +{ + OS_Init(); + OS_InitTick(); + + OS_InitAlarm(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + CARD_Init(); // 新規追加 + CARD_Enable(TRUE); // 新規追加 + + InitHeap(); + InitInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: ReadKey + + Description: キー入力情報を取得し、入力情報構造体を編集する。 + 押しトリガ、離しトリガ、押し継続リピートトリガ を検出する。 + + Arguments: pKey - 編集するキー入力情報構造体を指定する。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void ReadKey(KeyInfo* pKey) +{ + static u16 repeat_count[12]; + int i; + u16 r; + + r = PAD_Read(); + pKey->trg = 0x0000; + pKey->up = 0x0000; + pKey->rep = 0x0000; + + for (i = 0; i < 12; i++) + { + if (r & (0x0001 << i)) + { + if (!(pKey->cnt & (0x0001 << i))) + { + pKey->trg |= (0x0001 << i); // 押しトリガ + repeat_count[i] = 1; + } + else + { + if (repeat_count[i] > KEY_REPEAT_START) + { + pKey->rep |= (0x0001 << i); // 押し継続リピート + repeat_count[i] = (u16) (KEY_REPEAT_START - KEY_REPEAT_SPAN); + } + else + { + repeat_count[i]++; + } + } + } + else + { + if (pKey->cnt & (0x0001 << i)) + { + pKey->up |= (0x0001 << i); // 離しトリガ + } + } + } + + pKey->cnt = r; // 未加工キー入力 +} + +/*---------------------------------------------------------------------------* + Name: InitInterrupts + + Description: 割り込み設定を初期化する。 + V ブランク割り込みを許可し、割り込みハンドラを設定する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitInterrupts(void) +{ + // V ブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // 割り込み許可 + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitHeap + + Description: メインメモリ上のアリーナにてメモリ割当てシステムを初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitHeap(void) +{ + void* tempLo; + OSHeapHandle hh; + + // メインメモリ上のアリーナにヒープをひとつ作成 + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + // ヒープ作成に失敗した場合は異常終了 + OS_Panic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/src/font.c b/build/tests/ETicketViewer/src/font.c new file mode 100644 index 00000000..ebc10e7b --- /dev/null +++ b/build/tests/ETicketViewer/src/font.c @@ -0,0 +1,585 @@ +/*---------------------------------------------------------------------------* + Project: NitroWiFi - WCM - demos - wcm-list + File: font.c + + Copyright 2005-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. + + $Log: font.c,v $ + Revision 1.2 2006/03/10 09:22:43 kitase_hirotake + INDENT SOURCE + + Revision 1.1 2005/07/21 08:21:06 adachi_hiroaki + 新規追加 + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = +{ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/src/main.c b/build/tests/ETicketViewer/src/main.c new file mode 100644 index 00000000..0ba024c6 --- /dev/null +++ b/build/tests/ETicketViewer/src/main.c @@ -0,0 +1,712 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - appjumpTest - Nand-2 + File: main.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:: 2008-09-03#$ + $Rev: 8251 $ + $Author: nishimoto_takashi $ + *---------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "application_jump_private.h" +#include "common.h" +#include "screen.h" + +#define TITLE_NUM_CUL 18 +#define TITLE_NUM_PAGE (TITLE_NUM_CUL * 2) + +#define NTR_AREA_READ_NUM 7 +#define TWL_AREA_READ_NUM 7 +#define CARD_READ_SIZE 32 +#define CARD_READ_INTERVAL 0x8000 + +#define FLX_AREA_DATA_Y_BASE 4 +#define LTD_AREA_DATA_Y_BASE 13 +#define ETICKET_NUM_MAX 10 + +#define ES_ERR_OK 0 + +// 表示する対象をユーザーアプリだけにする場合 +#define USER_APP_ONLY + +// デバッグ用 +//#define DEBUG_MODE + +/*---------------------------------------------------------------------------* + 変数 定義 + *---------------------------------------------------------------------------*/ +typedef void* (*NAMUTAlloc)(u32 size); +typedef void (*NAMUTFree)(void* ptr); + +static NAMUTAlloc spAllocFunc; +static NAMUTFree spFreeFunc; + +// キー入力 +static KeyInfo gKey; + +// インストールされている NAND アプリの数 +static s32 gNandAppNum; +static s32 gNandInstalledAppNum; +static s32 gNandAllAppNum; + +// カーソル位置 +static s32 gCurPos = 0; + +// eTicketType +typedef enum ETicketType { + ETICKET_TYPE_COMMON = 0, + ETICKET_TYPE_PERSONALIZED = 1 +}ETicketType; + +typedef struct DataStruct +{ + NAMTitleId id; + BOOL commonTicketFlg; + BOOL isSrlFlg; + u32 numTicket; + ETicketType tType[ETICKET_NUM_MAX]; + +} DataStruct; + +typedef struct { + u8 pad1[ 12 ]; + u32 deviceId; + u8 pad2[ 216 - 16 ]; +} ESTicketView; + +typedef s32 ESError; + +extern ESError ES_GetTicketViews(u64 titleId, ESTicketView* ticketViewList, u32* ticketViewCnt); + +static DataStruct gDataList[TITLE_NUM_PAGE * 2]; +static DataStruct gInstalledDataList[TITLE_NUM_PAGE]; + +#ifdef DEBUG_MODE +static MATHRandContext32 context; +#endif + +/*---------------------------------------------------------------------------* + Prototype + *---------------------------------------------------------------------------*/ +static void DrawScene(DataStruct* list); +static BOOL GetDataStruct(DataStruct* list, DataStruct* Ilist); + +static void ConvertTitleIdLo(u8* code, u8* titleid_lo); +static void ConvertGameCode(u8* code, u32 game_code); +static void ConvertInitialCode(u8* code, u32 titleid_lo); + +static void* AllocForNAM(u32 size); +static void FreeForNAM(void* ptr); + +static s32 GetETicketType(DataStruct* data, ETicketType *pETicketType ); +static s32 GetTicketViews(ESTicketView** pptv, u32* pNumTicket, NAMTitleId titleId); + +BOOL GetETicketData( void ); +void* MyNAMUT_Alloc(u32 size); +void MyNAMUT_Free(void* buffer); + +#ifdef USER_APP_ONLY +static void getUserApplication(DataStruct* list); +#endif +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + u32 count = 0; + BOOL errorFlg = FALSE; + + InitCommon(); + InitScreen(); + + GX_DispOn(); + GXS_DispOn(); + + spAllocFunc = AllocForNAM; + spFreeFunc = FreeForNAM; + + gNandAppNum = 0; + gNandInstalledAppNum = 0; + gNandAllAppNum = 0; + + FS_Init( FS_DMA_NOT_USE ); + + NAM_Init(AllocForNAM, FreeForNAM); + + MI_CpuClear8( gDataList, sizeof(gDataList)); + MI_CpuClear8( gInstalledDataList, sizeof(gInstalledDataList)); + +#ifdef DEBUG_MODE + MATH_InitRand32( &context, 15 ); +#endif + + (void) GetETicketData(); + + ClearScreen(); + + while(TRUE) + { + // キー入力情報取得 + ReadKey(&gKey); + + // カーソルの移動 + if (gKey.trg & PAD_KEY_DOWN) + { + gCurPos++; + if ( gCurPos >= ( gNandAllAppNum < TITLE_NUM_PAGE ? gNandAllAppNum : TITLE_NUM_PAGE) ) + { + gCurPos = 0; + } + } + if (gKey.trg & PAD_KEY_UP) + { + if( gNandAllAppNum ) + { + if ( gCurPos == 0 ) + { + if ( gNandAllAppNum < TITLE_NUM_PAGE ) + { + gCurPos = gNandAllAppNum - 1; + } + else + { + gCurPos = TITLE_NUM_PAGE - 1; + } + } + else + { + gCurPos--; + } + } + } + + + // 画面描画 + DrawScene(gDataList); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // 画面クリア + ClearScreen(); + } + + // Vブランク待ち 最後に画面を更新してから終了 + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + +/*---------------------------------------------------------------------------* + Name: DrawScene + + Description: 画面描画関数 + + メモ: + 0xf0, // 黒 0xf1, // 赤 0xf2, // 緑 + 0xf3, // 青 0xf4, // 黄 0xf5, // ピンク + 0xf6, // 水色 0xf7, // くすんだ赤 0xf8, // くすんだ緑 + 0xf9, // くすんだ青 0xfa, // くすんだ黄色 0xfb, // 紫 + 0xfc, // うすい青 0xfd, // 灰色 0xfe, // 濃い灰色 + *---------------------------------------------------------------------------*/ +#define COMMON_COLOR ((u8)0xff) +#define PERSONALIZED_COLOR ((u8)0xfc) + +#define GAME_CODE_BASE_X 1 + +static void DrawScene(DataStruct* list) +{ + s32 i; + u8 init_code[5]; + u8 color; + + DataStruct* p = list; + + // 上画面 一覧表示 + PutMainScreen( 1, 0, 0xf2, "------- eTicket Viewer ------- "); + PutMainScreen( 1, 2, 0xf4, "Game Ticket Ticket"); + PutMainScreen( 1, 3, 0xf4, " Code srl Num Type"); + PutMainScreen( 0, 4, 0xff, "--------------------------------"); + + // カーソル表示 + PutMainScreen( 0, gCurPos+5 , 0xf1, ">"); + + for ( i=0; i < TITLE_NUM_PAGE; i++, p++) + { + // そもそも NAND アプリの数が 1ページにも満たない場合は途中で終了する + if ( i >= gNandAllAppNum ) + { + break; + } + + ConvertInitialCode(init_code, NAM_GetTitleIdLo(p->id)); + + color = p->commonTicketFlg ? COMMON_COLOR : PERSONALIZED_COLOR; + + // ゲームコード表示 + PutMainScreen( GAME_CODE_BASE_X, 5 +i, color, "%s", init_code); + + // srlの有無表示 + if(p->isSrlFlg) + { + PutMainScreen( GAME_CODE_BASE_X + 7, 5 +i, color, "o"); + } + else + { + PutMainScreen( GAME_CODE_BASE_X + 7, 5 +i, color, "x"); + } + + // ETicketの数の表示 + PutMainScreen( GAME_CODE_BASE_X + 12, 5 +i, color, "%d", p->numTicket); + + // ETicketのタイプの表示 + if(p->commonTicketFlg) + { + PutMainScreen(GAME_CODE_BASE_X + 19, 5 +i, color, "common"); + } + else + { + PutMainScreen(GAME_CODE_BASE_X + 19, 5 +i, color, "personalized"); + } + } + + // 下画面 詳細表示 + ConvertInitialCode(init_code, NAM_GetTitleIdLo(list[gCurPos].id)); + PutSubScreen(3, 2, 0xf4, "Selected Title : [ %s ]", init_code); + PutSubScreen(3, 4, 0xff, "- Ticket List -"); + + for( i=0; i < list[gCurPos].numTicket; i++){ + if(i > 15) + { + break; + } + + PutSubScreen(5, 6+i, 0xf4, "Ticket%d : ", (i+1)); + + if(list[gCurPos].tType[i] == ETICKET_TYPE_COMMON) + { + PutSubScreen(15, 6+i, COMMON_COLOR, "COMMON"); + } + else + { + PutSubScreen(15, 6+i, PERSONALIZED_COLOR, "PERSONALIZED"); + } + } +} + + +/*---------------------------------------------------------------------------* + Name: GetDataStruct + + Description: TitleIDリストを取得する関数 + NAM_GetTitleList と NAM_GetInstalledTitleList を使う + *---------------------------------------------------------------------------*/ +static BOOL GetDataStruct(DataStruct* list, DataStruct* Ilist) +{ + // 36個分のタイトルIDリストバッファ + NAMTitleId titleIdList[TITLE_NUM_PAGE]; + s32 i; + + // --- GetTitleList + if ( NAM_GetTitleList(titleIdList, TITLE_NUM_PAGE) != NAM_OK ) + { + OS_PutString("NAM_GetTitleList failed."); + return FALSE; + } + + // データリストの作成(1ページ分) + for ( i=0; i= gNandAppNum ) + { + break; + } + + OS_TPrintf("id : 0x%08x\n", titleIdList[i]); + list->id = titleIdList[i]; + list->isSrlFlg = TRUE; + } + + MI_CpuClear8(titleIdList, sizeof(titleIdList)); + + OS_PutString("\n\n"); + + // --- GetInstalledTitleList + if ( NAM_GetInstalledTitleList(titleIdList, TITLE_NUM_PAGE) != NAM_OK ) + { + OS_PutString("NAM_GetInstalledTitleList failed."); + return FALSE; + } + + // データリストの作成(1ページ分) + for ( i=0; i= gNandInstalledAppNum ) + { + break; + } + + OS_TPrintf("id : 0x%08x\n", titleIdList[i]); + Ilist->id = titleIdList[i]; + Ilist->isSrlFlg = FALSE; + } + + return TRUE; +} + + +/*---------------------------------------------------------------------------* + Name: GetETicketType + + Description: 指定された titleID の eTicket タイプを取得する + + Arguments: titleID: common eTicket かどうかを調べたいタイトルの titleID + pETicketType : 結果を格納するESETicketTypeポインタ + + Returns: NAM_OK : 取得成功 + それ以外: 取得失敗 + *---------------------------------------------------------------------------*/ +static s32 GetETicketType(DataStruct* data, ETicketType *pETicketType ) +{ + s32 result; + ESTicketView* ptv; + u32 numTicket; + +#ifdef DEBUG_MODE + u32 i; +#endif + + *pETicketType = ETICKET_TYPE_PERSONALIZED; + + result = GetTicketViews(&ptv, &numTicket, data->id); + +#ifndef DEBUG_MODE + data->numTicket = numTicket; +#else + data->numTicket = MATH_Rand32( &context, 10 ); +#endif + + if( result == NAM_OK ) + { + if( numTicket > 0 ) + { + int i; + // eTicket は、そのままもしくは追加しかありえないので、プリインストールされたアプリでは、必ずCommon eTikcetが存在する。 + // よって、全ての eTicket のうち、ひとつでも deviceId が 0x00000000 なら、common eTicket と判断。 + for( i = 0; i < numTicket; i++ ) + { + if( ptv[i].deviceId == 0x00000000 ) + { + *pETicketType = ETICKET_TYPE_COMMON; + data->tType[i] = ETICKET_TYPE_COMMON; + } + else + { + data->tType[i] = ETICKET_TYPE_PERSONALIZED; + } + } + } + MyNAMUT_Free(ptv); + } + +#ifdef DEBUG_MODE + for( i=0; inumTicket; i++) + { + if( MATH_Rand32( &context, 10 ) % 5 ) + { + data->tType[i] = ETICKET_TYPE_COMMON; + } + else + { + data->tType[i] = ETICKET_TYPE_PERSONALIZED; + } + } +#endif + + return result; +} + + +/*---------------------------------------------------------------------------* + Name: GetTicketViews + + Description: 指定されたタイトルの eTicket を取得 +        ※nam_title.c の GetTicketViews 関数をコピペ + + Arguments: pptv : 取得成功時に eTicket リストのポインタを格納するポインタ + pNumTicket : 取得成功時に eTicket 数を格納するポインタ + titleID : eTicket を取得したいタイトルの titleID + + Returns: NAM_OK : 取得成功 + それ以外 : 取得失敗 + *---------------------------------------------------------------------------*/ +static s32 GetTicketViews(ESTicketView** pptv, u32* pNumTicket, NAMTitleId titleId) +{ + s32 result; + u32 numTicket; + ESTicketView* ptv = NULL; + + result = ES_GetTicketViews(titleId, NULL, &numTicket); + + if( result != ES_ERR_OK ) + { + return result; + } + + if( numTicket != 0 ) + { + ptv = MyNAMUT_Alloc(sizeof(ESTicketView) * numTicket); + + if( ptv == NULL ) + { + return NAM_NO_MEMORY; + } + + result = ES_GetTicketViews(titleId, ptv, &numTicket); + } + + if( result == ES_ERR_OK ) + { + *pptv = ptv; + *pNumTicket = numTicket; + } + else + { + MyNAMUT_Free(ptv); + } + + return result; +} + + +/*---------------------------------------------------------------------------* + Name: GetETicketData + + Description: 各アプリのETicketデータを取得する + *---------------------------------------------------------------------------*/ +BOOL GetETicketData( void ) +{ + s32 result = TRUE; + s32 i,j; + + // NAND にインポートされているNAND アプリの数を取得する + if ( (gNandAppNum = NAM_GetNumTitles()) < 0) + { + OS_Panic("NAM_GetNumTitles() failed."); + } + // 実体があるタイトル数 + if ( (gNandInstalledAppNum = NAM_GetNumInstalledTitles()) < 0) + { + OS_Panic("NAM_GetNumInstalledTitles() failed."); + } + // 情報の取得 + if ( !GetDataStruct(gDataList, gInstalledDataList) ) + { + OS_Panic("GetDataStruct() failed."); + } + + // NAM_GetTitleList -- 削除されているがeTicketのみ存在するタイトルがリストアップされない + // NAM_GetInstalledTitleList -- SRLはあるがeTicketがないタイトルがリストアップされない + // そのため両者をマージする + gNandAllAppNum = gNandAppNum; + for (i=0; iid & TITLE_ID_APP_TYPE_MASK)) + { + MI_CpuCopy8(p, &buf[count], sizeof(DataStruct)); + count++; + } + } + + // ユーザーアプリだけのリストをコピー + MI_CpuCopy8(buf, list, sizeof(buf)); + + // アプリ総数の更新 + gNandAllAppNum = count; +} +#endif + + +/*---------------------------------------------------------------------------* + UTIL 関数 + *---------------------------------------------------------------------------*/ +static void ConvertTitleIdLo(u8* code, u8* titleid_lo) +{ + u8 tmp[5]; + s32 i; + + for ( i=3; i>=0; i--, titleid_lo++ ) + { + tmp[i] = *titleid_lo; + *code = tmp[i]; + } + + // NULL 終端 + *code = 0x00; +} + +static void ConvertGameCode(u8* code, u32 game_code) +{ + u8 tmp[5]; + s32 i; + + ConvertInitialCode(tmp, game_code); + + for ( i=3; i>=0; i--, code++) + { + *code = tmp[i]; + } + + // NULL 文字終端 + *code = 0x00; +} + +static void ConvertInitialCode(u8* code, u32 titleid_lo) +{ + s32 i; + + for ( i=0; i<4; i++, code++) + { + *code = (u8)(titleid_lo >> (8 * (3-i))); + } + + // NULL文字終端 + *code = 0x00; +} + + +void* MyNAMUT_Alloc(u32 size) +{ + const u32 allocSize = MATH_ROUNDUP32(size); + SDK_ASSERTMSG( spAllocFunc != NULL, "NAMUT_Init should be called previously.\n"); + return spAllocFunc(allocSize); +} + + +static void* AllocForNAM(u32 size) +{ + void* ptr; + ptr = OS_AllocFromMain(size); + + if (ptr == NULL) + { + OS_Panic("alloc failed."); + } + + return ptr; +} + + +void MyNAMUT_Free(void* buffer) +{ + SDK_ASSERTMSG( spFreeFunc != NULL, "NAMUT_Init should be called previously.\n"); + if (buffer) + { + spFreeFunc(buffer); + } +} + + +static void FreeForNAM(void* ptr) +{ + OS_FreeToMain(ptr); +} + + +void VBlankIntr(void) +{ + // テキスト表示を更新 + UpdateScreen(); + + // IRQ チェックフラグ47をセット + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ETicketViewer/src/screen.c b/build/tests/ETicketViewer/src/screen.c new file mode 100644 index 00000000..c00a4a75 --- /dev/null +++ b/build/tests/ETicketViewer/src/screen.c @@ -0,0 +1,194 @@ + /*---------------------------------------------------------------------------* + Project: TwlSDK - WCM - demos - wcm-list-2 + File: screen.c + + Copyright 2007-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:: 2008-09-17#$ + $Rev: 8556 $ + $Author: okubata_ryoma $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" +#include "font.h" + +/*---------------------------------------------------------------------------* + 定数 定義 + *---------------------------------------------------------------------------*/ +#define TEXT_SCREEN_SIZE 2048 + +/*---------------------------------------------------------------------------* + 内部変数 定義 + *---------------------------------------------------------------------------*/ + +// 仮想スクリーン[ 上下画面 ][ BG 枚数 ][ キャラクタ数 ] +static u16 gScreen[2 ][ 1 ][ TEXT_SCREEN_SIZE / sizeof(u16) ] ATTRIBUTE_ALIGN(32); + +/*---------------------------------------------------------------------------* + Name: InitScreen + + Description: 文字表示システムのために、表示設定を初期化する。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void InitScreen(void) +{ + // 各 V-RAM 初期化 + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void*)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + // OAM 初期化 + MI_CpuFillFast((void*)HW_OAM, 0xc0, HW_OAM_SIZE); + MI_CpuFillFast((void*)HW_DB_OAM, 0xc0, HW_DB_OAM_SIZE); + + // パレット初期化 + MI_CpuClearFast((void*)HW_PLTT, HW_PLTT_SIZE); + MI_CpuClearFast((void*)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + // 上画面設定 + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + + GX_SetBankForBG(GX_VRAM_BG_128_A); + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + + // 下画面設定 + GX_SetBankForSubBG(GX_VRAM_SUB_BG_32_H); + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + ((u16*)HW_DB_PLTT)[0] = 0x0000; // black + MI_CpuFillFast(gScreen[1][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: 画面のテキスト表示をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +void ClearMainScreen(void) +{ + MI_CpuClearFast(gScreen[0][0], TEXT_SCREEN_SIZE); + +} +void ClearSubScreen(void) +{ + MI_CpuClearFast(gScreen[1][0], TEXT_SCREEN_SIZE); +} +/*---------------------------------------------------------------------------* + Name: PutMainScreen + + Description: メイン画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutMainScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[0][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: PrintSubScreen + + Description: サブ画面にテキスト出力する。 + + Arguments: text - 出力する文字列。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void PutSubScreen(s32 x, s32 y, u8 palette, char* text, ...) +{ + va_list vlist; + char temp[33]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + for (i = 0; i < 32; i++) + { + if (temp[i] == 0x00) + { + break; + } + + gScreen[1][0][((y * 32) + x + i) % (32 * 32)] = (u16) (palette << 12 | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: UpdateScreen + + Description: 仮想スクリーンを V-RAM に反映する。 + V ブランク期間中での呼び出しを想定。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void UpdateScreen(void) +{ + // 仮想スクリーンを V-RAM に反映 + DC_StoreRange(gScreen[0][0], TEXT_SCREEN_SIZE); + GX_LoadBG0Scr(gScreen[0][0], 0, TEXT_SCREEN_SIZE); + DC_StoreRange(gScreen[1][0], TEXT_SCREEN_SIZE); + GXS_LoadBG0Scr(gScreen[1][0], 0, TEXT_SCREEN_SIZE); +} + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/ErrorLogTest/ARM9/Makefile b/build/tests/ErrorLogTest/ARM9/Makefile new file mode 100644 index 00000000..32b13e36 --- /dev/null +++ b/build/tests/ErrorLogTest/ARM9/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/ErrorLogTest/ARM9/Makefile.0 b/build/tests/ErrorLogTest/ARM9/Makefile.0 new file mode 100644 index 00000000..3ebe7c11 --- /dev/null +++ b/build/tests/ErrorLogTest/ARM9/Makefile.0 @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - ErrorLogTest +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +SUBDIRS = $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/errorLog + +GAMECODE = 0B5A +MEDIA = gamecard +TARGET_BIN = main.srl + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(MEDIA) + +#---------------------------------------------------------------------------- + + + +MISC_DIR = ../../../systemMenu_RED/misc +LINCLUDES += $(MISC_DIR)/include + +SRCS = ErrorLogTest.c $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LLIBRARIES += liberrorlog$(TWL_LIBSUFFIX).a + +ROM_SPEC = main.rsf +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +MAKEROM_FLAGS += -DERRLOGTEST_GAMECODE=$(GAMECODE) \ + -DERRLOGTEST_MEDIA=$(MEDIA) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/ErrorLogTest/ARM9/Makefile.1 b/build/tests/ErrorLogTest/ARM9/Makefile.1 new file mode 100644 index 00000000..5f502fdb --- /dev/null +++ b/build/tests/ErrorLogTest/ARM9/Makefile.1 @@ -0,0 +1,55 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - ErrorLogTest +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +SUBDIRS = $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/errorLog + +GAMECODE = 013A +MEDIA = NAND +TARGET_BIN = main.tad + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(MEDIA) +#---------------------------------------------------------------------------- + + + +MISC_DIR = ../../../systemMenu_RED/misc +LINCLUDES += $(MISC_DIR)/include + +SRCS = ErrorLogTest.c $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LLIBRARIES += liberrorlog$(TWL_LIBSUFFIX).a + +ROM_SPEC = main.rsf +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +MAKEROM_FLAGS += -DERRLOGTEST_GAMECODE=$(GAMECODE) \ + -DERRLOGTEST_MEDIA=$(MEDIA) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/ErrorLogTest/ARM9/main.rsf b/build/tests/ErrorLogTest/ARM9/main.rsf new file mode 100644 index 00000000..8ba5e5dd --- /dev/null +++ b/build/tests/ErrorLogTest/ARM9/main.rsf @@ -0,0 +1,269 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [0 - 255] + # + #AgreeEULAVersion 0 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media $(ERRLOGTEST_MEDIA) + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(ERRLOGTEST_GAMECODE) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + Secure TRUE + AppType System +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} + +Rating +{ + # + # Permited age to play for each rating organization [0 - 31, ALWAYS, FREE] + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / ALWAYS / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/ErrorLogTest/ARM9/src/ErrorLogTest.c b/build/tests/ErrorLogTest/ARM9/src/ErrorLogTest.c new file mode 100644 index 00000000..a3a23892 --- /dev/null +++ b/build/tests/ErrorLogTest/ARM9/src/ErrorLogTest.c @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - ErrorLog + File: errorLog.h + + Copyright **** 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 "misc.h" + +// なぜかバッファサイズが256byteを超えると出力が欠けるようになる +// ダンプを見ると、OS_TPrintf()呼び出し時にもバッファにはちゃんと格納されている模様 +// 原因は現在調査中 +#define BUFSIZE 128 + +void VBlankIntr(void); + + +void TwlMain( void ) +{ + int numEntry; + + OS_Init(); + RTC_Init(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + FS_Init( FS_DMA_NOT_USE ); + InitAllocator(); +// FS_DeleteFile("nand:/sys/log/sysmenu.log"); + + ERRORLOG_Init( Alloc, Free ); + + numEntry = ERRORLOG_GetNum(); + OS_TPrintf("API: before numEntry : %d\n", numEntry ); + ERRORLOG_Write( 0x80000 ); + ERRORLOG_Printf( "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" + "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" + "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" + "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" + "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" + "this is overflow message!\nthis is overflow message!\nthis is overflow message!\n" ); + +/* + ERRORLOG_Write( (u64)0x77700040051LL ); + ERRORLOG_Printf( "%d hyoooo nyoronyoro\naboooon dogaaaaaaaan", 2+5 ); + + + ERRORLOG_Printf( "menuRedIplManager.cpp [l.73] RED FATAL 0" ); + ERRORLOG_Printf( "this is too long long long long long long long long long long long long string.\n" + "this is too long long long long long long long long long long long long string.\n" + "this is too long long long long long long long long long long long long string.\n" + "this is too long long long long long long long long long long long long string.\n" ); + */ + +/* + if( numEntry > 2 ) + { + pEntry = ERRORLOG_Read(1); + OS_TPrintf("entry[1] : %02d-%02d-%02d %02d:%02d:%02d errorCode: %d\n", + pEntry->year, + pEntry->month, + pEntry->day, + pEntry->hour, + pEntry->minute, + pEntry->second, + pEntry->errorCode); + } +*/ + OS_TPrintf( "*** log file data\n" ); + + { + // ログファイルの中身を出力 + FSFile file; + char buf[BUFSIZE+1]; + int numEntry = 0; + int totalSize = 0, nowSize = 0; + buf[BUFSIZE] = '\0'; + + FS_InitFile( &file ); + FS_OpenFileEx( &file, "nand:/sys/log/sysmenu.log", FS_FILEMODE_R ); + + while( ( nowSize = FS_ReadFile( &file, buf, BUFSIZE ) ) == BUFSIZE ) + { + char *p = buf; + + OS_TPrintf("%s",buf); + totalSize += nowSize; + + while( (p = STD_SearchChar(p, '#')) != NULL) + { + // '#'が出てきた回数だけエントリ数を増やす + numEntry++; + p++; + } + + } + + //OS_TPrintf("%s\n",buf); + OS_TPrintf("\n"); + FS_CloseFile( &file ); + + totalSize += nowSize; + + OS_TPrintf("count: \'#\' count : %d\n", numEntry ); + OS_TPrintf("total Size : %d\n", totalSize); + } + + numEntry = ERRORLOG_GetNum(); + OS_TPrintf("API: end numEntry : %d\n", numEntry ); + + + ERRORLOG_End(); + OS_TPrintf( "*** End of demo\n" ); + OS_Terminate(); +} + +void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + diff --git a/build/tests/ErrorLogTest/Makefile b/build/tests/ErrorLogTest/Makefile new file mode 100644 index 00000000..737d6bcd --- /dev/null +++ b/build/tests/ErrorLogTest/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - ErrorLogTest +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +SUBDIRS = ARM9 banner + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/ErrorLogTest/about.txt b/build/tests/ErrorLogTest/about.txt new file mode 100644 index 00000000..ba84c322 --- /dev/null +++ b/build/tests/ErrorLogTest/about.txt @@ -0,0 +1,11 @@ +ErrorLogTest + + +ランチャに組み込まれたErrorLogライブラリのテスト用アプリです。 +実行されるとERRORLOG_Write()を呼び出し、エラーログの書き込みを行ってから +コンソールに現在のログエントリ数やその中身を出力して終了します。 +毎回ログ書き込みを行うため、実行するたびにログエントリの総数は増加しますが、 +ログファイルが16KB固定で作成されているため、古いログは順次削除されていきます。 + +また、直接Write関数を呼んでいるため、FatalErrorを実際に発生させずに +エラーログの生成や書き込みをしたいときに利用することも可能です。 diff --git a/build/tests/ErrorLogTest/banner/Makefile b/build/tests/ErrorLogTest/banner/Makefile new file mode 100644 index 00000000..1f8aa1d4 --- /dev/null +++ b/build/tests/ErrorLogTest/banner/Makefile @@ -0,0 +1,49 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/ErrorLogTest/banner/banner_v3.bsf b/build/tests/ErrorLogTest/banner/banner_v3.bsf new file mode 100644 index 00000000..d45ce7bc Binary files /dev/null and b/build/tests/ErrorLogTest/banner/banner_v3.bsf differ diff --git a/build/tests/ErrorLogTest/banner/icon/gameIcon.bmp b/build/tests/ErrorLogTest/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..af71c8e5 Binary files /dev/null and b/build/tests/ErrorLogTest/banner/icon/gameIcon.bmp differ diff --git a/build/tests/FakeRomHeader/Makefile b/build/tests/FakeRomHeader/Makefile new file mode 100644 index 00000000..892956ee --- /dev/null +++ b/build/tests/FakeRomHeader/Makefile @@ -0,0 +1,99 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: TwlSDK - tools - mastering.TWL +# File: Makefile.TWL +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +TARGET_PLATFORM = TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + + +TARGETS = FakeRomHeader$(SUFFIX).exe + +SOURCES_C = main.c keys.c + +SOURCES = $(SOURCES_C) + +OBJECTS = $(SOURCES:.c=.o) + +INCDIR = $(TWLSDK_ROOT)/build/tools/makerom.TWL \ + $(TWL_IPL_RED_ROOT)/include + +REVISION_H = revision.h + +#INSTALL_DIR = $(FIRM_INSTALL_TOOLSDIR)/bin +#INSTALL_TARGETS = $(TARGETS) + +MACROS += $(addprefix -I,$(INCDIR)) -DPLATFORM_ENDIAN_LITTLE + +LIBACSIGN = $(ROOT)/build/tools/makerom.TWL/acsign/lib/X86/libacsign_x86.a +LIBAES = $(ROOT)/build/tools/makerom.TWL/aes/lib/X86/libaes_x86.a +LIBDIGEST = $(ROOT)/build/tools/makerom.TWL/digest/lib/X86/libdigest_x86.a +#LIBDGT = $(ROOT)/build/tools/libdgt.TWL/lib/libdgt.TWL.a + +ifeq ($(KEY_LAUNCHER),TRUE) +MACROS += -DKEY_LAUNCHER +SUFFIX = .launcher +else +ifeq ($(KEY_SECURE),TRUE) +MACROS += -DKEY_SECURE +SUFFIX = .secure +else +ifeq ($(KEY_SYSTEM),TRUE) +MACROS += -DKEY_SYSTEM +SUFFIX = .sys +else +MACROS += -DKEY_USER +SUFFIX = .user +endif +endif +endif + +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) *.BAK $(REVISION_H) + +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.x86 + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(REVISION_H) $(OBJECTS) $(LIBACSIGN) $(LIBAES) $(LIBDIGEST) + $(CC_X86) $+ -o $@ -lnetapi32 -lwsock32 + +main.o: main.c + +#main.h: + +# avoid to warning message +#misc.o:WARNING += -Wno-format-y2k + +# + +$(REVISION_H) :: + @if test -e $(TWLSDK_ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(TWLSDK_ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|#define SDK_REVISION \"\1\"|" > $(REVISION_H); \ + else \ + echo "#define SDK_REVISION \"-\"" > $(REVISION_H); \ + fi + @if test -e $(TWL_IPL_RED_ROOT)/.svn; then \ + LANG=C svn info $(call empath,$(TWL_IPL_RED_ROOT)) | grep 'Revision' | sed "s|Revision: \(.*\)|#define IPL_REVISION \"\1\"|" >> $(REVISION_H); \ + else \ + echo "#define IPL_REVISION \"-\"" >> $(REVISION_H); \ + fi + +#test: path.c misc.c +# $(CC_X86) -DTEST $+ -o $@ diff --git a/build/tests/FakeRomHeader/README.txt b/build/tests/FakeRomHeader/README.txt new file mode 100644 index 00000000..6a287402 --- /dev/null +++ b/build/tests/FakeRomHeader/README.txt @@ -0,0 +1,35 @@ +ROMヘッダ偽装ツール + +○What? + +・PC用コマンドラインツール +・入出力 + - 入力: SRL + - 出力: SRL + - 両者の違い: 出力SRLには新たなヘッダCRCと署名がついている + (つまり、署名チェックが通る) + +○ビルド方法 + + ふつうに make すると、署名の鍵がユーザアプリ用になります。 + 鍵を変えたいとき、以下のオプションをつけて make してください。 + + make KEY_SYSTEM=TRUE システムアプリ用の鍵が選択される + make KEY_SECURE=TRUE セキュアアプリ用の鍵が選択される + make KEY_LAUNCHER=TRUE ランチャアプリ用の鍵が選択される + +○実行方法 + + ./fakeRomHeader [Option] input_file output_file + + ・オプション + -p: プラットフォームコードを0x01にします。 + -s: 署名有効フラグをOffにします。 + -d: 新・開発用暗号フラグを0にして、旧・開発用暗号フラグを1にします。 + + ・他にもROMヘッダをいじりたいとき + -> バイナリエディタなどでROMヘッダをいじった後に、 + 本ツールをオプションなしで実行すると、 + そのROMヘッダからヘッダCRCと署名を再計算してつけ直します。 + +以上 diff --git a/build/tests/FakeRomHeader/keys.c b/build/tests/FakeRomHeader/keys.c new file mode 100644 index 00000000..67431383 --- /dev/null +++ b/build/tests/FakeRomHeader/keys.c @@ -0,0 +1,243 @@ +// 署名用の鍵データ from makerom.TWL + +#include +#include "keys.h" + +#ifdef KEY_USER +// 開発機用ROMヘッダ署名公開鍵 +const u8 g_devPubKey_DER[ 0xa2 ] = { + 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xAC, 0x93, 0xBB, + 0x3C, 0x15, 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, + 0xD5, 0x79, 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, + 0xCB, 0x94, 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, + 0xF0, 0x11, 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, + 0x7F, 0x11, 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, + 0x96, 0x4F, 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, + 0x62, 0x39, 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, + 0xC9, 0x6F, 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11, 0x02, 0x03, 0x01, + 0x00, 0x01, +}; +// 開発機用アプリROMヘッダ署名秘密鍵 +const u8 g_devPrivKey_DER[ 0x263 ] = { + 0x30, 0x82, 0x02, 0x5F, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xAC, 0x93, 0xBB, 0x3C, 0x15, + 0x5C, 0x5F, 0x25, 0xB0, 0x4C, 0x37, 0xA4, 0x2D, 0x85, 0x29, 0x1D, 0x7A, 0x9D, 0x2D, 0xD5, 0x79, + 0xB5, 0x5D, 0xB1, 0x08, 0x20, 0x9C, 0xF0, 0x4C, 0x56, 0x27, 0x97, 0xF8, 0x7E, 0x3E, 0xCB, 0x94, + 0x06, 0x05, 0x94, 0x00, 0x92, 0x9B, 0xB0, 0x5B, 0x06, 0xF6, 0xAF, 0xAA, 0x9C, 0xA5, 0xF0, 0x11, + 0xA7, 0x8A, 0xCB, 0x0C, 0x11, 0xD6, 0x0C, 0x3D, 0x30, 0xAC, 0x51, 0x79, 0x5A, 0xB5, 0x7F, 0x11, + 0x92, 0x74, 0x48, 0x82, 0x81, 0xBF, 0x3B, 0xFA, 0x93, 0xBF, 0x6B, 0x5B, 0x3F, 0x86, 0x96, 0x4F, + 0xCC, 0x90, 0x12, 0xB2, 0x39, 0x8D, 0x68, 0x16, 0x7B, 0xC6, 0x87, 0xF1, 0xF5, 0x60, 0x62, 0x39, + 0xFB, 0x10, 0x7E, 0x48, 0x7F, 0xDD, 0x82, 0x38, 0x38, 0x76, 0xB5, 0xCE, 0x21, 0x4B, 0xC9, 0x6F, + 0x31, 0x8D, 0x23, 0x57, 0x3D, 0xB6, 0x6C, 0xEE, 0xC2, 0x0D, 0x11, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x02, 0x81, 0x81, 0x00, 0x95, 0xDC, 0xC8, 0x18, 0x19, 0xF8, 0x98, 0x0B, 0x73, 0x78, 0x0C, 0x4D, + 0x7E, 0xD6, 0x06, 0xE9, 0x39, 0x83, 0xEA, 0xBC, 0x59, 0xAF, 0x7C, 0x87, 0xF2, 0x25, 0xD8, 0x02, + 0xF8, 0x57, 0x4C, 0x94, 0xB4, 0xCE, 0x74, 0x9B, 0x76, 0x94, 0x70, 0x1D, 0xA1, 0x0D, 0xAF, 0x33, + 0x4B, 0x28, 0xD5, 0xE9, 0xA0, 0x3F, 0xDD, 0xFD, 0x86, 0x67, 0x36, 0xA8, 0xB2, 0x77, 0x7E, 0xA8, + 0x2C, 0x2E, 0xEB, 0x43, 0x7B, 0xE4, 0xA3, 0x66, 0x7C, 0x3A, 0x00, 0x90, 0xC5, 0xF5, 0xF8, 0x59, + 0xF9, 0x95, 0x88, 0x2A, 0xA8, 0xF4, 0x94, 0x41, 0x05, 0x02, 0xA0, 0x47, 0xC0, 0xC1, 0xB9, 0x80, + 0x1F, 0x49, 0xBB, 0x09, 0xBF, 0x42, 0xBA, 0xE6, 0xEE, 0x8D, 0x21, 0x1D, 0xFB, 0x8F, 0xC7, 0xB7, + 0x71, 0x00, 0xFB, 0x35, 0x13, 0xD8, 0xBC, 0xA3, 0x3F, 0x3A, 0xCF, 0x96, 0xB0, 0x0B, 0x8A, 0x61, + 0x9C, 0x70, 0xF8, 0x91, 0x02, 0x41, 0x00, 0xD8, 0xAA, 0x14, 0x21, 0x49, 0x7A, 0x2C, 0xC3, 0xAA, + 0xDA, 0xFB, 0x17, 0xB0, 0xD7, 0xF5, 0x5A, 0x77, 0xEE, 0xF0, 0xA9, 0x09, 0x18, 0x85, 0x21, 0xD4, + 0x12, 0x4F, 0x85, 0x35, 0x05, 0x20, 0x36, 0x22, 0x65, 0x2C, 0xDD, 0xFA, 0xF5, 0x8E, 0xA5, 0x2E, + 0xC4, 0xFD, 0xD1, 0xFA, 0xC6, 0x8A, 0x0F, 0x98, 0x69, 0xD9, 0x82, 0x50, 0xDF, 0xFA, 0x80, 0xC3, + 0xFE, 0x5E, 0x15, 0x59, 0xA8, 0xD4, 0x05, 0x02, 0x41, 0x00, 0xCB, 0xE8, 0x9A, 0xF2, 0x5F, 0xC1, + 0x75, 0xA5, 0x1E, 0x95, 0xE4, 0x4F, 0x1A, 0x48, 0xA1, 0x75, 0x9A, 0x6E, 0xDB, 0xA2, 0x31, 0xD6, + 0x66, 0x29, 0xEA, 0x19, 0x37, 0x0C, 0xB2, 0x89, 0xD3, 0x03, 0x15, 0xE6, 0x7A, 0x1A, 0xCB, 0xCE, + 0xB9, 0x79, 0x11, 0x9B, 0x71, 0x78, 0xA5, 0xBB, 0x07, 0x6F, 0xA3, 0x05, 0x3B, 0x84, 0x23, 0x47, + 0xAB, 0x20, 0x34, 0x39, 0xB0, 0x59, 0x87, 0xEC, 0xCE, 0x9D, 0x02, 0x41, 0x00, 0xB8, 0xE0, 0x98, + 0x00, 0xB7, 0x64, 0x0B, 0x22, 0x83, 0x7E, 0x0B, 0xD7, 0xF1, 0x4C, 0xB5, 0xCD, 0x96, 0x9D, 0x4A, + 0xB9, 0xD2, 0x4B, 0x1B, 0xFE, 0xFB, 0xA9, 0x0C, 0x35, 0xCC, 0x42, 0x2D, 0x74, 0x43, 0xF1, 0x35, + 0x51, 0xCD, 0x3D, 0x0F, 0x95, 0x1F, 0xCD, 0x74, 0x10, 0x62, 0xFE, 0x5A, 0xFC, 0x67, 0xBF, 0x9A, + 0x9C, 0x3A, 0x4A, 0x84, 0xC4, 0xAF, 0x79, 0x33, 0xEA, 0xDF, 0xF0, 0xD1, 0xC9, 0x02, 0x41, 0x00, + 0xAA, 0x5B, 0x16, 0x00, 0xC2, 0xB1, 0x5D, 0x39, 0x6B, 0x59, 0x2D, 0x5A, 0x4D, 0x0A, 0x3B, 0x22, + 0x86, 0xB8, 0x71, 0x74, 0x8B, 0x90, 0xA4, 0xE0, 0x05, 0xBD, 0xB5, 0x39, 0x3D, 0x7C, 0x5A, 0x37, + 0xAC, 0xB7, 0x56, 0x72, 0x46, 0xAD, 0xDA, 0x54, 0xE4, 0xB9, 0xEA, 0x4E, 0x32, 0xA0, 0x13, 0xF1, + 0x57, 0xD0, 0x4A, 0x4D, 0xF6, 0x2F, 0xAD, 0x2F, 0x85, 0x92, 0x60, 0xDC, 0x1B, 0xEC, 0x63, 0x1D, + 0x02, 0x41, 0x00, 0xAC, 0x40, 0x43, 0xF2, 0x74, 0x2C, 0x56, 0xF4, 0xB9, 0x52, 0xB0, 0xCC, 0x89, + 0xC7, 0x70, 0x33, 0xA9, 0xC0, 0xD3, 0x4E, 0x35, 0xFC, 0x49, 0x69, 0xCB, 0x22, 0x9C, 0x0D, 0xD0, + 0xE1, 0x8F, 0xCC, 0xF4, 0xAD, 0x25, 0xC2, 0xE1, 0x84, 0xD6, 0x34, 0x35, 0x89, 0xFA, 0xC4, 0xBA, + 0x43, 0x34, 0xF4, 0xD2, 0xB2, 0x36, 0x56, 0xB9, 0x96, 0x78, 0x4D, 0x7A, 0xE3, 0x4D, 0xA9, 0x5E, + 0xF5, 0x3E, 0x88, +}; +#endif //#ifdef KEY_USER + +#ifdef KEY_SYSTEM +// 開発用システムアプリ ROMヘッダ署名用公開鍵 +const u8 g_devPubKey_DER[ 0xa2 ] = { + 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE9, 0x9E, 0xA7, + 0x9F, 0x59, 0x4D, 0xF4, 0xA7, 0x60, 0x04, 0xBD, 0x47, 0xF2, 0xB3, 0x64, 0xCD, 0x16, 0x79, 0xC1, + 0x47, 0x39, 0xF6, 0xA9, 0xF8, 0xEE, 0x1A, 0xD0, 0x72, 0xCF, 0x43, 0x97, 0x0C, 0x93, 0xA1, 0x38, + 0x4E, 0x13, 0x40, 0x6C, 0x10, 0x59, 0x43, 0xE2, 0x71, 0x29, 0x54, 0x14, 0x2C, 0xC5, 0xDA, 0x59, + 0x4D, 0xB4, 0x6A, 0xEF, 0x85, 0x61, 0x6F, 0x7F, 0x1C, 0x59, 0x34, 0x2C, 0xC6, 0x24, 0xF3, 0x7B, + 0xC3, 0xB7, 0x40, 0xD1, 0x46, 0xF8, 0x90, 0xB7, 0xC2, 0x98, 0x50, 0xAF, 0x95, 0x52, 0x42, 0xDB, + 0xAC, 0xD6, 0x7E, 0xA9, 0xC3, 0x3D, 0x1B, 0x51, 0x56, 0x07, 0x06, 0xD0, 0x0B, 0x01, 0xBB, 0x58, + 0x93, 0xEA, 0xA0, 0x2C, 0xC7, 0x7D, 0x6A, 0x31, 0x7E, 0xC9, 0xE2, 0xDA, 0xFE, 0x1F, 0x2E, 0x9D, + 0xA7, 0x54, 0x84, 0xDC, 0x28, 0xB9, 0x18, 0xEA, 0x16, 0xF2, 0x95, 0x55, 0x6D, 0x02, 0x03, 0x01, + 0x00, 0x01, +}; + +// 開発用システムアプリ ROMヘッダ署名用秘密鍵 +const u8 g_devPrivKey_DER[ 0x263 ] = { + 0x30, 0x82, 0x02, 0x5E, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xE9, 0x9E, 0xA7, 0x9F, 0x59, + 0x4D, 0xF4, 0xA7, 0x60, 0x04, 0xBD, 0x47, 0xF2, 0xB3, 0x64, 0xCD, 0x16, 0x79, 0xC1, 0x47, 0x39, + 0xF6, 0xA9, 0xF8, 0xEE, 0x1A, 0xD0, 0x72, 0xCF, 0x43, 0x97, 0x0C, 0x93, 0xA1, 0x38, 0x4E, 0x13, + 0x40, 0x6C, 0x10, 0x59, 0x43, 0xE2, 0x71, 0x29, 0x54, 0x14, 0x2C, 0xC5, 0xDA, 0x59, 0x4D, 0xB4, + 0x6A, 0xEF, 0x85, 0x61, 0x6F, 0x7F, 0x1C, 0x59, 0x34, 0x2C, 0xC6, 0x24, 0xF3, 0x7B, 0xC3, 0xB7, + 0x40, 0xD1, 0x46, 0xF8, 0x90, 0xB7, 0xC2, 0x98, 0x50, 0xAF, 0x95, 0x52, 0x42, 0xDB, 0xAC, 0xD6, + 0x7E, 0xA9, 0xC3, 0x3D, 0x1B, 0x51, 0x56, 0x07, 0x06, 0xD0, 0x0B, 0x01, 0xBB, 0x58, 0x93, 0xEA, + 0xA0, 0x2C, 0xC7, 0x7D, 0x6A, 0x31, 0x7E, 0xC9, 0xE2, 0xDA, 0xFE, 0x1F, 0x2E, 0x9D, 0xA7, 0x54, + 0x84, 0xDC, 0x28, 0xB9, 0x18, 0xEA, 0x16, 0xF2, 0x95, 0x55, 0x6D, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x02, 0x81, 0x81, 0x00, 0xCF, 0x67, 0xAA, 0x3B, 0x1F, 0x26, 0xC5, 0x68, 0x7F, 0x27, 0x55, 0xFF, + 0xF5, 0x29, 0x6C, 0xF9, 0x62, 0xD5, 0xCF, 0x50, 0xF3, 0xD5, 0xD8, 0x4B, 0x06, 0xE0, 0xC9, 0x64, + 0xD4, 0x3B, 0x96, 0x73, 0x74, 0xF1, 0x71, 0xB2, 0x67, 0x07, 0x0F, 0xA9, 0x68, 0x06, 0x8B, 0x97, + 0x99, 0x70, 0x6A, 0xC4, 0xE1, 0x16, 0x9B, 0xA8, 0x0F, 0xDF, 0xCC, 0x2B, 0xE7, 0x37, 0xFC, 0x6A, + 0x67, 0x8B, 0x99, 0x9E, 0xD1, 0xDA, 0xCC, 0x68, 0xFC, 0xEB, 0x8D, 0xFE, 0x42, 0x84, 0x72, 0x88, + 0x05, 0xAF, 0x23, 0x32, 0x30, 0x1F, 0xFA, 0xCC, 0x67, 0x52, 0x93, 0x6C, 0xC1, 0x0A, 0xCF, 0xD6, + 0xD3, 0x5F, 0x75, 0xE9, 0x4D, 0x32, 0xC0, 0x31, 0x1B, 0xD4, 0xB5, 0x4B, 0xB4, 0x4E, 0xB0, 0x3E, + 0xD5, 0x6C, 0x3C, 0xDC, 0x57, 0xBB, 0x32, 0x24, 0x41, 0x9C, 0x79, 0xBE, 0xFC, 0xC0, 0x3B, 0x63, + 0x0C, 0x5D, 0xC6, 0xE5, 0x02, 0x41, 0x00, 0xF6, 0x77, 0x12, 0x72, 0x63, 0xD0, 0x9B, 0x22, 0xC6, + 0x4F, 0x19, 0x1E, 0x2A, 0xE1, 0x97, 0xCF, 0x28, 0xD3, 0xC3, 0x5E, 0xFB, 0x22, 0x57, 0xE5, 0x4F, + 0x90, 0x83, 0x53, 0xB0, 0x80, 0xD3, 0x2D, 0xFB, 0x77, 0x55, 0x52, 0x5E, 0x00, 0xD8, 0x72, 0x39, + 0x93, 0xF0, 0x89, 0x83, 0x97, 0xFB, 0x78, 0xD2, 0xB0, 0xCD, 0xED, 0x1C, 0x9B, 0x8F, 0x5D, 0xBD, + 0x00, 0x26, 0x37, 0xA1, 0xE5, 0x38, 0xE7, 0x02, 0x41, 0x00, 0xF2, 0xA8, 0x5D, 0x86, 0xE0, 0x33, + 0xC8, 0x93, 0x5C, 0xB9, 0xBD, 0xCF, 0x27, 0x70, 0x81, 0x79, 0xE1, 0x12, 0x82, 0x09, 0x64, 0xCB, + 0xDB, 0xCF, 0xBB, 0x52, 0xD3, 0x3F, 0x22, 0x90, 0x47, 0x23, 0xAA, 0x20, 0x7D, 0x92, 0xFD, 0xD6, + 0x58, 0x68, 0xF3, 0xB1, 0xFA, 0x7B, 0x81, 0x0D, 0x8F, 0x22, 0xDC, 0x84, 0x08, 0x91, 0x60, 0x07, + 0xE8, 0x98, 0x9A, 0x84, 0xDA, 0x4C, 0x24, 0xC7, 0x10, 0x8B, 0x02, 0x41, 0x00, 0xB3, 0xB0, 0xAA, + 0x75, 0x55, 0xCA, 0x90, 0x60, 0xB1, 0x1E, 0x98, 0x1C, 0x83, 0x7D, 0x08, 0x36, 0x53, 0xF8, 0xD8, + 0x77, 0x16, 0x37, 0xBA, 0xC7, 0x87, 0xD3, 0xBF, 0xBB, 0xB3, 0x72, 0xA9, 0x04, 0xDC, 0x52, 0xEB, + 0x94, 0xEA, 0xCE, 0x49, 0x00, 0x36, 0x74, 0x62, 0xA9, 0x8F, 0x94, 0xAE, 0x16, 0x2F, 0xDE, 0x11, + 0xB4, 0xEE, 0xE7, 0x87, 0x85, 0xFB, 0x36, 0xF1, 0xA6, 0x1B, 0xD5, 0xC8, 0x3F, 0x02, 0x40, 0x73, + 0x18, 0x72, 0xCC, 0x1F, 0x99, 0xD0, 0x40, 0x3D, 0x52, 0x08, 0x7A, 0xB2, 0x5D, 0x45, 0xBC, 0x76, + 0x8A, 0x1D, 0xCD, 0xB0, 0xD6, 0x94, 0xDB, 0x32, 0x21, 0xB5, 0xFB, 0x13, 0x3C, 0xD5, 0xD1, 0x4F, + 0xC7, 0x7B, 0x68, 0x76, 0x27, 0xED, 0xE5, 0x51, 0xF9, 0x90, 0x32, 0x76, 0x62, 0xE5, 0x0A, 0x87, + 0x07, 0xC5, 0x3C, 0x97, 0x0D, 0x09, 0x41, 0x20, 0xC1, 0x74, 0xFD, 0x7A, 0xD0, 0x44, 0xC3, 0x02, + 0x41, 0x00, 0xAF, 0xA3, 0x2C, 0x53, 0x8E, 0x8E, 0xA8, 0xE7, 0x36, 0xC0, 0x5C, 0x9E, 0x95, 0xEE, + 0xC1, 0x97, 0x02, 0x63, 0x7F, 0x3B, 0x4E, 0xB2, 0x0F, 0xF2, 0x7A, 0xBD, 0x57, 0x9C, 0x8B, 0x85, + 0xA8, 0x5D, 0x14, 0x3B, 0x7B, 0xF0, 0xBE, 0xFE, 0x0F, 0x8E, 0x4F, 0xD5, 0xB8, 0x49, 0xE8, 0x90, + 0xF5, 0x12, 0xBF, 0xB2, 0xD6, 0xE2, 0x78, 0x20, 0x26, 0x6C, 0x3F, 0x5C, 0xE4, 0x57, 0x6D, 0xE9, + 0xB4, 0x63, +}; +#endif // #ifdef KEY_SYSTEM + +#ifdef KEY_SECURE +// 開発用ショップアプリ ROMヘッダ署名用公開鍵 +const u8 g_devPubKey_DER[ 0xa2 ] = { + 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xA7, 0x9F, 0x54, + 0xA0, 0xC7, 0x45, 0xAE, 0xF6, 0x63, 0xA7, 0x53, 0xB7, 0x0A, 0xCC, 0x0B, 0xCB, 0x65, 0xE1, 0x11, + 0xC6, 0x05, 0x15, 0xB5, 0x6E, 0xBD, 0xAC, 0x0C, 0xCA, 0xF4, 0x7C, 0x68, 0x7A, 0xF9, 0x0E, 0x5D, + 0x98, 0x5B, 0xC8, 0x4D, 0x22, 0x3B, 0xA3, 0xBE, 0x8B, 0x5B, 0x7F, 0x26, 0x44, 0x9F, 0xC4, 0x48, + 0x44, 0xB1, 0x32, 0xB7, 0xBE, 0x63, 0xBA, 0xD6, 0xC1, 0x10, 0xCE, 0xF6, 0xED, 0x47, 0x8F, 0xE1, + 0xFF, 0x7F, 0x5A, 0xD5, 0x5D, 0x94, 0x38, 0x2F, 0xA1, 0xD4, 0xEF, 0x82, 0xB1, 0x0D, 0xC4, 0x43, + 0xEC, 0xBE, 0x77, 0xB6, 0x82, 0x9C, 0xFA, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, 0xFB, 0xD6, 0x05, + 0xC8, 0x9A, 0x7E, 0xAD, 0x44, 0x40, 0x0D, 0x35, 0x9C, 0x45, 0x44, 0x64, 0x36, 0x61, 0x4B, 0xF7, + 0xE6, 0x31, 0x5C, 0x7D, 0x96, 0x73, 0xE8, 0xAC, 0xB4, 0xE3, 0x5E, 0xD1, 0x9D, 0x02, 0x03, 0x01, + 0x00, 0x01, +}; + +// 開発用ショップアプリ ROMヘッダ署名用秘密鍵 +const u8 g_devPrivKey_DER[ 0x263 ] = { + 0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xA7, 0x9F, 0x54, 0xA0, 0xC7, + 0x45, 0xAE, 0xF6, 0x63, 0xA7, 0x53, 0xB7, 0x0A, 0xCC, 0x0B, 0xCB, 0x65, 0xE1, 0x11, 0xC6, 0x05, + 0x15, 0xB5, 0x6E, 0xBD, 0xAC, 0x0C, 0xCA, 0xF4, 0x7C, 0x68, 0x7A, 0xF9, 0x0E, 0x5D, 0x98, 0x5B, + 0xC8, 0x4D, 0x22, 0x3B, 0xA3, 0xBE, 0x8B, 0x5B, 0x7F, 0x26, 0x44, 0x9F, 0xC4, 0x48, 0x44, 0xB1, + 0x32, 0xB7, 0xBE, 0x63, 0xBA, 0xD6, 0xC1, 0x10, 0xCE, 0xF6, 0xED, 0x47, 0x8F, 0xE1, 0xFF, 0x7F, + 0x5A, 0xD5, 0x5D, 0x94, 0x38, 0x2F, 0xA1, 0xD4, 0xEF, 0x82, 0xB1, 0x0D, 0xC4, 0x43, 0xEC, 0xBE, + 0x77, 0xB6, 0x82, 0x9C, 0xFA, 0x17, 0x87, 0x84, 0x82, 0x25, 0x46, 0xFB, 0xD6, 0x05, 0xC8, 0x9A, + 0x7E, 0xAD, 0x44, 0x40, 0x0D, 0x35, 0x9C, 0x45, 0x44, 0x64, 0x36, 0x61, 0x4B, 0xF7, 0xE6, 0x31, + 0x5C, 0x7D, 0x96, 0x73, 0xE8, 0xAC, 0xB4, 0xE3, 0x5E, 0xD1, 0x9D, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x02, 0x81, 0x80, 0x48, 0xCA, 0x9C, 0x49, 0xA5, 0xBF, 0xD1, 0x17, 0x16, 0x77, 0x97, 0x97, 0x29, + 0x8D, 0x2A, 0xA2, 0x0D, 0x80, 0x0B, 0xE3, 0xDE, 0x59, 0x6B, 0x0C, 0xC8, 0x39, 0x6A, 0xE4, 0xC7, + 0xFF, 0x2E, 0xB0, 0x18, 0x6F, 0xF0, 0x9D, 0x35, 0x5E, 0x6A, 0x80, 0xAF, 0x3D, 0x90, 0x85, 0x9C, + 0x1A, 0x3F, 0x58, 0x15, 0xB9, 0x7B, 0x58, 0xB9, 0x4A, 0xB9, 0x18, 0x68, 0xDE, 0xBE, 0x5B, 0xE1, + 0x1C, 0xBF, 0x85, 0xDF, 0x5F, 0x30, 0xFD, 0xD2, 0xEC, 0xC0, 0x77, 0x33, 0x62, 0x58, 0xEC, 0xC1, + 0x47, 0xF7, 0x41, 0xE8, 0x2B, 0x21, 0x83, 0xE0, 0x8E, 0xE0, 0xF4, 0x03, 0x5D, 0x07, 0x84, 0x91, + 0xFA, 0x5B, 0xD8, 0xD3, 0x47, 0x90, 0x6E, 0x7D, 0x81, 0x9C, 0x1A, 0xB3, 0x03, 0x2F, 0xBC, 0x1A, + 0x28, 0x01, 0xBB, 0x78, 0x33, 0x60, 0xD2, 0x32, 0x34, 0x09, 0xEE, 0x08, 0x35, 0x50, 0x7A, 0x02, + 0x77, 0xB9, 0x01, 0x02, 0x41, 0x00, 0xCF, 0x39, 0xB3, 0x95, 0xDB, 0x1A, 0x2C, 0xD5, 0x6B, 0x0E, + 0xD8, 0x7B, 0xEC, 0x36, 0x14, 0xC5, 0x6C, 0x6C, 0x03, 0x34, 0xCB, 0x8A, 0x03, 0xF0, 0x94, 0x9C, + 0x2E, 0xBB, 0xA4, 0x24, 0x85, 0x6F, 0x3C, 0x8B, 0xAD, 0x44, 0x88, 0xA1, 0xDC, 0x88, 0xFE, 0xE7, + 0x02, 0x24, 0xB3, 0x73, 0xEA, 0xD1, 0xF6, 0x61, 0x6A, 0x73, 0x00, 0x86, 0x0B, 0x67, 0xAB, 0x00, + 0xFB, 0xF7, 0xFD, 0x0D, 0x92, 0x91, 0x02, 0x41, 0x00, 0xCF, 0x13, 0x5C, 0xD1, 0x72, 0x12, 0xA5, + 0x1D, 0x3A, 0x86, 0xAB, 0xAC, 0x87, 0x11, 0x37, 0x6D, 0xEB, 0x90, 0x14, 0x41, 0x7B, 0xAA, 0x38, + 0x88, 0xFF, 0xAF, 0xAA, 0xAE, 0x12, 0x3E, 0x7C, 0x28, 0x59, 0xDB, 0xBE, 0xAE, 0x79, 0x20, 0x0C, + 0x4F, 0xE5, 0xAB, 0x97, 0x64, 0x0D, 0x1E, 0x31, 0x54, 0x10, 0xB0, 0x1C, 0x7E, 0x5A, 0x7B, 0x98, + 0x32, 0x00, 0xF7, 0xE0, 0x18, 0x15, 0x53, 0xFC, 0x4D, 0x02, 0x41, 0x00, 0x90, 0x5F, 0x38, 0x01, + 0xD0, 0x9B, 0x44, 0xDF, 0x0F, 0x6E, 0x51, 0x5E, 0xCC, 0xEB, 0xC4, 0xBE, 0xE2, 0xD1, 0xC1, 0xCE, + 0x17, 0x7C, 0x39, 0x50, 0x74, 0x88, 0xF7, 0x7A, 0x1D, 0x5A, 0xA0, 0x68, 0x26, 0x3B, 0x7D, 0xE4, + 0xC0, 0x78, 0x5C, 0x68, 0x49, 0x86, 0xF2, 0x14, 0x55, 0xBE, 0x0D, 0xBC, 0x68, 0x35, 0xE8, 0x6E, + 0xE4, 0xCF, 0x7E, 0xC4, 0xA3, 0xFB, 0xD4, 0x90, 0x2A, 0x8A, 0x39, 0x31, 0x02, 0x41, 0x00, 0x93, + 0x88, 0xE3, 0x17, 0xA2, 0xA3, 0xA0, 0x1A, 0x4C, 0x09, 0x89, 0x24, 0xD9, 0xF2, 0xAD, 0x40, 0x56, + 0x96, 0x07, 0xA8, 0x84, 0x18, 0x4A, 0x41, 0x69, 0x92, 0x5A, 0x13, 0xBD, 0x91, 0xE1, 0x59, 0xCA, + 0x73, 0xE2, 0xCE, 0x62, 0x24, 0x30, 0x41, 0x78, 0x8C, 0x21, 0xC7, 0xBA, 0x04, 0xE9, 0xF6, 0x50, + 0x11, 0x79, 0xAB, 0x98, 0x81, 0xF8, 0x74, 0x9F, 0xF5, 0xFB, 0x26, 0x8D, 0x83, 0x91, 0xFD, 0x02, + 0x40, 0x4D, 0xA4, 0x03, 0x7E, 0x00, 0xB6, 0xA2, 0xEE, 0x85, 0x19, 0x5C, 0xB3, 0xBE, 0x06, 0x48, + 0xF7, 0xA8, 0x27, 0xB3, 0xC9, 0xED, 0x60, 0xE1, 0x56, 0x0A, 0x3F, 0x8D, 0x64, 0x56, 0xBA, 0x2E, + 0xC3, 0xF6, 0x2D, 0x95, 0x38, 0x87, 0x58, 0xD6, 0x95, 0xF7, 0xA6, 0xD6, 0xEE, 0x85, 0x7D, 0xD7, + 0x93, 0x80, 0xF5, 0x1D, 0xBF, 0x5F, 0x3E, 0x3A, 0x22, 0x29, 0x18, 0xE5, 0x95, 0x73, 0x0D, 0xEA, + 0x42, +}; +#endif // #ifdef KEY_SECURE + +#ifdef KEY_LAUNCHER +// 開発用システムアプリ ROMヘッダ署名用公開鍵 +const u8 g_devPubKey_DER[ 0xa2 ] = { + 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, + 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xBC, 0xFD, 0xA1, + 0xFF, 0x1F, 0x66, 0xDF, 0xEC, 0xB4, 0x69, 0xF8, 0xF7, 0x43, 0x0C, 0x5D, 0x0F, 0x00, 0xD7, 0x20, + 0x49, 0x42, 0x06, 0x03, 0x29, 0x85, 0x0B, 0x99, 0x59, 0x61, 0x98, 0x70, 0x6E, 0xFF, 0xF6, 0xB4, + 0x70, 0x66, 0xF0, 0xDD, 0x8F, 0xDC, 0xE9, 0xF2, 0x0D, 0xD0, 0x21, 0x1D, 0x77, 0xB8, 0x9C, 0x51, + 0x87, 0xC0, 0xB1, 0x33, 0xAB, 0x13, 0x96, 0x0B, 0x47, 0xB8, 0x42, 0x4A, 0x0D, 0xC3, 0x77, 0xE1, + 0x87, 0xB1, 0x6B, 0x24, 0x31, 0x10, 0x8A, 0x47, 0xF2, 0x32, 0xF4, 0xC9, 0x78, 0x25, 0x13, 0xD4, + 0x80, 0x10, 0x05, 0x52, 0xC3, 0xE7, 0x50, 0x7B, 0x29, 0x49, 0xCE, 0x93, 0xD9, 0x8F, 0x2A, 0xB5, + 0x4D, 0xD1, 0xC1, 0x91, 0xD8, 0x07, 0x16, 0x10, 0x15, 0xFF, 0xD6, 0x84, 0x8F, 0x54, 0x3D, 0x91, + 0x5B, 0x37, 0x45, 0x48, 0xE4, 0x6B, 0x62, 0xD2, 0x11, 0x9B, 0x0D, 0x71, 0x69, 0x02, 0x03, 0x01, + 0x00, 0x01, +}; + +// 開発用システムアプリ ROMヘッダ署名用秘密鍵 +const u8 g_devPrivKey_DER[ 0x263 ] = { + 0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xBC, 0xFD, 0xA1, 0xFF, 0x1F, + 0x66, 0xDF, 0xEC, 0xB4, 0x69, 0xF8, 0xF7, 0x43, 0x0C, 0x5D, 0x0F, 0x00, 0xD7, 0x20, 0x49, 0x42, + 0x06, 0x03, 0x29, 0x85, 0x0B, 0x99, 0x59, 0x61, 0x98, 0x70, 0x6E, 0xFF, 0xF6, 0xB4, 0x70, 0x66, + 0xF0, 0xDD, 0x8F, 0xDC, 0xE9, 0xF2, 0x0D, 0xD0, 0x21, 0x1D, 0x77, 0xB8, 0x9C, 0x51, 0x87, 0xC0, + 0xB1, 0x33, 0xAB, 0x13, 0x96, 0x0B, 0x47, 0xB8, 0x42, 0x4A, 0x0D, 0xC3, 0x77, 0xE1, 0x87, 0xB1, + 0x6B, 0x24, 0x31, 0x10, 0x8A, 0x47, 0xF2, 0x32, 0xF4, 0xC9, 0x78, 0x25, 0x13, 0xD4, 0x80, 0x10, + 0x05, 0x52, 0xC3, 0xE7, 0x50, 0x7B, 0x29, 0x49, 0xCE, 0x93, 0xD9, 0x8F, 0x2A, 0xB5, 0x4D, 0xD1, + 0xC1, 0x91, 0xD8, 0x07, 0x16, 0x10, 0x15, 0xFF, 0xD6, 0x84, 0x8F, 0x54, 0x3D, 0x91, 0x5B, 0x37, + 0x45, 0x48, 0xE4, 0x6B, 0x62, 0xD2, 0x11, 0x9B, 0x0D, 0x71, 0x69, 0x02, 0x03, 0x01, 0x00, 0x01, + 0x02, 0x81, 0x80, 0x16, 0x65, 0xDC, 0xC8, 0x16, 0x99, 0xA3, 0x9A, 0x32, 0xFB, 0x88, 0x35, 0x0D, + 0xAE, 0x2E, 0x6D, 0x33, 0xC5, 0x4B, 0x1F, 0x43, 0x82, 0xE0, 0xE7, 0x0F, 0xCC, 0x83, 0x1D, 0x13, + 0xB2, 0xF4, 0x48, 0x43, 0x6F, 0xA2, 0x8C, 0xDB, 0xB6, 0x5A, 0x1B, 0xCD, 0xAB, 0xB0, 0x33, 0x30, + 0xE2, 0x6B, 0xD2, 0x9F, 0x7F, 0x6F, 0x2E, 0x2E, 0x89, 0x11, 0xBD, 0x89, 0xB1, 0xB3, 0x9E, 0x89, + 0x58, 0xD9, 0xDB, 0xB9, 0x91, 0x00, 0xDA, 0x17, 0xA9, 0x14, 0xC3, 0x83, 0xFF, 0xFF, 0x46, 0x0F, + 0x5F, 0x81, 0x1B, 0x5B, 0x02, 0xD2, 0x29, 0xEF, 0x48, 0xB7, 0xDF, 0x8C, 0x34, 0xED, 0xA2, 0xEC, + 0xC0, 0x79, 0x50, 0xC6, 0xAD, 0x0B, 0x98, 0x28, 0xC2, 0x17, 0x80, 0x96, 0x67, 0x3A, 0x22, 0xD7, + 0x60, 0x61, 0x98, 0xF6, 0xAB, 0x10, 0x1E, 0xE6, 0x23, 0x06, 0x4B, 0x61, 0xAF, 0xFE, 0xD5, 0xAF, + 0xB8, 0x3D, 0x81, 0x02, 0x41, 0x00, 0xE2, 0x82, 0xC3, 0x83, 0x2A, 0xEF, 0xA0, 0x86, 0x15, 0xFD, + 0x80, 0x23, 0x2B, 0x1C, 0x80, 0x0C, 0xF7, 0xA0, 0xA3, 0x53, 0x2B, 0xAD, 0xF9, 0xF6, 0xF7, 0xA3, + 0x7E, 0x1A, 0x5E, 0xE7, 0x18, 0x6D, 0xF3, 0xD6, 0xDE, 0x68, 0xBB, 0x4A, 0x54, 0xAF, 0xDF, 0xA5, + 0xEC, 0xA7, 0x62, 0xBB, 0xCB, 0x7A, 0xDE, 0x3F, 0xFB, 0x9A, 0x99, 0x2A, 0xF7, 0x2D, 0x23, 0x98, + 0x9A, 0x9F, 0xCE, 0xFB, 0x67, 0xB1, 0x02, 0x41, 0x00, 0xD5, 0x98, 0x63, 0x19, 0x3D, 0x80, 0xDF, + 0x71, 0x13, 0x6A, 0xF4, 0x5E, 0x62, 0x99, 0x16, 0x34, 0x18, 0xF9, 0xDC, 0x58, 0x2F, 0xC3, 0xD8, + 0x8B, 0x68, 0xC1, 0x43, 0x98, 0xF0, 0xEC, 0x39, 0xE3, 0x40, 0x6E, 0x08, 0x9F, 0xED, 0x17, 0xBE, + 0xCC, 0x87, 0x4A, 0xAD, 0x99, 0x15, 0x09, 0xD0, 0xBB, 0xDB, 0x13, 0xF0, 0x53, 0xDF, 0xCB, 0x66, + 0x1A, 0xD1, 0xF2, 0x14, 0xB7, 0x17, 0xFA, 0xCB, 0x39, 0x02, 0x41, 0x00, 0xD8, 0xA2, 0x05, 0x89, + 0x32, 0x8C, 0x41, 0xB3, 0x5B, 0xDE, 0xBA, 0x29, 0x68, 0x76, 0xF6, 0x84, 0xF0, 0x64, 0x23, 0x30, + 0x4D, 0x4B, 0x34, 0x11, 0x1E, 0x60, 0xB0, 0x1F, 0x5A, 0x7A, 0x9C, 0xE3, 0xB3, 0xDC, 0xE1, 0x93, + 0xBA, 0xE4, 0x69, 0x40, 0x57, 0x9E, 0xA2, 0x4A, 0xA8, 0x64, 0x41, 0x44, 0xBE, 0xC0, 0xE4, 0xCA, + 0xC4, 0x08, 0xD2, 0xA3, 0xCA, 0x32, 0x8E, 0x57, 0x9F, 0x26, 0xD4, 0xD1, 0x02, 0x41, 0x00, 0x9B, + 0xD5, 0x50, 0x07, 0xAC, 0x2D, 0x87, 0xD7, 0x71, 0xB9, 0x48, 0x8C, 0x4C, 0x17, 0x30, 0x71, 0xD5, + 0xFF, 0x05, 0x59, 0x79, 0x8F, 0xC3, 0x3F, 0x02, 0xB0, 0x6D, 0xE6, 0xF9, 0x6E, 0xFF, 0x54, 0xE3, + 0x3E, 0xE4, 0x1F, 0xF9, 0xD4, 0xA7, 0x29, 0x85, 0x53, 0x60, 0x90, 0x1D, 0x1F, 0x4A, 0x20, 0xA4, + 0x57, 0x49, 0xB1, 0x87, 0xC7, 0x57, 0xB9, 0x1D, 0x8F, 0x26, 0xB9, 0xE6, 0x4E, 0xDD, 0x51, 0x02, + 0x40, 0x4F, 0xE6, 0xC8, 0x11, 0x14, 0xA2, 0xF9, 0xC3, 0xD1, 0x7B, 0x74, 0x48, 0x8F, 0x33, 0xB4, + 0xF6, 0xFF, 0xEE, 0xDC, 0x4E, 0x34, 0xF9, 0x66, 0xB8, 0x25, 0x3A, 0x05, 0xF5, 0x29, 0x1B, 0x12, + 0x61, 0x6C, 0xCD, 0xF1, 0x0D, 0xE6, 0x68, 0xED, 0x81, 0x44, 0x96, 0x07, 0x5A, 0x43, 0x72, 0x93, + 0xDC, 0xEE, 0xD7, 0x81, 0x82, 0x22, 0x5E, 0x07, 0x15, 0x02, 0xA5, 0xE9, 0x54, 0x59, 0x86, 0x03, + 0x02, +}; +#endif // #ifdef KEY_LAUNCHER diff --git a/build/tests/FakeRomHeader/keys.h b/build/tests/FakeRomHeader/keys.h new file mode 100644 index 00000000..349ae8e4 --- /dev/null +++ b/build/tests/FakeRomHeader/keys.h @@ -0,0 +1,14 @@ +// 署名用の鍵データの宣言 + +#include + +// 鍵の種類 +//#define KEY_USER +//#define KEY_SYSTEM +//#define KEY_SECURE +//#define KEY_LAUNCHER + +// 開発機用ROMヘッダ署名鍵 +extern const u8 g_devPubKey_DER[ 0xa2 ]; +extern const u8 g_devPrivKey_DER[ 0x263 ]; + diff --git a/build/tests/FakeRomHeader/main.c b/build/tests/FakeRomHeader/main.c new file mode 100644 index 00000000..d09d497f --- /dev/null +++ b/build/tests/FakeRomHeader/main.c @@ -0,0 +1,533 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirmware - tools - mastering + File: mastering.c + + Copyright 2003 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 // strcasecmp() +#include // getopt() +#include // stat() +#include +#include +#include +#include +#include +#include "revision.h" +#include "keys.h" + +#define CARD_LATENCY_MASK 0x083f1fff +#define CARD_MROM_GAME_LATENCY 0x00010017 +#define CARD_MROM_SECURE_HW_LATENCY 0x001808f8 +#define CARD_MROM_SECURE_SW_LATENCY 0x051e +#define CARD_1TROM_GAME_LATENCY 0x00010657 +#define CARD_1TROM_SECURE_HW_LATENCY 0x081808f8 +#define CARD_1TROM_SECURE_SW_LATENCY 0x0d7e + + +/*---------------------------------------------------------------------------* + + + 宣言 & 定数 + + + *---------------------------------------------------------------------------*/ + +// -- 内部パラメータ + +// CRC (makerom.TWL/misc.cとmakerom.TWL/format_rom_private.hからコピペ) +#define CRC16_INIT_VALUE (0xffff) +#define CALC_CRC16_SIZE (0x15e) + +// ファイルコピー用バッファ +#define BUFSIZE (16*1024) +static u8 buf[ BUFSIZE ]; + +// -- Context + +typedef struct _SContext +{ + // オプション + BOOL bPlatform; + BOOL bSignFlag; + BOOL bDevFlag; + BOOL bVerFlag; + BOOL bDebugger; + BOOL bCheckCard; + int verNum; + BOOL bMROM; + BOOL bNTR; + + FILE *ifp; + FILE *ofp; +} +SContext; + +// -- internal function +static BOOL iMain( SContext *pContext ); +u16 CalcCRC16(u16 start, u8 *data, int size); +BOOL SignRomHeader( ROM_Header *prh ); +static void SetRomSpeedByIndex(ROM_Header * header, tRomSpeedType idx); + +/*---------------------------------------------------------------------------* + + + グローバル変数 + + + *---------------------------------------------------------------------------*/ + +BOOL DebugMode = FALSE; + +/*---------------------------------------------------------------------------* + + + おおもとの本体 + + + *---------------------------------------------------------------------------*/ + +void usage() +{ + printf( "-----------------------------------------------------------------------------\n" ); + printf( "Usage: fakeRomHeader.exe input_file output_file\n" ); + printf( " input_file : a ROM data file (generated by makerom.TWL).\n" ); + printf( " output_file : a destination file.\n" ); + printf( "\nOption:\n" ); + printf( "-h : print help only.\n" ); + printf( "-p : write invalid platform code in a ROM Header.\n" ); + printf( "-s : negate flag for the signature in a ROM Header.\n" ); + printf( "-d : negate a new developer encrypt flag, and assert an old one.\n" ); + printf( "-v NUM: change ROM version in a ROM Header.\n" ); + printf( "-m : [Only NTR limited ROM] Rom speed type replace 1TROM from MROM.\n" ); + printf( "-D : assert a disable flag of debugger alalysis.\n" ); + printf( "-c : assert a check(inspection) card flag.\n" ); + printf( "-N : skip sign [using for NTR limited ROM]" ); + printf( "-f : force to overwrite a output_file.\n" ); + printf( "-----------------------------------------------------------------------------\n" ); +} + +int main(int argc, char *argv[]) +{ + SContext context; + char *pSrc, *pDst; + int opt; + extern char *optarg; + extern int optind, opterr; + struct stat st; + BOOL bResult; + BOOL bForceOverwrite = FALSE; + + printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" ); + printf( " fakeRomHeader [%s-%s]\n", SDK_REVISION, IPL_REVISION ); + printf( "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" ); + + // context の初期化 + memset( &context, 0, sizeof(SContext) ); + + // オプション + while( (opt = getopt(argc, argv, "hpsdmv:DcfN")) >= 0 ) + { + switch( opt ) + { + case 'h': + usage(); + return 0; + break; + + case 'p': + context.bPlatform = TRUE; + break; + + case 's': + context.bSignFlag = TRUE; + break; + + case 'd': + context.bDevFlag = TRUE; + break; + + case 'v': + context.bVerFlag = TRUE; + context.verNum = atoi(optarg); + break; + + case 'm': + context.bMROM = TRUE; + break; + + case 'D': + context.bDebugger = TRUE; + break; + + case 'c': + context.bCheckCard = TRUE; + break; + + case 'N': + context.bNTR = TRUE; + break; + + case 'f': + bForceOverwrite = TRUE; + break; + + default: // オプション引数が指定されていないときにも実行される + usage(); + fprintf( stdout, "error: illegal option\n" ); + exit(1); + break; + } + } + argc = argc - optind; + argv = argv + optind; + + // 引数処理 + if( argc != 2 ) + { + usage(); + printf( "error arguments\n" ); + exit(1); + } + else + { + pSrc = argv[0]; + pDst = argv[1]; + } + + printf( "input_file: %s\n", pSrc ); + printf( "output_file: %s\n", pDst ); + printf( "\n" ); + + // 入力ファイルと出力ファイル名が同じならダメ + if( (strlen(pSrc) == strlen(pDst)) && (memcmp(pSrc, pDst, strlen(pSrc)) == 0) ) + { + printf( "The name of output_file must be different from the one of input_file\n" ); + exit(1); + } + + // 出力ファイルが存在するとき上書きするかどうかを確認する + if( !bForceOverwrite && stat( pDst, &st )==0 ) + { + char ans; + printf( "The %s already exists. Overwrite it? (y or n) ", pDst ); + //fscanf( stdin, "%c", &ans ); + ans = (char)getch(); // リターンキーなし + printf( "%c\n", ans ); // getch では入力が表示されないので自分で表示する必要あり + printf( "\n" ); + if( !(ans=='y') && !(ans=='Y') ) + { + printf( "mastering is aborted.\n" ); + exit(1); + } + } + + // ファイルを開く + context.ifp = fopen(pSrc, "rb"); + context.ofp = fopen(pDst, "wb+"); + if( !(context.ifp) || !(context.ofp) ) + { + printf( "fopen failed.\n" ); + bResult = FALSE; + goto FINALIZE; + } + + // 本処理 + bResult = iMain( &context ); + +// 終了処理 +FINALIZE: + + if( !bResult ) + { + printf( "\n" ); + printf( "error.\n" ); + } + else + { + printf( "\n" ); + printf( "succeeded.\n" ); + } + if( context.ifp ) fclose(context.ifp); // 資源の解放 + if( context.ofp ) fclose(context.ofp); + + if( (!bResult) && (stat( pDst, &st ) == 0) ) + { + unlink( pDst ); // 出力ファイルを削除する + } + return 0; +} + +/*---------------------------------------------------------------------------* + + ROMヘッダの偽装 + + *---------------------------------------------------------------------------*/ + +static BOOL iMain( SContext *pContext ) +{ + ROM_Header rh; + int size; + + // ROMヘッダをリード + fseek( pContext->ifp, 0, SEEK_SET ); + if( sizeof(ROM_Header) != fread( &rh, 1, sizeof(ROM_Header), pContext->ifp ) ) + { + printf( "fread failed in reading ROM Header\n" ); + return FALSE; + } + + // ROMヘッダをいじる + { + if( pContext->bPlatform ) + { + printf( "platform_code: 0x%02x -> 0x01\n", rh.s.platform_code ); + rh.s.platform_code = 0x01; + } + + if( pContext->bSignFlag ) + { + printf( "enable_signature: 0x%02x -> 0x00\n", rh.s.enable_signature ); + rh.s.enable_signature = 0x0; + } + + if( pContext->bDevFlag ) + { + printf( "old dev. encrypt: 0x%02x -> 0x01x\n", rh.s.developer_encrypt_old ); + printf( "new dev. encrypt: 0x%02x -> 0x00x\n", rh.s.exFlags.developer_encrypt ); + rh.s.developer_encrypt_old = 0x1; + rh.s.exFlags.developer_encrypt = 0x0; + } + + if( pContext->bVerFlag ) + { + printf( "ROM version: 0x%02x -> 0x%02x\n", rh.s.rom_version, pContext->verNum ); + rh.s.rom_version = pContext->verNum; + } + + if( pContext->bMROM ) + { + if( rh.s.platform_code != 0x00 ) + { + printf( "ERROR: This option is only for NTR Limited." ); + return FALSE; + } + //if( (rh.s.game_cmd_param & CARD_LATENCY_MASK) != CARD_MROM_GAME_LATENCY ) + //{ + // printf( "ERROR: This option is only for MROM Setting" ); + // return FALSE; + //} + SetRomSpeedByIndex( &rh, ONETROM ); + printf( "ROM Speed Type: **** -> 1TROM\n" ); + } + + if( pContext->bDebugger ) + { + if( rh.s.disable_debug == 0 ) + { + rh.s.disable_debug = 0x1; + printf( "Debugger analysis: Enable -> Disable\n" ); + } + else + { + printf( "Debugger analysis: Originally Disable\n" ); + } + } + + if( pContext->bCheckCard ) + { + if( rh.s.inspect_card == 0 ) + { + rh.s.inspect_card = 0x1; + printf( "Check Card Flag: Disable -> Enable\n" ); + } + else + { + printf( "Check Card Flag: Originally Enable\n" ); + } + } + } + + // ヘッダCRC計算 + rh.s.header_crc16 = CalcCRC16( CRC16_INIT_VALUE, (u8*)&rh, CALC_CRC16_SIZE ); + + // 署名 + if( !(pContext->bMROM) && !(pContext->bNTR) ) // NTR専用オプションのときは署名しない + { + if( !SignRomHeader( &rh ) ) + { + return FALSE; + } + } + else + { + printf( "skip sign\n" ); + } + + // ファイルをコピる + fseek( pContext->ifp, 0, SEEK_END ); + size = ftell( pContext->ifp ); + fseek( pContext->ifp, 0, SEEK_SET ); + fseek( pContext->ofp, 0, SEEK_SET ); + while( size > 0 ) + { + int len = (BUFSIZE < size)?BUFSIZE:size; + + if( len != fread( buf, 1, len, pContext->ifp ) ) + { + printf( "fread failed in a copying file\n" ); + return FALSE; + } + if( len != fwrite( buf, 1, len, pContext->ofp ) ) + { + printf( "fwrite failed in a copying file\n" ); + return FALSE; + } + + size -= len; + } + + // ROMヘッダを上書き + fseek( pContext->ofp, 0, SEEK_SET ); + if( sizeof(ROM_Header) != fwrite( &rh, 1, sizeof(ROM_Header), pContext->ofp ) ) + { + printf( "fwrite failed in a copying file\n" ); + return FALSE; + } + + return TRUE; +} + +/*---------------------------------------------------------------------------* + + CRCの計算 + + *---------------------------------------------------------------------------*/ + +static u16 crc16_table[16] = { + 0x0000, 0xCC01, 0xD801, 0x1400, + 0xF001, 0x3C00, 0x2800, 0xE401, + 0xA001, 0x6C00, 0x7800, 0xB401, + 0x5000, 0x9C01, 0x8801, 0x4400 +}; + +u16 CalcCRC16(u16 start, u8 *data, int size) +{ + u16 r1; + u16 total = start; + + while (size-- > 0) + { + // 下位4bit + r1 = crc16_table[total & 0xf]; + total = (total >> 4) & 0x0fff; + total = total ^ r1 ^ crc16_table[*data & 0xf]; + + // 上位4bit + r1 = crc16_table[total & 0xf]; + total = (total >> 4) & 0x0fff; + total = total ^ r1 ^ crc16_table[(*data >> 4) & 0xf]; + + data++; + } + return total; +} + + +/*---------------------------------------------------------------------------* + + ROMヘッダの署名 + + *---------------------------------------------------------------------------*/ + +BOOL SignRomHeader( ROM_Header *prh ) +{ + SignatureData signSrc; // 署名のもととなるダイジェスト値 + u8 signDst[ RSA_KEY_LENGTH ]; // 署名の格納先Tmpバッファ + u8 decryptBlock[ RSA_KEY_LENGTH ]; // 署名を解除後ブロックバッファ + BOOL result; + int pos; + + // ROMヘッダのダイジェストを算出(先頭から証明書領域の直前までが対象) + ACSign_DigestUnit( + signSrc.digest, + prh, + (u32)&(prh->certificate) - (u32)prh // this->pRomHeader はマネージヒープ上にあるので実アドレスを取得できない + ); + +#ifdef KEY_USER + printf( "Signature Key: USER\n" ); +#endif +#ifdef KEY_SYSTEM + printf( "Signature Key: SYSTEM\n" ); +#endif +#ifdef KEY_SECURE + printf( "Signature Key: SECURE\n" ); +#endif +#ifdef KEY_LAUNCHER + printf( "Signature Key: LAUNCHER\n" ); +#endif + + // ダイジェストに署名をかける + result = ACSign_Encrypto( signDst, g_devPrivKey_DER, &signSrc, sizeof(SignatureData) ); + if( !result ) + { + printf( "ACSign_Encrypto encryption failed.\n" ); + return FALSE; + } + + // 署名を解除してダイジェストと一致するかベリファイする + result = ACSign_Decrypto( decryptBlock, g_devPubKey_DER, signDst, RSA_KEY_LENGTH ); + for( pos=0; pos < RSA_KEY_LENGTH; pos++ ) + { + if( decryptBlock[pos] == 0x0 ) // 解除後ブロックから実データをサーチ + break; + } + if( !result || (memcmp( &signSrc, &(decryptBlock[pos+1]), sizeof(SignatureData) ) != 0) ) + { + printf( "Verification a signature failed.\n" ); + return FALSE; + } + + // ROMヘッダに署名を上書き + memcpy( prh->signature, signDst, RSA_KEY_LENGTH ); + + return TRUE; +} // ECSrlResult RCSrl::signRomHeader(void) + + +/*---------------------------------------------------------------------------* + + ROM Speed Typeの設定 + + *---------------------------------------------------------------------------*/ + +static ROM_LT romSpeedTypeLatencyTable[] = { + {CARD_1TROM_GAME_LATENCY, CARD_1TROM_SECURE_HW_LATENCY, CARD_1TROM_SECURE_SW_LATENCY}, + {CARD_MROM_GAME_LATENCY, CARD_MROM_SECURE_HW_LATENCY, CARD_MROM_SECURE_SW_LATENCY}, +}; + +static void SetRomSpeedByIndex(ROM_Header * header, tRomSpeedType idx) +{ + ROM_LT *l = &romSpeedTypeLatencyTable[idx]; + + header->s.game_cmd_param &= ~CARD_LATENCY_MASK; + header->s.game_cmd_param |= l->game_latency; + header->s.secure_cmd_param &= ~CARD_LATENCY_MASK; + header->s.secure_cmd_param |= l->secure_hw_latency; + header->s.secure_cmd_latency = l->secure_sw_latency; +} + + +// end of file diff --git a/build/tests/FatalErrorChecker/ARM9/Makefile b/build/tests/FatalErrorChecker/ARM9/Makefile new file mode 100644 index 00000000..12e304a0 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/Makefile @@ -0,0 +1,55 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - FatalErrorChecker +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +SUBDIRS = + +SRCS = main.c \ + keypad.c \ + kami_font.c \ + graphics.c \ + font_data.c + +LINCLUDES += $(MISC_DIR)/include + +ROM_SPEC = main.rsf + +TARGET_BIN = menu.srl + +LLIBRARIES += liberrorlog$(TWL_LIBSUFFIX).a + +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +DEFAULT_MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorChecker/ARM9/main.rsf b/build/tests/FatalErrorChecker/ARM9/main.rsf new file mode 100644 index 00000000..f0fc5c0f --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/main.rsf @@ -0,0 +1,245 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "FatalChecker" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/banner.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + LockSCFG FALSE + + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media gamecard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 0G6A + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/tests/FatalErrorChecker/ARM9/src/font_data.c b/build/tests/FatalErrorChecker/ARM9/src/font_data.c new file mode 100644 index 00000000..aa1ba501 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 茶 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(25, 15, 15), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/FatalErrorChecker/ARM9/src/graphics.c b/build/tests/FatalErrorChecker/ARM9/src/graphics.c new file mode 100644 index 00000000..1de138e9 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/graphics.c @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(0); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} diff --git a/build/tests/FatalErrorChecker/ARM9/src/graphics.h b/build/tests/FatalErrorChecker/ARM9/src/graphics.h new file mode 100644 index 00000000..ddd8c4f6 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/graphics.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/FatalErrorChecker/ARM9/src/kami_font.c b/build/tests/FatalErrorChecker/ARM9/src/kami_font.c new file mode 100644 index 00000000..fb3818b6 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/tests/FatalErrorChecker/ARM9/src/kami_font.h b/build/tests/FatalErrorChecker/ARM9/src/kami_font.h new file mode 100644 index 00000000..d9855fd0 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/kami_font.h @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 +#define BG_COLOR_BROWN 11 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/FatalErrorChecker/ARM9/src/keypad.c b/build/tests/FatalErrorChecker/ARM9/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/tests/FatalErrorChecker/ARM9/src/keypad.h b/build/tests/FatalErrorChecker/ARM9/src/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/FatalErrorChecker/ARM9/src/main.c b/build/tests/FatalErrorChecker/ARM9/src/main.c new file mode 100644 index 00000000..df65d888 --- /dev/null +++ b/build/tests/FatalErrorChecker/ARM9/src/main.c @@ -0,0 +1,652 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - Tests - FatalErrorChecker + File: main.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 "graphics.h" +#include "keypad.h" + +#define BUFSIZE 256 + +#define FATAL_ERROR_MAX 51 +#define NUM_ENTRY_PER_PAGE 5 +#define NUM_LINE_PER_ENTRY 4 +#define SKIP_SPAN 5 +#define FOOTER_Y 22 + +#define ASK_LINE_OFFSET 9 +#define RESULT_LINE_OFFSET 13 + +#define SCREEN_WIDTH 32 + +#define DST_LOGFILE_PATH "sdmc:/sysmenu.log" +#define ERRORLOG_LOGFILE_PATH "nand:/sys/log/sysmenu.log" + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ +static char *s_strError[ FATAL_ERROR_MAX ]; +static BOOL nowEntryView; +static BOOL nowAskingCopy; +static BOOL nowAskingDelete; +static BOOL resetConsoleFlag; +static int drawIndex = 0; +static int numEntry; +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); +static void drawErrorLog( void ); +static BOOL deleteLogfile(); +static void control(); +static void removeLC( char *dst, const char *src ); +static void drawMessage( void ); +static void kamiFontPrintfWrap( s16 x, s16 y, u8 color, char *fmt, ... ); +static s16 kamiFontPrintfWrapSub( s16 x, s16 y, u8 color, char *str ); +static BOOL copyLogToSD( void ); +int convertLF( char *dst, char *src ); +static void drawMenu( void ); +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + char tst[] = "\n\n\n\n\na"; + + OS_Init(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + ERRORLOG_Init( OS_AllocFromMain, OS_FreeToMain ); + + numEntry = ERRORLOG_GetNum(); + nowEntryView = FALSE; + nowAskingCopy = FALSE; + nowAskingDelete = FALSE; + resetConsoleFlag = TRUE; + + while (1) + { + static i = 0 ; + kamiPadRead(); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + if( resetConsoleFlag ) + { + drawMenu(); + resetConsoleFlag = FALSE; + } + + // 操作検出と描画 + control(); + + if( nowEntryView ) + { + drawMessage(); + } + else + { + drawErrorLog(); + } + + } + +} + +static void drawMessage( void ) +{ + char titlebuf[5]; + const ErrorLogEntry *entry = ERRORLOG_Read( drawIndex ); + kamiFontClear(); + + if( entry->isBroken ) + { + kamiFontPrintf( 0, 0 , FONT_COLOR_BLACK, "%02d: Broken Entry", drawIndex); + + kamiFontPrintfWrap( 0, 2, FONT_COLOR_BLACK, "%s\n" ,entry->errorStr ); + + } + else if( entry->isLauncherError ) + { + STD_CopyLStringZeroFill( titlebuf, (char*)&entry->titleId, 5); + + kamiFontPrintf( 0, 0, FONT_COLOR_BLACK, "%02d: RED %02d/%02d/%02d %02d:%02d:%02d" , + drawIndex , entry->year, entry->month, entry->day, + entry->hour, entry->minute, entry->second ); + + kamiFontPrintf( 0, 1, FONT_COLOR_BLACK, "titleID: %s errorCode: %d", + titlebuf, entry->errorCode ); + + kamiFontPrintfWrap( 0, 3, FONT_COLOR_BLACK, s_strError[entry->errorCode] ); + + } + else{ + STD_CopyLStringZeroFill( titlebuf, (char*)&entry->titleId, 5); + + kamiFontPrintf( 0, 0 , FONT_COLOR_BLACK, "%02d: FFT %02d/%02d/%02d %02d:%02d:%02d" , + drawIndex , entry->year, entry->month, entry->day, + entry->hour, entry->minute, entry->second ); + + kamiFontPrintf( 0, 1, FONT_COLOR_BLACK, "titleID: %s", titlebuf ); + + kamiFontPrintfWrap( 0, 3, FONT_COLOR_BLACK, entry->errorStr ); + + } + +} + +static void drawErrorLog( void ) +{ + char titlebuf[5]; + s16 i; + + kamiFontClear(); + + for( i = 0; i < NUM_ENTRY_PER_PAGE && i+drawIndex < numEntry ; i++ ) + { + u8 color = (i == 0) ? (u8)FONT_COLOR_BLUE : (u8)FONT_COLOR_BLACK; + s16 posY = (s16)(i * NUM_LINE_PER_ENTRY); + const ErrorLogEntry *entry = ERRORLOG_Read( i + drawIndex ); + char drawBuf[256 + 1]; + + if( entry->isBroken ) + { +// kamiFontPrintf( 0, posY , color, "%02d: Broken Entry", i + drawIndex); + kamiFontPrintf( 0, posY , color, "%02d: Broken Entry", i + drawIndex); + + // 改行を取り除いてから表示 + removeLC( drawBuf, entry->errorStr ); + kamiFontPrintf( 0, (s16)( posY + 1), color, drawBuf ); + + } + else if( entry->isLauncherError ) + { + STD_CopyLStringZeroFill( titlebuf, (char*)&entry->titleId, 5); + + kamiFontPrintf( 0, posY , color, "%02d: RED %02d/%02d/%02d %02d:%02d:%02d" , + i + drawIndex , entry->year, entry->month, entry->day, + entry->hour, entry->minute, entry->second ); + + kamiFontPrintf( 0, (s16)( posY + 1), color, "titleID: %s errorCode: %d", + titlebuf, entry->errorCode ); + + kamiFontPrintf( 0, (s16)( posY + 2), color, s_strError[entry->errorCode] ); + } + else{ + STD_CopyLStringZeroFill( titlebuf, (char*)&entry->titleId, 5); + + kamiFontPrintf( 0, posY , color, "%02d: FFT %02d/%02d/%02d %02d:%02d:%02d" , + i + drawIndex , entry->year, entry->month, entry->day, + entry->hour, entry->minute, entry->second ); + + kamiFontPrintf( 0, (s16)( posY + 1), color, "titleID: %s", titlebuf ); + + // 改行を取り除いてから表示 + removeLC( drawBuf, entry->errorStr ); + kamiFontPrintf( 0, (s16)( posY + 2), color, drawBuf ); + + } + } + + kamiFontPrintf( 0, FOOTER_Y , FONT_COLOR_BLACK, "numEntry : %d", numEntry ); +} + +static void control() +{ + if( nowAskingCopy ) + { + // 本当にやるの?って聞いてる最中 + if( kamiPadIsTrigger( PAD_BUTTON_A )) + { + BOOL result; + kamiFontPrintfMain( 0, ASK_LINE_OFFSET+2, CONSOLE_ORANGE, "now copying..."); + result = copyLogToSD(); + nowAskingCopy = FALSE; + } + + if( kamiPadIsTrigger( PAD_BUTTON_B )) + { + drawMenu(); + nowAskingCopy = FALSE; + } + + return; + } + + if( nowAskingDelete ) + { + // 本当にやるの?って聞いてる最中 + if( kamiPadIsTrigger( PAD_BUTTON_A )) + { + BOOL result; + kamiFontPrintfMain( 0, ASK_LINE_OFFSET+2, CONSOLE_ORANGE, "now deleting..."); + result = deleteLogfile(); + nowAskingDelete = FALSE; + } + + if( kamiPadIsTrigger( PAD_BUTTON_B )) + { + drawMenu(); + nowAskingDelete = FALSE; + } + + return; + } + + if( kamiPadIsTrigger( PAD_KEY_UP ) ) + { + drawIndex--; + } + else if( kamiPadIsTrigger( PAD_KEY_DOWN ) ) + { + drawIndex++; + } + + if( kamiPadIsTrigger( PAD_KEY_LEFT ) ) + { + drawIndex -= SKIP_SPAN; + } + else if( kamiPadIsTrigger( PAD_KEY_RIGHT ) ) + { + drawIndex += SKIP_SPAN; + } + + if( kamiPadIsTrigger( PAD_BUTTON_A ) ) + { + if( 0 < numEntry ) + { + nowEntryView = !nowEntryView ; + } + } + else if( kamiPadIsTrigger( PAD_BUTTON_X ) ) + { + drawMenu(); + kamiFontPrintfMain( 0, ASK_LINE_OFFSET, CONSOLE_ORANGE, "Copy Logfile to SD. OK ?"); + kamiFontPrintfMain( 0, ASK_LINE_OFFSET + 1, CONSOLE_ORANGE, "A: Decide B: Cancel"); + + nowAskingCopy = TRUE; + } + else if ( kamiPadIsTrigger( PAD_BUTTON_Y ) ) + { + drawMenu(); + kamiFontPrintfMain( 0, ASK_LINE_OFFSET, CONSOLE_ORANGE, "Delete Logfile From NAND. OK ?"); + kamiFontPrintfMain( 0, ASK_LINE_OFFSET + 1, CONSOLE_ORANGE, "A: Decide B: Cancel"); + + nowAskingDelete = TRUE; + } + + // 操作の結果、描画インデクスがはみ出しそうだったら修正 + drawIndex = numEntry-1 < drawIndex ? numEntry-1 : drawIndex ; + drawIndex = drawIndex < 0 ? 0: drawIndex; +} + +// srcから改行を取り除いてdstに引き渡す +static void removeLC( char *dst, const char *src ) +{ + char *idx; + STD_StrCpy( dst, src ); + + while( ( idx = STD_StrChr( dst, '\n' )) != NULL ) + { + *idx = ' '; + } +} + + +static void kamiFontPrintfWrap( s16 x, s16 y, u8 color, char *fmt, ... ) +{ + va_list vlist; + char temp[BUFSIZE + 1]; + char *head, *tail; + + va_start(vlist, fmt); + (void)vsnprintf(temp, BUFSIZE+1, fmt, vlist); + va_end(vlist); + + head = temp; + + // 終端追加 + temp[BUFSIZE] = '\0'; + + // 自前でctok的な事をして改行を別々に出力する + tail = STD_StrChr( temp, '\n' ); + while( tail != NULL ) + { + *tail = '\0'; + y += kamiFontPrintfWrapSub( x, y, color, head ); + head = tail+1; + tail = STD_StrChr( head, '\n' ); + } + + kamiFontPrintfWrapSub( x, y, color, head ); +} + +// 表示可能文字数で自動折り返し +// 返り値は描画に利用した行数 +static s16 kamiFontPrintfWrapSub( s16 x, s16 y, u8 color, char *str ) +{ + char *head = str; + char buf[SCREEN_WIDTH+1]; + s16 linecount = 0; + int length; + + while( SCREEN_WIDTH <= ( length = STD_StrLen( head )) ) + { + STD_StrLCpy( buf, head, SCREEN_WIDTH+1 ); + kamiFontPrintf( x, (s16)(y + linecount++), color, buf ); + head += SCREEN_WIDTH; + } + + kamiFontPrintf( x, (s16)(y + linecount++), color, head ); + + return linecount; + +} + + +static BOOL deleteLogfile( void ) +{ + + if( !FS_DeleteFile( ERRORLOG_LOGFILE_PATH ) ) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Delete Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_DeleteFile" ); + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+2, CONSOLE_ORANGE, + "errorCode : %d", FS_GetArchiveResultCode( ERRORLOG_LOGFILE_PATH ) ); + + return FALSE; + } + + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Delete Succeeded!") ; + return TRUE; +} + +static BOOL copyLogToSD( void ) +{ + FSFile src, dst; + // 最悪で読み込んだサイズの倍の文字列になる可能性がある + char buf[BUFSIZE + 1]; + char winbuf[BUFSIZE*2 +1]; + s32 readSize; + s32 writeSize = 0; + + buf[256] = '\0'; + FS_InitFile( &dst ); + + // まずファイルを削除 + FS_DeleteFile( DST_LOGFILE_PATH ); + + if( ! FS_CreateFile( DST_LOGFILE_PATH, FS_PERMIT_R | FS_PERMIT_W ) ) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_CreateFile" ); + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+2, CONSOLE_ORANGE, "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + + // ファイル作成に成功 + if( !FS_OpenFileEx( &dst , DST_LOGFILE_PATH, FS_FILEMODE_RW )) + { + // 作成したファイルをopenできなかった場合 + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_OpenFile / FS_SetFileLength" ); + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+2, CONSOLE_ORANGE, "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + + // サイズ変更が終わったら、念のためファイルサイズ変更不可なRWLモードで開きなおしておく + // →ファイルサイズ可変長に変更 + FS_CloseFile( &dst ); + + if( !FS_OpenFileEx( &dst, DST_LOGFILE_PATH, FS_FILEMODE_RW ) ) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_OpenFile dst" ); + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+2, CONSOLE_ORANGE, "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + return FALSE; + } + + if( !FS_OpenFileEx( &src, ERRORLOG_LOGFILE_PATH, FS_FILEMODE_R ) ) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_OpenFile src" ); + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+2, CONSOLE_ORANGE, "errorCode : %d", FS_GetArchiveResultCode( DST_LOGFILE_PATH ) ); + } + + if( !FS_SeekFileToBegin( &src )) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_SeekFileToBegin" ); + return FALSE; + } + + while( ( readSize = FS_ReadFile( &src, buf, 256 )) > 0 ) + { + int size; + size = convertLF( winbuf, buf ); + + if( FS_WriteFile( &dst, winbuf, size ) < 0 ) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_WriteFile" ); + return FALSE; + } + + } + + + if( !FS_CloseFile( &src )) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_CloseFile(src)" ); + } + + + if( !FS_CloseFile( &dst )) + { + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Failed!") ; + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET+1, CONSOLE_ORANGE, "func: FS_CloseFile(dst)" ); + } + kamiFontPrintfMain( 0, RESULT_LINE_OFFSET, CONSOLE_ORANGE, "Copy Succeeded!") ; + + return TRUE; + +} + +static void drawMenu( void ) +{ + int line = 0; + + kamiFontClearMain(); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "How to"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "+-----------------------------+"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "l U/D Key : Scroll Line l"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "l L/R Key : Scroll Page l"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "l A Button : Switch View Mode l"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "l X Button : Copy to SDCard l"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "l Y Button : Delete Logfile l"); + kamiFontPrintfMain( 0, (s16)(line++), CONSOLE_ORANGE, "+-----------------------------+"); +} + +// LFをLFCRに置換して書き戻す +// dstは最悪時でsrcの二倍の領域が必要 +int convertLF( char *dst, char *src ) +{ + char *head = src, *tail; + int writesize = 0; + + tail = STD_StrChr( src, '\n' ); + + while( tail != NULL ) + { + *tail = '\0'; + writesize += STD_StrLCpy( &dst[writesize], head,BUFSIZE ); + dst[writesize] = 0x0d; + dst[writesize+1] = 0x0a; + writesize += 2; + + head = tail + 1; + tail = STD_StrChr( head, '\n' ); + } + + writesize += STD_StrLCpy( &dst[writesize], head, BUFSIZE ); + + return writesize; +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + + + +static char *s_strError[ FATAL_ERROR_MAX ] = { + "UNDEFINED", + "NAND", + "HWINFO_NORMAL", + "HWINFO_SECURE", + "TWLSETTINGS", + "SHARED_FONT", + "WLANFIRM_AUTH", + "WLANFIRM_LOAD", + "TITLE_LOAD_FAILED", + "TITLE_POINTER_ERROR", + "AUTHENTICATE_FAILED", + "ENTRY_ADDRESS_ERROR", + "TITLE_BOOTTYPE_ERROR", + "SIGN_DECRYPTION_FAILED", + "SIGN_COMPARE_FAILED", + "HEADER_HASH_CALC_FAILED", + "TITLEID_COMPARE_FAILED", + "VALID_SIGN_FLAG_OFF", + "CHECK_TITLE_LAUNCH_RIGHTS_FAILED", + "MODULE_HASH_CHECK_FAILED", + "MODULE_HASH_CALC_FAILED", + "MEDIA_CHECK_FAILED", + "DL_MAGICCODE_CHECK_FAILED", + "DL_SIGN_DECRYPTION_FAILED", + "DL_HASH_CALC_FAILED", + "DL_SIGN_COMPARE_FAILED", + "WHITELIST_INITDB_FAILED", + "WHITELIST_NOTFOUND", + "DHT_PHASE1_FAILED", + "DHT_PHASE2_FAILED", + "LANDING_TMP_JUMP_FLAG_OFF", + "TWL_BOOTTYPE_UNKNOWN", + "NTR_BOOTTYPE_UNKNOWN", + "PLATFORM_UNKNOWN", + "LOAD_UNFINISHED", + "LOAD_OPENFILE_FAILED", + "LOAD_MEMALLOC_FAILED", + "LOAD_SEEKFILE_FAILED", + "LOAD_READHEADER_FAILED", + "LOAD_LOGOCRC_ERROR = 39", + "LOAD_READDLSIGN_FAILED", + "LOAD_RELOCATEINFO_FAILED", + "LOAD_READMODULE_FAILED", + "NINTENDO_LOGO_CHECK_FAILED", + "SYSMENU_VERSION", + "DHT_PHASE1_CALC_FAILED", + "LOAD_UNKNOWN_BOOTTYPE", + "LOAD_AUTH_HEADER_FAILED", + "LOAD_NEVER_STARTED", + "EJECT_CARD_AFTER_LOAD_START", + "TITLEID_COMPARE_FAILED_NTR" +}; diff --git a/build/tests/FatalErrorChecker/Makefile b/build/tests/FatalErrorChecker/Makefile new file mode 100644 index 00000000..35985393 --- /dev/null +++ b/build/tests/FatalErrorChecker/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + #---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorChecker/banner/Makefile b/build/tests/FatalErrorChecker/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/tests/FatalErrorChecker/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/FatalErrorChecker/banner/banner_v3.bsf b/build/tests/FatalErrorChecker/banner/banner_v3.bsf new file mode 100644 index 00000000..3690eee1 Binary files /dev/null and b/build/tests/FatalErrorChecker/banner/banner_v3.bsf differ diff --git a/build/tests/FatalErrorChecker/banner/icon/gameIcon.bmp b/build/tests/FatalErrorChecker/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..1a32e5af Binary files /dev/null and b/build/tests/FatalErrorChecker/banner/icon/gameIcon.bmp differ diff --git a/build/tests/FatalErrorMaker/ARM9/Makefile b/build/tests/FatalErrorMaker/ARM9/Makefile new file mode 100644 index 00000000..4144a38b --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorMaker/ARM9/Makefile.0 b/build/tests/FatalErrorMaker/ARM9/Makefile.0 new file mode 100644 index 00000000..3208af96 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/Makefile.0 @@ -0,0 +1,87 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - FatalErrorMaker +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +SUBDIRS = + +MEDIA = NAND +GAMECODE = 012A +TARGET_BIN = FatalErrorMaker.tad +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(MEDIA) + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c fatalErrorMaker.c \ + $(MISC_DIR)/src/misc.c \ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include + +ROM_SPEC = main.rsf + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont_launcher$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +MAKEROM_FLAGS += -DFATALMAKER_GAMECODE=$(GAMECODE) \ + -DFATALMAKER_MEDIA=$(MEDIA) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +DEFAULT_MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorMaker/ARM9/Makefile.1 b/build/tests/FatalErrorMaker/ARM9/Makefile.1 new file mode 100644 index 00000000..2f3dde27 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/Makefile.1 @@ -0,0 +1,87 @@ +#/*---------------------------------------------------------------------------* +# Project: TwlIPL - tests - FatalErrorMaker +# File: makefile +# +# Copyright **** 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$ +# *---------------------------------------------------------------------------*/ +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_NANDAPP = TRUE + +SUBDIRS = + +MEDIA = GameCard +GAMECODE = 0G4A +TARGET_BIN = FatalErrorMaker.srl +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(MEDIA) + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c fatalErrorMaker.c \ + $(MISC_DIR)/src/misc.c \ + $(MISC_DIR)/src/cmn.c + +LINCLUDES += $(MISC_DIR)/include + +ROM_SPEC = main.rsf + +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/rom_header_$(call toLower,$(GAMECODE)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(GAMECODE)/libsyscall.a + +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont_launcher$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + libreboot$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +MAKEROM_FLAGS += -DFATALMAKER_GAMECODE=$(GAMECODE) \ + -DFATALMAKER_MEDIA=$(MEDIA) \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +DEFAULT_MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorMaker/ARM9/main.rsf b/build/tests/FatalErrorMaker/ARM9/main.rsf new file mode 100644 index 00000000..3637e711 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/main.rsf @@ -0,0 +1,248 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + + _GameCode $(FATALMAKER_GAMECODE) + + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "FatalMaker" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode 01 + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile ../banner/$(FATALMAKER_GAMECODE).bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + LockSCFG FALSE + + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media $(FATALMAKER_MEDIA) + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(FATALMAKER_GAMECODE) + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR + +} diff --git a/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.c b/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.c new file mode 100644 index 00000000..c73b3cc4 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.c @@ -0,0 +1,379 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - FatalErrorMaker + File: fatalErrorMaker.c + + Copyright **** 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 "misc.h" +#include "fatalErrorMaker.h" + +#define NORMAL_INFO_PATH "nand:/sys/HWINFO_N.dat" +#define SECURE_INFO_PATH "nand:/sys/HWINFO_S.dat" +#define SHARED_FONT_PATH "nand:/sys/TWLFontTable.dat" +#define WIRELESS_TITLEID 0x0003000F484E4341 + +#define NOR_BUFSIZE 128 +#define NOR_SETTING_ADDRESS_OFFSET 0x20 +#define NOR_NANDFLAG_NEGATIVE_OFFSET ( 0x1fe00 - 0x1f380 ) +#define NOR_NANDFLAG_MASK 0x10 + +#define SELECT_MESSAGE "select data for breaking." +#define SUCCESS_MESSAGE "breaking data succeeded." +#define FAIL_MESSAGE "breaking data failed." +#define ALREADY_MESSAGE "this data is broken already." + +#define MENU_LINES 5 +#define INFORMATION_LEFT 20 +#define INFORMATION_UP 150 +#define SELECTION_LEFT 40 +#define RESULT_LEFT 190 +#define SELECTION_UP 30 +#define ALLOW_LEFT 25 +#define LINE_OFFSET 20 +#define HEADER_LEFT 5 +#define HEADER_UP 0 + +typedef enum FatalErrorTarget { + BREAK_HW_NORMAL = 0, + BREAK_HW_SECURE = 1, + BREAK_FONT = 2, + BREAK_WIRELESS = 3, + BREAK_NAND = 4 +} FatalErrorTarget; + + +typedef enum ControlResult { + CONTROL_RESULT_INITIAL = 0, + CONTROL_RESULT_SUCCESS = 1, + CONTROL_RESULT_FAILED = 2, + CONTROL_RESULT_ALREADY = 3, + CONTROL_RESULT_MOVE = 4, + CONTROL_RESULT_NONE = -1 +} ControlResult; + +ControlResult control( int *line, u8 *flag ); +void draw( int select, int result, int flag ); +BOOL breakNAND( void ); +BOOL breakData( FatalErrorTarget tgt ); +static void DumpBinary(u32 offset, void* data, u32 size); +void setParity( u8 *data ); + +static char* s_strInfo[4]; +static char* s_strMenu[ MENU_LINES ]; +static char* s_strFilePath[ MENU_LINES ]; + +void fatalMakerMain( void ) +{ + static int selectLine = 0; + static u8 brokenFlag = 0; // 0: NORMAL, 1: SECURE, 2: FONT, 3: WL, 4: NAND + ControlResult result ; + + result = control( &selectLine, &brokenFlag ); // 入力を呼んで状態を更新 + + // 画面の描画 + draw( selectLine, result , brokenFlag ); +} + +void draw( int select, int result, int flag ) +{ + static int lastBreakData; + static int lastStatus = CONTROL_RESULT_INITIAL; + int i; + + // 何らかの決定動作があった場合はlastBreakDataを更新 + if( result != CONTROL_RESULT_NONE && result != CONTROL_RESULT_MOVE ) + { + lastBreakData = select; + lastStatus = result; + } + + // 操作があったときはキャンパスクリア + if( result != CONTROL_RESULT_NONE ) + { + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + } + + // 項目の羅列 + for( i = 0; i < MENU_LINES; i++ ) + { + if( i == select ) + { + PrintfSJIS( SELECTION_LEFT, SELECTION_UP + (i * LINE_OFFSET), TXT_COLOR_GREEN, s_strMenu[i] ); + } + else + { + PrintfSJIS( SELECTION_LEFT, SELECTION_UP + (i * LINE_OFFSET), TXT_COLOR_BLACK, s_strMenu[i] ); + } + + // 破壊したかどうかの表示 + if( flag & (1 << i) ) + { + PrintfSJIS( RESULT_LEFT, SELECTION_UP + (i * LINE_OFFSET), TXT_COLOR_RED, "BROKEN" ); + } + } + + PrintfSJIS( HEADER_LEFT, HEADER_UP, TXT_COLOR_RED, "Fatal Error Maker" ); + PrintfSJIS( INFORMATION_LEFT, INFORMATION_UP, TXT_COLOR_BLACK, s_strInfo[ lastStatus ] ); + PrintfSJIS( ALLOW_LEFT, SELECTION_UP + (select * LINE_OFFSET), TXT_COLOR_BLACK, "→" ); + +} + +ControlResult control( int *line, u8 *flag ) +{ + BOOL controlFlag = FALSE; // 何らかの操作があったかどうかをメモる + + if( pad.trg & PAD_KEY_UP ) + { + controlFlag = TRUE; + + // デクリメントしてマイナスになったらループ + if( --*line < 0 ) + { + *line = MENU_LINES-1; + } + } + else if( pad.trg & PAD_KEY_DOWN ) + { + controlFlag = TRUE; + + // インクリメントしてmaxを超えたらループ + if( MENU_LINES <= ++*line ) + { + *line = 0; + } + } + + if( pad.trg & PAD_BUTTON_A ) + { + controlFlag = TRUE; + + // 選択項目を破壊する + if( *flag & (1 << *line) ) + { + // フラグが立ってたら既に破壊済みなので何もしない + return CONTROL_RESULT_ALREADY; + } + + // データを実際に破壊する + if( ! breakData( (FatalErrorTarget)*line ) ) + { + // 破壊に失敗 + return CONTROL_RESULT_FAILED; + } + + // 破壊成功 + *flag |= 1 << *line ; + return CONTROL_RESULT_SUCCESS; + } + + // 特に何も破壊しない + return controlFlag ? CONTROL_RESULT_MOVE : CONTROL_RESULT_NONE; +} + +BOOL breakData( FatalErrorTarget tgt ) +{ + switch( tgt ) + { + case BREAK_FONT: + case BREAK_HW_NORMAL: + case BREAK_HW_SECURE: + case BREAK_WIRELESS: + // SharedFont, NormalInfo, SecureInfoについては該当パスきめうちで削除してしまう + if( ! FS_DeleteFile( s_strFilePath[tgt] ) ) + { + OS_TPrintf( "FS_DeleteFile Error. file: %s err: %d\n" , + s_strFilePath[tgt], FS_GetArchiveResultCode( s_strFilePath[tgt] ) ); + + return FALSE; + } + + OS_TPrintf( "delete file succeeded. : %s\n", s_strFilePath[tgt] ); + return TRUE; + + case BREAK_NAND: + return breakNAND() ; + } + + // illegal argument + return FALSE; +} + +BOOL breakNAND( void ) +{ + static u8 buf[NOR_BUFSIZE] ; + u32 settingAddress; + NVRAMResult result; + + + // まずIPLヘッダから本体設定のあるオフセットを取得 + + // キャッシュを破棄 + DC_InvalidateRange( buf, NOR_BUFSIZE); + result = NVRAMi_Read( NOR_SETTING_ADDRESS_OFFSET , NOR_BUFSIZE, buf ); + + if( result != NVRAM_RESULT_SUCCESS ) + { + // readに失敗 + OS_TPrintf( "nvram_read() failed. errorcode: %d\n", result ); + return FALSE; + } + + OS_TPrintf("reading address... %x %x \n", buf[0], buf[1] ); + + // 格納されている値の8倍が設定アドレスの開始アドレス + settingAddress = ( (u32)(buf[1]) << 8 | (u32)buf[0]) * 8 ; + OS_TPrintf("settingAddress : %x\n", settingAddress ); + + DC_InvalidateRange( buf, NOR_BUFSIZE); + result = NVRAMi_Read( settingAddress - NOR_NANDFLAG_NEGATIVE_OFFSET , NOR_BUFSIZE, buf ); + + if( result != NVRAM_RESULT_SUCCESS ) + { + // readに失敗 + OS_TPrintf( "nvram_read() failed. errorcode: %d\n", result ); + return FALSE; + } + + DumpBinary( settingAddress - NOR_NANDFLAG_NEGATIVE_OFFSET , buf, NOR_BUFSIZE ); + + OS_TPrintf(" now flag : %x\n", buf[NOR_BUFSIZE-1] ); + buf[ NOR_BUFSIZE - 1 ] |= NOR_NANDFLAG_MASK; + setParity( &buf[NOR_BUFSIZE-1] ); + OS_TPrintf(" now flag : %x\n", buf[NOR_BUFSIZE-1] ); + + // キャッシュを書き戻して、それからnvramに書き込む + DC_StoreRange(buf, sizeof(buf)); + result = NVRAMi_Write( settingAddress - NOR_NANDFLAG_NEGATIVE_OFFSET , NOR_BUFSIZE, buf ); + + // 読み直す + DC_InvalidateRange( buf, NOR_BUFSIZE); + result = NVRAMi_Verify( settingAddress - NOR_NANDFLAG_NEGATIVE_OFFSET , NOR_BUFSIZE, buf ); + + if( result != NVRAM_RESULT_SUCCESS ) + { + // writeに失敗 + OS_TPrintf( "nvram_verify() failed. errorcode: %d\n", result ); + return FALSE; + } + + // 書き込み成功 + return TRUE; +} + +void fatalMakerInit( void ) +{ + static char filePath[NAM_PATH_LEN+1]; + + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + // 無線ファームのパスを取得する + NAM_GetTitleBootContentPath( filePath , WIRELESS_TITLEID); // + s_strFilePath[ BREAK_WIRELESS ] = filePath; + OS_TPrintf( "wireless path : %s\n", filePath ); +} + +static char* s_strInfo[] = { + SELECT_MESSAGE, + SUCCESS_MESSAGE, + FAIL_MESSAGE, + ALREADY_MESSAGE +}; + +static char* s_strMenu[] = { + "HW Normal Info", + "HW Secure Info", + "Shared Font", + "Wireless Firmware", + "NAND" +}; + +static char* s_strFilePath[] = { + NORMAL_INFO_PATH, + SECURE_INFO_PATH, + SHARED_FONT_PATH, + NULL, // 無線ファームのパスはあとからNAM経由で入れる + NULL +}; + + +/*---------------------------------------------------------------------------* + Name: DumpBinary + Description: バイナリデータを 16 進数表記でダンプ出力する。 + Arguments: offset - 先頭アドレスを指定。 + data - ダンプ表示するデータへのポインタ。 + size - ダンプ表示するデータ量をバイト単位で指定。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +DumpBinary(u32 offset, void* data, u32 size) +{ +#pragma unused(data) + s32 i; + + if (size > 0) + { + if ((offset % 16) != 0) + { + OS_TPrintf("%08x:", (u32)(offset & ~0xf)); + for (i = 0; i < (offset % 16); i ++) + { + OS_TPrintf(" "); + if ((i % 16) == 7) + { + OS_TPrintf(" -"); + } + } + } + for (i = 0; i < size; i ++) + { + if (((offset + i) % 16) == 0) + { + OS_TPrintf("%08x:", offset + i); + } + OS_TPrintf(" %02x", ((u8*)data)[i]); + if (((offset + i) % 16) == 7) + { + OS_TPrintf(" -"); + } + else if (((offset + i) % 16) == 15) + { + OS_TPrintf("\n"); + } + } + if (((offset + i - 1) % 16) != 15) + { + OS_TPrintf("\n"); + } + } +} + +void setParity( u8 *data ) +{ + u8 i, parity; + + parity = 1; /* 通常と逆(1が奇数個で0になる)*/ + for( i=0; i<7; i++) { /* 0-7(最上位ビットがparity) */ + parity += ((*data >> i) & 0x01); + } + /* パリティビットを上書き */ + *data &= (u8)(~(0x80)); + *data |= ((parity << 7) & 0x80); +} \ No newline at end of file diff --git a/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.h b/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.h new file mode 100644 index 00000000..5ac04b27 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/src/fatalErrorMaker.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - FatalErrorMaker + File: fatalErrorMaker.h + + Copyright **** 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 __FATAL_ERROR_MAKE__ +#define __FATAL_ERROR_MAKE__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void fatalMakerMain( void ); +void fatalMakerInit( void ); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/build/tests/FatalErrorMaker/ARM9/src/main.c b/build/tests/FatalErrorMaker/ARM9/src/main.c new file mode 100644 index 00000000..c3b8f043 --- /dev/null +++ b/build/tests/FatalErrorMaker/ARM9/src/main.c @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - DisplaySystemInformation + File: main.c + + Copyright **** 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 "misc.h" +#include "fatalErrorMaker.h" + +///////////////////////////// + +void VBlankHandler( void ); + +///////////////////////////// + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ + + + +void TwlMain( void ) +{ + + OS_Init(); + OS_InitTick(); + OS_TPrintf("Initialize begin\n"); + + //---- interrupt setting + OS_EnableIrq(); + OS_EnableInterrupts(); + + GX_Init(); + + OS_SetIrqFunction( OS_IE_V_BLANK, VBlankHandler ); + OS_EnableIrqMask( OS_IE_V_BLANK ); + GX_VBlankIntr( TRUE ); + + OS_TPrintf("RTC Initilize...\n"); + RTC_Init(); + + OS_TPrintf("Allocator Initialize...\n"); + InitAllocator(); + + + InitBG(); + OS_TPrintf("Initialize Finished\n"); + + NVRAMi_Init(); + FS_Init( FS_DMA_NOT_USE ); + CRYPTO_SetAllocator( Alloc, Free ); + NAM_Init( Alloc, Free ); + + + fatalMakerInit(); + OS_TPrintf("begin mainloop\n"); + + + // メインループ + while( 1 ) + { + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + + fatalMakerMain(); // ビューア更新 + } + + OS_Terminate(); + +} + + +void VBlankHandler(void) +{ + OS_SetIrqCheckFlag( OS_IE_V_BLANK ); // Vブランク割込チェックのセット +} diff --git a/build/tests/FatalErrorMaker/Makefile b/build/tests/FatalErrorMaker/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/tests/FatalErrorMaker/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorMaker/about.txt b/build/tests/FatalErrorMaker/about.txt new file mode 100644 index 00000000..c58fb52b --- /dev/null +++ b/build/tests/FatalErrorMaker/about.txt @@ -0,0 +1,22 @@ +FatalErrorMaker + +NAND、無線ファーム、共有フォント、ノーマルHW情報、セキュアHW情報を +破壊し、意図的にFatal Errorを引き起こすテストです。 +起動するとメニューが表示されるので、破壊したい項目にカーソルを合わせてAボタンを押してください。 +共有フォント以外は次回起動時に確実にFatal Errorを引き起こすと考えられるので、 +NAND Initializerが利用できることを確認したうえで実行したほうがよいと思います。 + +手法としては、NAND以外の各データはそれぞれのファイルをFS_DeleteFile()で削除することで、 +NANDに関してはNORフラッシュにおけるNAND FATALエラーフラグ(IPL/docs/フラッシュマップ_NOR.xls参照)を +立てることで該当項目の破壊を実現しています。 + + +破壊しているファイルは具体的に以下の通りです。 + +共有フォント:nand:/sys/TWLFontTable.dat +ノーマル情報:nand:/sys/HWINFO_N.dat +セキュア情報:nand:/sys/HWINFO_S.dat + +また、無線ファームに関してはコンテンツとしてtitleフォルダ以下に配置されているので、 +NAMライブラリを利用してパスを取得してから削除しにいっています。 + diff --git a/build/tests/FatalErrorMaker/banner/Makefile b/build/tests/FatalErrorMaker/banner/Makefile new file mode 100644 index 00000000..960abdc6 --- /dev/null +++ b/build/tests/FatalErrorMaker/banner/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = \ + Makefile.012A Makefile.0G4A + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/FatalErrorMaker/banner/Makefile.012A b/build/tests/FatalErrorMaker/banner/Makefile.012A new file mode 100644 index 00000000..cc294ddc --- /dev/null +++ b/build/tests/FatalErrorMaker/banner/Makefile.012A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 012A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/FatalErrorMaker/banner/Makefile.0G4A b/build/tests/FatalErrorMaker/banner/Makefile.0G4A new file mode 100644 index 00000000..53a0164b --- /dev/null +++ b/build/tests/FatalErrorMaker/banner/Makefile.0G4A @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +GAMECODE = 0G4A +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/$(GAMECODE).bmp +BANNER_SPEC = banner$(GAMECODE)_v3.bsf + +TARGETS = $(GAMECODE).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) + $(NTEXCONV) -no -bg -bgb -bgnc $(BANNER_ICON) >/dev/null && \ + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) diff --git a/build/tests/FatalErrorMaker/banner/banner.bnr b/build/tests/FatalErrorMaker/banner/banner.bnr new file mode 100644 index 00000000..7faf2304 Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/banner.bnr differ diff --git a/build/tests/FatalErrorMaker/banner/banner012A_v3.bsf b/build/tests/FatalErrorMaker/banner/banner012A_v3.bsf new file mode 100644 index 00000000..eaf83c8d Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/banner012A_v3.bsf differ diff --git a/build/tests/FatalErrorMaker/banner/banner0G4A_v3.bsf b/build/tests/FatalErrorMaker/banner/banner0G4A_v3.bsf new file mode 100644 index 00000000..248fcb42 Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/banner0G4A_v3.bsf differ diff --git a/build/tests/FatalErrorMaker/banner/bannerOption.txt b/build/tests/FatalErrorMaker/banner/bannerOption.txt new file mode 100644 index 00000000..f8313a29 --- /dev/null +++ b/build/tests/FatalErrorMaker/banner/bannerOption.txt @@ -0,0 +1,2 @@ +012A FatalErrorMaker_card +0G4A FatalErrorMaker_nand \ No newline at end of file diff --git a/build/tests/FatalErrorMaker/banner/banner_v3.bsf b/build/tests/FatalErrorMaker/banner/banner_v3.bsf new file mode 100644 index 00000000..86449213 Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/banner_v3.bsf differ diff --git a/build/tests/FatalErrorMaker/banner/icon/012A.bmp b/build/tests/FatalErrorMaker/banner/icon/012A.bmp new file mode 100644 index 00000000..8fb6cafb Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/icon/012A.bmp differ diff --git a/build/tests/FatalErrorMaker/banner/icon/0G4A.bmp b/build/tests/FatalErrorMaker/banner/icon/0G4A.bmp new file mode 100644 index 00000000..d8d531eb Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/icon/0G4A.bmp differ diff --git a/build/tests/FatalErrorMaker/banner/icon/gameIcon.bmp b/build/tests/FatalErrorMaker/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..876eca5b Binary files /dev/null and b/build/tests/FatalErrorMaker/banner/icon/gameIcon.bmp differ diff --git a/build/tests/FileRecoveryTest/Makefile b/build/tests/FileRecoveryTest/Makefile new file mode 100644 index 00000000..c06e7830 --- /dev/null +++ b/build/tests/FileRecoveryTest/Makefile @@ -0,0 +1,43 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - FileRecoveryTest +# File: Makefile +# +# Copyright **** 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:$ +#---------------------------------------------------------------------------- +SUBDIRS = $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/util/ + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#---------------------------------------------------------------------------- + +TARGET_BIN = main.srl + +SRCS = main.c + +LLIBRARIES += libsysmutil$(TWL_LIBSUFFIX).a + +ROM_SPEC = main.rsf + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/FileRecoveryTest/main.rsf b/build/tests/FileRecoveryTest/main.rsf new file mode 100644 index 00000000..30b63f3e --- /dev/null +++ b/build/tests/FileRecoveryTest/main.rsf @@ -0,0 +1,269 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [0 - 255] + # + #AgreeEULAVersion 0 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + Secure TRUE + AppType System +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} + +Rating +{ + # + # Permited age to play for each rating organization [0 - 31, ALWAYS, FREE] + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / ALWAYS / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/FileRecoveryTest/src/main.c b/build/tests/FileRecoveryTest/src/main.c new file mode 100644 index 00000000..460c313b --- /dev/null +++ b/build/tests/FileRecoveryTest/src/main.c @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util_recoveryFile.h + + Copyright **** 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 + +static char *s_strResult[4]; + +void VBlankIntr(void); + +void TwlMain( void ) +{ + char path[] = "nand:/tmp/a/b/c/d/hogehoge.dat"; + UTL_RecoveryStatus result; + + OS_Init(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + + // とりあえずファイルサイズに16byte指定 + result = UTL_RecoveryFile( path, 0x0010 ); + + OS_TPrintf("recovery result: %d\n", result); + OS_TPrintf("%s\n", s_strResult[result] ); + OS_TPrintf( "*** End of demo\n" ); + OS_Terminate(); + + +} + +void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static char *s_strResult[] = { + "Target file exists and file size matched.", + "File size didn't match. Changing size succeeded.", + "Target file didn't exist. Creating file and setting size succeeded.", + "ERROR: File Recovery Failed." +}; \ No newline at end of file diff --git a/build/tests/HashCheckTemplate/ARM7/Makefile b/build/tests/HashCheckTemplate/ARM7/Makefile new file mode 100644 index 00000000..e2d8e1b7 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBMAKES = Makefile_ltd Makefile_hyb Makefile_ltd_offset + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM7/Makefile_hyb b/build/tests/HashCheckTemplate/ARM7/Makefile_hyb new file mode 100644 index 00000000..0f47bbf5 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/Makefile_hyb @@ -0,0 +1,88 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - mongoose.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = HYBRID +override TWL_CODEGEN = ARM +TWL_NO_STD_PCHDR = True + +#---------------------------------------------------------------------------- + +SRCDIR += $(ROOT)/build/components/mongoose.TWL/src + +SRCS = main.c initScfg.c + +TARGET_NAME = mongoose_hct + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = mongoose_hct.lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/mongoose.TWL/mongoose.lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/mongoose.TWL/mongoose.response.template + +LLIBRARY_DIRS += ../crt/ARM7/obj/ARM7-TS.HYB/$(TWL_BUILD_DIR) +CRT0_O = crt0_hct.HYB.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +# If THUMB, use ARM libraries +# CODEGEN が THUMB の場合、ARM でビルドしたものを THUMB として装います。 +ifeq ($(TARGET_CODEGEN),THUMB) +TWL_LIBSUFFIX = .TWL$(ARCHGEN_TYPE) +CODEGEN_CC = ARM +endif + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='$(if $(ISDBG_LIBS_NITRO),$(ISDBG_LIBS_NITRO),libstubsisd_sp$(TWL_LIBSUFFIX).a)' + +#-------------------------------- +# install target +#-------------------------------- +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ + $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include + +#LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ +# libcdc_sp$(TWL_LIBSUFFIX).a \ +# libtpex_sp$(TWL_LIBSUFFIX).a \ +# libmicex_sp$(TWL_LIBSUFFIX).a \ +# libsdio_hcd_twl$(TWL_LIBSUFFIX).a \ +# libsdio_busdriver$(TWL_LIBSUFFIX).a \ +# libsdio_lib$(TWL_LIBSUFFIX).a \ +# librompatch_sp$(TWL_LIBSUFFIX).a \ +# libARM7athdrv$(TWL_LIBSUFFIX).a \ + + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM7/Makefile_ltd b/build/tests/HashCheckTemplate/ARM7/Makefile_ltd new file mode 100644 index 00000000..5893c9ca --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/Makefile_ltd @@ -0,0 +1,81 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +override TWL_CODEGEN = ARM +TWL_NO_STD_PCHDR = True + +#---------------------------------------------------------------------------- + +SRCDIR += $(ROOT)/build/components/mongoose.TWL/src + +SRCS = main.c initScfg.c + +TARGET_NAME = racoon_hct + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = racoon_hct.lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/racoon.TWL/racoon.lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/racoon.TWL/racoon.response.template + +LLIBRARY_DIRS += ../crt/ARM7/obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) +CRT0_O = crt0_hct.LTD.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#MACRO_FLAGS += -DSDK_ARM7COMP_LTD + +ifeq ($(TWL_PLATFORM),BB) +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037e0000' +else +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' +endif + +MAKELCF_FLAGS += -DADDRESS_FLXMAIN='0x02380000' + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include +#LLIBRARIES += libwl_sp.TWL.LTD.a libsdio_hcd_twl$(TWL_LIBSUFFIX).a libsdio_busdriver$(TWL_LIBSUFFIX).a libsdio_lib$(TWL_LIBSUFFIX).a libARM7athdrv$(TWL_LIBSUFFIX).a +LLIBRARIES += libwl_sp.TWL.LTD.a +#LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ +# libcdc_sp$(TWL_LIBSUFFIX).a \ +# libtpex_sp$(TWL_LIBSUFFIX).a \ +# libmicex_sp$(TWL_LIBSUFFIX).a \ +# libsdio_hcd_twl$(TWL_LIBSUFFIX).a \ +# libsdio_busdriver$(TWL_LIBSUFFIX).a \ +# libsdio_lib$(TWL_LIBSUFFIX).a \ +# librompatch_sp$(TWL_LIBSUFFIX).a \ +# libARM7athdrv$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM7/Makefile_ltd_offset b/build/tests/HashCheckTemplate/ARM7/Makefile_ltd_offset new file mode 100644 index 00000000..123e2195 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/Makefile_ltd_offset @@ -0,0 +1,83 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +override TWL_CODEGEN = ARM +TWL_NO_STD_PCHDR = True + +#---------------------------------------------------------------------------- + +SRCDIR += $(ROOT)/build/components/mongoose.TWL/src + +SRCS = main.c initScfg.c + +TARGET_NAME = racoon_hct_offset + +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = racoon_hct.lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/racoon.TWL/racoon.lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/racoon.TWL/racoon.response.template + +LLIBRARY_DIRS += ../crt/ARM7/obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) +CRT0_O = crt0_hct.LTD.TWL.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#MACRO_FLAGS += -DSDK_ARM7COMP_LTD + +ifeq ($(TWL_PLATFORM),BB) +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037e0000' +else +MAKELCF_FLAGS += -DADDRESS_LTDWRAM='0x037c0000' +endif + +MAKELCF_FLAGS += -DADDRESS_FLXMAIN='0x02390000' + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + + +LINCLUDES = $(ROOT)/build/libraries/spi/ARM7/include +#LLIBRARIES += libwl_sp.TWL.LTD.a libsdio_hcd_twl$(TWL_LIBSUFFIX).a libsdio_busdriver$(TWL_LIBSUFFIX).a libsdio_lib$(TWL_LIBSUFFIX).a libARM7athdrv$(TWL_LIBSUFFIX).a +LLIBRARIES += libwl_sp.TWL.LTD.a +#LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ +# libcdc_sp$(TWL_LIBSUFFIX).a \ +# libtpex_sp$(TWL_LIBSUFFIX).a \ +# libmicex_sp$(TWL_LIBSUFFIX).a \ +# libsdio_hcd_twl$(TWL_LIBSUFFIX).a \ +# libsdio_busdriver$(TWL_LIBSUFFIX).a \ +# libsdio_lib$(TWL_LIBSUFFIX).a \ +# librompatch_sp$(TWL_LIBSUFFIX).a \ +# libARM7athdrv$(TWL_LIBSUFFIX).a + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM7/mongoose_hct.lsf b/build/tests/HashCheckTemplate/ARM7/mongoose_hct.lsf new file mode 100644 index 00000000..78e6357d --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/mongoose_hct.lsf @@ -0,0 +1,172 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - mongoose.TWL +# File: mongoose.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + Library $(CRT0_O) \ + libos_sp$(LIBSUFFIX).a \ + libsyscall_sp.twl.a \ + libmi_sp$(LIBSUFFIX).a + Object $(OBJDIR)/initScfg.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address 0x037f8000 + + Library libsubpsyscall.a + Library $(CW_LIBS) + Library libpad_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libctrdg_sp$(LIBSUFFIX).a + + Object * (.etable) + Object * (.wram) + Object $(OBJDIR)/main.o + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( AddTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in WlCmdIf.o + ## Object OBJECT( RequestCmdTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WStop , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp.TWL$(ARCHGEN).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp.TWL$(ARCHGEN).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp.TWL$(ARCHGEN).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp.TWL$(ARCHGEN).a ) (.text) + +} + +#-------- +Autoload MAIN +{ + Address 0x02fe0000 + Library librtc_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a + Library libwl_sp.TWL$(ARCHGEN).a + Library $(ISDBG_LIBS_NITRO) + Library $(ISDBG_LIBS_TWL) +} + +#-------- +Ltdautoload LTDWRAM +{ + Address 0x03000000 + Object * (.ltdwram) + Library libi2c_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libaes_sp$(LIBSUFFIX).a + + Library libsdio_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + + Object OBJECT( wpa_sm_rx_eapol , libwpa_sp$(LIBSUFFIX).a ) (.text) + + # FATFS core symbols + Object OBJECT(FATFSi_lfi2text, libfatfs_sp$(LIBSUFFIX).a) (.text) # 360 BYTEs + Object OBJECT(FATFSi_pc_findin, libfatfs_sp$(LIBSUFFIX).a) (.text) # 904 BYTEs + Object OBJECT(FATFSi_pc_patcmp_vfat, libfatfs_sp$(LIBSUFFIX).a) (.text) # 436 BYTEs + Object OBJECT(FATFSi_pc_ascii_mfile, libfatfs_sp$(LIBSUFFIX).a) (.text) # 160 BYTEs + Object OBJECT(FATFSi_map_ascii_to_unicode, libfatfs_sp$(LIBSUFFIX).a) (.text) # 48 BYTEs + Object OBJECT(SDCARD_Intr_Thread, libfatfs_sp$(LIBSUFFIX).a) (.text) # 520 BYTEs + Object OBJECT(FATFSi_unicode_cmp_to_ascii_char, libfatfs_sp$(LIBSUFFIX).a) (.text) # 40 BYTEs + Object OBJECT(FATFSi_pc_read_blk, libfatfs_sp$(LIBSUFFIX).a) (.text) # 352 BYTEs + +} + +#-------- +Ltdautoload LTDMAIN +{ + Address 0x02f88000 + Object * (.ltdmain) + Library libnwm_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + + Library libwpa_sp$(LIBSUFFIX).a +} diff --git a/build/tests/HashCheckTemplate/ARM7/racoon_hct.lsf b/build/tests/HashCheckTemplate/ARM7/racoon_hct.lsf new file mode 100644 index 00000000..2928fee8 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM7/racoon_hct.lsf @@ -0,0 +1,231 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: racoon.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address $(ADDRESS_FLXMAIN) + Library $(CRT0_O) \ + libos_sp$(LIBSUFFIX).a \ + libsyscall_sp.twl.a \ + libmi_sp$(LIBSUFFIX).a + Object $(OBJDIR)/initScfg.o + StackSize 1024 1024 +} + +#-------- +Autoload WRAM +{ + Address $(ADDRESS_LTDWRAM) + + Library libsubpsyscall.a \ + $(CW_LIBS) \ + libpad_sp$(LIBSUFFIX).a \ + libpxi_sp$(LIBSUFFIX).a \ + libstd_sp$(LIBSUFFIX).a \ + libexi_sp$(LIBSUFFIX).a \ + libsnd_sp$(LIBSUFFIX).a \ + libspi_sp$(LIBSUFFIX).a \ + libpm_sp$(LIBSUFFIX).a \ + libmath_sp$(LIBSUFFIX).a \ + libscfg_sp$(LIBSUFFIX).a \ + libtp_sp$(LIBSUFFIX).a \ + libmic_sp$(LIBSUFFIX).a \ + libfs_sp$(LIBSUFFIX).a \ + libcard_sp$(LIBSUFFIX).a \ + libi2c_sp$(LIBSUFFIX).a \ + libcamera_sp$(LIBSUFFIX).a \ + libcdc_sp$(LIBSUFFIX).a \ + libsndex_sp$(LIBSUFFIX).a \ + libtpex_sp$(LIBSUFFIX).a \ + libmicex_sp$(LIBSUFFIX).a \ + libmcu_sp$(LIBSUFFIX).a \ + + Library libsdio_sp$(LIBSUFFIX).a + + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + + + Object * (.etable) + Object * (.wram) + Object * (.ltdwram) + Object $(OBJDIR)/main.o + + # caches in fatfs library, that should be on WRAM. + # 2007/12/11 OBJECT() による .bss シンボルのリンクがうまくいかないので、 + # 変数定義箇所に pragma で .ltdwram セクションに含まれるように暫定対策しました。 +# Object OBJECT( FATFSi___mem_drives_structures , libfatfs_sp$(LIBSUFFIX).a) (.bss) + + ##### + # Sub-routines in WL library , that should be on WRAM. + # in TaskMan.o + Object OBJECT( MainTaskRoutine , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( LowestIdleTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ExecuteMessage , libwl_sp$(LIBSUFFIX).a ) (.text) + # in BufMan.o + Object OBJECT( NewHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DeleteHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AllocateHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ReleaseHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MoveHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AddHeapBuf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( GetHeapBufNextAdrs , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlCmdIf.o + Object OBJECT( RequestCmdTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SendMessageToWmDirect , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlNic.o + Object OBJECT( WStart , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WStop , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WSetStaState , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntr.o + Object OBJECT( WlIntr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrPreTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTbtt , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrActEnd , libwl_sp$(LIBSUFFIX).a ) (.text) +# Object OBJECT( WlIntrAckCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrCntOvf , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxErr , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxCntup , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartTx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrStartRx , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxq , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( MacBugTxMp , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AdjustRingPointer , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( CheckKeyTxEnd , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WlIntrTask.o + Object OBJECT( WlIntrTxBeaconTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrTxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrRxEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WlIntrMpEndTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( SetParentTbttTxqTask , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( TakeoutRxFrame , libwl_sp$(LIBSUFFIX).a ) (.text) + # in TxCtrl.o + Object OBJECT( InitTxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in RxCtrl.o + Object OBJECT( InitRxCtrl , libwl_sp$(LIBSUFFIX).a ) (.text) + # in WaitLoop.o + Object OBJECT( WaitLoop_Rxpe , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_Waitus , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_ClrAid , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_BbpAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( WaitLoop_RfAccess , libwl_sp$(LIBSUFFIX).a ) (.text) + + +} + +#-------- +Ltdautoload RSVWRAM +{ + Address 0x03040000 + Object * (.rsvwram) + Library libathdrv_sp$(LIBSUFFIX).a (.bss) + Library libathdrv_sp$(LIBSUFFIX).a (.data) + + ##### + # Sub-routines in TWL WIRELESS Driver , that should be on WRAM. + Object OBJECT( HTCSendPktCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCIssueSend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCTrySend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCSendPkt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCProcessCreditRpt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevRecvPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCProcessRecvHeader, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCRecvCompleteHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCRecvMessagePendingHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCAddReceivePkt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AR6KFreeIOPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( AR6KAllocIOPacket, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevRWCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevGetEventAsyncHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevCheckPendingRecvMsgsAsync, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DevDsrHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HIFReadWrite, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( hifRWCompletionHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( hifIRQHandler, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HIFAckInterrupt, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_credit_distribute, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_alloc, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_alloc_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_put, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_push, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_pull, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_free, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_to_data, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_to_len, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( a_netbuf_headroom, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_drv_return_netbuf, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ath_queue_remove_from_head, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ath_queue_insert_tail, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_alloc_cookie, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_driver_tx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_tx_complete, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_dix_2_dot3, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_data_hdr_add, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_data_hdr_remove, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( nin_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_ibss_map_epid, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DL_ListInsertTail, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( DL_ListRemove, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_control_rx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_cmd_send, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( ar6000_control_tx, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( wmi_implicit_create_pstream, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCAllocControlBuffer, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( HTCFreeControlBuffer, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMILZData, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( bmiBufferSend, libathdrv_sp$(LIBSUFFIX).a ) (.text) + Object OBJECT( BMIWriteMemory, libathdrv_sp$(LIBSUFFIX).a ) (.text) + + + # FATFS core symbols + Object OBJECT(FATFSi_lfi2text, libfatfs_sp$(LIBSUFFIX).a) (.text) # 360 BYTEs + Object OBJECT(FATFSi_pc_findin, libfatfs_sp$(LIBSUFFIX).a) (.text) # 904 BYTEs + Object OBJECT(FATFSi_pc_patcmp_vfat, libfatfs_sp$(LIBSUFFIX).a) (.text) # 436 BYTEs + Object OBJECT(FATFSi_pc_ascii_mfile, libfatfs_sp$(LIBSUFFIX).a) (.text) # 160 BYTEs + Object OBJECT(FATFSi_map_ascii_to_unicode, libfatfs_sp$(LIBSUFFIX).a) (.text) # 48 BYTEs + Object OBJECT(SDCARD_Intr_Thread, libfatfs_sp$(LIBSUFFIX).a) (.text) # 520 BYTEs + Object OBJECT(FATFSi_unicode_cmp_to_ascii_char, libfatfs_sp$(LIBSUFFIX).a) (.text) # 40 BYTEs + Object OBJECT(FATFSi_pc_read_blk, libfatfs_sp$(LIBSUFFIX).a) (.text) # 352 BYTEs +} + +#-------- +Ltdautoload LTDMAIN +{ + Address 0x02f88000 + + Object * (.ltdmain) + Library libwm_sp$(LIBSUFFIX).a \ + libnwm_sp$(LIBSUFFIX).a \ + libwvr_sp$(LIBSUFFIX).a \ + libwl_sp$(LIBSUFFIX).a + + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + + Library libfatfs_sp$(LIBSUFFIX).a \ + libaes_sp$(LIBSUFFIX).a + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) +} diff --git a/build/tests/HashCheckTemplate/ARM9/Makefile b/build/tests/HashCheckTemplate/ARM9/Makefile new file mode 100644 index 00000000..a63deeb2 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/Makefile @@ -0,0 +1,29 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBMAKES = Makefile_ltd Makefile_hyb + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM9/Makefile_hyb b/build/tests/HashCheckTemplate/ARM9/Makefile_hyb new file mode 100644 index 00000000..79a3f290 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/Makefile_hyb @@ -0,0 +1,75 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +override TWL_ARCHGEN = HYBRID + +TARGET_NAME = HashCheckTemplate +TARGET_BIN = $(TARGET_NAME).tad + +TITLEID_LO = 0DTA + +ROM_SPEC = main.rsf +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/rom_header_$(call toLower,$(TITLEID_LO)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/libsyscall.a + +MISC_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/misc + +SRCS = main.c HashCheckTemplate.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +#デバッグ用パラメータ追加 +MAKEROM_FLAGS += -DSYSCALL_C='$(call empath,$(LIBSYSCALL:.a=_c.bin))' \ + -DARM9FLX_EXPAND=0x27c000 \ + -DARM7FLX_EXPAND=0x40000 \ + -DARM9LTD_EXPAND=0x280000 \ + -DARM7LTD_EXPAND=0x108000 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.DEBUG.exe + +DEFAULT_COMP_ARM7 = mongoose_hct +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +LDIRT_CLEAN = $(TARGET_TAD) +INSTALL_TARGETS = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM9/Makefile_ltd b/build/tests/HashCheckTemplate/ARM9/Makefile_ltd new file mode 100644 index 00000000..bf6f7936 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/Makefile_ltd @@ -0,0 +1,75 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +override TWL_ARCHGEN = LIMITED + +TARGET_NAME = HashCheckTemplate +TARGET_BIN = $(TARGET_NAME).tad + +TITLEID_LO = 0DTA + +ROM_SPEC = main.rsf +ROM_HEADER_TEMPLATE = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/rom_header_$(call toLower,$(TITLEID_LO)).template.sbin +LIBSYSCALL = $(SYSMENU_ROM_HEADER_DIR)/$(TITLEID_LO)/libsyscall.a + +MISC_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/misc + +SRCS = main.c HashCheckTemplate.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -F -DTITLEID_LO='$(TITLEID_LO)' \ + -DROM_HEADER_TEMPLATE='$(call empath,$(ROM_HEADER_TEMPLATE))' + +#デバッグ用パラメータ追加 +MAKEROM_FLAGS += -DSYSCALL_C='$(call empath,$(LIBSYSCALL:.a=_c.bin))' \ + -DARM9FLX_EXPAND=0x27c000 \ + -DARM7FLX_EXPAND=0x40000 \ + -DARM9LTD_EXPAND=0x280000 \ + -DARM7LTD_EXPAND=0x108000 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.DEBUG.exe + +DEFAULT_COMP_ARM7 = racoon_hct +DEFAULT_MAKEROM_ARM7_BASE = ../ARM7/bin/$(TWL_BUILDTYPE_ARM7)/$(DEFAULT_COMP_ARM7) +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + +LDIRT_CLEAN = $(TARGET_TAD) +INSTALL_TARGETS = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/ARM9/main.rsf b/build/tests/HashCheckTemplate/ARM9/main.rsf new file mode 100644 index 00000000..8f742b9a --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/main.rsf @@ -0,0 +1,185 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + RomHeaderTemplate $(ROM_HEADER_TEMPLATE) + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType User + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.c b/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.c new file mode 100644 index 00000000..3764fe64 --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.c @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: HashCheckTemplate.c + + Copyright 2007 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 "misc.h" +#include "HashCheckTemplate.h" + +// define data------------------------------------------ +#define RETURN_BUTTON_TOP_X 2 +#define RETURN_BUTTON_TOP_Y 21 +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) + +#define UNDEF_CODE 0xe7ffdeff + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- +static BOOL s_switch = TRUE; + +//static u32 dummy[1024*1024/2]={1,2,3,};//2MB + +// const data ----------------------------------------- + +//====================================================== +// 再配置チェッカー(多分ここからやる事は表示のみ) +//====================================================== + +/* +static void draw_sub1(u8 *ram_addr, u8 *header_addr, int y) +{ + int l; + PrintfSJIS(8,y,TXT_UCOLOR_DARKGREEN, "ARM9FLX ( VERIFY %s ) :",( (*(u32 *)0x02000180 == UNDEF_CODE) ? "OK" : "NG" )); + + for (l=0; l<20; l++) + { + PrintfSJIS(24+(l%10)*19, y+12+12*(l/10), TXT_COLOR_BLACK, "%.2x", *(ram_addr+l)); + if(s_switch) + { + PrintfSJIS(24+(l%10)*19, y+12+12*(l/10), (*(ram_addr+l) != *(header_addr+l)) ? TXT_COLOR_RED : TXT_COLOR_BLUE, "%.2x", *(header_addr+l)); + } + } +} +*/ + +static void draw_sub2(u8 *ram_addr, u8 *header_addr, int y, const u16 *str) +{ + int l; + PutStringUTF16(8,y,TXT_UCOLOR_DARKGREEN, str); + for (l=0; l<20; l++) + { + PrintfSJIS(24+(l%10)*19, y+12+12*(l/10), TXT_COLOR_BLACK, "%.2x", *(ram_addr+l)); + if(s_switch ) + { + PrintfSJIS(24+(l%10)*19, y+12+12*(l/10), (*(ram_addr+l) != *(header_addr+l)) ? TXT_COLOR_RED : TXT_COLOR_BLUE, "%.2x", *(header_addr+l)); + } + } +} + +static void encryObjdraw(void) +{ + int l; + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"decrypted encryObj (first 200 bytes)"); + for (l=0; l<50; l++) + { + PrintfSJIS(4+(l%4)*64, 24+12*(l/4), TXT_COLOR_BLACK, "%.8x", *(((u32 *)0x02000180)+l) ); + } +} + +static void draw() +{ + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + + PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"SelfDigestChecker"); + PutStringUTF16( 3 * 8, 1 * 12, TXT_COLOR_BLACK, (const u16 *)L"Press A to Check Digest...."); + + draw_sub2((u8 *)0x02000100, (u8 *)(HW_TWL_ROM_HEADER_BUF + 0x38c), 12*2+4, (const u16 *)L"ARM9FLX :" ); + draw_sub2((u8 *)0x02000120, (u8 *)(HW_TWL_ROM_HEADER_BUF + 0x314), 12*5+8, (const u16 *)L"ARM7FLX :" ); + draw_sub2((u8 *)0x02000140, (u8 *)(HW_TWL_ROM_HEADER_BUF + 0x350), 12*8+12, (const u16 *)L"ARM9LTD :" ); + draw_sub2((u8 *)0x02000160, (u8 *)(HW_TWL_ROM_HEADER_BUF + 0x364), 12*11+16, (const u16 *)L"ARM7LTD :" ); +} + +// 初期化 +void HashCheckTemplateInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + + draw(); + + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + +static u32 c; +// メインループ +void HashCheckTemplateMain(void) +{ + BOOL tp_cancel = FALSE; + + ReadTP(); // タッチパネル入力の取得 + + // [RETURN]ボタン押下チェック + if(tpd.disp.touch) { + tp_cancel = WithinRangeTP( RETURN_BUTTON_TOP_X * 8, RETURN_BUTTON_TOP_Y * 8 - 4, + RETURN_BUTTON_BOTTOM_X * 8, RETURN_BUTTON_BOTTOM_Y * 8 - 4, &tpd.disp ); + } + + if( ( pad.trg & PAD_BUTTON_A )) { + s_switch = !s_switch; + draw(); + } + + if( ( pad.trg & PAD_BUTTON_X )) { + encryObjdraw(); + } + + if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { +// SYSM_RebootLauncher(); + } + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); +} + + diff --git a/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.h b/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.h new file mode 100644 index 00000000..fe20f46a --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/src/HashCheckTemplate.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: HashCheckTemplate.h + + Copyright 2007 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 __HASH_CHECK_TEMPLATE_H__ +#define __HASH_CHECK_TEMPLATE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include + +// define data---------------------------------------------------------- + +void HashCheckTemplateInit( void ); +void HashCheckTemplateMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __HASH_CHECK_TEMPLATE_H__ diff --git a/build/tests/HashCheckTemplate/ARM9/src/main.c b/build/tests/HashCheckTemplate/ARM9/src/main.c new file mode 100644 index 00000000..c42a2d4d --- /dev/null +++ b/build/tests/HashCheckTemplate/ARM9/src/main.c @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "HashCheckTemplate.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + OS_SetArenaHi(OS_ARENA_MAIN, (void *)0x02d00000);// arm9MMEMheap + InitAllocator(); + + InitBG(); + HashCheckTemplateInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + HashCheckTemplateMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/HashCheckTemplate/Makefile b/build/tests/HashCheckTemplate/Makefile new file mode 100644 index 00000000..96d468e9 --- /dev/null +++ b/build/tests/HashCheckTemplate/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner crt ARM7 ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/banner/Makefile b/build/tests/HashCheckTemplate/banner/Makefile new file mode 100644 index 00000000..cf9ea411 --- /dev/null +++ b/build/tests/HashCheckTemplate/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -d -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/HashCheckTemplate/banner/banner_v3.bsf b/build/tests/HashCheckTemplate/banner/banner_v3.bsf new file mode 100644 index 00000000..fb39aad4 Binary files /dev/null and b/build/tests/HashCheckTemplate/banner/banner_v3.bsf differ diff --git a/build/tests/HashCheckTemplate/banner/icon/gameIcon.bmp b/build/tests/HashCheckTemplate/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..2d6194b1 Binary files /dev/null and b/build/tests/HashCheckTemplate/banner/icon/gameIcon.bmp differ diff --git a/build/tests/HashCheckTemplate/crt/ARM7/Makefile b/build/tests/HashCheckTemplate/crt/ARM7/Makefile new file mode 100644 index 00000000..75aef4bf --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/ARM7/Makefile @@ -0,0 +1,29 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - init - ARM7.TWL +# File: Makefile.LTD +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBMAKES = Makefile_ltd Makefile_hyb + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/crt/ARM7/Makefile_hyb b/build/tests/HashCheckTemplate/crt/ARM7/Makefile_hyb new file mode 100644 index 00000000..1af439e1 --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/ARM7/Makefile_hyb @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - init - ARM7.TWL +# File: Makefile.HYB +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL + +# Codegen for sub processer +override TWL_PROC = ARM7 + +# Avoid to use pre-compile-header of "nitro.h" +TWL_NO_STD_PCHDR = True + +# Avoid to build THUMB version object +override TARGET_CODEGEN = ARM + +# Avoid to build LIMITED version object +override TWL_ARCHGEN = HYBRID + +SRCDIR = src +INCDIR = ../common/include + +SRCS = crt0_hct.HYB.c +TARGET_OBJ = crt0_hct.HYB.TWL.o + +MACRO_FLAGS += -DSDK_NOINIT + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +$(OBJDIR)/$(TARGET_OBJ): $(OBJDIR)/$(SRCS:.c=.o) + $(CP) $< $@ + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/crt/ARM7/Makefile_ltd b/build/tests/HashCheckTemplate/crt/ARM7/Makefile_ltd new file mode 100644 index 00000000..9b602b3f --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/ARM7/Makefile_ltd @@ -0,0 +1,52 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - init - ARM7.TWL +# File: Makefile.LTD +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL + +# Codegen for sub processer +override TWL_PROC = ARM7 + +# Avoid to use pre-compile-header of "nitro.h" +TWL_NO_STD_PCHDR = True + +# Avoid to build THUMB version object +override TARGET_CODEGEN = ARM + +# Avoid to build HYBRID version object +override TWL_ARCHGEN = LIMITED + +SRCDIR = src +INCDIR = ../common/include + +SRCS = crt0_hct.LTD.c +TARGET_OBJ = crt0_hct.LTD.TWL.o + +MACRO_FLAGS += -DSDK_NOINIT + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +$(OBJDIR)/$(TARGET_OBJ): $(OBJDIR)/$(SRCS:.c=.o) + $(CP) $< $@ + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.HYB.c b/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.HYB.c new file mode 100644 index 00000000..1e2a39f7 --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.HYB.c @@ -0,0 +1,918 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.HYB.c + + Copyright 2007 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 +#include +#include +#include "boot_sync.h" + + + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); +void WVR_ShelterExtWram(void); +void INIT_InitializeScfg(void); + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* 外部関数参照定義 */ +extern void OS_IrqHandler(void); +extern void _fp_init(void); +extern void __call_static_initializers(void); + +/* 内部関数プロトタイプ定義 */ +static void INITi_SetHMACSHA1ToAppParam(void); +static void INITi_DoAutoload(void); +static void INITi_ShelterLtdBinary(void); +static BOOL INITi_IsRunOnTwl( void ); +static void INITi_CopySysConfig( void ); +static void INITi_DetectMainMemorySize(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_WRAM_ARENA_LO(void); +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); + +void* const _start_ModuleParams[] = +{ + (void*)SDK_AUTOLOAD_LIST, + (void*)SDK_AUTOLOAD_LIST_END, + (void*)SDK_AUTOLOAD_START, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, // CompressedStaticEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_CURRENT_VERSION_NUMBER, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, // CompressedLtdautoloadEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LTDMAIN_START(void); + +void* const _start_LtdMainParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LTDMAIN_START, +}; + +#ifdef DEBUG_WRAM_SETTING +u32 const wramMapping[12] = { + 0x8d898581, 0x8c888480, 0x9c989490, 0x8c888480, + 0x9c989490, 0x00000000, 0x09403900, 0x09803940, + 0x00403000, 0x09403900, 0x09803940, 0x0300000f +}; +#endif + +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) +static const u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + +/* IPL によってメインメモリ上に展開される情報のアドレス定義 */ +#define IPL_PARAM_DOWNLOAD_PARAMETER 0x023fe904 +#define IPL_PARAM_CARD_ROM_HEADER 0x023fe940 + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +#ifdef DEBUG_WRAM_SETTING +/*---------------------------------------------------------------------------* + Name: WaitAgreement + Description: ARM9 の起動ベクタが特定の状態になるまで待つ。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - 同期用フェーズ管理変数へのポインタ。 + r1 - 待機するフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_WaitAgreement[7] = +{ + 0xe1d020b0, /* @1: ldrh r2, [r0] ; フェーズ管理変数を共有メモリから読む */ + 0xe1510002, /* cmp r1, r2 ; 待機フェーズ番号と比較 */ + 0x012fff1e, /* bxeq lr ; 一致していれば待機完了 */ + 0xe3a03010, /* mov r3, #16 ; 空ループ回数初期化 */ + 0xe2533001, /* @2: subs r3, r3, #1 ; 空ループ回数 -- */ + 0x1afffffd, /* bne @2 ; 16 回ループ */ + 0xeafffff8 /* b @1 ; 先頭に戻る */ +}; +#endif + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + r1 - 同期用フェーズ管理変数へのポインタ。 + r2 - ARM9 に伝えるフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[2] = +{ + 0xe1c120b0, /* strh r2, [r1] ; フェーズ管理変数を更新 */ + 0xe12fff10 /* bx r0 ; Main 関数へジャンプ */ +}; + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割り込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] // Use that LSB of HW_REG_BASE is 0b0 + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 +@001: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @001 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + + // ロードされたアプリのダイジェストを計算してアプリ間パラメータに格納 + bl INITi_SetHMACSHA1ToAppParam + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for stack check code + mov r0, #HW_PSR_SYS_MODE // System mode + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* SCFG を HW_SYS_CONF_BUF へコピー */ + bl INIT_InitializeScfg + bl INITi_CopySysConfig + + /* TWL ハードウェア上で動作しているかどうかを調査 */ + bl INITi_IsRunOnTwl + bne @013 + + /* TWL ハードウェア上で動作している場合 */ + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + + b @020 + +@013: /* NTR ハードウェア上で動作している場合 */ + /* ブートタイプが MB の場合のみ、ROM ヘッダ情報を所定位置にコピー */ + ldr r0, =HW_WM_BOOT_BUF + ldrh r0, [r0] + cmp r0, #OS_BOOTTYPE_DOWNLOAD_MB + bne @020 + /* カードの ROM ヘッダ情報を共有エリアに退避 */ + ldr r0, =HW_CARD_ROM_HEADER + ldr r1, =IPL_PARAM_CARD_ROM_HEADER + mov r2, #HW_CARD_ROM_HEADER_SIZE + bl INITi_Copy32 + /* ダウンロードパラメータ情報を共有エリアに退避 */ + ldr r0, =HW_DOWNLOAD_PARAMETER + ldr r1, =IPL_PARAM_DOWNLOAD_PARAMETER + mov r2, #HW_DOWNLOAD_PARAMETER_SIZE + bl INITi_Copy32 + +@020: + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC ブロックの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + //---- detect main memory size + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + //---- set debug print window + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7<<8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR<<8) + strh r0, [r1, #2] +#endif + + /* 割り込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@030: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + ldr r0, [r1], #4 + str r0, [sp, #-4] + ldr r0, [r1] + str r0, [sp] + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =TwlSpMain + ldr r1, =HW_BOOT_SYNC_PHASE + mov r2, #BOOT_SYNC_PHASE_4 + ldr lr, =HW_RESET_VECTOR + sub r3, sp, #4 + bx r3 +} + +#include +#include +#include +/*---------------------------------------------------------------------------* + Name: INITi_SetHMACSHA1ToAppParam + Description: ROMがロードされた各アプリ領域のHMACSHA1を計算し、特定のアドレ + スに保存 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define UNDEF_CODE 0xe7ffdeff +#define ENCRYPT_DEF_SIZE 0x800 +#define DGT_TGT_ADDR ( HW_MAIN_MEM + 0x0100 ) + +static void INITi_SetHMACSHA1ToAppParam(void) +{ + SVCHMACSHA1Context *pCon = ( SVCHMACSHA1Context * ) (0x2000300 - sizeof(SVCHMACSHA1Context)); + ROM_Header_Short *pROMH = (ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + u32 bak; + + // arm9_flx + bak = *(u32 *)pROMH->main_autoload_done; + *(u32 *)pROMH->main_autoload_done = 0xE12FFF1E; + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->main_ram_address, pROMH->main_size); + SVC_HMACSHA1GetHash(pCon, (void *)DGT_TGT_ADDR); + *(u32 *)pROMH->main_autoload_done = bak; + // arm7_flx + bak = *(u32 *)pROMH->sub_autoload_done; + *(u32 *)pROMH->sub_autoload_done = 0xE12FFF1E; + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->sub_ram_address, pROMH->sub_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 32)); + *(u32 *)pROMH->sub_autoload_done = bak; + // arm9_ltd + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->main_ltd_ram_address, pROMH->main_ltd_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 2 * 32)); + // arm7_ltd + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->sub_ltd_ram_address, pROMH->sub_ltd_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 3 * 32)); +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* + * < 二段階オートロード > + * 0x02380000 に crt0 及び一段目ロード元バイナリが配置されている。 + * NITRO と共有可能な WRAM 上に配置されるべきバイナリデータを 0x037f8000 にロードする。 + * NITRO と共有可能な MAIN 上に配置されるべきバイナリデータを 0x02fe0000 にロードする。 + * NITRO と共有可能な VRAM 上に配置されるべきバイナリデータがある場合は WVR ライブラリのローダ関数を呼び出す。 + * 0x02400000 に ARM9 の二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f80000 - 0x02f84000 に退避する。 + * 0x02e80000 に二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f84000 - 0x02f88000 に退避する。 + * TWL でしか動作しない WRAM 上に配置されるべきバイナリデータを 0x03000000 にロードする。 + * TWL でしか動作しない MAIN 上に配置されるべきバイナリデータを 0x02f88000 にロードする。 + */ +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + +@01_autoload: + /* NITRO 共用ブロックをオートロード */ + ldr r0, =_start_ModuleParams + ldr r12, [r0] // r12 = SDK_AUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_AUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_AUTOLOAD_START +@01_segments_loop: + cmp r12, r3 + bge @02_start + /* VRAM へのオートロードブロックかどうかを調査 */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, =HW_EXT_WRAM + cmp r0, r2 + beq @01_shelter_vram_segment + /* 固定セクション */ + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 // r0 = start address of source range of static initializers table +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = size of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} // r1 = end address of source range of the autoload segment + b @01_segments_loop + +@01_shelter_vram_segment: + ldr r2, [r12], #12 // r2 = size of fixed section + add r1, r1, r2 // r1 = end address of source range of the autoload segment + /* VRAM へのオートロードブロックをバックアップ */ + stmfd sp!, {r1, r3, r12} + bl WVR_ShelterExtWram + ldmfd sp!, {r1, r3, r12} + b @01_segments_loop + +@02_start: + /* TWL ハードウェア上で動作しているかどうか調査 */ + bl INITi_IsRunOnTwl + bne @03_start + /* 再読み出し不可部分を退避 */ + bl INITi_ShelterLtdBinary + + /* TWL 専用オートロードブロックの存在を確認 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + ldr r0, [r1, #ROM_Header.s.sub_ltd_size] + cmp r0, #0 + beq @03_start + +@02_autoload: + /* TWL 専用ブロックをオートロード */ + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_LTDAUTOLOAD_START +@02_segments_loop: + cmp r12, r3 + bge @03_start + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = size of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} // r1 = end address of source range of the ltdautoload segment + b @02_segments_loop + +@03_start: + /* オートロード完了コールバック関数呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + +/*---------------------------------------------------------------------------* + Name: INITi_ShelterLtdBinary + Description: TWL 専用のオートロード元バイナリデータの内、カード ROM から + 再読み出しできない領域のデータを退避エリアに退避する。 + 再読み出しできない領域のデータは ARM7 用と ARM9 用の拡張常駐 + モジュールの2つに分かれている可能性があるので、冗長ではあるが + 両方の先頭から 0x4000 分をそれぞれ退避する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterLtdBinary(void) +{ + stmfd sp!, {lr} + + /* NAND からブートした場合には退避するデータの使い道がない為、処理をスキップ */ + ldr r3, =HW_TWL_ROM_HEADER_BUF + ldr r0, [r3, #ROM_Header.s.titleID_Hi] + tst r0, #TITLE_ID_HI_MEDIA_MASK + ldmnefd sp!, {pc} + +@shelter_arm7_ltdautoload_src: + /* ARM7 用拡張常駐モジュールの存在を確認 */ + ldr r1, [r3, #ROM_Header.s.sub_ltd_size] + cmp r1, #0 + beq @shelter_arm9_ltdautoload_src + + /* ARM7 用拡張常駐モジュールの先頭 16K bytes を退避 */ + ldr r1, [r3, #ROM_Header.s.sub_ltd_ram_address] + ldr r0, =_start_LtdMainParams + ldr r0, [r0] + mov r2, #0x4000 // r2 = size of shelter buffer + sub r0, r0, r2 // r0 = SDK_LTDAUTOLOAD_LTDMAIN_START - 0x4000 + bl INITi_Copy32 + +@shelter_arm9_ltdautoload_src: + /* ARM9 用拡張常駐モジュールの存在を確認 */ + ldr r3, =HW_TWL_ROM_HEADER_BUF + ldr r1, [r3, #ROM_Header.s.main_ltd_size] + cmp r1, #0 + beq @end + + /* ARM9 用拡張常駐モジュールの先頭 16K bytes を退避 */ + ldr r1, [r3, #ROM_Header.s.main_ltd_ram_address] + ldr r0, =_start_LtdMainParams + ldr r0, [r0] + mov r2, #0x4000 // r2 = size of shelter buffer + sub r0, r0, r2 + sub r0, r0, r2 // r0 = SDK_LTDAUTOLOAD_LTDMAIN_START - 0x8000 + bl INITi_Copy32 + +@end: + ldmfd sp!, {pc} +} + +#ifndef SDK_NOINIT +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* 退避場所先頭から空き場所を調査 */ +@001: ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 + + /* 空き場所にテーブルをコピー */ +@002: ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* テーブルに管理されているポインタを一つずつ呼び出し */ +@001: ldr r0, [r1] + cmp r0, #0 + beq @002 + stmdb sp!, {r1} + mov lr, pc + bx r0 + ldmia sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 + +@002: ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: NitroSpStartUp + Description: Hook for user start up. + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void +NitroSpStartUp(void) +{ +} + +/*---------------------------------------------------------------------------* + Name: INITi_IsRunOnTwl + + Description: check running platform + + This function is used in only Nitro-TWL hybrid mode. + (In Nitro mode and TWL limited mode, treated as constant) + + Arguments: None + + Returns: TRUE : running on TWL + FALSE : running on NITRO + *---------------------------------------------------------------------------*/ +static asm BOOL INITi_IsRunOnTwl( void ) +{ + ldr r0, =HW_PRV_WRAM_SYSRV + ldrb r0, [r0,#HWi_WSYS08_WRAMOFFSET] + and r0, r0, #HWi_WSYS08_ROM_ARM9SEC_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + moveq r0, #TRUE + movne r0, #FALSE + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INIT_InitializeScfg + + Description: ローダーが行う SCFG ブロックへの設定処理を代行する為の関数。 + 処理の実体は crt0 の外部に定義するため、弱シンボルとする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +INIT_InitializeScfg(void) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CopySysConfig + + Description: copy SCFG registers to HW_SYS_CONF_BUF and HW_PRV_WRAM_SYSRV + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static asm void INITi_CopySysConfig( void ) +{ + //---- copy scfg setting + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + + Description: detect main memory size. + result is written into (u32*)HW_MMEMCHECKER_SUB. + value is [OS_CONSOLE_SIZE_4MB|OS_CONSOLE_SIZE_8MB| + OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32MB] + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE 0x400000 +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void INITi_DetectMainMemorySize( void ) +{ + stmfd sp!, {lr} + + //---- detect memory size + mov r0, #OS_CONSOLE_SIZE_4MB + mov r1, #0 + + ldr r2, =HW_MMEMCHECKER_SUB + sub r3, r2, #OSi_IMAGE_DIFFERENCE +@1: + strh r1, [r2] + ldrh r12, [r3] + cmp r1, r12 + bne @2 + + add r1, r1, #1 + cmp r1, #2 // check 2 loop + bne @1 + + //---- 4MB + b @3 + + //---- 8MB or 16MB or 32MB +@2: + // check if running on twl/nitro + bl INITi_IsRunOnTwl + movne r0, #OS_CONSOLE_SIZE_8MB + bne @3 + + //---- 16MB or 32MB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + ldrb r2, [r3] + + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@4 subs r12, r12, #4 + bcs @4 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @3 + + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@5 subs r12, r12, #4 + bcs @5 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@3: + //---- check SMX_CNT + strb r2, [r3] + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + ldr r2, =HW_MMEMCHECKER_SUB + strh r0, [r2] + + ldmfd sp!, {lr} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: WVR_ShelterExtWram + Description: WVR ライブラリ用に 拡張 WRAM に配置されるオートロードブロックを + メインメモリに退避する関数のダミー。 + 実際に拡張 WRAM にライブラリを配置する必要のあるコンポーネント + では、当関数の強シンボルが別途リンクされる。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void +WVR_ShelterExtWram(void) +{ +} + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 可能な限り 32 バイト単位で、半端な分は 4 バイト単位でコピーを + 行う。 + スタックを 36 バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 可能な限り 32 バイト単位で、半端な分は 4 バイト単位でバッファ + 内容を指定データで埋める。 + スタックを 36 バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +#include diff --git a/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.LTD.c b/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.LTD.c new file mode 100644 index 00000000..110841fd --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/ARM7/src/crt0_hct.LTD.c @@ -0,0 +1,861 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.LTD.c + + Copyright 2007 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 +#include +#include "boot_sync.h" + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); +void INIT_InitializeScfg(void); + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* 外部関数参照定義 */ +extern void OS_IrqHandler(void); +extern void _fp_init(void); +extern void __call_static_initializers(void); + +/* 内部関数プロトタイプ定義 */ +static void INITi_SetHMACSHA1ToAppParam(void); +static void INITi_DoAutoload(void); +static void INITi_ShelterLtdBinary(void); +static BOOL INITi_IsRunOnTwl( void ); +static void INITi_CopySysConfig( void ); +static void INITi_DetectMainMemorySize(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); + +void* const _start_ModuleParams[] = +{ + (void*)SDK_AUTOLOAD_LIST, + (void*)SDK_AUTOLOAD_LIST_END, + (void*)SDK_AUTOLOAD_START, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, // CompressedStaticEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_CURRENT_VERSION_NUMBER, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, // CompressedLtdautoloadEnd. This fixed number will be updated by compstatic tool. + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +extern void SDK_LTDAUTOLOAD_LTDMAIN_START(void); + +void* const _start_LtdMainParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LTDMAIN_START, +}; + +#ifdef DEBUG_WRAM_SETTING +u32 const wramMapping[12] = { + 0x8d898581, 0x8c888480, 0x9c989490, 0x8c888480, + 0x9c989490, 0x00000000, 0x09403900, 0x09803940, + 0x080037c0, 0x09403900, 0x09803940, 0x0000000f +}; +#endif + +#define DIGEST_HASH_BLOCK_SIZE_SHA1 (512/8) +static const u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = +{ + 0x21, 0x06, 0xc0, 0xde, + 0xba, 0x98, 0xce, 0x3f, + 0xa6, 0x92, 0xe3, 0x9d, + 0x46, 0xf2, 0xed, 0x01, + + 0x76, 0xe3, 0xcc, 0x08, + 0x56, 0x23, 0x63, 0xfa, + 0xca, 0xd4, 0xec, 0xdf, + 0x9a, 0x62, 0x78, 0x34, + + 0x8f, 0x6d, 0x63, 0x3c, + 0xfe, 0x22, 0xca, 0x92, + 0x20, 0x88, 0x97, 0x23, + 0xd2, 0xcf, 0xae, 0xc2, + + 0x32, 0x67, 0x8d, 0xfe, + 0xca, 0x83, 0x64, 0x98, + 0xac, 0xfd, 0x3e, 0x37, + 0x87, 0x46, 0x58, 0x24, +}; + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +#ifdef DEBUG_WRAM_SETTING +/*---------------------------------------------------------------------------* + Name: WaitAgreement + Description: ARM9 の起動ベクタが特定の状態になるまで待つ。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - 同期用フェーズ管理変数へのポインタ。 + r1 - 待機するフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_WaitAgreement[7] = +{ + 0xe1d020b0, /* @1: ldrh r2, [r0] ; フェーズ管理変数を共有メモリから読む */ + 0xe1510002, /* cmp r1, r2 ; 待機フェーズ番号と比較 */ + 0x012fff1e, /* bxeq lr ; 一致していれば待機完了 */ + 0xe3a03010, /* mov r3, #16 ; 空ループ回数初期化 */ + 0xe2533001, /* @2: subs r3, r3, #1 ; 空ループ回数 -- */ + 0x1afffffd, /* bne @2 ; 16 回ループ */ + 0xeafffff8 /* b @1 ; 先頭に戻る */ +}; +#endif + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + r1 - 同期用フェーズ管理変数へのポインタ。 + r2 - ARM9 に伝えるフェーズ番号。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[2] = +{ + 0xe1c120b0, /* strh r2, [r1] ; フェーズ管理変数を更新 */ + 0xe12fff10 /* bx r0 ; Main 関数へジャンプ */ +}; + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割り込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] // Use that LSB of HW_REG_BASE is 0b0 + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 +@001: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @001 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + + // ロードされたアプリのダイジェストを計算してアプリ間パラメータに格納 + bl INITi_SetHMACSHA1ToAppParam + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for stack check code + mov r0, #HW_PSR_SYS_MODE + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* SCFG を HW_SYS_CONF_BUF へコピー */ + bl INIT_InitializeScfg + bl INITi_CopySysConfig + + /* TWL ハードウェア上で動作しているかどうかを調査 */ + bl INITi_IsRunOnTwl + /* TWL ハードウェア上で動作していない場合は永久ループ */ +@012: bne @012 + + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + +@020: + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC ブロックの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + //---- detect main memory size + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + //---- set debug print window + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7<<8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR<<8) + strh r0, [r1, #2] +#endif + + /* 割り込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@030: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + ldr r0, [r1], #4 + str r0, [sp, #-4] + ldr r0, [r1] + str r0, [sp] + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =TwlSpMain + ldr r1, =HW_BOOT_SYNC_PHASE + mov r2, #BOOT_SYNC_PHASE_4 + ldr lr, =HW_RESET_VECTOR + sub r3, sp, #4 + bx r3 +} + +#include +#include +#include +/*---------------------------------------------------------------------------* + Name: INITi_SetHMACSHA1ToAppParam + Description: ROMがロードされた各アプリ領域のHMACSHA1を計算し、特定のアドレ + スに保存 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define UNDEF_CODE 0xe7ffdeff +#define ENCRYPT_DEF_SIZE 0x800 +#define DGT_TGT_ADDR ( HW_MAIN_MEM + 0x0100 ) + +static void INITi_SetHMACSHA1ToAppParam(void) +{ + SVCHMACSHA1Context *pCon = ( SVCHMACSHA1Context * ) (0x2000300 - sizeof(SVCHMACSHA1Context)); + ROM_Header_Short *pROMH = (ROM_Header_Short *)HW_TWL_ROM_HEADER_BUF; + u32 bak; + + // arm9_flx + bak = *(u32 *)pROMH->main_autoload_done; + *(u32 *)pROMH->main_autoload_done = 0xE12FFF1E; + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->main_ram_address, pROMH->main_size); + SVC_HMACSHA1GetHash(pCon, (void *)DGT_TGT_ADDR); + *(u32 *)pROMH->main_autoload_done = bak; + // arm7_flx + bak = *(u32 *)pROMH->sub_autoload_done; + *(u32 *)pROMH->sub_autoload_done = 0xE12FFF1E; + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->sub_ram_address, pROMH->sub_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 32)); + *(u32 *)pROMH->sub_autoload_done = bak; + // arm9_ltd + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->main_ltd_ram_address, pROMH->main_ltd_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 2 * 32)); + // arm7_ltd + SVC_HMACSHA1Init(pCon, (void *)s_digestDefaultKey, DIGEST_HASH_BLOCK_SIZE_SHA1); + SVC_HMACSHA1Update(pCon, pROMH->sub_ltd_ram_address, pROMH->sub_ltd_size); + SVC_HMACSHA1GetHash(pCon, (void *)(DGT_TGT_ADDR + 3 * 32)); +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +/* + * < 二段階オートロード > + * 0x02380000 に crt0 及び一段目ロード元バイナリが配置されている。 + * NITRO と共有可能な WRAM 上に配置されるべきバイナリデータを 0x037c0000 にロードする。 + * TWL でしか動作しない WRAM 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + * 0x02400000 に ARM9 の二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f80000 - 0x02f84000 に退避する。 + * 0x02e80000 に二段目ロード元バイナリが配置されている。 + * 0x04000 バイト分はカード ROM から再読み出し不可なので、0x02f84000 - 0x02f88000 に退避する。 + * NITRO と共有可能な MAIN 上に配置されるべきバイナリデータを 0x02f88000 にロードする。 + * TWL でしか動作しない MAIN 上に配置されるべきバイナリデータを続きのアドレスにロードする。 + */ +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + +@01_autoload: + /* WRAM 用ブロックをオートロード */ + ldr r0, =_start_ModuleParams + ldr r12, [r0] // r12 = SDK_AUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_AUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_AUTOLOAD_START +@01_segments_loop: + cmp r12, r3 + bge @02_start + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 // r0 = start address of source range of static initializers table +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = size of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} // r1 = end address of source range of the autoload segment + b @01_segments_loop + +@02_start: +#ifndef SDK_SYSMENU_BUILD + /* 再読み出し不可部分を退避 */ + bl INITi_ShelterLtdBinary +#endif // SDK_SYSMENU_BUILD + + /* メインメモリ用オートロードブロックの存在を確認 */ + ldr r1, =HW_TWL_ROM_HEADER_BUF + ldr r0, [r1, #ROM_Header.s.sub_ltd_size] + cmp r0, #0 + beq @03_start + +@02_autoload: + /* メインメモリ用ブロックをオートロード */ + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_AUTOLOAD_START +@02_segments_loop: + cmp r12, r3 + bge @03_start + /* 固定セクション */ + ldr r0, [r12], #4 + ldr r2, [r12], #4 + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} + mov r1, #0 + ldr r2, [r12], #4 + bl INITi_Fill32 + ldmfd sp!, {r1} + b @02_segments_loop + +@03_start: + /* オートロード完了コールバック関数呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + +/*---------------------------------------------------------------------------* + Name: INITi_ShelterLtdBinary + Description: TWL 専用のオートロード元バイナリデータの内、カード ROM から + 再読み出しできない領域のデータを退避エリアに退避する。 + 再読み出しできない領域のデータは ARM7 用と ARM9 用の拡張常駐 + モジュールの2つに分かれている可能性があるので、冗長ではあるが + 両方の先頭から 0x4000 分をそれぞれ退避する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterLtdBinary(void) +{ + stmfd sp!, {lr} + + /* NAND からブートした場合には退避するデータの使い道がない為、処理をスキップ */ + ldr r3, =HW_TWL_ROM_HEADER_BUF + ldr r0, [r3, #ROM_Header.s.titleID_Hi] + tst r0, #TITLE_ID_HI_MEDIA_MASK + ldmnefd sp!, {pc} + +@shelter_arm7_ltdautoload_src: + /* ARM7 用拡張常駐モジュールの存在を確認 */ + ldr r1, [r3, #ROM_Header.s.sub_ltd_size] + cmp r1, #0 + beq @shelter_arm9_ltdautoload_src + + /* ARM7 用拡張常駐モジュールの先頭 16K bytes を退避 */ + ldr r1, [r3, #ROM_Header.s.sub_ltd_ram_address] + ldr r0, =_start_LtdMainParams + ldr r0, [r0] + mov r2, #0x4000 // r2 = size of shelter buffer + sub r0, r0, r2 // r0 = SDK_LTDAUTOLOAD_LTDMAIN_START - 0x4000 + bl INITi_Copy32 + +@shelter_arm9_ltdautoload_src: + /* ARM9 用拡張常駐モジュールの存在を確認 */ + ldr r3, =HW_TWL_ROM_HEADER_BUF + ldr r1, [r3, #ROM_Header.s.main_ltd_size] + cmp r1, #0 + beq @end + + /* ARM9 用拡張常駐モジュールの先頭 16K bytes を退避 */ + ldr r1, [r3, #ROM_Header.s.main_ltd_ram_address] + ldr r0, =_start_LtdMainParams + ldr r0, [r0] + mov r2, #0x4000 // r2 = size of shelter buffer + sub r0, r0, r2 + sub r0, r0, r2 // r0 = SDK_LTDAUTOLOAD_LTDMAIN_START - 0x8000 + bl INITi_Copy32 + +@end: + ldmfd sp!, {pc} +} + +#ifndef SDK_NOINIT +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* 退避場所先頭から空き場所を調査 */ +@001: ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 + + /* 空き場所にテーブルをコピー */ +@002: ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 + + /* テーブルに管理されているポインタを一つずつ呼び出し */ +@001: ldr r0, [r1] + cmp r0, #0 + beq @002 + stmdb sp!, {r1} + mov lr, pc + bx r0 + ldmia sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 + +@002: ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: NitroSpStartUp + Description: Hook for user start up. + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL void +NitroSpStartUp(void) +{ +} + +/*---------------------------------------------------------------------------* + Name: INITi_IsRunOnTwl + + Description: check running platform + + This function is used in only Nitro-TWL hybrid mode. + (In Nitro mode and TWL limited mode, treated as constant) + + Arguments: None + + Returns: TRUE : running on TWL + FALSE : running on NITRO + *---------------------------------------------------------------------------*/ +static asm BOOL INITi_IsRunOnTwl( void ) +{ + ldr r0, =HW_PRV_WRAM_SYSRV + ldrb r0, [r0,#HWi_WSYS08_WRAMOFFSET] + and r0, r0, #HWi_WSYS08_ROM_ARM9SEC_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + moveq r0, #TRUE + movne r0, #FALSE + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INIT_InitializeScfg + + Description: ローダーが行う SCFG ブロックへの設定処理を代行する為の関数。 + 処理の実体は crt0 の外部に定義するため、弱シンボルとする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +INIT_InitializeScfg(void) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CopySysConfig + + Description: copy SCFG registers to HW_SYS_CONF_BUF and HW_PRV_WRAM_SYSRV + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static asm void INITi_CopySysConfig( void ) +{ + //---- copy scfg setting + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + + Description: detect main memory size. + result is written into (u32*)HW_MMEMCHECKER_SUB. + value is [OS_CONSOLE_SIZE_4MB|OS_CONSOLE_SIZE_8MB| + OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32MB] + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE 0x400000 +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void INITi_DetectMainMemorySize( void ) +{ + stmfd sp!, {lr} + + //---- detect memory size + mov r0, #OS_CONSOLE_SIZE_4MB + mov r1, #0 + + ldr r2, =HW_MMEMCHECKER_SUB + sub r3, r2, #OSi_IMAGE_DIFFERENCE +@1: + strh r1, [r2] + ldrh r12, [r3] + cmp r1, r12 + bne @2 + + add r1, r1, #1 + cmp r1, #2 // check 2 loop + bne @1 + + //---- 4MB + b @3 + + //---- 8MB or 16MB or 32MB +@2: + // check if running on twl/nitro + bl INITi_IsRunOnTwl + movne r0, #OS_CONSOLE_SIZE_8MB + bne @3 + + //---- 16MB or 32MB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + ldrb r2, [r3] + + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@4 subs r12, r12, #4 + bcs @4 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @3 + + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r12, =OSi_100usWAIT +@5 subs r12, r12, #4 + bcs @5 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@3: + //---- check SMX_CNT + strb r2, [r3] + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + ldr r2, =HW_MMEMCHECKER_SUB + strh r0, [r2] + + ldmfd sp!, {lr} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 可能な限り 32 バイト単位で、半端な分は 4 バイト単位でコピーを + 行う。 + スタックを 36 バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 可能な限り 32 バイト単位で、半端な分は 4 バイト単位でバッファ + 内容を指定データで埋める。 + スタックを 36 バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + ldmfd sp!, {r3-r11} + bx lr +} + +#include diff --git a/build/tests/HashCheckTemplate/crt/Makefile b/build/tests/HashCheckTemplate/crt/Makefile new file mode 100644 index 00000000..e7337139 --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - init +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM7 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/HashCheckTemplate/crt/common/include/boot_sync.h b/build/tests/HashCheckTemplate/crt/common/include/boot_sync.h new file mode 100644 index 00000000..c744ffe2 --- /dev/null +++ b/build/tests/HashCheckTemplate/crt/common/include/boot_sync.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - common + File: boot_sync.h + + Copyright 2007 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 TWL_LIBRARIES_INIT_COMMON_BOOT_SYNC_H_ +#define TWL_LIBRARIES_INIT_COMMON_BOOT_SYNC_H_ +#ifdef __cplusplus +extern "C" { +#endif +/*---------------------------------------------------------------------------*/ + +#define BOOT_SYNC_PHASE_1 1 +#define BOOT_SYNC_PHASE_2 2 +#define BOOT_SYNC_PHASE_3 3 +#define BOOT_SYNC_PHASE_4 4 +#define BOOT_SYNC_PHASE_5 5 +#define BOOT_SYNC_PHASE_6 6 + +/*---------------------------------------------------------------------------*/ +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif /* TWL_LIBRARIES_INIT_COMMON_BOOT_SYNC_H_ */ diff --git a/build/tests/HashCheckTemplate/memo.txt b/build/tests/HashCheckTemplate/memo.txt new file mode 100644 index 00000000..cf41343d --- /dev/null +++ b/build/tests/HashCheckTemplate/memo.txt @@ -0,0 +1,49 @@ +【ISデバッガがコードを変更する箇所】 +・ARM9.flx.static, ARM7.flx.static + _start_AutoloadDoneCallbackの先頭コードをISデバッガのモニタプログラムへの分岐に書き換えるので、 + ハッシュを正しく計算する場合は、そのアドレスのコードを元々の値である0xE12FFF1E(= BX LR)にアプリで書き換えてやる + 必要がある。 +・ブレークポイント設定箇所 + ブレークポイント設定箇所は、デバッガによって未定義命令が埋め込まれるので、ハッシュを正しく計算する場合は、全ての + ブレークポイントを無効にする必要がある。 + +なお、これらは、単体ブートなら何もケアしなくてOK. + + + +【blowfish暗号化システムコール】 +ARM9FLXの先頭0x800バイト(2kバイト)はシステムコールが配置され、Blowfish暗号化されている(暗号化領域)。 +で、ランチャーがブート直前に暗号化を解除する。 +ヘッダに埋め込まれているARM9FLXのハッシュは、暗号化された状態でのハッシュである。 +HashCheckTemplateでARM9FLXのハッシュを計算する時点では、すでに暗号化が解除されているため、計算が合わない。 +どうにかして解除前の暗号化領域を手に入れる必要がある。 + + +・ROMヘッダが"NTRJ"の場合 + アプリケーション上で上記暗号領域を00で埋めれば計算が合う。 + HashCheckTemplateのようなテストプログラムでは、暗号化領域は00で埋められるためである。 + <暗号化領域が00であった事の確認> + 1)暗号解除時、先頭0x800バイトのうち先頭2バイトの暗号解除結果が"encryObj"でない場合は全体の暗号解除をせず、特殊処理 +  として未定義命令コード(0xe7ffdeff)で埋められる。 +  よって、暗号化領域に当たる部分が実行時に未定義命令コードで埋まってるのを確認すれば良い。 + + 2)makerom特別版のmakerom.TWL.DEBUG.exe/makerom.TWL.sys.DEBUG.exe/makerom.TWL.secure.DEBUG.exeを使用する。(SDKに添付) +  このmakeromを使用して、MAKEROM_FLAGSで、-DSYSCALL_Cの指定をしなかった場合、ROMヘッダのnitro_whitelist_phase2_diegstに +  上記暗号領域を除いた状態のARM9.FLX.staticのハッシュ値が格納される。 + +・ROMヘッダが"NTRJ"以外の正式ROMヘッダを使用している場合 + makerom特別版のmakerom.TWL.DEBUG.exe/makerom.TWL.sys.DEBUG.exe/makerom.TWL.secure.DEBUG.exeを使用する。(SDKに添付) + このmakeromを使用して、MAKEROM_FLAGS += -DSYSCALL_C='hoge/libsyscall_c.bin'の形式で、正式版ROMヘッダに添付している + クローンブート用のデコード済みシステムコールバイナリを指定することで、ROMヘッダのnitro_whitelist_phase2_diegstに + 上記暗号領域をデコードした状態のARM9.FLX.staticのハッシュ値が格納される。 + + + +【staticサイズ拡張】 + makerom特別版のmakerom.TWL.DEBUG.exe/makerom.TWL.sys.DEBUG.exe/makerom.TWL.secure.DEBUG.exeを使用する。(SDKに添付) + MAKEROM_FLAGSに下記定義を追加することで、対象セグメントを指定サイズ分ランダム値で拡張できる。 + ARM9.FLX.static : -DARM9FLX_EXPAND=拡張サイズ (ランチャーで正常ブート可能 max サイズ = 0x27c000) + ARM7.FLX.static : -DARM7FLX_EXPAND=拡張サイズ (  〃           max サイズ = 0x40000) + ARM9.LTD.static : -DARM9LTD_EXPAND=拡張サイズ (  〃           max サイズ = 0x280000) + ARM7.LTD.static : -DARM7LTD_EXPAND=拡張サイズ (  〃           max サイズ = 0x108000) + diff --git a/build/tests/HashCheckTemplate/test_roms/rombreak.bat b/build/tests/HashCheckTemplate/test_roms/rombreak.bat new file mode 100644 index 00000000..83c6ea10 --- /dev/null +++ b/build/tests/HashCheckTemplate/test_roms/rombreak.bat @@ -0,0 +1,199 @@ +mkdir break_dev +mkdir prod +mkdir break_prod + +"../../../tools/rombreaker/rombreaker.exe" -i twl_0E8A.srl -b HEADER -o "break_dev/twl_0E8A.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0E9A.nand.srl -b HEADER -o "break_dev/twl_0E9A.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EAA.srl -b ARM9FLX -o "break_dev/twl_0EAA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EBA.nand.srl -b ARM9FLX -o "break_dev/twl_0EBA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ECA.srl -b ARM7FLX -o "break_dev/twl_0ECA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EDA.nand.srl -b ARM7FLX -o "break_dev/twl_0EDA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EEA.srl -b ARM9LTD -o "break_dev/twl_0EEA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EFA.nand.srl -b ARM9LTD -o "break_dev/twl_0EFA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EGA.srl -b ARM7LTD -o "break_dev/twl_0EGA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EHA.nand.srl -b ARM7LTD -o "break_dev/twl_0EHA.nand.srl" + +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EIA.nand.srl -b HEADER -o "break_dev/twl_0EIA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EJA.nand.srl -b ARM9FLX -o "break_dev/twl_0EJA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EKA.nand.srl -b ARM7FLX -o "break_dev/twl_0EKA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ELA.nand.srl -b ARM9LTD -o "break_dev/twl_0ELA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EMA.nand.srl -b ARM7LTD -o "break_dev/twl_0EMA.nand.srl" + +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ENA.srl -b HEADER -o "break_dev/twl_0ENA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EOA.nand.srl -b HEADER -o "break_dev/twl_0EOA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EPA.srl -b ARM9FLX -o "break_dev/twl_0EPA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EQA.nand.srl -b ARM9FLX -o "break_dev/twl_0EQA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ERA.srl -b ARM7FLX -o "break_dev/twl_0ERA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ESA.nand.srl -b ARM7FLX -o "break_dev/twl_0ESA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0ETA.srl -b ARM9LTD -o "break_dev/twl_0ETA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EUA.nand.srl -b ARM9LTD -o "break_dev/twl_0EUA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EVA.srl -b ARM7LTD -o "break_dev/twl_0EVA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i twl_0EWA.nand.srl -b ARM7LTD -o "break_dev/twl_0EWA.nand.srl" + +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0E8A.srl "prod/twl_0E8A.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0E9A.nand.srl "prod/twl_0E9A.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EAA.srl "prod/twl_0EAA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EBA.nand.srl "prod/twl_0EBA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ECA.srl "prod/twl_0ECA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EDA.nand.srl "prod/twl_0EDA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EEA.srl "prod/twl_0EEA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EFA.nand.srl "prod/twl_0EFA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EGA.srl "prod/twl_0EGA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EHA.nand.srl "prod/twl_0EHA.nand.srl" + +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EIA.nand.srl "prod/twl_0EIA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EJA.nand.srl "prod/twl_0EJA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EKA.nand.srl "prod/twl_0EKA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ELA.nand.srl "prod/twl_0ELA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EMA.nand.srl "prod/twl_0EMA.nand.srl" + +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ENA.srl "prod/twl_0ENA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EOA.nand.srl "prod/twl_0EOA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EPA.srl "prod/twl_0EPA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EQA.nand.srl "prod/twl_0EQA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ERA.srl "prod/twl_0ERA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ESA.nand.srl "prod/twl_0ESA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0ETA.srl "prod/twl_0ETA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EUA.nand.srl "prod/twl_0EUA.nand.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EVA.srl "prod/twl_0EVA.srl" +"%TWL_IPL_RED_PRIVATE_ROOT%/tools/bin/mastering.TWL.exe" -t twl_0EWA.nand.srl "prod/twl_0EWA.nand.srl" + +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0E8A.srl -b HEADER -o "break_prod/twl_0E8A.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0E9A.nand.srl -b HEADER -o "break_prod/twl_0E9A.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EAA.srl -b ARM9FLX -o "break_prod/twl_0EAA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EBA.nand.srl -b ARM9FLX -o "break_prod/twl_0EBA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ECA.srl -b ARM7FLX -o "break_prod/twl_0ECA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EDA.nand.srl -b ARM7FLX -o "break_prod/twl_0EDA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EEA.srl -b ARM9LTD -o "break_prod/twl_0EEA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EFA.nand.srl -b ARM9LTD -o "break_prod/twl_0EFA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EGA.srl -b ARM7LTD -o "break_prod/twl_0EGA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EHA.nand.srl -b ARM7LTD -o "break_prod/twl_0EHA.nand.srl" + +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EIA.nand.srl -b HEADER -o "break_prod/twl_0EIA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EJA.nand.srl -b ARM9FLX -o "break_prod/twl_0EJA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EKA.nand.srl -b ARM7FLX -o "break_prod/twl_0EKA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ELA.nand.srl -b ARM9LTD -o "break_prod/twl_0ELA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EMA.nand.srl -b ARM7LTD -o "break_prod/twl_0EMA.nand.srl" + +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ENA.srl -b HEADER -o "break_prod/twl_0ENA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EOA.nand.srl -b HEADER -o "break_prod/twl_0EOA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EPA.srl -b ARM9FLX -o "break_prod/twl_0EPA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EQA.nand.srl -b ARM9FLX -o "break_prod/twl_0EQA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ERA.srl -b ARM7FLX -o "break_prod/twl_0ERA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ESA.nand.srl -b ARM7FLX -o "break_prod/twl_0ESA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0ETA.srl -b ARM9LTD -o "break_prod/twl_0ETA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EUA.nand.srl -b ARM9LTD -o "break_prod/twl_0EUA.nand.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EVA.srl -b ARM7LTD -o "break_prod/twl_0EVA.srl" +"../../../tools/rombreaker/rombreaker.exe" -i prod/twl_0EWA.nand.srl -b ARM7LTD -o "break_prod/twl_0EWA.nand.srl" + + +mkdir "break_dev/tad" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0E9A.nand.srl -v 0 -o break_dev/tad/twl_0E9A.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EBA.nand.srl -v 0 -o break_dev/tad/twl_0EBA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EDA.nand.srl -v 0 -o break_dev/tad/twl_0EDA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EFA.nand.srl -v 0 -o break_dev/tad/twl_0EFA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EHA.nand.srl -v 0 -o break_dev/tad/twl_0EHA.tad + +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EIA.nand.srl -s -v 0 -o break_dev/tad/twl_0EIA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EJA.nand.srl -s -v 0 -o break_dev/tad/twl_0EJA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EKA.nand.srl -s -v 0 -o break_dev/tad/twl_0EKA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0ELA.nand.srl -s -v 0 -o break_dev/tad/twl_0ELA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EMA.nand.srl -s -v 0 -o break_dev/tad/twl_0EMA.tad + +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EOA.nand.srl -s -v 0 -o break_dev/tad/twl_0EOA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EQA.nand.srl -s -v 0 -o break_dev/tad/twl_0EQA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0ESA.nand.srl -s -v 0 -o break_dev/tad/twl_0ESA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EUA.nand.srl -s -v 0 -o break_dev/tad/twl_0EUA.tad +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe break_dev/twl_0EWA.nand.srl -s -v 0 -o break_dev/tad/twl_0EWA.tad + +mkdir "break_prod/0E9A/v0" +cd "break_prod/0E9A/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0E9A.nand.srl -v 0 -p -o twl_0E9A.tad +mv properties ../ +cd ../../ + +mkdir "0EBA/v0" +cd "0EBA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EBA.nand.srl -v 0 -p -o twl_0EBA.tad +mv properties ../ +cd ../../ + +mkdir "0EDA/v0" +cd "0EDA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EDA.nand.srl -v 0 -p -o twl_0EDA.tad +mv properties ../ +cd ../../ + +mkdir "0EFA/v0" +cd "0EFA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EFA.nand.srl -v 0 -p -o twl_0EFA.tad +mv properties ../ +cd ../../ + +mkdir "0EHA/v0" +cd "0EHA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EHA.nand.srl -v 0 -p -o twl_0EHA.tad +mv properties ../ +cd ../../ + + +mkdir "0EIA/v0" +cd "0EIA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EIA.nand.srl -s -v 0 -p -o twl_0EIA.tad +mv properties ../ +cd ../../ + +mkdir "0EJA/v0" +cd "0EJA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EJA.nand.srl -s -v 0 -p -o twl_0EJA.tad +mv properties ../ +cd ../../ + +mkdir "0EKA/v0" +cd "0EKA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EKA.nand.srl -s -v 0 -p -o twl_0EKA.tad +mv properties ../ +cd ../../ + +mkdir "0ELA/v0" +cd "0ELA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0ELA.nand.srl -s -v 0 -p -o twl_0ELA.tad +mv properties ../ +cd ../../ + +mkdir "0EMA/v0" +cd "0EMA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EMA.nand.srl -s -v 0 -p -o twl_0EMA.tad +mv properties ../ +cd ../../ + + +mkdir "0EOA/v0" +cd "0EOA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EOA.nand.srl -s -v 0 -p -o twl_0EOA.tad +mv properties ../ +cd ../../ + +mkdir "0EQA/v0" +cd "0EQA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EQA.nand.srl -s -v 0 -p -o twl_0EQA.tad +mv properties ../ +cd ../../ + +mkdir "0ESA/v0" +cd "0ESA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0ESA.nand.srl -s -v 0 -p -o twl_0ESA.tad +mv properties ../ +cd ../../ + +mkdir "0EUA/v0" +cd "0EUA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EUA.nand.srl -s -v 0 -p -o twl_0EUA.tad +mv properties ../ +cd ../../ + +mkdir "0EWA/v0" +cd "0EWA/v0" +%TWLSDK_ROOT%/build/tools/maketad/bin/maketad.exe ../../twl_0EWA.nand.srl -s -v 0 -p -o twl_0EWA.tad +mv properties ../ +cd ../../ diff --git a/build/tests/HashCheckTemplate/test_roms/遐エ螢翫★縺ソROM縺ョ菴懊j譁ケ.txt b/build/tests/HashCheckTemplate/test_roms/遐エ螢翫★縺ソROM縺ョ菴懊j譁ケ.txt new file mode 100644 index 00000000..10b74350 --- /dev/null +++ b/build/tests/HashCheckTemplate/test_roms/遐エ螢翫★縺ソROM縺ョ菴懊j譁ケ.txt @@ -0,0 +1,9 @@ +TestMakerで + +make boottest +make + +したあと、このディレクトリが作業ディレクトリになっている状態でrombreak.batを実行。 +(要するにexplorerからダブルクリックでOK) + +これでbraek_devおよびbreak_prodの中にsrlとtadまでが完成。 diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/Makefile b/build/tests/JumpToSettingForZonetest/ARM9.TWL/Makefile new file mode 100644 index 00000000..08b0b206 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +# nandapp にする場合はこの辺とかのコメントをはずす +# rsfの方もmediaをNandにするi + +TWL_NANDAPP = TRUE + + +SRCS = main.c font.c screen.c keypad.c +LINCLUDES = ./include +SRCDIR = ./src + #TARGET_BIN = NewApp.srl +TARGET_BIN = JumpToSetting.tad +ROM_SPEC = main.rsf + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +DEFAULT_MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +DEFAULT_MAKEROM_ARM7 = $(DEFAULT_MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + + MAKETAD_OPTION += -s +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/font.h b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/font.h new file mode 100644 index 00000000..9e703b04 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/font.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef FONT_H_ +#define FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern const u32 d_CharData[8 * 256]; +extern const u32 d_PaletteData[8 * 16]; + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/keypad.h b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/screen.h b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/screen.h new file mode 100644 index 00000000..7e55f3e1 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/include/screen.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.h + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef SCREEN_H_ +#define SCREEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ +#include + +extern u16 gScreen[32 * 32]; + +#define CONSOLE_BLACK 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 +#define CONSOLE_BLUE 3 +#define CONSOLE_YELLOW 4 +#define CONSOLE_WHITE 15 + +void ClearScreen(void); +void PrintString(s16 x, s16 y, u8 palette, char *text, ...); +void ColorString(s16 x, s16 y, s16 length, u8 palette); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SCREEN_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/main.rsf b/build/tests/JumpToSettingForZonetest/ARM9.TWL/main.rsf new file mode 100644 index 00000000..623fabb5 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/main.rsf @@ -0,0 +1,197 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "JumpSetting" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType SYSTEM + Secure TRUE + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 0JSA + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 1 + + # + # Use Shared2 fikle size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 128K +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/font.c b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/font.c new file mode 100644 index 00000000..c5c4bf70 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/font.c @@ -0,0 +1,580 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: font.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include "font.h" + +/*---------------------------------------------------------------------------* + Character data + *---------------------------------------------------------------------------*/ +const u32 d_CharData[8 * 256] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01010010, 0x01010010, 0x00000110, // 0001h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 00f6h + 0x00100000, 0x00100000, 0x00100000, 0x00111111, + 0x00000000, 0x01010010, 0x01010010, 0x00111111, // 00f7h + 0x00010010, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01010011, 0x01010100, 0x00100011, // 00f8h + 0x00100100, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01010000, 0x01011111, 0x00010000, // 00f9h + 0x00001000, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x01010010, 0x01111111, 0x00100010, // 00fah + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x01010001, 0x01010010, 0x00100000, // 00fbh + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01011110, 0x01010010, 0x00100110, // 00fch + 0x00111001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010000, 0x01011110, 0x00010000, // 00fdh + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x00100101, 0x01001010, 0x00101010, // 00feh + 0x00100000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +}; + + +/*---------------------------------------------------------------------------* + Palette data + *---------------------------------------------------------------------------*/ +const u32 d_PaletteData[8 * 16] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/keypad.c b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/main.c b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/main.c new file mode 100644 index 00000000..87a0dc63 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/main.c @@ -0,0 +1,174 @@ + +#include +#include +#include "font.h" +#include "screen.h" +#include "keypad.h" + +#define DAMMY_TITLEID_HI 0x00030005 +#define DAMMY_TITLEID_LO 0x484e4a00 +#define JUMP_GAMECODE 0x00030015484e4241ULL +#define JUMP_PARAMETER 50 + +void VBlankIntr(void); +void myInit(void); + +void TwlMain( void ) +{ + unsigned char regioncode; + myInit(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + + PrintString(0, 0, CONSOLE_WHITE, "Press A key To AppJump"); + + switch(OS_GetRegion()){ + case OS_TWL_REGION_JAPAN: + regioncode = 'J'; + break; + case OS_TWL_REGION_AMERICA: + regioncode = 'E'; + break; + case OS_TWL_REGION_EUROPE: + regioncode = 'P'; + break; + case OS_TWL_REGION_AUSTRALIA: + regioncode = 'U'; + break; + case OS_TWL_REGION_KOREA: + regioncode = 'K'; + break; + case OS_TWL_REGION_CHINA: + regioncode = 'C'; + break; + default: + PrintString(0, 1, CONSOLE_RED, "Illegal Region setting!"); + OS_Terminate(); + goto ERROR; + } + + + while(1){ + kamiPadRead(); + + if(kamiPadIsTrigger(PAD_BUTTON_A)){ + OSDeliverArgInfo info; + u32 dammycode_lo = (u32)(DAMMY_TITLEID_LO | (u32)regioncode); + + // romheaderのタイトルIDを書き換えて騙す + PrintString(0,3, CONSOLE_WHITE, "%x", dammycode_lo); + OS_WaitVBlankIntr(); + MI_StoreLE32((void*)(HW_TWL_ROM_HEADER_BUF + 0x230), dammycode_lo); + MI_StoreLE32((void*)(HW_TWL_ROM_HEADER_BUF + 0x234), DAMMY_TITLEID_HI); + + OS_InitDeliverArgInfo(&info, 0); + OS_SetSysParamToDeliverArg(JUMP_PARAMETER); + OS_EncodeDeliverArg(); + OS_DoApplicationJump(JUMP_GAMECODE, OS_APP_JUMP_NORMAL); + + PrintString(0, 1, CONSOLE_RED, "Jump Failed"); + } + + OS_WaitVBlankIntr(); + } + +ERROR: + + OS_WaitVBlankIntr(); + OS_Terminate(); +} + + +static void +VBlankIntr(void) +{ + //---- upload pseudo screen to VRAM + DC_FlushRange(gScreen, sizeof(gScreen)); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + + +void myInit(void) +{ + //---- init + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + FX_Init(); + GX_Init(); + GX_DispOff(); + GXS_DispOff(); + + //---- init displaying + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- setting 2D for top screen + GX_SetBankForBG(GX_VRAM_BG_128_A); + + G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2_SetBG0Priority(0); + G2_BG0Mosaic(FALSE); + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GX_SetVisiblePlane(GX_PLANEMASK_BG0); + + GX_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GX_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + + //---- setting 2D for bottom screen + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0xf800, GX_BG_CHARBASE_0x00000, GX_BG_EXTPLTT_01); + G2S_SetBG0Priority(0); + G2S_BG0Mosaic(FALSE); + GXS_SetGraphicsMode(GX_BGMODE_0); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0); + + GXS_LoadBG0Char(d_CharData, 0, sizeof(d_CharData)); + GXS_LoadBGPltt(d_PaletteData, 0, sizeof(d_PaletteData)); + + + //---- screen + MI_CpuFillFast((void *)gScreen, 0, sizeof(gScreen)); + DC_FlushRange(gScreen, sizeof(gScreen)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + GX_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + GXS_LoadBG0Scr(gScreen, 0, sizeof(gScreen)); + + //---- init interrupt + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + //---- FileSytem init + FS_Init(FS_DMA_NOT_USE); + + //---- start displaying + GX_DispOn(); + GXS_DispOn(); +} + diff --git a/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/screen.c b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/screen.c new file mode 100644 index 00000000..5b7b735e --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/ARM9.TWL/src/screen.c @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - demos - consoleType-1 + File: screen.c + + Copyright 2003-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. + + $Log: main.c,v $ + Revision 1.23 2006/01/18 02:11:29 kitase_hirotake + do-indent + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include "screen.h" + +u16 gScreen[32 * 32]; + +/*---------------------------------------------------------------------------* + Name: ClearScreen + + Description: clear screen buffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ClearScreen(void) +{ + MI_CpuClearFast((void *)gScreen, sizeof(gScreen)); +} + +/*---------------------------------------------------------------------------* + Name: PrintString + + Description: enter string into screen buffer + string must be within 32 chars + + Arguments: x : x + y : y + palette : color (0-15) + text : string. end mark is NULL + + Returns: None. + *---------------------------------------------------------------------------*/ +void PrintString(s16 x, s16 y, u8 palette, char *text, ...) +{ + va_list vlist; + char temp[32 + 2], *tempPtr; + s32 i; + u16 *p, *pLimit; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0; + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + tempPtr = &temp[0]; + + for (i = 0; *tempPtr; i++, tempPtr++) + { + *p = (u16)((palette << 12) | *tempPtr); + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} + +/*---------------------------------------------------------------------------* + Name: ColorString + + Description: change string color which is put in screen buffer + + Arguments: x : x + y : y + length : number of characters to change color + palette : color (0-15) + + Returns: None. + *---------------------------------------------------------------------------*/ +void ColorString(s16 x, s16 y, s16 length, u8 palette) +{ + s32 i; + u16 *p, *pLimit; + + if (length < 0) + return; + + p = &gScreen[((y * 32) + x) % (32 * 32)]; + pLimit = &gScreen[32 * 32]; + + for (i = 0; i < length; i++) + { + u16 temp = *p; + temp &= 0x0fff; + temp |= (palette << 12); + *p = temp; + + if (++p >= pLimit) + { + p = &gScreen[0]; + } + } +} diff --git a/build/tests/JumpToSettingForZonetest/Makefile b/build/tests/JumpToSettingForZonetest/Makefile new file mode 100644 index 00000000..063c7eaf --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/Makefile @@ -0,0 +1,33 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM9.TWL + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/JumpToSettingForZonetest/banner/Makefile b/build/tests/JumpToSettingForZonetest/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/tests/JumpToSettingForZonetest/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/JumpToSettingForZonetest/banner/banner_v3.bsf b/build/tests/JumpToSettingForZonetest/banner/banner_v3.bsf new file mode 100644 index 00000000..8881d35e Binary files /dev/null and b/build/tests/JumpToSettingForZonetest/banner/banner_v3.bsf differ diff --git a/build/tests/JumpToSettingForZonetest/banner/icon/gameIcon.bmp b/build/tests/JumpToSettingForZonetest/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..3057c17d Binary files /dev/null and b/build/tests/JumpToSettingForZonetest/banner/icon/gameIcon.bmp differ diff --git a/build/tests/Launcher_sdlog/Makefile b/build/tests/Launcher_sdlog/Makefile new file mode 100644 index 00000000..4b5881c4 --- /dev/null +++ b/build/tests/Launcher_sdlog/Makefile @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +export SDLOG ?= ARM9 + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher + +SUBMAKES = sdlog/Makefile scripts/Makefile \ + $(LAUNCHER_DIR)/banner/Makefile $(LAUNCHER_DIR)/ARM9/Makefile_sdlog + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/Launcher_sdlog/jackal.TWL/Makefile b/build/tests/Launcher_sdlog/jackal.TWL/Makefile new file mode 100644 index 00000000..c72c408c --- /dev/null +++ b/build/tests/Launcher_sdlog/jackal.TWL/Makefile @@ -0,0 +1,58 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - mongoose.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +# Definition to override for jackal with sdlog +# + +LLIBRARIES += libossdlog_sp$(TWL_LIBSUFFIX).a +LLIBRARY_DIRS += $(call eupath, $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE)) + +COMPONENT_DIR += $(SYSMENU_ROOT)/build/components/jackal.TWL +COMPONENT_SRC_DIR += $(COMPONENT_DIR)/../hyena.TWL/src + +override SUBDIRS = $(SYSMENU_ROOT)/build/libraries/aes \ + $(SYSMENU_ROOT)/build/components/jackal.TWL/wram_regs + +override SRCS =$(COMPONENT_SRC_DIR)/crt0.LTD.c $(COMPONENT_SRC_DIR)/main.c $(COMPONENT_SRC_DIR)/initScfg.c + +override TARGET_NAME = jackal + +# Generate my own lsf from original lsf of mongoose +LSF_ORG = $(COMPONENT_DIR)/$(TARGET_NAME).lsf +MAKE_LSF = make_lsf.pl +AUTOGEN_LSF = $(TARGET_NAME)_sdlog.lsf + +LDIRT_CLEAN = $(AUTOGEN_LSF) + +override TARGET_NEF = $(TARGET_NAME).tef +override LCFILE_SPEC = $(AUTOGEN_LSF) +override LCFILE_TEMPLATE = $(COMPONENT_DIR)/$(TARGET_NAME).lcf.template + +override TWL_INSTALL_COMPONENTSDIR= $(call eupath, $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/components) +override INSTALL_DIR = $(TWL_INSTALL_COMPONENTSDIR)/$(TARGET_NAME)/$(TWL_BUILDTYPE) + +# + +include $(TWL_IPL_RED_ROOT)/build/components/jackal.TWL/Makefile + +$(AUTOGEN_LSF): $(LSF_ORG) $(MAKE_LSF) + @echo " make:" $@ + @perl $(MAKE_LSF) $(TARGET_NAME) + +#===== End of Makefile ===== + diff --git a/build/tests/Launcher_sdlog/jackal.TWL/make_lsf.pl b/build/tests/Launcher_sdlog/jackal.TWL/make_lsf.pl new file mode 100755 index 00000000..cc4770f1 --- /dev/null +++ b/build/tests/Launcher_sdlog/jackal.TWL/make_lsf.pl @@ -0,0 +1,57 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlWLAN - components - mongoose_sdlog.TWL +# File: make_lsf.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $ROOT; + +my $COMPONENT = $ARGV[0]; +print $COMPONENT; +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $ROOT = $ENV{$_}; + } +} + +my $src = sprintf("$ROOT/build/components/%s.TWL/%s.lsf", $COMPONENT, $COMPONENT); +my $dst = sprintf("%s_sdlog.lsf", $COMPONENT); + + +my $rn = "\x0D\x0A"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/libos_sp/ ) + { + my $tmp = $line; + $tmp =~ s/libos_sp/libossdlog_sp/; + + print OUT $tmp; + next; + } + + print OUT $line; +} +close(OUT); diff --git a/build/tests/Launcher_sdlog/readme.txt b/build/tests/Launcher_sdlog/readme.txt new file mode 100644 index 00000000..1a1c542a --- /dev/null +++ b/build/tests/Launcher_sdlog/readme.txt @@ -0,0 +1,48 @@ +■ SDLOG対応版ランチャーについて + +実機等でのでデバッグ用に、SDカードにデバッグプリントを出力するランチャーです。 + +TwlIPL/build/tests/Launcher_sdlogに移動してビルドすると、 +同じディレクトリにHNAA.tadが作成されますので、NandInitializer等でImportして下さい。 + +●ARM9のデバッグプリントのみを出力 + +$ make SDLOG=ARM9 + +●ARM9/ARM7のデバッグプリントを出力 + +$ make SDLOG=ALL + + +■ SDLOG(改造版)ライブラリ超適当リファレンス + +// SDLOGシステムの開始。開始以降、OS_Printf系を乗っ取り、SDログバッファに蓄積→SDカード書き出しを行います。 +// +// path: 出力するファイルを置くSDカード上のディレクトリ(例:sdmc:/log) +// filename: 出力するファイル名 +// buffer: ログの一時書込先。大量のログを残す場合は 1KB 以上を推奨 +// partitionSize: SD カードに書き込むサイズ。 bufferSize の 1/n を推奨 +// writeType: 上書き or 追記の指定。ファイルが存在しない場合はどちらも新規作成となる + +BOOL SDLOG_InitEx(const char* path, const char* filename, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType); + +// OS_Printf系を乗っ取らない版 +// path: 保存先。 sdmc:/sample と指定すると sdmc:/sample/Log0.log に +// ログが保存される(ファイル名は固定です。) +BOOL SDLOG_Init(const char* path, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType); + + +// SDLOGにデバッグ情報を書き出す。 +void SDLOG_Printf(const char *fmt, ...); + +// バッファに貯められたログを強制的に SD カードに書き込む +// ここでは確実にログを書き出したいという場所に追加することを推奨。 +void SDLOG_Flush(void); + +// まだ書き出していないログを SD カードに書き込んでファイルをクローズ +void SDLOG_FinishEx(void); // OS_Printf乗っ取り版 +void SDLOG_Finish(void); // OS_Printf乗っ取らない版 + +// ARM7のデバッグログを出力 +void SDLOG_PrintServer(void); + diff --git a/build/tests/Launcher_sdlog/scripts/Makefile b/build/tests/Launcher_sdlog/scripts/Makefile new file mode 100644 index 00000000..75bcf9e9 --- /dev/null +++ b/build/tests/Launcher_sdlog/scripts/Makefile @@ -0,0 +1,60 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher + +SYSMENU_LIBRARIES_DIR = $(SYSMENU_ROOT)/build/libraries_sysmenu + +SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdater + +SCRIPTS_DIR = . + +MAKEFILES_ORG = $(LAUNCHER_DIR)/ARM9/Makefile +MAKE_MAKEFILES = $(SCRIPTS_DIR)/sdlog_makefile.pl +AUTOGEN_MAKEFILES = $(LAUNCHER_DIR)/ARM9/Makefile_sdlog +LDIRT_CLEAN += $(AUTOGEN_MAKEFILES) + +MAIN_ORG = $(LAUNCHER_DIR)/ARM9/src/main.c +MAKE_MAIN = $(SCRIPTS_DIR)/sdlog_main_c.pl +AUTOGEN_MAIN = $(LAUNCHER_DIR)/ARM9/src/main_sdlog.c +LDIRT_CLEAN += $(AUTOGEN_MAIN) + + + +TARGETS = $(AUTOGEN_MAKEFILES) $(AUTOGEN_MAIN) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +$(AUTOGEN_MAKEFILES): $(MAKEFILES_ORG) $(MAKE_MAKEFILES) + @echo " make:" $@ + @perl $(MAKE_MAKEFILES) + +$(AUTOGEN_MAIN): $(MAIN_ORG) $(MAKE_MAIN) + @echo " make:" $@ + @perl $(MAKE_MAIN) + +#===== End of Makefile ===== diff --git a/build/tests/Launcher_sdlog/scripts/sdlog_main_c.pl b/build/tests/Launcher_sdlog/scripts/sdlog_main_c.pl new file mode 100755 index 00000000..4ac96bbd --- /dev/null +++ b/build/tests/Launcher_sdlog/scripts/sdlog_main_c.pl @@ -0,0 +1,92 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: sdlog_main_c.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $src = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/main.c"; +my $dst = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/main_sdlog.c"; + + +my $rn = "\x0D\x0A"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + print OUT $line; + + if( $line =~ m/^\#include \"scanWDS\.h\"/ ) + { + print OUT "//\t[AUTO COMMENT] SDLOGのヘッダをインクルードし、ログ用バッファを定義します。", $rn; + print OUT <<__SDLOG_DEFINE__; +\#ifdef USE_SDLOG +\#include "sd_log_wrapper.h" +\#define BUFFER_SIZE 0x800 +char logBuffer[ (BUFFER_SIZE + 1) ]; +\#endif +__SDLOG_DEFINE__ + } + if( $line =~ m/^[\t ]*RTC_Init\(\);/ ) + { + print OUT "//\t[AUTO COMMENT] SDカードにOS_Printfのログを記録するために、SDLOGを初期化します。", $rn; + print OUT <<__SDLOG_INITEX__; +\#ifdef USE_SDLOG + { + RTCDate rDate; + RTCTime rTime; + char filename[FS_ENTRY_LONGNAME_MAX]; + + (void)RTC_GetDateTime(&rDate, &rTime); + OS_SPrintf(filename, "Launcher_%02d%02d%02d_%02d%02d.txt", + rDate.year, rDate.month, rDate.day, + rTime.hour, rTime.minute); + + SDLOG_InitEx("sdmc:/log", filename, logBuffer, + BUFFER_SIZE, 0x80, SDLOG_WRITE_TYPE_CONTINUANCE); + } +\#endif +__SDLOG_INITEX__ + } + + if( $line =~ m/^[\t ]*OS_SetIrqCheckFlag\(OS_IE_V_BLANK\);/ ) + { + print OUT <<__SDLOG_PRINTARM7__; +\#ifdef USE_SDLOG +\#ifdef USE_SDLOG_SUBP + SDLOG_PrintServer(); +\#endif +\#endif +__SDLOG_PRINTARM7__ + } + +} +close(OUT); + diff --git a/build/tests/Launcher_sdlog/scripts/sdlog_makefile.pl b/build/tests/Launcher_sdlog/scripts/sdlog_makefile.pl new file mode 100755 index 00000000..04931aa7 --- /dev/null +++ b/build/tests/Launcher_sdlog/scripts/sdlog_makefile.pl @@ -0,0 +1,103 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: sdlog_makefile.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $rn = "\x0D\x0A"; + +my $src = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile"; +my $dst = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile_sdlog"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/main\.c/ ) + { + $line =~ s/main\.c/main_sdlog\.c/; + } + + if( $line =~ m/^COMPONENT_DIR/ ) + { + $line =~ s/\/build\/components/\/build\/tests\/Launcher_sdlog/; + print OUT $line; + print OUT "override COMPONENTSDIR\t=\t\$(call eupath, \$(COMPONENT_DIR)/../components)", $rn; + next; + } + + if( $line =~ m/^WRAM_MAP_FILE[\t ]*=[\t ]*\$\(COMPONENT_DIR\)\/wram_regs\/wram_regs.rbin/ ) + { + $line =~ s/\$\(COMPONENT_DIR\)/\$\(TWL_IPL_RED_ROOT\)\/build\/components\/\$\(DEFAULT_COMP_ARM7\)\.TWL/; + } + + if( $line =~ m/^INSTALL_DIR/ ) + { + $line =~ s/\$\(SDK_NMENU_DATADIR\)/\$\(TWL_IPL_RED_ROOT\)\/build\/tests\/Launcher_sdlog/; + } + + if( $line =~ m/^TARGET_BIN[\t ]*=[\t ]*\$\(TITLEID_LO\)\.tad/ ) + { + $line =~ s/\.tad/_sdlog\.tad/; + print OUT <<__SDLOG_DESCRIPTIONS__; +\# -------------------------------------------------------------- +\# SDLOG +ifeq (\$(TWL_FINALROM),) \# SDLOG is enabled only on Release and Debug + +ifeq (\$(SDLOG), TRUE) +override SDLOG = ARM9 +endif + +ifneq (\$(filter ARM7,\$(SDLOG)),) +\$(error "Invalid SDLOG option : should be SDLOG=[ARM9/ALL]") +endif + +SDLOG_LIST = \$(if \$(filter ALL,\$(SDLOG)),ARM7 ARM9,\$(SDLOG)) + +ifneq (\$(filter ARM9,\$(SDLOG_LIST)),) +MACRO_FLAGS += -DUSE_SDLOG +ELIBRARIES += libsdlogRed\$(TWL_LIBSUFFIX).a +ELIBRARY_DIRS += \$(SYSMENU_ROOT)/build/tests/Launcher_sdlog/lib/\$(TWL_LIBTYPE) +EINCLUDES += \$(SYSMENU_ROOT)/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/include \\ + \$(ROOT)/build/tests/sdlog/sdlog/include +ifneq (\$(filter ARM7,\$(SDLOG_LIST)),) +MACRO_FLAGS += -DUSE_SDLOG_SUBP +endif \# SDLOG [ARM7] +endif \# SDLOG [ARM9] + +endif \# FINALROM + +__SDLOG_DESCRIPTIONS__ + } + + print OUT $line; +} +close(OUT); + diff --git a/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/Makefile b/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/Makefile new file mode 100644 index 00000000..75ec2c71 --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/Makefile @@ -0,0 +1,100 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL + +TARGET_CODEGEN ?= ARM +TWL_ARCHGEN ?= LIMITED +TWL_PROC = ARM7 + +OS_LIBRARY_SRC_DIR_BASE = $(ROOT)/build/libraries/os +OS_LIBSRC_ARM7 = $(OS_LIBRARY_SRC_DIR_BASE)/ARM7/src +OS_LIBSRC_ARM7TWL = $(OS_LIBRARY_SRC_DIR_BASE)/ARM7.TWL/src +OS_LIBSRC_COMMON = $(OS_LIBRARY_SRC_DIR_BASE)/common/src + +SRCDIR = src ../common/src ../ARM7/src +INCDIR = $(OS_LIBSRC_ARM7TWL)/../../common/include + +SRCS = $(OS_LIBSRC_ARM7TWL)/os_irqHandler.c \ + $(OS_LIBSRC_COMMON)/os_irqTable.c \ + $(OS_LIBSRC_COMMON)/os_interrupt.c \ + $(OS_LIBSRC_COMMON)/os_pxi.c \ + $(OS_LIBSRC_COMMON)/os_spinLock.c \ + os_printf.c \ + $(OS_LIBSRC_COMMON)/os_thread.c \ + $(OS_LIBSRC_COMMON)/os_context.c \ + $(OS_LIBSRC_COMMON)/os_emulator.c \ + $(OS_LIBSRC_COMMON)/os_message.c \ + $(OS_LIBSRC_COMMON)/os_mutex.c \ + $(OS_LIBSRC_COMMON)/os_init.c \ + $(OS_LIBSRC_COMMON)/os_arena.c \ + $(OS_LIBSRC_COMMON)/os_alloc.c \ + $(OS_LIBSRC_COMMON)/os_exception.c \ + $(OS_LIBSRC_COMMON)/os_timer.c \ + $(OS_LIBSRC_COMMON)/os_tick.c \ + $(OS_LIBSRC_COMMON)/os_alarm.c \ + $(OS_LIBSRC_COMMON)/os_valarm.c \ + $(OS_LIBSRC_COMMON)/os_system.c \ + $(OS_LIBSRC_COMMON)/os_systemWork.c \ + $(OS_LIBSRC_COMMON)/os_profile.c \ + $(OS_LIBSRC_COMMON)/os_reset.c \ + $(OS_LIBSRC_COMMON)/os_ownerInfo.c \ + $(OS_LIBSRC_COMMON)/os_ownerInfoEx.c \ + $(OS_LIBSRC_COMMON)/os_entropy.c \ + $(OS_LIBSRC_ARM7)/os_terminate_sp.c \ + $(OS_LIBSRC_COMMON)/os_event.c \ + $(OS_LIBSRC_COMMON)/os_application_jump.c + +TARGET_LIB = libossdlog_sp$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +# DEBUG版ビルドの場合、RELEASE版でビルドして +# DEBUG版のライブラリを装います。 + +ifdef TARGET_DEBUG +TWL_BUILD_TYPE = RELEASE +else +ifdef TWL_DEBUG +TWL_BUILD_TYPE = RELEASE +else +ifdef NITRO_DEBUG +TWL_BUILD_TYPE = RELEASE +endif +endif +endif + +#---------------------------------------------------------------------------- +# HYBRID / LIMITED 両方のライブラリを作成します +TWL_ARCHGEN ?= ALL + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/src/os_printf.c b/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/src/os_printf.c new file mode 100644 index 00000000..44c337ea --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/ARM7.TWL/src/os_printf.c @@ -0,0 +1,1536 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - OS + File: os_printf.c + + Copyright 2003 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 + +//---------------- for IS-NITRO-DEBUGGER +#ifdef SDK_LINK_ISD +# pragma warn_extracomma off +# include // has extracomma in enum +# pragma warn_extracomma reset +#else +void ISDPrint(const char *); +#endif + +//---------------- for IS-TWL-DEBUGGER +#ifdef SDK_LINK_ISTD +# pragma warn_extracomma off +# include // has extracomma in enum +# pragma warn_extracomma reset +#else +void ISTDPrintEx(int console, const char *); +#endif +//---- print output +#ifdef SDK_ARM9 +#define OSi_PRINT_OUTPUT (*(u8*)HW_PRINT_OUTPUT_ARM9) +#define OSi_PRINT_ERR_OUTPUT (*(u8*)HW_PRINT_OUTPUT_ARM9ERR) +#else +#define OSi_PRINT_OUTPUT (*(u8*)HW_PRINT_OUTPUT_ARM7) +#define OSi_PRINT_ERR_OUTPUT (*(u8*)HW_PRINT_OUTPUT_ARM7ERR) +#endif + +#ifndef SDK_FINALROM +static char common_buffer[256]; // thread unsafe, but less use of stack +#endif + +#if !defined(SDK_FINALROM) && defined(SDK_NO_MESSAGE) +#undef OSi_Warning +#undef OSi_TWarning +#undef OSi_Panic +#undef OSi_TPanic +void OSi_Warning(const char *file, int line, const char *fmt, ...); +void OSi_TWarning(const char *file, int line, const char *fmt, ...); +void OSi_Panic(const char *file, int line, const char *fmt, ...); +void OSi_TPanic(const char *file, int line, const char *fmt, ...); +#endif /* SDK_NO_MESSAGE */ + + +/*---------------------------------------------------------------------------* + Name: OS_PutChar + OS_FPutChar + + Description: put a letter for debug console + + Arguments: console : output window + c : char code , shuild be 0x01-0xff + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OS_PutChar(char c) +{ + OS_FPutChar((int)OSi_PRINT_OUTPUT, c); +} + +SDK_WEAK_SYMBOL void OS_FPutChar(int console, char c) +{ + char str[2]; + + str[0] = c; + str[1] = '\0'; + + // Because of no putchar-type function on ISDebugger library, + // use 'putstring' for a single letter outputting + OS_FPutString(console, str); +} +#endif + +/*---------------------------------------------------------------------------* + Name: OS_FPutString + + Description: put a string to debug console. + console port are automatically switched depends on emu/hw + + Arguments: console : output window + str : string + + Returns: None. + *---------------------------------------------------------------------------*/ +static void OS_PutStringDefault(const char* str); +static void OS_FPutStringInit(int console, const char *str); + +#ifndef SDK_FINALROM +static void OS_FPutStringDummy(int console, const char *str); +static void OS_FPutStringAris(int console, const char *str); +static void OS_FPutStringISD(int console, const char *str); +static void OS_FPutStringISTD(int console, const char *str); +#ifdef SDK_ARM7 +static void OS_FPutStringPrnSrv(int console, const char *str); +#endif +#endif + +#ifndef SDK_FINALROM +void (*OS_PutString) (const char *str) = OS_PutStringDefault; +void (*OS_FPutString) (int console, const char *str) = OS_FPutStringInit; +void (*OSi_FuncTerminate) (void) = OS_Terminate; +//---- hook function +static OSFPutStringHookType OSi_FPutStringHook = NULL; +#endif + + +/*---------------------------------------------------------------------------* + Name: OS_PutStringDefault + Description: OS_PutString initializer + *---------------------------------------------------------------------------*/ +static void OS_PutStringDefault(const char* str) +{ +#pragma unused(str) +#ifndef SDK_FINALROM + OS_FPutString(OS_PRINT_OUTPUT_CURRENT, str); +#endif +} + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringInit + Description: OS_FPutString initializer + *---------------------------------------------------------------------------*/ +static void OS_FPutStringInit(int console, const char *str) +{ +#ifndef SDK_FINALROM + OSIntrMode intr = OS_DisableInterrupts(); + u32 consoleType = OS_GetConsoleType(); + + OS_FPutString = OS_FPutStringDummy; + +#ifdef SDK_ARM9 + //---- arm9 + if ( consoleType & OS_CONSOLE_ENSATA ) + { + OS_FPutString = OS_FPutStringAris; + } + else if ( consoleType & OS_CONSOLE_TWLDEBUGGER ) + { + OS_FPutString = OS_FPutStringISTD; + } + else if ( consoleType & OS_CONSOLE_ISDEBUGGER ) + { +#ifndef SDK_TWLLTD + OS_FPutString = OS_FPutStringISD; +#endif + } +#else + //---- arm7 +// if ( consoleType & OS_CONSOLE_TWLDEBUGGER ) +// { +// OS_FPutString = OS_FPutStringISTD; +// } +// else + { + OS_FPutString = OS_FPutStringPrnSrv; + } +#endif + + OS_FPutString(console, str); + + (void)OS_RestoreInterrupts(intr); + +#else +#pragma unused(console, str) +#endif +} + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringDummy + Description: dummy OS_FPutString. do nothing. + *---------------------------------------------------------------------------*/ +static void OS_FPutStringDummy(int console, const char *str) +{ +#pragma unused(console, str) +#ifndef SDK_FINALROM + if ( OSi_FPutStringHook ) + { + OSi_FPutStringHook(OS_FPUTSTRING_DUMMY, console, str); + } +#endif +} + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringAris + Description: OS_FPutString for software simulator called ARIS + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +#ifdef SDK_CW_WARNOFF_SAFESTRB +#include +#endif +static void OS_FPutStringAris(int console, const char *str) +{ + char c; + + if ( console == OS_PRINT_OUTPUT_CURRENT ) + { + console = (int)OSi_PRINT_OUTPUT; + } + else if ( console == OS_PRINT_OUTPUT_ERROR ) + { + console = (int)OSi_PRINT_ERR_OUTPUT; + } + + if ( console != OS_PRINT_OUTPUT_NONE ) + { + while ('\0' != (c = *str)) + { + reg_OS_EMU_CONSOLE_OUT = (u8)c; // Console out + str++; + } + if ( OSi_FPutStringHook ) + { + OSi_FPutStringHook(OS_FPUTSTRING_ARIS, console, str); + } + } +} +#ifdef SDK_CW_WARNOFF_SAFESTRB +#include +#endif +#endif + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringISD + Description: OS_FPutString for hardware emulator called IS Debugger + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +static void OS_FPutStringISD(int console, const char *str) +{ + // ISDPrint の初期化処理 + OS_InitLock(); + + if ( console == OS_PRINT_OUTPUT_CURRENT ) + { + console = (int)OSi_PRINT_OUTPUT; + } + else if ( console == OS_PRINT_OUTPUT_ERROR ) + { + console = (int)OSi_PRINT_ERR_OUTPUT; + } + + if ( console != OS_PRINT_OUTPUT_NONE ) + { + ISDPrint(str); + if ( OSi_FPutStringHook ) + { + OSi_FPutStringHook(OS_FPUTSTRING_ISD, console, str); + } + } +} +#endif + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringISTD + Description: OS_FPutString for hardware emulator called IS TWL Debugger + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +static void OS_FPutStringISTD(int console, const char *str) +{ + // ISTDPrintEx の初期化処理 + OS_InitLock(); + + if ( console == OS_PRINT_OUTPUT_CURRENT ) + { + console = (int)OSi_PRINT_OUTPUT; + } + else if ( console == OS_PRINT_OUTPUT_ERROR ) + { + console = (int)OSi_PRINT_ERR_OUTPUT; + } + + if ( console != OS_PRINT_OUTPUT_NONE ) + { + ISTDPrintEx(console, str); + if ( OSi_FPutStringHook ) + { + OSi_FPutStringHook(OS_FPUTSTRING_ISTD, console, str); + } + } +} +#endif + + +/*---------------------------------------------------------------------------* + Name: OS_VPrintf/OS_TVPrintf + + Description: print formatted strings (vprintf ver.) + + Arguments: fmt : format string + vlist : parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +// If you want to use "vsnprintf()" in ARM7, define SDK_USE_VSNPRINTF. +// "vsnprintf()" is able to print float format but the code size become hugely bigger. +// #define SDK_USE_VSNPRINTF + +#ifndef SDK_FINALROM +#if defined(SDK_ARM9) || defined(SDK_USE_VSNPRINTF) +SDK_WEAK_SYMBOL void OS_VPrintf(const char *fmt, va_list vlist) +{ + OS_VFPrintf(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); +} +SDK_WEAK_SYMBOL void OS_VFPrintf(int console, const char *fmt, va_list vlist) +{ + (void)vsnprintf(common_buffer, sizeof(common_buffer), fmt, vlist); + OS_FPutString(console, common_buffer); +} +#else +SDK_WEAK_SYMBOL void OS_VPrintf(const char *fmt, va_list vlist) +{ + OS_TVFPrintf(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); +} +SDK_WEAK_SYMBOL void OS_VFPrintf(int console, const char *fmt, va_list vlist) +{ + OS_TVFPrintf(console, fmt, vlist); +} +#endif +SDK_WEAK_SYMBOL void OS_TVPrintf(const char *fmt, va_list vlist) +{ + OS_TVFPrintf(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); +} +SDK_WEAK_SYMBOL void OS_TVFPrintf(int console, const char *fmt, va_list vlist) +{ + (void)OS_VSNPrintf(common_buffer, sizeof(common_buffer), fmt, vlist); + OS_FPutString(console, common_buffer); +} +SDK_WEAK_SYMBOL void OS_TVPrintfEx(const char *fmt, va_list vlist) +{ + OS_TVFPrintfEx(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); +} +SDK_WEAK_SYMBOL void OS_TVFPrintfEx(int console, const char *fmt, va_list vlist) +{ + (void)OS_VSNPrintfEx(common_buffer, sizeof(common_buffer), fmt, vlist); + OS_FPutString(console, common_buffer); +} +#endif + +/*---------------------------------------------------------------------------* + Name: OS_Printf/OS_TPrintf/OS_TPrintfEx + OS_FPrintf/OS_TFPrintf/OS_TFPrintfEx + + Description: print formatted strings. + + Arguments: console : output window + fmt : format string + ... and parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OS_Printf(const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_VFPrintf(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); + va_end(vlist); +} + +SDK_WEAK_SYMBOL void OS_FPrintf(int console, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_VFPrintf(console, fmt, vlist); + va_end(vlist); +} + +SDK_WEAK_SYMBOL void OS_TPrintf(const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TVFPrintf(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); + va_end(vlist); +} + +SDK_WEAK_SYMBOL void OS_TFPrintf(int console, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TVFPrintf(console, fmt, vlist); + va_end(vlist); +} + +SDK_WEAK_SYMBOL void OS_TPrintfEx(const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TVFPrintfEx(OS_PRINT_OUTPUT_CURRENT, fmt, vlist); + va_end(vlist); +} + +SDK_WEAK_SYMBOL void OS_TFPrintfEx(int console, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TVFPrintfEx(console, fmt, vlist); + va_end(vlist); +} +#endif + + +/*---------------------------------------------------------------------------* + Name: OSi_Warning / OSi_TWarning + + Description: print warning message. + + Arguments: file : filename of warning location + line : line number of warning location + fmt : format string + ... and parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OSi_Warning(const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_FPrintf(OS_PRINT_OUTPUT_ERROR, "%s:%d Warning:", file, line); + OS_VFPrintf(OS_PRINT_OUTPUT_ERROR, fmt, vlist); + OS_FPrintf(OS_PRINT_OUTPUT_ERROR, "\n"); + va_end(vlist); +} + + +SDK_WEAK_SYMBOL void OSi_TWarning(const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TPrintf("%s:%d Warning:", file, line); + OS_TVPrintf(fmt, vlist); + OS_TPrintf("\n"); + va_end(vlist); +} +#endif + +/*---------------------------------------------------------------------------* + Name: OSi_Panic/OSi_TPanic + + Description: print panic message and halt cpu. + + Arguments: file : filename of panic location + line : line number of panic location + fmt : format string + ... and parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OSi_Panic(const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + (void)OS_DisableInterrupts(); + OS_FPrintf(OS_PRINT_OUTPUT_ERROR, "%s:%d Panic:", file, line); + OS_VFPrintf(OS_PRINT_OUTPUT_ERROR, fmt, vlist); + OS_FPrintf(OS_PRINT_OUTPUT_ERROR, "\n"); + OSi_FuncTerminate(); // Never Returns +} + +SDK_WEAK_SYMBOL void OSi_TPanic(const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + (void)OS_DisableInterrupts(); + OS_TPrintf("%s:%d Panic:", file, line); + OS_TVPrintf(fmt, vlist); + OS_TPrintf("\n"); + OSi_FuncTerminate(); // Never Returns +} +#endif + +/*---------------------------------------------------------------------------* + Name: OSi_FWarning / OSi_TFWarning + + Description: print warning message. + + Arguments: console : output window + file : filename of warning location + line : line number of warning location + fmt : format string + ... and parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OSi_FWarning(int console, const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_FPrintf(console, "%s:%d Warning:", file, line); + OS_VFPrintf(console, fmt, vlist); + OS_FPrintf(console, "\n"); + va_end(vlist); +} + + +SDK_WEAK_SYMBOL void OSi_TFWarning(int console, const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + OS_TFPrintf(console, "%s:%d Warning:", file, line); + OS_TVFPrintf(console, fmt, vlist); + OS_TFPrintf(console, "\n"); + va_end(vlist); +} +#endif + +/*---------------------------------------------------------------------------* + Name: OSi_FPanic/OSi_TFPanic + + Description: print panic message and halt cpu. + + Arguments: file : filename of panic location + line : line number of panic location + fmt : format string + ... and parameters + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifndef SDK_FINALROM +SDK_WEAK_SYMBOL void OSi_FPanic(int console, const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + (void)OS_DisableInterrupts(); + OS_FPrintf(console, "%s:%d Panic:", file, line); + OS_VFPrintf(console, fmt, vlist); + OS_FPrintf(console, "\n"); + OSi_FuncTerminate(); // Never Returns +} + +SDK_WEAK_SYMBOL void OSi_TFPanic(int console, const char *file, int line, const char *fmt, ...) +{ + va_list vlist; + + va_start(vlist, fmt); + (void)OS_DisableInterrupts(); + OS_TFPrintf(console, "%s:%d Panic:", file, line); + OS_TVFPrintf(console, fmt, vlist); + OS_TFPrintf(console, "\n"); + OSi_FuncTerminate(); // Never Returns +} +#endif + +/*---------------------------------------------------------------------------* + Name: OS_InitPrintServer + + Description: initialize print server + - this code should be called before OS_InitLock() + - OS_InitLock() are also called from OS_Init() + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +#ifdef SDK_ARM9 +#ifndef SDK_FINALROM +void OS_InitPrintServer(void) +{ + OSPrintServerBuffer *p; + + // first, allocate buffer and register it. + OS_InitArena(); + p = OS_AllocFromSharedArenaHi(sizeof(OSPrintServerBuffer), 4); + p->in = p->out = 0UL; + PXI_SetComponentParam((u32)p); +} +#endif //SDK_FINALROM +#endif //SDK_ARM9 + + +/*---------------------------------------------------------------------------* + Name: OS_PrintServer + + Description: print a string comes from ARM7 via shared memory + + Arguments: str : string + + Returns: None. + *---------------------------------------------------------------------------*/ +#ifdef SDK_ARM9 +#ifndef SDK_FINALROM +#include // to access 'common_buffer' via cache +void OS_PrintServer(void) +{ + OSPrintServerBuffer *p; + register OSPrintWChar word; + + u32 in, out; + int i; + + p = (OSPrintServerBuffer *)PXI_GetComponentParam(); + + //---- If print buffer isn't set up, do nothing. + if (!p) + { + return; + } + + out = p->out; + in = p->in; + + while (in != out) + { + i = 0; + + while (in != out && i < sizeof(common_buffer) - 3) + { + word.s = p->buffer[out].s; + if (word.c[0]) + { + common_buffer[i++] = word.c[0]; // store via cache + + if (word.c[1]) + { + common_buffer[i++] = word.c[1]; // store via cache + } + } + out++; + if (out >= OS_PRINTSRV_WCHARSIZE) + out = 0; + } + common_buffer[i] = '\0'; // store via cache + OS_FPutString(OS_PRINT_OUTPUT_CURRENT, common_buffer); + } + + // tell finished + p->out = out; +} + +#include +#endif //SDK_FINALROM +#endif //SDK_ARM9 + + +/*---------------------------------------------------------------------------* + Name: OS_FPutStringPrnSrv + + Description: sends string to ARM9 via shared memory + + Arguments: console : output window + str : string to be sent + + Returns: None + *---------------------------------------------------------------------------*/ +#ifdef SDK_ARM7 +static void OS_FPutStringPrnSrv(int console, const char *str) +{ +#pragma unused(console, str) +#ifndef SDK_FINALROM + OSPrintServerBuffer *p; + register OSPrintWChar word; + + u32 in, in_tmp, out; + u32 isOdd; + + if ( console == OS_PRINT_OUTPUT_NONE ) + { + return; + } + + p = (OSPrintServerBuffer *)PXI_GetComponentParam(); + in = p->in; + out = p->out; + isOdd = ((u32)str) & 1; + + while (1) + { + in_tmp = in + 1; + if (in_tmp >= OS_PRINTSRV_WCHARSIZE) + in_tmp = 0; + if (out == in_tmp) + break; // Buffer full, then exit + + if (isOdd) + { + p->buffer[in].s = word.s = (u16)((*(u16 *)(str - 1)) & 0xff00); + str++; + isOdd = 0UL; + if (!word.c[1]) + break; + in = in_tmp; + } + else + { + p->buffer[in].s = word.s = *(u16 *)str; + str += 2; + if (!word.c[0]) + break; + in = in_tmp; + if (!word.c[1]) + break; + } + } + p->in = in; +#endif //SDK_FINALROM +} +#endif //SDK_ARM7 + + +#if defined(SDK_CW_WARNOFF_SAFESTRB) +#include +#endif + +/* inner function for sized-buffer output */ +typedef struct dst_string_tag +{ + size_t len; + char *cur; + char *base; +} +dst_string; + +static void string_put_char(dst_string * p, char c) +{ + if (p->len > 0) + *p->cur = c, --p->len; + ++p->cur; +} + +static void string_fill_char(dst_string * p, char c, int n) +{ + if (n > 0) + { + size_t i, k = p->len; + if (k > (size_t) n) + k = (size_t) n; + for (i = 0; i < k; ++i) + p->cur[i] = c; + p->len -= k; + p->cur += n; + } +} + +static void string_put_string(dst_string * p, const char *s, int n) +{ + if (n > 0) + { + size_t i, k = p->len; + if (k > (size_t) n) + k = (size_t) n; + for (i = 0; i < k; ++i) + p->cur[i] = s[i]; + p->len -= k; + p->cur += n; + } +} + +/*---------------------------------------------------------------------------* + Name: OS_SPrintf + + Description: equal to 'OS_VSPrintf' except argument style. + + Arguments: dst : destination buffer. + fmt : format string. + + Returns: length of the generated string. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL int OS_SPrintf(char *dst, const char *fmt, ...) +{ + int ret; + va_list va; + va_start(va, fmt); + ret = OS_VSPrintf(dst, fmt, va); + va_end(va); + return ret; +} + +/*---------------------------------------------------------------------------* + Name: OS_VSPrintf + + Description: equal to 'OS_VSNPrintf' except buffer size argument. + + Arguments: dst : destination buffer. + fmt : format string. + vlist : parameters. + + Returns: length of the generated string. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL int OS_VSPrintf(char *dst, const char *fmt, va_list vlist) +{ + return OS_VSNPrintf(dst, 0x7FFFFFFF, fmt, vlist); +} + +/*---------------------------------------------------------------------------* + Name: OS_SNPrintf + + Description: equal to 'OS_VSNPrintf' except argument style. + + Arguments: dst : destination buffer. + len : destination buffer size. + fmt : format string. + + Returns: length of the generated string. (except '\0') + if(result < len), + put NUL in dst[result]. + else if(len > 0), + put NUL in dst[len - 1]. + else, + do nothing. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL int OS_SNPrintf(char *dst, size_t len, const char *fmt, ...) +{ + int ret; + va_list va; + va_start(va, fmt); + ret = OS_VSNPrintf(dst, len, fmt, va); + va_end(va); + return ret; +} + +/*---------------------------------------------------------------------------* + Name: OS_VSNPrintf + + Description: small-size vsnprintf which is similar to 'vsnprintf' + without following supports. + * CodeWarrior Extensions (#s) + * MSL AltiVec Extensions (v, vh, vl, hv, lv, @) + * indexed argments (%m$, *m$) + * floating-point + * wchar_t + + Note: '+' and '#' do not work, MSL's sprintf(). + to keep same result, they are no implement. + { // exsample + char buf[5]; + sprintf(buf, "%-i\n", 45); // "45" (OK) + sprintf(buf, "%0i\n", 45); // "45" (OK) + sprintf(buf, "% i\n", 45); // " 45" (OK) + sprintf(buf, "%+i\n", 45); // "%+i" ("+45" expected) + sprintf(buf, "%#x\n", 45); // "%#x" ("0x2d" expected) + // but, this works correctly! + sprintf(buf, "% +i\n", 45); // "+45" (OK) + } + + Arguments: dst : destination buffer. + len : destination buffer size. + fmt : format string. + vlist : parameters. + + Returns: length of the generated string. (except '\0') + if(result < len), + put NUL in dst[result]. + else if(len > 0), + put NUL in dst[len - 1]. + else, + do nothing. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL int OS_VSNPrintf(char *dst, size_t len, const char *fmt, va_list vlist) +{ + return STD_TVSNPrintf(dst, len, fmt, vlist); +} + +/*---------------------------------------------------------------------------* + Name: OS_VSNPrintfEx + + Description: OS_VSNPrintfEx is an addition of binary output to OS_VSNPrintfEx. + + Arguments: dst : destination buffer. + len : destination buffer size. + fmt : format string. + vlist : parameters. + + Returns: length of the generated string. (except '\0') + if(result < len), + put NUL in dst[result]. + else if(len > 0), + put NUL in dst[len - 1]. + else, + do nothing. + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL int OS_VSNPrintfEx(char *dst, size_t len, const char *fmt, va_list vlist) +{ + char buf[24]; + int n_buf; + char prefix[2]; + int n_prefix; + + const char *s = fmt; + + dst_string str; + str.len = len, str.cur = str.base = dst; + + while (*s) + { + if ((unsigned int)(((unsigned char)*s ^ 0x20) - 0xA1) < 0x3C) + { + /* Shift JIS character */ + string_put_char(&str, *s++); + if (*s) + string_put_char(&str, *s++); + } + else if (*s != '%') + { + /* normal ASCII character */ + string_put_char(&str, *s++); + } + else + { + /* output with format */ + enum + { + flag_blank = 000001, /* ' ' */ + flag_plus = 000002, /* '+' */ + flag_sharp = 000004, /* '#' */ + flag_minus = 000010, /* '-' */ + flag_zero = 000020, /* '0' */ + flag_l1 = 000040, /* "l" */ + flag_h1 = 000100, /* "h" */ + flag_l2 = 000200, /* "ll" */ + flag_h2 = 000400, /* "hh" */ + flag_unsigned = 010000, /* 'o', 'u', ... */ + flag_binary = 020000, /* 'b' */ + flag_colon = 040000, /* ':' */ + flag_end + }; + int flag = 0, width = 0, precision = -1, radix = 10; + char hex_char = 'a' - 10; + const char *p_start = s; + /* flags */ + for (;;) + { + switch (*++s) + { + case '+': + if (s[-1] != ' ') + break; + flag |= flag_plus; + continue; + case ' ': + flag |= flag_blank; + continue; + case '-': + flag |= flag_minus; + continue; + case '0': + flag |= flag_zero; + continue; + case ':': + flag |= flag_colon; + continue; + } + break; + } + /* width */ + if (*s == '*') + { + ++s, width = va_arg(vlist, int); + if (width < 0) + width = -width, flag |= flag_minus; + } + else + { + while ((*s >= '0') && (*s <= '9')) + width = (width * 10) + *s++ - '0'; + } + /* precision */ + if (*s == '.') + { + ++s, precision = 0; + if (*s == '*') + { + ++s, precision = va_arg(vlist, int); + if (precision < 0) + precision = -1; + } + else + { + while ((*s >= '0') && (*s <= '9')) + precision = (precision * 10) + *s++ - '0'; + } + } + /* option */ + switch (*s) + { + case 'h': + if (*++s != 'h') + flag |= flag_h1; + else + ++s, flag |= flag_h2; + break; + case 'l': + if (*++s != 'l') + flag |= flag_l1; + else + ++s, flag |= flag_l2; + break; + } + + /* type */ + switch (*s) + { + case 'd': /* signed decimal */ + case 'i': /* signed decimal */ + goto put_integer; + case 'o': /* unsigned octal */ + radix = 8; + flag |= flag_unsigned; + goto put_integer; + case 'u': /* unsigned decimal */ + flag |= flag_unsigned; + goto put_integer; + case 'X': /* unsigned hexadecimal */ + hex_char = 'A' - 10; + goto put_hexadecimal; + case 'x': /* unsigned hexadecimal */ + goto put_hexadecimal; + case 'p': /* pointer */ + /* equal to code warrior */ + flag |= flag_sharp; + precision = 8; + goto put_hexadecimal; + + case 'C': /* unicode-character */ + flag |= flag_l1; + case 'c': /* character */ + if (precision >= 0) + goto put_invalid; + { + int c = va_arg(vlist, int); + width -= 1; + if (flag & flag_minus) + { + if (flag & flag_l1) + { + char dst[2]; + + if (STD_ConvertCharUnicodeToSjis(dst, (u16)c) == 1) + { + string_put_char(&str, dst[0]); + } + else + { + string_put_string(&str, dst, 2); + } + } + else + { + string_put_char(&str, (char)c); + } + string_fill_char(&str, ' ', width); + } + else + { + char pad = (char)((flag & flag_zero) ? '0' : ' '); + string_fill_char(&str, pad, width); + + if (flag & flag_l1) + { + char dst[2]; + + if (STD_ConvertCharUnicodeToSjis(dst, (u16)c) == 1) + { + string_put_char(&str, dst[0]); + } + else + { + string_put_string(&str, dst, 2); + } + } + else + { + string_put_char(&str, (char)c); + } + } + ++s; + } + break; + + case 'S': /* unicode-string */ + flag |= flag_l1; + case 's': /* string */ + { + int n_buf = 0; + const char *p_buf = va_arg(vlist, const char *); + + if (precision < 0) + { + while (p_buf[n_buf]) + { + if (flag & flag_l1) + { + n_buf += 2; + } + else + { + ++n_buf; + } + } + } + else + { + while ((n_buf < precision) && p_buf[n_buf]) + { + if (flag & flag_l1) + { + n_buf += 2; + } + else + { + ++n_buf; + } + } + } + if (flag & flag_l1) + { + n_buf /= 2; + } + width -= n_buf; + if (flag & flag_minus) + { + if (flag & flag_l1) + { + u16 *w_buf = (u16 *)p_buf; + char dst[2]; + + while (n_buf--) + { + if (STD_ConvertCharUnicodeToSjis(dst, *w_buf) == 1) + { + string_put_char(&str, dst[0]); + } + else + { + string_put_string(&str, dst, 2); + } + w_buf++; + } + } + else + { + string_put_string(&str, p_buf, n_buf); + } + string_fill_char(&str, ' ', width); + } + else + { + char pad = (char)((flag & flag_zero) ? '0' : ' '); + string_fill_char(&str, pad, width); + + if (flag & flag_l1) + { + u16 *w_buf = (u16 *)p_buf; + char dst[2]; + + while (n_buf--) + { + if (STD_ConvertCharUnicodeToSjis(dst, *w_buf) == 1) + { + string_put_char(&str, dst[0]); + } + else + { + string_put_string(&str, dst, 2); + } + w_buf++; + } + } + else + { + string_put_string(&str, p_buf, n_buf); + } + } + ++s; + } + break; + + case 'B': /* binary */ + hex_char = 'A' - 10; + case 'b': /* binary */ + { + int n_buf = width; + int count = 0; + char *p_buf = va_arg(vlist, char *); + int column_count; + + if (n_buf <= 0) + { + n_buf = 1; + } + if (precision == 0) + { + precision = -1; + } + column_count = precision; + + while (1) + { + char left_char, right_char; + int left = ((p_buf[count] & 0xF0) >> 4); + int right = (p_buf[count] & 0x0F); + + left_char = (char)((left < 10) ? (left + '0') : (left + hex_char)); + right_char = (char)((right < 10) ? (right + '0') : (right + hex_char)); + + string_put_char(&str, left_char); + string_put_char(&str, right_char); + + count++; + + if (count >= n_buf) + break; + + if (column_count > 0) + { + --column_count; + } + + if (column_count == 0) + { + string_put_char(&str, '\n'); + if ((flag & flag_blank) && !(flag & flag_minus)) + { + string_put_char(&str, ' '); + } + column_count = precision; + } + else if (flag & flag_colon) + { + string_put_char(&str, ':'); + } + else if (flag & flag_blank) + { + string_put_char(&str, ' '); + } + } + ++s; + } + break; + + case 'n': /* store the number of output */ + { + int pos = str.cur - str.base; + if (flag & flag_h2) + ; + else if (flag & flag_h1) + *va_arg(vlist, signed short *) = (signed short)pos; + else if (flag & flag_l2) + *va_arg(vlist, u64 *) = (u64)pos; + else + *va_arg(vlist, signed int *) = (signed int)pos; + } + ++s; + break; + + case '%': /* output '%' */ + if (p_start + 1 != s) + goto put_invalid; + string_put_char(&str, *s++); + break; + + default: /* invalid type */ + goto put_invalid; + + put_invalid: + string_put_string(&str, p_start, s - p_start); + break; + + put_hexadecimal: + radix = 16; + flag |= flag_unsigned; + put_integer: + { + u64 val = 0; + n_prefix = 0; + + if (flag & flag_minus) + flag &= ~flag_zero; + if (precision < 0) + precision = 1; + else + flag &= ~flag_zero; + + if (flag & flag_unsigned) + { + if (flag & flag_h2) + val = va_arg(vlist, unsigned char); + else if (flag & flag_h1) + val = va_arg(vlist, unsigned short); + else if (flag & flag_l2) + val = va_arg(vlist, u64); + else + val = va_arg(vlist, unsigned long); + flag &= ~(flag_plus | flag_blank); + if (flag & flag_sharp) + { + if (radix == 16) + { + if (val != 0) + { + prefix[0] = (char)(hex_char + (10 + 'x' - 'a')); + prefix[1] = '0'; + n_prefix = 2; + } + } + else if (radix == 8) + { + prefix[0] = '0'; + n_prefix = 1; + } + } + } + else + { + if (flag & flag_h2) + val = va_arg(vlist, char); + else if (flag & flag_h1) + val = va_arg(vlist, short); + else if (flag & flag_l2) + val = va_arg(vlist, u64); + else + val = va_arg(vlist, long); + if ((val >> 32) & 0x80000000) + { + val = ~val + 1; + prefix[0] = '-'; + n_prefix = 1; + } + else + { + if (val || precision) + { + if (flag & flag_plus) + { + prefix[0] = '+'; + n_prefix = 1; + } + else if (flag & flag_blank) + { + prefix[0] = ' '; + n_prefix = 1; + } + } + } + } + n_buf = 0; + switch (radix) + { + case 8: + while (val != 0) + { + int d = (int)(val & 0x07); + val >>= 3; + buf[n_buf++] = (char)(d + '0'); + } + break; + case 10: + if ((val >> 32) == 0) + { +#if defined(SDK_CW) || defined(SDK_RX) || defined(__MWERKS__) +#pragma optimize_for_size off +#endif + u32 v = (u32)val; + while (v != 0) + { + // u32 と定数の除算であれば、コンパイラが自動的に + // マジックナンバーを使用した積算に変換する + u32 r = v / 10; + int d = (int)(v - (r * 10)); + v = r; + buf[n_buf++] = (char)(d + '0'); + } + } + else + { + while (val != 0) + { + u64 r = val / 10; + int d = (int)(val - (r * 10)); + val = r; + buf[n_buf++] = (char)(d + '0'); + } + } + break; + case 16: + while (val != 0) + { + int d = (int)(val & 0x0f); + val >>= 4; + buf[n_buf++] = (char)((d < 10) ? (d + '0') : (d + hex_char)); + } + break; + } + if ((n_prefix > 0) && (prefix[0] == '0')) + { + n_prefix = 0; + buf[n_buf++] = '0'; + } + } + goto put_to_stream; + + put_to_stream: + { + int n_pad = precision - n_buf; + if (flag & flag_zero) + { + if (n_pad < width - n_buf - n_prefix) + n_pad = width - n_buf - n_prefix; + } + if (n_pad > 0) + width -= n_pad; + width -= n_prefix + n_buf; + if (!(flag & flag_minus)) + string_fill_char(&str, ' ', width); + while (n_prefix > 0) + string_put_char(&str, prefix[--n_prefix]); + string_fill_char(&str, '0', n_pad); + while (n_buf > 0) + string_put_char(&str, buf[--n_buf]); + if (flag & flag_minus) + string_fill_char(&str, ' ', width); + ++s; + } + break; + } + } + } + + if (str.len > 0) + *str.cur = '\0'; + else if (len > 0) + str.base[len - 1] = '\0'; + return str.cur - str.base; +} + + +#if defined(SDK_CW_WARNOFF_SAFESTRB) +#include +#endif + +//================================================================================ +// Set output of print (for IS-TWL-DEBUGGER) +//================================================================================ +#ifndef SDK_FINALROM +#ifdef SDK_LINK_ISTD +/*---------------------------------------------------------------------------* + Name: OS_SetPrintOutput + + Description: Specify the output window OS_Printf uses. + This is only for IS-TWL-DEBUGGER. + + Arguments: proc : processor + OS_PRINT_OUTPUT_PROC_ARM9 : ARM9 + OS_PRINT_OUTPUT_PROC_ARM7 : ARM7 + OS_PRINT_OUTPUT_PROC_ARM9ERR : ARM9 for error + OS_PRINT_OUTPUT_PROC_ARM7ERR : ARM7 for error + num : window number (0-3) + + Returns: None. + *---------------------------------------------------------------------------*/ +void OS_SetPrintOutput( OSPrintOutputProc proc, int num ) +{ + SDK_ASSERT( (0<=num && num<=OS_PRINT_OUTPUT_WINDOW_MAX) || num==OS_PRINT_OUTPUT_NONE ); + SDK_ASSERT( 0<=(int)proc && (int)proc<=OS_PRINT_OUTPUT_PROC_ARM7ERR ); + *(u8*)(HW_PRINT_OUTPUT_ARM9 + proc) = (u8)num; +} +#endif +#endif + +//================================================================================ +// FPutString hook +//================================================================================ +#ifndef SDK_FINALROM +/*---------------------------------------------------------------------------* + Name: OS_SetFPutStringHook + + Description: set hook function in FPutString + + Arguments: func : hook function + + Returns: None. + *---------------------------------------------------------------------------*/ +void OS_SetFPutStringHook( OSFPutStringHookType func ) +{ + OSi_FPutStringHook = func; +} + +/*---------------------------------------------------------------------------* + Name: OS_GetFPutStringHook + + Description: get hook function in FPutString + + Arguments: None. + + Returns: hook function + *---------------------------------------------------------------------------*/ +OSFPutStringHookType OS_GetFPutStringHook(void) +{ + return OSi_FPutStringHook; +} +#endif + +//================================================================================ +// DUMMY PRINT (stub for FINALROM) +//================================================================================ +#ifdef SDK_FINALROM +#ifdef OS_Printf +#undef OS_Printf +#endif +void OS_Printf(const char *fmt, ...); +void OS_Printf(const char *fmt, ...) +{ +#pragma unused( fmt ) +} +#endif diff --git a/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/Makefile b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/Makefile new file mode 100644 index 00000000..dca6850a --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TWL WLAN - libraries - os +# File: Makefile +# +# Copyright 2003 - 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. +# +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL + +TWL_PROC = ARM9 + +TARGET_CODEGEN ?= ARM +TWL_ARCHGEN ?= LIMITED + +SRCDIR = ./src +INCDIR = ./include $(ROOT)/build/tests/sdlog/sdlog/include \ + $(ROOT)/build/tests/sdlog/sdlog/src + +SRCS = sd_log_wrapper.c + +SRCS += $(ROOT)/build/tests/sdlog/sdlog/src/os_log.c + +#---------------------------------------------------------------------------- + +TARGET_LIB = libsdlogRed$(TWL_LIBSUFFIX).a + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/tests/Launcher_sdlog/lib/$(TWL_LIBTYPE) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/include/sd_log_wrapper.h b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/include/sd_log_wrapper.h new file mode 100644 index 00000000..d32dc48e --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/include/sd_log_wrapper.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SDLOG - include + File: sd_log_wrapper.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 TWL_SD_LOG_WRAPPER_H_ +#define TWL_SD_LOG_WRAPPER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "log.h" +#include "sd_log.h" + +BOOL SDLOG_InitEx(const char* path, const char* filename, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType); + +void SDLOG_FinishEx(void); + +inline +void SDLOG_PrintServer(void) +{ + OS_PrintServer(); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_SD_LOG_WRAPPER_H_ */ +#endif diff --git a/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/src/sd_log_wrapper.c b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/src/sd_log_wrapper.c new file mode 100644 index 00000000..d974dd09 --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/ARM9.TWL/src/sd_log_wrapper.c @@ -0,0 +1,179 @@ + +#include +#include +#include "sd_log_wrapper.h" + +#include "sd_log.c" + +/* Function Prototype */ +static void OS_FPutStringSD(int console, const char *str); +static void SDLOGi_WriteThreadEx(void* arg); + +/* Static */ +static void (*HookedFPutString)(int console, const char *string); + +void TwlStartUp(void) +{ + OS_InitPrintServer(); // Should be called before PXI_Init() +} + +/*---------------------------------------------------------------------------* + Name: SDLOG_Init + + Description: Initialize + + Arguments: None + + Returns: ファイルの作成に失敗した場合は FALSE を返す + *---------------------------------------------------------------------------*/ +BOOL SDLOG_InitEx(const char* path, const char* filename, char* buffer, u16 bufferSize, u16 partitionSize, SDLOGWriteType writeType) +{ + if( isInitialized ) + { + return FALSE; + } + + if( !FS_IsAvailable() ) + { + FS_Init(FS_DMA_NOT_USE); + } + + OS_InitLog(); + + { + int i = 0; + FS_InitFile(&work.logInfo[i].file); + + /* ファイルシステムの初期化 */ + { + char tmpPath[256]; + + STD_TSPrintf(tmpPath, "%s/%s", path, filename); + + if( writeType == SDLOG_WRITE_TYPE_OVERWRITE ) + { + /* 上書き設定の場合はファイルを削除 */ + (void)FS_DeleteFileAuto(tmpPath); + } + + if( !FS_CreateDirectoryAuto( path, FS_PERMIT_W | FS_PERMIT_R ) ) + { + //OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) ); + } + + if( !FS_CreateFile( tmpPath, FS_PERMIT_W | FS_PERMIT_R ) ) + { + //OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) ); + } + + if(!FS_OpenFileEx(&work.logInfo[i].file, tmpPath, FS_PERMIT_R | FS_PERMIT_W)) + { + //OS_TPrintf("%s L:%04d Error(%d)\n", __FILE__, __LINE__, FS_GetArchiveResultCode(tmpPath) ); + goto file_error; + } + + if( writeType == SDLOG_WRITE_TYPE_CONTINUANCE ) + { + /* 追記設定の場合はファイル端までシーク */ + FS_SeekFileToEnd(&work.logInfo[i].file); + } + } + + /* OS_Log の諸設定 */ + work.logInfo[i].buffer = buffer; + work.logInfo[i].current = 0; + work.logInfo[i].bufferSize = bufferSize; + work.logInfo[i].partitionSize = partitionSize; + work.logInfo[i].writeType = writeType; + + OS_InitLogBuffer(&work.logInfo[i].info, buffer, partitionSize); + OS_SetLogWarningOffset(&work.logInfo[i].info, OS_LOG_WARNING_OFFSET_FULL ); + OS_SetLogAnnounceType(&work.logInfo[i].info, OS_LOG_ANNOUNCE_IMM); + + OS_SetLogCallback(&work.logInfo[i].info, SDlogCallback, (void *)i ); + } + + /* カレントは IS_TWL_DEBBUGER と同じく出力ゼロ */ + OS_SetLogCurrentInfo(&work.logInfo[0].info); + + /* Thread */ + if( OS_IsThreadAvailable() == FALSE ) + { + /*スレッドシステムが立ち上がっていない場合は立ち上げる*/ + OS_InitThread(); + } + + OS_InitMessageQueue(&work.writeQueue, work.writeMsg, WRITE_MESSAGE_COUNT ); + OS_CreateThread(&work.writeThread, SDLOGi_WriteThreadEx, NULL, + work.writeThreadStack+SDLOG_THREAD_STACK_SIZE/sizeof(u32), SDLOG_THREAD_STACK_SIZE, 15); + OS_WakeupThreadDirect(&work.writeThread); + + HookedFPutString = OS_FPutString; + OS_FPutString = OS_FPutStringSD; + + SDLOG_Printf("------------ START ------------\n"); + + isInitialized =TRUE; + + return TRUE; + +file_error: + return FALSE; +} + + +void OS_FPutStringSD(int console, const char *str) +{ +#pragma unused (console) + OS_LockMutex( &work.logInfo[0].info.mutex ); + OS_LogFPutString( &work.logInfo[0].info, str ); + OS_UnlockMutex( &work.logInfo[0].info.mutex ); +} + + +void SDLOG_FinishEx(void) +{ + SDLOG_Finish(); + + if (OS_FPutString == OS_FPutStringSD) { + OS_FPutString = HookedFPutString; + } +} + + +static void SDLOGi_WriteThreadEx(void* arg) +{ +#pragma unused(arg) + + u32 num; + const char* buffer; + u32 dataSize; + + OSMessage msg; + + while(TRUE) + { + + (void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK); + num =(u32) msg; + (void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK); + buffer =(const char*) msg; + (void)OS_ReceiveMessage(&work.writeQueue, &msg, OS_MESSAGE_BLOCK); + dataSize =(u32) msg; + + if(FS_WriteFile(&work.logInfo[num].file, buffer, (u16)dataSize) < 0) + { + if (OS_FPutString == OS_FPutStringSD) { + OS_FPutString = HookedFPutString; + OS_TPrintf("%s L:%d SD Write Error\n",__FILE__, __LINE__); + } + } else { + if (OS_FPutString == HookedFPutString) { + OS_FPutString = OS_FPutStringSD; + } + } + + FS_FlushFile(&work.logInfo[num].file); + + } +} \ No newline at end of file diff --git a/build/tests/Launcher_sdlog/sdlog/Makefile b/build/tests/Launcher_sdlog/sdlog/Makefile new file mode 100644 index 00000000..b3a6c676 --- /dev/null +++ b/build/tests/Launcher_sdlog/sdlog/Makefile @@ -0,0 +1,24 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TWL WLAN - libraries - os +# File: Makefile +# +# Copyright 2003 - 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. +# +#---------------------------------------------------------------------------- + +TARGET_PLATFORM := TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +SUBDIRS := $(GSUBDIRS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/Makefile b/build/tests/Makefile new file mode 100644 index 00000000..f1c4722d --- /dev/null +++ b/build/tests/Makefile @@ -0,0 +1,53 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS_P = \ + CheckDSHashTable \ + FatalErrorMaker \ + RomTypeTest \ + WirelessChecker \ + CheckPreloadParameters \ + FileRecoveryTest \ + Shared2File \ + build4WLDev \ + CheckSharedFont \ + HashCheckTemplate \ + SimpleBenchmark \ + compressSharedFontLoad/compSharedFont \ + compressSharedFontLoad/testLoadSpeed \ + DisplaySystemInformation \ + Launcher_sdlog \ + TestMaker \ + yuv2rgb \ + ErrorLogTest \ + Makefile \ + WDSTest \ + FatalErrorChecker \ + WDSWrapperTest \ + + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/NotLaunchRom/Makefile b/build/tests/NotLaunchRom/Makefile new file mode 100644 index 00000000..103cac67 --- /dev/null +++ b/build/tests/NotLaunchRom/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 Makefile.2 + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/NotLaunchRom/Makefile.0 b/build/tests/NotLaunchRom/Makefile.0 new file mode 100644 index 00000000..a464e703 --- /dev/null +++ b/build/tests/NotLaunchRom/Makefile.0 @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +IS_NAND_APP = TRUE +TWL_ARCHGEN = LIMITED + +TWL_NANDAPP = TRUE + +TARGET_BIN = notLaunch_secure.tad +ROM_SPEC = secure.rsf + +TARGET_PLATFORM = TWL + +SRCS = data.c main.c + + +BINDIR = ./bin/$(TWL_BUILDTYPE) + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +MAKETAD_OPTION += -s +MAKEROM = $(TWLSDK_ROOT)/tools/bin/makerom.TWL.secure.exe +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/NotLaunchRom/Makefile.1 b/build/tests/NotLaunchRom/Makefile.1 new file mode 100644 index 00000000..d01da319 --- /dev/null +++ b/build/tests/NotLaunchRom/Makefile.1 @@ -0,0 +1,51 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +IS_NAND_APP = TRUE +TWL_ARCHGEN = LIMITED + +TWL_NANDAPP = TRUE + +TARGET_BIN = notLaunch_system.tad +ROM_SPEC = system.rsf + +TARGET_PLATFORM = TWL + +SRCS = data.c main.c + + +BINDIR = ./bin/$(TWL_BUILDTYPE) + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +MAKETAD_OPTION += -s +MAKEROM = $(call eupath,$(TWLSDK_ROOT)/tools/bin/makerom.TWL.sys.exe) +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/NotLaunchRom/Makefile.2 b/build/tests/NotLaunchRom/Makefile.2 new file mode 100644 index 00000000..b893f5e1 --- /dev/null +++ b/build/tests/NotLaunchRom/Makefile.2 @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - CheckPreloadParameters +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +FILE_IDX = 0 +IS_NAND_APP = TRUE +TWL_ARCHGEN = LIMITED +GAMECODE = 010A + +TWL_NANDAPP = TRUE +TARGET_BIN = notLaunch_user.tad + +TARGET_PLATFORM = TWL + +SRCS = data.c main.c +ROM_SPEC = user.rsf + +BINDIR = ./bin/$(TWL_BUILDTYPE) + + + +MAKEROM_FLAGS += -DLOGOCHECK_MEDIA=$(MEDIA) \ + -DLOGOCHECK_BANNERPATH=$(BANNERPATH) \ + -DLOGOCHECK_GAMECODE=$(GAMECODE) + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/NotLaunchRom/include/data.h b/build/tests/NotLaunchRom/include/data.h new file mode 100644 index 00000000..524c8fe8 --- /dev/null +++ b/build/tests/NotLaunchRom/include/data.h @@ -0,0 +1,28 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - GX - demos - UnitTours/2D_CharBg_1 + File: data.h + + Copyright 2003 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 BG_DATA_H_ +#define BG_DATA_H_ + +#define SCREEN_SIZE (32 * 24) + +/*-------------------------- Data -------------------------------*/ +#define CHAR_SIZE (16 * 128 * sizeof(int)) +extern const unsigned int d_64_256_bg_schDT[16 * 128]; +extern const unsigned int d_64_256_bg_sclDT[8 * 16]; + +#endif diff --git a/build/tests/NotLaunchRom/secure.rsf b/build/tests/NotLaunchRom/secure.rsf new file mode 100644 index 00000000..a267fce7 --- /dev/null +++ b/build/tests/NotLaunchRom/secure.rsf @@ -0,0 +1,196 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile $(LOGOCHECK_BANNERPATH) + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + Secure TRUE + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch FALSE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 011A + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 1 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 128K +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/NotLaunchRom/src/data.c b/build/tests/NotLaunchRom/src/data.c new file mode 100644 index 00000000..a8c960e0 --- /dev/null +++ b/build/tests/NotLaunchRom/src/data.c @@ -0,0 +1,573 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - GX - demos - UnitTours/2D_CharBg_1 + File: data.c + + Copyright 2003 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 "data.h" + +/*---------------------- Palette Data ---------------------------*/ +const unsigned int d_64_256_bg_sclDT[8 * 16] = { + 0x628a7ffe, 0x6f0d6acb, 0x6aec6f2f, 0x77757352, // 0000h + 0x51e6460d, 0x66f05a27, 0x41845a8f, 0x49c53943, + 0x41c73567, 0x4e2c5668, 0x62ad41cb, 0x566c2924, // 0010h + 0x5eb1524f, 0x45e93566, 0x1ca16f55, 0x24e26b13, + 0x31442d02, 0x10607798, 0x7bba39aa, 0x7bdc779b, // 0020h + 0x66c90820, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0030h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0040h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0050h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0070h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0080h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0090h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00c0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00d0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00e0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00f0h + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + +/*---------------------- Character Data -------------------------*/ +const unsigned int d_64_256_bg_schDT[16 * 128] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0001h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x0f000000, + 0x00000000, 0x090d0000, 0x00000000, 0x0f0f0d0f, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0002h + 0x00000000, 0x01010000, 0x09000000, 0x0201010a, + 0x0f0e0d00, 0x0101010a, 0x090f0f0f, 0x1101010a, + 0x0a090f09, 0x11010101, 0x010a090f, 0x11010109, + 0x00000000, 0x00000000, 0x02010000, 0x04030302, // 0003h + 0x05020201, 0x04040403, 0x03050101, 0x06040404, + 0x04121110, 0x06060604, 0x17111016, 0x0b070603, + 0x1b111a1a, 0x0815171b, 0x17131b1b, 0x08080817, + 0x00000000, 0x00000000, 0x04030304, 0x00000304, // 0004h + 0x06070706, 0x06070706, 0x07060b04, 0x07070707, + 0x06151413, 0x06070b06, 0x0c080808, 0x18181318, + 0x0c180808, 0x18180c18, 0x0c18080c, 0x0c0c0c18, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0005h + 0x00000808, 0x00000000, 0x0b0c0b06, 0x00000006, + 0x0707060b, 0x00080b07, 0x07060c18, 0x13190b07, + 0x07060c18, 0x180b1c07, 0x0b0c1919, 0x1c060707, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0006h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x0000000c, 0x00000000, + 0x00000b06, 0x00000000, 0x0b0b0707, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0007h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0008h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0009h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 000fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0010h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x0d000000, 0x00000000, 0x23000000, + 0x00000000, 0x1d0e0000, 0x00000000, 0x0e0e0e00, + 0x1d000000, 0x0f090d0d, 0x0f0f0000, 0x0a0a0f0d, // 0011h + 0x1f0e0f00, 0x0a0a0d1d, 0x201d0e0f, 0x21090f0d, + 0x0f1d0e0f, 0x16200f0f, 0x0f0e0e20, 0x201f160d, + 0x0f090f0e, 0x161f2016, 0x0d0f090d, 0x1f1f0e1f, + 0x01010a0d, 0x1b020201, 0x0101010a, 0x03030502, // 0012h + 0x0201010a, 0x04030201, 0x01010a21, 0x04040111, + 0x11112121, 0x1317021b, 0x1a1a2121, 0x1b241b16, + 0x16090a09, 0x1b101b10, 0x1a020201, 0x151b1b1b, + 0x0604171b, 0x0c180c06, 0x0606171b, 0x180b0b06, // 0013h + 0x06041313, 0x0b0c180b, 0x0c0c130b, 0x0b0c0c0c, + 0x08150b17, 0x180c1813, 0x13041314, 0x19181308, + 0x0c0c141b, 0x19181813, 0x17141b15, 0x0c181808, + 0x180c0b0b, 0x190c0c0c, 0x0c0c070b, 0x070c0c0c, // 0014h + 0x0c181e07, 0x0707190c, 0x0c0c0b1e, 0x0722071e, + 0x19180c18, 0x1c220707, 0x1e190c0b, 0x1c1c0707, + 0x1c070707, 0x25071c07, 0x07070707, 0x1c1c0722, + 0x190c0c1e, 0x07070706, 0x1919191e, 0x19191e1e, // 0015h + 0x1e19191e, 0x1919191e, 0x1c1e1e1c, 0x1e19191e, + 0x221e1e1e, 0x1e1e1e22, 0x221c1c1c, 0x1c220722, + 0x221c1c25, 0x22222225, 0x22262525, 0x25252525, + 0x0707071c, 0x0000000b, 0x071c190c, 0x00000b06, // 0016h + 0x07061919, 0x000b061c, 0x1e1e1e1e, 0x0b0b0707, + 0x071e1e1e, 0x06060707, 0x07071e1c, 0x1c07071c, + 0x1e070722, 0x1c071e19, 0x1e1c2222, 0x0707070b, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0017h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0000000c, 0x00000000, 0x00000006, 0x00000000, + 0x00000c0b, 0x00000000, 0x000c0b06, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0018h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0019h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 001fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x20200e00, 0x00000000, 0x200e0e1d, // 0020h + 0x00000000, 0x0d0e201d, 0x0e000000, 0x0e201f20, + 0x20000000, 0x0d0e0e0d, 0x20000000, 0x0f0f0d0e, + 0x1f200000, 0x0d0f0f20, 0x200e0000, 0x200d0e1d, + 0x1f0d090d, 0x0921211f, 0x2009090d, 0x0a211621, // 0021h + 0x0d09090f, 0x0a201f21, 0x0909090f, 0x090d0d0f, + 0x0f090f0f, 0x1f1a090f, 0x0a0f0f09, 0x110a0909, + 0x0a0d0d09, 0x01110a01, 0x0a210f0f, 0x0a090102, + 0x1a020502, 0x0b1b101b, 0x1a120505, 0x04131010, // 0022h + 0x11161103, 0x0404131a, 0x1111110a, 0x04060b1a, + 0x1a1b0a21, 0x0c03151b, 0x101b020a, 0x24111a10, + 0x1b120105, 0x0b171313, 0x1b110102, 0x0b131b15, + 0x0c141506, 0x19181819, 0x0c140b06, 0x07190c0b, // 0023h + 0x14140b06, 0x071c1e06, 0x08081904, 0x07070618, + 0x13142414, 0x07071813, 0x130c1414, 0x1c1e1918, + 0x0c040604, 0x0c180808, 0x14080b0b, 0x0c181808, + 0x221e1e1c, 0x221c1c1c, 0x221e191e, 0x25221c22, // 0024h + 0x221e191e, 0x25252225, 0x221e1919, 0x25221c22, + 0x1c1e1e07, 0x25221c07, 0x1e1e1c07, 0x221c1c1e, + 0x2207071e, 0x221c1c22, 0x1e19190c, 0x22221e1e, + 0x25252525, 0x25252626, 0x27272525, 0x22262627, // 0025h + 0x27272725, 0x22262727, 0x27272725, 0x22262727, + 0x27272725, 0x25252727, 0x27272525, 0x25252527, + 0x25252525, 0x25252525, 0x25252522, 0x25252525, + 0x07222222, 0x07070707, 0x22222222, 0x07070722, // 0026h + 0x22221c1c, 0x07071e07, 0x22071c1c, 0x190c0c19, + 0x1c071c22, 0x180c191e, 0x07222222, 0x180c1e1e, + 0x07070722, 0x18191c1e, 0x071c1c22, 0x191e1c07, + 0x000c0c1e, 0x00000000, 0x13131819, 0x00000000, // 0027h + 0x17180c06, 0x00000000, 0x14180b1e, 0x00000014, + 0x08130b0b, 0x00000014, 0x130c0b0b, 0x00000008, + 0x080c0b19, 0x00001308, 0x080c060b, 0x00001408, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0028h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0029h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x201d0000, 0x090f0e23, 0x201f0000, 0x090f0f20, // 0030h + 0x0d0d2000, 0x090f0f0d, 0x0d0d0e00, 0x090f0f0f, + 0x0d0d2000, 0x0f090f0d, 0x0d0e1d00, 0x0e090f0f, + 0x0e1d1d00, 0x200f0f0f, 0x1d1f2000, 0x0d0e0f0f, + 0x0f200d09, 0x02020202, 0x0f0e0d0a, 0x0201010a, // 0031h + 0x090f090a, 0x020a010a, 0x0d210d0f, 0x0502010a, + 0x1f1f231d, 0x0a0a0a20, 0x20201d23, 0x1f20161d, + 0x1f201d1d, 0x201f1d1d, 0x1f1f0e0e, 0x211d1f1f, + 0x1b111102, 0x1311241b, 0x11112112, 0x1b1b1110, // 0032h + 0x1a111b02, 0x141b1116, 0x10111103, 0x13150b13, + 0x15101a11, 0x04040404, 0x1b1a1a1f, 0x06040415, + 0x101a1a1a, 0x04040413, 0x1b112111, 0x24241b1b, + 0x14141b14, 0x190c0c13, 0x08131414, 0x18180c08, // 0033h + 0x08142414, 0x180c0b0c, 0x08131713, 0x0c0b070b, + 0x17131315, 0x0b06070b, 0x15241404, 0x080c0406, + 0x13141b0b, 0x0814130c, 0x1414241b, 0x13081314, + 0x1919190c, 0x25071e19, 0x190c1818, 0x22221e19, // 0034h + 0x19191813, 0x22221c19, 0x0c190c0c, 0x07220719, + 0x0b18180c, 0x07070706, 0x07190c18, 0x07070707, + 0x1e181813, 0x07070707, 0x180c1813, 0x07070618, + 0x25222222, 0x22252525, 0x22072222, 0x07222222, // 0035h + 0x22072222, 0x1e071e1c, 0x1c070707, 0x1e071c1e, + 0x07070707, 0x07070707, 0x07070707, 0x071e061e, + 0x07070707, 0x1c1e0b1e, 0x07070707, 0x1c1e0707, + 0x07071c07, 0x06061c07, 0x071e1e07, 0x06061c1c, // 0036h + 0x0719191e, 0x06061c06, 0x1e1e0619, 0x1c1c060b, + 0x180c0707, 0x06071c19, 0x18181e22, 0x06061c0c, + 0x18190707, 0x0606060c, 0x06060707, 0x06060604, + 0x0b06060b, 0x00001717, 0x0b0c0b0c, 0x00000403, // 0037h + 0x1914180b, 0x00130b04, 0x15170606, 0x00130c0c, + 0x0b0b0606, 0x00131b14, 0x06060606, 0x00041413, + 0x030b0606, 0x000b1413, 0x24241706, 0x000b1414, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0038h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0039h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 003fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x20200e00, 0x0f0d090f, 0x0e1d2000, 0x2021210f, // 0040h + 0x0d201d00, 0x1f0f0f0f, 0x0d0e2000, 0x0f090d0d, + 0x0d0d0e00, 0x090f0d0d, 0x0d0d0e00, 0x0f090f0f, + 0x0f0e0000, 0x1f0f0f0f, 0x20230000, 0x230e0f0f, + 0x1d0e0909, 0x11211f1d, 0x0d09090d, 0x090d200d, // 0041h + 0x0a0a0d1f, 0x020a090a, 0x0a09201f, 0x0201010a, + 0x09090d0e, 0x01020a0f, 0x0909090d, 0x020a0d0f, + 0x0a090f1d, 0x09200e0a, 0x090f0920, 0x161f210f, + 0x1b1b1a1a, 0x1b111010, 0x05151201, 0x17030117, // 0042h + 0x05030502, 0x04041701, 0x02010502, 0x04041717, + 0x05010101, 0x03151112, 0x02010102, 0x151b1112, + 0x17120a0a, 0x1b161202, 0x11111a1f, 0x12161112, + 0x1314141b, 0x08131313, 0x1314141b, 0x13140813, // 0043h + 0x24241013, 0x17241b1b, 0x13131504, 0x17241414, + 0x13130404, 0x04132413, 0x04040404, 0x04031703, + 0x04060404, 0x04040404, 0x04040604, 0x03030b04, + 0x0b060c08, 0x07070b0b, 0x0604060b, 0x0604060c, // 0044h + 0x0b040606, 0x0b0b0617, 0x0b040606, 0x0b040404, + 0x0b0b0406, 0x0b0b190b, 0x15030304, 0x0b15130b, + 0x03030304, 0x1b0b0b0b, 0x03030b0b, 0x240b0b03, + 0x071c061c, 0x06060707, 0x06060606, 0x06060606, // 0045h + 0x0606040b, 0x0c0b0404, 0x06060b0c, 0x170c0406, + 0x06040b03, 0x0404040b, 0x0b041513, 0x040b150b, + 0x0b040b1b, 0x15151503, 0x030b0414, 0x03170303, + 0x0606071c, 0x0b0b0b0b, 0x0604040b, 0x04030b0b, // 0046h + 0x0b040b15, 0x1504040b, 0x0b150b0b, 0x0b040603, + 0x0b17150b, 0x04040b04, 0x0b150b03, 0x04151503, + 0x15040404, 0x04030303, 0x15040404, 0x03121215, + 0x13241413, 0x00051b1b, 0x04131b17, 0x00151503, // 0047h + 0x040b1b17, 0x00171704, 0x13150b17, 0x00010117, + 0x10111504, 0x00010512, 0x10111504, 0x0001051b, + 0x11130504, 0x00000312, 0x13111703, 0x00000104, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0048h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0049h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 004fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x1d280000, 0x1d231d1d, 0x23280000, 0x0e231d1d, // 0050h + 0x20000000, 0x0f1d1d0e, 0x20000000, 0x090d0d0e, + 0x0e000000, 0x090f0e0d, 0x00000000, 0x0f0d200e, + 0x00000000, 0x0e0d0d0e, 0x00000000, 0x23200e00, + 0x200f0a0f, 0x0d201d1d, 0x0d0a0909, 0x011f1f20, // 0051h + 0x0a21200a, 0x0f0d0d0f, 0x0a1f0e09, 0x0f210f01, + 0x0a0a0e0d, 0x2020090a, 0x1d0d0d0d, 0x211d200e, + 0x231d1d1d, 0x0a1d231d, 0x23282323, 0x011f1f0f, + 0x1a1a1209, 0x03131111, 0x16120305, 0x121b101a, // 0052h + 0x21111209, 0x12161111, 0x1221090a, 0x1b160911, + 0x0101120f, 0x11161a01, 0x0212090a, 0x121a1101, + 0x1e180102, 0x120a1212, 0x14150202, 0x12091b16, + 0x03050303, 0x03031703, 0x0403171b, 0x15151504, // 0053h + 0x04030505, 0x17150304, 0x04030505, 0x03030304, + 0x03030502, 0x02020404, 0x03051201, 0x17050403, + 0x03051201, 0x05050303, 0x05021212, 0x02050305, + 0x15031515, 0x17171515, 0x03151b1b, 0x04040b15, // 0054h + 0x12101b17, 0x04040315, 0x1b130504, 0x03040312, + 0x03040101, 0x03030305, 0x0305171b, 0x05030303, + 0x03050502, 0x05030303, 0x03051212, 0x01050303, + 0x15050415, 0x04150517, 0x15151504, 0x04151512, // 0055h + 0x01050304, 0x04041513, 0x05150303, 0x04040305, + 0x05050503, 0x03040217, 0x05050502, 0x03030117, + 0x03011b02, 0x05030303, 0x03051112, 0x01050503, + 0x03040404, 0x17101715, 0x03040404, 0x121b1205, // 0056h + 0x05030304, 0x12020215, 0x05040403, 0x01121705, + 0x05030303, 0x01010205, 0x01050505, 0x1b05111a, + 0x1b030505, 0x12011111, 0x01121212, 0x01111205, + 0x031b1203, 0x00001205, 0x05111705, 0x00002111, // 0057h + 0x1b1b0205, 0x00000016, 0x11010502, 0x00000016, + 0x02011212, 0x00000012, 0x2912011b, 0x00000000, + 0x12120111, 0x00000000, 0x00091112, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0058h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0059h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x23281d00, 0x00000000, 0x23280000, // 0060h + 0x00000000, 0x23000000, 0x00000000, 0x23000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x1f231d23, 0x091d0f0e, 0x1f1d1d1d, 0x201d201f, // 0061h + 0x1d1d1d23, 0x20231d1d, 0x1d1d2323, 0x0e201f23, + 0x1f1d201d, 0x200f1d23, 0x1f1f2300, 0x1d0d1623, + 0x1f230000, 0x1d1d1f23, 0x1d000000, 0x1f1d1f1d, + 0x1f160a02, 0x1a16211d, 0x1f200e0a, 0x1f23231f, // 0062h + 0x1d0e0e0e, 0x1d1d1d1d, 0x1d1f1d1d, 0x1f1f1d1d, + 0x1d201d1d, 0x0d0f201f, 0x201d1d1d, 0x2902201d, + 0x1d0e2323, 0x090a0d23, 0x231d1d1f, 0x0f0a0a1d, + 0x031b1611, 0x05020503, 0x0112161f, 0x05052902, // 0063h + 0x12291a1f, 0x09010212, 0x09291220, 0x1f0d0a12, + 0x09290512, 0x0d1f110a, 0x29292929, 0x29090a01, + 0x29120a0a, 0x01292929, 0x2929090f, 0x01091229, + 0x05111f12, 0x12011205, 0x111f1105, 0x11011201, // 0064h + 0x1f1f1a09, 0x0a120511, 0x16211f1f, 0x01122911, + 0x09090a11, 0x0a290202, 0x29292929, 0x1f12091b, + 0x0d120229, 0x0d090916, 0x1d0d0a29, 0x120a0d1f, + 0x05030212, 0x01020205, 0x05030212, 0x05020205, // 0065h + 0x03050501, 0x03291b12, 0x02050505, 0x03011111, + 0x05050501, 0x29122929, 0x05022921, 0x01120105, + 0x02022909, 0x09090205, 0x02020229, 0x09120205, + 0x01091f21, 0x161f0d09, 0x12161601, 0x1f16111b, // 0066h + 0x12110504, 0x21160d01, 0x29010102, 0x12160f01, + 0x01020201, 0x021b1202, 0x12021229, 0x0005020a, + 0x12121201, 0x00002912, 0x2909110a, 0x00000029, + 0x00201101, 0x00000000, 0x00002912, 0x00000000, // 0067h + 0x00000001, 0x00000000, 0x00000029, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0068h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0069h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 006fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0070h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x200d2123, 0x00000000, 0x0d0f0000, // 0071h + 0x00000000, 0x0d000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x1d231d1d, 0x0d0d0f1f, 0x20201f20, 0x1d1f0a0d, // 0072h + 0x0909090d, 0x0e090a0a, 0x20200d00, 0x0a0a0a0e, + 0x23000000, 0x0a091d23, 0x00000000, 0x09090000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x090a090d, 0x12090d0d, 0x0e0e200f, 0x01010e20, // 0073h + 0x290d1d0d, 0x0d110d0a, 0x010e231d, 0x230d0502, + 0x1d1d200e, 0x23210a0e, 0x200e090a, 0x1d231f1d, + 0x090a0000, 0x1d1f2020, 0x00000000, 0x00000000, + 0x1f1d0d29, 0x200d201d, 0x211f2112, 0x20112120, // 0074h + 0x1621201f, 0x09161d0d, 0x1d21201f, 0x1d1d1d23, + 0x0d202121, 0x201f210d, 0x0f0d200d, 0x1f1d200f, + 0x0d201d1d, 0x00001d1d, 0x00000000, 0x00000000, + 0x2912090f, 0x0a292929, 0x121d2021, 0x090a0912, // 0075h + 0x091d210a, 0x09091112, 0x0f1d1111, 0x00090a0f, + 0x091d1d1d, 0x00000009, 0x00001d1d, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0912120a, 0x00000000, 0x00001201, 0x00000000, // 0076h + 0x0000000a, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0077h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0078h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0079h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007ah + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007bh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007ch + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007dh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 007fh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; + + +/* EOF */ diff --git a/build/tests/NotLaunchRom/src/main.c b/build/tests/NotLaunchRom/src/main.c new file mode 100644 index 00000000..32bb2741 --- /dev/null +++ b/build/tests/NotLaunchRom/src/main.c @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - GX - demos - UnitTours/2D_CharBg_1 + File: main.c + + Copyright 2003 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$ + *---------------------------------------------------------------------------*/ +//--------------------------------------------------------------------------- +// A sample that use BG #0 as text mode: +// +// This sample simply displays a sphere on the display. +// +// HOWTO: +// 1. Transfer the character data by GX_LoadBGxChar(). +// 2. Transfer the palette data by GX_LoadBGPltt(). +// 3. Transfer the screen data by GX_LoadBGxScr(). +// +// Do not forget to flush the corresponding cache if you modified the data +// before transfer. +//--------------------------------------------------------------------------- + +#ifdef SDK_TWL +#include +#else +#include +#endif +#include "DEMO.h" +#include "data.h" + +static u16 sScrnBuf[SCREEN_SIZE]; // Buffer for screen data(BG #0) + +#ifdef SDK_TWL +void TwlMain(void) +#else +void NitroMain(void) +#endif +{ + //--------------------------------------------------------------------------- + // Initialize: + // They enable IRQ interrupts, initialize VRAM, and set BG #0 for text mode. + //--------------------------------------------------------------------------- + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBG0Only(); + + //--------------------------------------------------------------------------- + // Transmitting the character data and the palette data + //--------------------------------------------------------------------------- + GX_LoadBG0Char(d_64_256_bg_schDT, 0, sizeof(d_64_256_bg_schDT)); + GX_LoadBGPltt(d_64_256_bg_sclDT, 0, sizeof(d_64_256_bg_sclDT)); + + { + int i, j; + for (i = 0; i < 8; i++) + { + for (j = 0; j < 8; j++) + { + sScrnBuf[(i * 32) + j] = (u16)((i * 0x10) + j); + } + } + } + // Store the data onto the main memory, and invalidate the cache. + DC_FlushRange(sScrnBuf, sizeof(sScrnBuf)); + /* DMA操作でIOレジスタへアクセスするのでキャッシュの Wait は不要 */ + // DC_WaitWriteBufferEmpty(); + + // DMA transfer to BG #0 screen + GX_LoadBG0Scr(sScrnBuf, 0, sizeof(sScrnBuf)); + + DEMOStartDisplay(); + + //--------------------------------------------------------------------------- + // Main Loop + //--------------------------------------------------------------------------- + while (1) + { +#ifdef SDK_AUTOTEST + GX_SetBankForLCDC(GX_VRAM_LCDC_C); + EXT_TestSetVRAMForScreenShot(GX_VRAM_LCDC_C); + EXT_TestScreenShot(100, 0xC7953680); + EXT_TestTickCounter(); +#endif //SDK_AUTOTEST + + OS_WaitVBlankIntr(); // Waiting the end of VBlank interrupt + GX_LoadBG0Scr(sScrnBuf, 0, sizeof(sScrnBuf)); + } +} + +//--------------------------------------------------------------------------- +// VBlank interrupt function: +// +// Interrupt handlers are registered on the interrupt table by OS_SetIRQFunction. +// OS_EnableIrqMask selects IRQ interrupts to enable, and +// OS_EnableIrq enables IRQ interrupts. +// Notice that you have to call 'OS_SetIrqCheckFlag' to check a VBlank interrupt. +//--------------------------------------------------------------------------- +void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} diff --git a/build/tests/NotLaunchRom/system.rsf b/build/tests/NotLaunchRom/system.rsf new file mode 100644 index 00000000..7dd8942e --- /dev/null +++ b/build/tests/NotLaunchRom/system.rsf @@ -0,0 +1,195 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile $(LOGOCHECK_BANNERPATH) + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch FALSE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 011A + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 1 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 128K +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/NotLaunchRom/user.rsf b/build/tests/NotLaunchRom/user.rsf new file mode 100644 index 00000000..85b18697 --- /dev/null +++ b/build/tests/NotLaunchRom/user.rsf @@ -0,0 +1,195 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile $(LOGOCHECK_BANNERPATH) + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType User + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(LOGOCHECK_GAMECODE) + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 1 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 128K +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/Makefile b/build/tests/RomTypeTest/ARM9/Makefile new file mode 100644 index 00000000..3ef269e2 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 Makefile.2 Makefile.3 Makefile.4 Makefile.5 \ + Makefile.6 Makefile.7 Makefile.8 Makefile.9 Makefile.a Makefile.b \ + Makefile.c Makefile.h \ + Makefile.i Makefile.j Makefile.k + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.0 b/build/tests/RomTypeTest/ARM9/Makefile.0 new file mode 100644 index 00000000..a0db88bd --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.0 @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 0 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = RT$(TARGET_NUMBER)A +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.1 b/build/tests/RomTypeTest/ARM9/Makefile.1 new file mode 100644 index 00000000..295a0190 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.1 @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 1 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = RT$(TARGET_NUMBER)A +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.2 b/build/tests/RomTypeTest/ARM9/Makefile.2 new file mode 100644 index 00000000..fdb9e52e --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.2 @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 2 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = RT$(TARGET_NUMBER)A +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.3 b/build/tests/RomTypeTest/ARM9/Makefile.3 new file mode 100644 index 00000000..dceb5ad8 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.3 @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 3 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = RT$(TARGET_NUMBER)A +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.4 b/build/tests/RomTypeTest/ARM9/Makefile.4 new file mode 100644 index 00000000..023be1e1 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.4 @@ -0,0 +1,61 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 4 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).srl +TITLEID_LO = RT$(TARGET_NUMBER)A +#TARGET_TAD = $(BINDIR)/$(TITLEID_LO).$(TWL_BUILD_DIR)$(CODEGEN_ARCH).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.5 b/build/tests/RomTypeTest/ARM9/Makefile.5 new file mode 100644 index 00000000..25957624 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.5 @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 5 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.6 b/build/tests/RomTypeTest/ARM9/Makefile.6 new file mode 100644 index 00000000..9eccec93 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.6 @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 6 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.7 b/build/tests/RomTypeTest/ARM9/Makefile.7 new file mode 100644 index 00000000..fae03c69 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.7 @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 7 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.8 b/build/tests/RomTypeTest/ARM9/Makefile.8 new file mode 100644 index 00000000..b1b44b6f --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.8 @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 8 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.9 b/build/tests/RomTypeTest/ARM9/Makefile.9 new file mode 100644 index 00000000..26a85d17 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.9 @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 9 +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.a b/build/tests/RomTypeTest/ARM9/Makefile.a new file mode 100644 index 00000000..83348305 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.a @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = a +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.b b/build/tests/RomTypeTest/ARM9/Makefile.b new file mode 100644 index 00000000..08b8224b --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.b @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = b +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.c b/build/tests/RomTypeTest/ARM9/Makefile.c new file mode 100644 index 00000000..f8bd7ad8 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.c @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = c +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.h b/build/tests/RomTypeTest/ARM9/Makefile.h new file mode 100644 index 00000000..ad5100a2 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.h @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = h +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.i b/build/tests/RomTypeTest/ARM9/Makefile.i new file mode 100644 index 00000000..a1a1cb33 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.i @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = i +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.j b/build/tests/RomTypeTest/ARM9/Makefile.j new file mode 100644 index 00000000..be75d339 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.j @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = j +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/Makefile.k b/build/tests/RomTypeTest/ARM9/Makefile.k new file mode 100644 index 00000000..caf16051 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/Makefile.k @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = k +TARGET_NAME = RomTypeTest$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = RT$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c RomTypeTest.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +MAKETAD_OPTION += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/ARM9/main0.rsf b/build/tests/RomTypeTest/ARM9/main0.rsf new file mode 100644 index 00000000..4ba1965f --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main0.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_0.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main1.rsf b/build/tests/RomTypeTest/ARM9/main1.rsf new file mode 100644 index 00000000..3f11e2da --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main1.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_1.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main2.rsf b/build/tests/RomTypeTest/ARM9/main2.rsf new file mode 100644 index 00000000..045dddc3 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main2.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_2.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main3.rsf b/build/tests/RomTypeTest/ARM9/main3.rsf new file mode 100644 index 00000000..78932ce2 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main3.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_3.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main4.rsf b/build/tests/RomTypeTest/ARM9/main4.rsf new file mode 100644 index 00000000..68adda4e --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main4.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_4.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + #Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main5.rsf b/build/tests/RomTypeTest/ARM9/main5.rsf new file mode 100644 index 00000000..95188af0 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main5.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_5.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main6.rsf b/build/tests/RomTypeTest/ARM9/main6.rsf new file mode 100644 index 00000000..b8155275 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main6.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_6.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main7.rsf b/build/tests/RomTypeTest/ARM9/main7.rsf new file mode 100644 index 00000000..bfc391a5 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main7.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_7.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main8.rsf b/build/tests/RomTypeTest/ARM9/main8.rsf new file mode 100644 index 00000000..7ee473d5 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main8.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_8.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/main9.rsf b/build/tests/RomTypeTest/ARM9/main9.rsf new file mode 100644 index 00000000..9cdf6617 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/main9.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_9.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/maina.rsf b/build/tests/RomTypeTest/ARM9/maina.rsf new file mode 100644 index 00000000..b575ba4e --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/maina.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_a.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/mainb.rsf b/build/tests/RomTypeTest/ARM9/mainb.rsf new file mode 100644 index 00000000..85a3c914 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/mainb.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_b.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/mainc.rsf b/build/tests/RomTypeTest/ARM9/mainc.rsf new file mode 100644 index 00000000..ac929d83 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/mainc.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_c.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/mainh.rsf b/build/tests/RomTypeTest/ARM9/mainh.rsf new file mode 100644 index 00000000..02d4c355 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/mainh.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_h.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/maini.rsf b/build/tests/RomTypeTest/ARM9/maini.rsf new file mode 100644 index 00000000..28e76872 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/maini.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_i.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess TRUE + SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/mainj.rsf b/build/tests/RomTypeTest/ARM9/mainj.rsf new file mode 100644 index 00000000..084716a8 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/mainj.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_j.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/maink.rsf b/build/tests/RomTypeTest/ARM9/maink.rsf new file mode 100644 index 00000000..c53b6cd6 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/maink.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_k.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + #AppType USER + AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/RomTypeTest/ARM9/src/RomTypeTest.c b/build/tests/RomTypeTest/ARM9/src/RomTypeTest.c new file mode 100644 index 00000000..0f77a0a7 --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/src/RomTypeTest.c @@ -0,0 +1,419 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.c + + Copyright 2007 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 "misc.h" +#include "RomTypeTest.h" + +// define data------------------------------------------ +#define RETURN_BUTTON_TOP_X 2 +#define RETURN_BUTTON_TOP_Y 21 +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) + +#define ENABLE_CONTENT 0 +#define ENABLE_SHARED2 0 + +#if (ENABLE_CONTENT == 1) +#define CTRUE TRUE +#else +#define CTRUE FALSE +#endif + +#if (ENABLE_SHARED2 == 1) +#define STRUE TRUE +#else +#define STRUE FALSE +#endif + +#define TEST_NUM 15 + +typedef enum AccessPermission { + PERMISSION_NA = 0, + PERMISSION_RO, + PERMISSION_RW, + PERMISSION_ERROR, + PERMISSION_MAX +} +AccessPermission; + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- +static AccessPermission RWExTestCore( char *path, char *testfile ); +static AccessPermission SRLTest( void ); +static AccessPermission ContentTest( void ); +static void FinalizeRWTest( FSFile *file, char* filename ); +static AccessPermission RWTestCore( char *path, char *testfile ); +static AccessPermission RWTest( char *path ); +static void TestFSPermission( void ); + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// static variable ------------------------------------- +static BOOL s_quiettest = FALSE; + +// const data ----------------------------------------- +static AccessPermission s_answer_data[TEST_NUM]; + +static const u16 *s_answer_str[PERMISSION_MAX] = +{ + L"NA", + L"RO", + L"RW", + L"×", +}; + +static const u16 *s_test_name[TEST_NUM] = +{ + L"nand:", + L"nand2:", + L"content:", + L"shared1:", + L"shared2:", + L"photo:", + L"dataPub:", + L"dataPrv:", + L"sdmc:", + L"nand:/sys", + L"nand:/import", + L"nand:/tmp", + L"nand:/", + L"nand:/", + L"nand:/" +}; + +//====================================================== +// テストプログラム +//====================================================== + +static AccessPermission RWExistTestCore( char *path, char *testfile ) +{ + char filename[256]; + int len; + char buf[5]; + FSFile file[1]; + AccessPermission result = PERMISSION_RW; + + FS_InitFile( file ); + STD_TSNPrintf( filename, 256, "%s/%s", path, testfile ); + + // RWLモードファイルオープン + if ( !FS_OpenFileEx( file, filename, FS_FILEMODE_RWL ) ) + { + // RWLモードファイルオープン失敗 + if( !s_quiettest ) OS_TPrintf("%s:RWL mode open failed.\n",filename); + FS_CloseFile( file ); + // Rモードファイルオープン + if ( !FS_OpenFileEx( file, filename, FS_FILEMODE_R ) ) + { + // Rモードファイルオープン失敗 + if( !s_quiettest ) OS_TPrintf("%s:R mode open failed.\n",filename); + return PERMISSION_NA; + } + result = PERMISSION_RO; + } + + // ファイルリード + len = FS_ReadFile( file, buf, 3 ); + if( len != 3 ) + { + // リード失敗 + if( !s_quiettest ) OS_TPrintf("%s:read failed.\n",filename); + FS_CloseFile( file ); + return PERMISSION_ERROR; + } + + // ファイルクローズ + if( !FS_CloseFile( file ) ) + { + // クローズ失敗 + if( !s_quiettest ) OS_TPrintf("%s:close failed.\n",filename); + return PERMISSION_ERROR; + } + + return result; +} + +static AccessPermission BannerTest( void ) +{ + return RWExistTestCore( "nand:", "" ); +} + +static AccessPermission SRLTest( void ) +{ + return RWExistTestCore( "nand:", "" ); +} + +static AccessPermission ContentTest( void ) +{ + return RWExistTestCore( "content:", "title.tmd" ); +} + +static AccessPermission Shared1Test( void ) +{ + return RWExistTestCore( "shared1:", "TWLCFG0.dat" ); +} + +static void FinalizeRWTest( FSFile *file, char* filename ) +{ + FS_CloseFile( file ); + FS_DeleteFile( filename ); +} + +// パス名は最後にスラッシュを入れない事 +static AccessPermission RWTestCore( char *path, char *testfile ) +{ + char filename[256]; + int len; + char buf[5]; + FSFile file[1]; + + FS_InitFile( file ); + STD_TSNPrintf( filename, 256, "%s/%s", path, testfile ); + + // ファイル残ってると嫌なので削除を先に走らせておく(テスト結果には影響せず) + FS_DeleteFile(filename); + + // ファイル作成テスト + if ( FS_CreateFile(filename, FS_PERMIT_R | FS_PERMIT_W) ) + { + // ファイルオープン + if ( !FS_OpenFileEx( file, filename, FS_FILEMODE_W ) ) + { + // ファイルオープン失敗 + if( !s_quiettest ) OS_TPrintf("%s:open failed.\n",filename); + FS_DeleteFile( filename ); + return PERMISSION_ERROR; + } + // ファイルライト + len = FS_WriteFile( file, "test", 5); + if( len != 5 ) + { + // ライト失敗 + if( !s_quiettest ) OS_TPrintf("%s:write failed.\n",filename); + FinalizeRWTest( file, filename ); + return PERMISSION_ERROR; + } + // ファイルクローズ + if( !FS_CloseFile( file ) ) + { + // クローズ失敗 + if( !s_quiettest ) OS_TPrintf("%s:close failed.\n",filename); + FinalizeRWTest( file, filename ); + return PERMISSION_ERROR; + } + + // ファイルオープン + if ( !FS_OpenFileEx( file, filename, FS_FILEMODE_R ) ) + { + // ファイルオープン失敗 + if( !s_quiettest ) OS_TPrintf("%s:open failed.\n",filename); + FS_DeleteFile( filename ); + return PERMISSION_ERROR; + } + // ファイルリード + len = FS_ReadFile( file, buf, len ); + if( len != 5 || STD_CompareString( buf, "test" ) != 0 ) + { + // リード失敗 + if( !s_quiettest ) OS_TPrintf("%s:read failed.\n",filename); + FinalizeRWTest( file, filename ); + return PERMISSION_ERROR; + } + // ファイルクローズ + if( !FS_CloseFile( file ) ) + { + // クローズ失敗 + if( !s_quiettest ) OS_TPrintf("%s:close failed.\n",filename); + FinalizeRWTest( file, filename ); + return PERMISSION_ERROR; + } + // ファイルデリート + if( !FS_DeleteFile( filename )) + { + // デリート失敗 + if( !s_quiettest ) OS_TPrintf("%s:delete failed.\n",filename); + FinalizeRWTest( file, filename ); + return PERMISSION_ERROR; + } + }else + { + // ファイル作成失敗 + FSResult fs_result = FS_GetArchiveResultCode( filename ); + if( !s_quiettest ) OS_TPrintf("%s:cleate failed.\n",filename); + OS_TPrintf( "FS_GetArchiveResultCode(%s) : %d\n", filename, fs_result ); + if( FS_RESULT_ERROR == fs_result ) + { + // ファイル作成にNO_ENTRY=存在しないディレクトリの下にファイルを作ろうとしたかマウントされていない + // どちらにせよアクセスできないし、ディレクトリの存在を確認する事もできないので、パーミッションNAとして扱う + return PERMISSION_NA; + }else if( FS_RESULT_PERMISSION_DENIED == fs_result ) + { + // PERMISSION_DENIEDを貰った場合、ROでない事を確認する必要がある + if ( !FS_OpenFileEx( file, filename, FS_FILEMODE_R ) ) + { + if( FS_RESULT_PERMISSION_DENIED == FS_GetArchiveResultCode( filename ) ) + { + // 架空のファイルをRモードで読み込もうとした結果もDENIEDならパーミッションNA + return PERMISSION_NA; + } + } + return PERMISSION_ERROR; + } + // あとはERROR扱い + return PERMISSION_ERROR; + } + + return PERMISSION_RW; +} + +static AccessPermission RWTest( char *path ) +{ + return RWTestCore( path, "test.txt" ); +} + +static AccessPermission TMPJumpTest( void ) +{ + return RWTestCore( "nand:", "" ); +} + +static void TestFSPermission( void ) +{ + AccessPermission result[TEST_NUM]; + BOOL test_ok = TRUE; + int l; + + result[0] = RWTest( "nand:" ); // nand: + result[1] = RWTest( "nand2:" ); // nand2: + result[2] = ContentTest(); // content: + result[3] = Shared1Test(); // shared1: + result[4] = RWTest( "shared2:" ); // shared2: + result[5] = RWTest( "photo:" ); // photo: + result[6] = RWTest( "dataPub:" ); // dataPub: + result[7] = RWTest( "dataPrv:" ); // dataPrv: + result[8] = RWTest( "sdmc:" ); // sdmc: + result[9] = RWTest( "nand:/sys" ); // nand:/sys + result[10] = RWTest( "nand:/import" ); // nand:/import + result[11] = RWTest( "nand:/tmp" ); // nand:/tmp + result[12] = SRLTest(); // nand:/ + result[13] = BannerTest(); // nand:/ + result[14] = TMPJumpTest(); // nand:/ + + for( l=0; ltitleID_Lo[1]); + PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_WHITE, test_ok ? (const u16 *)L"Test Succeeded." : (const u16 *)L"Test Failed..." ); + + for( l=0; l<15; l++ ) + { + PutStringUTF16Sub( 8*1, l * 12, TXT_COLOR_WHITE, s_test_name[l]); + PutStringUTF16Sub( 8*18 + 8, l * 12, TXT_COLOR_WHITE, s_answer_str[ s_answer_data[l] ]); + PutStringUTF16Sub( 8*18 + 8*7, l * 12, ( result[l]==s_answer_data[l] ? TXT_COLOR_CYAN : TXT_COLOR_YELLOW ), s_answer_str[ result[l] ]); + } + +} + +static void makeAnswerData( void ) +{ + ROM_Header_Short *rhs = (ROM_Header_Short *)(HW_TWL_ROM_HEADER_BUF); + + BOOL isNandApp = (rhs->titleID_Hi & TITLE_ID_HI_MEDIA_MASK) ? TRUE : FALSE; + BOOL isSecureApp = (rhs->titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK) ? TRUE : FALSE; + BOOL isNandAccessOn = (rhs->access_control.nand_access) ? TRUE : FALSE; + BOOL isSDCardAccessOn = (rhs->access_control.sd_card_access) ? TRUE : FALSE; + BOOL isEnablePublicSaveData = ( rhs->public_save_data_size != 0 ) ? TRUE : FALSE; + BOOL isEnablePrivateSaveData = ( rhs->private_save_data_size != 0 ) ? TRUE : FALSE; + + // 正しいアクセス設定情報を生成、特筆しない限りは、指定条件下でフルアクセス + s_answer_data[0] = ( ( isNandApp || isNandAccessOn ) && isSecureApp ) ? PERMISSION_RW : PERMISSION_NA; // nand: (NANDアプリ or NANDアクセスON)and SecureApp + s_answer_data[1] = ( ( isNandApp || isNandAccessOn ) && isSecureApp ) ? PERMISSION_RW : PERMISSION_NA; // nand2: (NANDアプリ or NANDアクセスON)and SecureApp + s_answer_data[2] = ( isNandApp && CTRUE ) ? PERMISSION_RO : PERMISSION_NA; // content: 現在無効。有効の場合はNANDアプリのみReadOnly + s_answer_data[3] = ( isNandApp || isNandAccessOn ) ? PERMISSION_RO : PERMISSION_NA; // shared1: (NANDアプリ or NANDアクセスON)でReadOnly + s_answer_data[4] = ( ( isNandApp || isNandAccessOn ) && STRUE ) ? PERMISSION_RW : PERMISSION_NA; // shared2: 現在無効。有効の場合は(NANDアプリ or NANDアクセスON) + s_answer_data[5] = ( isNandApp || isNandAccessOn ) ? PERMISSION_RW : PERMISSION_NA; // photo: NANDアプリ or NANDアクセスON + s_answer_data[6] = ( isNandApp && isEnablePublicSaveData ) ? PERMISSION_RW : PERMISSION_NA; // dataPub: NANDアプリ and dataPub サイズ設定あり + s_answer_data[7] = ( isNandApp && isEnablePrivateSaveData ) ? PERMISSION_RW : PERMISSION_NA; // dataPrv: NANDアプリ and dataPrv サイズ設定あり + s_answer_data[8] = isSDCardAccessOn ? PERMISSION_RW : PERMISSION_NA; // sdmc: SDアクセス可(SDカードが刺さっていないと失敗) + s_answer_data[9] = ( ( isNandApp || isNandAccessOn ) && isSecureApp ) ? PERMISSION_RW : PERMISSION_NA; // nand:/sys (NANDアプリ or NANDアクセスON)and SecureApp + s_answer_data[10] = ( ( isNandApp || isNandAccessOn ) && isSecureApp ) ? PERMISSION_RW : PERMISSION_NA; // nand:/import (NANDアプリ or NANDアクセスON)and SecureApp + s_answer_data[11] = ( ( isNandApp || isNandAccessOn ) && isSecureApp ) ? PERMISSION_RW : PERMISSION_NA; // nand:/tmp (NANDアプリ or NANDアクセスON)and SecureApp + s_answer_data[12] = isNandApp ? ( isSecureApp ? PERMISSION_RW : PERMISSION_RO ) : PERMISSION_NA; // nand:/ NANDアプリでReadOnly(Secureの場合はフルアクセス) + s_answer_data[13] = isNandApp ? PERMISSION_RW : PERMISSION_NA; // nand:/ NANDアプリ + s_answer_data[14] = ( isNandApp || isNandAccessOn ) ? PERMISSION_RW : PERMISSION_NA; // nand:/ NANDアプリ or NANDアクセスON +} + +// テストプログラムの初期化 +void RomTypeTestInit( void ) +{ + GX_DispOff(); + GXS_DispOff(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + + PrintfSJIS( 1 * 8, 9 * 8, TXT_COLOR_BLACK, "FATFSPermissionCheck %c", (char)((ROM_Header_Short *)(HW_TWL_ROM_HEADER_BUF))->titleID_Lo[1]); + PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLACK, (const u16 *)L"Start." ); + //GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); + + s_quiettest = FALSE; + + makeAnswerData(); + + TestFSPermission(); + +} + + +// テストプログラムのメインループ +void RomTypeTestMain(void) +{ + BOOL tp_cancel = FALSE; + + ReadTP(); // タッチパネル入力の取得 + + // [RETURN]ボタン押下チェック + if(tpd.disp.touch) { + tp_cancel = WithinRangeTP( RETURN_BUTTON_TOP_X * 8, RETURN_BUTTON_TOP_Y * 8 - 4, + RETURN_BUTTON_BOTTOM_X * 8, RETURN_BUTTON_BOTTOM_Y * 8 - 4, &tpd.disp ); + } + + if( ( pad.trg & PAD_BUTTON_A ) ) { + } + + if( ( pad.trg & PAD_BUTTON_X ) ) { + } + + if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { +// SYSM_RebootLauncher(); + } + + //GetAndDrawRTCData( &g_rtcDraw, FALSE ); +} + + diff --git a/build/tests/RomTypeTest/ARM9/src/RomTypeTest.h b/build/tests/RomTypeTest/ARM9/src/RomTypeTest.h new file mode 100644 index 00000000..86e4339b --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/src/RomTypeTest.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: RomTypeTest.h + + Copyright 2007 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 __ROM_TYPE_TEST_H__ +#define __ROM_TYPE_TEST_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// define data---------------------------------------------------------- + +void RomTypeTestInit( void ); +void RomTypeTestMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __ROM_TYPE_TEST_H__ diff --git a/build/tests/RomTypeTest/ARM9/src/main.c b/build/tests/RomTypeTest/ARM9/src/main.c new file mode 100644 index 00000000..72fe2c5e --- /dev/null +++ b/build/tests/RomTypeTest/ARM9/src/main.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "RomTypeTest.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + InitBG(); + RomTypeTestInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + RomTypeTestMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/RomTypeTest/Makefile b/build/tests/RomTypeTest/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/tests/RomTypeTest/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/RomTypeTest/banner/Makefile b/build/tests/RomTypeTest/banner/Makefile new file mode 100644 index 00000000..a03da7d0 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile @@ -0,0 +1,35 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 Makefile.2 Makefile.3 Makefile.4 Makefile.5 \ + Makefile.6 Makefile.7 Makefile.8 Makefile.9 Makefile.a Makefile.b \ + Makefile.c Makefile.d Makefile.e Makefile.f Makefile.g Makefile.h \ + Makefile.i Makefile.j Makefile.k + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.0 b/build/tests/RomTypeTest/banner/Makefile.0 new file mode 100644 index 00000000..97c32d52 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.0 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 0 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.1 b/build/tests/RomTypeTest/banner/Makefile.1 new file mode 100644 index 00000000..54f8cd07 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.1 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 1 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.2 b/build/tests/RomTypeTest/banner/Makefile.2 new file mode 100644 index 00000000..13eeca27 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.2 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 2 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.3 b/build/tests/RomTypeTest/banner/Makefile.3 new file mode 100644 index 00000000..5bfadf81 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.3 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 3 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.4 b/build/tests/RomTypeTest/banner/Makefile.4 new file mode 100644 index 00000000..7ea01f33 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.4 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 4 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.5 b/build/tests/RomTypeTest/banner/Makefile.5 new file mode 100644 index 00000000..4c44bd16 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.5 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 5 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.6 b/build/tests/RomTypeTest/banner/Makefile.6 new file mode 100644 index 00000000..a3cb390c --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.6 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 6 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.7 b/build/tests/RomTypeTest/banner/Makefile.7 new file mode 100644 index 00000000..c4e38d94 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.7 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 7 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.8 b/build/tests/RomTypeTest/banner/Makefile.8 new file mode 100644 index 00000000..b42bcec4 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.8 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 8 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.9 b/build/tests/RomTypeTest/banner/Makefile.9 new file mode 100644 index 00000000..5657c255 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.9 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 9 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.a b/build/tests/RomTypeTest/banner/Makefile.a new file mode 100644 index 00000000..fc320423 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.a @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = a + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.b b/build/tests/RomTypeTest/banner/Makefile.b new file mode 100644 index 00000000..77b38975 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.b @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = b + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.c b/build/tests/RomTypeTest/banner/Makefile.c new file mode 100644 index 00000000..c80098fe --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.c @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = c + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.d b/build/tests/RomTypeTest/banner/Makefile.d new file mode 100644 index 00000000..1187190a --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.d @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = d + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.e b/build/tests/RomTypeTest/banner/Makefile.e new file mode 100644 index 00000000..32024fb5 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.e @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = e + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.f b/build/tests/RomTypeTest/banner/Makefile.f new file mode 100644 index 00000000..2360a8d6 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.f @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = f + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.g b/build/tests/RomTypeTest/banner/Makefile.g new file mode 100644 index 00000000..3d947db4 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.g @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = g + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.h b/build/tests/RomTypeTest/banner/Makefile.h new file mode 100644 index 00000000..55893d65 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.h @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = h + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.i b/build/tests/RomTypeTest/banner/Makefile.i new file mode 100644 index 00000000..298a0bdb --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.i @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = i + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.j b/build/tests/RomTypeTest/banner/Makefile.j new file mode 100644 index 00000000..e8d5ea6a --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.j @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = j + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/Makefile.k b/build/tests/RomTypeTest/banner/Makefile.k new file mode 100644 index 00000000..b1cff1b6 --- /dev/null +++ b/build/tests/RomTypeTest/banner/Makefile.k @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = k + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/RomTypeTest/banner/banner_v3.bsf b/build/tests/RomTypeTest/banner/banner_v3.bsf new file mode 100644 index 00000000..d595b6d3 Binary files /dev/null and b/build/tests/RomTypeTest/banner/banner_v3.bsf differ diff --git a/build/tests/RomTypeTest/banner/icon/gameIcon.bmp b/build/tests/RomTypeTest/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5fe5ee2c Binary files /dev/null and b/build/tests/RomTypeTest/banner/icon/gameIcon.bmp differ diff --git a/build/tests/RomTypeTest/banner/icon/msk_pictchat_icon.bin b/build/tests/RomTypeTest/banner/icon/msk_pictchat_icon.bin new file mode 100644 index 00000000..5b2734aa Binary files /dev/null and b/build/tests/RomTypeTest/banner/icon/msk_pictchat_icon.bin differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_0_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_0_v3.TWL.bsf new file mode 100644 index 00000000..f91f07dd Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_0_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_1_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_1_v3.TWL.bsf new file mode 100644 index 00000000..b793ddcf Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_1_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_2_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_2_v3.TWL.bsf new file mode 100644 index 00000000..b5bcbdb4 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_2_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_3_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_3_v3.TWL.bsf new file mode 100644 index 00000000..e506e210 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_3_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_4_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_4_v3.TWL.bsf new file mode 100644 index 00000000..e2025bf5 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_4_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_5_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_5_v3.TWL.bsf new file mode 100644 index 00000000..f6cbe8a3 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_5_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_6_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_6_v3.TWL.bsf new file mode 100644 index 00000000..9886587c Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_6_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_7_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_7_v3.TWL.bsf new file mode 100644 index 00000000..27726336 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_7_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_8_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_8_v3.TWL.bsf new file mode 100644 index 00000000..8cb61ef2 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_8_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_9_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_9_v3.TWL.bsf new file mode 100644 index 00000000..3a35c6d0 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_9_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_a_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_a_v3.TWL.bsf new file mode 100644 index 00000000..e7206a8a Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_a_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_b_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_b_v3.TWL.bsf new file mode 100644 index 00000000..02983981 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_b_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_c_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_c_v3.TWL.bsf new file mode 100644 index 00000000..7475a88a Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_c_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_d_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_d_v3.TWL.bsf new file mode 100644 index 00000000..58156ac8 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_d_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_e_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_e_v3.TWL.bsf new file mode 100644 index 00000000..69ecd6ec Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_e_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_f_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_f_v3.TWL.bsf new file mode 100644 index 00000000..63a152b1 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_f_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_g_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_g_v3.TWL.bsf new file mode 100644 index 00000000..3fcb24cf Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_g_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_h_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_h_v3.TWL.bsf new file mode 100644 index 00000000..19e03afe Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_h_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_i_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_i_v3.TWL.bsf new file mode 100644 index 00000000..59f07fb2 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_i_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_j_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_j_v3.TWL.bsf new file mode 100644 index 00000000..cd034555 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_j_v3.TWL.bsf differ diff --git a/build/tests/RomTypeTest/banner/test-utf16_k_v3.TWL.bsf b/build/tests/RomTypeTest/banner/test-utf16_k_v3.TWL.bsf new file mode 100644 index 00000000..88b33805 Binary files /dev/null and b/build/tests/RomTypeTest/banner/test-utf16_k_v3.TWL.bsf differ diff --git a/build/tests/Shared2File/Makefile b/build/tests/Shared2File/Makefile new file mode 100644 index 00000000..199b8d48 --- /dev/null +++ b/build/tests/Shared2File/Makefile @@ -0,0 +1,46 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos.TWL - nandApp - build +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED + +TITLEID_LO = 0S2A +SRCS = main.c +TARGET_BIN = shared2Test.tad + +TWL_NANDAPP = TRUE + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = main.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/Shared2File/main.rsf b/build/tests/Shared2File/main.rsf new file mode 100644 index 00000000..d58d4d04 --- /dev/null +++ b/build/tests/Shared2File/main.rsf @@ -0,0 +1,198 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType User + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode 0S2A + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + Shared2FileIndex 1 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + Shared2FileSize 128K +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/Shared2File/src/main.c b/build/tests/Shared2File/src/main.c new file mode 100644 index 00000000..f182ab80 --- /dev/null +++ b/build/tests/Shared2File/src/main.c @@ -0,0 +1,490 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - nandApp - demos - backup + File: main.c + + Copyright 2007 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 + +static void PrintBootType(); + +static void InitDEMOSystem(); +static void InitInteruptSystem(); +static void InitAllocSystem(); +static void InitFileSystem(); + +static char* LoadFile(const char* path); +static BOOL SaveFile(const char* path, void* pData, u32 size); +static u32 GetCounter(const char* root); +static void SetCounter(const char* root, u32 counter); +static void PrintBackup(const char* root); +static BOOL AddBackup(const char* root); +static void PrintAndAddBackup(const char* root); + +// OS_Printfのフック関数 +#ifndef SDK_FINALROM +void OS_Printf(const char *fmt, ...) +{ + char dst[256]; + + int ret; + va_list va; + va_start(va, fmt); + ret = OS_VSPrintf(dst, fmt, va); + va_end(va); + + OS_PutString(dst); +} +#endif + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数です。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + OS_Init(); + RTC_Init(); + InitInteruptSystem(); + InitFileSystem(); + InitAllocSystem(); + InitDEMOSystem(); + OS_Printf("*** start nandApp demo\n"); + + OS_Printf("Build:%s %s\n", __DATE__, __TIME__); + + PrintBootType(); + + // Shared2 ファイルは NAND 上に保存されます。 + // そのため使用する API は FS API となり、 + // ファイルシステムとしてアクセスすることができます。 + { + // 「shared2」は アプリ間で共有できるファイルのアーカイブ名です。 + OS_Printf("Shared2 file %04x:\n", *(u16 *)( HW_TWL_ROM_HEADER_BUF + 0x020c ) ); + PrintAndAddBackup("shared2:"); + + OS_Printf("\n"); + } + + OS_Printf("*** End of demo\n"); + + + // ランチャーに戻れるように、 + // 終了しない + for (;;) + { + // フレーム更新。 + { + DEMO_DrawFlip(); + OS_WaitVBlankIntr(); + } + } + + OS_Terminate(); +} + + +/*---------------------------------------------------------------------------* + Name: LoadFile + + Description: 内部でメモリを確保しファイルを読み込みます。 + + Arguments: path: 読み込むファイルのパス。 + + Returns: ファイルが存在するならファイルの内容が読み込まれた + 内部で確保したバッファへのポインタを返します。 + このポインタは FS_Free で解放する必要があります。 + *---------------------------------------------------------------------------*/ +static char* LoadFile(const char* path) +{ + FSFile f; + BOOL bSuccess; + char* pBuffer; + u32 fileSize; + s32 readSize; + + FS_InitFile(&f); + + bSuccess = FS_OpenFileEx(&f, path, FS_FILEMODE_R); + if( ! bSuccess ) + { + return NULL; + } + + fileSize = FS_GetFileLength(&f); + pBuffer = (char*)OS_Alloc(fileSize + 1); + SDK_POINTER_ASSERT(pBuffer); + + readSize = FS_ReadFile(&f, pBuffer, (s32)fileSize); + SDK_ASSERT( readSize == fileSize ); + + bSuccess = FS_CloseFile(&f); + SDK_ASSERT( bSuccess ); + + pBuffer[fileSize] = '\0'; + return pBuffer; +} + +/*---------------------------------------------------------------------------* + Name: SaveFile + + Description: ファイルを作成しデータを書き込みます。 + 途中のディレクトリは作成しません。 + + Arguments: path: 作成するファイルのパス。 + pData: 書き込むデータ。 + size: 書き込むデータのサイズ。 + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +static BOOL SaveFile(const char* path, void* pData, u32 size) +{ + FSFile f; + BOOL bSuccess; + FSResult fsResult; + s32 writtenSize; + + FS_InitFile(&f); + + FS_CreateFile(path, (FS_PERMIT_R|FS_PERMIT_W)); + bSuccess = FS_OpenFileEx(&f, path, FS_FILEMODE_W); + if (bSuccess == FALSE) + { + FSResult res = FS_GetArchiveResultCode(path); + OS_Printf("Failed create file:%d\n", res); + return FALSE; + } + SDK_ASSERT( bSuccess ); + + fsResult = FS_SetFileLength(&f, 0); + SDK_ASSERT( fsResult == FS_RESULT_SUCCESS ); + + writtenSize = FS_WriteFile(&f, pData, (s32)size); + SDK_ASSERT( writtenSize == size ); + + bSuccess = FS_CloseFile(&f); + SDK_ASSERT( bSuccess ); + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: GetCounter + + Description: /counter.bin に保存されているカウンタ値を読み込みます。 + + Arguments: root: counter.bin が保存されているディレクトリのパス。 + + Returns: カウンタ値を返します。 + /counter.bin が存在しない場合は 0 を返します。 + *---------------------------------------------------------------------------*/ +static u32 GetCounter(const char* root) +{ + char path[FS_FILE_NAME_MAX]; + char* pBuffer; + u32 counter = 0; + + STD_TSNPrintf(path, sizeof(path), "%s/counter.bin", root); + + pBuffer = LoadFile(path); + if( pBuffer != NULL ) + { + counter = MI_LoadLE32(pBuffer); + OS_Free(pBuffer); + } + + OS_Printf("%s counter is %d.\n", root, counter); + + return counter; +} + +/*---------------------------------------------------------------------------* + Name: SetCounter + + Description: /counter.bin にカウンタ値を保存します。 + ファイルが無い場合は作成します。 + + Arguments: root: counter.bin を保存するディレクトリのパス。 + counter: 保存するカウンタ値。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void SetCounter(const char* root, u32 counter) +{ + char path[FS_FILE_NAME_MAX]; + + STD_TSNPrintf(path, sizeof(path), "%s/counter.bin", root); + (void)SaveFile(path, &counter, sizeof(counter)); +} + +/*---------------------------------------------------------------------------* + Name: PrintBackup + + Description: 指定されたディレクトリの内容を print します。 + サブディレクトリの内容は print しません。 + + Arguments: root: 対象のディレクトリのパス。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void PrintBackup(const char* root) +{ + FSFile dir; + FSDirectoryEntryInfo entry; + BOOL bSuccess; + int numEntry = 0; + + FS_InitFile(&dir); + + bSuccess = FS_OpenDirectory(&dir, root, FS_FILEMODE_R); + if( bSuccess ) + { + while( FS_ReadDirectory(&dir, &entry) ) + { + // 自分や親を指すエントリはスキップします + if( (STD_CompareString(entry.longname, ".") == 0) + || (STD_CompareString(entry.longname, "..") == 0) ) + { + continue; + } + + if( (entry.attributes & FS_ATTRIBUTE_IS_DIRECTORY) != 0 ) + { + // ディレクトリ + OS_Printf(" d %s\n", entry.longname); + } + else + { + // ファイル + + char path[FS_FILE_NAME_MAX]; + char* text; + char* found_cr; + char* found_lf; + + // 最初の改行までの内容を表示します。 + STD_TSNPrintf(path, sizeof(path), "%s/%s", root, entry.longname); + text = LoadFile(path); + SDK_POINTER_ASSERT(text); + + found_cr = STD_SearchString(text, "\r"); + if( found_cr != NULL ) + { + *found_cr = '\0'; + } + found_lf = STD_SearchString(text, "\n"); + if( found_lf != NULL ) + { + *found_lf = '\0'; + } + + OS_Printf(" f %-6s %s\n", entry.longname, text); + OS_Free(text); + } + + numEntry++; + } + + bSuccess = FS_CloseDirectory(&dir); + SDK_ASSERT( bSuccess ); + } + + if( numEntry == 0 ) + { + OS_TPrintf(" (no entry)\n"); + } +} + +/*---------------------------------------------------------------------------* + Name: AddBackup + + Description: 対象のディレクトリにテスト用のディレクトリとファイルを + 作成します。 + + Arguments: root: 対象のディレクトリのパス。 + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +static BOOL AddBackup(const char* root) +{ + char path[FS_FILE_NAME_MAX]; + char text[256]; + u32 counter; + BOOL bSuccess; + u8 GameCode[ 5 ]; + + // ROMヘッダからGameCode取得 + { + int i; + u8 *p = (u8 *)(HW_TWL_ROM_HEADER_BUF + 0x0233 ); + MI_CpuClear8( GameCode, sizeof(GameCode) ); + for( i = 0; i < 4; i++ ) { + GameCode[ i ] = *p--; + } + } + // ファイルに書き込む内容を生成します。 + STD_TSNPrintf(text, sizeof(text), ": generated by %s", GameCode ); + + // ファイル名の生成に使用するカウンタ値を取得/更新します。 + counter = GetCounter(root); + counter++; + SetCounter(root, counter); + + // ディレクトリを作成 + STD_TSNPrintf(path, sizeof(path), "%s/dir_%d", root, counter); + bSuccess = FS_CreateDirectory(path, (FS_PERMIT_R|FS_PERMIT_W)); + if (bSuccess == FALSE) + { + FSResult res = FS_GetArchiveResultCode(path); + OS_Printf("Failed create directory:%d\n", res); + return FALSE; + } + SDK_ASSERT( bSuccess ); + + // ファイルを作成 + STD_TSNPrintf(path, sizeof(path), "%s/file_%d", root, counter); + (void)SaveFile(path, text, (u32)STD_GetStringLength(text)); + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: PrintAndAddBackup + + Description: 対象のディレクトリの内容を表示した後、テスト用の + ディレクトリとファイルを作成します。 + + Arguments: root: 対象のディレクトリのパス。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void PrintAndAddBackup(const char* root) +{ + PrintBackup(root); + (void)AddBackup(root); +} + + +/*---------------------------------------------------------------------------* + Name: PrintBootType + + Description: BootType を print します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void PrintBootType() +{ + const OSBootType btype = OS_GetBootType(); + + switch( btype ) + { + case OS_BOOTTYPE_ROM: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_ROM\n"); break; + case OS_BOOTTYPE_NAND: OS_TPrintf("OS_GetBootType = OS_BOOTTYPE_NAND\n"); break; + default: + { + OS_Warning("unknown BootType(=%d)", btype); + } + break; + } +} + +/*---------------------------------------------------------------------------* + Name: InitDEMOSystem + + Description: コンソールの画面出力用の表示設定を行います。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitDEMOSystem() +{ + // 画面表示の初期化。 + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); +} + +/*---------------------------------------------------------------------------* + Name: InitInteruptSystem + + Description: 割り込みを初期化します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitInteruptSystem() +{ + // 個別割り込みフラグを全て不許可に + (void)OS_SetIrqMask(0); + + // マスター割り込みフラグを許可に + (void)OS_EnableIrq(); + + // IRQ 割り込みを許可します + (void)OS_EnableInterrupts(); +} + +/*---------------------------------------------------------------------------* + Name: InitAllocSystem + + Description: ヒープを作成して OS_Alloc が使えるようにします。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitAllocSystem() +{ + void* newArenaLo; + OSHeapHandle hHeap; + + // メインアリーナのアロケートシステムを初期化 + newArenaLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetMainArenaLo(newArenaLo); + + // メインアリーナ上にヒープを作成 + hHeap = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); +} + +/*---------------------------------------------------------------------------* + Name: InitFileSystem + + Description: FS を初期化します。 + この関数を呼び出す前に InitInteruptSystem() が + 呼ばれている必要があります。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitFileSystem() +{ + // ARM7との通信FIFO割り込み許可 + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + + // ファイルシステム初期化 + FS_Init( FS_DMA_NOT_USE ); +} diff --git a/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lcf.template b/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lcf.template new file mode 100644 index 00000000..bdc95bb6 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lcf.template @@ -0,0 +1,1048 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.NITRO (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN.NITRO (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX.NITRO (RW) : ORIGIN = AFTER(dummy.MAIN_EX.NITRO,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + + check.ITCM (RW) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check + check.MAIN.NITRO (RW) : ORIGIN = 0x02000000, LENGTH = 0x0f80000 > main.nitro.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.TWL (RW) : ORIGIN = 0x0d000000, LENGTH = 0x0 + arena.MAIN.TWL (RW) : ORIGIN = AFTER(,,LTDMAIN,), LENGTH = 0x0 + arena.MAIN_EX.TWL (RW) : ORIGIN = AFTER(dummy.MAIN_EX.TWL,,,LTDMAIN,), LENGTH = 0x0 + + check.MAIN.TWL (RW) : ORIGIN = 0x02000000, LENGTH = 0x0f80000 > main.twl.check + + binary.MODULE_FILES (RW) : ORIGIN = 0, LENGTH = 0x0 > component.files +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + libsyscall.a (.text) + OBJECT(_start,*) + crt0.FLX.TWL.o (.text) + crt0.FLX.TWL.o (.rodata) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); # Fit to cache line + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + . = ALIGN(4); + + SDK_LTDOVERLAYTABLE_DIGEST =.; + . = . + 20; + SDK_LTDOVERLAYTABLE_DIGEST_END =.; + SDK_OVERLAYTABLE_DIGEST =.; + . = . + 20; + SDK_OVERLAYTABLE_DIGEST_END =.; + SDK_OVERLAY_DIGEST =.; + . = . + * 20; + . = . + * 20; + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x02fe0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_AUTOLOAD..SINIT_START = .; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_AUTOLOAD..SINIT_END = .; + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + . = ALIGN(32); + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + . = ALIGN(32); + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW SDK_OVERLAY_DIGEST - ADDR(.); + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_OVERLAY..DATA_END =.; + . = ALIGN(32); + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # compressed state + + + } > F + + ############################ ARENA ################################## + .dummy.MAIN_EX.NITRO: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.NITRO + + .arena.MAIN.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN.NITRO + + .arena.MAIN_EX.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + + } > arena.MAIN_EX.NITRO + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + + } > arena.DTCM + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + + } > check.ITCM + + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + . = . + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + + .check.MAIN.NITRO: + { + . = SDK_SECTION_ARENA_START; + + } > check.MAIN.NITRO + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = SDK_STATIC_BSS_END; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_EDN = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02400000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDAUTOLOAD__ID =; + SDK_LTDAUTOLOAD..ID =; + SDK_LTDAUTOLOAD..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDAUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDAUTOLOAD..SINIT_START = .; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDAUTOLOAD..SINIT_END = .; + #:::::::::: text/rodata + SDK_LTDAUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_LTDAUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_LTDAUTOLOAD..DATA_END =.; + . = ALIGN(32); + SDK_LTDAUTOLOAD..END =.; + + SDK_LTDAUTOLOAD..TEXT_SIZE = SDK_LTDAUTOLOAD..TEXT_END - SDK_LTDAUTOLOAD..TEXT_START; + SDK_LTDAUTOLOAD..DATA_SIZE = SDK_LTDAUTOLOAD..DATA_END - SDK_LTDAUTOLOAD..DATA_START; + SDK_LTDAUTOLOAD..SIZE = SDK_LTDAUTOLOAD..END - SDK_LTDAUTOLOAD..START; + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDAUTOLOAD..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_LTDAUTOLOAD..BSS_END =.; + + SDK_LTDAUTOLOAD..BSS_SIZE = SDK_LTDAUTOLOAD..BSS_END - SDK_LTDAUTOLOAD..BSS_START; + + } >> + + + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + SDK_LTDOVERLAY__ID =; + SDK_LTDOVERLAY..ID =; + SDK_LTDOVERLAY..START =.; + # + # TEXT BLOCK: READ ONLY + # + SDK_LTDOVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_LTDOVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_LTDOVERLAY..SINIT_END =.; + #:::::::::: text/rodata + SDK_LTDOVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); + SDK_LTDOVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + #:::::::::: data + SDK_LTDOVERLAY..DATA_END =.; + . = ALIGN(32); + SDK_LTDOVERLAY..END =.; + + SDK_LTDOVERLAY..TEXT_SIZE = SDK_LTDOVERLAY..TEXT_END - SDK_LTDOVERLAY..TEXT_START; + SDK_LTDOVERLAY..DATA_SIZE = SDK_LTDOVERLAY..DATA_END - SDK_LTDOVERLAY..DATA_START; + SDK_LTDOVERLAY..SIZE = SDK_LTDOVERLAY..END - SDK_LTDOVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_LTDOVERLAY..BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_LTDOVERLAY..BSS_END =.; + + SDK_LTDOVERLAY..BSS_SIZE = SDK_LTDOVERLAY..BSS_END - SDK_LTDOVERLAY..BSS_START; + + } >> + + + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # compressed state + + + } > L + + ############################ ARENA ################################## + .dummy.MAIN_EX.TWL: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.TWL + + .arena.MAIN.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_ARENA_LO =.; + + } > arena.MAIN.TWL + + .arena.MAIN_EX.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_EX_ARENA_LO =.; + + } > arena.MAIN_EX.TWL + + .check.MAIN.TWL: + { + . = SDK_LTDMAIN_ARENA_LO; + + } > check.MAIN.TWL + + ############################ OTHERS ################################# + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + + } > binary.MODULE_FILES + +} diff --git a/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lsf b/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lsf new file mode 100644 index 00000000..b4de7a96 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/ARM9-TS.lsf @@ -0,0 +1,53 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-BB.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x02680200 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) +} + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/tests/SimpleBenchmark/ARM9/Makefile b/build/tests/SimpleBenchmark/ARM9/Makefile new file mode 100644 index 00000000..4144a38b --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/commondefs + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/tests/RelocateChecker/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/SimpleBenchmark/ARM9/Makefile.0 b/build/tests/SimpleBenchmark/ARM9/Makefile.0 new file mode 100644 index 00000000..fcfff216 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/Makefile.0 @@ -0,0 +1,77 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +# コンポーネント選択 ( jackal ) + +export DEFAULT_COMP_ARM7 = jackal + +COMPONENT_DIR = $(TWL_IPL_RED_ROOT)/build/components/$(DEFAULT_COMP_ARM7).TWL +WRAM_MAP_FILE = $(COMPONENT_DIR)/wram_regs/wram_regs.rbin + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 0 +TARGET_NAME = SimpleBenchmark$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TARGET_BIN = $(TARGET_NAME).tad +LCFILE_SPEC = ARM9-TS.lsf +LCFILE_TEMPLATE = ARM9-TS.lcf.template + +TITLEID_LO = SB$(TARGET_NUMBER)A + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c SimpleBenchmark.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LLIBRARIES = libhotsw$(TWL_LIBSUFFIX).a + +LINCLUDES = $(MISC_DIR)/include + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) +ADDRESS_DTCM = 0x0e000000 + +MAKEROM_FLAGS += -DWRAM_MAP_FILE='$(WRAM_MAP_FILE)' +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/SimpleBenchmark/ARM9/Makefile.1 b/build/tests/SimpleBenchmark/ARM9/Makefile.1 new file mode 100644 index 00000000..c9ab05b9 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/Makefile.1 @@ -0,0 +1,64 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - simpleShoot-1 +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- + +TWL_NANDAPP = TRUE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +TARGET_NUMBER = 1 +TARGET_NAME = SimpleBenchmark$(TARGET_NUMBER) +BINDIR = ./bin/$(TWL_BUILDTYPE)/$(TARGET_NAME) +TITLEID_LO = SB$(TARGET_NUMBER)A +TARGET_BIN = $(TARGET_NAME).tad + +ROM_SPEC = main$(TARGET_NUMBER).rsf + +MISC_DIR = ../../../systemMenu_RED/misc + +SRCS = main.c SimpleBenchmark.c \ + $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c + +LINCLUDES = $(MISC_DIR)/include + +LLIBRARIES = libhotsw$(TWL_LIBSUFFIX).a + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' +#MAKETAD_FLAGS += -s + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = $(TARGET_TAD) + +#---------------------------------------------------------------------------- + +do-build : $(TARGETS) + + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- + +#===== End of Makefile ===== diff --git a/build/tests/SimpleBenchmark/ARM9/main0.rsf b/build/tests/SimpleBenchmark/ARM9/main0.rsf new file mode 100644 index 00000000..7b576398 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/main0.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_0.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMappingDirect $(WRAM_MAP_FILE) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + #NANDAccess FALSE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/SimpleBenchmark/ARM9/main1.rsf b/build/tests/SimpleBenchmark/ARM9/main1.rsf new file mode 100644 index 00000000..8045315d --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/main1.rsf @@ -0,0 +1,204 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner_1.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + #SDCardAccess FALSE + + # + # NandAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + #AppType SYSTEM + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + #Media GameCard + Media NAND + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure TRUE + Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot ../../../systemMenu_RED/data + Root /data + File NTR_IPL_font_m.NFTR +} diff --git a/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.c b/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.c new file mode 100644 index 00000000..95ad3985 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.c @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: DS_Chat.c + + Copyright 2007 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 "misc.h" +#include "SimpleBenchmark.h" + +// define data------------------------------------------ +#define RETURN_BUTTON_TOP_X 2 +#define RETURN_BUTTON_TOP_Y 21 +#define RETURN_BUTTON_BOTTOM_X ( RETURN_BUTTON_TOP_X + 8 ) +#define RETURN_BUTTON_BOTTOM_Y ( RETURN_BUTTON_TOP_Y + 2 ) + +// extern data------------------------------------------ + +// function's prototype declaration--------------------- + +// global variable ------------------------------------- +RTCDrawProperty g_rtcDraw = { + TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y +}; + +// テストプログラムの初期化 +void SimpleBenchmarkInit( void ) +{ + OS_InitTick(); + + + if( (u32)OS_GetTitleId() == 0x53423041 ) //SB0A + { + HOTSW_Init(); + } + + GX_DispOff(); + GXS_DispOff(); + + GetAndDrawRTCData( &g_rtcDraw, TRUE ); + + GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); + GX_DispOn(); + GXS_DispOn(); +} + + +// テストプログラムのメインループ +void SimpleBenchmarkMain(void) +{ + BOOL tp_cancel = FALSE; + OSTick ot; + static u64 tm = 0; + + ReadTP(); // タッチパネル入力の取得 + + // [RETURN]ボタン押下チェック + if(tpd.disp.touch) { + tp_cancel = WithinRangeTP( RETURN_BUTTON_TOP_X * 8, RETURN_BUTTON_TOP_Y * 8 - 4, + RETURN_BUTTON_BOTTOM_X * 8, RETURN_BUTTON_BOTTOM_Y * 8 - 4, &tpd.disp ); + } + + + ot = OS_GetTick(); + NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE ); + PrintfSJIS( 0 * 8, 0 * 8, TXT_COLOR_RED, "%d\n",tm); + PutStringUTF16( 1 * 8, 2 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 3 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 4 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 5 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 6 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 7 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 8 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 9 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 10 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 11 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 12 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 13 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 14 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 15 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 16 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 17 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 18 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 19 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 20 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 21 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + PutStringUTF16( 1 * 8, 22 * 8, TXT_COLOR_BLUE, (const u16 *)L"SimpleBenchmarkTestSimpleBenchmarkTest"); + ot = OS_GetTick()-ot; + + tm = OS_TicksToMicroSeconds(ot); + + OS_TPrintf("%d\n", tm); + + if( ( pad.trg & PAD_BUTTON_A ) ) { + } + + if( ( pad.trg & PAD_BUTTON_X ) ) { + } + + if( ( pad.trg & PAD_BUTTON_B ) || tp_cancel ) { +// SYSM_RebootLauncher(); + } + + GetAndDrawRTCData( &g_rtcDraw, FALSE ); +} + + diff --git a/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.h b/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.h new file mode 100644 index 00000000..c62094e6 --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/src/SimpleBenchmark.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: RomTypeTest.h + + Copyright 2007 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 __SIMPLE_BENCHMARK_H__ +#define __SIMPLE_BENCHMARK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// define data---------------------------------------------------------- + +void SimpleBenchmarkInit( void ); +void SimpleBenchmarkMain( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __SIMPLE_BENCHMARK_H__ diff --git a/build/tests/SimpleBenchmark/ARM9/src/main.c b/build/tests/SimpleBenchmark/ARM9/src/main.c new file mode 100644 index 00000000..7bac66bc --- /dev/null +++ b/build/tests/SimpleBenchmark/ARM9/src/main.c @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: main.c + + Copyright 2007 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 "misc.h" +#include "SimpleBenchmark.h" + +// extern data----------------------------------------------------------------- + +// define data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +static void INTR_VBlank( void ); + +// global variable------------------------------------------------------------- + +// static variable------------------------------------------------------------- + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// function's description +// ============================================================================ +void TwlMain(void) +{ + + // 初期化---------------------------------- + OS_Init(); + + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + GX_Init(); + GX_SetPower(GX_POWER_ALL); // 各ロジック パワーON + + // 割り込み許可---------------------------- + (void)OS_SetIrqFunction(OS_IE_V_BLANK, INTR_VBlank); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + + // デバイス初期化------------------------------- + TP_Init(); + (void)RTC_Init(); + + // システムの初期化------------------ + InitAllocator(); + + InitBG(); + SimpleBenchmarkInit(); + // メインループ---------------------------- + while(1){ + OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち + + ReadKeyPad(); // キー入力の取得 + ReadTP(); // TP入力の取得 + + SimpleBenchmarkMain(); + } +} + + +// ============================================================================ +// 割り込み処理 +// ============================================================================ + +// Vブランク割り込み +static void INTR_VBlank(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // Vブランク割込チェックのセット +} + diff --git a/build/tests/SimpleBenchmark/Makefile b/build/tests/SimpleBenchmark/Makefile new file mode 100644 index 00000000..66754bca --- /dev/null +++ b/build/tests/SimpleBenchmark/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = banner ARM9 + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/SimpleBenchmark/banner/Makefile b/build/tests/SimpleBenchmark/banner/Makefile new file mode 100644 index 00000000..a11fb47a --- /dev/null +++ b/build/tests/SimpleBenchmark/banner/Makefile @@ -0,0 +1,32 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +SUBDIRS = +SUBMAKES = Makefile.0 Makefile.1 + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + + +# diff --git a/build/tests/SimpleBenchmark/banner/Makefile.0 b/build/tests/SimpleBenchmark/banner/Makefile.0 new file mode 100644 index 00000000..97c32d52 --- /dev/null +++ b/build/tests/SimpleBenchmark/banner/Makefile.0 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 0 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/SimpleBenchmark/banner/Makefile.1 b/build/tests/SimpleBenchmark/banner/Makefile.1 new file mode 100644 index 00000000..54f8cd07 --- /dev/null +++ b/build/tests/SimpleBenchmark/banner/Makefile.1 @@ -0,0 +1,48 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +BNRNUM = 1 + +ICON_DIR = ./icon + +BANNER_SPEC = test-utf16_$(BNRNUM)_v3.TWL.bsf + +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe + +TARGETS = banner_$(BNRNUM).bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) + $(MAKEBANNER) -p TWL $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/SimpleBenchmark/banner/banner_v3.bsf b/build/tests/SimpleBenchmark/banner/banner_v3.bsf new file mode 100644 index 00000000..d595b6d3 Binary files /dev/null and b/build/tests/SimpleBenchmark/banner/banner_v3.bsf differ diff --git a/build/tests/SimpleBenchmark/banner/icon/gameIcon.bmp b/build/tests/SimpleBenchmark/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..5fe5ee2c Binary files /dev/null and b/build/tests/SimpleBenchmark/banner/icon/gameIcon.bmp differ diff --git a/build/tests/SimpleBenchmark/banner/icon/msk_pictchat_icon.bin b/build/tests/SimpleBenchmark/banner/icon/msk_pictchat_icon.bin new file mode 100644 index 00000000..5b2734aa Binary files /dev/null and b/build/tests/SimpleBenchmark/banner/icon/msk_pictchat_icon.bin differ diff --git a/build/tests/SimpleBenchmark/banner/test-utf16_0_v3.TWL.bsf b/build/tests/SimpleBenchmark/banner/test-utf16_0_v3.TWL.bsf new file mode 100644 index 00000000..f59e3078 Binary files /dev/null and b/build/tests/SimpleBenchmark/banner/test-utf16_0_v3.TWL.bsf differ diff --git a/build/tests/SimpleBenchmark/banner/test-utf16_1_v3.TWL.bsf b/build/tests/SimpleBenchmark/banner/test-utf16_1_v3.TWL.bsf new file mode 100644 index 00000000..462ba007 Binary files /dev/null and b/build/tests/SimpleBenchmark/banner/test-utf16_1_v3.TWL.bsf differ diff --git a/build/tests/TestComponent/ARM7.TWL/Makefile b/build/tests/TestComponent/ARM7.TWL/Makefile new file mode 100644 index 00000000..da5bad5c --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/Makefile @@ -0,0 +1,103 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TWL_PROC = ARM7 +override TWL_ARCHGEN = LIMITED +##override TWL_PLATFORM = TS +TWL_NO_STD_PCHDR = True +override TARGET_CODEGEN = ARM + +TARGET_FIRM = SYSTEMMENU + +ifndef TWLSDK_NOCRYPTO +#---------------------------------------------------------------------------- + +SRCS = crt0.SCFG_NOLOCK.c \ + main.c \ + kami_pxi.c \ + formatter.c \ + mcu_firm.c + +TARGET_NAME = armadillo + +TARGET_NEF = $(TARGET_NAME).tef +LCFILE_SPEC = $(TARGET_NAME).lsf +LCFILE_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).lcf.template +LDRES_TEMPLATE = $(ROOT)/build/components/$(TARGET_NAME).TWL/$(TARGET_NAME).response.template + +CRT0_O = crt0.SCFG_NOLOCK.o + +# スタック不足防止の為、インライン展開せずにコンパイルする +CCFLAGS_OPT = -O4 -inline off + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +MACRO_FLAGS += -DSDK_ARM7COMP_LTD -DSDK_SEA -DSDK_NOINIT + +MAKELCF_FLAGS += -DISDBG_LIBS_TWL='$(if $(ISDBG_LIBS_TWL),$(ISDBG_LIBS_TWL),libstubsistd_sp$(TWL_LIBSUFFIX).a)' \ + -DISDBG_LIBS_NITRO='libstubsisd_sp$(TWL_LIBSUFFIX).a' + +LINCLUDES += $(ROOT)/build/libraries/spi/ARM7/include \ + $(ROOT)/build/libraries/os/common/include \ + $(TWL_IPL_RED_ROOT)/include \ + ../common/include \ + $(ROOT)/build/libraries/init/common/include \ + $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/common/ARM7/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/fatfs \ + $(ROOT)/build/libraries/fatfs/ARM7.TWL/include/twl/fatfs/ARM7 + +SRCDIR += ../../../systemMenu_tools/common/ARM7/src + +LLIBRARY_DIRS += $(TWL_IPL_RED_ROOT)/lib/ARM7-TS/$(TWL_BUILD_DIR) \ + ./obj/ARM7-TS.LTD/$(TWL_BUILD_DIR) + +LLIBRARIES += libwl_sp$(TWL_LIBSUFFIX).a \ + libsdio_sp$(TWL_LIBSUFFIX).a \ + libathdrv_sp$(TWL_LIBSUFFIX).a \ + libwpa_sp$(TWL_LIBSUFFIX).a \ + libhotsw_sp$(TWL_LIBSUFFIX).a \ + libreloc_info_sp$(TWL_LIBSUFFIX).a + +LLIBRARIES += libpm_sp.SYSMENU$(TWL_LIBSUFFIX).a +GLIBRARIES := $(filter-out libpm_sp$(TWL_LIBSUFFIX).a,$(GLIBRARIES)) + +LDEPENDS_NEF = $(TWL_LIBS) $(LLIBRARIES) + +#-------------------------------- +# install target +#-------------------------------- +INSTALL_TARGETS = $(BINDIR)/$(TARGET_NAME).tef \ + $(BINDIR)/$(TARGET_NAME).TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.FLX.sbin \ + $(BINDIR)/$(TARGET_NAME).TWL.LTD.sbin \ + $(BINDIR)/$(TARGET_NAME)_defs.TWL.LTD.sbin + +INSTALL_DIR = $(SYSMENU_COMPONENTSDIR)/$(TARGET_NAME)_uji/$(TWL_BUILDTYPE) + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +endif #ifndef TWLSDK_NOCRYPTO + +#===== End of Makefile ===== diff --git a/build/tests/TestComponent/ARM7.TWL/armadillo.lsf b/build/tests/TestComponent/ARM7.TWL/armadillo.lsf new file mode 100644 index 00000000..abe99fa6 --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/armadillo.lsf @@ -0,0 +1,89 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - armadillo.TWL +# File: armadillo.lsf +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# Nitro LCF SPEC FILE +# +#-------- +Static $(TARGET_NAME) +{ + Address 0x02380000 + StackSize 1024 1024 + + Library $(CRT0_O) +} + +#-------- +Ltdautoload SCRWRAM +{ + Address 0x03740000 + + Library libsubpsyscall.a + Library libsyscall_sp.twl.a + Library $(CW_LIBS) + Library $(ISDBG_LIBS_TWL) + Library $(ISDBG_LIBS_NITRO) + + Object * (.etable) + Object $(OBJDIR)/main.o + Object $(OBJDIR)/kami_pxi.o + Object $(OBJDIR)/formatter.o + Object $(OBJDIR)/mcu_firm.o + + Library libsea_sp$(LIBSUFFIX).a + Library libcrypto_sp$(LIBSUFFIX).a + + Library libos_sp$(LIBSUFFIX).a + Library libmi_sp$(LIBSUFFIX).a + Library libstd_sp$(LIBSUFFIX).a + Library libmath_sp$(LIBSUFFIX).a + Library libpxi_sp$(LIBSUFFIX).a + Library libexi_sp$(LIBSUFFIX).a + Library libi2c_sp$(LIBSUFFIX).a + Library libsdio_sp$(LIBSUFFIX).a + Library libpad_sp$(LIBSUFFIX).a + Library libscfg_sp$(LIBSUFFIX).a + Library libmcu_sp$(LIBSUFFIX).a + Library libcdc_sp$(LIBSUFFIX).a + Library libsnd_sp$(LIBSUFFIX).a + Library libsndex_sp$(LIBSUFFIX).a + Library libspi_sp$(LIBSUFFIX).a + Library libpm_sp.SYSMENU$(LIBSUFFIX).a + Library libtp_sp$(LIBSUFFIX).a + Library libtpex_sp$(LIBSUFFIX).a + Library libmic_sp$(LIBSUFFIX).a + Library libmicex_sp$(LIBSUFFIX).a + Library libnvram_sp$(LIBSUFFIX).a + Library librtc_sp$(LIBSUFFIX).a + Library libfatfs_sp$(LIBSUFFIX).a + Library libwm_sp$(LIBSUFFIX).a + Library libnwm_sp$(LIBSUFFIX).a + Library libwvr_sp$(LIBSUFFIX).a + Library libwl_sp$(LIBSUFFIX).a + Library libwpa_sp$(LIBSUFFIX).a + Library libathdrv_sp$(LIBSUFFIX).a + Library libfs_sp$(LIBSUFFIX).a + Library libcard_sp$(LIBSUFFIX).a + Library libcamera_sp$(LIBSUFFIX).a + Library libhotsw_sp$(LIBSUFFIX).a + Library libreloc_info_sp$(LIBSUFFIX).a + + Object * (.wram) + Object * (.ltdwram) + Object * (.rsvwram) + Object * (.main) + Object * (.ltdmain) +} diff --git a/build/tests/TestComponent/ARM7.TWL/include/kami_pxi.h b/build/tests/TestComponent/ARM7.TWL/include/kami_pxi.h new file mode 100644 index 00000000..cbce8090 --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/include/kami_pxi.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_CAMERA_TEST_CAMERATEST_H_ +#define TWL_CAMERA_TEST_CAMERATEST_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void KamiPxiInit( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TEST_CAMERATEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM7.TWL/src/crt0.SCFG_NOLOCK.c b/build/tests/TestComponent/ARM7.TWL/src/crt0.SCFG_NOLOCK.c new file mode 100644 index 00000000..84ea2ede --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/src/crt0.SCFG_NOLOCK.c @@ -0,0 +1,798 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraries - init - ARM7.TWL + File: crt0.SCR.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 +#ifndef SDK_FINALROM +#include +#endif +#include "boot_sync.h" + +/*---------------------------------------------------------------------------*/ +void _start(void); +void _start_AutoloadDoneCallback(void* argv[]); + +/*---------------------------------------------------------------------------* + 外部参照 + *---------------------------------------------------------------------------*/ +/* リンカスクリプトにより定義されるシンボル参照 */ +extern void SDK_AUTOLOAD_LIST(void); +extern void SDK_AUTOLOAD_LIST_END(void); +extern void SDK_AUTOLOAD_START(void); +extern void SDK_STATIC_START(void); +extern void SDK_STATIC_BSS_START(void); +extern void SDK_STATIC_BSS_END(void); +extern void SDK_LTDAUTOLOAD_LIST(void); +extern void SDK_LTDAUTOLOAD_LIST_END(void); +extern void SDK_LTDAUTOLOAD_START(void); +extern void SDK_WRAM_ARENA_LO(void); + +/* 外部関数参照 */ +extern void OS_IrqHandler(void); +#ifndef SDK_NOINIT +extern void _fp_init(void); +extern void __call_static_initializers(void); +#endif + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 +#define SDK_TWLCODE_LE 0x6314c0de +#define SDK_TWLCODE_BE 0xdec01463 + +/* .rodata セクションに配置するロードに必要な情報 */ +void* const _start_ModuleParams[] = +{ + (void*)0, + (void*)0, + (void*)0, + (void*)SDK_STATIC_BSS_START, + (void*)SDK_STATIC_BSS_END, + (void*)0, + (void*)0, + (void*)SDK_NITROCODE_BE, + (void*)SDK_NITROCODE_LE, +}; + +void* const _start_LtdModuleParams[] = +{ + (void*)SDK_LTDAUTOLOAD_LIST, + (void*)SDK_LTDAUTOLOAD_LIST_END, + (void*)SDK_LTDAUTOLOAD_START, + (void*)0, + (void*)SDK_TWLCODE_BE, + (void*)SDK_TWLCODE_LE, +}; + +/*---------------------------------------------------------------------------* + Name: ShakeHand + Description: ARM9 の ShakeHand 関数と同期を取る。 + メインメモリでないメモリ空間で実行される必要がある。 + Arguments: r0 - ARM9 同期用変数へのポインタ。 + r1 - ARM7 同期用変数へのポインタ。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_ShakeHand[10] = +{ + 0xe1d020b0, /* ldrh r2, [r0] ; 同期変数9を共有メモリから読む */ + 0xe1d130b0, /* ldrh r3, [r1] ; 同期変数7を共有メモリから読む */ + 0xe2833001, /* @1: add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe1d0c0b0, /* ldrh r12, [r0] ; 同期変数9の現状を共有メモリから読む */ + 0xe152000c, /* cmp r2, r12 ; 同期変数9の変化を判定する */ + 0x0afffffa, /* beq @1 ; 変化していなければループ */ + 0xe2833001, /* add r3, r3, #1 ; 同期変数7 ++ */ + 0xe1c130b0, /* strh r3, [r1] ; 同期変数7を共有メモリに書く */ + 0xe12fff1e /* bx lr ; ハンドシェイク完了 */ +}; + +/*---------------------------------------------------------------------------* + Name: Stop + Description: プログラムを停止する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_Stop[2] = +{ + 0xef000006, /* @1: swi #6 ; SVC_Halt */ + 0xeafffffd /* b @1 ; ループ */ +}; + +/*---------------------------------------------------------------------------* + Name: GotoMain + Description: ARM9 に特定の状態になったことを伝えた上で、Main 関数へジャンプ + する。同時に指定バッファの 0 クリアを行う。スタック内で動作させ + ることを想定している為、スタックを一切使用しない。 + Arguments: r0 - 0 クリアするバッファの先頭アドレス。 + 4 バイトアラインされたアドレスである必要がある。 + r1 - 上位 8 bit: ARM9 に伝えるフェーズ番号。 + 下位 24 bit: 0 クリアするバッファのサイズ。 + 4 の倍数である必要がある。 + r2 - 同期用フェーズ管理変数へのポインタ。 + r3 - Main 関数のポインタ。Main 関数が Thumb コードである場合 + には、bx 命令でジャンプするため最下位ビットが 1 になって + いる必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static const u32 microcode_GotoMain[10] = +{ + 0xe59fc01c, /* @1: ldr r12, [pc, #28] ; 下位 24 bit マスクを用意 */ + 0xe111000c, /* tst r1, r12 ; クリアバッファ残サイズをチェック */ + 0xe3a0c000, /* mov r12, #0 ; クリア用変数を用意 */ + 0x1480c004, /* strne r12, [r0], #4 ; 4 バイトクリア */ + 0x12411004, /* subne r1, r1, #4 ; クリアバッファ残サイズ -= 4 */ + 0x1afffff9, /* bne @1 ; 残サイズが 0 になるまでループ */ + 0xe1a01c21, /* mov r1, r1, LSR #24 ; フェーズ管理変数の更新値を用意 */ + 0xe1c210b0, /* strh r1, [r2] ; フェーズ管理変数を更新 */ + 0xe12fff13, /* bx r3 ; Main 関数へジャンプ */ + 0x00fffffc /* 0x00fffffc */ +}; + + +/*---------------------------------------------------------------------------* + 内部関数プロトタイプ + *---------------------------------------------------------------------------*/ +static void INITi_CheckSysConfig(void); +static void INITi_DetectMainMemorySize(void); +static void INITi_Stop(void); +static void INITi_DoAutoload(void); +#ifndef SDK_NOINIT +static void INITi_ShelterStaticInitializer(u32* ptr); +static void INITi_CallStaticInitializers(void); +#endif + +static void* INITi_Copy32(void* dst, void* src, u32 size); +static void* INITi_Fill32(void* dst, u32 value, u32 size); + +/*---------------------------------------------------------------------------*/ +#include + +/*---------------------------------------------------------------------------* + Name: _start + Description: 起動ベクタ。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start(void) +{ +@000: + /* 割込み禁止 */ + mov r12, #HW_REG_BASE + str r12, [r12, #REG_IME_OFFSET] + + /* SCFG 設定を確認 */ + bl INITi_CheckSysConfig + + /* プリロードパラメータアドレスが格納されていない場合は、デフォルト値をセット */ + ldr r0, =HW_PRELOAD_PARAMETER_ADDR + ldr r1, [r0] + cmp r1, #0 + ldreq r1, =HW_PARAM_TWL_SETTINGS_DATA_DEFAULT + streq r1, [r0] + + /* ランチャーから渡された情報を退避 */ + ldr r3, =SDK_WRAM_ARENA_LO + sub r2, r3, #0x40 + ldr r1, =HW_LAUNCHER_DELIVER_PARAM_BUF +@001: + cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @001 + + + /* ハンドシェイク用マイクロコードを専用 WRAM にコピー */ + ldr r1, =microcode_ShakeHand + ldr r2, =HW_PRV_WRAM + add r3, r2, #40 // sizeof(microcode_ShakeHand) +@002: ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @002 + + /* 専用 WRAM 上のコードで ARM9 とハンドシェイク */ + ldr r0, =HW_BOOT_SHAKEHAND_9 + ldr r1, =HW_BOOT_SHAKEHAND_7 + ldr r2, =HW_PRV_WRAM + mov lr, pc + bx r2 + +@010: + /* スタックポインタ設定 */ + mov r0, #HW_PSR_SVC_MODE // SuperVisor mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_SVC_STACK_END + mov r0, #HW_PSR_IRQ_MODE // IRQ mode + msr cpsr_c, r0 + ldr sp, =HW_PRV_WRAM_IRQ_STACK_END + ldr r1, =SDK_IRQ_STACKSIZE + sub r1, sp, r1 + sub sp, sp, #4 // 4 bytes for IRQ stack check code + mov r0, #HW_PSR_SYS_MODE // System mode + msr cpsr_csfx, r0 + sub sp, r1, #4 // 4 bytes for SYS stack check code + + /* スタック領域をクリア */ + ldr r0, =SDK_SYS_STACKSIZE + sub r1, r1, r0 + ldr r2, =HW_PRV_WRAM_IRQ_STACK_END + mov r0, #0 +@011: cmp r1, r2 + strlt r0, [r1], #4 + blt @011 + + /* Autoload を実施 */ + bl INITi_DoAutoload + + /* STATIC セグメントの .bss セクションを 0 クリア */ + mov r1, #0 // r1 = clear value for STATIC bss section + ldr r3, =_start_ModuleParams + ldr r0, [r3, #12] // r0 = start address of STATIC bss section + ldr r2, [r3, #16] + subs r2, r2, r0 // r2 = size of STATIC bss section + blgt INITi_Fill32 + + /* メインメモリサイズを調査 */ + bl INITi_DetectMainMemorySize + +#ifndef SDK_FINALROM + /* デバッグ出力ウィンドウを設定 */ + ldr r1, =HW_PRINT_OUTPUT_ARM9 + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9 + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7 << 8) + strh r0, [r1] + mov r0, #OS_PRINT_OUTPUT_DEFAULT_ARM9ERR + orr r0, r0, #(OS_PRINT_OUTPUT_DEFAULT_ARM7ERR << 8) + strh r0, [r1, #2] +#endif + + /* IRQ 割込みベクタ設定 */ + ldr r1, =HW_INTR_VECTOR_BUF + ldr r0, =OS_IrqHandler + str r0, [r1] + +#ifndef SDK_NOINIT + /* c++ 用初期化 */ + bl _fp_init + bl TwlSpStartUp + bl __call_static_initializers + bl INITi_CallStaticInitializers +#endif + +@0f0: + /* Main 関数へのジャンプ用マイクロコードをスタックの底にコピー */ + ldr r1, =microcode_GotoMain + sub r2, sp, #40 + mov r3, sp +@0f1: cmp r2, r3 + ldrlt r0, [r1], #4 + strlt r0, [r2], #4 + blt @0f1 + + /* マイクロコードを経由して Main 関数へジャンプ */ + ldr r0, =SDK_STATIC_START + bic r0, r0, #0x00000003 + ldr r1, =SDK_STATIC_BSS_END + sub r1, r1, r0 + add r1, r1, #3 + bic r1, r1, #0x00000003 + bic r1, r1, #0xff000000 + mov r2, #BOOT_SYNC_PHASE_4 + mov r2, r2, LSL #24 + orr r1, r1, r2 + ldr r2, =HW_BOOT_SYNC_PHASE + ldr r3, =TwlSpMain + ldr lr, =HW_RESET_VECTOR + sub r12, sp, #40 + bx r12 + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: _start_AutoloadDoneCallback + Description: オートロード完了コールバック。 + Arguments: argv - オートロードパラメータを保持している配列。 + argv[0] = SDK_AUTOLOAD_LIST + argv[1] = SDK_AUTOLOAD_LIST_END + argv[2] = SDK_AUTOLOAD_START + argv[3] = SDK_STATIC_BSS_START + argv[4] = SDK_STATIC_BSS_END + Returns: なし。 + *---------------------------------------------------------------------------*/ +SDK_WEAK_SYMBOL asm void +_start_AutoloadDoneCallback(void* argv[]) +{ + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CheckSysConfig + Description: SCFG 関連 I/O レジスタの内容を確認する。 + A7-SCFG ブロックがアクセス有効な場合には、ローダーが行う設定処 + 理を代行した上でアクセスを無効化する。 + ARM7 専用 WRAM 内にローダーが展開している I/O レジスタ情報を確 + 認した上でメインメモリ上の共有領域にコピーする。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CheckSysConfig(void) +{ + /* A7-SCFG のアクセス可否判定 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] + ldr r2, =HW_PRV_WRAM_SYSRV + tst r0, #REG_SCFG_EXT_CFG_MASK + beq @invalid + +@valid: + /* ARM7 Secure-ROM 切り離し */ + ldr r1, =REG_A7ROM_ADDR + ldrb r0, [r1] + orr r0, r0, #REG_SCFG_A7ROM_SEC_MASK + strb r0, [r1] + + /* ARM9 Secure-ROM 切り離し */ + ldr r1, =REG_A9ROM_ADDR + ldrb r0, [r1] + orr r0, r0, #REG_SCFG_A9ROM_SEC_MASK + strb r0, [r1] + + /* NITRO 無線を有効化 */ + ldr r1, =REG_WL_ADDR + ldrh r0, [r1] + orr r0, r0, #REG_SCFG_WL_OFFB_MASK + strh r0, [r1] + + /* ROM 設定、NITRO 無線設定、ボンディングオプション情報を WRAM に展開 */ + ldr r3, =REG_OP_ADDR // SCFG-OP + ldrb r1, [r3] + and r0, r1, #(REG_SCFG_OP_OP1_MASK | REG_SCFG_OP_OP0_MASK) + ldr r3, =REG_A9ROM_ADDR // SCFG-ROM:0~7 + ldrb r1, [r3] + and r3, r1, #(REG_SCFG_A9ROM_RSEL_MASK | REG_SCFG_A9ROM_SEC_MASK) + orr r0, r0, r3, LSL #(HWi_WSYS08_ROM_ARM9RSEL_SHIFT - REG_SCFG_A9ROM_RSEL_SHIFT) + ldr r3, =REG_A7ROM_ADDR // SCFG-ROM:8~15 + ldrb r1, [r3] + and r3, r1, #(REG_SCFG_A7ROM_RSEL_MASK | REG_SCFG_A7ROM_FUSE_MASK) + orr r0, r0, r3, LSL #(HWi_WSYS08_ROM_ARM7RSEL_SHIFT - REG_SCFG_A7ROM_RSEL_SHIFT) + ldr r3, =REG_WL_ADDR // SCFG-WL + ldrb r1, [r3] + and r3, r1, #REG_SCFG_WL_OFFB_MASK + orr r0, r0, r3, LSL #(HWi_WSYS08_WL_OFFB_SHIFT - REG_SCFG_WL_OFFB_SHIFT) + strb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + + /* 各新規ブロックへクロックを供給 */ + ldr r1, =REG_CLK_ADDR + ldrh r0, [r1] + ldr r3, =REG_SCFG_CLK_SNDMCLK_MASK | REG_SCFG_CLK_WRAMHCLK_MASK | REG_SCFG_CLK_AESHCLK_MASK | REG_SCFG_CLK_SD2HCLK_MASK | REG_SCFG_CLK_SD1HCLK_MASK + orr r0, r0, r3 + strh r0, [r1] + + /* JTAG 情報を WRAM に展開 */ + ldr r3, =REG_JTAG_ADDR // SCFG-JTAG + ldrh r1, [r3] + and r0, r1, #(REG_SCFG_JTAG_CPUJE_MASK | REG_SCFG_JTAG_ARM7SEL_MASK) + and r3, r1, #REG_SCFG_JTAG_DSPJE_MASK + orr r0, r0, r3, LSR #(REG_SCFG_JTAG_DSPJE_SHIFT - HWi_WSYS09_JTAG_DSPJE_SHIFT) + strb r0, [r2, #HWi_WSYS09_WRAMOFFSET] + + /* 各拡張機能を有効化 */ + ldr r1, =REG_EXT_ADDR // SCFG_EXT + ldr r0, [r1] + ldr r3, =REG_SCFG_EXT_WRAM_MASK | REG_SCFG_EXT_GPIO_MASK | REG_SCFG_EXT_I2C_MASK | REG_SCFG_EXT_I2S_MASK | REG_SCFG_EXT_MIC_MASK | REG_SCFG_EXT_SD2_MASK | REG_SCFG_EXT_SD1_MASK | REG_SCFG_EXT_AES_MASK | REG_SCFG_EXT_DMAC_MASK + orr r0, r0, r3 + orr r0, r0, #(REG_SCFG_EXT_DSEL_MASK | REG_SCFG_EXT_INTC_MASK) + bic r0, r0, #REG_SCFG_EXT_MC_B_MASK + str r0, [r1] + + /* 各拡張機能の制御設定内容を WRAM に展開 */ + str r0, [r2, #HWi_WSYS04_WRAMOFFSET] + + /* メモリーカード I/F のスロット選択 */ + ldr r1, =REG_MC1_ADDR // SCFG_MC1 + ldr r0, [r1] + bic r0, r0, #REG_MI_MC1_SWP_MASK + str r0, [r1] + + /* WRAM-A/B/C が ARM7 に割り当たっていることを確認 */ + ldr r1, =REG_MBK1_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK2_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK3_ADDR + ldr r0, [r1] + ldr r3, =0x9d999591 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK4_ADDR + ldr r0, [r1] + ldr r3, =0x8d898581 + cmp r0, r3 + blne INITi_Stop + ldr r1, =REG_MBK5_ADDR + ldr r0, [r1] + ldr r3, =0x9d999591 + cmp r0, r3 + blne INITi_Stop + + /* WRAM-A/B/C のメモリマップを設定 */ + ldr r1, =REG_MBK6_ADDR + ldr r0, =0x080037c0 + str r0, [r1] + ldr r1, =REG_MBK7_ADDR + ldr r0, =0x07c03780 + str r0, [r1] + ldr r1, =REG_MBK8_ADDR + ldr r0, =0x07803740 + str r0, [r1] + ldr r1, =REG_MBK9_ADDR + ldr r0, =0x00ffff0f + str r0, [r1] + + /* A7-SCFG ブロックへのアクセスを無効化 */ + ldr r1, =REG_EXT_ADDR + ldr r0, [r1] +/* bic r0, r0, #REG_SCFG_EXT_CFG_MASK */ + str r0, [r1] + +@invalid: + /* ROM 設定、NITRO 無線設定内容を確認 */ + ldrb r0, [r2, #HWi_WSYS08_WRAMOFFSET] + and r0, r0, #(HWi_WSYS08_ROM_ARM7RSEL_MASK | HWi_WSYS08_ROM_ARM9RSEL_MASK | HWi_WSYS08_ROM_ARM9SEC_MASK) + cmp r0, #HWi_WSYS08_ROM_ARM9SEC_MASK + blne INITi_Stop + + /* SCFG レジスタ設定情報を共有領域にコピー */ + ldr r2, =HW_PRV_WRAM_SYSRV + ldr r3, =HW_SYS_CONF_BUF + ldr r0, [r2, #HWi_WSYS04_WRAMOFFSET] + str r0, [r3, #HWi_WSYS04_OFFSET] + ldrh r0, [r2, #HWi_WSYS08_WRAMOFFSET] + strh r0, [r3, #HWi_WSYS08_OFFSET] + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_DetectMainMemorySize + Description: メインメモリサイズを調査する。 + 調査結果は (u16*)HW_MMEMCHECER_SUB に格納される。 + 格納される値は [OS_CONSOLE_SIZE_16MB|OS_CONSOLE_SIZE_32B] + NOTE: プラットフォームが NITRO の場合は考慮していない。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +#define OSi_IMAGE_DIFFERENCE2 0xb000000 +#define OSi_DETECT_NITRO_MASK (REG_SND_SMX_CNT_E_MASK | REG_SND_SMX_CNT_FSEL_MASK) +#define OSi_DETECT_NITRO_VAL (REG_SND_SMX_CNT_E_MASK) + +#define OSi_CHECKNUM1 0x55 +#define OSi_CHECKNUM2 0xaa +#define OSi_100usWAIT 3352 // 100us = 3351.4cycles(33.514MHz) + +static asm void +INITi_DetectMainMemorySize(void) +{ + ldr r2, =HW_MMEMCHECKER_SUB + add r3, r2, #OSi_IMAGE_DIFFERENCE2 + mov r0, #OS_CONSOLE_SIZE_16MB + + /* OSi_CHECKNUM1 (0x55) 書き込みテスト */ + mov r1, #OSi_CHECKNUM1 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@1 subs r2, r2, #4 + bcs @1 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM1 + bne @check_smix + + /* OSi_CHECKNUM2 (0xaa) を 書き込みテスト */ + mov r1, #OSi_CHECKNUM2 + strb r1, [r3] + + ldr r2, =OSi_100usWAIT +@2 subs r2, r2, #4 + bcs @2 + + ldrb r1, [r3] + cmp r1, #OSi_CHECKNUM2 + moveq r0, #OS_CONSOLE_SIZE_32MB + +@check_smix: + /* SMIX レジスタを調査 */ + ldr r3, =REG_SMX_CNT_ADDR + ldrh r1, [r3] + and r1, r1, #OSi_DETECT_NITRO_MASK + cmp r1, #OSi_DETECT_NITRO_VAL + orreq r0, r0, #OS_CHIPTYPE_SMX_MASK + + /* 調査結果を格納 */ + ldr r2, =HW_MMEMCHECKER_SUB + strb r0, [r2] + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Stop + Description: プログラムを停止する。ARM7 専用 WRAM に Halt を繰り返すループ + 関数をコピーし、コピーした関数を実行する。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_Stop(void) +{ + ldr r1, =microcode_Stop + ldr r2, =HW_PRV_WRAM + add r3, r2, #8 // sizeof(microcode_Stop) +@copy_loop: + ldr r0, [r1], #4 + str r0, [r2], #4 + cmp r2, r3 + blt @copy_loop + +@stop_loop: + ldr r0, =HW_PRV_WRAM + mov lr, pc + bx r0 + b @stop_loop + /* never return */ +} + +/*---------------------------------------------------------------------------* + Name: INITi_DoAutoload + Description: リンク情報に沿って、各オートロードブロックの固定データ部の展開 + 及び変数部の 0 クリアを行う。 + NITRO 互換オートロードセグメントは存在せず、TWL 専用セグメント + のみが存在するという前提。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ + +static asm void +INITi_DoAutoload(void) +{ + stmfd sp!, {lr} + + /* オートロードを実施 */ +@000: + ldr r0, =_start_LtdModuleParams + ldr r12, [r0] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r0, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r1, [r0, #8] // r1 = SDK_LTDAUTOLOAD_START +@001: + cmp r12, r3 + bge @010 + /* 固定セクション */ + ldr r0, [r12], #4 // r0 = start address of destination range of fixed section + ldr r2, [r12], #4 // r2 = size of fixed section + bl INITi_Copy32 + stmfd sp!, {r0, r1} + /* static initializer テーブル */ + ldr r0, [r12], #4 +#ifndef SDK_NOINIT + stmfd sp!, {r3, r12} + bl INITi_ShelterStaticInitializer + ldmfd sp!, {r3, r12} +#endif + /* bss セクション */ + ldmfd sp!, {r0} // r0 = start address of destination range of bss section + mov r1, #0 // r1 = clear value for bss section + ldr r2, [r12], #4 // r2 = sizeo of bss section + bl INITi_Fill32 + ldmfd sp!, {r1} + b @001 + + /* オートロードリスト・オートロード元バッファをクリア */ +@010: + ldr r1, =_start_LtdModuleParams + ldr r12, [r1] // r12 = SDK_LTDAUTOLOAD_LIST + ldr r3, [r1, #4] // r3 = SDK_LTDAUTOLOAD_LIST_END + ldr r0, [r1, #8] // r0 = SDK_LTDAUTOLOAD_START +@011: + cmp r12, r3 + bge @0f0 + mov r1, #0 // r1 = clear value + str r1, [r12], #4 + ldr r2, [r12] // r2 = size of fixed section + str r1, [r12], #4 + str r1, [r12], #4 + str r1, [r12], #4 + bl INITi_Fill32 + b @011 + +@0f0: + /* オートロード完了コールバック呼び出し */ + ldr r0, =_start_ModuleParams + ldr r1, =_start_LtdModuleParams + ldmfd sp!, {lr} + b _start_AutoloadDoneCallback +} + +#ifndef SDK_NOINIT + +static asm void +/*---------------------------------------------------------------------------* + Name: INITi_ShelterStaticInitializer + Description: 各オートロードセグメント内の static initializer へのポインタ + テーブルを IRQ スタックの最上部に退避する。 + Arguments: ptr - セグメント内のポインタテーブルへのポインタ。 + テーブルは NULL で終端されている必要がある。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_ShelterStaticInitializer(u32* ptr) +{ + /* 引数確認 */ + cmp r0, #0 + bxeq lr + + /* 退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* 退避場所先頭から空き場所を調査 */ + ldr r2, [r1] + cmp r2, #0 + addne r1, r1, #4 + bne @001 +@002: + /* 空き場所にテーブルをコピー */ + ldr r2, [r0], #4 + str r2, [r1], #4 + cmp r2, #0 + bne @002 + + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_CallStaticInitializers + Description: 各オートロードセグメント内の static initializer を呼び出す。 + オートロード処理によって IRQ スタックの最上部に退避されている + 関数ポインタテーブルを一つずつ呼び出す。 + Arguments: なし。 + Returns: なし。 + *---------------------------------------------------------------------------*/ +static asm void +INITi_CallStaticInitializers(void) +{ + stmdb sp!, {lr} + + /* テーブル退避場所先頭アドレスを計算 */ + ldr r1, =HW_PRV_WRAM_IRQ_STACK_END + ldr r2, =SDK_IRQ_STACKSIZE + sub r1, r1, r2 + add r1, r1, #4 +@001: + /* テーブルに管理されているポインタを一つずつ呼び出し */ + ldr r0, [r1] + cmp r0, #0 + beq @002 + stmfd sp!, {r1} + mov lr, pc + bx r0 + ldmfd sp!, {r1} + /* 一旦呼び出したポインタはゼロクリア (IRQスタックを間借りしている為) */ + mov r0, #0 + str r0, [r1], #4 + b @001 +@002: + ldmia sp!, {lr} + bx lr +} +#endif + +/*---------------------------------------------------------------------------* + Name: INITi_Copy32 + Description: 32 bit 単位でコピーを行う。スタックを 36 バイト消費するが、 + レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - コピー先へのポインタ ( 4 バイトアライン )。 + r1 - コピー元へのポインタ ( 4 バイトアライン )。 + r2 - コピーする長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - コピー後のコピー先へのポインタ ( r0 + r2 )。 + r1 - コピー後のコピー元へのポインタ ( r1 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Copy32(void* dst, void* src, u32 size) +{ + stmfd sp!, {r3-r11} + + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + ldmia r1!, {r4-r11} + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + ldmneia r1!, {r4-r7} + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + ldmneia r1!, {r4-r5} + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + ldmneia r1!, {r4} + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +/*---------------------------------------------------------------------------* + Name: INITi_Fill32 + Description: 32 bit 単位でバッファ内容を指定データで埋める。スタックを 36 + バイト消費するが、レジスタ r3 - r12 は破壊しない。 + Arguments: r0 - バッファへのポインタ ( 4 バイトアライン )。 + r1 - バッファを埋める内容を 32 bit 値で指定。 + r2 - バッファを埋める長さをバイト単位で指定 ( 4 の倍数 )。 + Returns: r0 - 処理後のバッファへのポインタ ( r0 + r2 )。 + *---------------------------------------------------------------------------*/ +static asm void* +INITi_Fill32(void* dst, u32 value, u32 size) +{ + stmfd sp!, {r3-r11} + + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 + mov r8, r1 + mov r9, r1 + mov r10, r1 + mov r11, r1 + bics r3, r2, #0x0000001f + beq @next + add r3, r0, r3 +@loop: + stmia r0!, {r4-r11} + cmp r3, r0 + bgt @loop +@next: + tst r2, #0x00000010 + stmneia r0!, {r4-r7} + tst r2, #0x00000008 + stmneia r0!, {r4-r5} + tst r2, #0x00000004 + stmneia r0!, {r4} + + ldmfd sp!, {r3-r11} + bx lr +} + +#include diff --git a/build/tests/TestComponent/ARM7.TWL/src/kami_pxi.c b/build/tests/TestComponent/ARM7.TWL/src/kami_pxi.c new file mode 100644 index 00000000..cb0e5ac4 --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/src/kami_pxi.c @@ -0,0 +1,413 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" +#include "twl/cdc.h" +#include "formatter.h" +#include "mcu_firm.h" +#include +#include +#include +#include +#include + +/* sdmc.h はFATFSライブラリ内の非公開ヘッダのため、必要な定義をローカルで持つ。 */ +//#include + +typedef enum { + SDMC_PORT_CARD = 0x400, + SDMC_PORT_NAND = 0x401 +}SDMC_PORT_NO; + +#define TRUE 1 /* Don't change */ +#define FALSE 0 /* Don't change */ + +typedef unsigned char byte; /* Don't change */ +typedef unsigned short word; /* Don't change */ +typedef unsigned long dword; /* Don't change */ + +#define BOOLEAN int + +extern BOOL FATFSi_nandRtfsIo( int driveno, dword block, void* buffer, word count, BOOLEAN reading); +extern BOOL sdmcFormatNandLog( BOOL verify_flag); +extern void sdmcGetCID( SDMC_PORT_NO port, u32* dest); +extern void SPI_Lock(u32 id); +extern void SPI_Unlock(u32 id); + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define KAMITEST_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ +#define KAMITEST_THREAD_STACK_SIZE 2048 // スレッドのスタックサイズ + +#define KAMITEST_THREAD_PRIORITY 6 + +// アライメント調整してコピーする +#define KAMI_UNPACK_U8(d, s) \ + (*(d) = (u8)((((u8*)s)[0] << 0))) +#define KAMI_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define KAMI_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL result; + u32 total; + u32 current; + KamiCommand command; + u8 data[KAMITEST_PXI_DATA_SIZE_MAX]; // 後続データ格納用 + + OSMessageQueue msgQ; // スレッド同期用メッセージキュー + OSMessage msgArray[KAMITEST_MESSAGE_ARRAY_MAX]; + // メッセージを格納するバッファ + OSThread thread; // KAMI用スレッド + u64 stack[KAMITEST_THREAD_STACK_SIZE / sizeof(u64)]; + // KAMI用スレッドのスタック +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; +static u32 kamiSpiLockId; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result); +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data); +static void KamiThread(void *arg); + +void KamiPxiInit(void) +{ + if (kamiInitialized) + { + return; + } + kamiInitialized = TRUE; + kamiSpiLockId = (u32)OS_GetLockID(); + if (kamiSpiLockId == OS_LOCK_ID_ERROR) + { + OS_Panic("%s: OS_GetLockID failed.\n", __FUNCTION__); + } + + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + + OS_InitMessageQueue(&kamiWork.msgQ, kamiWork.msgArray, KAMITEST_MESSAGE_ARRAY_MAX); + OS_CreateThread(&kamiWork.thread, KamiThread, 0, + (void *)(kamiWork.stack + (KAMITEST_THREAD_STACK_SIZE / sizeof(u64))), + KAMITEST_THREAD_STACK_SIZE, KAMITEST_THREAD_PRIORITY); + OS_WakeupThreadDirect(&kamiWork.thread); +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.data[kamiWork.current++] = (u8)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 後続データ + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + if (kamiWork.current >= kamiWork.total) + { + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + case KAMI_NAND_IO: + case KAMI_MCU_WRITE_FIRM: + case KAMI_MCU_IO: + case KAMI_CODEC_IO: + case KAMI_ARM7_IO: + case KAMI_CDC_GO_DSMODE: + case KAMI_CLEAR_NAND_ERRORLOG: + case KAMI_GET_CAMERA_MODULE_TYPE: + case KAMI_GET_NAND_CID: + if (!OS_SendMessage(&kamiWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_FATAL_ERROR); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +static void KamiReturnResult(KamiCommand command, KAMIPxiResult result) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((1 << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiReturnResultEx(KamiCommand command, KAMIPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | KAMITEST_PXI_RESULT_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + (((size+1) << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((result << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + for (i = 0; i < size; i+= 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } + } +} + +static void KamiThread(void *arg) +{ +#pragma unused( arg ) + OSMessage msg; + BOOL result; + + while (TRUE) + { + (void)OS_ReceiveMessage(&kamiWork.msgQ, &msg, OS_MESSAGE_BLOCK); + switch (kamiWork.command) + { + case KAMI_EXE_FORMAT: + { + result = ExeFormat((FormatMode)kamiWork.data[0]); // Quick or Full + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_NAND_IO: + { + BOOL is_read; + u32 block; + void* buffer; + u32 count; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&block, &kamiWork.data[1]); + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[5]); + KAMI_UNPACK_U32(&count, &kamiWork.data[9]); + + result = FATFSi_nandRtfsIo( 0, block, buffer, (u16)count, is_read ); + if (result) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_TRUE); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_MCU_WRITE_FIRM: + { + void* buffer; + KAMI_UNPACK_U32((u32 *)(&buffer), &kamiWork.data[1]); + + if ( MCU_WriteFirm( buffer ) ) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_MCU_IO: + { + BOOL is_read; + u32 reg_no; + u32 write; + u32 read; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(®_no, &kamiWork.data[1]); + KAMI_UNPACK_U32(&write, &kamiWork.data[5]); + + if (is_read) + { + read = MCU_ReadRegister( (u8)reg_no ); + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u8), (u8*)&read ); + } + else + { + MCU_WriteRegister( (u8)reg_no, (u8)write ); + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + } + break; + + case KAMI_CODEC_IO: + { + BOOL is_read; + u8 page; + u8 reg_no; + u32 write; + u32 read; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U8(&page, &kamiWork.data[1]); + KAMI_UNPACK_U8(®_no, &kamiWork.data[2]); + KAMI_UNPACK_U32(&write, &kamiWork.data[5]); + + if (is_read) + { + SPI_Lock(kamiSpiLockId); // CODEC用SPI排他ロック + read = CDC_ReadSpiRegisterEx( page, reg_no ); + SPI_Unlock(kamiSpiLockId); // CODEC用SPI排他ロック + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u8), (u8*)&read ); + } + else + { + SPI_Lock(kamiSpiLockId); // CODEC用SPI排他ロック + CDC_WriteSpiRegisterEx( page, reg_no, (u8)write ); + SPI_Unlock(kamiSpiLockId); // CODEC用SPI排他ロック + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + } + break; + + case KAMI_ARM7_IO: + { + BOOL is_read; + u32 addr; + u32 write; + u32 read; + + is_read = (BOOL)kamiWork.data[0]; + KAMI_UNPACK_U32(&addr, &kamiWork.data[1]); + KAMI_UNPACK_U32(&write, &kamiWork.data[5]); + + if (is_read) + { + read = *(u32 *)addr; + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(u32), (u8*)&read ); + } + else + { + *(u32 *)addr = write; + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + } + break; + + case KAMI_CDC_GO_DSMODE: + { + CDC_Init(); // IIRなどのパラメータ初期化のため + CDC_GoDsMode(); + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + break; + + case KAMI_CLEAR_NAND_ERRORLOG: + { + if (sdmcFormatNandLog(TRUE)) + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS); + } + else + { + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_SUCCESS_FALSE); + } + } + break; + + case KAMI_GET_CAMERA_MODULE_TYPE: + { + CameraModuleTypes types; + if (CAMERAi_IsSharpModule(CAMERA_SELECT_IN)) + { + types.in = CAMERA_MODULE_TYPE_SHARP; + } + else if (CAMERAi_IsMicronModule(CAMERA_SELECT_IN)) + { + types.in = CAMERA_MODULE_TYPE_MICRON; + } + else + { + types.in = CAMERA_MODULE_TYPE_UNKNOWN; + } + if (CAMERAi_IsSharpModule(CAMERA_SELECT_OUT)) + { + types.out = CAMERA_MODULE_TYPE_SHARP; + } + else if (CAMERAi_IsMicronModule(CAMERA_SELECT_OUT)) + { + types.out = CAMERA_MODULE_TYPE_MICRON; + } + else + { + types.out = CAMERA_MODULE_TYPE_UNKNOWN; + } + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(CameraModuleTypes), (u8*)&types); + } + break; + + case KAMI_GET_NAND_CID: + { + u8 buffer[16]; + sdmcGetCID( SDMC_PORT_NAND, (u32*)buffer); + KamiReturnResultEx(kamiWork.command, KAMI_PXI_RESULT_SUCCESS, sizeof(buffer), (u8*)buffer ); + } + break; + + default: + KamiReturnResult(kamiWork.command, KAMI_PXI_RESULT_INVALID_COMMAND); + } + } +} + +#include diff --git a/build/tests/TestComponent/ARM7.TWL/src/main.c b/build/tests/TestComponent/ARM7.TWL/src/main.c new file mode 100644 index 00000000..b2a99285 --- /dev/null +++ b/build/tests/TestComponent/ARM7.TWL/src/main.c @@ -0,0 +1,654 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - components - armadillo.TWL + File: main.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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nvram_sp.h" +#include "kami_pxi.h" +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +/* 各スレッド優先度 */ +#define THREAD_PRIO_SPI 2 +#define THREAD_PRIO_MCU 4 // 暫定 +#define THREAD_PRIO_SND 6 +#define THREAD_PRIO_NWM_EVENT 7 +#define THREAD_PRIO_NWM_SDIO 8 +#define THREAD_PRIO_FATFS 8 +#define THREAD_PRIO_NWM_COMMAND 9 +#define THREAD_PRIO_NWM_WPA 10 +#define THREAD_PRIO_HOTSW 11 +#define THREAD_PRIO_AES 12 +#define THREAD_PRIO_SEA 12 +#define THREAD_PRIO_RTC 12 +#define THREAD_PRIO_SNDEX 14 +#define THREAD_PRIO_FS 15 +/* OS_THREAD_LAUNCHER_PRIORITY 16 */ + +/* ROM 内登録エリアの拡張言語コード */ +#define ROMHEADER_FOR_CHINA_BIT 0x80 +#define ROMHEADER_FOR_KOREA_BIT 0x40 + +/* 使用 DMA 番号 */ +#define DMA_NO_FATFS FATFS_DMA_4 // = 0 +#define DMA_NO_NWM 3 + +/* カードチャタリングカウンタ */ +#define CHATTERING_COUNTER 0x1988 // 100ms分 (0x1988 * 15.3us = 100000us) + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void PrintDebugInfo(void); +static OSHeapHandle InitializeAllocateSystem(void); +static void InitializeFatfs(void); +static void InitializeNwm(OSHeapHandle hh); +static void InitializeCardPower(void); +static void InitializeCdc(void); + +static void ReadUserInfo(void); +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +static BOOL IsValidConfigEx(void); +static u16 GetRomValidLanguage(void); +static s32 CheckCorrectNCDEx(NVRAMConfigEx* ncdsp); +#else +static s32 CheckCorrectNCD(NVRAMConfig* ncdsp); +#endif +static void VBlankIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlSpMain + Description: 起動ベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +void +TwlSpMain(void) +{ + OSHeapHandle heapHandle; + + /* OS 初期化 */ + OS_Init(); + PrintDebugInfo(); + + /* NVRAM からユーザー情報読み出し */ + ReadUserInfo(); + + /* ヒープ領域設定 */ + heapHandle = InitializeAllocateSystem(); + + /* ボタン入力サーチ初期化 */ + (void)PAD_InitXYButton(); + + /* 割込み許可 */ + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); +#endif + + /* 各ライブラリ初期化 */ + AES_Init(THREAD_PRIO_AES); // AES + SEA_Init(THREAD_PRIO_SEA); // SEA + FS_Init(FS_DMA_NOT_USE); // FS for CARD + FS_CreateReadServerThread(THREAD_PRIO_FS); // FS for CARD + InitializeFatfs(); // FAT-FS + InitializeNwm(heapHandle); // TWL 無線 + MCU_InitIrq(THREAD_PRIO_MCU); // マイコン + + if (OSi_IsCodecTwlMode() == TRUE) + { + InitializeCdc(); // CODEC + CAMERA_Init(); // カメラ + } + + SND_Init(THREAD_PRIO_SND); // サウンド + SNDEX_Init(THREAD_PRIO_SNDEX); // サウンド拡張 + RTC_Init(THREAD_PRIO_RTC); // RTC + WVR_Begin(heapHandle); // NITRO 無線 + SPI_Init(THREAD_PRIO_SPI); + InitializeCardPower(); // カード電源ON(検査プログラム用) + + while (TRUE) + { + OS_Halt(); + + /* ソフトウェアリセット要求は監視しない */ + /* AGB カートリッジの挿抜チェックは行わない */ + /* DS カードの挿抜チェックは行わない */ + } +} + +/*---------------------------------------------------------------------------* + Name: PrintDebugInfo + Description: ARM7 コンポーネントの情報をデバッグ出力する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +PrintDebugInfo(void) +{ + OS_TPrintf("ARM7: This component is running on TWL.\n"); + OS_TPrintf("ARM7: This component is \"armadillo.TWL\".\n"); +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + Description: メモリ割当てシステムを初期化する。 + Arguments: None. + Returns: OSHeapHandle - WRAM アリーナ上に確保されたヒープのハンドルを返す。 + *---------------------------------------------------------------------------*/ +static OSHeapHandle +InitializeAllocateSystem(void) +{ + OSHeapHandle hh; + void* subLo = (void*)OS_GetWramSubArenaLo(); + void* subHi = (void*)OS_GetWramSubArenaHi(); + void* privLo = (void*)OS_GetWramSubPrivArenaLo(); + void* privHi = (void*)OS_GetWramSubPrivArenaHi(); + + if (((u32)privLo == HW_PRV_WRAM) && ((u32)subHi == HW_PRV_WRAM) && ((u32)subLo < HW_PRV_WRAM)) + { + /* SUB アリーナを SUBPRIV アリーナに吸収 */ + OS_SetWramSubArenaHi(subLo); + OS_SetWramSubPrivArenaLo(subLo); + privLo = subLo; + } + + /* アリーナを 0 クリア */ + MI_CpuClear8(privLo, (u32)privHi - (u32)privLo); + + /* ヒープ作成初期化 */ + privLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV, privLo, privHi, 1); + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, privLo, privHi); + if (hh < 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + + /* カレントヒープに設定 */ + (void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + /* ヒープサイズの確認 */ + { + u32 heapSize; + + heapSize = (u32)OS_CheckHeap(OS_ARENA_WRAM_SUBPRIV, hh); + + if (heapSize <= 0) + { + OS_Panic("ARM7: Failed to create heap.\n"); + } + OS_TPrintf("ARM7: heap size [%d]\n", heapSize); + } + + return hh; +} + +/*---------------------------------------------------------------------------* + Name: InitializeFatfs + Description: FATFSライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeFatfs(void) +{ + // FATFSライブラリの初期化 + if(!FATFS_Init( FATFS_DMA_4, FATFS_DMA_5, THREAD_PRIO_FATFS)) + { + // do nothing + } +} + +/*---------------------------------------------------------------------------* + Name: InitializeNwm + Description: NWMライブラリを初期化する。 + Arguments: hh - 利用可能なヒープのハンドルを指定。 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeNwm(OSHeapHandle hh) +{ + NwmspInit nwmInit; + + /* [TODO] 確保しているヒープ領域が新無線一式が必要としているメモリ量以上かのチェックが必要 */ + + nwmInit.cmdPrio = THREAD_PRIO_NWM_COMMAND; + nwmInit.evtPrio = THREAD_PRIO_NWM_EVENT; + nwmInit.sdioPrio = THREAD_PRIO_NWM_SDIO; + + nwmInit.dmaNo = DMA_NO_NWM; + nwmInit.drvHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.drvHeap.handle = hh; + + nwmInit.wpaPrio = THREAD_PRIO_NWM_WPA; + nwmInit.wpaHeap.id = OS_ARENA_WRAM_SUBPRIV; + nwmInit.wpaHeap.handle = hh; + + NWMSP_Init(&nwmInit); +} + +/*---------------------------------------------------------------------------* + Name: InitializeCardPower + Description: カード電源をONする。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCardPower(void) +{ + // チャッタリングカウンタの値を設定 + reg_MI_MC1 = (u32)((reg_MI_MC1 & ~REG_MI_MC1_CC_MASK) | + (CHATTERING_COUNTER << REG_MI_MC1_CC_SHIFT)); + + // チャタリングカウンタ分待つことによりCDETが0になる + OS_SpinWait( OS_MSEC_TO_CPUCYC(200) ); + + // カードスロット1電源ON + HOTSWi_TurnCardPowerOn(1); +} + +/*---------------------------------------------------------------------------* + Name: InitializeCdc + Description: CDCライブラリを初期化する。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +static void +InitializeCdc(void) +{ + u32 spiLockId; + + spiLockId = (u32)OS_GetLockID(); + if (spiLockId == OS_LOCK_ID_ERROR) + { + OS_Warning("OS_GetLockID failed.\n"); + } + + /* CODEC 初期化 */ + SPI_Lock(spiLockId); + CDC_Init(); + SPI_Unlock(spiLockId); +} + +//#ifdef WM_PRECALC_ALLOWEDCHANNEL +//extern u16 WMSP_GetAllowedChannel(u16 bitField); +//#endif +/*---------------------------------------------------------------------------* + Name: ReadUserInfo + + Description: NVRAMからユーザー情報を読み出し、共有領域に展開する。 + ミラーリングされているバッファが両方壊れている場合は、 + 共有領域のユーザー情報格納場所をクリアする。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void ReadUserInfo(void) +{ + s32 offset; +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + NVRAMConfigEx temp[2]; +#else + NVRAMConfig temp[2]; +#endif + s32 check; + u8 *p = OS_GetSystemWork()->nvramUserInfo; + + // オフセット読み出し +#ifdef NVRAM_CONFIG_CONST_ADDRESS + offset = NVRAM_CONFIG_DATA_ADDRESS_DUMMY; +#else + NVRAM_ReadDataBytes(NVRAM_CONFIG_DATA_OFFSET_ADDRESS, NVRAM_CONFIG_DATA_OFFSET_SIZE, + (u8 *)(&offset)); + offset <<= NVRAM_CONFIG_DATA_OFFSET_SHIFT; +#endif + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfigEx), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfigEx), + (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCDEx(temp); +#else + // ミラーされた2つのデータを読み出し + NVRAM_ReadDataBytes((u32)offset, sizeof(NVRAMConfig), (u8 *)(&temp[0])); + NVRAM_ReadDataBytes((u32)(offset + SPI_NVRAM_PAGE_SIZE), sizeof(NVRAMConfig), (u8 *)(&temp[1])); + // 2つの内どちらを使うか判断 + check = CheckCorrectNCD(temp); +#endif + + if (check >= 3) + { + // アプリケーションの起動を抑制 + MI_CpuFill32(p, 0xffffffff, sizeof(NVRAMConfig)); + } + else if (check) + { + s32 i; + + // ニックネームを補正 + if (temp[check - 1].ncd.owner.nickname.length < NVRAM_CONFIG_NICKNAME_LENGTH) + { + for (i = NVRAM_CONFIG_NICKNAME_LENGTH; + i > temp[check - 1].ncd.owner.nickname.length; i--) + { + temp[check - 1].ncd.owner.nickname.str[i - 1] = 0x0000; + } + } + // コメントを補正 + if (temp[check - 1].ncd.owner.comment.length < NVRAM_CONFIG_COMMENT_LENGTH) + { + for (i = NVRAM_CONFIG_COMMENT_LENGTH; i > temp[check - 1].ncd.owner.comment.length; + i--) + { + temp[check - 1].ncd.owner.comment.str[i - 1] = 0x0000; + } + } + // 共有領域にストア + MI_CpuCopy32(&temp[check - 1], p, sizeof(NVRAMConfig)); + } + else + { + // 共有領域をクリア + MI_CpuClear32(p, sizeof(NVRAMConfig)); + } + + // 無線MACアドレスをユーザー情報の後ろに展開 + { + u8 wMac[6]; + + // NVRAMからMACアドレスを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_MACADDRESS_ADDRESS, 6, wMac); + // 展開先アドレスを計算 + p = (u8 *)((u32)p + ((sizeof(NVRAMConfig) + 3) & ~0x00000003)); + // 共有領域に展開 + MI_CpuCopy8(wMac, p, 6); + } +/* +#ifdef WM_PRECALC_ALLOWEDCHANNEL + // 使用可能チャンネルから使用許可チャンネルを計算 + { + u16 enableChannel; + u16 allowedChannel; + + // 使用可能チャンネルを読み出し + NVRAM_ReadDataBytes(NVRAM_CONFIG_ENABLECHANNEL_ADDRESS, 2, (u8 *)(&enableChannel)); + // 使用許可チャンネルを計算 + allowedChannel = WMSP_GetAllowedChannel((u16)(enableChannel >> 1)); + // 展開先アドレスを計算(MACアドレスの後ろの2バイト) + p = (u8 *)((u32)p + 6); + // 共有領域に展開 + *((u16 *)p) = allowedChannel; + } +#endif +*/ +} + +#ifdef NVRAM_CONFIG_DATA_EX_VERSION +/*---------------------------------------------------------------------------* + Name: IsValidConfigEx + + Description: ユーザー情報が拡張コンフィグに対応しているかどうかを調査する。 + + Arguments: None. + + Returns: BOOL - 拡張ユーザー情報が有効な場合にTRUEを返す。 + 無効である場合はFALSEを返す。 + *---------------------------------------------------------------------------*/ +static BOOL IsValidConfigEx(void) +{ + u8 ipl2_type; + + NVRAM_ReadDataBytes(NVRAM_CONFIG_IPL2_TYPE_ADDRESS, NVRAM_CONFIG_IPL2_TYPE_SIZE, &ipl2_type); + if (ipl2_type == NVRAM_CONFIG_IPL2_TYPE_NORMAL) + { + return FALSE; + } + if (ipl2_type & NVRAM_CONFIG_IPL2_TYPE_EX_MASK) + { + return TRUE; + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: GetRomValidLanguage + + Description: ROM内登録エリアの情報から、拡張言語コードの対応言語ビットマップ + に関する情報を抽出する。 + + Arguments: None. + + Returns: u16 - DSカード、もしくは マルチブートバイナリが対応している + 言語コードのビットマップを返す。DSカードが拡張言語 + コードに対応していない場合は 0 を返す。 + *---------------------------------------------------------------------------*/ +static u16 GetRomValidLanguage(void) +{ + u16 ret = 0x0000; + u8 langBit = OS_GetSystemWork()->rom_header[0x1d]; + + // ROM内登録エリアの拡張言語コードを確認 + if (langBit == ROMHEADER_FOR_CHINA_BIT) + { + // for CHINA + ret |= (0x0001 << NVRAM_CONFIG_LANG_CHINESE); + } + else if (langBit == ROMHEADER_FOR_KOREA_BIT) + { + // for KOREA + ret |= (0x0001 << NVRAM_CONFIG_LANG_HANGUL); + } + return ret; +} + +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCDEx + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + 3: アプリの起動を抑制すべき。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCDEx(NVRAMConfigEx * ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // IPLが拡張言語コードに対応しているか + if (IsValidConfigEx()) + { + // IPLが拡張言語コードに対応している場合 + u16 rom_valid_language = GetRomValidLanguage(); + + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + calc_crc = + SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd_ex), sizeof(NVRAMConfigDataEx)); + if ((ncdsp[i].crc16_ex == calc_crc) + && ((0x0001 << ncdsp[i].ncd_ex.language) & + (ncdsp[i].ncd_ex.valid_language_bitmap))) + { + // 拡張データ用 CRC が正しく、設定言語コードが対応言語コードに含まれる場合に正当と判断 + if (rom_valid_language & ncdsp[i].ncd_ex.valid_language_bitmap) + { + // 拡張言語コードで通常言語コードを上書き + ncdsp[i].ncd.option.language = ncdsp[i].ncd_ex.language; + } + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE) & ~ncdsp[i]. + ncd_ex.valid_language_bitmap) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されているが、 + // IPL2の対応言語コードに"中国語"拡張言語コードが含まれない場合は起動を抑制 + return 3; + } + crc_flag |= (1 << i); + } + } + } + } + else + { + // IPLが拡張言語コードに対応していない場合 + u16 rom_valid_language = GetRomValidLanguage(); + + if (rom_valid_language & (0x0001 << NVRAM_CONFIG_LANG_CHINESE)) + { + // ROM 内登録エリアに"中国語"拡張言語コードが設定されている場合は起動を抑制 + return 3; + } + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRC が正しく saveCount 値が 0x80 未満のデータを正当と判断 + crc_flag |= (1 << i); + } + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} + +#else +/*---------------------------------------------------------------------------* + Name: CheckCorrectNCD + + Description: ミラーリングされているユーザー情報のどちらを使うべきか判定する。 + + Arguments: nvdsp - 比較するコンフィグデータ2つの配列。 + + Returns: s32 - 0: 両方不適切。 + 1: 配列[ 0 ]が適切。 + 2: 配列[ 1 ]が適切。 + *---------------------------------------------------------------------------*/ +static s32 CheckCorrectNCD(NVRAMConfig *ncdsp) +{ + u16 i; + u16 calc_crc; + s32 crc_flag = 0; + u16 saveCount; + + // 各ミラーデータのCRC & saveCount正当性チェック + for (i = 0; i < 2; i++) + { + calc_crc = SVC_GetCRC16(0xffff, (void *)(&ncdsp[i].ncd), sizeof(NVRAMConfigData)); + + if ((ncdsp[i].crc16 == calc_crc) && (ncdsp[i].saveCount < NVRAM_CONFIG_SAVE_COUNT_MAX)) + { + // CRCが正しく、saveCount値が0x80未満のデータを正当と判断。 + crc_flag |= (1 << i); + } + } + + // 正当なデータのうちどのデータが有効かを判定する。 + switch (crc_flag) + { + case 1: + case 2: + // 片方のCRCだけ正常 + return crc_flag; + + case 3: + // 両方ともCRCが正しければどちらが最新のデータか判断する。 + saveCount = (u8)((ncdsp[0].saveCount + 1) & NVRAM_CONFIG_SAVE_COUNT_MASK); + if (saveCount == ncdsp[1].saveCount) + { + return 2; + } + return 1; + } + + // 両方ともCRCが不正 + return 0; +} +#endif + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + Description: V ブランク割り込みベクタ。 + Arguments: None. + Returns: None. + *---------------------------------------------------------------------------*/ +extern BOOL PMi_Initialized; +extern void PM_SelfBlinkProc(void); + +static void +VBlankIntr(void) +{ + if (PMi_Initialized) + { + PM_SelfBlinkProc(); + } +} diff --git a/build/tests/TestComponent/ARM9.TWL/ARM9-TS.lsf b/build/tests/TestComponent/ARM9.TWL/ARM9-TS.lsf new file mode 100644 index 00000000..9e89469d --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/ARM9-TS.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address $(ADDRESS_STATIC) + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + StackSize 4096 4096 +} + +Autoload ITCM +{ + Address $(ADDRESS_ITCM) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) +} diff --git a/build/tests/TestComponent/ARM9.TWL/Makefile b/build/tests/TestComponent/ARM9.TWL/Makefile new file mode 100644 index 00000000..755c4c59 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/Makefile @@ -0,0 +1,130 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - systemMenu_RED - NandInitializerRed +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +#============================================================================ +#製品鍵を使った書き込みを行う場合は、TwlIPL/build/buildtools/commondefsの"FIRM_USE_PRODUCT_KEYS=TRUE"を有効にしてください。 +#============================================================================ +#============================================================================ +# ワイヤレスの強制Disableフラグを設定可能にする場合定義します。(要:Make Clean) +MACRO_FLAGS += -DUSE_WIRELESS_FORCE_DISABLE_SETTING +#============================================================================ +#============================================================================ +# 各種データを書き込み可能にする場合定義します。(要:Make Clean) +# 具体的には TWLFontTable.dat wrap.bin cert.sys の3つです。 +MACRO_FLAGS += -DUSE_WRITE_VARIOUS_DATA +#============================================================================ +#============================================================================ +# dev.kpを書き込み可能にする場合定義します。(要:Make Clean) +#MACRO_FLAGS += -DWRITE_DEVKP_ENABLE +#============================================================================ +#============================================================================ +# マリクラデバッグ用として作成する場合定義します。(要:Make Clean) +# ・自動処理において"nand:/shared2/launcher/wrap.bin"を作成します。 +# ・自動処理において開発用CLSの証明書(cert.sys)を書き込みます。 +# ・自動処理の最後に本体初期化を行います。 +#MACRO_FLAGS += -DMARIOCLUB_VERSION +#============================================================================ + +SYSM_DISABLE_DEBUG = FALSE + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + +#TARGET_CODEGEN = THUMB + +TITLEID_LO = 0NRA +#TARGET_TAD = + +TARGET_BIN = TestComponent.srl +LCFILE_SPEC = ARM9-TS.lsf +ROM_SPEC = main.rsf + +MAKEROM_ARM7_BASE = $(SYSMENU_COMPONENTSDIR)/armadillo_uji/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +SRCS = main.c \ + kami_pxi.c \ + font_data.c \ + graphics.c \ + keypad.c \ + kami_font.c \ + + +LINCLUDES = ../common/include \ + $(ROOT)/build/libraries/lcfg/ARM9.TWL/include \ + ../../../systemMenu_tools/common/ARM9/include + +SRCDIR = src \ + ../../../systemMenu_tools/HWInfoWriter/ARM9/src \ + ../../../systemMenu_tools/common/ARM9/src + +#LCFILE = # using default + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +ifdef FIRM_USE_PRODUCT_KEYS +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo.der' \ + -DHWID_PRIVKEY='private_HWID.der' +else +MAKEROM_FLAGS += -DHWINFO_PRIVKEY='private_HWInfo_dev.der' \ + -DHWID_PRIVKEY='private_HWID_dev.der' +endif +endif + +MAKEROM_FLAGS += -DTITLEID_LO='$(TITLEID_LO)' \ + -DPRIVKEY_PATH='$(TWL_KEYSDIR)/rsa' \ + -DCARD_REGION='$(CARD_REGION)' \ + -DDISABLE_DEBUG='$(SYSM_DISABLE_DEBUG)' + +MAKETAD_FLAGS += -s + +SYSMENU_LIBS = \ + libnamut$(TWL_LIBSUFFIX).a + +SDK_APPEND_LIBS = \ + libes$(TWL_LIBSUFFIX).a \ + libboc$(TWL_LIBSUFFIX).a \ + libsfs$(TWL_LIBSUFFIX).a \ + libnam$(TWL_LIBSUFFIX).a \ + libsea$(TWL_LIBSUFFIX).a \ + liblcfg$(TWL_LIBSUFFIX).a \ + libna$(TWL_LIBSUFFIX).a + +LLIBRARIES += $(SYSMENU_LIBS) $(SDK_APPEND_LIBS) + +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#LDIRT_CLEAN = +#INSTALL_TARGETS = +INSTALL_DIR = $(SDK_NMENU_DATADIR) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#include $(TWLSDK_ROOT)/build/buildtools/modulerules +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/TestComponent/ARM9.TWL/include/graphics.h b/build/tests/TestComponent/ARM9.TWL/include/graphics.h new file mode 100644 index 00000000..ddd8c4f6 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/include/graphics.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: graphics.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 GRAPHICS_H_ +#define GRAPHICS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void InitGraphics(void); +void DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* GRAPHICS_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/kami_font.h b/build/tests/TestComponent/ARM9.TWL/include/kami_font.h new file mode 100644 index 00000000..d9855fd0 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/include/kami_font.h @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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_FONT_H_ +#define KAMI_FONT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +extern u8 prog_state; +enum +{ STATE_NONE, STATE_SELECT, STATE_KS_PARENTINIT, STATE_KS_PARENT, STATE_KS_CHILDINIT, + STATE_KS_CHILDSCAN, STATE_KS_CHILD +}; +extern OSHeapHandle heapHandle; // Heapハンドル; + +extern const u16 BgScDataMain[32 * 24]; +extern const u16 BgScDataSub[32 * 24]; +extern const u32 sampleCharData[8 * 0x100]; +extern const u16 PlttDataObj[16][16]; +extern const u16 PlttDataMain[16][16]; +extern const u16 PlttDataSub[16][16]; + +void kamiFontInit(void); +void kamiFontClear(void); +void kamiFontClearMain(void); +void kamiFontPut(u16 x, u16 y, u16 color, u16 no); +void kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...); +void kamiFontFill(s16 x, s16 y, u8 color, s16 value, s32 length); +void kamiFontFillChar(int lineNo, u8 color1, u8 color2); +void kamiFontLoadScreenData(void); +void kamiFontPrintfConsole(u8 color, const char *text, ...); +void kamiFontPrintfConsoleEx(u8 color, const char *text, ...); + +// 上画面コンソール文字列用パレット +#define CONSOLE_ORANGE 0 +#define CONSOLE_RED 1 +#define CONSOLE_GREEN 2 + +// 下画面フォント用パレット +#define FONT_COLOR_BLACK 0 +#define FONT_COLOR_RED 1 +#define FONT_COLOR_GREEN 2 +#define FONT_COLOR_BLUE 3 +#define FONT_COLOR_YELLOW 4 +#define FONT_COLOR_CYAN 5 +#define FONT_COLOR_PURPLE 6 + +// 下画面背景用パレット +#define BG_COLOR_TRANS 0 +#define BG_COLOR_WHITE 1 +#define BG_COLOR_BLACK 2 +#define BG_COLOR_GRAY 3 +#define BG_COLOR_PURPLE 4 +#define BG_COLOR_PINK 5 +#define BG_COLOR_BLUE 6 +#define BG_COLOR_GREEN 7 +#define BG_COLOR_VIOLET 8 +#define BG_COLOR_RED 9 +#define BG_COLOR_YELLOW 10 +#define BG_COLOR_BROWN 11 + +#define BG_COLOR_NONE 0xff + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_FONT_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/kami_pxi.h b/build/tests/TestComponent/ARM9.TWL/include/kami_pxi.h new file mode 100644 index 00000000..a9ca7a50 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/include/kami_pxi.h @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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 TWL_KAMI_TEST_KAMITEST_H_ +#define TWL_KAMI_TEST_KAMITEST_H_ + +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// 処理結果定義 +typedef enum KAMIResult +{ + KAMI_RESULT_SUCCESS = 0, + KAMI_RESULT_SUCCESS_TRUE = 0, + KAMI_RESULT_SUCCESS_FALSE, + KAMI_RESULT_INVALID_COMMAND, + KAMI_RESULT_INVALID_PARAMETER, + KAMI_RESULT_ILLEGAL_STATUS, + KAMI_RESULT_BUSY, + KAMI_RESULT_FATAL_ERROR, + KAMI_RESULT_SEND_ERROR, + KAMI_RESULT_MAX +} +KAMIResult; + + +typedef enum { + FORMAT_MODE_QUICK, // Quickフォーマット + FORMAT_MODE_FULL // Fullフォーマット(各パーティション内を0xFFで埋める) +} FormatMode; + +// コールバック +typedef void (*KAMICallback)(KAMIResult result, void *arg); + + +void KamiPxiInit( void ); + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback); +KAMIResult ExeFormat(FormatMode format_mode); +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read); +KAMIResult kamiMcuWriteFirm(void* buffer ); +KAMIResult kamiMcuIo(u32 reg_no, void* buffer, u32 value, BOOL is_read); +KAMIResult kamiARM7Io(u32 addr, u32* buffer, u32 value, BOOL is_read); +KAMIResult kamiCDC_GoDsMode( void ); +KAMIResult kamiClearNandErrorLog( void ); +KAMIResult kamiGetCameraModuleTypesAsync( CameraModuleTypes *pTypes, KAMICallback callback, void* arg ); +KAMIResult kamiGetCameraModuleTypes( CameraModuleTypes *pTypes ); +KAMIResult kamiGetNandCID( void* buffer ); +KAMIResult kamiCodecIo(u8 page, u8 reg_no, u8* buffer, u8 value, BOOL is_read); + +// (重要) +// ARM7が読み書きするためリード前はInvalidate、ライト前はフラッシュしてください。 +// +static KAMIResult kamiNandRead(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, TRUE); +} +static KAMIResult kamiNandWrite(u32 block, void* buffer, u32 count) +{ + return kamiNandIo(block, buffer, count, FALSE); +} +static KAMIResult kamiMcuRead(u8 reg_no, void* buffer) +{ + return kamiMcuIo((u32)reg_no, buffer, 0, TRUE); +} +static KAMIResult kamiMcuWrite(u8 reg_no, u8 value) +{ + return kamiMcuIo((u32)reg_no, NULL, (u32)value, FALSE); +} +static KAMIResult kamiARM7Read(u32 addr, void* buffer) +{ + return kamiARM7Io(addr, buffer, 0, TRUE); +} +static KAMIResult kamiARM7Write(u32 addr, u8 value) +{ + return kamiARM7Io(addr, NULL, value, FALSE); +} + +static KAMIResult kamiCodecRead(u8 page, u8 reg_no, u8* buffer) +{ + return kamiCodecIo(page, reg_no, buffer, 0, TRUE); +} + +static KAMIResult kamiCodecWrite(u8 page, u8 reg_no, u8 value) +{ + return kamiCodecIo(page, reg_no, NULL, value, FALSE); +} + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_KAMITEST_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/include/keypad.h b/build/tests/TestComponent/ARM9.TWL/include/keypad.h new file mode 100644 index 00000000..2f5a1602 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/include/keypad.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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_KEY_PAD_H_ +#define KAMI_KEY_PAD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +#include + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +void kamiPadRead(void); +BOOL kamiPadIsTrigger(u16 key); +BOOL kamiPadIsRepeatTrigger(u16 key); +BOOL kamiPadIsPress(u16 key); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* KAMI_KEY_PAD_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/main.rsf b/build/tests/TestComponent/ARM9.TWL/main.rsf new file mode 100644 index 00000000..7d39d6cb --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/main.rsf @@ -0,0 +1,232 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + RomVersion 2 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 2G + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile ../banner/banner.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + WramMapping MAP_TS_SCR + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + CommonClientKey TRUE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + HwAESSlotC TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SCFG: scfg lock [TRUE/FALSE] + # + LockSCFG FALSE + + # + # DisableDebug :最終ROMでは、実行時にデバッグできないようにTRUEにする必要があります。 + # + DisableDebug $(DISABLE_DEBUG) + + ### + #### END +} + + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + + +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) +} diff --git a/build/tests/TestComponent/ARM9.TWL/src/font_data.c b/build/tests/TestComponent/ARM9.TWL/src/font_data.c new file mode 100644 index 00000000..aa1ba501 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/font_data.c @@ -0,0 +1,734 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: font_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 + +/*---------------------- BGスクリーン ---------------------------*/ + +const u16 BgScDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +const u16 BgScDataSub[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +/*---------------------- パレットデータ ---------------------------*/ +#define RGB555(r,g,b) (b<<10|g<<5|r) + +const u16 PlttDataObj[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(31, 0, 0), RGB555(5, 5, 20),}, // Black + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White +}; + +// 上画面コンソール文字列パレット +const u16 PlttDataMain[16][16] = { + {RGB555( 0, 0, 0), RGB555(31, 10, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Orange + {RGB555(31, 31, 31), RGB555(31, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555(0, 31, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555(0, 0, 31), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(31, 31, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(31, 0, 31), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555( 0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0), RGB555(0, 0, 0),}, // Black +}; + +// 下画面コンソール文字列パレット +const u16 PlttDataSub[16][16] = { + {RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(25, 25, 25), RGB555(31, 31, 31),}, // Black + {RGB555(31, 31, 31), RGB555(21, 0, 0), RGB555(31, 0, 0), RGB555(31, 0, 0),}, // Red + {RGB555(31, 31, 31), RGB555( 0, 21, 0), RGB555(0, 31, 0), RGB555(0, 31, 0),}, // Green + {RGB555(31, 31, 31), RGB555( 0, 0, 21), RGB555(0, 0, 31), RGB555(0, 0, 31),}, // Blue + {RGB555(31, 31, 31), RGB555(21, 21, 0), RGB555(31, 31, 0), RGB555(31, 31, 0),}, // Yellow + {RGB555(31, 31, 31), RGB555(0, 21, 21), RGB555(0, 31, 31), RGB555(0, 31, 31),}, // Cyan + {RGB555(31, 31, 31), RGB555(21, 0, 21), RGB555(31, 0, 31), RGB555(31, 0, 31),}, // Purple + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(20, 20, 20), RGB555(20, 20, 20), RGB555(20, 20, 20),}, // Gray + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555(31, 31, 31),}, // White + + // 背景カラーはこの16番パレット + // 白 黒 灰 むらさき ピンク みずいろ 緑 青紫 赤 黄 茶 + {RGB555(31, 31, 31), RGB555(31, 31, 31), RGB555( 0, 0, 0), RGB555(20, 20, 20), RGB555(31, 15, 31), RGB555(31, 20, 20), RGB555(20, 29, 31), RGB555(20, 31, 20), RGB555(21, 21, 31), RGB555(31, 0, 0), RGB555(31, 31, 10), RGB555(25, 15, 15), RGB555(31, 31, 31), RGB555(31, 31, 31), } // White +}; + +/*---------------------- キャラクタデータ -------------------------*/ + +const u32 sampleCharData[8 * 0x100] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0000h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x11111111, 0x11111111, // 0001h use for import progress bar + 0x11111111, 0x11111111, 0x00000000, 0x00000000, + 0x00000000, 0x01011010, 0x01010010, 0x00010010, // 0002h + 0x00100010, 0x00100010, 0x00100001, 0x00100001, + 0x00000000, 0x01010001, 0x01010001, 0x01111111, // 0003h + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01010000, 0x01111111, 0x00100000, // 0004h + 0x00100000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x01010000, 0x01010100, 0x00001010, // 0005h + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011000, 0x01011000, 0x01111111, // 0006h + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01010010, 0x01101111, 0x01010010, // 0007h + 0x00010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x01010010, 0x01011111, 0x00000100, // 0008h + 0x00011111, 0x00001000, 0x00000001, 0x00011110, + 0x00000000, 0x01010000, 0x01011000, 0x00000110, // 0009h + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x01010000, 0x01111101, 0x00010001, // 000ah + 0x00010001, 0x00010001, 0x00010001, 0x00001010, + 0x00000000, 0x01010000, 0x01011110, 0x00100000, // 000bh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010100, 0x01011111, 0x00001000, // 000ch + 0x00010000, 0x00000001, 0x00000001, 0x00011110, + 0x00000000, 0x01010001, 0x01010001, 0x00000001, // 000dh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00011000, // 000eh + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x01010010, 0x01111111, 0x00010010, // 000fh + 0x00010010, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00001110, 0x01010100, 0x01010010, // 0010h + 0x00111111, 0x00000100, 0x00000100, 0x00011000, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 0011h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x01010100, 0x01011111, 0x00000010, // 0012h + 0x00011110, 0x00100001, 0x00100000, 0x00011110, + 0x00000000, 0x01010000, 0x01011100, 0x00100011, // 0013h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01010000, 0x01111111, 0x00010000, // 0014h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x01010010, 0x01010010, 0x00001100, // 0015h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x01010001, 0x01111101, 0x00010001, // 0016h + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01010100, 0x01010011, 0x01110010, // 0017h + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01011110, 0x01011000, 0x00000100, // 0018h + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01010000, 0x01011100, 0x00010010, // 0019h + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01011101, 0x01010001, 0x00111101, // 001ah + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x01110001, 0x01011101, 0x00110001, // 001bh + 0x00010001, 0x00111001, 0x01010101, 0x00011001, + 0x00000000, 0x01110100, 0x01010011, 0x00110010, // 001ch + 0x00010001, 0x00010001, 0x00001010, 0x00000100, + 0x00000000, 0x01101110, 0x01011000, 0x00100100, // 001dh + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x01110000, 0x01011100, 0x00110010, // 001eh + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x01010001, 0x00111101, // 001fh + 0x00010001, 0x00011001, 0x00110101, 0x00001001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 0020h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 0021h + 0x00001000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x01101100, 0x01001000, 0x00100100, // 0022h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00100100, 0x01111111, 0x00100100, // 0023h + 0x00100100, 0x01111111, 0x00010010, 0x00010010, + 0x00000000, 0x00001000, 0x01111110, 0x00001001, // 0024h + 0x00111110, 0x01001000, 0x00111111, 0x00001000, + 0x00000000, 0x01000010, 0x00100101, 0x00010010, // 0025h + 0x00001000, 0x00100100, 0x01010010, 0x00100001, + 0x00000000, 0x00001110, 0x00010001, 0x00001001, // 0026h + 0x01000110, 0x00101001, 0x00110001, 0x01001110, + 0x00000000, 0x00011000, 0x00010000, 0x00001000, // 0027h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01110000, 0x00001000, 0x00000100, // 0028h + 0x00000100, 0x00000100, 0x00001000, 0x01110000, + 0x00000000, 0x00000111, 0x00001000, 0x00010000, // 0029h + 0x00010000, 0x00010000, 0x00001000, 0x00000111, + 0x00000000, 0x00001000, 0x01001001, 0x00101010, // 002ah + 0x00011100, 0x00101010, 0x01001001, 0x00001000, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 002bh + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002ch + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002dh + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 002eh + 0x00000000, 0x00000000, 0x00000000, 0x00001100, + 0x00000000, 0x01000000, 0x00100000, 0x00010000, // 002fh + 0x00001000, 0x00000100, 0x00000010, 0x00000001, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0030h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00011100, 0x00010000, 0x00010000, // 0031h + 0x00010000, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0032h + 0x00111110, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x00111110, 0x01000001, 0x01000000, // 0033h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00100000, 0x00110000, 0x00101000, // 0034h + 0x00100100, 0x00100010, 0x01111111, 0x00100000, + 0x00000000, 0x01111111, 0x00000001, 0x00111111, // 0035h + 0x01000000, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x00000001, 0x00111111, // 0036h + 0x01000001, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00100000, 0x00100000, // 0037h + 0x00010000, 0x00010000, 0x00001000, 0x00001000, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0038h + 0x00111110, 0x01000001, 0x01000001, 0x00111110, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 0039h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003ah + 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00001100, 0x00000000, // 003bh + 0x00000000, 0x00001100, 0x00001000, 0x00000100, + 0x00000000, 0x01100000, 0x00011000, 0x00000110, // 003ch + 0x00000001, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00000000, 0x01111111, 0x00000000, // 003dh + 0x00000000, 0x00000000, 0x01111111, 0x00000000, + 0x00000000, 0x00000011, 0x00001100, 0x00110000, // 003eh + 0x01000000, 0x00110000, 0x00001100, 0x00000011, + 0x00000000, 0x00111110, 0x01000001, 0x01000001, // 003fh + 0x00110000, 0x00001000, 0x00000000, 0x00001000, + 0x00000000, 0x00011100, 0x00100010, 0x01001001, // 0040h + 0x01010101, 0x01010101, 0x01010101, 0x00111010, + 0x00000000, 0x00001000, 0x00010100, 0x00010100, // 0041h + 0x00100010, 0x00111110, 0x01000001, 0x01000001, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0042h + 0x00111111, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0043h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x00011111, 0x00100001, 0x01000001, // 0044h + 0x01000001, 0x01000001, 0x00100001, 0x00011111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0045h + 0x01111111, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01111111, 0x00000001, 0x00000001, // 0046h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00111100, 0x01000010, 0x00000001, // 0047h + 0x01111001, 0x01000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0048h + 0x01111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x00001000, 0x00001000, // 0049h + 0x00001000, 0x00001000, 0x00001000, 0x00111110, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 004ah + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01100001, 0x00011001, 0x00000101, // 004bh + 0x00000011, 0x00000101, 0x00011001, 0x01100001, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 004ch + 0x00000001, 0x00000001, 0x00000001, 0x01111111, + 0x00000000, 0x01000001, 0x01100011, 0x01010101, // 004dh + 0x01001001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x01000001, 0x01000011, 0x01000101, // 004eh + 0x01001001, 0x01010001, 0x01100001, 0x01000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 004fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0050h + 0x00111111, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00011100, 0x00100010, 0x01000001, // 0051h + 0x01000001, 0x01011001, 0x00100010, 0x01011100, + 0x00000000, 0x00111111, 0x01000001, 0x01000001, // 0052h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00111110, 0x01000001, 0x00000001, // 0053h + 0x00111110, 0x01000000, 0x01000001, 0x00111110, + 0x00000000, 0x01111111, 0x00001000, 0x00001000, // 0054h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0055h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x01000001, 0x01000001, 0x00100010, // 0056h + 0x00100010, 0x00010100, 0x00010100, 0x00001000, + 0x00000000, 0x01000001, 0x01000001, 0x01000001, // 0057h + 0x01001001, 0x01010101, 0x01100011, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0058h + 0x00001000, 0x00010100, 0x00100010, 0x01000001, + 0x00000000, 0x01000001, 0x00100010, 0x00010100, // 0059h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01111111, 0x00100000, 0x00010000, // 005ah + 0x00001000, 0x00000100, 0x00000010, 0x01111111, + 0x00000000, 0x01111100, 0x00000100, 0x00000100, // 005bh + 0x00000100, 0x00000100, 0x00000100, 0x01111100, + 0x00000000, 0x00100010, 0x00010100, 0x00111110, // 005ch + 0x00001000, 0x00111110, 0x00001000, 0x00001000, + 0x00000000, 0x00011111, 0x00010000, 0x00010000, // 005dh + 0x00010000, 0x00010000, 0x00010000, 0x00011111, + 0x00000000, 0x00001000, 0x00010100, 0x00100010, // 005eh + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 005fh + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x00010000, 0x00001000, 0x00011000, // 0060h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011110, 0x00100001, // 0061h + 0x00111110, 0x00100001, 0x00100001, 0x01011110, + 0x00000000, 0x00000001, 0x00000001, 0x00111111, // 0062h + 0x01000001, 0x01000001, 0x01000001, 0x00111111, + 0x00000000, 0x00000000, 0x00111100, 0x01000010, // 0063h + 0x00000001, 0x00000001, 0x01000010, 0x00111100, + 0x00000000, 0x01000000, 0x01000000, 0x01111110, // 0064h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0065h + 0x01111111, 0x00000001, 0x01000001, 0x00111110, + 0x00000000, 0x00110000, 0x00001000, 0x00001000, // 0066h + 0x01111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x01111110, 0x01000001, // 0067h + 0x01000001, 0x01111110, 0x01000000, 0x00111110, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0068h + 0x00111111, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00001000, 0x00000000, 0x00001000, // 0069h + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00100000, 0x00000000, 0x00100000, // 006ah + 0x00100000, 0x00100001, 0x00100001, 0x00011110, + 0x00000000, 0x00000001, 0x00000001, 0x01100001, // 006bh + 0x00011001, 0x00000111, 0x00011001, 0x01100001, + 0x00000000, 0x00001000, 0x00001000, 0x00001000, // 006ch + 0x00001000, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00110111, 0x01001001, // 006dh + 0x01001001, 0x01001001, 0x01001001, 0x01001001, + 0x00000000, 0x00000000, 0x00111111, 0x01000001, // 006eh + 0x01000001, 0x01000001, 0x01000001, 0x01000001, + 0x00000000, 0x00000000, 0x00011100, 0x00100010, // 006fh + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00000000, 0x00111101, 0x01000011, // 0070h + 0x01000001, 0x01000011, 0x00111101, 0x00000001, + 0x00000000, 0x00000000, 0x01011110, 0x01100001, // 0071h + 0x01000001, 0x01100001, 0x01011110, 0x01000000, + 0x00000000, 0x00000000, 0x00110001, 0x00001101, // 0072h + 0x00000011, 0x00000001, 0x00000001, 0x00000001, + 0x00000000, 0x00000000, 0x00111110, 0x01000001, // 0073h + 0x00001110, 0x00110000, 0x01000001, 0x00111110, + 0x00000000, 0x00000100, 0x00000100, 0x01111111, // 0074h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0075h + 0x01000001, 0x01000001, 0x01000001, 0x01111110, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0076h + 0x00100010, 0x00100010, 0x00010100, 0x00001000, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0077h + 0x01001001, 0x00101010, 0x00101010, 0x00010100, + 0x00000000, 0x00000000, 0x00100001, 0x00010010, // 0078h + 0x00001100, 0x00001100, 0x00010010, 0x00100001, + 0x00000000, 0x00000000, 0x01000001, 0x01000001, // 0079h + 0x00100010, 0x00011100, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111111, 0x00010000, // 007ah + 0x00001000, 0x00000100, 0x00000010, 0x00111111, + 0x00000000, 0x00001000, 0x00011110, 0x01100100, // 007bh + 0x00011000, 0x00100100, 0x00000100, 0x01111000, + 0x00000000, 0x00000000, 0x00011110, 0x00000100, // 007ch + 0x00011110, 0x00110101, 0x00101101, 0x00010010, + 0x00000000, 0x00000000, 0x00000000, 0x00010001, // 007dh + 0x00100001, 0x00100001, 0x00000001, 0x00000010, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007eh + 0x00011110, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00011100, 0x00000000, // 007fh + 0x00111110, 0x00010000, 0x00001100, 0x00110010, + 0x00000000, 0x00000000, 0x00000100, 0x00101111, // 0080h + 0x01000100, 0x00011110, 0x00100101, 0x00010110, + 0x00000000, 0x00000000, 0x00001010, 0x00011110, // 0081h + 0x00101011, 0x00100010, 0x00010100, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00011101, // 0082h + 0x00101011, 0x00101001, 0x00011001, 0x00000100, + 0x00000000, 0x00000000, 0x00001000, 0x00111000, // 0083h + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00000000, 0x00000000, 0x00011100, // 0084h + 0x00100011, 0x00100000, 0x00100000, 0x00011100, + 0x00000000, 0x00000110, 0x01001001, 0x00110000, // 0085h + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000100, 0x00111111, 0x00000100, // 0086h + 0x00111110, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000000, 0x00100001, 0x01000001, // 0087h + 0x01000001, 0x01000001, 0x00000001, 0x00000010, + 0x00000000, 0x00111100, 0x00000000, 0x00111110, // 0088h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00011100, 0x00000000, 0x00111110, // 0089h + 0x00010000, 0x00001000, 0x00010100, 0x01100010, + 0x00000000, 0x00100100, 0x01011111, 0x00000100, // 008ah + 0x00111110, 0x01000101, 0x01000101, 0x00100010, + 0x00000000, 0x00100010, 0x01001111, 0x01010010, // 008bh + 0x01010010, 0x00010010, 0x00010010, 0x00001001, + 0x00000000, 0x00000100, 0x00111110, 0x00001000, // 008ch + 0x00111110, 0x00010000, 0x00000010, 0x00111100, + 0x00000000, 0x00100000, 0x00011000, 0x00000110, // 008dh + 0x00000001, 0x00000110, 0x00011000, 0x00100000, + 0x00000000, 0x00100000, 0x01111101, 0x00100001, // 008eh + 0x00100001, 0x00100001, 0x00100001, 0x00010010, + 0x00000000, 0x00011110, 0x00100000, 0x00000000, // 008fh + 0x00000000, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00001000, 0x01111111, 0x00010000, // 0090h + 0x00100000, 0x00000010, 0x00000010, 0x00111100, + 0x00000000, 0x00000001, 0x00000001, 0x00000001, // 0091h + 0x01000001, 0x01000001, 0x00100010, 0x00011100, + 0x00000000, 0x00010000, 0x01111111, 0x00011000, // 0092h + 0x00010100, 0x00010100, 0x00011000, 0x00001100, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 0093h + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x00111100, 0x00010000, 0x00001100, // 0094h + 0x01111111, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000100, 0x00011111, 0x00000100, // 0095h + 0x01110100, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00001000, 0x01111111, 0x00000100, // 0096h + 0x00111100, 0x01000010, 0x01000000, 0x00111100, + 0x00000000, 0x00000000, 0x00011100, 0x00100011, // 0097h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01111111, 0x00010000, 0x00001000, // 0098h + 0x00001000, 0x00001000, 0x00001000, 0x00110000, + 0x00000000, 0x00000010, 0x00110010, 0x00001100, // 0099h + 0x00000010, 0x00000001, 0x00000001, 0x00111110, + 0x00000000, 0x00100100, 0x01001111, 0x01000010, // 009ah + 0x00010001, 0x00111100, 0x00010010, 0x00001100, + 0x00000000, 0x00000010, 0x01111010, 0x01000010, // 009bh + 0x00000010, 0x00000010, 0x00001010, 0x01110010, + 0x00000000, 0x00100010, 0x00111110, 0x01010010, // 009ch + 0x01001011, 0x01101101, 0x01010101, 0x00110010, + 0x00000000, 0x00110010, 0x01001011, 0x01000110, // 009dh + 0x01000110, 0x01110010, 0x01001011, 0x00110010, + 0x00000000, 0x00011100, 0x00101010, 0x01001001, // 009eh + 0x01001001, 0x01000101, 0x01000101, 0x00110010, + 0x00000000, 0x00100001, 0x01111101, 0x00100001, // 009fh + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00000100, 0x00100011, 0x01100010, // 00a0h + 0x00100001, 0x00100001, 0x00010010, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a1h + 0x00000000, 0x00000100, 0x00001010, 0x00000100, + 0x00000000, 0x01110000, 0x00010000, 0x00010000, // 00a2h + 0x00010000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a3h + 0x00001000, 0x00001000, 0x00001000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00a4h + 0x00000000, 0x00000010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00011000, // 00a5h + 0x00011000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x01111111, // 00a6h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x00000000, 0x00111111, 0x00100000, // 00a7h + 0x00010100, 0x00001100, 0x00000100, 0x00000010, + 0x00000000, 0x00000000, 0x00100000, 0x00100000, // 00a8h + 0x00010000, 0x00001111, 0x00001000, 0x00001000, + 0x00000000, 0x00000000, 0x00000100, 0x00111111, // 00a9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00aah + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00000000, 0x00010000, 0x00111111, // 00abh + 0x00011000, 0x00010100, 0x00010010, 0x00011001, + 0x00000000, 0x00000000, 0x00000010, 0x00111111, // 00ach + 0x00100010, 0x00010010, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00000000, 0x00111110, // 00adh + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00aeh + 0x00111110, 0x00100000, 0x00100000, 0x00111110, + 0x00000000, 0x00000000, 0x00100101, 0x00101010, // 00afh + 0x00101010, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00b0h + 0x01111111, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x01111111, 0x01000000, 0x00101000, // 00b1h + 0x00011000, 0x00001000, 0x00001000, 0x00000100, + 0x00000000, 0x01000000, 0x00100000, 0x00011000, // 00b2h + 0x00010111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x00001000, 0x01111111, 0x01000001, // 00b3h + 0x01000001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000000, 0x00111110, 0x00001000, // 00b4h + 0x00001000, 0x00001000, 0x00001000, 0x01111111, + 0x00000000, 0x00100000, 0x01111111, 0x00110000, // 00b5h + 0x00101000, 0x00100100, 0x00100010, 0x00110001, + 0x00000000, 0x00000100, 0x01111111, 0x01000100, // 00b6h + 0x01000100, 0x01000100, 0x01000010, 0x00100001, + 0x00000000, 0x00000100, 0x00111111, 0x00001000, // 00b7h + 0x01111111, 0x00010000, 0x00010000, 0x00010000, + 0x00000000, 0x01111100, 0x01000100, 0x01000100, // 00b8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00000010, 0x01111110, 0x00100010, // 00b9h + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00bah + 0x01000000, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00100010, 0x01111111, 0x00100010, // 00bbh + 0x00100010, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x00000011, 0x00000100, 0x01000011, // 00bch + 0x01000100, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x01111111, 0x01000000, 0x00100000, // 00bdh + 0x00010000, 0x00011000, 0x00100100, 0x01000011, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00beh + 0x00100010, 0x00000010, 0x00000010, 0x01111100, + 0x00000000, 0x01000001, 0x01000010, 0x01000000, // 00bfh + 0x00100000, 0x00100000, 0x00011000, 0x00000110, + 0x00000000, 0x01111110, 0x01000010, 0x01001110, // 00c0h + 0x01110001, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x01100000, 0x00011110, 0x00010000, // 00c1h + 0x01111111, 0x00010000, 0x00010000, 0x00001100, + 0x00000000, 0x01000101, 0x01001010, 0x01001010, // 00c2h + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00c3h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000010, 0x00000010, 0x00000110, // 00c4h + 0x00011010, 0x01100010, 0x00000010, 0x00000010, + 0x00000000, 0x00010000, 0x00010000, 0x01111111, // 00c5h + 0x00010000, 0x00010000, 0x00001000, 0x00000110, + 0x00000000, 0x00000000, 0x00111110, 0x00000000, // 00c6h + 0x00000000, 0x00000000, 0x00000000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000100, // 00c7h + 0x00101000, 0x00010000, 0x00101000, 0x01000110, + 0x00000000, 0x00001000, 0x01111111, 0x00100000, // 00c8h + 0x00010000, 0x00011100, 0x01101011, 0x00001000, + 0x00000000, 0x01000000, 0x01000000, 0x01000000, // 00c9h + 0x00100000, 0x00100000, 0x00011000, 0x00000111, + 0x00000000, 0x00010010, 0x00100010, 0x00100010, // 00cah + 0x01000010, 0x01000010, 0x01000001, 0x01000001, + 0x00000000, 0x00000001, 0x00000001, 0x01111111, // 00cbh + 0x00000001, 0x00000001, 0x00000001, 0x01111110, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cch + 0x01000000, 0x00100000, 0x00010000, 0x00001110, + 0x00000000, 0x00000000, 0x00000100, 0x00001010, // 00cdh + 0x00010001, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x00001000, 0x00001000, 0x01111111, // 00ceh + 0x00001000, 0x00101010, 0x01001010, 0x01001001, + 0x00000000, 0x01111111, 0x01000000, 0x01000000, // 00cfh + 0x00100010, 0x00010100, 0x00001000, 0x00010000, + 0x00000000, 0x00001110, 0x01110000, 0x00001110, // 00d0h + 0x01110000, 0x00000110, 0x00011000, 0x01100000, + 0x00000000, 0x00001000, 0x00001000, 0x00000100, // 00d1h + 0x00000100, 0x00100010, 0x01000010, 0x01111111, + 0x00000000, 0x01000000, 0x01000000, 0x00100100, // 00d2h + 0x00101000, 0x00010000, 0x00101100, 0x01000011, + 0x00000000, 0x01111111, 0x00000100, 0x01111111, // 00d3h + 0x00000100, 0x00000100, 0x00000100, 0x01111000, + 0x00000000, 0x00000010, 0x01111111, 0x01000010, // 00d4h + 0x00100010, 0x00010100, 0x00000100, 0x00000100, + 0x00000000, 0x00000000, 0x00111110, 0x00100000, // 00d5h + 0x00100000, 0x00100000, 0x00100000, 0x01111111, + 0x00000000, 0x01111110, 0x01000000, 0x01000000, // 00d6h + 0x01111110, 0x01000000, 0x01000000, 0x01111110, + 0x00000000, 0x00111110, 0x00000000, 0x01111111, // 00d7h + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00d8h + 0x01000010, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00001010, 0x00001010, 0x00001010, // 00d9h + 0x01001010, 0x01001010, 0x00101010, 0x00011001, + 0x00000000, 0x00000010, 0x00000010, 0x01000010, // 00dah + 0x01000010, 0x00100010, 0x00010010, 0x00001110, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dbh + 0x01000001, 0x01000001, 0x01000001, 0x01111111, + 0x00000000, 0x01111111, 0x01000001, 0x01000001, // 00dch + 0x01000000, 0x01000000, 0x00100000, 0x00011100, + 0x00000000, 0x01000011, 0x01000100, 0x01000000, // 00ddh + 0x01000000, 0x00100000, 0x00010000, 0x00001111, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00deh 0 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, // 00dfh 1 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00011110, 0x00001000, 0x00000100, // 00e0h 2 + 0x00101001, 0x01010001, 0x01010001, 0x00001100, + 0x00000000, 0x00000000, 0x00001100, 0x00010010, // 00e1h 3 + 0x00010010, 0x00100001, 0x01000000, 0x00000000, + 0x00000000, 0x01111101, 0x00100001, 0x01111101, // 00e2h 4 + 0x00100001, 0x00111001, 0x01100101, 0x00011001, + 0x00000000, 0x00111100, 0x00010000, 0x00111100, // 00e3h 5 + 0x00010000, 0x00011100, 0x00110010, 0x00001100, + 0x00000000, 0x00001110, 0x00101000, 0x00101000, // 00e4h 6 + 0x00111110, 0x01100101, 0x00100101, 0x00010010, + 0x00000000, 0x00000100, 0x00101111, 0x01000100, // 00e5h 7 + 0x00000110, 0x01000101, 0x01000101, 0x00111110, + 0x00000000, 0x00100010, 0x00100010, 0x00111110, // 00e6h 8 + 0x01010010, 0x01010101, 0x01001101, 0x00100110, + 0x00000000, 0x00000100, 0x00011111, 0x00000010, // 00e7h 9 + 0x00011111, 0x01000010, 0x01000010, 0x00111100, + 0x00000000, 0x00010010, 0x00111110, 0x01010011, // 00e8h 10 + 0x01000010, 0x00100100, 0x00000100, 0x00000100, + 0x00000000, 0x00001000, 0x00111101, 0x01001011, // 00e9h 11 + 0x01001001, 0x01001001, 0x00111000, 0x00000100, + 0x00000000, 0x00001000, 0x00111000, 0x00001000, // 00eah 12 + 0x00001000, 0x00011110, 0x00101001, 0x00000110, + 0x00000000, 0x00011000, 0x00100000, 0x00000100, // 00ebh 13 + 0x00111010, 0x01000110, 0x01000000, 0x00111000, + 0x00000000, 0x01000010, 0x01000010, 0x01000010, // 00ech 14 + 0x01000110, 0x01000000, 0x00100000, 0x00011000, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00edh 15 + 0x01000011, 0x01001100, 0x01010010, 0x00111100, + 0x00000000, 0x00100010, 0x00110011, 0x00101010, // 00eeh 16 + 0x00100110, 0x00100010, 0x00100011, 0x01000010, + 0x00000000, 0x00111110, 0x00010000, 0x00111100, // 00efh 17 + 0x01000011, 0x01000000, 0x01000010, 0x00111100, + 0x00000000, 0x00000010, 0x00111011, 0x01000110, // 00f0h 18 + 0x01000010, 0x01000011, 0x01000010, 0x00110010, + 0x00000000, 0x00000100, 0x00000100, 0x00000010, // 00f1h 19 + 0x01000110, 0x01000101, 0x01000101, 0x00111001, + 0x00000000, 0x01010100, 0x01111111, 0x00100100, // 00f2h 20 + 0x00100100, 0x00100100, 0x00100010, 0x00010001, + 0x00000000, 0x01010100, 0x01011111, 0x00000100, // 00f3h 21 + 0x00111111, 0x00001000, 0x00001000, 0x00001000, + 0x00000000, 0x01011110, 0x01100010, 0x00100010, // 00f4h 22 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + 0x00000000, 0x01010010, 0x01111110, 0x00100010, // 00f5h 23 + 0x00100001, 0x00100000, 0x00010000, 0x00001100, + + 0x33330000, + 0x33330000, + 0x33000000, + 0x33000000, // 00f6h + 0x33000000, + 0x33000000, + 0x33330000, + 0x33330000, + + + 0x00020000, // 00f7h + 0x00020000, + 0x00020000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00f8h + 0x00000000, + 0x00000000, + 0x00000000, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00f9h + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + + 0x11111111, // 00fah + 0x11111111, + 0x11111111, + 0x11111111, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00000000, // 00fbh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fch + 0x00020000, + 0x00020000, + 0x22222222, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00020000, // 00fdh + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + 0x00020000, + + 0x00000000, // 00feh + 0x00000000, + 0x00000000, + 0x22222222, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + 0x00020000, + 0x00220000, + 0x02122222, + 0x21111112, + 0x21111112, + 0x02122222, + 0x00220000, + 0x00020000, + + + +/* + 0x00022222, + 0x00002112, + 0x00021112, + 0x00211122, + 0x02111202, + 0x21112000, + 0x02120000, + 0x00200000, +*/ + +/* + 0x00000000, 0x01011110, 0x01010000, 0x00111111, // 00ffh + 0x00001000, 0x00001000, 0x00001000, 0x00000110 +*/ +}; + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestComponent/ARM9.TWL/src/graphics.c b/build/tests/TestComponent/ARM9.TWL/src/graphics.c new file mode 100644 index 00000000..1de138e9 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/graphics.c @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: praphics.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 "kami_font.h" +#include "graphics.h" + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: InitGraphics + + Description: 表示の初期化処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void +InitGraphics(void) +{ + GX_DispOff(); + GXS_DispOff(); + + //---- VRAM クリア + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //---- OAMとパレットクリア + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); + MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE); + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); + + //---- OBJバンクの設定 + GX_SetBankForOBJ(GX_VRAM_OBJ_128_A); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_128_D); + + //---- BGバンクの設定 + GX_SetBankForBG(GX_VRAM_BG_128_B); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + + //---- 表示モード設定 + GX_SetGraphicsMode (GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_3D); + GX_SetVisiblePlane (GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + GXS_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_OBJ); + + //---- 3D初期化 + G3X_Init(); + G3X_InitMtxStack(); + G2_SetBG0Priority(0); + G3X_AlphaTest(FALSE, 0); + G3X_AntiAlias(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, (GXFogBlend)0, (GXFogSlope)0, 0); + G3X_SetClearColor(0, 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + + //---- 32KバイトのOBJで2Dマップモードで使用 + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_2D); + + // スクリーンオフセット及びキャラクターオフセットの設定 + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x10000); + + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x00000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG0Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, + GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x2000 , + GX_BG_CHARBASE_0x04000, + GX_BG_EXTPLTT_01 + ); + + G2_BG1Mosaic(FALSE); + G2S_BG1Mosaic(FALSE); + + //---- データロード + GX_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBG1Char( sampleCharData, 0, sizeof(sampleCharData)); + GX_LoadBGPltt ( PlttDataMain, 0, sizeof(PlttDataMain)); + GX_LoadBG1Scr ( BgScDataMain, 0, sizeof(BgScDataMain)); + GX_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GXS_LoadOBJ ( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBG0Char( sampleCharData, 0, sizeof(sampleCharData)); + GXS_LoadBGPltt ( PlttDataSub, 0, sizeof(PlttDataSub)); + GXS_LoadBG0Scr ( BgScDataSub, 0, sizeof(BgScDataSub)); + GXS_LoadOBJPltt( PlttDataObj, 0, sizeof(PlttDataObj)); + + GX_DispOn(); + GXS_DispOn(); +} + +/*---------------------------------------------------------------------------* + Name: DrawLine + + Description: 三角ポリゴンで線を描画 + + Arguments: sx - 描画する線の開始点のx座標 + sy - 描画する線の開始点のy座標 + ex - 描画する線の終点のx座標 + ey - 描画する線の終点のy座標 + color - 描画する線の色 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +DrawLine(s16 sx, s16 sy, s16 ex, s16 ey, GXRgb color) +{ + fx16 fsx = (fx16)(((sx - 128) * 0x1000) / 128); + fx16 fsy = (fx16)(((96 - sy) * 0x1000) / 96); + fx16 fex = (fx16)(((ex - 128) * 0x1000) / 128); + fx16 fey = (fx16)(((96 - ey) * 0x1000) / 96); + + G3_Begin(GX_BEGIN_TRIANGLES); + { + G3_Color( color ); + G3_Vtx(fsx, fsy, 0); + G3_Color( color ); + G3_Vtx(fex, fey, 0); + G3_Color( color ); + G3_Vtx(fsx, fsy, 1); + } + G3_End(); +} diff --git a/build/tests/TestComponent/ARM9.TWL/src/kami_font.c b/build/tests/TestComponent/ARM9.TWL/src/kami_font.c new file mode 100644 index 00000000..fb3818b6 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/kami_font.c @@ -0,0 +1,407 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_font.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" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define SCREEN_DATA_COLOR_PLTT_SHIFT 12 +#define NUM_OF_PRINT_TARGET 2 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u8 sXPos; +static u8 sYPos; + +static u32 sBackColorCharData[24*8]; + +static u16 sFontScreenDataMain[32 * 24] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sFontScreenDataSub[24*32] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static u16 sBackColorScreenData[32 * 24] = { + 0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de,0xf0de, + 0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df,0xf0df, + 0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0,0xf0e0, + 0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1,0xf0e1, + 0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2,0xf0e2, + 0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3,0xf0e3, + 0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4,0xf0e4, + 0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5,0xf0e5, + 0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6,0xf0e6, + 0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7,0xf0e7, + 0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8,0xf0e8, + 0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9,0xf0e9, + 0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea,0xf0ea, + 0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb,0xf0eb, + 0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec,0xf0ec, + 0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed,0xf0ed, + 0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee,0xf0ee, + 0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef,0xf0ef, + 0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0,0xf0f0, + 0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1,0xf0f1, + 0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2,0xf0f2, + 0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3,0xf0f3, + 0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4,0xf0f4, + 0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5,0xf0f5, +}; + +/*---------------------------------------------------------------------------* + 内部関数宣言 + *---------------------------------------------------------------------------*/ + +static void kamiFontReturnConsole( void ); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontInit(void) +{ + // 背景用キャラクタデータ + MI_CpuCopy32( &sampleCharData[8 * 0xde], sBackColorCharData, sizeof(sBackColorCharData) ); + + // 背景用スクリーンデータセット + DC_FlushRange ( sBackColorScreenData, sizeof(sBackColorScreenData) ); + GXS_LoadBG1Scr ( sBackColorScreenData, 0, sizeof(sBackColorScreenData) ); +} + +/*---------------------------------------------------------------------------* + Name: + + Description: + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontLoadScreenData(void) +{ + DC_FlushRange ( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); + GX_LoadBG0Scr ( sFontScreenDataMain, 0, sizeof(sFontScreenDataMain) ); + + DC_FlushRange ( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); + GXS_LoadBG0Scr ( sFontScreenDataSub, 0, sizeof(sFontScreenDataSub) ); + + // 背景キャラクタデータ書き換え + DC_FlushRange( sBackColorCharData, sizeof(sBackColorCharData) ); + GXS_LoadBG0Char( sBackColorCharData, 0xde*32, sizeof(sBackColorCharData) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClear + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClear(void) +{ + MI_CpuClear8( sFontScreenDataSub, sizeof(sFontScreenDataSub) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontClearMain + + Description: 仮想スクリーンをクリアする + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontClearMain(void) +{ + MI_CpuClear8( sFontScreenDataMain, sizeof(sFontScreenDataMain) ); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintf(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataSub[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintf + + Description: 仮想スクリーンに文字列を配置する。文字列は32文字まで。 + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfMain(s16 x, s16 y, u8 color, char *text, ...) +{ + va_list vlist; + char temp[32 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 33, text, vlist); + va_end(vlist); + + *(u16 *)(&temp[32]) = 0x0000; + for (i = 0;temp[i] != 0x00; i++) + { + sFontScreenDataMain[((y * 32) + x + i) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontFillChar + + Description: 仮想スクリーンに + + Arguments: x - 文字列の先頭を配置する x 座標( × 8 ドット )。 + y - 文字列の先頭を配置する y 座標( × 8 ドット )。 + color - 文字の色をパレット番号で指定。 + value + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontFillChar(int lineNo, u8 color1, u8 color2) +{ + s32 i; + u32 line; + int charNo = 0xde + lineNo; + + if (color1 < 0x10) + { + line = (u32)(0x11111111 * color1); + + for (i = 0;i<4; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } + + if (color2 < 0x10) + { + line = (u32)(0x11111111 * color2); + + for (i = 4;i<8; i++) + { + sBackColorCharData[8 * lineNo + i] = line; + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsole + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsole(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + s32 i; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + // 終端追加 + *(u16 *)(&temp[256]) = 0x0000; + + for(i=0; temp[i] != 0x00; i++) + { + if (temp[i] == 0x0A) + { + // 改行コード + kamiFontReturnConsole(); + } + else + { + // 一文字ずつ書き込み + sFontScreenDataMain[((sYPos * 32) + sXPos) % (24 * 32)] = + (u16)((color << SCREEN_DATA_COLOR_PLTT_SHIFT) | temp[i]); + + // X座標が右端に到達した場合は改行処理 + if (++sXPos >= 32) + { + kamiFontReturnConsole(); + } + } + } +} + +/*---------------------------------------------------------------------------* + Name: kamiFontPrintfConsoleEx + + Description: 仮想コンソールに文字列を配置する。文字列は256文字まで。 + OS_Printfもついでに実行する。 + + Arguments: color - 文字の色をパレット番号で指定。 + text - 配置する文字列。終端文字はNULL。 + ... - 仮想引数。 + + Returns: None. + *---------------------------------------------------------------------------*/ +void +kamiFontPrintfConsoleEx(u8 color, const char *text, ...) +{ + va_list vlist; + char temp[256 + 2]; + + va_start(vlist, text); + (void)vsnprintf(temp, 256, text, vlist); + va_end(vlist); + + kamiFontPrintfConsole(color, temp); + OS_TPrintf(temp); +} + +/*---------------------------------------------------------------------------* + Name: kamiFontReturnConsole + + Description: 仮想コンソールにおける改行処理を行う + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +kamiFontReturnConsole( void ) +{ + sXPos = 0; + if (sYPos < 23) + { + // 次の行へ + sYPos++; + } + else + { + // 既に最終行に到達している場合シフトを行う + MI_CpuCopy32( &sFontScreenDataMain[32], sFontScreenDataMain, sizeof(u16)*32*23 ); + MI_CpuClear32( &sFontScreenDataMain[32*23], sizeof(u16)*32); + } +} + diff --git a/build/tests/TestComponent/ARM9.TWL/src/kami_pxi.c b/build/tests/TestComponent/ARM9.TWL/src/kami_pxi.c new file mode 100644 index 00000000..eb6359ab --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/kami_pxi.c @@ -0,0 +1,743 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: kami_pxi.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_pxi.h" +#include "fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +// 詰めてコピーする +#define KAMI_PACK_U8(d, s) \ + ((d)[0] = (u8)((*((u8*)s) >> 0) & 0xFF)) + + +#define KAMI_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define KAMI_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef struct KamiWork +{ + BOOL lock; + + KamiCommand command; + KAMIPxiResult result; + KAMICallback callback; + void* arg; + + u32 total; + u32 current; + u8* data; +} +KamiWork; + +/*---------------------------------------------------------------------------* + 静的変数定義 + *---------------------------------------------------------------------------*/ +static BOOL kamiInitialized; +static KamiWork kamiWork; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data); +static void KamiSendPxiData(u8 *pData); +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void KamiDone(KAMIResult result); +static void KamiWaitBusy(void); + + +void KamiPxiInit( void ) +{ + kamiWork.lock = FALSE; + + PXI_Init(); + while ( !PXI_IsCallbackReady(PXI_FIFO_TAG_KAMITEST, PXI_PROC_ARM7 )) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_KAMITEST, KamiPxiCallback); + if ( 0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, KAMITEST_PXI_START_BIT | (KAMI_TEST_COMMAND << KAMITEST_PXI_COMMAND_SHIFT), 0)) + { + return; + } +} + + + +/////////////////////////////////////////////////////////////////// + +//typedef void (*KAMICallback)(KAMIResult result, void *arg); +/* +void CDC_ReadCallback(KAMIResult result, void* arg); +void CDC_ReadCallback(KAMIResult result, void* arg) +{ + +} +*/ + +/*---------------------------------------------------------------------------* + Name: フォーマット実行関数 + + Description: + + Arguments: FormatMode + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult ExeFormatAsync(FormatMode format_mode, KAMICallback callback) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = callback; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode) == FALSE) + { + return KAMI_RESULT_SEND_ERROR; + } + return KAMI_RESULT_SUCCESS; +} + +KAMIResult ExeFormat(FormatMode format_mode) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_EXE_FORMAT, 1, format_mode)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: NANDアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiNandIo(u32 block, void* buffer, u32 count, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &block); + KAMI_PACK_U32(&data[4], &buffer); + KAMI_PACK_U32(&data[8], &count); + + if (KamiSendPxiCommand(KAMI_NAND_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiMcuWriteFirm + + Description: MCUファーム更新関数 + + Arguments: buffer : new mcu data buffer + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiMcuWriteFirm(void* buffer ) +{ + OSIntrMode enabled; + u8 data[4+2]; // 3の倍数 + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + + // データ作成 + KAMI_PACK_U32(&data[0], &buffer); + + if (KamiSendPxiCommand(KAMI_MCU_WRITE_FIRM, 5, (u8)0)) + { + for (i = 0; i < 4; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: MCUアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiMcuIo(u32 reg_no, void* buffer, u32 value, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + if (is_read) + { + kamiWork.data = (u8*)buffer; + } + else + { + kamiWork.data = 0; + } + + // データ作成 + KAMI_PACK_U32(&data[0], ®_no); + KAMI_PACK_U32(&data[4], &value); + + if (KamiSendPxiCommand(KAMI_MCU_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CODECアクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiCodecIo(u8 page, u8 reg_no, u8* buffer, u8 value, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + if (is_read) + { + kamiWork.data = (u8*)buffer; + } + else + { + kamiWork.data = 0; + } + + // データ作成 + KAMI_PACK_U8(&data[0], &page); + KAMI_PACK_U8(&data[1], ®_no); + KAMI_PACK_U32(&data[4], &value); + + if (KamiSendPxiCommand(KAMI_CODEC_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: ARM7アクセス関数 + + Description: + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiARM7Io(u32 addr, u32* buffer, u32 value, BOOL is_read) +{ + OSIntrMode enabled; + u8 data[12]; + int i; + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + if (is_read) + { + kamiWork.data = (u8*)buffer; + } + else + { + kamiWork.data = 0; + } + + // データ作成 + KAMI_PACK_U32(&data[0], &addr); + KAMI_PACK_U32(&data[4], &value); + + if (KamiSendPxiCommand(KAMI_ARM7_IO, 13, (u8)is_read)) + { + for (i = 0; i < 12; i+=3) + { + KamiSendPxiData(&data[i]); + } + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiCDC_GoDsMode + + Description: CODECをDSモードへ遷移させる関数 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiCDC_GoDsMode( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CDC_GO_DSMODE, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiClearNandErrorLog + + Description: NVRAMのNANDエラー情報をクリアします。 + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiClearNandErrorLog( void ) +{ + OSIntrMode enabled; + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = 0; + + if (KamiSendPxiCommand(KAMI_CLEAR_NAND_ERRORLOG, 0, (u8)0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetCameraModuleTypesAsync + + Description: カメラモジュールタイプを取得します(非同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetCameraModuleTypesAsync( CameraModuleTypes *pTypes, KAMICallback callback, void* arg ) +{ + OSIntrMode enabled; + + if (pTypes == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = callback; + kamiWork.arg = arg; + kamiWork.data = (u8*)pTypes; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_CAMERA_MODULE_TYPE, 0, 0)) + { + return KAMI_RESULT_SUCCESS; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetCameraModuleTypes + + Description: カメラモジュールタイプを取得します(同期版) + + Arguments: None. + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetCameraModuleTypes( CameraModuleTypes *pTypes ) +{ + OSIntrMode enabled; + + if (pTypes == NULL) + { + return KAMI_RESULT_INVALID_PARAMETER; + } + + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)pTypes; + (void)OS_RestoreInterrupts(enabled); + + if (KamiSendPxiCommand(KAMI_GET_CAMERA_MODULE_TYPE, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: kamiGetNandCID + + Description: NANDのCIDを取得します。 + + Arguments: buffer : 16バイトバッファ + + Returns: + *---------------------------------------------------------------------------*/ + +KAMIResult kamiGetNandCID(void* buffer ) +{ + OSIntrMode enabled; + u8 data[4+2]; // 3の倍数 + + MI_CpuClear8( data, sizeof(data)); + + // ロック + enabled = OS_DisableInterrupts(); + if (kamiWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return KAMI_RESULT_BUSY; + } + kamiWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + + kamiWork.callback = NULL; + kamiWork.arg = 0; + kamiWork.data = (u8*)buffer; + + if (KamiSendPxiCommand(KAMI_GET_NAND_CID, 0, 0)) + { + KamiWaitBusy(); + return (KAMIResult)kamiWork.result; + } + + return KAMI_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + PXI関連 + *---------------------------------------------------------------------------*/ + +static BOOL KamiSendPxiCommand(KamiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(KAMITEST_PXI_START_BIT | + ((command << KAMITEST_PXI_COMMAND_SHIFT) & KAMITEST_PXI_COMMAND_MASK) | + ((size << KAMITEST_PXI_DATA_NUMS_SHIFT) & KAMITEST_PXI_DATA_NUMS_MASK) | + ((data << KAMITEST_PXI_1ST_DATA_SHIFT) & KAMITEST_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +static void KamiSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_KAMITEST, pxiData, 0)) + { + } +} + +static void KamiPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + if (err) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (data & KAMITEST_PXI_START_BIT) // 先頭データ + { + if (data & KAMITEST_PXI_RESULT_BIT) + { + kamiWork.total = (u8)((data & KAMITEST_PXI_DATA_NUMS_MASK) >> KAMITEST_PXI_DATA_NUMS_SHIFT); + kamiWork.current = 0; + kamiWork.command = (KamiCommand)((data & KAMITEST_PXI_COMMAND_MASK) >> KAMITEST_PXI_COMMAND_SHIFT); + kamiWork.result = (KAMIPxiResult)((data & KAMITEST_PXI_1ST_DATA_MASK) >> KAMITEST_PXI_1ST_DATA_SHIFT); + } + else // 未知のデータ + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + } + else // 後続データ + { + if (kamiWork.data == NULL) + { + KamiDone(KAMI_RESULT_FATAL_ERROR); + return; + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (kamiWork.current < kamiWork.total-1) + { + kamiWork.data[kamiWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + if (kamiWork.current == kamiWork.total-1) + { + KAMIResult result; + switch (kamiWork.result) + { + case KAMI_PXI_RESULT_SUCCESS: // alias KAMI_PXI_RESULT_SUCCESS_TRUE + result = KAMI_RESULT_SUCCESS; // alias KAMI_RESULT_SUCCESS_TRUE + break; + case KAMI_PXI_RESULT_SUCCESS_FALSE: + result = KAMI_RESULT_SUCCESS_FALSE; + break; + case KAMI_PXI_RESULT_INVALID_COMMAND: + result = KAMI_RESULT_INVALID_COMMAND; + break; + case KAMI_PXI_RESULT_INVALID_PARAMETER: + result = KAMI_RESULT_INVALID_PARAMETER; + break; + case KAMI_PXI_RESULT_ILLEGAL_STATUS: + result = KAMI_RESULT_ILLEGAL_STATUS; + break; + case KAMI_PXI_RESULT_BUSY: + result = KAMI_RESULT_BUSY; + break; + default: + result = KAMI_RESULT_FATAL_ERROR; + } + KamiDone(result); + return; + } +} + +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void KamiWaitBusy(void) +{ + volatile BOOL *p = &kamiWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} + +static void KamiDone(KAMIResult result) +{ + KAMICallback callback = kamiWork.callback; + void* arg = kamiWork.arg; + kamiWork.callback = NULL; + kamiWork.arg = NULL; + if (kamiWork.lock) + { + kamiWork.lock = FALSE; + } + if (callback) + { + callback(result, arg); + } +} diff --git a/build/tests/TestComponent/ARM9.TWL/src/keypad.c b/build/tests/TestComponent/ARM9.TWL/src/keypad.c new file mode 100644 index 00000000..155c4bc2 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/keypad.c @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: keypad.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 "keypad.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define KEY_REPEAT_TRIGGER_START 20 +#define KEY_REPEAT_TRIGGER_TERM 5 + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static u16 Cont; +static u16 Trg; +static u16 Release; +static u16 RepeatTrg; +static u8 key = 60; + +static int repeat_counter; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +void +kamiPadRead(void) +{ + u16 ReadData; + + ReadData = PAD_Read(); + Trg = (u16)(ReadData & (ReadData ^ Cont)); + Release = (u16)(Cont & (ReadData ^ Cont)); + Cont = ReadData; + + RepeatTrg = Trg; + if (++repeat_counter > (KEY_REPEAT_TRIGGER_START + KEY_REPEAT_TRIGGER_TERM)) + { + repeat_counter = KEY_REPEAT_TRIGGER_START; + } + if (repeat_counter == KEY_REPEAT_TRIGGER_START) + { + RepeatTrg = ReadData; + } + if (!ReadData) + { + repeat_counter = 0; + } +} + +BOOL +kamiPadIsTrigger(u16 key) +{ + return (Trg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsRepeatTrigger(u16 key) +{ + return (RepeatTrg & key)? TRUE : FALSE; +} + +BOOL +kamiPadIsPress(u16 key) +{ + return (Cont & key)? TRUE : FALSE; +} + diff --git a/build/tests/TestComponent/ARM9.TWL/src/main.c b/build/tests/TestComponent/ARM9.TWL/src/main.c new file mode 100644 index 00000000..64ca2f34 --- /dev/null +++ b/build/tests/TestComponent/ARM9.TWL/src/main.c @@ -0,0 +1,230 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - NandInitializer + File: main.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 "graphics.h" +#include "keypad.h" +#include "kami_pxi.h" + +#define SCRAMBLE_MASK 0x00406000 + +extern void HWInfoWriterInit( void ); + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ +typedef void* (*Process)(void); + +/*---------------------------------------------------------------------------* + 内部変数定義 + *---------------------------------------------------------------------------*/ + +static Process sProcess; +static FSEventHook sSDHook; + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ +static void VBlankIntr(void); +static void InitAllocation(void); + +static void* DummyProcess0(void) +{ + return DummyProcess0; +} + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void +TwlMain() +{ + // 製品ビルドランチャー&デバッガ上での起動対応 + if ( OS_GetRunningConsoleType() & OS_CONSOLE_TWLDEBUGGER ) + { + ROM_Header *dh = (void *)HW_ROM_HEADER_BUF; + dh->s.game_cmd_param &= ~SCRAMBLE_MASK; + } + + OS_Init(); + OS_InitTick(); + OS_InitArena(); + PXI_Init(); + OS_InitLock(); + OS_InitArenaEx(); + OS_InitIrqTable(); + OS_SetIrqStackChecker(); + MI_Init(); + OS_InitVAlarm(); + OSi_InitVramExclusive(); + OS_InitThread(); + OS_InitReset(); + GX_Init(); + FX_Init(); + SND_Init(); + SNDEX_Init(); + TP_Init(); + RTC_Init(); + +#ifndef NAND_INITIALIZER_LIMITED_MODE + KamiPxiInit(); /* 独自PXI初期化 */ +#endif + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrqMask(OS_IE_FIFO_RECV); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + + // initialize file-system + FS_Init(FS_DMA_NOT_USE); + + // FATドライバを初期化します。 + // NANDにアクセスするために必要です。 + // この関数はTwlSDK_branchUIGには含まれていません。 + FS_InitFatDriver(); + + // SDカードの挿抜イベント監視コールバック設定 +// FS_RegisterEventHook("sdmc", &sSDHook, SDEvents, NULL); + + // FS_Initの後の方が良い模様 + InitAllocation(); + + // 表示関連初期化 + InitGraphics(); + kamiFontInit(); + + /* always preload FS table for faster directory access. */ + { + u32 need_size = FS_GetTableSize(); + void *p_table = OS_Alloc(need_size); + SDK_ASSERT(p_table != NULL); + (void)FS_LoadTable(p_table, need_size); + } + + // 初期シーケンス設定 + sProcess = DummyProcess0; + + kamiFontPrintfConsole( CONSOLE_ORANGE, "This is Test Component\n"); + +#ifdef TWL_CAPTURE_VERSION + // memory-launcher経由で立ち上がるTWLCaptureSystemWriterでは + // RED_LAUNCHER_VERが0でフォーマットに失敗するので強制的に書き換える + MI_StoreLE8((void*)HW_TWL_RED_LAUNCHER_VER, 1); +#endif + +#ifdef AUTO_FORMAT_MODE +// 検査工程ではNANDが初期化されていないがその状態でFATにアクセスすると +// 問題があるため強制的にフォーマットを行う 2008/06/18 +// ExeFormat(FORMAT_MODE_QUICK); +// +// Secure情報を読み込む前にフォーマットしてしまうとSecure情報が消えてしまう。 +// そうするとシリアルNoが書き換わってしまうのでこの処理はなくす。 +// 検査工程と異なりNandInitializerが実行される段階ではフォーマット済みなはず。 +// 仮に未フォーマットであったとしてもBadFormat扱いとなる。2009/03/05 +#endif + + // NAMライブラリ初期化 + NAM_Init( OS_AllocFromMain, OS_FreeToMain); + NAMUT_Init( OS_AllocFromMain, OS_FreeToMain); + +/* +{ + u8 temp; + kamiCodecRead( 1, 31, &temp); + OS_Printf("temp = %x\n", temp); + kamiCodecWrite( 1, 31, (temp & 0x7f)); + kamiCodecRead( 1, 31, &temp); + OS_Printf("temp = %x\n", temp); + +} +*/ + + while (1) + { + kamiPadRead(); + + // コマンドフラッシュ +// (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + + // Vブランク待ち + OS_WaitVBlankIntr(); + + // ARM7コマンド応答受信 +// while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) +// { +// } + + // フォントスクリーンデータロード + kamiFontLoadScreenData(); + + sProcess = sProcess(); + } +} + +/*---------------------------------------------------------------------------* + Name: VBlankIntr + + Description: VBlank割り込み処理 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +/*---------------------------------------------------------------------------* + Name: InitAllocation + + Description: ヒープの初期化. + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void InitAllocation(void) +{ + void *tmp; + OSHeapHandle hh; + + /* アリーナの初期化 */ + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + OS_Panic("ARM9: Fail to create heap...\n"); + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + diff --git a/build/tests/TestComponent/Makefile b/build/tests/TestComponent/Makefile new file mode 100644 index 00000000..d593101e --- /dev/null +++ b/build/tests/TestComponent/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + banner \ + ARM7.TWL \ + ARM9.TWL \ + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/TestComponent/banner/Makefile b/build/tests/TestComponent/banner/Makefile new file mode 100644 index 00000000..e373c033 --- /dev/null +++ b/build/tests/TestComponent/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ICON_DIR = ./icon + +BANNER_ICON = $(ICON_DIR)/gameIcon.bmp +BANNER_SPEC = banner_v3.bsf + +TARGETS = banner.bnr +INSTALL_DIR = ./ +INSTALL_TARGETS = $(TARGETS) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) +BANNER_ICON_MIDDLE = $(addprefix $(BANNER_ICON_NAME), .nbfs .nbfc .nbfp) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_MIDDLE) \ + $(TARGETS:.bnr=.srl) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON) $(BANNER_ICON_MIDDLE) + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/TestComponent/banner/banner_v3.bsf b/build/tests/TestComponent/banner/banner_v3.bsf new file mode 100644 index 00000000..a86a720b Binary files /dev/null and b/build/tests/TestComponent/banner/banner_v3.bsf differ diff --git a/build/tests/TestComponent/banner/icon/gameIcon.bmp b/build/tests/TestComponent/banner/icon/gameIcon.bmp new file mode 100644 index 00000000..34909746 Binary files /dev/null and b/build/tests/TestComponent/banner/icon/gameIcon.bmp differ diff --git a/build/tests/TestComponent/common/include/fifo.h b/build/tests/TestComponent/common/include/fifo.h new file mode 100644 index 00000000..7e00b943 --- /dev/null +++ b/build/tests/TestComponent/common/include/fifo.h @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera-test - include + File: fifo.h + + Copyright 2007 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 TWL_KAMI_TEST_FIFO_H_ +#define TWL_KAMI_TEST_FIFO_H_ + +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define PXI_FIFO_TAG_KAMITEST PXI_FIFO_TAG_USER_1 + +#define KAMI_PXI_CONTINUOUS_PACKET_MAX 10 +#define KAMITEST_PXI_DATA_SIZE_MAX ((KAMI_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define KAMITEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define KAMITEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define KAMITEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define KAMITEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define KAMITEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define KAMITEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define KAMITEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 +#define KAMITEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum KAMIPxiResult +{ + KAMI_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + KAMI_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + KAMI_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + KAMI_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + KAMI_PXI_RESULT_ILLEGAL_STATUS, // KAMIの状態により処理を実行不可 + KAMI_PXI_RESULT_BUSY, // 他のリクエストを実行中 + KAMI_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + KAMI_PXI_RESULT_MAX +} +KAMIPxiResult; + + +typedef enum KamiCommand +{ + KAMI_TEST_COMMAND, + KAMI_EXE_FORMAT, + KAMI_NAND_IO, + KAMI_MCU_IO, + KAMI_MCU_WRITE_FIRM, + KAMI_ARM7_IO, + KAMI_CDC_GO_DSMODE, + KAMI_CLEAR_NAND_ERRORLOG, + KAMI_GET_CAMERA_MODULE_TYPE, + KAMI_GET_NAND_CID, + KAMI_CODEC_IO +} +KamiCommand; + + +typedef enum CameraModuleType +{ + CAMERA_MODULE_TYPE_UNKNOWN, + CAMERA_MODULE_TYPE_SHARP, + CAMERA_MODULE_TYPE_MICRON +} +CameraModuleType; + + +typedef struct CameraModuleTypes +{ + CameraModuleType in; + CameraModuleType out; +} +CameraModuleTypes; + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_KAMI_TEST_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/build/tests/TestMaker/Makefile b/build/tests/TestMaker/Makefile new file mode 100644 index 00000000..a4b0b349 --- /dev/null +++ b/build/tests/TestMaker/Makefile @@ -0,0 +1,241 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - GX - demos - UnitTours/3D_Shininess +# File: Makefile +# +# Copyright 2003 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$ +#---------------------------------------------------------------------------- + +ifeq ($(GAMECODE),) +#------------------------------------------------------------------------------------ +# sub make 起動 + +CONFIG = ./script/config.py +GENCLS = ./script/clsdir.py +GENFONT = ./script/fontcode.py +GENPARENTAL = ./script/parentalcontrol.py +FONTCODES = ./doc/20080617_DS_fontcodeList_NOE_FIANL.xls +CLSROMPARAM = ./config/romparam_forCLStest.yaml +PCROMPARAM = ./config/twl_parentalcontrol_spec.yaml +EULAROMPARAM = ./config/romparam_forEULAtest.yaml +SHOPROMPARAM = ./config/romparam_forShoptest.yaml +SAVEROMPARAM = ./config/romparam_forSavetest.yaml +FATFSPERMISSIONROMPARAM = ./config/romparam_forFATFSPermissiontest.yaml +BOOTROMPARAM = ./config/romparam_forBoottest.yaml +ROMPARAM = ./romparam.yaml +CODESLIST = ./codeslist + +-include $(CODESLIST) + +build: $(GAMECODES) + +.PHONY: $(GAMECODES) clean config clstest fonttest parentaltest + +#---- CLS テスト設定 +clstest: + cp -f $(CLSROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "CLS" + +#---- fontcode テスト設定 +fonttest: + $(GENFONT) $(FONTCODES) $(ROMPARAM) "Reverse" + $(CONFIG) $(ROMPARAM) $(CODESLIST) "FONT" + +#---- parentarlcontrol テスト設定 +parentaltest: + $(GENPARENTAL) $(PCROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "PARENTAL" + +#---- eula テスト設定 +eulatest: + cp -f $(EULAROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "EULA" + +#---- shop テスト設定 +shoptest: + cp -f $(SHOPROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "SHOP" + +#---- savedate テスト設定 +savetest: + cp -f $(SAVEROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "SAVE" + +#---- fatfspermissiontest テスト設定 +fatfspermissiontest: + cp -f $(FATFSPERMISSIONROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "FATFSPERMISSION" + +#---- boottest テスト設定 +boottest: + cp -f $(BOOTROMPARAM) $(ROMPARAM) + $(CONFIG) $(ROMPARAM) $(CODESLIST) "BOOT" + +#---- config +config: + $(CONFIG) $(ROMPARAM) $(CODESLIST) "DEFAULT" + +$(GAMECODES): $(CODESLIST) + install -d $@ && $(MAKE) -k -C $@ -f ../Makefile GAMECODE=$@ TEST_TYPE=$(TEST_TYPE) + +forcls: + $(GENCLS) $(ROMPARAM) + +clean: + rm -Rf $(GAMECODES) + rm -f $(CODESLIST) + rm -Rf roms + rm -Rf forCLS + +else +#------------------------------------------------------------------------------------ +# sub make 本体 + +SUBDIRS = + +#---- sysm_red_misc +MISC_DIR = ../../../systemMenu_RED/misc + +#---- default +BASEDIR = $(ROOT)/build/demos/os/consoleType-1 +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c font.c screen.c +BANNERSRC := $(wildcard ../banner/dummy/Cell/*.nce) +INSTALL_DIR = ../roms +MY_COMMONDEFS = $(TWLSDK_ROOT)/build/buildtools/commondefs \ + $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib +MY_MODULERULES = $(TWLSDK_ROOT)/build/buildtools/modulerules + +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +TWL_NANDAPP := TRUE + +ifeq ($(TEST_TYPE),CLS) +BASEDIR = $(ROOT)/build/demos/os/consoleType-1 +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c font.c screen.c +BANNERSRC := $(wildcard ../banner/dummy/Cell/*.nce) +endif + +ifeq ($(TEST_TYPE),FONT) +BASEDIR = $(ROOT)/build/demos/gx/UnitTours/3D_BoxTest +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c data.c +BANNERSRC := $(wildcard ../banner/font/Cell/*.nce) +endif + +ifeq ($(TEST_TYPE),PARENTAL) +BASEDIR = $(ROOT)/build/tests/ogntest/ +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c +BANNERSRC := $(wildcard ../banner/parental/Cell/*.nce) +endif + +ifeq ($(TEST_TYPE),EULA) +BASEDIR = $(ROOT)/build/demos/gx/UnitTours/3D_BoxTest +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c data.c +BANNERSRC := $(wildcard ../banner/eula/Cell/*.nce) +endif + +ifeq ($(TEST_TYPE),SHOP) +BASEDIR = $(ROOT)/build/tests/nandApp/40M +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = main.c +BANNERSRC := $(wildcard ../banner/shop/Cell/*.nce) +MAKEROM_ROMROOT = $(ROOT)/build/tests/nandApp/40M/rom_data +MAKEROM_ROMFILES = *.* +endif + +ifeq ($(TEST_TYPE),SAVE) +BASEDIR = $(ROOT)/build/tests/save_data/DisplayVersion +SRCDIR = $(BASEDIR)/src +INCDIR = $(BASEDIR)/include +SRCS = dataver.c font.c main.c menu.c screen.c +BANNERSRC := $(wildcard $(BASEDIR)/banner/data/Cell/*.nce) +endif + +ifeq ($(TEST_TYPE),FATFSPERMISSION) +TARGET_FIRM = SYSTEMMENU +BASEDIR = ../../RomTypeTest +SRCDIR = $(BASEDIR)/ARM9/src +INCDIR = $(BASEDIR)/ARM9/src $(MISC_DIR)/include +SRCS = main.c RomTypeTest.c $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c +BANNERSRC := $(wildcard ../banner/shop/Cell/*.nce) +INSTALL_DIR = $(BASEDIR)/test_roms +INSTALL_TARGETS += $(BINDIR)/twl_$(GAMECODE).$(INT_ROM_EXT) +MAKEROM_ROMROOT = ../../../systemMenu_RED/ +MAKEROM_ROMFILES = ./data/NTR_IPL_font_m.NFTR +MY_COMMONDEFS = $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MY_MODULERULES = $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +endif + +ifeq ($(TEST_TYPE),BOOT) +TARGET_FIRM = SYSTEMMENU +BASEDIR = ../../HashCheckTemplate +SUBDIRS = $(BASEDIR)/crt $(BASEDIR)/ARM7 +SRCDIR = $(BASEDIR)/ARM9/src +INCDIR = $(BASEDIR)/ARM9/src $(MISC_DIR)/include +SRCS = main.c HashCheckTemplate.c $(MISC_DIR)/src/misc.c $(MISC_DIR)/src/cmn.c +BANNERSRC := $(wildcard ../banner/shop/Cell/*.nce) +INSTALL_DIR = $(BASEDIR)/test_roms +INSTALL_TARGETS += $(BINDIR)/twl_$(GAMECODE).$(INT_ROM_EXT) +MAKEROM_ROMROOT = ../../../systemMenu_RED/ +MAKEROM_ROMFILES = ./data/NTR_IPL_font_m.NFTR +MY_COMMONDEFS = $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +MY_MODULERULES = $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules +endif + +BANNER = ./banner.bnr +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + +#---------------------------------------------------------------------------- + +TARGET_BIN = twl_$(GAMECODE).$(TARGET_SUFFIX) +ROM_SPEC = twl_$(GAMECODE).rsf + +#SRCDIR = # using default +#LCFILE = # using default + +INSTALL_TARGETS += $(BINDIR)/$(TARGET_BIN) + +include $(GAMECODE).param + +include $(MY_COMMONDEFS) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +$(TARGETS): $(BANNER) + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + +include $(MY_MODULERULES) + +# sub make 本体 +#------------------------------------------------------------------------------------ +endif + +#===== End of Makefile ===== diff --git a/build/tests/TestMaker/banner/dummy/Cell/Cell0.nce b/build/tests/TestMaker/banner/dummy/Cell/Cell0.nce new file mode 100644 index 00000000..becd7177 Binary files /dev/null and b/build/tests/TestMaker/banner/dummy/Cell/Cell0.nce differ diff --git a/build/tests/TestMaker/banner/dummy/Character/banner_anm_idea03_ALL.ncg b/build/tests/TestMaker/banner/dummy/Character/banner_anm_idea03_ALL.ncg new file mode 100644 index 00000000..383dda18 Binary files /dev/null and b/build/tests/TestMaker/banner/dummy/Character/banner_anm_idea03_ALL.ncg differ diff --git a/build/tests/TestMaker/banner/dummy/ColorPalette/banner_anm_idea03.ncl b/build/tests/TestMaker/banner/dummy/ColorPalette/banner_anm_idea03.ncl new file mode 100644 index 00000000..da867522 Binary files /dev/null and b/build/tests/TestMaker/banner/dummy/ColorPalette/banner_anm_idea03.ncl differ diff --git a/build/tests/TestMaker/banner/dummy/Preview/Preview0.npv b/build/tests/TestMaker/banner/dummy/Preview/Preview0.npv new file mode 100644 index 00000000..b57efd88 --- /dev/null +++ b/build/tests/TestMaker/banner/dummy/Preview/Preview0.npv @@ -0,0 +1,104 @@ +#PROPLIST.VER 100/LINE 103 +PreviewDetail_State = 0 +PreviewDetail_Version = 4 +PreviewDetail_Comment = +PreviewDetail_Bg_State = 18 +PreviewDetail_Bg_NormalPaletteFile_State = 9 +PreviewDetail_Bg_NormalPaletteFile_FileName = +PreviewDetail_Bg_NormalPaletteFile_DataSize = 0 +PreviewDetail_Bg_Screens = 1 +PreviewDetail_Bg_0000Screen_State = 0 +PreviewDetail_Bg_0000Screen_ScreenFile_State = 11 +PreviewDetail_Bg_0000Screen_ScreenFile_FileName = +PreviewDetail_Bg_0000Screen_ScreenFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_CharacterFile_State = 10 +PreviewDetail_Bg_0000Screen_CharacterFile_FileName = +PreviewDetail_Bg_0000Screen_CharacterFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_State = 9 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_FileName = +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_BgSurface = -1 +PreviewDetail_Bg_0000Screen_PositionX = 0 +PreviewDetail_Bg_0000Screen_PositionY = 0 +PreviewDetail_Bg_0000Screen_StartPositionX = 0 +PreviewDetail_Bg_0000Screen_StartPositionY = 0 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleX = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleY = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_Rotate = 0 +PreviewDetail_Bg_0000Screen_Priority = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeX = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeY = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeX = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeY = 0 +PreviewDetail_Bg_0000Screen_Comment = +PreviewDetail_Bg_3DPriority = 0 +PreviewDetail_Cell_State = 17921 +PreviewDetail_Cell_MultiCellFile_State = 13 +PreviewDetail_Cell_MultiCellFile_FileName = +PreviewDetail_Cell_MultiCellFile_DataSize = 0 +PreviewDetail_Cell_CellFile_State = 4 +PreviewDetail_Cell_CellFile_FileName = ..\Cell\Cell0.nce +PreviewDetail_Cell_CellFile_DataSize = 5108 +PreviewDetail_Cell_CharacterFile_State = 2 +PreviewDetail_Cell_CharacterFile_FileName = ..\Character\banner_anm_idea03_ALL.ncg +PreviewDetail_Cell_CharacterFile_DataSize = 4096 +PreviewDetail_Cell_ColorPaletteFile_State = 1 +PreviewDetail_Cell_ColorPaletteFile_FileName = ..\ColorPalette\banner_anm_idea03_1 のコピー.ncl +PreviewDetail_Cell_ColorPaletteFile_DataSize = 512 +PreviewDetail_Cell_Animations = 1 +PreviewDetail_Cell_0000Animation_State = 1 +PreviewDetail_Cell_0000Animation_LabelId = 0 +PreviewDetail_Cell_0000Animation_LabelName = CellAnime0 +PreviewDetail_Cell_0000Animation_PositionX = 128 +PreviewDetail_Cell_0000Animation_PositionY = 96 +PreviewDetail_Cell_0000Animation_Comment = +PreviewDetail_Rambank_State = 0 +PreviewDetail_Rambank_CharacterBaseOffset = 0 +PreviewDetail_Rambank_CharacterBaseBlock0 = 0 +PreviewDetail_Rambank_CharacterBaseBlock1 = 0 +PreviewDetail_Rambank_CharacterBaseBlock2 = 0 +PreviewDetail_Rambank_CharacterBaseBlock3 = 0 +PreviewDetail_Rambank_ScreenBaseOffset = 0 +PreviewDetail_Rambank_ScreenBaseBlock0 = 0 +PreviewDetail_Rambank_ScreenBaseBlock1 = 0 +PreviewDetail_Rambank_ScreenBaseBlock2 = 0 +PreviewDetail_Rambank_ScreenBaseBlock3 = 0 +PreviewDetail_Rambank_Vrams = 7 +PreviewDetail_Rambank_0000Vram_State = 58 +PreviewDetail_Rambank_0000Vram_CurrentSize = 4096 +PreviewDetail_Rambank_0000Vram_MaxSize = 131072 +PreviewDetail_Rambank_0001Vram_State = 56 +PreviewDetail_Rambank_0001Vram_CurrentSize = 0 +PreviewDetail_Rambank_0001Vram_MaxSize = 131072 +PreviewDetail_Rambank_0002Vram_State = 24 +PreviewDetail_Rambank_0002Vram_CurrentSize = 0 +PreviewDetail_Rambank_0002Vram_MaxSize = 131072 +PreviewDetail_Rambank_0003Vram_State = 24 +PreviewDetail_Rambank_0003Vram_CurrentSize = 0 +PreviewDetail_Rambank_0003Vram_MaxSize = 131072 +PreviewDetail_Rambank_0004Vram_State = 120 +PreviewDetail_Rambank_0004Vram_CurrentSize = 0 +PreviewDetail_Rambank_0004Vram_MaxSize = 65536 +PreviewDetail_Rambank_0005Vram_State = 248 +PreviewDetail_Rambank_0005Vram_CurrentSize = 0 +PreviewDetail_Rambank_0005Vram_MaxSize = 16384 +PreviewDetail_Rambank_0006Vram_State = 248 +PreviewDetail_Rambank_0006Vram_CurrentSize = 0 +PreviewDetail_Rambank_0006Vram_MaxSize = 16384 +PreviewDetail_Effect_State = 524288 +PreviewDetail_Effect_AlphaCoefficient0 = 0 +PreviewDetail_Effect_AlphaCoefficient1 = 0 +PreviewDetail_Effect_BrightCoefficient = 0 +PreviewDetail_Effect_BgMosaicSizeX = 0 +PreviewDetail_Effect_BgMosaicSizeY = 0 +PreviewDetail_Effect_ObjMosaicSizeX = 0 +PreviewDetail_Effect_ObjMosaicSizeY = 0 +PreviewDetail_Window_State = 32768 +PreviewDetail_Window_WindowRect0Left = 0 +PreviewDetail_Window_WindowRect0Right = 0 +PreviewDetail_Window_WindowRect0Top = 0 +PreviewDetail_Window_WindowRect0Bottom = 0 +PreviewDetail_Window_WindowRect1Left = 0 +PreviewDetail_Window_WindowRect1Right = 0 +PreviewDetail_Window_WindowRect1Top = 0 +PreviewDetail_Window_WindowRect1Bottom = 0 diff --git a/build/tests/TestMaker/banner/dummy/Scene/Scene0.nsn b/build/tests/TestMaker/banner/dummy/Scene/Scene0.nsn new file mode 100644 index 00000000..5a18ca2b --- /dev/null +++ b/build/tests/TestMaker/banner/dummy/Scene/Scene0.nsn @@ -0,0 +1,54 @@ +INTELLIGENT SYSTEMS Co.,Ltd. NITRO-CHARACTER layout format version 1.00 +#PROPLIST.VER 100/LINE 49 +FILE.VERSION = 1 +PALETTE.DOCUMENT0 = ..\ColorPalette\banner_anm_idea03.ncl +PALETTE.COUNT = 1 +PREVIEW.DOCUMENT0 = ..\Preview\Preview0.npv +PREVIEW.COUNT = 1 +CHARACTER.DOCUMENT0 = ..\Character\banner_anm_idea03_ALL.ncg +CHARACTER.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:177:87:1203:702 +CHARACTER.DOCUMENT0.FRAME0.LayerID = 2 +CHARACTER.DOCUMENT0.FRAME0.View0.Grid = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Mag = 6 +CHARACTER.DOCUMENT0.FRAME0.View0.Scroll = 542,0 +CHARACTER.DOCUMENT0.FRAMECOUNT = 1 +CHARACTER.COUNT = 1 +SCREEN.COUNT = 0 +OBJECT.DOCUMENT0 = ..\Cell\Cell0.nce +OBJECT.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:64:10:862:685 +OBJECT.DOCUMENT0.FRAME0.LayerID = 1 +OBJECT.DOCUMENT0.FRAME0.PaneWidth0 = 150 +OBJECT.DOCUMENT0.FRAME0.PaneWidth1 = 624 +OBJECT.DOCUMENT0.FRAME0.PaneWidth2 = 0 +OBJECT.DOCUMENT0.FRAME0.TreeWidth = 93 +OBJECT.DOCUMENT0.FRAME0.List.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.List.Cursor = 0,7 +OBJECT.DOCUMENT0.FRAME0.List.HeaderWidth = 64,256 +OBJECT.DOCUMENT0.FRAME0.View.Grid = 1 +OBJECT.DOCUMENT0.FRAME0.View.Mag = 4 +OBJECT.DOCUMENT0.FRAME0.View.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAME0.Tree.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.HeaderWidth = 30,30,32,32,25,30,20,33,20,60,38,30,21,33,35,20 +OBJECT.DOCUMENT0.FRAMETYPE0 = 1 +OBJECT.DOCUMENT0.FRAME1.WindowPlacement = 0:1:-1:-1:-1:-1:135:323:1085:976 +OBJECT.DOCUMENT0.FRAME1.LayerID = 0 +OBJECT.DOCUMENT0.FRAME1.ColumnSize0 = 231 +OBJECT.DOCUMENT0.FRAME1.ColumnSize1 = 113 +OBJECT.DOCUMENT0.FRAME1.ColumnSize2 = 546 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.HeaderWidth = 59,34,256 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.HeaderWidth = 43,37,40,40,40,40,40,256 +OBJECT.DOCUMENT0.FRAME1.Anime.Grid = 0 +OBJECT.DOCUMENT0.FRAME1.Anime.Mag = 4 +OBJECT.DOCUMENT0.FRAME1.Anime.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAMETYPE1 = 2 +OBJECT.DOCUMENT0.FRAMECOUNT = 2 +OBJECT.COUNT = 1 +MULTICELL.COUNT = 0 +NITRO-CHARACTER Scene format version 1.00 +#PROPLIST.VER 100/LINE 1 +Scene.Comment = diff --git a/build/tests/TestMaker/banner/dummy/workset.ini b/build/tests/TestMaker/banner/dummy/workset.ini new file mode 100644 index 00000000..75afb17d --- /dev/null +++ b/build/tests/TestMaker/banner/dummy/workset.ini @@ -0,0 +1,4 @@ +[LastScene] +File=Scene\Scene0.nsn +[Recent] +ExportFolder= diff --git a/build/tests/TestMaker/banner/eula/Cell/Cell0.nce b/build/tests/TestMaker/banner/eula/Cell/Cell0.nce new file mode 100644 index 00000000..ab3ba8fb Binary files /dev/null and b/build/tests/TestMaker/banner/eula/Cell/Cell0.nce differ diff --git a/build/tests/TestMaker/banner/eula/Character/eula.ncg b/build/tests/TestMaker/banner/eula/Character/eula.ncg new file mode 100644 index 00000000..b7de68cd Binary files /dev/null and b/build/tests/TestMaker/banner/eula/Character/eula.ncg differ diff --git a/build/tests/TestMaker/banner/eula/ColorPalette/eula.ncl b/build/tests/TestMaker/banner/eula/ColorPalette/eula.ncl new file mode 100644 index 00000000..99910793 Binary files /dev/null and b/build/tests/TestMaker/banner/eula/ColorPalette/eula.ncl differ diff --git a/build/tests/TestMaker/banner/eula/Preview/Preview0.npv b/build/tests/TestMaker/banner/eula/Preview/Preview0.npv new file mode 100644 index 00000000..2c89eced --- /dev/null +++ b/build/tests/TestMaker/banner/eula/Preview/Preview0.npv @@ -0,0 +1,104 @@ +#PROPLIST.VER 100/LINE 103 +PreviewDetail_State = 0 +PreviewDetail_Version = 4 +PreviewDetail_Comment = +PreviewDetail_Bg_State = 18 +PreviewDetail_Bg_NormalPaletteFile_State = 9 +PreviewDetail_Bg_NormalPaletteFile_FileName = +PreviewDetail_Bg_NormalPaletteFile_DataSize = 0 +PreviewDetail_Bg_Screens = 1 +PreviewDetail_Bg_0000Screen_State = 0 +PreviewDetail_Bg_0000Screen_ScreenFile_State = 11 +PreviewDetail_Bg_0000Screen_ScreenFile_FileName = +PreviewDetail_Bg_0000Screen_ScreenFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_CharacterFile_State = 10 +PreviewDetail_Bg_0000Screen_CharacterFile_FileName = +PreviewDetail_Bg_0000Screen_CharacterFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_State = 9 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_FileName = +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_BgSurface = -1 +PreviewDetail_Bg_0000Screen_PositionX = 0 +PreviewDetail_Bg_0000Screen_PositionY = 0 +PreviewDetail_Bg_0000Screen_StartPositionX = 0 +PreviewDetail_Bg_0000Screen_StartPositionY = 0 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleX = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleY = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_Rotate = 0 +PreviewDetail_Bg_0000Screen_Priority = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeX = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeY = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeX = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeY = 0 +PreviewDetail_Bg_0000Screen_Comment = +PreviewDetail_Bg_3DPriority = 0 +PreviewDetail_Cell_State = 17921 +PreviewDetail_Cell_MultiCellFile_State = 13 +PreviewDetail_Cell_MultiCellFile_FileName = +PreviewDetail_Cell_MultiCellFile_DataSize = 0 +PreviewDetail_Cell_CellFile_State = 4 +PreviewDetail_Cell_CellFile_FileName = ..\Cell\Cell0.nce +PreviewDetail_Cell_CellFile_DataSize = 5348 +PreviewDetail_Cell_CharacterFile_State = 2 +PreviewDetail_Cell_CharacterFile_FileName = ..\Character\eula.ncg +PreviewDetail_Cell_CharacterFile_DataSize = 4096 +PreviewDetail_Cell_ColorPaletteFile_State = 1 +PreviewDetail_Cell_ColorPaletteFile_FileName = ..\ColorPalette\eula.ncl +PreviewDetail_Cell_ColorPaletteFile_DataSize = 512 +PreviewDetail_Cell_Animations = 1 +PreviewDetail_Cell_0000Animation_State = 1 +PreviewDetail_Cell_0000Animation_LabelId = 0 +PreviewDetail_Cell_0000Animation_LabelName = CellAnime0 +PreviewDetail_Cell_0000Animation_PositionX = 128 +PreviewDetail_Cell_0000Animation_PositionY = 96 +PreviewDetail_Cell_0000Animation_Comment = +PreviewDetail_Rambank_State = 0 +PreviewDetail_Rambank_CharacterBaseOffset = 0 +PreviewDetail_Rambank_CharacterBaseBlock0 = 0 +PreviewDetail_Rambank_CharacterBaseBlock1 = 0 +PreviewDetail_Rambank_CharacterBaseBlock2 = 0 +PreviewDetail_Rambank_CharacterBaseBlock3 = 0 +PreviewDetail_Rambank_ScreenBaseOffset = 0 +PreviewDetail_Rambank_ScreenBaseBlock0 = 0 +PreviewDetail_Rambank_ScreenBaseBlock1 = 0 +PreviewDetail_Rambank_ScreenBaseBlock2 = 0 +PreviewDetail_Rambank_ScreenBaseBlock3 = 0 +PreviewDetail_Rambank_Vrams = 7 +PreviewDetail_Rambank_0000Vram_State = 58 +PreviewDetail_Rambank_0000Vram_CurrentSize = 4096 +PreviewDetail_Rambank_0000Vram_MaxSize = 131072 +PreviewDetail_Rambank_0001Vram_State = 56 +PreviewDetail_Rambank_0001Vram_CurrentSize = 0 +PreviewDetail_Rambank_0001Vram_MaxSize = 131072 +PreviewDetail_Rambank_0002Vram_State = 24 +PreviewDetail_Rambank_0002Vram_CurrentSize = 0 +PreviewDetail_Rambank_0002Vram_MaxSize = 131072 +PreviewDetail_Rambank_0003Vram_State = 24 +PreviewDetail_Rambank_0003Vram_CurrentSize = 0 +PreviewDetail_Rambank_0003Vram_MaxSize = 131072 +PreviewDetail_Rambank_0004Vram_State = 120 +PreviewDetail_Rambank_0004Vram_CurrentSize = 0 +PreviewDetail_Rambank_0004Vram_MaxSize = 65536 +PreviewDetail_Rambank_0005Vram_State = 248 +PreviewDetail_Rambank_0005Vram_CurrentSize = 0 +PreviewDetail_Rambank_0005Vram_MaxSize = 16384 +PreviewDetail_Rambank_0006Vram_State = 248 +PreviewDetail_Rambank_0006Vram_CurrentSize = 0 +PreviewDetail_Rambank_0006Vram_MaxSize = 16384 +PreviewDetail_Effect_State = 524288 +PreviewDetail_Effect_AlphaCoefficient0 = 0 +PreviewDetail_Effect_AlphaCoefficient1 = 0 +PreviewDetail_Effect_BrightCoefficient = 0 +PreviewDetail_Effect_BgMosaicSizeX = 0 +PreviewDetail_Effect_BgMosaicSizeY = 0 +PreviewDetail_Effect_ObjMosaicSizeX = 0 +PreviewDetail_Effect_ObjMosaicSizeY = 0 +PreviewDetail_Window_State = 32768 +PreviewDetail_Window_WindowRect0Left = 0 +PreviewDetail_Window_WindowRect0Right = 0 +PreviewDetail_Window_WindowRect0Top = 0 +PreviewDetail_Window_WindowRect0Bottom = 0 +PreviewDetail_Window_WindowRect1Left = 0 +PreviewDetail_Window_WindowRect1Right = 0 +PreviewDetail_Window_WindowRect1Top = 0 +PreviewDetail_Window_WindowRect1Bottom = 0 diff --git a/build/tests/TestMaker/banner/eula/Scene/Scene0.nsn b/build/tests/TestMaker/banner/eula/Scene/Scene0.nsn new file mode 100644 index 00000000..d447d80e --- /dev/null +++ b/build/tests/TestMaker/banner/eula/Scene/Scene0.nsn @@ -0,0 +1,54 @@ +INTELLIGENT SYSTEMS Co.,Ltd. NITRO-CHARACTER layout format version 1.00 +#PROPLIST.VER 100/LINE 49 +FILE.VERSION = 1 +PALETTE.DOCUMENT0 = ..\ColorPalette\eula.ncl +PALETTE.COUNT = 1 +PREVIEW.DOCUMENT0 = ..\Preview\Preview0.npv +PREVIEW.COUNT = 1 +CHARACTER.DOCUMENT0 = ..\Character\eula.ncg +CHARACTER.DOCUMENT0.FRAME0.WindowPlacement = 2:3:-1:-1:-4:-30:107:187:1251:751 +CHARACTER.DOCUMENT0.FRAME0.LayerID = 0 +CHARACTER.DOCUMENT0.FRAME0.View0.Grid = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Mag = 10 +CHARACTER.DOCUMENT0.FRAME0.View0.Scroll = 1329,0 +CHARACTER.DOCUMENT0.FRAMECOUNT = 1 +CHARACTER.COUNT = 1 +SCREEN.COUNT = 0 +OBJECT.DOCUMENT0 = ..\Cell\Cell0.nce +OBJECT.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:156:74:857:824 +OBJECT.DOCUMENT0.FRAME0.LayerID = 2 +OBJECT.DOCUMENT0.FRAME0.PaneWidth0 = 150 +OBJECT.DOCUMENT0.FRAME0.PaneWidth1 = 527 +OBJECT.DOCUMENT0.FRAME0.PaneWidth2 = 0 +OBJECT.DOCUMENT0.FRAME0.TreeWidth = 93 +OBJECT.DOCUMENT0.FRAME0.List.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.List.Cursor = 0,7 +OBJECT.DOCUMENT0.FRAME0.List.HeaderWidth = 64,256 +OBJECT.DOCUMENT0.FRAME0.View.Grid = 1 +OBJECT.DOCUMENT0.FRAME0.View.Mag = 4 +OBJECT.DOCUMENT0.FRAME0.View.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAME0.Tree.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.HeaderWidth = 30,30,32,32,25,30,20,33,20,60,38,30,21,33,35,20 +OBJECT.DOCUMENT0.FRAMETYPE0 = 1 +OBJECT.DOCUMENT0.FRAME1.WindowPlacement = 0:1:-1:-1:-4:-30:45:26:1239:777 +OBJECT.DOCUMENT0.FRAME1.LayerID = 1 +OBJECT.DOCUMENT0.FRAME1.ColumnSize0 = 231 +OBJECT.DOCUMENT0.FRAME1.ColumnSize1 = 284 +OBJECT.DOCUMENT0.FRAME1.ColumnSize2 = 636 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.HeaderWidth = 59,34,256 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.HeaderWidth = 43,37,40,40,40,40,40,256 +OBJECT.DOCUMENT0.FRAME1.Anime.Grid = 0 +OBJECT.DOCUMENT0.FRAME1.Anime.Mag = 4 +OBJECT.DOCUMENT0.FRAME1.Anime.Scroll = 832,0 +OBJECT.DOCUMENT0.FRAMETYPE1 = 2 +OBJECT.DOCUMENT0.FRAMECOUNT = 2 +OBJECT.COUNT = 1 +MULTICELL.COUNT = 0 +NITRO-CHARACTER Scene format version 1.00 +#PROPLIST.VER 100/LINE 1 +Scene.Comment = diff --git a/build/tests/TestMaker/banner/eula/workset.ini b/build/tests/TestMaker/banner/eula/workset.ini new file mode 100644 index 00000000..75afb17d --- /dev/null +++ b/build/tests/TestMaker/banner/eula/workset.ini @@ -0,0 +1,4 @@ +[LastScene] +File=Scene\Scene0.nsn +[Recent] +ExportFolder= diff --git a/build/tests/TestMaker/banner/font/Cell/Cell0.nce b/build/tests/TestMaker/banner/font/Cell/Cell0.nce new file mode 100644 index 00000000..ca5a3fb2 Binary files /dev/null and b/build/tests/TestMaker/banner/font/Cell/Cell0.nce differ diff --git a/build/tests/TestMaker/banner/font/Character/font.ncg b/build/tests/TestMaker/banner/font/Character/font.ncg new file mode 100644 index 00000000..428f74e1 Binary files /dev/null and b/build/tests/TestMaker/banner/font/Character/font.ncg differ diff --git a/build/tests/TestMaker/banner/font/ColorPalette/font.ncl b/build/tests/TestMaker/banner/font/ColorPalette/font.ncl new file mode 100644 index 00000000..99910793 Binary files /dev/null and b/build/tests/TestMaker/banner/font/ColorPalette/font.ncl differ diff --git a/build/tests/TestMaker/banner/font/Preview/Preview0.npv b/build/tests/TestMaker/banner/font/Preview/Preview0.npv new file mode 100644 index 00000000..2ee73f82 --- /dev/null +++ b/build/tests/TestMaker/banner/font/Preview/Preview0.npv @@ -0,0 +1,104 @@ +#PROPLIST.VER 100/LINE 103 +PreviewDetail_State = 0 +PreviewDetail_Version = 4 +PreviewDetail_Comment = +PreviewDetail_Bg_State = 18 +PreviewDetail_Bg_NormalPaletteFile_State = 9 +PreviewDetail_Bg_NormalPaletteFile_FileName = +PreviewDetail_Bg_NormalPaletteFile_DataSize = 0 +PreviewDetail_Bg_Screens = 1 +PreviewDetail_Bg_0000Screen_State = 0 +PreviewDetail_Bg_0000Screen_ScreenFile_State = 11 +PreviewDetail_Bg_0000Screen_ScreenFile_FileName = +PreviewDetail_Bg_0000Screen_ScreenFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_CharacterFile_State = 10 +PreviewDetail_Bg_0000Screen_CharacterFile_FileName = +PreviewDetail_Bg_0000Screen_CharacterFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_State = 9 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_FileName = +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_BgSurface = -1 +PreviewDetail_Bg_0000Screen_PositionX = 0 +PreviewDetail_Bg_0000Screen_PositionY = 0 +PreviewDetail_Bg_0000Screen_StartPositionX = 0 +PreviewDetail_Bg_0000Screen_StartPositionY = 0 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleX = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleY = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_Rotate = 0 +PreviewDetail_Bg_0000Screen_Priority = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeX = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeY = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeX = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeY = 0 +PreviewDetail_Bg_0000Screen_Comment = +PreviewDetail_Bg_3DPriority = 0 +PreviewDetail_Cell_State = 17921 +PreviewDetail_Cell_MultiCellFile_State = 13 +PreviewDetail_Cell_MultiCellFile_FileName = +PreviewDetail_Cell_MultiCellFile_DataSize = 0 +PreviewDetail_Cell_CellFile_State = 4 +PreviewDetail_Cell_CellFile_FileName = ..\Cell\Cell0.nce +PreviewDetail_Cell_CellFile_DataSize = 5360 +PreviewDetail_Cell_CharacterFile_State = 2 +PreviewDetail_Cell_CharacterFile_FileName = ..\Character\font.ncg +PreviewDetail_Cell_CharacterFile_DataSize = 4096 +PreviewDetail_Cell_ColorPaletteFile_State = 1 +PreviewDetail_Cell_ColorPaletteFile_FileName = ..\ColorPalette\font.ncl +PreviewDetail_Cell_ColorPaletteFile_DataSize = 512 +PreviewDetail_Cell_Animations = 1 +PreviewDetail_Cell_0000Animation_State = 1 +PreviewDetail_Cell_0000Animation_LabelId = 0 +PreviewDetail_Cell_0000Animation_LabelName = CellAnime0 +PreviewDetail_Cell_0000Animation_PositionX = 128 +PreviewDetail_Cell_0000Animation_PositionY = 96 +PreviewDetail_Cell_0000Animation_Comment = +PreviewDetail_Rambank_State = 0 +PreviewDetail_Rambank_CharacterBaseOffset = 0 +PreviewDetail_Rambank_CharacterBaseBlock0 = 0 +PreviewDetail_Rambank_CharacterBaseBlock1 = 0 +PreviewDetail_Rambank_CharacterBaseBlock2 = 0 +PreviewDetail_Rambank_CharacterBaseBlock3 = 0 +PreviewDetail_Rambank_ScreenBaseOffset = 0 +PreviewDetail_Rambank_ScreenBaseBlock0 = 0 +PreviewDetail_Rambank_ScreenBaseBlock1 = 0 +PreviewDetail_Rambank_ScreenBaseBlock2 = 0 +PreviewDetail_Rambank_ScreenBaseBlock3 = 0 +PreviewDetail_Rambank_Vrams = 7 +PreviewDetail_Rambank_0000Vram_State = 58 +PreviewDetail_Rambank_0000Vram_CurrentSize = 4096 +PreviewDetail_Rambank_0000Vram_MaxSize = 131072 +PreviewDetail_Rambank_0001Vram_State = 56 +PreviewDetail_Rambank_0001Vram_CurrentSize = 0 +PreviewDetail_Rambank_0001Vram_MaxSize = 131072 +PreviewDetail_Rambank_0002Vram_State = 24 +PreviewDetail_Rambank_0002Vram_CurrentSize = 0 +PreviewDetail_Rambank_0002Vram_MaxSize = 131072 +PreviewDetail_Rambank_0003Vram_State = 24 +PreviewDetail_Rambank_0003Vram_CurrentSize = 0 +PreviewDetail_Rambank_0003Vram_MaxSize = 131072 +PreviewDetail_Rambank_0004Vram_State = 120 +PreviewDetail_Rambank_0004Vram_CurrentSize = 0 +PreviewDetail_Rambank_0004Vram_MaxSize = 65536 +PreviewDetail_Rambank_0005Vram_State = 248 +PreviewDetail_Rambank_0005Vram_CurrentSize = 0 +PreviewDetail_Rambank_0005Vram_MaxSize = 16384 +PreviewDetail_Rambank_0006Vram_State = 248 +PreviewDetail_Rambank_0006Vram_CurrentSize = 0 +PreviewDetail_Rambank_0006Vram_MaxSize = 16384 +PreviewDetail_Effect_State = 524288 +PreviewDetail_Effect_AlphaCoefficient0 = 0 +PreviewDetail_Effect_AlphaCoefficient1 = 0 +PreviewDetail_Effect_BrightCoefficient = 0 +PreviewDetail_Effect_BgMosaicSizeX = 0 +PreviewDetail_Effect_BgMosaicSizeY = 0 +PreviewDetail_Effect_ObjMosaicSizeX = 0 +PreviewDetail_Effect_ObjMosaicSizeY = 0 +PreviewDetail_Window_State = 32768 +PreviewDetail_Window_WindowRect0Left = 0 +PreviewDetail_Window_WindowRect0Right = 0 +PreviewDetail_Window_WindowRect0Top = 0 +PreviewDetail_Window_WindowRect0Bottom = 0 +PreviewDetail_Window_WindowRect1Left = 0 +PreviewDetail_Window_WindowRect1Right = 0 +PreviewDetail_Window_WindowRect1Top = 0 +PreviewDetail_Window_WindowRect1Bottom = 0 diff --git a/build/tests/TestMaker/banner/font/Scene/Scene0.nsn b/build/tests/TestMaker/banner/font/Scene/Scene0.nsn new file mode 100644 index 00000000..59c312c0 --- /dev/null +++ b/build/tests/TestMaker/banner/font/Scene/Scene0.nsn @@ -0,0 +1,54 @@ +INTELLIGENT SYSTEMS Co.,Ltd. NITRO-CHARACTER layout format version 1.00 +#PROPLIST.VER 100/LINE 49 +FILE.VERSION = 1 +PALETTE.DOCUMENT0 = ..\ColorPalette\font.ncl +PALETTE.COUNT = 1 +PREVIEW.DOCUMENT0 = ..\Preview\Preview0.npv +PREVIEW.COUNT = 1 +CHARACTER.DOCUMENT0 = ..\Character\font.ncg +CHARACTER.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-4:-30:107:187:1251:751 +CHARACTER.DOCUMENT0.FRAME0.LayerID = 0 +CHARACTER.DOCUMENT0.FRAME0.View0.Grid = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Mag = 2 +CHARACTER.DOCUMENT0.FRAME0.View0.Scroll = 0,0 +CHARACTER.DOCUMENT0.FRAMECOUNT = 1 +CHARACTER.COUNT = 1 +SCREEN.COUNT = 0 +OBJECT.DOCUMENT0 = ..\Cell\Cell0.nce +OBJECT.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:156:74:857:824 +OBJECT.DOCUMENT0.FRAME0.LayerID = 2 +OBJECT.DOCUMENT0.FRAME0.PaneWidth0 = 150 +OBJECT.DOCUMENT0.FRAME0.PaneWidth1 = 527 +OBJECT.DOCUMENT0.FRAME0.PaneWidth2 = 0 +OBJECT.DOCUMENT0.FRAME0.TreeWidth = 93 +OBJECT.DOCUMENT0.FRAME0.List.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.List.Cursor = 0,7 +OBJECT.DOCUMENT0.FRAME0.List.HeaderWidth = 64,256 +OBJECT.DOCUMENT0.FRAME0.View.Grid = 1 +OBJECT.DOCUMENT0.FRAME0.View.Mag = 4 +OBJECT.DOCUMENT0.FRAME0.View.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAME0.Tree.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.HeaderWidth = 30,30,32,32,25,30,20,33,20,60,38,30,21,33,35,20 +OBJECT.DOCUMENT0.FRAMETYPE0 = 1 +OBJECT.DOCUMENT0.FRAME1.WindowPlacement = 0:1:-1:-1:-4:-30:45:26:1239:777 +OBJECT.DOCUMENT0.FRAME1.LayerID = 1 +OBJECT.DOCUMENT0.FRAME1.ColumnSize0 = 231 +OBJECT.DOCUMENT0.FRAME1.ColumnSize1 = 284 +OBJECT.DOCUMENT0.FRAME1.ColumnSize2 = 636 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.HeaderWidth = 59,34,256 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.HeaderWidth = 43,37,40,40,40,40,40,256 +OBJECT.DOCUMENT0.FRAME1.Anime.Grid = 0 +OBJECT.DOCUMENT0.FRAME1.Anime.Mag = 4 +OBJECT.DOCUMENT0.FRAME1.Anime.Scroll = 832,0 +OBJECT.DOCUMENT0.FRAMETYPE1 = 2 +OBJECT.DOCUMENT0.FRAMECOUNT = 2 +OBJECT.COUNT = 1 +MULTICELL.COUNT = 0 +NITRO-CHARACTER Scene format version 1.00 +#PROPLIST.VER 100/LINE 1 +Scene.Comment = diff --git a/build/tests/TestMaker/banner/font/workset.ini b/build/tests/TestMaker/banner/font/workset.ini new file mode 100644 index 00000000..75afb17d --- /dev/null +++ b/build/tests/TestMaker/banner/font/workset.ini @@ -0,0 +1,4 @@ +[LastScene] +File=Scene\Scene0.nsn +[Recent] +ExportFolder= diff --git a/build/tests/TestMaker/banner/parental/Cell/Cell0.nce b/build/tests/TestMaker/banner/parental/Cell/Cell0.nce new file mode 100644 index 00000000..32c9539e Binary files /dev/null and b/build/tests/TestMaker/banner/parental/Cell/Cell0.nce differ diff --git a/build/tests/TestMaker/banner/parental/Character/parental_control.ncg b/build/tests/TestMaker/banner/parental/Character/parental_control.ncg new file mode 100644 index 00000000..ae83167b Binary files /dev/null and b/build/tests/TestMaker/banner/parental/Character/parental_control.ncg differ diff --git a/build/tests/TestMaker/banner/parental/ColorPalette/parental_control.ncl b/build/tests/TestMaker/banner/parental/ColorPalette/parental_control.ncl new file mode 100644 index 00000000..99910793 Binary files /dev/null and b/build/tests/TestMaker/banner/parental/ColorPalette/parental_control.ncl differ diff --git a/build/tests/TestMaker/banner/parental/Preview/Preview0.npv b/build/tests/TestMaker/banner/parental/Preview/Preview0.npv new file mode 100644 index 00000000..b57efd88 --- /dev/null +++ b/build/tests/TestMaker/banner/parental/Preview/Preview0.npv @@ -0,0 +1,104 @@ +#PROPLIST.VER 100/LINE 103 +PreviewDetail_State = 0 +PreviewDetail_Version = 4 +PreviewDetail_Comment = +PreviewDetail_Bg_State = 18 +PreviewDetail_Bg_NormalPaletteFile_State = 9 +PreviewDetail_Bg_NormalPaletteFile_FileName = +PreviewDetail_Bg_NormalPaletteFile_DataSize = 0 +PreviewDetail_Bg_Screens = 1 +PreviewDetail_Bg_0000Screen_State = 0 +PreviewDetail_Bg_0000Screen_ScreenFile_State = 11 +PreviewDetail_Bg_0000Screen_ScreenFile_FileName = +PreviewDetail_Bg_0000Screen_ScreenFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_CharacterFile_State = 10 +PreviewDetail_Bg_0000Screen_CharacterFile_FileName = +PreviewDetail_Bg_0000Screen_CharacterFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_State = 9 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_FileName = +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_BgSurface = -1 +PreviewDetail_Bg_0000Screen_PositionX = 0 +PreviewDetail_Bg_0000Screen_PositionY = 0 +PreviewDetail_Bg_0000Screen_StartPositionX = 0 +PreviewDetail_Bg_0000Screen_StartPositionY = 0 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleX = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleY = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_Rotate = 0 +PreviewDetail_Bg_0000Screen_Priority = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeX = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeY = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeX = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeY = 0 +PreviewDetail_Bg_0000Screen_Comment = +PreviewDetail_Bg_3DPriority = 0 +PreviewDetail_Cell_State = 17921 +PreviewDetail_Cell_MultiCellFile_State = 13 +PreviewDetail_Cell_MultiCellFile_FileName = +PreviewDetail_Cell_MultiCellFile_DataSize = 0 +PreviewDetail_Cell_CellFile_State = 4 +PreviewDetail_Cell_CellFile_FileName = ..\Cell\Cell0.nce +PreviewDetail_Cell_CellFile_DataSize = 5108 +PreviewDetail_Cell_CharacterFile_State = 2 +PreviewDetail_Cell_CharacterFile_FileName = ..\Character\banner_anm_idea03_ALL.ncg +PreviewDetail_Cell_CharacterFile_DataSize = 4096 +PreviewDetail_Cell_ColorPaletteFile_State = 1 +PreviewDetail_Cell_ColorPaletteFile_FileName = ..\ColorPalette\banner_anm_idea03_1 のコピー.ncl +PreviewDetail_Cell_ColorPaletteFile_DataSize = 512 +PreviewDetail_Cell_Animations = 1 +PreviewDetail_Cell_0000Animation_State = 1 +PreviewDetail_Cell_0000Animation_LabelId = 0 +PreviewDetail_Cell_0000Animation_LabelName = CellAnime0 +PreviewDetail_Cell_0000Animation_PositionX = 128 +PreviewDetail_Cell_0000Animation_PositionY = 96 +PreviewDetail_Cell_0000Animation_Comment = +PreviewDetail_Rambank_State = 0 +PreviewDetail_Rambank_CharacterBaseOffset = 0 +PreviewDetail_Rambank_CharacterBaseBlock0 = 0 +PreviewDetail_Rambank_CharacterBaseBlock1 = 0 +PreviewDetail_Rambank_CharacterBaseBlock2 = 0 +PreviewDetail_Rambank_CharacterBaseBlock3 = 0 +PreviewDetail_Rambank_ScreenBaseOffset = 0 +PreviewDetail_Rambank_ScreenBaseBlock0 = 0 +PreviewDetail_Rambank_ScreenBaseBlock1 = 0 +PreviewDetail_Rambank_ScreenBaseBlock2 = 0 +PreviewDetail_Rambank_ScreenBaseBlock3 = 0 +PreviewDetail_Rambank_Vrams = 7 +PreviewDetail_Rambank_0000Vram_State = 58 +PreviewDetail_Rambank_0000Vram_CurrentSize = 4096 +PreviewDetail_Rambank_0000Vram_MaxSize = 131072 +PreviewDetail_Rambank_0001Vram_State = 56 +PreviewDetail_Rambank_0001Vram_CurrentSize = 0 +PreviewDetail_Rambank_0001Vram_MaxSize = 131072 +PreviewDetail_Rambank_0002Vram_State = 24 +PreviewDetail_Rambank_0002Vram_CurrentSize = 0 +PreviewDetail_Rambank_0002Vram_MaxSize = 131072 +PreviewDetail_Rambank_0003Vram_State = 24 +PreviewDetail_Rambank_0003Vram_CurrentSize = 0 +PreviewDetail_Rambank_0003Vram_MaxSize = 131072 +PreviewDetail_Rambank_0004Vram_State = 120 +PreviewDetail_Rambank_0004Vram_CurrentSize = 0 +PreviewDetail_Rambank_0004Vram_MaxSize = 65536 +PreviewDetail_Rambank_0005Vram_State = 248 +PreviewDetail_Rambank_0005Vram_CurrentSize = 0 +PreviewDetail_Rambank_0005Vram_MaxSize = 16384 +PreviewDetail_Rambank_0006Vram_State = 248 +PreviewDetail_Rambank_0006Vram_CurrentSize = 0 +PreviewDetail_Rambank_0006Vram_MaxSize = 16384 +PreviewDetail_Effect_State = 524288 +PreviewDetail_Effect_AlphaCoefficient0 = 0 +PreviewDetail_Effect_AlphaCoefficient1 = 0 +PreviewDetail_Effect_BrightCoefficient = 0 +PreviewDetail_Effect_BgMosaicSizeX = 0 +PreviewDetail_Effect_BgMosaicSizeY = 0 +PreviewDetail_Effect_ObjMosaicSizeX = 0 +PreviewDetail_Effect_ObjMosaicSizeY = 0 +PreviewDetail_Window_State = 32768 +PreviewDetail_Window_WindowRect0Left = 0 +PreviewDetail_Window_WindowRect0Right = 0 +PreviewDetail_Window_WindowRect0Top = 0 +PreviewDetail_Window_WindowRect0Bottom = 0 +PreviewDetail_Window_WindowRect1Left = 0 +PreviewDetail_Window_WindowRect1Right = 0 +PreviewDetail_Window_WindowRect1Top = 0 +PreviewDetail_Window_WindowRect1Bottom = 0 diff --git a/build/tests/TestMaker/banner/parental/Scene/Scene0.nsn b/build/tests/TestMaker/banner/parental/Scene/Scene0.nsn new file mode 100644 index 00000000..2872adb9 --- /dev/null +++ b/build/tests/TestMaker/banner/parental/Scene/Scene0.nsn @@ -0,0 +1,54 @@ +INTELLIGENT SYSTEMS Co.,Ltd. NITRO-CHARACTER layout format version 1.00 +#PROPLIST.VER 100/LINE 49 +FILE.VERSION = 1 +PALETTE.DOCUMENT0 = ..\ColorPalette\parental_control.ncl +PALETTE.COUNT = 1 +PREVIEW.DOCUMENT0 = ..\Preview\Preview0.npv +PREVIEW.COUNT = 1 +CHARACTER.DOCUMENT0 = ..\Character\parental_control.ncg +CHARACTER.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-4:-30:404:56:1548:620 +CHARACTER.DOCUMENT0.FRAME0.LayerID = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Grid = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Mag = 4 +CHARACTER.DOCUMENT0.FRAME0.View0.Scroll = 0,0 +CHARACTER.DOCUMENT0.FRAMECOUNT = 1 +CHARACTER.COUNT = 1 +SCREEN.COUNT = 0 +OBJECT.DOCUMENT0 = ..\Cell\Cell0.nce +OBJECT.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:275:56:852:806 +OBJECT.DOCUMENT0.FRAME0.LayerID = 2 +OBJECT.DOCUMENT0.FRAME0.PaneWidth0 = 150 +OBJECT.DOCUMENT0.FRAME0.PaneWidth1 = 403 +OBJECT.DOCUMENT0.FRAME0.PaneWidth2 = 0 +OBJECT.DOCUMENT0.FRAME0.TreeWidth = 93 +OBJECT.DOCUMENT0.FRAME0.List.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.List.Cursor = 0,7 +OBJECT.DOCUMENT0.FRAME0.List.HeaderWidth = 64,256 +OBJECT.DOCUMENT0.FRAME0.View.Grid = 1 +OBJECT.DOCUMENT0.FRAME0.View.Mag = 4 +OBJECT.DOCUMENT0.FRAME0.View.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAME0.Tree.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.HeaderWidth = 30,30,32,32,25,30,20,33,20,60,38,30,21,33,35,20 +OBJECT.DOCUMENT0.FRAMETYPE0 = 1 +OBJECT.DOCUMENT0.FRAME1.WindowPlacement = 0:1:-1:-1:-4:-30:12:111:1206:862 +OBJECT.DOCUMENT0.FRAME1.LayerID = 0 +OBJECT.DOCUMENT0.FRAME1.ColumnSize0 = 231 +OBJECT.DOCUMENT0.FRAME1.ColumnSize1 = 284 +OBJECT.DOCUMENT0.FRAME1.ColumnSize2 = 636 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.HeaderWidth = 59,34,256 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Cursor = 1,6 +OBJECT.DOCUMENT0.FRAME1.AnimeView.HeaderWidth = 43,37,40,40,40,40,40,256 +OBJECT.DOCUMENT0.FRAME1.Anime.Grid = 0 +OBJECT.DOCUMENT0.FRAME1.Anime.Mag = 4 +OBJECT.DOCUMENT0.FRAME1.Anime.Scroll = 832,0 +OBJECT.DOCUMENT0.FRAMETYPE1 = 2 +OBJECT.DOCUMENT0.FRAMECOUNT = 2 +OBJECT.COUNT = 1 +MULTICELL.COUNT = 0 +NITRO-CHARACTER Scene format version 1.00 +#PROPLIST.VER 100/LINE 1 +Scene.Comment = diff --git a/build/tests/TestMaker/banner/parental/workset.ini b/build/tests/TestMaker/banner/parental/workset.ini new file mode 100644 index 00000000..75afb17d --- /dev/null +++ b/build/tests/TestMaker/banner/parental/workset.ini @@ -0,0 +1,4 @@ +[LastScene] +File=Scene\Scene0.nsn +[Recent] +ExportFolder= diff --git a/build/tests/TestMaker/banner/shop/Cell/Cell0.nce b/build/tests/TestMaker/banner/shop/Cell/Cell0.nce new file mode 100644 index 00000000..becd7177 Binary files /dev/null and b/build/tests/TestMaker/banner/shop/Cell/Cell0.nce differ diff --git a/build/tests/TestMaker/banner/shop/Character/banner_anm_idea03_ALL.ncg b/build/tests/TestMaker/banner/shop/Character/banner_anm_idea03_ALL.ncg new file mode 100644 index 00000000..383dda18 Binary files /dev/null and b/build/tests/TestMaker/banner/shop/Character/banner_anm_idea03_ALL.ncg differ diff --git a/build/tests/TestMaker/banner/shop/ColorPalette/banner_anm_idea03.ncl b/build/tests/TestMaker/banner/shop/ColorPalette/banner_anm_idea03.ncl new file mode 100644 index 00000000..da867522 Binary files /dev/null and b/build/tests/TestMaker/banner/shop/ColorPalette/banner_anm_idea03.ncl differ diff --git a/build/tests/TestMaker/banner/shop/Preview/Preview0.npv b/build/tests/TestMaker/banner/shop/Preview/Preview0.npv new file mode 100644 index 00000000..b57efd88 --- /dev/null +++ b/build/tests/TestMaker/banner/shop/Preview/Preview0.npv @@ -0,0 +1,104 @@ +#PROPLIST.VER 100/LINE 103 +PreviewDetail_State = 0 +PreviewDetail_Version = 4 +PreviewDetail_Comment = +PreviewDetail_Bg_State = 18 +PreviewDetail_Bg_NormalPaletteFile_State = 9 +PreviewDetail_Bg_NormalPaletteFile_FileName = +PreviewDetail_Bg_NormalPaletteFile_DataSize = 0 +PreviewDetail_Bg_Screens = 1 +PreviewDetail_Bg_0000Screen_State = 0 +PreviewDetail_Bg_0000Screen_ScreenFile_State = 11 +PreviewDetail_Bg_0000Screen_ScreenFile_FileName = +PreviewDetail_Bg_0000Screen_ScreenFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_CharacterFile_State = 10 +PreviewDetail_Bg_0000Screen_CharacterFile_FileName = +PreviewDetail_Bg_0000Screen_CharacterFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_State = 9 +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_FileName = +PreviewDetail_Bg_0000Screen_ExtendPaletteFile_DataSize = 0 +PreviewDetail_Bg_0000Screen_BgSurface = -1 +PreviewDetail_Bg_0000Screen_PositionX = 0 +PreviewDetail_Bg_0000Screen_PositionY = 0 +PreviewDetail_Bg_0000Screen_StartPositionX = 0 +PreviewDetail_Bg_0000Screen_StartPositionY = 0 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleX = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_ScaleY = 1.00 +PreviewDetail_Bg_0000Screen_AffineParam_Rotate = 0 +PreviewDetail_Bg_0000Screen_Priority = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeX = 0 +PreviewDetail_Bg_0000Screen_ScreenSizeY = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeX = 0 +PreviewDetail_Bg_0000Screen_CharacterSizeY = 0 +PreviewDetail_Bg_0000Screen_Comment = +PreviewDetail_Bg_3DPriority = 0 +PreviewDetail_Cell_State = 17921 +PreviewDetail_Cell_MultiCellFile_State = 13 +PreviewDetail_Cell_MultiCellFile_FileName = +PreviewDetail_Cell_MultiCellFile_DataSize = 0 +PreviewDetail_Cell_CellFile_State = 4 +PreviewDetail_Cell_CellFile_FileName = ..\Cell\Cell0.nce +PreviewDetail_Cell_CellFile_DataSize = 5108 +PreviewDetail_Cell_CharacterFile_State = 2 +PreviewDetail_Cell_CharacterFile_FileName = ..\Character\banner_anm_idea03_ALL.ncg +PreviewDetail_Cell_CharacterFile_DataSize = 4096 +PreviewDetail_Cell_ColorPaletteFile_State = 1 +PreviewDetail_Cell_ColorPaletteFile_FileName = ..\ColorPalette\banner_anm_idea03_1 のコピー.ncl +PreviewDetail_Cell_ColorPaletteFile_DataSize = 512 +PreviewDetail_Cell_Animations = 1 +PreviewDetail_Cell_0000Animation_State = 1 +PreviewDetail_Cell_0000Animation_LabelId = 0 +PreviewDetail_Cell_0000Animation_LabelName = CellAnime0 +PreviewDetail_Cell_0000Animation_PositionX = 128 +PreviewDetail_Cell_0000Animation_PositionY = 96 +PreviewDetail_Cell_0000Animation_Comment = +PreviewDetail_Rambank_State = 0 +PreviewDetail_Rambank_CharacterBaseOffset = 0 +PreviewDetail_Rambank_CharacterBaseBlock0 = 0 +PreviewDetail_Rambank_CharacterBaseBlock1 = 0 +PreviewDetail_Rambank_CharacterBaseBlock2 = 0 +PreviewDetail_Rambank_CharacterBaseBlock3 = 0 +PreviewDetail_Rambank_ScreenBaseOffset = 0 +PreviewDetail_Rambank_ScreenBaseBlock0 = 0 +PreviewDetail_Rambank_ScreenBaseBlock1 = 0 +PreviewDetail_Rambank_ScreenBaseBlock2 = 0 +PreviewDetail_Rambank_ScreenBaseBlock3 = 0 +PreviewDetail_Rambank_Vrams = 7 +PreviewDetail_Rambank_0000Vram_State = 58 +PreviewDetail_Rambank_0000Vram_CurrentSize = 4096 +PreviewDetail_Rambank_0000Vram_MaxSize = 131072 +PreviewDetail_Rambank_0001Vram_State = 56 +PreviewDetail_Rambank_0001Vram_CurrentSize = 0 +PreviewDetail_Rambank_0001Vram_MaxSize = 131072 +PreviewDetail_Rambank_0002Vram_State = 24 +PreviewDetail_Rambank_0002Vram_CurrentSize = 0 +PreviewDetail_Rambank_0002Vram_MaxSize = 131072 +PreviewDetail_Rambank_0003Vram_State = 24 +PreviewDetail_Rambank_0003Vram_CurrentSize = 0 +PreviewDetail_Rambank_0003Vram_MaxSize = 131072 +PreviewDetail_Rambank_0004Vram_State = 120 +PreviewDetail_Rambank_0004Vram_CurrentSize = 0 +PreviewDetail_Rambank_0004Vram_MaxSize = 65536 +PreviewDetail_Rambank_0005Vram_State = 248 +PreviewDetail_Rambank_0005Vram_CurrentSize = 0 +PreviewDetail_Rambank_0005Vram_MaxSize = 16384 +PreviewDetail_Rambank_0006Vram_State = 248 +PreviewDetail_Rambank_0006Vram_CurrentSize = 0 +PreviewDetail_Rambank_0006Vram_MaxSize = 16384 +PreviewDetail_Effect_State = 524288 +PreviewDetail_Effect_AlphaCoefficient0 = 0 +PreviewDetail_Effect_AlphaCoefficient1 = 0 +PreviewDetail_Effect_BrightCoefficient = 0 +PreviewDetail_Effect_BgMosaicSizeX = 0 +PreviewDetail_Effect_BgMosaicSizeY = 0 +PreviewDetail_Effect_ObjMosaicSizeX = 0 +PreviewDetail_Effect_ObjMosaicSizeY = 0 +PreviewDetail_Window_State = 32768 +PreviewDetail_Window_WindowRect0Left = 0 +PreviewDetail_Window_WindowRect0Right = 0 +PreviewDetail_Window_WindowRect0Top = 0 +PreviewDetail_Window_WindowRect0Bottom = 0 +PreviewDetail_Window_WindowRect1Left = 0 +PreviewDetail_Window_WindowRect1Right = 0 +PreviewDetail_Window_WindowRect1Top = 0 +PreviewDetail_Window_WindowRect1Bottom = 0 diff --git a/build/tests/TestMaker/banner/shop/Scene/Scene0.nsn b/build/tests/TestMaker/banner/shop/Scene/Scene0.nsn new file mode 100644 index 00000000..5a18ca2b --- /dev/null +++ b/build/tests/TestMaker/banner/shop/Scene/Scene0.nsn @@ -0,0 +1,54 @@ +INTELLIGENT SYSTEMS Co.,Ltd. NITRO-CHARACTER layout format version 1.00 +#PROPLIST.VER 100/LINE 49 +FILE.VERSION = 1 +PALETTE.DOCUMENT0 = ..\ColorPalette\banner_anm_idea03.ncl +PALETTE.COUNT = 1 +PREVIEW.DOCUMENT0 = ..\Preview\Preview0.npv +PREVIEW.COUNT = 1 +CHARACTER.DOCUMENT0 = ..\Character\banner_anm_idea03_ALL.ncg +CHARACTER.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:177:87:1203:702 +CHARACTER.DOCUMENT0.FRAME0.LayerID = 2 +CHARACTER.DOCUMENT0.FRAME0.View0.Grid = 1 +CHARACTER.DOCUMENT0.FRAME0.View0.Mag = 6 +CHARACTER.DOCUMENT0.FRAME0.View0.Scroll = 542,0 +CHARACTER.DOCUMENT0.FRAMECOUNT = 1 +CHARACTER.COUNT = 1 +SCREEN.COUNT = 0 +OBJECT.DOCUMENT0 = ..\Cell\Cell0.nce +OBJECT.DOCUMENT0.FRAME0.WindowPlacement = 0:1:-1:-1:-1:-1:64:10:862:685 +OBJECT.DOCUMENT0.FRAME0.LayerID = 1 +OBJECT.DOCUMENT0.FRAME0.PaneWidth0 = 150 +OBJECT.DOCUMENT0.FRAME0.PaneWidth1 = 624 +OBJECT.DOCUMENT0.FRAME0.PaneWidth2 = 0 +OBJECT.DOCUMENT0.FRAME0.TreeWidth = 93 +OBJECT.DOCUMENT0.FRAME0.List.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.List.Cursor = 0,7 +OBJECT.DOCUMENT0.FRAME0.List.HeaderWidth = 64,256 +OBJECT.DOCUMENT0.FRAME0.View.Grid = 1 +OBJECT.DOCUMENT0.FRAME0.View.Mag = 4 +OBJECT.DOCUMENT0.FRAME0.View.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAME0.Tree.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME0.Tree.HeaderWidth = 30,30,32,32,25,30,20,33,20,60,38,30,21,33,35,20 +OBJECT.DOCUMENT0.FRAMETYPE0 = 1 +OBJECT.DOCUMENT0.FRAME1.WindowPlacement = 0:1:-1:-1:-1:-1:135:323:1085:976 +OBJECT.DOCUMENT0.FRAME1.LayerID = 0 +OBJECT.DOCUMENT0.FRAME1.ColumnSize0 = 231 +OBJECT.DOCUMENT0.FRAME1.ColumnSize1 = 113 +OBJECT.DOCUMENT0.FRAME1.ColumnSize2 = 546 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeList.HeaderWidth = 59,34,256 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Scroll = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.Cursor = 0,0 +OBJECT.DOCUMENT0.FRAME1.AnimeView.HeaderWidth = 43,37,40,40,40,40,40,256 +OBJECT.DOCUMENT0.FRAME1.Anime.Grid = 0 +OBJECT.DOCUMENT0.FRAME1.Anime.Mag = 4 +OBJECT.DOCUMENT0.FRAME1.Anime.Scroll = 832,320 +OBJECT.DOCUMENT0.FRAMETYPE1 = 2 +OBJECT.DOCUMENT0.FRAMECOUNT = 2 +OBJECT.COUNT = 1 +MULTICELL.COUNT = 0 +NITRO-CHARACTER Scene format version 1.00 +#PROPLIST.VER 100/LINE 1 +Scene.Comment = diff --git a/build/tests/TestMaker/banner/shop/workset.ini b/build/tests/TestMaker/banner/shop/workset.ini new file mode 100644 index 00000000..75afb17d --- /dev/null +++ b/build/tests/TestMaker/banner/shop/workset.ini @@ -0,0 +1,4 @@ +[LastScene] +File=Scene\Scene0.nsn +[Recent] +ExportFolder= diff --git a/build/tests/TestMaker/config/ROM-TS_nand_forPARENTAL.rsf b/build/tests/TestMaker/config/ROM-TS_nand_forPARENTAL.rsf new file mode 100644 index 00000000..35e5167d --- /dev/null +++ b/build/tests/TestMaker/config/ROM-TS_nand_forPARENTAL.rsf @@ -0,0 +1,251 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + #CERO FREE + #ESRB FREE + #USK FREE + #PEGI_GEN FREE + #PEGI_PRT FREE + #PEGI_BBFC FREE + #OFLC FREE + #GRB FREE +} diff --git a/build/tests/TestMaker/config/romparam_forBoottest.yaml b/build/tests/TestMaker/config/romparam_forBoottest.yaml new file mode 100644 index 00000000..29387e6c Binary files /dev/null and b/build/tests/TestMaker/config/romparam_forBoottest.yaml differ diff --git a/build/tests/TestMaker/config/romparam_forCLStest.yaml b/build/tests/TestMaker/config/romparam_forCLStest.yaml new file mode 100644 index 00000000..72206362 Binary files /dev/null and b/build/tests/TestMaker/config/romparam_forCLStest.yaml differ diff --git a/build/tests/TestMaker/config/romparam_forEULAtest.yaml b/build/tests/TestMaker/config/romparam_forEULAtest.yaml new file mode 100644 index 00000000..1f9532f9 Binary files /dev/null and b/build/tests/TestMaker/config/romparam_forEULAtest.yaml differ diff --git a/build/tests/TestMaker/config/romparam_forFATFSPermissiontest.yaml b/build/tests/TestMaker/config/romparam_forFATFSPermissiontest.yaml new file mode 100644 index 00000000..980299c9 Binary files /dev/null and b/build/tests/TestMaker/config/romparam_forFATFSPermissiontest.yaml differ diff --git a/build/tests/TestMaker/config/romparam_forShoptest.yaml b/build/tests/TestMaker/config/romparam_forShoptest.yaml new file mode 100644 index 00000000..6804a5ed Binary files /dev/null and b/build/tests/TestMaker/config/romparam_forShoptest.yaml differ diff --git a/build/tests/TestMaker/config/twl_parentalcontrol_spec.yaml b/build/tests/TestMaker/config/twl_parentalcontrol_spec.yaml new file mode 100644 index 00000000..70502ddc Binary files /dev/null and b/build/tests/TestMaker/config/twl_parentalcontrol_spec.yaml differ diff --git a/build/tests/TestMaker/doc/20080617_DS_fontcodeList_NOE_FIANL.xls b/build/tests/TestMaker/doc/20080617_DS_fontcodeList_NOE_FIANL.xls new file mode 100644 index 00000000..6da552de Binary files /dev/null and b/build/tests/TestMaker/doc/20080617_DS_fontcodeList_NOE_FIANL.xls differ diff --git a/build/tests/TestMaker/doc/twl_cls_checksheet_20080508.xls b/build/tests/TestMaker/doc/twl_cls_checksheet_20080508.xls new file mode 100644 index 00000000..9329f55a Binary files /dev/null and b/build/tests/TestMaker/doc/twl_cls_checksheet_20080508.xls differ diff --git a/build/tests/TestMaker/doc/twl_parentalcontrol_spec_20080704.xls b/build/tests/TestMaker/doc/twl_parentalcontrol_spec_20080704.xls new file mode 100644 index 00000000..3a612cca Binary files /dev/null and b/build/tests/TestMaker/doc/twl_parentalcontrol_spec_20080704.xls differ diff --git a/build/tests/TestMaker/readme.txt b/build/tests/TestMaker/readme.txt new file mode 100644 index 00000000..95b161ae --- /dev/null +++ b/build/tests/TestMaker/readme.txt @@ -0,0 +1,39 @@ +#---------------------------------------------------------------------------- +# [CLS テスト用] ROM 作成 +# +# -- CLS テスト 用 ROM を作成します。 +# このドキュメントはほぼ覚書です。 +# +#---------------------------------------------------------------------------- + +* 注意 +- Python 2.5 の実行環境が必須です。すいません。 +- PyYAML のインストールが必須です。すいません。 +- pyExcelerator のインストールが一部必要です。すいません。 +-- http://pyyaml.org/ を参照してください。 + +* 利用方法 + +- CLS テスト ROM 作成には make clstest -> make してください。 +- FONT テスト ROM 作成には make fonttest -> make してください。 +- PARENTAL テスト ROM 作成には make parentaltest -> make してください。 +- EULA テスト ROM 作成には make eulatest -> make してください。 +- 上記 make 作業後に、make forcls と打つと、~ + CLS 操作用ディレクトリ (forCLS) が生成されます。 + +* ROM 生成パラメータ +- romparam.yaml にパラメータが指定されています。 +- CLS テスト用パラメータに関しては、 + ./docs/twl_cls_checksheet_20080508.xls を参照してください。 +- FONT テスト用パラメータに関しては、 + ./docs/20080617_DS_fontcodeList_NOE_FIANL.xls を参照してください。 +- PARENTAL テスト用パラメータに関しては、 + ./docs/twl_parentalcontrol_spec_20080704.xls を参照してください。 +- EULA テスト用パラメータに関しては、 + 今後検証内容の詳細をつめる必要があります。 + +* CLS テスト生成物 + HZ0A : System/NAND/セキュア --> ShopApp / Menu + HZ4A : System/NAND/データ --> 写真帳 + HZ5A : System/非表示/NAND/データ --> 無線 Firm + KZ2A : User/NAND --> Shop 販売 App \ No newline at end of file diff --git a/build/tests/TestMaker/romparam.yaml b/build/tests/TestMaker/romparam.yaml new file mode 100644 index 00000000..051094cf Binary files /dev/null and b/build/tests/TestMaker/romparam.yaml differ diff --git a/build/tests/TestMaker/rsf/ROM-TS_custom.rsf b/build/tests/TestMaker/rsf/ROM-TS_custom.rsf new file mode 100644 index 00000000..3b2f97af --- /dev/null +++ b/build/tests/TestMaker/rsf/ROM-TS_custom.rsf @@ -0,0 +1,319 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G/4G] + # + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # CommonClientKey: launcher deliver common client Key [TRUE/FALSE] + # + #CommonClientKey FALSE + + # + # HwAESSlotA_SSLClientCert: launcher deliver HW AES slot A setting [TRUE/FALSE] + # + #HwAESSlotA_SSLClientCert FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + #HwAESSlotB FALSE + + # + # HwAESSlotB for Sign JPEG for Launcher: launcher deliver HW AES slot B setting for Sign JPEG for Launcher [TRUE/FALSE] + # + #HwAESSlotB_SignJPEGForLauncher FALSE + + # + # HwAESSlotC: launcher deliver HW AES slot C setting [TRUE/FALSE] + # + #HwAESSlotC FALSE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + #SDCardAccess FALSE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + #NANDAccess FALSE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [1 - 255] + # + #AgreeEULAVersion 1 + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + #Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType USER + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + #Launch TRUE + + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + #DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + #Secure FALSE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE + + # + # Game card transferd to nitro mode: [TRUE/FALSE] + # + #GameCardNitroMode FALSE + + # + # Shared2 file size: [DISABLE/0-4194304/0K-4096K/0M-4M] + # + #Shared2File0Size Disable + #Shared2File1Size Disable + #Shared2File2Size Disable + #Shared2File3Size Disable + #Shared2File4Size Disable + #Shared2File5Size Disable +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / PENDING / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/TestMaker/script/clsdir.py b/build/tests/TestMaker/script/clsdir.py new file mode 100644 index 00000000..bfbfa795 --- /dev/null +++ b/build/tests/TestMaker/script/clsdir.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import os, sys, shutil +import yaml,codecs +import binascii + +romparampath = sys.argv[1] +romparam = yaml.load(codecs.open(romparampath,'r','utf16')) + +#----- 螳壽焚 +rsfkey = 'RSF' +bnrkey = 'Banner' +eulakey = 'EULA' +ratingkey = 'Rating' + +#----- forCLS 繝繧」繝ャ繧ッ繝医Μ縺ョ逕滓 ------------------------------------ +forclsdir = './forCLS' +try: + os.mkdir(forclsdir) +except: + print 'clsdir.py : can not create dir %s' % forclsdir + +#----- cls 謫堺ス懃畑繝繧」繝ャ繧ッ繝医Μ縺ョ逕滓 --------------------------------- +for num in romparam.keys(): + gamecode = romparam[num][rsfkey]['GameCode'] + tadpath = ''.join(['./roms/','twl_',gamecode,'.tad']) + + #----- gamecode dir 縺ョ逕滓. + if os.path.exists(tadpath): + try: + clsappdir = ''.join([forclsdir,'/',gamecode]) + os.mkdir(clsappdir) + except: + print 'clsdir.py : can not create dir %s' % clsappdir + else: + print 'clsdir.py : can not create dir %s' % clsappdir + continue + + #----- version 繝繧」繝ャ繧ッ繝医Μ縺ョ逕滓 + verdir = ''.join([clsappdir,'/v',str(romparam[num][rsfkey]['Version'])]) + try: + os.mkdir(verdir) + except: + print 'clsdir.py : can not create dir %s' % verdir + continue + + #----- tadfile 縺ョ繧ウ繝斐シ + try: + shutil.copy(tadpath,verdir) + except (IOError, os.error), why: + print "Can't copy %s to %s: %s" % (`tadpath`, `verdir`, str(why)) + continue + + #----- TitleID 蜿門セ + tmpId = 0x00030000 + keys = ('AppType','Launch','Media','DataOnly','Secure') + for shiftbit, key in enumerate(keys): + if key == 'Launch': + if not romparam[num][rsfkey][key]: + tmpId = tmpId + (1< 2 and key[1] == 1][:-29] + fonts = [sheet[key][1] for key in keys if key[0] > 2 and key[1] == 2][:-29] + + #--- ROM 縺ョ菴懈宣蠎上ョ螟画峩 + if reverseflg: + fontcodes.reverse() + fonts.reverse() + + #--- romparam.yaml 縺ョ逕滓 + try: + yamlfile = codecs.open(yamlpath, 'w', 'utf16') + except: + print 'genparam.py : can not open %s file' % yamlpath + continue + else: + #--- 螳壽焚蛟、 + version = '0x0000' + apptype = 'USER' + launch = 'TRUE' + media = 'NAND' + dataonly = 'FALSE' + secure = 'FALSE' + etikect = 'personalized' + titlename = '' + titletype = 'TWL_APP' + filename = 'banner.bnr' + bnrver = '3' + codes = map(chr,range(ord('a'),ord('z')+1)) + for index, font in enumerate(fonts): + #--- gamecode, bnrtitle 縺ョ豎コ螳 + gamecode = ''.join(['4',codes[index/26],codes[(index%26)],'A']) + #--- 0x0060 縺縺醍音蛻・蟇セ蠢懊Excel 繝繝シ繧ソ縺悟ュ伜惠縺励↑縺縺溘aシimg 雋シ莉假シ + if fontcodes[index] == '0x0060': + bnrline1 = repr(''.join(['\x60_',fontcodes[index]]))[2:-1] + else: + bnrline1 = repr(''.join([font,'_',fontcodes[index]]))[2:-1] + #--- index + yamlfile.write('#-- ROM No.%d ------------------------\n' % index) + yamlfile.write('%d:\n' % index) + #--- rsf & properties parameter + yamlfile.write(' RSF :\n') + yamlfile.write(' GameCode : %s\n' % gamecode ) + yamlfile.write(' Version : %s\n' % version ) + #yamlfile.write(' AppType : %s\n' % apptype ) + #yamlfile.write(' Launch : %s\n' % launch ) + yamlfile.write(' Media : %s\n' % media ) + #yamlfile.write(' DataOnly : %s\n' % dataonly ) + #yamlfile.write(' Secure : %s\n' % secure ) + yamlfile.write(' TitleName : %s\n' % titlename ) + yamlfile.write(' TitleType : %s\n' % titletype ) + yamlfile.write(' eTicket : %s\n' % etikect ) + #--- bsf parameter + yamlfile.write(' Banner :\n') + yamlfile.write(' File : %s\n' % filename ) + yamlfile.write(' Version : %s\n' % bnrver ) + for language in ('JP','EN','FR','GE','IT','SP','CN','HN'): + bnrline2 = ''.join(['No.',str(index),' Lang:',language]) + if font == '"': + yamlfile.write(" %s : ['%s', '%s']\n" % (language, bnrline1, bnrline2)) + else: + yamlfile.write(' %s : ["%s", "%s"]\n' % (language, bnrline1, bnrline2)) + yamlfile.write('\n\n') + finally: + yamlfile.close() \ No newline at end of file diff --git a/build/tests/TestMaker/script/parentalcontrol.py b/build/tests/TestMaker/script/parentalcontrol.py new file mode 100644 index 00000000..105a36d4 --- /dev/null +++ b/build/tests/TestMaker/script/parentalcontrol.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import sys, yaml, codecs + + +target = sys.argv[1] +yamlpath = sys.argv[2] +#target = '../config/twl_parentalcontrol_spec.yaml' +#yamlpath = '../romparam.yaml' +ognparam = yaml.load(codecs.open(target,'r','utf16')) + +#--- romparam.yaml 縺ョ逕滓 +try: + yamlfile = codecs.open(yamlpath, 'w', 'utf16') +except: + print '%s : can not open %s file' % ('hoge', yamlpath) +else: + #--- 螳壽焚蛟、 + version = '0x0000' + apptype = 'USER' + launch = 'TRUE' + media = 'NAND' + dataonly = 'FALSE' + secure = 'FALSE' + etikect = 'personalized' + titlename = '' + titletype = 'TWL_APP' + filename = 'banner.bnr' + bnrver = '3' + codes = map(chr,range(ord('a'),ord('z')+1)) + + index = 0 + for ogn in sorted(ognparam.keys()): + #--- CardRegion 縺ョ豎コ螳 + region = ognparam[ogn][0] + for age in ognparam[ogn][1]: + #--- gamecode, bnrtitle 縺ョ豎コ螳 + gamecode = ''.join(['4',codes[index/26],codes[(index%26)],'A']) + bnrline1 = ''.join([ogn,'/',str(age)]) + #--- index + yamlfile.write('#-- ROM No.%d ------------------------\n' % index) + yamlfile.write('%d:\n' % index) + #--- rsf & properties parameter + yamlfile.write(' RSF :\n') + yamlfile.write(' GameCode : %s\n' % gamecode ) + yamlfile.write(' Version : %s\n' % version ) + yamlfile.write(' AppType : %s\n' % apptype ) + yamlfile.write(' Launch : %s\n' % launch ) + yamlfile.write(' Media : %s\n' % media ) + yamlfile.write(' DataOnly : %s\n' % dataonly ) + yamlfile.write(' Secure : %s\n' % secure ) + yamlfile.write(' CardRegion : %s\n' % region ) + yamlfile.write(' TitleName : %s\n' % titlename ) + yamlfile.write(' TitleType : %s\n' % titletype ) + yamlfile.write(' eTicket : %s\n' % etikect ) + #--- bsf parameter + yamlfile.write(' Banner :\n') + yamlfile.write(' File : %s\n' % filename ) + yamlfile.write(' Version : %s\n' % bnrver ) + for language in ('JP','EN','FR','GE','IT','SP','CN','HN'): + bnrline2 = ''.join(['No.',str(index),' Lang:',language]) + yamlfile.write(" %s : %s" % (language,str(yaml.dump([bnrline1,bnrline2])))) + #--- Rating + yamlfile.write(' Rating :\n') + yamlfile.write(' Ogn : %s\n' % ogn ) + yamlfile.write(' Age : %s\n' % age ) + yamlfile.write('\n\n') + index = index + 1 +finally: + yamlfile.close() \ No newline at end of file diff --git a/build/tests/TestMaker/script/rename_eula.py b/build/tests/TestMaker/script/rename_eula.py new file mode 100644 index 00000000..d65863f1 --- /dev/null +++ b/build/tests/TestMaker/script/rename_eula.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import os, sys, yaml, codecs + +#yamlpath = sys.argv[1] +yamlpath = '../romparam.yaml' +romparam = yaml.load(codecs.open(yamlpath,'r','utf16')) + +#----- 螳壽焚 +rsfkey = 'RSF' +bnrkey = 'Banner' +eulakey = 'EULA' +ratingkey = 'Rating' + +os.chdir('../roms') + +for num in romparam.keys(): + srcname = ''.join(['twl_',romparam[num][rsfkey]['GameCode'],'.tad']) + destname = ''.join([str(romparam[num][bnrkey]['JP'][0]),'.tad']) + os.rename(srcname,destname) \ No newline at end of file diff --git a/build/tests/TestMaker/script/rename_font.py b/build/tests/TestMaker/script/rename_font.py new file mode 100644 index 00000000..47074a1e --- /dev/null +++ b/build/tests/TestMaker/script/rename_font.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import os, sys, yaml, codecs + +#yamlpath = sys.argv[1] +yamlpath = '../romparam.yaml' +romparam = yaml.load(codecs.open(yamlpath,'r','utf16')) + +#----- 螳壽焚 +rsfkey = 'RSF' +bnrkey = 'Banner' +eulakey = 'EULA' +ratingkey = 'Rating' + +os.chdir('../roms') + +for num in romparam.keys(): + srcname = ''.join(['twl_',romparam[num][rsfkey]['GameCode'],'.tad']) + #destname = ''.join([('No.%03d_' % num), + # romparam[num][bnrkey]['JP'][0].split('_')[1], + # '.tad']) + destname = ''.join([('No.%03d_' % num), + romparam[num][bnrkey]['JP'][1].split('_')[0], + '_L2.tad']) + + try: + os.rename(srcname,destname) + except: + print srcname, destname \ No newline at end of file diff --git a/build/tests/TestMaker/script/rename_parental.py b/build/tests/TestMaker/script/rename_parental.py new file mode 100644 index 00000000..5d6d11fe --- /dev/null +++ b/build/tests/TestMaker/script/rename_parental.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +import os, sys, yaml, codecs + +#yamlpath = sys.argv[1] +yamlpath = '../romparam.yaml' +romparam = yaml.load(codecs.open(yamlpath,'r','utf16')) + +#----- 螳壽焚 +rsfkey = 'RSF' +bnrkey = 'Banner' +eulakey = 'EULA' +ratingkey = 'Rating' + +os.chdir('../roms') + +for num in romparam.keys(): + srcname = ''.join(['twl_',romparam[num][rsfkey]['GameCode'],'.tad']) + destname = ''.join([str(romparam[num][bnrkey]['JP'][0]).replace('/','_'),'.tad']) + os.rename(srcname,destname) + + srcname = ''.join(['twl_',romparam[num][rsfkey]['GameCode'],'.srl']) + destname = ''.join([str(romparam[num][bnrkey]['JP'][0]).replace('/','_'),'.srl']) + os.rename(srcname,destname) \ No newline at end of file diff --git a/build/tests/UjiPackage/Makefile b/build/tests/UjiPackage/Makefile new file mode 100644 index 00000000..9b70d85c --- /dev/null +++ b/build/tests/UjiPackage/Makefile @@ -0,0 +1,98 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - build +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +# 製品技術部用リリース作成Makefile + +TARGET_FIRM = SYSTEMMENU + +# -------------------------------- +# ツリーへのExport + +ifdef TWLSYSTEM_ROOT +export NITROSYSTEM_ROOT = $(TWLSYSTEM_ROOT) +endif + +export TARGET_CODEGEN = ALL + +# -------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# check mandatory packages + +ifneq ($(TWLSDK_PRIVATE),TRUE) +$(error "TwlSDK-private is needed.") +endif + +ifneq ($(TWLSDK_SYSMENU_PRIVATE),TRUE) +$(error "TwlSDK-SysMenu-private is needed.") +endif + +ifneq ($(TWLSDK_SECURE7_PRIVATE),TRUE) +$(error "TwlSDK-Secure7-private is needed.") +endif + +ifneq ($(TWLSDK_TWL_WIRELESS_PRIVATE),TRUE) +$(error "TwlSDK-TwlWireless-private is needed.") +endif + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/namut/ARM9 \ + $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/reloc_info/ARM7 \ + $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/hotsw/ARM7 \ + $(TWL_IPL_RED_ROOT)/build/tests/TestComponent/ARM7.TWL + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +FIND := find +ARCHIVE_ROOT ?= . +PACKING_DATE_AND_TIME ?= $(shell date +"%Y%m%d %H%M") +PACKING_DATE ?= $(word 1,$(PACKING_DATE_AND_TIME)) +PACKING_TIME ?= $(word 2,$(PACKING_DATE_AND_TIME)) +ARCHIVE ?= TwlIPL-uji-$(PACKING_DATE)-$(PACKING_TIME).zip +PACKAGE_TMP ?= ./TwlIPL + +.PHONY: package + +package: + @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; \ + $(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; \ + $(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 new file mode 100644 index 00000000..80107ac6 --- /dev/null +++ b/build/tests/UjiPackage/readme.txt @@ -0,0 +1,24 @@ +製品技術部検査プログラム用TwlIPLパッケージ作成Makefile + +■必要なTwlSDKパッケージ + + TWLSDK-5_1-20090303-jp.zip + TWLSDK-5_1-20090303-private-jp.zip + TWLSDK-5_1-20090303-private-Secure7-jp.zip + TWLSDK-5_1-20090303-private-SysMenu-jp.zip + TwlSDK-5_1-20090303-private-TwlWireless-jp.zip + + +■作り方 +1. 各種変数を設定 + +$ export TWLSDK_PLATFORM=TWL +$ export TWLSYSTEM_ROOT=(TwlSystemのインストールディレクトリ) +※TWLSYSTEMは使用しませんが、TwlIPLのcommondefsがきちんと解釈されないため、 + 設定してください。 + +2. packageターゲットを指定してmake + +$ make package + +TwlIPL-uji-(日付)-(時間).zip がこのディレクトリに生成されます。 diff --git a/build/tests/WDSTest/Makefile b/build/tests/WDSTest/Makefile new file mode 100644 index 00000000..fe71f85b --- /dev/null +++ b/build/tests/WDSTest/Makefile @@ -0,0 +1,40 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SRCS = main.c +TARGET_BIN = main.srl + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LLIBRARIES += WDS$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/WDSTest/src/main.c b/build/tests/WDSTest/src/main.c new file mode 100644 index 00000000..e896b5bb --- /dev/null +++ b/build/tests/WDSTest/src/main.c @@ -0,0 +1,297 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - WDSTest + File: main.c + + Copyright 2007 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 + +// ヒープ初期化関数 +static void InitializeAllocateSystem(void); + +// アクセスポイント情報のデバッグ表示用関数 +static void DumpWDSApInfo( WDSApInfo *apinfo ); + +void VBlankIntr(void); + +// WDS非同期関数のコールバック関数たち +// コールバック関数内ではアプリケーションのステート変数g_appstateを変更する +void WDS_Initialize_CB(void *arg); +void WDS_StartScan_CB(void *arg); +void WDS_EndScan_CB(void *arg); +void WDS_End_CB(void *arg); + +// アプリケーションを制御するステートの列挙型 +typedef enum AppState { + APP_STATE_WDSINIT, + APP_STATE_WDSWAITINIT, + APP_STATE_WDSSCAN, + APP_STATE_WDSWAITSCAN, + APP_STATE_WDSCOMPLETESCAN, + APP_STATE_WDSENDSCAN, + APP_STATE_WDSWAITENDSCAN, + APP_STATE_WDSCOMPLETEENDSCAN, + APP_STATE_WDSEND, + APP_STATE_WDSWAITEND, + APP_STATE_WDSCOMPLETEEND +} AppState; + +// アプリケーションを制御するステート変数 +static AppState g_appstate = APP_STATE_WDSINIT; + +// 受け取ったビーコン情報を格納する変数(この配列をランチャー経由でホットスポットチャンネルに渡す) +static WDSBriefApInfo briefapinfo[WDS_APINFO_MAX]; + +// 時間計測用 +static OSTick wdsBegin; + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + u8 *wdsSysBuf; + OSTick wdsScanBeginTick = 0; + + // 各種初期化処理 + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + InitializeAllocateSystem(); + + // WDSライブラリが使用するバッファを確保(32バイトアラインメントしている必要がある) + wdsSysBuf = OS_Alloc( WDS_GetWorkAreaSize() ); + if( wdsSysBuf == NULL) + { + OS_Panic("OS_Alloc Failed"); + } + + // メインループ + while( 1 ) { + OSTick now; + int i; + + OS_WaitVBlankIntr(); + switch( g_appstate ) + { + case APP_STATE_WDSINIT: + // イニシャルステート + + // WDSライブラリの初期化関数を呼び出し、その非同期処理の完了を待つ + OS_Printf("*** WDS_Initialize\n"); + g_appstate = APP_STATE_WDSWAITINIT; + wdsBegin = OS_GetTick(); + if( WDS_Initialize( wdsSysBuf, WDS_Initialize_CB, 0 ) == 0 ) + { + OS_Printf("WDS_Initialize successed\n"); + } + else { + OS_TPrintf("WDS_Initialize failed"); + g_appstate = APP_STATE_WDSCOMPLETEEND; + } + break; + OS_Printf("*** WDS_Initialize waiting asyncronous process\n"); + case APP_STATE_WDSWAITINIT: + case APP_STATE_WDSWAITSCAN: + case APP_STATE_WDSWAITENDSCAN: + case APP_STATE_WDSWAITEND: + // 非同期処理の完了を待つステート群 + + // コールバック関数が呼び出され、ステートが変更されるのを待てばよい + break; + case APP_STATE_WDSSCAN: + // 初期化が完了した直後か、ビーコンスキャン完了時に引き続きスキャンを行う場合に入ってくるステート + + //OS_Printf("*** WDS_StartScan\n"); + // ビーコンスキャン非同期処理を開始する + g_appstate = APP_STATE_WDSWAITSCAN; + wdsBegin = OS_GetTick(); + if( WDS_StartScan( WDS_StartScan_CB ) == 0 ) + { + if( wdsScanBeginTick == 0 ) + wdsScanBeginTick = OS_GetTick(); + } + else { + OS_TPrintf("WDS_EndScan failed"); + g_appstate = APP_STATE_WDSEND; + } + break; + case APP_STATE_WDSCOMPLETESCAN: + // スキャン完了後に入ってくるステート + + // 一回のスキャンではビーコンを取れないことが多いので、2秒間ビーコン受信を繰り返す + now = OS_GetTick(); + if( OS_TicksToMilliSeconds(now - wdsScanBeginTick) < 2000 ) + { + // 再スキャンのためにスキャン開始ステートに移行 + g_appstate = APP_STATE_WDSSCAN; + } + else { + // スキャン終了ステートに移行 + g_appstate = APP_STATE_WDSENDSCAN; + } + break; + case APP_STATE_WDSENDSCAN: + // スキャンを終了させる際に入ってくるステート + OS_Printf("*** WDS_EndScan\n"); + + // スキャンを終了させる非同期処理を開始する + wdsBegin = OS_GetTick(); + g_appstate = APP_STATE_WDSWAITENDSCAN; + if( WDS_EndScan( WDS_EndScan_CB ) == 0 ) + { + OS_Printf("WDS_EndScan successed\n"); + } + else { + OS_TPrintf("WDS_EndScan failed"); + g_appstate = APP_STATE_WDSEND; + } + break; + case APP_STATE_WDSCOMPLETEENDSCAN: + // スキャン終了非同期処理が終わった際に入って来るステート + OS_Printf("*** WDS_GetApInfoAll\n"); + if( WDS_GetApInfoAll( briefapinfo ) != 0 ) + { + OS_Panic("WDS_GetApInfoAll failed\n"); + } + for( i = 0 ; i < WDS_APINFO_MAX ; i++ ) + { + if( briefapinfo[i].isvalid == TRUE ) + { + OS_TPrintf("rssi: %d\n", briefapinfo[i].rssi); + DumpWDSApInfo( &briefapinfo[i].apinfo ); + } + } + g_appstate = APP_STATE_WDSEND; + break; + case APP_STATE_WDSEND: + // WDSライブラリを終了し、無線ハードの電源を落とす非同期処理を開始する + OS_Printf("*** WDS_End\n"); + g_appstate = APP_STATE_WDSWAITEND; + wdsBegin = OS_GetTick(); + if( WDS_End( WDS_End_CB ) == 0 ) + { + OS_Printf("WDS_End successed\n"); + } + else { + OS_Panic("WDS_End failed"); + } + break; + case APP_STATE_WDSCOMPLETEEND: + // WDSライブラリの解放処理が完了した際に入って来るステート + + OS_TPrintf("WDS completed\n"); + OS_Terminate(); + } + } +} + +// アクセスポイント情報のデバッグ表示用関数 +static void DumpWDSApInfo( WDSApInfo *apinfo ) +{ + int i; + char buf[256]; + + OS_TPrintf( "================================\n" ); + // SSID + MI_CpuCopy8( apinfo->ssid, buf, WDS_SSID_BUF_SIZE) ; + buf[WDS_SSID_BUF_SIZE] = 0x00; + OS_TPrintf( "SSID: %s\n", buf ); + + // APNUM + MI_CpuCopy8( apinfo->apnum, buf, WDS_APNUM_BUF_SIZE) ; + buf[WDS_APNUM_BUF_SIZE] = 0x00; + OS_TPrintf( "APNUM: %s\n", buf ); + + // CHANNEL + OS_TPrintf( "channel: %d\n", apinfo->channel ); + + // ENCRYPTFLAG + OS_TPrintf( "encryptmethod: %d\n", apinfo->encryptflag); + + // WEPKEY + OS_TPrintf( "WEPKEY: " ); + for( i = 0 ; i < WDS_WEPKEY_BUF_SIZE ; i++ ) + { + OS_TPrintf( "%02x", apinfo->wepkey[i] ); + } + OS_TPrintf( "\n" ); + OS_TPrintf( "================================\n" ); +} + +static void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +// ヒープ初期化関数 +static void InitializeAllocateSystem(void) +{ + void *tempLo; + OSHeapHandle hh; + + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_Panic("ARM9: Fail to create heap...\n"); + } + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +static void WDS_Initialize_CB(void *arg) +{ +#pragma unused(arg) + OS_TPrintf("WDS_Initialize_CB\n"); + g_appstate = APP_STATE_WDSSCAN; + OS_TPrintf("Elapsed time = %llu\n", OS_TicksToMicroSeconds( OS_GetTick() - wdsBegin ) ); +} + +static void WDS_StartScan_CB(void *arg) +{ +#pragma unused(arg) + OS_TPrintf("WDS_StartScan_CB\n"); + g_appstate = APP_STATE_WDSCOMPLETESCAN; + OS_TPrintf("Elapsed time = %llu\n", OS_TicksToMicroSeconds( OS_GetTick() - wdsBegin ) ); +} + +static void WDS_EndScan_CB(void *arg) +{ +#pragma unused(arg) + OS_TPrintf("WDS_EndScan_CB\n"); + g_appstate = APP_STATE_WDSCOMPLETEENDSCAN; + OS_TPrintf("Elapsed time = %llu\n", OS_TicksToMicroSeconds( OS_GetTick() - wdsBegin ) ); +} + +static void WDS_End_CB(void *arg) +{ +#pragma unused(arg) + OS_TPrintf("WDS_End_CB\n"); + g_appstate = APP_STATE_WDSCOMPLETEEND; + OS_TPrintf("Elapsed time = %llu\n", OS_TicksToMicroSeconds( OS_GetTick() - wdsBegin ) ); +} diff --git a/build/tests/WDSWrapperTest/Makefile b/build/tests/WDSWrapperTest/Makefile new file mode 100644 index 00000000..efc21709 --- /dev/null +++ b/build/tests/WDSWrapperTest/Makefile @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: WDSWrapperTest +# File: Makefile +# +# 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. +# +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED +TWL_PROC = ARM9 + +SRCS = main.c +TARGET_BIN = main.srl + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LLIBRARIES += WDS$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +#---------------------------------------------------------------------------- +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/WDSWrapperTest/src/main.c b/build/tests/WDSWrapperTest/src/main.c new file mode 100644 index 00000000..c103a5d8 --- /dev/null +++ b/build/tests/WDSWrapperTest/src/main.c @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tests - WDSWrapperTest + File: main.c + + Copyright 2007 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 + +// Vブランク関数 +static void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +// ヒープ初期化関数 +static void InitializeAllocateSystem(void) +{ + void *tempLo; + OSHeapHandle hh; + + tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tempLo); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_Panic("ARM9: Fail to create heap...\n"); + } + hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh); +} + +// WDSWrapper用アロケータ +static void *Alloc_WDSWrapper( u32 size ) +{ + return OS_Alloc( size ); +} + +static void Free_WDSWrapper( void *ptr ) +{ + OS_Free( ptr ); +} + +char *callbackstring[] = { + "WDSWRAPPER_CALLBACK_INITIALIZE", + "WDSWRAPPER_CALLBACK_CLEANUP", + "WDSWRAPPER_CALLBACK_STARTSCAN", + "WDSWRAPPER_CALLBACK_STARTSCAN2", + "WDSWRAPPER_CALLBACK_STOPSCAN", +}; + +// WDSWrapper用コールバック関数 +static void Callback_WDSWrapper( void *ptr ) +{ + WDSWrapperCallbackParam *callback = (WDSWrapperCallbackParam *)ptr; + OS_TPrintf("Callback_WDSWrapper: %s %d ", callbackstring[callback->callback], callback->errcode ); + + switch( callback->callback ) { + case WDSWRAPPER_CALLBACK_INITIALIZE: + OS_TPrintf( "初期化完了" ); + break; + case WDSWRAPPER_CALLBACK_STARTSCAN2: + // n秒間隔のビーコン間欠スキャン一回分が完了 + // ビーコンを受け取っていないという結果が出た場合、強調表示を消します + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_FAILURE ) + OS_TPrintf( "強調表示を消します" ); + else { + OS_TPrintf( "強調表示をつけます" ); + } + // 受信したビーコン情報データをArgument領域に書き込む +#ifdef SDK_TWL + OS_TPrintf( "\n" ); + WDS_WrapperSetArgumentParam(); +#endif + break; + case WDSWRAPPER_CALLBACK_STARTSCAN: + // n秒間隔のビーコン間欠スキャン一回分が完了 + // ビーコンを受け取っている場合のみ強調表示を付けます + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_SUCCESS ) + OS_TPrintf( "強調表示をつけます" ); + break; + case WDSWRAPPER_CALLBACK_STOPSCAN: + if( WDS_WrapperCheckValidBeacon() == WDSWRAPPER_ERRCODE_FAILURE ) + OS_TPrintf( "強調表示を消します" ); + else { + OS_TPrintf( "強調表示をつけます" ); + } + break; + case WDSWRAPPER_CALLBACK_CLEANUP: + OS_TPrintf( "解放完了" ); + break; + } + OS_TPrintf( "\n" ); +} + +// スリープモードに入る前に呼び出されるコールバック関数 +static void Callback_WDSPreSleep( void *ptr ) +{ +#pragma unused( ptr ) + WDS_WrapperCleanup(); + while( WDS_WrapperCheckThreadRunning() == WDSWRAPPER_ERRCODE_SUCCESS ) + OS_Sleep( 100 ); +} + +// スリープモードから復帰する際に呼び出されるコールバック関数 +static void Callback_WDSPostSleep( void *ptr ) +{ +#pragma unused( ptr ) + WDSWrapperInitializeParam param; + + // WDSWrapper初期化と動作開始 + param.threadprio = 20; + param.dmano = 1; + + param.callback = Callback_WDSWrapper; + param.alloc = Alloc_WDSWrapper; + param.free = Free_WDSWrapper; + WDS_WrapperInitialize( param ); +} + +// メイン関数 +void NitroMain(void) +{ + WDSWrapperInitializeParam param; + u16 lastpad = 0x0000; + u16 nowpad = 0x0000; + PMSleepCallbackInfo presleepcallbackinfo, postsleepcallbackinfo; + + // 各種初期化処理 + OS_Init(); + OS_InitTick(); + OS_InitAlarm(); + + //---- interrupt setting + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + OS_EnableIrqMask(OS_IE_V_BLANK); + OS_EnableIrq(); + GX_VBlankIntr(TRUE); + + //---- power manager callback + PM_SetSleepCallbackInfo( &presleepcallbackinfo, Callback_WDSPreSleep, NULL ); + PM_AppendPreSleepCallback( &presleepcallbackinfo ); + PM_SetSleepCallbackInfo( &postsleepcallbackinfo, Callback_WDSPostSleep, NULL ); + PM_AppendPostSleepCallback( &postsleepcallbackinfo ); + + InitializeAllocateSystem(); + + OS_TPrintf( "WDSWrapper Sample\n\n" ); + OS_TPrintf( "Xボタン: WDSラッパーとWDSを初期化し、間欠スキャンを開始\n" ); + OS_TPrintf( "Bボタン: スキャンを中断\n" ); + OS_TPrintf( "Aボタン: スキャンを再開\n" ); + OS_TPrintf( "Yボタン: スキャンを中断し、WDSラッパーとWDSを解放\n" ); + OS_TPrintf( "スタートボタン: ヒープをダンプ表示\n" ); + OS_TPrintf( "セレクトボタン: スリープモードin/out\n" ); + + // キー入力で中断・再開・解放をやる + while( 1 ) { + lastpad = nowpad; + nowpad = PAD_Read(); + + // Aボタン: スキャンを再開 + // Bボタン: スキャンを中断 + // Xボタン: ラッパーを初期化 + // Yボタン: ラッパーを解放 + // スタートボタン: ヒープをダンプ表示 + if( ( lastpad ^ nowpad ) & PAD_BUTTON_A && !( nowpad & PAD_BUTTON_A ) ) + WDS_WrapperStartScan(); + if( ( lastpad ^ nowpad ) & PAD_BUTTON_B && !( nowpad & PAD_BUTTON_B ) ) + WDS_WrapperStopScan(); + if( ( lastpad ^ nowpad ) & PAD_BUTTON_X && !( nowpad & PAD_BUTTON_X ) ) { + // WDSWrapper初期化と動作開始 + param.threadprio = 20; + param.dmano = 1; + + param.callback = Callback_WDSWrapper; + param.alloc = Alloc_WDSWrapper; + param.free = Free_WDSWrapper; + WDS_WrapperInitialize( param ); + } + if( ( lastpad ^ nowpad ) & PAD_BUTTON_Y && !( nowpad & PAD_BUTTON_Y ) ) + WDS_WrapperCleanup(); + if( ( lastpad ^ nowpad ) & PAD_BUTTON_START && !( nowpad & PAD_BUTTON_START ) ) + OS_DumpHeap( OS_ARENA_MAIN, OS_CURRENT_HEAP_HANDLE ); + if( ( lastpad ^ nowpad ) & PAD_BUTTON_SELECT && !( nowpad & PAD_BUTTON_SELECT ) ) { + PM_GoSleepMode( PM_TRIGGER_KEY, PM_PAD_LOGIC_OR, PAD_BUTTON_SELECT ); + } + OS_Sleep( 100 ); + } +} diff --git a/build/tests/WirelessChecker/@ b/build/tests/WirelessChecker/@ new file mode 100644 index 00000000..bd33deb9 --- /dev/null +++ b/build/tests/WirelessChecker/@ @@ -0,0 +1 @@ +NINTENDO_RED_CONFIDENTIAL diff --git a/build/tests/WirelessChecker/Makefile b/build/tests/WirelessChecker/Makefile new file mode 100644 index 00000000..b8b4ad89 --- /dev/null +++ b/build/tests/WirelessChecker/Makefile @@ -0,0 +1,133 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - Wireless Checker +# File: Makefile +# +# 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$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + +SUBDIRS = libraries components rsf banner + +RES_DIR = ./resources + +SRCDIR = src +INCDIR = include $(ROOT)/build/libraries/wm/common.TWL/inc \ + $(ROOT)/build/libraries/wm/ARM9.TWL/nwm/inc + +ifeq ($(TWL_NANDAPP),TRUE) +ROM_SPEC = rsf/wireless_checker_nand.rsf +else +ROM_SPEC = rsf/wireless_checker.rsf +endif + +BANNER_FILE = ./banner/000A_WLCK.bnr +MAKEROM_FLAGS = -DBANNER_FILE='$(BANNER_FILE)' + +#---------------------------------- +# Font + +FONTCVTR_DIR = $(call empath,$(TWLSYSTEM_ROOT))/tools/fontcvtr +FONT_BMP = $(RES_DIR)/ds_ipl10.bmp + +TARGET_OBJ += $(FONT_O) +EXT_OBJS += $(OBJDIR)/$(FONT_O) + + +FONT_RES_LC = $(RES_DIR)/font.NFTR +FONT_O_LC = font.o + +FONT_RES = $(FONT_RES_LC) +FONT_O = $(FONT_O_LC) + +MACRO_FLAGS += -DTWLNMENU_USE_LC_FONT + + +LDIRT_CLEAN += $(FONT_RES_LC) $(FONT_RES_NO_LC) *.rsf $(REVISION_C) + +#---------------------------------------------------------------------------- + +ifeq ($(TWL_NANDAPP),TRUE) +TARGET_BIN = WirelessChecker_nand.tad +else +TARGET_BIN = WirelessChecker.srl +endif + +ifeq ($(TWL_NANDAPP),TRUE) +LCFILE_AUTOGEN = $(BINDIR)/$(notdir $(LCFILE_SPEC:.lsf=.autogen.nand.lcf)) +LDRES_AUTOGEN = $(BINDIR)/$(notdir $(LCFILE_SPEC:.lsf=.autogen.nand.response)) +endif + +SRCS = main.cpp \ + frame.cpp \ + test.cpp \ + test_wm.cpp \ + test_nwm.cpp \ + test_fatal.cpp \ + test_recovery.cpp \ + util/util.cpp \ + util/canvas.cpp \ + util/wprintf.cpp \ + util/memory.cpp + +LINCLUDES = $(ROOT)/build/libraries/wm/ARM9.TWL/nwm/inc \ + $(ROOT)/build/libraries/wm/common.TWL/inc + +LLIBRARY_DIRS = +LLIBRARIES = + +COMPONENT_NAME = racoon +MAKEROM_ARM7_BASE = ./components/racoon_wckr/bin/$(TWL_BUILDTYPE_ARM7)/racoon +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) + +include $(TWLSYSTEM_ROOT)/build/buildtools/commondefs + +LIBRARIES_UNLINK := libnwm$(TWL_LIBSUFFIX).a + +LLIBRARY_DIRS += ./libraries/nwm/ARM9/lib/$(TWL_BUILDTYPE_ARM9) +LLIBRARIES += libnwm.WCKR$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +# convert font + +$(FONT_RES): $(FONT_BMP) $(FONT_FILTER) +ifdef SILENT + echo "make font:" $(notdir $<) +endif + $(FONTCVTR_DIR)/fontcvtrc.exe \ + -i bmp -if $< -io $(FONTCVTR_DIR)/xlor/ds_ipl.xlor -ib 1 \ + -o nitro -of $@ -oe utf16 -oa 0x23 $(FONT_OPTION) + +$(OBJDIR)/$(FONT_O): $(FONT_RES) +ifdef SILENT + echo " b2o font:" $(notdir $<) +endif + $(BIN2OBJ) $< $@ --begin font_NFTR_begin --end font_NFTR_end --align 32 + +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +INSTALL_DIR = ./ +#$(TWLSDK_INSTALL_ROOT)/bin/$(CODEGEN_PROC)-$(TWL_PLATFORM)/$(TWL_BUILD_DIR) + +do-build: $(TARGETS) +ifneq ($(TWL_NANDAPP),TRUE) + $(REMAKE) TWL_NANDAPP=TRUE SKIP_SUBDIR=TRUE +endif + +include $(TWLSYSTEM_ROOT)/build/buildtools/modulerules +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.add-ins.nadk + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/banner/000A_WLCK.bmp b/build/tests/WirelessChecker/banner/000A_WLCK.bmp new file mode 100644 index 00000000..51252b83 Binary files /dev/null and b/build/tests/WirelessChecker/banner/000A_WLCK.bmp differ diff --git a/build/tests/WirelessChecker/banner/000A_WLCK.bsf b/build/tests/WirelessChecker/banner/000A_WLCK.bsf new file mode 100644 index 00000000..a8d31c5b Binary files /dev/null and b/build/tests/WirelessChecker/banner/000A_WLCK.bsf differ diff --git a/build/tests/WirelessChecker/banner/Makefile b/build/tests/WirelessChecker/banner/Makefile new file mode 100644 index 00000000..f6ef1ca6 --- /dev/null +++ b/build/tests/WirelessChecker/banner/Makefile @@ -0,0 +1,47 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: NitroSDK - tools +# File: Makefile +# +# Copyright 2003,2004 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. +# +# $Log: Makefile,v $ +# Revision 1.1 2004/11/01 08:25:59 ooe +# (none) +# +# $NoKeywords: $ +#--------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +BANNER_ICON = 000A_WLCK.bmp +BANNER_SPEC = 000A_WLCK.bsf + +TARGETS = $(BANNER_SPEC:.bsf=.bnr) + +BANNER_ICON_NAME = $(basename $(BANNER_ICON)) + +LDIRT_CLEAN = $(TARGETS) \ + $(BANNER_ICON_NAME).nbfs \ + $(BANNER_ICON_NAME).nbfc \ + $(BANNER_ICON_NAME).nbfp \ + $(TARGETS:.bnr=.srl) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(BANNER_SPEC) $(BANNER_ICON_NAME).nbfc $(BANNER_ICON_NAME).nbfp + $(MAKEBANNER) -N $(BANNER_ICON_NAME) $(BANNER_SPEC) $(TARGETS) + +# diff --git a/build/tests/WirelessChecker/components/Makefile b/build/tests/WirelessChecker/components/Makefile new file mode 100644 index 00000000..6ca34f03 --- /dev/null +++ b/build/tests/WirelessChecker/components/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TWL WLAN - components +# File: Makefile +# +# Copyright 2003 - 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. +# +# $Log: Makefile,v $ +# +# +# $NoKeywords: $ +#---------------------------------------------------------------------------- + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS_P += racoon_wckr + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/components/racoon_wckr/Makefile b/build/tests/WirelessChecker/components/racoon_wckr/Makefile new file mode 100644 index 00000000..81bcb35e --- /dev/null +++ b/build/tests/WirelessChecker/components/racoon_wckr/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - components - racoon.TWL +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +# Definition to override for racoon_wckr +# + +LLIBRARIES += libnwm_sp.WCKR$(TWL_LIBSUFFIX).a +LLIBRARY_DIRS += ../../libraries/nwm/ARM7/lib/$(TWL_BUILDTYPE) + +COMPONENT_DIR += $(ROOT)/build/components/racoon.TWL +COMPONENT_SRC_DIR += $(ROOT)/build/components/mongoose.TWL/src + +override SRCS = $(COMPONENT_SRC_DIR)/main.c $(COMPONENT_SRC_DIR)/initScfg.c + +override TARGET_NAME = racoon + +# Generate my own lsf from original lsf of mongoose +LSF_ORG = $(COMPONENT_DIR)/$(TARGET_NAME).lsf +MAKE_LSF = make_lsf.pl +AUTOGEN_LSF = $(TARGET_NAME)_wckr.lsf + +LDIRT_CLEAN = $(AUTOGEN_LSF) + +override TARGET_NEF = $(TARGET_NAME).tef +override LCFILE_SPEC = $(AUTOGEN_LSF) +override LCFILE_TEMPLATE = $(COMPONENT_DIR)/$(TARGET_NAME).lcf.template +override LDRES_TEMPLATE = $(COMPONENT_DIR)/$(TARGET_NAME).response.template + +override TWL_INSTALL_COMPONENTSDIR= +override INSTALL_TARGETS = +override INSTALL_DIR = + +# + +include $(TWLSDK_ROOT)/build/components/racoon.TWL/Makefile + +$(AUTOGEN_LSF): $(LSF_ORG) $(MAKE_LSF) + @echo " make:" $@ + @perl $(MAKE_LSF) $(TARGET_NAME) + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/components/racoon_wckr/make_lsf.pl b/build/tests/WirelessChecker/components/racoon_wckr/make_lsf.pl new file mode 100755 index 00000000..b3c48384 --- /dev/null +++ b/build/tests/WirelessChecker/components/racoon_wckr/make_lsf.pl @@ -0,0 +1,53 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlWLAN - components - mongoose_sdlog.TWL +# File: make_lsf.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $ROOT; + +my $COMPONENT = $ARGV[0]; +print $COMPONENT; +# search TWLSDK_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWLSDK_ROOT/s) { + $ROOT = $ENV{$_}; + } +} + +my $src = sprintf("$ROOT/build/components/%s.TWL/%s.lsf", $COMPONENT, $COMPONENT); +my $dst = sprintf("%s_wckr.lsf", $COMPONENT); + + +my $rn = "\x0D\x0A"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/libnwm_sp/ ) + { + $line =~ s/libnwm_sp/libnwm_sp\.WCKR/; + } + + print OUT $line; +} +close(OUT); diff --git a/build/tests/WirelessChecker/libraries/Makefile b/build/tests/WirelessChecker/libraries/Makefile new file mode 100644 index 00000000..401e4ee5 --- /dev/null +++ b/build/tests/WirelessChecker/libraries/Makefile @@ -0,0 +1,30 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile +# +# Copyright 2007 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 $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = nwm + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/libraries/nwm/ARM7/Makefile b/build/tests/WirelessChecker/libraries/nwm/ARM7/Makefile new file mode 100644 index 00000000..3d20987a --- /dev/null +++ b/build/tests/WirelessChecker/libraries/nwm/ARM7/Makefile @@ -0,0 +1,126 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - WM - libraries +# File: Makefile +# +# Copyright 2003 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$ +#---------------------------------------------------------------------------- + +SUBDIRS = + +#---------------------------------------------------------------------------- +override TARGET_PLATFORM = TWL + +# Codegen for sub processer +TWL_PROC = ARM7 + +# build ARM & THUMB libraries +TARGET_CODEGEN ?= ALL + +MACRO_FLAGS = -DNWM_WRACK_FIRMWARE + +NWM_SRCDIR = $(ROOT)/build/libraries/wm/ARM7.TWL/nwm + +#---------------------------------------------------------------------------- + +# INCDIR 注意点: +INCDIR = $(NWM_SRCDIR)/inc $(NWM_SRCDIR)/../../inc \ + $(NWM_SRCDIR)/../../ARM7/inc $(NWM_SRCDIR)/../../common.TWL/inc \ + $(NWM_SRCDIR)/../common/inc \ + $(NWM_SRCDIR)/../../../wpa/include \ + $(TWLWIRELESS_ROOT)/include \ + $(TWLWIRELESS_ROOT)/host/include \ + $(TWLWIRELESS_ROOT)/host/wlan/include \ + $(TWLWIRELESS_ROOT)/host/os/twl/include \ + $(TWLWIRELESS_ROOT)/host/os/twl/library/athioctl/include \ + $(TWLWIRELESS_ROOT)/host/os/nitro/include \ + $(TWLWIRELESS_ROOT)/host/os/nitro/library/athioctl/include \ + $(ROOT)/build/libraries/spi/ARM7/include + +SRCDIR_ = ../../ARM7/src src ../../common.TWL/src + +SRCDIR = $(addprefix $(NWM_SRCDIR)/, $(SRCDIR_)) + +SRCS_ARM7 = nwmsp_system.c \ + nwmsp_cmd.c \ + nwmsp_event.c \ + nwmsp_wlan_handler.c \ + nwmsp_event_handler.c \ + nwmsp_beaconinfo.c + +SRCS_COMMON = nwm_loaddev.c \ + nwm_unloaddev.c \ + nwm_open.c \ + nwm_close.c \ + nwm_startscan.c \ + nwm_connect.c \ + nwm_disconnect.c \ + nwm_sendframe.c \ + nwm_recvframe.c \ + nwm_setwepkey.c \ + nwm_setpowersave.c \ + nwm_wpa.c \ + nwm_qos.c \ + nwm_reset.c + +SRCS = $(addprefix $(NWM_SRCDIR)/src/, $(SRCS_ARM7)) \ + $(addprefix $(NWM_SRCDIR)/../../common.TWL/src/, $(SRCS_COMMON)) \ + ../src/nwm_installfirm_autogen.c + +TARGET_LIB = libnwm_sp.WCKR$(TWL_LIBSUFFIX).a + +#---------------------------------------------------------------------------- + +# DEBUG版ビルドの場合、RELEASE版でビルドして +# DEBUG版のライブラリを装います。 + +ifdef TARGET_DEBUG +TWL_BUILD_TYPE = RELEASE +else +ifdef TWL_DEBUG +TWL_BUILD_TYPE = RELEASE +CCFLAGS += -DNWM_DEBUG +else +ifdef NITRO_DEBUG +TWL_BUILD_TYPE = RELEASE +endif +endif +endif + +#---------------------------------------------------------------------------- +# Default では LIMITED のライブラリを作成します +TWL_ARCHGEN ?= LIMITED + +#---------------------------------------------------------------------------- + +# 新無線用のデバッグフラグなど + +ifdef NWM_DEBUG +CCFLAGS += -DNWM_DEBUG +endif + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#INSTALL_TARGETS = $(TARGETS) +#INSTALL_DIR = $(SYSMENU_INSTALL_LIBDIR) +#GDIRT_INSTALLED = $(addprefix $(INSTALL_DIR)/,$(notdir $(INSTALL_TARGETS))) + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== + diff --git a/build/tests/WirelessChecker/libraries/nwm/ARM9/Makefile b/build/tests/WirelessChecker/libraries/nwm/ARM9/Makefile new file mode 100644 index 00000000..e8ecb1e6 --- /dev/null +++ b/build/tests/WirelessChecker/libraries/nwm/ARM9/Makefile @@ -0,0 +1,95 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - WM - libraries +# File: Makefile +# +# Copyright 2003 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$ +#---------------------------------------------------------------------------- +#SUBDIRS = wm_lib + +override TARGET_PLATFORM = TWL + +# Codegen for sub processer +TWL_PROC = ARM9 +TARGET_CODEGEN ?= ALL + +MACRO_FLAGS = -DNWM_WRACK_FIRMWARE + +NWM_SRCDIR = $(ROOT)/build/libraries/wm/ARM9.TWL/nwm + +# HYBRID / LIMITED 両方のライブラリを作成します +TWL_ARCHGEN ?= ALL + +# LoadDeviceEx で転送するファームウェアのディレクトリ +TWLWIRELESS_FW_DIR = $(ROOT)/add-ins/TwlWireless/$(TWLWIRELESS_PACKAGE)/binfile + +SRCDIR = ./src ../../common.TWL/src +INCDIR = $(NWM_SRCDIR)/inc $(NWM_SRCDIR)/../../inc $(NWM_SRCDIR)/../../ARM9/inc \ + $(NWM_SRCDIR)/../../common.TWL/inc $(NWM_SRCDIR)/../common/inc + +SRCS_ARM9 = nwm_init.c \ + nwm_system.c \ + nwm_end.c \ + nwm_cmd.c \ + nwm_passphrase.c + +SRCS_COMMON = nwm_loaddev.c \ + nwm_unloaddev.c \ + nwm_open.c \ + nwm_close.c \ + nwm_startscan.c \ + nwm_connect.c \ + nwm_disconnect.c \ + nwm_setwepkey.c \ + nwm_setpowersave.c \ + nwm_sendframe.c \ + nwm_recvframe.c \ + nwm_wpa.c \ + nwm_qos.c \ + nwm_reset.c + +SRCS = $(addprefix $(NWM_SRCDIR)/src/, $(SRCS_ARM9)) \ + $(addprefix $(NWM_SRCDIR)/../../common.TWL/src/, $(SRCS_COMMON)) \ + ../src/nwm_installfirm_autogen.c + +EXT_OBJS = $(OBJDIR)/nwm_firm.o + +TARGET_LIB = libnwm.WCKR$(TWL_LIBSUFFIX).a + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#INSTALL_TARGETS = $(TARGETS) + +#INSTALL_DIR = $(TWL_INSTALL_LIBDIR) + +GDIRT_INSTALLED = $(addprefix $(INSTALL_DIR)/,$(notdir $(INSTALL_TARGETS))) + +#---------------------------------------------------------------------------- +# 新無線用のデバッグフラグなど + +ifdef NWM_DEBUG +CCFLAGS += -DNWM_DEBUG +endif + +CCFLAGS += -DENABLE_RXACK + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +$(OBJDIR)/nwm_firm.o: $(TWLWIRELESS_FW_DIR)/nwm_firm.bin + $(BIN2OBJ) $(call empath, $<) $@ + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/libraries/nwm/Makefile b/build/tests/WirelessChecker/libraries/nwm/Makefile new file mode 100644 index 00000000..a7c14231 --- /dev/null +++ b/build/tests/WirelessChecker/libraries/nwm/Makefile @@ -0,0 +1,39 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - wm +# File: Makefile +# +# Copyright 2003 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$ +#---------------------------------------------------------------------------- + + +TARGET_PLATFORM := TWL + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +SUBDIRS = scripts + +ifneq ($(filter TWL,$(TARGET_PLATFORM_LIST)),) +SUBDIRS_P += ARM9 +ifeq ($(TWLSDK_PRIVATE),TRUE) +SUBDIRS_P += ARM7 +endif +endif + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/libraries/nwm/scripts/Makefile b/build/tests/WirelessChecker/libraries/nwm/scripts/Makefile new file mode 100644 index 00000000..2582bc5b --- /dev/null +++ b/build/tests/WirelessChecker/libraries/nwm/scripts/Makefile @@ -0,0 +1,42 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - wm +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +override TARGET_CODEGEN := ARM +override TWL_ARCHGEN := LIMITED + +NWM_ORG = $(ROOT)/build/libraries/wm/common.TWL/src/nwm_installfirm.c +MAKE_NWM = make_nwm_fw_wrack.pl +AUTOGEN_NWM = src/nwm_installfirm_autogen.c +LDIRT_CLEAN += $(AUTOGEN_NWM) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +TARGETS = $(AUTOGEN_NWM) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +$(AUTOGEN_NWM): $(NWM_ORG) $(MAKE_NWM) + @echo " make:" $@ + @perl $(MAKE_NWM) + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/libraries/nwm/scripts/make_nwm_fw_wrack.pl b/build/tests/WirelessChecker/libraries/nwm/scripts/make_nwm_fw_wrack.pl new file mode 100755 index 00000000..50d2ebf4 --- /dev/null +++ b/build/tests/WirelessChecker/libraries/nwm/scripts/make_nwm_fw_wrack.pl @@ -0,0 +1,108 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: make_nwm_fw_wrack.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $rn = "\x0D\x0A"; + +my $SDKROOT; + +# search TWLSDK_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWLSDK_ROOT/s) { + $SDKROOT = $ENV{$_}; + } +} + +my $src = "$SDKROOT/build/libraries/wm/common.TWL/src/nwm_installfirm.c"; +my $dst_dir = "../src"; +my $dst_file = "nwm_installfirm_autogen.c"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + +mkdir $dst_dir unless -e $dst_dir; + +my $in_instfirm_count = 0; + +open(OUT, ">$dst_dir/$dst_file") or die "cant open $dst_dir/$dst_file\n"; +foreach my $line ( @lines ) +{ + if ( $line =~ m/^NWMRetCode NWMi_InstallFirmware\(NWMCallbackFunc callback, void\* addr, u32 size, BOOL isColdstart\)/ ) + { + print OUT <<__WRACK_FIRMWARE_API__; + +\#ifdef NWM_WRACK_FIRMWARE +NWMRetCode NWMi_WrackFirmware(NWMCallbackFunc callback); + +NWMRetCode NWMi_WrackFirmware(NWMCallbackFunc callback) +{ + NWMArm9Buf *sys = NWMi_GetSystemWork(); + NWMRetCode result; + + // コールバック関数を登録 + NWMi_SetCallbackTable(NWM_APIID_INSTALL_FIRMWARE, callback); + + // ARM7にFIFOで通知 + result = NWMi_SendCommand(NWM_APIID_INSTALL_FIRMWARE, 5, + (u32)(sys->NWM7), (u32)(sys->status), (u32)(sys->fifo7to9), NULL, FALSE); + + return NWM_RETCODE_OPERATING; +} +\#endif // NWM_WRACK_FIRMWARE + +__WRACK_FIRMWARE_API__ + } + + if ( $line =~ m/MCU_SetWifiLedBlinkingStatus\( FALSE \);/ ) + { + print OUT "#ifndef NWM_WRACK_FIRMWARE", $rn; + } + + if( $line =~ m/^installfirm_err:/ ) + { + print OUT <<__WRACK_FIRMWARE__; + +\#else // NWM_WRACK_FIRMWARE +\#pragma unused (err) + // set WiFi_RST to disable WiFi + NWMSPi_SetWiFiReset(FALSE); + OS_Sleep(1); // wait 1msec + // set WiFi_RST to enable WiFi + NWMSPi_SetWiFiReset(TRUE); + { + NWMCallback *cb; + + NWMSP_ClearAPIActiveFlag(NWM_APIID_INSTALL_FIRMWARE); + // 正常終了 + cb = (NWMCallback *)NWMSP_GetBuffer4Callback2Nwm9(); + cb->apiid = NWM_APIID_INSTALL_FIRMWARE; + cb->retcode = NWM_RETCODE_FATAL_ERROR; + NWMSP_ReturnResult2Nwm9((void *)cb); + return; + } +\#endif // NWM_WRACK_FIRMWARE +__WRACK_FIRMWARE__ + } + print OUT $line; + + +} +close(OUT); + diff --git a/build/tests/WirelessChecker/readme.txt b/build/tests/WirelessChecker/readme.txt new file mode 100644 index 00000000..980f4e29 --- /dev/null +++ b/build/tests/WirelessChecker/readme.txt @@ -0,0 +1,62 @@ +* WirelessChecker - 本体デバッグ用 無線機能チェックプログラム + +- 確認手順 + +1. 本体無線フラグの確認 + + 上画面の「無線ON/OFF設定」および「無線強制OFF本体」の設定を確認してください。 + 無線が使用できる状態は、以下の状態です。 + + 無線ON/OFF設定[ON ] + 無線強制OFF本体[No ] + + +2. DS無線の初期化テスト + + DS無線の初期化→スキャン→終了をテストします。 + アクティブスキャン(電波を出すスキャン)を行います。 + LEDの点滅を確認することで無線が正常に動作していることを確認してください。 + また、無線ON/OFF設定をOFFにすることで、初期化が失敗することを確認してください。 + +3. TWL無線の初期化テスト + + TWL無線の初期化→スキャン→終了をテストします。 + アクティブスキャン(電波を出すスキャン)を行います。 + LEDの点滅を確認することで無線が正常に動作していることを確認してください。 + また、無線ON/OFF設定をOFFにすることで、初期化が失敗することを確認してください。 + +4. FATALエラーリカバリテスト + + TWL無線モジュールのファームウェア壊れをエミュレートし、それによるFATALエラー発生後、 + アプリジャンプによるハードウェアリセットで、ファームウェアがロードし直されていることを確認します。 + 再起動後に自動的にTWL無線の初期化チェックを行います。初期化チェックが成功し、LEDが点滅していることを確認してください。 + +(以下の項目はオプションです。) + +5. FATALエラーエミュレーション + 項目4.のFATALエラーを手動で起こします。この操作を行った後、「TWL無線の初期化テスト」が失敗することを確認してください。 + + +- TODO + +・NOAとかのデバッグにむけて英語表示も対応(?) + +- 変更履歴 + +- 080801 + NANDアプリに対応。 + バナー追加。 + ゲームコード追加。 + +- 080731 + FINALROMでビルド。 + テスト用のプリントデバッグが出ていたのを修正。 + コマンドログを日本語化。 + TwlSDK 5.0 RC1でビルド。 + +- 080730 + 下画面に簡易ヘルプを表示。 + +- 080725 + 最初のリリース + diff --git a/build/tests/WirelessChecker/resources/ds_ipl10.bmp b/build/tests/WirelessChecker/resources/ds_ipl10.bmp new file mode 100644 index 00000000..6fc8eedc Binary files /dev/null and b/build/tests/WirelessChecker/resources/ds_ipl10.bmp differ diff --git a/build/tests/WirelessChecker/rsf/Makefile b/build/tests/WirelessChecker/rsf/Makefile new file mode 100644 index 00000000..93cda094 --- /dev/null +++ b/build/tests/WirelessChecker/rsf/Makefile @@ -0,0 +1,37 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: NitroWiFi - demos - ps-ping +# File: Makefile +# +# Copyright 2005 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. +# +# $Log: Makefile,v $ +# +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +# Generate my own lsf from original lsf of mongoose +RSF_ORG = $(ROOT)/include/twl/specfiles/ROM-TS.rsf +MAKE_RSF = make_rsf.pl + +AUTOGEN_RSF = wireless_checker.rsf + +LDIRT_CLEAN = $(AUTOGEN_RSF) + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +do-build: $(AUTOGEN_RSF) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +$(AUTOGEN_RSF): $(RSF_ORG) $(MAKE_RSF) + @echo " make:" $@ + perl $(MAKE_RSF) $(AUTOGEN_RSF) + +#===== End of Makefile ===== diff --git a/build/tests/WirelessChecker/rsf/make_rsf.pl b/build/tests/WirelessChecker/rsf/make_rsf.pl new file mode 100755 index 00000000..49691859 --- /dev/null +++ b/build/tests/WirelessChecker/rsf/make_rsf.pl @@ -0,0 +1,97 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlWLAN - demos - wifi +# File: make_rsf.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $ROOT; + +# search TWLSDK_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWLSDK_ROOT/s) { + $ROOT = $ENV{$_}; + } +} + +my $src1 = "$ROOT/include/twl/specfiles/ROM-TS.rsf"; +my $dst1 = "wireless_checker.rsf"; + + +my $rn = "\x0D\x0A"; + +open(F, $src1) or die "cant open $src1\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst1") or die "cant open $dst1\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/TitleName\t+/ ) + { + $line =~ s/\t\#?TitleName.*\".*\"/\tTitleName\t\t\"WLAN CHECKER\"/; + } + + if( $line =~ m/^\tBannerFile/ ) + { + print OUT "\tBannerFile\t\t\$(BANNER_FILE)", $rn; + print OUT $rn, "\t#", $rn; + print OUT "\t# Permit LandingNormalJump: for TWL \"ApplicationJump\" function [TRUE/FALSE]", $rn; + print OUT "\t#", $rn; + print OUT "\tPermitLandingNormalJump\tTRUE", $rn; + next; + } + + print OUT $line; +} +close(OUT); + + +my $src2 = "$ROOT/include/twl/specfiles/ROM-TS_nand.rsf"; +my $dst2 = "wireless_checker_nand.rsf"; + +open(F, $src2) or die "cant open $src2\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst2") or die "cant open $dst2\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^\tBannerFile/ ) + { + print OUT "\tBannerFile\t\t\$(BANNER_FILE)", $rn; + next; + } + + if( $line =~ m/InitialCode\t+/ ) + { + $line =~ s/\t\#?InitialCode.*[a-zA-Z0-9]{4}/\tInitialCode\t\t\t\t000A/; + } + + if( $line =~ m/TitleName\t+/ ) + { + $line =~ s/\t\#?TitleName.*\".*\"/\tTitleName\t\t\"WLAN CHECKER\"/; + } + + if( $line =~ m/PermitLandingNormalJump/ ) + { + $line =~ s/\t\#?.*(TRUE|FALSE)/\tPermitLandingNormalJump\tTRUE/; + } + + print OUT $line; +} \ No newline at end of file diff --git a/build/tests/WirelessChecker/src/frame.cpp b/build/tests/WirelessChecker/src/frame.cpp new file mode 100644 index 00000000..c8582dc0 --- /dev/null +++ b/build/tests/WirelessChecker/src/frame.cpp @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: main.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "frame.h" + +namespace +{ + +} + +CFrame::CFrame() : m_itemIndex(ITEM_TEST_WM) +{ + OS_InitMessageQueue(&m_EntrMsgq, m_EntrMsg, sizeof(m_EntrMsg)/sizeof(m_EntrMsg[0])); + +} + +CFrame::CFrame(u8 item) +{ + m_itemIndex = item; + OS_InitMessageQueue(&m_EntrMsgq, m_EntrMsg, sizeof(m_EntrMsg)/sizeof(m_EntrMsg[0])); +} + +CFrame::~CFrame() +{ + +} + +void +CFrame::InitDisp() +{ + util::CCanvas* pcm = util::GetMain1Canvas(); + util::CCanvas* pcs = util::GetSub1Canvas(); + + pcm->Clear(util::COLOR_BLACK); + pcs->Clear(util::COLOR_BLACK); + pcm->Printf(16*5, 0, util::COLOR_WHITE, L"無線機能確認ツール"); + pcm->Printf(96, 16*1, util::COLOR_WHITE, L"BUILD TIME: %s %s", L""__DATE__, L""__TIME__); + + DrawBorder(pcm, 4, 16*2 + 4, 256 - 8, 192 - (16*2 + 4), util::COLOR_WHITE); + pcm->Printf(16*1, 16*3, util::COLOR_WHITE, L"無線ON/OFF設定[ %s ]", TRUE == OS_IsAvailableWireless() ? L"ON ":L"OFF"); + pcm->Printf(16*8, 16*3, util::COLOR_WHITE, L"無線強制OFF本体[ %s ]", TRUE == OS_IsForceDisableWireless() ? L"Yes":L"No "); + + pcm->Printf(16*2, 16*5, util::COLOR_WHITE, L"DS無線の初期化テスト"); + pcm->Printf(16*2, 16*6, util::COLOR_WHITE, L"TWL無線の初期化テスト"); + pcm->Printf(16*2, 16*7, util::COLOR_WHITE, L"FATALエラーエミュレーション"); + pcm->Printf(16*2, 16*8, util::COLOR_WHITE, L"FATALエラーリカバリテスト"); + + DrawBorder(pcs, 4, 16*9 + 4, 256 - 8, 192 - (16*9 + 4), util::COLOR_WHITE); +} + +void +CFrame::CursorDisp(int xpos, int ystart, util::PaletteColor color) +{ + util::CCanvas* pcm = util::GetMain1Canvas(); + pcm->Clear(xpos, ystart, 16, 16*ITEM_NUM, util::COLOR_BLACK); + pcm->Print(xpos, ystart + 16*GetItemIndex(), color, L"■"); +} + +void +CFrame::HelpDisp(util::PaletteColor color) +{ + util::CCanvas* pcs = util::GetSub1Canvas(); + pcs->Clear(8, 16*9 + 8, 256 - 16, 16*2, util::COLOR_BLACK); + + wchar_t *pHelpString1, *pHelpString2; + + switch (GetItemIndex()) + { + case ITEM_TEST_WM: + pHelpString1 = L"DS無線の初期化テストを行います。"; + pHelpString2 = L"LEDの点滅を確認してください。"; + break; + case ITEM_TEST_NWM: + pHelpString1 = L"TWL無線の初期化テストを行います。"; + pHelpString2 = L"LEDの点滅を確認してください。"; + break; + case ITEM_TEST_FATAL: + pHelpString1 = L"FATALエラーを発生させ、TWL無線を使えなくします"; + pHelpString2 = L"HWリセットで回復します。"; + break; + case ITEM_TEST_RECOVERY: + pHelpString1 = L"FATALエラーのリカバリーをテストします。"; + pHelpString2 = L"再起動後にTWL無線初期化を確認してください。"; + break; + } + pcs->Print(8, 16*9 + 8, color, pHelpString1); + pcs->Print(8, 16*10 + 8, color, pHelpString2); +} + +BOOL +CFrame::AutoEnter() +{ + return OS_SendMessage(&m_EntrMsgq, (OSMessage)TRUE, OS_MESSAGE_NOBLOCK); +} + +void +CFrame::ProcessButton() +{ + if (util::IsPadTrigger(PAD_KEY_UP)) + { + decRound(); + } else + if (util::IsPadTrigger(PAD_KEY_DOWN)) + { + incRound(); + } + + if (util::IsPadTrigger(PAD_BUTTON_A)) + { + if (FALSE == OS_SendMessage(&m_EntrMsgq, (OSMessage)TRUE, OS_MESSAGE_NOBLOCK)) + { + // already entered + } + } +} + +BOOL +CFrame::IsEnter() +{ + OSMessage msg; + return OS_ReceiveMessage(&m_EntrMsgq, &msg, OS_MESSAGE_NOBLOCK); + +} + +void +CFrame::DrawBorder(util::CCanvas* pCanvas, int px, int py, int pw, int ph, util::PaletteColor color) +{ + pCanvas->Clear(px, py, pw, 1, color); + pCanvas->Clear(px, py + ph - 1, pw, 1, color); + pCanvas->Clear(px, py + 1, 1, ph - 2, color); + pCanvas->Clear(px + pw - 1, py + 1, 1, ph - 2, color); +} diff --git a/build/tests/WirelessChecker/src/frame.h b/build/tests/WirelessChecker/src/frame.h new file mode 100644 index 00000000..2fec1121 --- /dev/null +++ b/build/tests/WirelessChecker/src/frame.h @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: frame.h + + Copyright 2007 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 WIRELESS_CHECHER_FRAME_H_ +#define WIRELESS_CHECHER_FRAME_H_ + +#include +#include "util/util.h" +#include + +class CFrame +{ +public: + enum { + ITEM_TEST_WM, + ITEM_TEST_NWM, + ITEM_TEST_FATAL, + ITEM_TEST_RECOVERY, + ITEM_NUM + }; +private: + u8 m_itemIndex; + OSMessageQueue m_EntrMsgq; + OSMessage m_EntrMsg[1]; + BOOL m_isEnter; + + static const u8 m_itemNum = ITEM_NUM; + void incRound() + { + if (m_itemNum) + { + m_itemIndex = (u8)((m_itemIndex + 1)%m_itemNum); + } + } + void decRound() + { + if (m_itemNum) + { + m_itemIndex = (u8)((m_itemNum + m_itemIndex - 1)%m_itemNum); + } + } +public: + CFrame(); + CFrame(u8 item); + virtual ~CFrame(); + void InitDisp(); + void CursorDisp(int xpos, int ystart, util::PaletteColor color); + void HelpDisp(util::PaletteColor color); + virtual void ProcessButton(); + u8 GetItemIndex() + { + return m_itemIndex; + } + BOOL IsEnter(); + BOOL AutoEnter(); + void DrawBorder(util::CCanvas* pCanvas, int px, int py, int pw, int ph, util::PaletteColor color); +}; + +#endif // WIRELESS_CHECHER_TEST_NWM_H_ diff --git a/build/tests/WirelessChecker/src/main.cpp b/build/tests/WirelessChecker/src/main.cpp new file mode 100644 index 00000000..0069788b --- /dev/null +++ b/build/tests/WirelessChecker/src/main.cpp @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: main.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "frame.h" +#include "test_wm.h" +#include "test_nwm.h" +#include "test_fatal.h" +#include "test_recovery.h" +#include + +namespace +{ + +} +// end of anonymous namespace + + +void +TwlStartUp(void) +{ + +} + +void +TwlMain(void) +{ + BOOL isFatalChecking = FALSE; + util::Init(); + + OSDeliverArgInfo argInfo; + if (TRUE == OS_IsValidDeliverArg()) + { + OS_InitDeliverArgInfo(&argInfo, 0); + OS_DecodeDeliverArg(); + if( (OS_GetDeliverArgc() > 0) && ( STD_CompareNString( (const char *)OS_GetDeliverArgv(1), "fatal", 3 ) == 0 ) ) + { + isFatalChecking = TRUE; + } + } + + // display on + util::WaitVBlankIntr(); + util::dispOn(); + + CFrame menu(isFatalChecking == TRUE ? CFrame::ITEM_TEST_RECOVERY:CFrame::ITEM_TEST_WM); + if (isFatalChecking == TRUE) + { + menu.AutoEnter(); + } + CTestWm wm; + CTestNwm nwm; + CTestFatal fatal; + CTestRecovery rcv; + menu.InitDisp(); + + for (;;) + { + util::UpdateGamePad(); + menu.ProcessButton(); + menu.CursorDisp(16*1, 16*5, util::COLOR_LIMEGREEN); + menu.HelpDisp(util::COLOR_WHITE); + + if (menu.IsEnter()) + { + BOOL result; + u8 itemidx = menu.GetItemIndex(); + util::CCanvas* pcm = util::GetMain1Canvas(); + + switch (itemidx) + { + case CFrame::ITEM_TEST_WM: + pcm->Clear(16*12, 16*5, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*5, util::COLOR_YELLOW, L"TESTING"); + util::WaitVBlankIntr(); + util::UpdateDisplay(); + result = wm.WirelessTest(); + pcm->Clear(16*12, 16*5, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*5, result == TRUE ? util::COLOR_TURQUOISE:util::COLOR_RED, result == TRUE ? L"SUCCESS":L"FAILURE"); + break; + case CFrame::ITEM_TEST_NWM: + pcm->Clear(16*12, 16*6, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*6, util::COLOR_YELLOW, L"TESTING"); + util::WaitVBlankIntr(); + util::UpdateDisplay(); + result = nwm.WirelessTest(); + pcm->Clear(16*12, 16*6, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*6, result == TRUE ? util::COLOR_TURQUOISE:util::COLOR_RED, result == TRUE ? L"SUCCESS":L"FAILURE"); + break; + case CFrame::ITEM_TEST_FATAL: + pcm->Clear(16*12, 16*7, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*7, util::COLOR_YELLOW, L"TESTING"); + result = fatal.WrackTest(); + pcm->Clear(16*12, 16*7, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*7, result == TRUE ? util::COLOR_TURQUOISE:util::COLOR_RED, result == TRUE ? L"SUCCESS":L"FAILURE"); + break; + case CFrame::ITEM_TEST_RECOVERY: + pcm->Clear(16*12, 16*8, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*8, util::COLOR_YELLOW, L"TESTING"); + if (isFatalChecking == FALSE) + { + result = rcv.RecoveryTest(); + } else { + result = rcv.RecoveryTest2(); + isFatalChecking = FALSE; + } + pcm->Clear(16*12, 16*8, 16*3, 16, util::COLOR_BLACK); + pcm->Print(16*12, 16*8, result == TRUE ? util::COLOR_TURQUOISE:util::COLOR_RED, result == TRUE ? L"SUCCESS":L"FAILURE"); + break; + } + } + + util::WaitVBlankIntr(); + util::UpdateDisplay(); + } + +} diff --git a/build/tests/WirelessChecker/src/test.cpp b/build/tests/WirelessChecker/src/test.cpp new file mode 100644 index 00000000..4dd480af --- /dev/null +++ b/build/tests/WirelessChecker/src/test.cpp @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: main.cpp + + Copyright 2007 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 "util/canvas.h" +#include "util/util.h" +#include "util/wprintf.h" +#include +#include +#include +#include +//#include +#include +#include "test.h" + +CTest::CTest() : m_state(TEST_STATE_NONE) +{ + m_pc = util::GetSub1Canvas(); +} + +CTest::~CTest() +{ + +} + +BOOL +CTest::Init(void) +{ + return TRUE; +} + +BOOL +CTest::Enable(void) +{ + return TRUE; +} + +BOOL +CTest::ScanTest(void) +{ + return TRUE; +} + +BOOL +CTest::Disable(void) +{ + return TRUE; +} + +BOOL +CTest::End(void) +{ + return TRUE; +} + +u8 +CTest::GetState(void) +{ + return m_state; +} + +void CTest::LogClear(util::CCanvas* pc) +{ + pc->Clear(0, 0, 256, 16*9, util::COLOR_BLACK); + m_line = 0; + util::WaitVBlankIntr(); + util::UpdateDisplay(); +} + +void +CTest::LogPrintf(util::CCanvas* pc, const NNSG2dChar* text, ...) +{ + std::auto_ptr pLocalBuffer(new wchar_t[LOCAL_BUFFER_LEN]); + va_list args; + + va_start(args, text); + util::VSNWPrintf(pLocalBuffer.get(), LOCAL_BUFFER_LEN, text, args); + va_end(args); + pc->Print(16*1, 16*m_line++, util::COLOR_WHITE, pLocalBuffer.get()); + util::WaitVBlankIntr(); + util::UpdateDisplay(); +} diff --git a/build/tests/WirelessChecker/src/test.h b/build/tests/WirelessChecker/src/test.h new file mode 100644 index 00000000..21c4d985 --- /dev/null +++ b/build/tests/WirelessChecker/src/test.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: test.h + + Copyright 2007 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 WIRELESS_CHECHER_TEST_H_ +#define WIRELESS_CHECHER_TEST_H_ + +#include +#include "util/util.h" +#include "util/canvas.h" +#include +#include +#include + +class CTest + +{ +private: + u8 m_line; + static const int LOCAL_BUFFER_LEN = 1024; +public: + enum { + TEST_STATE_NONE, + TEST_STATE_INITIALIZED, + TEST_STATE_ENABLED, + TEST_STATE_NUM + }; + u8 m_state; + util::CCanvas *m_pc; + CTest(); + virtual ~CTest(); + virtual BOOL Init(void); + virtual BOOL Enable(void); + virtual BOOL ScanTest(void); + virtual BOOL Disable(void); + virtual BOOL End(void); + u8 GetState(void); + void LogClear(util::CCanvas* pc); + void LogPrintf(util::CCanvas* pc, const NNSG2dChar* text, ...); +}; + +#endif // WIRELESS_CHECHER_TEST_H_ diff --git a/build/tests/WirelessChecker/src/test_fatal.cpp b/build/tests/WirelessChecker/src/test_fatal.cpp new file mode 100644 index 00000000..a3684aca --- /dev/null +++ b/build/tests/WirelessChecker/src/test_fatal.cpp @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: test_fatal.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "test_fatal.h" +#include "nwm_arm9_private.h" +#pragma exceptions on + +extern "C" { +extern NWMRetCode NWMi_WrackFirmware(NWMCallbackFunc callback); +} + +namespace +{ + OSMessageQueue m_AsyncMsgq; + OSMessage m_AsyncMsg[1]; + + void m_WrackFirmCallback(void *arg) + { + NWMCallback *cb = (NWMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_FATAL_ERROR ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_InitMessage(void) + { + OS_InitMessageQueue(&m_AsyncMsgq, m_AsyncMsg, sizeof(m_AsyncMsg)/sizeof(m_AsyncMsg[0])); + } + + BOOL m_WaitCallback(void) + { + OSMessage msg; + (void)OS_ReceiveMessage(&m_AsyncMsgq, &msg, OS_MESSAGE_BLOCK); + return (BOOL)msg; + } +} + + + + + +CTestFatal::CTestFatal() +{ + m_InitMessage(); +} + +CTestFatal::~CTestFatal() +{ + +} + +BOOL +CTestFatal::Wrack(void) +{ + try + { + if (m_state < TEST_STATE_INITIALIZED) + { + throw L"ステートが不正です.\n"; + } + + if (NWM_RETCODE_OPERATING != NWMi_WrackFirmware(m_WrackFirmCallback)) + { + throw L"WrackFirmware 失敗.\n"; + } + if (m_WaitCallback() == FALSE) + { + throw L"WrackFirmware 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WrackFirmware 成功.\n"); + + } + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + return TRUE; +} + +BOOL +CTestFatal::WrackTest(void) +{ + try + { + if (FALSE == Init()) + { + throw L"Init() 失敗.\n"; + } + + if (FALSE == Wrack()) + { + End(); + throw L"Wrack() 失敗.\n"; + } + + if (FALSE == End()) + { + throw L"End() 失敗.\n"; + } + } + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + LogPrintf(m_pc, L"テストが完了しました.\n"); + + return TRUE; +} diff --git a/build/tests/WirelessChecker/src/test_fatal.h b/build/tests/WirelessChecker/src/test_fatal.h new file mode 100644 index 00000000..128d582d --- /dev/null +++ b/build/tests/WirelessChecker/src/test_fatal.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: test_fatal.h + + Copyright 2007 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 WIRELESS_CHECHER_TEST_FATAL_H_ +#define WIRELESS_CHECHER_TEST_FATAL_H_ + +#include +#include "test.h" +#include "test_nwm.h" +#include "util/canvas.h" + +class CTestFatal + : public CTestNwm +{ +private: +public: + CTestFatal(); + virtual ~CTestFatal(); + BOOL Wrack(void); + BOOL WrackTest(void); +}; + + +#endif // WIRELESS_CHECHER_TEST_FATAL_H_ diff --git a/build/tests/WirelessChecker/src/test_nwm.cpp b/build/tests/WirelessChecker/src/test_nwm.cpp new file mode 100644 index 00000000..127afab7 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_nwm.cpp @@ -0,0 +1,355 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: test_nwm.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "test_nwm.h" +#pragma exceptions on + +namespace test_nwm +{ + OSMessageQueue m_AsyncMsgq; + OSMessage m_AsyncMsg[1]; + void m_InitMessage(void); + + void m_LoadDeviceCallback(void *arg) + { + NWMCallback *cb = (NWMCallback*)arg; + + // TODO: get FW ver and RegDomain? + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + } + + void m_OpenCallback(void *arg) + { + NWMCallback *cb = (NWMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_UnloadDeviceCallback(void *arg) + { + NWMCallback *cb = (NWMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + } + + void m_CloseCallback(void *arg) + { + NWMCallback *cb = (NWMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_ScanCallback(void *arg) + { + NWMStartScanCallback *cb = (NWMStartScanCallback*)arg; + + OS_TPrintf("Number of BSS: %d\n", cb->bssDescCount); + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->retcode == NWM_RETCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_InitMessage(void) + { + OS_InitMessageQueue(&m_AsyncMsgq, m_AsyncMsg, sizeof(m_AsyncMsg)/sizeof(m_AsyncMsg[0])); + } + + BOOL m_WaitCallback(void) + { + OSMessage msg; + (void)OS_ReceiveMessage(&m_AsyncMsgq, &msg, OS_MESSAGE_BLOCK); + return (BOOL)msg; + } +} + + + + + +CTestNwm::CTestNwm() : m_pNwmBuffer(0), m_pScanBuffer(0) +{ + test_nwm::m_InitMessage(); +} + +CTestNwm::~CTestNwm() +{ + +} + + +BOOL +CTestNwm::Init(void) +{ + LogClear(m_pc); + + try + { + if (m_state != TEST_STATE_NONE) + { + throw L"ステートが不正です.\n"; + } + if (m_pNwmBuffer) + { + delete [] m_pNwmBuffer; + m_pNwmBuffer = 0; + throw L"NWMバッファが不正です.\n"; + } + + m_pNwmBuffer = new u8 [NWM_SYSTEM_BUF_SIZE + 0x20]; + + + if (NWM_RETCODE_SUCCESS != NWM_Init((void*)MATH_ROUNDUP((u32)m_pNwmBuffer, 32), NWM_SYSTEM_BUF_SIZE, m_DmaNo)) + { + throw L"NWM_Init 失敗.\n"; + } + + LogPrintf(m_pc, L"NWM_Init 成功.\n"); + } + + catch (const wchar_t* string) + { + delete [] m_pNwmBuffer; + m_pNwmBuffer = 0; + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_INITIALIZED; + + return TRUE; +} + +BOOL +CTestNwm::Enable(void) +{ + try { + if (m_state != TEST_STATE_INITIALIZED) + { + throw L"ステートが不正です.\n"; + } + + if (NWM_RETCODE_OPERATING != NWM_LoadDevice(test_nwm::m_LoadDeviceCallback)) + { + throw L"NWM_LoadDevice 失敗.\n"; + } + + if (test_nwm::m_WaitCallback() == FALSE) + { + throw L"NWM_LoadDevice 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"NWM_LoadDevice 成功.\n"); + + if (NWM_RETCODE_OPERATING != NWM_Open(test_nwm::m_OpenCallback)) + { + throw L"NWM_Open 失敗.\n"; + } + if (test_nwm::m_WaitCallback() == FALSE) + { + throw L"NWM_Open 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"NWM_Open 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + m_state = TEST_STATE_ENABLED; + return TRUE; +} + +BOOL +CTestNwm::ScanTest(void) +{ + try + { + + if (m_state != TEST_STATE_ENABLED) + { + throw L"ステートが不正です.\n"; + } + + if (m_pScanBuffer) + { + throw L"Scanバッファが不正です.\n"; + } + + m_pScanBuffer = new u8 [NWM_SIZE_SCANBUF_MAX + 0x20]; + + NWMScanParam param; + + MI_CpuClear8(m_pScanBuffer, NWM_SIZE_SCANBUF_MAX + 0x20); + DC_StoreRange(m_pScanBuffer, NWM_SIZE_SCANBUF_MAX + 0x20); + param.scanBuf = (NWMBssDesc*)MATH_ROUNDUP((u32)m_pScanBuffer, 32); + param.scanBufSize = NWM_SIZE_SCANBUF_MAX; + param.channelList = (u16)(NWM_GetAllowedChannel() >> 1); + param.channelDwellTime = NWM_GetDispersionScanPeriod(NWM_SCANTYPE_ACTIVE); + param.scanType = NWM_SCANTYPE_ACTIVE; + param.ssidLength = 0; + MI_CpuFill8(param.ssid, 0xFF, sizeof(param.ssid)); + + if (NWM_RETCODE_OPERATING != NWM_StartScan(test_nwm::m_ScanCallback, ¶m)) + { + throw L"NWM_StartScan 失敗.\n"; + } + + if (test_nwm::m_WaitCallback() == FALSE) + { + throw L"NWM_StartScan 非同期処理失敗.\n"; + } + + LogPrintf(m_pc, L"NWM_StartScan 成功.\n"); + + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + delete [] m_pScanBuffer; + m_pScanBuffer = 0; + + return TRUE; +} + +BOOL +CTestNwm::Disable(void) +{ + try { + if (m_state != TEST_STATE_ENABLED) + { + throw L"ステートが不正です.\n"; + } + + if (NWM_RETCODE_OPERATING != NWM_Close(test_nwm::m_CloseCallback)) + { + throw L"NWM_Close 失敗.\n"; + } + if (test_nwm::m_WaitCallback() == FALSE) + { + throw L"NWM_Close 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"NWM_Close 成功.\n"); + + if (NWM_RETCODE_OPERATING != NWM_UnloadDevice(test_nwm::m_UnloadDeviceCallback)) + { + throw L"NWM_UnloadDevice 失敗.\n"; + } + if (test_nwm::m_WaitCallback() == FALSE) + { + throw L"NWM_UnloadDevice 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"NWM_UnloadDevice 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + m_state = TEST_STATE_INITIALIZED; + return TRUE; + +} + +BOOL +CTestNwm::End(void) +{ + try + { + if (m_state != TEST_STATE_INITIALIZED) + { + throw L"ステートが不正です.\n"; + } + if (NWM_RETCODE_SUCCESS != NWM_End()) + { + throw L"NWM_End 失敗.\n"; + } + + LogPrintf(m_pc, L"NWM_End 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_NONE; + delete [] m_pNwmBuffer; + m_pNwmBuffer = 0; + + return TRUE; +} + +BOOL +CTestNwm::WirelessTest(void) +{ + try + { + if (FALSE == Init()) + { + throw L"Init() 失敗.\n"; + } + if (FALSE == Enable()) + { + End(); + throw L"Enable() 失敗.\n"; + } + if (FALSE == ScanTest()) + { + Disable(); + End(); + throw L"ScanTest() 失敗.\n"; + } + if (FALSE == Disable()) + { + throw L"Disable() 失敗.\n"; + } + if (FALSE == End()) + { + throw L"End() 失敗.\n"; + } + } + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + LogPrintf(m_pc, L"テストが完了しました.\n"); + + return TRUE; +} diff --git a/build/tests/WirelessChecker/src/test_nwm.h b/build/tests/WirelessChecker/src/test_nwm.h new file mode 100644 index 00000000..cbc725f6 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_nwm.h @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: test_nwm.h + + Copyright 2007 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 WIRELESS_CHECHER_TEST_NWM_H_ +#define WIRELESS_CHECHER_TEST_NWM_H_ + +#include +#include "test.h" + +namespace test_nwm +{ + void m_LoadDeviceCallback(void *arg); + void m_OpenCallback(void *arg); + void m_UnloadDeviceCallback(void *arg); + void m_CloseCallback(void *arg); + void m_ScanCallback(void *arg); + BOOL m_WaitCallback(void); +} + +class CTestNwm + : public CTest +{ +private: + static const u8 m_DmaNo = 3; + u8 *m_pNwmBuffer; + u8 *m_pScanBuffer; +public: + CTestNwm(); + virtual ~CTestNwm(); + BOOL Init(void); + BOOL Enable(void); + BOOL ScanTest(void); + BOOL Disable(void); + BOOL End(void); + BOOL WirelessTest(void); +}; + + +#endif // WIRELESS_CHECHER_TEST_NWM_H_ diff --git a/build/tests/WirelessChecker/src/test_recovery.cpp b/build/tests/WirelessChecker/src/test_recovery.cpp new file mode 100644 index 00000000..ab8ae1f0 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_recovery.cpp @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: test_recovery.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "test_recovery.h" +#include "nwm_arm9_private.h" +#pragma exceptions on + + +CTestRecovery::CTestRecovery() +{ +} + +CTestRecovery::~CTestRecovery() +{ + +} + + +BOOL +CTestRecovery::RecoveryTest(void) +{ + try + { + if (FALSE == Init()) + { + throw L"Init() 失敗.\n"; + } + + if (FALSE == Enable()) + { + End(); + throw L"Enable() 失敗.\n"; + } + + if (FALSE == Wrack()) + { + Disable(); + End(); + throw L"Wrack() 失敗.\n"; + } + + LogPrintf(m_pc, L"FATALエラーを待っています.\n"); + + if (TRUE == test_nwm::m_WaitCallback()) + { + Disable(); + End(); + throw L"FATALエラーが起こりませんでした.\n"; + } + + LogPrintf(m_pc, L"FATALエラーが発生しました.\n"); + } + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_INITIALIZED; + End(); + LogPrintf(m_pc, L"3秒後にHWリセットを行います.\n"); + OS_Sleep(3000); + + OSDeliverArgInfo argInfo; + OS_InitDeliverArgInfo(&argInfo, 0); + OSi_SetDeliverArgState( OS_DELIVER_ARG_BUF_ACCESSIBLE | OS_DELIVER_ARG_BUF_WRITABLE ); + OS_SetStringToDeliverArg( "fatal" ); + OS_EncodeDeliverArg(); + OS_DoApplicationJump( + *(const OSTitleId*)(HW_TWL_ROM_HEADER_BUF + 0x230), + OS_APP_JUMP_NORMAL); + + return TRUE; +} + +BOOL +CTestRecovery::RecoveryTest2(void) +{ + return WirelessTest(); +} + diff --git a/build/tests/WirelessChecker/src/test_recovery.h b/build/tests/WirelessChecker/src/test_recovery.h new file mode 100644 index 00000000..c346bc17 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_recovery.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: test_recovery.h + + Copyright 2007 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 WIRELESS_CHECHER_TEST_RECOVERY_H_ +#define WIRELESS_CHECHER_TEST_RECOVERY_H_ + +#include +#include "test.h" +#include "test_fatal.h" +#include "util/canvas.h" + +class CTestRecovery + : public CTestFatal +{ +private: +public: + CTestRecovery(); + ~CTestRecovery(); + BOOL RecoveryTest(void); + BOOL RecoveryTest2(void); +}; + + +#endif // WIRELESS_CHECHER_TEST_RECOVERY_H_ diff --git a/build/tests/WirelessChecker/src/test_wm.cpp b/build/tests/WirelessChecker/src/test_wm.cpp new file mode 100644 index 00000000..f2b2a151 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_wm.cpp @@ -0,0 +1,376 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: test_nwm.cpp + + Copyright 2007 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 "util/util.h" +#include "util/canvas.h" +#include "test_wm.h" +#pragma exceptions on + +namespace +{ + OSMessageQueue m_AsyncMsgq; + OSMessage m_AsyncMsg[1]; + + void m_EnableCallback(void *arg) + { + WMCallback *cb = (WMCallback*)arg; + + // TODO: get FW ver and RegDomain? + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + } + + void m_PowerOnCallback(void *arg) + { + WMCallback *cb = (WMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_DisableCallback(void *arg) + { + WMCallback *cb = (WMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + } + + void m_PowerOffCallback(void *arg) + { + WMCallback *cb = (WMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_ScanCallback(void *arg) + { + WMStartScanExCallback *cb = (WMStartScanExCallback*)arg; + + OS_TPrintf("Number of BSS: %d\n", cb->bssDescCount); + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_EndScanCallback(void *arg) + { + WMCallback *cb = (WMCallback*)arg; + + if (FALSE == OS_SendMessage(&m_AsyncMsgq, (OSMessage)(cb->errcode == WM_ERRCODE_SUCCESS ? TRUE:FALSE), OS_MESSAGE_NOBLOCK)) + { + } + + } + + void m_InitMessage(void) + { + OS_InitMessageQueue(&m_AsyncMsgq, m_AsyncMsg, sizeof(m_AsyncMsg)/sizeof(m_AsyncMsg[0])); + } + + BOOL m_WaitCallback(void) + { + OSMessage msg; + (void)OS_ReceiveMessage(&m_AsyncMsgq, &msg, OS_MESSAGE_BLOCK); + return (BOOL)msg; + } +} + + + + + +CTestWm::CTestWm() : m_pWmBuffer(0), m_pScanBuffer(0) +{ + m_InitMessage(); + m_pc = util::GetSub1Canvas(); +} + +CTestWm::~CTestWm() +{ + +} + + +BOOL +CTestWm::Init(void) +{ + LogClear(m_pc); + + try + { + if (m_state != TEST_STATE_NONE) + { + throw L"ステートが不正です.\n"; + } + if (m_pWmBuffer) + { + delete [] m_pWmBuffer; + m_pWmBuffer = 0; + throw L"WM用バッファが不正です.\n"; + } + + m_pWmBuffer = new u8 [WM_SYSTEM_BUF_SIZE + 0x20]; + + + if (WM_ERRCODE_SUCCESS != WM_Init((void*)MATH_ROUNDUP((u32)m_pWmBuffer, 32), m_DmaNo)) + { + throw L"WM_Init 失敗.\n"; + } + + LogPrintf(m_pc, L"WM_Init 成功.\n"); + + } + + catch (const wchar_t* string) + { + delete [] m_pWmBuffer; + m_pWmBuffer = 0; + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_INITIALIZED; + + return TRUE; +} + +BOOL +CTestWm::Enable(void) +{ + try { + + if (m_state != TEST_STATE_INITIALIZED) + { + throw L"ステートが不正です.\n"; + } + + if (WM_ERRCODE_OPERATING != WM_Enable(m_EnableCallback)) + { + throw L"WM_Enable 失敗.\n"; + } + if (m_WaitCallback() == FALSE) + { + throw L"WM_Enable 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_Enable 成功.\n"); + if (WM_ERRCODE_OPERATING != WM_PowerOn(m_PowerOnCallback)) + { + throw L"WM_PowerOn 失敗.\n"; + } + if (m_WaitCallback() == FALSE) + { + throw L"WM_PowerOn 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_PowerOn 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + m_state = TEST_STATE_ENABLED; + return TRUE; +} + +BOOL +CTestWm::ScanTest(void) +{ + try + { + + if (m_state != TEST_STATE_ENABLED) + { + throw L"ステートが不正です.\n"; + } + + if (m_pScanBuffer) + { + throw L"Scanバッファが不正です.\n"; + } + + m_pScanBuffer = new u8 [WM_SIZE_SCAN_EX_BUF + 0x20]; + + WMScanExParam param; + + MI_CpuClear8(m_pScanBuffer, WM_SIZE_SCAN_EX_BUF + 0x20); + DC_StoreRange(m_pScanBuffer, WM_SIZE_SCAN_EX_BUF + 0x20); + param.scanBuf = (WMBssDesc*)MATH_ROUNDUP((u32)m_pScanBuffer, 32); + param.scanBufSize = WM_SIZE_SCAN_EX_BUF; + param.channelList = (u16)WM_GetAllowedChannel(); + param.maxChannelTime = WM_GetDispersionScanPeriod(); + param.scanType = WM_SCANTYPE_ACTIVE; + param.ssidLength = 0; + MI_CpuFill8(param.ssid, 0xFF, sizeof(param.ssid)); + param.ssidMatchLength = 0; + + if (WM_ERRCODE_OPERATING != WM_StartScanEx(m_ScanCallback, ¶m)) + { + throw L"WM_StartScanEx 失敗.\n"; + } + + if (m_WaitCallback() == FALSE) + { + throw L"WM_StartScanEx 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_StartScanEx 成功.\n"); + + if (WM_ERRCODE_OPERATING != WM_EndScan(m_EndScanCallback)) + { + throw L"WM_EndScan 失敗.\n"; + } + + if (m_WaitCallback() == FALSE) + { + throw L"WM_EndScan 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_EndScan 成功.\n"); + + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + delete [] m_pScanBuffer; + m_pScanBuffer = 0; + + return TRUE; +} + +BOOL +CTestWm::Disable(void) +{ + try { + if (m_state != TEST_STATE_ENABLED) + { + throw L"ステートが不正です.\n"; + } + + if (WM_ERRCODE_OPERATING != WM_PowerOff(m_PowerOffCallback)) + { + throw L"WM_PowerOff 失敗.\n"; + } + if (m_WaitCallback() == FALSE) + { + throw L"WM_PowerOff 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_PowerOff 成功.\n"); + + if (WM_ERRCODE_OPERATING != WM_Disable(m_DisableCallback)) + { + throw L"WM_Disable 失敗.\n"; + } + if (m_WaitCallback() == FALSE) + { + throw L"WM_Disable 非同期処理失敗.\n"; + } + LogPrintf(m_pc, L"WM_Disable 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_INITIALIZED; + return TRUE; + +} + +BOOL +CTestWm::End(void) +{ + try + { + if (m_state != TEST_STATE_INITIALIZED) + { + throw L"ステートが不正です\n"; + } + if (WM_ERRCODE_SUCCESS != WM_Finish()) + { + throw L"WM_Finish 失敗.\n"; + } + LogPrintf(m_pc, L"WM_Finish 成功.\n"); + } + + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + m_state = TEST_STATE_NONE; + delete [] m_pWmBuffer; + m_pWmBuffer = 0; + + return TRUE; +} + +BOOL +CTestWm::WirelessTest(void) +{ + try + { + if (FALSE == Init()) + { + throw L"Init() 失敗.\n"; + } + if (FALSE == Enable()) + { + End(); + throw L"Enable() 失敗.\n"; + } + if (FALSE == ScanTest()) + { + Disable(); + End(); + throw L"ScanTest() 失敗.\n"; + } + if (FALSE == Disable()) + { + throw L"Disable() 失敗.\n"; + } + if (FALSE == End()) + { + throw L"End() 失敗.\n"; + } + } + catch (const wchar_t* string) + { + LogPrintf(m_pc, L"%s", string); + return FALSE; + } + + LogPrintf(m_pc, L"テストが完了しました.\n"); + + return TRUE; +} diff --git a/build/tests/WirelessChecker/src/test_wm.h b/build/tests/WirelessChecker/src/test_wm.h new file mode 100644 index 00000000..958a4919 --- /dev/null +++ b/build/tests/WirelessChecker/src/test_wm.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: test_wm.h + + Copyright 2007 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 WIRELESS_CHECHER_TEST_WM_H_ +#define WIRELESS_CHECHER_TEST_WM_H_ + +#include +#include "test.h" +#include "util/canvas.h" + +class CTestWm + : public CTest +{ +private: + static const u8 m_DmaNo = 3; + u8 *m_pWmBuffer; + u8 *m_pScanBuffer; +public: + CTestWm(); + virtual ~CTestWm(); + BOOL Init(void); + BOOL Enable(void); + BOOL ScanTest(void); + BOOL Disable(void); + BOOL End(void); + BOOL WirelessTest(void); +}; + + +#endif // WIRELESS_CHECHER_TEST_WM_H_ diff --git a/build/tests/WirelessChecker/src/util/canvas.cpp b/build/tests/WirelessChecker/src/util/canvas.cpp new file mode 100644 index 00000000..9e9156ef --- /dev/null +++ b/build/tests/WirelessChecker/src/util/canvas.cpp @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: Canvas.cpp + + Copyright 2007 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 "util/canvas.h" +#include "util/util.h" +#include "util/wprintf.h" +#include +#include +#include +#include +//#include +#include + +namespace util +{ + +CCanvas::CCanvas() +: m_pFont(NULL) +{ +} + +CCanvas::~CCanvas() +{ +} + +void +CCanvas::Init(NNS_GFD_DST_TYPE type, u32 offset, void* pScrBase, const NNSG2dFont* pFont) +{ + m_transType = type; + m_transOffset = offset; + m_pFont = pFont; + + NNS_G2dCharCanvasInitForBG( + &m_cc, + m_offscreen, + CANVAS_WIDTH, + CANVAS_HEIGHT, + NNS_G2D_CHARA_COLORMODE_16 ); + + NNS_G2dTextCanvasInit( + &m_txn, + &m_cc, + m_pFont, + TEXT_HSPACE, + TEXT_VSPACE ); + + NNS_G2dMapScrToCharText( + pScrBase, + CANVAS_WIDTH, + CANVAS_HEIGHT, + CANVAS_LEFT, + CANVAS_TOP, + NNS_G2D_TEXT_BG_WIDTH_256, + CANVAS_CHARACTER_OFFSET, + DEFAULT_COLOR_PALETTE ); +} + +void +CCanvas::Clear(PaletteColor c) +{ + NNS_G2dCharCanvasClear(&m_cc, c); + RegisterTransferTask(); +} + +void +CCanvas::Clear(int x, int y, int w, int h, PaletteColor c) +{ + const int px = MATH_CLAMP(x, 0, HW_LCD_WIDTH); + const int py = MATH_CLAMP(y, 0, HW_LCD_HEIGHT); + const int pw = MATH_CLAMP(x + w, px, HW_LCD_WIDTH) - px; + const int ph = MATH_CLAMP(y + h, py, HW_LCD_HEIGHT) - py; + + if( pw > 0 && ph > 0 ) + { + NNS_G2dCharCanvasClearArea(&m_cc, c, px, py, pw, ph); + RegisterTransferTask(); + } +} + +void +CCanvas::Print(int x, int y, PaletteColor c, const NNSG2dChar* text) +{ + NNS_G2dTextCanvasDrawText( + &m_txn, + x, + y, + c, + DRAWTEXT_FLAG_DEFAULT, + text ); + + RegisterTransferTask(); +} + +void +CCanvas::Printf(int x, int y, PaletteColor c, const NNSG2dChar* text, ...) +{ + std::auto_ptr pLocalBuffer(new wchar_t[LOCAL_BUFFER_LEN]); + va_list args; + + va_start(args, text); + VSNWPrintf(pLocalBuffer.get(), LOCAL_BUFFER_LEN, text, args); + va_end(args); + + Print(x, y, c, pLocalBuffer.get()); +} + + +void +CCanvas::RegisterTransferTask() +{ + if( ! m_bTransferRegsitered ) + { + NNS_GfdRegisterNewVramTransferTask( + m_transType, + m_transOffset, + m_offscreen, + sizeof(m_offscreen) ); + + m_bTransferRegsitered = true; + } +} + +void +CCanvas::ResetTransferTask() +{ + m_bTransferRegsitered = false; +} + + +std::wstring +CCanvas::WrapText(std::wstring text, int width) +{ + int textWidth = 0; + + for( u32 i = 0; i < text.length(); ++i ) + { + const int charWidth = NNS_G2dFontGetCharWidth(m_pFont, text[i]); + + if( text[i] == L'\n' ) + { + textWidth = 0; + } + else if( (textWidth > 0) && ((textWidth + charWidth) > width) ) + { + text.insert(i - 1, 1, L'\n'); + textWidth = 0; + } + else + { + textWidth += charWidth + TEXT_HSPACE; + } + } + + return text; +} + + + +} +// end of namespace tlib diff --git a/build/tests/WirelessChecker/src/util/canvas.h b/build/tests/WirelessChecker/src/util/canvas.h new file mode 100644 index 00000000..0e6c7781 --- /dev/null +++ b/build/tests/WirelessChecker/src/util/canvas.h @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: Canvas.h + + Copyright 2007 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 TLIB_CONTROL_CANVAS_H_ +#define TLIB_CONTROL_CANVAS_H_ + +#define NNS_G2D_UNICODE +#include +#include +#include +#include +#include "util.h" + +namespace util +{ + +class CCanvas +{ +private: + static const int CANVAS_WIDTH = 32; + static const int CANVAS_HEIGHT = 24; + static const int CANVAS_LEFT = 0; + static const int CANVAS_TOP = 0; + static const int TEXT_HSPACE = 1; + static const int TEXT_VSPACE = 1; + static const int CANVAS_CHARACTER_OFFSET = 1; + + static const int LOCAL_BUFFER_LEN = 1024; + + static const u32 DRAWTEXT_FLAG_DEFAULT = ( NNS_G2D_VERTICALORIGIN_TOP + | NNS_G2D_HORIZONTALORIGIN_LEFT + | NNS_G2D_HORIZONTALALIGN_LEFT ); + +private: + NNSG2dCharCanvas m_cc; + NNSG2dTextCanvas m_txn; + GXCharFmt16 m_offscreen[32 * 24]; + const NNSG2dFont* m_pFont; + NNS_GFD_DST_TYPE m_transType; + u32 m_transOffset; + bool m_bTransferRegsitered; + +public: + CCanvas(); + ~CCanvas(); + +public: + void Init(NNS_GFD_DST_TYPE type, u32 offset, void* pScrBase, const NNSG2dFont* pFont); + void Clear (PaletteColor c); + void Clear (int x, int y, int w, int h, PaletteColor c); + void Print (int x, int y, PaletteColor c, const NNSG2dChar* text); + void Printf(int x, int y, PaletteColor c, const NNSG2dChar* text, ...); + std::wstring WrapText(std::wstring text, int width); + + void ResetTransferTask(); + +protected: + void RegisterTransferTask(); +}; + +} +// end of namespace tlib + + +#endif // TLIB_CONTROL_CANVAS_H_ diff --git a/build/tests/WirelessChecker/src/util/memory.cpp b/build/tests/WirelessChecker/src/util/memory.cpp new file mode 100644 index 00000000..5e0d1d57 --- /dev/null +++ b/build/tests/WirelessChecker/src/util/memory.cpp @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: Memory.cpp + + Copyright 2007 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 "util/memory.h" + + +namespace util +{ + + +namespace +{ + NNSFndHeapHandle shHeap; + NNSFndAllocator sAllocator; + OSMutex sLock; +} + + +void +InitMemory() +{ + u32 arenaLow = MATH_ROUNDUP ((u32)OS_GetMainArenaLo(), 16); + u32 arenaHigh = MATH_ROUNDDOWN((u32)OS_GetMainArenaHi(), 16); + u32 heapSize = arenaHigh - arenaLow; + void* heapMemory = OS_AllocFromMainArenaLo(heapSize, 16); + + shHeap = NNS_FndCreateExpHeap(heapMemory, heapSize); + SDK_ASSERT( shHeap != NNS_FND_HEAP_INVALID_HANDLE ); + + NNS_FndInitAllocatorForExpHeap(&sAllocator, shHeap, 4); + + OS_InitMutex(&sLock); +} + +NNSFndHeapHandle +GetHeapHandle() +{ + return shHeap; +} + +NNSFndAllocator* +GetAllocator() +{ + return &sAllocator; +} + +void* +Alloc(size_t size, int align) +{ + OS_LockMutex(&sLock); + SDK_ASSERT(NNS_FndCheckExpHeap(shHeap, NNS_FND_HEAP_ERROR_PRINT)); + void* p = NNS_FndAllocFromExpHeapEx(shHeap, size, align); + OS_UnlockMutex(&sLock); + + return p; +} + +void +Free(void* ptr) +{ + OS_LockMutex(&sLock); + SDK_ASSERT(NNS_FndCheckExpHeap(shHeap, NNS_FND_HEAP_ERROR_PRINT)); + SDK_ASSERT(NNS_FndCheckForMBlockExpHeap(ptr, shHeap, NNS_FND_HEAP_ERROR_PRINT)); + NNS_FndFreeToExpHeap(shHeap, ptr); + OS_UnlockMutex(&sLock); +} + + +} +// end of namespace util + + + + +//------------ global namespace ------------------------------------ + +void* +operator new(size_t size) +{ + // operator new[] で 32 byte アライメントを保証できないので + // operator new でも 32 byte アライメントは行わない。 + return util::Alloc(size, 4); +} + +void* +operator new[](size_t size) +{ + // operator new[] では 32 byteアライメントを保証できない。 + return util::Alloc(size, 4); +} + +void +operator delete(void* ptr) +{ + if( ptr != NULL ) + { + util::Free(ptr); + } +} + +void +operator delete[](void* ptr) +{ + if( ptr != NULL ) + { + util::Free(ptr); + } +} diff --git a/build/tests/WirelessChecker/src/util/memory.h b/build/tests/WirelessChecker/src/util/memory.h new file mode 100644 index 00000000..c0e1ed39 --- /dev/null +++ b/build/tests/WirelessChecker/src/util/memory.h @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: Memory.h + + Copyright 2007 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 TLIB_SYSTEM_MEMORY_H_ +#define TLIB_SYSTEM_MEMORY_H_ + +#include +#include + +namespace util +{ + +void InitMemory(); + +NNSFndAllocator* GetAllocator(); +NNSFndHeapHandle GetHeapHandle(); +void* Alloc(size_t size, int align=32); +void Free(void* ptr); + +} +// end of namespace tlib + + + +#endif // TLIB_SYSTEM_MEMORY_H_ diff --git a/build/tests/WirelessChecker/src/util/util.cpp b/build/tests/WirelessChecker/src/util/util.cpp new file mode 100644 index 00000000..5828b7e8 --- /dev/null +++ b/build/tests/WirelessChecker/src/util/util.cpp @@ -0,0 +1,276 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checker + File: util.cpp + + 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 "util/util.h" +#include "util/canvas.h" +#include "util/memory.h" +#include +#include + +extern u8 font_NFTR_begin[]; +extern u8 font_NFTR_end[]; + +namespace util +{ + GamePad System_GamePadState; + int System_BaseWidth; + int System_LineHeight; + + namespace + { + const int REPEAT_START_FRAME = 15; + const int REPEAT_INTERVAL = 30; + const u32 TASK_ARRAY_NUM = 4; + const int CANVAS_CHARACTER_OFFSET = 1; + + GXRgb COLOR_PALETTE[18] = + { + GX_RGB(26, 26, 26), + GX_RGB(31, 31, 31), + GX_RGB( 0, 0, 0), + + GX_RGB(31, 0, 3), + GX_RGB(30, 28, 0), + GX_RGB(21, 31, 0), + GX_RGB( 6, 23, 30), + GX_RGB( 0, 11, 30), + GX_RGB(25, 23, 1), + GX_RGB(22, 22, 22), + GX_RGB(16, 16, 16), + + GX_RGB(29, 31, 31) + }; + NNSG2dFont sFont; + CCanvas sCanvasMain1; + CCanvas sCanvasMain3; + CCanvas sCanvasSub1; + CCanvas sCanvasSub3; + + NNSGfdVramTransferTask sTaskArray[TASK_ARRAY_NUM]; + + void ClearVram( void ) + { + //--------------------------------------------------------------------------- + // All VRAM banks to LCDC + //--------------------------------------------------------------------------- + GX_SetBankForLCDC(GX_VRAM_LCDC_ALL); + + //--------------------------------------------------------------------------- + // Clear all LCDC space + //--------------------------------------------------------------------------- + MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE); + + //--------------------------------------------------------------------------- + // Disable the banks on LCDC + //--------------------------------------------------------------------------- + (void)GX_DisableBankForLCDC(); + + MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE); // clear the standard palette + + MI_CpuFillFast((void*)HW_DB_OAM, 192, HW_DB_OAM_SIZE); // clear OAM + MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE); // clear the standard palette + } + + void InitFont(void* pNFTR) + { + NNS_G2dFontInitUTF16(&sFont, pNFTR); + + System_BaseWidth = NNS_G2dFontGetCellWidth(&sFont) / 2; + System_LineHeight = NNS_G2dFontGetLineFeed(&sFont); + } + + void VBlankIntr(void) + { + OS_SetIrqCheckFlag( OS_IE_V_BLANK ); + } + + + } // namespace + + void WaitVBlankIntr(void) + { + SVC_WaitVBlankIntr(); + } + + void dispOn(void) + { + GX_DispOn(); + GXS_DispOn(); + } + + CCanvas* GetMain1Canvas() { return &sCanvasMain1; } + CCanvas* GetMain3Canvas() { return &sCanvasMain3; } + CCanvas* GetSub1Canvas() { return &sCanvasSub1; } + CCanvas* GetSub3Canvas() { return &sCanvasSub3; } + + void UpdateGamePad(void) + { + u16 status = PAD_Read(); + + System_GamePadState.repeatTrigger = false; + + if( status != 0 ) + { + if( System_GamePadState.button == 0 ) + { + System_GamePadState.beginPress = 0; + } + else + { + System_GamePadState.beginPress++; + const int lapse = System_GamePadState.beginPress - REPEAT_START_FRAME; + + if( lapse >= 0 ) + { + if( (lapse % REPEAT_INTERVAL) == 0 ) + { + System_GamePadState.repeatTrigger = true; + } + } + } + } + + System_GamePadState.trigger = (u16)(status & (status ^ System_GamePadState.button)); + System_GamePadState.release = (u16)(System_GamePadState.button & (status ^ System_GamePadState.button)); + System_GamePadState.button = status; + } + + void UpdateDisplay(void) + { + sCanvasMain1.ResetTransferTask(); + sCanvasMain3.ResetTransferTask(); + sCanvasSub1 .ResetTransferTask(); + sCanvasSub3 .ResetTransferTask(); + NNS_GfdDoVramTransfer(); + } + + void Init() + { + OS_Init(); + FX_Init(); + GX_Init(); + + OS_InitTick(); + OS_InitAlarm(); + + GX_DispOff(); + GXS_DispOff(); + + RTC_Init(); + + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + ClearVram(); + + InitMemory(); + + // assign vram banks + GX_SetBankForBG(GX_VRAM_BG_128_A); + GX_SetBankForOBJ(GX_VRAM_OBJ_16_F); + GX_SetBankForSubBG(GX_VRAM_SUB_BG_128_C); + GX_SetBankForSubOBJ(GX_VRAM_SUB_OBJ_16_I); + GX_SetBankForLCDC(GX_VRAM_LCDC_B); + + // init screen + // BG 1 を設定 + G2_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x0000, // スクリーンベース + GX_BG_CHARBASE_0x04000, // キャラクタベース + GX_BG_EXTPLTT_01 ); // 拡張パレットスロット + + G2S_SetBG1Control( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x0000, // スクリーンベース + GX_BG_CHARBASE_0x04000, // キャラクタベース + GX_BG_EXTPLTT_01 ); // 拡張パレットスロット + + // BG 2 を設定 + G2_SetBG2ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x0800, // スクリーンベース + GX_BG_CHARBASE_0x0c000 ); // キャラクタベース + + G2S_SetBG2ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x0800, // スクリーンベース + GX_BG_CHARBASE_0x0c000 ); // キャラクタベース + + // BG 3 を設定 + G2_SetBG3ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x1000, // スクリーンベース + GX_BG_CHARBASE_0x14000 ); // キャラクタベース + + G2S_SetBG3ControlText( + GX_BG_SCRSIZE_TEXT_256x256, // スクリーンサイズ 256x256 + GX_BG_COLORMODE_16, // カラーモード 16色 + GX_BG_SCRBASE_0x1000, // スクリーンベース + GX_BG_CHARBASE_0x14000 ); // キャラクタベース + + // BG1/3 を可視に + GX_SetVisiblePlane ( GX_PLANEMASK_BG1 | GX_PLANEMASK_BG3 ); + GXS_SetVisiblePlane( GX_PLANEMASK_BG1 | GX_PLANEMASK_BG3 ); + + // BG1/2/3 の優先順位設定 + G2_SetBG1Priority(3); + G2_SetBG2Priority(2); + G2_SetBG3Priority(1); + G2S_SetBG1Priority(3); + G2S_SetBG2Priority(2); + G2S_SetBG3Priority(1); + + GX_LoadBGPltt(COLOR_PALETTE, 0, sizeof(COLOR_PALETTE)); + GXS_LoadBGPltt(COLOR_PALETTE, 0, sizeof(COLOR_PALETTE)); + + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_0, GX_BG0_AS_2D); + GXS_SetGraphicsMode(GX_BGMODE_0); + GX_SetBGScrOffset(GX_BGSCROFFSET_0x00000); + GX_SetBGCharOffset(GX_BGCHAROFFSET_0x00000); + + InitFont(font_NFTR_begin); + + { + const u32 chrOffset = CANVAS_CHARACTER_OFFSET * sizeof(GXCharFmt16); + sCanvasMain1.Init(NNS_GFD_DST_2D_BG1_CHAR_MAIN, chrOffset, G2_GetBG1ScrPtr(), &sFont); + sCanvasMain3.Init(NNS_GFD_DST_2D_BG3_CHAR_MAIN, chrOffset, G2_GetBG3ScrPtr(), &sFont); + sCanvasSub1 .Init(NNS_GFD_DST_2D_BG1_CHAR_SUB, chrOffset, G2S_GetBG1ScrPtr(), &sFont); + sCanvasSub3 .Init(NNS_GFD_DST_2D_BG3_CHAR_SUB, chrOffset, G2S_GetBG3ScrPtr(), &sFont); + + NNS_GfdInitVramTransferManager(sTaskArray, TASK_ARRAY_NUM); + } + + PAD_Read(); + } + + u16 GetPadTrigger() + { + return static_cast(System_GamePadState.button); + } + +} // namespace util + diff --git a/build/tests/WirelessChecker/src/util/util.h b/build/tests/WirelessChecker/src/util/util.h new file mode 100644 index 00000000..a84e4afb --- /dev/null +++ b/build/tests/WirelessChecker/src/util/util.h @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Wireless Checher + File: util.h + + Copyright 2007 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 WIRELESS_CHECHER_UTIL_H_ +#define WIRELESS_CHECHER_UTIL_H_ + +#include + +namespace util +{ + +const int DEFAULT_COLOR_PALETTE = 0; + +enum PaletteColor +{ + COLOR_NULL=0, + COLOR_WHITE, + COLOR_BLACK, + + COLOR_RED, + COLOR_YELLOW, + COLOR_LIMEGREEN, + COLOR_TURQUOISE, + COLOR_BLUE, + COLOR_BROWN, + COLOR_LIGHTGRAY, + COLOR_DARKGRAY, + + COLOR_GUIDE_BG +}; + +struct GamePad +{ + u16 trigger; + u16 release; + u16 button; + bool repeatTrigger; + u8 padding0; + int beginPress; +}; + +void Init(void); +void WaitVBlankIntr(void); +void dispOn(void); +void UpdateGamePad(void); +void UpdateDisplay(void); + +class CCanvas; +CCanvas* GetMain1Canvas(); +CCanvas* GetMain3Canvas(); +CCanvas* GetSub1Canvas(); +CCanvas* GetSub3Canvas(); + +inline u16 +IsPadDown(u16 key) +{ + extern GamePad System_GamePadState; + return static_cast(System_GamePadState.trigger & key); +} +inline u16 +IsPadUp(u16 key) +{ + extern GamePad System_GamePadState; + return static_cast(System_GamePadState.release & key); +} +inline u16 +IsPadPress(u16 key) +{ + extern GamePad System_GamePadState; + return static_cast(System_GamePadState.button & key); +} +inline u16 +IsPadTrigger(u16 key) +{ + extern GamePad System_GamePadState; + if( System_GamePadState.repeatTrigger ) + { + return IsPadPress(key); + } + else + { + return IsPadDown(key); + } +} + +u16 GetPadTrigger(); + +} // namespace util + +#endif // WIRELESS_CHECHER_UTIL_H_ diff --git a/build/tests/WirelessChecker/src/util/wprintf.cpp b/build/tests/WirelessChecker/src/util/wprintf.cpp new file mode 100644 index 00000000..35879971 --- /dev/null +++ b/build/tests/WirelessChecker/src/util/wprintf.cpp @@ -0,0 +1,387 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: WPrintf.cpp + + Copyright 2007 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 "util/wprintf.h" + +namespace util +{ +namespace +{ + /* inner function for sized-buffer output */ + + typedef struct dst_string_tag + { + size_t len; + wchar_t *cur; + wchar_t *base; + } dst_string; + + void + string_put_char(dst_string *p, wchar_t c) + { + if(p->len > 0) *p->cur = c, --p->len; + ++p->cur; + } + + void + string_fill_char(dst_string *p, wchar_t c, int n) + { + if(n > 0) { + size_t i, k = p->len; + if(k > (size_t)n) k = (size_t)n; + for( i = 0 ; i < k ; ++i ) + p->cur[i] = c; + p->len -= k; + p->cur += n; + } + } + + void + string_put_string(dst_string *p, const wchar_t *s, int n) + { + if(n > 0) { + size_t i, k = p->len; + if(k > (size_t)n) k = (size_t)n; + for( i = 0 ; i < k ; ++i ) + p->cur[i] = s[i]; + p->len -= k; + p->cur += n; + } + } +} + +// based on OS_VSNPrintf + +/*---------------------------------------------------------------------------* + Name: OS_VSNPrintf + + Description: small-size vsnprintf which is similar to 'vsnprintf' + without following supports. + * CodeWarrior Extensions (#s) + * MSL AltiVec Extensions (v, vh, vl, hv, lv, @) + * indexed argments (%m$, *m$) + * floating-point + * wchar_t + + Note: '+' and '#' do not work, MSL's sprintf(). + to keep same result, they are no implement. + { // exsample + wchar_t buf[5]; + sprintf(buf, "%-i\n", 45); // "45" (OK) + sprintf(buf, "%0i\n", 45); // "45" (OK) + sprintf(buf, "% i\n", 45); // " 45" (OK) + sprintf(buf, "%+i\n", 45); // "%+i" ("+45" expected) + sprintf(buf, "%#x\n", 45); // "%#x" ("0x2d" expected) + // but, this works correctly! + sprintf(buf, "% +i\n", 45); // "+45" (OK) + } + + Arguments: dst : destination buffer. + len : destination buffer size. + fmt : format string. + vlist : parameters. + + Returns: length of the generated string. (except '\0') + if(result < len), + put NUL in dst[result]. + else if(len > 0), + put NUL in dst[len - 1]. + else, + do nothing. + *---------------------------------------------------------------------------*/ +int +VSNWPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, va_list vlist) +{ + wchar_t buf[24]; + int n_buf; + wchar_t prefix[2]; + int n_prefix; + + const wchar_t *s = fmt; + + dst_string str; + str.len = len, str.cur = str.base = dst; + + while(*s) { + if(*s != L'%') { + /* normal character */ + string_put_char(&str, *s++); + } else { + /* output with format */ + enum { + flag_blank = 000001, /* L' ' */ + flag_plus = 000002, /* L'+' */ + flag_sharp = 000004, /* L'#' */ + flag_minus = 000010, /* L'-' */ + flag_zero = 000020, /* L'0' */ + flag_l1 = 000040, /* "l" */ + flag_h1 = 000100, /* "h" */ + flag_l2 = 000200, /* "ll" */ + flag_h2 = 000400, /* "hh" */ + flag_unsigned = 010000, /* L'o', L'u', ... */ + flag_end } ; + int flag = 0, width = 0, precision = -1, radix = 10; + wchar_t hex_char = L'a' - 10; + const wchar_t *p_start = s; + /* flags */ + for( ; ; ) { + switch(*++s) { + case L'+':if(s[-1] != L' ') break; + flag |= flag_plus; continue; + case L' ':flag |= flag_blank;continue; + case L'-':flag |= flag_minus;continue; + case L'0':flag |= flag_zero; continue; + } + break; + } + /* width */ + if(*s == L'*') { + ++s, width = va_arg(vlist, int); + if(width < 0) + width = -width, flag |= flag_minus; + } else { + while((*s >= L'0') && (*s <= L'9')) + width = (width * 10) + *s++ - L'0'; + } + /* precision */ + if(*s == L'.') { + ++s, precision = 0; + if(*s == L'*') { + ++s, precision = va_arg(vlist, int); + if(precision < 0) precision = -1; + } else { + while((*s >= L'0') && (*s <= L'9')) + precision = (precision * 10) + *s++ - L'0'; + } + } + /* option */ + switch(*s) { + case L'h': + if(*++s != L'h') flag |= flag_h1; + else ++s, flag |= flag_h2; + break; + case L'l': + if(*++s != L'l') flag |= flag_l1; + else ++s, flag |= flag_l2; + break; + } + + /* type */ + switch(*s) { + case L'd': /* signed decimal */ + case L'i': /* signed decimal */ + goto put_integer; + case L'o': /* unsigned octal */ + radix = 8; + flag |= flag_unsigned; + goto put_integer; + case L'u': /* unsigned decimal */ + flag |= flag_unsigned; + goto put_integer; + case L'X': /* unsigned hexadecimal */ + hex_char = L'A' - 10; + goto put_hexadecimal; + case L'x': /* unsigned hexadecimal */ + goto put_hexadecimal; + case L'p': /* pointer */ + /* equal to code warrior */ + flag |= flag_sharp; + precision = 8; + goto put_hexadecimal; + + case L'c': /* character */ + if(precision >= 0) + goto put_invalid; + { + int c = va_arg(vlist, int); + width -= 1; + if(flag & flag_minus) { + string_put_char(&str, (wchar_t)c); + string_fill_char(&str, L' ', width); + } else { + wchar_t pad = (wchar_t)( + (flag & flag_zero) ? L'0' : L' '); + string_fill_char(&str, pad, width); + string_put_char(&str, (wchar_t)c); + } + ++s; + } + break; + + case L's': /* string */ + { + int n_buf = 0; + const wchar_t *p_buf = va_arg(vlist, const wchar_t*); + if(precision < 0) { + while(p_buf[n_buf]) + ++n_buf; + } else { + while((n_buf < precision) && p_buf[n_buf]) + ++n_buf; + } + width -= n_buf; + if(flag & flag_minus) { + string_put_string(&str, p_buf, n_buf); + string_fill_char(&str, L' ', width); + } else { + wchar_t pad = (wchar_t)( + (flag & flag_zero) ? L'0' : L' '); + string_fill_char(&str, pad, width); + string_put_string(&str, p_buf, n_buf); + } + ++s; + } + break; + + case L'n': /* store the number of output */ + { + int pos = str.cur - str.base; + if(flag & flag_h2) + ; + else if(flag & flag_h1) + *va_arg(vlist, signed short*) = (signed short)pos; + else if(flag & flag_l2) + *va_arg(vlist, u64*) = (u64)pos; + else + *va_arg(vlist, signed int*) = (signed int)pos; + } + ++s; + break; + + case L'%': /* output L'%' */ + if(p_start + 1 != s) + goto put_invalid; + string_put_char(&str, *s++); + break; + + default: /* invalid type */ + goto put_invalid; + +put_invalid: + string_put_string(&str, p_start, s - p_start); + break; + +put_hexadecimal: + radix = 16; + flag |= flag_unsigned; +put_integer: + { + u64 val = 0; + n_prefix = 0; + + if(flag & flag_minus) + flag &= ~flag_zero; + if(precision < 0) precision = 1; + else flag &= ~flag_zero; + + if(flag & flag_unsigned) { + if(flag & flag_h2) + val = va_arg(vlist, wchar_t); + else if(flag & flag_h1) + val = va_arg(vlist, unsigned short); + else if(flag & flag_l2) + val = va_arg(vlist, u64); + else + val = va_arg(vlist, unsigned long); + flag &= ~(flag_plus | flag_blank); + if(flag & flag_sharp) { + if(radix == 16) { + if(val != 0) { + prefix[0] = (wchar_t)(hex_char + (10 + L'x' - L'a')); + prefix[1] = L'0'; + n_prefix = 2; + } + } else if(radix == 8) { + prefix[0] = L'0'; + n_prefix = 1; + } + } + } else { + if(flag & flag_h2) + val = va_arg(vlist, wchar_t); + else if(flag & flag_h1) + val = va_arg(vlist, short); + else if(flag & flag_l2) + val = va_arg(vlist, u64); + else + val = va_arg(vlist, long); + if((val >> 32) & 0x80000000) { + val = ~val + 1; + prefix[0] = L'-'; + n_prefix = 1; + } else { + if(val || precision) { + if(flag & flag_plus) { + prefix[0] = L'+'; + n_prefix = 1; + } else + if(flag & flag_blank) { + prefix[0] = L' '; + n_prefix = 1; + } + } + } + } + n_buf = 0; + while(val != 0) { + int d = (int)(val % radix); + val /= radix; + buf[n_buf++] = (wchar_t)((d < 10) ? + (d + L'0') : (d + hex_char)); + } + if((n_prefix > 0) && (prefix[0] == L'0')) { + n_prefix = 0; + buf[n_buf++] = L'0'; + } + } + goto put_to_stream; + +put_to_stream: + { + int n_pad = precision - n_buf; + if(flag & flag_zero) { + if(n_pad < width - n_buf - n_prefix) + n_pad = width - n_buf - n_prefix; + } + if(n_pad > 0) width -= n_pad; + width -= n_prefix + n_buf; + if(!(flag & flag_minus)) + string_fill_char(&str, L' ', width); + while(n_prefix > 0) + string_put_char(&str, prefix[--n_prefix]); + string_fill_char(&str, L'0', n_pad); + while(n_buf > 0) + string_put_char(&str, buf[--n_buf]); + if(flag & flag_minus) + string_fill_char(&str, L' ', width); + ++s; + } + break; + } + } + } + + if(str.len > 0) + *str.cur = '\0'; + else if(len > 0) + str.base[len - 1] = '\0'; + return str.cur - str.base; +} + + +} +// end of namespace tlib diff --git a/build/tests/WirelessChecker/src/util/wprintf.h b/build/tests/WirelessChecker/src/util/wprintf.h new file mode 100644 index 00000000..d63dff9f --- /dev/null +++ b/build/tests/WirelessChecker/src/util/wprintf.h @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - Nmenu + File: WPrintf.h + + Copyright 2007 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 TLIB_SYSTEM_WPRINTF_H_ +#define TLIB_SYSTEM_WPRINTF_H_ + + + +namespace util +{ + +int VSNWPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, va_list vlist); + + +/*---------------------------------------------------------------------------* + Name: OS_SNPrintf + + Description: equal to 'OS_VSNPrintf' except argument style. + + Arguments: dst : destination buffer. + len : destination buffer size. + fmt : format string. + + Returns: length of the generated string. (except '\0') + if(result < len), + put NUL in dst[result]. + else if(len > 0), + put NUL in dst[len - 1]. + else, + do nothing. + *---------------------------------------------------------------------------*/ +inline int +SNWPrintf(wchar_t *dst, size_t len, const wchar_t *fmt, ...) +{ + int ret; + va_list va; + va_start(va, fmt); + ret = VSNWPrintf(dst, len, fmt, va); + va_end(va); + return ret; +} + +/*---------------------------------------------------------------------------* + Name: OS_VSPrintf + + Description: equal to 'OS_VSNPrintf' except buffer size argument. + + Arguments: dst : destination buffer. + fmt : format string. + vlist : parameters. + + Returns: length of the generated string. + *---------------------------------------------------------------------------*/ +inline int +VSWPrintf(wchar_t *dst, const wchar_t *fmt, va_list vlist) +{ + return VSNWPrintf(dst, 0x7FFFFFFF, fmt, vlist); +} + +/*---------------------------------------------------------------------------* + Name: OS_SPrintf + + Description: equal to 'OS_VSPrintf' except argument style. + + Arguments: dst : destination buffer. + fmt : format string. + + Returns: length of the generated string. + *---------------------------------------------------------------------------*/ +inline int +SWPrintf(wchar_t *dst, const wchar_t *fmt, ...) +{ + int ret; + va_list va; + va_start(va, fmt); + ret = VSWPrintf(dst, fmt, va); + va_end(va); + return ret; +} + + +} +// end of namespace tlib + + + +#endif // TLIB_SYSTEM_WPRINTF_H_ diff --git a/build/tests/build4WLDev/Makefile b/build/tests/build4WLDev/Makefile new file mode 100644 index 00000000..561282d0 --- /dev/null +++ b/build/tests/build4WLDev/Makefile @@ -0,0 +1,146 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +# force to build for debugger +export SYSM_BUILD_FOR_DEBUGGER = TRUE + +# SDK configuration for export +override TWL_ARCHGEN := LIMITED +overrice TWL_CODEGEN := THUMB +export TWL_ARCHGEN +export OBJDIR = ./obj.WLAN/$(TWL_BUILDTYPE) +export DEPENDDIR = ./depend.WLAN/$(TWL_BUILDTYPE) +export LIBDIR = ./lib.WLAN/$(TWL_BUILDTYPE) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +export LDIRT_CLEAN = ./obj.WLAN ./depend.WLAN ./lib.WLAN + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher +MACHINESETTINGS_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/MachineSettings +WLANFIRM_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/wlanfirm +DS_HASH_TABLE = $(SYSMENU_ROOT)/build/systemMenu_RED/DSHashTable +SHARED_FONT_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/sharedFont +NANDFIRM_DIR = $(SYSMENU_ROOT)/build/nandfirm/menu-launcher + +SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdaterRegionSelect + +# 実際に書き込みたいファイルの置かれているdataフォルダを指定 +export UPDATER_HOST_ROOT_DIR = $(call empath,$(SYSMENU_ROOT)/build/tests/build4WLDev/data_sysmenu) + +SUBMAKES = $(SYSMENU_ROOT)/build/libraries_sysmenu/Makefile \ + \ + $(LAUNCHER_DIR)/banner/Makefile \ + $(LAUNCHER_DIR)/ARM9/Makefile_autogen_HNAJ \ + $(LAUNCHER_DIR)/ARM9/Makefile_autogen_HNAE \ + $(SYSTEMUPDATER_DIR)/banner/Makefile \ + $(SYSTEMUPDATER_DIR)/ARM7.TWL/Makefile \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/Makefile_autogen + +# COMPILE SWITCH for build SystemMenu + +export SYSM_UPDATER_RELEASE = TRUE + +export SYSM_DO_NOT_SHOW_LAUNCHER = FALSE +export SYSM_DISABLE_WDS_SCAN = FALSE + +############################################# +# For Wireless development +# + +# disable signature check +export SYSM_IGNORE_WLFIRM_SIGNCHECK = TRUE + +export SYSM_DISABLE_WLFIRM_LOAD = FALSE +export SYSM_DISABLE_INITIAL_SETTINGS = TRUE +export SYSM_OUTSIDE_UI = TRUE + +export SYSM_DEV_WHITELIST_CHECK_SKIP = TRUE + +export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE + +# MAKEROM SWITCH for build SystemMenu +export SYSM_DISABLE_DEBUG = TRUE +export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE + +# Option for SystemUpdater +export IGNORE_VERSION_CHECK = TRUE + +############################################# +# inhibit reentrant + +FIRST_CALL ?= TRUE +SKIP_SUBDIR ?= TRUE + +DATE_AND_TIME ?= $(shell date +"%y%m%d %H%M") + +DATE ?= $(word 1,$(DATE_AND_TIME)) +TIME ?= $(word 2,$(DATE_AND_TIME)) +TIME_NOZERO = $(shell echo $(TIME) | sed -e 's/^0*\(.\)/\1/') + +ifneq ($(FIRST_CALL),TRUE) +INSTALL_TARGETS = $(SYSTEMUPDATER_DIR)/ARM9.TWL/bin/$(TWL_BUILDTYPE)/SystemUpdater.srl +INSTALL_DIR = . +endif + +GDIRT_INSTALLED += ./$(notdir $(subst .srl,_WL_$(DATE)_*.srl,$(INSTALL_TARGETS))) + +#---------------------------------------------------------------------------- + +do-build: do-core +clean: cl-core +clobber: cl-core + +do-build: MY_TARGET=default +clean: MY_TARGET=clean +clobber: MY_TARGET=clobber + +do-core: +ifeq ($(FIRST_CALL),TRUE) + @echo Enter remake SKIP_SUBDIR=$(SKIP_SUBDIR) + +$(REMAKE) -C ./scripts SKIP_SUBDIR=FALSE $(MY_TARGET) + +$(REMAKE) FIRST_CALL=FALSE SKIP_SUBDIR=FALSE $(MY_TARGET) +endif + +cl-core: +ifeq ($(FIRST_CALL),TRUE) + +$(REMAKE) FIRST_CALL=FALSE SKIP_SUBDIR=FALSE $(MY_TARGET) + +$(REMAKE) -C ./scripts SKIP_SUBDIR=FALSE $(MY_TARGET) +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +# Override generic DO_INSTALL +define DO_INSTALL + $(INSTALL) -d $(INSTALL_DIR) $(AND) \ + $(foreach FILE, $(INSTALL_TARGETS), \ + if [ ! -e $(INSTALL_DIR)/$(FILE) -o \ + $(FILE) -nt $(INSTALL_DIR)/$(FILE) ]; \ + then \ + $(ECHO) " install: $(FILE) -> $(subst .srl,_WL_$(DATE)_$(TIME).srl,$(FILE))" $(AND) \ + $(INSTALL) $(FILE) $(INSTALL_DIR)/$(notdir $(subst .srl,_WL_$(DATE)_$(TIME).srl,$(FILE))); \ + fi $(AND) ) $(TRUE) +endef + +test: + @echo SKIP_SUBDIR=$(SKIP_SUBDIR) +#===== End of Makefile ===== diff --git a/build/tests/build4WLDev/Makefile_environment b/build/tests/build4WLDev/Makefile_environment new file mode 100644 index 00000000..d11a6952 --- /dev/null +++ b/build/tests/build4WLDev/Makefile_environment @@ -0,0 +1,41 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +# force to build for debugger +export SYSM_BUILD_FOR_DEBUGGER = TRUE + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +# skip demos +export NITRO_WITHOUT_DEMOS = TRUE +export TWL_WITHOUT_DEMOS = TRUE + +override TWLSYSTEM_ROOT= +export TWLSYSTEM_ROOT + +SUBDIRS = $(ROOT) \ + $(NITROSYSTEM_ROOT) \ + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/build4WLDev/Makefile_old b/build/tests/build4WLDev/Makefile_old new file mode 100644 index 00000000..dc98d6a4 --- /dev/null +++ b/build/tests/build4WLDev/Makefile_old @@ -0,0 +1,144 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +# force to build for debugger +export SYSM_BUILD_FOR_DEBUGGER = TRUE + +# SDK configuration for export +override TWL_ARCHGEN := LIMITED +export TWL_ARCHGEN +export OBJDIR = ./obj.WLAN/$(TWL_BUILDTYPE) +export DEPENDDIR = ./depend.WLAN/$(TWL_BUILDTYPE) +export LIBDIR = ./lib.WLAN/$(TWL_BUILDTYPE) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +export LDIRT_CLEAN = ./obj.WLAN ./depend.WLAN ./lib.WLAN + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher +MACHINESETTINGS_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/MachineSettings +WLANFIRM_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/wlanfirm +DS_HASH_TABLE = $(SYSMENU_ROOT)/build/systemMenu_RED/DSHashTable +SHARED_FONT_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/sharedFont +NANDFIRM_DIR = $(SYSMENU_ROOT)/build/nandfirm/menu-launcher + +SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdater + +# 実際に書き込みたいファイルの置かれているdataフォルダを指定 +export UPDATER_HOST_ROOT_DIR = $(call empath,$(SYSTEMUPDATER_DIR)/data) + +ifdef BUILD_TWLSDK +SUBMAKES += Makefile_environment +endif + +SUBMAKES += $(SYSMENU_ROOT)/build/tools/Makefile \ + $(SYSMENU_ROOT)/build/libraries/Makefile \ + $(SYSMENU_ROOT)/build/libraries_sysmenu/Makefile_autogen \ + \ + $(LAUNCHER_DIR)/Makefile_autogen \ + $(MACHINESETTINGS_DIR)/Makefile_autogen \ + $(WLANFIRM_DIR)/Makefile \ + $(DS_HASH_TABLE)/Makefile \ + $(SHARED_FONT_DIR)/Makefile \ + $(NANDFIRM_DIR)/Makefile \ + $(SYSTEMUPDATER_DIR)/data/Makefile \ + $(SYSTEMUPDATER_DIR)/banner/Makefile \ + $(SYSTEMUPDATER_DIR)/ARM7.TWL/Makefile \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/Makefile + +# COMPILE SWITCH for build SystemMenu + +export SYSM_UPDATER_RELEASE = TRUE + +export SYSM_DO_NOT_SHOW_LAUNCHER = TRUE +export SYSM_DISABLE_WDS_SCAN = FALSE + +############################################# +# For Wireless development +# + +# disable signature check +export SYSM_IGNORE_WLFIRM_SIGNCHECK = TRUE + +export SYSM_DISABLE_WLFIRM_LOAD = FALSE +export SYSM_DISABLE_INITIAL_SETTINGS = TRUE +export SYSM_OUTSIDE_UI = TRUE + +export SYSM_DEV_WHITELIST_CHECK_SKIP = TRUE + +export SYSM_BUILD_FOR_PRODUCTION_TEST = FALSE + +# MAKEROM SWITCH for build SystemMenu +export SYSM_DISABLE_DEBUG = TRUE +export SYSM_USE_WLANFIRM_LOCAL_PUBKEY = FALSE + +DATE_AND_TIME ?= $(shell date +"%y%m%d %H%M") + +DATE ?= $(word 1,$(DATE_AND_TIME)) +TIME ?= $(word 2,$(DATE_AND_TIME)) +TIME_NOZERO = $(shell echo $(TIME) | sed -e 's/^0*\(.\)/\1/') + +INSTALL_TARGETS = $(SYSTEMUPDATER_DIR)/ARM9.TWL/bin/$(TWL_BUILDTYPE)/SystemUpdater.srl +INSTALL_DIR = . + +GDIRT_INSTALLED += ./$(notdir $(subst .srl,_WL_$(DATE)_*.srl,$(INSTALL_TARGETS))) + +#---------------------------------------------------------------------------- + +SKIP_SUBDIR ?= TRUE + +do-build: do-core +clean: cl-core +clobber: cl-core + +do-build: MY_TARGET=default +clean: MY_TARGET=clean +clobber: MY_TARGET=clobber + +do-core: +ifeq ($(SKIP_SUBDIR),TRUE) + +$(REMAKE) -C ./scripts SKIP_SUBDIR=FALSE $(MY_TARGET) + +$(REMAKE) SKIP_SUBDIR=FALSE $(MY_TARGET) +endif + +cl-core: +ifeq ($(SKIP_SUBDIR),TRUE) + +$(REMAKE) SKIP_SUBDIR=FALSE $(MY_TARGET) + +$(REMAKE) -C ./scripts SKIP_SUBDIR=FALSE $(MY_TARGET) +endif + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +# Override generic DO_INSTALL +define DO_INSTALL + $(INSTALL) -d $(INSTALL_DIR) $(AND) \ + $(foreach FILE, $(INSTALL_TARGETS), \ + if [ ! -e $(INSTALL_DIR)/$(FILE) -o \ + $(FILE) -nt $(INSTALL_DIR)/$(FILE) ]; \ + then \ + $(ECHO) " install: $(FILE) -> $(subst .srl,_WL_$(DATE)_$(TIME).srl,$(FILE))" $(AND) \ + $(INSTALL) $(FILE) $(INSTALL_DIR)/$(notdir $(subst .srl,_WL_$(DATE)_$(TIME).srl,$(FILE))); \ + fi $(AND) ) $(TRUE) +endef + + +#===== End of Makefile ===== diff --git a/build/tests/build4WLDev/readme.txt b/build/tests/build4WLDev/readme.txt new file mode 100644 index 00000000..14f75eb3 --- /dev/null +++ b/build/tests/build4WLDev/readme.txt @@ -0,0 +1,26 @@ +* 無線開発用SystemUpdater + +1. 各種systemMenuファイルの用意 + +TwlIPL/build/tests/build4WLDev の直下に以下のディレクトリ構成で +systemMenu関連ファイルを用意してください。(HNA*.tadは除いてください。) + +※Regionは、JapanとAmericaのみをサポート、開発実機には対応していません。 + +data_sysmenu + +debugger + l +america/* + l +japan/* + +上記の*には、 +HNA*.tad以外の全tadとnandファームとフォントデータを置いてください。 + + +2.SystemUpdaterのビルド + +TwlIPL/build/tests/build4WLDev でmakeを実行してください。 +※TwlIPL_privateが必要です。 + +最終的に、以下のような日付時間タグつきのSystemUpdaterが同じディレクトリに作成されます。 + +SystemUpdater_WL_yymmdd_hhmm.srl diff --git a/build/tests/build4WLDev/scripts/Makefile b/build/tests/build4WLDev/scripts/Makefile new file mode 100644 index 00000000..919866fa --- /dev/null +++ b/build/tests/build4WLDev/scripts/Makefile @@ -0,0 +1,74 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher + +SYSMENU_LIBRARIES_DIR = $(SYSMENU_ROOT)/build/libraries_sysmenu + +SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdaterRegionSelect + +SCRIPTS_DIR = ./ + +MAKEFILES_ORG = $(LAUNCHER_DIR)/ARM9/Makefile +MAKE_MAKEFILES = $(SCRIPTS_DIR)/launcher_makefile_region.pl +AUTOGEN_MAKEFILES = $(LAUNCHER_DIR)/ARM9/Makefile_autogen_HNAJ $(LAUNCHER_DIR)/ARM9/Makefile_autogen_HNAE + +LDIRT_CLEAN += $(AUTOGEN_MAKEFILES) + +LOADWLAN_ORG = $(LAUNCHER_DIR)/ARM9/src/loadWlanFirm.c +MAKE_LOADWLAN = $(SCRIPTS_DIR)/launcher_loadWlanFirm_c.pl +AUTOGEN_LOADWLAN = $(LAUNCHER_DIR)/ARM9/src/loadWlanFirm_autogen.c +LDIRT_CLEAN += $(AUTOGEN_LOADWLAN) + +SYSUP_ORG = $(SYSTEMUPDATER_DIR)/ARM9.TWL/src/process_check_console.c \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/src/process_select_region.c \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/Makefile +MAKE_SYSUP = $(SCRIPTS_DIR)/systemupdater_source.pl +AUTOGEN_SYSUP = $(SYSTEMUPDATER_DIR)/ARM9.TWL/src/process_check_console_autogen.c \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/src/process_select_region_autogen.c \ + $(SYSTEMUPDATER_DIR)/ARM9.TWL/Makefile_autogen +LDIRT_CLEAN += $(AUTOGEN_SYSUP) + + +TARGETS = $(AUTOGEN_MAKEFILES) $(AUTOGEN_LOADWLAN) $(AUTOGEN_SYSUP) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +$(AUTOGEN_MAKEFILES): $(MAKEFILES_ORG) $(MAKE_MAKEFILES) + @echo " make:" $@ + @perl $(MAKE_MAKEFILES) + +$(AUTOGEN_LOADWLAN): $(LOADWLAN_ORG) $(MAKE_LOADWLAN) + @echo " make:" $@ + @perl $(MAKE_LOADWLAN) + +$(AUTOGEN_SYSUP): $(SYSUP_ORG) $(MAKE_SYSUP) + @echo " make:" $@ + @perl $(MAKE_SYSUP) + + +#===== End of Makefile ===== diff --git a/build/tests/build4WLDev/scripts/Makefile_old b/build/tests/build4WLDev/scripts/Makefile_old new file mode 100644 index 00000000..481ac3b3 --- /dev/null +++ b/build/tests/build4WLDev/scripts/Makefile_old @@ -0,0 +1,87 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: SystemUpdater +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +LAUNCHER_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher +MACHINESETTINGS_DIR = $(SYSMENU_ROOT)/build/systemMenu_RED/MachineSettings + +SYSMENU_LIBRARIES_DIR = $(SYSMENU_ROOT)/build/libraries_sysmenu + +SYSTEMUPDATER_DIR = $(SYSMENU_ROOT)/build/systemMenu_tools/SystemUpdater + +SCRIPTS_DIR = ./ + +MAKEFILES_ORG = $(LAUNCHER_DIR)/Makefile $(LAUNCHER_DIR)/ARM9/Makefile \ + $(MACHINESETTINGS_DIR)/Makefile $(MACHINESETTINGS_DIR)/ARM9/Makefile +MAKE_MAKEFILES = $(SCRIPTS_DIR)/launcher_makefile.pl +AUTOGEN_MAKEFILES = $(LAUNCHER_DIR)/Makefile_autogen $(LAUNCHER_DIR)/ARM9/Makefile_autogen \ + $(MACHINESETTINGS_DIR)/Makefile_autogen $(MACHINESETTINGS_DIR)/ARM9/Makefile_autogen + +LDIRT_CLEAN += $(AUTOGEN_MAKEFILES) + +LOADWLAN_ORG = $(LAUNCHER_DIR)/ARM9/src/loadWlanFirm.c +MAKE_LOADWLAN = $(SCRIPTS_DIR)/launcher_loadWlanFirm_c.pl +AUTOGEN_LOADWLAN = $(LAUNCHER_DIR)/ARM9/src/loadWlanFirm_autogen.c +LDIRT_CLEAN += $(AUTOGEN_LOADWLAN) + +MACHSETTING_ORG = $(MACHINESETTINGS_DIR)/ARM9/src/MachineSetting.c +MAKE_MACHSETTING = $(SCRIPTS_DIR)/launcher_MachineSetting_c.pl +AUTOGEN_MACHSETTING = $(MACHINESETTINGS_DIR)/ARM9/src/MachineSetting_autogen.c +LDIRT_CLEAN += $(AUTOGEN_MACHSETTING) + +NWM_ORG = $(SYSMENU_LIBRARIES_DIR)/Makefile \ + $(SYSMENU_LIBRARIES_DIR)/nwm/Makefile \ + $(SYSMENU_LIBRARIES_DIR)/nwm/ARM7/Makefile \ + $(ROOT)/build/libraries/wm/ARM7.TWL/nwm/src/nwmsp_event_handler.c +MAKE_NWM = $(SCRIPTS_DIR)/launcher_fake_macaddress.pl +AUTOGEN_NWM = $(SYSMENU_LIBRARIES_DIR)/Makefile_autogen \ + $(SYSMENU_LIBRARIES_DIR)/nwm/Makefile_autogen \ + $(SYSMENU_LIBRARIES_DIR)/nwm/ARM7/Makefile_autogen \ + $(ROOT)/build/libraries/wm/ARM7.TWL/nwm/src/nwmsp_event_handler_autogen.c +LDIRT_CLEAN += $(AUTOGEN_NWM) + + +TARGETS = $(AUTOGEN_MAKEFILES) $(AUTOGEN_LOADWLAN) $(AUTOGEN_MACHSETTING) $(AUTOGEN_NWM) + +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +$(AUTOGEN_MAKEFILES): $(MAKEFILES_ORG) $(MAKE_MAKEFILES) + @echo " make:" $@ + @perl $(MAKE_MAKEFILES) + +$(AUTOGEN_LOADWLAN): $(LOADWLAN_ORG) $(MAKE_LOADWLAN) + @echo " make:" $@ + @perl $(MAKE_LOADWLAN) + +$(AUTOGEN_MACHSETTING): $(MACHSETTING_ORG) $(MAKE_MACHSETTING) + @echo " make:" $@ + @perl $(MAKE_MACHSETTING) + +$(AUTOGEN_NWM): $(NWM_ORG) $(MAKE_NWM) + @echo " make:" $@ + @perl $(MAKE_NWM) + +#===== End of Makefile ===== diff --git a/build/tests/build4WLDev/scripts/launcher_MachineSetting_c.pl b/build/tests/build4WLDev/scripts/launcher_MachineSetting_c.pl new file mode 100755 index 00000000..0d4e890a --- /dev/null +++ b/build/tests/build4WLDev/scripts/launcher_MachineSetting_c.pl @@ -0,0 +1,52 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: launcher_MachineSetting_c.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $src = "$IPLROOT/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting.c"; +my $dst = "$IPLROOT/build/systemMenu_RED/MachineSettings/ARM9/src/MachineSetting_autogen.c"; + +my $rn = "\x0D\x0A"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + print OUT $line; + # 従来版との見た目の区別のために、無線開発用の表示を追加。 + if( $line =~ m/^[\t ]*PrintfSJIS\(.*\"MACHINE SETTINGS IPL:%s SDK:%s\".*\);/ ) + { + print OUT "//\t[AUTO ADDITION] 従来版との見た目の区別のために、無線開発用の表\示を追加。", $rn; + print OUT "\tPrintfSJIS( 0, 22*8, TXT_COLOR_BLUE, \"[ BUILT FOR WIRELESS DEVELOPMENT ]\");", $rn; + } +} +close(OUT); + diff --git a/build/tests/build4WLDev/scripts/launcher_fake_macaddress.pl b/build/tests/build4WLDev/scripts/launcher_fake_macaddress.pl new file mode 100755 index 00000000..4480c292 --- /dev/null +++ b/build/tests/build4WLDev/scripts/launcher_fake_macaddress.pl @@ -0,0 +1,123 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: launcher_fake_macaddress.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $rn = "\x0D\x0A"; + +my $SDKROOT; + +# search TWLSDK_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWLSDK_ROOT/s) { + $SDKROOT = $ENV{$_}; + } +} + +my $src = "$SDKROOT/build/libraries/wm/ARM7.TWL/nwm/src/nwmsp_event_handler.c"; +my $dst = "$SDKROOT/build/libraries/wm/ARM7.TWL/nwm/src/nwmsp_event_handler_autogen.c"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^ *MI_CpuCopy8\(ev->macaddr, sys->status->macAddress, NWM_SIZE_MACADDR\);/ ) + { + print OUT "//\t\t[AUTO COMMENT] fake MAC address of TWL wireless, copy MAC address from that in NOR flash.", $rn; + # add comment out at the top of line + $line =~ s/ev->macaddr,/wmMac,/; + } + + print OUT $line; +} +close(OUT); + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $src_make1 = "$IPLROOT/build/libraries_sysmenu/Makefile"; +my $dst_make1 = "$IPLROOT/build/libraries_sysmenu/Makefile_autogen"; + +open(F, $src_make1) or die "cant open $src_make1\n"; +my @lines = ; +close(F); + +open(OUT, ">$dst_make1") or die "cant open $dst_make1\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^SUBDIRS/ ) + { + print OUT "SUBMAKES\t\t=\t\tnwm/Makefile_autogen", $rn, $rn; + } + + if( $line =~ m/nwm/ ) + { + $line =~ s/^/\#/; + } + + print OUT $line; +} +close(OUT); + +my $src_make2 = "$IPLROOT/build/libraries_sysmenu/nwm/Makefile"; +my $dst_make2 = "$IPLROOT/build/libraries_sysmenu/nwm/Makefile_autogen"; + +open(F, $src_make2) or die "cant open $src_make2\n"; +my @lines = ; +close(F); + +open(OUT, ">$dst_make2") or die "cant open $dst_make2\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^SUBDIRS_P *\+= *ARM7/ ) + { + print OUT "SUBMAKES_P += ARM7/Makefile_autogen", $rn; + next + } + + print OUT $line; +} +close(OUT); + +my $src_make3 = "$IPLROOT/build/libraries_sysmenu/nwm/ARM7/Makefile"; +my $dst_make3 = "$IPLROOT/build/libraries_sysmenu/nwm/ARM7/Makefile_autogen"; + +open(F, $src_make3) or die "cant open $src_make3\n"; +my @lines = ; +close(F); + +open(OUT, ">$dst_make3") or die "cant open $dst_make3\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^[\t ]*nwmsp_event_handler\.c/ ) + { + $line =~ s/nwmsp_event_handler\.c/nwmsp_event_handler_autogen\.c/; + } + + print OUT $line; +} +close(OUT); diff --git a/build/tests/build4WLDev/scripts/launcher_loadWlanFirm_c.pl b/build/tests/build4WLDev/scripts/launcher_loadWlanFirm_c.pl new file mode 100755 index 00000000..c3841558 --- /dev/null +++ b/build/tests/build4WLDev/scripts/launcher_loadWlanFirm_c.pl @@ -0,0 +1,55 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: launcher_loadWlanFirm_c.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $src = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm.c"; +my $dst = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/src/loadWlanFirm_autogen.c"; + + +my $rn = "\x0D\x0A"; + +open(F, $src) or die "cant open $src\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst") or die "cant open $dst\n"; +foreach my $line ( @lines ) +{ + # WLANのLoad時に限り、FatalErrorのセット無効にする。 + if( $line =~ m/^[\t ]*UTL_SetFatalError\([\t ]*FATAL_ERROR_WLANFIRM_(LOAD|AUTH)[\t ]*\)/ ) + { + print OUT "//\t[AUTO COMMENTOUT] 無線開発用ランチャーの場合、無線関連のFATALエラー発生は無視してブートするようにします。", $rn; + # add comment out at the top of line + $line =~ s/^/\/\//; + } + + print OUT $line; +} +close(OUT); + diff --git a/build/tests/build4WLDev/scripts/launcher_makefile.pl b/build/tests/build4WLDev/scripts/launcher_makefile.pl new file mode 100755 index 00000000..c558652e --- /dev/null +++ b/build/tests/build4WLDev/scripts/launcher_makefile.pl @@ -0,0 +1,112 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: launcher_makefile.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $rn = "\x0D\x0A"; + +my $src1 = "$IPLROOT/build/systemMenu_RED/Launcher/Makefile"; +my $dst1 = "$IPLROOT/build/systemMenu_RED/Launcher/Makefile_autogen"; + +open(F, $src1) or die "cant open $src1\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst1") or die "cant open $dst1\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^SUBDIRS\t*=\t*banner ARM9/ ) + { + print OUT "SUBMAKES\t\t=\tbanner/Makefile ARM9/Makefile_autogen", $rn; + next; + } + + print OUT $line; +} +close(OUT); + +my $src2 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile"; +my $dst2 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile_autogen"; + +open(F, $src2) or die "cant open $src2\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst2") or die "cant open $dst2\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/loadWlanFirm\.c/ ) + { + $line =~ s/loadWlanFirm\.c/loadWlanFirm_autogen\.c/; + } + + print OUT $line; +} +close(OUT); + +my $src3 = "$IPLROOT/build/systemMenu_RED/MachineSettings/Makefile"; +my $dst3 = "$IPLROOT/build/systemMenu_RED/MachineSettings/Makefile_autogen"; + +open(F, $src3) or die "cant open $src3\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst3") or die "cant open $dst3\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^SUBDIRS\t*=\t*banner ARM9/ ) + { + print OUT "SUBMAKES\t\t=\tbanner/Makefile ARM9/Makefile_autogen", $rn; + next; + } + + print OUT $line; +} +close(OUT); + +my $src4 = "$IPLROOT/build/systemMenu_RED/MachineSettings/ARM9/Makefile"; +my $dst4 = "$IPLROOT/build/systemMenu_RED/MachineSettings/ARM9/Makefile_autogen"; + +open(F, $src4) or die "cant open $src4\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst4") or die "cant open $dst4\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/ +MachineSetting\.c/ ) + { + $line =~ s/MachineSetting\.c/MachineSetting_autogen\.c/; + } + + print OUT $line; +} +close(OUT); diff --git a/build/tests/build4WLDev/scripts/launcher_makefile_region.pl b/build/tests/build4WLDev/scripts/launcher_makefile_region.pl new file mode 100755 index 00000000..f11bf281 --- /dev/null +++ b/build/tests/build4WLDev/scripts/launcher_makefile_region.pl @@ -0,0 +1,112 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: launcher_makefile.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $rn = "\x0D\x0A"; + +my $src1 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile"; +my $dst1 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile_autogen_HNAJ"; + +open(F, $src1) or die "cant open $src1\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst1") or die "cant open $dst1\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/loadWlanFirm\.c/ ) + { + $line =~ s/loadWlanFirm\.c/loadWlanFirm_autogen\.c/; + } + + if( $line =~ m/^TITLEID_LO/ ) + { + $line =~ s/HNAA/HNAJ/; + } + + if( $line =~ m/^CARD_REGION/ ) + { + $line =~ s/ALL/Japan/; + print OUT $line; + print OUT "BINDIR = ./bin.HNAJ/\$(TWL_BUILDTYPE)", $rn; + next; + } + + if( $line =~ m/^INSTALL_DIR/ ) + { + print OUT "INSTALL_DIR = \$(UPDATER_HOST_ROOT_DIR)/debugger/japan", $rn; + print OUT "MAKETAD := \$(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/maketad.updater.exe", $rn; + next; + } + + print OUT $line; +} +close(OUT); + + +my $src2 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile"; +my $dst2 = "$IPLROOT/build/systemMenu_RED/Launcher/ARM9/Makefile_autogen_HNAE"; + +open(F, $src2) or die "cant open $src2\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst2") or die "cant open $dst2\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/loadWlanFirm\.c/ ) + { + $line =~ s/loadWlanFirm\.c/loadWlanFirm_autogen\.c/; + } + + if( $line =~ m/^TITLEID_LO/ ) + { + $line =~ s/HNAA/HNAE/; + } + + if( $line =~ m/^CARD_REGION/ ) + { + $line =~ s/ALL/America/; + print OUT $line; + print OUT "BINDIR = ./bin.HNAE/\$(TWL_BUILDTYPE)", $rn; + next; + } + + if( $line =~ m/^INSTALL_DIR/ ) + { + print OUT "INSTALL_DIR = \$(UPDATER_HOST_ROOT_DIR)/debugger/america", $rn; + print OUT "MAKETAD := \$(TWL_IPL_RED_PRIVATE_TOOLSDIR)/bin/maketad.updater.exe", $rn; + next; + } + + print OUT $line; +} +close(OUT); + diff --git a/build/tests/build4WLDev/scripts/systemupdater_source.pl b/build/tests/build4WLDev/scripts/systemupdater_source.pl new file mode 100755 index 00000000..a997eec7 --- /dev/null +++ b/build/tests/build4WLDev/scripts/systemupdater_source.pl @@ -0,0 +1,125 @@ +#!/bin/perl +#---------------------------------------------------------------------------- +# Project: TwlIPL - tests - +# File: systemupdater_source.pl +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- + +use strict; + +my $IPLROOT; + +# search TWL_IPL_RED_ROOT +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_ROOT/s) { + $IPLROOT = $ENV{$_}; + } +} + +my $rn = "\x0D\x0A"; + +my $src1 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console.c"; +my $dst1 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_check_console_autogen.c"; + +my $in_check_console = 0; + +open(F, $src1) or die "cant open $src1\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst1") or die "cant open $dst1\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/^void ProcessCheckConsole\(void\)/ ) + { + $in_check_console = 1; + } + + if ($in_check_console == 1) + { + if( $line =~ m/^\/\*/ ) + { + print OUT "\tkamiFontPrintfConsole( FONT_COLOR_GREEN, \"This updater is for Wireless development.\\n\");", $rn; + print OUT "//\t[AUTO COMMENTOUT] 無線開発用SystemUpdaterの場合、コメントアウトをはずします。", $rn; + # add comment out at the top of line + $line =~ s/^/\/\//; + } + if( $line =~ m/^\*\// ) + { + print OUT "//\t[AUTO COMMENTOUT] 無線開発用SystemUpdaterの場合、コメントアウトをはずします。", $rn; + # add comment out at the top of line + $line =~ s/^/\/\//; + } + if( $line =~ m/^}/ ) + { + $in_check_console = 0; + } + } + + print OUT $line; +} +close(OUT); + +my $src2 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_select_region.c"; +my $dst2 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/src/process_select_region_autogen.c"; + +open(F, $src2) or die "cant open $src2\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst2") or die "cant open $dst2\n"; +foreach my $line ( @lines ) +{ + # WLANのLoad時に限り、FatalErrorのセット無効にする。 + if( $line =~ m/OS_TWL_REGION_AUSTRALIA/ ) + { + print OUT "//\t[AUTO COMMENTOUT] 無線開発用SystemUpdaterの場合、RegionはJapanとAmericaのみ。", $rn; + $line =~ s/OS_TWL_REGION_AUSTRALIA/OS_TWL_REGION_AMERICA/; + } + + print OUT $line; +} +close(OUT); + +my $src3 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/Makefile"; +my $dst3 = "$IPLROOT/build/systemMenu_tools/SystemUpdaterRegionSelect/ARM9.TWL/Makefile_autogen"; + +open(F, $src3) or die "cant open $src3\n"; +my @lines = ; +close(F); + + +open(OUT, ">$dst3") or die "cant open $dst3\n"; +foreach my $line ( @lines ) +{ + if( $line =~ m/UPDATER_HOST_ROOT_DIR =/ ) + { + $line =~ s/UPDATER_HOST_ROOT_DIR =/UPDATER_HOST_ROOT_DIR ?=/; + } + + if( $line =~ m/process_select_region\.c/ ) + { + $line =~ s/process_select_region\.c/process_select_region_autogen\.c/; + } + + if( $line =~ m/process_check_console\.c/ ) + { + $line =~ s/process_check_console\.c/process_check_console_autogen\.c/; + } + + print OUT $line; +} +close(OUT); diff --git a/build/tests/compressSharedFontLoad/README.txt b/build/tests/compressSharedFontLoad/README.txt new file mode 100644 index 00000000..5fed4e21 --- /dev/null +++ b/build/tests/compressSharedFontLoad/README.txt @@ -0,0 +1,60 @@ +# ------------------------------------------ +# 共有フォント圧縮時のロード速度実験 +# +# 作成者 : nishikawa_takeshi +# ------------------------------------------ + +実験は以下の2ステップから構成されます。 + +1. 共有フォントの圧縮とインポート +2. ロード速度の測定 + +以下、各ステップについて説明します。 + + +# ------------------------------------------ +# ステップ1 共有フォントの圧縮とインポート +# ------------------------------------------ + +(1)共有フォントの圧縮 + +compSharedFont ディレクトリに移動して make してください。 + % cd compSharedFont + % make + +(2)圧縮したフォントのインポート + +圧縮された共有フォントを NandInitializerRed でインポートする必要がありますが、 +NandInitializerRed は、SDからではなく、ROMアーカイブからインポートします。 +(つまり、自身のSRL内部に共有フォントを持ちます。) +そのため、NandInitializerRed を再度、ビルドする必要があります。 +圧縮フォントは(1)の処理によって、NandInitializerRed のディレクトリに自動的にコピーされますので、 +コピーする必要はありません。 + + % cd $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/NandIntializerRed + % make clean; make + +再ビルドされた NandInitializerRed.srl (ARM9.TWL/bin/以下にあります) をSDカードにコピーして、 +SDカードブートすると、メニューからフォントをインポートする項目を選択できます。 + +# ------------------------------------------ +# ステップ2 ロード速度の測定 +# ------------------------------------------ + +ロード速度の測定プログラムは、testLoadSpeed ディレクトリにあります。 +ここで、OS ライブラリの共有フォント関連の関数を変更し、 +されに、TWLSDK を SYSMENU パッケージとしてビルドしなおす必要があります。 +これらの変更とテストプログラムのビルドは、make にオプションをつけると自動的に実行されます。 +(お好みで、TWL_WITHOUT_DEMOS=TRUE や TWL_FINALROM=TRUE オプションをおつけください。) + + % cd testLoadSpeed + % make TEST_TWLSDK_REBUILD=TRUE + +上記の TWLSDK の変更をしないときには、テストプログラムのビルドが正常にできません。 + +テストプログラムを変更する場合、毎回 TWLSDK をビルドするのは時間がかかりますので、 +オプションをつけずに make すると、テストプログラムのビルドのみ実行します。 + + % make + +作成されたテストプログラムを実行すれば、圧縮した共有フォントのロード時間を測定できます。 diff --git a/build/tests/compressSharedFontLoad/compSharedFont/Makefile b/build/tests/compressSharedFontLoad/compSharedFont/Makefile new file mode 100644 index 00000000..3417d6b0 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/Makefile @@ -0,0 +1,62 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +SUBDIRS = compBLZ_modified \ + ntrcomp + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +FONT_TIMESTAMP = 08061300 +FONT_DIR = WW +FONTS = TBF1_l.NFTR \ + TBF1_m.NFTR \ + TBF1_s.NFTR +FONT_RSC = $(addprefix $(FONT_DIR)/, $(FONTS)) + +FONT_ORG_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/sharedFont/WW +FONT_ORG_RSC = $(addprefix $(FONT_ORG_DIR)/, $(FONTS)) + +ifneq ($(TWL_IPL_RED_PRIVATE_ROOT),) +FONT_TABLE = TWLFontTable.dat +endif + +GEN_FONT_TABLE = ./genFontTable.plx + +#---------------------------------------------------------------------------- +INSTALL_TARGETS = $(FONT_TABLE) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/build/systemMenu_tools/NandInitializerRed/data + +LDIRT_CLEAN = $(FONT_TABLE) $(FONT_RSC) + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build : $(FONT_TABLE) + +# step1 : copy sharedFonts into local directory for work +$(FONT_RSC): + cp $(FONT_ORG_RSC) $(FONT_DIR) + +# step2 : compress sharedFonts and them in local directory +$(FONT_TABLE): $(FONT_RSC) + $(GEN_FONT_TABLE) $(FONT_TIMESTAMP) $(FONT_RSC) + +#===== End of Makefile ===== diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/Makefile b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/Makefile new file mode 100644 index 00000000..89101f6e --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/Makefile @@ -0,0 +1,73 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: TwlSDK - tools - compBLZ +# File: Makefile +# +# 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$ +#--------------------------------------------------------------------------- + +TARGET_PLATFORM = TWL NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#--------------------------------------------------------------------------- + +TARGET_BIN = compBLZ.exe +TARGETS = $(BINDIR)/$(TARGET_BIN) + +SRCS = main.c \ + compress.c \ + file.c \ + version.c + +HEADERS = common.h \ + compress.h \ + file.h + +INCDIR += ../../../include +OBJDIR = obj +BINDIR = bin + +OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.c=.o)) + +MACROS += -DSDK_TWL $(addprefix -I,$(INCDIR)) +NEWDIRS = $(OBJDIR) $(BINDIR) +LDIRT_CLEAN += $(NEWDIRS) version.c + +#INSTALL_DIR = $(TWL_INSTALL_TOOLSDIR)/bin +#INSTALL_TARGETS = $(TARGETS) + +#--------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + +do-build: $(TARGETS) + +$(TARGETS): $(OBJS) $(LIBDGT) $(MAKEFILE) + $(CC_X86) $(OBJS) $(LIBDGT) -o $@ + +$(OBJS):%.o: + $(COMPILE_C) + +$(OBJDIR)/main.o: main.c file.h version.c +$(OBJDIR)/compress.o: compress.c compress.h +$(OBJDIR)/file.o: file.c file.h +$(OBJDIR)/version.o: version.c + +version.c: $(filter-out version.c,$(SRCS)) $(HEADERS) $(MAKEFILE) + @for i in $^ ; \ + do \ + date -r $$i +'const unsigned long SDK_DATE_OF_LATEST_FILE=%Y%m%dUL;'; \ + done | sort | tail -1 > $@ + +#===== End of Makefile ===== diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/_ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/_ new file mode 100644 index 00000000..95665859 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/_ @@ -0,0 +1 @@ +SDK_CONFIDENTIAL diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/common.h b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/common.h new file mode 100644 index 00000000..9f60ce54 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/common.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compstatic + File: common.h + + Copyright 2003 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 COMMON_H__ +#define COMMON_H__ + +typedef enum +{ + TRUE = 1, + FALSE = 0 +} +BOOL; + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; + +// macro +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define ROUNDUP4(x) (((x)+3)&~3) +#define LE(a) ((((a)<<24)&0xff000000)|(((a)<<8)&0x00ff0000)|\ + (((a)>>8)&0x0000ff00)|(((a)>>24)&0x000000ff)) +#define FREE(x) do { if (x){ free(x); x = NULL; } } while(0) + + +#endif //COMMON_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.c b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.c new file mode 100644 index 00000000..57f4b5bc --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.c @@ -0,0 +1,374 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compstatic + File: compress.c + + Copyright 2003 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 "file.h" +#include "compress.h" + +static int LZCompressRV(u8 *src_buffer, int src_size, u8 *dst_buffer, int dst_size); +static int FindMatched(u8 *src_buffer, int src_size, u8 *dic_buffer, int dic_size, int *index); +static int HowManyMatched(u8 *src_buffer, u8 *dic_buffer, int max_len); +static int CheckOverwrite(int orig_size, u8 *cmprs_buffer, int cmprs_buffer_size, + int *orig_safe, int *cmprs_safe); + + +/*---------------------------------------------------------------------------* + Name: Compress + + Description: Buffer の逆順の圧縮を行なう. + ただし圧縮データと展開データがメモリ空間を共有できるように + 調整する + + buffer : 被圧縮データ + buffer_size : 被圧縮データサイズ + + Return: >=0: 圧縮後のサイズ + < 0: 失敗 + *---------------------------------------------------------------------------*/ +int Compress(u8 *buffer_original, int buffer_original_size) +{ + u8 *buffer; + int buffer_size; + int buffer_start; + u8 *temp_buffer_original; + u8 *temp_buffer; + int temp_buffer_size; + int temp_buffer_start; + int compressed_size; + int aligned_size; + int total_size; + int reduced; + int i; + CompFooter *footer; + + // 前準備 + if (NULL == (temp_buffer_original = (u8 *)malloc(buffer_original_size))) + { + ErrorPrintf("Cannot allocate memory size=%d\n", buffer_original_size); + return COMPRESS_FATAL_ERROR; + } + + if ((u32)buffer_original % 4 != 0) + { + ErrorPrintf("Top of buffer is not aligned by 4.\n"); + return COMPRESS_FATAL_ERROR; + } + + buffer = buffer_original; + buffer_size = buffer_original_size; + temp_buffer = temp_buffer_original; + temp_buffer_size = buffer_original_size; + + // 圧縮を行なう + reduced = LZCompressRV(buffer, buffer_size, temp_buffer, temp_buffer_size); + if (reduced < 0) + { + DebugPrintf("Compressed buffer size exceeds original data size.\n"); + free(temp_buffer_original); + return COMPRESS_LARGER_ORIGINAL; + } + + temp_buffer_size -= reduced; + temp_buffer += reduced; + + DebugPrintf("1: source size = %d compressed = %d\n", buffer_size, temp_buffer_size); + + // 展開不能な上書きが発生するか確認 + if (!CheckOverwrite + (buffer_size, temp_buffer, temp_buffer_size, &buffer_start, &temp_buffer_start)) + { + // 上書きが発生するなら圧縮範囲を変更する + buffer += buffer_start; + buffer_size -= buffer_start; + temp_buffer += temp_buffer_start; + temp_buffer_size -= temp_buffer_start; + + DebugPrintf(" !! Shrink back Compressed region to avoid overwriting.\n" + " !! Expand non-compressed region = +%d\n" + "2: source size = %d compressed = %d\n", + buffer_start, buffer_size, temp_buffer_size); + } + + // PADDING とパラメータ領域を加えても超えないかどうか判定 + compressed_size = buffer_start + temp_buffer_size; // header+body + aligned_size = ROUNDUP4(compressed_size); // +padding + total_size = aligned_size + sizeof(CompFooter); // +footer + + if (buffer_original_size <= total_size) + { + DebugPrintf("Compressed buffer size exceeds or equals original data size.\n"); + free(temp_buffer_original); + return COMPRESS_LARGER_ORIGINAL; + } + + // データをテンポラリバッファから元データへ上書きする + CopyBuffer(temp_buffer, buffer, temp_buffer_size); + free(temp_buffer_original); + + // サイズが 4 の倍数になるように PADDING + // LZ の実装上圧縮領域の最初のバイト値は 0xff にならない(最初は圧縮 + // フラグであり、最初のデータは圧縮なしで格納されるから)ので 0xff で + // 埋める + for (i = compressed_size; i < aligned_size; i++) + { + buffer_original[i] = 0xff; + } + + // サイズ設定 + // compressBottom は sizeof(PAD)+sizeof(footer) なので 1バイトで十分 + footer = (CompFooter *) (buffer_original + aligned_size); + footer->bufferTop = total_size - buffer_start; // 正の値 + footer->compressBottom = total_size - compressed_size; // 正の値 + footer->originalBottom = buffer_original_size - total_size; // 正の値 + + return total_size; +} + + +/*---------------------------------------------------------------------------* + Name: LZCompressRV + + Description: LZ 圧縮を行なう.ただしデータの後方から圧縮開始する + 圧縮結果も後ろ詰めになる + + Returns: 圧縮データの先頭 index + 圧縮データは dst_buffer+index から dst_buffer+dst_size-1 まで + -1: 圧縮失敗(圧縮した結果の方が大きい場合) + *---------------------------------------------------------------------------*/ +static int LZCompressRV(u8 *src_buffer, int src_size, u8 *dst_buffer, int dst_size) +{ + int src_index = src_size; + int dst_index = dst_size; + int compflag; + int compflag_index; + int i; + + while (src_index > 0) + { + if (dst_index < 1) + return -1; // Buffer Overflow + + // 8bit の圧縮フラグの挿入位置を予約 + compflag = 0x00; + compflag_index = --dst_index; + + // フラグ系列が8ビットデータとして格納されるため、8回ループ + for (i = 0; i < 8; i++) + { + compflag <<= 1; + + if (src_index > 0) // src が残っているか判定 + { + u8 *dic_buffer; + int dic_size; + u8 *ref_buffer; + int ref_size; + int index; + int len; + + dic_buffer = src_buffer + src_index; + dic_size = src_size - src_index; + ref_size = MIN(src_index, LZ_MAX_COPY); + ref_buffer = dic_buffer - ref_size; + + len = FindMatched(ref_buffer, ref_size, + dic_buffer, MIN(dic_size, LZ_MAX_DIC_LENGTH), &index); + + if (len >= LZ_MIN_COPY) + { + u16 half; + + // Offset/Len の記録が可能かどうか確認 + if (dst_index < 2) + return -1; // Buffer Overflow + + // src index 進める + src_index -= len; + + // len >= LZ_MIN_COPY なのでその分減算し値域を節約する + index -= (LZ_MIN_COPY - 1); + len -= (LZ_MIN_COPY - 0); + + // 16bit データとしてたたむ + half = (u16)((index & (LZ_MAX_INDEX - 1)) | (len << LZ_BIT_INDEX)); + dst_buffer[--dst_index] = (half >> 8) & 0xff; + dst_buffer[--dst_index] = (half >> 0) & 0xff; + + // flag セット + compflag |= 0x01; + } + else + { + // 値そのままを記録する & src index 進める + if (dst_index < 1) + return -1; // Buffer Overflow + dst_buffer[--dst_index] = src_buffer[--src_index]; + } + } + } + // 圧縮フラグの保存 + dst_buffer[compflag_index] = compflag; + } + return dst_index; +} + + +/*---------------------------------------------------------------------------* + Name: FindMatched + + Description: 一致するパターンの検索を行なう.ただしデータの後方から前方への + 検索 + + src_buffer[0...src_size-1] のパターンを src_buffer の後方から + dic_buffer[0...dic_size-1] のパターンと最大一致する部分を + 検索する. + + Returns: 一致したサイズ + *index 一致した位置 + *---------------------------------------------------------------------------*/ +static int FindMatched(u8 *src_buffer, int src_size, u8 *dic_buffer, int dic_size, int *index) +{ + u8 *src_bottom = src_buffer + src_size - 1; + u8 char_src_bottom = *src_bottom; + int n, len, max_len; + + // 返値初期化 + max_len = 0; + + for (n = 0; n < dic_size; n++) + { + // 高速化のためのキャッシュ + if (char_src_bottom == dic_buffer[n]) + { + len = HowManyMatched(src_bottom, dic_buffer + n, MIN(n + 1, src_size)); + if (max_len < len) + { + max_len = len; + *index = n; + } + } + } + + // 最小サイズ以上なら成功 + return max_len; +} + + +/*---------------------------------------------------------------------------* + Name: HowManyMatched + + Description: 2つのパターンが逆順にどこまで一致しているかを調査する + + src_buffer, dic_buffer 比較パターンのアドレス + (このアドレスから逆方向へ検索する) + max_len 最大調査する長さ + + Returns: 一致した長さ + *---------------------------------------------------------------------------*/ +static int HowManyMatched(u8 *src_buffer, u8 *dic_buffer, int max_len) +{ + int i; + + // パターン一致検索(逆順) + for (i = 0; i < max_len; i++) + { + if (*src_buffer != *dic_buffer) + { + break; + } + src_buffer--; + dic_buffer--; + } + return i; +} + + +/*---------------------------------------------------------------------------* + Name: CheckOverwrite + + Description: LZ 展開で展開先と展開元を同じアドレスに置いた場合に、どこまで + 正常に展開が可能かをチェックする + + Returns: 最後まで展開可能なら TRUE 途中までなら FALSE + *---------------------------------------------------------------------------*/ +static int CheckOverwrite(int orig_size, u8 *cmprs_buffer, int cmprs_buffer_size, + int *orig_safe, int *cmprs_safe) +{ + int src = cmprs_buffer_size; + int dst = orig_size; + int flag; + int i; + +//#define DETAIL + while (dst > 0) + { + flag = cmprs_buffer[--src]; // 圧縮非圧縮フラグ 8 ループ分 + +#ifdef DETAIL + DebugPrintf("%08x %08x FLG=0x%02x\n", src, dst, flag); +#endif + for (i = 0; i < 8; i++) + { + if (dst > 0) + { + if (flag & 0x80) // 圧縮データか? + { + u16 half; + int len; + + // 展開長を計算 + src -= 2; + half = (u16)(cmprs_buffer[src] | (cmprs_buffer[src + 1] << 8)); + len = ((half >> LZ_BIT_INDEX) & (LZ_MAX_LENGTH - 1)) + LZ_MIN_COPY; +#ifdef DETAIL + DebugPrintf("%08x %08x-%08x LEN=%d\n", src, dst - 1, dst - len, len); +#endif + // ソースデータを上書きしてしまうかチェック + dst -= len; + + if (dst < 0) + { + ErrorPrintf("System error in CheckOverwrite???\n"); + exit(-1); // Panic!! + } + + if (dst < src) + { + // 上書きしてしまうなら圧縮は現在のところまでで止める + *orig_safe = dst; + *cmprs_safe = src; + return FALSE; + } + } + else + { + // 非圧縮データならそのままコピーなので + // 破壊を伴なう上書きは起こらない + src--; + dst--; +#ifdef DETAIL + DebugPrintf("%08x %08x CHR=0x%02x\n", src, dst, cmprs_buffer[src]); +#endif + } + flag <<= 1; + } + } + } + *orig_safe = 0; + *cmprs_safe = 0; + return TRUE; +} diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.h b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.h new file mode 100644 index 00000000..9b141d6c --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/compress.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compstatic + File: compress.h + + Copyright 2003 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 COMPRESS_H__ +#define COMPRESS_H__ +#include "common.h" + +//--------------------------------------------------------- +typedef struct +{ + u32 bufferTop:24; // 圧縮領域終端 - 先頭 + u32 compressBottom:8; // 圧縮領域終端 - データ終端 + u32 originalBottom; // 展開領域終端 - 圧縮領域終端 +} +CompFooter; + +//--------------------------------------------------------- +int Compress(u8 *buffer, int buffer_size); + +#define COMPRESS_LARGER_ORIGINAL (-1) +#define COMPRESS_FATAL_ERROR (-2) + + +// loader area +#define LOADER_SIZE_ARM9 (16*1024) +#define LOADER_SIZE_ARM7 ( 1*1024) + +// LZ compress parameters +#define LZ_BIT_INDEX 12 // 12bit offset +#define LZ_BIT_LENGTH 4 // 4bit length +#define LZ_MAX_INDEX (1 << LZ_BIT_INDEX) +#define LZ_MAX_LENGTH (1 << LZ_BIT_LENGTH) + +#define LZ_MIN_COPY 3 +#define LZ_MAX_COPY (LZ_MIN_COPY+LZ_MAX_LENGTH-1) +#define LZ_MAX_DIC_LENGTH (LZ_MIN_COPY+LZ_MAX_INDEX-1) + +// macro +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define ROUNDUP4(x) (((x)+3)&~3) + +#endif diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.c b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.c new file mode 100644 index 00000000..871c6e46 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.c @@ -0,0 +1,314 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compstatic + File: file.c + + Copyright 2003 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 // calloc() +#include // free(), exit() +#include // stat() +#include // strlen/strdup/strcpy +#include // va_start(),va_end() +#include // unlink() +#include "file.h" + + +/*---------------------------------------------------------------------------* + Name: ReadFile + + Description: ファイルの読み込み バッファの確保 + *---------------------------------------------------------------------------*/ +int ReadFile(const char *filename, u8 **buffer) +{ + FILE *fp; + struct stat filestat; + int filesize; + + fp = NULL; + *buffer = NULL; + + if (filename == NULL) + { + ErrorPrintf("Not specified filename\n"); + goto error; + } + + /* Open file */ + if (stat(filename, &filestat) || !S_ISREG(filestat.st_mode) || + NULL == (fp = fopen(filename, "rb"))) + { + ErrorPrintf("Cannot open file '%s'\n", filename); + goto error; + } + + /* Read file */ + filesize = filestat.st_size; + if (NULL == (*buffer = malloc(filesize))) + { + ErrorPrintf("Cannot allocate memory size=%d\n", filesize); + goto error; + } + + if (filesize != fread(*buffer, sizeof(u8), filesize, fp)) + { + ErrorPrintf("Cannot read file '%s'\n", filename); + goto error; + } + + DebugPrintf("%p %8d bytes ReadFile \'%s\'\n", *buffer, filesize, filename); + + /* Close file */ + fclose(fp); + return filesize; + + error: + if (*buffer) + free(*buffer); + if (fp) + fclose(fp); + return -1; +} + + +/*---------------------------------------------------------------------------* + Name: WriteFile + + Description: ファイルの作成書き込み + *---------------------------------------------------------------------------*/ +int WriteFile(const char *filename, u8 *buffer, int size) +{ + FILE *fp; + + DebugPrintf("%p %8d bytes WriteFile \'%s\'\n", buffer, size, filename); + + /* Open file */ + if (NULL == (fp = fopen(filename, "wb"))) + { + ErrorPrintf("Cannot open file '%s'\n", filename); + return -1; + } + + /* Write file */ + if (size != fwrite(buffer, sizeof(u8), size, fp)) + { + ErrorPrintf("Cannot write file '%s'\n", filename); + (void)fclose(fp); + (void)unlink(filename); + return -1; + } + + /* Close file */ + if (0 > fclose(fp)) + { + ErrorPrintf("Cannot close file '%s'\n", filename); + (void)unlink(filename); + return -1; + } + return size; +} + +/*---------------------------------------------------------------------------* + Name: CopyBuffer + + Description: バッファのコピー + *---------------------------------------------------------------------------*/ +void CopyBuffer(const u8 *src, u8 *dst, int size) +{ + int i; + + if ((unsigned int)src > (unsigned int)dst) + { + for (i = 0; i < size; i++) + { + dst[i] = src[i]; + } + } + else + { + for (i = size - 1; i >= 0; i--) + { + dst[i] = src[i]; + } + } + return; +} + +/*---------------------------------------------------------------------------* + Name: GetDirName + + Description: ファイル名のディレクトリ名を取得する + *---------------------------------------------------------------------------*/ +char *GetDirName(const char *path) +{ + int i; + char *new_path; + + for (i = strlen(path) - 1; i >= 0; i--) + { + if (path[i] == '/' || path[i] == '\\') + { + if (NULL != (new_path = strdup(path))) + { + new_path[i] = '\0'; + } + return new_path; + } + if (path[i] == ':') + { + if (NULL != (new_path = malloc(i + 3))) + { + strncpy(new_path, path, i); + strcpy(new_path + i, ":."); + } + return new_path; + } + } + + return strdup("."); +} + +/*---------------------------------------------------------------------------* + Name: DebugPrintf + + Description: Debug 出力用 Printf + *---------------------------------------------------------------------------*/ +BOOL bDebugMode = FALSE; + +void DebugPrintf(const char *fmt, ...) +{ + va_list va; + + if (bDebugMode) + { + va_start(va, fmt); + vfprintf(stderr, fmt, va); + va_end(va); + } +} + +/*---------------------------------------------------------------------------* + Name: ConsolePrintf + + Description: 通常コンソール出力用 Printf + *---------------------------------------------------------------------------*/ +void ConsolePrintf(const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + vfprintf(stdout, fmt, va); + va_end(va); +} + +/*---------------------------------------------------------------------------* + Name: ErrorPrintf + + Description: Error 出力用 Printf + *---------------------------------------------------------------------------*/ +void ErrorPrintf(const char *fmt, ...) +{ + va_list va; + + fprintf(stderr, "Error: "); + va_start(va, fmt); + vfprintf(stderr, fmt, va); + va_end(va); +} + + +/*---------------------------------------------------------------------------* + Name: StrDup + + Description: エラーハンドリング&古い値の free 付き strdup 関数 + *---------------------------------------------------------------------------*/ +char *StrDup(char *old, char *new) +{ + if (old) + { + free(old); + } + if (new && NULL == (new = strdup(new))) + { + ErrorPrintf("Cannot allocate memory\n"); + exit(1); + } + return new; +} + + +/*---------------------------------------------------------------------------* + Name: StrCat + + Description: 文字列の連結 + *---------------------------------------------------------------------------*/ +char *StrCat(int num, ...) +{ + va_list va; + int i; + int size; + char *result; + + va_start(va, num); + size = 0; + for (i = 0; i < num; i++) + { + size += strlen(va_arg(va, char *)); + } + va_end(va); + + if (NULL == (result = malloc(size + 1))) + { + ErrorPrintf("Cannot allocate memory\n"); + exit(1); + } + + va_start(va, num); + result[0] = '\0'; + for (i = 0; i < num; i++) + { + (void)strcat(result, va_arg(va, char *)); + } + va_end(va); + + return result; +} + +//--------------------------------------------------------------------------- +// パス文字列からファイル名部分のポインタを取得し、拡張子を削る +// @param path パス +// @return ファイル名のポインタ +//--------------------------------------------------------------------------- +char *StrCutFname(char *path) +{ + char *search_tmp; + + if (path == NULL) + { + return NULL; + } + + if ((search_tmp = strrchr(path, '/')) != NULL) + { + path = (search_tmp + 1); + } + if ((search_tmp = strrchr(path, '\\')) != NULL) + { + path = (search_tmp + 1); + } + if ((search_tmp = strrchr(path, '.')) != NULL) + { + *search_tmp = '\0'; + } + return path; +} diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.h b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.h new file mode 100644 index 00000000..b266b0ff --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/file.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compstatic + File: file.h + + Copyright 2003 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 FILE_H__ +#define FILE_H__ + +#include "common.h" + +int ReadFile(const char *filename, u8 **buffer); +int WriteFile(const char *filename, u8 *buffer, int size); +void CopyBuffer(const u8 *src, u8 *dst, int size); +char *GetDirName(const char *filename); +void DebugPrintf(const char *fmt, ...); +void ErrorPrintf(const char *fmt, ...); +void ConsolePrintf(const char *fmt, ...); +char *StrDup(char *old, char *new); +char *StrCat(int num, ...); +char *StrCutFname(char *path); + +extern BOOL bDebugMode; + +#endif //FILE_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/main.c b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/main.c new file mode 100644 index 00000000..f7ec6980 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/compBLZ_modified/main.c @@ -0,0 +1,171 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - compBLZ + File: main.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 // getopt() +#include "file.h" +#include "compress.h" + +extern const unsigned long SDK_DATE_OF_LATEST_FILE; + +static void usage(void); + +/*---------------------------------------------------------------------------* + Name: main + + Description: + *---------------------------------------------------------------------------*/ +int main(int argc, char *argv[]) +{ + int n; + int result; + int iptfilesize; + + char* optfilename; + char* suffix; + u8* filebuf; + + BOOL optfname_flag = FALSE; // if optfilename input, this flag is true. + + optfilename = suffix = NULL; + + while ((n = getopt(argc, argv, "o:e:dhv")) != -1) + { + switch (n) + { + case 'o': // output file name + optfilename = optarg; + optfname_flag = TRUE; + break; + + case 'e': + suffix = optarg; + break; + + case 'd': // Show debug message + bDebugMode = TRUE; + break; + + case 'h': + case 'v': + default: + usage(); // Never returns + break; + } + + DebugPrintf("option -%c: %s\n", n, optarg ? optarg : "No ARG"); + } + + argc -= optind; + argv += optind; + + if (bDebugMode) + { + int i; + + DebugPrintf("argc=%d optind=%d\n", argc, optind); + for (i = 0; i < argc; i++) + { + DebugPrintf("argv[%d] = [%s]\n", i, argv[i]); + } + } + + if (argc == 1) + { + if (optfilename == NULL) + { + optfilename = argv[0]; + } + iptfilesize = ReadFile(argv[0], &filebuf); + } + else + { + usage(); // Never returns + } + + if (iptfilesize < 0) + { + ConsolePrintf("exit...\n"); + return 1; + } + + if ((result = Compress(filebuf, iptfilesize)) < 0) + { + switch (result) + { + case COMPRESS_LARGER_ORIGINAL: + ConsolePrintf("Inputdata ..... Not compressed (enlarged or same size as before)\n"); + break; + case COMPRESS_FATAL_ERROR: + ConsolePrintf("Fatal error occured\n"); + break; + } + ConsolePrintf("exit...\n"); + return 1; + } + + // cut file path and suffix of input file + if (!optfname_flag) + { + optfilename = StrCutFname(optfilename); + } + + // create output filename + if (suffix == NULL) + { + optfilename = StrCat(2, optfilename, "_BLZ.bin"); + } + else + { + optfilename = StrCat(2, optfilename, suffix); + } + + // output file + if (WriteFile(optfilename, filebuf, result) < 0) + { + ConsolePrintf("exit...\n\n"); + return 1; + } + + ConsolePrintf("Inputdata ..... Compressed ... %9d -> %9d\n", iptfilesize, result); + + return 0; +} + +/*---------------------------------------------------------------------------* + Name: usage + + Description: + *---------------------------------------------------------------------------*/ +static void usage(void) +{ + fprintf(stderr, + "TWL-SDK Development Tool - compBLZ - Compress data\n" + "Build %lu\n" + "\n" + "Usage: compBLZ [-d] [-o outputFile] [-e suffix] inputFile\n" + "\n" + " Compress data (backward LZ)\n" + "\n" + " -o outputFile FILENAME for output file (default:input filename)\n" + " -e suffix SUFFIX for output file (default:\"_BLZ\")\n" + " -d Show debug messages (for test purpose)\n" + " -h Show this message\n" "\n", SDK_DATE_OF_LATEST_FILE); + + exit(1); +} diff --git a/build/tests/compressSharedFontLoad/compSharedFont/genFontTable.plx b/build/tests/compressSharedFontLoad/compSharedFont/genFontTable.plx new file mode 100644 index 00000000..69cd3c09 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/genFontTable.plx @@ -0,0 +1,261 @@ +#!/usr/bin/perl + +# +# To Do +# ・Font info table の padding を圧縮後ファイルサイズを格納するエントリに変更 +# ・ファイルサイズを取得して詰め込む処理を追加 +# ・SHA-1ハッシュをつける前に圧縮する +# + +###################################################################### +# genFontTable.pl +# +# generate Secure Shared Font Data Table +# +# [[ HEADER FORMAT ]] +# security code (128 bytes) : RSA signature of Header +# +# Header ( 32 bytes) +# TimeStamp ( 4 bytes) : date %y%m%d%H +# number ( 2 bytes) : number of font files +# padding ( 6 bytes) : +# padding ( 20 bytes) : SHA1 digest of Font info table +# +# Font info table ( 64 bytes * number) +# fileName ( 32 bytes) : font file name +# comp_length ( 4 bytes) : length of the compression file +# file offset ( 4 bytes) : file offset of Font data +# length ( 4 bytes) : length of file (bytes) +# digest ( 20 bytes) : SHA1 digest of Font data +# +# note: each section image is aligned to 32 bytes. +# +###################################################################### + +use POSIX 'strftime'; +use File::Basename; + +if ($#ARGV < 2) { + printf STDOUT ("Usage: %s [genFontTable] timestamp [Target font files...]\n", $0); + exit(-1); +} + +my $outFile = "TWLFontTable.dat"; +my $infoFile = "info.bin"; +my $headerFile = "header.bin"; +my $digestFile = "sha1.bin"; +my $signFile = "sign.bin"; +my $tempFile = "temp.bin"; +my $compprog = "./compBLZ_modified/bin/compBLZ.exe"; # 圧縮プログラム +my $compoption = "-e \"\""; +#my $compprog = "./ntrcomp/gcc/ntrcomp.exe"; +#my $compoption = "-h8 -A32 -s"; + +# 後始末 +sub deleteTemp { + system ("rm -f $infoFile"); + system ("rm -f $headerFile"); + system ("rm -f $digestFile"); + system ("rm -f $signFile"); + system ("rm -f $tempFile"); +} + +# 環境変数からSDKのルートをサーチして(ntrcompの場所特定に必要) +#foreach ( sort keys ( %ENV ) ){ +# if ($_ =~ m/TWLSDK_ROOT/s) { +# $SDKROOT = $ENV{$_}; +# } +#} +#printf "TWLSDK_ROOT is ${SDKROOT}\n"; + +my $signSize = 0x80; +my $headerSize = 0x20; +my @files; + +# 要素数算出 +my $num = 0; +foreach ( @ARGV ) { + next if( $_ eq $ARGV[0] ); + $files[ $num ] = $_; + $num++; +} + +# 情報テーブルの出力 +{ + my $elementSize = 0x40; + my $fileNameMax = 0x20; + my $padLen = 0x04; + # offset length = 0x04; + # file length = 0x04; + my $sha1Len = 0x14; + + open INFO, ">$infoFile" or die; + binmode INFO; + + # オフセット算出 + my $offset = $signSize + $headerSize + $num * $elementSize; + if( ( $offset % 32 ) > 0 ) { $offset += 32 - ( $offset % 32 ); } + + printf "---------------------------------------------------------------\n"; + printf "filename\toffset \torig_size\tcompressed_size\n"; + foreach ( @files ) { + # NULL指定時は、NULL出力 + if( "NULL" eq basename( $_ ) ) { + syswrite( INFO, pack( "x$elementSize") ); + next; + } + + # ファイルネームの出力 + if( !( -e $_ ) ) { + close( INFO ); + deleteTemp(); + die "file not exist. : $_\n"; + } + my $name = basename( $_ ); + if( length $name >= $fileNameMax ) { + close( INFO ); + deleteTemp(); + die "file name length must be smaller than $fileNameMax. : $_\n"; + } + my $data = pack( "a$fileNameMax", $name ); + syswrite( INFO, $data, $fileNameMax ); + + # 圧縮 + # SDKのcompBLZ.exeは引数バグがあるためローカルに修正版を入れておく + my $compfile = "$_.comp"; + system ("${compprog} $compoption $_ -o $compfile"); + + # パディングの出力 + #syswrite( INFO, pack( "x$padLen") ); + + # 圧縮ファイル長を出力(もともとはpadding) + $data = pack( "L", -s $compfile ); + syswrite( INFO, $data, 4 ); + + # ファイルオフセットの出力 + $data = pack( "L", $offset ); + syswrite( INFO, $data, 4 ); + + # ファイル長の出力 + $data = pack( "L", -s $_ ); + syswrite( INFO, $data, 4 ); + + # ファイルのSHA1ハッシュの出力 + { + my $digest; + #system ("openssl dgst -sha1 -binary -out $digestFile $_"); + system ("openssl dgst -sha1 -binary -out $digestFile $compfile"); # 圧縮後のファイルにハッシュをつける + open DIGEST, $digestFile or die; + binmode DIGEST; + sysread( DIGEST, $digest, $sha1Len ); + close DIGEST; + syswrite( INFO, $digest, $sha1Len ); + } + + printf "%s\t0x%08x\t0x%08x\t0x%08x\n", $_, $offset, -s $_, -s $compfile; + + # オフセット加算 + #$offset += -s $_; + $offset += -s $compfile; + if( ( $offset % 32 ) > 0 ) { $offset += 32 - ( $offset % 32 ); } + } + close INFO; + printf "---------------------------------------------------------------\n"; +} + +# ヘッダの出力 +{ + # timestampLen = 0x08; + # elementNumLen = 0x02; + my $padLen = 0x06; + my $sha1Len = 0x14; + + open HEADER, ">$headerFile" or die; + binmode HEADER; + + # タイムスタンプの出力 +# my $timestamp = strftime "%y%m%d%H", localtime; + my $timestamp = $ARGV[ 0 ]; + printf "timestamp = %s\n", $timestamp; + syswrite( HEADER, pack( "N", unpack( "L", pack( "H8", $timestamp ) ) ) ); + + # 要素数の出力 + syswrite( HEADER, pack( "S", $num ) ); + + # パディングの出力 + syswrite( HEADER, pack( "x$padLen") ); + + # 情報テーブルのSHA1ハッシュの出力 + { + my $digest; + system ("openssl dgst -sha1 -binary -out $digestFile $infoFile"); + open DIGEST, $digestFile or die; + binmode DIGEST; + sysread( DIGEST, $digest, $sha1Len ); + close DIGEST; + syswrite( HEADER, $digest, $sha1Len ); + } + close HEADER; +} + +# 環境変数サーチ +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_PRIVATE_ROOT/s) { + $KEYROOT = $ENV{$_}; + } +} +if (!$KEYROOT) { + deleteTemp(); + die "No TWL_IPL_RED_PRIVATE_ROOT is found.\n"; +} + +# ヘッダへの署名付加 +{ + system ( "openssl dgst -sha1 -binary -out $digestFile $headerFile" ); + system ( "openssl rsautl -sign -in $digestFile -inkey $KEYROOT/keys/rsa/private_sharedFont.der -keyform DER -out $signFile" ); + system ( "cat $signFile $headerFile >$tempFile" ); + system ( "cat $tempFile $infoFile >$outFile" ); + deleteTemp(); +} + + +# フォントの出力 +{ + open FONTTABLE, ">>$outFile" or die; + binmode FONTTABLE; + + { + # パディング出力 + my $fileLen = -s $outFile; + my $padNum = ( $fileLen % 32 ) ? ( 32 - ( $fileLen % 32 ) ) : 0; + my $padding = pack( "x$padNum" ); + syswrite( FONTTABLE, $padding, $padNum ); + } + + foreach ( @files ) { + # NULL指定時はスキップ + if( "NULL" eq basename( $_ ) ) { + next; + } + + # フォント出力 + #my $fileLen = -s $_; + #open TEST, $_ or die; + my $compfile = "$_.comp"; # 圧縮ファイルを出力 + $fileLen = -s $compfile; + open TEST, $compfile or die; + binmode TEST; + sysread ( TEST, $buffer, $fileLen ); + close TEST; + syswrite( FONTTABLE, $buffer, $fileLen ); + + # パディング出力 + my $padNum = ( $fileLen % 32 ) ? ( 32 - ( $fileLen % 32 ) ) : 0; + my $padding = pack( "x$padNum" ); + syswrite( FONTTABLE, $padding, $padNum ); + + # 圧縮ファイルを削除 + system ("rm -rf $compfile"); + } + close FONTTABLE; +} diff --git a/build/tests/compressSharedFontLoad/compSharedFont/makeboot.bat b/build/tests/compressSharedFontLoad/compSharedFont/makeboot.bat new file mode 100644 index 00000000..2ec4818b --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/makeboot.bat @@ -0,0 +1,18 @@ +rem +rem ***** SD起動ファイル作成ツール ***** +rem +rem sdmc_launcher_writer.gcd が起動ファイルとして menu.srl しか受け付けないので +rem 引数として与えたファイルを menu.srl としてコピーする +rem + +if "%1" equ "" ( + echo 失敗しました。 + echo ディレクトリごとドラッグアンドドロップしてください。 + echo: + goto end +) + +set progdir=%~dp0 + +del %progdir%\menu.srl +copy %1 %progdir%\menu.srl diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/@ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/@ new file mode 100644 index 00000000..ae91d2ff --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/@ @@ -0,0 +1 @@ +NINTENDO PRIVATE diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile new file mode 100644 index 00000000..cb219807 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile @@ -0,0 +1,27 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - build - tools - ntrcomp +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = NITRO + +export TWLSDK_PLATFORM = NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +SUBDIRS += gcc + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile.BAK b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile.BAK new file mode 100644 index 00000000..5d41f479 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/Makefile.BAK @@ -0,0 +1,25 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - build - tools - ntrcomp +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +SUBDIRS += gcc + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile new file mode 100644 index 00000000..981c2ad2 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile @@ -0,0 +1,59 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - build - tools - ntrcomp - gcc +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +OBJECTS = ntcompress_main.o ntcompress_test.o nitroCompLib.o multipleCompLib.o rangeCoder.o + +WIN32 ?= 1 + +ifneq ($(WIN32),0) +TARGETS = ntrcomp.exe +CC_X86 := gcc -mno-cygwin +else +TARGETS = ntrcomp +CC_X86 := gcc +endif + +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) + +#INSTALL_DIR = $(NITRO_INSTALL_TOOLSDIR)/bin +#INSTALL_TARGETS = $(TARGETS) + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(OBJECTS) + $(CC_X86) $+ -o $@ + +ntcompress_main.o: ../src/ntcompress_main.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +ntcompress_test.o: ../src/ntcompress_test.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +nitroCompLib.o: ../src/nitroCompLib.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +multipleCompLib.o: ../src/multipleCompLib.c ../src/multipleCompLib.h + $(CC_X86) -c $< -o $@ +rangeCoder.o: ../src/rangeCoder.c ../src/rangeCoder.h + $(CC_X86) -c $< -o $@ + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile.BAK b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile.BAK new file mode 100644 index 00000000..c1cde1a4 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/gcc/Makefile.BAK @@ -0,0 +1,59 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - build - tools - ntrcomp - gcc +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +OBJECTS = ntcompress_main.o ntcompress_test.o nitroCompLib.o multipleCompLib.o rangeCoder.o + +WIN32 ?= 1 + +ifneq ($(WIN32),0) +TARGETS = ntrcomp.exe +CC_X86 := gcc -mno-cygwin +else +TARGETS = ntrcomp +CC_X86 := gcc +endif + +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) + +INSTALL_DIR = $(NITRO_INSTALL_TOOLSDIR)/bin +INSTALL_TARGETS = $(TARGETS) + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(OBJECTS) + $(CC_X86) $+ -o $@ + +ntcompress_main.o: ../src/ntcompress_main.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +ntcompress_test.o: ../src/ntcompress_test.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +nitroCompLib.o: ../src/nitroCompLib.c ../src/nitroCompLib.h + $(CC_X86) -c $< -o $@ +multipleCompLib.o: ../src/multipleCompLib.c ../src/multipleCompLib.h + $(CC_X86) -c $< -o $@ +rangeCoder.o: ../src/rangeCoder.c ../src/rangeCoder.h + $(CC_X86) -c $< -o $@ + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.c b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.c new file mode 100644 index 00000000..fcb44e89 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.c @@ -0,0 +1,2494 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: multipleCompLib.c + + Copyright 2007 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 "multipleCompLib.h" + +#undef _DEBUG +#ifdef _DEBUG + +#endif + +#define LH_CODE_HEADER (0x40) +#define LRC_CODE_HEADER (0x50) + +#define BLEND_COMP_FLAG 1 + +#define LH_ENC_OFFSET_WIDTH /* この設定が有効な場合にはoffset値全体ではなくoffsetのbit長を符号化する */ + +#if !defined(LH_ENC_OFFSET_WIDTH) + #define LH_OFFSET_BITS 12 + #define LH_OFFSET_TABLE_BITS LH_OFFSET_BITS +#else // if defined(LH_ENC_OFFSET_WIDTH) + #define LH_OFFSET_BITS 15 + #define LH_OFFSET_TABLE_BITS 5 +#endif + +#define LENGTH_BITS (8 + BLEND_COMP_FLAG) +#define OFFSET_SIZE_MAX (1 << 15) + +#define REVERSE_SEARCH + +typedef struct +{ + u16 WindowPos; // 現在のスライド辞書の先頭位置 + u16 WindowLen; // 現在のスライド辞書のサイズ + + s16 LZOffsetTable[ OFFSET_SIZE_MAX ]; // オフセットデータのテーブル + #ifdef REVERSE_SEARCH + s16 LZRevOffsetTable[ OFFSET_SIZE_MAX ]; // オフセットデータの逆順テーブル + #endif + s16 LZByteTable[ 256 ]; // データの先頭テーブル + s16 LZEndTable [ 256 ]; // データの終端テーブル + u8 OffsetBits; // オフセットを表現する為のビット数 +} LZCompressInfo; + +static LZCompressInfo gLZWork; + +INLINE u32 +RoundUp( u32 value, u32 base ) +{ + return (value + (base - 1)) & ~(base - 1); +} + +/*---------------------------------------------------------------------------* + Name: LZInitTable + Description: + Arguments: work + Returns: None. + *---------------------------------------------------------------------------*/ +static void +LZInitTable( LZCompressInfo* info ) +{ + u16 i; + + for ( i = 0; i < 256; i++ ) + { + info->LZByteTable[i] = -1; + info->LZEndTable[i] = -1; + } + info->WindowPos = 0; + info->WindowLen = 0; +} + +/*---------------------------------------------------------------------------* + Name: SlideByte + Description: 辞書を1バイトスライド + Arguments: *srcp + work + Returns: None. + *---------------------------------------------------------------------------*/ +static void +SlideByte( LZCompressInfo* info, const u8 *srcp ) +{ + s16 offset; + u8 in_data = *srcp; + u16 insert_offset; + +#if defined( REVERSE_SEARCH ) // 探索順を逆にする(新しいデータを優先) + s16 *const LZByteTable = info->LZEndTable; + s16 *const LZEndTable = info->LZByteTable; + s16 *const LZOffsetTable = info->LZRevOffsetTable; + s16 *const LZRevOffsetTable = info->LZOffsetTable; +#else + s16 *const LZByteTable = info->LZByteTable; + s16 *const LZEndTable = info->LZEndTable; + s16 *const LZOffsetTable = info->LZOffsetTable; +#endif + const u16 windowPos = info->WindowPos; + const u16 windowLen = info->WindowLen; + const u32 OFFSET_SIZE = (1 << info->OffsetBits); + + if ( windowLen == OFFSET_SIZE ) + { + u8 out_data = *(srcp - OFFSET_SIZE); + if ((LZByteTable[out_data] = LZOffsetTable[LZByteTable[out_data]]) == -1) + { + LZEndTable[out_data] = -1; + } + else + { + #if defined( REVERSE_SEARCH ) + LZRevOffsetTable[LZByteTable[out_data]] = -1; + #endif + } + insert_offset = windowPos; + } + else + { + insert_offset = windowLen; + } + + offset = LZEndTable[in_data]; + if (offset == -1) + { + LZByteTable[in_data] = insert_offset; + #if defined( REVERSE_SEARCH ) + LZRevOffsetTable[insert_offset] = -1; + #endif + } + else + { + #if defined( REVERSE_SEARCH ) + LZRevOffsetTable[insert_offset] = offset; + #endif + LZOffsetTable[offset] = insert_offset; + } + LZEndTable[in_data] = insert_offset; + LZOffsetTable[insert_offset] = -1; + + if (windowLen == OFFSET_SIZE) + { + info->WindowPos = (u16)((windowPos + 1) % OFFSET_SIZE); + } + else + { + info->WindowLen++; + } +} + +/*---------------------------------------------------------------------------* + Name: LZSlide + Description: + Arguments: *srcp + n + Returns: None. + *---------------------------------------------------------------------------*/ +static void +LZSlide( LZCompressInfo* info, const u8 *srcp, u32 n ) +{ + u32 i; + + for (i = 0; i < n; i++) + { + SlideByte(info, srcp++); + } +} + +//-------------------------------------------------------- +// LZ77圧縮でスライド窓の中から最長一致列を検索します。 +// Arguments: startp データの開始位置を示すポインタ +// nextp 検索を開始するデータのポインタ +// remainSize 残りデータサイズ +// offset 一致したオフセットを格納する領域へのポインタ +// Return : 一致列が見つかった場合は TRUE +// 見つからなかった場合は FALSE +//-------------------------------------------------------- +static u16 +SearchLZ( const LZCompressInfo* info, const u8 *nextp, u32 remainSize, u16 *offset, u16 minOffset, u32 maxLength ) +{ + const u8 *searchp; + const u8 *headp, *searchHeadp; + u16 currOffset; + u16 currLength = 2; + u16 tmpLength; + s32 w_offset; + const s16 * const LZOffsetTable = info->LZOffsetTable; + const u16 windowPos = info->WindowPos; + const u16 windowLen = info->WindowLen; + + if (remainSize < 3) + { + return 0; + } + + w_offset = info->LZByteTable[ *nextp ]; + + while (w_offset != -1) + { + if (w_offset < windowPos) + { + searchp = nextp - windowPos + w_offset; + } + else + { + searchp = nextp - windowLen - windowPos + w_offset; + } + + /* 無くても良いが、僅かに高速化する */ + if (*(searchp + 1) != *(nextp + 1) || *(searchp + 2) != *(nextp + 2)) + { + w_offset = LZOffsetTable[ w_offset ]; + continue; + } + + if (nextp - searchp < minOffset) + { + // VRAMは2バイトアクセスなので (VRAMからデータを読み出す場合があるため)、 + // 検索対象データは2バイト前からのデータにしなければならない。 + // + // オフセットは12ビットで格納されるため、4096以下 + #if defined( REVERSE_SEARCH ) + w_offset = LZOffsetTable[ w_offset ]; + continue; + #else + break; + #endif + } + tmpLength = 3; + searchHeadp = searchp + 3; + headp = nextp + 3; + + while (((u32)(headp - nextp) < remainSize) && (*headp == *searchHeadp)) + { + headp++; + searchHeadp++; + tmpLength++; + + // データ長は8ビットで格納されるため、258以下 (3の下駄をはかせる) + if (tmpLength == maxLength) + { + break; + } + } + if (tmpLength > currLength) + { + // 最大長オフセットを更新 + currLength = tmpLength; + currOffset = (u16)((u32)nextp - (u32)searchp); + if (currLength == maxLength) + { + // 一致長が最大なので、検索を終了する。 + break; + } + } + w_offset = LZOffsetTable[w_offset]; + } + + if (currLength < 3) + { + return 0; + } + *offset = currOffset; + return currLength; +} + +/*---------------------------------------------------------------------------* + Name: LZCompWrite + + Description: + + Arguments: *srcp + size + *dstp + lzSearchOffset + + Returns: + *---------------------------------------------------------------------------*/ +static u32 +LZCompWrite_( const u8 *srcp, s32 size, u8 *dstp, u8 lzSearchOffset, u8 offsetBits ) +{ + u32 LZDstCount = 0; // 圧縮データのバイト数 + u8 LZCompFlags; // 圧縮の有無を示すフラグ系列 + u8 *LZCompFlagsp; // LZCompFlags を格納するメモリ領域をポイント + u16 lastOffset; // 一致データまでのオフセット (その時点での最長一致データ) + u16 lastLength; // 一致データ長 (その時点での最長一致データ) + u8 i; + const u32 MAX_LENGTH = 0xFF + 3; + + LZInitTable( &gLZWork ); + gLZWork.OffsetBits = offsetBits; + + while ( size > 0 ) + { + LZCompFlags = 0; + LZCompFlagsp = dstp++; // フラグ系列の格納先 + LZDstCount++; + + // フラグ系列が8ビットデータとして格納されるため、8回ループ + for ( i = 0; i < 8; i++ ) + { + LZCompFlags <<= 1; // 初回 (i=0) は特に意味はない + if (size <= 0) + { + // 終端に来た場合はフラグを最後までシフトさせてから終了 + continue; + } + + if ( (lastLength = SearchLZ(&gLZWork, srcp, size, &lastOffset, lzSearchOffset, MAX_LENGTH)) != 0 ) + { + // 圧縮可能な場合はフラグを立てる + LZCompFlags |= 0x1; + + // オフセットは上位4ビットと下位8ビットに分けて格納 + *dstp++ = (u8)(lastLength - 3); + *dstp++ = (u8)((lastOffset - 1) & 0xff); // リトルエンディアン + *dstp++ = (u8)((lastOffset - 1) >> 8); + LZDstCount += 3; + LZSlide( &gLZWork, srcp, lastLength ); + srcp += lastLength; + size -= lastLength; + } + else + { + // 圧縮なし + LZSlide( &gLZWork, srcp, 1 ); + *dstp++ = *srcp++; + size--; + LZDstCount++; + } + } // 8回ループ終了 + *LZCompFlagsp = LZCompFlags; // フラグ系列を格納 + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((LZDstCount + i) & 0x3) + { + *dstp++ = 0; + i++; + } + + return LZDstCount; +} + + +typedef struct +{ + u16 No; // データNo + s16 PaNo; // 親No + u32 Freq; // 出現頻度 + s16 ChNo[2]; // 子No (0: 左側, 1: 右側) + u16 PaDepth; // 親ノードの深さ + u16 LeafDepth; // 葉までの深さ + u32 HuffCode; // ハフマン符号 + u16 Bit; // ノードのビットデータ + u16 HWord; // 各中間節点において、その節点をルートとする部分木を HuffTree 格納に必要なメモリ量 +} +HuffData; + +typedef struct +{ + u8 leftOffsetNeed; // 左の子節点へのオフセットが必要なら1 + u8 rightOffsetNeed; // 右の子節点へのオフセットが必要なら1 + u16 leftNodeNo; // 左の子節点No + u16 rightNodeNo; // 右の子節点No +} +HuffTreeCtrlData; + +// ハフマンワークバッファ構成 +typedef struct +{ + HuffData* huffTable; // huffTable[ 512 ]; 12288B + u16* huffTree; // huffTree[ 256 * 2 ]; 512B + HuffTreeCtrlData* huffTreeCtrl; // huffTreeCtrl[ 256 ]; 1536B + u16 huffTreeTop; // + u8 bitSize; // + u8 padding_[1]; // +} +HuffInfo; // 計 14340B + +static void HuffMakeHuffTree ( HuffInfo* info, u16 rootNo ); +static void HuffMakeSubsetHuffTree ( HuffInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ); +static BOOL HuffRemainingNodeCanSetOffset( HuffInfo* info, u16 costHWord ); +static void HuffSetOneNodeOffset ( HuffInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ); +static u16 HuffMakeNode ( HuffData* table, u8 bitSize ); + +static void HuffAddParentDepthToTable( HuffData *table, u16 leftNo, u16 rightNo ); +static void HuffAddCodeToTable ( HuffData* table, u16 nodeNo, u32 paHuffCode ); +static u16 HuffAddCountHWordToTable ( HuffData *table, u16 nodeNo ); + + +// ビットストリーム +typedef struct +{ + u8* dstp; // 出力先ポインタ + u32 cnt; // 出力サイズ + u32 stream; // カレントストリームデータ + u32 stream_len; // ストリームの長さ +} +BitStream; + +static void +BitStream_Init( BitStream* context, u8* dstp ) +{ + context->dstp = dstp; + context->cnt = 0; + context->stream = 0; + context->stream_len = 0; +} + +static void +BitStream_Write( BitStream* context, u32 data, u32 width ) +{ + u32 i; + u32 stream = context->stream; + u32 cnt = context->cnt; + u32 stream_len = context->stream_len; + u32 mask = (1 << width) - 1; + + if ( width == 0 ) + { + return; + } + + stream = (stream << width) | ( data & mask ); + stream_len += width; + + for ( i = 0; i < stream_len / 8; i++ ) + { + context->dstp[ cnt++ ] = (u8)( stream >> ( stream_len - ( i + 1 ) * 8 ) ); + } + stream_len %= 8; + + context->stream = stream; + context->cnt = cnt; + context->stream_len = stream_len; +} + +static void +BitStream_Terminate( BitStream* context, u32 align ) +{ + u32 stream = context->stream; + u32 cnt = context->cnt; + u32 stream_len = context->stream_len; + + if ( stream_len > 0 ) + { + stream <<= 8 - stream_len; + + if ( context->stream_len != 0 ) + { + context->dstp[ cnt++ ] = (u8)( stream ); + } + } + + while ( cnt % align ) + { + context->dstp[ cnt++ ] = 0; + } + context->cnt = cnt; + context->stream_len = 0; +} + + + + +/*---------------------------------------------------------------------------* + Name: HuffInitTable + Description: + Arguments: info + bitSize + Returns: None. + *---------------------------------------------------------------------------*/ +static void +HuffInitTable( HuffInfo* info, u8 bitSize ) +{ + u32 tableSize = (1 << bitSize); + u32 i; + + info->huffTable = (HuffData*)malloc( sizeof(HuffData) * tableSize * 2 ); + info->huffTree = (u16*)malloc( sizeof(u16) * tableSize * 2 ); + info->huffTreeCtrl = (HuffTreeCtrlData*)malloc( sizeof(HuffTreeCtrlData) * tableSize ); + + info->huffTreeTop = 1; + info->bitSize = bitSize; + + // huffTableを初期化 + { + HuffData* table = info->huffTable; + const HuffData HUFF_TABLE_INIT_DATA = { 0, 0, 0, {-1, -1}, 0, 0, 0, 0, 0 }; + for ( i = 0; i < tableSize * 2; i++ ) + { + table[ i ] = HUFF_TABLE_INIT_DATA; + table[ i ].No = (u16)i; + } + } + + // huffTree, huffTreeCtrlを初期化 + { + const HuffTreeCtrlData HUFF_TREE_CTRL_INIT_DATA = { 1, 1, 0, 0 }; + u16* huffTree = info->huffTree; + HuffTreeCtrlData* huffTreeCtrl = info->huffTreeCtrl; + + for ( i = 0; i < tableSize; i++ ) + { + huffTree[ i * 2 ] = 0; + huffTree[ i * 2 + 1 ] = 0; + huffTreeCtrl[ i ] = HUFF_TREE_CTRL_INIT_DATA; + } + } +} + + +/*---------------------------------------------------------------------------* + Name: LZCountHuffData + Description: + Arguments: srcp + srcSize + info8 + info16 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +LZCountHuffData( const u8* srcp, u32 srcSize, HuffInfo* info8, HuffInfo* info16 ) +{ + u32 srcCnt = 0; + u32 i; + + while ( srcCnt < srcSize ) + { + u8 compFlags = srcp[ srcCnt++ ]; // 圧縮の有無を示すフラグ列 + for ( i = 0; i < 8; i++ ) + { + if ( compFlags & 0x80 ) // 圧縮されている、length:8, offset:16 + { + u8 length = srcp[ srcCnt++ ]; + u16 offset = srcp[ srcCnt++ ]; // リトルエンディアン + offset |= (srcp[ srcCnt++ ] << 8); + + #if BLEND_COMP_FLAG + info8->huffTable[ length | 0x100 ].Freq++; + #else + info8->huffTable[ length ].Freq++; + #endif + #if !defined(LH_ENC_OFFSET_WIDTH) + info16->huffTable[ offset ].Freq++; + #else + { + u32 offset_bit = 0; + while ( offset != 0 ) + { + ++offset_bit; + offset >>= 1; + } + info16->huffTable[ offset_bit ].Freq++; + } + #endif + } + else + { + u8 data = srcp[ srcCnt++ ]; + info8->huffTable[ data ].Freq++; + } + compFlags <<= 1; + if ( srcCnt >= srcSize ) + { + break; + } + } + } +} + + +/*---------------------------------------------------------------------------* + Name: ConstructHuffTree + Description: + Arguments: info + bitSize + Returns: None. + *---------------------------------------------------------------------------*/ +static void +ConstructHuffTree( HuffInfo* info, u8 bitSize ) +{ + HuffData* table = info->huffTable; + u16 rootNo; + + // 出現頻度からノードを構築 + rootNo = HuffMakeNode( table, bitSize ); + + // ハフマンコード生成 (table[i].HuffCode に) + HuffAddCodeToTable( table, rootNo, 0x00 ); // PaDepthのビット数だけ、HuffCode の下位ビットをマスクしたものがハフマンコード + + // 各中間節点において、その節点をルートとする部分木を huffTree 格納に必要なメモリ量の計算 + HuffAddCountHWordToTable( table, rootNo ); + + HuffMakeHuffTree( info, rootNo ); + info->huffTreeTop--; +} + +//----------------------------------------------------------------------- +// ハフマンコード表作成 +//----------------------------------------------------------------------- +static void +HuffMakeHuffTree( HuffInfo* info, u16 rootNo ) +{ + s16 i; + s16 costHWord, tmpCostHWord; // 部分木のコード表を作成しなかった時のコスト 最大値の節点の部分木コード表を作る + s16 costOffsetNeed, tmpCostOffsetNeed; + s16 costMaxKey; // コスト最小の節点を huffTreeBuf.huffTree から特定するための情報 + BOOL costMaxRightFlag; + u16 offsetNeedNum; + BOOL tmpRightFlag; + const u32 MAX_COST = 1 << (info->bitSize - 2); + + info->huffTreeTop = 1; + costOffsetNeed = 0; + + info->huffTreeCtrl[0].leftOffsetNeed = 0; // 使用しない (テーブルサイズとして使用) + info->huffTreeCtrl[0].rightNodeNo = rootNo; + + while ( 1 ) // return するまで + { + // オフセットを設定する必要のあるノード数の計算 + offsetNeedNum = 0; + for ( i = 0; i < info->huffTreeTop; i++ ) + { + if ( info->huffTreeCtrl[ i ].leftOffsetNeed ) + { + offsetNeedNum++; + } + if ( info->huffTreeCtrl[ i ].rightOffsetNeed ) + { + offsetNeedNum++; + } + } + + // 最大コストの節点を検索 + costHWord = -1; + costMaxKey = -1; + tmpRightFlag = 0; + + for ( i = 0; i < info->huffTreeTop; i++ ) + { + tmpCostOffsetNeed = (u16)( info->huffTreeTop - i ); + + // 左の子節点のコスト評価 + if ( info->huffTreeCtrl[i].leftOffsetNeed ) + { + tmpCostHWord = (s16)info->huffTable[ info->huffTreeCtrl[i].leftNodeNo ].HWord; + + if ( (u32)(tmpCostHWord + offsetNeedNum) > MAX_COST ) + { + goto leftCostEvaluationEnd; + } + if ( ! HuffRemainingNodeCanSetOffset( info, (u16)tmpCostHWord ) ) + { + goto leftCostEvaluationEnd; + } + if ( tmpCostHWord > costHWord ) + { + costMaxKey = i; + costMaxRightFlag = 0; + } + else if ( (tmpCostHWord == costHWord) && (tmpCostOffsetNeed > costOffsetNeed) ) + { + costMaxKey = i; + costMaxRightFlag = 0; + } + } +leftCostEvaluationEnd:{} + + if ( info->huffTreeCtrl[i].rightOffsetNeed ) + { + tmpCostHWord = (s16)info->huffTable[ info->huffTreeCtrl[i].rightNodeNo ].HWord; + + if ( (u32)(tmpCostHWord + offsetNeedNum) > MAX_COST ) + { + goto rightCostEvaluationEnd; + } + if ( ! HuffRemainingNodeCanSetOffset( info, (u16)tmpCostHWord ) ) + { + goto rightCostEvaluationEnd; + } + if ( tmpCostHWord > costHWord ) + { + costMaxKey = i; + costMaxRightFlag = 1; + } + else if ( (tmpCostHWord == costHWord) && (tmpCostOffsetNeed > costOffsetNeed) ) + { + costMaxKey = i; + costMaxRightFlag = 1; + } + } +rightCostEvaluationEnd:{} + } + + // 部分木をまるまる huffTree に格納 + if ( costMaxKey >= 0 ) + { + HuffMakeSubsetHuffTree( info, (u16)costMaxKey, costMaxRightFlag); + goto nextTreeMaking; + } + else + { + // 必要オフセット最大のノードを検索 + for ( i = 0; i < info->huffTreeTop; i++ ) + { + u16 tmp = 0; + tmpRightFlag = 0; + if ( info->huffTreeCtrl[i].leftOffsetNeed ) + { + tmp = info->huffTable[ info->huffTreeCtrl[i].leftNodeNo ].HWord; + } + if ( info->huffTreeCtrl[i].rightOffsetNeed ) + { + if ( info->huffTable[ info->huffTreeCtrl[i].rightNodeNo ].HWord > tmp ) + { + tmpRightFlag = 1; + } + } + if ( (tmp != 0) || (tmpRightFlag) ) + { + HuffSetOneNodeOffset( info, (u16)i, tmpRightFlag ); + goto nextTreeMaking; + } + } + } + return; +nextTreeMaking:{} + } +} + +//----------------------------------------------------------------------- +// 部分木をまるまる huffTree に格納 +//----------------------------------------------------------------------- +static void +HuffMakeSubsetHuffTree( HuffInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ) +{ + u16 i; + + i = info->huffTreeTop; + HuffSetOneNodeOffset( info, huffTreeNo, rightNodeFlag ); + + if ( rightNodeFlag ) + { + info->huffTreeCtrl[ huffTreeNo ].rightOffsetNeed = 0; + } + else + { + info->huffTreeCtrl[ huffTreeNo ].leftOffsetNeed = 0; + } + + while ( i < info->huffTreeTop ) + { + if ( info->huffTreeCtrl[ i ].leftOffsetNeed ) + { + HuffSetOneNodeOffset( info, i, 0 ); + info->huffTreeCtrl[ i ].leftOffsetNeed = 0; + } + if ( info->huffTreeCtrl[ i ].rightOffsetNeed ) + { + HuffSetOneNodeOffset( info, i, 1 ); + info->huffTreeCtrl[ i ].rightOffsetNeed = 0; + } + i++; + } +} + +//----------------------------------------------------------------------- +// 与えられたデータ量の部分木を展開しても huffTree 構築に支障がないか調べる +//----------------------------------------------------------------------- +static BOOL +HuffRemainingNodeCanSetOffset( HuffInfo* info, u16 costHWord ) +{ + u16 i; + s16 capacity; + const u32 MAX_COST = 1 << (info->bitSize - 2); + + capacity = (s16)( MAX_COST - costHWord ); + + // オフセット数は i が小さいほど大きいので、ソートせず、i = 0 -> huffTreeTop で計算すればよい + for ( i = 0; i < info->huffTreeTop; i++ ) + { + if ( info->huffTreeCtrl[i].leftOffsetNeed ) + { + if ( (info->huffTreeTop - i) <= capacity ) + { + capacity--; + } + else + { + return 0; + } + } + if ( info->huffTreeCtrl[i].rightOffsetNeed ) + { + if ( (info->huffTreeTop - i) <= capacity ) + { + capacity--; + } + else + { + return 0; + } + } + } + + return 1; +} + + +/*---------------------------------------------------------------------------* + Name: HuffSetOneNodeOffset + Description: 1節点分、ハフマンコード表を作成 + Arguments: *table ハフマンテーブル + huffTreeNo + rightNodeFlag 右側のノードであるかどうかのフラグ + Returns: None. + *---------------------------------------------------------------------------*/ +static void +HuffSetOneNodeOffset( HuffInfo* info, u16 huffTreeNo, BOOL rightNodeFlag) +{ + u16 nodeNo; + u16 offsetData = 0; + + HuffData* huffTable = info->huffTable; + u16* huffTree = info->huffTree; + HuffTreeCtrlData* huffTreeCtrl = info->huffTreeCtrl; + u16 huffTreeTop = info->huffTreeTop; + + if (rightNodeFlag) + { + nodeNo = huffTreeCtrl[ huffTreeNo ].rightNodeNo; + huffTreeCtrl[ huffTreeNo ].rightOffsetNeed = 0; + } + else + { + nodeNo = huffTreeCtrl[ huffTreeNo ].leftNodeNo; + huffTreeCtrl [huffTreeNo ].leftOffsetNeed = 0; + } + + // 左の子節点 + if ( huffTable[ huffTable[nodeNo].ChNo[0] ].LeafDepth == 0) + { + offsetData |= 0x8000; + huffTree[ huffTreeTop * 2 + 0 ] = (u16)huffTable[ nodeNo ].ChNo[0]; + huffTreeCtrl[ huffTreeTop ].leftNodeNo = (u16)huffTable[ nodeNo ].ChNo[0]; + huffTreeCtrl[ huffTreeTop ].leftOffsetNeed = 0; // オフセットは必要なくなる + } + else + { + huffTreeCtrl[ huffTreeTop ].leftNodeNo = (u16)huffTable[ nodeNo ].ChNo[0]; // オフセットは必要 + } + + // 右の子節点 + if ( huffTable[ huffTable[ nodeNo ].ChNo[1] ].LeafDepth == 0 ) + { + offsetData |= 0x4000; + huffTree[ huffTreeTop * 2 + 1 ] = (u16)huffTable[nodeNo].ChNo[1]; + huffTreeCtrl[ huffTreeTop ].rightNodeNo = (u16)huffTable[ nodeNo ].ChNo[1]; + huffTreeCtrl[ huffTreeTop ].rightOffsetNeed = 0; // オフセットは必要なくなる + } + else + { + huffTreeCtrl[ huffTreeTop ].rightNodeNo = (u16)huffTable[ nodeNo ].ChNo[1]; // オフセットは必要 + } + + offsetData |= (u16)( huffTreeTop - huffTreeNo - 1 ); + huffTree[ huffTreeNo * 2 + (rightNodeFlag? 1 : 0) ] = offsetData; + + info->huffTreeTop++; +} + +/*---------------------------------------------------------------------------* + Name: HuffMakeNode + Description: 出現頻度からノードデータを構築 + Arguments: table + Returns: None. + *---------------------------------------------------------------------------*/ +static u16 +HuffMakeNode( HuffData* table, u8 bitSize ) +{ + u16 dataNum = ( 1 << bitSize ); + u16 tableTop = (u16)dataNum; // テーブル作成時の、テーブルトップNo + + u32 i; + s32 leftNo, rightNo; // 2分木作成時のノードNo + u16 rootNo; // 二分木のルートNo + + leftNo = -1; + rightNo = -1; + while ( 1 ) + { + // Freqの小さい部分木頂点を2つ探す 1つは必ず見つかるはず + // 子頂点(左)の探索 + for ( i = 0; i < tableTop; i++ ) + { + if ( ( table[i].Freq == 0 ) || + ( table[i].PaNo != 0 ) ) + { + continue; + } + + if ( leftNo < 0 ) + { + leftNo = i; + } + else if ( table[i].Freq < table[ leftNo ].Freq ) + { + leftNo = i; + } + } + + // 子頂点(右)の探索 + for ( i = 0; i < tableTop; i++ ) + { + if ( ( table[i].Freq == 0 ) || + ( table[i].PaNo != 0 ) || + ( i == leftNo ) ) + { + continue; + } + + if ( rightNo < 0 ) + { + rightNo = i; + } + else if ( table[i].Freq < table[ rightNo ].Freq ) + { + rightNo = i; + } + } + + // 1つしかなかったら、テーブル作成終了 + if ( rightNo < 0 ) + { + // 値が一種類しかない存在しない場合には01どちらも同じ値となるノードを1つ作成する + if ( tableTop == dataNum ) + { + table[ tableTop ].Freq = table[ leftNo ].Freq; + table[ tableTop ].ChNo[0] = (s16)leftNo; + table[ tableTop ].ChNo[1] = (s16)leftNo; + table[ tableTop ].LeafDepth = 1; + table[ leftNo ].PaNo = (s16)tableTop; + table[ leftNo ].Bit = 0; + table[ leftNo ].PaDepth = 1; + } + else + { + tableTop--; + } + rootNo = tableTop; + return rootNo; + } + + // 左部分木と右部分木を統合する頂点作成 + table[ tableTop ].Freq = table[ leftNo ].Freq + table[ rightNo ].Freq; + table[ tableTop ].ChNo[0] = (s16)leftNo; + table[ tableTop ].ChNo[1] = (s16)rightNo; + if ( table[ leftNo ].LeafDepth > table[ rightNo ].LeafDepth ) + { + table[ tableTop ].LeafDepth = (u16)( table[ leftNo ].LeafDepth + 1 ); + } + else + { + table[ tableTop ].LeafDepth = (u16)( table[ rightNo ].LeafDepth + 1 ); + } + + table[ leftNo ].PaNo = table[ rightNo ].PaNo = (s16)( tableTop ); + table[ leftNo ].Bit = 0; + table[ rightNo ].Bit = 1; + + HuffAddParentDepthToTable( table, (u16)leftNo, (u16)rightNo ); + + tableTop++; + leftNo = rightNo = -1; + } +} + + +//----------------------------------------------------------------------- +// 2文木作成時に、部分木を統合したときに、部分木の各構成ノードの深さを+1する +//----------------------------------------------------------------------- +static void +HuffAddParentDepthToTable( HuffData *table, u16 leftNo, u16 rightNo ) +{ + table[ leftNo ].PaDepth++; + table[ rightNo ].PaDepth++; + + if ( table[ leftNo ].LeafDepth != 0 ) + { + HuffAddParentDepthToTable( table, (u16)table[ leftNo ].ChNo[0], (u16)table[ leftNo ].ChNo[1] ); + } + if ( table[ rightNo ].LeafDepth != 0 ) + { + HuffAddParentDepthToTable( table, (u16)table[ rightNo ].ChNo[0], (u16)table[ rightNo ].ChNo[1] ); + } +} + +//----------------------------------------------------------------------- +// ハフマンコード生成 +//----------------------------------------------------------------------- +static void +HuffAddCodeToTable( HuffData* table, u16 nodeNo, u32 paHuffCode ) +{ + table[ nodeNo ].HuffCode = (paHuffCode << 1) | table[ nodeNo ].Bit; + + if ( table[ nodeNo ].LeafDepth != 0 ) + { + HuffAddCodeToTable( table, (u16)table[ nodeNo ].ChNo[0], table[ nodeNo ].HuffCode ); + HuffAddCodeToTable( table, (u16)table[ nodeNo ].ChNo[1], table[ nodeNo ].HuffCode ); + } +} + + +//----------------------------------------------------------------------- +// 中間ノードが huffTree 作成に必要とするデータ量 +//----------------------------------------------------------------------- +static u16 +HuffAddCountHWordToTable( HuffData *table, u16 nodeNo) +{ + u16 leftHWord, rightHWord; + + switch ( table[ nodeNo ].LeafDepth ) + { + case 0: + return 0; + case 1: + leftHWord = rightHWord = 0; + break; + default: + leftHWord = HuffAddCountHWordToTable( table, (u16)table[nodeNo].ChNo[0] ); + rightHWord = HuffAddCountHWordToTable( table, (u16)table[nodeNo].ChNo[1] ); + break; + } + + table[ nodeNo ].HWord = (u16)( leftHWord + rightHWord + 1 ); + return (u16)( leftHWord + rightHWord + 1 ); +} + + + +/*---------------------------------------------------------------------------* + Name: LZMakeHuffTree + Description: + Arguments: srcp + tree8 + tree16 + Returns: None. + *---------------------------------------------------------------------------*/ +static void +LZMakeHuffTree( const u8* srcp, u32 srcSize, HuffInfo* info8, HuffInfo* info16 ) +{ + HuffInitTable( info8, LENGTH_BITS ); + HuffInitTable( info16, LH_OFFSET_TABLE_BITS ); + + LZCountHuffData( srcp, srcSize, info8, info16 ); + + ConstructHuffTree( info8, LENGTH_BITS ); + ConstructHuffTree( info16, LH_OFFSET_TABLE_BITS ); +} + + +/*---------------------------------------------------------------------------* + Name: ExportHuffTree + Description: + Arguments: dstp + info + bitSize + Returns: + *---------------------------------------------------------------------------*/ +static u32 +ExportHuffTree( u8* dstp, HuffInfo* info, u8 bitSize ) +{ + BitStream stream; + u32 i; + u8* pSize; + u32 tblSize; + + BitStream_Init( &stream, dstp ); + + pSize = dstp; + BitStream_Write( &stream, 0, RoundUp( bitSize, 8 ) ); + + for ( i = 1; i < (u16)( (info->huffTreeTop + 1) * 2); i++ ) + { + u16 flags = (u16)( info->huffTree[ i ] & 0xC000 ); + u32 data = info->huffTree[ i ] | (flags >> (16 - bitSize)); + BitStream_Write( &stream, data, bitSize ); + } + BitStream_Terminate( &stream, 4 ); + + // テーブルサイズの1/4をサイズ領域へ保存 + tblSize = (stream.cnt / 4) - 1; + if ( RoundUp( bitSize, 8 ) == 8 ) + { + if ( tblSize >= 0x100 ) + { + fprintf(stderr, "table size is over!\n"); + } + *pSize = (u8)( tblSize ); + } + else // RoundUp( bitSize, 8 ) == 16 ) + { + if ( tblSize >= 0x10000 ) + { + fprintf(stderr, "table size is over!\n"); + } + *(u16*)pSize = (u16)( tblSize ); + } + return stream.cnt; +} + + +/*---------------------------------------------------------------------------* + Name: ConvertHuff + Description: + Arguments: info + data + stream + Returns: None. + *---------------------------------------------------------------------------*/ +static void +ConvertHuff( HuffInfo* info, u16 data, BitStream* stream ) +{ + u16 width = info->huffTable[ data ].PaDepth; + u32 code = info->huffTable[ data ].HuffCode; + + BitStream_Write( stream, code, width ); +} + + +/*---------------------------------------------------------------------------* + Name: LZConvertHuffData + Description: + Arguments: srcp + tmpSize + dstp + info8 + info16 + Returns: + *---------------------------------------------------------------------------*/ +static u32 +LZConvertHuffData( const u8* srcp, u32 srcSize, u8* dstp, HuffInfo* info8, HuffInfo* info16 ) +{ + u32 srcCnt = 0; + u32 dstCnt = 0; + + BitStream stream; + + BitStream_Init( &stream, dstp ); + + while ( srcCnt < srcSize ) + { + u32 i; + u8 compFlags = srcp[ srcCnt++ ]; // 圧縮の有無を示すフラグ列 + #if BLEND_COMP_FLAG + #else + BitStream_Write( &stream, compFlags, 8 ); + #endif + + for ( i = 0; i < 8; i++ ) + { + if ( compFlags & 0x80 ) // 圧縮されている、length:8, offset:16 + { + u8 length = srcp[ srcCnt++ ]; + u16 offset = srcp[ srcCnt++ ]; // リトルエンディアン + offset |= srcp[ srcCnt++ ] << 8; + + #if BLEND_COMP_FLAG + ConvertHuff( info8, length | 0x100, &stream ); + #else + ConvertHuff( info8, length, &stream ); + #endif + #if ! defined(LH_ENC_OFFSET_WIDTH) + ConvertHuff( info16, offset, &stream ); + #else + { + u16 offset_bit = 0; + u16 offset_tmp = offset; + while ( offset_tmp > 0 ) + { + offset_tmp >>= 1; + ++offset_bit; + } + ConvertHuff( info16, offset_bit, &stream ); + // offsetが0であることはないので、最上位のビットは省略する + BitStream_Write( &stream, offset & ~(1 << (offset_bit - 1)), offset_bit - 1 ); + } + #endif + } + else + { + u8 data = srcp[ srcCnt++ ]; + + ConvertHuff( info8, data, &stream ); + } + compFlags <<= 1; + if ( srcCnt >= srcSize ) + { + break; + } + } + } + + BitStream_Terminate( &stream, 4 ); + return stream.cnt; +} + +/*---------------------------------------------------------------------------* + Name: LHCompWrite + Description: + Arguments: *srcp + size + *dstp + Returns: + *---------------------------------------------------------------------------*/ +u32 +LHCompWrite( const u8 *srcp, s32 srcSize, u8 *dstp ) +{ + static HuffInfo sTree8; + static HuffInfo sTree16; + + u32 tmpSize; + u32 dstSize; + u8* tmpBuf = (u8*)malloc( srcSize * 3 ); + // まずはsrcpを普通にLZ圧縮 + tmpSize = LZCompWrite_( srcp, srcSize, tmpBuf, 2, LH_OFFSET_BITS ); + + // offsetとlengthの集計 + LZMakeHuffTree( tmpBuf, tmpSize, &sTree8, &sTree16 ); + + dstSize = 0; + + // ヘッダの書き込み + if ( srcSize < 0x1000000 && srcSize > 0 ) + { + *(u32*)dstp = LH_CODE_HEADER | ( srcSize << 8 ); + dstSize = 4; + } + else + { + *(u32*)dstp = LH_CODE_HEADER; + *(u32*)&dstp[4] = srcSize; + dstSize = 8; + } + // ハフマンテーブルを出力 + dstSize += ExportHuffTree( &dstp[ dstSize ], &sTree8, LENGTH_BITS ); + dstSize += ExportHuffTree( &dstp[ dstSize ], &sTree16, LH_OFFSET_TABLE_BITS ); + + // 圧縮結果をハフマン符号化しながら出力 + dstSize += LZConvertHuffData( tmpBuf, tmpSize, &dstp[ dstSize ], &sTree8, &sTree16 ); + + return dstSize; +} + + + +typedef struct +{ + u16 huffTable9 [ (1 << LENGTH_BITS) * 2 ]; + u16 huffTable12[ OFFSET_SIZE_MAX * 2 ]; +} +LHContext; + + +/*---------------------------------------------------------------------------* + Name: HuffImportTree + Description: + Arguments: pTable + srcp + bitSize + srcRemainSize + Returns: + *---------------------------------------------------------------------------*/ +static u32 +HuffImportTree( u16* pTable, const u8* srcp, u8 bitSize, u32 srcRemainSize ) +{ + u32 tableSize; + u32 idx = 1; + u32 data = 0; + u32 bitNum = 0; + u32 bitMask = (1 << bitSize) - 1; + u32 srcCnt = 0; + + if ( bitSize > 8 ) + { + tableSize = *(u16*)srcp; + srcp += 2; + srcCnt += 2; + } + else + { + tableSize = *srcp; + srcp += 1; + srcCnt += 1; + } + tableSize = (tableSize + 1) * 4; + if ( srcRemainSize < tableSize ) + { + return tableSize; + } + + while ( srcCnt < tableSize ) + { + while ( bitNum < bitSize ) + { + data <<= 8; + data |= *srcp++; + ++srcCnt; + bitNum += 8; + } + if ( idx < (u32)((1 << bitSize) * 2) ) + { + pTable[ idx++ ] = (u16)( ( data >> (bitNum - bitSize) ) & bitMask ); + } + bitNum -= bitSize; + } + + pTable[ 0 ] = (u16)idx; + return tableSize; +} + + +/*---------------------------------------------------------------------------* + Name: HuffVerifyTable + + Description: ハフマンテーブルの整合性をチェック + + Arguments: pTable ハフマンテーブルへのポインタ + bit ハフマン符号のビット数 + + Returns: 正常なテーブルの場合には TRUE + 不正なテーブルの場合には FALSE + *---------------------------------------------------------------------------*/ +static BOOL +HuffVerifyTable( const void* pTable, u8 bit ) +{ +#if !defined(LH_ENC_OFFSET_WIDTH) + enum { FLAGS_ARRAY_NUM = 8192 / 8 }; /* 1024Byte */ + static u8 end_flags[ FLAGS_ARRAY_NUM ]; +#else + enum { FLAGS_ARRAY_NUM = 1024 / 8 }; /* 128Byte */ + u8 end_flags[ FLAGS_ARRAY_NUM ]; +#endif + u16* treep = (u16*)pTable; + u16* treeStartp = treep + 1; + u32 treeSize = *treep; + u16* treeEndp = (u16*)pTable + treeSize; + u32 i; + u32 idx; + const u16 ofs_mask = (u16)( (1 << (bit - 2)) - 1 ); + const u16 l_mask = (u16)( 1 << (bit - 1) ); + const u16 r_mask = (u16)( 1 << (bit - 2) ); + + for ( i = 0; i < FLAGS_ARRAY_NUM; i++ ) + { + end_flags[ i ] = 0; + } + + if ( treeSize > (1U << (bit + 1)) ) + { + return FALSE; + } + + idx = 1; + treep = treeStartp; + while ( treep < treeEndp ) + { + if ( (end_flags[ idx / 8 ] & (1 << (idx % 8) )) == 0 ) + { + u32 offset = (u32)( ( (*treep & ofs_mask) + 1 ) << 1 ); + u16* nodep = (u16*)((u32)treep & ~0x3) + offset; + + // 終端のアライメント用データは読み飛ばす + if ( *treep == 0 && idx >= treeSize - 4 ) + { + goto next; + } + if ( nodep >= treeEndp ) + { + return FALSE; + } + if ( *treep & l_mask ) + { + u32 left = (idx & ~0x1) + offset; + end_flags[ left / 8 ] |= (u8)( 1 << (left % 8) ); + } + if ( *treep & r_mask ) + { + u32 right = (idx & ~0x1) + offset + 1; + end_flags[ right / 8 ] |= (u8)( 1 << (right % 8) ); + } + } + next: + ++idx; + ++treep; + } + return TRUE; +} + + +typedef struct +{ + const u8* srcp; + u32 cnt; + u32 srcSize; + u32 stream; + u32 stream_len; +} +BitReader; + +static INLINE void +BitReader_Init( BitReader* context, const u8* srcp, u32 srcSize ) +{ + context->srcp = srcp; + context->cnt = 0; + context->stream = 0; + context->stream_len = 0; + context->srcSize = srcSize; +} + +static INLINE s8 +BitReader_Read( BitReader* context ) +{ + s8 bit; + if ( context->stream_len == 0 ) + { + if ( context->cnt > context->srcSize ) + { + return -1; + } + context->stream = context->srcp[context->cnt++]; + context->stream_len = 8; + } + bit = (s8)( (context->stream >> (context->stream_len - 1)) & 0x1 ); + context->stream_len--; + return bit; +} + +static s32 +BitReader_ReadEx( BitReader* context, u8 width ) +{ + s32 data; + + ASSERT( width <= 24 ); + + if ( width == 0 ) + { + return 0; + } + + while ( context->stream_len < width ) + { + if ( context->cnt > context->srcSize ) + { + return -1; + } + context->stream <<= 8; + context->stream |= context->srcp[context->cnt++]; + context->stream_len += 8; + } + data = (s32)( (context->stream >> (context->stream_len - width)) & ((1 << width) - 1) ); + context->stream_len -= width; + return data; +} + + +/*---------------------------------------------------------------------------* + Name: LHCompRead + Description: + Arguments: srcp + size + *dstp + Returns: + *---------------------------------------------------------------------------*/ +s32 +LHCompRead( const u8* srcp, u32 srcSize, u8* dstp ) +{ + static LHContext sContext; + u32 dstSize; + u32 srcCnt = 0; + u32 dstCnt = 0; + BitReader stream; + + if ( srcSize < 4 ) + { + return -1; + } + + // ヘッダの読み込み + dstSize = *(u32*)srcp >> 8; + srcCnt = 4; + if ( dstSize == 0 ) + { + if ( srcSize < 8 ) + { + return -1; + } + dstSize = *(u32*)(srcp + 4); + srcCnt += 4; + } + + // ハフマンテーブルを読む + srcCnt += HuffImportTree( sContext.huffTable9, &srcp[srcCnt], LENGTH_BITS, srcSize - srcCnt ); + if ( srcCnt >= srcSize || (!HuffVerifyTable( sContext.huffTable9, LENGTH_BITS )) ) + { + return -1; + } + + srcCnt += HuffImportTree( sContext.huffTable12, &srcp[srcCnt], LH_OFFSET_TABLE_BITS, srcSize - srcCnt ); + + if ( srcCnt >= srcSize || (!HuffVerifyTable( sContext.huffTable12, LH_OFFSET_TABLE_BITS )) ) + { + return -1; + } + + BitReader_Init( &stream, &srcp[srcCnt], srcSize - srcCnt ); + + while ( dstCnt < dstSize ) + { + u16* nodep = sContext.huffTable9 + 1; + u16 val; + do + { + s8 bit = BitReader_Read( &stream ); + u32 offset = (((*nodep & 0x7F) + 1) << 1) + bit; + + if ( bit < 0 ) + { + return -1; + } + + if ( *nodep & (0x100 >> bit) ) + { + nodep = (u16*)((u32)nodep & ~0x3); + val = *(nodep + offset); + break; + } + else + { + nodep = (u16*)((u32)nodep & ~0x3); + nodep += offset; + } + } while ( 1 ); + + if ( val < 0x100 ) + // 非圧縮データ + { + dstp[dstCnt++] = (u8)val; + } + else + // 圧縮データ + { + #if !defined(LH_ENC_OFFSET_WIDTH) + #define OFFSET_MASK 0x3FF + #define LEAF_FLAG 0x800 + #else + #define OFFSET_MASK 0x07 + #define LEAF_FLAG 0x10 + u16 offset_bit; + #endif + u16 length = (val & 0xFF) + 3; + u16* nodep = sContext.huffTable12 + 1; + do + { + s8 bit = BitReader_Read( &stream ); + u32 offset = (((*nodep & OFFSET_MASK) + 1) << 1) + bit; + + if ( bit < 0 ) + { + return -1; + } + + if ( *nodep & (LEAF_FLAG >> bit) ) + { + nodep = (u16*)((u32)nodep & ~0x3); + val = *(nodep + offset); + break; + } + else + { + nodep = (u16*)((u32)nodep & ~0x3); + nodep += offset; + } + } while ( 1 ); + + #if defined(LH_ENC_OFFSET_WIDTH) + offset_bit = val; + val = 0; + if ( offset_bit > 0 ) + { + val = 1; + while ( --offset_bit > 0 ) + { + val <<= 1; + val |= BitReader_Read( &stream ); + } + } + #endif + val += 1; + + // バッファオーバーランをチェック + if ( dstCnt + length > dstSize ) + { + return -1; + } + if ( dstCnt < val ) + { + return -1; + } + if ( srcCnt + stream.cnt > srcSize ) + { + return -1; + } + + while ( length-- > 0 ) + { + dstp[dstCnt] = dstp[dstCnt - val]; + ++dstCnt; + } + #undef OFFSET_MASK + #undef LEAF_FLAG + } + } + return dstCnt; + + +} + + +//============================================================================== +// +// LRC圧縮/展開 +// +//============================================================================== + +#define LRC_ADAPTIVE // 適応型レンジコーダを使用するかどうか +#define RC_MAX_RANGE 0x80000000 +#define RC_UNIT_BITS 8 // 1バイト単位で出力 +// #define LRC_ENC_OFFSET_WIDTH // NOTE: このオプションでは正常に動作できない。 + // 正確には、展開時に生のbitデータがレンジコードとして先に + // 読まれてしまうので、復元後には次のデータが取り出せない。 + +#if defined( LRC_ADAPTIVE ) + #define TABLE8_ADAPTIVE TRUE +#else + #define TABLE8_ADAPTIVE FALSE +#endif + +#if defined( LRC_ENC_OFFSET_WIDTH ) + #define TABLE16_ADAPTIVE FALSE // bitLenを使用する場合には、境界テーブルが小さいのでofsは静的RCでOK + #define LRC_OFFSET_BITS 15 + #define LRC_OFFSET_TABLE_BITS 5 +#else + #define TABLE16_ADAPTIVE TRUE // bitLenを使用しない場合には、境界テーブルが大きくなるのでofsは動的RCを使用 + #define LRC_OFFSET_BITS 12 + #define LRC_OFFSET_TABLE_BITS LRC_OFFSET_BITS +#endif + +// レンジコーダ用構造体 +typedef struct +{ + u32 *freq; // 出現頻度テーブル (1 << bitSize) * sizeof(u32) Byte + u32 *low_cnt; // LOW境界値テーブル (1 << bitSize) * sizeof(u32) Byte + u32 total; // トータル 4 Byte + u8 bitSize; // ビットサイズ 1 Byte + u8 padding_[1]; // +} +RCCompressionInfo; + +// レンジコーダ状態構造体 +typedef struct +{ + u32 low; + u32 range; + u32 code; // 展開時のみ使用 + u8 carry; // 圧縮時のみ使用 + u32 carry_cnt; // 圧縮時のみ使用 +} +RCState; + +/*---------------------------------------------------------------------------* + Name: RCInitState_ + + Description: RC状態の初期化をおこないます。 + + Arguments: state + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCInitState_( RCState* state ) +{ + // 開始Rangeが0x80000000なので、初回いきなり桁上げが発生することはない + state->low = 0; + state->range = RC_MAX_RANGE; + state->code = 0; + state->carry = 0; + state->carry_cnt = 0; +} + + +/*---------------------------------------------------------------------------* + Name: RCInitInfo_ + + Description: 静的レンジコーダのテーブル初期化 + すべての出現頻度を0で初期化します。 + + Arguments: info + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCInitInfo_( RCCompressionInfo* info, u8 bitSize ) +{ + u32 tableSize = (1 << bitSize); + u32 i; + + info->bitSize = bitSize; + info->freq = (u32*)malloc( sizeof(u32) * tableSize ); + info->low_cnt = (u32*)malloc( sizeof(u32) * tableSize ); + + for ( i = 0; i < tableSize; i++ ) + { + info->freq[ i ] = 0; + info->low_cnt[ i ] = 0; + } + info->total = 0; +} + +/*---------------------------------------------------------------------------* + Name: RCExportTable_ + + Description: 静的RCテーブルを出力します。 + + Arguments: dstp + info + + Returns: 出力データサイズ + *---------------------------------------------------------------------------*/ +static u32 +RCExportTable_( u8* dstp, RCCompressionInfo* info ) +{ + u32 tableSize = (1 << info->bitSize); + u32 cnt = 0; + u32 i; + + // 頻度テーブルの出力(16bitリトルエンディアン) + for ( i = 0; i < tableSize; i++ ) + { + dstp[ cnt++ ] = (u8)( info->freq[ i ] ); + dstp[ cnt++ ] = (u8)( info->freq[ i ] >> 8 ); + } + return cnt; +} + +/*---------------------------------------------------------------------------* + Name: RCImportTable_ + + Description: + + Arguments: info + srcp + srcRemainSize + + Returns: + *---------------------------------------------------------------------------*/ +static u32 +RCImportTable_( RCCompressionInfo* info, const u8* srcp, u32 srcRemainSize ) +{ + u32 tableSize = (1 << info->bitSize); + u32 cnt = 0; + u32 i; + + if ( srcRemainSize < tableSize * sizeof(u16) ) + { + return srcRemainSize; + } + + // 頻度テーブルのインポート(16bitリトルエンディアン) + for ( i = 0; i < tableSize; i++ ) + { + info->freq[ i ] = srcp[ cnt ] | ( srcp[ cnt + 1 ] << 8 ); + cnt += 2; + } + info->low_cnt[ 0 ] = 0; + info->total = info->freq[ 0 ]; + for ( i = 1; i < tableSize; i++ ) + { + info->low_cnt[ i ] = info->low_cnt[ i - 1 ] + info->freq[ i - 1 ]; + info->total += info->freq[ i ]; + } + return cnt; +} + +/*---------------------------------------------------------------------------* + Name: RCNormalizeTable_ + + Description: RCテーブルの正規化 + + Arguments: info + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCNormalizeTable_( RCCompressionInfo* info ) +{ + u32 tableSize = (1 << info->bitSize); + u32 i; + + // トータルのカウント + info->total = 0; + for ( i = 0; i < tableSize; i++ ) + { + info->total += info->freq[ i ]; + } + + // 正規化 + // 0x10000へ正規化 + #define NORMAL_FREQ 0x10000 + { + f32 rate = (f32)NORMAL_FREQ / info->total; + u32 max_i = 0; + u32 max_freq = 0; + + info->total = 0; + for ( i = 0; i < tableSize; i++ ) + { + u32 orig = info->freq[ i ]; + info->freq[ i ] = (u32)(rate * info->freq[ i ] + 0.5f); + if ( orig != 0 && info->freq[ i ] == 0 ) + { + info->freq[ i ] = 1; + } + + info->total += info->freq[ i ]; + if ( info->freq[ i ] >= max_freq ) + { + max_i = i; + max_freq = info->freq[ i ]; + } + } + // 最も出現頻度の高い値を誤差調整に利用 + if ( info->total > NORMAL_FREQ ) + { + info->freq[ max_i ] -= (info->total - NORMAL_FREQ); + } + else + { + info->freq[ max_i ] += (NORMAL_FREQ - info->total); + } + info->total = NORMAL_FREQ; + } + #undef NORMAL_FREQ + + // low_cntの計算 + info->low_cnt[ 0 ] = 0; + for ( i = 1; i < tableSize; i++ ) + { + info->low_cnt[ i ] = info->low_cnt[ i - 1 ] + info->freq[ i - 1 ]; + } +} + + +/*---------------------------------------------------------------------------* + Name: RCCountData_ + + Description: LZ圧縮したデータから静的レンジコーダ用のテーブルを作成します。 + + Arguments: srcp + srcSize + info8 + info16 + + Returns: + *---------------------------------------------------------------------------*/ +static void +RCCountData_( const u8* srcp, u32 srcSize, RCCompressionInfo* info8, RCCompressionInfo* info16 ) +{ + u32 srcCnt = 0; + u32 i; + + while ( srcCnt < srcSize ) + { + u8 compFlags = srcp[ srcCnt++ ]; // 圧縮の有無を示すフラグ列 + for ( i = 0; i < 8; i++ ) + { + if ( compFlags & 0x80 ) // 圧縮されている、length:8, offset:16 + { + u8 length = srcp[ srcCnt++ ]; + u16 offset = srcp[ srcCnt++ ]; // リトルエンディアン + offset |= (srcp[ srcCnt++ ] << 8); + + #if BLEND_COMP_FLAG + info8->freq[ length | 0x100 ]++; + #else + info8->freq[ length ]++; + #endif + #if !defined( LRC_ENC_OFFSET_WIDTH ) + info16->freq[ offset ]++; + #else + { + u32 offset_bit = 0; + while ( offset != 0 ) + { + ++offset_bit; + offset >>= 1; + } + info16->freq[ offset_bit ]++; + } + #endif + } + else + { + u8 data = srcp[ srcCnt++ ]; + info8->freq[ data ]++; + } + compFlags <<= 1; + if ( srcCnt >= srcSize ) + { + break; + } + } + } + + RCNormalizeTable_( info8 ); + RCNormalizeTable_( info16 ); +} + + + +/*---------------------------------------------------------------------------* + Name: RCAInitInfo_ + + Description: 適応型レンジコーダのテーブル初期化 + すべての出現頻度を1で初期化します。 + + Arguments: info + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCAInitInfo_( RCCompressionInfo* info, u8 bitSize ) +{ + u32 tableSize = (1 << bitSize); + u32 i; + + info->bitSize = bitSize; + info->freq = (u32*)malloc( sizeof(u32) * tableSize ); + info->low_cnt = (u32*)malloc( sizeof(u32) * tableSize ); + + for ( i = 0; i < tableSize; i++ ) + { + info->freq[ i ] = 1; + info->low_cnt[ i ] = i; + } + info->total = tableSize; +} + + +/*---------------------------------------------------------------------------* + Name: RCAAddCount_ + + Description: 適応型レンジコーダの頻度テーブルを更新します。 + + Arguments: info + val + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCAAddCount_( RCCompressionInfo* info, u16 val ) +{ + u32 i; + u32 tableSize = (1 << info->bitSize); + + info->freq[ val ]++; + info->total++; + for ( i = val + 1; i < tableSize; i++ ) + { + info->low_cnt[ i ]++; + } + + // トータルが最大値を越えた場合には、再構成する。 + if ( info->total >= 0x00010000 ) + { + if ( info->freq[ 0 ] > 1 ) + { + info->freq[ 0 ] = info->freq[ 0 ] / 2; + } + info->low_cnt[ 0 ] = 0; + info->total = info->freq[ 0 ]; + + for ( i = 1; i < tableSize; i++ ) + { + if ( info->freq[ i ] > 1 ) + { + info->freq[ i ] >>= 1; + } + info->low_cnt[ i ] = info->low_cnt[ i - 1 ] + info->freq[ i - 1 ]; + info->total += info->freq[ i ]; + } + } +} + + +/*---------------------------------------------------------------------------* + Name: ConvertRC + Description: + Arguments: info + data + stream + Returns: None. + *---------------------------------------------------------------------------*/ +static void +ConvertRC( RCCompressionInfo* info, u16 data, BitStream* stream, RCState* state, BOOL adaptive ) +{ +#define MIN_RANGE 0x01000000 + u32 temp = state->range / info->total; + u32 prevLow = state->low; + + state->low += info->low_cnt[ data ] * temp; + state->range = info->freq[ data ] * temp; + + if ( adaptive ) + { + // 出現頻度テーブルを更新 + RCAAddCount_( info, data ); + } + + // 桁上がりが発生する場合の処理 + if ( prevLow > state->low ) + { + // キャリーを1くり上げ + state->carry++; + // キャリーと(キャリーカウンタ - 1)個の0x00を出力します。 + if ( state->carry_cnt > 1 ) + { + BitStream_Write( stream, state->carry, RC_UNIT_BITS ); + state->carry_cnt--; + state->carry = 0x00; + } + while ( state->carry_cnt > 1 ) + { + BitStream_Write( stream, 0x00, RC_UNIT_BITS ); + state->carry_cnt--; + } + } + + // Rangeの上位1バイトが空になったら桁上げ + while ( state->range < MIN_RANGE ) + { + u8 candidate = (u8)( state->low >> 24 ); + // 次のキャリーが0xFFの場合は更に桁上げがあり得るのでcarryを出力せずにcarry_cntだけ増やす + if ( candidate == 0xFF ) + { + state->carry_cnt++; + } + else + // 次のキャリーが0xFFではない場合はcarryを出力する + { + // carryと(carry_cnt - 1)分の0xFFを出力する + if ( state->carry_cnt > 0 ) + { + BitStream_Write( stream, state->carry, RC_UNIT_BITS ); + state->carry_cnt--; + } + while ( state->carry_cnt > 0 ) + { + BitStream_Write( stream, 0xFF, RC_UNIT_BITS ); + state->carry_cnt--; + } + // 新しいcarryに置き換え + state->carry = candidate; + state->carry_cnt = 1; + } + state->low <<= 8; + state->range <<= 8; + } +#undef MIN_RANGE +} + +/*---------------------------------------------------------------------------* + Name: FinalizeRC_ + Description: + Arguments: srcp + tmpSize + dstp + info8 + info16 + Returns: + *---------------------------------------------------------------------------*/ +static void +FinalizeRC_( BitStream* stream, RCState* state ) +{ + // carryと(carry_cnt - 1)分の0xFFを出力する + if ( state->carry_cnt > 0 ) + { + BitStream_Write( stream, state->carry, RC_UNIT_BITS ); + state->carry_cnt--; + } + while ( state->carry_cnt > 0 ) + { + BitStream_Write( stream, 0xFF, RC_UNIT_BITS ); + state->carry_cnt--; + } + // lowに残ったデータを書き出す + BitStream_Write( stream, state->low >> 24, RC_UNIT_BITS ); + BitStream_Write( stream, state->low >> 16, RC_UNIT_BITS ); + BitStream_Write( stream, state->low >> 8, RC_UNIT_BITS ); + BitStream_Write( stream, state->low , RC_UNIT_BITS ); +} + + +/*---------------------------------------------------------------------------* + Name: LZConvertDataRC + Description: + Arguments: srcp + tmpSize + dstp + info8 + info16 + Returns: + *---------------------------------------------------------------------------*/ +static u32 +LZConvertDataRC( const u8* srcp, u32 srcSize, u8* dstp, RCCompressionInfo* info8, RCCompressionInfo* info16 ) +{ + u32 srcCnt = 0; + u32 dstCnt = 0; + + BitStream stream; + RCState rcState; + + RCInitState_( &rcState ); + + BitStream_Init( &stream, dstp ); + + while ( srcCnt < srcSize ) + { + u32 i; + u8 compFlags = srcp[ srcCnt++ ]; // 圧縮の有無を示すフラグ列 + + for ( i = 0; i < 8; i++ ) + { + if ( compFlags & 0x80 ) // 圧縮されている、length:8, offset:16 + { + u8 length = srcp[ srcCnt++ ]; + u16 offset = srcp[ srcCnt++ ]; // リトルエンディアン + offset |= srcp[ srcCnt++ ] << 8; + + // length | 0x100をレンジコーダに掛ける + ConvertRC( info8, length | 0x100, &stream, &rcState, TABLE8_ADAPTIVE ); + + #if !defined( LRC_ENC_OFFSET_WIDTH ) // テーブルサイズが大きいので強制的に適応型 + ConvertRC( info16, offset, &stream, &rcState, TABLE16_ADAPTIVE ); + #else + { + u16 offset_bit = 0; + u16 offset_tmp = offset; + while ( offset_tmp > 0 ) + { + offset_tmp >>= 1; + ++offset_bit; + } + ConvertRC( info16, offset_bit, &stream, &rcState, TABLE16_ADAPTIVE ); + // offsetが0であることはないので、最上位のビットは省略する + BitStream_Write( &stream, offset & ~(1 << (offset_bit - 1)), offset_bit - 1 ); + } + #endif + } + else + { + u8 data = srcp[ srcCnt++ ]; + + ConvertRC( info8, data, &stream, &rcState, TABLE8_ADAPTIVE ); + } + compFlags <<= 1; + if ( srcCnt >= srcSize ) + { + break; + } + } + } + // carryとlowに残ったデータを吐き出す + FinalizeRC_( &stream, &rcState ); + + BitStream_Terminate( &stream, 4 ); + return stream.cnt; +} + + +/*---------------------------------------------------------------------------* + Name: LRCCompWrite + + Description: + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +u32 LRCCompWrite( const u8* srcp, u32 srcSize, u8* dstp ) +{ + RCCompressionInfo sRCInfo8; + RCCompressionInfo sRCInfo16; + + u32 tmpSize; + u32 dstSize; + u8* tmpBuf = (u8*)malloc( srcSize * 3 ); + // まずはsrcpを普通にLZ圧縮 + tmpSize = LZCompWrite_( srcp, srcSize, tmpBuf, 2, LRC_OFFSET_BITS ); + + // テーブル初期化 + RCInitInfo_( &sRCInfo8, LENGTH_BITS ); + RCInitInfo_( &sRCInfo16, LRC_OFFSET_TABLE_BITS ); + + dstSize = 0; + + // ヘッダの書き込み + if ( srcSize < 0x1000000 && srcSize > 0 ) + { + *(u32*)dstp = LRC_CODE_HEADER | ( srcSize << 8 ); + dstSize = 4; + } + else + { + *(u32*)dstp = LRC_CODE_HEADER; + *(u32*)&dstp[4] = srcSize; + dstSize = 8; + } + + // 静的レンジコーダの頻度表を作成だけしておく(使用するかどうかはオプション次第) + RCCountData_( tmpBuf, tmpSize, &sRCInfo8, &sRCInfo16 ); + +#if TABLE8_ADAPTIVE + RCAInitInfo_( &sRCInfo8, LENGTH_BITS ); +#else // if (! TABLE8_ADAPTIVE ) + dstSize += RCExportTable_( &dstp[ dstSize ], &sRCInfo8 ); +#endif + +#if TABLE16_ADAPTIVE + RCAInitInfo_( &sRCInfo16, LRC_OFFSET_TABLE_BITS ); +#else // if (! TABLE16_ADAPTIVE ) + dstSize += RCExportTable_( &dstp[ dstSize ], &sRCInfo16 ); +#endif + + // 圧縮結果をレンジコーダ符号化しながら出力 + dstSize += LZConvertDataRC( tmpBuf, tmpSize, &dstp[ dstSize ], &sRCInfo8, &sRCInfo16 ); + + return dstSize; +} + + + +/*---------------------------------------------------------------------------* + Name: SearchRC_ + + Description: + + Arguments: info + code + range + low + + Returns: + *---------------------------------------------------------------------------*/ +static u16 +SearchRC_( RCCompressionInfo* info, u32 code, u32 range, u32 low ) +{ + u32 tableSize = (1 << info->bitSize); + u32 codeVal = code - low; + u32 i; + u32 temp = range / info->total; + u32 tempVal = codeVal / temp; + +#if 0 + // TODO: とりあえず線形探索、二分探索にするべき + for ( i = 0; i < tableSize - 1; i++ ) + { + if ( info->low_cnt[ i + 1 ] > tempVal ) + { + while ( info->freq[ i ] == 0 ) + { + --i; + } + return (u16)i; + } + } + return (u16)( (1 << info->bitSize) - 1 ); +#else + // 二分探索 + u32 left = 0; + u32 right = tableSize - 1; + + while ( left < right ) + { + i = (left + right) / 2; + + if ( info->low_cnt[ i ] > tempVal ) + { + right = i; + } + else + { + left = i + 1; + } + } + + i = left; + while ( info->low_cnt[ i ] > tempVal ) + { + --i; + } + return (u16)i; + +#endif +} + + + +static u16 +RCGetDate_( BitReader* stream, RCCompressionInfo* info, RCState* state, BOOL adaptive ) +{ +#define MIN_RANGE 0x01000000 + u16 val = SearchRC_( info, state->code, state->range, state->low ); + + { + u32 tmp; + tmp = state->range / info->total; + state->low += info->low_cnt[ val ] * tmp; + state->range = info->freq[ val ] * tmp; + } + + // 出現頻度テーブルを更新 + if ( adaptive ) + { + RCAAddCount_( info, val ); + } + while ( state->range < MIN_RANGE ) + { + state->code <<= 8; + state->code += BitReader_ReadEx( stream, 8 ); + state->range <<= 8; + state->low <<= 8; + } + return val; +#undef MIN_RANGE +} + + +/*---------------------------------------------------------------------------* + Name: LRCCompRead + + Description: + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 LRCCompRead( const u8* srcp, u32 srcSize, u8* dstp ) +{ + RCCompressionInfo sRCInfo8; + RCCompressionInfo sRCInfo16; + RCState rcState; + + u32 dstSize; + u32 srcCnt = 0; + u32 dstCnt = 0; + BitReader stream; + + if ( srcSize < 4 ) + { + return -1; + } + + // ヘッダの読み込み + dstSize = *(u32*)srcp >> 8; + srcCnt = 4; + if ( dstSize == 0 ) + { + if ( srcSize < 8 ) + { + return -1; + } + dstSize = *(u32*)(srcp + 4); + srcCnt += 4; + } + + // RC頻度テーブルを読む +#if TABLE8_ADAPTIVE + RCAInitInfo_( &sRCInfo8, LENGTH_BITS ); +#else + RCInitInfo_( &sRCInfo8, LENGTH_BITS ); + srcCnt += RCImportTable_( &sRCInfo8, &srcp[ srcCnt ], srcSize - srcCnt ); +#endif +#if TABLE16_ADAPTIVE + RCAInitInfo_( &sRCInfo16, LRC_OFFSET_TABLE_BITS ); +#else + RCInitInfo_( &sRCInfo16, LRC_OFFSET_TABLE_BITS ); + srcCnt += RCImportTable_( &sRCInfo16, &srcp[ srcCnt ], srcSize - srcCnt ); +#endif + + BitReader_Init( &stream, &srcp[ srcCnt ], srcSize - srcCnt ); + + if ( srcSize - srcCnt <= 4 ) + { + // 最低でも初回のコード分の4Byteは必要 + return -1; + } + + RCInitState_( &rcState ); + + rcState.code = (u32)( (BitReader_ReadEx( &stream, 8 ) << 24) | + (BitReader_ReadEx( &stream, 8 ) << 16) | + (BitReader_ReadEx( &stream, 8 ) << 8) | + (BitReader_ReadEx( &stream, 8 ) ) ); + + while ( dstCnt < dstSize ) + { + u16 val = (u16)( RCGetDate_( &stream, &sRCInfo8, &rcState, TABLE8_ADAPTIVE ) ); + + if ( val < 0x100 ) + // 非圧縮データ + { + dstp[ dstCnt++ ] = (u8)val; + } + else + // 圧縮データ + { + u16 length = (val & 0xFF) + 3; + val = (u16)( RCGetDate_( &stream, &sRCInfo16, &rcState, TABLE16_ADAPTIVE ) ); + + #if defined( LRC_ENC_OFFSET_WIDTH ) + { + u16 offset_bit = val; + val = 0; + if ( offset_bit > 0 ) + { + val = 1; + while ( --offset_bit > 0 ) + { + val <<= 1; + val |= BitReader_Read( &stream ); + } + } + } + #endif + val += 1; + + // バッファオーバーランをチェック + if ( dstCnt + length > dstSize ) + { + return -1; + } + if ( dstCnt < val ) + { + return -1; + } + if ( srcCnt + stream.cnt > srcSize ) + { + return -1; + } + + while ( length-- > 0 ) + { + dstp[ dstCnt ] = dstp[ dstCnt - val ]; + ++dstCnt; + } + } + } + + return dstCnt; +} + + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.h b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.h new file mode 100644 index 00000000..72dc2e5b --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/multipleCompLib.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: multipleCompLib.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +// nitroCompLib.h : nitroCompLib.DLL のメイン ヘッダー ファイル +// + +#ifndef __MULTIPLE_COMPLIB_H__ +#define __MULTIPLE_COMPLIB_H__ + +//=========================================================================================== +// インクルード +//=========================================================================================== +#include +#include +#include +#include +#include "types.h" + +//=========================================================================================== +// プロトタイプ宣言 +//=========================================================================================== +// C++用 +#ifdef __cplusplus +extern "C" +{ +#endif + +s32 LHCompRead( const u8* srcp, u32 srcSize, u8* dstp ); + +u32 LHCompWrite( const u8* srcp, s32 size, u8* dstp ); + +s32 LRCCompRead( const u8* srcp, u32 srcSize, u8* dstp ); + +u32 LRCCompWrite( const u8* srcp, u32 size, u8* dstp ); + + +#ifdef __cplusplus +} +#endif + +#endif // __MULTIPLEX_COMPLIB_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.c b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.c new file mode 100644 index 00000000..135f7a45 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.c @@ -0,0 +1,2282 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: nitroCompLib.c + + Copyright 2007 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 "nitroCompLib.h" + +#undef _DEBUG +#ifdef _DEBUG +#define new DEBUG_NEW +#define DEBUG_PRINT +// #define DEBUG_PRINT_DIFFFILT +#define DEBUG_PRINT_RL +// #define DEBUG_PRINT_HUFF +// #define DEBUG_PRINT_LZ +// #define DEBUG_PRINT_DATAMATCH +#endif + + +#ifdef __cplusplus +#define EXTERN extern "C" +#define STATIC +#else +#define EXTERN +#define STATIC static +#endif + + +#ifdef DEBUG_PRINT +#define dbg_printf fprintf +#else +#define dbg_printf dummy +#endif + +#ifdef DEBUG_PRINT_DIFFFILT +#define dbg_printf_dif fprintf +#else +#define dbg_printf_dif dummy +#endif + +#ifdef DEBUG_PRINT_RL +#define dbg_printf_rl fprintf +#else +#define dbg_printf_rl dummy +#endif + +#ifdef DEBGU_PRINT_HUFF +#define dbg_printf_huff fprintf +#else +#define dbg_printf_huff dummy +#endif + +#ifdef DEBGU_PRINT_LZ +#define dbg_printf_lz fprintf +#else +#define dbg_printf_lz dummy +#endif + +#ifdef DEBUG_PRINT_DATAMATCH +#define dbg_printf_match fprintf +#else +#define dbg_printf_match dummy +#endif + +void dummy(void *fp, ...) +{ +} + + +//================================================================================== +// グローバル変数宣言 +//================================================================================== +static u8 *pCompBuf[2]; // 圧縮処理中に用いるダブルバッファ +static u8 compBufNo = 1; // 有効なダブルバッファを示す + +//================================================================================== +// プロトタイプ宣言 +//================================================================================== +static u32 RawWrite(u8 *srcp, u32 size, u8 *dstp); +static u32 DiffFiltWrite(u8 *srcp, u32 size, u8 *dstp, u8 diffBitSize); +static u32 RLCompWrite(u8 *srcp, u32 size, u8 *dstp); +static u32 LZCompWriteEx(u8 *srcp, u32 size, u8 *dstp, u8 lzSearchOffset, BOOL ex_available); +static u32 HuffCompWrite(u8 *srcp, u32 size, u8 *dstp, u8 huffBitSize); + +static s32 RawRead ( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize ); +static s32 DiffFiltRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, u8 diffBitSize ); +static s32 RLCompRead ( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize ); +static s32 LZCompReadEx( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, BOOL ex_available ); +static s32 HuffCompRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, u8 huffBitSize ); + +/* +//================================================================================== +// DLL用関数 +//================================================================================== +EXTERN BOOL WINAPI DllMain( HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) +{ + return TRUE; +} +*/ + +//---------------------------------------------------------------------------------- +// 圧縮後のデータを置くためのメモリ領域を確保 +// 圧縮前のデータの2倍の領域を確保する +//---------------------------------------------------------------------------------- +EXTERN u8 * STDCALL nitroCompMalloc(u32 size) +{ + return (u8 *)malloc(size * 3 + 512); +} + +//---------------------------------------------------------------------------------- +// 圧縮後のデータを置いていたメモリ領域を解放 +//---------------------------------------------------------------------------------- +EXTERN void STDCALL nitroCompFree(u8 *p) +{ + if (p != NULL) + { + free((void *)p); + p = NULL; + } +} + +//------------------------------------------------------------ +// データの圧縮 +//------------------------------------------------------------ +EXTERN u32 STDCALL nitroCompress( const u8 *srcp, u32 srcSize, u8 *dstp, char *compList, u8 rawHeaderFlag ) +{ + char *pCompList; // compListの現在の参照ポイント + u32 dataSize, nextDataSize; // 圧縮データのサイズ(バイト単位) + u8 *pReadBuf; // 圧縮データの先頭番地を指すポインタ + u8 bitSize; // 差分フィルタ,ハフマン符号化の適用単位 + char str[16]; + u16 i, j; + u8 lzSearchOffset; + +// pCompBuf[0] = (u8 *)malloc(srcSize*2 + 4 + 256*2); // 最悪のハフマンが size*2 + 4 + 256*2 なので、 +// pCompBuf[1] = (u8 *)malloc(srcSize*2 + 4 + 256*2); // その他の圧縮やデータヘッダ追加で、不足する可能性あり + pCompBuf[0] = (u8 *)malloc(srcSize * 3 + 256 * 2); + pCompBuf[1] = (u8 *)malloc(srcSize * 3 + 256 * 2); + pReadBuf = pCompBuf[0]; + compBufNo = 1; // 重要!! これをしないと2回目にnitroCompressを呼び出したときにおかしくなる + + // malloc チェック + if (pCompBuf[0] == NULL || pCompBuf[1] == NULL) + { + fprintf(stderr, "Error: Memory is not enough.\n"); + exit(1); + } + + dataSize = srcSize; + + // NULLヘッダ(圧縮前のデータ用の、擬似ヘッダ) の追加処理 + if (rawHeaderFlag) + { + dataSize += 4; + *(u32 *)pReadBuf = srcSize << 8 | 0; // データ・ヘッダ + memcpy(&pReadBuf[4], srcp, srcSize); + } + else + { + memcpy(pReadBuf, srcp, srcSize); + } + + pCompList = compList; // 圧縮順序を格納した配列をポイント + + // 圧縮順序を格納した配列に要素がある限り、ループ + while (1) + { + switch (*pCompList) + { + case 'd': + { + pCompList++; // 'd' の次には、8 か 16 + str[0] = *pCompList; + if (*pCompList == '1') + { + pCompList++; + str[1] = *pCompList; + str[2] = '\n'; + } + bitSize = atoi(str); // 差分フィルタの適用単位を格納 + str[0] = str[1] = '\n'; + + dbg_printf(stderr, "nitroCompress Diff %d\n", bitSize); + + if ((bitSize == 16) && (dataSize & 0x01)) + { + fprintf(stderr, "16-bit differencial filter must be 2-byte allignment.\n"); + exit(1); + } + nextDataSize = DiffFiltWrite(pReadBuf, dataSize, pCompBuf[compBufNo], bitSize); + } + break; + + case 'r': + { + dbg_printf(stderr, "nitroCompress RL\n"); + + nextDataSize = RLCompWrite(pReadBuf, dataSize, pCompBuf[compBufNo]); + } + break; + + case 'l': + case 'L': + { + BOOL ex_format = (*pCompList == 'L')? TRUE : FALSE; + + pCompList++; + i = 0; + while (isdigit(*pCompList)) + { + str[i] = *pCompList; + pCompList++; + i++; + if (i == 15) + { + break; + } + } + str[i] = '\n'; + pCompList--; + lzSearchOffset = (u8)atoi(str); // 大きな値は切り捨てて丸め + for (j = 0; j < i; j++) + { + str[j] = '\n'; + } + dbg_printf(stderr, "nitroCompress L %d\n", lzSearchOffset); + + nextDataSize = LZCompWriteEx(pReadBuf, dataSize, pCompBuf[compBufNo], lzSearchOffset, ex_format); + } + break; + + case 'h': + { + pCompList++; // 'h' の次には、4 か 8 + str[0] = *pCompList; + str[1] = '\n'; + bitSize = atoi(str); // 4 or 8 + str[0] = '\n'; + + dbg_printf(stderr, "nitroCompress Huff %d\n", bitSize); + + nextDataSize = HuffCompWrite(pReadBuf, dataSize, pCompBuf[compBufNo], bitSize); + } + break; + //----------------------------------------- + // 圧縮終了 (*CompTypeBufp が NULL) + default: + { + dbg_printf(stderr, "nitroCompress raw\n"); + + RawWrite(pReadBuf, dataSize, dstp); + if (pCompBuf[0] != NULL) + { + free((void *)pCompBuf[0]); + pCompBuf[0] = NULL; + } + if (pCompBuf[1] != NULL) + { + free(pCompBuf[1]); + pCompBuf[1] = NULL; + } + return dataSize; + } + } + // もう一周 + pReadBuf = pCompBuf[compBufNo]; + compBufNo ^= 0x01; + dataSize = nextDataSize; + pCompList++; + } +} + + +//=========================================================================== +// 圧縮データのコピー +//=========================================================================== +static u32 RawWrite(u8 *srcp, u32 size, u8 *dstp) +{ + u32 i; + + dbg_printf(stderr, "RawWrite\tsize=%d\n\n", size); + + size = (size + 0x3) & ~0x3; + for (i = 0; i < size - 1; i++) + { + *dstp = *srcp; + dstp++; + srcp++; + } + *dstp = *srcp; + + return size; +} + + +//=========================================================================== +// 差分フィルタ +//=========================================================================== +static u32 DiffFiltWrite(u8 *srcp, u32 size, u8 *dstp, u8 diffBitSize) +{ + u32 DiffCount; // 圧縮データのバイト数 + u32 i; + + u16 *src16p = (u16 *)srcp; + u16 *dst16p = (u16 *)dstp; + + dbg_printf_dif(stderr, "DiffFiltWrite\tsize=%d\tdiffBitSize=%d\n", size, diffBitSize); + + if ( size < 0x1000000 && size > 0 ) + { + *(u32 *)dstp = size << 8 | (DIFF_CODE_HEADER | diffBitSize / 8); // データ・ヘッダ + DiffCount = 4; + } + else + { + *(u32 *)dstp = (DIFF_CODE_HEADER | diffBitSize / 8); // データ・ヘッダ + *(u32 *)(dstp + 4) = size; + DiffCount = 8; + } + + if (diffBitSize == 8) + { +#ifdef DEBUG_PRINT_DIFFFILT + for (i = 0; i < 16; i++) + { + dbg_printf_dif(stderr, "srcp[%d] = %x\n", i, srcp[i]); + } +#endif + dstp[DiffCount] = srcp[0]; // 先頭データのみ差分無し + DiffCount++; + for (i = 1; i < size; i++, DiffCount++) + { + dbg_printf_dif(stderr, "dstp[%x] = srcp[%d]-srcp[%d] = %x - %x = %x\n", + DiffCount, i, i - 1, srcp[i], srcp[i - 1], srcp[i] - srcp[i - 1]); + + dstp[DiffCount] = srcp[i] - srcp[i - 1]; // 差分データ格納 + } + } + else // 16ビットサイズ + { + dst16p[DiffCount / 2] = src16p[0]; + DiffCount += 2; + for (i = 1; i < size / 2; i++, DiffCount += 2) + { + dst16p[DiffCount / 2] = src16p[i] - src16p[i - 1]; + } + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((DiffCount + i) & 0x3) + { + dstp[DiffCount + i] = 0; + i++; + } + + return DiffCount; +} + + +//=========================================================================== +// ランレングス符号化 (バイト単位) +//=========================================================================== +static u32 RLCompWrite(u8 *srcp, u32 size, u8 *dstp) +{ + u32 RLDstCount; // 圧縮データのバイト数 + u32 RLSrcCount; // 圧縮対象データの処理済データ量(バイト単位) + u8 RLCompFlag; // ランレングス符号化を行う場合1 + u8 runLength; // ランレングス + u8 rawDataLength; // ランになっていないデータのレングス + u32 i; + + u8 *startp; // 一回の処理ループにおける、圧縮対象データの先頭をポイント + + dbg_printf_rl(stderr, "RLCompWrite\tsize=%d\n", size); + + // データヘッダ (サイズは展開後のもの) + if ( size < 0x1000000 && size > 0 ) + { + *(u32 *)dstp = size << 8 | RL_CODE_HEADER; // データ・ヘッダ + RLDstCount = 4; + } + else + // サイズが24bitに収まらない場合には拡張形式のヘッダとなる + { + *(u32 *)dstp = RL_CODE_HEADER; + *(u32 *)(dstp + 4) = size; + RLDstCount = 8; + } + + RLSrcCount = 0; + rawDataLength = 0; + RLCompFlag = 0; + + while (RLSrcCount < size) + { + startp = &srcp[RLSrcCount]; // 圧縮対象データの設定 + + for (i = 0; i < 128; i++) // 7ビットで表現できるデータ量が 0~127 + { + // 圧縮対象データの末尾に到達 + if (RLSrcCount + rawDataLength >= size) + { + rawDataLength = (u8)(size - RLSrcCount); + break; + } + + if (RLSrcCount + rawDataLength + 2 < size) + { + if (startp[i] == startp[i + 1] && startp[i] == startp[i + 2]) + { + RLCompFlag = 1; + break; + } + } + rawDataLength++; + } + + // 符号化しないデータを格納 + // データ長格納バイトの8ビット目が0なら、符号化しないデータ系列 + // データ長は -1 した数になるので、0-127 が 1-128 となる + if (rawDataLength) + { + dstp[RLDstCount++] = rawDataLength - 1; // "データ長-1" 格納(7ビット) + for (i = 0; i < rawDataLength; i++) + { + dstp[RLDstCount++] = srcp[RLSrcCount++]; + } + rawDataLength = 0; + } + + // ランレングス符号化 + if (RLCompFlag) + { + runLength = 3; + for (i = 3; i < 128 + 2; i++) + { + // 圧縮用データの末尾に到達 + if (RLSrcCount + runLength >= size) + { + runLength = (u8)(size - RLSrcCount); + break; + } + + // ランが途切れた場合 + if (srcp[RLSrcCount] != srcp[RLSrcCount + runLength]) + { + break; + } + // ラン継続中 + runLength++; + } + + // データ長格納バイトの8ビット目が1なら、符号化したデータ系列 + dstp[RLDstCount++] = 0x80 | (runLength - 3); // 3の下駄をはかせて、3~130を格納 + dstp[RLDstCount++] = srcp[RLSrcCount]; + RLSrcCount += runLength; + RLCompFlag = 0; + } + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((RLDstCount + i) & 0x3) + { + dstp[RLDstCount + i] = 0; + i++; + } + + return RLDstCount; +} + + +//=========================================================================== +// LZ77圧縮 +//=========================================================================== + +#define LZ_OFFSET_BITS 12 +#define LZ_OFFSET_SIZE (1<LZByteTable[i] = -1; + info->LZEndTable[i] = -1; + } + info->WindowPos = 0; + info->WindowLen = 0; +} + +/*---------------------------------------------------------------------------* + Name: SlideByte + Description: 辞書を1バイトスライド + Arguments: *srcp + work + Returns: None. + *---------------------------------------------------------------------------*/ +static void SlideByte(LZCompressInfo * info, const u8 *srcp) +{ + s16 offset; + u8 in_data = *srcp; + u16 insert_offset; + + s16 *const LZByteTable = info->LZByteTable; + s16 *const LZEndTable = info->LZEndTable; + s16 *const LZOffsetTable = info->LZOffsetTable; + const u16 windowPos = info->WindowPos; + const u16 windowLen = info->WindowLen; + + if (windowLen == LZ_OFFSET_SIZE) + { + u8 out_data = *(srcp - LZ_OFFSET_SIZE); + if ((LZByteTable[out_data] = LZOffsetTable[LZByteTable[out_data]]) == -1) + { + LZEndTable[out_data] = -1; + } + insert_offset = windowPos; + } + else + { + insert_offset = windowLen; + } + + offset = LZEndTable[in_data]; + if (offset == -1) + { + LZByteTable[in_data] = insert_offset; + } + else + { + LZOffsetTable[offset] = insert_offset; + } + LZEndTable[in_data] = insert_offset; + LZOffsetTable[insert_offset] = -1; + + if (windowLen == LZ_OFFSET_SIZE) + { + info->WindowPos = (u16)((windowPos + 1) % LZ_OFFSET_SIZE); + } + else + { + info->WindowLen++; + } +} + +static void LZSlide(LZCompressInfo * info, const u8 *srcp, u32 n) +{ + u32 i; + + for (i = 0; i < n; i++) + { + SlideByte(info, srcp++); + } +} + + +/*---------------------------------------------------------------------------* + Name: LZCompWriteEx + + Description: LZ77圧縮を行なう関数(最大lengthの拡張) + + Arguments: srcp 圧縮元データへのポインタ + size 圧縮元データサイズ + dstp 圧縮先データへのポインタ + 圧縮元データよりも大きいサイズのバッファが必要です。 + + Returns: 圧縮後のデータサイズ。 + 圧縮後のデータが圧縮前よりも大きくなる場合には圧縮を中断し0を返します。 + *---------------------------------------------------------------------------*/ +static u32 LZCompWriteEx(u8 *srcp, u32 size, u8 *dstp, u8 lzSearchOffset, BOOL ex_available ) +{ + static LZCompressInfo sLZInfo; + + u32 LZDstCount; // 圧縮データのバイト数 + u8 LZCompFlags; // 圧縮の有無を示すフラグ系列 + u8 *LZCompFlagsp; // LZCompFlags を格納するメモリ領域をポイント + u16 lastOffset; // 一致データまでのオフセット (その時点での最長一致データ) + u32 lastLength; // 一致データ長 (その時点での最長一致データ) + u8 i; + const u32 MAX_LENGTH = (ex_available)? (0xFFFF + 0xFF + 0xF + 3) : (0xF + 3); + + if ( size < 0x1000000 && size > 0 ) + { + *(u32 *)dstp = size << 8 | LZ_CODE_HEADER | (ex_available? 1 : 0 ); // データ・ヘッダ + dstp += 4; + LZDstCount = 4; + } + else + { + *(u32 *)dstp = LZ_CODE_HEADER | (ex_available? 1 : 0); + *(u32 *)(dstp + 4) = size; + dstp += 8; + LZDstCount = 8; + } + LZInitTable( &sLZInfo ); + + while (size > 0) + { + LZCompFlags = 0; + LZCompFlagsp = dstp++; // フラグ系列の格納先 + LZDstCount++; + + // フラグ系列が8ビットデータとして格納されるため、8回ループ + for (i = 0; i < 8; i++) + { + LZCompFlags <<= 1; // 初回 (i=0) は特に意味はない + if (size <= 0) + { + // 終端に来た場合はフラグを最後までシフトさせてから終了 + continue; + } + + if ( (lastLength = SearchLZ(&sLZInfo, srcp, size, &lastOffset, lzSearchOffset, MAX_LENGTH)) != 0) + { + u32 length; + // 圧縮可能な場合はフラグを立てる + LZCompFlags |= 0x1; + + if ( ex_available ) + { + if ( lastLength >= 0xFF + 0xF + 3 ) + { + length = lastLength - 0xFF - 0xF - 3; + *dstp++ = (u8)( 0x10 | (length >> 12) ); + *dstp++ = (u8)( length >> 4 ); + LZDstCount += 2; + } + else if ( lastLength >= 0xF + 2 ) + { + length = lastLength - 0xF - 2; + *dstp++ = (u8)( length >> 4 ); + LZDstCount += 1; + } + else + { + length = lastLength - 1; + } + } + else + { + length = lastLength - 3; + } + // オフセットは上位4ビットと下位8ビットに分けて格納 + *dstp++ = (u8)( length << 4 | (lastOffset - 1) >> 8 ); + *dstp++ = (u8)( (lastOffset - 1) & 0xFF ); + LZDstCount += 2; + LZSlide( &sLZInfo, srcp, lastLength); + srcp += lastLength; + size -= lastLength; + } + else + { + // 圧縮なし + LZSlide(&sLZInfo, srcp, 1); + *dstp++ = *srcp++; + size--; + LZDstCount++; + } + } // 8回ループ終了 + *LZCompFlagsp = LZCompFlags; // フラグ系列を格納 + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((LZDstCount + i) & 0x3) + { + *dstp++ = 0; + i++; + } + + return LZDstCount; +} + + +//-------------------------------------------------------- +// LZ77圧縮でスライド窓の中から最長一致列を検索します。 +// Arguments: startp データの開始位置を示すポインタ +// nextp 検索を開始するデータのポインタ +// remainSize 残りデータサイズ +// offset 一致したオフセットを格納する領域へのポインタ +// Return : 一致列が見つかった場合は TRUE +// 見つからなかった場合は FALSE +//-------------------------------------------------------- +static u32 SearchLZ( const LZCompressInfo * info, const u8 *nextp, u32 remainSize, u16 *offset, u16 minOffset, u32 maxLength ) +{ + const u8 *searchp; + const u8 *headp, *searchHeadp; + u16 currOffset; + u32 currLength = 2; + u32 tmpLength; + s32 w_offset; + const s16 * const LZOffsetTable = info->LZOffsetTable; + const u16 windowPos = info->WindowPos; + const u16 windowLen = info->WindowLen; + + if (remainSize < 3) + { + return 0; + } + + w_offset = info->LZByteTable[*nextp]; + + while (w_offset != -1) + { + if (w_offset < windowPos) + { + searchp = nextp - windowPos + w_offset; + } + else + { + searchp = nextp - windowLen - windowPos + w_offset; + } + + /* 無くても良いが、僅かに高速化する */ + if (*(searchp + 1) != *(nextp + 1) || *(searchp + 2) != *(nextp + 2)) + { + w_offset = LZOffsetTable[w_offset]; + continue; + } + + if (nextp - searchp < minOffset) + { + // VRAMは2バイトアクセスなので (VRAMからデータを読み出す場合があるため)、 + // 検索対象データは2バイト前からのデータにしなければならない。 + // + // オフセットは12ビットで格納されるため、4096以下 + break; + } + tmpLength = 3; + searchHeadp = searchp + 3; + headp = nextp + 3; + + while (((u32)(headp - nextp) < remainSize) && (*headp == *searchHeadp)) + { + headp++; + searchHeadp++; + tmpLength++; + + // 一致長が最大なので、検索を終了する + if (tmpLength == maxLength) + { + break; + } + } + if (tmpLength > currLength) + { + // 最大長オフセットを更新 + currLength = tmpLength; + currOffset = (u16)(nextp - searchp); + if (currLength == maxLength) + { + // 一致長が最大なので、検索を終了する。 + break; + } + } + w_offset = LZOffsetTable[w_offset]; + } + + if (currLength < 3) + { + return 0; + } + *offset = currOffset; + return currLength; +} + + +//=========================================================================== +// ハフマン符号化 +//=========================================================================== +#define HUFF_END_L 0x80 +#define HUFF_END_R 0x40 + +typedef struct +{ + u16 No; // データNo + s16 PaNo; // 親No + u32 Freq; // 出現頻度 + s16 ChNo[2]; // 子No (0: 左側, 1: 右側) + u16 PaDepth; // 親ノードの深さ + u16 LeafDepth; // 葉までの深さ + u32 HuffCode; // ハフマン符号 + u8 Bit; // ノードのビットデータ + u16 HWord; // 各中間節点において、その節点をルートとする部分木を HuffTree 格納に必要なメモリ量 +} +HuffData; + +typedef struct +{ + u8 leftOffsetNeed; // 左の子節点へのオフセットが必要なら1 + u8 rightOffsetNeed; // 右の子節点へのオフセットが必要なら1 + u16 leftNodeNo; // 左の子節点No + u16 rightNodeNo; // 右の子節点No +} +HuffTreeCtrlData; + +// ハフマンワークバッファ構成 +typedef struct +{ + HuffData huffTable[ 512 ]; // huffTable[ 512 ]; 12288B + u8 huffTree [ 256 * 2 ]; // huffTree[ 256 * 2 ]; 512B + HuffTreeCtrlData huffTreeCtrl[ 256 ]; // huffTreeCtrl[ 256 ]; 1536B + u16 huffTreeTop; // + u8 bitSize; // + u8 padding_[1]; // +} +HuffCompressionInfo; // 計 14340B + +static void HuffInitTable( HuffCompressionInfo* info, u8 bitSize ); +static void HuffCountData( HuffData* table, const u8 *srcp, u32 size, u8 bitSize ); +static void HuffConstructTree( HuffCompressionInfo *info, u8 bitSize ); +static u32 HuffExportTree( u8* dstp, HuffCompressionInfo* info ); +static u32 HuffConvertData( const HuffData *table, const u8* srcp, u8* dstp, u32 srcSize, u8 bitSize ); + +static void HuffAddParentDepthToTable( HuffData *table, u16 leftNo, u16 rightNo ); +static void HuffAddCodeToTable ( HuffData *table, u16 nodeNo, u32 paHuffCode ); +static u16 HuffAddCountHWordToTable ( HuffData *table, u16 nodeNo ); + +static u16 HuffMakeNode ( HuffData* table, u8 bitSize ); +static void HuffMakeHuffTree ( HuffCompressionInfo* info, u16 rootNo ); +static void HuffMakeSubsetHuffTree ( HuffCompressionInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ); +static BOOL HuffRemainingNodeCanSetOffset( HuffCompressionInfo* info, u16 costHWord ); +static void HuffSetOneNodeOffset ( HuffCompressionInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ); + +HuffCompressionInfo sHuffCompressionInfo; + +/*---------------------------------------------------------------------------* + Name: HuffCompWrite + Description: ハフマン圧縮 + Arguments: *srcp + size + *dstp + huffBitSize + Returns: None. + *---------------------------------------------------------------------------*/ +static u32 HuffCompWrite(u8 *srcp, u32 size, u8 *dstp, u8 huffBitSize) +{ + u32 huffDstCount; // 圧縮データのバイト数 + u32 offset; + HuffCompressionInfo* info = &sHuffCompressionInfo; + + u16 huffDataNum = 1 << huffBitSize; // 8->256, 4->16 + + // テーブル初期化 + HuffInitTable( info, huffBitSize ); + + // 出現頻度チェック + HuffCountData( info->huffTable, srcp, size, huffBitSize ); + + // ハフマン符号テーブル作成 + HuffConstructTree( info, huffBitSize ); + + // データ・ヘッダ + if ( size < 0x1000000 && size > 0 ) + { + *(u32 *)dstp = size << 8 | HUFF_CODE_HEADER | huffBitSize; + offset = 4; + } + else + { + *(u32 *)dstp = HUFF_CODE_HEADER | huffBitSize; + *(u32 *)(dstp + 4) = size; + offset = 8; + } + huffDstCount = offset; + + // ハフマンテーブルをバイナリ出力 + huffDstCount += HuffExportTree( &dstp[ huffDstCount ], info ); + + // ハフマンテーブルによるデータ変換 + huffDstCount += HuffConvertData( info->huffTable, srcp, &dstp[ huffDstCount ], size, huffBitSize ); + + return huffDstCount; +} + + + + +/*---------------------------------------------------------------------------* + Name: HuffInitTable + Description: ハフマンテーブルの初期化 + Arguments: table + size + Returns: None. + *---------------------------------------------------------------------------*/ +static void HuffInitTable( HuffCompressionInfo* info, u8 bitSize ) +{ + u32 tableSize = (1 << bitSize); + u32 i; + + info->huffTreeTop = 1; + info->bitSize = bitSize; + + // huffTableを初期化 + { + HuffData* table = info->huffTable; + + const HuffData HUFF_TABLE_INIT_DATA = { 0, 0, 0, {-1, -1}, 0, 0, 0, 0, 0 }; + for ( i = 0; i < tableSize * 2U; i++ ) + { + table[ i ] = HUFF_TABLE_INIT_DATA; + table[ i ].No = (u16)i; + } + } + + // huffTree, huffTreeCtrlを初期化 + { + const HuffTreeCtrlData HUFF_TREE_CTRL_INIT_DATA = { 1, 1, 0, 0 }; + u8* huffTree = info->huffTree; + HuffTreeCtrlData* huffTreeCtrl = info->huffTreeCtrl; + + for ( i = 0; i < 256; i++ ) + { + huffTree[ i * 2 ] = 0; + huffTree[ i * 2 + 1 ] = 0; + huffTreeCtrl[ i ] = HUFF_TREE_CTRL_INIT_DATA; + } + } +} + + +/*---------------------------------------------------------------------------* + Name: HuffCountData + Description: 出現頻度のカウント + Arguments: table + *srcp + size + bitSize + Returns: None. + *---------------------------------------------------------------------------*/ +static void HuffCountData( HuffData* table, const u8 *srcp, u32 size, u8 bitSize ) +{ + u32 i; + u8 tmp; + + if ( bitSize == 8 ) + { + for ( i = 0; i < size; i++ ) + { + table[ srcp[ i ] ].Freq++; // 8ビット符号化 + } + } + else + { + for ( i = 0; i < size; i++ ) // 4ビット符号化 + { + tmp = (srcp[ i ] & 0xf0) >> 4; + table[ tmp ].Freq++; // 上位4ビットから先に格納// どっちでもいい + tmp = srcp[ i ] & 0x0f; + table[ tmp ].Freq++; // 問題は符号化のとこ + } + } +} + + +/*---------------------------------------------------------------------------* + Name: HuffConstructTree + Description: ハフマンツリーを構築 + Arguments: *table + dataNum + Returns: None. + *---------------------------------------------------------------------------*/ +static void HuffConstructTree( HuffCompressionInfo *info, u8 bitSize ) +{ + HuffData* table = info->huffTable; + u16 rootNo; // 二分木のルートNo + + // 出現頻度からノードを構築 + rootNo = HuffMakeNode( table, bitSize ); + + // ハフマンコード生成 (table[i].HuffCode に) + HuffAddCodeToTable( table, rootNo, 0x00 ); // PaDepthのビット数だけ、HuffCode の下位ビットをマスクしたものがハフマンコード + + // 各中間節点において、その節点をルートとする部分木を huffTree 格納に必要なメモリ量の計算 + HuffAddCountHWordToTable( table, rootNo ); + + // sHuffTreeBuf.huffTree 作成 + HuffMakeHuffTree( info, rootNo ); + + info->huffTree[0] = (u8)( --info->huffTreeTop ); +} + + +/*---------------------------------------------------------------------------* + Name: HuffMakeNode + Description: 出現頻度からノードデータを構築 + Arguments: table + Returns: None. + *---------------------------------------------------------------------------*/ +static u16 +HuffMakeNode( HuffData* table, u8 bitSize ) +{ + u16 dataNum = ( 1 << bitSize ); + u16 tableTop = (u16)dataNum; // テーブル作成時の、テーブルトップNo + + u32 i; + s32 leftNo, rightNo; // 2分木作成時のノードNo + u16 rootNo; // 二分木のルートNo + + leftNo = -1; + rightNo = -1; + while ( 1 ) + { + // Freqの小さい部分木頂点を2つ探す 1つは必ず見つかるはず + // 子頂点(左)の探索 + for ( i = 0; i < tableTop; i++ ) + { + if ( ( table[i].Freq == 0 ) || + ( table[i].PaNo != 0 ) ) + { + continue; + } + + if ( leftNo < 0 ) + { + leftNo = i; + } + else if ( table[i].Freq < table[ leftNo ].Freq ) + { + leftNo = i; + } + } + + // 子頂点(右)の探索 + for ( i = 0; i < tableTop; i++ ) + { + if ( ( table[i].Freq == 0 ) || + ( table[i].PaNo != 0 ) || + ( i == leftNo ) ) + { + continue; + } + + if ( rightNo < 0 ) + { + rightNo = i; + } + else if ( table[i].Freq < table[ rightNo ].Freq ) + { + rightNo = i; + } + } + + // 1つしかなかったら、テーブル作成終了 + if ( rightNo < 0 ) + { + // 値が一種類しかない存在しない場合には01どちらも同じ値となるノードを1つ作成する + if ( tableTop == dataNum ) + { + if ( leftNo < 0 ) + { + leftNo = 0; + } + table[ tableTop ].Freq = table[ leftNo ].Freq; + table[ tableTop ].ChNo[0] = (s16)leftNo; + table[ tableTop ].ChNo[1] = (s16)leftNo; + table[ tableTop ].LeafDepth = 1; + table[ leftNo ].PaNo = (s16)tableTop; + table[ leftNo ].Bit = 0; + table[ leftNo ].PaDepth = 1; + } + else + { + tableTop--; + } + rootNo = tableTop; + return rootNo; + } + + // 左部分木と右部分木を統合する頂点作成 + table[ tableTop ].Freq = table[ leftNo ].Freq + table[ rightNo ].Freq; + table[ tableTop ].ChNo[0] = (s16)leftNo; + table[ tableTop ].ChNo[1] = (s16)rightNo; + if ( table[ leftNo ].LeafDepth > table[ rightNo ].LeafDepth ) + { + table[ tableTop ].LeafDepth = (u16)( table[ leftNo ].LeafDepth + 1 ); + } + else + { + table[ tableTop ].LeafDepth = (u16)( table[ rightNo ].LeafDepth + 1 ); + } + + table[ leftNo ].PaNo = table[ rightNo ].PaNo = (s16)( tableTop ); + table[ leftNo ].Bit = 0; + table[ rightNo ].Bit = 1; + + HuffAddParentDepthToTable( table, (u16)leftNo, (u16)rightNo ); + + tableTop++; + leftNo = rightNo = -1; + } +} + + +//----------------------------------------------------------------------- +// 2文木作成時に、部分木を統合したときに、部分木の各構成ノードの深さを+1する +//----------------------------------------------------------------------- +static void HuffAddParentDepthToTable( HuffData *table, u16 leftNo, u16 rightNo ) +{ + table[ leftNo ].PaDepth++; + table[ rightNo ].PaDepth++; + + if ( table[ leftNo ].LeafDepth != 0 ) + { + HuffAddParentDepthToTable( table, (u16)table[ leftNo ].ChNo[0], (u16)table[ leftNo ].ChNo[1] ); + } + if ( table[ rightNo ].LeafDepth != 0 ) + { + HuffAddParentDepthToTable( table, (u16)table[ rightNo ].ChNo[0], (u16)table[ rightNo ].ChNo[1] ); + } +} + +//----------------------------------------------------------------------- +// ハフマンコード生成 +//----------------------------------------------------------------------- +static void HuffAddCodeToTable( HuffData* table, u16 nodeNo, u32 paHuffCode ) +{ + table[ nodeNo ].HuffCode = (paHuffCode << 1) | table[ nodeNo ].Bit; + + if ( table[ nodeNo ].LeafDepth != 0 ) + { + HuffAddCodeToTable( table, (u16)table[ nodeNo ].ChNo[0], table[ nodeNo ].HuffCode ); + HuffAddCodeToTable( table, (u16)table[ nodeNo ].ChNo[1], table[ nodeNo ].HuffCode ); + } +} + + +//----------------------------------------------------------------------- +// 中間ノードが huffTree 作成に必要とするデータ量 +//----------------------------------------------------------------------- +static u16 HuffAddCountHWordToTable( HuffData *table, u16 nodeNo) +{ + u16 leftHWord, rightHWord; + + switch ( table[ nodeNo ].LeafDepth ) + { + case 0: + return 0; + case 1: + leftHWord = rightHWord = 0; + break; + default: + leftHWord = HuffAddCountHWordToTable( table, (u16)table[nodeNo].ChNo[0] ); + rightHWord = HuffAddCountHWordToTable( table, (u16)table[nodeNo].ChNo[1] ); + break; + } + + table[ nodeNo ].HWord = (u16)( leftHWord + rightHWord + 1 ); + return (u16)( leftHWord + rightHWord + 1 ); +} + + +//----------------------------------------------------------------------- +// ハフマンコード表作成 +//----------------------------------------------------------------------- +static void HuffMakeHuffTree( HuffCompressionInfo* info, u16 rootNo ) +{ + s16 i; + s16 costHWord, tmpCostHWord; // 部分木のコード表を作成しなかった時のコスト 最大値の節点の部分木コード表を作る + s16 costOffsetNeed, tmpCostOffsetNeed; + s16 costMaxKey; // コスト最小の節点を huffTreeBuf.huffTree から特定するための情報 + BOOL costMaxRightFlag; + u16 offsetNeedNum; + BOOL tmpRightFlag; + const u32 MAX_COST = 64; + + info->huffTreeTop = 1; + costOffsetNeed = 0; + + info->huffTreeCtrl[0].leftOffsetNeed = 0; // 使用しない (テーブルサイズとして使用) + info->huffTreeCtrl[0].rightNodeNo = rootNo; + + + while ( 1 ) // return するまで + { + // オフセットを設定する必要のあるノード数の計算 + offsetNeedNum = 0; + for ( i = 0; i < info->huffTreeTop; i++ ) + { + if ( info->huffTreeCtrl[ i ].leftOffsetNeed ) + { + offsetNeedNum++; + } + if ( info->huffTreeCtrl[ i ].rightOffsetNeed ) + { + offsetNeedNum++; + } + } + + // 最大コストの節点を検索 + costHWord = -1; + costMaxKey = -1; + tmpRightFlag = 0; + + for ( i = 0; i < info->huffTreeTop; i++ ) + { + tmpCostOffsetNeed = (u16)( info->huffTreeTop - i ); + + // 左の子節点のコスト評価 + if ( info->huffTreeCtrl[i].leftOffsetNeed ) + { + tmpCostHWord = (s16)info->huffTable[ info->huffTreeCtrl[i].leftNodeNo ].HWord; + + if ( (u32)(tmpCostHWord + offsetNeedNum) > MAX_COST ) + { + goto leftCostEvaluationEnd; + } + if ( ! HuffRemainingNodeCanSetOffset( info, (u16)tmpCostHWord ) ) + { + goto leftCostEvaluationEnd; + } + if ( tmpCostHWord > costHWord ) + { + costMaxKey = i; + costMaxRightFlag = 0; + } + else if ( (tmpCostHWord == costHWord) && (tmpCostOffsetNeed > costOffsetNeed) ) + { + costMaxKey = i; + costMaxRightFlag = 0; + } + } +leftCostEvaluationEnd:{} + + if ( info->huffTreeCtrl[i].rightOffsetNeed) + { + tmpCostHWord = (s16)info->huffTable[info->huffTreeCtrl[i].rightNodeNo].HWord; + + if ( (u32)(tmpCostHWord + offsetNeedNum) > MAX_COST ) + { + goto rightCostEvaluationEnd; + } + if ( ! HuffRemainingNodeCanSetOffset( info, (u16)tmpCostHWord ) ) + { + goto rightCostEvaluationEnd; + } + if ( tmpCostHWord > costHWord ) + { + costMaxKey = i; + costMaxRightFlag = 1; + } + else if ( (tmpCostHWord == costHWord) && (tmpCostOffsetNeed > costOffsetNeed) ) + { + costMaxKey = i; + costMaxRightFlag = 1; + } + } +rightCostEvaluationEnd:{} + } + + // 部分木をまるまる huffTree に格納 + if ( costMaxKey >= 0 ) + { + HuffMakeSubsetHuffTree( info, (u16)costMaxKey, costMaxRightFlag); + goto nextTreeMaking; + } + else + { + // 必要オフセット最大のノードを検索 + for ( i = 0; i < info->huffTreeTop; i++ ) + { + u16 tmp = 0; + tmpRightFlag = 0; + if (info->huffTreeCtrl[i].leftOffsetNeed) + { + tmp = info->huffTable[ info->huffTreeCtrl[i].leftNodeNo ].HWord; + } + if (info->huffTreeCtrl[i].rightOffsetNeed) + { + if ( info->huffTable[info->huffTreeCtrl[i].rightNodeNo ].HWord > tmp ) + { + tmpRightFlag = 1; + } + } + if ( (tmp != 0) || (tmpRightFlag) ) + { + HuffSetOneNodeOffset( info, (u16)i, tmpRightFlag); + goto nextTreeMaking; + } + } + } + return; +nextTreeMaking:{} + } +} + +//----------------------------------------------------------------------- +// 部分木をまるまる huffTree に格納 +//----------------------------------------------------------------------- +static void HuffMakeSubsetHuffTree( HuffCompressionInfo* info, u16 huffTreeNo, BOOL rightNodeFlag ) +{ + u16 i; + + i = info->huffTreeTop; + HuffSetOneNodeOffset( info, huffTreeNo, rightNodeFlag ); + + if ( rightNodeFlag ) + { + info->huffTreeCtrl[ huffTreeNo ].rightOffsetNeed = 0; + } + else + { + info->huffTreeCtrl[ huffTreeNo ].leftOffsetNeed = 0; + } + + while ( i < info->huffTreeTop ) + { + if ( info->huffTreeCtrl[ i ].leftOffsetNeed ) + { + HuffSetOneNodeOffset( info, i, 0); + info->huffTreeCtrl[ i ].leftOffsetNeed = 0; + } + if ( info->huffTreeCtrl[ i ].rightOffsetNeed ) + { + HuffSetOneNodeOffset( info, i, 1); + info->huffTreeCtrl[ i ].rightOffsetNeed = 0; + } + i++; + } +} + +//----------------------------------------------------------------------- +// 与えられたデータ量の部分木を展開しても huffTree 構築に支障がないか調べる +//----------------------------------------------------------------------- +static BOOL HuffRemainingNodeCanSetOffset( HuffCompressionInfo* info, u16 costHWord ) +{ + u16 i; + s16 capacity; + const u32 MAX_COST = 64; + + capacity = (s16)( MAX_COST - costHWord ); + + // オフセット数は i が小さいほど大きいので、ソートせず、i = 0 -> huffTreeTop で計算すればよい + for ( i = 0; i < info->huffTreeTop; i++ ) + { + if ( info->huffTreeCtrl[i].leftOffsetNeed ) + { + if ( (info->huffTreeTop - i) <= capacity ) + { + capacity--; + } + else + { + return 0; + } + } + if ( info->huffTreeCtrl[i].rightOffsetNeed ) + { + if ( (info->huffTreeTop - i) <= capacity ) + { + capacity--; + } + else + { + return 0; + } + } + } + + return 1; +} + + +/*---------------------------------------------------------------------------* + Name: HuffSetOneNodeOffset + Description: 1節点分、ハフマンコード表を作成 + Arguments: *table ハフマンテーブル + huffTreeNo + rightNodeFlag 右側のノードであるかどうかのフラグ + Returns: None. + *---------------------------------------------------------------------------*/ +static void HuffSetOneNodeOffset( HuffCompressionInfo* info, u16 huffTreeNo, BOOL rightNodeFlag) +{ + u16 nodeNo; + u16 offsetData = 0; + + HuffData* huffTable = info->huffTable; + u8* huffTree = info->huffTree; + HuffTreeCtrlData* huffTreeCtrl = info->huffTreeCtrl; + u16 huffTreeTop = info->huffTreeTop; + + if (rightNodeFlag) + { + nodeNo = huffTreeCtrl[ huffTreeNo ].rightNodeNo; + huffTreeCtrl[ huffTreeNo ].rightOffsetNeed = 0; + } + else + { + nodeNo = huffTreeCtrl[ huffTreeNo ].leftNodeNo; + huffTreeCtrl [huffTreeNo ].leftOffsetNeed = 0; + } + + // 左の子節点 + if ( huffTable[ huffTable[nodeNo].ChNo[0] ].LeafDepth == 0) + { + offsetData |= 0x80; + huffTree[ huffTreeTop * 2 + 0 ] = (u8)huffTable[ nodeNo ].ChNo[0]; + huffTreeCtrl[ huffTreeTop ].leftNodeNo = (u8)huffTable[ nodeNo ].ChNo[0]; + huffTreeCtrl[ huffTreeTop ].leftOffsetNeed = 0; // オフセットは必要なくなる + } + else + { + huffTreeCtrl[ huffTreeTop ].leftNodeNo = (u16)huffTable[ nodeNo ].ChNo[0]; // オフセットは必要 + } + + // 右の子節点 + if ( huffTable[ huffTable[ nodeNo ].ChNo[1] ].LeafDepth == 0 ) + { + offsetData |= 0x40; + huffTree[ huffTreeTop * 2 + 1 ] = (u8)huffTable[nodeNo].ChNo[1]; + huffTreeCtrl[ huffTreeTop ].rightNodeNo = (u8)huffTable[ nodeNo ].ChNo[1]; + huffTreeCtrl[ huffTreeTop ].rightOffsetNeed = 0; // オフセットは必要なくなる + } + else + { + huffTreeCtrl[ huffTreeTop ].rightNodeNo = (u16)huffTable[ nodeNo ].ChNo[1]; // オフセットは必要 + } + + offsetData |= (u16)( huffTreeTop - huffTreeNo - 1 ); + huffTree[ huffTreeNo * 2 + (rightNodeFlag? 1 : 0) ] = (u8)offsetData; + + info->huffTreeTop++; +} + + +/*---------------------------------------------------------------------------* + Name: HuffExportTree + + Description: ハフマンテーブルをバイナリ出力 + + Arguments: dstp + info + bitSize + + Returns: + *---------------------------------------------------------------------------*/ +static u32 HuffExportTree( u8* dstp, HuffCompressionInfo* info ) +{ + u32 cnt = 0; + s32 i; + + for ( i = 0; i < (info->huffTreeTop + 1) * 2; i++ ) // ツリーテーブル + { + dstp[ cnt++ ] = ((u8*)info->huffTree)[ i ]; + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含める (デコーダのアルゴリズムによる) + while ( cnt & 0x3 ) + { + if ( cnt & 0x1 ) + { + info->huffTreeTop++; + dstp[ 0 ] = dstp[ 0 ] + 1; + } + dstp[ cnt++ ] = 0; + } + return cnt; +} + + +/*---------------------------------------------------------------------------* + Name: HuffConvertData + Description: ハフマンテーブルを元にデータ変換 + Arguments: *table + srcp + dstp + srcSize + bitSize + Returns: None. + *---------------------------------------------------------------------------*/ +static u32 HuffConvertData( const HuffData *table, const u8* srcp, u8* dstp, u32 srcSize, u8 bitSize ) +{ + u32 i, ii, iii; + u8 srcTmp; + u32 bitStream = 0; + u32 streamLength = 0; + u32 dstSize = 0; + + // ハフマン符号化 + for ( i = 0; i < srcSize; i++ ) + { // データ圧縮 + u8 val = srcp[ i ]; + if ( bitSize == 8 ) + { // 8ビットハフマン + bitStream = (bitStream << table[ val ].PaDepth) | table[ val ].HuffCode; + streamLength += table[ val ].PaDepth; + for ( ii = 0; ii < streamLength / 8; ii++ ) + { + dstp[ dstSize++ ] = (u8)(bitStream >> (streamLength - (ii + 1) * 8)); + } + streamLength %= 8; + } + else // 4ビットハフマン + { + for ( ii = 0; ii < 2; ii++ ) + { + if ( ii ) + { + srcTmp = val >> 4; // 上位4ビットが後 + } + else + { + srcTmp = val & 0x0F; // 下位4ビットが先( デコーダがLittleEndianでアクセスする関係 ) + } + bitStream = (bitStream << table[ srcTmp ].PaDepth) | table[ srcTmp ].HuffCode; + streamLength += table[srcTmp].PaDepth; + for ( iii = 0; iii < streamLength / 8; iii++ ) + { + dstp[ dstSize++ ] = (u8)(bitStream >> (streamLength - (iii + 1) * 8)); + } + streamLength %= 8; + } + } + } + if ( streamLength != 0 ) + { + dstp[ dstSize++ ] = (u8)(bitStream << (8 - streamLength)); + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含め「る」 + // ハフマン符号化だけ特別! リトルエンディアン変換するため、アラインメント境界データより後にデータが格納される + while ( dstSize & 0x3 ) + { + dstp[ dstSize++ ] = 0; + } + + // リトルエンディアン変換 + for ( i = 0; i < dstSize / 4; i++ ) + { + u8 tmp; + tmp = dstp[i * 4 + 0]; + dstp[i * 4 + 0] = dstp[i * 4 + 3]; + dstp[i * 4 + 3] = tmp; // スワップ + tmp = dstp[i * 4 + 1]; + dstp[i * 4 + 1] = dstp[i * 4 + 2]; + dstp[i * 4 + 2] = tmp; // スワップ + } + return dstSize; +} + + + +/*---------------------------------------------------------------------------* + Name: HuffVerifyTable + + Description: ハフマンテーブルの整合性をチェック + + Arguments: ハフマンテーブルへのポインタ + + Returns: 正常なテーブルの場合には TRUE + 不正なテーブルの場合には FALSE + *---------------------------------------------------------------------------*/ +static BOOL +HuffVerifyTable( const void* pTable, u8 bit ) +{ + enum { FLAGS_ARRAY_NUM = 512 / 8 }; /* 64Byte */ + u8* treep = (u8*)pTable; + u8* treeStartp = treep + 1; + u32 treeSize = *treep; + u8* treeEndp = (u8*)pTable + (treeSize + 1) * 2; + u32 i; + u8 end_flags[ FLAGS_ARRAY_NUM ]; + u32 idx; + + for ( i = 0; i < FLAGS_ARRAY_NUM; i++ ) + { + end_flags[ i ] = 0; + } + + if ( bit == 4 ) + { + if ( treeSize >= 0x10 ) + { + return FALSE; + } + } + + idx = 1; + treep = treeStartp; + while ( treep < treeEndp ) + { + if ( (end_flags[ idx / 8 ] & (1 << (idx % 8) )) == 0 ) + { + u32 offset = (u32)( ( (*treep & 0x3F) + 1 ) << 1); + u8* nodep = (u8*)( (((u32)treep >> 1) << 1) + offset ); + + // 終端のアライメント用データは読み飛ばす + if ( *treep == 0 && idx >= (treeSize * 2) ) + { + goto next; + } + if ( nodep >= treeEndp ) + { + return FALSE; + } + if ( *treep & 0x80 ) + { + u32 left = (idx & ~0x1) + offset; + end_flags[ left / 8 ] |= (u8)( 1 << (left % 8) ); + } + if ( *treep & 0x40 ) + { + u32 right = (idx & ~0x1) + offset + 1; + end_flags[ right / 8 ] |= (u8)( 1 << (right % 8) ); + } + } + next: + ++idx; + ++treep; + } + return TRUE; +} + + + + +//############################################################################################## +//############################################################################################## +// 展開関連の関数は以下 +//############################################################################################## +//############################################################################################## + +//================================================================================== +// Rawデータ展開 +//================================================================================== +static s32 RawRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize ) +{ +// memcpy(dstp, srcp, size); + u32 i; + + if ( srcSize < dstSize ) + { + return -1; + } + + for (i = 0; i < dstSize; i++) + { + *dstp = *srcp; + dstp++; + srcp++; + } + + return dstSize; +} + +//================================================================================== +// 差分圧縮データ展開 +//================================================================================== +static s32 DiffFiltRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, u8 diffBitSize ) +{ + s32 DiffCount = 0; // 展開データのバイト数 + u32 i; + + u16 *src16p = (u16 *)srcp; + u16 *dst16p = (u16 *)dstp; + + // ソースのバッファオーバーフローチェック + if ( dstSize > srcSize ) + { + return -1; + } + + if (diffBitSize == 8) + { +#ifdef DEBUG_PRINT_DIFFFILT + for (i = 0; i < 16; i++) + { + dbg_printf_dif(stderr, "srcp[%d] = %x\n", i, srcp[i]); + } +#endif + dstp[DiffCount] = srcp[0]; // 先頭データのみ差分無し + DiffCount++; + for (i = 1; i < dstSize; i++, DiffCount++) + { + dbg_printf_dif(stderr, "dstp[%x] = srcp[%d]+dstp[%d] = %x + %x = %x\n", + DiffCount, i, i - 1, srcp[i], dstp[i - 1], srcp[i] - dstp[i - 1]); + dstp[DiffCount] = srcp[i] + dstp[i - 1]; // 差分データ格納 + } + } + else // 16ビットサイズ + { + dst16p[DiffCount / 2] = src16p[0]; + DiffCount += 2; + for (i = 1; i < dstSize / 2; i++, DiffCount += 2) + { + dst16p[DiffCount / 2] = src16p[i] + dst16p[i - 1]; + } + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((DiffCount + i) & 0x3) + { + dstp[DiffCount + i] = 0; + i++; + } + + return DiffCount; +} + +//================================================================================== +// ランレングス圧縮データ展開 +//================================================================================== +static s32 RLCompRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize ) +{ + u32 RLDstCount; // 展開データのバイト数 + u32 RLSrcCount; // 展開対象データの処理済データ量(バイト単位) + u32 i; + + RLSrcCount = 0; + RLDstCount = 0; + while ( RLDstCount < dstSize ) + { + if ( srcp[ RLSrcCount ] & 0x80 ) // 復号処理(ランレングス符号化されている) + { + u8 length = (srcp[ RLSrcCount++ ] & 0x7f) + 3; // データ長を格納(3の下駄を履いているので、実際は+3して考える) + // バッファオーバーランチェック + if ( RLSrcCount >= srcSize ) + { + return -1; + } + if ( RLDstCount + length > dstSize ) + { + return -1; + } + for ( i = 0; i < length; i++ ) + { + dstp[ RLDstCount++ ] = srcp[ RLSrcCount ]; + } + RLSrcCount++; + } + else // 生データをコピー(ランレングス符号化されていない) + { + u8 length = srcp[ RLSrcCount++ ] + 1; // (srcp[RLSrcCount] & 0x7f と同じ) + // バッファオーバーランチェック + if ( RLSrcCount + length > srcSize ) + { + return -1; + } + if ( RLDstCount + length > dstSize ) + { + return -1; + } + + for ( i = 0; i < length; i++ ) + { // データ長は -1 されて格納されているため +1 + dstp[ RLDstCount++ ] = srcp[ RLSrcCount++ ]; + } + } + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ((RLDstCount + i) & 0x3) + { + dstp[RLDstCount + i] = 0; + i++; + } + + return RLDstCount; +} + +//================================================================================== +// LZ77圧縮データ展開 +//================================================================================== +static s32 LZCompReadEx( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, BOOL ex_available) +{ + u32 LZDstCount; // 展開データのバイト数 + u32 LZSrcCount; // 展開対象データの処理済データ量(バイト単位) + u32 i; + + LZSrcCount = 0; + LZDstCount = 0; + + while ( LZDstCount < dstSize ) + { + u8 compFlags = srcp[LZSrcCount++]; // 圧縮の有無を示すフラグ列 + if ( LZSrcCount > srcSize ) + { + return -1; + } + + for ( i = 0; i < 8; i++ ) + { + if (compFlags & 0x80) // 圧縮されている + { + u32 length; // 対象データ長 + u16 offset; // 一致データオフセット - 1 (常に2以上)(下位4ビット,offsetでは11-8ビット目) + + length = srcp[ LZSrcCount ] >> 4; + + if ( ex_available ) + { + if ( length == 1 ) + { + length = (srcp[ LZSrcCount ] & 0x0F) << 12; + LZSrcCount++; + length |= srcp[ LZSrcCount ] << 4; + LZSrcCount++; + length |= srcp[ LZSrcCount ] >> 4; + length += 0xFF + 0xF + 3; + } + else if ( length == 0 ) + { + length = (srcp[ LZSrcCount ] & 0x0F) << 4; + LZSrcCount++; + length |= srcp[ LZSrcCount ] >> 4; + length += 0xF + 2; + } + else + { + length += 1; + } + } + else + { + length += 3; + } + offset = (srcp[LZSrcCount] & 0x0F) << 8; + LZSrcCount++; + offset |= srcp[LZSrcCount]; + offset++; + LZSrcCount++; + + // バッファオーバーランをチェック + if ( LZSrcCount > srcSize ) + { + return -1; + } + if ( LZDstCount + length > dstSize ) + { + return -1; + } + if ( LZDstCount < offset ) + { + return -1; + } + + // 展開処理 + do + { + dstp[ LZDstCount++ ] = dstp[ LZDstCount - offset ]; + } while ( --length > 0 ); + } + else // 圧縮無し + { + dstp[ LZDstCount++ ] = srcp[ LZSrcCount++ ]; + if ( LZSrcCount > srcSize ) + { + return -1; + } + } + // サイズに達したら終了 + if ( LZDstCount >= dstSize ) + { + break; + } + compFlags <<= 1; + } + } + + // 4バイト境界アラインメント + // アラインメント用データ0 はデータサイズに含めない + i = 0; + while ( (LZDstCount + i) & 0x3 ) + { + dstp[ LZDstCount + i ] = 0; + i++; + } + return LZDstCount; +} + + +//================================================================================== +// ハフマン符号化データ展開 +//================================================================================== +static s32 HuffCompRead( const u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize, u8 huffBitSize ) +{ + u16 treeSize; // huffTreeのサイズ * 2 + u32 HuffSrcCount; // 展開対象データの処理済データ量(バイト単位) + u32 HuffDstCount; // 展開データ + u32 currentBitStream; + u8 currentBit; + u16 treeAddr; + u8 treeData; + u8 preTreeData; + u8 isUpper4bits = 0; + + treeSize = ((*srcp) + 1) * 2; + HuffSrcCount = treeSize; // データの先頭を取得 + HuffDstCount = 0; + treeAddr = 1; + preTreeData = srcp[ 1 ]; + + dbg_printf_huff(stderr, "HuffSrcCount = %d\n", HuffSrcCount); + + // ハフマンテーブルの整合性チェック + if ( ! HuffVerifyTable( srcp, huffBitSize ) ) + { + return -1; + } + if ( srcSize < treeSize ) + { + return -1; + } + + // 展開処理 + while ( HuffDstCount < dstSize ) // return まで + { + u16 i; + + currentBitStream = srcp[HuffSrcCount++]; + currentBitStream |= srcp[HuffSrcCount++] << 8; + currentBitStream |= srcp[HuffSrcCount++] << 16; + currentBitStream |= srcp[HuffSrcCount++] << 24; + + if ( HuffSrcCount > srcSize ) + { + return -1; + } + + for ( i = 0; i < 32; i++ ) + { + currentBit = (u8)(currentBitStream >> 31); + currentBitStream <<= 1; + + if (((currentBit == 0) && (preTreeData & 0x80)) || + ((currentBit == 1) && (preTreeData & 0x40))) + { + if (huffBitSize == 8) + { + treeData = srcp[(treeAddr * 2) + currentBit]; // 符号データ + dstp[HuffDstCount++] = treeData; + } + else if (isUpper4bits) + { + treeData |= (srcp[(treeAddr * 2) + currentBit]) << 4; + dstp[HuffDstCount++] = treeData; + isUpper4bits = 0; + } + else + { + treeData = srcp[(treeAddr * 2) + currentBit]; + isUpper4bits = 1; + } + + if (HuffDstCount >= dstSize) + { + return HuffDstCount; + } + + treeAddr = 1; + preTreeData = srcp[ 1 ]; + } + else + { + preTreeData = srcp[(treeAddr * 2) + currentBit]; // オフセット・データ + treeAddr += (preTreeData & 0x3f) + 1; + } + } + } + return HuffDstCount; +} + + +//================================================================================== +// 圧縮ファイルの元ファイルサイズ取得 +//================================================================================== +EXTERN u32 STDCALL nitroGetDecompFileSize( const void* srcp ) +{ + const u32* p = (const u32*)srcp; + + u32 size = *p >> 8; + if ( size == 0 ) + { + size = *(p + 1); + } + return size; +} + + +//================================================================================== +// データ展開制御関数 (自動展開のため、最後にrawデータ展開用ヘッダがないと動作しない) +//================================================================================== +EXTERN s32 STDCALL nitroDecompress( const u8 *srcp, u32 srcSize, u8 *dstp, s8 depth ) +{ + // rawData // データ・ヘッダ + // *(u32 *)pReadBuf = size << 8 | 0; + // [i+3] [i+2] [i+1](サイズ) | [0000 0000] + // DiffFilt + // *(u32 *)dstp = size << 8 | 0x80 | diffBitSize/8; + // [i+3] [i+2] [i+1](サイズ) | [1000 00XX] + // RL + // *(u32 *)dstp = size << 8 | 0x30; + // [i+3] [i+2] [i+1](サイズ) | [0011 0000] + // LZ77 + // *(u32 *)dstp = size << 8 | 0x10; + // [i+3] [i+2] [i+1](サイズ) | [0001 0000] + // Huffman + // *(u32 *)dstp = size << 8 | 0x20 | huffBitSize; + // [i+3] [i+2] [i+1](サイズ) | [0010 XX00] + u32 header; + s32 dstSize; + u32 memSize = srcSize * 3 + 256 * 2; + u8 *pReadBuf; // 圧縮データの先頭番地を指すポインタ + u8 offset; + s8 curDepth = 0; + s8 targetDepth; + + pCompBuf[0] = (u8 *)malloc(memSize); + pCompBuf[1] = (u8 *)malloc(memSize); + pReadBuf = pCompBuf[0]; + + // malloc チェック + if (pCompBuf[0] == NULL || pCompBuf[1] == NULL) + { + fprintf(stderr, "Error: Memory is not enough.\n"); + exit(1); + } + + compBufNo = 1; + memcpy(pReadBuf, srcp, srcSize); + + if (depth < 1) + { + targetDepth = -1; + } + else + { + targetDepth = depth; + } + dbg_printf(stderr, "nitroCompress \t(Compressed size is 0x%x)\n", srcSize); + + while (1) + { + // targetDepth指定の際の終了条件 + if (curDepth == targetDepth) + { + dbg_printf(stderr, "nitroDecompress Raw \t(Decompressed size will be 0x%x)\n", + dstSize); + dstSize = RawRead(pReadBuf, dstSize, dstp, dstSize); + + if (pCompBuf[0] != NULL) + { + free(pCompBuf[0]); + pCompBuf[0] = NULL; + } + if (pCompBuf[1] != NULL) + { + free(pCompBuf[1]); + pCompBuf[1] = NULL; + } + return dstSize; + } + + header = *(u32 *)pReadBuf; + dstSize = header >> 8; // ヘッダを含まないサイズ, 展開関数にもヘッダを含めずに渡す + offset = 4; + + if ( dstSize == 0 ) + { + dstSize = *(u32 *)(pReadBuf + 4); + offset = 8; + } + + if ( memSize < (u32)dstSize ) + { + memSize = dstSize * 3 + 256 * 2; + pCompBuf[0] = (u8 *)realloc(pCompBuf[0], memSize); + pCompBuf[1] = (u8 *)realloc(pCompBuf[1], memSize); + pReadBuf = pCompBuf[compBufNo ^ 0x1]; + + } + + switch (header & CODE_HEADER_MASK) + { + case DIFF_CODE_HEADER: + { + dbg_printf(stderr, "nitroDecompress Diff %d \t(Decompressed size will be 0x%x)\n", + ((u8)header & 0x03) * 8, dstSize ); + dstSize = + DiffFiltRead(&pReadBuf[offset], srcSize - offset, pCompBuf[compBufNo], dstSize, + ((u8)header & 0x03) * 8); + } + break; + case HUFF_CODE_HEADER: + { + dbg_printf(stderr, "nitroDecompress Huff %d \t(Decompressed size will be 0x%x)\n", + ((u8)header & 0x0f), dstSize); + dstSize = + HuffCompRead(&pReadBuf[offset], srcSize - offset, pCompBuf[compBufNo], dstSize, (u8)header & 0x0f); + } + break; + case LZ_CODE_HEADER: + { + BOOL ex_format = ((header & 0xF) == 0)? FALSE : TRUE; + + dbg_printf(stderr, "nitroDecompress LZ \t(Decompressed size will be 0x%x)\n", + dstSize); + dstSize = LZCompReadEx(&pReadBuf[offset], srcSize - offset, pCompBuf[compBufNo], dstSize, ex_format); + } + break; + case RL_CODE_HEADER: + { + dbg_printf(stderr, "nitroDecompress RL \t(Decompressed size will be 0x%x)\n", + dstSize); + dstSize = RLCompRead(&pReadBuf[offset], srcSize - offset, pCompBuf[compBufNo], dstSize); + } + break; + default: + { + dbg_printf(stderr, "nitroDecompress Raw \t(Decompressed size will be 0x%x)\n", + dstSize); + + dstSize = RawRead(&pReadBuf[offset], srcSize - offset, dstp, dstSize); + if (pCompBuf[0] != NULL) + { + free(pCompBuf[0]); + pCompBuf[0] = NULL; + } + if (pCompBuf[1] != NULL) + { + free(pCompBuf[1]); + pCompBuf[1] = NULL; + } + return dstSize; + } + } + + if ( dstSize < 0 ) + // 不正なファイルで解凍に失敗 + { + dbg_printf(stderr, "decompress fail\n"); + return -1; + } + + // もう一周 + pReadBuf = pCompBuf[compBufNo]; + compBufNo ^= 0x01; + srcSize = dstSize; + curDepth++; + } +} + +//================================================================================== +// メモリ内容を16進で出力 +//================================================================================== +EXTERN void STDCALL debugMemPrint(FILE * fp, u8 *str, u32 size) +{ + u32 i = 0; + + while (str) + { + fprintf(fp, "%4lx:\t0x%2x\n", i, *str); + str++; + i++; + if (i >= size) + { + break; + } + } +} + +//================================================================================== +// メモリ内容を2進で出力 +//================================================================================== +EXTERN void STDCALL debugMemBitPrint(FILE * fp, u8 *str, u32 size) +{ + u32 i = 0; + u8 j; + + while (str) + { + if (i >= size) + { + break; + } + + fprintf(fp, "%4lx:\t0x%2x\t(binary\t", i, *str); + for (j = 0; j < 8; j++) + { + fprintf(fp, "%d", *str >> (7 - j) & 0x01); + } + fprintf(fp, " )\n"); + str++; + i++; + } +} + +//================================================================================== +// 圧縮前と展開後のデータの比較(正しく展開できていれば、"DATA match"と出力される) +//================================================================================== +EXTERN int STDCALL matchingCheck(u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize) +{ + u32 minSize, i; + u8 dataMatchFlag = 1; + u8 sizeMatchFlag; + + sizeMatchFlag = (srcSize == dstSize); + if (srcSize < dstSize) + { + minSize = srcSize; + } + else + { + minSize = dstSize; + } + + for (i = 0; i < minSize; i++) + { + dbg_printf_match(stderr, "src[%3x], dst[%3x] = %2x , %2x", i, i, srcp[i], dstp[i]); + if (srcp[i] != dstp[i]) + { + dataMatchFlag = 0; + dbg_printf_match(stderr, "\t; mismatch here!"); + } + dbg_printf_match(stderr, "\n"); + } + + if (sizeMatchFlag) + { + fprintf(stderr, "\nSIZE match.\n"); + } + else + { + fprintf(stderr, "\nSIZE mismatch!\n"); + } + + if (dataMatchFlag) + { + fprintf(stderr, "DATA match.\n"); + } + else + { + fprintf(stderr, "DATA mismatch!\n"); + } + + if (dataMatchFlag && sizeMatchFlag) + { + return 1; + } + else + { + return 0; + } +} + + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.h b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.h new file mode 100644 index 00000000..7c96d8db --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/nitroCompLib.h @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: nitroCompLib.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +// nitroCompLib.h : nitroCompLib.DLL のメイン ヘッダー ファイル +// + +#ifndef __NITROCOMPLIB_H__ +#define __NITROCOMPLIB_H__ + +//=========================================================================================== +// インクルード +//=========================================================================================== +#include +#include +#include +#include +#include "types.h" + +#ifdef WIN32 +#define STDCALL __stdcall +#else +#define STDCALL +#endif + +//=========================================================================================== +// プロトタイプ宣言 +//=========================================================================================== +// C++用 +#ifdef __cplusplus + extern "C" + { +#endif + +//BOOL WINAPI DllMain( HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved); +u8* STDCALL nitroCompMalloc( u32 size ); +void STDCALL nitroCompFree( u8 *p ); +u32 STDCALL nitroCompress ( const u8 *srcp, u32 srcSize, u8 *dstp, char *compList, u8 rawHeader ); +s32 STDCALL nitroDecompress( const u8 *srcp, u32 srcSize, u8 *dstp, s8 depth ); +void STDCALL debugMemPrint ( FILE * fp, u8 *str, u32 size ); +void STDCALL debugMemBitPrint( FILE * fp, u8 *str, u32 size ); +int STDCALL matchingCheck( u8 *srcp, u32 srcSize, u8 *dstp, u32 dstSize ); +u32 STDCALL nitroGetDecompFileSize( const void* srcp ); + +#ifdef __cplusplus + } +#endif + +//=========================================================================================== +// 関数の使用法 +//=========================================================================================== +//---------------------------------------------------------------------------------- +// 圧縮後のデータを置くためのメモリ領域を確保 +// 圧縮前のデータの2倍の領域を確保する +// 引数 +// u32 size 圧縮前のデータサイズ +// u32 は符号無し整数型でたいていは、 +// unsigned int (処理系依存) +// 返り値 +// u8 * 圧縮後のデータ領域を指すポインタ +// (汎用ポインタなので、好きな型にキャスト) +// ではない +//---------------------------------------------------------------------------------- +//u8 *nitroCompMalloc(u32 size); + +//---------------------------------------------------------------------------------- +// 圧縮後のデータを置いていたメモリ領域を解放 +// 引数 +// u8 *p 圧縮後のデータ領域を指すポインタ +//---------------------------------------------------------------------------------- +//void nitroCompFree(u8 *p); + +//---------------------------------------------------------------------------------- +// データを圧縮する +// 圧縮方式、圧縮順序は引数compListを用いて指示する +// 引数 +// u8 *srcp 圧縮対象データを指すポインタ +// u32 size 圧縮対象データのサイズ(単位はバイト) +// u8 *dstp 圧縮後のデータを保持するデータ領域を指すポインタ +// 十分な領域を確保しておく必要あり +// nitroCompMallocの返り値でよい +// char *compList 圧縮方式、圧縮順序を格納したリスト (C言語のヌル文字列) +// d8 : 8ビット差分フィルタ +// d16 : 16ビット差分フィルタ +// r : ランレングス符号化 +// lx : LZ77.xには同一データ検索の開始点を示すオフセット +// : 2以上でなければならない.上限は255. +// h4 : 4ビット・ハフマン圧縮 +// h8 : 8ビット・ハフマン圧縮 +// u8 rawHeaderFlag 圧縮前のデータであることを示すヘッダ情報を付加するかどうかを +// 指示するフラグ.0であれば付加せず、1であれば、展開しきった +// データにもヘッダが付加される. +// 返り値 +// 圧縮後のデータサイズ +//---------------------------------------------------------------------------------- +//u32 nitroCompress(u8 *srcp, u32 size, u8 *dstp, char *compList, u8 rawHeader); + +//---------------------------------------------------------------------------------- +// データを展開する +// 展開方式、展開順序はデータのヘッダを見て判断する +// 引数 +// u8 *srcp 展開対象データを指すポインタ +// u32 size 展開対象データのサイズ(単位はバイト) +// u8 *dstp 展開後のデータを保持するデータ領域を指すポインタ +// 十分な領域を確保しておく必要あり +// nitroCompMallocの返り値でよい +// u8 depth 展開する深さ(回数) +// 0未満の場合は、圧縮前データを示すヘッダ情報が得られるまで展開し続ける +// 返り値 +// 展開後のデータサイズ +//---------------------------------------------------------------------------------- +//u32 nitroDecompress(u8 *srcp, u32 size, u8 *dstp, s8 depth); + +#endif // __NITROCOMPLIB_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_main.c b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_main.c new file mode 100644 index 00000000..ce37efb2 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_main.c @@ -0,0 +1,1164 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: ntcompress_main.c + + Copyright 2007 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 "nitroCompLib.h" +#include "ntcompress_test.h" +#include "multipleCompLib.h" +#include "rangeCoder.h" + +#define FOR_NITRO + +#if defined( FOR_NITRO ) + #define INCLUDE_TARGET "nitro" + #define TARGET_NAME "ntrcomp" + #define NTCOMPRESS_VERSION "1.1.0" +#else // for revolution + #define SUPPORT_LH_LRC + #define INCLUDE_TARGET "revolution" + #define TARGET_NAME "ntcompress" + #define NTCOMPRESS_VERSION "2.0.0" +#endif + + +#define uint unsigned int +#define ushort unsigned short +#define ulong unsigned long +#define uchar unsigned char + + +#define ROUNDUP(x,n) (((x) + ((n) - 1)) & (~((n)-1))) +#define ROUNDUP4(x) ROUNDUP((x),4) + +#define TEXT_BIG_ENDIAN_FLAG 0x10 +#define TEXT_WIDTH_MASK 0x07 + +//--------------------------------------------------------------------------- +// 型定義 +//--------------------------------------------------------------------------- +// 圧縮タイプ +typedef enum +{ + CONV_TYPE_NON, // 変換なし + CONV_TYPE_DIFF, // 差分フィルタ + CONV_TYPE_RUNLENGTH, // ランレングス符号化 + CONV_TYPE_LZ77, // LZ77圧縮 + CONV_TYPE_HUFFMAN, // ハフマン圧縮 + CONV_TYPE_UNCOMPRESS, // 解凍 + CONV_TYPE_LZ77EX, // 拡張LZ77圧縮 + CONV_TYPE_LH, // LZ77-ハフマン複合圧縮 + CONV_TYPE_LRC, // LZ77-RangeCoder複合圧縮 + CONV_TYPE_RANGECODER // レンジコーダ +} +t_conv_type; + +// 圧縮データ情報構造体 +typedef struct +{ + t_conv_type type; // 圧縮タイプ + uint opt; // 圧縮パラメータ + ulong src_size; // 圧縮前データサイズ + ulong dest_size; // 圧縮後データサイズ + uchar *src_buf; // 圧縮前データバッファ + uchar *dest_buf; // 圧縮後データバッファ + uchar textout_width; // テキスト出力するかどうかのフラグ兼サイズ + uchar alignment; // 出力ファイルサイズのアライメント + uchar header_flg :1; // ヘッダ情報を付加するかどうかのフラグ + uchar silent_flg :1; // 標準出力へメッセージを出力するかどうかのフラグ + uchar verify_flg :1; // 圧縮ファイルを展開する際のべりファイをおこなうかどうかのフラグ +} +t_conv_data; + +typedef enum +{ + OPT_NONE, // 無効なオプション + OPT_VERSION, // バージョン表示(-v) + OPT_SILENT, // 標準出力抑止(-s) + OPT_LOWER_TEXT, // 小文字でのテキスト出力(-t) + OPT_UPPER_TEXT, // 大文字でのテキスト出力(-T) + OPT_ALIGN, // アライメント指定(-A4|8|16|32) + OPT_HEADER, // ヘッダ付加(-H) + OPT_OUTPUT, // 出力ファイル指定(-o) + OPT_EXTRACT, // 解凍(-x) + OPT_DIFF_FILTER, // 差分フィルタ(-d) + OPT_RUN_LENGTH, // ランレングス圧縮(-r) + OPT_LZ77, // 旧LZ77圧縮(-l) + OPT_LZ77EX, // LZ77圧縮(-lex) + OPT_LH, // LH圧縮(-lh) + OPT_LRC, // LRC圧縮(-lrc) + OPT_HUFFMAN, // ハフマン圧縮(-h4|8) + + OPT_RANGECODER, // レンジコーダ圧縮(デバッグ版のみ) (-R) + OPT_VERIFY, // ベリファイ (デバッグ版のみ) (-D) + OPT_TEST, // テスト (デバッグ版のみ) (--TEST) +} +t_opt; + + + + +//--------------------------------------------------------------------------- +// プロトタイプ宣言 +//--------------------------------------------------------------------------- +static void usage( const char *cmd_string ); +static void version_info( void ); +static int parse_opt( int argc, char *argv[], t_conv_data * cnv_dat, char **in_fname, + char **out_fname ); +static int load_file ( const char *fname, t_conv_data * cnv_dat ); +static int save_file ( const char *fname, const t_conv_data * cnv_dat ); +static int convert_data( t_conv_data * cnv_dat ); +static int fwrite_text ( const uchar * buf, ulong size, uint width, FILE * fp, const char *name ); +static char* cut_fname ( char *path ); +static char* make_output_fname( const char *input_fname, const t_conv_data * cnv_dat ); +static int verify_data ( t_conv_data * cnv_dat ); + + +//--------------------------------------------------------------------------- +// エンディアン変換 +//--------------------------------------------------------------------------- +static ushort +reverse_endian16( ushort x ) +{ + return (ushort)( ( (x >> 8) & 0x00FF ) | ( (x << 8) & 0xFF00 ) ); +} + +static ulong +reverse_endian32( ulong x ) +{ + return (ulong)( ( (x >> 24) & 0x000000FF ) | + ( (x >> 8) & 0x0000FF00 ) | + ( (x << 8) & 0x00FF0000 ) | + ( (x << 24) & 0xFF000000 ) ); +} + + + +//--------------------------------------------------------------------------- +// メイン関数 +//--------------------------------------------------------------------------- +int main(int argc, char *argv[]) +{ + t_conv_data cnv_dat; + char *in_fname, *out_fname; + +#ifdef _DEBUG + if ( argc >= 2 && strcmp(argv[1], "-TEST") == 0 ) + { + ntcompress_test(); + return 0; + } +#endif + + // データの初期化 + memset(&cnv_dat, 0, sizeof(cnv_dat)); + + // コマンドオプションの解析 + if (parse_opt(argc, argv, &cnv_dat, &in_fname, &out_fname) != 0) + { + exit(1); + } + + // 入力ファイルをバッファへ読み込み + if (load_file(in_fname, &cnv_dat) != 0) + { + exit(1); + } + + // ファイルの圧縮 + if (convert_data(&cnv_dat) != 0) + { + exit(1); + } + + // 圧縮データのベリファイ + if (verify_data( &cnv_dat ) != 0) + { + exit(1); + } + + // バッファから出力ファイルへの書き込み + if (save_file(out_fname, &cnv_dat) != 0) + { + exit(1); + } + + if (!cnv_dat.silent_flg) + { + fprintf(stdout, "convert %s(%ldbyte) to %s(%ldbyte)\n", in_fname, cnv_dat.src_size, + out_fname, cnv_dat.dest_size); + } + + free(cnv_dat.src_buf); + if (cnv_dat.dest_buf != cnv_dat.src_buf) + { + free(cnv_dat.dest_buf); + } + + return 0; +} + +//--------------------------------------------------------------------------- +// USAGE: +//--------------------------------------------------------------------------- +static void usage(const char *cmd_string) +{ + fprintf(stderr, "\n"); +#if defined( SUPPORT_LH_LRC ) + fprintf(stderr, + "Usage: %s <-d(4|8)|r|l|lex|h(8|16)|lh|lrc> [-o outputFile] [-A(4|8|16|32)] [-[width]] [-s] [-H] [-v] \n" + " %s -x [-o outputFile] [-s] \n", + cmd_string, cmd_string); +#else + fprintf(stderr, + "Usage: %s <-d(4|8)|r|l|lex|h(8|16)> [-o outputFile] [-A(4|8|16|32)] [-[width]] [-s] [-H] [-v] \n" + " %s -x [-o outputFile] [-s] \n", + cmd_string, cmd_string); +#endif + fprintf(stderr, "\t-v Show version\n"); + fprintf(stderr, "\t-r Runlength encode.\n"); + fprintf(stderr, "\t-l LZ77 encode(compatible with previous LZ77).\n"); + fprintf(stderr, "\t-lex LZ77 encode.\n"); + fprintf(stderr, "\t-h BitSize(4|8) Huffman encode.\n"); + fprintf(stderr, "\t-d BitSize(8|16) Differential filter.\n"); +#if defined( SUPPORT_LH_LRC ) + fprintf(stderr, "\t-lh LZ and Huffman encode\n"); + fprintf(stderr, "\t-lrc LZ and RangeCoder encode\n"); +#endif + fprintf(stderr, "\n"); + fprintf(stderr, "\t-A(4|8|16|32) Align n byte for compressed filesize\n"); + fprintf(stderr, "\t-o outputFile Specify the output file name.\n"); + fprintf(stderr, "\t-t[TypeWidth(1|2|4)] output C format text(little endian).\n"); + fprintf(stderr, "\t We can specify the type(1=u8,2=u16,4=u32).\n"); + fprintf(stderr, "\t-T[TypeWidth(1|2|4)] output C format text(big endian).\n"); + fprintf(stderr, "\t We can specify the type(1=u8,2=u16,4=u32).\n"); + fprintf(stderr, "\t-s Print no message if you've been successful in the conversion.\n"); + fprintf(stderr, "\t-H Raw data header\n"); + fprintf(stderr, "\t-x Extract compressed file.\n"); +} + + +static void version_info( void ) +{ + fprintf(stderr, "%s version %s\n", TARGET_NAME, NTCOMPRESS_VERSION); +} + +//--------------------------------------------------------------------------- +// パス文字列からファイル名部分のポインタを取得し、拡張子を削る +// @param path パス +// @return ファイル名のポインタ +//--------------------------------------------------------------------------- +static char *cut_fname(char *path) +{ + char *search_tmp; + + if (path == NULL) + { + return NULL; + } + + if ((search_tmp = strrchr(path, '/')) != NULL) + { + path = (search_tmp + 1); + } + if ((search_tmp = strrchr(path, '\\')) != NULL) + { + path = (search_tmp + 1); + } + if ((search_tmp = strrchr(path, '.')) != NULL) + { + *search_tmp = '\0'; + } + return path; +} + +//--------------------------------------------------------------------------- +// 入力ファイル名から出力ファイル名を生成する関数 +// @param input_fname 入力ファイル名 +// @param cnv_dat 変換情報 +// @return 出力ファイル名へのポインタ +//--------------------------------------------------------------------------- +static char *make_output_fname(const char *input_fname, const t_conv_data * cnv_dat) +{ + char *out_fname, *edit_tmp; + + if (input_fname == NULL) + { + return NULL; + } + + // メモリ領域の確保 + if ((out_fname = (char *)malloc(strlen(input_fname) + 0x10)) == NULL) + { + fprintf(stderr, "internal err: malloc fail!\n"); + exit(1); + } + + strcpy(out_fname, input_fname); + edit_tmp = cut_fname(out_fname); + + // 圧縮方式をファイル名に付加 + switch ( cnv_dat->type ) + { + case CONV_TYPE_NON: + strcat(edit_tmp, "_NONE"); + break; + case CONV_TYPE_DIFF: + strcat(edit_tmp, "_DIFF"); + break; + case CONV_TYPE_RUNLENGTH: + strcat(edit_tmp, "_RL"); + break; + case CONV_TYPE_LZ77: + case CONV_TYPE_LZ77EX: + strcat(edit_tmp, "_LZ"); + break; + case CONV_TYPE_HUFFMAN: + strcat(edit_tmp, "_HUFF"); + break; + case CONV_TYPE_LH: + strcat(edit_tmp, "_LH"); + break; + case CONV_TYPE_LRC: + strcat(edit_tmp, "_LRC"); + break; + case CONV_TYPE_RANGECODER: + strcat(edit_tmp, "_RC"); + break; + case CONV_TYPE_UNCOMPRESS: + strcat(edit_tmp, "_DECOMP"); + } + // 拡張子を付加 + if (cnv_dat->textout_width != 0) + { + strcat(edit_tmp, ".c"); + } + else + { + strcat(edit_tmp, ".bin"); + } + return out_fname; +} + + +//--------------------------------------------------------------------------- +// 次のオプションのタイプ判別 +// @param opt 判別したいオプション文字列 +// @return オプションのタイプ +//--------------------------------------------------------------------------- +t_opt +get_opt_type( const char* opt ) +{ + if ( strncmp( opt, "--", 2 ) == 0 ) + { + } + else + { + // オプション解析 + switch ( opt[1] ) + { + case 'v': + return OPT_VERSION; + case 's': + return OPT_SILENT; + case 'D': + return OPT_VERIFY; + case 't': + return OPT_LOWER_TEXT; + case 'T': + return OPT_UPPER_TEXT; + case 'A': + return OPT_ALIGN; + case 'H': + return OPT_HEADER; + case 'o': + return OPT_OUTPUT; + case 'x': + return OPT_EXTRACT; + case 'd': + return OPT_DIFF_FILTER; + case 'r': + return OPT_RUN_LENGTH; + case 'R': + return OPT_RANGECODER; + case 'l': + if ( strcmp(opt, "-lex" ) == 0 ) + { + return OPT_LZ77EX; + } +#if defined( SUPPORT_LH_LRC ) + else if ( strcmp(opt, "-lh") == 0 ) + { + return OPT_LH; + } + else if ( strcmp(opt, "-lrc") == 0 ) + { + return OPT_LRC; + } +#endif + else + { + return OPT_LZ77; + } + case 'h': + return OPT_HUFFMAN; + } + } + return OPT_NONE; +} + + +//--------------------------------------------------------------------------- +// コマンドパラメータ解析 +// @param argc パラメータ数 +// @param argv パラメータ配列 +// @retval cnv_dat 圧縮情報データ +// @retval in_fname 入力ファイル名 +// @retval out_fname 出力ファイル名 +// @return 0 ファイルの書き込み成功 +// -1 ファイルの書き込みエラー +//--------------------------------------------------------------------------- + +static int parse_opt(int argc, char *argv[], t_conv_data * cnv_dat, + char **in_fname, char **out_fname) +{ + int i = 1; + t_conv_type type; + int opt_num; + char *cmd_string; +#define SYNTAX_CHECK(exp) do { if (!(exp)) { usage(cmd_string); return -1; } } while(0) + + // コマンド名取得 + cmd_string = cut_fname(argv[0]); + + // 状態初期化 + cnv_dat->type = CONV_TYPE_NON; + cnv_dat->header_flg = 0; + cnv_dat->textout_width = 0; + cnv_dat->silent_flg = 0; + cnv_dat->alignment = 0; + cnv_dat->verify_flg = 0; + *out_fname = NULL; + *in_fname = NULL; + + // オプション解析 + while (i < argc) + { + t_opt opt; + + if (argv[i][0] != '-') + { + SYNTAX_CHECK(*in_fname == NULL); // 2重読みチェック + + // 入力ファイル名取得 + *in_fname = argv[i]; + i++; + continue; + } + + opt = get_opt_type( argv[i] ); + + // ハイフン付オプション解析 + switch ( opt ) + { + //-------------------- + // バージョン表示オプション'v'(引数0) + case OPT_VERSION: + SYNTAX_CHECK(argv[i][2] == '\0'); // 文字数チェック + + version_info(); + return -1; + + //-------------------- + // 標準出力無しオプション's' (引数0) + case OPT_SILENT: + SYNTAX_CHECK(argv[i][2] == '\0'); // 文字数チェック + SYNTAX_CHECK(!cnv_dat->silent_flg); // 2重読みチェック + + cnv_dat->silent_flg = 1; + break; + +#ifdef _DEBUG + //-------------------- + // ベリファイオプション'D' (引数0) + case OPT_VERIFY: + SYNTAX_CHECK(argv[i][2] == '\0'); // 文字数チェック + SYNTAX_CHECK(!cnv_dat->verify_flg); // 2重読みチェック + cnv_dat->verify_flg = 1; + break; +#endif + + //-------------------- + // C言語テキスト出力オプション't' (引数0-1) (リトルエンディアン) + case OPT_LOWER_TEXT: + SYNTAX_CHECK(cnv_dat->textout_width == 0); // 2重読みチェック + + if (strlen(argv[i]) == 2) // パラメータが無い場合はバイト単位で書き込む + { + cnv_dat->textout_width = 1; + } + else + { + cnv_dat->textout_width = atoi(&argv[i][2]); + SYNTAX_CHECK(cnv_dat->textout_width == 1 || cnv_dat->textout_width == 2 + || cnv_dat->textout_width == 4); + } + break; + + //-------------------- + // C言語テキスト出力オプション'T' (引数0-1) (ビッグエンディアン) + case OPT_UPPER_TEXT: + SYNTAX_CHECK(cnv_dat->textout_width == 0); // 2重読みチェック + + if (strlen(argv[i]) == 2) // パラメータが無い場合はバイト単位で書き込む + { + cnv_dat->textout_width = 1; + } + else + { + cnv_dat->textout_width = atoi(&argv[i][2]); + SYNTAX_CHECK(cnv_dat->textout_width == 1 || cnv_dat->textout_width == 2 + || cnv_dat->textout_width == 4); + } + cnv_dat->textout_width |= TEXT_BIG_ENDIAN_FLAG; + break; + + //-------------------- + // 出力ファイルサイズアライン指定'A4|8|16|32' (引数0) + case OPT_ALIGN: + SYNTAX_CHECK(strlen(argv[i]) <= 4 ); // 文字数チェック + SYNTAX_CHECK( cnv_dat->alignment == 0 ); // 2重読みチェック + + cnv_dat->alignment = atoi(&argv[i][2]); + SYNTAX_CHECK( cnv_dat->alignment == 4 || cnv_dat->alignment == 8 || cnv_dat->alignment == 16 || cnv_dat->alignment == 32 ); + + break; + + //-------------------- + // 展開後データの先頭にデータサイズを付加するオプション'H' (引数0) + case OPT_HEADER: + SYNTAX_CHECK(strlen(argv[i]) == 2); // 文字数チェック + SYNTAX_CHECK(!cnv_dat->header_flg); // 2重読みチェック + + cnv_dat->header_flg = 1; + break; + + //-------------------- + // 出力ファイル指定オプション 'o' (引数1) + case OPT_OUTPUT: + SYNTAX_CHECK(strlen(argv[i]) == 2); // 文字数チェック + SYNTAX_CHECK(*out_fname == NULL); // 2重読みチェック + SYNTAX_CHECK(i + 1 < argc); // パラメータチェック + + *out_fname = argv[++i]; + break; + + //-------------------- + // 解凍指定 'x'(引数0) + case OPT_EXTRACT: + SYNTAX_CHECK(strlen(argv[i]) == 2); // 文字数チェック + + type = CONV_TYPE_UNCOMPRESS; + opt_num = 0; + goto common; + + //-------------------- + // 差分フィルタ指定 'd'(引数1) + case OPT_DIFF_FILTER: + type = CONV_TYPE_DIFF; + goto common_opt1; + + //-------------------- + // ランレングス圧縮指定'r'(引数0) + case OPT_RUN_LENGTH: + SYNTAX_CHECK(strlen(argv[i]) == 2); // 文字数チェック + + type = CONV_TYPE_RUNLENGTH; + opt_num = 0; + goto common; + +#ifdef _DEBUG + //-------------------- + // レンジコーダ圧縮指定'R'(引数0) + case OPT_RANGECODER: + SYNTAX_CHECK(strlen(argv[i]) == 2); // 文字数チェック + + type = CONV_TYPE_RANGECODER; + opt_num = 0; + goto common; +#endif + //-------------------- + // 旧LZ77圧縮"-l"(引数0) + case OPT_LZ77: + SYNTAX_CHECK( (argv[i][2] == '\0') || isdigit(argv[i][2]) ); + type = CONV_TYPE_LZ77; + opt_num = 0; + cnv_dat->opt = 2; + + #if defined( FOR_NITRO ) + // 次にパラメータがあり、入力ファイル名でなければ読み飛ばす + if ( i + 2 < argc && argv[i + 1][0] != '-' && + argv[i + 1][1] == '\0' && atoi(&argv[i + 1][0]) != 0 ) + { + i++; + } + #endif + goto common; + + //-------------------- + // LZ77圧縮"-lex"(引数0) + case OPT_LZ77EX: + type = CONV_TYPE_LZ77EX; + opt_num = 0; + cnv_dat->opt = 2; // 検索開始位置はオプションで指定できない事にする + goto common; + + //-------------------- + // LH圧縮"-lh"(引数0) + case OPT_LH: + type = CONV_TYPE_LH; + opt_num = 0; + goto common; + + //-------------------- + // LRC圧縮"-lrc"(引数0) + case OPT_LRC: + type = CONV_TYPE_LRC; + opt_num = 0; + goto common; + + //-------------------- + // ハフマン圧縮指定'h'(引数1) + case OPT_HUFFMAN: + type = CONV_TYPE_HUFFMAN; + goto common_opt1; + + //-------------------- + // 圧縮方式指定部分の共通処理 + common_opt1: + if (strlen(argv[i]) == 2) + // 文字列が終了していれば次の引数がパラメータとなる + { + opt_num = 1; + } + else + // 文字列が続いていればその値がパラメータとなる + { + cnv_dat->opt = atoi(&argv[i][2]); + SYNTAX_CHECK(cnv_dat->opt != 0); // パラメータが1以上の数字であるかのチェック + opt_num = 0; + } + // don't break; + common: + SYNTAX_CHECK(cnv_dat->type == CONV_TYPE_NON); // 2重読みチェック + + cnv_dat->type = type; + + if (opt_num == 0) + { + break; + } + + // 引数がある場合 + SYNTAX_CHECK(i + 1 < argc); // パラメータチェック + i++; + SYNTAX_CHECK(argv[i][0] != '-'); // パラメータにハイフンで始まらないかのチェック + + cnv_dat->opt = atoi(argv[i]); + + SYNTAX_CHECK(cnv_dat->opt != 0); // パラメータが1以上の数字であるかのチェック + + break; + + //-------------------- + default: + usage(cmd_string); + return -1; + } + i++; + } + + SYNTAX_CHECK(*in_fname != NULL); // 入力ファイルが指定されたかどうかのチェック + + // 出力ファイル名の自動生成 + if (*out_fname == NULL) + { + *out_fname = make_output_fname(*in_fname, cnv_dat); + } + + if (strcmp(*in_fname, *out_fname) == 0) + { + fprintf(stderr, "ERR: output file %s is same as input file\n", *out_fname); + return -1; + } + + if ( cnv_dat->type == CONV_TYPE_UNCOMPRESS ) + // 解凍オプションが指定された場合のオプションチェック + { + SYNTAX_CHECK(cnv_dat->alignment == 0); // アライメントの指定は不能です + SYNTAX_CHECK(cnv_dat->header_flg == 0); // ヘッダの追加オプションは不能です + } + + return 0; +#undef SYNTAX_CHECK +} + + + +//--------------------------------------------------------------------------- +// 入力ファイルの読み込み関数 +// +// @param fname 入力ファイル名 +// @retval 圧縮情報構造体へのポインタ +// @return 0 ファイルの読み込み成功 +// -1 ファイルの読み込みエラー +//--------------------------------------------------------------------------- + +static int load_file(const char *fname, t_conv_data * cnv_dat) +{ + FILE *in_file; + + // ファイルのオープン + if ((in_file = fopen(fname, "rb")) == NULL) + { + fprintf(stderr, "ERR: could not open file: %s\n", fname); + return -1; + } + + // ファイルのサイズ取得 + fseek(in_file, 0, SEEK_END); + if ((cnv_dat->src_size = ftell(in_file)) < 0) + { + fprintf(stderr, "ERR: file error\n"); + return -1; + } + + // 入力ファイルをバッファへ読み込み + if ((cnv_dat->src_buf = (uchar *) malloc(ROUNDUP4(cnv_dat->src_size))) == NULL) + { + fprintf(stderr, "ERR: memory exhausted\n"); + return -1; + } + + fseek(in_file, 0, SEEK_SET); + if (fread(cnv_dat->src_buf, 1, cnv_dat->src_size, in_file) != cnv_dat->src_size) + { + fprintf(stderr, "ERR: read error\n"); + return -1; + } + + fclose(in_file); + + // 4バイトアラインまでを0で埋める + { + ulong i; + for (i = 0; (cnv_dat->src_size + i) & 3; i++) + { + cnv_dat->src_buf[cnv_dat->src_size + i] = 0; + } + } + + return 0; +} + + +//--------------------------------------------------------------------------- +// 出力ファイルへの書き込み関数 +// +// @param fname 出力ファイル名 +// @retval 圧縮情報構造体へのポインタ +// @return 0 ファイルの書き込み成功 +// -1 ファイルの書き込みエラー +//--------------------------------------------------------------------------- + +static int save_file(const char *fname, const t_conv_data * cnv_dat) +{ + FILE *out_file; + + // 書き込みデータのチェック + if (cnv_dat->dest_buf == NULL || cnv_dat->dest_size < 0) + { + fprintf(stderr, "ERR: convert error\n"); + return -1; + } + + // ファイルのオープン + if ((out_file = fopen(fname, "wb")) == NULL) + { + fprintf(stderr, "ERR: could not open file: %s\n", fname); + return -1; + } + + // バッファを出力ファイルへ書き込み + if (cnv_dat->textout_width != 0) + { + // テキスト出力 + if ( fwrite_text(cnv_dat->dest_buf, cnv_dat->dest_size, cnv_dat->textout_width, out_file, fname) + != cnv_dat->dest_size ) + { + fprintf(stderr, "ERR: write error\n"); + return -1; + } + } + else + { + // バイナリ出力 + if ( fwrite(cnv_dat->dest_buf, 1, cnv_dat->dest_size, out_file) != cnv_dat->dest_size ) + { + fprintf(stderr, "ERR: write error\n"); + return -1; + } + } + + fclose(out_file); + + return 0; +} + +//--------------------------------------------------------------------------- +// C言語フォーマットでのテキスト出力 +// @param buf データバッファ +// @param size データサイズ +// @param fp 出力ファイルポインタ +// @param name 定数ラベル名 +// @return 0 ファイルの書き込み成功 +// -1 ファイルの書き込みエラー +//--------------------------------------------------------------------------- + +static int fwrite_text(const uchar * buf, ulong size, uint width, FILE * fp, const char *name) +{ + char *const_name_buf; + char *const_name_ptr; + ulong i; + ulong line_num; + uint big_endian = width & TEXT_BIG_ENDIAN_FLAG; + + width &= TEXT_WIDTH_MASK; + + if (fp == NULL) + { + return -1; + } + if (buf == NULL) + { + return -1; + } + if (name == NULL) + { + return -1; + } + + // 定数名の決定 + if ((const_name_buf = (char *)malloc( strlen(name) + 1 )) == NULL) + { + fprintf(stderr, "internal err: malloc fail!\n"); + return -1; + } + + strcpy(const_name_buf, name); + const_name_ptr = cut_fname(const_name_buf); + size = (size + width - 1) / width; + + // データの書き込み + if ( fprintf(fp, "#include <%s/types.h>\n\n", INCLUDE_TARGET) < 0 ) + { + return -1; + } + + if ( fprintf(fp, "const u%d %s[0x%lX] = {", width * 8, const_name_ptr, size) < 0 ) + { + return -1; + } + + line_num = (width >= 2) ? 2 : 1; + + for ( i = 0; i < size; i++ ) + { + if ((i * line_num) % 0x10 == 0) + { + if (fprintf(fp, "\n") < 0) + { + return -1; + } + } + switch ( width ) + { + case 1: + { + if ( fprintf(fp, "0x%02X,", *buf) < 0 ) + { + return -1; + } + buf++; + } + break; + case 2: + { + ushort val = *(ushort*)buf; + if ( big_endian ) + { + val = reverse_endian16( val ); + } + + if ( fprintf(fp, "0x%04X,", val) < 0 ) + { + return -1; + } + buf += 2; + } + break; + case 4: + { + ulong val = *(ulong*)buf; + if ( big_endian ) + { + val = reverse_endian32( val ); + } + + if ( fprintf(fp, "0x%08lX,", val) < 0 ) + { + return -1; + } + buf += 4; + } + break; + default: + return -1; + } + } + + if (fprintf(fp, "\n};\n") < 0) + { + return -1; + } + + free(const_name_buf); + + return i * width; +} + + +//--------------------------------------------------------------------------- +// データの変換 +// @retval cnv_dat 変換情報データ +// @return 0 変換成功 +// -1 変換失敗 +//--------------------------------------------------------------------------- + +static int convert_data(t_conv_data * cnv_dat) +{ + char cmd_str[16]; + + // コマンドストリングの生成 + switch (cnv_dat->type) + { + //--------------------- + // 差分フィルタ + case CONV_TYPE_DIFF: + if (cnv_dat->opt != 8 && cnv_dat->opt != 16) + { + fprintf(stderr, "ERR: invalid DIFF parameter %d\n", cnv_dat->opt); + return -1; + }; + sprintf(cmd_str, "d%d", cnv_dat->opt); + break; + + //--------------------- + // ランレングス圧縮 + case CONV_TYPE_RUNLENGTH: + // ランレングス符号化 + strcpy(cmd_str, "r"); + break; + + //--------------------- + // LZ77圧縮 + case CONV_TYPE_LZ77: + if (cnv_dat->opt < 2 || cnv_dat->opt > 255) + { + fprintf(stderr, "ERR: invalid LZ77 parameter %d\n", cnv_dat->opt); + return -1; + }; + sprintf(cmd_str, "l%d", cnv_dat->opt); + break; + + //--------------------- + // LZ77拡張圧縮 + case CONV_TYPE_LZ77EX: + if (cnv_dat->opt < 2 || cnv_dat->opt > 255) + { + fprintf(stderr, "ERR: invalid LZ77 parameter %d\n", cnv_dat->opt); + return -1; + }; + sprintf(cmd_str, "L%d", cnv_dat->opt); + break; + + //--------------------- + // ハフマン圧縮 + case CONV_TYPE_HUFFMAN: + if (cnv_dat->opt != 4 && cnv_dat->opt != 8) + { + fprintf(stderr, "ERR: invalid HUFFMAN parameter %d\n", cnv_dat->opt); + return -1; + }; + sprintf(cmd_str, "h%d", cnv_dat->opt); + break; + + //--------------------- + // レンジコーダ圧縮 + case CONV_TYPE_RANGECODER: + cnv_dat->dest_buf = nitroCompMalloc( cnv_dat->src_size ); + cnv_dat->dest_size = RCACompWrite( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf ); + goto finish; + + //--------------------- + // LZ-ハフマン複合圧縮 + case CONV_TYPE_LH: + cnv_dat->dest_buf = nitroCompMalloc( cnv_dat->src_size ); + cnv_dat->dest_size = LHCompWrite( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf ); + goto finish; + + //--------------------- + // LZ-RangeCoder複合圧縮 + case CONV_TYPE_LRC: + cnv_dat->dest_buf = nitroCompMalloc( cnv_dat->src_size ); + cnv_dat->dest_size = LRCCompWrite( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf ); + goto finish; + + //--------------------- + // 無圧縮 + case CONV_TYPE_NON: + { + cnv_dat->dest_size = cnv_dat->src_size; + cnv_dat->dest_buf = cnv_dat->src_buf; + + // 4バイトアラインチェック + if (cnv_dat->alignment) + { + cnv_dat->dest_size = ROUNDUP(cnv_dat->src_size, cnv_dat->alignment); + } + else if (cnv_dat->textout_width >= 2) + { + cnv_dat->dest_size = ROUNDUP( cnv_dat->src_size, cnv_dat->textout_width & TEXT_WIDTH_MASK ); + } + } + return 0; + + //--------------------- + // 解凍 + case CONV_TYPE_UNCOMPRESS: + { + s32 ret; + if ( cnv_dat->src_size == 4 ) + { + cnv_dat->dest_size = 0; + cnv_dat->dest_buf = NULL; + goto finish; + } + cnv_dat->dest_size = nitroGetDecompFileSize( cnv_dat->src_buf ); + cnv_dat->dest_buf = (void*)malloc( cnv_dat->dest_size + 0x20 ); // アライメント分余分に確保 + memset(cnv_dat->dest_buf, 0, cnv_dat->dest_size + 0x20); + + switch ( *cnv_dat->src_buf & 0xF0 ) + { + case LH_CODE_HEADER: + ret = LHCompRead( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf ); + break; + case LRC_CODE_HEADER: + ret = LRCCompRead( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf ); + break; + case DIFF_CODE_HEADER: + case LZ_CODE_HEADER: + case HUFF_CODE_HEADER: + case RL_CODE_HEADER: + ret = nitroDecompress( cnv_dat->src_buf, cnv_dat->src_size, cnv_dat->dest_buf, 1 ); + break; + default: + ret = -1; + } + if ( ret < 0 ) + { + fprintf(stderr, "ERR: Can't extract this file.\n"); + return -1; + } + } + goto finish; + + default: + fprintf(stderr, "ERR: invalid convert type\n"); + return -1; + } + + // 圧縮後ファイルのバッファ領域確保 + cnv_dat->dest_buf = nitroCompMalloc( cnv_dat->src_size ); + + // データ圧縮 + cnv_dat->dest_size = nitroCompress(cnv_dat->src_buf, + cnv_dat->src_size, + cnv_dat->dest_buf, cmd_str, cnv_dat->header_flg); + // 4バイトアラインチェック + if (cnv_dat->alignment) + { + cnv_dat->dest_size = ROUNDUP(cnv_dat->dest_size, cnv_dat->alignment); + } + +finish: + // テキスト形式出力の型によるアラインチェック + if (cnv_dat->textout_width >= 2) + { + cnv_dat->dest_size = ROUNDUP( cnv_dat->dest_size, cnv_dat->textout_width & TEXT_WIDTH_MASK ); + } + + return 0; +} + + +/*---------------------------------------------------------------------------* + Name: verify_data + + Description: 圧縮データの展開をおこない、元データと一致するかどうか + 確認する。 + + Arguments: cnv_dat 変換情報データ + + Returns: 0 ベリファイOK + -1 ベリファイNG + *---------------------------------------------------------------------------*/ +static int verify_data( t_conv_data * cnv_dat ) +{ + // 圧縮データの展開チェック + char *decomp_buf; + ulong decomp_size; + + if ( ! cnv_dat->verify_flg ) + { + return 0; + } + + decomp_buf = nitroCompMalloc( cnv_dat->src_size ); + decomp_size = nitroDecompress( cnv_dat->dest_buf, cnv_dat->dest_size, decomp_buf, 1 ); + + if ( matchingCheck(cnv_dat->src_buf, cnv_dat->src_size, decomp_buf, decomp_size) == 0 ) + { + fprintf(stderr, "ERR: data convert error\n"); + return -1; + } + return 0; +} + + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.c b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.c new file mode 100644 index 00000000..588590d9 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.c @@ -0,0 +1,661 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: ntcompress_test.c + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +#if defined( _DEBUG ) + +#include +#include +#include +#include +#include +#include "nitroCompLib.h" +#include "multipleCompLib.h" + +#define MAX_DATA_SIZE_EX 0x02000000 // 32MB +#define MAX_DATA_SIZE 0x00100000 // 1MB +//#define MAX_DATA_SIZE 0x100 // 256B + +#define LOOP_CNT 100 +#define LOOP_CNT_EX 4 + +#if 0 +#define TestReport(...) (void)0 +#else +#define TestReport printf +#endif + +#define ASSERT assert + +static u8* s_original; + +static int TestInit( void ); +static void TestLZ8( void ); +static void TestRL8( void ); +static void TestHuffman( void ); + +static struct +{ + u64 x; // 乱数値 + u64 mul; // 乗数 + u64 add; // 加算する数 +} +sRandContext; + +static void InitRand32_(u64 seed) +{ + sRandContext.x = seed; + sRandContext.mul = (1566083941LL << 32) + 1812433253LL; + sRandContext.add = 2531011; +} + +static u32 Rand32_(u32 max) +{ + sRandContext.x = sRandContext.mul * sRandContext.x + sRandContext.add; + + // 引数maxが定数ならばコンパイラにより最適化される。 + if (max == 0) + { + return (u32)(sRandContext.x >> 32); + } + else + { + return (u32)((((sRandContext.x >> 32) * (max >> 1)) >> 32) + (max >> 1)); + } +} + + + +static int compare( const u8 a[], const u8 b[], int size ) +{ + int i; + int equivalent_flag = 1; + for ( i = 0; i < size; ++i ) + { + if ( a[i] != b[i] ) + { + equivalent_flag = 0; + break; + } + } + return equivalent_flag; +} + + +//-------------------------------------------------- +// 元データ生成用関数 +//-------------------------------------------------- + +// LZ,Huffmanで圧縮されやすい元データを作成する。 +static u32 makeOriginalDataForLZHuff( u32 seed ) +{ + u32 fsize; + u32 i; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + (void)Rand32_( 0 ); + fsize = Rand32_( MAX_DATA_SIZE ); + if ( fsize <= 4 ) + { + fsize += 5; + } + + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = (u8)(Rand32_(0x100) & 0xF0); + } + return fsize; +} + + +// RL圧縮されやすい元データを作成する。 +static u32 makeOriginalDataForRL( u32 seed ) +{ + u8 val; + u32 i; + u32 fsize; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + (void)Rand32_( 0 ); + fsize = Rand32_( MAX_DATA_SIZE ); + if ( fsize <= 4 ) + { + fsize += 5; + } + + for ( i = 0; i < fsize; ++i ) + { + if ( (i % 4) == 0 ) + { + val = (u8)Rand32_(0x100); + } + s_original[ i ] = val; + } + return fsize; +} + +// 圧縮されにくい元データを作成する。 +static u32 makeOriginalDataRand( u32 seed ) +{ + u32 i; + u32 fsize; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + (void)Rand32_( 0 ); + fsize = Rand32_( MAX_DATA_SIZE ); + if ( fsize <= 4 ) + { + fsize += 5; + } + + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = (u8)Rand32_(0x100); + } + return fsize; +} + + +// すべてが単一値の元データを作成する。 +static u32 makeOriginalDataMonoValue( u32 seed ) +{ + u32 i; + u32 fsize; + u8 val; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + (void)Rand32_( 0 ); + fsize = Rand32_( MAX_DATA_SIZE ); + if ( fsize <= 4 ) + { + fsize += 5; + } + + val = (u8)Rand32_(0x100); + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = val; + } + return fsize; +} + +// LZ,Huffmanで圧縮されやすい元データを作成する。 +static u32 makeOriginalDataForLZHuffEx( u32 seed ) +{ + u32 i; + u32 fsize; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + fsize = Rand32_(MAX_DATA_SIZE_EX / 2) + (MAX_DATA_SIZE_EX / 2); + if ( fsize <= 4 ) + { + fsize += 5; + } + + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = (u8)(Rand32_(0x100) & 0xF0); + } + return fsize; +} + + +// RL圧縮されやすい元データを作成する。 +static u32 makeOriginalDataForRLEx( u32 seed ) +{ + u32 i; + u32 fsize; + u8 val; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + fsize = Rand32_(MAX_DATA_SIZE_EX / 2) + (MAX_DATA_SIZE_EX / 2); + if ( fsize <= 4 ) + { + fsize += 5; + } + + val; + for ( i = 0; i < fsize; ++i ) + { + if ( (i % 4) == 0 ) + { + val = (u8)Rand32_(0x100); + } + s_original[ i ] = val; + } + return fsize; +} + +// 圧縮されにくい元データを作成する。 +static u32 makeOriginalDataRandEx( u32 seed ) +{ + u32 fsize; + u32 i; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + fsize = Rand32_(MAX_DATA_SIZE_EX / 2) + (MAX_DATA_SIZE_EX / 2); + if ( fsize <= 4 ) + { + fsize += 5; + } + + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = (u8)Rand32_(0x100); + } + return fsize; +} + + +// すべてが単一値の元データを作成する。 +static u32 makeOriginalDataMonoValueEx( u32 seed ) +{ + u32 fsize; + u32 i; + u8 val; + + TestReport("seed: %u\n", seed); + InitRand32_( seed ); + fsize = Rand32_(MAX_DATA_SIZE_EX / 2) + (MAX_DATA_SIZE_EX / 2); + if ( fsize <= 4 ) + { + fsize += 5; + } + + val = (u8)Rand32_(0x100); + for ( i = 0; i < fsize; ++i ) + { + s_original[ i ] = val; + } + return fsize; +} + + + +typedef u32 (*MakeDataFunc)( u32 seed ); +#define WATER_MARK 0xDeadBeaf + + +static void TestLZ8_template( MakeDataFunc makeDataFunc, u32 exFmt, u32 loop_cnt ) +{ + u32 i; + for ( i = 0; i < loop_cnt; ++i ) + { + u32 fsize = makeDataFunc( i ); + + u8* s_compressed = nitroCompMalloc( fsize ); + u8* s_uncompressed = (u8*)malloc( fsize + 4 ); + u32 sz; + + TestReport("size = %d\n", fsize); + if ( ! exFmt ) + { + sz = nitroCompress( s_original, fsize, s_compressed, "l2", 0 ); + } + else + { + sz = nitroCompress( s_original, fsize, s_compressed, "L2", 0 ); + } + + if ( sz == 0 ) + { + TestReport( "compress LZ fail size %d\n", fsize ); + } + else + { + TestReport("compress LZ %d -> %d\n", fsize, sz ); + *(u32*)(&s_uncompressed[ fsize ]) = WATER_MARK; + nitroDecompress( s_compressed, sz, s_uncompressed, 1 ); + ASSERT( compare( s_original, s_uncompressed, (int)fsize ) ); + // 展開時のオーバーアクセスをチェック + ASSERT( *(u32*)(&s_uncompressed[ fsize ]) == WATER_MARK ); + } + + nitroCompFree( s_compressed ); + free( s_uncompressed ); + } +} + +static void TestRL8_template( MakeDataFunc makeDataFunc, u32 loop_cnt ) +{ + u32 i; + for ( i = 0; i < loop_cnt; ++i ) + { + u32 fsize = makeDataFunc( i ); + + u8* s_compressed = nitroCompMalloc( fsize ); + u8* s_uncompressed = (u8*)malloc( fsize + 4 ); + u32 sz; + + TestReport("size = %d\n", fsize); + sz = nitroCompress( s_original, fsize, s_compressed, "r", 0 ); + + if ( sz == 0 ) + { + TestReport( "compress RL fail size %d\n", fsize ); + } + else + { + TestReport("compress RL %d -> %d\n", fsize, sz ); + *(u32*)(&s_uncompressed[ fsize ]) = WATER_MARK; + nitroDecompress( s_compressed, sz, s_uncompressed, 1 ); + ASSERT( compare(s_original, s_uncompressed, (int)fsize) ); + // 展開時のオーバーアクセスをチェック + ASSERT( *(u32*)(&s_uncompressed[ fsize ]) == WATER_MARK ); + } + + nitroCompFree( s_compressed ); + free( s_uncompressed ); + } +} + +static void TestHuffman_template( MakeDataFunc makeDataFunc, u8 encBit, u32 loop_cnt ) +{ + u32 i; + for (i = 0; i < loop_cnt; ++i ) + { + u32 fsize = makeDataFunc( i ); + u8* s_compressed = nitroCompMalloc( fsize ); + u8* s_uncompressed = (u8*)malloc( ((fsize + 0x3) & ~0x3) + 4 ); + u32 sz; + + TestReport("size = %d\n", fsize); + sz = nitroCompress( s_original, fsize, s_compressed, (encBit == 4 )? "h4" : "h8", 0 ); + + if ( sz == 0 ) + { + TestReport( "compress Huff fail size %d\n", fsize ); + } + else + { + TestReport("compress Huff %d -> %d\n", fsize, sz ); + // ハフマン展開では末尾の4バイトアラインまではオーバーアクセスされ得る + // コードになっている + *(u32*)(&s_uncompressed[ (fsize + 0x3) & ~0x3 ]) = WATER_MARK; + nitroDecompress( s_compressed, sz, s_uncompressed, 1 ); + ASSERT( compare(s_original, s_uncompressed, (int)fsize) ); + // 展開時のオーバーアクセスをチェック + ASSERT( *(u32*)(&s_uncompressed[ (fsize + 0x3) & ~0x3 ]) == WATER_MARK ); + } + nitroCompFree( s_compressed ); + free( s_uncompressed ); + } +} + + +static void TestLH8_template( MakeDataFunc makeDataFunc, u32 exFmt, u32 loop_cnt ) +{ + u32 i; + for ( i = 0; i < loop_cnt; ++i ) + { + u32 fsize = makeDataFunc( i ); + + u8* s_compressed = nitroCompMalloc( fsize ); + u8* s_uncompressed = (u8*)malloc( fsize + 4 ); + u32 sz; + + TestReport("size = %d\n", fsize); + sz = LHCompWrite( s_original, fsize, s_compressed ); + + if ( sz == 0 ) + { + TestReport( "compress LH fail size %d\n", fsize ); + } + else + { + TestReport("compress LH %d -> %d\n", fsize, sz ); + *(u32*)(&s_uncompressed[ fsize ]) = WATER_MARK; + LHCompRead( s_compressed, sz, s_uncompressed ); + ASSERT( compare(s_original, s_uncompressed, (int)fsize) ); + // 展開時のオーバーアクセスをチェック + ASSERT( *(u32*)(&s_uncompressed[ fsize ]) == WATER_MARK ); + } + + nitroCompFree( s_compressed ); + free( s_uncompressed ); + } +} + + +static void TestLRC8_template( MakeDataFunc makeDataFunc, u32 exFmt, u32 loop_cnt ) +{ + u32 i; + for ( i = 0; i < loop_cnt; ++i ) + { + u32 fsize = makeDataFunc( i ); + + u8* s_compressed = nitroCompMalloc( fsize ); + u8* s_uncompressed = (u8*)malloc( fsize + 4 ); + u32 sz; + + TestReport("size = %d\n", fsize); + sz = LRCCompWrite( s_original, fsize, s_compressed ); + + if ( sz == 0 ) + { + TestReport( "compress LRC fail size %d\n", fsize ); + } + else + { + TestReport("compress LRC %d -> %d\n", fsize, sz ); + *(u32*)(&s_uncompressed[ fsize ]) = WATER_MARK; + LRCCompRead( s_compressed, sz, s_uncompressed ); + ASSERT( compare(s_original, s_uncompressed, (int)fsize) ); + // 展開時のオーバーアクセスをチェック + ASSERT( *(u32*)(&s_uncompressed[ fsize ]) == WATER_MARK ); + } + + nitroCompFree( s_compressed ); + free( s_uncompressed ); + } +} + + +//-------------------------------------------------- +// テストメイン +//-------------------------------------------------- + +static int TestInit( void ) +{ + time_t t; + s_original = (u8*)malloc( MAX_DATA_SIZE_EX + 4 ); + makeOriginalDataRand( (u32)time( &t ) ); + + return 0; +} + + +static void TestLZ8_normal( void ) +{ + TestLZ8_template( makeOriginalDataForLZHuff, 0, LOOP_CNT ); +} +static void TestLZ8_random( void ) +{ + TestLZ8_template( makeOriginalDataRand, 0, LOOP_CNT ); +} +static void TestLZ8_mono( void ) +{ + TestLZ8_template( makeOriginalDataMonoValue, 0, LOOP_CNT ); +} + +static void TestLZ8EX_normal( void ) +{ + TestLZ8_template( makeOriginalDataForLZHuff, 1, LOOP_CNT ); +} +static void TestLZ8EX_random( void ) +{ + TestLZ8_template( makeOriginalDataRand, 1, LOOP_CNT ); +} +static void TestLZ8EX_mono( void ) +{ + TestLZ8_template( makeOriginalDataMonoValue, 1, LOOP_CNT ); +} + + +static void TestRL8_normal( void ) +{ + TestRL8_template( makeOriginalDataForRL, LOOP_CNT ); +} +static void TestRL8_random( void ) +{ + TestRL8_template( makeOriginalDataRand, LOOP_CNT ); +} +static void TestRL8_mono( void ) +{ + TestRL8_template( makeOriginalDataMonoValue, LOOP_CNT ); +} + +static void TestHuffman8_normal( void ) +{ + TestHuffman_template( makeOriginalDataForLZHuff, 8, LOOP_CNT ); +} +static void TestHuffman8_random( void ) +{ + TestHuffman_template( makeOriginalDataRand, 8, LOOP_CNT ); +} +static void TestHuffman8_mono( void ) +{ + TestHuffman_template( makeOriginalDataMonoValue, 8, LOOP_CNT ); +} + +static void TestHuffman4_normal( void ) +{ + TestHuffman_template( makeOriginalDataForLZHuff, 4, LOOP_CNT ); +} +static void TestHuffman4_random( void ) +{ + TestHuffman_template( makeOriginalDataRand, 4, LOOP_CNT ); +} +static void TestHuffman4_mono( void ) +{ + TestHuffman_template( makeOriginalDataMonoValue, 4, LOOP_CNT ); +} + +static void TestLZ_ex(void) +{ + TestLZ8_template( makeOriginalDataForLZHuffEx, 0, LOOP_CNT_EX ); +} + +static void TestLZEX_ex(void) +{ + TestLZ8_template( makeOriginalDataForLZHuffEx, 1, LOOP_CNT_EX ); +} + +static void TestRL_ex(void) +{ + TestRL8_template( makeOriginalDataForRLEx, LOOP_CNT_EX ); +} + +static void TestHuffman8_ex(void) +{ + TestHuffman_template( makeOriginalDataForLZHuffEx, 8, LOOP_CNT_EX ); +} + +static void TestHuffman4_ex(void) +{ + TestHuffman_template( makeOriginalDataForLZHuffEx, 4, LOOP_CNT_EX ); +} + +static void TestLH_normal(void) +{ + TestLH8_template( makeOriginalDataForLZHuff, 0, LOOP_CNT ); +} + +static void TestLH_random(void) +{ + TestLH8_template( makeOriginalDataRand, 0, LOOP_CNT ); +} + +static void TestLH_mono(void) +{ + TestLH8_template( makeOriginalDataMonoValue, 0, LOOP_CNT ); +} + +static void TestLRC_normal(void) +{ + TestLRC8_template( makeOriginalDataForLZHuff, 0, LOOP_CNT ); +} + +static void TestLRC_random(void) +{ + TestLRC8_template( makeOriginalDataRand, 0, LOOP_CNT ); +} + +static void TestLRC_mono(void) +{ + TestLRC8_template( makeOriginalDataMonoValue, 0, LOOP_CNT ); +} + +#endif /* defined( _DEBUG ) */ + + + + + +/*---------------------------------------------------------------------------* + Name: ntcompress_test + + Description: テストメイン + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void ntcompress_test( void ) +{ +#if defined( _DEBUG ) + TestInit(); + + TestLH_normal(); + TestLH_random(); + TestLH_mono (); + TestLRC_normal(); + TestLRC_random(); + TestLRC_mono (); + + TestLZ8EX_normal(); + TestLZ8EX_random(); + TestLZ8EX_mono (); + TestLZ8_normal(); + TestLZ8_random(); + TestLZ8_mono (); + TestRL8_normal(); + TestRL8_random(); + TestRL8_mono (); + TestHuffman8_normal(); + TestHuffman8_random(); + TestHuffman8_mono (); + TestHuffman4_normal(); + TestHuffman4_random(); + TestHuffman4_mono (); + TestLZ_ex(); + TestLZEX_ex(); + TestRL_ex(); + TestHuffman8_ex(); + TestHuffman4_ex(); + +#endif +} + + + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.h b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.h new file mode 100644 index 00000000..1167a58d --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/ntcompress_test.h @@ -0,0 +1,23 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: ntcompress_test.h + + Copyright 2007 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 NTCOMPRESS_TEST_H__ +#define NTCOMPRESS_TEST_H__ + +void ntcompress_test( void ); + +#endif // NTCOMPRESS_TEST_H__ + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.c b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.c new file mode 100644 index 00000000..193baa9c --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.c @@ -0,0 +1,539 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: rangeCoder.c + + Copyright 2007 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 "rangeCoder.h" + +typedef struct +{ + u32 freq[ 0x100 ]; + u32 low_cnt[ 0x100 ]; + u32 total; +} +RCCompressionInfo; + +// レンジコーダ状態構造体 +typedef struct +{ + u32 low; + u32 range; + u32 code; // 展開時のみ使用 + u8 carry; // 圧縮時のみ使用 + u32 carry_cnt; // 圧縮時のみ使用 +} +RCState; + + +#define MAX_RANGE 0x80000000 + +/*---------------------------------------------------------------------------* + Name: RCInitInfo_ + Description: + Arguments: info + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCInitInfo_( RCCompressionInfo* info, BOOL adaptive ) +{ + u32 i; + + if ( adaptive ) + // 適応型レンジコーダ + { + for ( i = 0; i < 0x100; i++ ) + { + info->freq[ i ] = 1; + info->low_cnt[ i ] = i; + } + info->total = 0x100; + } + else + // 静的レンジコーダ + { + for ( i = 0; i < 0x100; i++ ) + { + info->freq[ i ] = 0; + info->low_cnt[ i ] = 0; + } + info->total = 0; + } +} + + +/*---------------------------------------------------------------------------* + Name: RCCount_ + Description: + Arguments: info + srcp + size + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCCount_( RCCompressionInfo* info, const u8* srcp, u32 size ) +{ + u32 srcCnt = 0; + u32 i; + + while ( srcCnt < size ) + { + info->freq[ srcp[ srcCnt ] ]++; + info->total++; + srcCnt++; + } + + // 0x10000へ正規化 + #define NORMAL_FREQ 0x10000 + { + f32 rate = (f32)NORMAL_FREQ / info->total; + u32 max_i = 0; + u32 max_freq = 0; + + info->total = 0; + for ( i = 0; i < 0x100; i++ ) + { + u32 orig = info->freq[ i ]; + info->freq[ i ] = (u32)(rate * info->freq[ i ] + 0.5f); + if ( orig != 0 && info->freq[ i ] == 0 ) + { + info->freq[ i ] = 1; + } + + info->total += info->freq[ i ]; + if ( info->freq[ i ] >= max_freq ) + { + max_i = i; + max_freq = info->freq[ i ]; + } + } + if ( info->total > NORMAL_FREQ ) + { + info->freq[ max_i ] -= (info->total - NORMAL_FREQ); + } + else + { + info->freq[ max_i ] += (NORMAL_FREQ - info->total); + } + info->total = NORMAL_FREQ; + } + #undef NORMAL_FREQ + + info->low_cnt[ 0 ] = 0; + + for ( i = 1; i < 0x100; i++ ) + { + info->low_cnt[ i ] = info->low_cnt[ i - 1 ] + info->freq[ i - 1 ]; + } +} + + + +/*---------------------------------------------------------------------------* + Name: RCAAddCount_ + + Description: 適応型レンジコーダの頻度テーブルを更新します。 + + Arguments: info + val + + Returns: None. + *---------------------------------------------------------------------------*/ +static void +RCAAddCount_( RCCompressionInfo* info, u8 val ) +{ + u32 i; + + info->freq[ val ]++; + info->total++; + for ( i = val + 1; i < 0x100; i++ ) + { + info->low_cnt[ i ]++; + } + + // トータルが最大値を越えた場合には、再構成する。 + if ( info->total >= 0x00010000 ) + { + if ( info->freq[ 0 ] > 1 ) + { + info->freq[ 0 ] = info->freq[ 0 ] / 2; + } + info->low_cnt[ 0 ] = 0; + info->total = info->freq[ 0 ]; + + for ( i = 1; i < 0x100; i++ ) + { + if ( info->freq[ i ] > 1 ) + { + info->freq[ i ] >>= 1; + } + info->low_cnt[ i ] = info->low_cnt[ i - 1 ] + info->freq[ i - 1 ]; + info->total += info->freq[ i ]; + } + } +} + + +/*---------------------------------------------------------------------------* + Name: RCCompWrite + + Description: レンジコーダの圧縮(テーブル型) + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 +RCCompWrite_( const u8* srcp, u32 size, u8* dstp, BOOL adaptive ) +{ +#define MIN_RANGE 0x01000000 + static RCCompressionInfo sInfo; + u32 srcCnt = 0; + u32 dstCnt = 0; + u32 low, range; + u8 carry; + u32 carry_cnt; + u32 i; + + // ワークの初期化 + RCInitInfo_( &sInfo, adaptive ); + + if ( ! adaptive ) + { + // 出現頻度を計算 + RCCount_( &sInfo, srcp, size ); + } + + // 開始Rangeが0x80000000なので、初回いきなり桁上げが発生することはない + low = 0; + range = MAX_RANGE; + carry = 0; + carry_cnt = 0; + + // ヘッダ出力 + dstp[ dstCnt++ ] = LRC_CODE_HEADER; + if ( size > 0x1000000 ) + { + dstp[ dstCnt++ ] = 0; + dstp[ dstCnt++ ] = 0; + dstp[ dstCnt++ ] = 0; + } + dstp[ dstCnt++ ] = (u8)( size ); + dstp[ dstCnt++ ] = (u8)( size >> 8 ); + dstp[ dstCnt++ ] = (u8)( size >> 16 ); + if ( size > 0x1000000 ) + { + dstp[ dstCnt++ ] = (u8)( size >> 24 ); + } + + if ( ! adaptive ) + { + // 頻度テーブルの出力(16bitリトルエンディアン) + for ( i = 0; i < 0x100; i++ ) + { + dstp[ dstCnt++ ] = (u8)( sInfo.freq[ i ] ); + dstp[ dstCnt++ ] = (u8)( sInfo.freq[ i ] >> 8 ); + } + } + + // コードの出力 + while ( srcCnt < size ) + { + u8 val = srcp[ srcCnt++ ]; + u32 temp = range / sInfo.total; + u32 prevLow = low; + low = low + sInfo.low_cnt[ val ] * temp; + range = sInfo.freq[ val ] * temp; + + if ( adaptive ) + { + // 出現頻度テーブルを更新 + RCAAddCount_( &sInfo, val ); + } + + // 桁上がりが発生する場合の処理 + if ( prevLow > low ) + { + // キャリーを1繰上げ + ++carry; + // キャリーと(キャリーカウンタ - 1)分の0x00を出力します。 + if ( carry_cnt > 1 ) + { + dstp[ dstCnt++ ] = carry; + --carry_cnt; + carry = 0x00; + } + while ( carry_cnt > 1 ) + { + dstp[ dstCnt++ ] = 0x00; + --carry_cnt; + } + } + + // Rangeの上位1バイトが空になったら桁上げ + while ( range < MIN_RANGE ) + { + u8 candidate = (u8)( low >> 24 ); + + // 次のキャリーが0xFFの場合は更に桁上げがあり得るのでcarryを出力せずにcarry_cntだけ増やす + if ( candidate == 0xFF ) + { + ++carry_cnt; + } + else + // 次のキャリーが0xFFではない場合はcarryを出力する + { + // carryと(carry_cnt - 1)分の0xFFを出力する + if ( carry_cnt > 0 ) + { + dstp[ dstCnt++ ] = carry; + --carry_cnt; + } + while ( carry_cnt > 0 ) + { + dstp[ dstCnt++ ] = 0xFF; + --carry_cnt; + } + // 新しいcarryに置き換え + carry = candidate; + carry_cnt = 1; + } + low <<= 8; + range <<= 8; + } + } + + if ( carry_cnt > 0 ) + { + dstp[ dstCnt++ ] = carry; + --carry_cnt; + } + while ( carry_cnt > 0 ) + { + dstp[ dstCnt++ ] = 0xFF; + --carry_cnt; + } + dstp[ dstCnt++ ] = (u8)( (low >> 24) & 0xFF ); + dstp[ dstCnt++ ] = (u8)( (low >> 16) & 0xFF ); + dstp[ dstCnt++ ] = (u8)( (low >> 8 ) & 0xFF ); + dstp[ dstCnt++ ] = (u8)( (low >> 0 ) & 0xFF ); + + return dstCnt; +#undef MIN_RANGE +} + + +/*---------------------------------------------------------------------------* + Name: RCACompWrite + + Description: レンジコーダの圧縮(適応型) + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 +RCCompWrite( const u8* srcp, u32 size, u8* dstp ) +{ + return RCCompWrite_( srcp, size, dstp, FALSE ); +} + +s32 +RCACompWrite( const u8* srcp, u32 size, u8* dstp ) +{ + return RCCompWrite_( srcp, size, dstp, TRUE ); +} + +static u8 +SearchRC_( RCCompressionInfo* info, u32 code, u32 range, u32 low ) +{ +#define TABLE_SIZE 0x100 + u32 codeVal = code - low; + u32 i; + u32 temp = range / info->total; + u32 tempVal = codeVal / temp; + +#if 0 + // TODO: とりあえず線形探索、二分探索にするべき + for ( i = 0; i < TABLE_SIZE - 1; i++ ) + { + if ( info->low_cnt[ i + 1 ] > tempVal ) + { + while ( info->freq[ i ] == 0 ) + { + --i; + } + return (u8)i; + } + } + return TABLE_SIZE - 1; +#else + // 二分探索 + u32 left = 0; + u32 right = TABLE_SIZE - 1; + + while ( left < right ) + { + i = (left + right) / 2; + + if ( info->low_cnt[ i ] > tempVal ) + { + right = i; + } + else + { + left = i + 1; + } + } + + i = left; + while ( info->low_cnt[ i ] > tempVal ) + { + --i; + } + return (u8)i; +#endif +} + +/*---------------------------------------------------------------------------* + Name: RCCompRead + + Description: レンジコーダ展開(テーブル型) + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 +RCCompRead_( const u8* srcp, u32 srcSize, u8* dstp, BOOL adaptive ) +{ +#define MIN_RANGE 0x01000000 + static RCCompressionInfo sInfo; + + u32 dstSize = *(u32*)srcp >> 8; + u32 dstCnt = 0; + u32 srcCnt = 0; + u32 i; + u32 code, range, low; + + if ( srcSize < 4 ) + { + return -1; + } + + srcCnt = 4; + if ( dstSize == 0 ) + { + dstSize = *(u32*)&srcp[ srcCnt ]; + srcCnt += 4; + if ( srcSize < 8 ) + { + return -1; + } + } + + if ( srcSize < sizeof(u16) * 0x100 + srcCnt ) + { + return -1; + } + + // ワークの初期化 + if ( adaptive ) + { + RCInitInfo_( &sInfo, TRUE ); + } + else + { + sInfo.total = 0; + for ( i = 0; i < 0x100; i++ ) + { + sInfo.freq[ i ] = *(u16*)&srcp[ srcCnt ]; + srcCnt += 2; + sInfo.total += sInfo.freq[ i ]; + } + sInfo.low_cnt[ 0 ] = 0; + for ( i = 1; i < 0x100; i++ ) + { + sInfo.low_cnt[ i ] = sInfo.low_cnt[ i - 1 ] + sInfo.freq[ i - 1 ]; + } + } + + code = (u32)((srcp[ srcCnt ] << 24) | (srcp[ srcCnt + 1 ] << 16) | + (srcp[ srcCnt + 2 ] << 8) | (srcp[ srcCnt + 3 ])); + range = MAX_RANGE; + low = 0; + srcCnt += 4; + + while ( dstCnt < dstSize ) + { + u8 val = SearchRC_( &sInfo, code, range, low ); + + dstp[ dstCnt++ ] = val; + + { + u32 tmp; + tmp = range / sInfo.total; + low = low + sInfo.low_cnt[ val ] * tmp; + range = sInfo.freq[ val ] * tmp; + } + + if ( adaptive ) + { + // 出現頻度テーブルを更新 + RCAAddCount_( &sInfo, val ); + } + + while ( range < MIN_RANGE ) + { + code <<= 8; + code += srcp[ srcCnt++ ]; + range <<= 8; + low <<= 8; + } + } + + return dstSize; +#undef MIN_RANGE +} + + +/*---------------------------------------------------------------------------* + Name: RCACompRead + + Description: レンジコーダ展開(適応型) + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 +RCCompRead( const u8* srcp, u32 srcSize, u8* dstp ) +{ + return RCCompRead_( srcp, srcSize, dstp, FALSE ); +} + +s32 +RCACompRead( const u8* srcp, u32 srcSize, u8* dstp ) +{ + return RCCompRead_( srcp, srcSize, dstp, TRUE ); +} + diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.h b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.h new file mode 100644 index 00000000..53808e5a --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/rangeCoder.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: rangeCoder.h + + Copyright 2007 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 "types.h" + +#ifndef __NTCOMPRESS_RANGE_CODER_H__ +#define __NTCOMPRESS_RANGE_CODER_H__ + +/*---------------------------------------------------------------------------* + Name: RCCompWrite + + Description: レンジコーダの圧縮 + + Arguments: srcp + size + dstp + + Returns: + *---------------------------------------------------------------------------*/ +s32 +RCCompWrite( const u8* srcp, u32 size, u8* dstp ); + +s32 +RCCompRead( const u8* srcp, u32 srcSize, u8* dstp ); + +s32 +RCACompWrite( const u8* srcp, u32 size, u8* dstp ); + +s32 +RCACompRead( const u8* srcp, u32 srcSize, u8* dstp ); + +#endif // __NTCOMPRESS_RANGE_CODER_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/types.h b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/types.h new file mode 100644 index 00000000..7d76786b --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/src/types.h @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------* + Project: NinTendo Compress tool + File: types.h + + Copyright 2007 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 __NTCOMPRESS_TYPES_H__ +#define __NTCOMPRESS_TYPES_H__ + +//=========================================================================================== +// 型定義 +//=========================================================================================== +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; +typedef float f32; +typedef unsigned long BOOL; +#define FALSE 0 +#define TRUE 1 + +#define DIFF_CODE_HEADER (0x80) +#define LZ_CODE_HEADER (0x10) +#define HUFF_CODE_HEADER (0x20) +#define RL_CODE_HEADER (0x30) +#define LH_CODE_HEADER (0x40) +#define LRC_CODE_HEADER (0x50) +#define CODE_HEADER_MASK (0xF0) + + +#if defined( __GNUC__ ) + typedef unsigned long long int u64; + typedef signed long long int s64; + #define INLINE inline + #define ASSERT(x) (void)0 +#else + #include + #define INLINE __inline + #define ASSERT assert + typedef unsigned __int64 u64; + typedef signed __int64 s64; +#endif + +#endif // __NTCOMPRESS_TYPES_H__ diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.sln b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.sln new file mode 100644 index 00000000..541afd75 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ntcompress", "ntcompress.vcproj", "{FA042C1E-4CB1-4B8A-87A6-B46B4222605E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {FA042C1E-4CB1-4B8A-87A6-B46B4222605E}.Debug.ActiveCfg = Debug|Win32 + {FA042C1E-4CB1-4B8A-87A6-B46B4222605E}.Debug.Build.0 = Debug|Win32 + {FA042C1E-4CB1-4B8A-87A6-B46B4222605E}.Release.ActiveCfg = Release|Win32 + {FA042C1E-4CB1-4B8A-87A6-B46B4222605E}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.vcproj b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.vcproj new file mode 100644 index 00000000..050e7b60 --- /dev/null +++ b/build/tests/compressSharedFontLoad/compSharedFont/ntrcomp/vc++/ntcompress.vcproj @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/Makefile b/build/tests/compressSharedFontLoad/testLoadSpeed/Makefile new file mode 100644 index 00000000..4f394d4f --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/Makefile @@ -0,0 +1,54 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - demos - FS - overlay +# File: Makefile +# +# Copyright 2007 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$ +#---------------------------------------------------------------------------- +TARGET_PLATFORM = TWL +TWL_ARCHGEN = LIMITED + + +ifeq ($(TEST_TWLSDK_REBUILD),TRUE) +export TWLSDK_SYSMENU_PRIVATE = TRUE +SUBDIRS = copy_to_sdk \ + $(ROOT) +endif # ifeq ($(TEST_TWLSDK_REBUILD),TRUE) + +#---------------------------------------------------------------------------- + +TARGET_BIN = main.srl + +SRCS = main.c loadSharedFont.c + +LLIBRARIES += libsharedfont$(TWL_LIBSUFFIX).a + +ROM_SPEC = ROM-TS_nand.rsf + +include $(TWLSDK_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + +MAKEROM_ARM7_BASE = $(TWL_COMPONENTSDIR)/armadillo/$(TWL_BUILDTYPE_ARM7)/armadillo +MAKEROM_ARM7 = $(MAKEROM_ARM7_BASE).$(TWL_ELF_EXT) +MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe + +#---------------------------------------------------------------------------- + +do-build: oslib $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +oslib: + touch $(ROOT)/build/libraries/os/ARM9.TWL/src/os_sharedFont.c + +#===== End of Makefile ===== diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/ROM-TS_nand.rsf b/build/tests/compressSharedFontLoad/testLoadSpeed/ROM-TS_nand.rsf new file mode 100644 index 00000000..8cb68fb1 --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/ROM-TS_nand.rsf @@ -0,0 +1,277 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "MY APP NAME" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingNormalJump FALSE + + # + # Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE] + # + #PermitLandingTmpJump FALSE + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # +################################################################ + + WramMapping MAP_TS_SCR + +################################################################ + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion ALL + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + # + # NANDAccess: NAND access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # Disp WiFiConnection Icon for Launcher [TRUE/FALSE] + # + #WiFiConnectionIcon FALSE + + # + # Disp DSWireless Icon for Launcher [TRUE/FALSE] + # + #DSWirelessIcon FALSE + + # + # Disable debug [TRUE/FALSE] + # + DisableDebug FALSE + + # + # Agree EULA [TRUE/FALSE] + # + #AgreeEULA FALSE + + # + # Agree EULA version [0 - 255] + # + #AgreeEULAVersion 0 + + ### + #### END +} + +AppendProperty +{ + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + + # + # Boot allowed Media: [GameCard] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode ABCJ + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile TRUE + + # + # Use Shared2 file index: [0-65535] + #Shared2FileIndex 0 + + # + # Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M] + #Shared2FileSize 0K + + # + # Game card power on: [TRUE/FALSE] + # + #GameCardOn FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} + +Rating +{ + # + # Permited age to play for each rating organization [0 - 31, ALWAYS, FREE] + # + # Supported organization + # - CERO (OGN0) : for Japan + # - ESRB (OGN1) : for North America + # - BBFC (OGN2) : obsolete organization + # - USK (OGN3) : for German + # - PEGI_GEN (OGN4) : for Europe + # - PEGI_FINLAND (OGN5) : obsolete organization + # - PEGI_PRT (OGN6) : for Portugal + # - PEGI_BBFC (OGN7) : for UK + # - OFLC (OGN8) : for Australia and NewZealand + # - GRB (OGN9) : for Korea + # - OGN10 : reserved + # - OGN11 : reserved + # - OGN12 : reserved + # - OGN13 : reserved + # - OGN14 : reserved + # - OGN15 : reserved + # + # Available age [ 0 - 31 / ALWAYS / FREE ] + + CERO FREE +# ESRB FREE +# USK FREE +# PEGI_GEN FREE +# PEGI_PRT FREE +# PEGI_BBFC FREE +# OFLC FREE +# GRB FREE +} diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/Makefile b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/Makefile new file mode 100644 index 00000000..a859f4e3 --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/Makefile @@ -0,0 +1,39 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL +# File: Makefile - +# +# Copyright 2007 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: +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +ORG_H = sharedFont.h +ORG_C = os_sharedFont.c + +CP_H_DIR = $(TWLSDK_ROOT)/include/twl/os/common +CP_C_DIR = $(TWLSDK_ROOT)/build/libraries/os/ARM9.TWL/src/ + +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + +do-build: + cp $(ORG_H) $(CP_H_DIR) + cp $(ORG_C) $(CP_C_DIR) + +#===== End of Makefile ===== diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/os_sharedFont.c b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/os_sharedFont.c new file mode 100644 index 00000000..d6f94dd1 --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/os_sharedFont.c @@ -0,0 +1,352 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS + File: os_sharedFont.c + + Copyright 2007 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 + +#ifdef USE_FONT_WRAM_LOAD +#include "fs_wram.h" +#endif // USE_FONT_WRAM_LOAD + +// compile switch-------------------------------------------------------------- +//#define DISABLE_HASH_CHECK + +// extern data----------------------------------------------------------------- +// define data----------------------------------------------------------------- +#ifdef USE_FONT_WRAM_LOAD +#define THREAD_PRIO_FS_FRAM 3 +#define WRAM_TOP_SLOT_FOR_FS 4 +#define WRAM_SIZE_FOR_FS MI_WRAM_SIZE_96KB +#endif // USE_FONT_WRAM_LOAD + +#define OS_SHARED_FONT_TABLE_PATH "nand:/" +#define OS_SHARED_FONT_FILE_NAME_LENGTH 0x20 +#define OS_SHARED_FONT_SIGN_SIZE 0x80 + +// 共有フォントテーブルヘッダ +typedef struct OSSharedFontHeader { + u32 timestamp; + u16 fontNum; + u8 pad[ 6 ]; + u8 digest[ SVC_SHA1_DIGEST_SIZE ]; +}OSSharedFontHeader; + +// 共有フォントテーブル +typedef struct OSSharedFontEntry { + u8 fileName[ OS_SHARED_FONT_FILE_NAME_LENGTH ]; +// u8 pad[ 4 ]; + u32 compLength; // 圧縮後サイズ + u32 offset; + u32 origLength; // 元のサイズ + u8 digest[ SVC_SHA1_DIGEST_SIZE ]; +}OSSharedFontEntry; + +// 共有フォントライブラリワーク +typedef struct OSSharedFontWork { + OSSharedFontHeader header; + OSSharedFontEntry *pInfoTable; +}OSSharedFontWork; + +#ifdef USE_FONT_WRAM_LOAD +// SHA1コールバック引数 +typedef struct CalcSHA1CallbackArg +{ + SVCSHA1Context ctx; + u32 hash_length; +} CalcSHA1CallbackArg; +#endif // USE_FONT_WRAM_LOAD + +// function's prototype------------------------------------------------------- +#ifdef USE_FONT_WRAM_LOAD +static void CalcSHA1Callback(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg); +#endif // USE_FONT_WRAM_LOAD + +// global variable------------------------------------------------------------- +// static variable------------------------------------------------------------- +static OSSharedFontWork s_work; +static BOOL s_isInitialized = FALSE; + +// const data------------------------------------------------------------------ +// 共有フォント署名確認用公開鍵 +static const u8 s_sharedFontPubKey[] = { + 0x9f, 0x80, 0xbc, 0x5f, 0xb6, 0xb6, 0x1d, 0x2a, 0x46, 0x02, 0x52, 0x64, 0xb2, 0xa3, 0x86, 0xce, + 0xe6, 0x54, 0xd3, 0xa9, 0x70, 0x5b, 0xe3, 0xc2, 0x10, 0xa9, 0xb5, 0x2f, 0x38, 0xc5, 0x51, 0xfb, + 0xb5, 0xd1, 0x80, 0xfd, 0xff, 0x20, 0x65, 0xc1, 0x28, 0x4d, 0x56, 0xbe, 0xfb, 0xbd, 0x3f, 0xe4, + 0xba, 0xf7, 0x9c, 0x3a, 0x33, 0x74, 0x74, 0x9d, 0xdb, 0xdd, 0x9e, 0x86, 0x05, 0x2c, 0xad, 0xfc, + 0x93, 0xfa, 0xfb, 0x08, 0xea, 0x71, 0x18, 0x36, 0xc5, 0xdc, 0x4c, 0x06, 0x34, 0x57, 0xa7, 0x8f, + 0x4e, 0x82, 0xf7, 0xb3, 0xe2, 0x9c, 0xe4, 0x72, 0xe3, 0xdc, 0x60, 0xaf, 0xcc, 0x18, 0xe2, 0xd4, + 0xef, 0xd2, 0x76, 0x47, 0x31, 0xe6, 0x14, 0x0e, 0x1d, 0x26, 0xb5, 0x85, 0x97, 0xbc, 0xc6, 0xb6, + 0xd8, 0xe7, 0x69, 0x2d, 0x2c, 0x26, 0xfb, 0x5f, 0x70, 0x9e, 0x19, 0x9c, 0x6b, 0x02, 0x6d, 0x97 +}; + +// 共有フォント初期化 +BOOL OS_InitSharedFont( void ) +{ + FSFile file[1]; + u8 signature[ OS_SHARED_FONT_SIGN_SIZE ]; + + if( s_isInitialized ) { + return TRUE; + } + + MI_CpuClear32( &s_work, sizeof(s_work) ); + + if( !FS_OpenFileEx( file, OS_SHARED_FONT_TABLE_PATH, FS_FILEMODE_R ) ) { + return FALSE; + } + + // 署名リード + if( FS_ReadFile( file, signature, OS_SHARED_FONT_SIGN_SIZE ) != OS_SHARED_FONT_SIGN_SIZE ){ + goto ERROR; + } + + // ヘッダリード + if( FS_ReadFile( file, &s_work.header, sizeof(OSSharedFontHeader) ) != sizeof(OSSharedFontHeader) ){ + goto ERROR; + } + + FS_CloseFile( file ); + +#ifndef DISABLE_HASH_CHECK + // ヘッダ署名チェック + { + u8 calc_digest[ SVC_SHA1_DIGEST_SIZE ]; + u8 sign_digest[ SVC_SHA1_DIGEST_SIZE ]; + static u32 heap[ 4096 / sizeof(u32) ]; + + SVCSignHeapContext acmemoryPool; + SVC_CalcSHA1( calc_digest, &s_work.header, sizeof(OSSharedFontHeader) ); + SVC_InitSignHeap( &acmemoryPool, heap, 4096 ); + if( !SVC_DecryptSign( &acmemoryPool, sign_digest, signature, s_sharedFontPubKey ) ) { + return FALSE; + } + if( !SVC_CompareSHA1( calc_digest, sign_digest ) ) { + return FALSE; + } + } +#endif + +#ifdef USE_FONT_WRAM_LOAD + // WRAM利用Read関数の準備、WRAMCの後半だけ解放しておく + FS_InitWramTransfer( THREAD_PRIO_FS_FRAM ); + MI_FreeWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM7 ); + MI_FreeWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM9 ); + MI_FreeWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_DSP ); + MI_CancelWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM7 ); + MI_CancelWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_ARM9 ); + MI_CancelWramSlot_C( WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, MI_WRAM_DSP ); +#endif // USE_FONT_WRAM_LOAD + + s_isInitialized = TRUE; + return TRUE; + +ERROR: + FS_CloseFile( file ); + return FALSE; +} + + +// 共有フォント テーブルサイズ取得 +int OS_GetSharedFontTableSize( void ) +{ + if( s_isInitialized ) { + return (int)( s_work.header.fontNum * sizeof(OSSharedFontEntry) ); + }else { + return -1; + } +} + + +// 共有フォント テーブルロード +BOOL OS_LoadSharedFontTable( void *pBuffer ) +{ + FSFile file[1]; + u32 tableLen = sizeof(OSSharedFontEntry) * s_work.header.fontNum; + + if( ( !s_isInitialized ) || + ( s_work.header.fontNum == 0 ) || + ( pBuffer == NULL ) || + ( s_work.pInfoTable ) ) { + return FALSE; + } + + // フォントテーブルリード + if( !FS_OpenFileEx( file, OS_SHARED_FONT_TABLE_PATH, FS_FILEMODE_R ) ) { + return FALSE; + } + if( !FS_SeekFile( file, OS_SHARED_FONT_SIGN_SIZE + sizeof(OSSharedFontHeader), FS_SEEK_SET ) ){ + goto ERROR; + } + if( FS_ReadFile( file, pBuffer, (int)tableLen ) != tableLen ){ + goto ERROR; + } + FS_CloseFile( file ); + +#ifndef DISABLE_HASH_CHECK + // フォントテーブル ハッシュチェック + { + u8 calc_digest[ SVC_SHA1_DIGEST_SIZE ]; + SVC_CalcSHA1( calc_digest, pBuffer, tableLen ); + if( !SVC_CompareSHA1( calc_digest, s_work.header.digest ) ) { + return FALSE; + } + } +#endif + + s_work.pInfoTable = pBuffer; + return TRUE; + +ERROR: + FS_CloseFile( file ); + return FALSE; +} + + +// 共有フォント フォントサイズ取得 +int OS_GetSharedFontSize( OSSharedFontIndex index ) +{ + if( ( s_isInitialized == NULL ) || + ( s_work.pInfoTable == NULL ) || + ( index >= s_work.header.fontNum ) || + ( index < 0 ) || + ( index >= OS_SHARED_FONT_MAX ) ) { + return -1; + } + + return (int)s_work.pInfoTable[ index ].origLength; +} + + +// 共有フォント 圧縮後フォントサイズ取得 +int OS_GetSharedFontCompressedSize( OSSharedFontIndex index ) +{ + if( ( s_isInitialized == NULL ) || + ( s_work.pInfoTable == NULL ) || + ( index >= s_work.header.fontNum ) || + ( index < 0 ) || + ( index >= OS_SHARED_FONT_MAX ) ) { + return -1; + } + + return (int)s_work.pInfoTable[ index ].compLength; +} + + +// 共有フォント フォントネーム取得 +const u8 *OS_GetSharedFontName( OSSharedFontIndex index ) +{ + if( ( s_isInitialized == NULL ) || + ( s_work.pInfoTable == NULL ) || + ( index >= s_work.header.fontNum ) || + ( index < 0 ) || + ( index >= OS_SHARED_FONT_MAX ) ) { + return NULL; + } + + return s_work.pInfoTable[ index ].fileName; +} + + +// 共有フォント タイムスタンプ取得 +u32 OS_GetSharedFontTimestamp( void ) +{ + if( ( s_isInitialized == NULL ) ) { + return 0; + } + return s_work.header.timestamp; +} + + +// 共有フォント フォントロード +BOOL OS_LoadSharedFont( OSSharedFontIndex index, void *pBuffer ) +{ + FSFile file[1]; + OSSharedFontEntry *pInfo = &s_work.pInfoTable[ index ]; + u8 calc_digest[ SVC_SHA1_DIGEST_SIZE ]; + + if( ( s_isInitialized == NULL ) || + ( s_work.pInfoTable == NULL ) || + ( index >= s_work.header.fontNum ) || + ( index < 0 ) || + ( index >= OS_SHARED_FONT_MAX ) ) { + return FALSE; + } + + // フォント リード + if( !FS_OpenFileEx( file, OS_SHARED_FONT_TABLE_PATH, FS_FILEMODE_R ) ) { + return FALSE; + } + if( !FS_SeekFile( file, (int)pInfo->offset, FS_SEEK_SET ) ){ + goto ERROR; + } +#ifdef USE_FONT_WRAM_LOAD + { + CalcSHA1CallbackArg arg; + SVC_SHA1Init( &arg.ctx ); + arg.hash_length = pInfo->compLength; + if( !FS_ReadFileViaWram( file, pBuffer, (s32)MATH_ROUNDUP( pInfo->compLength, 0x20 ), MI_WRAM_C, + WRAM_TOP_SLOT_FOR_FS, WRAM_SIZE_FOR_FS, +#ifndef DISABLE_HASH_CHECK + CalcSHA1Callback, +#else + NULL, +#endif // DISABLE_HASH_CHECK + &arg ) ) { + goto ERROR; + } + SVC_SHA1GetHash( &arg.ctx, &calc_digest ); + } +#else + if( FS_ReadFile( file, pBuffer, (int)pInfo->compLength ) != pInfo->compLength ){ + goto ERROR; + } +#ifndef DISABLE_HASH_CHECK + SVC_CalcSHA1( calc_digest, pBuffer, pInfo->compLength ); +#endif // DISABLE_HASH_CHECK +#endif // USE_FONT_WRAM_LOAD + + FS_CloseFile( file ); + +#ifndef DISABLE_HASH_CHECK + // フォント ハッシュチェック + if( !SVC_CompareSHA1( calc_digest, pInfo->digest ) ) { + return FALSE; + } +#endif // DISABLE_HASH_CHECK + + return TRUE; + +ERROR: + FS_CloseFile( file ); + return FALSE; +} + + +#ifdef USE_FONT_WRAM_LOAD +// FS-WRAM転送時のSHA1計算コールバック +static void CalcSHA1Callback(const void* addr, const void* orig_addr, u32 len, MIWramPos wram, s32 slot, void* arg) +{ +#pragma unused(orig_addr) +#pragma unused(wram) +#pragma unused(slot) + CalcSHA1CallbackArg *cba = (CalcSHA1CallbackArg *)arg; + u32 calc_len = ( cba->hash_length < len ? cba->hash_length : len ); + if( calc_len == 0 ) return; + cba->hash_length -= calc_len; + SVC_SHA1Update( &cba->ctx, addr, calc_len ); +} +#endif // USE_FONT_WRAM_LOAD diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/sharedFont.h b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/sharedFont.h new file mode 100644 index 00000000..98447dda --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/copy_to_sdk/sharedFont.h @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - include + File: sharedFont.h + + Copyright 2007 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 TWL_OS_SHARED_FONT_H_ +#define TWL_OS_SHARED_FONT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 + +// 共有フォントインデックス +typedef enum OSSharedFontIndex { + OS_SHARED_FONT_WW_L = 0, + OS_SHARED_FONT_WW_M = 1, + OS_SHARED_FONT_WW_S = 2, + OS_SHARED_FONT_MAX = 3 +}OSSharedFontIndex; + + +// 共有フォント初期化 +BOOL OS_InitSharedFont( void ); + +// 共有フォント テーブルサイズ取得 +int OS_GetSharedFontTableSize( void ); + +// 共有フォント テーブルロード +BOOL OS_LoadSharedFontTable( void *pBuffer ); + +// 共有フォント フォントサイズ取得 +int OS_GetSharedFontSize( OSSharedFontIndex index ); + +// 共有フォント 圧縮後サイズ取得 +int OS_GetSharedFontCompressedSize( OSSharedFontIndex index ); + +// 共有フォント フォントネーム取得 +const u8 *OS_GetSharedFontName( OSSharedFontIndex index ); + +// 共有フォント タイムスタンプ取得 +u32 OS_GetSharedFontTimestamp( void ); + +// 共有フォント フォントロード +BOOL OS_LoadSharedFont( OSSharedFontIndex index, void *pBuffer ); + +#endif // SDK_ARM9 + +#ifdef __cplusplus +} +#endif + +#endif // TWL_OS_SHARED_FONT_H_ diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.c b/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.c new file mode 100644 index 00000000..4fbb98a5 --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.c @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.c + + Copyright 2007 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 "loadSharedFont.h" + +// 圧縮フォントを解凍するときは1にする +#define UNCOMPRESS_FONTS 1 + +// 前方圧縮のときには1にする +#define FORWARD_COMPRESS 0 + +// extern data----------------------------------------------------------------- + +// function's prototype------------------------------------------------------- +BOOL g_isSucceededLoad[ OS_SHARED_FONT_MAX ]; + +// static variable------------------------------------------------------------- +static u8 *s_pFontBuffer[ OS_SHARED_FONT_MAX ]; // 読み込みはテストなのでロード先はstatic変数にしている。 +static BOOL s_isStarted = FALSE; +static u8 *s_pCompressedBuffer[ OS_SHARED_FONT_MAX ]; // 圧縮用TempBuffer + +// const data------------------------------------------------------------------ + + +// ============================================================================ +// 共有フォントロード +// ============================================================================ +void LoadSharedFont( STicks *pTicks ) +{ + u8 *pBuffer; + int size; + OSSharedFontIndex i; + OSTick starttick; + + pTicks->all = 0; + pTicks->comp = 0; + + if( s_isStarted ) return; + + starttick = OS_GetTick(); + + // フォントロード準備 + if( !OS_InitSharedFont() ) { + OS_TPrintf( "OS_InitSharedFont failed.\n" ); + return; + } + size = OS_GetSharedFontTableSize(); + if( size < 0 ) { + OS_TPrintf( "OS_GetSharedTableSize failed.\n" ); + return; + } + + pBuffer = OS_Alloc( (u32)size ); + if( pBuffer == NULL ) { + OS_TPrintf( "malloc failed.\n" ); + return; + } + if( !OS_LoadSharedFontTable( pBuffer ) ) { + OS_TPrintf( "OS_LoadSharedTable failed.\n" ); + return; + } + + for( i = OS_SHARED_FONT_WW_L; i < OS_SHARED_FONT_MAX; i++ ) + { + int origsize; +#if (UNCOMPRESS_FONTS==1) + int compsize; + int comperr; + OSTick comptick; +#endif + + OS_TPrintf( "%s read.\n", OS_GetSharedFontName( i ) ); + + // フォントの元の(解凍後の)サイズ + origsize = OS_GetSharedFontSize( i ); + if( origsize < 0 ) + { + OS_TPrintf( " get font size failed.\n" ); + } + origsize = MATH_ROUNDUP( origsize, 32 ); // FSのキャッシュが怪しそうなので、とりあえずアラインメントをとっておく。 + OS_TPrintf( " original size = %d\n", origsize ); + +#if (UNCOMPRESS_FONTS==1) + compsize = OS_GetSharedFontCompressedSize( i ); + if( compsize < 0 ) + { + OS_TPrintf( " get compressed font size failed.\n" ); + } + OS_TPrintf( " compressed size = %d\n", compsize ); +#endif + + s_pFontBuffer[ i ] = OS_Alloc( (u32)origsize ); // 元のフォントサイズでバッファ確保 + if( s_pFontBuffer[ i ] == NULL ) + { + OS_TPrintf( " malloc failed.\n" ); + } + + // 圧縮後のフォントをロード +#if (FORWARD_COMPRESS==1) + s_pCompressedBuffer[i] = OS_Alloc( (u32)MATH_ROUNDUP( compsize, 32 ) ); + if( OS_LoadSharedFont( i, s_pCompressedBuffer[ i ] ) ) +#else + if( OS_LoadSharedFont( i, s_pFontBuffer[ i ] ) ) +#endif + { + OS_TPrintf( " load succeeded.\n" ); + g_isSucceededLoad[ i ] = TRUE; + } + else + { + OS_TPrintf( " load failed.\n" ); + g_isSucceededLoad[ i ] = FALSE; + } + + // 解凍 +#if (UNCOMPRESS_FONTS==1) + comptick = OS_GetTick(); + OS_TPrintf( " uncompress font\n" ); +#if (FORWARD_COMPRESS==1) + //comperr = MI_SecureUncompressLZ( s_pCompressedBuffer[i], (u32)compsize, s_pFontBuffer[i], (u32)origsize ); + //comperr = MI_SecureUncompressHuffman( s_pCompressedBuffer[i], (u32)compsize, s_pFontBuffer[i], (u32)origsize ); + MI_UncompressHuffman( s_pCompressedBuffer[i], s_pFontBuffer[i] ); + comperr = MI_ERR_SUCCESS; +#else + comperr = MI_SecureUncompressBLZ( s_pFontBuffer[i], (u32)compsize, (u32)origsize ); +#endif + if( MI_ERR_SUCCESS == comperr ) + { + OS_TPrintf( " uncompression succeeded\n" ); + } + else + { + OS_TPrintf( " uncompression failed %d\n", comperr ); + } + pTicks->comp += (OS_GetTick() - comptick); // 解凍にかかった時間 +#endif + } + + // 全部の処理にかかった時間 + pTicks->all = OS_GetTick() - starttick; + + s_isStarted = TRUE; +} + +void WriteFontIntoSD( void ) +{ + u8 *pFont = NULL; + int size; + OSSharedFontIndex i; + char str[100]; + FSFile fp[1]; + + FS_InitFile( fp ); + + for( i = OS_SHARED_FONT_WW_L; i < OS_SHARED_FONT_MAX; i++ ) + { + pFont = s_pFontBuffer[i]; + size = OS_GetSharedFontSize(i); + if( pFont != NULL) + { + STD_TSPrintf( str, "sdmc:/%s.uncomp", OS_GetSharedFontName(i) ); + FS_DeleteFile( str ); + if( !FS_CreateFile( str, FS_PERMIT_R|FS_PERMIT_W ) ) + { + OS_TPrintf( "sd create failed %d\n", FS_GetArchiveResultCode(str) ); + } + if( FS_OpenFileEx( fp, str, FS_FILEMODE_W ) ) + { + FS_WriteFile( fp, pFont, size ); + FS_CloseFile( fp ); + OS_TPrintf( "%s is written\n", str ); + } + else + { + OS_TPrintf( "sd write failed %d\n", FS_GetArchiveResultCode(str) ); + } + } + } +} + + + + diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.h b/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.h new file mode 100644 index 00000000..4095ee9c --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/src/loadSharedFont.h @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: loadSharedFont.h + + Copyright 2007 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 __LOAD_SHARED_FONT_H__ +#define __LOAD_SHARED_FONT_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data------------------------------------------------------- +typedef struct _STicks +{ + OSTick all; // 全部の時間 + OSTick comp; // 解凍の時間 +} STicks; + +// global variables-------------------------------------------------- +extern BOOL g_isSucceededLoad[ OS_SHARED_FONT_MAX ]; + +// function---------------------------------------------------------- +void LoadSharedFont( STicks *pTicks ); +void WriteFontIntoSD( void ); + +#ifdef __cplusplus +} +#endif + +#endif // __LOAD_SHARED_FONT_H__ diff --git a/build/tests/compressSharedFontLoad/testLoadSpeed/src/main.c b/build/tests/compressSharedFontLoad/testLoadSpeed/src/main.c new file mode 100644 index 00000000..ce1781e3 --- /dev/null +++ b/build/tests/compressSharedFontLoad/testLoadSpeed/src/main.c @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos - FS - overlay + File: main.c + + Copyright 2007 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 "DEMO.h" +#include "loadSharedFont.h" + +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: NitroMain + + Description: アプリケーションメインエントリ + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void NitroMain(void) +{ + STicks ticks; + + OS_Init(); + OS_InitTick(); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + { + OSHeapHandle hh; + void *tmp; + tmp = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1); + OS_SetArenaLo(OS_ARENA_MAIN, tmp); + hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi()); + if (hh < 0) + { + OS_TPanic("ARM9: Fail to create heap...\n"); + } + (void)OS_SetCurrentHeap(OS_ARENA_MAIN, hh); + } + + DEMOInitCommon(); + DEMOInitVRAM(); + DEMOInitDisplayBitmap(); + DEMOHookConsole(); + + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 0, 1)); + DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR); + DEMOStartDisplay(); + + FS_Init(FS_DMA_NOT_USE); + + OS_TPrintf("--------------------------------\n" + "Shared Font sample.\n"); + + LoadSharedFont( &ticks ); + + // 結果表示 + { + int i; + int ox = 10; + int oy = 60; + + DEMOFillRect(0, 0, GX_LCD_SIZE_X, GX_LCD_SIZE_Y, DEMO_RGB_CLEAR); + DEMOSetBitmapTextColor(GX_RGBA(0, 31, 0, 1)); + DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1)); + DEMODrawFrame(ox, oy, 240, 10 + OS_SHARED_FONT_MAX * 10 + 20, GX_RGBA( 0, 31, 0, 1)); + for (i = 0; i < OS_SHARED_FONT_MAX; ++i) + { + DEMODrawText(ox + 10, oy + 5 + i * 10, "%s load %s", + OS_GetSharedFontName( (OSSharedFontIndex)i ), g_isSucceededLoad[ i ] ? "suceeded" : "failed"); + } + DEMODrawText(ox + 10, oy + 5 + OS_SHARED_FONT_MAX * 10, "all time %d msec", OS_TicksToMilliSeconds(ticks.all) ); + DEMODrawText(ox + 10, oy + 5 + OS_SHARED_FONT_MAX * 10 + 10, "comp time %d msec", OS_TicksToMilliSeconds(ticks.comp) ); + } + DEMO_DrawFlip(); + + WriteFontIntoSD(); + OS_TPrintf( "end\n" ); + OS_WaitVBlankIntr(); + + OS_Terminate(); +} + + diff --git a/build/tests/yuv2rgb/Makefile b/build/tests/yuv2rgb/Makefile new file mode 100644 index 00000000..3bf6d022 --- /dev/null +++ b/build/tests/yuv2rgb/Makefile @@ -0,0 +1,121 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: TwlSDK - YUV2RGB +# File: Makefile +# +# 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:$ +#--------------------------------------------------------------------------- + +ifdef TWL_IPL_RED_ROOT +#コンポーネントを切り替えます。 +#コメントアウトするとracoonを、有効化するとjackalを使います。 +#下の行を変更したらmake cleanしてください。 +TWL_IPL_USE_RED_IPL := TRUE +endif + +ifdef TWL_IPL_USE_RED_IPL +TARGET_FIRM = SYSTEMMENU +REBOOT_LIB = libreboot$(TWL_LIBSUFFIX).a +LDEPENDS_NEF += $(REBOOT_LIB) +ADDRESS_DTCM = 0x0e000000 +DEFAULT_COMP_ARM7 = jackal +MAKEROM_FLAGS += -F +LCFILE_SPEC = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lsf +LCFILE_TEMPLATE = $(SYSMENU_ROOT)/build/systemMenu_RED/Launcher/ARM9/ARM9-TS.lcf.template +MACRO_FLAGS += -DTWL_IPL_USE_RED_IPL +MAKELCF_FLAGS += -DREBOOT_LIB='$(REBOOT_LIB)' +endif + + +TARGET_PLATFORM := TWL +TWL_PROC := ARM9 +TWL_ARCHGEN := LIMITED + +TARGET_BIN = main.srl +ROM_SPEC_TEMPLATE = yuv2rgb.rsf.template +ROM_SPEC = yuv2rgb.autogen.rsf +SRCS = snd_data.c mainy.cpp new.cpp cpu_yuv2rgb.c menuIrqHandler.c menuCameraManager.cpp #dsp_yuv2rgb.c +DATA_DIR = ./data +EXT_OBJS += $(patsubst $(DATA_DIR)/%.dat,$(OBJDIR)/%.o,$(wildcard $(DATA_DIR)/*.dat)) + +# DSPファームウェアを定数として静的リンクする。 +#DSP_FIRMWARE_DIR = $(ROOT)/build/dspcomponents/build/tests/yuv2rgb/bin +#DATA_DIR = . +#EXT_OBJS += $(patsubst $(DSP_FIRMWARE_DIR)/%.a,$(OBJDIR)/%.o,$(wildcard $(DSP_FIRMWARE_DIR)/*.a)) + +MACRO_FLAGS += -DTWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + +#---------------------------------------------------------------------------- + +ifdef TWL_IPL_USE_RED_IPL +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs +include $(TWLSDK_ROOT)/build/libraries/reboot/commondefs.reboot +MAKEROM := $(TWL_IPL_RED_ROOT)/tools/bin/makerom.TWL.launcher.exe +else +include $(TWLSDK_ROOT)/build/buildtools/commondefs +endif +include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib + + +LLIBRARIES += libcpu_jpegEncoder$(TWL_LIBSUFFIX).a + + +#---------------------------------------------------------------------------- + +#do-build: $(ROM_SPEC) prepare $(TARGETS) +do-build: $(ROM_SPEC) $(TARGETS) + +#SUBDIRS = ../../../dspcomponents/build/tests/yuv2rgb + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +# UIGランチャーのソースをそのままコピーします。 +.PHONY: prepare +prepare: + cp -p $(TWL_IPL_ROOT)/menu/scene/src/menuCameraManager.cpp src + cp -p $(TWL_IPL_ROOT)/menu/scene/include/menuCameraManager.h include + +ifdef TWL_IPL_USE_RED_IPL +# for $(SYSMENU_LIBS) +include redipl_defs_autogen_by_uig +LLIBRARIES += $(SYSMENU_LIBS) + +$(ROM_SPEC): $(ROM_SPEC_TEMPLATE) Makefile + grep -v MAKEROM_WRAM_MAPPING $(ROM_SPEC_TEMPLATE) | grep -v NTRJ | grep -v User > $(ROM_SPEC) + +else +$(ROM_SPEC): $(ROM_SPEC_TEMPLATE) Makefile + grep -v WramMappingDirect $(ROM_SPEC_TEMPLATE) | grep -v HNAJ | grep -v Secure | grep -v System | grep -v HwAESSlot > $(ROM_SPEC) + +endif + +LDIRT_CLEAN += $(ROM_SPEC) + +#---------------------------------------------------------------------------- + +$(OBJDIR)/%.o : $(DATA_DIR)/%.dat + $(BIN2OBJ) --compatible $< $@ >/dev/null + +$(DATA_DIR)/%.dat : $(call eupath,$(DSP_FIRMWARE_DIR)/%.a) + cp -T $< $@ + + +ZIPDIR=$(notdir $(shell pwd)) +ZIPFILE=$(HOME)/$(ZIPDIR)-$(shell date +%y%m%d_%H%M).zip +.PHONY: zip +zip: + @cd .. && find $(ZIPDIR) ! -type d | grep -v -e \~ -e .tmp -e .svn -e .obj -e /bin/ -e /depend/ -e /obj/ | zip $(ZIPFILE) -@ + @ls -l $(ZIPFILE) + + +#===== End of Makefile ===== diff --git a/build/tests/yuv2rgb/data/camera_shutter.dat b/build/tests/yuv2rgb/data/camera_shutter.dat new file mode 100644 index 00000000..14b56eb5 Binary files /dev/null and b/build/tests/yuv2rgb/data/camera_shutter.dat differ diff --git a/build/tests/yuv2rgb/data/camera_shutter_MONO.dat b/build/tests/yuv2rgb/data/camera_shutter_MONO.dat new file mode 100644 index 00000000..4d8cf1c7 Binary files /dev/null and b/build/tests/yuv2rgb/data/camera_shutter_MONO.dat differ diff --git a/build/tests/yuv2rgb/data/wheel.dat b/build/tests/yuv2rgb/data/wheel.dat new file mode 100644 index 00000000..81a737dc Binary files /dev/null and b/build/tests/yuv2rgb/data/wheel.dat differ diff --git a/build/tests/yuv2rgb/include/const.h b/build/tests/yuv2rgb/include/const.h new file mode 100644 index 00000000..e3db50e6 --- /dev/null +++ b/build/tests/yuv2rgb/include/const.h @@ -0,0 +1,36 @@ +#define cScreenWidth 256 +#define cScreenHeight 192 +#define cPhotoWidth 640 +#define cPhotoHeight 480 +// #define cThreadPriority_LauncherCameraHi (OS_THREAD_LAUNCHER_PRIORITY - 1) +// #define cThreadPriority_LauncherCameraLo (OS_THREAD_LAUNCHER_PRIORITY + 1) +// #define cThreadPriority_LauncherCameraShot (OS_THREAD_LAUNCHER_PRIORITY + 2) +#define IPL_ASSERT(exp) if ( !( exp ) ) IPL_HALT( #exp ) +#define IPL_PRINT OS_TPrintf +#define IPL_HALT OS_TPanic + +namespace menu { namespace sys { +class Object +{ +public: +// // スレッド優先順位。 +// enum +// { +// cThreadPriority_LauncherCameraHi = OS_THREAD_LAUNCHER_PRIORITY - 1, +// cThreadPriority_LauncherCameraLo = OS_THREAD_LAUNCHER_PRIORITY + 1, +// cThreadPriority_LauncherCameraShot = OS_THREAD_LAUNCHER_PRIORITY + 2, +// cThreadPriority_UpPicture = OS_THREAD_LAUNCHER_PRIORITY + 3 +// }; + + // 作り直し版 スレッド優先度。 + enum + { + // 優先度は検討が必要。 + cThreadPriority_CameraI2c = OS_THREAD_LAUNCHER_PRIORITY - 2, + cThreadPriority_CameraLowerHi = OS_THREAD_LAUNCHER_PRIORITY - 1, + + cThreadPriority_CameraLowerLo = OS_THREAD_LAUNCHER_PRIORITY + 10 + }; + +}; +}} diff --git a/build/tests/yuv2rgb/include/menuCameraManager.h b/build/tests/yuv2rgb/include/menuCameraManager.h new file mode 100644 index 00000000..2c67d505 --- /dev/null +++ b/build/tests/yuv2rgb/include/menuCameraManager.h @@ -0,0 +1,381 @@ +// 落ち着いたらcmnCameraManager.hへ持っていく。 + +#ifndef MENU_CAMERA_MANAGER_H_ +#define MENU_CAMERA_MANAGER_H_ + +//#define TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +// まだDSP版JPEGライブラリを使う。 +//#define TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#endif + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#include "const.h" +#endif + +namespace cmn { namespace sys { namespace cmr2 +{ + + // eMode_Texのみ対応。 +// カメラモード +enum +{ + eMode_BG = 0 , + eMode_Tex , + eMode_BGSingle , + eMode_Max +}; + +// 定数 +enum +{ + cDefaultShowWidth = cScreenWidth , + cDefaultShowHeight = cScreenHeight , + cDefaultShotWidth = cPhotoWidth , + cDefaultShotHeight = cPhotoHeight , + + cEncodeResultSizeMax = cPhotoWidth * cPhotoHeight, + cEncodeQuality = 90, + cEncodeSampling = 2, + + cBufferCount = 2 , + + cCaptureRetryMax = 20, + + cDefaultDmaNo = 1 +}; + +enum +{ + cMsgI2c_Destroy = 0, + cMsgI2c_AfterInit, + cMsgI2c_Activate, + +// cMsgI2c_ChangeSizeToShot, +// cMsgI2c_ChangeSizeToShow, + + cMsgI2c_ChangeLedToOn, + cMsgI2c_ChangeLedToBlink, + + cMsgI2c_Max +}; + + + +enum +{ + // CAMERASelectはビットマスクなので注意。 + cCameraIndex_In = 0, + cCameraIndex_Out, + cCameraMax +}; + +enum +{ + // 通常時でも、起動直後に3回出る。 +// CAMERA_RESULT_BUSY type 0 retry 0 +// CAMERA_RESULT_BUSY type 0 retry 1 +// CAMERA_RESULT_BUSY type 0 retry 2 + + + cI2cRetryMax = 30, + cI2cRetryIntervalMsec = 100 +}; + +enum +{ + cI2cCommon_Activate = 0, + cI2cCommon_FrameRate, + cI2cCommon_ContextSwitch, + cI2cCommon_LedOn, + cI2cCommon_LedBlink, + + cI2cCommon_Max +}; + + +struct dtcmWork { + u32 mShrinkBuf[208*3]; // max(256*2,208*3) * sizeof(u32) + u64 mYuvBuf[12]; +}; + +typedef struct { + CAMERAContext mContext; + CAMERAFrameRate mFrameRate; +} cameraState; + +class Manager +{ +public: + // サイズはinit()で指定する。 + Manager(); + ~Manager(); + + void preInit( u32 show_w, u32 show_h, u32 shot_w, u32 shot_h ); + void preInit() { + preInit( mShowWdt, mShowHgt, mShotWdt, mShotHgt ); + } + + void init( +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + sys::Heap* p_heap , +#endif + int mode , CAMERASelect sel_cmr , int vram1 , int vram2 , + cmn::sys::cmr2::dtcmWork* pDtcmWork , + void (*gx_user_proc)(u8* vramAddr, BOOL shot) , + u32 show_w, u32 show_h, u32 shot_w, u32 shot_h ); + + void init( +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + sys::Heap* p_heap , +#endif + int mode , CAMERASelect sel_cmr , int vram1 , int vram2 , + cmn::sys::cmr2::dtcmWork* pDtcmWork , + void (*gx_user_proc)(u8* vramAddr, BOOL shot) ) { + init( +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + p_heap , +#endif + mode, sel_cmr, vram1, vram2, + pDtcmWork, gx_user_proc, + mShowWdt, mShowHgt, mShotWdt, mShotHgt ); + } + + BOOL tryDestroy(); + + void activate(); + + void changeCamera( CAMERASelect sel_cmr ) { mNextCmr = sel_cmr; } + void changeCamera() + { + changeCamera( mNextCmr == CAMERA_SELECT_IN ? CAMERA_SELECT_OUT : CAMERA_SELECT_IN ); + } + + // 「内(外)カメラに切り替えました」旨のメッセージを表示する場合、 + // 厳密に今の瞬間のカメラではなく、 + // 最終的にどちらのカメラが有効になるかを返せば良いと思うので + // mNextCmrを返す。 + CAMERASelect getCurrentCamera() const { return mNextCmr; } + // でも、切り替えにタイムラグがあるので、切り替え中かどうかを + // 知る方法も用意する。 + // mCaptureSkipCountは、他の要因(例えばカメラ解像度切り替え中)でも + // 0でなくなる。その場合にこの関数が一瞬0でなくなるが、 + // IN/OUT切り替え中の判定のために呼び出す限りは問題ないはず。 + BOOL isCameraChanging() { return ((mSelCmr != mNextCmr) || mCaptureSkipCount); } + + void startCapture(CAMERASelect sel_cmr); + void startCapture() { + startCapture(mNextCmr); + } + void stopCapture() { mNextCaptureFlag = FALSE; } + BOOL isCaptureBusy() { return (mCaptureFlag || mNextCaptureFlag); } + BOOL isSaveBusy() { return mEncodeBusyFlag; } + BOOL shoot(BOOL keepCapture = FALSE); + BOOL tryPrepareToSleep(); + +// void setShutterSnd( const u8* p_wav , u32 size , BOOL stereo ); +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +// void startShutterSnd(); +// void finishShutterSnd(); +// BOOL isFinishedShutterSnd() const; +// #endif + + virtual void procVBlankIntr(); + virtual void procCameraIntr(); + virtual u16* procPreCapture(); + virtual void procPostCapture(); + virtual void procPostConvert(BOOL shot); + virtual void procPostShot(); + virtual u16* allocCapBuf(); + virtual void freeCapBufByPtr(const u16* pBuf); + BOOL isShotDone() { return mShotDone; } + void clearShotDone() { mShotDone = FALSE; } + void setTexSwap() { mTexSwap = TRUE; } +// int getTexBank() { return mTexBank; } + void setOneShotFlag(BOOL flag) { mOneShotFlag = (u8)flag; } + BOOL getOneShotFlag() { return mOneShotFlag; } + virtual BOOL convert(BOOL shot); + + void setCaptureRgbFlag(BOOL useRgb); + BOOL isFirstPictureReady() { return mFirstPictureReady; } + +#ifndef TWL_IPL_FINAL +public: + vu32 mDebugPort; +#endif + +private: + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + sys::Heap* mpHeap; +#endif + + u8 mLedKeepFlag; + u8 mOneShotFlag; + u8 mCaptureRgbFlag; + + vu8 mEncodeBusyFlag; + + vu8 mPreInitFlag; + vu8 mInitFlag; + vu8 mPreInitBusyFlag; + vu8 mInitBusyFlag; + + u32 mEncodeOption; + + static vu8 mCaptureFlag; + static vu8 mNextCaptureFlag; + static vu8 mShotFlag; + static vu8 mNextShotFlag; + + vu8 mShotDone; + vu8 mTexSwap; + vu8 mI2cBusy; +#if SDK_VERSION_DATE < 20080630 + vu8 mIntrPositiveEdge; +#else + // intr edgeはCAMERAライブラリがハンドリングする。 +#endif + vu8 mFirstPictureReady; + + vu32 mShotErr; + + u32 mCaptureSkipCount; + u32 mCaptureRetryCount; + + u8 mIsCapBufUsed[2]; + u16* mpCapBuf[2]; + vu16* mpCaptureBuf; + vu16* mpConvBuf; + vu16* mpNextConvBuf; + vu16* mpShotBuf; + dtcmWork* mpDtcmWork; + + volatile int mTexBank; + volatile int mNextTexBank; + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + struct encodeWork { + u16 y[cPhotoWidth * cPhotoHeight]; + u16 cbcr[(cPhotoWidth * cPhotoHeight / 4) * 2]; + } *mpEncodeWork; +#else + u8* mpEncodeWork; +#endif + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + u8* mpEncodeResult; +#endif + + int mTarget; + + u32 mShowWdt; + u32 mShowHgt; + u32 mShotWdt; + u32 mShotHgt; + int mShowTransferLines; + int mShotTransferLines; + + int mMode; + + u32 mGxDma; + + int mVramType[ 2 ]; + u8* mVramAddr[ 2 ]; + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + const u8* mpShutterSnd; + u32 mShutterSndSize; + BOOL mShutterStereo; +#endif + + MINDmaConfig mDmaConfig; + + // 手元の実験ではmpTaskが使えないので… + OSThread mLowerThread; + OSThread mI2cThread; + u64 mLowerThreadStack[2048]; // JPEGを使うので、念のため16KBで。 + u64 mI2cThreadStack[1024]; + OSMessage mI2cMsgBuf[1]; + OSMessageQueue mI2cMsgQueue; + enum { + cEventMaskLower_Destroy = 1 << 0, + cEventMaskLower_EnableIntrAndPrepareBuffer = 1 << 1, + cEventMaskLower_DisableIntrAndDestroyBuffer = 1 << 2, + cEventMaskLower_Convert = 1 << 3, + cEventMaskLower_Shot = 1 << 4, + cEventMaskLower_NextConvertAndShot = 1 << 5, + cEventMaskLower_Activate = 1 << 6, + + cEventMaskLower_All = 0xffffffff + }; + OSEvent mLowerEvent; + void procLower(); + void procI2c(); + static void procLower_(void* p_arg) { + reinterpret_cast(p_arg)->procLower(); + } + static void procI2c_(void* p_arg) { + reinterpret_cast(p_arg)->procI2c(); + } + + static OSMessage mI2cAsyncMsgBuf[1]; + static OSMessageQueue mI2cAsyncMsgQueue; + CAMERAResult i2cCommon(u32 type, CAMERASelect sel_cmr); + CAMERAResult i2cSetupOthers(); + CAMERAResult i2cActivate(CAMERASelect sel_cmr); + CAMERAResult i2cFrameRate(CAMERASelect sel_cmr); + CAMERAResult i2cContextSwitch(CAMERASelect sel_cmr); + CAMERAResult i2cLed(BOOL isBlink); + static void i2cCommonAsyncCallback(CAMERAResult result, void *arg); + static void i2cActivateCallback(CAMERAResult result, void *arg); + static void i2cFrameRateCallback(CAMERAResult result, void *arg); + static void i2cContextSwitchCallback(CAMERAResult result, void *arg); + static void i2cLedCallback(CAMERAResult result, void *arg); + + CAMERASelect indexToCameraSelect(u32 i) { return (CAMERASelect)(CAMERA_SELECT_IN << i); } + static BOOL isOutCamera(CAMERASelect sel_cmr) { return (sel_cmr == CAMERA_SELECT_OUT); } + + static vu8 mCurLedBlink; + static volatile CAMERASelect mSelCmr; + static volatile CAMERASelect mNextCmr; + + static volatile cameraState mCmrCurState[cCameraMax]; + static volatile cameraState mCmrNextState[cCameraMax]; + + void prepareBuffer(); + void destroyBuffer(); + void useNextConvBuf(); + void encodeAndSave(); + void setInterrupt(BOOL enable); + + void (*mpGxUserProc)(u8* vramAddr, BOOL shot); + BOOL writeJpegToSD(const u8* src, u32 size); +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else + BOOL writeJpegToNand(const u8* src, u32 size); +#endif + + // if non-static, CW claims: + // Error: 'pDtcm' could not be assigned to a register + // Error: internal compiler error (report to ...) + // while executing in file 'PCodeAssembly.c' line: 468 + static void Shrink640Yuv422To208Rgb555( const void* src, void* dst, u32 height, void* pDtcm ); + static void Shrink640Yuv422To256Rgb555( const void* src, void* dst, u32 height, void* pDtcm ); + static void Convert8bitYuv422To16bitYuv420( const u32* src, u16* pYCbCrBuf, u32 width, u32 height, void* pDtcm_ ); + +}; + +}}} + +#endif diff --git a/build/tests/yuv2rgb/include/new.h b/build/tests/yuv2rgb/include/new.h new file mode 100644 index 00000000..822167fc --- /dev/null +++ b/build/tests/yuv2rgb/include/new.h @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - OS - demos - cplusplus-1 + File: new.h + + Copyright 2003-2007 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. + + $Log: new.h,v $ + Revision 1.6 2007/02/20 00:28:10 kitase_hirotake + indent source + + Revision 1.5 2006/01/18 02:11:30 kitase_hirotake + do-indent + + Revision 1.4 2005/02/28 05:26:27 yosizaki + do-indent. + + Revision 1.3 2004/03/08 08:55:47 yada + fix top comment + + Revision 1.2 2004/02/20 00:04:05 yasu + add comments + + Revision 1.1 2004/02/18 04:19:30 yada + C++デモ + + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef MY_NEW_H_ +#define MY_NEW_H_ + +void *operator new(std::size_t blocksize); +void *operator new[] (std::size_t blocksize); +void operator delete(void *block) throw(); +void operator delete[] (void *block)throw(); + +/* MY_NEW_H_ */ +#endif diff --git a/build/tests/yuv2rgb/include/snd_data.h b/build/tests/yuv2rgb/include/snd_data.h new file mode 100644 index 00000000..89a4e28b --- /dev/null +++ b/build/tests/yuv2rgb/include/snd_data.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: snd_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 SND_DATA_H_ +#define SND_DATA_H_ +#ifdef __cplusplus +extern "C" { +#endif +/*---------------------------------------------------------------------------*/ + +#include + +extern const u8 sound_seq_data[]; +extern const u8 sound_bank_data[]; +extern const u8 sound_wave_data[]; + +/*---------------------------------------------------------------------------*/ +#ifdef __cplusplus +} // extern "C" +#endif +#endif // SND_DATA_H_ diff --git a/build/tests/yuv2rgb/include/yuv2rgb.h b/build/tests/yuv2rgb/include/yuv2rgb.h new file mode 100644 index 00000000..7f06cbab --- /dev/null +++ b/build/tests/yuv2rgb/include/yuv2rgb.h @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - YUV2RGB + File: cpu_yuv2rgb.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 YUV2RGB_H_ +#define YUV2RGB_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DSP_DMA_NOT_USE 0xFFFFFFFFUL + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +typedef struct YUYV +{ + u8 y1; + u8 u; + u8 y2; + u8 v; +} YUYV; + +typedef struct RGBX16 +{ + u16 r:5; + u16 g:5; + u16 b:5; + u16 x:1; +} RGBX16; + +typedef void (*YUV2RGBCallback)(void); + +typedef enum _MessageYuv2Rgb +{ + MESSAGE_YUV2RGB_CONVERT = 1 +} MessageYuv2Rgb; + +/*---------------------------------------------------------------------------* + Name: DSP_Yuv2RgbInit + + Description: 初期化関数 + + Arguments: *** + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL DSP_Yuv2RgbInit(u32 dmaNo); + +/*---------------------------------------------------------------------------* + Name: DSP_Yuv2RgbConvertAsync + + Description: YUV->RGB変換を行います。(非同期版) + + Arguments: *** + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL DSP_Yuv2RgbConvertAsync(void* src, void* dest, u32 size, YUV2RGBCallback callback); + +// CPU版 +u32 CpuYuv2Rgb( const void* src, void* dest, u32 pixels ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* YUV2RGB_H_ */ +#endif diff --git a/build/tests/yuv2rgb/readme.txt b/build/tests/yuv2rgb/readme.txt new file mode 100644 index 00000000..26873f1d --- /dev/null +++ b/build/tests/yuv2rgb/readme.txt @@ -0,0 +1,227 @@ +このパッケージについて +====================== + +ARM7コンポーネントを、racoonからjackalにすると、カメラ動作時の +ARM9の処理落ちが多くなることを調べるためのサンプルです。 + +コンポーネントの切り替えは、Makefileの + +ifdef TWL_IPL_RED_ROOT +#コンポーネントを切り替えます。 +#コメントアウトするとracoonを、有効化するとjackalを使います。 +#下の行を変更したらmake cleanしてください。 +TWL_IPL_USE_RED_IPL := TRUE +endif + +上記の行をコメントアウトするか有効化するかで行ってください。 +変更したらmake cleanしてください。 + +処理落ちが発生すると、デバッグ出力に + +mConvBusy! 0, nextp empty +mConvBusy! 1, nextp empty + : + +と表示されます。数字は回数です。この頻度が、racoonとjackalで異な +ります。 + +画面上部の '*' の動きのスムーズさや、カメラに向かって手を振ったり +すると、カクカクすることでも処理落ちにお気づき頂けると思います。 + +以上です。 + + + +以下は、このパッケージに含まれる関数をSDKのDSP JPEGライブラリに追 +加して頂くために提供したときに作成したドキュメントです。 + +↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ +====================================================================== + +このパッケージについて +====================== + +UIGランチャーのカメラ撮影部分(カメラマネージャ)の実装のため、いろ +いろ実験するためのパッケージです。直接カメラやJPEGには関係しない +ファイルが含まれていますがご了承ください。 + +src/menuCameraManager.cppは、基本的に現状のUIGランチャーと同じも +のです。ここでの実験の成果をUIGランチャーへ反映しています。 + +YUV422->YUV420変換関数以外は、未完成の部分もあり、雑に作っている +部分もありますので、公開なさらないようにお願いします。 + +SDカードアクセス部は、UIGランチャー正式仕様ではありません。ただし +現状のUIGランチャーにもこのまま使われています。シャッター音もまだ +鳴りません。 + +実行方法は、普通にmakeしてmain.tlfをロードして頂くと、上画面にア +ウトカメラの画像が出ます。Aボタンでシャッターを切ります。SDカード +が入っていれば/menu/menu####.jpgを連番で生成します。(SDKのデモを +そのまま頂いています) + + +YUV422->YUV420変換関数の使用方法 +================================ + +menuCameraManager.cppのConvert8bitYuv422To16bitYuv420()で、 +YUV422->YUV420変換を行います。この関数を呼び出している同ファイル +の1074行目から1102行目あたり + + frame_y = mpTestEncodeWork->y; + frame_cb = mpTestEncodeWork->cbcr; + frame_cr = frame_cb + (mShotWdt * mShotHgt / 4); + tick = OS_GetTick(); + Convert8bitYuv422To16bitYuv420(reinterpret_cast(pBuf), + frame_y, + mShotWdt, + mShotHgt, + mpDtcmWork->mYuvBuf); + // store YUV420 and invalidate encode result + // DC_StoreAll(), DC_FlushAll() is NG? + DC_FlushAll(); + + IPL_PRINT("procShot: yuv422to420 time %d usec\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - tick)); + tick = OS_GetTick(); + + // 出力サイズはいかほど必要? + DSP_SetJpegEncoderBuffer(mpTestEncodeWork->result, sizeof(mpTestEncodeWork->result)); + // explicit initialization + DSP_SetJpegEncoderThumbnailBuffer(NULL, NULL, NULL); + DSP_SetJpegEncoderAllocator( dspAlloc_, dspFree_ ); + u32 size = DSP_StartJpegEncoder( static_cast< s16 > ( mShotWdt ) , + static_cast< s16 > ( mShotHgt ) , + DSP_JPEG_THUMBNAIL , + 4 ); + + // need here too ? sometimes picture breaks... + // DC_StoreAll(), DC_FlushAll() is NG? + DC_InvalidateRange(mpTestEncodeWork->result, size); + +について説明します。 + +- 1078行目の変換関数の引数pBufは、カメラがVGA、YUV422でキャプチャ +した結果を指しています。このバッファは、直前にprocConvert()を通っ +てきており、917行目の + DC_FlushAll(); +で、データキャッシュのInvalidateが済んでいます。 +変換元データはワード(4バイト)リードされるため、 +reinterpret_castしています。 + +- 引数frame_yは、SDKのJPEGエンコーダのグローバル変数です。今は11 +行目から直接 +extern "C" { +// build/libraries/dsp/ARM9.TWL/src/dsp_jpeg_enc.c +extern u16 *frame_y; +extern u16 *frame_cb; +extern u16 *frame_cr; +} /* extern "C" */ +で参照していますが、SDKのグローバル変数名としては適切ではないため、 +変数名を整えてSet関数を追加して頂いた方が良いと思います。 + +- SDKのJPEGエンコーダには、frame_cbとframe_crも与える必要がありま +す。frame_cbとframe_crを与えているのは1074行目からの + frame_y = mpTestEncodeWork->y; + frame_cb = mpTestEncodeWork->cbcr; + frame_cr = frame_cb + (mShotWdt * mShotHgt / 4); +になります。 + +変換関数は、frame_yに隙間無く続けてframe_cb、frame_crを出力します +ので、変換関数の引数はframe_yだけです。 + +- mShotWdtは640、mShotHgtは480です。 + +- mpDtcmWork->mYuvBufで、処理高速化用のDTCMワークを与えています。 +menuCameraManager.hの43行目にある、12ダブルワード(96バイト) + u64 mYuvBuf[12]; +の領域が必要です。strd命令を使用しているので8バイトアラインメント +してください。(その上のmShrinkBufは、縮小用なので変換関数には関係 +ありません) + +DTCMを使うことについては、SDKとして公開する場合に検討が必要だと思 +います。メインメモリやVRAMを割り当てても動作するはずですが、試し +ていません。staticなDTCMワークでなくても、メインスレッドのスタッ +クフレームなら通常はDTCMになるはずですが、そういうことを意識させ +ると敷居が高くなります。 + +- 変換後の1085行目 + DC_FlushAll(); +は、JPEGエンコード時に画像が崩れる症状に悩まされ、念のためデータ +キャッシュの内容を実メモリへ吐き出しました。画像が崩れなくなれば、 +不要かもしれません。 + +- 1094行目の + DSP_SetJpegEncoderAllocator( dspAlloc_, dspFree_ ); +で指定しているアロケータですが、実体はmainy.cppの1667行目にありま +す。 + +dspAlloc_()は、実は何もしていません。何もしていないどころか、呼ば +れたらアサートで停止させます。 + +dspFree_()は、SDKから呼ばれてしまうので、停止はしませんがダミー関 +数にしてあります。 + +このアロケータの使われ方(SDKのdsp_jpeg_enc.c)については、いろいろ +思うところはあるのですが、簡単に言うと + +a. 最大で何バイト必要になるのか、できればコンパイル時に知りたいが +その方法が提供されていない + +b. pTmp2を最初に確保しているため、pYbuf、pCBbuf、pCRbufを確保した +後に + DSPFree(pTmp2); +するのはフラグメントを生じる可能性がある + +c. extra_bytesに関する処理や + Yuv_image_size=(u32)(image_width+32)*(image_height+32); +の+32が意図不明 + +というところで不安になったのが、私が変換関数を自作したもう一つの +理由です。 + +- JPEGエンコード後の1102行目 + DC_InvalidateRange(mpTestEncodeWork->result, size); +も、JPEGエンコード時の画像崩れ対策テストです。 +もしかして、SDへ書き込むFSライブラリに問題があるかもと思い、FSラ +イブラリ用にデータキャッシュをInvalidateしたものです。崩れなくな +れば、これも不要になるでしょう。 + + +YUV422->YUV420変換関数の補足説明 +================================ + +- 793行目から821行目まで、 +#if 0 + // even line U + : +#else + // even column ave. uv (V0 U0) + : +#endif + +ですが、これはYUV422->YUV420に伴って失われるU、V成分を2ラインの +平均値とするか、Wikipediaを鵜呑みした + +| YUV420 : 2×2ピクセルのうち、青の色差信号を最初のラインから取り、 +| 赤の色差信号を次のラインからとる方式。輝度信号は1ピクセルごとにと +| る。 + +の方式にするかを試したものです。平均値にした方がノイズが低減され +ているように感じたため、今の#if 0としてあります。#if 1にするとシ +ャープな感じになります。 + +しかし、そもそもY成分はそのままでU、Vだけ平均化したらおかしい絵に +ならないのか、とはいえ上のラインのVを下のラインから持ってくるのも +おかしな話では?という思いはあります。 + +JPEGエンコーダの入力データ仕様を詳しく調べていないので、どちらが +良いのか分かっていません。 + +- 変換関数の引数の制限について、714行目からのコメントを補足します。 + +// pYCbCrBufも最低4バイトアラインメントですが、各デバイスとの連携に +// 備えて32バイトアラインメントしてください。 + +↑これは、変換結果がDSPの入力データになるので、32バイトアラインメ +ントしておけばキャッシュまわりの心配が減るからです。 + diff --git a/build/tests/yuv2rgb/redipl_defs_autogen_by_uig b/build/tests/yuv2rgb/redipl_defs_autogen_by_uig new file mode 100644 index 00000000..7c5d15da --- /dev/null +++ b/build/tests/yuv2rgb/redipl_defs_autogen_by_uig @@ -0,0 +1,14 @@ +SYSMENU_LIBS = \ + liblcfg$(TWL_LIBSUFFIX).a \ + libsysmenu$(TWL_LIBSUFFIX).a \ + libsysmmcu$(TWL_LIBSUFFIX).a \ + libsysmutil$(TWL_LIBSUFFIX).a \ + libboot$(TWL_LIBSUFFIX).a \ + libds$(TWL_LIBSUFFIX).a \ + libhotsw$(TWL_LIBSUFFIX).a \ + libdht$(TWL_LIBSUFFIX).a \ + libreloc_info$(TWL_LIBSUFFIX).a \ + libnamut$(TWL_LIBSUFFIX).a \ + libsharedfont_launcher$(TWL_LIBSUFFIX).a \ + WDS$(TWL_LIBSUFFIX).a + diff --git a/build/tests/yuv2rgb/src/cpu_yuv2rgb.c b/build/tests/yuv2rgb/src/cpu_yuv2rgb.c new file mode 100644 index 00000000..bdb09f57 --- /dev/null +++ b/build/tests/yuv2rgb/src/cpu_yuv2rgb.c @@ -0,0 +1,103 @@ + // 中身をいじってある。 +/*---------------------------------------------------------------------------* + Project: TwlSDK - YUV2RGB + File: cpu_yuv2rgb.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 "yuv2rgb.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ + +u32 yuv2rgb16( const void* src, void* dest, u32 pixels ); + +/*---------------------------------------------------------------------------* + 内部関数定義 + *---------------------------------------------------------------------------*/ + +static inline int r_diff( u8 v ) +{ +// return (1402 * ( v - 128 )) / 1000; + return (11760828/*.416*/ * ( v - 128)) >> 23; +} + +static inline int g_diff( u8 u, u8 v ) +{ +// return (-344 * ( u - 128 ) -714 * ( v - 128 )) / 1000; + return (-2885681/*.152*/ * ( u - 128 ) -5989466/*.112*/ * ( v - 128 )) >> 23; +} +static inline int b_diff( u8 u ) +{ +// return (1772 * ( u - 128 )) / 1000; + return (14864613/*.376*/ * ( u - 128 )) >> 23; +} + +static inline int trim( int e ) +{ + return e < 0 ? 0 : ( e > 255 ? 255 : e); +} + +/*---------------------------------------------------------------------------* + Name: CpuYuv2Rgb + + Description: YUV->RGB変換を行います(CPUバージョン) + + Arguments: src : input data adress (YUV) + dest : output data adress (RGB) + pixels : num of pixel + + Returns: None + *---------------------------------------------------------------------------*/ +u32 CpuYuv2Rgb( const void* src, void* dest, u32 pixels ) +{ + OSTick begin; + u8* yuyv = (u8*)src; + u32* rgb = (u32*)dest; + + u32 limit = pixels >> 1; + u32 i; + +begin = OS_GetTick(); + + for (i = 0; i < limit; i++) + { + u8 y1 = *yuyv++; + u8 u = *yuyv++; + u8 y2 = *yuyv++; + u8 v = *yuyv++; + *rgb++ = (u32)( + 0xffffffff + //0x83e083e0 // G only + & ( + 0x80008000 | + ( ( trim( y2 + b_diff( u ) ) & 0xF8 ) << 23) | + ( ( trim( y2 + g_diff( u, v ) ) & 0xF8 ) << 18) | + ( ( trim( y2 + r_diff( v ) ) & 0xF8 ) << 13) | + ( ( trim( y1 + b_diff( u ) ) & 0xF8 ) << 7) | + ( ( trim( y1 + g_diff( u, v ) ) & 0xF8 ) << 2) | + ( ( trim( y1 + r_diff( v ) ) ) >> 3) )); + } + +OS_Printf("total(555) = %d us\n", OS_TicksToMicroSeconds(OS_GetTick() - begin)); + + return pixels * sizeof(RGBX16); +} + diff --git a/build/tests/yuv2rgb/src/dsp_yuv2rgb.c b/build/tests/yuv2rgb/src/dsp_yuv2rgb.c new file mode 100644 index 00000000..ee1ada37 --- /dev/null +++ b/build/tests/yuv2rgb/src/dsp_yuv2rgb.c @@ -0,0 +1,308 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - YUV2RGB + File: dsp_yuv2rgb.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 "yuv2rgb.h" + +/*---------------------------------------------------------------------------* + 型定義 + *---------------------------------------------------------------------------*/ + +#define THREAD_YUV2RGB_PRIO 10 // メインスレッドより優先 +#define STACK_SIZE 1024 +#define DSP_BUFFER_SIZE 0x6000 // 24KB + +/*---------------------------------------------------------------------------* + 変数定義 + *---------------------------------------------------------------------------*/ + +OSThread threadYUV2RGB; // YUV2RGBスレッド +u64 stack[STACK_SIZE / sizeof(u64)]; // YUV2RGBスレッド用スタック + +// メッセージ関連 +OSMessage mesgBuffer[10]; +OSMessageQueue mesgQueue; + +static YUV2RGBCallback sCallback; +static u8* sSrc; +static u8* sDst; +static u32 sSize; +static u32 sDmaNo; +static u8 sBusy; + +DSPPipe binout[1]; +DSPPipe binin[1]; + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ +BOOL YUV2RGB_Init(void); +static void DSPi_Yuv2RgbThread(void *arg); +static void DSPi_Yuv2RgbLoadProgram(); +static void DSPi_Yuv2RgbConvertCore(void); + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: DSP_Yuv2RgbInit + + Description: 初期化関数 + + Arguments: *** + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL DSP_Yuv2RgbInit(u32 dmaNo) +{ + // DSPファームをロード + DSPi_Yuv2RgbLoadProgram(); + + // DSPパイプ情報をロード(DSP->ARM) + (void)DSP_LoadPipe( + binout, // パイプ情報の格納先 (DSP側ではNULLでよい) + DSP_PIPE_BINARY, // パイプのポート番号(1) + DSP_PIPE_OUTPUT); // DSP_PIPE_INPUT または DSP_PIPE_OUTPUT + + (void)DSP_LoadPipe( + binin, // パイプ情報の格納先 (DSP側ではNULLでよい) + DSP_PIPE_BINARY, // パイプのポート番号(1) + DSP_PIPE_INPUT); // DSP_PIPE_INPUT または DSP_PIPE_OUTPUT + + // メッセージキューの初期化 + OS_InitMessageQueue(&mesgQueue, &mesgBuffer[0], 10); + + // YUV2RGB変換スレッド生成・起動 + OS_CreateThread(&threadYUV2RGB, DSPi_Yuv2RgbThread, (void *)0, stack + STACK_SIZE / sizeof(u64), STACK_SIZE, THREAD_YUV2RGB_PRIO); + OS_WakeupThreadDirect(&threadYUV2RGB); + + // WRAM-C Slot1 の割り当てを DSP->ARM へ変更 + if ( MI_SwitchWramSlot_C( 1, MI_WRAM_SIZE_32KB, MI_WRAM_DSP, MI_WRAM_ARM9 ) != 1 ) + { + OS_TPanic("can't allocate WRAM Slot"); + } + + // 使用するDMA番号を保存 + sDmaNo = dmaNo; + + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: DSPi_Yuv2RgbLoadProgram + + Description: DSPテストプログラムをロード。 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void DSPi_Yuv2RgbLoadProgram(void) +{ + MI_FreeWram_B(MI_WRAM_ARM9); + MI_CancelWram_B(MI_WRAM_ARM9); + MI_FreeWram_C(MI_WRAM_ARM9); + MI_CancelWram_C(MI_WRAM_ARM9); + { + extern const u8 _binary_simple_dat[]; + extern const u8 _binary_simple_dat_end[]; + if (!DSP_LoadFileAuto(_binary_simple_dat)) + { + OS_TPanic("can't allocate WRAM Slot"); + } + // 必ずこのタイミングでONしないといけないのかどうかは未確認。 + { + static BOOL once = FALSE; + if (!once) + { + DSP_PowerOn(); + once = TRUE; + } + } +// DSP_ResetInterface(); + DSP_ResetOff(); + OS_TPrintf("dsp app run...\n"); + DSP_EnableRecvDataInterrupt(0); + DSP_EnableRecvDataInterrupt(1); + DSP_EnableRecvDataInterrupt(2); + } +} + +/*---------------------------------------------------------------------------* + Name: DSPi_Yuv2RgbThread + + Description: YUV2RGB専用スレッド + + Arguments: *** + + Returns: None + *---------------------------------------------------------------------------*/ + +static void DSPi_Yuv2RgbThread(void *arg) +{ +#pragma unused( arg ) + OSMessage message; + + while (1) + { + (void)OS_ReceiveMessage(&mesgQueue, &message, OS_MESSAGE_BLOCK); + + switch ((MessageYuv2Rgb)message) + { + case MESSAGE_YUV2RGB_CONVERT: + DSPi_Yuv2RgbConvertCore(); + break; + } + } +} + +/*---------------------------------------------------------------------------* + Name: DSP_Yuv2RgbConvertAsync + + Description: YUV->RGB変換を行います(非同期版) + + Arguments: *** + + Returns: 依頼成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL DSP_Yuv2RgbConvertAsync(void* src, void* dest, u32 size, YUV2RGBCallback callback) +{ + OSMessage message; + + message = (OSMessage)MESSAGE_YUV2RGB_CONVERT; + + if (!sBusy) + { + sCallback = callback; // コンバート完了後に呼び出すコールバックを保存 + sSrc = src; + sDst = dest; + sSize = size; + return OS_SendMessage(&mesgQueue, message, OS_MESSAGE_NOBLOCK); + } + return FALSE; +} + +/*---------------------------------------------------------------------------* + Name: DSPi_Yuv2RgbConvertCore + + Description: YUV->RGB変換のためにDSPとのやり取りや + データコピーなどを行います + + Arguments: *** + + Returns: None + *---------------------------------------------------------------------------*/ +static void DSPi_Yuv2RgbConvertCore(void) +{ + u16 command; + u16 reply; + u32 adress = MI_GetWramMapStart_C() + MI_WRAM_C_SLOT_SIZE; // 暫定的にスロット1固定 + OSTick begin, current, tick_copy1, tick_convert, tick_copy2; + u32 offset =0; + + // ビジーフラグON + sBusy = TRUE; + + tick_copy1=tick_convert=tick_copy2=0; + + // 現状DSP側にバッファを24KBしか確保できていないため256x192(96Kb)などの + // 大きいサイズの変換は4回に分けて行っている。 + + while (sSize > 0) + { + u16 size; + + if (sSize > DSP_BUFFER_SIZE) { size = DSP_BUFFER_SIZE; } + else { size = (u16)sSize; } + + sSize -= size; + +begin = OS_GetTick(); + + // src -> WRAM-C に書き込む + if (sDmaNo == DSP_DMA_NOT_USE) + { + MI_CpuCopy16(sSrc + offset, (void*)adress, size); + DC_FlushRange((void*)adress, size); + } + else + { + MI_NDmaCopy( 3, sSrc + offset, (void*)adress, size ); + } + + // WRAM-C Slot1 の割り当てを ARM->DSP へ変更 + if ( MI_SwitchWramSlot_C( 1, MI_WRAM_SIZE_32KB, MI_WRAM_ARM9, MI_WRAM_DSP ) != 1 ) + { + OS_Printf("====== WRAM Allocation Fail ! =======\n"); + } + +current = OS_GetTick(); +tick_copy1 += (current - begin); +begin = current; + + // DSPへコマンド送信 + command = (u16)(size>>1); // ピクセル数として渡す + DSP_WritePipe(binout, &command, sizeof(u16)); + + // DSPからコマンド受信(ここでスリープに入り、DSP_HookPipeNotificationで起床) + DSP_ReadPipe(binin, &reply, sizeof(u16)); + +current = OS_GetTick(); +tick_convert += (current - begin); +begin = current; + + // WRAM-C Slot1 の割り当てを DSP->ARM へ変更 + if ( MI_SwitchWramSlot_C( 1, MI_WRAM_SIZE_32KB, MI_WRAM_DSP, MI_WRAM_ARM9 ) != 1 ) + { + OS_Printf("====== WRAM Allocation Fail ! =======\n"); + } + + // WRAM-C -> dst に書き込む + if (sDmaNo == DSP_DMA_NOT_USE) + { + DC_InvalidateRange((void*)adress, size); + MI_CpuCopy16((void*)adress, sDst + offset, size); + } + else + { + MI_NDmaCopy( 3, (void*)adress, sDst + offset, size); + } + +current = OS_GetTick(); +tick_copy2 += (current - begin); + + // オフセット更新 + offset += size; + } + + OS_Printf("copy to wram = %d us, ", OS_TicksToMicroSeconds(tick_copy1)); + OS_Printf("convert = %d us, ", OS_TicksToMicroSeconds(tick_convert)); + OS_Printf("from wram = %d us, ", OS_TicksToMicroSeconds(tick_copy2)); + OS_Printf("total = %d us\n", OS_TicksToMicroSeconds(tick_copy1+tick_convert+tick_copy2)); + + // ビジーフラグOFF + sBusy = FALSE; + + if (sCallback) + { + sCallback(); + } +} + diff --git a/build/tests/yuv2rgb/src/mainy.cpp b/build/tests/yuv2rgb/src/mainy.cpp new file mode 100644 index 00000000..181a117b --- /dev/null +++ b/build/tests/yuv2rgb/src/mainy.cpp @@ -0,0 +1,1813 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - YUV2RGB + File: main.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 +#include +#include +#include +#include + +#ifdef TWL_IPL_USE_RED_IPL +#include +#include +#endif + +// #include +// #include +#include "DEMOBitmap.h" +#include "yuv2rgb.h" +#include "menuIrqHandler.h" +#include "menuCameraManager.h" + +#include "snd_data.h" + +// テストグローバルアクセサ +cmn::sys::cmr2::Manager* mpCmrMgr2; + +//extern u16 b_data[]; + +extern const u8 _binary_camera_shutter_dat[], _binary_camera_shutter_dat_end[]; +extern const u8 _binary_camera_shutter_MONO_dat[], _binary_camera_shutter_MONO_dat_end[]; +extern const u8 _binary_wheel_dat[], _binary_wheel_dat_end[]; + + +#include +// 実験に必要なu32個数はmax(208*3, 256*2) +// とりあえず256*4で。 +static cmn::sys::cmr2::dtcmWork sDtcmWork; +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#define CAMERA_NEW_DMA_NO 1 // CAMERAで使用するNew DMA番号 +#define WIDTH 640 +#define HEIGHT 480 + +#define LINES_SPLIT 1 +#define LINES_AT_ONCE (CAMERA_GET_MAX_LINES(WIDTH)/LINES_SPLIT) // 一回の転送ライン数 +#define BYTES_PER_LINE CAMERA_GET_LINE_BYTES(WIDTH) // 一ラインの転送バイト数 + + enum + { + eStt_Deactive = 0 , + eStt_Capture , + eStt_WaitShooting , + eStt_Shoot , + eStt_FinishShooting , + eStt_Stop , + eStt_Max + } mState, mLastState; + +BOOL mError; + + enum + { +#if 1 + cPictureOffsetX = 0, + cPictureOffsetY = 0, +#else + cPictureOffsetX = 24, + cPictureOffsetY = 24, +#endif + cPictureWidth = cScreenWidth - (cPictureOffsetX * 2), + cPictureHeight = cScreenHeight - (cPictureOffsetY * 2), + cShootWidth = 640, + cShootHeight = 480 + }; + +/*---------------------------------------------------------------------------* + 関数宣言 + *---------------------------------------------------------------------------*/ + +static void VBlankIntr(void); +static void CameraIntr(void); +//static void CameraIntr2(void); +//static void CameraIntr3(void); +static void NDmaIntr(void); +static void NDmaDummyIntr(void); +static void PutString( char *format, ... ); +static void DrawFPS(void); + +/*---------------------------------------------------------------------------* + 変数定義 + *---------------------------------------------------------------------------*/ + +static BOOL startRequest = FALSE; + +// [0],[1]はcameraからのinput。[2]は捨てられるcamera input用? +static u16 buffer[3][WIDTH*HEIGHT] ATTRIBUTE_ALIGN(32); +//static vu8 we; +//static vu8 re; +//static vu8 reading; +//static vu8 tp; +//static vu8 wp; // カメラからデータを取り込み中のバッファ +//static vu8 rp; // 最後のVRAMにコピーしたバッファ +//static BOOL wp_pending; // 取り込みを中断した (再び同じバッファに取り込む) +static CAMERASelect current = CAMERA_SELECT_IN; +static MenuIrqHandlerLogBuffer logBuf[0x10000]; + +static u16 text_buffer[ 32 ] ATTRIBUTE_ALIGN(32); + +static vu8 sNowConvert = FALSE; // YUV->RGB変換中フラグ + +static vu8 sLongDmaFlag; + +static u32 gWords[0x2000]; +static u32 gSum; + +#define GRAD_WIDTH 256 +static u16 grad0[GRAD_WIDTH] ATTRIBUTE_ALIGN(32); +static u16 grad1[GRAD_WIDTH] ATTRIBUTE_ALIGN(32); +static void MakeGrad(void) +{ + static u16 table[] = { + 0, 8, 0, 1, 0, 2, 0, 3, + 0, 4, 0, 5, 0, 6, 0, 7, + 1, 8, 1, 9, 2,10, 3,11, + 4,12, 5,13, 6,14, 7,15, + 8,16, 9,17,10,18,11,19, + 12,20,13,21,14,22,15,23, + 16,24,17,25,18,26,19,27, + 20,28,21,29,22,30,23,31, + }; + u32 i; + u32 color; + u32 shift = GX_RGBA_G_SHIFT; + + for (i = 0; i < GRAD_WIDTH; i++) { + color = i >> 2; // 0-63 + grad0[i] = (u16)((table[color] << shift) | GX_RGBA_A_MASK); + grad1[i] = (u16)(((color >> 1) << shift) | GX_RGBA_A_MASK); + } + + DC_StoreAll(); +} + +static inline int r_diff( u8 v ) +{ +// return (1402 * ( v - 128 )) / 1000; + return (11760828/*.416*/ * ( v - 128)) >> 23; +} + +static inline int g_diff( u8 u, u8 v ) +{ +// return (-344 * ( u - 128 ) -714 * ( v - 128 )) / 1000; + return (-2885681/*.152*/ * ( u - 128 ) -5989466/*.112*/ * ( v - 128 )) >> 23; +} +static inline int b_diff( u8 u ) +{ +// return (1772 * ( u - 128 )) / 1000; + return (14864613/*.376*/ * ( u - 128 )) >> 23; +} + +static inline int trim( int e ) +{ + return e < 0 ? 0 : ( e > 255 ? 255 : e); +} +#if 0 +static u32 CpuYuv2Rgb666( const void* src, void* dest, u32 pixels ) +{ + return CpuYuv2Rgb(src, dest, pixels); +} +#elif 0 +static u32 CpuYuv2Rgb666( const void* src, void* dest, u32 pixels ) +{ + MakeGrad(); + return 0; +} +#elif 0 +// little endian only +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ + // x * 6/7 + ldr r0, =0x000003fd + ldr r1, =(6*0x10000)/7 + smulwb r0, r1, r0 +// mov r0, #0x16c << 16 + bx lr +} +#elif 0 +// little endian only +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ + // カメラ起動中、AHBはどれくらいストールする? + + +// 0009 0000 0000 0000 0000 0000 0000 0000 ret=00000001 +// 0002 0000 0000 0000 0000 0000 0000 0000 ret=00000001 +// 0003 0000 0000 0000 0000 0000 0000 0000 ret=00000001 + // 9とか酷いな。sysclk/64なので...cpuclkにすると4倍、 + // タイマーがカウントアップ直前だったとしても + // つまり8*64*4=2048 cpu cyclesの間、ストールしているってこと? + // これは何が原因? + // カメラのラインバッファって16MHzで動いてるの? + // もしそうだとすると、256ドット=64 Words、このDMAには + // sysclkにして8倍、64*8=512 cpu cycles...そんなに早くない? + // + // あーっと!!CAMERA_GetBytesAtOnce(WIDTH)=2048だ! + // つまり 512 Wordsなので512*8 = 4096 cycles...そんな計算にはならんな。 + // カメラのラインバッファがsysclk動作ならcpuclkにすると4倍、 + // 512*4=2048 cpu cycles...つじつま合う? + // バイト数と同じcpu cyclesになるとすると、2048はアカンやろ(笑) + // 割り込みルーチンの中でもそんなにストールするリスクがある。 + // サウンドDMAだってあるのに。 + // まあでも、他の要因によってストールする可能性があるから + // カメラのラインバッファを4ライン分としているのかな。 + // こまったなあ。うーん、カメラのラインバッファからメインメモリ + // へ転送時の、DMA終了割り込みを使わなければ、DMAが追いつかなくて + // 破綻するとかは、あまり心配しなくて良さそう。 + // + // 000e 0000 0000 0000 0000 0000 0000 0000 ret=00000001 + // なんじゃこりゃ!?割り込み入った? + // + // mi_ndma.cに + // #define CAMERA_DMA_BLOCK_SIZE MI_NDMA_BWORD_16 + // #define CAMERA_DMA_INTERVAL 2 + // #define CAMERA_DMA_PRESCALER MI_NDMA_INTERVAL_PS_1 + // とあるので、16ワード単位の分割転送になっているのかな。 + // うん、なってる。プリスケーラ=1倍(sysclk)、インターバル=2 + // 特に悪い設定とは思えないが、ラインバッファがオーバーフローするのかな… + // しかもストールが長いのは、カメラNDMAのせいでもなさそうだし。 + + + +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3,r4-r11,lr + +#define t0 r6 +#define t1 r7 +#define tm0l_addr r11 +#define vcount_addr lr + +#define tm0 r4 +#define vcount r5 + +#define COUNT_MAX 8 + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + + ldr tm0l_addr, =REG_TM0CNT_L_ADDR + ldr vcount_addr, =REG_VCOUNT_ADDR + mov pixels, #COUNT_MAX // 最高計測個数 + +// VCOUNT値は0xc4とか0x60とかなので、繰り上がりは非対応。 + ldrh vcount, [vcount_addr] + add vcount, vcount, #0x30 + mov vcount, #192 +@10: + ldrsh tm0, [tm0l_addr] +@20: + ldrsh t0, [tm0l_addr] + sub t1, t0, tm0 + movs t0, t1, lsr #1 + beq @50 + + strh t1, [dst], #2 + subs pixels, pixels, #1 + beq @150 + +@50: + ldrh t0, [vcount_addr] + cmp t0, vcount + blt @10 + b @100 + +@100: + mov t1, pixels + mov t0, #0 +@110: + strh t0, [dst], #2 + subs t1, t1, #1 + bne @110 + +@150: + rsb r0, pixels, #COUNT_MAX + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr +#undef SAVE_REGS +#undef t0 +#undef t1 +#undef tm0l_addr +#undef vcount_addr +#undef tm0 +#undef vcount +#undef COUNT_MAX +} +#elif 1 +// dstダミーフェッチ無し +// dstはMAINではない(VRAM)と想定しているので、DTCM非使用。 +// 666じゃなくて単なる555。 +// little endian only +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ + +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3,r4-r11,lr +#define t0 r3 +#define t1 r12 +#define y0 r9 +#define y1 r10 +#define uv r11 +#define rgba lr + +#define CONST_REGS r4-r8 +#define const_0x80008000 r4 +#define const_0xff00ff00 r5 +#define const_0x7f800000 r6 +#define const_H1_402_L1_772 r7 +#define const_Hm0_344_Lm0_714 r8 + + // omit odd and zero + eor t0, pixels, #1 + movs t0, t0, lsr #1 + bxls lr // LS: C clear or Z set + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + + ldr t0, =@constants + ldmia t0, {CONST_REGS} + + ldr t0, [src], #4 +@10: + and uv, t0, const_0xff00ff00 + eor uv, uv, const_0x80008000 + and y0, const_0x7f800000, t0, lsl #23 // 0x000000ff -> 0x7f800000 + and y1, const_0x7f800000, t0, lsl #23-16 // 0x00ff0000 -> 0x7f800000 + + // Green + // -0.344*(U-128) + smultb t0, const_Hm0_344_Lm0_714, uv + // -0.714*(V-128) + smulbt t1, const_Hm0_344_Lm0_714, uv + mov rgba, const_0x80008000 + add t1, t0, t1 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #21 // 0x7c000000 -> 0x000003e0 + ands t0, t1, #0xfc000000 + + // Red + // 1.402*(V-128) + smultt t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #21-16 // 0x7c000000 -> 0x03e00000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #26 // 0x7c000000 -> 0x0000001f + ands t0, t1, #0xfc000000 + + // Blue + // 1.772*(U-128) + smulbb t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #26-16 // 0x7c000000 -> 0x001f0000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #16 // 0x7c000000 -> 0x00007c00 + ands t0, t1, #0xfc000000 + orrpl rgba, rgba, t0 // 0x7c000000 + + str rgba, [dst], #4 + subs pixels, pixels, #2 + ldrne t0, [src], #4 + bne @10 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr + +@constants: + dcd 0x80008000 + dcd 0xff00ff00 + dcd 0x7f800000 + dcd 0x59ba7168 // ((1.402 * 0x4000) << 16) | ((1.772 * 0x4000) & 0xffff) + dcd 0xe9fcd24e // ((-0.344 * 0x4000) << 16) | ((-0.714 * 0x4000) & 0xffff) + +#undef SAVE_REGS +#undef t0 +#undef t1 +#undef y0 +#undef y1 +#undef uv +#undef rgba +#undef CONST_REGS +#undef const_0x80008000 +#undef const_0xff00ff00 +#undef const_0x7f800000 +#undef const_H1_402_L1_772 +#undef const_Hm0_344_Lm0_714 +} + +#elif 0 +// dstダミーフェッチあり…めちゃ遅くなる。残念。 +// little endian only +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ + +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3,r4-r11,lr +#define t0 r3 +#define t1 r12 +#define y0 r9 +#define y1 r10 +#define uv r11 +#define rgba lr + +#define CONST_REGS r4-r8 +#define const_0x80008000 r4 +#define const_0xff00ff00 r5 +#define const_0x7f800000 r6 +#define const_H1_402_L1_772 r7 +#define const_Hm0_344_Lm0_714 r8 + + // omit odd and zero + eor t0, pixels, #1 + movs t0, t0, lsr #1 + bxls lr // LS: C clear or Z set + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + + ldr t0, =@constants + ldmia t0, {CONST_REGS} + + ldr t0, [src], #4 +@10: + and uv, t0, const_0xff00ff00 + eor uv, uv, const_0x80008000 + and y0, const_0x7f800000, t0, lsl #23 // 0x000000ff -> 0x7f800000 + and y1, const_0x7f800000, t0, lsl #23-16 // 0x00ff0000 -> 0x7f800000 + + // dst dummy-fetch + ldr rgba, [dst] + + // Green + // -0.344*(U-128) + smultb t0, const_Hm0_344_Lm0_714, uv + // -0.714*(V-128) + smulbt t1, const_Hm0_344_Lm0_714, uv + mov rgba, const_0x80008000 + add t1, t0, t1 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #21 // 0x7c000000 -> 0x000003e0 + ands t0, t1, #0xfc000000 + + // Red + // 1.402*(V-128) + smultt t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #21-16 // 0x7c000000 -> 0x03e00000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #26 // 0x7c000000 -> 0x0000001f + ands t0, t1, #0xfc000000 + + // Blue + // 1.772*(U-128) + smulbb t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #26-16 // 0x7c000000 -> 0x001f0000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #16 // 0x7c000000 -> 0x00007c00 + ands t0, t1, #0xfc000000 + orrpl rgba, rgba, t0 // 0x7c000000 + + str rgba, [dst], #4 + subs pixels, pixels, #2 + ldrne t0, [src], #4 + bne @10 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr + +@constants: + dcd 0x80008000 + dcd 0xff00ff00 + dcd 0x7f800000 + dcd 0x59ba7168 // ((1.402 * 0x4000) << 16) | ((1.772 * 0x4000) & 0xffff) + dcd 0xe9fcd24e // ((-0.344 * 0x4000) << 16) | ((-0.714 * 0x4000) & 0xffff) + +#undef SAVE_REGS +#undef t0 +#undef t1 +#undef y0 +#undef y1 +#undef uv +#undef rgba +#undef CONST_REGS +#undef const_0x80008000 +#undef const_0xff00ff00 +#undef const_0x7f800000 +#undef const_H1_402_L1_772 +#undef const_Hm0_344_Lm0_714 +} + +#elif 0 +// little endian only +// 最小値、最大値を調べる。 +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ +#define SAVE_REGS0 src,dst,pixels +#define SAVE_REGS1 r4-r11,lr +#define t0 r3 +#define minVal r4 +#define maxVal r5 + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS0, SAVE_REGS1} + + mvn minVal, #0x80000000 + mov maxVal, #0x80000000 + +@10: + ldrb t0, [src], #4 + ldrb t0, [src, #1-4] + cmp minVal, t0 + movgt minVal, t0 + cmp maxVal, t0 + movlt maxVal, t0 + +#if 0 + cmp minVal, t0 + movgt minVal, t0 + cmp maxVal, t0 + movlt maxVal, t0 + ldrb t0, [src, #2-4] + cmp minVal, t0 + movgt minVal, t0 + cmp maxVal, t0 + movlt maxVal, t0 +#endif + + subs pixels, pixels, #2 + bne @10 + + mov minVal, minVal, lsl #16 + mov maxVal, maxVal, lsl #16 + orr t0, maxVal, minVal, lsr #16 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS0, SAVE_REGS1} + mov r0, t0 + bx lr + +#undef SAVE_REGS0 +#undef SAVE_REGS1 +#undef t0 +#undef minVal +#undef maxVal +} + +#else +// little endian only +// ベタに作ったらこうなる。Cと変わらん。 +static asm u32 CpuYuv2Rgb666( register const void* src, register void* dst, register u32 pixels ) +{ +// registers +// keep stack frame 8-Bytes aligned +#define SAVE_REGS0 src,dst,pixels +#define SAVE_REGS1 r4-r11,lr +#define t0 r3 +#define rgba r12 +#define u src +#define v dst +#define y0 r11 +#define y1 lr + +#define tablep r9 +#define data0 r10 +#define data1 pixels + +#define CONST_REGS r4-r8 +#define const_0x80008000 r4 +#define const_minus_0_344 r5 +#define const_minus_0_714 r6 +#define const_1_402 r7 +#define const_1_772 r8 + + cmp pixels, #2 + bxlt lr + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS0, SAVE_REGS1} + + ldr t0, =@constants + ldmia t0, {CONST_REGS} + + ldr tablep, =@table + +@10: + ldrb y0, [src], #4 + ldrb t0, [src, #1-4] + ldrb y1, [src, #2-4] + ldrb rgba, [src, #3-4] + // do not update sp here! keep 8-Bytes aligned + stmia sp, {SAVE_REGS0} + sub u, t0, #0x80 + sub v, rgba, #0x80 + + // Green + // -0.344*(U-128) + mul t0, const_minus_0_344, u + // -0.714*(V-128) + mul rgba, const_minus_0_714, v + mov t0, t0, asr #23 + add t0, t0, rgba, asr #23 + // +Y + adds rgba, t0, y0 + movmi rgba, #0 + cmp rgba, #0xff + movgt rgba, #0xff + ldrb data1, [tablep, rgba, lsr #2] + and rgba, rgba, #0xf8 + mov rgba, rgba, lsl #2 + adds t0, t0, y1 + movmi t0, #0 + cmp t0, #0xff + movgt t0, #0xff + ldrb data0, [tablep, t0, lsr #2] + and t0, t0, #0xf8 + orr rgba, rgba, t0, lsl #16+2 + mov data1, data1, lsl #5 + orr data0, data1, data0, lsl #16+5 + + // Red + // 1.402*(V-128) + mul t0, const_1_402, v + mov t0, t0, asr #23 + // +Y + // now v is free + adds v, t0, y0 + movmi v, #0 + cmp v, #0xff + movgt v, #0xff + ldrb data1, [tablep, v, lsr #2] + orr rgba, rgba, v, lsr #3 + adds t0, t0, y1 + movmi t0, #0 + cmp t0, #0xff + movgt t0, #0xff + ldrb v, [tablep, t0, lsr #2] + and t0, t0, #0xf8 + orr rgba, rgba, t0, lsl #16-3 + orr data0, data0, data1 + orr data0, data0, v, lsl #16 + + // Blue + // 1.772*(U-128) + mul t0, const_1_772, u + mov t0, t0, asr #23 + // +Y + // now u,v is free + adds v, t0, y0 + movmi v, #0 + cmp v, #0xff + movgt v, #0xff + ldrb data1, [tablep, v, lsr #2] + and v, v, #0xf8 + orr rgba, rgba, v, lsl #7 + adds t0, t0, y1 + movmi t0, #0 + cmp t0, #0xff + movgt t0, #0xff + and t0, t0, #0xf8 + ldrb v, [tablep, t0, lsr #2] + orr rgba, rgba, t0, lsl #16+7 + orr data0, data0, data1, lsl #10 + orr data0, data0, v, lsl #16+10 + + // do not update sp here! keep 8-Bytes aligned + ldmia sp, {SAVE_REGS0} + orr data0, data0, const_0x80008000 + str data0, [dst, const_0x80008000, lsl #1] + orr rgba, rgba, const_0x80008000 + str rgba, [dst], #4 + subs pixels, pixels, #2 + bne @10 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS0, SAVE_REGS1} + bx lr + +@table: + dcd 0x01000800 + dcd 0x03000200 + dcd 0x05000400 + dcd 0x07000600 + dcd 0x09010801 + dcd 0x0b030a02 + dcd 0x0d050c04 + dcd 0x0f070e06 + dcd 0x11091008 + dcd 0x130b120a + dcd 0x150d140c + dcd 0x170f160e + dcd 0x19111810 + dcd 0x1b131a12 + dcd 0x1d151c14 + dcd 0x1f171e16 + +@constants: +/* const_0x80008000 r4 */ dcd 0x80008000 +/* const_minus_0_344 r5 */ dcd (-2885681) +/* const_minus_0_714 r6 */ dcd (-5989466) +/* const_1_402 r7 */ dcd 11760828 +/* const_1_772 r8 */ dcd 14864613 + + +// OSTick begin; +// u8* yuyv = (u8*)src; +// u32* rgb = (u32*)dest; +// +// u32 limit = pixels >> 1; +// u32 i; +// +// begin = OS_GetTick(); +// +// for (i = 0; i < limit; i++) +// { +// u8 y1 = *yuyv++; +// u8 u = *yuyv++; +// u8 y2 = *yuyv++; +// u8 v = *yuyv++; +// *rgb++ = (u32)( 0x80008000 | +// ( ( trim( y2 + b_diff( u ) ) & 0xF8 ) << 23) | +// ( ( trim( y2 + g_diff( u, v ) ) & 0xF8 ) << 18) | +// ( ( trim( y2 + r_diff( v ) ) & 0xF8 ) << 13) | +// ( ( trim( y1 + b_diff( u ) ) & 0xF8 ) << 7) | +// ( ( trim( y1 + g_diff( u, v ) ) & 0xF8 ) << 2) | +// ( ( trim( y1 + r_diff( v ) ) ) >> 3) ); +// } +// +// OS_Printf("total(666) = %d us\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - begin)); +// +// return pixels * sizeof(RGBX16); + +#undef SAVE_REGS0 +#undef SAVE_REGS1 +#undef t0 +#undef rgba +#undef u +#undef v +#undef y0 +#undef y1 + +#undef tablep +#undef data0 +#undef data1 + +#undef CONST_REGS +#undef const_0x80008000 +#undef const_minus_0_344 +#undef const_minus_0_714 +#undef const_1_402 +#undef const_1_772 +} +#endif + + +static void drawTexture(u8* vramAddr, BOOL shot) +{ +#pragma unused(vramAddr) +#pragma unused(shot) + s32 x0, y0; + s32 x1, y1; + s32 s0, s1; + s32 t0, t1; + + x0 = cPictureOffsetX; + x1 = cPictureOffsetX + cPictureWidth; + y0 = cPictureOffsetY; + y1 = cPictureOffsetY + cPictureHeight; + + s0 = 0; + s1 = cPictureWidth; + t0 = 0; + t1 = cPictureHeight; + + G3X_Reset(); + + // Ortho matrix + { + G3_Ortho(0, + -GX_LCD_SIZE_Y, + 0, + GX_LCD_SIZE_X, + 0 * FX32_ONE, + 2 * FX32_ONE, + NULL); + G3_StoreMtx(0); + } + + { + G3_MtxMode(GX_MTXMODE_TEXTURE); + G3_Identity(); + // Use an identity matrix for the texture matrix for simplicity + G3_MtxMode(GX_MTXMODE_POSITION_VECTOR); + } + + //--------------------------------------------------------------------------- + // Set up a camera matrix + //--------------------------------------------------------------------------- + { + VecFx32 Eye = { 0, 0, FX32_ONE }; // Eye position + VecFx32 at = { 0, 0, 0 }; // Viewpoint + VecFx32 vUp = { 0, FX32_ONE, 0 }; // Up + + G3_LookAt(&Eye, &vUp, &at, NULL); + } + +#if 0 + GX_BeginLoadTex(); // map the texture image slots onto LCDC address space + { + GX_LoadTex((void *)&grad0[0], + myTexGrad0Addr, + 256 * sizeof(u16) + ); + GX_LoadTex((void *)&grad1[0], + myTexGrad1Addr, + 256 * sizeof(u16) + ); + + } + GX_EndLoadTex(); // restore the texture image slots +#endif + + G3_PolygonAttr(GX_LIGHTMASK_NONE, // Light #0 is on + GX_POLYGONMODE_DECAL, // modulation mode + GX_CULL_BACK, // cull none + 1, // polygon ID(0 - 63) + 30, // alpha(0 - 31) + GX_POLYGON_ATTR_MISC_XLU_DEPTH_UPDATE // OR of GXPolygonAttrMisc's value + ); + G3_TexImageParam(GX_TEXFMT_DIRECT, + GX_TEXGEN_TEXCOORD, // use texcoord + GX_TEXSIZE_S256, + GX_TEXSIZE_T256, + GX_TEXREPEAT_NONE, // no repeat + GX_TEXFLIP_NONE, // no flip + GX_TEXPLTTCOLOR0_USE, // use color 0 of the palette + 0x00000 // the offset of the texture image + ); + G3_Begin(GX_BEGIN_QUADS); + { + G3_TexCoord(s1 << FX32_SHIFT, t1 << FX32_SHIFT); + G3_Vtx((s16)x1, (s16)(-y1), 0); + G3_TexCoord(s1 << FX32_SHIFT, t0 << FX32_SHIFT); + G3_Vtx((s16)x1, (s16)(-y0), 0); + G3_TexCoord(s0 << FX32_SHIFT, t0 << FX32_SHIFT); + G3_Vtx((s16)x0, (s16)(-y0), 0); + G3_TexCoord(s0 << FX32_SHIFT, t1 << FX32_SHIFT); + G3_Vtx((s16)x0, (s16)(-y1), 0); + } + G3_End(); + +// G3_PolygonAttr(GX_LIGHTMASK_NONE, // Light #0 is on +// GX_POLYGONMODE_DECAL, // modulation mode +// GX_CULL_BACK, // cull none +// 2, // polygon ID(0 - 63) +// 1, // alpha(0 - 31) +// GX_POLYGON_ATTR_MISC_DEPTHTEST_DECAL // OR of GXPolygonAttrMisc's value +// ); +// G3_TexImageParam(GX_TEXFMT_DIRECT, +// GX_TEXGEN_TEXCOORD, // use texcoord +// GX_TEXSIZE_S256, +// GX_TEXSIZE_T256, +// GX_TEXREPEAT_NONE, // no repeat +// GX_TEXFLIP_NONE, // no flip +// GX_TEXPLTTCOLOR0_USE, // use color 0 of the palette +// 0x10000 // the offset of the texture image +// ); +// G3_Begin(GX_BEGIN_QUADS); +// { +// G3_TexCoord(256 * FX32_ONE, (HEIGHT/2) * FX32_ONE); +// G3_Vtx((s16)x1, (s16)y1, 0); +// G3_TexCoord(256 * FX32_ONE, 0 * FX32_ONE); +// G3_Vtx((s16)x1, (s16)y0, 0); +// G3_TexCoord(0 * FX32_ONE, 0 * FX32_ONE); +// G3_Vtx((s16)x0, (s16)y0, 0); +// G3_TexCoord(0 * FX32_ONE, (HEIGHT/2) * FX32_ONE); +// G3_Vtx((s16)x0, (s16)y1, 0); +// } +// G3_End(); + + { + OSIntrMode enabled = OS_DisableInterrupts(); + + // swapping the polygon list RAM, the vertex RAM, etc. + G3_SwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + mpCmrMgr2->setTexSwap(); + + OS_RestoreInterrupts(enabled); + } + + DrawFPS(); +} + +static void dumpWramBanks(u32 line) +{ + u32 i; + + OS_TPrintf("line %d: WramB=", line); + for (i = 0; i < 8; i++) { + OS_TPrintf(" %d", MI_GetWramBankEnable_B((s32)i)); + } + OS_TPrintf(", WramC="); + for (i = 0; i < 8; i++) { + OS_TPrintf(" %d", MI_GetWramBankEnable_C((s32)i)); + } + OS_TPrintf("\n"); +} + +#if SDK_VERSION_DATE < 20080624 +static void proc_camera_intr_() { +#else +static void cameraVsyncCallback(CAMERAResult result) { +#pragma unused( result ) +#endif +#if 1 + // 自家製のみ呼ぶ。 + mpCmrMgr2->procCameraIntr(); +#else + MenuSys()->procCameraIntr(); +#endif + + OS_SetIrqCheckFlag( OS_IE_CAMERA ); +} + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void TwlMain() +{ +// CAMERAResult result; + +#ifdef TWL_IPL_USE_RED_IPL + HOTSW_Init(); +#endif + + // 初期化 + // in new.cpp: TwlStartUp() + + MenuIrqHandlerStart(logBuf, sizeof(logBuf)); + + // DEMOInitCommon(), DEMOInitVRAM(), DEMOInitDisplay3D()を呼ばない + FX_Init(); + G3X_Init(); // initialize the 3D graphics states + G3X_InitMtxStack(); // initialize the matrix stack + + // GXでDMAを使わない (旧DMAはカメラDMAの邪魔になる) + GX_SetDefaultDMA(GX_DMA_NOT_USE); + + // VRAMクリア + GX_SetBankForLCDC(GX_VRAM_LCDC_A); + GX_SetBankForLCDC(GX_VRAM_LCDC_B); + MI_CpuClearFast((void*)HW_LCDC_VRAM_A, 128 * 1024); + MI_CpuClearFast((void*)HW_LCDC_VRAM_B, 128 * 1024); + + GX_SetBankForLCDC(GX_VRAM_LCDC_C); + GX_SetBankForLCDC(GX_VRAM_LCDC_D); + MI_CpuClearFast((void*)HW_LCDC_VRAM_C, HW_VRAM_C_SIZE); + MI_CpuClearFast((void*)HW_LCDC_VRAM_D, HW_VRAM_D_SIZE); +// GX_SetBankForTex(GX_VRAM_TEX_0_C); + + + // ダイレクトビットマップ表示モード&文字表示 + GX_SetBankForBG(GX_VRAM_BG_256_AB); // VRAM-A,BバンクをBGに割り当る + GX_SetGraphicsMode(GX_DISPMODE_GRAPHICS, GX_BGMODE_4, GX_BG0_AS_3D); + + G2_SetBG0Priority(2); + G3X_AntiAlias(TRUE); // enable antialias(without additional computing costs) + G3X_AlphaBlend(TRUE); // enable alpha blending + //--------------------------------------------------------------------------- + // After you start the geometry engine and the rendering one + // (by GX_SetPower etc.), G3_SwapBuffers must be called once before use + //--------------------------------------------------------------------------- + G3_SwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3X_SetClearColor(GX_RGB(0, 0, 0), // clear color + 0, // clear alpha + 0x7fff, // clear depth + 63, // clear polygon ID + FALSE); // fog + G3_ViewPort(0, 0, 255, 191); // Viewport + + GX_SetVisiblePlane(GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_BG3); + + G2_SetBG1Control(GX_BG_SCRSIZE_TEXT_256x256, GX_BG_COLORMODE_16, + GX_BG_SCRBASE_0x0000, GX_BG_CHARBASE_0x04000, GX_BG_EXTPLTT_01); + G2_SetBG1Priority(1); + G2_BG1Mosaic(FALSE); + + G2_SetBG3ControlDCBmp(GX_BG_SCRSIZE_DCBMP_256x256, GX_BG_AREAOVER_XLU, GX_BG_BMPSCRBASE_0x20000); + G2_SetBG3Priority(3); + G2_BG3Mosaic(FALSE); + + // 文字の読み込み + { + static const GXRgb pal[16] = { GX_RGB(0, 0, 0), GX_RGB(31, 31, 31), }; + GX_LoadBG1Char(DEMOAsciiChr, 0x00000, sizeof(DEMOAsciiChr)); + GX_LoadBGPltt(pal, 0x0000, sizeof(pal)); + } +// we = TRUE; +// re = FALSE; +// wp = 0; +// rp = 1; +// tp = 0; +// wp_pending = TRUE; + +// MakeGrad(); + + // VBlank割り込みを許可するより前にカメラマネージャを生成しておく。 +// #if 0 +// pDtcm = OS_AllocFromArenaLo(OS_ARENA_DTCM, 256*4*sizeof(u32), HW_CACHE_LINE_SIZE); +// #else +// pDtcm = (u32 *)myArena; +// #endif + OS_TPrintf("sDtcmWork=0x%x\n", &sDtcmWork); + OS_DumpArenaInfo(OS_ARENA_DTCM, TRUE); + +#if SDK_VERSION_DATE < 20080624 + OS_SetIrqFunction( OS_IE_CAMERA , proc_camera_intr_ ); +#else + // CAMERAライブラリからのコールバックに変更されました。 +// OS_SetIrqFunction(OS_IE_CAMERA, proc_camera_intr_); + CAMERA_SetVsyncCallback(cameraVsyncCallback); +#endif + + // new()って使えないよね…new.cpp追加で使えた! + mpCmrMgr2 = new cmn::sys::cmr2::Manager(); + +#if 0 + // old + + // 割り込みを許可しておかないとダメ? + mpCmrMgr2->init(cmn::sys::cmr2::eMode_Tex, current, + /*GX_VRAM_A, GX_VRAM_B,*/GX_VRAM_C, GX_VRAM_D, &sDtcmWork, drawTexture); + mpCmrMgr2->activate(); + + mpCmrMgr2->setShutterSnd(_binary_camera_shutter_dat, + (u32)(_binary_camera_shutter_dat_end - _binary_camera_shutter_dat), + TRUE); +#endif + + mpCmrMgr2->preInit(); +// mpCmrMgr2->setCaptureRgbFlag(TRUE); + +// // stereo +// mpCmrMgr2->setShutterSnd(_binary_camera_shutter_dat, +// (u32)(_binary_camera_shutter_dat_end - _binary_camera_shutter_dat), +// TRUE); + +// // mono +// mpCmrMgr2->setShutterSnd(_binary_camera_shutter_MONO_dat, +// (u32)(_binary_camera_shutter_MONO_dat_end - _binary_camera_shutter_MONO_dat), +// FALSE); + + if (1) { +// mpCmrMgr2->setOneShotFlag(TRUE); + } + + + + + // Vブランク割り込み設定 + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableInterrupts(); + + // SD初期化 + FS_Init( FS_DMA_NOT_USE ); + +#if 1 + // demos.TWL/snd/extraFunc + /* サウンド初期化 */ + SND_Init(); + SND_AssignWaveArc((SNDBankData*)sound_bank_data, 0, (SNDWaveArc*)sound_wave_data); + SND_StartSeq(0, sound_seq_data, 0, (SNDBankData*)sound_bank_data); +#endif + + /* サウンド拡張機能初期化 */ + SNDEX_Init(); + + OS_WaitIrq(TRUE, OS_IE_V_BLANK); + GX_DispOn(); + +// OS_TPrintf("sizeof testEncodeWork=%d\n", sizeof(cmn::sys::cmr2::Manager::testEncodeWork)); +// OS_TPrintf("ticks/1000usec = %lld\n", (u64)OS_MicroSecondsToTicks(1000)); +// +// { +// OSTick tick; +// BOOL flag = FALSE; +// +// tick = OS_GetTick(); +// mpCmrMgr2->preInit(); +// +// // 1秒あればpreInitは終わるとして +// OS_Sleep(1000); +// +// tick = OS_GetTick(); +// // 本initにかかる時間は? +// mpCmrMgr2->init(cmn::sys::cmr2::eMode_Tex, current, GX_VRAM_C, GX_VRAM_D, &sDtcmWork, drawTexture); +// +// while (1) { +// OS_Sleep(5000); +// if (!flag) { +// flag = TRUE; +// OS_TPrintf("main loop ok, tick before init=%lld\n", (u64)tick); +// } +// } +// } + + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + MI_FreeWram_B ( MI_WRAM_ARM9 ); + MI_CancelWram_B( MI_WRAM_ARM9 ); + MI_FreeWram_C ( MI_WRAM_ARM9 ); + MI_CancelWram_C( MI_WRAM_ARM9 ); + + // for DSP_PlaySound() ? + // DSP_InitPipe(); + /* プログラムを起動する */ +#if 1 + // JPEG DECと併用できない! + FSFile file[1]; + DSP_OpenStaticComponentJpegEncoder(file); + if(!DSP_LoadJpegEncoder(file, 0xff, 0xff)) + { + // WramB= 1 1 1 0 0 0 0 0, WramC= 1 1 1 1 0 0 0 0 + OS_TPanic("failed to load JpegEncoder DSP-component! (lack of WRAM-B/C)"); + } +#endif + dumpWramBanks(__LINE__); +#if 0 + // JPEG ENCと併用できない! + if(!DSP_LoadJpegDecoder()) + { + // WramB= 1 1 0 0 0 0 0 0, WramC= 1 1 1 1 0 0 0 0 + OS_TPanic("failed to load JpegDecoder DSP-component! (lack of WRAM-B/C)"); + } + dumpWramBanks(__LINE__); +#endif +#if 0 + // JPEGと併用できない! + if (!DSP_LoadShutter()) { + // WramB= 1 0 0 0 0 0 0 0, WramC= 1 0 1 1 0 0 0 0 + OS_TPanic("failed to load Shutter DSP-component! (lack of WRAM-B/C)"); + } +#endif +#else + dumpWramBanks(__LINE__); +#endif + + + + OS_WaitVBlankIntr(); + + while (1) + { + u16 pad; + u16 trg; + static u16 old = 0xffff; + static BOOL refresh = FALSE; + +// static const u32 myTexGrad0Addr = 0x2000; +// static const u32 myTexGrad1Addr = 0x3000; + + + /* サウンドメイン処理 */ + while (SND_RecvCommandReply(SND_COMMAND_NOBLOCK) != NULL) + { + } + (void)SND_FlushCommand(SND_COMMAND_NOBLOCK); + +#if 1 +// // more than 1 frame +// OS_WaitIrq(TRUE, OS_IE_V_BLANK); + OS_WaitVBlankIntr(); +#else + // keep AHB busy + OS_ClearIrqCheckFlag(OS_IE_V_BLANK); + while (!(OS_GetIrqCheckFlag() & OS_IE_V_BLANK)) { + u32 wordIdx; + wordIdx = (wordIdx + 0x11) & 0x1fff; + gWords[wordIdx]++; + } +#endif + GX_LoadBG1Scr(text_buffer, 0, sizeof(text_buffer)); + + + pad = PAD_Read(); + trg = (u16)(pad & ~old); + old = pad; + + { + static BOOL initialized; + static BOOL destroying; + + if (!initialized && (trg || 1)) { + initialized = TRUE; + mpCmrMgr2->init(cmn::sys::cmr2::eMode_Tex, current, GX_VRAM_C, GX_VRAM_D, &sDtcmWork, drawTexture); + + mpCmrMgr2->startCapture(current); + } + + if (!destroying) { + if (trg & PAD_BUTTON_START) { + destroying = TRUE; + } + } else { + if (!mpCmrMgr2->tryDestroy()) { + IPL_PRINT("waiting for destroy...\n"); + } else { + IPL_PRINT("destroy done!\n"); + destroying = FALSE; + initialized = FALSE; + } + } + if (!initialized || destroying) { + // この後のボタンチェック(撮影やカメラ切り替え等)を行わない。 + continue; + } + } + + + + if (PAD_DetectFold()) { + // キャプチャを停止して、停止を確認してから + // スリープモードへ移行するようにしないと、 + // cameraIntr: status error + // cameraIntr: status error + // と、2回エラーになるようだ。 + + if (mpCmrMgr2->tryPrepareToSleep()) { + PM_GoSleepMode(PM_TRIGGER_COVER_OPEN, PM_PAD_LOGIC_AND, 0); + } else { + IPL_PRINT("waiting for ready to sleep...\n"); + } + } + +// if (trg & PAD_BUTTON_B) { +// // test +// OS_TPrintf("force stop dma\n"); +// MI_StopNDma(CAMERA_NEW_DMA_NO); +// } +// if (trg & PAD_BUTTON_Y) { +// // test +// OS_TPrintf("force long dma\n"); +// sLongDmaFlag = TRUE; +// } + + if (!mpCmrMgr2->isCameraChanging()) { + if (trg & PAD_BUTTON_X) { + mpCmrMgr2->changeCamera(); + } else if (pad & PAD_BUTTON_SELECT) { + static u8 r; + + r += 1; + if (!(r & 3)) { + mpCmrMgr2->changeCamera(); + } + } + } + + + if (trg & (PAD_BUTTON_A | PAD_BUTTON_B)) { +#ifndef TWL_IPL_FINAL + mpCmrMgr2->mDebugPort = __LINE__; +#endif +// SNDEX_SetDSPMixRate( 0 ); +// SNDEX_ForceOut( TRUE ); +// +// if (trg & PAD_BUTTON_A) { +// DSP_PlaySound(const_cast(_binary_camera_shutter_dat), +// (u32)(_binary_camera_shutter_dat_end - _binary_camera_shutter_dat) / 2, +// TRUE); +// } else { +// DSP_PlaySound(const_cast(_binary_wheel_dat), +// (u32)(_binary_wheel_dat_end - _binary_wheel_dat) / 2, +// TRUE); +// } + +// #if 0 +// // test +// CAMERA_SetLED(TRUE); +// #endif + + + IPL_PRINT("shoot()=%d\n", mpCmrMgr2->shoot()); + } + + +// if (re) { +// OSTick begin = OS_GetTick(); +// // 今はy方向の間引きが出来ないので、480 linesじゃなくて156*3 linesとしている。 +// // ちょっとこのへん適当。 +// rp = (u8)(wp ^ 1); +// Shrink640to208(buffer[rp ? 0 : 1], 156*3/*480*/, pDtcm, (u16*)(rp ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C) /*buffer[2]*/); +// we = TRUE; +// // CpuYuv2Rgb666(buffer[2], (u16*)(wp ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C), (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 1); +// OS_Printf("total(exp) = %d us\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - begin)); +// DrawFPS(); +// } + +// +// if (refresh) { +// // GX_LoadBG3Scr( buffer[rp], 0, BYTES_PER_LINE * HEIGHT); +// GX_DisableBankForTex(); +// GX_SetBankForTex(rp ? GX_VRAM_TEX_0_D : GX_VRAM_TEX_0_C); +// GX_SetBankForLCDC(rp ? GX_VRAM_LCDC_C : GX_VRAM_LCDC_D); +// refresh = FALSE; +// } +// +// if (!we && !sNowConvert) +// { +// // 変なことになりそうだがとりあえず動かす。 +// // CPUによるYUV->RGB変換実行 +// // DC_InvalidateRange( buffer[wp], BYTES_PER_LINE * HEIGHT); +// DC_FlushAll(); +// +// // RGB666実験は一旦封印。 +// // if (mode || 1) { +// // OSTick begin = OS_GetTick(); +// // u32 ret; +// // // テクスチャイメージスロットの半分、つまり画面の上半分しか書けない。 +// // GX_SetBankForLCDC((wp) ? GX_VRAM_LCDC_D : GX_VRAM_LCDC_C); +// // #if 1 +// // ret = CpuYuv2Rgb666(buffer[wp], (void *)((wp) ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C), (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// // // OS_Printf("total(666) = %d us, ret=0x%08x\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - begin), ret); +// // #else +// // ret = CpuYuv2Rgb666(buffer[wp], buffer[wp] + (WIDTH*HEIGHT) / 2, (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// // OS_Printf("%04x %04x %04x %04x %04x %04x %04x %04x ret=%08x\n", +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 0], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 1], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 2], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 3], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 4], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 5], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 6], +// // buffer[wp][(WIDTH*HEIGHT) / 2 + 7], +// // ret); +// // #endif +// // } +// /*else*/ +// { +// +// #if 1 +// #if 0 +// // 条件を合わせて下半分だけに。 +// CpuYuv2Rgb( buffer[wp], buffer[wp] + (WIDTH*HEIGHT) / 2, (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// MI_CpuFillFast((void *)buffer[wp], 0, sizeof(u16) * (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// #else +// OSTick begin = OS_GetTick(); +// // CpuYuv2Rgb666(buffer[wp], buffer[wp] + (WIDTH*HEIGHT) / 2, (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// +// // 固定データ実験 +// Shrink640to208(buffer[wp]/* b_dat*/, (u16*)(wp ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C) /*buffer[wp]*/, 96 * 3, pDtcm); +// // Shrink640to208(buffer[wp]/* b_dat*/, buffer[2], 96 * 3, pDtcm); +// // CpuYuv2Rgb666(buffer[2], (u16*)(wp ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C), (u32)(HW_LCD_WIDTH*HW_LCD_HEIGHT) / 2); +// +// OS_Printf("total(exp) = %d us\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - begin)); +// #endif +// #endif +// } +// +// // DC_FlushRange( buffer[wp], BYTES_PER_LINE * HEIGHT); +// // DC_FlushRange((void *)((wp) ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C), BYTES_PER_LINE * HEIGHT); +// // DC_StoreAll(); +// +// rp = wp; +// refresh = TRUE; +// we = TRUE; +// } +// + + + + if (mpCmrMgr2->isShotDone()) { +// #if 1 +// // test +// CAMERA_SetLED(FALSE); +// #endif + OS_TPrintf("SHOT DONE!\n"); + // check error mShotErr + + // anything to process ? + mpCmrMgr2->clearShotDone(); + + if (!mpCmrMgr2->getOneShotFlag()) { + mpCmrMgr2->startCapture(current); + } + +// SNDEX_SetDSPMixRate( 8 ); +// SNDEX_ForceOut( FALSE ); + + } else { + // ここで(trg)にするとカメラ切り替えとかできなくなる。 + if (mpCmrMgr2->getOneShotFlag() && (trg & PAD_BUTTON_Y)) { + mpCmrMgr2->startCapture(current); + } + } + +// { +// +// if (re) { +// re = FALSE; +// tp = rp; +// } +// +// } + + } +} + +/*---------------------------------------------------------------------------* + Name: Vブランク割り込み処理 + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void VBlankIntr(void) +{ + mpCmrMgr2->procVBlankIntr(); + + +// if (tp == rp) { +// GX_DisableBankForTex(); +// GX_SetBankForTex( tp ? GX_VRAM_TEX_0_D : GX_VRAM_TEX_0_C); +// GX_SetBankForLCDC(tp ? GX_VRAM_LCDC_C : GX_VRAM_LCDC_D); +// } + + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} + +// static void CameraIntr2(void) +// { +// u32 nwp = wp; +// +// // ちゃんとエラー処理してないけど… +// if (CAMERA_GetErrorStatus()) { +// OS_TPrintf("Error!\n"); +// CAMERA_StopCapture(); +// CAMERA_ClearBuffer(); +// MI_StopNDma(CAMERA_NEW_DMA_NO); +// CAMERA_StartCapture(); +// } else { +// if (MI_IsNDmaBusy(CAMERA_NEW_DMA_NO)) { +// static u32 count; +// OS_TPrintf("DMA was not done until VBlank.%d\n", count++); +// MI_StopNDma(CAMERA_NEW_DMA_NO); +// } else { +// if (reading) { +// re = TRUE; +// if (we) { +// we = FALSE; +// wp ^= 1; +// } +// } +// } +// } +// +// if (sLongDmaFlag) { +// sLongDmaFlag = FALSE; +// CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT + 1), /*(MINDmaCallback)NDmaDummyIntr*/NULL, NULL); +// } else { +// CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), /*(MINDmaCallback)NDmaDummyIntr*/NULL, NULL); +// } +// reading = TRUE; +// +// +// // OS_SetIrqCheckFlag(OS_IE_CAMERA); // checking camera interrupt +// // +// // if (mError) { +// // CAMERA_ClearBuffer(); +// // mError = FALSE; +// // } else { +// // if (CAMERA_GetErrorStatus() +// // /*|| +// // (OS_GetIrqMask() & (OS_IE_NDMA0 << CAMERA_NEW_DMA_NO))*/) { +// // // error +// // OS_TPrintf("line %d %x\n", __LINE__, (OS_GetIrqMask() & (OS_IE_NDMA0 << CAMERA_NEW_DMA_NO))); +// // +// // CAMERA_StopCapture(); +// // MI_StopNDma(CAMERA_NEW_DMA_NO); +// // // OS_DisableIrqMask(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO); +// // mError = TRUE; +// // return; +// // } +// // +// // if (mLastState == eStt_Capture) { +// // // OS_EnableIrqMask(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO); +// // return; +// // } +// // } +// // +// // switch (mState) { +// // case eStt_Capture: +// // CAMERA_StartCapture(); +// // // reg_OS_IF = OS_IE_NDMA0 << CAMERA_NEW_DMA_NO; +// // // callbackを指定しないと、mi_ndma.cで +// // // //---- set interrupt enable +// // // if ( callback ) +// // // { +// // // contData |= MI_NDMA_IF_ENABLE; +// // // } +// // // となっているので割り込みがかからない。 +// // +// // // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[0], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), (MINDmaCallback)NDmaDummyIntr, NULL); +// // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[0], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), (MINDmaCallback)NDmaIntr, NULL); +// // break; +// // +// // default: +// // break; +// // } +// // +// // mLastState = mState; +// +// // DrawFPS(); +// } +// +// // static void NDmaIntr(void) +// // { +// // OS_SetIrqCheckFlag(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO); +// // +// // if (mError) { +// // // captured data is broken +// // } else { +// // // 変換スレッドにメッセージを送る。 +// // +// // mLastState = mState; +// // switch (mState) { +// // case eStt_Capture: +// // // 表示用キャプチャを継続。 +// // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[0], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), (MINDmaCallback)NDmaIntr, NULL); +// // break; +// // +// // default: +// // // とりあえずそれ以外はキャプチャ停止。 +// // CAMERA_StopCapture(); +// // break; +// // } +// // OS_TPrintf("Send message!\n"); +// // +// // } +// // +// // // OS_DisableIrqMask(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO); +// // } + +static void NDmaDummyIntr(void) +{ +// // camera-2/main.c: CameraDmaIntr()で、これが行われている。 +// // これを抜いたのがうまく動かない原因ではなさそう。 +// // OS_SetIrqCheckFlag(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO); +// +// // camera-2/main.c: CameraDmaIntr()で、これが行われている。 +// // …おい!ここでセットする関数は、引数無しだぞ?どうなっとるん? +// // あ、CAMERA_DmaRecv*()のcallbackではないから、別物なのか!? +// // callbackは毎line来るんだよね? +// OS_SetIrqFunction(OS_IE_NDMA0 << CAMERA_NEW_DMA_NO, NDmaDummyIntr); // for next interrupt + +} + + +// /*---------------------------------------------------------------------------* +// Name: カメラ割り込み処理 (エラー時とVsync時の両方で発生) +// +// Description: +// +// Arguments: None +// +// Returns: None +// *---------------------------------------------------------------------------*/ +// void CameraIntr(void) +// { +// int nwp = 2; +// OS_SetIrqCheckFlag(OS_IE_CAMERA); // checking camera interrupt +// +// if (CAMERA_GetErrorStatus()) +// { +// OS_TPrintf("Error was occurred.\n"); +// // 停止処理 +// CAMERA_StopCapture(); // カメラ停止 +// CAMERA_ClearBuffer(); // クリア +// MI_StopNDma(CAMERA_NEW_DMA_NO); // DMA停止 +// wp_pending = TRUE; // 次回も同じフレームを使用する +// startRequest = TRUE; // カメラ再開要求 +// return; // waiting next frame (skip current frame) +// } +// +// // 以降はVsync時の処理 +// +// if (startRequest) +// { +// CAMERA_ClearBuffer(); +// CAMERA_StartCapture(); +// startRequest = FALSE; +// } +// +// if (CAMERA_IsBusy() == FALSE) // done to execute stop command? +// { +// //OS_TPrintf("while stopping the capture or just finished\n"); +// } +// else +// { +// if (MI_IsNDmaBusy(CAMERA_NEW_DMA_NO)) // NOT done to capture last frame? +// { +// OS_TPrintf("DMA was not done until VBlank.\n"); +// MI_StopNDma(CAMERA_NEW_DMA_NO); // DMA停止 +// // return; // waiting next frame (skip current frame) +// } +// // start to capture for next frame +// if (wp_pending) +// { +// wp_pending = FALSE; +// } +// else +// { +// // 更新バッファ変更 +// if (we) { +// nwp = wp; +// wp ^= 1; +// we = FALSE; +// } +// +// // #ifdef CONVERT_WITH_DSP +// // // DSPによるYUV->RGB変換実行 +// // sNowConvert = TRUE; +// // DSP_Yuv2RgbConvertAsync(buffer[rp ^ 1], buffer[rp ^ 1], (WIDTH*HEIGHT*2), Yuv2rgbCallback); +// // #else +// // // CPUによるYUV->RGB変換実行 +// // DC_InvalidateRange( buffer[rp ^ 1], BYTES_PER_LINE * HEIGHT); +// // GX_SetBankForLCDC((rp ^ 1) ? GX_VRAM_LCDC_D : GX_VRAM_LCDC_C); +// // CpuYuv2Rgb666(buffer[rp ^ 1], (void *)((rp ^ 1) ? HW_LCDC_VRAM_D : HW_LCDC_VRAM_C), (u32)(WIDTH*HEIGHT) ); +// // CpuYuv2Rgb( buffer[rp ^ 1], buffer[rp ^ 1], (u32)(WIDTH*HEIGHT) ); +// // #endif +// } +// +// // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), NULL, NULL); +// // なんで +// // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH)/LINES_SPLIT, CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), NULL, NULL); +// // じゃないの? +// // CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), NULL, NULL); +// CAMERA_DmaRecvAsync(CAMERA_NEW_DMA_NO, buffer[nwp], CAMERA_GetBytesAtOnce(WIDTH), CAMERA_GET_FRAME_BYTES(WIDTH, HEIGHT), (MINDmaCallback)CameraIntr, NULL); +// } +// +// // frame rate print +// // 割り込みでは遠慮しよう。 +// // DrawFPS(); +// } + +/*---------------------------------------------------------------------------* + Name: PutString + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static void PutString( char *format, ... ) +{ + u16 *dest = text_buffer; + char temp[32+1]; + int i; + va_list va; + + va_start(va, format); + (void)OS_VSNPrintf(temp, sizeof(temp), format, va); + va_end(va); + + MI_CpuClearFast(text_buffer, sizeof(text_buffer)); + for (i = 0; i < 32 && temp[i]; i++) + { + dest[i] = (u16)((u8)temp[i] | (0 << 12)); + } + DC_StoreRange(text_buffer, sizeof(text_buffer)); +} + +/*---------------------------------------------------------------------------* + Name: DrawFPS + + Description: FPSを表示します。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static void DrawFPS(void) +{ +#define FPS_SAMPLES 4 + static OSTick begin = 0; + static int uspf[FPS_SAMPLES] = { 0 }; + static int count = 0; + // 0123456789abcdef + static u8 star[16 + 1] = " "; + static u8 starIdx; + int i; + int sum = 0; + OSTick end = OS_GetTick(); + if (begin) // 初回を除く + { + uspf[count] = (int)OS_TicksToMicroSeconds(end - begin); + count = (count + 1) % FPS_SAMPLES; + } + begin = end; + // 平均値の算定 + for (i = 0; i < FPS_SAMPLES; i++) + { + if (uspf[i] == 0) break; + sum += uspf[i]; + } + star[starIdx] = ' '; + star[starIdx ^ 8] = ' '; + starIdx = (u8)((starIdx + 1) & 0xf); + star[starIdx] = '*'; + star[starIdx ^ 8] = '*'; + star[16] = '\0'; + if (1 || sum) + { + int mfps = (int)(1000000000LL * i / sum); + PutString("%2d.%03d fps %s", mfps / 1000, mfps % 1000, star); + } +} + +// /*---------------------------------------------------------------------------* +// Name: Yuv2rgbCallback +// +// Description: YUV->RGB変換完了後に呼び出されるコールバック +// +// Arguments: None +// +// Returns: None +// *---------------------------------------------------------------------------*/ +// static void Yuv2rgbCallback(void) +// { +// sNowConvert = FALSE; +// } +// +// + +// namespace cmn { namespace sys { namespace cmr2 +// { +// void* Manager::dspAlloc_( u32 size ) { +// #pragma unused(size) +// // this function must not be called by SDK +// OS_TPanic("dspAlloc_\n"); +// return NULL; +// } +// +// void Manager::dspFree_( void* p_ptr ) { +// #pragma unused(p_ptr) +// // this function is always called by SDK +// return; +// } +// +// }}} diff --git a/build/tests/yuv2rgb/src/menuCameraManager.cpp b/build/tests/yuv2rgb/src/menuCameraManager.cpp new file mode 100644 index 00000000..8db5e723 --- /dev/null +++ b/build/tests/yuv2rgb/src/menuCameraManager.cpp @@ -0,0 +1,2453 @@ +// TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECTについて +// ランチャーでは常に未定義です。 +// 私の手元で行っているカメラ部分に特化した実験開発プロジェクトと +// ソースを共用するため、そちらへ組み込まれる時のみ定義されます。 + +// 落ち着いたらcmnCameraManager.cppへ持っていく。 + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +#include "menu.h" +//#include "cmnJpegManager.h" +#include "cmnFile.h" +//#include "cmnImageSampling.h" +#include "menuImageSampling.h" +#endif + + +#include +#include +#include "menuCameraManager.h" +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#include +#include +#else +#include +#include +#endif + +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +// #else +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +// #include "menuDspManager.h" +// #endif +// #endif + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +extern "C" { +// build/libraries/dsp/ARM9.TWL/src/dsp_jpeg_enc.c +extern u16 *DSPFrame_y; +extern u16 *DSPFrame_cb; +extern u16 *DSPFrame_cr; +} /* extern "C" */ +#endif + +#if SDK_VERSION_DATE < 20080630 +#else +/*! + カメラVsyncコールバック + */ +static void proc_camera_vsync_callback( CAMERAResult result ) +{ +#pragma unused( result ) +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + { + extern cmn::sys::cmr2::Manager* mpCmrMgr2; + mpCmrMgr2->procCameraIntr(); + } +#else + MenuSys()->getCmrMgr2()->procCameraIntr(); +#endif +} +#endif + +namespace cmn { namespace sys { namespace cmr2 +{ + vu8 Manager::mCaptureFlag; + vu8 Manager::mNextCaptureFlag; + vu8 Manager::mShotFlag; + vu8 Manager::mNextShotFlag; + vu8 Manager::mCurLedBlink; + volatile CAMERASelect Manager::mSelCmr; + volatile CAMERASelect Manager::mNextCmr; + volatile cameraState Manager::mCmrCurState[cCameraMax]; + volatile cameraState Manager::mCmrNextState[cCameraMax]; + OSMessage Manager::mI2cAsyncMsgBuf[1]; + OSMessageQueue Manager::mI2cAsyncMsgQueue; + +/*! + コンストラクタ + */ +Manager::Manager() : +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + mpHeap( NULL ), +#endif + mShowWdt( cDefaultShowWidth ), + mShowHgt( cDefaultShowHeight ), + mShotWdt( cDefaultShotWidth ), + mShotHgt( cDefaultShotHeight ), + mLedKeepFlag( FALSE ), + mOneShotFlag( FALSE ), + mEncodeBusyFlag( FALSE ), + mPreInitFlag( FALSE ), + mInitFlag( FALSE ), + mpCaptureBuf( NULL ), + mpConvBuf( NULL ), + mpNextConvBuf( NULL ), + mpShotBuf( NULL ), + mI2cBusy( FALSE ), + mTexSwap( FALSE ), + mTexBank( GX_VRAM_TEX_NONE ), + mNextTexBank( GX_VRAM_TEX_NONE ), + mpEncodeWork(NULL) +{ + u32 i; + + // manager default value + for (i = 0; i < cCameraMax; i++) { + mCmrNextState[i].mContext = CAMERA_CONTEXT_B; + // フレームレートも、カメラ毎に保持している。 + mCmrNextState[i].mFrameRate = CAMERA_FRAME_RATE_20; + } + + for (i = 0; i < cBufferCount; i++) { + mIsCapBufUsed[i] = FALSE; + mpCapBuf[i] = NULL; + } + + mSelCmr = mNextCmr = CAMERA_SELECT_NONE; + mCaptureFlag = mNextCaptureFlag = mShotFlag = mNextShotFlag = FALSE; + mCurLedBlink = FALSE; + + // 初期化はこのタイミングで確実に行っておく。 + OS_InitEvent(&mLowerEvent); + + setCaptureRgbFlag( FALSE ); + +// TwlSDK/build/libraries/mi/common.TWL/src/mi_ndma.c: +// #define CAMERA_DMA_BLOCK_SIZE MI_NDMA_BWORD_16 +// #define CAMERA_DMA_INTERVAL 2 +// #define CAMERA_DMA_PRESCALER MI_NDMA_INTERVAL_PS_1 + MI_GetNDmaConfig(cDefaultDmaNo, &mDmaConfig); + mDmaConfig.intervalTimer = 2; // CAMERA_DMA_INTERVAL + mDmaConfig.prescaler = MI_NDMA_INTERVAL_PS_1; // CAMERA_DMA_PRESCALER; + // blockWordが16だとjackal (hyena)使用時の処理落ちが酷いが、 + // yuv2rgb実験において、32なら64との差は感じられなかった。 + // ランチャーへ組み込んでみると、32より64の方が処理落ちが少なかった。 + // 64にする。 + mDmaConfig.blockWord = MI_NDMA_BWORD_16; // MI_NDMA_BWORD_64; // CAMERA_DMA_BLOCK_SIZE; + +} + + +/*! + デストラクタ + */ +Manager::~Manager() +{ + while (!tryDestroy()) { + OS_Sleep(1); + } +} + + +/*! + カメラ先行初期化。 + 体感的なカメラ起動時間を短縮するため、本初期化の手前 + (ヒープを必要としない部分)まで行う。 + カメラはスタンバイに。 + 呼ばなくても良い。 + */ +void Manager::preInit( u32 show_w, u32 show_h, u32 shot_w, u32 shot_h ) +{ + // preInit()は複数箇所から呼ばれても良いようにしておく。 + { + OSIntrMode enabled = OS_DisableInterrupts(); + + if (mPreInitFlag) { + OS_RestoreInterrupts(enabled); + return; + } + mPreInitBusyFlag = TRUE; + mPreInitFlag = TRUE; + OS_RestoreInterrupts(enabled); + } + + mShowWdt = show_w; + mShowHgt = show_h; + mShotWdt = shot_w; + mShotHgt = shot_h; + +// setShutterSnd(NULL, 0, FALSE); + + // 直前の終了要求が残っているかもしれない。 + // 初期化要求以外、イベントはクリアしておく。 + OS_ClearEvent(&mLowerEvent, (u32)(cEventMaskLower_All & ~cEventMaskLower_EnableIntrAndPrepareBuffer)); + + OS_InitMessageQueue(&mI2cMsgQueue, mI2cMsgBuf, sizeof(mI2cMsgBuf) / sizeof(*mI2cMsgBuf)); + OS_InitMessageQueue(&mI2cAsyncMsgQueue, mI2cAsyncMsgBuf, sizeof(mI2cAsyncMsgBuf) / sizeof(*mI2cAsyncMsgBuf)); + OS_CreateThread(&mLowerThread, procLower_, this, + mLowerThreadStack + (sizeof(mLowerThreadStack) / sizeof(*mLowerThreadStack)), + sizeof(mLowerThreadStack), + menu::sys::Object::cThreadPriority_CameraLowerLo); + OS_CreateThread(&mI2cThread, procI2c_, this, + mI2cThreadStack + (sizeof(mI2cThreadStack) / sizeof(*mI2cThreadStack)), + sizeof(mI2cThreadStack), + menu::sys::Object::cThreadPriority_CameraI2c); + OS_WakeupThreadDirect(&mLowerThread); + OS_WakeupThreadDirect(&mI2cThread); +} + + +/*! + カメラライブラリの初期化 + @param p_heap ヒープ + @param mode 表示モード + @param sel_cmr 選択されたカメラ + @param vram1 ダブルバッファのVRAM1 + @param vram2 ダブルバッファのVRAM2 + @param show_w 表示横幅 (とりあえず208のみ) + @param show_h 表示高さ (とりあえず156のみ) + @param shot_w 撮影横幅 (とりあえず640のみ) + @param shot_h 撮影高さ (とりあえず480のみ) + */ +void Manager::init( +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + sys::Heap* p_heap , +#endif + int mode , CAMERASelect sel_cmr , int vram1 , int vram2 , + cmn::sys::cmr2::dtcmWork* pDtcmWork , + void (*gx_user_proc)(u8* vramAddr, BOOL shot) , + u32 show_w , u32 show_h , u32 shot_w , u32 shot_h ) +{ + if (mInitFlag) { + return; + } + mInitBusyFlag = TRUE; + mInitFlag = TRUE; + + preInit(show_w, show_h, shot_w, shot_h); + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // no Heap +#else + mpHeap = p_heap; +#endif + + mpDtcmWork = pDtcmWork; + mTarget = 0; + mpCaptureBuf = NULL; + mpConvBuf = NULL; + mpNextConvBuf = NULL; + mpShotBuf = NULL; + // 最初に準備したいのはvram1で、すでに準備済みのものがvram2 + // とする。 + mTexBank = GXVRamTex(vram2); + mNextTexBank = 0; + mCaptureFlag = FALSE; + mShotFlag = FALSE; + mNextCaptureFlag = FALSE; + mNextShotFlag = FALSE; + mShotDone = FALSE; + mShotErr = 0; + mpGxUserProc = gx_user_proc; +#ifndef TWL_IPL_FINAL + mDebugPort = 0; +#endif + + mTexSwap = FALSE; + mFirstPictureReady = FALSE; + + mCaptureSkipCount = 0; + mCaptureRetryCount = 0; + + mVramType[ 0 ] = vram1; + mVramType[ 1 ] = vram2; + + // vram2 == 0 ならシングルバッファにすればいいのでは? + for ( int i = 0 ; i < 2; ++ i ) + { + switch ( mVramType[ i ] ) + { + case GX_VRAM_A: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_A ); break; + case GX_VRAM_B: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_B ); break; + case GX_VRAM_C: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_C ); break; + case GX_VRAM_D: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_D ); break; + case GX_VRAM_E: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_E ); break; + case GX_VRAM_F: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_F ); break; + case GX_VRAM_G: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_G ); break; + case GX_VRAM_H: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_H ); break; + case GX_VRAM_I: mVramAddr[ i ] = reinterpret_cast< u8* > ( HW_LCDC_VRAM_I ); break; + default: IPL_ASSERT( 0 ); break; + } + } + + mMode = mode; + mNextCmr = sel_cmr; + + mGxDma = GX_GetDefaultDMA(); + // GXでDMAを使わない (旧DMAはカメラDMAの邪魔になる) + // で、いつ戻すの? + GX_SetDefaultDMA(GX_DMA_NOT_USE); + + OS_SignalEvent(&mLowerEvent, + cEventMaskLower_EnableIntrAndPrepareBuffer); +} + + +void Manager::procLower() +{ + u32 event; + BOOL initDone = FALSE; + CAMERAResult camResult; + u32 i; + BOOL shot; + + while (TRUE) { + if (!initDone) { +#if SDK_VERSION_DATE < 20080630 + // CAMERAライブラリを初期化していないという前提なので、 + // setInterrupt()は使わない。 + OS_DisableIrqMask(OS_IE_CAMERA); +#else + // OS_IE_CAMERAはCAMERAライブラリがハンドリングする。 +#endif + // 重いので低優先度で。 + camResult = CAMERA_Init(); + if (camResult != CAMERA_RESULT_SUCCESS) { + // とりあえず + IPL_HALT("CAMERA_Init() error %d\n", camResult); + OS_TPanic(""); + // NEVER REACH HERE + } + initDone = TRUE; + + // SDK default value + mSelCmr = CAMERA_SELECT_NONE; + for (i = 0; i < cCameraMax; i++) { + mCmrCurState[i].mContext = CAMERA_CONTEXT_A; + mCmrCurState[i].mFrameRate = CAMERA_FRAME_RATE_15; + } + mCurLedBlink = FALSE; + // I2C各種設定リクエスト送信。 + // 高優先度スレッドでAsync処理。 + OS_SendMessage(&mI2cMsgQueue, (OSMessage)cMsgI2c_AfterInit, OS_MESSAGE_BLOCK); + } + + event = OS_WaitEventEx_Or(&mLowerEvent, cEventMaskLower_All, cEventMaskLower_All); +// IPL_PRINT("event=0x%02x\n", event); + + if (event & cEventMaskLower_Destroy) { + break; + } + if (event & cEventMaskLower_EnableIntrAndPrepareBuffer) { + // カメラ割り込みを有効にする。 + setInterrupt(TRUE); + prepareBuffer(); + // 初期化は終わった。 + mInitBusyFlag = FALSE; + } + if (event & cEventMaskLower_Activate) { + if (mSelCmr == CAMERA_SELECT_NONE && mNextCmr != CAMERA_SELECT_NONE) { + // CAMERA_SELECT_NONEを設定時は、CAM_VSYNCは発生しないので + // kickする。 + // カメラ起動直後一定フレーム数の間は画像が安定しないのでキャプチャ停止。 + mCaptureSkipCount = 1; + OS_SendMessage(&mI2cMsgQueue, (OSMessage)cMsgI2c_Activate, OS_MESSAGE_BLOCK); + } + } + shot = FALSE; + if ((event & cEventMaskLower_Convert) || mpNextConvBuf) { + shot = convert((BOOL)(event & cEventMaskLower_Shot)); + } + if (shot) { + // 変換しないで撮影のみとか、 + // 撮影中にキャプチャを継続することには、まだ対応していない。 + mEncodeBusyFlag = TRUE; + encodeAndSave(); + mEncodeBusyFlag = FALSE; + } + if (event & cEventMaskLower_DisableIntrAndDestroyBuffer) { + // このイベントは連続発生する可能性がある。 + if (mInitFlag) { + // カメラ割り込みを無効にする。 + setInterrupt(FALSE); + destroyBuffer(); + MI_StopNDma(cDefaultDmaNo); + // 再初期化が必要。 + mInitFlag = FALSE; + } + } + } + + // I2Cスレッドを終了 (BLOCK) + OS_SendMessage(&mI2cMsgQueue, (OSMessage)cMsgI2c_Destroy, OS_MESSAGE_BLOCK); + OS_JoinThread(&mI2cThread); + + CAMERA_End(); + + GX_SetDefaultDMA(mGxDma); +} + + +void Manager::procI2c() +{ + OSMessage msg; + CAMERAResult camResult; + + while (TRUE) { + OS_ReceiveMessage(&mI2cMsgQueue, &msg, OS_MESSAGE_BLOCK); +// IPL_PRINT("I2c msg=%d\n", msg); + if (!msg) { + break; + } + + mI2cBusy = TRUE; + + switch ((u32)msg) { + case cMsgI2c_AfterInit: + CAMERA_SetOutputFormat(mCaptureRgbFlag ? CAMERA_OUTPUT_RGB : CAMERA_OUTPUT_YUV); + CAMERA_SetTrimming(FALSE); + // TrimmingがFALSEなのでTrimmingParamsは無視。 + mShowTransferLines = (int)CAMERA_GET_MAX_LINES(mShowWdt); + mShotTransferLines = (int)CAMERA_GET_MAX_LINES(mShotWdt); + // 今は解像度切り替えができないので、mShowWdtじゃなくてmShotWdtで。 + CAMERA_SetTransferLines(mShotTransferLines); + + camResult = i2cSetupOthers(); + // 結果はともかく、先行初期化は終わった。 + mPreInitBusyFlag = FALSE; + if (camResult != CAMERA_RESULT_SUCCESS) { + // まだ。 + IPL_HALT("not yet %d\n", camResult); + // TWL_IPL_FINALではスルーするー + OS_TPanic(""); + } + + break; + + case cMsgI2c_Activate: + camResult = i2cActivate(mNextCmr); + if (camResult != CAMERA_RESULT_SUCCESS) { + // まだ。 + IPL_HALT("not yet %d\n", camResult); + // TWL_IPL_FINALではスルーするー + OS_TPanic(""); + } + + break; + + case cMsgI2c_ChangeLedToOn: + case cMsgI2c_ChangeLedToBlink: + camResult = i2cLed( ((u32)msg == cMsgI2c_ChangeLedToBlink) ); + if (camResult != CAMERA_RESULT_SUCCESS) { + // まだ。 + IPL_HALT("not yet %d\n", camResult); + // TWL_IPL_FINALではスルーするー + OS_TPanic(""); + } + + break; + + default: + IPL_HALT("unknown msg %d\n", msg); + // TWL_IPL_FINALではスルーするー + break; + } + + mI2cBusy = FALSE; + } +} + + +// 高優先度スレッドからのみ呼ばれることを想定しているので排他制御しない。 +CAMERAResult Manager::i2cCommon(u32 type, CAMERASelect sel_cmr) +{ + union { + CAMERAResult result; + OSMessage msg; + } u = { + (CAMERAResult)(-1) // CAMERAResultは非負なので、この値が返ったら実装ミス。 + }; + const volatile cameraState* pNextState = &mCmrNextState[isOutCamera(sel_cmr)]; + u32 retryCount = 0; + + // cI2cCommon_Activateのみ、CAMERA_SELECT_NONEを受け付ける。 + // どんなときも、CAMERA_SELECT_BOTHは受け付けない。 + if (sel_cmr == CAMERA_SELECT_NONE && + type != cI2cCommon_Activate) { + IPL_HALT("error: CAMERA_SELECT_NONE for type %d\n", type); + return (CAMERAResult)(-2); + } + + while (TRUE) { + switch (type) { + case cI2cCommon_Activate: + u.result = CAMERA_I2CActivateAsync(sel_cmr, i2cActivateCallback, (void*)sel_cmr); + break; + + case cI2cCommon_FrameRate: + u.result = CAMERA_I2CFrameRateAsync(sel_cmr, pNextState->mFrameRate, i2cFrameRateCallback, (void*)sel_cmr); + break; + + case cI2cCommon_ContextSwitch: + u.result = CAMERA_I2CContextSwitchAsync(sel_cmr, pNextState->mContext, i2cContextSwitchCallback, (void*)sel_cmr); + break; + + // I2Cじゃないけど + case cI2cCommon_LedOn: + case cI2cCommon_LedBlink: + u.result = CAMERA_SetLEDAsync( (type == cI2cCommon_LedBlink), i2cLedCallback, (void*)(type == cI2cCommon_LedBlink)); + break; + + default: + IPL_HALT("unknown type(1) %d sel_cmr %d\n", type, sel_cmr); + // TWL_IPL_FINALではスルーするー + break; + } + + if (u.result == CAMERA_RESULT_BUSY) { + IPL_PRINT("CAMERA_RESULT_BUSY type %d retry %d\n", type, retryCount); + retryCount++; + if (retryCount < cI2cRetryMax) { + OS_Sleep(cI2cRetryIntervalMsec); + continue; + } + } + break; + } + + if (u.result == CAMERA_RESULT_SUCCESS) { + OS_ReceiveMessage(&mI2cAsyncMsgQueue, &u.msg, OS_MESSAGE_BLOCK); + if (u.result != CAMERA_RESULT_SUCCESS) { + IPL_HALT("I2cAsyncCommon error: result %d for type %d sel_cmr %d\n", u.result, type, sel_cmr); + // TWL_IPL_FINALではスルーするー + } + } else { + IPL_HALT("I2cAsyncCommon error: result %d for type %d sel_cmr %d\n", u.result, type, sel_cmr); + // TWL_IPL_FINALではスルーするー + } + + return u.result; +} + + +// 両方のカメラについて、コンテキスト切り替え、および +// コンテキストで保持されない設定を行う。 +// (mNextCmr == CAMERA_SELECT_NONE)の場合にのみスタンバイにする。 +// それ以外ではカメラの明示的な起動はしない。 +CAMERAResult Manager::i2cSetupOthers() +{ + CAMERAResult result = CAMERA_RESULT_SUCCESS; + CAMERASelect sel_cmr; + u32 i; + + if (mNextCmr == CAMERA_SELECT_NONE) { + // 先にスタンバイにする。 + result = i2cActivate(mNextCmr); + // スタンバイにしても、他の設定を続ける。 + } + + for (i = 0; i < cCameraMax; i++) { + sel_cmr = indexToCameraSelect(i); + + if (result == CAMERA_RESULT_SUCCESS) { + // どちらのコンテキストへ切り替える? + if (mCmrNextState[i].mContext == CAMERA_CONTEXT_A) { + // フレームレートは後から変更(上がるかもしれない) + result = i2cContextSwitch(sel_cmr); + if (result == CAMERA_RESULT_SUCCESS) { + result = i2cFrameRate(sel_cmr); + } + } else { + // フレームレートは先に変更(下がるかもしれない) + result = i2cFrameRate(sel_cmr); + if (result == CAMERA_RESULT_SUCCESS) { + result = i2cContextSwitch(sel_cmr); + } + } + } + } + + return result; +} + + +#if SDK_VERSION_DATE < 20080630 +void Manager::setInterrupt(BOOL enable) +{ + OS_DisableIrqMask(OS_IE_CAMERA); + + CAMERA_SetMasterInterrupt(enable); + if (enable) { + // ここでカメラ割り込みは禁止になっているので + // mIntrPositiveEdgeの操作を割り込み禁止にはしない。 + mIntrPositiveEdge = FALSE; + // almost begin of vblank + CAMERA_SetVsyncInterrupt(CAMERA_INTR_VSYNC_NEGATIVE_EDGE); + CAMERA_SetBufferErrorInterrupt(FALSE); + CAMERA_ClearBuffer(); + OS_ResetRequestIrqMask(OS_IE_CAMERA); + OS_EnableIrqMask(OS_IE_CAMERA); + } +} +#else +// OS_IE_CAMERAはCAMERAライブラリがハンドリングする。 +void Manager::setInterrupt(BOOL enable) +{ + CAMERA_SetVsyncCallback( NULL ); + if (enable) { + CAMERA_ClearBuffer(); + CAMERA_SetVsyncCallback( proc_camera_vsync_callback ); + } +} +#endif + + +CAMERAResult Manager::i2cActivate(CAMERASelect sel_cmr) +{ + return i2cCommon(cI2cCommon_Activate, sel_cmr); +} + +CAMERAResult Manager::i2cFrameRate(CAMERASelect sel_cmr) +{ + return i2cCommon(cI2cCommon_FrameRate, sel_cmr); +} + +CAMERAResult Manager::i2cContextSwitch(CAMERASelect sel_cmr) +{ + return i2cCommon(cI2cCommon_ContextSwitch, sel_cmr); +} + +CAMERAResult Manager::i2cLed(BOOL isBlink) +{ + return i2cCommon(isBlink ? cI2cCommon_LedBlink : cI2cCommon_LedOn, CAMERA_SELECT_OUT); +} + +void Manager::i2cCommonAsyncCallback(CAMERAResult result, void *arg) +{ +#ifdef TWL_IPL_FINAL +#pragma unused(arg) +#endif + // このコールバックが呼ばれる前にメッセージバッファは空に + // なっているはず。 + if (!OS_SendMessage(&mI2cAsyncMsgQueue, (OSMessage)result, OS_MESSAGE_NOBLOCK)) { + IPL_HALT("mI2cAsyncMsgQueue full! arg %d\n", arg); + // TWL_IPL_FINALではスルーするー + } +} + +void Manager::i2cActivateCallback(CAMERAResult result, void *arg) +{ + if (result == CAMERA_RESULT_SUCCESS) { + mSelCmr = (CAMERASelect)arg; + } + i2cCommonAsyncCallback(result, arg); +} + +void Manager::i2cFrameRateCallback(CAMERAResult result, void *arg) +{ + if (result == CAMERA_RESULT_SUCCESS) { + mCmrCurState[isOutCamera((CAMERASelect)arg)].mFrameRate = + mCmrNextState[isOutCamera((CAMERASelect)arg)].mFrameRate; + } + i2cCommonAsyncCallback(result, arg); +} + +void Manager::i2cContextSwitchCallback(CAMERAResult result, void *arg) +{ + if (result == CAMERA_RESULT_SUCCESS) { + mCmrCurState[isOutCamera((CAMERASelect)arg)].mContext = + mCmrNextState[isOutCamera((CAMERASelect)arg)].mContext; + } + i2cCommonAsyncCallback(result, arg); +} + +void Manager::i2cLedCallback(CAMERAResult result, void *arg) +{ + if (result == CAMERA_RESULT_SUCCESS) { + // 単純に(u8)argとすると、 + // Warning: integral type is not large enough to hold pointer + // と言われる。 + mCurLedBlink = (u8)((BOOL)arg); + } + i2cCommonAsyncCallback(result, arg); +} + + +void Manager::prepareBuffer() +{ +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +#ifdef TWL_IPL_USE_RED_IPL + MenuSys()->getRedIplMgr()->UseScratchHeaps(TRUE); +#endif +#endif + + for (u32 i = 0; i < cBufferCount; i++) { + mpCapBuf[i] = +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + new u16 [ cPhotoWidth * cPhotoHeight ]; +#else +#ifdef TWL_IPL_USE_RED_IPL + (u16*)MenuSys()->getRedIplMgr()->allocCameraCaptureScratchBuffer(cPhotoWidth * cPhotoHeight * sizeof(u16)); +#else + new( mpHeap ) u16 [ cPhotoWidth * cPhotoHeight ]; +#endif +#endif + IPL_ASSERT( mpCapBuf[i] ); + IPL_PRINT("mpCapBuf[%d]=%x\n", i, mpCapBuf[i]); + } + + mpEncodeWork = +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + new encodeWork; +#else + new u8 [ SSP_JpegEncoderGetBufferSize(cPhotoWidth, cPhotoHeight, cEncodeSampling, mEncodeOption) ]; +#endif +#else +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#ifdef TWL_IPL_USE_RED_IPL + (encodeWork*)MenuSys()->getRedIplMgr()->allocJpegEncodeScratchBuffer(sizeof(encodeWork)); +#else + new ( mpHeap ) encodeWork; +#endif +#else +#ifdef TWL_IPL_USE_RED_IPL + (u8*)MenuSys()->getRedIplMgr()->allocJpegEncodeScratchBuffer(SSP_JpegEncoderGetBufferSize(cPhotoWidth, cPhotoHeight, cEncodeSampling, mEncodeOption)); +#else + new ( mpHeap ) u8 [ SSP_JpegEncoderGetBufferSize(cPhotoWidth, cPhotoHeight, cEncodeSampling, mEncodeOption) ]; +#endif +#endif +#endif + IPL_ASSERT( mpEncodeWork ); + + IPL_PRINT("mpEncodeWork=%x\n", mpEncodeWork); + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + mpEncodeResult = new u8 [ cEncodeResultSizeMax ]; IPL_ASSERT( mpEncodeResult ); +#endif + + // invalidate capture buffers + DC_FlushAll(); +} + +void Manager::destroyBuffer() +{ + // 使用中でも強引に破棄する。 + IPL_ASSERT( !mpCaptureBuf ); + IPL_ASSERT( !mpConvBuf ); + IPL_ASSERT( !mpNextConvBuf ); + IPL_ASSERT( !mpShotBuf ); + + mpCaptureBuf = NULL; + mpConvBuf = NULL; + mpNextConvBuf = NULL; + mpShotBuf = NULL; + + { + OSIntrMode enabled = OS_DisableInterrupts(); + + for (u32 i = 0; i < cBufferCount; i++) { + IPL_ASSERT( !mIsCapBufUsed[i] ); + mIsCapBufUsed[i] = FALSE; + if (mpCapBuf[i]) { +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + delete [] mpCapBuf[i]; +#else +#ifdef TWL_IPL_USE_RED_IPL + MenuSys()->getRedIplMgr()->freeCameraCaptureScratchBuffer(mpCapBuf[i]); +#else + delete [] mpCapBuf[i]; +#endif +#endif + mpCapBuf[i] = NULL; + } + } + + if (mpEncodeWork) { +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + delete mpEncodeWork; +#else + delete [] mpEncodeWork; +#endif +#else +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#ifdef TWL_IPL_USE_RED_IPL + MenuSys()->getRedIplMgr()->freeJpegEncodeScratchBuffer(mpEncodeWork); +#else + delete mpEncodeWork; +#endif +#else +#ifdef TWL_IPL_USE_RED_IPL + MenuSys()->getRedIplMgr()->freeJpegEncodeScratchBuffer(mpEncodeWork); +#else + delete [] mpEncodeWork; +#endif +#endif +#endif + mpEncodeWork = NULL; + } + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + if (mpEncodeResult) { + delete [] mpEncodeResult; + mpEncodeResult = NULL; + } +#endif + + OS_RestoreInterrupts(enabled); + } + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +#ifdef TWL_IPL_USE_RED_IPL + MenuSys()->getRedIplMgr()->UseScratchHeaps(FALSE); +#endif +#endif + +} + +// (mpNextConvBuf != NULL) の場合にのみ呼ばれる。 +void Manager::useNextConvBuf() +{ + OSIntrMode enabled = OS_DisableInterrupts(); + + if (mpConvBuf) { + freeCapBufByPtr((u16*)mpConvBuf); + } + mpConvBuf = mpNextConvBuf; + mpNextConvBuf = NULL; + OS_RestoreInterrupts(enabled); + + // invalidate capture buffers + DC_FlushAll(); + + IPL_PRINT("using NextConvBuf\n"); +} + +BOOL Manager::convert(BOOL shot) +{ + // 変換しないで撮影のみとか、 + // 撮影中にキャプチャを継続することには、まだ対応していない。 + if (!mpConvBuf && !mpNextConvBuf) { + IPL_HALT("(!mpConvBuf && !mpNextConvBuf)\n"); + // TWL_IPL_FINALではスルーするー + + return FALSE; + } + + while (mTexSwap || + mTexBank == mVramType[mTarget]) { + // 変換結果出力先のVRAMをLCDCへ割り当てられないので、 + // 少しsleep。 + // まだスレッドENDリクエストのチェックをしていないので、 + // 終了時にはまらないよう注意。 + OS_Sleep(1); + } + mNextTexBank = mVramType[mTarget]; + GX_SetBankForLCDC( mNextTexBank ); + + if (mpNextConvBuf) { + // 撮影データが存在。 + // mpConvBufは破棄する。 + useNextConvBuf(); + shot = TRUE; + } + + // キャプチャ済みデータのinvalidateは済んでいる。 +retry: + Shrink640Yuv422To256Rgb555(const_cast(mpConvBuf), mVramAddr[mTarget], mShotHgt, mpDtcmWork->mShrinkBuf); + + // ここでもmpNextConvBufをチェックする。 + if (mpNextConvBuf) { + // 撮影データが存在。 + // mpConvBufは破棄する。 + useNextConvBuf(); + shot = TRUE; + goto retry; + } + + // スレッド優先度を通常より高くする。 + OS_SetThreadPriority(OS_GetCurrentThread(), menu::sys::Object::cThreadPriority_CameraLowerHi); + { + OSIntrMode enabled = OS_DisableInterrupts(); + + procPostConvert(shot); + + OS_RestoreInterrupts(enabled); + } + + if (mMode == eMode_BG) { + mTexSwap = TRUE; + } else { + // eMode_Tex + if (mpGxUserProc) { + mpGxUserProc(mVramAddr[mTarget], shot); + } + } + + mTarget ^= 1; + + OS_SetThreadPriority(OS_GetCurrentThread(), menu::sys::Object::cThreadPriority_CameraLowerLo); + + if (!shot) { + // invalidate capture buffer for next capture + DC_FlushAll(); + } + + return shot; +} + +/*! + カメラマネージャを完全終了する + */ +BOOL Manager::tryDestroy() +{ + // スリープ可能な条件まで待つ。 + if (!tryPrepareToSleep()) { + return FALSE; + } + + if (mInitFlag) { + OS_SignalEvent(&mLowerEvent, + cEventMaskLower_DisableIntrAndDestroyBuffer); + return FALSE; + } else { + if (mPreInitFlag) { + OS_SignalEvent(&mLowerEvent, + cEventMaskLower_Destroy); + + if (OS_IsThreadTerminated(&mLowerThread)) { + // 再先行初期化が必要。 + mPreInitFlag = FALSE; + return TRUE; + } + return FALSE; + } + } + return TRUE; +} + + +void Manager::activate() +{ + startCapture(mNextCmr); +} + + +void Manager::startCapture(CAMERASelect sel_cmr) +{ + mNextCmr = sel_cmr; + mNextCaptureFlag = TRUE; + // CAMERA_Init()の処理が完了していないかもしれないので + // いきなりI2C処理要求の送信はできない。 + OS_SignalEvent(&mLowerEvent, cEventMaskLower_Activate); +} + + +// TRUEが返れば、撮影要求が成功した。 +// FALSEなら、失敗。(撮影処理途中で次の撮影をさせない) +BOOL Manager::shoot(BOOL keepCapture) +{ + OSIntrMode enabled; + + // とりあえず連射は無し。 + // 撮影処理には時間がかかるので、撮影中や保存中(!mCaptureFlag)なら撮影させない。 + if (mNextShotFlag || mShotFlag || !mCaptureFlag) { + return FALSE; + } + + // 外カメラのLED制御(点灯→点滅)は、なるべく早くLEDを消す + // (残光が映り込むのを防ぐ)ため、ここで行いたい。 + // しかし外カメラに切り替え要求が出ている途中は、まだ内カメラなのでできない。 + // CAMERA_RESULT_ILLEGAL_STATUS (6) が返る。 + // どっちみち、カメラを切り替えた直後はピンボケするので1フレーム待つ + // ことになるし、ここではLED制御を行わない。 + + enabled = OS_DisableInterrupts(); + + if (!keepCapture) { + mNextCaptureFlag = FALSE; + } + mNextShotFlag = TRUE; + + OS_RestoreInterrupts(enabled); + + return TRUE; +} + +BOOL Manager::tryPrepareToSleep() +{ + stopCapture(); + + if (// 先行初期化中ならダメ。 + (mPreInitFlag && mPreInitBusyFlag) || + // 初期化中ならダメ。 + (mInitFlag && mInitBusyFlag) || + // キャプチャ中ならダメ。 + mCaptureFlag || + mNextCaptureFlag || + mpCaptureBuf || + // 変換中ならダメ。 + mpConvBuf || + mpNextConvBuf || + // 撮影中ならダメ。 + mShotFlag || + mNextShotFlag || + mpShotBuf || + // シャッター音再生中ならダメ。 +// (!isFinishedShutterSnd()) || + // 保存中ならダメ。 + mEncodeBusyFlag || + // I2C処理中ならダメ。 + mI2cBusy) { + return FALSE; + } + + if (mSelCmr != CAMERA_SELECT_NONE || + mNextCmr != CAMERA_SELECT_NONE) { + // カメラ起動中ならダメ。 + mNextCmr = CAMERA_SELECT_NONE; + return FALSE; + } + + return TRUE; +} + +#include + +// pDtcmにはu32[256*2] (2048 Bytes)の作業領域が必要です。 +// 作業領域にDTCM以外のメモリを割り当てた場合には +// パフォーマンスが大きく低下する可能性があります。 +// little endian only +asm void Manager::Shrink640Yuv422To256Rgb555( register const void* src, register void* dst, register u32 height, register void* pDtcm ) +{ +#define ORIGINAL_WIDTH 640 +#define SHRINK_WIDTH 256 // must be even +#define SHRINK_TMP_BYTES_PER_PIXEL 4 +#define SHRINK_TMP_HEIGHT 2 +// loopCounters bits: +// d31-d25: (64 x 2) loop counter +// (d31-d24: dst loop counter) +// d23-d22: (2 or 3) loop counter +// d09-d00: height loop counter (0-511) << 1 +#define LOOP_COUNTERS_INNER_SHIFT 25 +#define LOOP_COUNTERS_DST_SHIFT 24 +#define LOOP_COUNTERS_ODD_LINE_SHIFT 22 +#define LOOP_COUNTERS_ODD_LINE_MASK_SHIFT 23 +#define LOOP_COUNTERS_HEIGHT_BIT_WIDTH 10 +// registers +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3-r11,lr +#define loopCounters height + +// keep order for ldm/stm +#define t0 r12 +#define t1 lr +#define yuyv0 r4 +#define yuyv1 r5 +#define yuyv2 r6 +#define yuyv3 r7 +#define uv r8 + +#define CONST_REGS0 r9 +#define const_0x01fe01fe r9 + +// yuv2rgb +#define y0 yuyv0 +#define y1 yuyv1 +#define rgba yuyv2 +#define const_0x80008000 const_0x01fe01fe +#define CONST_REGS1 const_H1_402_L1_772,const_Hm0_344_Lm0_714 +#define const_H1_402_L1_772 r10 +#define const_Hm0_344_Lm0_714 r11 + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + + ldr t0, =@constants1 + ldr const_0x01fe01fe, =0x01fe01fe + ldmia t0, {CONST_REGS1} + + // height << 1 and adjust loop counter + mov loopCounters, height, lsl #1 + sub loopCounters, loopCounters, #1 + +@480: + // (480/2.5) = 192 loops + +@640: + // (64 x 2) loops + +@64: + ldmia src!, {yuyv0, yuyv1, yuyv2, yuyv3, uv} + + and t0, const_0x01fe01fe, yuyv0, lsr #7 + and t1, const_0x01fe01fe, yuyv1, lsr #7 + and yuyv0, const_0x01fe01fe, yuyv0, lsl #1 + and yuyv1, const_0x01fe01fe, yuyv1, lsl #1 + add yuyv0, yuyv0, yuyv0, lsl #16 + mov yuyv0, yuyv0, lsr #16 + add yuyv1, yuyv1, yuyv1, lsr #16 + orr yuyv0, yuyv0, yuyv1, lsl #16 // ave. y << 1 + add yuyv1, t0, t1 // ave. uv << 1 + + and t0, const_0x01fe01fe, yuyv2, lsr #7 + and t1, const_0x01fe01fe, yuyv3, lsr #7 + add t1, t1, t0, lsr #1 + and t0, const_0x01fe01fe, uv, lsr #7 + + and yuyv2, const_0x01fe01fe, yuyv2, lsr #16-1 + and yuyv3, const_0x01fe01fe, yuyv3, lsl #1 + add yuyv2, yuyv2, yuyv3 + and uv, const_0x01fe01fe, uv, lsl #16+1 + add yuyv2, yuyv2, uv // ave. y << 1 + + add yuyv3, t1, t0, lsr #1 // ave. uv << 1 + + stmia pDtcm!, {yuyv0, yuyv1, yuyv2, yuyv3} + + adds loopCounters, loopCounters, #1 << LOOP_COUNTERS_INNER_SHIFT + bcc @64 + + sub pDtcm, pDtcm, #SHRINK_TMP_BYTES_PER_PIXEL * SHRINK_WIDTH * SHRINK_TMP_HEIGHT + ldr const_0x80008000, =0x80008000 +@yuv2rgb_loop: + ldmia pDtcm!, {y1, uv} + ldr t0, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 1 - SHRINK_TMP_BYTES_PER_PIXEL * 2] + ldr t1, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 1 - SHRINK_TMP_BYTES_PER_PIXEL * 2 + SHRINK_TMP_BYTES_PER_PIXEL] + add y1, y1, t0 + add uv, uv, t1 + + // original formula: + // R = Y + 1.402*(V-128) + // G = Y - 0.344*(U-128) - 0.714*(V-128) + // B = Y + 1.772*(U-128) + // + // y1: (sum y0y1 of 4 pixels) << 1 + // uv: (sum uv of 4 pixels) << 1 + // + // then, + // R = (sumY/2 + (1.402/2)*(sumV-128*2*4)) / 4 + // G = (sumY/2 - (0.344/2)*(sumU-128*2*4) - (0.714/2)*(sumV-128*2*4)) / 4 + // B = (sumY/2 + (1.772/2)*(sumU-128*2*4)) / 4 + // + // or + // R = sumY/8 + (1.402/8)*(sumV-128*2*4) + // G = sumY/8 - (0.344/8)*(sumU-128*2*4) - (0.714/8)*(sumV-128*2*4) + // B = sumY/8 + (1.772/8)*(sumU-128*2*4) + // + // sumY max is 0xff*2*4 = 0x07f8 + // sumU, sumV max is 0xff*2*4 = 0x07f8 + // 0x07f8 << 20 =0x7f800000 + + // sumY /= 8; and normalize to 0x7f800000 + mov y0, y1, lsl #20 + mov y1, y1, lsr #16 + mov y1, y1, lsl #20 + + // normalize sumU, sumV and -= 128*2*4 + mov uv, uv, lsl #5 + eor uv, uv, const_0x80008000 + + // Green + // -(0.714/8)*sumV + smulbt t0, const_Hm0_344_Lm0_714, uv + // -(0.344/8)*sumU + smultb t1, const_Hm0_344_Lm0_714, uv + mov rgba, const_0x80008000 + add t1, t0, t1 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #21 // 0x7c000000 -> 0x000003e0 + ands t0, t1, #0xfc000000 + + // Red + // (1.402/8)*sumV + smultt t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #21-16 // 0x7c000000 -> 0x03e00000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #26 // 0x7c000000 -> 0x0000001f + ands t0, t1, #0xfc000000 + + // Blue + // (1.772/8)*sumU + smulbb t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #26-16 // 0x7c000000 -> 0x001f0000 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #16 // 0x7c000000 -> 0x00007c00 + ands t0, t1, #0xfc000000 + orrpl rgba, rgba, t0 // 0x7c000000 + + str rgba, [dst], #4 + adds loopCounters, loopCounters, #2 << LOOP_COUNTERS_DST_SHIFT // 2 pixels at once + bcc @yuv2rgb_loop + + add loopCounters, loopCounters, #1 << LOOP_COUNTERS_ODD_LINE_SHIFT + tst loopCounters, #1 << LOOP_COUNTERS_ODD_LINE_MASK_SHIFT + // skip 1 line + addne src, src, #ORIGINAL_WIDTH * sizeof(u16) + bicne loopCounters, loopCounters, #1 << LOOP_COUNTERS_ODD_LINE_MASK_SHIFT + + sub pDtcm, pDtcm, #SHRINK_TMP_BYTES_PER_PIXEL * SHRINK_WIDTH + ldr const_0x01fe01fe, =0x01fe01fe + +@yuv2rgb_done: + // (-2.5) << 1 + subs loopCounters, loopCounters, #5 + bcs @480 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr + +@constants1: + dcd 0x59ba7168 // ((1.402 * 0x4000) << 16) | ((1.772 * 0x4000) & 0xffff) + dcd 0xe9fcd24e // ((-0.344 * 0x4000) << 16) | ((-0.714 * 0x4000) & 0xffff) + +#undef ORIGINAL_WIDTH +#undef SHRINK_WIDTH +#undef SHRINK_TMP_BYTES_PER_PIXEL +#undef SHRINK_TMP_HEIGHT +#undef LOOP_COUNTERS_INNER_SHIFT +#undef LOOP_COUNTERS_DST_SHIFT +#undef LOOP_COUNTERS_ODD_LINE_SHIFT +#undef LOOP_COUNTERS_ODD_LINE_MASK_SHIFT +#undef LOOP_COUNTERS_HEIGHT_BIT_WIDTH + +#undef SAVE_REGS +#undef loopCounters +#undef t0 +#undef t1 + +#undef yuyv0 +#undef yuyv1 +#undef yuyv2 +#undef yuyv3 +#undef uv + +#undef CONST_REGS0 +#undef const_0x01fe01fe + +#undef y0 +#undef y1 +#undef rgba +#undef const_0x80008000 +#undef CONST_REGS1 +#undef const_H1_402_L1_772 +#undef const_Hm0_344_Lm0_714 +} + + +// まだ480 linesではなく、156*3 linesでしか処理していない。 +// 小数切り捨てで問題ないのか、切り上げるのか? +// pDtcmにはu32[208*3] (2496 Bytes)の作業領域が必要です。 +// 作業領域にDTCM以外のメモリを割り当てた場合には +// パフォーマンスが大きく低下する可能性があります。 +// little endian only +asm void Manager::Shrink640Yuv422To208Rgb555( register const void* src, register void* dst, register u32 height, register void* pDtcm ) +{ +#define ORIGINAL_WIDTH 640 +#define SHRINK_WIDTH 208 // must be even +#define SHRINK_TMP_BYTES_PER_PIXEL 4 +#define SHRINK_TMP_HEIGHT 3 +// loopCounters bits: +// d31-d28: (6 + 7) loop counter +// d27-d24: (6 + 7) x 8 loop counter +// (d31-d24: dst loop counter) +// d23-d22: dtcm line loop counter +// d21-d09: unused +// d08-d00: height loop counter (0-511) +#define LOOP_COUNTERS_INNER_SHIFT 28 +#define LOOP_COUNTERS_LINE_SHIFT 24 +#define LOOP_COUNTERS_DST_SHIFT 24 +#define LOOP_COUNTERS_DTCM_LINE_SHIFT 22 +#define LOOP_COUNTERS_DTCM_LINE_MASK 0x3 +#define LOOP_COUNTERS_HEIGHT_BIT_WIDTH 9 +// registers +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3-r11,lr +#define loopCounters height + +// keep order for ldm/stm +#define t0 r12 +#define t1 lr +#define yuyv0 r4 +#define yuyv1 r5 +#define yuyv2 r6 +#define yuyv3 r7 +#define uv r8 + +#define CONST_REGS0 r9,r10,r11 +#define const_0x01fe01fe r9 +#define const_0x00001c73 r10 +#define const_0x00000e39 r11 + +// register pair (be careful about order) +#define YYUV_REGS0 yuyv1,uv +#define YYUV_REGS1 yuyv1,t1 + +// yuv2rgb +#define y0 yuyv0 +#define y1 yuyv1 +#define rgba yuyv2 +#define CONST_REGS1 const_0x000717c2,const_0x80008000,const_H1_402_L1_772,const_Hm0_344_Lm0_714 +#define const_0x000717c2 yuyv3 +#define const_0x80008000 const_0x01fe01fe +#define const_H1_402_L1_772 const_0x00001c73 +#define const_Hm0_344_Lm0_714 const_0x00000e39 + + ldr t0, =@constants0 + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + + ldmia t0, {CONST_REGS0} + + // dtcm line loop + // loopCounters and height may differ + add loopCounters, height, #SHRINK_TMP_HEIGHT << LOOP_COUNTERS_DTCM_LINE_SHIFT + +@480: + // (6 + 7) x 8 loops = 8,9,a,b,c,d,e,f + // adjust (6 + 7) loop counter, from minus + add loopCounters, loopCounters, #(8 << LOOP_COUNTERS_LINE_SHIFT) - (1 << LOOP_COUNTERS_INNER_SHIFT) + +@640: + // 6 loops + add loopCounters, loopCounters, #6 << LOOP_COUNTERS_INNER_SHIFT +@6: + ldmia src!, {yuyv0, yuyv1, yuyv2} + + and t0, const_0x01fe01fe, yuyv0, lsr #7 + and t1, const_0x01fe01fe, yuyv1, lsr #7 + add t0, t0, t1 + and t1, const_0x01fe01fe, yuyv2, lsr #7 + add uv, t0, t1 // sum uv << 1 + + and yuyv0, const_0x01fe01fe, yuyv0, lsl #1 + and yuyv1, const_0x01fe01fe, yuyv1, lsl #1 + add yuyv0, yuyv0, yuyv0, lsl #16 + add yuyv1, yuyv1, yuyv0, lsr #16 // sum y0 << 1 + + and yuyv2, const_0x01fe01fe, yuyv2, lsl #1 + add yuyv2, yuyv2, yuyv2, lsr #16 + add yuyv1, yuyv1, yuyv2, lsl #16 // sum y1 << 1 + stmia pDtcm!, {YYUV_REGS0} + + subs loopCounters, loopCounters, #1 << LOOP_COUNTERS_INNER_SHIFT + bpl @6 + + // 7 loops + add loopCounters, loopCounters, #7 << LOOP_COUNTERS_INNER_SHIFT + ldmia src!, {yuyv0, yuyv1, yuyv2, yuyv3} + and uv, const_0x01fe01fe, yuyv0, lsr #7 + and yuyv0, const_0x01fe01fe, yuyv0, lsl #1 +@7: + and t0, const_0x01fe01fe, yuyv1, lsr #7 + add t0, t0, uv, lsr #1 + and t1, const_0x01fe01fe, yuyv2, lsr #7 + add t0, t0, t1 + and uv, const_0x01fe01fe, yuyv3, lsr #7 + add t1, t0, uv, lsr #1 // sum uv << 1 + + and yuyv1, const_0x01fe01fe, yuyv1, lsl #1 + add yuyv1, yuyv1, yuyv0, lsr #16 + add yuyv1, yuyv1, yuyv1, lsl #16 + mov yuyv1, yuyv1, lsr #16 // sum y0 << 1 + + and yuyv2, const_0x01fe01fe, yuyv2, lsl #1 + and yuyv0, const_0x01fe01fe, yuyv3, lsl #1 + add yuyv2, yuyv2, yuyv0, lsl #16 + add yuyv2, yuyv2, yuyv2, lsr #16 + orr yuyv1, yuyv1, yuyv2, lsl #16 // sum y1 << 1 + + stmia pDtcm!, {YYUV_REGS1} + subs loopCounters, loopCounters, #1 << LOOP_COUNTERS_INNER_SHIFT + ldmplia src!, {yuyv1, yuyv2, yuyv3} + bpl @7 + + adds loopCounters, loopCounters, #1 << LOOP_COUNTERS_LINE_SHIFT + bmi @640 + + sub loopCounters, loopCounters, #1 << LOOP_COUNTERS_DTCM_LINE_SHIFT + tst loopCounters, #LOOP_COUNTERS_DTCM_LINE_MASK << LOOP_COUNTERS_DTCM_LINE_SHIFT + bne @yuv2rgb_done + + ldr t0, =@constants1 + add loopCounters, loopCounters, #SHRINK_TMP_HEIGHT << LOOP_COUNTERS_DTCM_LINE_SHIFT + ldmia t0, {CONST_REGS1} + + add loopCounters, loopCounters, #(0x100 - SHRINK_WIDTH) << LOOP_COUNTERS_DST_SHIFT + sub pDtcm, pDtcm, #SHRINK_TMP_BYTES_PER_PIXEL * SHRINK_WIDTH * SHRINK_TMP_HEIGHT +@yuv2rgb_loop: + ldmia pDtcm!, {y0, uv} + ldr t0, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 1 - SHRINK_TMP_BYTES_PER_PIXEL * 2] + ldr t1, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 1 - SHRINK_TMP_BYTES_PER_PIXEL * 2 + SHRINK_TMP_BYTES_PER_PIXEL] + add y0, y0, t0 + ldr t0, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 2 - SHRINK_TMP_BYTES_PER_PIXEL * 2] + add uv, uv, t1 + ldr t1, [pDtcm, #SHRINK_WIDTH * SHRINK_TMP_BYTES_PER_PIXEL * 2 - SHRINK_TMP_BYTES_PER_PIXEL * 2 + SHRINK_TMP_BYTES_PER_PIXEL] + add y0, y0, t0 + add uv, uv, t1 + + // original formula: + // R = Y + 1.402*(V-128) + // G = Y - 0.344*(U-128) - 0.714*(V-128) + // B = Y + 1.772*(U-128) + // + // y0: (sum y0y1 of 9 pixels) << 1 + // uv: (sum uv of 9 pixels) << 1 + // + // then, + // R = (sumY/2 + (1.402/2)*(sumV-128*2*9)) / 9 + // G = (sumY/2 - (0.344/2)*(sumU-128*2*9) - (0.714/2)*(sumV-128*2*9)) / 9 + // B = (sumY/2 + (1.772/2)*(sumU-128*2*9)) / 9 + // + // or + // R = sumY/18 + (1.402/18)*(sumV-128*2*9) + // G = sumY/18 - (0.344/18)*(sumU-128*2*9) - (0.714/18)*(sumV-128*2*9) + // B = sumY/18 + (1.772/18)*(sumU-128*2*9) + // + // sumY max is 0xff*2*9 = 0x11ee + // sumU, sumV max is 0xff*2*9 = 0x11ee + // 0x11ee*0x717c2=0x7f8003fc + + // sumY /= 2*9; and normalize to 0x7f800000 + mov t0, y0, lsr #16 + mul y1, const_0x000717c2, t0 + eor t0, y0, t0, lsl #16 + mul y0, const_0x000717c2, t0 + + // sumV -= 128*2*9 + sub uv, uv, #0x900 << 16 + + // Red + // (1.402/18)*sumV + smultt t1, const_H1_402_L1_772, uv + mov rgba, const_0x80008000 + // normalize + mov t1, t1, lsl #8 + + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #26 // 0x7c000000 -> 0x0000001f + ands t0, t1, #0xfc000000 + orrpl rgba, rgba, t0, lsr #26-16 // 0x7c000000 -> 0x001f0000 + + // Green + // -(0.714/18)*sumV + smulbt t0, const_Hm0_344_Lm0_714, uv + // sumU -= 128*2*9 + sub uv, uv, #0x900 + // -(0.344/18)*sumU + smultb t1, const_Hm0_344_Lm0_714, uv + // normalize + mov t0, t0, lsl #8 + add t1, t0, t1, lsl #8 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #21 // 0x7c000000 -> 0x000003e0 + ands t0, t1, #0xfc000000 + + // Blue + // (1.772/18)*sumU + smulbb t1, const_H1_402_L1_772, uv + orrpl rgba, rgba, t0, lsr #21-16 // 0x7c000000 -> 0x03e00000 + // normalize + mov t1, t1, lsl #8 + // +Y + qdadd t0, y0, t1 + qdadd t1, y1, t1 + ands t0, t0, #0xfc000000 + orrpl rgba, rgba, t0, lsr #16 // 0x7c000000 -> 0x00007c00 + ands t0, t1, #0xfc000000 + orrpl rgba, rgba, t0 // 0x7c000000 -> 0x7c000000 + + str rgba, [dst], #4 + adds loopCounters, loopCounters, #2 << LOOP_COUNTERS_DST_SHIFT // 2 pixels at once + bcc @yuv2rgb_loop + + ldr t0, =@constants0 + add dst, dst, #(HW_LCD_WIDTH - SHRINK_WIDTH) * sizeof(u16) + sub pDtcm, pDtcm, #SHRINK_TMP_BYTES_PER_PIXEL * SHRINK_WIDTH + ldmia t0, {CONST_REGS0} + +@yuv2rgb_done: + sub loopCounters, loopCounters, #1 + movs t0, loopCounters, lsl #32 - LOOP_COUNTERS_HEIGHT_BIT_WIDTH + bne @480 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr + +@constants0: + dcd 0x01fe01fe + dcd 0x00001c73 + dcd 0x00000e39 + +@constants1: + dcd 0x000717c2 + dcd 0x80008000 + dcd 0x04fc064c // (((1.402/18) * 0x4000) << 16) | (((1.772/18) * 0x4000) & 0xffff) + dcd 0xfec7fd77 // (((-0.344/18) * 0x4000) << 16) | (((-0.714/18) * 0x4000) & 0xffff) + + +#undef ORIGINAL_WIDTH +#undef SHRINK_WIDTH +#undef SHRINK_TMP_BYTES_PER_PIXEL +#undef SHRINK_TMP_HEIGHT +#undef LOOP_COUNTERS_INNER_SHIFT +#undef LOOP_COUNTERS_LINE_SHIFT +#undef LOOP_COUNTERS_DST_SHIFT +#undef LOOP_COUNTERS_DTCM_LINE_MASK +#undef LOOP_COUNTERS_DTCM_LINE_SHIFT +#undef LOOP_COUNTERS_HEIGHT_BIT_WIDTH + +#undef SAVE_REGS +#undef loopCounters +#undef t0 +#undef t1 + +#undef yuyv0 +#undef yuyv1 +#undef yuyv2 +#undef yuyv3 +#undef uv + +#undef CONST_REGS0 +#undef const_0x01fe01fe +#undef const_0x00001c73 +#undef const_0x00000e39 + +#undef YYUV_REGS0 +#undef YYUV_REGS1 + +#undef y0 +#undef y1 +#undef rgba +#undef CONST_REGS1 +#undef const_0x000717c2 +#undef const_0x80008000 +#undef const_H1_402_L1_772 +#undef const_Hm0_344_Lm0_714 +} + +// widthは16の倍数(16..640)、heightは2の倍数(2..480)である必要があります。 +// srcは最低4バイトアラインメントです。 +// pYCbCrBufも最低4バイトアラインメントですが、各デバイスとの連携に +// 備えて32バイトアラインメントしてください。 +// pYCbCrBufは、Y成分、Cb成分、Cr成分一括で確保してください。サイズは +// Y成分: width*height*sizeof(u16) Bytes +// Cb成分: ((width*height)/4)*sizeof(u16)) Bytes +// Cr成分: ((width*height)/4)*sizeof(u16)) Bytes +// 以上の合計 (width*height*3/2)*sizeof(u16) Bytesです。 +// (つまり元画像データサイズの1.5倍) +// pDtcm_にはu32[16+4+4] (96 Bytes)の作業領域が必要です。 +// 作業領域にDTCM以外のメモリを割り当てた場合には +// パフォーマンスが大きく低下する可能性があります。 +// 入力srcはCAMERAデバイスがYUVでキャプチャした形式 +// (Y 8bit,U 8bit,Y 8bit,V 8bit)です。 +// 出力pYCbCrBufはDSP JPEGエンコーダへの入力形式 +// (Y,Y,Y,Y,..., U,..., V,..., 各16bit)です。 +// 内部でデータキャッシュの制御は行っていないため、結果を +// DSP等へ渡す前にFlushあるいはStoreする必要があります。 +asm void Manager::Convert8bitYuv422To16bitYuv420( register const u32* src, register u16* pYCbCrBuf, register u32 width, register u32 height, void* pDtcm_ ) +{ +#define BLOCK_WIDTH 16 +// registers +// keep stack frame 8-Bytes aligned +#define SAVE_REGS r3-r11,lr // 10 registers = 40 Bytes +#define STACK_OFFSET_PYCBCRBUF 0 // initial value is r3 +#define STACK_OFFSET_PDTCM 40 +#define pCbBuf pYCbCrBuf +#define widthHeight width +#define pDtcm height +#define pDstY pDtcm +#define pDstCr pDtcm + +// keep order for ldm/stm/ldrd/strd +#define FLUSH_REGS r4-r11 +#define FLUSH_REGS_CB r4,r6,r8,r10 +#define FLUSH_REGS_CR r5,r7,r9,r11 +#define yuyv0 r4 +#define yuyv1 r5 +#define yuyv2 r6 +#define yuyv3 r7 +#define t0 r8 +#define t1 r9 +#define const_0x00ff00ff r11 + +#define loopHeightWidth r12 +#define pDtcmStop lr + + // keep 8-Bytes aligned + stmfd sp!, {SAVE_REGS} + // pDstY initial value is pYCbCrBuf + str pYCbCrBuf, [sp, #STACK_OFFSET_PYCBCRBUF] + + mul t0, width, height + // setup widthHeight before breaking pDtcm + orr widthHeight, height, width, lsl #16 + add pCbBuf, pYCbCrBuf, t0, lsl #1 + + ldr pDtcm, [sp, #STACK_OFFSET_PDTCM] + add pDtcmStop, pDtcm, #BLOCK_WIDTH * sizeof(u16) + + mov loopHeightWidth, widthHeight, lsl #16 + +@480: + add loopHeightWidth, loopHeightWidth, widthHeight, lsr #16 + +@640: + ldr const_0x00ff00ff, =0x00ff00ff + +@blockLoop: + add t0, src, widthHeight, lsr #16-1 // +1(odd) line + ldmia t0, {yuyv2, yuyv3} + ldmia src!, {yuyv0, yuyv1} + + // even line Y + and t0, yuyv0, const_0x00ff00ff + and t1, yuyv1, const_0x00ff00ff + strd t0, [pDtcm, #BLOCK_WIDTH * sizeof(u16)] + +#if 0 + // even line U + and yuyv0, const_0x00ff00ff, yuyv0, lsl #8 + and t0, const_0x00ff00ff, yuyv1, lsl #8 + orr yuyv0, t0, yuyv0, lsr #16 + + // odd line V + and yuyv1, const_0x00ff00ff, yuyv2, lsr #24 + and t0, const_0x00ff00ff, yuyv3, lsr #24 + orr yuyv1, yuyv1, t0, lsl #16 +#else + // even column ave. uv (V0 U0) + and yuyv0, const_0x00ff00ff, yuyv0, lsr #8 + and t0, const_0x00ff00ff, yuyv2, lsr #8 + add yuyv0, yuyv0, t0 + and yuyv0, const_0x00ff00ff, yuyv0, lsr #1 + + // odd column ave. uv (V1 U1) + and yuyv1, const_0x00ff00ff, yuyv1, lsr #8 + and t0, const_0x00ff00ff, yuyv3, lsr #8 + add yuyv1, yuyv1, t0 + and yuyv1, const_0x00ff00ff, yuyv1, lsr #1 + + // V0 U0 => U1 U0 + // V1 U1 V1 V0 + eor t0, yuyv0, yuyv1, ror #16 // V0^U1 U0^V1 + eor yuyv1, yuyv1, t0, lsr #16 // V1 V0 + eor yuyv0, t0, yuyv1, ror #16 // U1 U0 +#endif + + strd yuyv0, [pDtcm, #BLOCK_WIDTH * 2 * sizeof(u16)] + + // odd line Y + and yuyv2, yuyv2, const_0x00ff00ff + and yuyv3, yuyv3, const_0x00ff00ff + + stmia pDtcm!, {yuyv2, yuyv3} + cmp pDtcm, pDtcmStop + bne @blockLoop + +// もう少し改良できるかも + ldr pDstY, [sp, #STACK_OFFSET_PYCBCRBUF] + ldmdb pDtcmStop, {FLUSH_REGS} + add pDstY, pDstY, widthHeight, lsr #16-1 // +1(odd) line + stmia pDstY, {FLUSH_REGS} + sub pDstY, pDstY, widthHeight, lsr #16-1 // -1(even) line + + ldmia pDtcmStop!, {FLUSH_REGS} + stmia pDstY!, {FLUSH_REGS} + smultb t0, widthHeight, widthHeight + str pDstY, [sp, #STACK_OFFSET_PYCBCRBUF] + + add pDstCr, pCbBuf, t0, lsr #1 + ldmia pDtcmStop, {FLUSH_REGS} + stmia pDstCr, {FLUSH_REGS_CR} + stmia pCbBuf!, {FLUSH_REGS_CB} + + sub pDtcmStop, pDtcmStop, #8 * sizeof(u32) + sub pDtcm, pDtcmStop, #BLOCK_WIDTH * sizeof(u16) + + sub loopHeightWidth, loopHeightWidth, #BLOCK_WIDTH + movs t0, loopHeightWidth, lsl #16 + bne @640 + + ldr t0, [sp, #STACK_OFFSET_PYCBCRBUF] + subs loopHeightWidth, loopHeightWidth, #2 << 16 // 2 lines/loop + addne t0, t0, widthHeight, lsr #16-1 // 2 lines/loop + strne t0, [sp, #STACK_OFFSET_PYCBCRBUF] + addne src, src, widthHeight, lsr #16-1 // 2 lines/loop + bne @480 + + // keep 8-Bytes aligned + ldmfd sp!, {SAVE_REGS} + bx lr + +#undef BLOCK_WIDTH +#undef SAVE_REGS +#undef STACK_OFFSET_PYCBCRBUF +#undef STACK_OFFSET_PDTCM +#undef pCbBuf +#undef widthHeight +#undef pDtcm +#undef pDstY +#undef pDstCr + +#undef FLUSH_REGS +#undef FLUSH_REGS_CB +#undef FLUSH_REGS_CR +#undef yuyv0 +#undef yuyv1 +#undef yuyv2 +#undef yuyv3 +#undef t0 +#undef t1 +#undef const_0x00ff00ff + +#undef loopHeightWidth +#undef pDtcmStop +} + +#include + + +void Manager::procVBlankIntr() +{ + if (mMode == eMode_BG) { + + } else { + // eMode_Tex + if (mTexSwap) { + GX_DisableBankForTex(); + GX_SetBankForTex( GXVRamTex( mNextTexBank ) ); + mTexBank = mNextTexBank; + mTexSwap = FALSE; + mFirstPictureReady = TRUE; + } else { + // cmnで上書きされる可能性があるので毎フレーム再設定。 + // GX_DisableBankForTex(); + GX_SetBankForTex( GXVRamTex( mTexBank ) ); + } + } +} + + +void Manager::procCameraIntr() +{ + u32 err = 0; + u32 msg = cMsgI2c_Destroy; // このままの値が送信されたらプログラムミス。 + +#if SDK_VERSION_DATE < 20080630 + if (mIntrPositiveEdge) { + CAMERA_StopCapture(); + mIntrPositiveEdge = FALSE; + CAMERA_SetVsyncInterrupt(CAMERA_INTR_VSYNC_NEGATIVE_EDGE); + } +#else + // intr edgeはCAMERAライブラリがハンドリングする。 +#endif + + if (CAMERA_GetErrorStatus()) { + // error + CAMERA_StopCapture(); + CAMERA_ClearBuffer(); + MI_StopNDma(cDefaultDmaNo); + err = 1; + IPL_PRINT("cameraIntr: status error\n"); + } else { + if (MI_IsNDmaBusy(cDefaultDmaNo)) { + // error + // とは言い切れない?最後のNDMA転送中かもしれない? + MI_StopNDma(cDefaultDmaNo); + err = 2; + IPL_PRINT("cameraIntr: NDMA busy\n"); + } + } + + if (err) { + // キャプチャが失敗したので、リトライする。 + if (mpCaptureBuf) { + freeCapBufByPtr((u16*)mpCaptureBuf); + mpCaptureBuf = NULL; + } + mCaptureRetryCount++; + if (mCaptureRetryCount < cCaptureRetryMax) { + // retry + } else { + // fatal error + IPL_HALT("capture error too much!\n"); + // TWL_IPL_FINALではスルーするー + } + } else { + mCaptureRetryCount = 0; + procPostCapture(); + } + + // I2C処理中は何もしない。 + if (mI2cBusy) { + return; + } + + // キャプチャ<=>撮影で解像度を変更した直後にも必要? + if (mCaptureSkipCount) { + mCaptureSkipCount--; + return; + } + + if (mSelCmr != mNextCmr) { + // カメラを切り替えるためI2C処理要求を出す。 + // 外カメラのLED制御よりも先に行う。 + msg = cMsgI2c_Activate; + // カメラ切り替え直後一定フレーム数の間は画像が安定しないのでキャプチャ停止。 + // mSelCmrがNONEの場合にはここへ来ない。(カメラ割り込みが発生しないため) + mCaptureSkipCount = 1; + goto sendI2cRequest; + } + + // キャプチャ時と撮影時で解像度やフォーマットが異なる場合、 + // ここでI2C処理要求を出す。 + // まだ。 + + // 外カメラのLED制御。 + if (!mLedKeepFlag && (mSelCmr == CAMERA_SELECT_OUT)) { + if (mNextShotFlag) { + if (!mCurLedBlink) { + // 撮影なので点灯→点滅にする。 + // シャッタースピードを速くするため割り込み論理切り替え。 + // →NDMA busyエラーになってしまうので、割り込み論理は切り替えない。 + // 残念ながらLEDが映り込むことがある?(マイコンが古いせい?) + + // VBlank Time Intr Line Lines Ticks + // 272 4.5640 CAMERA 13 0 26 // negative edge + // 273 4.5754 V 192 0 17 + // 274 4.5921 V 192 0 6 + // 275 4.6089 V 192 1 33 + // 275 4.6140 CAMERA 10 1 20 // negative edge (+50.0ms from negative edge) + // 275 4.6144 PXI_NE 16 1 19 // SetLED関係 ( +0.4ms from negative edge) + // 275 4.6178 CAMERA 70 1 20 // positive edge ( +3.8ms from negative edge) + // 276 4.6256 V 192 0 11 + // 277 4.6423 V 192 0 20 + // 277 4.6474 TM0 9 0 9 + // 278 4.6590 V 192 0 5 + // 278 4.6640 CAMERA 8 9 282 // negative edge (+50.0ms from negative edge) + // *Warning: taking over 100 ticks (over 3 lines) + msg = cMsgI2c_ChangeLedToBlink; + goto sendI2cRequest; +// goto toPositiveEdgeAndSendI2cRequest; + } + } else if (!mShotFlag /* mCaptureFlag */ ) { + // 撮影ではないので点滅→点灯にする。 + // ここを「キャプチャなので(mCaptureFlag)」にすると、 + // エンコード、セーブ中にはmCaptureFlagが立たないので、 + // 点滅時間が長くなる。 + if (mCurLedBlink) { + // 画面更新スピードを速くするため割り込み論理切り替え。 + // VBlank Time Intr Line Lines Ticks + // 281 4.7140 CAMERA 6 0 10 // negative edge + // 282 4.7259 V 192 0 7 + // 283 4.7426 V 192 0 15 + // 284 4.7593 V 192 0 5 + // 284 4.7641 CAMERA 4 0 18 // negative edge (+50.1ms from negative edge) + // 284 4.7645 PXI_NE 11 0 19 // SetLED関係 ( +0.4ms from negative edge) + // 284 4.7678 CAMERA 63 1 7 // positive edge ( +3.7ms from negative edge) + // 284 4.7725 TM0 137 0 8 + // 285 4.7760 V 192 0 12 + // 286 4.7927 V 192 0 15 + // 287 4.8094 V 192 0 10 + // 287 4.8140 CAMERA 1 1 14 // negative edge (+49.9ms from negative edge) + msg = cMsgI2c_ChangeLedToOn; + goto sendI2cRequest; +// goto toPositiveEdgeAndSendI2cRequest; + } + } + } + + if (!err) { + mCaptureFlag = mNextCaptureFlag; + mShotFlag = mNextShotFlag; + // とりあえず単発保存のみ。 + mNextShotFlag = FALSE; + } + + // リトライ回数上限に達した場合の強制stopは必要? + // まだ。 + + if (mSelCmr != CAMERA_SELECT_NONE && + (mCaptureFlag || mShotFlag)) { + IPL_ASSERT( !mpCaptureBuf ); + mpCaptureBuf = procPreCapture(); + if (mpCaptureBuf) { + // ここだけリアルタイムにmShot{Wdt,Hgt}<=>mShow{Wdt,Hgt}の変換してもおかしくなるよね? + // transferlinesも再設定しないと。 + // CAMERA_GetBytesAtOnce()は、reg_CAM_CNTを直接読んでいる。 + // CAM_CNTは、カメライネーブル時の書き込みは無視されるから、 + // 期待した値が確実に得られる保証はないと思われる。 + // 一応ここはCAMERA Vブランク割り込みハンドラだから、期待した値が + // 入っていなければ動作そのものもおかしくなるが、その場合でも + // DMAで範囲外のメモリを破壊しないよう、計算で求めた数値 + // CAMERA_GET_LINE_BYTES(mShotWdt) * mTransferLines を指定。 +#if 0 +// : +// static inline void CAMERA_DmaRecvAsync(u32 dmaNo, void *dest, u32 unit, u32 length, MINDmaCallback callback, void* arg) +// { +// MI_Camera_NDmaRecvAsync( dmaNo, dest, unit/4, length, FALSE, callback, arg ); +// } + + // SDK default NDMA parameter + CAMERA_DmaRecvAsync(cDefaultDmaNo, (u16*)mpCaptureBuf, + CAMERA_GET_LINE_BYTES(mShotWdt) * mShotTransferLines, + CAMERA_GET_FRAME_BYTES(mShotWdt, mShotHgt), + NULL, NULL); +#else +// : +// void MI_Camera_NDmaRecvAsync(u32 ndmaNo, void *dest, u32 unit, u32 size, BOOL contSw, MINDmaCallback callback, void* arg ); +// void MI_Camera_NDmaRecvAsyncEx(u32 ndmaNo, void *dest, u32 size, BOOL contSw, MINDmaCallback callback, void* arg, const MINDmaConfig *config ); + + mDmaConfig.wordCount = (CAMERA_GET_LINE_BYTES(mShotWdt) * mShotTransferLines) / sizeof(u32); + MI_Camera_NDmaRecvAsyncEx(cDefaultDmaNo, (u16*)mpCaptureBuf, + CAMERA_GET_FRAME_BYTES(mShotWdt, mShotHgt), + FALSE, + NULL, NULL, + &mDmaConfig); +#endif + + CAMERA_StartCapture(); + } else { + IPL_PRINT("no memory for mpCaptureBuf\n"); + CAMERA_StopCapture(); + + // エラーリトライカウントを増やす? + // 単にprepareBuffer()できていないだけかもしれない。 + } + } else { + CAMERA_StopCapture(); + if (mOneShotFlag) { + // カメラを停止させる。 + // I2C処理要求を出す。 + // mNextCmrは上書きされる。 + mNextCmr = CAMERA_SELECT_NONE; + msg = cMsgI2c_Activate; + goto sendI2cRequest; + } + } + + return; + +#if SDK_VERSION_DATE < 20080630 +toPositiveEdgeAndSendI2cRequest: + CAMERA_StopCapture(); + mIntrPositiveEdge = TRUE; + CAMERA_SetVsyncInterrupt(CAMERA_INTR_VSYNC_POSITIVE_EDGE); +#else + // intr edgeはCAMERAライブラリがハンドリングする。 +#endif +// thru +sendI2cRequest: + CAMERA_StopCapture(); + if (!OS_SendMessage(&mI2cMsgQueue, (OSMessage)msg, OS_MESSAGE_NOBLOCK)) { + // リトライが必要。 + } else { + // 念のため、すぐにI2C処理中フラグも立てておく。 + mI2cBusy = TRUE; + + // エラーリトライカウンタを増やす必要がありそう。 + } +} + + +u16* Manager::procPreCapture() +{ + return allocCapBuf(); +} + + +void Manager::procPostCapture() +{ + if (mpCaptureBuf) { + if (mpConvBuf) { + // 前回のYUV2RGB変換が完了していない。 +#ifndef TWL_IPL_FINAL + static u32 count; + IPL_PRINT("mConvBusy! %d, nextp %s\n", count++, mpNextConvBuf ? "exist" : "empty"); +#endif + // 撮影データで、かつ次回変換予約のバッファが存在しなければ + // 次回変換予約とする。 + if (mShotFlag && !mpNextConvBuf) { + mpNextConvBuf = mpCaptureBuf; + // LowerスレッドがOS_WaitEvent()でブロックしないよう、次回変換&撮影要求もセットしておく。 + OS_SignalEvent(&mLowerEvent, cEventMaskLower_NextConvertAndShot); + } else { + // 今回のキャプチャ済みデータは破棄。 + freeCapBufByPtr((u16*)mpCaptureBuf); + } + } else { + // YUV2RGB変換要求セット。 + mpConvBuf = mpCaptureBuf; + OS_SignalEvent(&mLowerEvent, + (u32)(cEventMaskLower_Convert | (mShotFlag ? cEventMaskLower_Shot : 0))); + } + mpCaptureBuf = NULL; + } +} + + +void Manager::procPostConvert(BOOL shot) +{ + if (shot) { + // キャプチャ済みデータは撮影用に使う。 + mpShotBuf = mpConvBuf; + } else { + // キャプチャ済みデータは不要なので捨てる。 + freeCapBufByPtr((u16*)mpConvBuf); + } + mpConvBuf = NULL; +} + + +// (mpShotBuf != NULL) のときのみ呼ばれる。 +void Manager::procPostShot() +{ +// #ifndef TWL_IPL_FINAL +// mDebugPort = __LINE__; +// #endif + // "check only urgent errors here" ってマジ?割り込み禁止で呼ばれてるから。 + + freeCapBufByPtr((u16*)mpShotBuf); +} + + +// 割り込みルーチンからのみ呼ばれるので割り込み禁止にしていない。 +// キャプチャ時、撮影時でサイズが変わる場合であっても、大きい方の +// サイズを想定してバッファを確保する。 +u16* Manager::allocCapBuf() +{ + for (u32 i = 0; i < cBufferCount; i++) { + if (!mIsCapBufUsed[i] && mpCapBuf[i]) { + mIsCapBufUsed[i] = TRUE; +// OS_TPrintf("allocCapBuf[%d]=%x\n", i, mpCapBuf[i]); + return mpCapBuf[i]; + } + } + IPL_PRINT("allocCapBuf: no memory! %d %d\n", mCaptureFlag, mShotFlag); + + return NULL; +} + + +void Manager::freeCapBufByPtr(const u16* pBuf) +{ + if (pBuf) { + for (u32 i = 0; i < cBufferCount; i++) { + if (mpCapBuf[i] == const_cast(pBuf)) { + mIsCapBufUsed[i] = FALSE; + return; + } + } + } +} + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +BOOL Manager::writeJpegToNand(const u8* src, u32 size) +{ + BOOL ret = FALSE; + +// const u8* path; +// +// path = MenuSys()->getUpPicMgr()->getSavePath(); +// if (path) { +// cmn::sys::File file( (const char*)path ); +// ret = file.write(src, size); +// IPL_PRINT("writeJpegToNand(%s)=%d\n", path, ret); +// if (ret) { +// MenuSys()->getUpPicMgr()->calcNextSavePath(); +// } +// } + + ret = MenuSys()->getUpPicMgr()->writeTclPictureFile(src, size); + + return ret; +} +#endif + + +// ファイル名は中の人にしか分からない。 +BOOL Manager::writeJpegToSD(const u8* src, u32 size) +{ + FSFile file; + FSFile* pFile = &file; + u32 i; + + // DC_StoreAll(), DC_FlushAll() is NG? + DC_StoreAll(); + +/* + SDカード/menu/MENU####.jpg というファイル名を生成する +*/ +#define JPEG_DIRNAME "sdmc:/menu" +#define JPEG_FILENAME "menu%04d.jpg" + + if ( !pFile ) + { + return FALSE; + } + + /* + ディレクトリの存在を確実とする + 本当は、まずSDカードが存在するかを確認し、その後ディレクトリがすでに + 存在するかを見て無ければ作るという処理で良いのだが、現状では、いちいち + オープンしなければならない! + */ + { + FSFile dir; + if ( !FS_OpenDirectory( &dir, JPEG_DIRNAME, FS_FILEMODE_R | FS_FILEMODE_W ) ) + { + if ( !FS_CreateDirectory( JPEG_DIRNAME, FS_PERMIT_R | FS_PERMIT_W ) ) + { + IPL_PRINT("Cannot create directory %s.\n", JPEG_DIRNAME); + return FALSE; + } + } + else + { + FS_CloseDirectory( &dir ); + } + } + + FS_InitFile( pFile ); + + for (i = +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + 0 +#else + 1000 +#endif + ; i < 10000; i++) + { + char buffer[32]; + STD_TSPrintf(buffer, JPEG_DIRNAME "/" JPEG_FILENAME, i); + if ( FS_CreateFile( buffer, FS_PERMIT_W ) ) // すでにある場合失敗する + { + if ( FS_OpenFileEx( pFile, buffer, FS_FILEMODE_W ) ) // 作成したてのファイルをオープンする + { + // OK + break; +// if (filename) // 引数にメモリが指定されていればそこにファイル名を格納する +// { +// STD_CopyLString( filename, buffer, 256 ); +// } +// return TRUE; + } else { + IPL_PRINT("Create %s, but cannot open it.\n", buffer); // 致命的なエラー + return FALSE; + } + } + } + if (i == 10000) { + IPL_PRINT("Too many files in %s.\n", JPEG_DIRNAME); + return FALSE; + } + + if ( FS_WriteFile( pFile, src, static_cast(size) ) != size ) + { + FS_CloseFile( pFile ); + return FALSE; + } + FS_CloseFile( pFile ); + return TRUE; +} + + +// /*! +// シャッターサウンドファイルをセットする 廃棄予定 +// @param p_wav WAVのヘッダのない生音ファイル +// @param size サイズ +// */ +// void Manager::setShutterSnd( const u8* p_wav , u32 size , BOOL stereo ) +// { +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +// OSIntrMode enabled = OS_DisableInterrupts(); +// +// mpShutterSnd = p_wav; +// mShutterSndSize = size; +// mShutterStereo = stereo; +// +// OS_RestoreInterrupts(enabled); +// #endif +// } + + +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +// /*! +// シャッターサウンドを開始する +// */ +// void Manager::startShutterSnd() +// { +// if ( mpShutterSnd ) +// { +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +// SNDEX_SetDSPMixRate( 0 ); +// SNDEX_ForceOut( TRUE ); +// DSP_PlaySound( (void*)mpShutterSnd, (u32)(mShutterSndSize / 2), mShutterStereo ); +// #else +// MenuSys()->getDspMgr()->playSound(mpShutterSnd, (u32)(mShutterSndSize / sizeof(u16)), mShutterStereo); +// #endif +// } +// } +// +// /*! +// シャッターサウンドを終了する +// */ +// void Manager::finishShutterSnd() +// { +// if ( mpShutterSnd ) +// { +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +// SNDEX_SetDSPMixRate( 8 ); +// SNDEX_ForceOut( FALSE ); +// #else +// MenuSys()->getDspMgr()->stopSound(); +// #endif +// } +// } +// +// /*! +// シャッターサウンドが終了してるか +// @retval TRUE 終了してる +// @retval FALSE してない +// */ +// BOOL Manager::isFinishedShutterSnd() const +// { +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +// return TRUE; +// #else +// return !(MenuSys()->getDspMgr()->isSoundPlaying()); +// #endif +// } +// #endif + +void Manager::setCaptureRgbFlag(BOOL useRgb) +{ + mCaptureRgbFlag = (u8)useRgb; + mEncodeOption = (u32)(SSP_JPEG_THUMBNAIL | (useRgb ? SSP_JPEG_RGB555 : SSP_JPEG_YUV422)); +} + +void Manager::encodeAndSave() +{ + u32 err = 0; + OSTick tick; + + if (!mpShotBuf) { + IPL_HALT("!mpShotBuf\n"); + // TWL_IPL_FINALではスルーするー + return; + } + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else + // モジュールロード時に、シャッター音が止まる? + // シャッター音を再生する前にJPEGエンコーダモジュールを + // ロードしておく必要があるようだ。 + // シャッター音が鳴り終わるまでDSPを占有する。 + MenuSys()->getDspMgr()->lock(); + MenuSys()->getDspMgr()->loadJpegEncoder(); +#endif + +// // DSPを使う場合のみ、シャッター音の再生指示を出す。 +// startShutterSnd(); + + DSPFrame_y = mpEncodeWork->y; + DSPFrame_cb = mpEncodeWork->cbcr; + DSPFrame_cr = DSPFrame_cb + (mShotWdt * mShotHgt / 4); +#endif + + tick = OS_GetTick(); + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + Convert8bitYuv422To16bitYuv420((const u32*)mpShotBuf, + DSPFrame_y, + mShotWdt, + mShotHgt, + mpDtcmWork->mYuvBuf); + // store YUV420 and invalidate encode result + DC_FlushAll(); +#endif + + IPL_PRINT("procShot: yuv422to420 time %d usec\n", (u32)OS_TicksToMicroSeconds(OS_GetTick() - tick)); + tick = OS_GetTick(); + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else + // SDカードアクセス中のチラつき対策 + // Vブランク割り込みが遅延するので、アフィンパラメタをレジスタへ書き込まない。 + // writeJpegToSD()を呼ぶ直前の設定では間に合わないようだ。 +// MenuSys()->getUpPicMgr()->setSkipAffineFlag(TRUE); +#endif + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + // 出力サイズはいかほど必要? + DSP_SetJpegEncoderBuffer(mpEncodeResult, cEncodeResultSizeMax); + // explicit initialization + DSP_SetJpegEncoderThumbnailBuffer(NULL, NULL, NULL); + u32 size = DSP_StartJpegEncoder( static_cast< s16 > ( mShotWdt ) , + static_cast< s16 > ( mShotHgt ) , + DSP_JPEG_THUMBNAIL , + 4 ); +#else + // 出力サイズはいかほど必要? + // unlockはupPicMgrの if (event & cEventMask_WipeReplace) で行われる。 + MenuSys()->getUpPicMgr()->lockTcl(); + MenuSys()->getUpPicMgr()->lockJpegBuf(); + u32 size = MenuSys()->getDspMgr()->encodeJpegFrom16bitYuv420(DSPFrame_y, + mShotWdt, + mShotHgt, + MenuSys()->getUpPicMgr()->getJpegBufPtr(), + MenuSys()->getUpPicMgr()->getJpegBufSize(), + NULL, + 0, + DSP_JPEG_THUMBNAIL); +#endif +#else +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else + // unlockはupPicMgrの if (event & cEventMask_WipeReplace) で行われる。 + MenuSys()->getUpPicMgr()->lockTcl(); + MenuSys()->getUpPicMgr()->lockJpegBuf(); + + SSP_SetJpegEncoderMakerNote(MenuSys()->getUpPicMgr()->getMakerNote(), + MenuSys()->getUpPicMgr()->getMakerNoteSize()); +#endif + + if (!SSP_SetJpegEncoderDateTimeNow()) { + // 時刻の埋め込みに失敗したのでゼロで埋める。 + // 文字列は「YYYY:MM:DD HH:MM:DD」+0x00 の 20 文字としてください。 + static const u8 zeroes[20] = {}; + IPL_PRINT("SSP_SetJpegEncoderDateTimeNow() failed!\n"); + SSP_SetJpegEncoderDateTime((u8*)zeroes); + } + SSP_SetJpegEncoderSignMode(TRUE); + u32 size = SSP_StartJpegEncoder((const void*)mpShotBuf, +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + mpEncodeResult, + cEncodeResultSizeMax, +#else + MenuSys()->getUpPicMgr()->getJpegBufPtr(), + MenuSys()->getUpPicMgr()->getJpegBufSize(), +#endif + mpEncodeWork, + mShotWdt, mShotHgt, + cEncodeQuality, cEncodeSampling, mEncodeOption); +#endif + + IPL_PRINT("procShot: encode size %d, time %d usec\n", size, (u32)OS_TicksToMicroSeconds(OS_GetTick() - tick)); + + tick = OS_GetTick(); + + // save to SD or NAND + if (size) { +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else + if (!writeJpegToNand(MenuSys()->getUpPicMgr()->getJpegBufPtr(), + size)) { + err = 3; + } +#endif + + + if (!writeJpegToSD( +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT + mpEncodeResult, +#else + MenuSys()->getUpPicMgr()->getJpegBufPtr(), +#endif + size)) { + // SDカードへの保存はテストなので、エラーにはしない。 + // do nothing + } + } else { + err = 4; + } + + IPL_PRINT("procShot: save err %d, time %d usec\n", err, (u32)OS_TicksToMicroSeconds(OS_GetTick() - tick)); + +// #ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP +// while (!isFinishedShutterSnd()) { +// IPL_PRINT("procShot: waiting ShutterSnd finish\n"); +// OS_Sleep(1); +// } +// finishShutterSnd(); +// #endif + +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_FOR_LOCAL_PROJECT +#else +#ifdef TWL_IPL_MENU_CAMERA_MANAGER_USE_DSP + // シャッター音が鳴り終わったらDSPの占有を解除できる。 + MenuSys()->getDspMgr()->unlock(); +#endif + + MenuSys()->getUpPicMgr()->setJpegDataSize(size); + + if (MenuSys()->getUpPicMgr()->isEffectTypeNormal()) { + // ここでJPEGデコードを行う。 + // つまり、カメラシーン終了のためのフェードアウト開始が遅れる。 + MenuSys()->getUpPicMgr()->decodeJpeg(); + } else { + // 先に古い写真のワイプアウトを開始する。 + // カメラシーン終了のためのフェードアウト開始が早くなるが + // ランチャーメイン画面へ戻ってもしばらく上画面が何もない。 + // その状態でランチャーメイン画面の操作はできるが、重い。 + MenuSys()->getUpPicMgr()->wipeOut(); + } + +// MenuSys()->getUpPicMgr()->setSkipAffineFlag(FALSE); +#endif + + if (!mShotErr) { + mShotErr = err; + } + + { + OSIntrMode enabled = OS_DisableInterrupts(); + + procPostShot(); + mpShotBuf = NULL; + mShotDone = TRUE; + + OS_RestoreInterrupts(enabled); + } + + // invalidate capture buffer for next capture + DC_FlushAll(); + + IPL_PRINT("encodeAndSave done err=%d\n", mShotErr); +} + + + +}}} diff --git a/build/tests/yuv2rgb/src/menuIrqHandler.c b/build/tests/yuv2rgb/src/menuIrqHandler.c new file mode 100644 index 00000000..13c8e04e --- /dev/null +++ b/build/tests/yuv2rgb/src/menuIrqHandler.c @@ -0,0 +1,169 @@ +// This IRQ Handler is for ARM9 only. +#include "menuIrqHandler.h" +// not supplied +#include + +typedef struct MenuIrqHandlerLogControl { + // keep order! {End, Cur, VBlankCount, Top} for ldmia/stmia + MenuIrqHandlerLogBuffer* mpBufferEnd; + MenuIrqHandlerLogBuffer* mpBufferCur; + u32 mVBlankCount; + MenuIrqHandlerLogBuffer* mpBufferTop; +} MenuIrqHandlerLogControl; + +extern void MenuIrqHandler( void ); + +#include +#ifndef TWL_IPL_FINAL +static MenuIrqHandlerLogControl MenuIrqHandlerLogCtrl; +#endif +#include + +#include +#include +#include + +#ifndef TWL_IPL_FINAL +// derived from OS_IrqHandler +/*---------------------------------------------------------------------------* + Name: MenuIrqHandler + + Description: IRQ handler. call handler according to OS_InterruptTable + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +asm void MenuIrqHandler( void ) +{ + stmfd sp!, { lr } // save LR + + // get IE address + mov r12, #HW_REG_BASE + add r12, r12, #(REG_IE_OFFSET - 4) // r12: REG_IE address - 4 + + // get IME + ldrh r0, [ r12, #REG_IME_ADDR - (REG_IE_ADDR - 4) ] // r0: IME + + // get IE&IF + ldmib r12!, { r1-r2 } // r1: IE, r2: IF + + tst r0, #0x01 + andnes r1, r1, r2 // r1: IE & IF + + // if (IME==0) || (IE&IF==0) then return (without changing IF) + ldmeqfd sp!, { pc } + + //-------------------------------------------------- + // IRQ HANDLING CODE for ARCHITECTURE VERSION 5 + //-------------------------------------------------- + + ldr lr, =MenuIrqHandlerLogCtrl + + // get lowest 1 bit + rsb r3, r1, #0 + and r3, r1, r3 + + // clear IF + str r3, [ r12 ], #-REG_IF_OFFSET + + ldmia lr!, {r0, r1, r2} // mpBufferEnd, mpBufferCur, mVBlankCount + cmp r1, r0 + bcs @logSkip // log full or no buffer + +@logWrap: + ldrh r0, [r12, #REG_VCOUNT_ADDR - HW_REG_BASE] + add r1, r1, #sizeof(MenuIrqHandlerLogBuffer) + tst r3, #OS_IE_V_BLANK + addne r2, r2, #1 + bic r2, r2, #1 << 18 // lower 18bits only + stmdb lr, {r1, r2} // update mpBufferCur, mVBlankCount + + orr r2, r2, r0, lsl #23 // mInVLineCount | mInVBlankCount + // get jump vector + ldr r0, =OS_IRQTable + ((OS_IRQ_TABLE_MAX - 1) << 2) + clz r3, r3 + ldr r0, [r0, -r3, lsl #2] + orr r2, r2, r3, lsl #18 // mIntr + ldr r3, [r12, #REG_TM0CNT_L_ADDR - HW_REG_BASE] + stmfd sp!, {r1, r2, r3} // mpBufferCur, word0, tick + + blx r0 + + mov r12, #HW_REG_BASE + ldr lr, [r12, #REG_TM0CNT_L_ADDR - HW_REG_BASE] + ldrh r0, [r12, #REG_VCOUNT_ADDR - HW_REG_BASE] + ldmfd sp!, {r1, r2, r3} + subs r12, r0, r2, lsr #23 // mVLineCounts + addmi r12, r12, #HW_LCD_HEIGHT + addmi r12, r12, #HW_LCD_VBLANK + sub r3, lr, r3 // mTicks + orr r3, r12, r3, lsl #16 + stmdb r1, {r2, r3} // word0, word1 + b OS_IrqHandler_ThreadSwitch + +@logSkip: + cmp r1, #0 + ldrne r1, [lr] // mpBufferTop + bne @logWrap + + // get jump vector + ldr r0, =OS_IRQTable + ((OS_IRQ_TABLE_MAX - 1) << 2) + clz r3, r3 + ldr r0, [r0, -r3, lsl #2] + ldr lr, =OS_IrqHandler_ThreadSwitch + bx r0 // set return address for thread rescheduling +} +#endif + +#include +#include + + +void MenuIrqHandlerStart( MenuIrqHandlerLogBuffer* pBuffer, u32 size ) +{ +#ifndef TWL_IPL_FINAL + u32 count = size / sizeof(MenuIrqHandlerLogBuffer); + MenuIrqHandlerLogControl* pCtrl = &MenuIrqHandlerLogCtrl; + BOOL enabled = OS_DisableIrq(); + + *(u32 *)(HW_DTCM + HW_DTCM_SIZE - HW_DTCM_SYSRV_SIZE + HW_DTCM_SYSRV_OFS_INTR_VECTOR) + = (u32)MenuIrqHandler; + + if ( pBuffer && count ) { + pCtrl->mpBufferTop = + pCtrl->mpBufferCur = pBuffer; + pCtrl->mpBufferEnd = pBuffer + count; + } else { + pCtrl->mpBufferTop = + pCtrl->mpBufferCur = + pCtrl->mpBufferEnd = NULL; + } + pCtrl->mVBlankCount = 0; + + OS_RestoreIrq(enabled); +#else +#pragma unused(pBuffer) +#pragma unused(size) +#endif +} + +void MenuIrqHandlerEnd( void ) +{ +#ifndef TWL_IPL_FINAL + *(u32 *)(HW_DTCM + HW_DTCM_SIZE - HW_DTCM_SYSRV_SIZE + HW_DTCM_SYSRV_OFS_INTR_VECTOR) + = (u32)OS_IrqHandler; + // keep buffer +#endif +} + +BOOL MenuIrqHandlerIsUsed( void ) +{ +#ifndef TWL_IPL_FINAL + return (*(u32 *)(HW_DTCM + HW_DTCM_SIZE - HW_DTCM_SYSRV_SIZE + HW_DTCM_SYSRV_OFS_INTR_VECTOR) + == (u32)MenuIrqHandler); +#else + return FALSE; +#endif +} + diff --git a/build/tests/yuv2rgb/src/menuIrqHandler.h b/build/tests/yuv2rgb/src/menuIrqHandler.h new file mode 100644 index 00000000..1e9d4e0c --- /dev/null +++ b/build/tests/yuv2rgb/src/menuIrqHandler.h @@ -0,0 +1,36 @@ +#ifndef MENU_IRQ_HANDLER_H_ +#define MENU_IRQ_HANDLER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct MenuIrqHandlerLogBuffer { + union { + u32 word0; + struct { + u32 mInVLineCount : 9; // d31-d23 + u32 mIntr : 5; // d22-d18 + u32 mInVBlankCount : 18; // d17-d0 + }; + }; + union { + u32 word1; + struct { + u32 mTicks : 16; // d31-d16 + u32 mVLineCounts : 16; // d15-d0 + }; + }; +} MenuIrqHandlerLogBuffer; + +extern void MenuIrqHandlerStart( MenuIrqHandlerLogBuffer* pBuffer, u32 size ); +extern void MenuIrqHandlerEnd( void ); +extern BOOL MenuIrqHandlerIsUsed( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/build/tests/yuv2rgb/src/new.cpp b/build/tests/yuv2rgb/src/new.cpp new file mode 100644 index 00000000..6ebd0e1a --- /dev/null +++ b/build/tests/yuv2rgb/src/new.cpp @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------* + Project: NitroSDK - OS - demos - cplusplus-1 + File: new.cpp + + Copyright 2003,2004 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. + + $Log: new.cpp,v $ + Revision 1.4 2004/04/06 11:35:38 yada + fix header comment + + Revision 1.3 2004/02/20 03:32:18 yasu + add comments + + Revision 1.2 2004/02/20 00:04:05 yasu + add comments + + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#ifdef TWL_IPL_USE_RED_IPL +#include +#endif + +#define HEAP_ID ((OSHeapHandle)0) +#define ARENA_ID ((OSArenaId)OS_ARENA_MAIN) +#define ROUND(n, a) (((u32) (n) + (a) - 1) & ~((a) - 1)) + +//---------------------------------------------------------------- +// +void* operator new ( std::size_t blocksize ) +{ + void* p = OS_AllocFromHeap( ARENA_ID, HEAP_ID, blocksize ); + if (p) { +// MI_CpuClearFast(p, blocksize); + } + return p; +} + +//---------------------------------------------------------------- +// +void* operator new[] ( std::size_t blocksize ) +{ + void* p = OS_AllocFromHeap( ARENA_ID, HEAP_ID, blocksize ); + if (p) { +// MI_CpuClearFast(p, blocksize); + } + return p; +} + +//---------------------------------------------------------------- +// +void operator delete ( void* block ) throw() +{ + OS_FreeToHeap( ARENA_ID, HEAP_ID, block ); +} + +//---------------------------------------------------------------- +// +void operator delete[] ( void* block ) throw() +{ + OS_FreeToHeap( ARENA_ID, HEAP_ID, block ); +} + +/*---------------------------------------------------------------------------* + Name: NitroStartUp + + Description: startup before NitroMain() + - Initialize memory control system for new() + + FYI: + - Startup fuctions called in following order + 1) NitroStartUp(); + 2) Global/Static Constructors + 3) NitroMain(); + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void TwlStartUp(void) +{ + void* arenaLo; + void* arenaHi; + +#ifdef TWL_IPL_USE_RED_IPL + SYSM_Init(NULL, NULL); +#endif + OS_Init(); + OS_InitThread(); + GX_Init(); + OS_InitTick(); + OS_InitAlarm(); + TP_Init(); + FX_Init(); + GX_Init(); + RTC_Init(); + SNDEX_Init(); + OS_EnableIrq(); + OS_EnableInterrupts(); + FS_Init( FS_DMA_NOT_USE ); + MI_InitNDmaConfig(); + +#ifdef TWL_IPL_USE_RED_IPL + SYSM_SetArena(); // OS_Initの後でコールする必要あり。 + SYSM_InitPXI(); // 割り込み許可後にコールする必要あり。 +#endif + + arenaLo = OS_GetArenaLo( ARENA_ID ); + arenaHi = OS_GetArenaHi( ARENA_ID ); + + // Create a heap + arenaLo = OS_InitAlloc( ARENA_ID, arenaLo, arenaHi, 1 ); + OS_SetArenaLo( ARENA_ID, arenaLo ); + + // Ensure boundaries are 32B aligned + arenaLo = (void*)ROUND( arenaLo, 32 ); + arenaHi = (void*)ROUND( arenaHi, 32 ); + + // The boundaries given to OSCreateHeap should be 32B aligned + (void)OS_SetCurrentHeap( ARENA_ID, OS_CreateHeap( ARENA_ID, arenaLo, arenaHi ) ); + + // From here on out, OS_Alloc and OS_Free behave like malloc and free respectively + OS_SetArenaLo( ARENA_ID, arenaLo = arenaHi ); +} diff --git a/build/tests/yuv2rgb/src/snd_data.c b/build/tests/yuv2rgb/src/snd_data.c new file mode 100644 index 00000000..65b46440 --- /dev/null +++ b/build/tests/yuv2rgb/src/snd_data.c @@ -0,0 +1,10771 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - demos.TWL - snd - extraFunc + File: snd_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 + + +const u8 sound_seq_data[] ATTRIBUTE_ALIGN(HW_CACHE_LINE_SIZE) = +{ + 0xfe, 0xff, 0x0e, 0x93, 0x01, 0x02, 0x05, 0x00, 0x93, 0x02, 0xba, 0x05, 0x00, 0x93, 0x03, 0x72, + 0x06, 0x00, 0x93, 0x04, 0x04, 0x09, 0x00, 0x93, 0x05, 0x79, 0x0b, 0x00, 0x93, 0x06, 0xb9, 0x0b, + 0x00, 0x93, 0x07, 0x0e, 0x0d, 0x00, 0x93, 0x09, 0x44, 0x0d, 0x00, 0x93, 0x0a, 0xe9, 0x10, 0x00, + 0x93, 0x0b, 0xac, 0x18, 0x00, 0xc7, 0x00, 0xe1, 0x8c, 0x00, 0x81, 0x00, 0xc1, 0x7f, 0xc0, 0x40, + 0xc5, 0x02, 0xc4, 0x00, 0xcb, 0x10, 0xca, 0x00, 0x24, 0x7f, 0x82, 0x7f, 0x80, 0x83, 0x00, 0x30, + 0x5a, 0x82, 0x1f, 0x80, 0x82, 0x20, 0x24, 0x76, 0x04, 0x80, 0x0c, 0x24, 0x52, 0x02, 0x80, 0x0c, + 0x48, 0x6f, 0x0d, 0x80, 0x18, 0x24, 0x6e, 0x01, 0x80, 0x0c, 0x48, 0x71, 0x0b, 0x80, 0x0c, 0x24, + 0x4c, 0x01, 0x80, 0x0c, 0x24, 0x6f, 0x01, 0x80, 0x0b, 0x24, 0x7d, 0x85, 0x49, 0x80, 0x83, 0x01, + 0xca, 0x1e, 0x80, 0x82, 0x50, 0xca, 0x00, 0x24, 0x7f, 0x01, 0x80, 0x30, 0x24, 0x7f, 0x2f, 0x80, + 0x30, 0x2b, 0x6f, 0x1a, 0x80, 0x27, 0x2b, 0x3c, 0x06, 0x80, 0x09, 0x30, 0x62, 0x0a, 0x80, 0x18, + 0xc4, 0x80, 0x32, 0x67, 0x2f, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, 0x2b, 0x62, 0x08, 0x80, 0x0c, + 0x24, 0x52, 0x01, 0x80, 0x0c, 0x24, 0x7f, 0x2f, 0x80, 0x30, 0x2b, 0x67, 0x19, 0x80, 0x24, 0x2b, + 0x65, 0x0b, 0x80, 0x0c, 0x30, 0x53, 0x05, 0x80, 0x18, 0x30, 0x72, 0x17, 0x80, 0x18, 0x2b, 0x78, + 0x03, 0x80, 0x0c, 0x43, 0x74, 0x02, 0x80, 0x0c, 0x2b, 0x74, 0x0b, 0x80, 0x0c, 0x2b, 0x5e, 0x01, + 0x80, 0x0c, 0x95, 0xd8, 0x04, 0x00, 0x26, 0x74, 0x30, 0x80, 0x30, 0x2d, 0x68, 0x18, 0x80, 0x24, + 0x2d, 0x59, 0x0b, 0x80, 0x0c, 0x32, 0x59, 0x05, 0x80, 0x0c, 0x43, 0x4a, 0x02, 0x80, 0x0c, 0x32, + 0x6f, 0x23, 0x80, 0x24, 0x2c, 0x7f, 0x21, 0x80, 0x24, 0x2b, 0x7f, 0x2e, 0x80, 0x2f, 0x32, 0x62, + 0x18, 0x80, 0x24, 0x32, 0x4e, 0x0c, 0x80, 0x0d, 0x37, 0x59, 0x05, 0x80, 0x18, 0xc4, 0xac, 0x37, + 0x67, 0x2f, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, 0x32, 0x6b, 0x0c, 0x80, 0x18, 0x2b, 0x6a, 0x2e, + 0x80, 0x30, 0x32, 0x62, 0x18, 0x80, 0x24, 0x32, 0x56, 0x0b, 0x80, 0x0c, 0x37, 0x59, 0x07, 0x80, + 0x18, 0xc4, 0xbd, 0x37, 0x6a, 0x2e, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, 0x32, 0x59, 0x06, 0x80, + 0x18, 0x24, 0x7c, 0x2f, 0x80, 0x30, 0x2b, 0x65, 0x1b, 0x80, 0x24, 0x2b, 0x62, 0x0b, 0x80, 0x0c, + 0x30, 0x5c, 0x08, 0x80, 0x18, 0xc4, 0xa4, 0x30, 0x65, 0x2e, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, + 0x2b, 0x65, 0x09, 0x80, 0x18, 0x24, 0x71, 0x2f, 0x80, 0x30, 0x2b, 0x6a, 0x17, 0x80, 0x18, 0x2b, + 0x62, 0x0c, 0x80, 0x0c, 0x24, 0x62, 0x0a, 0x80, 0x0c, 0x30, 0x73, 0x08, 0x80, 0x0c, 0x48, 0x5d, + 0x03, 0x80, 0x0c, 0x4a, 0x77, 0x23, 0x2e, 0x79, 0x23, 0x80, 0x24, 0x4b, 0x79, 0x23, 0x2f, 0x79, + 0x23, 0x80, 0x24, 0x24, 0x7f, 0x2f, 0x80, 0x30, 0x2b, 0x6f, 0x1a, 0x80, 0x27, 0x2b, 0x3c, 0x06, + 0x80, 0x09, 0x30, 0x62, 0x0a, 0x80, 0x18, 0xc4, 0x80, 0x32, 0x67, 0x17, 0x80, 0x03, 0xc4, 0x00, + 0x80, 0x15, 0x32, 0x67, 0x05, 0x80, 0x06, 0x32, 0x67, 0x05, 0x80, 0x06, 0x43, 0x57, 0x03, 0x80, + 0x0c, 0x2b, 0x6a, 0x08, 0x80, 0x0c, 0x2b, 0x64, 0x01, 0x80, 0x0c, 0x24, 0x7f, 0x2f, 0x80, 0x30, + 0x2b, 0x67, 0x19, 0x80, 0x24, 0x2b, 0x65, 0x0b, 0x80, 0x0c, 0x30, 0x53, 0x05, 0x80, 0x0c, 0x30, + 0x53, 0x01, 0x80, 0x0c, 0x24, 0x7a, 0x17, 0x80, 0x18, 0x2b, 0x78, 0x03, 0x80, 0x0c, 0x43, 0x74, + 0x02, 0x80, 0x0c, 0x2b, 0x74, 0x0b, 0x80, 0x0c, 0x48, 0x5e, 0x01, 0x80, 0x0c, 0x95, 0xd8, 0x04, + 0x00, 0x26, 0x74, 0x30, 0x80, 0x30, 0x2d, 0x68, 0x18, 0x80, 0x24, 0x2d, 0x59, 0x0b, 0x80, 0x0c, + 0x32, 0x59, 0x05, 0x80, 0x0c, 0x43, 0x4a, 0x02, 0x80, 0x0c, 0x26, 0x6f, 0x23, 0x80, 0x24, 0xc4, + 0xb0, 0x2c, 0x7f, 0x21, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x21, 0x2b, 0x7f, 0x2f, 0x80, 0x30, 0x32, + 0x62, 0x18, 0x80, 0x24, 0x32, 0x51, 0x0b, 0x80, 0x0c, 0x37, 0x65, 0x07, 0x80, 0x18, 0xc4, 0x98, + 0x39, 0x62, 0x2f, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, 0x32, 0x53, 0x05, 0x80, 0x18, 0x2b, 0x71, + 0x2f, 0x80, 0x30, 0x32, 0x62, 0x17, 0x80, 0x24, 0x32, 0x49, 0x0b, 0x80, 0x0c, 0x37, 0x5c, 0x09, + 0x80, 0x0c, 0x37, 0x5c, 0x02, 0x80, 0x0c, 0xc4, 0xb4, 0x35, 0x65, 0x2f, 0x80, 0x03, 0xc4, 0x00, + 0x80, 0x2d, 0x32, 0x56, 0x06, 0x80, 0x18, 0x24, 0x7f, 0x2f, 0x80, 0x30, 0x46, 0x5b, 0x0b, 0x80, + 0x18, 0x2e, 0x7f, 0x45, 0x80, 0x48, 0x2c, 0x7f, 0x53, 0x80, 0x54, 0x44, 0x7a, 0x0b, 0x80, 0x0c, + 0x2c, 0x7d, 0x0a, 0x80, 0x0c, 0x3c, 0x33, 0x05, 0x80, 0x0c, 0x42, 0x73, 0x14, 0x80, 0x0c, 0xc4, + 0x15, 0x80, 0x0c, 0xc4, 0x00, 0x2c, 0x7c, 0x09, 0x80, 0x0c, 0x44, 0x7a, 0x09, 0x80, 0x0c, 0x2c, + 0x68, 0x09, 0x80, 0x0c, 0x3c, 0x54, 0x05, 0x80, 0x0c, 0x2c, 0x7c, 0x09, 0x80, 0x0c, 0x44, 0x38, + 0x06, 0x80, 0x0c, 0x2c, 0x73, 0x09, 0x80, 0x0c, 0x2c, 0x7a, 0x09, 0x80, 0x0c, 0x2c, 0x7c, 0x09, + 0x80, 0x0c, 0x44, 0x6d, 0x09, 0x80, 0x0c, 0x2c, 0x7a, 0x17, 0x80, 0x18, 0x2c, 0x7d, 0x09, 0x80, + 0x0c, 0x3f, 0x5c, 0x06, 0x80, 0x0c, 0x2c, 0x7d, 0x0b, 0x80, 0x0c, 0x44, 0x35, 0x05, 0x80, 0x0c, + 0x2c, 0x7e, 0x09, 0x80, 0x0c, 0x2c, 0x7a, 0x09, 0x80, 0x0c, 0x2c, 0x7c, 0x0a, 0x80, 0x0c, 0x44, + 0x7c, 0x09, 0x80, 0x0c, 0x2c, 0x7e, 0x0b, 0x80, 0x0c, 0x3c, 0x3c, 0x08, 0x80, 0x0c, 0x42, 0x70, + 0x11, 0x80, 0x0c, 0xc4, 0x15, 0x80, 0x0c, 0xc4, 0x00, 0x2c, 0x7a, 0x09, 0x80, 0x0c, 0x44, 0x7a, + 0x09, 0x80, 0x0c, 0x2c, 0x78, 0x17, 0x80, 0x18, 0x2c, 0x7d, 0x0b, 0x80, 0x0c, 0x3e, 0x44, 0x06, + 0x80, 0x0c, 0x44, 0x7d, 0x0a, 0x80, 0x0c, 0x2c, 0x62, 0x0b, 0x80, 0x0c, 0x2c, 0x7a, 0x09, 0x80, + 0x0c, 0x44, 0x7a, 0x0a, 0x80, 0x0c, 0x2a, 0x78, 0x17, 0x80, 0x18, 0x2c, 0x7d, 0x16, 0x80, 0x18, + 0x44, 0x62, 0x05, 0x80, 0x0c, 0x2c, 0x62, 0x05, 0x80, 0x0c, 0x2c, 0x7c, 0x17, 0x80, 0x18, 0x2c, + 0x7a, 0x08, 0x80, 0x0c, 0x44, 0x7a, 0x07, 0x80, 0x0c, 0x2c, 0x7d, 0x17, 0x80, 0x18, 0x2c, 0x7c, + 0x07, 0x80, 0x0c, 0x44, 0x7c, 0x07, 0x80, 0x0c, 0x2c, 0x7a, 0x09, 0x80, 0x0c, 0x44, 0x76, 0x05, + 0x80, 0x0c, 0x29, 0x78, 0x17, 0x80, 0x18, 0x2a, 0x71, 0x16, 0x80, 0x18, 0x2b, 0x79, 0x17, 0x80, + 0x18, 0x2c, 0x7f, 0x17, 0x80, 0x24, 0x44, 0x7a, 0x0b, 0x80, 0x0c, 0x2c, 0x7d, 0x0a, 0x80, 0x0c, + 0x3c, 0x33, 0x05, 0x80, 0x0c, 0x42, 0x61, 0x14, 0x80, 0x18, 0x2c, 0x7c, 0x09, 0x80, 0x0c, 0x44, + 0x7a, 0x09, 0x80, 0x0c, 0x2c, 0x68, 0x09, 0x80, 0x0c, 0x3c, 0x54, 0x05, 0x80, 0x0c, 0x2c, 0x7c, + 0x09, 0x80, 0x0c, 0x44, 0x38, 0x06, 0x80, 0x0c, 0x2c, 0x73, 0x09, 0x80, 0x0c, 0x2c, 0x7a, 0x09, + 0x80, 0x0c, 0x2c, 0x7d, 0x0b, 0x80, 0x0c, 0x3e, 0x44, 0x06, 0x80, 0x0c, 0x44, 0x7d, 0x0a, 0x80, + 0x0c, 0x2c, 0x62, 0x0b, 0x80, 0x0c, 0x2c, 0x7d, 0x0b, 0x80, 0x0c, 0x44, 0x7d, 0x0a, 0x80, 0x0c, + 0x3e, 0x44, 0x06, 0x80, 0x0c, 0x2c, 0x62, 0x0b, 0x80, 0x0c, 0x2c, 0x7a, 0x07, 0x80, 0x0c, 0x44, + 0x5d, 0x04, 0x80, 0x0c, 0x27, 0x7d, 0x59, 0x80, 0x60, 0x3f, 0x72, 0x05, 0x80, 0x0c, 0x27, 0x62, + 0x05, 0x80, 0x0c, 0x27, 0x72, 0x05, 0x80, 0x18, 0x3f, 0x70, 0x05, 0x80, 0x0c, 0x27, 0x62, 0x05, + 0x80, 0x0c, 0x27, 0x72, 0x05, 0x80, 0x0c, 0x3f, 0x62, 0x05, 0x80, 0x0c, 0x27, 0x62, 0x05, 0x80, + 0x18, 0x3f, 0x76, 0x11, 0x80, 0x18, 0x27, 0x67, 0x05, 0x80, 0x0c, 0x27, 0x65, 0x05, 0x80, 0x81, + 0x4c, 0x27, 0x7d, 0x16, 0x80, 0x18, 0x3f, 0x72, 0x05, 0x80, 0x0c, 0x27, 0x62, 0x05, 0x80, 0x0c, + 0x27, 0x72, 0x05, 0x80, 0x18, 0x3f, 0x70, 0x05, 0x80, 0x0c, 0x27, 0x62, 0x05, 0x80, 0x0c, 0x27, + 0x72, 0x05, 0x80, 0x0c, 0x3f, 0x62, 0x05, 0x80, 0x0c, 0x27, 0x62, 0x05, 0x80, 0x18, 0x3f, 0x76, + 0x11, 0x80, 0x18, 0x27, 0x67, 0x05, 0x80, 0x0c, 0x27, 0x65, 0x05, 0x80, 0x81, 0x4b, 0x27, 0x60, + 0x34, 0x80, 0x01, 0xc4, 0x00, 0x80, 0x03, 0xc4, 0xff, 0x80, 0x04, 0xc4, 0xfc, 0x80, 0x03, 0xc4, + 0xf9, 0x80, 0x04, 0xc4, 0xf3, 0x80, 0x03, 0xc4, 0xec, 0x80, 0x04, 0xc4, 0xe3, 0x80, 0x03, 0xc4, + 0xda, 0x80, 0x04, 0xc4, 0xce, 0x80, 0x03, 0xc4, 0xc1, 0x80, 0x04, 0xc4, 0xb2, 0x80, 0x04, 0xc4, + 0xa2, 0x80, 0x03, 0xc4, 0x90, 0x80, 0x04, 0xc4, 0x80, 0x80, 0x02, 0xc4, 0x00, 0x80, 0x84, 0x10, + 0x94, 0x3a, 0x00, 0x00, 0x80, 0x81, 0x40, 0xff, 0x26, 0x7f, 0x2f, 0x80, 0x30, 0x2d, 0x73, 0x17, + 0x80, 0x24, 0x2d, 0x42, 0x0b, 0x80, 0x0c, 0x32, 0x5e, 0x05, 0x80, 0x18, 0xc4, 0x80, 0x34, 0x6f, + 0x30, 0x80, 0x03, 0xc4, 0x00, 0x80, 0x2d, 0x2d, 0x66, 0x0b, 0x80, 0x0c, 0x26, 0x50, 0x01, 0x80, + 0x0c, 0xfd, 0xc7, 0x00, 0x81, 0x01, 0xc1, 0x4a, 0xc0, 0x7f, 0xc4, 0x00, 0xca, 0x00, 0x4a, 0x53, + 0x82, 0x7f, 0x47, 0x4a, 0x82, 0x7f, 0x80, 0x83, 0x00, 0x4c, 0x49, 0x82, 0x74, 0x48, 0x40, 0x82, + 0x73, 0x80, 0x83, 0x00, 0x48, 0x43, 0x82, 0x7d, 0x4c, 0x48, 0x82, 0x7c, 0x80, 0x83, 0x00, 0x47, + 0x35, 0x82, 0x68, 0x4a, 0x43, 0x82, 0x68, 0x80, 0x83, 0x00, 0x47, 0x67, 0x82, 0x79, 0x4a, 0x70, + 0x82, 0x79, 0x80, 0x83, 0x00, 0x48, 0x5a, 0x82, 0x68, 0x4c, 0x63, 0x82, 0x68, 0x80, 0x83, 0x00, + 0x4c, 0x63, 0x82, 0x79, 0x48, 0x66, 0x82, 0x79, 0x80, 0x83, 0x00, 0x4a, 0x6b, 0x82, 0x2d, 0x47, + 0x55, 0x82, 0x2d, 0x80, 0x82, 0x38, 0x48, 0x73, 0x22, 0x45, 0x66, 0x22, 0x80, 0x24, 0x49, 0x6b, + 0x23, 0x46, 0x66, 0x23, 0x80, 0x24, 0x4a, 0x6e, 0x82, 0x79, 0x47, 0x69, 0x82, 0x79, 0x80, 0x83, + 0x00, 0x4c, 0x60, 0x82, 0x6d, 0x48, 0x5d, 0x82, 0x6d, 0x80, 0x83, 0x00, 0x4c, 0x66, 0x82, 0x7a, + 0x48, 0x63, 0x82, 0x79, 0x80, 0x83, 0x00, 0x4a, 0x60, 0x45, 0x47, 0x4f, 0x45, 0x80, 0x48, 0x4b, + 0x66, 0x47, 0x48, 0x55, 0x47, 0x80, 0x48, 0x49, 0x4f, 0x83, 0x2f, 0x4d, 0x69, 0x83, 0x2f, 0x80, + 0x93, 0x70, 0x94, 0x04, 0x05, 0x00, 0x80, 0x81, 0x40, 0xff, 0xc7, 0x00, 0x81, 0x02, 0xc1, 0x4a, + 0xc0, 0x00, 0xc4, 0x00, 0xca, 0x00, 0x40, 0x47, 0x82, 0x7f, 0x43, 0x58, 0x82, 0x7f, 0x80, 0x83, + 0x00, 0x42, 0x40, 0x82, 0x79, 0x45, 0x57, 0x82, 0x79, 0x80, 0x83, 0x00, 0x45, 0x56, 0x82, 0x7f, + 0x41, 0x49, 0x82, 0x7f, 0x80, 0x83, 0x00, 0x40, 0x5c, 0x82, 0x67, 0x43, 0x57, 0x82, 0x67, 0x80, + 0x83, 0x00, 0x43, 0x66, 0x82, 0x7a, 0x40, 0x6c, 0x82, 0x7a, 0x80, 0x83, 0x00, 0x45, 0x66, 0x82, + 0x6e, 0x42, 0x6c, 0x82, 0x6e, 0x80, 0x83, 0x00, 0x45, 0x69, 0x82, 0x79, 0x41, 0x5b, 0x82, 0x7a, + 0x80, 0x83, 0x00, 0x40, 0x6f, 0x82, 0x2d, 0x43, 0x61, 0x82, 0x2d, 0x80, 0x82, 0x38, 0x3e, 0x67, + 0x22, 0x41, 0x60, 0x22, 0x80, 0x24, 0x3f, 0x6a, 0x23, 0x42, 0x62, 0x23, 0x80, 0x24, 0x40, 0x73, + 0x82, 0x7a, 0x43, 0x61, 0x82, 0x7a, 0x80, 0x83, 0x00, 0x45, 0x61, 0x82, 0x6d, 0x42, 0x60, 0x82, + 0x6d, 0x80, 0x83, 0x00, 0x41, 0x67, 0x82, 0x7a, 0x45, 0x5e, 0x82, 0x79, 0x80, 0x83, 0x00, 0x40, + 0x6c, 0x45, 0x43, 0x5b, 0x45, 0x80, 0x48, 0x44, 0x5e, 0x47, 0x41, 0x69, 0x47, 0x80, 0x48, 0x42, + 0x6c, 0x83, 0x2f, 0x46, 0x61, 0x83, 0x2f, 0x80, 0x93, 0x70, 0x94, 0xbc, 0x05, 0x00, 0x80, 0x81, + 0x40, 0xff, 0xc7, 0x00, 0x81, 0x03, 0xc1, 0x5a, 0xc0, 0x7f, 0xc4, 0x00, 0xcb, 0x17, 0xca, 0x00, + 0x3b, 0x3a, 0x82, 0x79, 0x3e, 0x43, 0x82, 0x79, 0x80, 0x60, 0x4f, 0x5c, 0x06, 0x80, 0x18, 0x4f, + 0x26, 0x06, 0x80, 0x0c, 0x43, 0x5c, 0x06, 0x80, 0x0c, 0x4f, 0x14, 0x06, 0x80, 0x0c, 0x43, 0x26, + 0x06, 0x80, 0x18, 0x43, 0x14, 0x06, 0x80, 0x6c, 0x4f, 0x5c, 0x06, 0x80, 0x18, 0x4f, 0x26, 0x06, + 0x80, 0x0c, 0x43, 0x5c, 0x06, 0x80, 0x0c, 0x4f, 0x14, 0x06, 0x80, 0x0c, 0x43, 0x26, 0x06, 0x80, + 0x18, 0x43, 0x14, 0x06, 0x80, 0x0c, 0x40, 0x4f, 0x82, 0x79, 0x3c, 0x46, 0x82, 0x79, 0x80, 0x60, + 0x4f, 0x5c, 0x05, 0x80, 0x18, 0x4f, 0x26, 0x05, 0x80, 0x0c, 0x43, 0x5c, 0x05, 0x80, 0x0c, 0x4f, + 0x14, 0x05, 0x80, 0x0c, 0x43, 0x26, 0x05, 0x80, 0x18, 0x43, 0x14, 0x05, 0x80, 0x6c, 0x4f, 0x5c, + 0x04, 0x80, 0x18, 0x4f, 0x26, 0x04, 0x80, 0x0c, 0x43, 0x5c, 0x04, 0x80, 0x0c, 0x4f, 0x14, 0x04, + 0x80, 0x0c, 0x43, 0x26, 0x04, 0x80, 0x18, 0x43, 0x14, 0x04, 0x80, 0x0c, 0x3c, 0x3f, 0x82, 0x77, + 0x40, 0x44, 0x82, 0x76, 0x80, 0x60, 0x4f, 0x5c, 0x05, 0x80, 0x18, 0x4f, 0x26, 0x05, 0x80, 0x0c, + 0x43, 0x5c, 0x04, 0x80, 0x0c, 0x4f, 0x14, 0x05, 0x80, 0x0c, 0x43, 0x26, 0x04, 0x80, 0x18, 0x43, + 0x14, 0x04, 0x80, 0x6c, 0x4f, 0x5c, 0x07, 0x80, 0x18, 0x4f, 0x26, 0x07, 0x80, 0x0c, 0x43, 0x5c, + 0x05, 0x80, 0x0c, 0x4f, 0x14, 0x07, 0x80, 0x0c, 0x43, 0x26, 0x05, 0x80, 0x18, 0x43, 0x14, 0x05, + 0x80, 0x0c, 0x3e, 0x3a, 0x82, 0x7a, 0x3b, 0x2c, 0x82, 0x7b, 0x80, 0x60, 0x4f, 0x5c, 0x05, 0x80, + 0x18, 0x4f, 0x26, 0x05, 0x80, 0x0c, 0x43, 0x5c, 0x05, 0x80, 0x0c, 0x4f, 0x14, 0x05, 0x80, 0x0c, + 0x43, 0x26, 0x05, 0x80, 0x18, 0x43, 0x14, 0x05, 0x80, 0x81, 0x48, 0x4e, 0x4c, 0x0d, 0x80, 0x05, + 0xc0, 0x4f, 0x4f, 0x59, 0x82, 0x0e, 0x80, 0x81, 0x10, 0xca, 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, + 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x6d, 0xca, 0x00, 0x80, 0x05, 0x4f, 0x35, 0x05, + 0x80, 0x06, 0x51, 0x5b, 0x4a, 0x80, 0x48, 0x4f, 0x46, 0x07, 0x80, 0x17, 0x4e, 0x50, 0x42, 0x80, + 0x48, 0x56, 0x61, 0x81, 0x6e, 0x80, 0x62, 0xca, 0x02, 0x80, 0x08, 0xca, 0x07, 0x80, 0x08, 0xca, + 0x0b, 0x80, 0x07, 0xca, 0x12, 0x80, 0x79, 0xca, 0x00, 0x51, 0x5c, 0x44, 0x80, 0x40, 0x53, 0x55, + 0x09, 0x80, 0x08, 0x54, 0x55, 0x78, 0x80, 0x54, 0xca, 0x01, 0x80, 0x09, 0xca, 0x0a, 0x80, 0x08, + 0xca, 0x17, 0x80, 0x12, 0x53, 0x58, 0x49, 0x80, 0x01, 0xca, 0x00, 0x80, 0x47, 0x51, 0x53, 0x79, + 0x80, 0x49, 0xca, 0x01, 0x80, 0x08, 0xca, 0x09, 0x80, 0x08, 0xca, 0x0f, 0x80, 0x07, 0xca, 0x17, + 0x80, 0x19, 0xca, 0x00, 0x53, 0x5d, 0x48, 0x80, 0x47, 0x54, 0x56, 0x81, 0x40, 0x80, 0x4f, 0xca, + 0x00, 0x80, 0x07, 0xca, 0x04, 0x80, 0x08, 0xca, 0x09, 0x80, 0x07, 0xca, 0x0d, 0x80, 0x07, 0xca, + 0x12, 0x80, 0x54, 0x4f, 0x56, 0x77, 0x80, 0x01, 0xca, 0x00, 0x80, 0x4e, 0xca, 0x00, 0x80, 0x09, + 0xca, 0x09, 0x80, 0x08, 0xca, 0x12, 0x80, 0x13, 0xca, 0x00, 0x80, 0x02, 0x4d, 0x55, 0x2b, 0x80, + 0x28, 0x4e, 0x50, 0x25, 0x80, 0x23, 0x4f, 0x58, 0x82, 0x08, 0x80, 0x81, 0x11, 0xca, 0x00, 0x80, + 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x61, 0xca, 0x00, 0x80, + 0x12, 0x4f, 0x41, 0x0b, 0x80, 0x06, 0x51, 0x53, 0x4a, 0x80, 0x48, 0x4f, 0x44, 0x0a, 0x80, 0x17, + 0x4e, 0x46, 0x44, 0x80, 0x47, 0x56, 0x5e, 0x81, 0x6f, 0x80, 0x62, 0xca, 0x00, 0x80, 0x08, 0xca, + 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x78, 0x54, 0x5e, 0x4a, 0x80, 0x01, + 0xca, 0x00, 0x80, 0x47, 0x58, 0x59, 0x49, 0x80, 0x48, 0x54, 0x60, 0x7a, 0x80, 0x49, 0xca, 0x00, + 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x19, 0xca, 0x00, + 0x53, 0x5d, 0x76, 0x80, 0x48, 0xca, 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, + 0x07, 0xca, 0x12, 0x80, 0x13, 0x54, 0x26, 0x0e, 0x80, 0x05, 0x56, 0x57, 0x4a, 0x80, 0x01, 0xca, + 0x00, 0x80, 0x47, 0x54, 0x5f, 0x82, 0x7f, 0x80, 0x81, 0x11, 0xca, 0x01, 0x80, 0x08, 0xca, 0x04, + 0x80, 0x08, 0xca, 0x09, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x08, 0xca, 0x0f, 0x80, 0x08, 0xca, 0x12, + 0x80, 0x07, 0xca, 0x17, 0x80, 0x81, 0x41, 0xca, 0x00, 0x80, 0x91, 0x7f, 0x94, 0x74, 0x06, 0x00, + 0x80, 0x81, 0x40, 0xff, 0xc7, 0x00, 0x81, 0x04, 0xc1, 0x5a, 0xc0, 0x00, 0xc4, 0x00, 0xcb, 0x17, + 0xca, 0x00, 0x37, 0x53, 0x82, 0x7c, 0x34, 0x3f, 0x82, 0x7a, 0x80, 0x6c, 0x43, 0x5f, 0x06, 0x80, + 0x18, 0x43, 0x28, 0x06, 0x80, 0x18, 0x4f, 0x5f, 0x09, 0x43, 0x11, 0x06, 0x80, 0x18, 0x4f, 0x28, + 0x09, 0x80, 0x0c, 0x95, 0x5a, 0x0b, 0x00, 0x39, 0x46, 0x82, 0x79, 0x36, 0x2f, 0x82, 0x79, 0x80, + 0x0c, 0x4f, 0x11, 0x08, 0x80, 0x60, 0x43, 0x5f, 0x05, 0x80, 0x18, 0x43, 0x28, 0x05, 0x80, 0x18, + 0x4f, 0x5f, 0x08, 0x43, 0x11, 0x05, 0x80, 0x18, 0x4f, 0x28, 0x08, 0x80, 0x18, 0x4f, 0x11, 0x08, + 0x80, 0x60, 0x43, 0x5f, 0x07, 0x80, 0x18, 0x43, 0x28, 0x07, 0x80, 0x18, 0x4f, 0x5f, 0x09, 0x43, + 0x11, 0x07, 0x80, 0x18, 0x4f, 0x28, 0x09, 0x80, 0x0c, 0x35, 0x34, 0x82, 0x7a, 0x39, 0x3e, 0x82, + 0x79, 0x80, 0x0c, 0x4f, 0x11, 0x09, 0x80, 0x60, 0x43, 0x5f, 0x04, 0x80, 0x18, 0x43, 0x28, 0x04, + 0x80, 0x18, 0x4f, 0x5f, 0x09, 0x43, 0x11, 0x04, 0x80, 0x18, 0x4f, 0x28, 0x09, 0x80, 0x0c, 0x95, + 0x5a, 0x0b, 0x00, 0x34, 0x41, 0x82, 0x7c, 0x37, 0x34, 0x82, 0x7c, 0x80, 0x0c, 0x4f, 0x11, 0x08, + 0x80, 0x60, 0x43, 0x5f, 0x05, 0x80, 0x18, 0x43, 0x28, 0x05, 0x80, 0x18, 0x4f, 0x5f, 0x08, 0x43, + 0x11, 0x05, 0x80, 0x18, 0x4f, 0x28, 0x08, 0x80, 0x18, 0x4f, 0x11, 0x08, 0x80, 0x81, 0x2f, 0x42, + 0x56, 0x0d, 0x80, 0x05, 0x43, 0x63, 0x82, 0x0e, 0x80, 0x02, 0xc0, 0x4f, 0x80, 0x81, 0x0e, 0xca, + 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x6d, 0xca, + 0x00, 0x80, 0x05, 0x43, 0x3f, 0x05, 0x80, 0x06, 0x45, 0x65, 0x4a, 0x80, 0x48, 0x43, 0x50, 0x07, + 0x80, 0x17, 0x42, 0x5a, 0x42, 0x80, 0x48, 0x4a, 0x6b, 0x81, 0x6e, 0x80, 0x62, 0xca, 0x02, 0x80, + 0x08, 0xca, 0x07, 0x80, 0x08, 0xca, 0x0b, 0x80, 0x07, 0xca, 0x12, 0x80, 0x79, 0xca, 0x00, 0x45, + 0x66, 0x44, 0x80, 0x40, 0x47, 0x5f, 0x09, 0x80, 0x08, 0x48, 0x5f, 0x78, 0x80, 0x54, 0xca, 0x01, + 0x80, 0x09, 0xca, 0x0a, 0x80, 0x08, 0xca, 0x17, 0x80, 0x12, 0x47, 0x62, 0x49, 0x80, 0x01, 0xca, + 0x00, 0x80, 0x47, 0x45, 0x5d, 0x79, 0x80, 0x49, 0xca, 0x01, 0x80, 0x08, 0xca, 0x09, 0x80, 0x08, + 0xca, 0x0f, 0x80, 0x07, 0xca, 0x17, 0x80, 0x19, 0xca, 0x00, 0x47, 0x67, 0x48, 0x80, 0x47, 0x48, + 0x60, 0x81, 0x40, 0x80, 0x4f, 0xca, 0x00, 0x80, 0x07, 0xca, 0x04, 0x80, 0x08, 0xca, 0x09, 0x80, + 0x07, 0xca, 0x0d, 0x80, 0x07, 0xca, 0x12, 0x80, 0x54, 0x43, 0x60, 0x77, 0x80, 0x01, 0xca, 0x00, + 0x80, 0x4e, 0xca, 0x00, 0x80, 0x09, 0xca, 0x09, 0x80, 0x08, 0xca, 0x12, 0x80, 0x13, 0xca, 0x00, + 0x80, 0x02, 0x41, 0x5f, 0x2b, 0x80, 0x28, 0x42, 0x5a, 0x25, 0x80, 0x23, 0x43, 0x62, 0x82, 0x08, + 0x80, 0x81, 0x11, 0xca, 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, + 0x12, 0x80, 0x61, 0xca, 0x00, 0x80, 0x12, 0x43, 0x4b, 0x0b, 0x80, 0x06, 0x45, 0x5d, 0x4a, 0x80, + 0x48, 0x43, 0x4e, 0x0a, 0x80, 0x17, 0x42, 0x50, 0x44, 0x80, 0x47, 0x4a, 0x68, 0x81, 0x6f, 0x80, + 0x62, 0xca, 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, + 0x78, 0x48, 0x68, 0x4a, 0x80, 0x01, 0xca, 0x00, 0x80, 0x47, 0x4c, 0x63, 0x49, 0x80, 0x48, 0x48, + 0x6a, 0x7a, 0x80, 0x49, 0xca, 0x00, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, + 0xca, 0x12, 0x80, 0x19, 0xca, 0x00, 0x47, 0x67, 0x76, 0x80, 0x48, 0xca, 0x00, 0x80, 0x08, 0xca, + 0x04, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x07, 0xca, 0x12, 0x80, 0x13, 0x48, 0x30, 0x0e, 0x80, 0x05, + 0x4a, 0x61, 0x4a, 0x80, 0x01, 0xca, 0x00, 0x80, 0x47, 0x48, 0x69, 0x82, 0x7f, 0x80, 0x81, 0x11, + 0xca, 0x01, 0x80, 0x08, 0xca, 0x04, 0x80, 0x08, 0xca, 0x09, 0x80, 0x08, 0xca, 0x0a, 0x80, 0x08, + 0xca, 0x0f, 0x80, 0x08, 0xca, 0x12, 0x80, 0x07, 0xca, 0x17, 0x80, 0x81, 0x41, 0xca, 0x00, 0x80, + 0x92, 0x00, 0x94, 0x06, 0x09, 0x00, 0x80, 0x81, 0x40, 0xff, 0x80, 0x0c, 0x4f, 0x11, 0x09, 0x80, + 0x60, 0x43, 0x5f, 0x05, 0x80, 0x18, 0x43, 0x28, 0x05, 0x80, 0x18, 0x4f, 0x5f, 0x08, 0x43, 0x11, + 0x05, 0x80, 0x18, 0x4f, 0x28, 0x08, 0x80, 0x0c, 0xfd, 0xc7, 0x00, 0x81, 0x05, 0xc1, 0x5d, 0xc0, + 0x40, 0xc4, 0x00, 0xca, 0x00, 0x4f, 0x4e, 0x8b, 0x4b, 0x80, 0xa0, 0x7e, 0x4a, 0x4a, 0x45, 0x47, + 0x39, 0x45, 0x43, 0x47, 0x45, 0x80, 0x48, 0x4b, 0x51, 0x47, 0x48, 0x40, 0x47, 0x44, 0x4b, 0x47, + 0x80, 0x48, 0x49, 0x37, 0x83, 0x31, 0x4d, 0x51, 0x83, 0x31, 0x46, 0x4b, 0x83, 0x31, 0x80, 0x93, + 0x72, 0x94, 0x7b, 0x0b, 0x00, 0x80, 0x81, 0x40, 0xff, 0xc7, 0x00, 0x81, 0x06, 0xc1, 0x7f, 0xc0, + 0x40, 0xc4, 0x00, 0xca, 0x00, 0x4f, 0x48, 0x0b, 0x80, 0x18, 0x54, 0x3a, 0x0b, 0x80, 0x18, 0x5b, + 0x37, 0x0b, 0x80, 0x18, 0x4f, 0x42, 0x0b, 0x80, 0x18, 0x54, 0x3b, 0x0b, 0x80, 0x18, 0x5b, 0x2e, + 0x0b, 0x80, 0x18, 0x4f, 0x3e, 0x0b, 0x80, 0x18, 0x54, 0x38, 0x0b, 0x80, 0x18, 0x5b, 0x33, 0x0b, + 0x80, 0x18, 0x4f, 0x3a, 0x0b, 0x80, 0x18, 0x54, 0x3a, 0x0b, 0x80, 0x18, 0x5b, 0x30, 0x0b, 0x80, + 0x18, 0x4f, 0x45, 0x0b, 0x80, 0x18, 0x54, 0x3b, 0x0b, 0x80, 0x18, 0x5b, 0x34, 0x0b, 0x80, 0x18, + 0x4f, 0x3d, 0x0b, 0x80, 0x18, 0x54, 0x34, 0x0b, 0x80, 0x18, 0x5b, 0x32, 0x0b, 0x80, 0x18, 0x4f, + 0x3d, 0x0b, 0x80, 0x18, 0x54, 0x37, 0x0b, 0x80, 0x18, 0x5b, 0x2b, 0x0b, 0x80, 0x18, 0x4f, 0x40, + 0x0b, 0x80, 0x18, 0x54, 0x38, 0x0b, 0x80, 0x18, 0x5b, 0x2e, 0x0b, 0x80, 0x18, 0x4f, 0x3d, 0x0b, + 0x80, 0x18, 0x54, 0x34, 0x0b, 0x80, 0x18, 0x5b, 0x2e, 0x0b, 0x80, 0x18, 0x4f, 0x35, 0x0b, 0x80, + 0x18, 0x54, 0x34, 0x0b, 0x80, 0x18, 0x5b, 0x30, 0x0b, 0x80, 0x18, 0x4f, 0x3b, 0x0b, 0x80, 0x18, + 0x54, 0x36, 0x0b, 0x80, 0x18, 0x5b, 0x36, 0x0b, 0x80, 0x18, 0x4f, 0x40, 0x0b, 0x80, 0x18, 0x54, + 0x39, 0x0b, 0x80, 0x18, 0x5b, 0x2d, 0x0b, 0x80, 0x18, 0x4f, 0x40, 0x0b, 0x80, 0x18, 0x54, 0x31, + 0x0b, 0x80, 0x18, 0x5b, 0x30, 0x0b, 0x80, 0x18, 0x4f, 0x40, 0x0b, 0x80, 0x18, 0x54, 0x35, 0x0b, + 0x80, 0x18, 0x5b, 0x30, 0x0b, 0x80, 0x18, 0x4f, 0x3b, 0x0b, 0x80, 0x18, 0x54, 0x32, 0x0b, 0x80, + 0x18, 0x5b, 0x32, 0x0b, 0x80, 0x18, 0x4f, 0x3a, 0x0b, 0x80, 0x18, 0x54, 0x36, 0x0b, 0x80, 0x18, + 0x5b, 0x2e, 0x0b, 0x80, 0x18, 0x4f, 0x3a, 0x0b, 0x80, 0x18, 0x54, 0x39, 0x0b, 0x80, 0x18, 0x5b, + 0x2e, 0x0b, 0x80, 0x18, 0x4f, 0x3d, 0x0b, 0x80, 0x18, 0x54, 0x37, 0x0b, 0x80, 0x18, 0x5b, 0x2e, + 0x0b, 0x80, 0x18, 0x4f, 0x42, 0x0b, 0x80, 0x18, 0x54, 0x37, 0x0b, 0x80, 0x18, 0x5b, 0x2e, 0x0b, + 0x80, 0x18, 0x4f, 0x38, 0x0b, 0x80, 0x18, 0x54, 0x2d, 0x0b, 0x80, 0x18, 0x5b, 0x29, 0x0b, 0x80, + 0x18, 0x4f, 0x35, 0x0b, 0x80, 0x18, 0x54, 0x2d, 0x0b, 0x80, 0x18, 0x5b, 0x32, 0x0b, 0x80, 0x18, + 0x4f, 0x31, 0x0b, 0x80, 0xaa, 0x18, 0x94, 0xbb, 0x0b, 0x00, 0x80, 0x81, 0x40, 0xff, 0xc7, 0x00, + 0x81, 0x07, 0xc1, 0x7f, 0xc0, 0x40, 0xc4, 0x00, 0xca, 0x00, 0x80, 0xa5, 0x0f, 0x50, 0x5a, 0x24, + 0x80, 0x08, 0x57, 0x4e, 0x20, 0x80, 0x0c, 0x5a, 0x53, 0x0f, 0x80, 0x07, 0x5c, 0x43, 0x14, 0x80, + 0x0a, 0x5e, 0x64, 0x2a, 0x80, 0x0c, 0x63, 0x5e, 0x3a, 0x80, 0x90, 0x40, 0x94, 0x10, 0x0d, 0x00, + 0x80, 0x81, 0x40, 0xff, 0xc7, 0x00, 0x81, 0x7f, 0xc1, 0x7f, 0xc0, 0x40, 0xc4, 0x00, 0xca, 0x00, + 0x24, 0x7e, 0x47, 0x31, 0x60, 0x81, 0x0f, 0x80, 0x84, 0x38, 0x41, 0x17, 0x03, 0x80, 0x04, 0x41, + 0x30, 0x03, 0x80, 0x04, 0x41, 0x74, 0x0b, 0x80, 0x0c, 0x41, 0x56, 0x0b, 0x80, 0x0c, 0x41, 0x7f, + 0x47, 0x80, 0x60, 0x24, 0x71, 0x23, 0x31, 0x5b, 0x46, 0x80, 0x24, 0x24, 0x74, 0x23, 0x34, 0x54, + 0x81, 0x03, 0x80, 0x24, 0x24, 0x78, 0x2f, 0x31, 0x60, 0x81, 0x0f, 0x80, 0x84, 0x38, 0x41, 0x17, + 0x03, 0x80, 0x04, 0x41, 0x30, 0x03, 0x80, 0x04, 0x29, 0x4c, 0x0b, 0x41, 0x5a, 0x0b, 0x80, 0x0c, + 0x29, 0x28, 0x0b, 0x41, 0x3e, 0x0b, 0x80, 0x0c, 0x29, 0x3a, 0x0b, 0x41, 0x40, 0x0b, 0x80, 0x0c, + 0x29, 0x28, 0x0b, 0x41, 0x38, 0x0b, 0x80, 0x0c, 0x29, 0x36, 0x0b, 0x41, 0x42, 0x0b, 0x80, 0x0c, + 0x29, 0x38, 0x0b, 0x41, 0x38, 0x0b, 0x80, 0x0c, 0x29, 0x44, 0x0b, 0x41, 0x4c, 0x0b, 0x80, 0x0c, + 0x29, 0x42, 0x0b, 0x41, 0x54, 0x0b, 0x80, 0x0c, 0x29, 0x4e, 0x0b, 0x41, 0x5e, 0x0b, 0x80, 0x0c, + 0x29, 0x54, 0x0b, 0x41, 0x54, 0x0b, 0x80, 0x0c, 0x29, 0x5e, 0x0b, 0x41, 0x62, 0x0b, 0x80, 0x0c, + 0x29, 0x62, 0x0b, 0x41, 0x6a, 0x0b, 0x80, 0x0c, 0x29, 0x6e, 0x0b, 0x41, 0x73, 0x0b, 0x80, 0x0c, + 0x29, 0x6c, 0x0b, 0x41, 0x73, 0x0b, 0x80, 0x0c, 0x29, 0x73, 0x0b, 0x41, 0x73, 0x0b, 0x80, 0x0c, + 0x29, 0x70, 0x0b, 0x41, 0x73, 0x0b, 0x80, 0x0c, 0x31, 0x60, 0x81, 0x3e, 0x24, 0x79, 0x2f, 0x80, + 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6c, 0x0b, 0x80, 0x0c, 0x24, 0x7e, 0x17, 0x80, 0x18, + 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, 0x7c, 0x2e, 0x80, 0x30, 0x95, 0x5f, 0x10, 0x00, 0x95, 0x83, + 0x10, 0x00, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6e, 0x0b, 0x80, + 0x0c, 0x24, 0x7c, 0x17, 0x80, 0x18, 0x31, 0x5b, 0x47, 0x24, 0x79, 0x23, 0x80, 0x24, 0x34, 0x54, + 0x81, 0x4b, 0x24, 0x79, 0x23, 0x80, 0x24, 0x95, 0xa2, 0x10, 0x00, 0x95, 0x5f, 0x10, 0x00, 0x95, + 0x83, 0x10, 0x00, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6e, 0x0b, + 0x80, 0x0c, 0x24, 0x7c, 0x17, 0x80, 0x18, 0x37, 0x7f, 0x47, 0x24, 0x79, 0x23, 0x80, 0x24, 0x34, + 0x60, 0x81, 0x4b, 0x24, 0x79, 0x23, 0x80, 0x24, 0x95, 0xa2, 0x10, 0x00, 0x95, 0x5f, 0x10, 0x00, + 0x95, 0x83, 0x10, 0x00, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6e, + 0x0b, 0x80, 0x0c, 0x24, 0x7c, 0x17, 0x80, 0x18, 0x31, 0x5b, 0x47, 0x24, 0x79, 0x23, 0x80, 0x24, + 0x34, 0x5b, 0x81, 0x4b, 0x24, 0x79, 0x23, 0x80, 0x24, 0x95, 0xa2, 0x10, 0x00, 0x95, 0xc5, 0x10, + 0x00, 0x31, 0x5b, 0x81, 0x0f, 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x0b, 0x80, 0x0c, 0x29, + 0x7c, 0x17, 0x80, 0x18, 0x34, 0x5b, 0x77, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x17, 0x80, + 0x18, 0x31, 0x60, 0x81, 0x10, 0x29, 0x7c, 0x2f, 0x80, 0x30, 0x95, 0xc5, 0x10, 0x00, 0x24, 0x79, + 0x23, 0x80, 0x24, 0x24, 0x79, 0x0b, 0x80, 0x0c, 0x29, 0x7c, 0x17, 0x80, 0x18, 0x24, 0x79, 0x2f, + 0x80, 0x30, 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, 0x7c, 0x2f, 0x80, 0x30, 0x37, 0x79, 0x81, 0x0f, + 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x0b, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, + 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x2f, 0x80, 0x18, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, 0x7c, + 0x17, 0x80, 0x18, 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x23, 0x80, 0x0c, 0x29, 0x7c, 0x2f, + 0x80, 0x18, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x17, 0x80, 0x18, 0x24, 0x7c, 0x2f, 0x80, + 0x18, 0x29, 0x7c, 0x0b, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x0c, 0x24, 0x79, 0x23, 0x80, 0x24, + 0x24, 0x79, 0x0b, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x24, + 0x79, 0x2f, 0x80, 0x18, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, 0x7c, 0x17, 0x80, 0x18, 0x24, 0x79, + 0x23, 0x80, 0x24, 0x24, 0x79, 0x23, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, 0x79, 0x17, + 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, 0x18, 0x31, 0x60, 0x81, 0x6f, 0x24, 0x79, 0x47, 0x80, 0x18, + 0x29, 0x7c, 0x2f, 0x80, 0x30, 0x37, 0x79, 0x5f, 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x23, + 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, + 0x18, 0x24, 0x79, 0x47, 0x80, 0x18, 0x29, 0x7c, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x23, 0x80, 0x24, + 0x24, 0x79, 0x23, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x34, 0x60, 0x81, 0x57, 0x24, 0x79, + 0x2f, 0x80, 0x30, 0x24, 0x79, 0x3b, 0x80, 0x18, 0x29, 0x7c, 0x2f, 0x80, 0x30, 0x37, 0x79, 0x5f, + 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x23, 0x80, 0x0c, 0x29, 0x7c, 0x2f, 0x80, 0x18, 0x24, + 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x47, 0x80, 0x18, 0x29, 0x79, 0x0b, 0x80, 0x0c, 0x29, 0x7c, + 0x30, 0x80, 0x24, 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x23, 0x80, 0x0c, 0x29, 0x7c, 0x3b, + 0x80, 0x18, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x47, 0x80, 0x18, 0x29, 0x7f, 0x17, 0x80, + 0x18, 0x29, 0x7f, 0x0b, 0x80, 0x0c, 0x29, 0x7f, 0x81, 0x4b, 0x80, 0x0c, 0x37, 0x79, 0x81, 0x3f, + 0x24, 0x79, 0x81, 0x3f, 0x80, 0x84, 0x40, 0x94, 0x46, 0x0d, 0x00, 0x80, 0x81, 0x40, 0xff, 0x24, + 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6e, 0x0b, 0x80, 0x0c, 0x24, 0x7c, + 0x17, 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, 0x6e, 0x0b, 0x80, 0x0c, 0x29, 0x7c, 0x23, + 0x80, 0x24, 0xfd, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, 0x24, 0x6c, 0x0b, + 0x80, 0x0c, 0x24, 0x7e, 0x17, 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, 0x7c, 0x2e, 0x80, + 0x30, 0xfd, 0x31, 0x60, 0x81, 0x3f, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x29, 0x7c, 0x23, 0x80, 0x24, + 0x24, 0x6c, 0x0b, 0x80, 0x0c, 0x24, 0x7e, 0x17, 0x80, 0x18, 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, + 0x7c, 0x2e, 0x80, 0x30, 0xfd, 0x24, 0x79, 0x23, 0x80, 0x24, 0x24, 0x79, 0x0b, 0x80, 0x0c, 0x29, + 0x7c, 0x17, 0x80, 0x18, 0x24, 0x79, 0x2f, 0x80, 0x30, 0x24, 0x79, 0x17, 0x80, 0x18, 0x29, 0x7c, + 0x2f, 0x80, 0x0c, 0x24, 0x79, 0x23, 0x80, 0x24, 0xfd, 0xc7, 0x00, 0x81, 0x0b, 0xc1, 0x60, 0xc0, + 0x4d, 0xc4, 0x00, 0xca, 0x00, 0x2e, 0x45, 0x17, 0x80, 0x18, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, + 0x57, 0x0b, 0x80, 0x0c, 0x2a, 0x61, 0x0b, 0x80, 0x0c, 0x2e, 0x76, 0x0b, 0x80, 0x0c, 0x2c, 0x4e, + 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x30, 0x0b, + 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x65, 0x0b, 0x80, + 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x36, 0x0b, 0x80, 0x0c, + 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x0c, 0x2a, + 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, + 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x32, 0x0b, + 0x80, 0x0c, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x69, 0x0b, 0x80, + 0x0c, 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x2e, 0x75, 0x0b, 0x80, 0x0c, + 0x2c, 0x52, 0x0b, 0x80, 0x0c, 0x2a, 0x29, 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, + 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x61, 0x0b, 0x80, 0x0c, 0x2a, 0x1d, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, + 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x3e, 0x0b, + 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x69, 0x0b, 0x80, + 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x0c, + 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, + 0x51, 0x0b, 0x80, 0x0c, 0x2a, 0x65, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x40, + 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x54, 0x0b, + 0x80, 0x0c, 0x2e, 0x6d, 0x23, 0x80, 0x18, 0x2c, 0x4d, 0x0b, 0x80, 0x0c, 0x2e, 0x69, 0x23, 0x80, + 0x24, 0x2c, 0x69, 0x05, 0x80, 0x06, 0x2a, 0x33, 0x05, 0x80, 0x06, 0x2a, 0x52, 0x05, 0x80, 0x06, + 0x2a, 0x25, 0x05, 0x80, 0x06, 0x2a, 0x69, 0x05, 0x80, 0x06, 0x2a, 0x48, 0x05, 0x80, 0x06, 0x2a, + 0x5c, 0x05, 0x80, 0x06, 0x2a, 0x38, 0x05, 0x80, 0x06, 0x2a, 0x67, 0x0b, 0x80, 0x0c, 0x2a, 0x1e, + 0x0b, 0x80, 0x0c, 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x6d, 0x0b, + 0x80, 0x0c, 0x2a, 0x30, 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, + 0x0c, 0x2a, 0x65, 0x0b, 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, + 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, + 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x39, + 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, + 0x80, 0x0c, 0x2a, 0x32, 0x0b, 0x80, 0x0c, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, + 0x0c, 0x2a, 0x69, 0x0b, 0x80, 0x0c, 0x2e, 0x7e, 0x0b, 0x80, 0x0c, 0x2c, 0x58, 0x0b, 0x80, 0x0c, + 0x2a, 0x4a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, 0x0b, 0x80, 0x0c, 0x2a, + 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x61, 0x0b, 0x80, 0x0c, 0x2a, 0x1d, + 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, + 0x80, 0x0c, 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, + 0x0c, 0x2a, 0x69, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2e, 0x78, 0x77, 0x80, 0x30, + 0x2c, 0x1a, 0x17, 0x80, 0x18, 0x2c, 0x30, 0x17, 0x80, 0x18, 0x2c, 0x1c, 0x17, 0x80, 0x18, 0x2c, + 0x32, 0x17, 0x80, 0x18, 0x2c, 0x20, 0x17, 0x80, 0x18, 0x2c, 0x3e, 0x17, 0x80, 0x18, 0x2c, 0x2e, + 0x17, 0x80, 0x24, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, + 0x80, 0x18, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, + 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x3f, 0x0b, 0x80, 0x0c, 0x2e, 0x7d, 0x17, 0x80, 0x18, + 0x2c, 0x65, 0x0b, 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, + 0x36, 0x0b, 0x80, 0x0c, 0x95, 0x95, 0x17, 0x00, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, 0x0b, + 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x18, 0x2a, 0x1d, 0x0b, 0x80, + 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, + 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2e, 0x73, 0x17, 0x80, 0x18, 0x2c, 0x69, 0x0b, 0x80, 0x0c, 0x2a, + 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x0c, 0x2a, 0x77, + 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, 0x0b, + 0x80, 0x18, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, + 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x54, 0x0b, 0x80, 0x0c, 0x2e, 0x7a, 0x23, 0x80, 0x24, + 0x2e, 0x7c, 0x23, 0x80, 0x24, 0x95, 0xd7, 0x17, 0x00, 0x95, 0x1e, 0x18, 0x00, 0x2a, 0x74, 0x0b, + 0x80, 0x0c, 0x2a, 0x29, 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, + 0x18, 0x2a, 0x1d, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, + 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2e, 0x78, 0x17, 0x80, 0x18, 0x2c, + 0x69, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x57, + 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, + 0x80, 0x0c, 0x2a, 0x51, 0x0b, 0x80, 0x18, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, + 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x54, 0x0b, 0x80, 0x0c, + 0x2e, 0x7e, 0x17, 0x80, 0x18, 0x2c, 0x5a, 0x0b, 0x80, 0x0c, 0x2e, 0x7b, 0x23, 0x80, 0x24, 0x2a, + 0x61, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, 0x57, + 0x0b, 0x80, 0x18, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, + 0x80, 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x30, 0x0b, 0x80, 0x0c, 0x2e, 0x74, 0x17, 0x80, + 0x18, 0x2c, 0x65, 0x0b, 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, + 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x95, 0x95, 0x17, 0x00, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, + 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x18, 0x2a, 0x1d, 0x0b, + 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, + 0x0c, 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2e, 0x7a, 0x17, 0x80, 0x18, 0x2c, 0x69, 0x0b, 0x80, 0x0c, + 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x0c, 0x2a, + 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, + 0x0b, 0x80, 0x18, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, + 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x54, 0x0b, 0x80, 0x0c, 0x2e, 0x76, 0x17, 0x80, + 0x18, 0x2c, 0x4b, 0x0b, 0x80, 0x0c, 0x2e, 0x7c, 0x23, 0x80, 0x24, 0x2a, 0x69, 0x0b, 0x80, 0x0c, + 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x18, 0x2a, + 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x6d, + 0x0b, 0x80, 0x0c, 0x2a, 0x30, 0x0b, 0x80, 0x0c, 0x2e, 0x72, 0x17, 0x80, 0x18, 0x2c, 0x65, 0x0b, + 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x36, 0x0b, 0x80, + 0x0c, 0x95, 0x1e, 0x18, 0x00, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, 0x0b, 0x80, 0x0c, 0x2a, + 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x18, 0x2a, 0x1d, 0x0b, 0x80, 0x0c, 0x2e, 0x78, + 0x17, 0x80, 0x18, 0x2c, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2e, 0x78, 0x17, + 0x80, 0x18, 0x2c, 0x69, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, + 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x0c, + 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, 0x0b, 0x80, 0x18, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, + 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x54, + 0x0b, 0x80, 0x0c, 0x2e, 0x6e, 0x17, 0x80, 0x18, 0x2c, 0x3f, 0x0b, 0x80, 0x0c, 0x2e, 0x65, 0x0b, + 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, 0x0b, 0x80, 0x0c, 0x95, 0xd7, 0x17, 0x00, + 0x95, 0x65, 0x18, 0x00, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, 0x0b, 0x80, 0x0c, 0x2a, 0x38, + 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x18, 0x2a, 0x1d, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, + 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x3e, 0x0b, 0x80, + 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x69, 0x0b, 0x80, 0x0c, + 0x2a, 0x45, 0x0b, 0x80, 0x24, 0x95, 0x65, 0x18, 0x00, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, 0x47, + 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, 0x0b, 0x80, 0x18, 0x2a, 0x40, 0x0b, + 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, + 0x0c, 0x2a, 0x54, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x18, + 0x2a, 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x2a, 0x0b, 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, + 0x69, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, 0x57, + 0x0b, 0x80, 0x18, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, + 0x80, 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x30, 0x0b, 0x80, 0x0c, 0x2e, 0x65, 0x17, 0x80, + 0x18, 0x2c, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x34, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, + 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x95, 0x1e, 0x18, 0x00, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x29, + 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x18, 0x2a, 0x1d, 0x0b, + 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x0c, 0x2a, 0x5a, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, + 0x0c, 0x2a, 0x3e, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x3b, 0x0b, 0x80, 0x24, + 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, 0x80, 0x0c, 0x2a, + 0x47, 0x0b, 0x80, 0x0c, 0x2a, 0x3c, 0x0b, 0x80, 0x0c, 0x2a, 0x51, 0x0b, 0x80, 0x18, 0x2a, 0x40, + 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x0c, 0x2a, 0x45, 0x0b, 0x80, 0x0c, 0x2a, 0x77, 0x0b, + 0x80, 0x0c, 0x2a, 0x54, 0x0b, 0x80, 0x0c, 0x2e, 0x6a, 0x17, 0x80, 0x18, 0x2c, 0x5a, 0x0b, 0x80, + 0x0c, 0x2a, 0x47, 0x0b, 0x80, 0x24, 0x2c, 0x6a, 0x81, 0x0f, 0x80, 0x84, 0x40, 0x94, 0xeb, 0x10, + 0x00, 0x80, 0x81, 0x40, 0xff, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, + 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x18, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, + 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x32, 0x0b, + 0x80, 0x0c, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x24, 0x2a, 0x2a, 0x0b, 0x80, + 0x0c, 0x2a, 0x4b, 0x0b, 0x80, 0x0c, 0xfd, 0x2a, 0x69, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, + 0x0c, 0x2a, 0x2d, 0x0b, 0x80, 0x0c, 0x2a, 0x57, 0x0b, 0x80, 0x18, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, + 0x2a, 0x49, 0x0b, 0x80, 0x0c, 0x2a, 0x31, 0x0b, 0x80, 0x0c, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, + 0x30, 0x0b, 0x80, 0x0c, 0x2a, 0x38, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x18, 0x2a, 0x34, + 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0xfd, 0x2a, 0x6d, + 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, + 0x80, 0x18, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, + 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x32, 0x0b, 0x80, 0x0c, 0x2a, 0x1e, 0x0b, 0x80, 0x0c, + 0x2a, 0x42, 0x0b, 0x80, 0x18, 0x2a, 0x36, 0x0b, 0x80, 0x0c, 0x2a, 0x2a, 0x0b, 0x80, 0x0c, 0x2a, + 0x4b, 0x0b, 0x80, 0x0c, 0xfd, 0x2a, 0x6d, 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, + 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x40, 0x0b, 0x80, 0x18, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x42, + 0x0b, 0x80, 0x0c, 0x2a, 0x39, 0x0b, 0x80, 0x0c, 0x2a, 0x74, 0x0b, 0x80, 0x0c, 0x2a, 0x32, 0x0b, + 0x80, 0x0c, 0x2e, 0x66, 0x17, 0x80, 0x18, 0x2c, 0x42, 0x0b, 0x80, 0x0c, 0x2a, 0x36, 0x0b, 0x80, + 0x0c, 0x2a, 0x2a, 0x0b, 0x80, 0x0c, 0x2a, 0x4b, 0x0b, 0x80, 0x0c, 0xfd, 0xc7, 0x00, 0x81, 0x0c, + 0xc1, 0x52, 0xc0, 0x27, 0xc4, 0x00, 0xca, 0x00, 0x80, 0x18, 0x46, 0x4c, 0x2f, 0x80, 0x30, 0x46, + 0x44, 0x2f, 0x80, 0x30, 0x46, 0x44, 0x2f, 0x80, 0x30, 0x46, 0x41, 0x2f, 0x80, 0x30, 0x46, 0x46, + 0x2f, 0x80, 0x30, 0x46, 0x46, 0x2f, 0x80, 0x30, 0x46, 0x45, 0x2f, 0x80, 0x30, 0x46, 0x44, 0x2f, + 0x80, 0x30, 0x46, 0x45, 0x2f, 0x80, 0x30, 0x46, 0x43, 0x2f, 0x80, 0x30, 0x46, 0x41, 0x2f, 0x80, + 0x30, 0x46, 0x43, 0x2f, 0x80, 0x30, 0x46, 0x44, 0x2f, 0x80, 0x30, 0x46, 0x44, 0x2f, 0x80, 0x30, + 0x46, 0x49, 0x2f, 0x80, 0x30, 0x46, 0x48, 0x2f, 0x80, 0x30, 0x46, 0x49, 0x2f, 0x80, 0x30, 0x46, + 0x46, 0x2f, 0x80, 0x30, 0x46, 0x42, 0x2f, 0x80, 0x30, 0x46, 0x47, 0x2f, 0x80, 0x30, 0x46, 0x48, + 0x2f, 0x80, 0x30, 0x46, 0x48, 0x2f, 0x80, 0x30, 0x46, 0x4e, 0x2f, 0x80, 0x30, 0x46, 0x47, 0x2f, + 0x80, 0x30, 0x46, 0x46, 0x2f, 0x80, 0x30, 0x46, 0x4a, 0x2f, 0x80, 0x30, 0x46, 0x44, 0x2f, 0x80, + 0x30, 0x46, 0x49, 0x2f, 0x80, 0x30, 0x46, 0x48, 0x2f, 0x80, 0x30, 0x46, 0x48, 0x2f, 0x80, 0x30, + 0x46, 0x4a, 0x2f, 0x80, 0x30, 0x46, 0x49, 0x17, 0x80, 0x18, 0x95, 0xcd, 0x19, 0x00, 0x95, 0x1e, + 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0xcd, 0x19, 0x00, 0x95, 0x1e, + 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0xcd, 0x19, 0x00, 0x95, 0x1e, + 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0xcd, 0x19, 0x00, 0x95, 0x1e, + 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0x1e, 0x1a, 0x00, 0x95, 0x6f, + 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xcd, 0x19, 0x00, 0x95, 0x1e, + 0x1a, 0x00, 0x95, 0x6f, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x95, 0xc0, 0x1a, 0x00, 0x46, 0x7d, + 0x81, 0x0f, 0x80, 0x84, 0x40, 0x94, 0xae, 0x18, 0x00, 0x80, 0x81, 0x40, 0xff, 0x46, 0x28, 0x0b, + 0x80, 0x0c, 0x46, 0x1f, 0x0b, 0x80, 0x0c, 0x46, 0x4a, 0x0b, 0x80, 0x0c, 0x46, 0x26, 0x0b, 0x80, + 0x0c, 0x46, 0x1d, 0x0b, 0x80, 0x0c, 0x46, 0x24, 0x0b, 0x80, 0x0c, 0x46, 0x50, 0x0b, 0x80, 0x0c, + 0x46, 0x23, 0x0b, 0x80, 0x0c, 0x46, 0x28, 0x0b, 0x80, 0x0c, 0x46, 0x21, 0x0b, 0x80, 0x0c, 0x46, + 0x50, 0x0b, 0x80, 0x0c, 0x46, 0x26, 0x0b, 0x80, 0x0c, 0x46, 0x2d, 0x0b, 0x80, 0x0c, 0x46, 0x2f, + 0x0b, 0x80, 0x0c, 0x46, 0x59, 0x0b, 0x80, 0x0c, 0x46, 0x27, 0x0b, 0x80, 0x0c, 0xfd, 0x46, 0x1f, + 0x0b, 0x80, 0x0c, 0x46, 0x22, 0x0b, 0x80, 0x0c, 0x46, 0x64, 0x0b, 0x80, 0x0c, 0x46, 0x26, 0x0b, + 0x80, 0x0c, 0x46, 0x25, 0x0b, 0x80, 0x0c, 0x46, 0x26, 0x0b, 0x80, 0x0c, 0x46, 0x54, 0x0b, 0x80, + 0x0c, 0x46, 0x30, 0x0b, 0x80, 0x0c, 0x46, 0x2d, 0x0b, 0x80, 0x0c, 0x46, 0x21, 0x0b, 0x80, 0x0c, + 0x46, 0x5e, 0x0b, 0x80, 0x0c, 0x46, 0x2e, 0x0b, 0x80, 0x0c, 0x46, 0x27, 0x0b, 0x80, 0x0c, 0x46, + 0x20, 0x0b, 0x80, 0x0c, 0x46, 0x5b, 0x0b, 0x80, 0x0c, 0x46, 0x34, 0x0b, 0x80, 0x0c, 0xfd, 0x46, + 0x29, 0x0b, 0x80, 0x0c, 0x46, 0x1b, 0x0b, 0x80, 0x0c, 0x46, 0x56, 0x0b, 0x80, 0x0c, 0x46, 0x1a, + 0x0b, 0x80, 0x0c, 0x46, 0x2f, 0x0b, 0x80, 0x0c, 0x46, 0x2b, 0x0b, 0x80, 0x0c, 0x46, 0x54, 0x0b, + 0x80, 0x0c, 0x46, 0x22, 0x0b, 0x80, 0x0c, 0x46, 0x32, 0x0b, 0x80, 0x0c, 0x46, 0x24, 0x0b, 0x80, + 0x0c, 0x46, 0x56, 0x0b, 0x80, 0x0c, 0x46, 0x2f, 0x0b, 0x80, 0x0c, 0x46, 0x2b, 0x0b, 0x80, 0x0c, + 0x46, 0x22, 0x0b, 0x80, 0x0c, 0x46, 0x5b, 0x0b, 0x80, 0x0c, 0x46, 0x21, 0x0b, 0x80, 0x0c, 0xfd, + 0x46, 0x37, 0x0b, 0x80, 0x0c, 0x46, 0x37, 0x0b, 0x80, 0x0c, 0x46, 0x5e, 0x0b, 0x80, 0x0c, 0x46, + 0x12, 0x0b, 0x80, 0x0c, 0x46, 0x35, 0x0b, 0x80, 0x0c, 0x46, 0x24, 0x0b, 0x80, 0x0c, 0x46, 0x48, + 0x0b, 0x80, 0x0c, 0x46, 0x26, 0x0b, 0x80, 0x0c, 0x46, 0x2b, 0x0b, 0x80, 0x0c, 0x46, 0x1d, 0x0b, + 0x80, 0x0c, 0x46, 0x50, 0x0b, 0x80, 0x0c, 0x46, 0x1b, 0x0b, 0x80, 0x0c, 0x46, 0x37, 0x0b, 0x80, + 0x0c, 0x46, 0x2e, 0x0b, 0x80, 0x0c, 0x46, 0x59, 0x0b, 0x80, 0x0c, 0x46, 0x19, 0x0b, 0x80, 0x0c, + 0xfd, 0xff, 0x00, 0x00, +}; + +const u8 sound_bank_data[] ATTRIBUTE_ALIGN(32) = +{ + 0x53, 0x42, 0x4e, 0x4b, 0xff, 0xfe, 0x02, 0x00, 0x84, 0x04, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x44, 0x41, 0x54, 0x41, 0x74, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x11, 0x64, 0x04, 0x00, + 0x01, 0x3c, 0x02, 0x00, 0x01, 0x46, 0x02, 0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x24, 0x04, 0x00, + 0x01, 0x50, 0x02, 0x00, 0x01, 0x5a, 0x02, 0x00, 0x11, 0x44, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0xd8, 0x03, 0x00, 0x01, 0x64, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6e, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x47, 0x7f, 0x7f, 0x7f, 0x7b, 0x40, 0x09, 0x00, 0x00, 0x00, 0x47, 0x7f, 0x7f, 0x7f, 0x7b, 0x40, + 0x10, 0x00, 0x00, 0x00, 0x4b, 0x7f, 0x7f, 0x7f, 0x64, 0x40, 0x0f, 0x00, 0x00, 0x00, 0x58, 0x7f, + 0x7f, 0x7f, 0x64, 0x40, 0x03, 0x00, 0x00, 0x00, 0x42, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x24, 0x41, + 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x24, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x7f, + 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x7f, 0x7f, 0x7f, 0x78, 0x40, + 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, + 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, + 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, + 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, + 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, + 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, + 0x01, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x78, 0x40, 0x01, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x30, 0x7f, 0x7f, 0x7f, 0x78, 0x22, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x7f, + 0x7f, 0x7f, 0x78, 0x22, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x7f, 0x7f, 0x7f, 0x78, 0x22, + 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0x7f, 0x7f, 0x7f, 0x78, 0x5e, 0x01, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x34, 0x7f, 0x7f, 0x7f, 0x78, 0x5e, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0x7f, + 0x7f, 0x7f, 0x78, 0x5e, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, + 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, + 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, + 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, + 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, + 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x78, 0x36, 0x01, 0x00, 0x11, 0x00, + 0x00, 0x00, 0x41, 0x7f, 0x7f, 0x7f, 0x78, 0x37, 0x2b, 0x2d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2a, 0x7f, 0x7f, 0x7f, 0x7b, 0x40, 0x01, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x2c, 0x7f, 0x7f, 0x7f, 0x7b, 0x40, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2e, 0x7f, + 0x7f, 0x7f, 0x7b, 0x40, 0x3f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x7d, 0x40, 0x01, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x43, 0x7f, + 0x7f, 0x7f, 0x7d, 0x40, 0x3f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x00, 0x00, 0x37, 0x7f, 0x7f, 0x7f, 0x7d, 0x40, 0x01, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x43, 0x7f, + 0x7f, 0x7f, 0x7d, 0x40, 0x53, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0c, 0x00, + 0x00, 0x00, 0x4f, 0x7f, 0x7f, 0x7f, 0x64, 0x40, 0x01, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5b, 0x7f, + 0x7f, 0x7f, 0x64, 0x40, 0x3b, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x28, 0x7f, 0x7f, 0x7f, 0x7b, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f, + 0x7f, 0x7f, 0x7b, 0x40, +}; + +const u8 sound_wave_data[] ATTRIBUTE_ALIGN(32) = +{ + 0x53, 0x57, 0x41, 0x52, 0xff, 0xfe, 0x01, 0x00, 0x64, 0x7f, 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x44, 0x41, 0x54, 0x41, 0x54, 0x7f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x30, 0x0f, 0x00, 0x00, 0x0c, 0x23, 0x00, 0x00, 0xc0, 0x2e, 0x00, 0x00, 0x78, 0x38, 0x00, 0x00, + 0x08, 0x8a, 0x00, 0x00, 0x18, 0xac, 0x00, 0x00, 0xf8, 0xc4, 0x00, 0x00, 0x48, 0x04, 0x01, 0x00, + 0xd8, 0x23, 0x01, 0x00, 0x34, 0x5c, 0x01, 0x00, 0xc8, 0x92, 0x01, 0x00, 0xe4, 0xad, 0x01, 0x00, + 0x84, 0xd7, 0x01, 0x00, 0x40, 0xf7, 0x01, 0x00, 0x90, 0x1a, 0x02, 0x00, 0xe0, 0x3b, 0x02, 0x00, + 0xb4, 0x5e, 0x02, 0x00, 0x02, 0x01, 0x52, 0x7d, 0x0a, 0x02, 0x47, 0x03, 0x61, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0xcf, 0x89, 0xa8, 0x80, 0x9b, 0x09, 0x98, 0x19, 0xaa, 0x99, 0xaa, 0x99, + 0xaa, 0x90, 0x90, 0x0b, 0xbc, 0x00, 0x19, 0xc9, 0x98, 0xba, 0xa9, 0xbb, 0xa1, 0x8c, 0x2c, 0xb3, + 0x0b, 0xac, 0xac, 0xb2, 0x0b, 0x19, 0xb9, 0xb9, 0x8c, 0xc9, 0xbb, 0xb9, 0x09, 0xba, 0xd9, 0xa9, + 0xab, 0xdb, 0xc9, 0x9a, 0x9a, 0xb9, 0xbb, 0x9d, 0xc9, 0x99, 0xdc, 0x9b, 0xeb, 0xbb, 0x9d, 0xba, + 0xab, 0xa9, 0xbe, 0xcb, 0xdb, 0xcb, 0xba, 0xaa, 0xa8, 0xcf, 0xaa, 0xba, 0xdb, 0xcc, 0xaa, 0x99, + 0xcb, 0xbd, 0xcb, 0xcb, 0xba, 0xdb, 0xbd, 0xaa, 0x9a, 0xcc, 0xcc, 0xba, 0xcc, 0xbb, 0xaa, 0xbb, + 0xbc, 0xcd, 0xcb, 0xba, 0xbd, 0xca, 0xab, 0xab, 0xbc, 0xbc, 0xcb, 0xdb, 0xbc, 0xba, 0xbb, 0xbc, + 0xbd, 0xbc, 0xbb, 0x9c, 0xdb, 0xcb, 0xbb, 0xaa, 0xbb, 0xba, 0xcc, 0xbb, 0xbc, 0xbb, 0xaa, 0xbb, + 0xbc, 0xfa, 0x8b, 0xca, 0xad, 0x82, 0xbf, 0x1b, 0x15, 0x89, 0xb9, 0xfa, 0x6a, 0xa3, 0x8f, 0x17, + 0x89, 0x00, 0x03, 0x2a, 0x96, 0x9f, 0x02, 0x19, 0x26, 0xa8, 0x0b, 0x92, 0x01, 0x9f, 0x23, 0x29, + 0xe9, 0x20, 0x80, 0x23, 0x88, 0x14, 0xbf, 0x11, 0x11, 0x09, 0x04, 0x9a, 0x81, 0x68, 0xb1, 0x58, + 0xa1, 0x1b, 0x92, 0xaa, 0x32, 0xc8, 0x62, 0x24, 0xc9, 0x19, 0x24, 0xb0, 0x9a, 0x41, 0x22, 0x12, + 0xcd, 0x28, 0x18, 0x32, 0x91, 0x0a, 0x02, 0xdd, 0x09, 0x42, 0x24, 0xc8, 0xbd, 0x30, 0x25, 0xa0, + 0xaa, 0x09, 0x42, 0xa1, 0x8c, 0x12, 0x89, 0x98, 0x10, 0x90, 0x23, 0xed, 0x9a, 0x52, 0x02, 0xc9, + 0x19, 0xd8, 0xab, 0x61, 0x14, 0xa9, 0xad, 0x29, 0x01, 0x21, 0x98, 0xdc, 0x2a, 0x83, 0xa9, 0x9a, + 0x54, 0xb8, 0xbc, 0x48, 0x14, 0x01, 0xba, 0xdb, 0x78, 0x83, 0xbc, 0x19, 0x15, 0x80, 0xbb, 0x58, + 0x92, 0xba, 0x29, 0x91, 0x21, 0x01, 0x64, 0xa1, 0x09, 0xb9, 0xbe, 0x40, 0x16, 0x91, 0xaa, 0x20, + 0x12, 0xba, 0x0a, 0x23, 0xd1, 0xad, 0x21, 0x54, 0x92, 0xbc, 0x8a, 0x08, 0x30, 0x93, 0x28, 0x83, + 0xda, 0x0a, 0xca, 0x9c, 0x73, 0x14, 0x98, 0x8a, 0x98, 0xda, 0xac, 0x43, 0x22, 0x90, 0xa9, 0x8f, + 0x88, 0x18, 0x88, 0xc9, 0x8e, 0x32, 0x31, 0x13, 0x99, 0xa9, 0xff, 0x29, 0x12, 0x18, 0x20, 0xc0, + 0x8c, 0x00, 0x31, 0xc9, 0x99, 0x46, 0xb8, 0x49, 0x13, 0xab, 0x71, 0xc1, 0x1b, 0x24, 0x91, 0xcb, + 0x1a, 0x27, 0xb8, 0x1b, 0x25, 0x98, 0x09, 0x11, 0xa8, 0x48, 0x92, 0xce, 0x0a, 0x44, 0x91, 0x0a, + 0x11, 0xb8, 0x0c, 0x21, 0x02, 0x88, 0x22, 0xd1, 0x9f, 0x52, 0x91, 0xaa, 0x18, 0xb0, 0x8e, 0x52, + 0x02, 0xa9, 0x9c, 0x18, 0x80, 0x32, 0xa2, 0xbd, 0x41, 0xb1, 0xaf, 0x19, 0x43, 0x82, 0xbb, 0x49, + 0x14, 0xa9, 0xcd, 0x1b, 0x16, 0x18, 0xd9, 0x09, 0x01, 0x21, 0xa2, 0x8b, 0x91, 0xbf, 0x29, 0x46, + 0x01, 0xb9, 0xac, 0x10, 0x33, 0x88, 0x89, 0x21, 0xd0, 0xbc, 0x0a, 0x57, 0x01, 0xab, 0x80, 0x3a, + 0x06, 0x9a, 0x99, 0x88, 0x31, 0x04, 0xdc, 0x39, 0x12, 0x08, 0xca, 0x29, 0x15, 0xca, 0x8b, 0x32, + 0x33, 0xb2, 0x9f, 0x51, 0x91, 0x0a, 0xa0, 0x08, 0x99, 0x18, 0x55, 0x81, 0x09, 0xd2, 0x2c, 0xa0, + 0x46, 0x98, 0xaa, 0x30, 0x12, 0xb9, 0x08, 0x08, 0x02, 0xcb, 0x48, 0x34, 0x01, 0xb0, 0xaf, 0x48, + 0x04, 0x9a, 0x22, 0x98, 0x9b, 0x24, 0xda, 0x9a, 0x28, 0x34, 0x11, 0x40, 0x96, 0xcf, 0x10, 0x13, + 0xa9, 0x30, 0x03, 0xbe, 0x18, 0x31, 0xb3, 0xaf, 0x00, 0x18, 0x32, 0x35, 0xdb, 0x28, 0x23, 0xfc, + 0x19, 0x31, 0xb1, 0x8d, 0x21, 0x01, 0xba, 0x38, 0xb3, 0xaf, 0x53, 0x92, 0xba, 0x50, 0x04, 0xb9, + 0x28, 0x82, 0xbe, 0x00, 0x43, 0x91, 0x88, 0x9b, 0x89, 0x12, 0x32, 0xc8, 0x72, 0x05, 0xcd, 0x1a, + 0x32, 0xa0, 0xbb, 0x18, 0x31, 0x12, 0x22, 0xf9, 0x1a, 0x14, 0xdd, 0x1a, 0x34, 0x82, 0xad, 0x09, + 0x21, 0xa1, 0xbe, 0x40, 0x82, 0x10, 0xa0, 0xac, 0x11, 0x80, 0x09, 0x44, 0x83, 0xfb, 0x9d, 0x38, + 0x05, 0xa8, 0xaa, 0x20, 0x14, 0xa8, 0x0b, 0x34, 0xb8, 0xbb, 0xac, 0x60, 0x25, 0x80, 0xda, 0x1a, + 0x33, 0x91, 0xbd, 0x19, 0x34, 0x81, 0xdb, 0x19, 0x22, 0xa0, 0x0b, 0x31, 0xa1, 0xaf, 0x12, 0x11, + 0x21, 0x02, 0xcd, 0x18, 0x10, 0x14, 0xdc, 0x1a, 0x26, 0xa9, 0x08, 0x29, 0x83, 0xd9, 0x0c, 0x53, + 0x81, 0xba, 0x99, 0x18, 0x25, 0x90, 0x09, 0xc9, 0x0a, 0x73, 0x14, 0xa0, 0xbe, 0x0a, 0x12, 0x30, + 0x27, 0xa9, 0x09, 0x88, 0xa1, 0xab, 0x75, 0x92, 0xac, 0x30, 0x24, 0xa9, 0xab, 0x99, 0x18, 0x35, + 0x90, 0x19, 0x21, 0x83, 0xfd, 0x48, 0x14, 0xdc, 0x38, 0x32, 0xa8, 0x0b, 0xa0, 0xab, 0x64, 0x02, + 0x98, 0xb9, 0x20, 0xb3, 0x8f, 0x34, 0xb0, 0x9c, 0x22, 0x88, 0x18, 0x12, 0xdb, 0x9a, 0x60, 0x14, + 0xaa, 0x31, 0xe2, 0x9d, 0x53, 0xa1, 0x8b, 0x13, 0x89, 0x01, 0x9a, 0x22, 0xdd, 0x38, 0x06, 0xa8, + 0x18, 0x81, 0xcc, 0x28, 0x02, 0x80, 0x08, 0x12, 0xd8, 0x1a, 0x14, 0xca, 0x28, 0x83, 0xba, 0x61, + 0x13, 0x98, 0xdb, 0x9a, 0x10, 0x81, 0xba, 0x49, 0x15, 0x90, 0xdd, 0x8b, 0x21, 0x01, 0x20, 0x25, + 0xd9, 0xab, 0xda, 0x8c, 0x63, 0x12, 0x01, 0xbb, 0x29, 0x13, 0xed, 0x8a, 0x32, 0x82, 0xdb, 0x18, + 0x44, 0xa0, 0xac, 0xa9, 0x08, 0x29, 0x23, 0x22, 0x83, 0x20, 0xe1, 0xbf, 0x38, 0x12, 0x90, 0xaa, + 0x52, 0xd9, 0x8b, 0x42, 0x13, 0xa8, 0xbd, 0x8b, 0x44, 0x98, 0x98, 0x38, 0x84, 0xbd, 0x50, 0x03, + 0x88, 0xab, 0x12, 0xc9, 0x6a, 0x04, 0xab, 0x0a, 0x26, 0xa9, 0x18, 0x82, 0xbf, 0x19, 0x43, 0x16, + 0xcb, 0x19, 0x81, 0x19, 0x16, 0xb9, 0x1a, 0x11, 0xa9, 0x11, 0x72, 0x93, 0xcf, 0x19, 0x34, 0xa8, + 0x28, 0xb0, 0x8c, 0x12, 0xba, 0x61, 0x81, 0x09, 0xa1, 0x3c, 0x37, 0xdc, 0x09, 0x21, 0x00, 0x20, + 0xb2, 0x8d, 0x22, 0x80, 0x9b, 0x89, 0x42, 0xc9, 0x69, 0x34, 0xb8, 0xac, 0x99, 0x21, 0x01, 0x32, + 0x04, 0xcd, 0x28, 0x93, 0x39, 0x34, 0xf0, 0x8d, 0x31, 0x32, 0xa8, 0xbc, 0x09, 0x32, 0x32, 0x81, + 0xab, 0x00, 0x91, 0xaf, 0x31, 0x22, 0xd1, 0xbd, 0x49, 0x27, 0xb0, 0xaa, 0x10, 0x88, 0x20, 0x88, + 0x47, 0xa0, 0x9c, 0x30, 0x01, 0x20, 0xf9, 0x8e, 0x32, 0x01, 0x99, 0xa9, 0x00, 0x02, 0x8a, 0x00, + 0x10, 0x52, 0xf0, 0xae, 0x41, 0x13, 0xbb, 0x0b, 0x43, 0x91, 0xaa, 0x10, 0x92, 0xbc, 0x51, 0x82, + 0xac, 0x31, 0xda, 0x9a, 0x73, 0x84, 0xac, 0x0a, 0x11, 0x00, 0x98, 0x20, 0x90, 0x99, 0xaa, 0x8c, + 0x57, 0xb0, 0xbb, 0x10, 0x43, 0x81, 0x09, 0x22, 0xfb, 0x1a, 0x82, 0xbe, 0x58, 0x02, 0xa9, 0x20, + 0xb0, 0x8b, 0x81, 0x70, 0xa3, 0x9f, 0x22, 0xc9, 0x39, 0x15, 0xaa, 0x10, 0xb1, 0x9c, 0x31, 0x23, + 0xb8, 0xef, 0x30, 0x05, 0xaa, 0x18, 0x90, 0x19, 0x13, 0xbc, 0x10, 0x01, 0xeb, 0x1a, 0x47, 0x91, + 0xac, 0x18, 0x81, 0x21, 0x82, 0xab, 0x01, 0x8a, 0x23, 0x11, 0x62, 0xb4, 0xff, 0x29, 0x24, 0xa8, + 0x8a, 0x81, 0x18, 0x08, 0x81, 0x09, 0x01, 0x21, 0x11, 0xcb, 0x80, 0xdf, 0x08, 0x63, 0x24, 0xb9, + 0xac, 0x30, 0x91, 0x8d, 0x33, 0xa8, 0x9b, 0x10, 0x76, 0x81, 0xbb, 0x9a, 0xba, 0x73, 0x16, 0xa8, + 0x09, 0x81, 0x98, 0x88, 0x18, 0x14, 0xda, 0x2a, 0x35, 0x80, 0xb0, 0xbf, 0x38, 0x15, 0x98, 0x0a, + 0x11, 0x01, 0xca, 0x29, 0x34, 0xba, 0x38, 0xa1, 0x59, 0x37, 0xd8, 0x9d, 0x21, 0x12, 0xa0, 0x0a, + 0x33, 0xd8, 0x8c, 0x22, 0xa0, 0x1a, 0xa1, 0x8b, 0x56, 0x02, 0xb9, 0x9c, 0x38, 0x82, 0x99, 0x48, + 0x06, 0xaa, 0x18, 0x88, 0x41, 0xa3, 0xaf, 0x18, 0x21, 0x11, 0xc9, 0x9c, 0x11, 0x8a, 0x52, 0xa0, + 0x9b, 0x43, 0xc9, 0x29, 0x15, 0xcb, 0x8a, 0x00, 0x52, 0x83, 0x19, 0xa0, 0xdf, 0x19, 0x12, 0x98, + 0x88, 0x80, 0x88, 0x51, 0x83, 0xcf, 0x29, 0x01, 0xa9, 0x09, 0x13, 0xab, 0x32, 0xc0, 0x49, 0x03, + 0xfb, 0xaf, 0x20, 0x24, 0xa1, 0xbc, 0x30, 0x04, 0x99, 0x08, 0xa1, 0x9d, 0x11, 0xaa, 0x41, 0x34, + 0xd8, 0x9e, 0x51, 0x02, 0xcb, 0x8a, 0x10, 0x23, 0xa9, 0x38, 0x03, 0xcf, 0x20, 0x00, 0x31, 0x83, + 0xef, 0x09, 0x22, 0x22, 0xb8, 0xac, 0x32, 0xc0, 0x1a, 0x25, 0xc0, 0x9c, 0x18, 0x32, 0x92, 0x9a, + 0x90, 0xad, 0x63, 0x92, 0xac, 0x21, 0x12, 0x88, 0x10, 0x11, 0xf8, 0xae, 0x40, 0x34, 0x90, 0xd9, + 0xac, 0x40, 0x14, 0xaa, 0x18, 0x02, 0xa9, 0x19, 0x25, 0xa2, 0xce, 0x89, 0x21, 0x53, 0x14, 0xda, + 0x8b, 0x22, 0x91, 0xab, 0x38, 0x35, 0xc8, 0x0b, 0x26, 0xb8, 0x9a, 0xaa, 0x38, 0x46, 0x91, 0x9a, + 0x09, 0x43, 0xb1, 0x9c, 0x42, 0x90, 0xaa, 0x30, 0x43, 0x14, 0xfc, 0x9b, 0x33, 0x23, 0xb8, 0x9d, + 0x21, 0x91, 0x08, 0x20, 0x01, 0x41, 0xa0, 0x9b, 0x65, 0x02, 0xda, 0x9d, 0x21, 0x23, 0x80, 0x18, + 0xa0, 0x9b, 0x11, 0xa9, 0x42, 0xfb, 0x8a, 0x50, 0x15, 0x88, 0xa9, 0x9b, 0x10, 0x81, 0x51, 0x14, + 0xa9, 0x9a, 0x00, 0x51, 0x05, 0xda, 0x9a, 0x30, 0x25, 0xc9, 0x9b, 0x00, 0xb9, 0x10, 0x11, 0x36, + 0xc1, 0xac, 0x30, 0x83, 0x98, 0xfc, 0x8b, 0x45, 0x92, 0xab, 0x10, 0x00, 0x90, 0xab, 0x40, 0xa3, + 0xbf, 0x89, 0x51, 0x23, 0xa0, 0xbe, 0x08, 0x22, 0xa2, 0xbf, 0x18, 0x25, 0xc9, 0x29, 0x23, 0xd8, + 0x9a, 0x89, 0x42, 0xa1, 0xba, 0x9a, 0x18, 0x57, 0x83, 0xcb, 0x89, 0x99, 0x18, 0x53, 0x02, 0xda, + 0xac, 0x31, 0x34, 0x80, 0xda, 0x9d, 0x32, 0x91, 0x9c, 0x52, 0xa1, 0xbb, 0x29, 0x55, 0x91, 0xad, + 0x18, 0x01, 0x20, 0x81, 0xbd, 0x39, 0x36, 0xa8, 0xab, 0x30, 0xb1, 0xbf, 0x61, 0x23, 0xa9, 0xbc, + 0x0a, 0x52, 0x12, 0xb9, 0x9a, 0x18, 0x34, 0xb8, 0x18, 0x11, 0xda, 0x9c, 0x62, 0x44, 0x91, 0xbd, + 0x0a, 0x21, 0x02, 0xb9, 0x30, 0x25, 0xa8, 0xab, 0x21, 0xc0, 0xcc, 0x19, 0x73, 0x33, 0xa1, 0xbe, + 0x18, 0x11, 0x00, 0xaa, 0x09, 0x34, 0x13, 0x89, 0x00, 0xd8, 0xcc, 0x8a, 0x32, 0x34, 0x82, 0xcd, + 0x19, 0x01, 0x42, 0x15, 0xb9, 0x8a, 0x01, 0x40, 0x35, 0xc8, 0xac, 0x08, 0x21, 0x25, 0xa0, 0xcb, + 0x99, 0x89, 0x31, 0x37, 0x83, 0xaa, 0x00, 0x44, 0x23, 0xc0, 0xae, 0x09, 0x22, 0x00, 0x31, 0x22, + 0x02, 0xdd, 0x0a, 0x45, 0xb0, 0xad, 0x31, 0x02, 0x11, 0xa8, 0xbd, 0x29, 0x23, 0xa0, 0x8a, 0x71, + 0x04, 0xbc, 0x50, 0x23, 0xd9, 0x8b, 0x31, 0x14, 0xa8, 0x9c, 0xa8, 0x8a, 0x34, 0xc9, 0x1a, 0x15, + 0xb8, 0x0b, 0x25, 0x01, 0xc9, 0xad, 0x20, 0x11, 0x11, 0xf9, 0x0b, 0x44, 0x81, 0xab, 0x10, 0xd8, + 0xac, 0x48, 0x27, 0xb8, 0x9c, 0x11, 0x11, 0x08, 0xa0, 0xbc, 0x0a, 0x11, 0x13, 0x21, 0x36, 0xf9, + 0x9e, 0x30, 0x12, 0xb9, 0xbb, 0x28, 0x43, 0x81, 0x9a, 0x08, 0x01, 0xda, 0x0b, 0x52, 0x04, 0xec, + 0x0b, 0x44, 0x02, 0xb9, 0xad, 0x20, 0x34, 0xb0, 0xac, 0x09, 0x00, 0x01, 0x42, 0x14, 0xd8, 0xad, + 0x1a, 0x53, 0x01, 0xa9, 0x9a, 0x18, 0x34, 0xa0, 0x0c, 0x11, 0xca, 0x1a, 0x53, 0x14, 0xa0, 0xbf, + 0x0a, 0x32, 0x23, 0xa9, 0xac, 0x30, 0x23, 0xd9, 0xac, 0x8a, 0x42, 0x53, 0x24, 0x88, 0xa9, 0xdb, + 0xab, 0x41, 0x14, 0x80, 0x01, 0xa9, 0x48, 0x03, 0xda, 0xbc, 0xaa, 0x68, 0x36, 0x81, 0x99, 0xb9, + 0x0b, 0x43, 0xa1, 0x0a, 0x03, 0x9b, 0x41, 0x24, 0x46, 0xd0, 0x9e, 0x11, 0x01, 0x00, 0x91, 0xdb, + 0x09, 0x10, 0x34, 0xb0, 0x58, 0x04, 0xbd, 0x30, 0x04, 0xaa, 0x28, 0x12, 0x80, 0x0a, 0x43, 0xf8, + 0x9d, 0x20, 0x90, 0x18, 0x03, 0x18, 0x55, 0x02, 0x98, 0xdb, 0x09, 0x11, 0x21, 0x34, 0xfa, 0x1a, + 0x33, 0xc9, 0x19, 0x24, 0x98, 0xab, 0x62, 0x82, 0xba, 0x19, 0x02, 0xba, 0x2a, 0x15, 0xa8, 0x9a, + 0x00, 0x41, 0x46, 0x92, 0xcc, 0x29, 0x37, 0x92, 0xdb, 0x8b, 0x31, 0x12, 0xca, 0x9a, 0x00, 0xa8, + 0x0b, 0x65, 0x24, 0xc8, 0xbc, 0x18, 0x43, 0x82, 0xdb, 0x8b, 0x41, 0x11, 0x98, 0x08, 0x11, 0xfa, + 0x9d, 0x31, 0x14, 0xb8, 0xab, 0x28, 0x35, 0xa1, 0xbd, 0x8b, 0x31, 0x01, 0x89, 0x10, 0xa8, 0x9c, + 0x41, 0x24, 0x91, 0xff, 0x8a, 0x20, 0x24, 0xa0, 0xbb, 0x8b, 0x42, 0x03, 0x09, 0x91, 0xcd, 0xab, + 0x10, 0x63, 0x25, 0xc8, 0x9b, 0x18, 0x21, 0x12, 0xfb, 0x8b, 0x20, 0x21, 0x24, 0xda, 0x8a, 0x88, + 0x19, 0x33, 0xca, 0x30, 0xc2, 0x0c, 0x13, 0xca, 0x08, 0xc9, 0x48, 0x36, 0x01, 0x83, 0xff, 0x8a, + 0x32, 0x01, 0x08, 0x80, 0x99, 0xa9, 0x20, 0xd1, 0xad, 0x30, 0x92, 0x3b, 0x77, 0x81, 0xab, 0x9b, + 0x21, 0x03, 0x18, 0x22, 0xb8, 0x8c, 0x32, 0x03, 0xb9, 0xdf, 0x8a, 0x42, 0x14, 0x88, 0x10, 0xb9, + 0x9d, 0x30, 0x13, 0x90, 0x88, 0xc9, 0x9c, 0x72, 0x25, 0xb8, 0x8d, 0x62, 0x92, 0xaa, 0x9a, 0x00, + 0x01, 0x11, 0x90, 0x8a, 0x18, 0x65, 0xa1, 0x8a, 0x02, 0xdc, 0x38, 0x36, 0x02, 0x00, 0xa9, 0xab, + 0xeb, 0x09, 0x23, 0xa0, 0xaa, 0x0c, 0x67, 0x03, 0xb9, 0x8b, 0x32, 0x24, 0xb0, 0xac, 0x20, 0x33, + 0x91, 0xcd, 0x41, 0x84, 0xcb, 0x38, 0x25, 0x81, 0xba, 0x9c, 0x50, 0x23, 0xa0, 0xbd, 0x09, 0x11, + 0x00, 0x10, 0x24, 0xd9, 0xac, 0x40, 0x35, 0x81, 0x99, 0xab, 0x38, 0x15, 0xbb, 0x8a, 0xc9, 0x8b, + 0x22, 0x53, 0x13, 0xc9, 0x9b, 0x89, 0x72, 0x83, 0xbf, 0x1a, 0x33, 0x03, 0xa8, 0xbe, 0x18, 0x01, + 0x20, 0xa1, 0xbb, 0xaa, 0x9a, 0x74, 0x17, 0xa8, 0xba, 0xdb, 0x18, 0x24, 0x82, 0xe9, 0xaa, 0x21, + 0x12, 0x33, 0xd2, 0xbe, 0x08, 0x12, 0xa9, 0x09, 0x01, 0xb8, 0x09, 0x36, 0xa0, 0xbc, 0xbb, 0xbb, + 0x58, 0x37, 0xa2, 0xae, 0x28, 0x33, 0xa9, 0x9b, 0xba, 0x18, 0x33, 0x53, 0x24, 0xfb, 0xbd, 0x19, + 0x43, 0x12, 0xa0, 0x99, 0xca, 0x9c, 0x52, 0x82, 0xac, 0x19, 0x33, 0x32, 0x04, 0xda, 0xdd, 0x0b, + 0x63, 0x82, 0x88, 0x10, 0x98, 0xaa, 0x8a, 0x20, 0xa1, 0xaf, 0x10, 0x31, 0x55, 0x91, 0xbc, 0x9a, + 0x20, 0x43, 0x91, 0x89, 0x32, 0x11, 0x81, 0xce, 0x18, 0xa0, 0x3a, 0x37, 0xc8, 0x9b, 0x22, 0x11, + 0x21, 0x91, 0x89, 0x00, 0xfb, 0xcc, 0x58, 0x26, 0xc8, 0xab, 0x51, 0x34, 0x81, 0xbc, 0x99, 0x00, + 0x22, 0xb0, 0x0c, 0x44, 0x91, 0xbb, 0x08, 0x02, 0xc9, 0xac, 0x60, 0x35, 0x11, 0xa9, 0x0b, 0x25, + 0xa1, 0xbb, 0x08, 0xca, 0x1a, 0x43, 0x21, 0x83, 0xbe, 0x89, 0x73, 0x25, 0x90, 0xcb, 0x09, 0x33, + 0x12, 0x00, 0xba, 0xa9, 0x9a, 0x50, 0x55, 0x13, 0xdb, 0x0a, 0x53, 0x02, 0xa9, 0x8a, 0xb9, 0x39, + 0x17, 0xa8, 0xbb, 0x10, 0x81, 0x08, 0x44, 0x02, 0xa8, 0x71, 0x25, 0x98, 0x8a, 0xdb, 0xbb, 0x58, + 0x24, 0xa8, 0xaa, 0x89, 0x38, 0x45, 0x91, 0xcc, 0x8a, 0x38, 0x33, 0x88, 0x18, 0xd8, 0xbc, 0x88, + 0x41, 0x33, 0xd9, 0xae, 0x20, 0x42, 0x82, 0xac, 0x19, 0x92, 0x9b, 0x41, 0xd8, 0xbc, 0x08, 0x31, + 0x14, 0x00, 0x81, 0xfd, 0x0a, 0x33, 0xa8, 0xab, 0x9a, 0x28, 0x33, 0x44, 0x91, 0xef, 0x9a, 0x18, + 0x42, 0x03, 0xda, 0x8a, 0x00, 0x10, 0x10, 0xa8, 0x89, 0x10, 0x24, 0xd9, 0x38, 0xf2, 0xbe, 0x10, + 0x43, 0x13, 0x98, 0xbd, 0x99, 0x08, 0x32, 0xa8, 0x0c, 0x23, 0x88, 0x64, 0xa2, 0xce, 0x8a, 0x21, + 0x12, 0x98, 0x20, 0x26, 0x80, 0xb9, 0xbd, 0x29, 0x84, 0xca, 0x2a, 0x45, 0x82, 0xcc, 0xab, 0x41, + 0x15, 0xa8, 0xbb, 0x48, 0x14, 0x90, 0x08, 0x10, 0xb8, 0x8c, 0x31, 0x33, 0xb1, 0xbf, 0x8a, 0x42, + 0x15, 0x80, 0x88, 0x20, 0xc8, 0x9b, 0x88, 0xbc, 0x28, 0x23, 0x74, 0x27, 0xa0, 0xad, 0x18, 0x22, + 0x01, 0x9a, 0x09, 0x01, 0x31, 0x26, 0xc9, 0xbd, 0x8a, 0x99, 0x60, 0x25, 0x90, 0x9b, 0x20, 0x54, + 0x02, 0x98, 0xa9, 0xbc, 0x38, 0x24, 0xa8, 0x9b, 0x08, 0x20, 0x12, 0x32, 0x85, 0xcc, 0x51, 0x13, + 0x31, 0x14, 0xec, 0x89, 0x10, 0x33, 0x82, 0xcc, 0x0a, 0x55, 0x23, 0xc9, 0x9b, 0x31, 0x11, 0x20, + 0x23, 0xc0, 0xbf, 0x9b, 0x21, 0x01, 0x21, 0xc0, 0x8d, 0x72, 0x23, 0x00, 0xaa, 0x9a, 0x89, 0x20, + 0x02, 0x88, 0xa9, 0xce, 0x29, 0x27, 0xb9, 0x8a, 0x88, 0x08, 0x32, 0x13, 0xda, 0xbc, 0x29, 0x25, + 0x88, 0x81, 0xfd, 0x9c, 0x21, 0x14, 0x81, 0xaa, 0x9a, 0x41, 0x23, 0xc0, 0xbd, 0x9a, 0xa9, 0x1a, + 0x57, 0x01, 0xa9, 0xab, 0x89, 0x21, 0x02, 0xa9, 0xcb, 0x0a, 0x53, 0x23, 0xd9, 0xcf, 0x8a, 0x41, + 0x23, 0xa8, 0xbc, 0x9b, 0x31, 0xa1, 0x9d, 0x50, 0x33, 0xc1, 0xbc, 0x38, 0x03, 0xdd, 0x8a, 0x41, + 0x33, 0xa1, 0xbc, 0x09, 0x12, 0xc9, 0xbb, 0x1a, 0x41, 0x54, 0x02, 0x98, 0xdb, 0xbc, 0x0a, 0x31, + 0x36, 0xa0, 0xad, 0x31, 0x14, 0x99, 0x19, 0x90, 0xcb, 0x09, 0x63, 0x83, 0xba, 0xba, 0xad, 0x51, + 0x14, 0xca, 0xab, 0x30, 0x25, 0xa0, 0x09, 0x90, 0x0a, 0x67, 0x01, 0xa9, 0xbb, 0xab, 0x38, 0x37, + 0x22, 0xa8, 0x8b, 0x00, 0x21, 0x16, 0xfa, 0xbb, 0x18, 0x34, 0x33, 0x00, 0xdb, 0xab, 0x30, 0x15, + 0x98, 0x30, 0x01, 0xa9, 0x69, 0x37, 0xa0, 0xbd, 0x89, 0x01, 0x11, 0xb8, 0xaf, 0x30, 0x24, 0x22, + 0x81, 0xaa, 0x29, 0x15, 0x00, 0x08, 0x00, 0xea, 0xac, 0x61, 0x03, 0xbb, 0xab, 0x10, 0x64, 0x33, + 0x01, 0xcb, 0xab, 0x31, 0x14, 0x32, 0x91, 0xbd, 0x29, 0x33, 0x22, 0x91, 0xac, 0x40, 0x47, 0x23, + 0x80, 0x11, 0xd9, 0xbc, 0x0a, 0x22, 0xc8, 0xcc, 0x18, 0x54, 0x22, 0xa0, 0xaa, 0x18, 0x43, 0x13, + 0x98, 0xbb, 0xcb, 0x0a, 0x44, 0x02, 0x98, 0xfb, 0xab, 0x20, 0x24, 0x80, 0x88, 0xfa, 0x8b, 0x63, + 0x24, 0xb8, 0xbf, 0x0a, 0x32, 0x82, 0xba, 0x29, 0x43, 0x14, 0xba, 0x8c, 0x00, 0xdb, 0x8b, 0x31, + 0x26, 0x98, 0xbb, 0xbc, 0x2a, 0x36, 0xb8, 0x9b, 0x32, 0x93, 0xbd, 0x8a, 0x98, 0xba, 0x59, 0x37, + 0xb0, 0xcb, 0xba, 0x8a, 0x20, 0x92, 0xcf, 0x19, 0x35, 0x82, 0xa9, 0xa8, 0xde, 0x8a, 0x22, 0x43, + 0x12, 0xa8, 0xcc, 0x0a, 0x21, 0x90, 0xac, 0x99, 0x20, 0x37, 0x12, 0xca, 0xbb, 0x0a, 0x11, 0xa8, + 0x10, 0xf8, 0x8f, 0x43, 0x02, 0xaa, 0x98, 0xba, 0x51, 0x35, 0x01, 0xda, 0xad, 0x28, 0x43, 0x02, + 0xca, 0x9a, 0x98, 0x8a, 0x21, 0x22, 0xa8, 0xac, 0x62, 0x35, 0x23, 0xc0, 0xcf, 0x8a, 0x42, 0x02, + 0x98, 0x09, 0x20, 0x23, 0x91, 0xbc, 0x9b, 0x08, 0x21, 0x32, 0x15, 0xb0, 0xad, 0x38, 0x13, 0x08, + 0xc0, 0xff, 0x18, 0x34, 0x23, 0x82, 0xa9, 0xaa, 0x89, 0x34, 0xa1, 0xef, 0x8b, 0x20, 0x33, 0x82, + 0xaa, 0x89, 0x32, 0x12, 0x72, 0x36, 0x81, 0xcb, 0x99, 0x20, 0x21, 0xd8, 0xbc, 0x10, 0x44, 0x14, + 0xb9, 0x8b, 0x20, 0x21, 0x42, 0x15, 0xb8, 0x9b, 0x52, 0x15, 0xb9, 0xab, 0x0b, 0x53, 0x23, 0x53, + 0x36, 0x91, 0xad, 0x29, 0x24, 0x81, 0xbd, 0xab, 0x10, 0x43, 0x12, 0xca, 0x0a, 0x43, 0x01, 0x09, + 0x42, 0xa2, 0xbd, 0x28, 0x34, 0x01, 0x98, 0xdc, 0x8a, 0x22, 0x92, 0xdc, 0x09, 0x11, 0x21, 0x35, + 0x82, 0xeb, 0xcb, 0x89, 0x18, 0x81, 0x88, 0x08, 0x52, 0x15, 0xe9, 0x8b, 0x18, 0x10, 0x33, 0xa1, + 0xdd, 0x99, 0x98, 0x88, 0x30, 0x04, 0xfa, 0x8a, 0x41, 0x02, 0xc9, 0xbd, 0x8a, 0x20, 0x35, 0x33, + 0xc8, 0xbd, 0x8b, 0x08, 0x88, 0xaa, 0x30, 0x82, 0x0a, 0x55, 0xb1, 0xef, 0x8a, 0x11, 0x22, 0x02, + 0xca, 0x9a, 0x30, 0x16, 0xc8, 0xbb, 0x8a, 0x18, 0x34, 0x23, 0x81, 0xea, 0xbd, 0x19, 0x44, 0x13, + 0xdb, 0xac, 0x18, 0x32, 0x01, 0xa9, 0xad, 0x38, 0x44, 0x91, 0xbb, 0x08, 0xa9, 0x40, 0x36, 0x11, + 0xa8, 0xcc, 0x99, 0x88, 0xb9, 0x9b, 0x9a, 0x74, 0x22, 0x33, 0x92, 0xde, 0x8b, 0x30, 0x33, 0xb8, + 0xad, 0x10, 0x41, 0x45, 0x90, 0xab, 0x09, 0x98, 0x18, 0x33, 0x24, 0xa2, 0xbe, 0x38, 0x25, 0x91, + 0xdd, 0xab, 0x28, 0x32, 0x44, 0x24, 0xa8, 0x8b, 0x52, 0x14, 0xca, 0x9b, 0x20, 0x01, 0x98, 0xba, + 0xad, 0x09, 0x11, 0x10, 0x76, 0x24, 0xb8, 0x9c, 0x42, 0x23, 0xa0, 0xcc, 0x8b, 0x42, 0x23, 0x90, + 0xbb, 0x9a, 0x00, 0x28, 0x56, 0x12, 0x99, 0x1a, 0x22, 0x43, 0x83, 0xde, 0x9b, 0x20, 0x23, 0x21, + 0x34, 0x01, 0x30, 0x36, 0x23, 0xa0, 0xbc, 0xbc, 0x28, 0x13, 0xa0, 0xce, 0x1a, 0x54, 0x01, 0x90, + 0x98, 0x88, 0x10, 0x10, 0x55, 0x13, 0xb9, 0x28, 0x13, 0xfb, 0x9e, 0x89, 0x80, 0x32, 0x26, 0x91, + 0xbb, 0x9b, 0x20, 0x12, 0x90, 0xec, 0xab, 0x30, 0x04, 0x10, 0xc8, 0xbc, 0x0b, 0x73, 0x34, 0x90, + 0xbc, 0xac, 0x0a, 0x63, 0x91, 0xbb, 0x38, 0x33, 0x80, 0xfb, 0xcb, 0x9a, 0x20, 0x34, 0x12, 0x10, + 0xea, 0xbc, 0x08, 0x23, 0x92, 0xde, 0x9b, 0x41, 0x24, 0x80, 0xeb, 0x9b, 0x08, 0x10, 0x31, 0x82, + 0xca, 0x9b, 0x31, 0x23, 0xb9, 0xcd, 0xab, 0x18, 0x44, 0x80, 0xa9, 0xac, 0x8a, 0x62, 0x34, 0x90, + 0xcd, 0x9b, 0x20, 0x23, 0xb8, 0xbf, 0x28, 0x35, 0x90, 0xbb, 0x9a, 0xcb, 0x0a, 0x57, 0x13, 0xa8, + 0x18, 0xa8, 0x9a, 0x20, 0xc1, 0xcd, 0x9b, 0x00, 0x73, 0x23, 0xa0, 0xcc, 0x0a, 0x43, 0x81, 0xbc, + 0x89, 0x21, 0x42, 0x13, 0x99, 0x28, 0xb0, 0xdf, 0x18, 0x33, 0x82, 0x9a, 0x10, 0x55, 0x14, 0xd9, + 0xad, 0x09, 0x31, 0x02, 0x98, 0x89, 0x98, 0x40, 0x36, 0x13, 0x98, 0xaa, 0x0a, 0x44, 0x13, 0xdb, + 0xcc, 0xaa, 0x18, 0x32, 0x04, 0x80, 0x80, 0x08, 0x72, 0x34, 0x90, 0xbc, 0x39, 0x27, 0x90, 0x88, + 0xa8, 0xaa, 0x08, 0x21, 0x01, 0xa9, 0x71, 0x35, 0x12, 0x24, 0xc8, 0x9c, 0x08, 0x88, 0x11, 0x98, + 0x9b, 0x61, 0x46, 0x23, 0x10, 0x11, 0x08, 0x51, 0x82, 0xdc, 0x9a, 0x18, 0x43, 0x12, 0x88, 0xa0, + 0xcf, 0x8a, 0x42, 0x33, 0x03, 0xba, 0x29, 0x55, 0x02, 0xc9, 0xac, 0x0a, 0x32, 0x23, 0x80, 0xab, + 0x00, 0xc9, 0x19, 0x73, 0x83, 0xeb, 0x9a, 0x21, 0x02, 0xea, 0xcc, 0x89, 0x63, 0x23, 0x91, 0xda, + 0xab, 0x09, 0x22, 0x14, 0xa0, 0xac, 0x89, 0x42, 0x33, 0xe8, 0xbe, 0x0a, 0x11, 0x01, 0x42, 0x03, + 0xec, 0x8a, 0x20, 0x01, 0xba, 0x9a, 0x18, 0x32, 0x33, 0xfa, 0xae, 0x89, 0x80, 0x00, 0x80, 0xd9, + 0x9c, 0x41, 0x02, 0x9a, 0x8a, 0x99, 0x88, 0x00, 0xb9, 0x98, 0xfe, 0xbc, 0x28, 0x47, 0x12, 0xda, + 0x9b, 0x19, 0x32, 0x81, 0xba, 0x8b, 0x42, 0x02, 0xbb, 0xa9, 0xfa, 0xdb, 0x8a, 0x61, 0x33, 0x91, + 0xa9, 0x28, 0x36, 0x91, 0xcc, 0xab, 0x99, 0x40, 0x14, 0xa9, 0x89, 0x80, 0x11, 0x32, 0xb8, 0xff, + 0x9c, 0x40, 0x33, 0x01, 0x89, 0xba, 0xcb, 0x18, 0x44, 0x80, 0x9a, 0x0a, 0x51, 0x45, 0x02, 0xaa, + 0xba, 0xab, 0x41, 0x03, 0xb8, 0xcd, 0x8a, 0x32, 0x23, 0x00, 0x35, 0x12, 0x54, 0x24, 0x91, 0xca, + 0x9b, 0xa9, 0x09, 0x11, 0xc9, 0xae, 0x28, 0x35, 0x13, 0xca, 0x9c, 0x42, 0x35, 0x12, 0x98, 0x20, + 0xa8, 0x9b, 0x01, 0xc0, 0xaf, 0x28, 0x88, 0x73, 0x26, 0x91, 0xba, 0x39, 0x25, 0x02, 0xcb, 0xbb, + 0x9b, 0x72, 0x22, 0x01, 0x10, 0x10, 0x21, 0x45, 0x91, 0x0a, 0x11, 0x00, 0x30, 0x47, 0xb0, 0xbd, + 0x08, 0x11, 0x00, 0x31, 0xb1, 0xaf, 0x61, 0x34, 0x90, 0xbb, 0x89, 0x20, 0x43, 0x13, 0xd9, 0xcb, + 0x89, 0x30, 0x44, 0x02, 0xdb, 0x9a, 0x21, 0x11, 0x90, 0xbc, 0xbc, 0x0a, 0x32, 0x45, 0x13, 0xd8, + 0xbc, 0x09, 0x02, 0xa8, 0xbc, 0x30, 0x36, 0x01, 0xc9, 0xcb, 0x99, 0x90, 0xaa, 0x60, 0x12, 0xc9, + 0xba, 0x1a, 0x34, 0xc0, 0xce, 0x8a, 0x53, 0x03, 0xa8, 0xbc, 0xa9, 0x89, 0x32, 0x81, 0xd9, 0xcd, + 0x9a, 0x89, 0x41, 0x14, 0xca, 0x9b, 0x31, 0x82, 0xb8, 0xce, 0x9a, 0x00, 0x20, 0x32, 0xa2, 0xdd, + 0x9b, 0x20, 0x33, 0xb0, 0xce, 0x09, 0x52, 0x33, 0xa8, 0xdd, 0xcb, 0x18, 0x01, 0x88, 0xa8, 0x9a, + 0x38, 0x67, 0x12, 0x91, 0xcb, 0x9c, 0x18, 0x31, 0x23, 0xc8, 0xab, 0x09, 0x11, 0x00, 0xfc, 0x9b, + 0x18, 0x43, 0x22, 0x11, 0xb0, 0xaf, 0x19, 0x11, 0xb8, 0xab, 0x08, 0x62, 0x45, 0x02, 0xb9, 0x9b, + 0x54, 0x13, 0x80, 0xa8, 0xbc, 0x8a, 0x80, 0xba, 0x8a, 0xec, 0x9b, 0x73, 0x27, 0x12, 0x88, 0x98, + 0x08, 0x42, 0x03, 0xdc, 0x9b, 0x20, 0x11, 0x98, 0xb8, 0xcd, 0x9b, 0x73, 0x24, 0x01, 0x98, 0x09, + 0x21, 0x24, 0x81, 0xbb, 0xcb, 0x9b, 0x30, 0x45, 0x92, 0xa9, 0x18, 0x75, 0x32, 0x81, 0xcb, 0x9a, + 0x31, 0x14, 0x81, 0xca, 0xac, 0x48, 0x36, 0x02, 0x88, 0x89, 0x31, 0x45, 0x34, 0x80, 0xaa, 0x9a, + 0x89, 0x31, 0x33, 0xb9, 0xbf, 0x8b, 0x55, 0x23, 0x90, 0xba, 0x8b, 0x64, 0x02, 0x08, 0x80, 0x00, + 0x99, 0x90, 0xcc, 0x29, 0x12, 0x31, 0x43, 0x15, 0xfb, 0xad, 0x09, 0x41, 0x03, 0xa8, 0x9b, 0x18, + 0x98, 0x08, 0xd8, 0xac, 0xaa, 0x40, 0x57, 0x01, 0xca, 0xab, 0x9b, 0x31, 0x15, 0x90, 0x98, 0x89, + 0x88, 0xaa, 0xbb, 0xbb, 0xce, 0x09, 0x54, 0x12, 0xc8, 0xac, 0x09, 0x41, 0x13, 0xfb, 0xac, 0x89, + 0x10, 0x12, 0xb0, 0xae, 0x89, 0x20, 0x11, 0x80, 0xca, 0xcf, 0x8a, 0x52, 0x12, 0x89, 0xba, 0xac, + 0x19, 0x24, 0xa0, 0xae, 0x0a, 0x20, 0x24, 0x24, 0xa0, 0xab, 0xcb, 0xbb, 0x9a, 0xa8, 0xdb, 0x1a, + 0x46, 0x02, 0x99, 0xaa, 0xa9, 0x48, 0x37, 0xa0, 0x9a, 0x10, 0x14, 0x98, 0x08, 0xfb, 0xcd, 0x8a, + 0x31, 0x25, 0x81, 0xcb, 0x8a, 0x32, 0x04, 0xa9, 0xbb, 0x9b, 0x39, 0x47, 0x02, 0xa8, 0xdb, 0x8a, + 0x61, 0x34, 0x80, 0x9a, 0x20, 0x24, 0x90, 0xca, 0xce, 0x8a, 0x18, 0x33, 0x12, 0x81, 0xba, 0x29, + 0x57, 0x34, 0x80, 0xab, 0x88, 0x32, 0x24, 0xc9, 0xdd, 0x9a, 0x00, 0x32, 0x82, 0xaa, 0x8a, 0x64, + 0x24, 0x12, 0x80, 0xbb, 0x0b, 0x43, 0x12, 0x00, 0xfa, 0xab, 0x10, 0x73, 0x23, 0xa0, 0x9b, 0x31, + 0x37, 0x12, 0xb8, 0xac, 0x08, 0x88, 0x11, 0x12, 0x98, 0x28, 0x77, 0x33, 0x11, 0x21, 0x11, 0x53, + 0x82, 0xaa, 0xdb, 0x9a, 0x53, 0x14, 0x00, 0x88, 0xdd, 0x8a, 0x32, 0x44, 0x02, 0xa9, 0x9a, 0x42, + 0x25, 0x98, 0xbc, 0x0a, 0x11, 0x43, 0x23, 0xc9, 0xbc, 0x8a, 0x00, 0x30, 0x47, 0xa0, 0xbc, 0x29, + 0x03, 0xda, 0xaa, 0xaa, 0x52, 0x35, 0x02, 0xea, 0xab, 0x89, 0x10, 0x22, 0x90, 0xbc, 0x09, 0x33, + 0x35, 0x83, 0xef, 0xbb, 0x08, 0x32, 0x11, 0x81, 0xeb, 0x9a, 0x21, 0x24, 0xc9, 0xaa, 0xa9, 0x89, + 0x10, 0x02, 0xfc, 0x9b, 0x9a, 0x20, 0x12, 0xfa, 0xbc, 0x29, 0x02, 0xaa, 0x09, 0x21, 0x90, 0x28, + 0xe8, 0xbd, 0xcc, 0xbd, 0x19, 0x55, 0x03, 0xb8, 0x9c, 0x08, 0x13, 0x81, 0xca, 0xac, 0x0a, 0x21, + 0x11, 0x90, 0xdc, 0xbd, 0x8a, 0x53, 0x14, 0x90, 0x99, 0x20, 0x36, 0x81, 0xcb, 0xab, 0xbb, 0x29, + 0x25, 0x80, 0x99, 0xaa, 0x19, 0x44, 0x01, 0xfd, 0xbb, 0x48, 0x26, 0x02, 0xb8, 0xbb, 0xab, 0x38, + 0x35, 0x01, 0xa9, 0x08, 0x63, 0x36, 0x81, 0xbb, 0xaa, 0x9b, 0x32, 0x04, 0xb9, 0xbf, 0x9b, 0x42, + 0x25, 0x01, 0x00, 0x00, 0x63, 0x34, 0x82, 0xc9, 0xab, 0x99, 0x08, 0x80, 0xdb, 0xbc, 0x20, 0x44, + 0x23, 0x98, 0x9a, 0x52, 0x44, 0x23, 0xa0, 0x18, 0x91, 0xbb, 0x18, 0xb1, 0xcf, 0x18, 0x22, 0x66, + 0x02, 0x01, 0x44, 0x7d, 0x0a, 0x02, 0xd0, 0x03, 0x24, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, + 0x9f, 0x35, 0x90, 0xbc, 0xa9, 0x8a, 0x10, 0x62, 0x55, 0x33, 0x31, 0x54, 0x33, 0x22, 0x63, 0x44, + 0x23, 0x32, 0x43, 0x34, 0x35, 0x34, 0x34, 0x24, 0x23, 0x43, 0x43, 0x24, 0x33, 0x35, 0x34, 0x24, + 0x43, 0x33, 0x35, 0x33, 0x34, 0x34, 0x43, 0x43, 0x43, 0x24, 0x33, 0x53, 0x33, 0x34, 0x33, 0x44, + 0x43, 0x24, 0x32, 0x33, 0x33, 0x33, 0x34, 0x33, 0x34, 0x24, 0x24, 0x33, 0x43, 0x33, 0x43, 0x33, + 0x15, 0x94, 0xff, 0x1f, 0x81, 0x08, 0x00, 0x90, 0xb8, 0x8b, 0x90, 0x38, 0xf9, 0x8d, 0x00, 0xbc, + 0x9b, 0x41, 0x92, 0xbb, 0xbc, 0xdc, 0xab, 0xa9, 0x99, 0x9a, 0xaa, 0xba, 0xba, 0xcb, 0xbb, 0xac, + 0x2d, 0x77, 0x12, 0xc8, 0xac, 0x20, 0x84, 0x0c, 0x12, 0x00, 0x08, 0x88, 0x80, 0xef, 0x89, 0x89, + 0x88, 0x88, 0x89, 0x89, 0x89, 0x99, 0x99, 0x9a, 0xaa, 0xaa, 0xab, 0xac, 0xbb, 0xbc, 0xbb, 0xbc, + 0xcb, 0xbb, 0xcb, 0x1b, 0x24, 0x33, 0x22, 0x54, 0x33, 0x81, 0x73, 0x25, 0x13, 0x34, 0x12, 0x20, + 0x26, 0x41, 0x33, 0x12, 0x73, 0x43, 0x02, 0x10, 0x34, 0x20, 0x34, 0x22, 0x34, 0x12, 0x11, 0x46, + 0x22, 0x22, 0x32, 0x32, 0x33, 0x34, 0x43, 0x33, 0x24, 0x24, 0x33, 0x24, 0x43, 0x32, 0x24, 0x33, + 0x34, 0x33, 0x34, 0x24, 0x33, 0x34, 0x43, 0x33, 0x43, 0x33, 0x84, 0x9b, 0x47, 0x90, 0xba, 0x1b, + 0x66, 0x23, 0xea, 0x39, 0x93, 0x8b, 0x80, 0x9a, 0x90, 0xbf, 0x19, 0x00, 0xa9, 0x30, 0xc2, 0xef, + 0x88, 0x80, 0x18, 0x98, 0xdb, 0x8c, 0xa8, 0x8c, 0x02, 0xbb, 0x08, 0x11, 0xe9, 0xbe, 0x0a, 0x12, + 0x00, 0xb8, 0xbf, 0x9a, 0xa8, 0xbb, 0x30, 0x04, 0xcb, 0x30, 0x84, 0xbf, 0x9b, 0x21, 0x34, 0xa1, + 0xce, 0x8a, 0x88, 0x09, 0x31, 0x02, 0xca, 0x29, 0x23, 0xc8, 0xad, 0x18, 0x34, 0x82, 0xcd, 0x9a, + 0x10, 0x22, 0x42, 0x13, 0xa0, 0x9a, 0x31, 0x24, 0xb8, 0x0c, 0x62, 0x02, 0xda, 0x9a, 0x41, 0x34, + 0x44, 0x12, 0x00, 0xa8, 0x89, 0x43, 0x23, 0x80, 0x88, 0x88, 0xdb, 0xab, 0x08, 0x66, 0x33, 0x24, + 0x11, 0x88, 0xaa, 0x30, 0x34, 0x22, 0x91, 0x88, 0x80, 0xbc, 0x8a, 0x62, 0x13, 0x51, 0x24, 0x22, + 0x82, 0x2a, 0x24, 0x22, 0xd9, 0x28, 0x82, 0x89, 0xb8, 0xef, 0x08, 0x89, 0x08, 0x31, 0x03, 0x1b, + 0x34, 0x82, 0xdb, 0x3b, 0x37, 0x21, 0x22, 0x34, 0x90, 0x61, 0x25, 0x80, 0x11, 0x98, 0x41, 0xa1, + 0x0c, 0x45, 0x22, 0x20, 0x37, 0x91, 0x29, 0x44, 0x12, 0x10, 0xa1, 0x9c, 0x98, 0x08, 0x43, 0x92, + 0x08, 0x01, 0xec, 0xac, 0x28, 0x45, 0x90, 0x08, 0xc9, 0xab, 0x98, 0x2a, 0x27, 0xaa, 0xa1, 0xbf, + 0xc8, 0xbe, 0x20, 0x02, 0xeb, 0x9a, 0xb9, 0x8a, 0xa9, 0x9d, 0x10, 0xca, 0xbc, 0x0a, 0xd0, 0xbd, + 0x88, 0x99, 0xa9, 0xce, 0x0b, 0x81, 0xcb, 0x9b, 0x9a, 0x88, 0xfb, 0x9f, 0x08, 0x98, 0x9a, 0x09, + 0xa8, 0xcc, 0x09, 0x12, 0xb8, 0xad, 0xaa, 0x9a, 0xaa, 0xca, 0xad, 0x08, 0x08, 0x32, 0xd2, 0xbf, + 0x19, 0xa8, 0xbc, 0x20, 0xa0, 0x8d, 0x34, 0x82, 0xbb, 0x09, 0x80, 0x21, 0xf8, 0x9e, 0x52, 0x03, + 0xaa, 0x19, 0x23, 0x12, 0x42, 0x34, 0x01, 0xde, 0x8a, 0x73, 0x12, 0x88, 0x40, 0x04, 0xea, 0x9b, + 0x20, 0x12, 0xca, 0x1a, 0x33, 0x91, 0xbb, 0x50, 0x04, 0xa9, 0x0a, 0xa0, 0xdf, 0xab, 0x42, 0x24, + 0xa8, 0xbb, 0x89, 0x01, 0x98, 0xbb, 0xce, 0x9b, 0x08, 0x00, 0xc9, 0xbe, 0x1a, 0x12, 0xe9, 0xbd, + 0x8b, 0x10, 0x81, 0xcc, 0xac, 0x99, 0x18, 0x01, 0xe9, 0xac, 0x8a, 0x30, 0x13, 0xa8, 0xab, 0x11, + 0x12, 0xeb, 0xce, 0xaa, 0x31, 0x22, 0xa0, 0xcc, 0xab, 0x30, 0x35, 0x02, 0xb8, 0xcb, 0xbb, 0xab, + 0x31, 0x37, 0x63, 0x33, 0x02, 0xca, 0x9a, 0x31, 0x47, 0x23, 0x80, 0x88, 0x89, 0x40, 0x55, 0x22, + 0x33, 0x14, 0x80, 0x00, 0x90, 0x61, 0x44, 0x32, 0x31, 0x02, 0xba, 0x40, 0x36, 0x43, 0x12, 0x11, + 0x11, 0x88, 0x40, 0x36, 0x24, 0x00, 0x10, 0x34, 0x01, 0x72, 0x34, 0x13, 0x11, 0x11, 0x80, 0x88, + 0x10, 0x66, 0x14, 0x90, 0x19, 0x01, 0x18, 0x63, 0x32, 0x22, 0xea, 0xab, 0x89, 0x89, 0x00, 0x62, + 0x13, 0x98, 0xa9, 0x18, 0xd0, 0x1a, 0x23, 0xc9, 0x9d, 0x99, 0xbb, 0xfb, 0xcc, 0x89, 0x90, 0x09, + 0x01, 0x99, 0xa9, 0x8a, 0x90, 0xef, 0xcb, 0x99, 0x89, 0xca, 0xba, 0xac, 0x99, 0x00, 0x20, 0x01, + 0xfb, 0xac, 0xaa, 0xbc, 0xab, 0x9a, 0x08, 0x00, 0x18, 0x81, 0xb9, 0x30, 0x04, 0xea, 0xac, 0x8a, + 0xca, 0xcc, 0x19, 0x34, 0x81, 0x8a, 0x20, 0x33, 0x41, 0x56, 0x34, 0x02, 0x88, 0x31, 0x03, 0x98, + 0x61, 0x44, 0x01, 0xa9, 0x1a, 0x45, 0x33, 0x34, 0x44, 0x23, 0x11, 0x41, 0x44, 0x02, 0x20, 0x53, + 0x23, 0xa0, 0x9a, 0x52, 0x44, 0x12, 0x43, 0x23, 0x90, 0x30, 0x35, 0x23, 0x08, 0x31, 0x36, 0x11, + 0x10, 0x62, 0x24, 0x22, 0x11, 0x11, 0x81, 0x99, 0x51, 0x44, 0x32, 0x33, 0x44, 0x34, 0x12, 0x11, + 0x23, 0x82, 0xaa, 0x48, 0x34, 0x01, 0x99, 0x31, 0x01, 0x03, 0x9a, 0x42, 0x67, 0x35, 0x21, 0x01, + 0x80, 0x28, 0x54, 0x13, 0xb9, 0x9c, 0x18, 0x54, 0x23, 0x88, 0x30, 0x45, 0x43, 0x12, 0x98, 0x39, + 0x37, 0x21, 0x00, 0x98, 0x40, 0x47, 0x23, 0x91, 0xca, 0x8a, 0x21, 0x02, 0xa8, 0x19, 0x64, 0x24, + 0x98, 0x99, 0x98, 0x73, 0x24, 0xa8, 0xdb, 0x9b, 0x41, 0x25, 0x81, 0x99, 0xa9, 0xa9, 0x00, 0xd8, + 0xce, 0x8a, 0x18, 0x02, 0xc9, 0x8a, 0x00, 0xa8, 0xdc, 0xbc, 0xa9, 0xcb, 0x18, 0x02, 0xdc, 0xac, + 0x89, 0x80, 0xc9, 0xbd, 0xbb, 0xca, 0xac, 0x09, 0x80, 0xa9, 0xa9, 0xdb, 0xce, 0xac, 0x8a, 0x10, + 0x80, 0xb9, 0xdb, 0xbb, 0xab, 0x30, 0x13, 0xfb, 0xbd, 0xbc, 0xab, 0x09, 0x21, 0x22, 0x82, 0xcb, + 0xcc, 0xac, 0x8b, 0x20, 0x33, 0x91, 0xde, 0xac, 0x9b, 0x20, 0x44, 0x13, 0xa8, 0xbc, 0x9c, 0x19, + 0x52, 0x34, 0x13, 0x80, 0xaa, 0xb9, 0xab, 0x71, 0x35, 0x24, 0x01, 0x99, 0xab, 0x18, 0x54, 0x22, + 0xb8, 0xbb, 0xab, 0x9a, 0x19, 0x77, 0x34, 0x01, 0x99, 0xbb, 0xbc, 0x0a, 0x43, 0x02, 0xfb, 0xac, + 0x18, 0x43, 0x11, 0x01, 0x90, 0xca, 0xcc, 0xab, 0x8a, 0x08, 0x11, 0x82, 0xfc, 0xbd, 0x9b, 0x88, + 0xa0, 0xba, 0xab, 0xdc, 0xbc, 0xaa, 0x88, 0xa9, 0xaa, 0x09, 0xa8, 0xcc, 0x9b, 0x88, 0xfb, 0xcb, + 0x9a, 0x89, 0xaa, 0xbc, 0xba, 0xbb, 0xba, 0xab, 0x31, 0x36, 0xa1, 0xdd, 0xcb, 0xbc, 0xad, 0x10, + 0x22, 0x22, 0x12, 0x12, 0x23, 0xc8, 0x8a, 0x71, 0x24, 0x11, 0x80, 0x1a, 0x64, 0x24, 0x54, 0x22, + 0x11, 0x22, 0x33, 0x13, 0x53, 0x34, 0x31, 0x34, 0x32, 0x23, 0x32, 0x63, 0x56, 0x02, 0x01, 0x21, + 0x53, 0x23, 0x43, 0x12, 0x98, 0x31, 0x53, 0x23, 0x33, 0x63, 0x54, 0x34, 0x12, 0x32, 0x33, 0x12, + 0x22, 0xa0, 0xbc, 0x8a, 0x72, 0x45, 0x23, 0x81, 0x20, 0x33, 0x12, 0x00, 0xba, 0xdc, 0x9b, 0x08, + 0xa9, 0x19, 0x10, 0x56, 0x22, 0xb0, 0xbf, 0x8a, 0x80, 0x90, 0xdc, 0xbc, 0x19, 0x01, 0xaa, 0x88, + 0xc9, 0xae, 0xab, 0x88, 0xda, 0xbc, 0x89, 0x11, 0xfa, 0xbf, 0x99, 0x89, 0x98, 0x88, 0x98, 0xcb, + 0x9b, 0x88, 0x80, 0xa9, 0xbc, 0xaa, 0xcb, 0xbf, 0xab, 0xaa, 0xaa, 0x9a, 0x80, 0x99, 0xcb, 0x9a, + 0x50, 0x33, 0xd9, 0x9b, 0x08, 0x90, 0x09, 0x53, 0x24, 0x81, 0x89, 0x88, 0x08, 0x90, 0x51, 0x47, + 0x24, 0x01, 0x00, 0x10, 0x73, 0x44, 0x43, 0x32, 0x23, 0x31, 0x33, 0x13, 0x22, 0x64, 0x35, 0x33, + 0x02, 0x00, 0x31, 0x54, 0x34, 0x25, 0x23, 0x31, 0x43, 0x22, 0x01, 0x31, 0x45, 0x33, 0x11, 0x98, + 0xb9, 0x0a, 0x56, 0x35, 0x14, 0x01, 0x10, 0x22, 0x32, 0x32, 0x44, 0x33, 0x12, 0x80, 0x20, 0x32, + 0x65, 0x44, 0x22, 0xb8, 0xac, 0x09, 0x43, 0x24, 0x42, 0x22, 0x90, 0xba, 0x9a, 0x89, 0x20, 0x46, + 0x43, 0x80, 0xab, 0x2a, 0x65, 0x23, 0x01, 0x88, 0xaa, 0xaa, 0x1b, 0x47, 0x24, 0x33, 0x33, 0x01, + 0xa9, 0x0a, 0x73, 0x36, 0x02, 0x90, 0x99, 0x08, 0x20, 0x64, 0x33, 0x81, 0xba, 0xcb, 0x9a, 0x21, + 0x55, 0x35, 0x13, 0xa8, 0xab, 0x88, 0x89, 0x61, 0x33, 0x81, 0x99, 0x88, 0x00, 0x41, 0x34, 0x81, + 0xfe, 0xbc, 0x9b, 0x00, 0x80, 0x08, 0x98, 0xba, 0xbe, 0xab, 0x89, 0x99, 0xda, 0xcc, 0xeb, 0xbc, + 0x9a, 0x88, 0xc9, 0xcb, 0xcb, 0xba, 0xaa, 0xab, 0xab, 0xb9, 0xcd, 0xab, 0xeb, 0xdc, 0xaa, 0x9a, + 0x9a, 0xab, 0xac, 0x8a, 0x10, 0xb8, 0xdd, 0xcb, 0xac, 0xab, 0x89, 0x89, 0x99, 0xaa, 0x8a, 0x99, + 0xde, 0xac, 0x18, 0x02, 0xe9, 0xbc, 0xbb, 0xbb, 0x09, 0x34, 0x04, 0xb9, 0xab, 0x52, 0x02, 0xda, + 0x09, 0x43, 0x33, 0x80, 0xaa, 0xab, 0x18, 0x64, 0x35, 0x03, 0x80, 0x62, 0x35, 0x02, 0xb9, 0xaa, + 0x08, 0x32, 0x13, 0x00, 0x31, 0x65, 0x44, 0x11, 0xba, 0xad, 0x88, 0xb9, 0xbe, 0xab, 0x30, 0x37, + 0x23, 0x11, 0x00, 0x98, 0x18, 0x90, 0xfc, 0xcc, 0xbb, 0x8a, 0x88, 0xa9, 0xba, 0x9a, 0xcb, 0xde, + 0xbc, 0xbc, 0xbb, 0xaa, 0x99, 0xbb, 0xbe, 0xbb, 0x9a, 0xa9, 0xcb, 0xba, 0xdc, 0xcb, 0x9a, 0x89, + 0x99, 0xcb, 0xcd, 0xdb, 0xba, 0x9b, 0x89, 0x18, 0x21, 0x12, 0xc9, 0xcd, 0xac, 0x99, 0xa9, 0xcb, + 0xcc, 0xaa, 0x99, 0x08, 0x42, 0x44, 0x12, 0x11, 0x91, 0xca, 0xcb, 0x9a, 0x30, 0x34, 0x33, 0x54, + 0x44, 0x32, 0x33, 0x43, 0x33, 0x22, 0x43, 0x13, 0x81, 0x42, 0x55, 0x34, 0x12, 0x21, 0x42, 0x43, + 0x43, 0x43, 0x33, 0x12, 0x31, 0x44, 0x33, 0x24, 0x53, 0x44, 0x23, 0x11, 0x31, 0x34, 0x34, 0x53, + 0x43, 0x22, 0x11, 0x10, 0x21, 0x11, 0x53, 0x45, 0x24, 0x11, 0x00, 0x11, 0x11, 0x33, 0x35, 0x12, + 0xa0, 0xcb, 0xbb, 0xdb, 0x8a, 0x42, 0x34, 0x80, 0xba, 0x9a, 0x20, 0x55, 0x34, 0x91, 0xec, 0xac, + 0x9b, 0x99, 0x9a, 0x99, 0xa8, 0xdd, 0xbc, 0xaa, 0x8a, 0x88, 0x99, 0xca, 0xcd, 0xbc, 0xba, 0x99, + 0x80, 0x98, 0xda, 0xcd, 0xcb, 0xab, 0x89, 0x08, 0x98, 0xba, 0xbe, 0xcb, 0xaa, 0x88, 0x10, 0x00, + 0xa8, 0xbb, 0xba, 0xaa, 0x40, 0x36, 0xb0, 0xdf, 0xab, 0x99, 0x08, 0x21, 0x43, 0x23, 0x00, 0x89, + 0x00, 0x22, 0x54, 0x45, 0x23, 0x80, 0x89, 0x42, 0x35, 0x14, 0x11, 0x10, 0x21, 0x52, 0x54, 0x34, + 0x33, 0x33, 0x34, 0x24, 0x12, 0x11, 0x34, 0x33, 0x12, 0x21, 0x54, 0x44, 0x24, 0x23, 0x02, 0x88, + 0x10, 0x53, 0x43, 0x22, 0x53, 0x43, 0x23, 0x11, 0x21, 0x32, 0x36, 0x25, 0x12, 0x10, 0x10, 0x44, + 0x34, 0x13, 0x81, 0x10, 0x32, 0x33, 0x33, 0x42, 0x63, 0x34, 0x24, 0x01, 0x88, 0x20, 0x43, 0x02, + 0xda, 0xaa, 0x08, 0x54, 0x44, 0x12, 0x00, 0x08, 0x20, 0x31, 0x22, 0x54, 0x44, 0x24, 0x11, 0x01, + 0x21, 0x31, 0x44, 0x34, 0x23, 0x21, 0x32, 0x25, 0x13, 0x88, 0x99, 0x21, 0x33, 0x43, 0x55, 0x43, + 0x22, 0x63, 0x44, 0x23, 0x01, 0x88, 0x80, 0xa8, 0xbb, 0x08, 0x22, 0x33, 0x56, 0x24, 0x91, 0xba, + 0x19, 0x81, 0xed, 0xbd, 0xaa, 0x88, 0x00, 0x00, 0xb8, 0xde, 0xbc, 0xaa, 0x99, 0xcb, 0xbc, 0xaa, + 0xeb, 0xcd, 0xab, 0xa9, 0xa8, 0xa9, 0xab, 0xdb, 0xbc, 0xac, 0xa9, 0xda, 0xbc, 0xbc, 0xbc, 0xcb, + 0xac, 0x9a, 0x09, 0x88, 0x99, 0xdb, 0xbc, 0xac, 0xaa, 0xa9, 0xcb, 0xbc, 0xbb, 0xbb, 0xab, 0x9b, + 0x99, 0xca, 0xdd, 0xbc, 0xbe, 0xbb, 0x9a, 0x08, 0x11, 0x01, 0x88, 0xb9, 0xcd, 0xbb, 0x89, 0x98, + 0xb9, 0xbb, 0xdb, 0xbb, 0x1a, 0x46, 0x34, 0x22, 0x01, 0x10, 0x42, 0x33, 0x53, 0x54, 0x24, 0x12, + 0x98, 0xba, 0xab, 0x89, 0x30, 0x35, 0x22, 0x62, 0x35, 0x33, 0x11, 0x80, 0xfa, 0xcd, 0xac, 0x88, + 0x31, 0x44, 0x44, 0x43, 0x11, 0x98, 0xaa, 0xbb, 0xbc, 0xab, 0x99, 0xeb, 0xcc, 0xaa, 0x10, 0x32, + 0x22, 0x90, 0xec, 0xbd, 0xbd, 0xab, 0xaa, 0x99, 0x89, 0xa9, 0xcb, 0xcc, 0x8a, 0x18, 0x80, 0xca, + 0xcc, 0xcb, 0xbb, 0xab, 0x9a, 0xa9, 0xbb, 0xbd, 0xbc, 0xac, 0x9a, 0x18, 0x02, 0xc9, 0xcf, 0xbc, + 0xaa, 0x8a, 0x80, 0x90, 0xc9, 0xba, 0x9a, 0x89, 0x20, 0x44, 0x25, 0x01, 0xb9, 0xab, 0x39, 0x65, + 0x34, 0x14, 0x01, 0x00, 0x31, 0x45, 0x34, 0x33, 0x23, 0x33, 0x22, 0x22, 0x43, 0x55, 0x43, 0x23, + 0x11, 0x21, 0x64, 0x44, 0x33, 0x23, 0x12, 0x11, 0x23, 0x34, 0x34, 0x34, 0x43, 0x34, 0x33, 0x43, + 0x33, 0x46, 0x33, 0x33, 0x33, 0x33, 0x44, 0x43, 0x33, 0x13, 0x91, 0x88, 0x32, 0x35, 0x34, 0x34, + 0x33, 0x12, 0x88, 0x88, 0x52, 0x43, 0x33, 0x01, 0xa8, 0x09, 0x65, 0x35, 0x22, 0x98, 0xda, 0xcc, + 0xac, 0x9b, 0x09, 0x88, 0x99, 0x99, 0xba, 0xbd, 0xac, 0xaa, 0xbb, 0xbf, 0xad, 0xaa, 0xaa, 0xaa, + 0xdb, 0xcc, 0xbd, 0xac, 0x9b, 0x99, 0xa9, 0x99, 0x9a, 0xaa, 0xbc, 0xcb, 0xbb, 0xbb, 0xcb, 0xcb, + 0xbd, 0xac, 0xab, 0xa9, 0x98, 0x99, 0xaa, 0xcb, 0xcb, 0xac, 0xa9, 0x89, 0x30, 0x44, 0x22, 0x98, + 0xbb, 0xdb, 0xab, 0x89, 0x31, 0x44, 0x34, 0x25, 0x23, 0x22, 0x44, 0x45, 0x33, 0x23, 0x33, 0x44, + 0x44, 0x24, 0x33, 0x33, 0x24, 0x33, 0x33, 0x34, 0x34, 0x34, 0x24, 0x23, 0x22, 0x33, 0x45, 0x34, + 0x33, 0x43, 0x32, 0x43, 0x42, 0x42, 0x33, 0x24, 0x12, 0x22, 0x22, 0x33, 0x64, 0x53, 0x33, 0x24, + 0x23, 0x23, 0x23, 0x11, 0x33, 0x44, 0x33, 0x33, 0x44, 0x24, 0x33, 0x53, 0x33, 0x12, 0xa8, 0xaa, + 0x9a, 0x8a, 0x20, 0x45, 0x14, 0x01, 0x28, 0x53, 0x44, 0x43, 0x34, 0x14, 0x11, 0x00, 0x20, 0x42, + 0x33, 0x44, 0x43, 0x22, 0x10, 0x20, 0x43, 0x45, 0x43, 0x32, 0x01, 0x88, 0x88, 0x10, 0x42, 0x54, + 0x35, 0x44, 0x32, 0x21, 0x01, 0x01, 0x01, 0x80, 0xca, 0xbb, 0x18, 0x65, 0x34, 0x34, 0x23, 0x12, + 0xa0, 0xca, 0xbb, 0x9b, 0x42, 0x24, 0xd8, 0xcc, 0x9b, 0x18, 0x12, 0x90, 0xec, 0xcc, 0xbc, 0xaa, + 0x8a, 0x10, 0x31, 0x23, 0xc8, 0xef, 0xcb, 0x9b, 0x8a, 0x98, 0xa9, 0xca, 0xbc, 0xdb, 0xba, 0xba, + 0xbb, 0xab, 0xbb, 0xcd, 0xcb, 0xab, 0x08, 0x80, 0xda, 0xce, 0xcb, 0xab, 0xab, 0xa9, 0x89, 0x9a, + 0xaa, 0xa9, 0xca, 0xdb, 0xba, 0xba, 0xde, 0xbc, 0xad, 0x9a, 0x08, 0x20, 0x11, 0x90, 0xcb, 0xab, + 0x99, 0xaa, 0xbd, 0xac, 0xbb, 0xab, 0x19, 0x54, 0x35, 0x34, 0x33, 0x12, 0x80, 0x88, 0x32, 0x35, + 0x81, 0xcc, 0xbc, 0xaa, 0x18, 0x44, 0x35, 0x23, 0x12, 0x00, 0x10, 0x31, 0x63, 0x23, 0x90, 0xcd, + 0xac, 0x08, 0x54, 0x44, 0x23, 0x11, 0x80, 0x88, 0x00, 0x80, 0xba, 0xcd, 0xdb, 0xbb, 0xbb, 0x99, + 0x80, 0xb8, 0xed, 0xbc, 0xbd, 0x9b, 0x8a, 0x98, 0xeb, 0xcd, 0xbb, 0xac, 0xa9, 0x89, 0x88, 0x99, + 0xca, 0xba, 0xcb, 0xcb, 0xba, 0xbb, 0xbd, 0xcd, 0xba, 0xaa, 0x99, 0xa9, 0xbb, 0xcd, 0xba, 0xbb, + 0xac, 0xcb, 0xbb, 0xbc, 0xbb, 0xbd, 0xac, 0x9a, 0x99, 0x99, 0x99, 0x09, 0x20, 0x63, 0x34, 0x24, + 0x02, 0x80, 0x98, 0xa9, 0xaa, 0x51, 0x57, 0x53, 0x33, 0x33, 0x33, 0x32, 0x22, 0x53, 0x53, 0x43, + 0x43, 0x33, 0x24, 0x23, 0x43, 0x53, 0x33, 0x33, 0x43, 0x32, 0x34, 0x44, 0x34, 0x35, 0x43, 0x33, + 0x33, 0x33, 0x43, 0x34, 0x44, 0x33, 0x43, 0x22, 0x23, 0x33, 0x34, 0x33, 0x22, 0x22, 0x43, 0x44, + 0x34, 0x35, 0x24, 0x23, 0x23, 0x11, 0x11, 0x22, 0x22, 0x23, 0x11, 0xa8, 0xcb, 0xcb, 0x8a, 0x41, + 0x34, 0x12, 0x99, 0xba, 0xbc, 0x9c, 0x20, 0x81, 0xff, 0xbc, 0xbd, 0xdb, 0xbb, 0xac, 0xa9, 0xba, + 0xcc, 0xbb, 0xac, 0xab, 0xab, 0xbb, 0xdc, 0xcb, 0xcb, 0xaa, 0xbb, 0xbc, 0xab, 0xbb, 0xcc, 0xbc, + 0xbb, 0xaa, 0x9b, 0xba, 0xcb, 0xbc, 0xad, 0xbb, 0xaa, 0xba, 0x99, 0x11, 0x02, 0xc9, 0xce, 0xbb, + 0xab, 0xab, 0xab, 0xaa, 0xbc, 0xab, 0x28, 0x44, 0x53, 0x44, 0x43, 0x23, 0x00, 0x00, 0x42, 0x34, + 0x35, 0x43, 0x23, 0x34, 0x44, 0x43, 0x33, 0x33, 0x32, 0x43, 0x43, 0x42, 0x43, 0x34, 0x33, 0x33, + 0x23, 0x32, 0x45, 0x44, 0x34, 0x33, 0x22, 0x11, 0x11, 0x22, 0x42, 0x34, 0x44, 0x43, 0x33, 0x43, + 0x34, 0x34, 0x34, 0x33, 0x13, 0x11, 0x00, 0x32, 0x45, 0x34, 0x43, 0x32, 0x22, 0x32, 0x22, 0x81, + 0x88, 0xaa, 0xaa, 0x89, 0x65, 0x45, 0x34, 0x24, 0x01, 0x88, 0x89, 0x28, 0x43, 0x34, 0x33, 0x23, + 0x22, 0x33, 0x44, 0x34, 0x24, 0x32, 0x21, 0x21, 0x53, 0x54, 0x44, 0x33, 0x22, 0x01, 0x08, 0x11, + 0x42, 0x43, 0x33, 0x22, 0x34, 0x45, 0x33, 0x34, 0x32, 0x21, 0x88, 0x09, 0x73, 0x45, 0x44, 0x22, + 0x01, 0x80, 0x99, 0x89, 0x99, 0xba, 0xbd, 0xac, 0x9b, 0x20, 0x46, 0x44, 0x23, 0x01, 0xda, 0xbc, + 0xbb, 0x9a, 0xaa, 0xcb, 0xcc, 0xab, 0x9b, 0x98, 0x80, 0x99, 0xdd, 0xcd, 0xbc, 0xbc, 0xba, 0xa9, + 0x99, 0xcb, 0xbc, 0xbb, 0xab, 0x9a, 0xaa, 0xeb, 0xcc, 0xdb, 0xbc, 0xbb, 0xbb, 0xbb, 0xba, 0x9a, + 0xba, 0xaa, 0xab, 0xdb, 0xdc, 0xcc, 0xcb, 0xbb, 0xac, 0xab, 0xbb, 0xbc, 0xab, 0xbb, 0xca, 0xba, + 0x9b, 0x8a, 0x99, 0xbb, 0xbc, 0xdb, 0xcb, 0x9b, 0x89, 0x88, 0x08, 0x53, 0x45, 0x22, 0x22, 0x42, + 0x23, 0x11, 0x00, 0xca, 0xde, 0xbb, 0x8b, 0x51, 0x45, 0x33, 0x23, 0x01, 0xa9, 0xa9, 0x30, 0x55, + 0x33, 0x14, 0x12, 0x00, 0x98, 0x28, 0x54, 0x34, 0x43, 0x32, 0x43, 0x43, 0x43, 0x12, 0xd9, 0xcd, + 0xbc, 0xab, 0xab, 0xab, 0x9a, 0x89, 0xaa, 0xbc, 0xbd, 0xcc, 0xcc, 0xcb, 0xdb, 0xcb, 0xbb, 0x9a, + 0x09, 0x88, 0x98, 0xa9, 0xcc, 0xdb, 0xbb, 0xbb, 0xbb, 0xba, 0xcc, 0xcc, 0xac, 0xbb, 0xcb, 0xba, + 0xcb, 0xcb, 0xba, 0xab, 0xbb, 0xcb, 0xaa, 0xbb, 0xdb, 0xcb, 0xcb, 0xaa, 0xaa, 0x99, 0x98, 0x98, + 0x98, 0x88, 0x08, 0x10, 0x20, 0x63, 0x55, 0x44, 0x33, 0x33, 0x53, 0x63, 0x33, 0x35, 0x32, 0x22, + 0x12, 0x22, 0x43, 0x43, 0x44, 0x33, 0x34, 0x42, 0x42, 0x43, 0x34, 0x35, 0x34, 0x43, 0x22, 0x32, + 0x43, 0x43, 0x33, 0x34, 0x33, 0x43, 0x43, 0x33, 0x34, 0x34, 0x43, 0x33, 0x43, 0x33, 0x35, 0x34, + 0x34, 0x22, 0x12, 0x12, 0x21, 0x33, 0x44, 0x33, 0x32, 0x12, 0x22, 0x44, 0x34, 0x45, 0x22, 0x02, + 0x98, 0xab, 0x09, 0x42, 0x25, 0x23, 0x01, 0x99, 0xbb, 0xcd, 0xbc, 0xbc, 0xac, 0xcb, 0xcb, 0xba, + 0xa9, 0x98, 0xba, 0xdd, 0xbc, 0xac, 0xab, 0xba, 0xcc, 0xdb, 0xcb, 0xba, 0xbb, 0xab, 0xaa, 0xbb, + 0xcc, 0xcb, 0xbb, 0xbb, 0x89, 0x89, 0xda, 0xdc, 0xbc, 0xab, 0x9b, 0x9a, 0x88, 0x98, 0xa8, 0xca, + 0xcb, 0xcb, 0xba, 0xcb, 0xcc, 0xcb, 0xab, 0x19, 0x52, 0x33, 0x33, 0x11, 0x98, 0x9a, 0x08, 0x43, + 0x43, 0x34, 0x33, 0x44, 0x63, 0x34, 0x35, 0x33, 0x23, 0x11, 0x20, 0x42, 0x45, 0x44, 0x32, 0x23, + 0x13, 0x32, 0x32, 0x44, 0x33, 0x43, 0x23, 0x22, 0x53, 0x34, 0x35, 0x33, 0x22, 0x22, 0x31, 0x45, + 0x44, 0x43, 0x43, 0x32, 0x32, 0x22, 0x33, 0x43, 0x33, 0x23, 0x22, 0x32, 0x63, 0x34, 0x44, 0x23, + 0x22, 0x10, 0x00, 0x11, 0x21, 0x52, 0x53, 0x33, 0x34, 0x24, 0x23, 0x13, 0x80, 0xa9, 0xa9, 0x18, + 0x54, 0x44, 0x44, 0x43, 0x33, 0x34, 0x33, 0x33, 0x22, 0x32, 0x12, 0x22, 0x21, 0x33, 0x32, 0x43, + 0x73, 0x46, 0x44, 0x34, 0x43, 0x12, 0x01, 0x00, 0x00, 0x31, 0x43, 0x33, 0x43, 0x23, 0x34, 0x45, + 0x43, 0x24, 0x12, 0x80, 0xb9, 0xbc, 0x9a, 0x10, 0x44, 0x43, 0x33, 0x22, 0x12, 0x11, 0x11, 0x01, + 0xc9, 0xde, 0xcc, 0xcb, 0xbb, 0xac, 0xac, 0xbb, 0xba, 0x9a, 0x80, 0x01, 0xa8, 0xcf, 0xcd, 0xbd, + 0xbc, 0xbb, 0xbb, 0xbb, 0xcb, 0xbb, 0xcb, 0xcb, 0xba, 0xbb, 0xbc, 0xcc, 0xcb, 0xac, 0xbb, 0xab, + 0xcb, 0xba, 0xbd, 0xbb, 0xbc, 0xbb, 0xbc, 0xbc, 0xbc, 0xbb, 0xbc, 0xcb, 0xcb, 0xbc, 0xcb, 0xbb, + 0xbb, 0xab, 0x89, 0x00, 0x01, 0x98, 0xca, 0xbc, 0xbc, 0xcb, 0xbc, 0xbc, 0xaa, 0x18, 0x42, 0x34, + 0x34, 0x32, 0x11, 0x98, 0xbb, 0xbb, 0x9a, 0x00, 0xc8, 0xbe, 0xab, 0x61, 0x45, 0x33, 0x24, 0x23, + 0x23, 0x11, 0x11, 0x73, 0x63, 0x32, 0x22, 0x80, 0x89, 0x41, 0x46, 0x33, 0x22, 0x11, 0x21, 0x32, + 0x33, 0x03, 0xfa, 0xdc, 0xcc, 0xcb, 0xab, 0xaa, 0x89, 0xba, 0xce, 0xbc, 0xbb, 0xab, 0x89, 0x99, + 0xdb, 0xbc, 0xbd, 0xbb, 0xbb, 0xaa, 0x99, 0xbb, 0xce, 0xbc, 0xbc, 0xac, 0xba, 0xdb, 0xbb, 0xcb, + 0xab, 0xab, 0xba, 0xcb, 0xdb, 0xba, 0xbc, 0xbb, 0xbc, 0xbb, 0xbc, 0xcc, 0xcb, 0xab, 0xaa, 0x08, + 0x80, 0xa9, 0xcb, 0xbb, 0x9a, 0x42, 0x45, 0x34, 0x33, 0x22, 0x00, 0x00, 0x21, 0x53, 0x33, 0x11, + 0x00, 0x10, 0x75, 0x54, 0x43, 0x24, 0x23, 0x22, 0x23, 0x53, 0x43, 0x43, 0x43, 0x32, 0x33, 0x34, + 0x35, 0x44, 0x32, 0x23, 0x32, 0x32, 0x44, 0x53, 0x34, 0x43, 0x32, 0x23, 0x33, 0x53, 0x43, 0x43, + 0x33, 0x33, 0x33, 0x43, 0x32, 0x43, 0x32, 0x33, 0x24, 0x33, 0x35, 0x36, 0x34, 0x34, 0x23, 0x11, + 0x00, 0x88, 0x88, 0x88, 0x08, 0x20, 0x44, 0x44, 0x43, 0x23, 0x12, 0xa8, 0xdc, 0xbc, 0xbc, 0x9a, + 0x99, 0x98, 0xa9, 0xba, 0xbc, 0xbe, 0xbd, 0xbd, 0xbc, 0xcb, 0xbb, 0xba, 0xac, 0xbb, 0xcb, 0xcb, + 0xbb, 0xcb, 0xbb, 0xbb, 0xbd, 0xbb, 0xcb, 0xba, 0xbb, 0xdc, 0xcb, 0xbb, 0xbc, 0xba, 0xaa, 0xaa, + 0xba, 0xac, 0xac, 0xcb, 0xba, 0xcb, 0xbb, 0xad, 0xac, 0x9a, 0x88, 0x22, 0x33, 0x12, 0xa8, 0xcc, + 0xac, 0x9b, 0x09, 0x43, 0x35, 0x35, 0x43, 0x43, 0x34, 0x34, 0x33, 0x43, 0x22, 0x32, 0x34, 0x34, + 0x44, 0x32, 0x43, 0x32, 0x23, 0x33, 0x44, 0x33, 0x33, 0x33, 0x43, 0x44, 0x63, 0x43, 0x43, 0x33, + 0x43, 0x33, 0x34, 0x33, 0x43, 0x32, 0x22, 0x11, 0x21, 0x53, 0x54, 0x34, 0x34, 0x33, 0x32, 0x33, + 0x23, 0x12, 0x02, 0x21, 0x31, 0x44, 0x32, 0x33, 0x53, 0x42, 0x32, 0x34, 0x34, 0x35, 0x32, 0x23, + 0x02, 0x10, 0x41, 0x44, 0x44, 0x32, 0x24, 0x33, 0x33, 0x43, 0x24, 0x24, 0x12, 0x81, 0x88, 0x0a, + 0x61, 0x54, 0x53, 0x32, 0x43, 0x32, 0x33, 0x33, 0x33, 0x33, 0x22, 0x00, 0x88, 0x30, 0x57, 0x35, + 0x34, 0x32, 0x21, 0x22, 0x53, 0x43, 0x24, 0x23, 0x23, 0x11, 0x98, 0xba, 0xac, 0x8a, 0x21, 0x43, + 0x34, 0x35, 0x45, 0x22, 0x81, 0xda, 0xcc, 0xbb, 0xbb, 0xcb, 0xba, 0xac, 0xab, 0xba, 0xaa, 0xcb, + 0xcd, 0xcd, 0xcc, 0xdb, 0xbb, 0xac, 0x9a, 0x9a, 0xa9, 0xba, 0xbb, 0xbc, 0xbb, 0xbc, 0xdb, 0xdb, + 0xcb, 0xcb, 0xcb, 0xba, 0xba, 0xbc, 0xcb, 0xac, 0xbb, 0xba, 0xba, 0xbc, 0xcc, 0xdb, 0xbb, 0xcb, + 0xaa, 0xaa, 0xaa, 0xcb, 0xbc, 0xbc, 0xaa, 0x99, 0x00, 0x00, 0x98, 0xdb, 0xbc, 0xbc, 0x9a, 0x08, + 0x01, 0x98, 0xeb, 0xba, 0x09, 0x51, 0x43, 0x22, 0x80, 0xa9, 0xaa, 0xaa, 0x09, 0x31, 0x23, 0x91, + 0x9a, 0x73, 0x77, 0x34, 0x24, 0x02, 0x80, 0x09, 0x52, 0x45, 0x34, 0x33, 0x23, 0x12, 0x21, 0x31, + 0x53, 0x23, 0x02, 0xfb, 0xcc, 0xbb, 0x9b, 0x89, 0x90, 0xb9, 0xdd, 0xcb, 0xac, 0xbb, 0xaa, 0x99, + 0xaa, 0xcb, 0xbc, 0xbc, 0xbc, 0xbc, 0xcd, 0xcc, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xba, 0xca, 0xcb, + 0xcb, 0xbc, 0xbc, 0xbc, 0xbc, 0xdb, 0xba, 0xcb, 0xbb, 0xcc, 0xba, 0xab, 0xbb, 0xaa, 0xba, 0xaa, + 0xbb, 0xbb, 0xaa, 0xbb, 0xcd, 0xcb, 0xab, 0x9a, 0x08, 0x42, 0x34, 0x24, 0x01, 0xa9, 0xcc, 0xab, + 0x08, 0x31, 0x54, 0x63, 0x44, 0x53, 0x43, 0x23, 0x32, 0x21, 0x01, 0x11, 0x31, 0x44, 0x45, 0x53, + 0x33, 0x43, 0x43, 0x33, 0x34, 0x34, 0x32, 0x43, 0x33, 0x53, 0x33, 0x35, 0x43, 0x33, 0x24, 0x23, + 0x43, 0x42, 0x33, 0x53, 0x32, 0x24, 0x33, 0x24, 0x33, 0x33, 0x33, 0x34, 0x34, 0x34, 0x35, 0x43, + 0x33, 0x22, 0x00, 0x08, 0x10, 0x32, 0x34, 0x34, 0x43, 0x43, 0x34, 0x33, 0x33, 0x12, 0x98, 0xdc, + 0xcc, 0xab, 0x9a, 0x08, 0x88, 0xb8, 0xbd, 0xbd, 0xcc, 0xcb, 0xcc, 0xbb, 0xbb, 0xac, 0xbb, 0xba, + 0xbb, 0xcb, 0xcb, 0xbc, 0xbc, 0xbb, 0xbb, 0xcd, 0xcb, 0xbc, 0xbb, 0xbb, 0xaa, 0xaa, 0xba, 0xba, + 0xcc, 0xdb, 0xbb, 0xbc, 0xac, 0xbb, 0xbc, 0xbb, 0xaa, 0x8a, 0x88, 0xa8, 0xdb, 0xcc, 0xac, 0xab, + 0xab, 0xaa, 0x99, 0x08, 0x31, 0x64, 0x53, 0x34, 0x43, 0x32, 0x23, 0x23, 0x33, 0x43, 0x33, 0x32, + 0x43, 0x43, 0x53, 0x44, 0x43, 0x34, 0x24, 0x33, 0x33, 0x34, 0x33, 0x43, 0x22, 0x22, 0x43, 0x44, + 0x44, 0x53, 0x33, 0x33, 0x33, 0x33, 0x43, 0x42, 0x33, 0x35, 0x43, 0x33, 0x43, 0x43, 0x34, 0x32, + 0x24, 0x22, 0x12, 0x12, 0x22, 0x32, 0x24, 0x33, 0x23, 0x32, 0x44, 0x45, 0x34, 0x34, 0x22, 0x23, + 0x22, 0x33, 0x34, 0x23, 0x12, 0x98, 0xaa, 0x8a, 0x73, 0x47, 0x53, 0x33, 0x23, 0x11, 0x11, 0x21, + 0x33, 0x35, 0x33, 0x22, 0x12, 0x31, 0x64, 0x54, 0x43, 0x33, 0x22, 0x12, 0x11, 0x22, 0x43, 0x24, + 0x23, 0x34, 0x43, 0x44, 0x43, 0x34, 0x43, 0x22, 0x11, 0x00, 0x10, 0x31, 0x43, 0x23, 0x80, 0x9a, + 0x18, 0x54, 0x36, 0x24, 0x23, 0x01, 0x80, 0x80, 0x88, 0x88, 0xca, 0xde, 0xbd, 0xbd, 0xcb, 0xaa, + 0xba, 0xba, 0xcb, 0xcb, 0xbb, 0xbc, 0xbd, 0xcc, 0xcb, 0xbb, 0xcb, 0xba, 0xbb, 0xbc, 0xcb, 0xbb, + 0xcc, 0xbb, 0xbc, 0xcb, 0xdb, 0xbb, 0xbc, 0xbb, 0xac, 0xbb, 0xbc, 0xcb, 0xcb, 0xbb, 0xbc, 0xbc, + 0xbc, 0xbb, 0xcb, 0xba, 0xaa, 0xba, 0xbb, 0xbd, 0xcb, 0xcb, 0xab, 0xbb, 0xbb, 0xbb, 0xac, 0xaa, + 0x9a, 0x89, 0x89, 0xb9, 0xce, 0xcc, 0xab, 0x9b, 0x09, 0x10, 0x11, 0x81, 0xa9, 0xcb, 0xbb, 0xab, + 0x8b, 0x63, 0x35, 0x34, 0x45, 0x44, 0x44, 0x43, 0x23, 0x23, 0x32, 0x34, 0x44, 0x32, 0x23, 0x11, + 0x80, 0xa9, 0xdb, 0xbb, 0x8a, 0x18, 0x41, 0x44, 0x44, 0x33, 0x03, 0xda, 0xcf, 0xcb, 0xcb, 0xaa, + 0x9a, 0xaa, 0xa9, 0xaa, 0xbb, 0xbb, 0xcd, 0xdb, 0xbc, 0xbd, 0xbc, 0xbb, 0xaa, 0x88, 0x08, 0xa8, + 0xeb, 0xcc, 0xcb, 0xbc, 0xbc, 0xbb, 0xbc, 0xac, 0xab, 0xbb, 0xba, 0xba, 0xbb, 0xcc, 0xcb, 0xab, + 0xbb, 0xab, 0xbc, 0xdb, 0xbb, 0xad, 0xbb, 0xaa, 0x99, 0x99, 0x98, 0x08, 0x10, 0x31, 0x34, 0x33, + 0x80, 0xdb, 0xbc, 0x8a, 0x31, 0x57, 0x34, 0x35, 0x43, 0x32, 0x43, 0x32, 0x43, 0x33, 0x34, 0x35, + 0x34, 0x44, 0x33, 0x44, 0x32, 0x24, 0x24, 0x23, 0x24, 0x33, 0x24, 0x43, 0x33, 0x53, 0x33, 0x35, + 0x43, 0x33, 0x43, 0x43, 0x42, 0x32, 0x32, 0x33, 0x33, 0x44, 0x42, 0x33, 0x34, 0x34, 0x33, 0x24, + 0x32, 0x32, 0x43, 0x43, 0x33, 0x24, 0x33, 0x43, 0x43, 0x33, 0x34, 0x33, 0x12, 0x01, 0x80, 0x88, + 0x11, 0x12, 0x02, 0xb9, 0xce, 0xac, 0xac, 0xbb, 0xbd, 0xcc, 0xbc, 0xbc, 0xcb, 0xbb, 0xcb, 0xcb, + 0xbb, 0xbc, 0xcb, 0xab, 0xab, 0xcb, 0xcc, 0xcc, 0xcb, 0xbb, 0xac, 0xaa, 0xa9, 0xaa, 0xbb, 0xbc, + 0xcb, 0xcb, 0xba, 0xcb, 0xcb, 0xdb, 0xbb, 0xbc, 0xba, 0xaa, 0xa9, 0xaa, 0xcb, 0xcb, 0xba, 0xbb, + 0xab, 0x9a, 0xa9, 0xa9, 0xab, 0x9a, 0x18, 0x31, 0x43, 0x54, 0x43, 0x35, 0x45, 0x33, 0x33, 0x23, + 0x22, 0x33, 0x53, 0x44, 0x44, 0x43, 0x43, 0x42, 0x32, 0x24, 0x24, 0x33, 0x33, 0x23, 0x43, 0x32, + 0x44, 0x43, 0x34, 0x35, 0x43, 0x24, 0x33, 0x24, 0x33, 0x32, 0x43, 0x32, 0x33, 0x34, 0x43, 0x33, + 0x35, 0x43, 0x34, 0x33, 0x43, 0x32, 0x22, 0x21, 0x22, 0x43, 0x34, 0x24, 0x24, 0x32, 0x24, 0x43, + 0x32, 0x22, 0x33, 0x32, 0x24, 0x32, 0x43, 0x43, 0x43, 0x34, 0x24, 0x43, 0x43, 0x34, 0x33, 0x34, + 0x33, 0x24, 0x33, 0x33, 0x32, 0x33, 0x43, 0x53, 0x53, 0x43, 0x43, 0x34, 0x43, 0x33, 0x24, 0x33, + 0x24, 0x33, 0x33, 0x24, 0x43, 0x43, 0x34, 0x34, 0x23, 0x33, 0x32, 0x43, 0x24, 0x24, 0x33, 0x53, + 0x33, 0x43, 0x24, 0x24, 0x33, 0x23, 0x80, 0xba, 0xbe, 0xac, 0xaa, 0x99, 0x99, 0xaa, 0xaa, 0xcb, + 0xba, 0xcc, 0xcd, 0xbd, 0xcc, 0xbb, 0xac, 0xab, 0xbb, 0xcb, 0xbd, 0xcc, 0xcb, 0xbb, 0xac, 0xbb, + 0xdb, 0xca, 0xba, 0xbc, 0xbb, 0xcb, 0xbb, 0xbd, 0xcb, 0xcb, 0xcb, 0xca, 0xba, 0xbb, 0xbc, 0xbc, + 0xcb, 0xbb, 0xba, 0xbb, 0xcb, 0xbb, 0xcb, 0xbb, 0xbd, 0xcb, 0xbc, 0xac, 0xbb, 0xab, 0xba, 0x99, + 0x99, 0x88, 0xa9, 0xcc, 0xcc, 0xbc, 0xbc, 0xcb, 0xab, 0x9b, 0x99, 0x00, 0x22, 0x32, 0x32, 0x22, + 0x21, 0x11, 0x11, 0x43, 0x35, 0x45, 0x45, 0x53, 0x34, 0x33, 0x24, 0x13, 0x12, 0x22, 0x42, 0x24, + 0x23, 0x12, 0x01, 0x00, 0x18, 0x52, 0x55, 0x53, 0x33, 0x23, 0x80, 0xb9, 0xcc, 0xcc, 0xbc, 0xcd, + 0xbb, 0xcb, 0x9a, 0x89, 0x10, 0x10, 0x80, 0xb9, 0xce, 0xcc, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc, 0xcb, + 0xba, 0xaa, 0xba, 0xcb, 0xbc, 0xbd, 0xbc, 0xcb, 0xcb, 0xba, 0xcb, 0xbb, 0xac, 0xbb, 0xbb, 0xbb, + 0xcb, 0xcb, 0xbc, 0xbc, 0xcb, 0xab, 0xab, 0xba, 0xaa, 0xbb, 0xbb, 0xbb, 0xaa, 0x99, 0xa9, 0xdc, + 0xcc, 0xbc, 0xab, 0x8a, 0x10, 0x33, 0x34, 0x33, 0x33, 0x54, 0x63, 0x53, 0x43, 0x33, 0x24, 0x43, + 0x32, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x43, 0x33, 0x25, 0x24, 0x33, 0x43, 0x43, 0x43, 0x43, + 0x32, 0x34, 0x33, 0x44, 0x32, 0x33, 0x34, 0x33, 0x43, 0x33, 0x44, 0x33, 0x35, 0x43, 0x32, 0x33, + 0x24, 0x23, 0x33, 0x34, 0x43, 0x43, 0x43, 0x43, 0x32, 0x43, 0x32, 0x33, 0x43, 0x32, 0x22, 0x12, + 0x12, 0x11, 0x00, 0x00, 0x22, 0x33, 0x13, 0x80, 0xca, 0xbc, 0xcc, 0xcc, 0xbd, 0xcc, 0xbc, 0xbc, + 0xcc, 0xba, 0xac, 0xba, 0xab, 0xbc, 0xbb, 0xbc, 0xbc, 0xdb, 0xbb, 0xbd, 0xbb, 0xbc, 0xbb, 0xdb, + 0xba, 0xbb, 0xbc, 0xba, 0xbc, 0xcb, 0xbc, 0xbc, 0xdb, 0xbb, 0xcb, 0xba, 0xaa, 0xab, 0xaa, 0xaa, + 0xa9, 0xba, 0xca, 0xbc, 0xbd, 0xac, 0xbb, 0xab, 0x9a, 0x08, 0x00, 0x20, 0x32, 0x36, 0x44, 0x43, + 0x23, 0x13, 0x22, 0x22, 0x53, 0x43, 0x34, 0x34, 0x33, 0x43, 0x53, 0x53, 0x43, 0x43, 0x23, 0x33, + 0x24, 0x43, 0x43, 0x34, 0x43, 0x43, 0x32, 0x43, 0x43, 0x34, 0x43, 0x33, 0x23, 0x33, 0x43, 0x33, + 0x34, 0x34, 0x43, 0x43, 0x32, 0x34, 0x34, 0x43, 0x24, 0x23, 0x22, 0x21, 0x11, 0x22, 0x33, 0x34, + 0x44, 0x33, 0x34, 0x43, 0x22, 0x33, 0x33, 0x44, 0x33, 0x43, 0x34, 0x53, 0x32, 0x33, 0x22, 0x23, + 0x33, 0x34, 0x34, 0x53, 0x33, 0x35, 0x25, 0x43, 0x32, 0x32, 0x43, 0x33, 0x34, 0x43, 0x43, 0x43, + 0x42, 0x22, 0x33, 0x33, 0x34, 0x33, 0x33, 0x34, 0x44, 0x44, 0x34, 0x43, 0x23, 0x23, 0x22, 0x22, + 0x32, 0x44, 0x44, 0x33, 0x24, 0x13, 0x12, 0x22, 0x22, 0x12, 0x11, 0x88, 0x88, 0x42, 0x46, 0x44, + 0x23, 0x80, 0xfb, 0xcc, 0xbc, 0xbb, 0xac, 0x9a, 0x9a, 0x99, 0x98, 0x98, 0x99, 0xcc, 0xcd, 0xcd, + 0xcb, 0xac, 0xbb, 0xaa, 0x9a, 0xaa, 0xbb, 0xbd, 0xcc, 0xbb, 0xcb, 0xac, 0xac, 0xbc, 0xcb, 0xcb, + 0xbb, 0xac, 0xbb, 0xbc, 0xcb, 0xbb, 0xbb, 0xac, 0xba, 0xca, 0xca, 0xbb, 0xad, 0xbb, 0xbb, 0x9a, + 0xaa, 0xca, 0xcb, 0xbc, 0xac, 0xba, 0xba, 0xbc, 0xcc, 0xcb, 0xbb, 0xbb, 0x9b, 0x88, 0x21, 0x23, + 0x11, 0x98, 0x89, 0x88, 0x99, 0xea, 0xdc, 0xcb, 0xab, 0x99, 0x10, 0x54, 0x36, 0x45, 0x43, 0x33, + 0x33, 0x33, 0x13, 0x11, 0x00, 0x21, 0x45, 0x44, 0x33, 0x22, 0x01, 0x88, 0xbb, 0xbe, 0xbd, 0xbc, + 0xab, 0xbb, 0xaa, 0x89, 0x00, 0x22, 0x13, 0xc9, 0xcf, 0xbd, 0xbd, 0xac, 0xac, 0xab, 0xba, 0xa9, + 0xaa, 0xdb, 0xdb, 0xbc, 0xcb, 0xac, 0xcb, 0xbb, 0xbc, 0xbd, 0xcb, 0xbb, 0xac, 0xbb, 0xba, 0xcb, + 0xcb, 0xbb, 0xbd, 0xbb, 0xbc, 0xac, 0xbb, 0xab, 0xbb, 0xba, 0xaa, 0xab, 0xbc, 0xbc, 0xbc, 0xbc, + 0xcb, 0xcb, 0xcb, 0xaa, 0xaa, 0x08, 0x20, 0x32, 0x24, 0x11, 0x80, 0x88, 0x10, 0x31, 0x44, 0x34, + 0x63, 0x44, 0x44, 0x34, 0x34, 0x43, 0x23, 0x43, 0x32, 0x43, 0x43, 0x43, 0x24, 0x24, 0x43, 0x43, + 0x43, 0x34, 0x33, 0x34, 0x33, 0x43, 0x43, 0x33, 0x34, 0x33, 0x24, 0x33, 0x33, 0x35, 0x44, 0x43, + 0x33, 0x34, 0x33, 0x34, 0x43, 0x32, 0x33, 0x33, 0x33, 0x33, 0x45, 0x43, 0x34, 0x24, 0x33, 0x23, + 0x22, 0x23, 0x43, 0x43, 0x22, 0x22, 0x22, 0x42, 0x34, 0x44, 0x32, 0x11, 0x90, 0xca, 0xcc, 0xdb, + 0xba, 0xbc, 0xbb, 0xcc, 0xbb, 0xab, 0xab, 0xaa, 0xb9, 0xca, 0xcb, 0xdb, 0xbb, 0xbd, 0xbd, 0xbc, + 0xdb, 0xba, 0xbb, 0xbb, 0xac, 0xbb, 0xcb, 0xbb, 0xbc, 0xbb, 0xbd, 0xcb, 0xdb, 0xbb, 0xbc, 0xac, + 0xbb, 0xbb, 0xba, 0xbb, 0xba, 0xba, 0xcb, 0xcb, 0xdb, 0xbb, 0xbb, 0xab, 0x88, 0x21, 0x33, 0x34, + 0x33, 0x23, 0x33, 0x44, 0x43, 0x12, 0x90, 0xa9, 0x09, 0x65, 0x45, 0x43, 0x33, 0x23, 0x23, 0x34, + 0x44, 0x44, 0x43, 0x43, 0x32, 0x23, 0x23, 0x34, 0x43, 0x43, 0x43, 0x42, 0x42, 0x43, 0x43, 0x43, + 0x33, 0x33, 0x32, 0x33, 0x24, 0x34, 0x53, 0x43, 0x33, 0x43, 0x22, 0x33, 0x33, 0x24, 0x23, 0x33, + 0x53, 0x33, 0x35, 0x44, 0x33, 0x34, 0x22, 0x12, 0x00, 0x00, 0x31, 0x44, 0x43, 0x24, 0x24, 0x23, + 0x33, 0x22, 0x12, 0x11, 0x11, 0x42, 0x46, 0x44, 0x53, 0x33, 0x33, 0x22, 0x12, 0x10, 0x21, 0x43, + 0x34, 0x34, 0x44, 0x42, 0x42, 0x32, 0x43, 0x32, 0x24, 0x22, 0x11, 0x11, 0x22, 0x34, 0x44, 0x43, + 0x34, 0x53, 0x33, 0x44, 0x32, 0x43, 0x32, 0x33, 0x22, 0x22, 0x11, 0x01, 0x21, 0x32, 0x25, 0x43, + 0x33, 0x34, 0x33, 0x11, 0xa8, 0xdc, 0xbd, 0xcb, 0xcb, 0xba, 0xdb, 0xbc, 0xbd, 0xbd, 0xbb, 0xba, + 0xab, 0xaa, 0xcb, 0xdc, 0xcb, 0xcb, 0xcb, 0xba, 0xba, 0xbb, 0xbc, 0xbd, 0xcc, 0xcb, 0xcb, 0xcb, + 0xdb, 0xca, 0xba, 0xbb, 0xbb, 0xbb, 0xab, 0xbb, 0xbb, 0xcc, 0xcb, 0xcc, 0xcb, 0xcb, 0xbb, 0xcb, + 0xba, 0xaa, 0xba, 0xba, 0xcb, 0xcb, 0xcb, 0xbb, 0xbb, 0xcb, 0xcb, 0xbb, 0xbb, 0xba, 0x9a, 0x9a, + 0xba, 0xdc, 0xcc, 0xcb, 0xbb, 0xbc, 0xba, 0xa9, 0xaa, 0x99, 0x11, 0x45, 0x35, 0x34, 0x33, 0x33, + 0x33, 0x43, 0x34, 0x44, 0x32, 0x33, 0x33, 0x34, 0x44, 0x44, 0x34, 0x32, 0x11, 0x88, 0xba, 0xab, + 0xaa, 0xa9, 0xaa, 0xac, 0x9b, 0x09, 0x42, 0x36, 0x33, 0xc0, 0xde, 0xcd, 0xcb, 0xba, 0xab, 0xa9, + 0x99, 0x9a, 0xba, 0xbb, 0xcd, 0xbc, 0xce, 0xdb, 0xcb, 0xbb, 0xac, 0xbb, 0xaa, 0xba, 0xca, 0xcb, + 0xdb, 0xbb, 0xbc, 0xbc, 0xac, 0xcb, 0xbb, 0xbb, 0xbc, 0xca, 0xaa, 0xab, 0xbb, 0xbb, 0xcb, 0xcb, + 0xbb, 0xdb, 0xbb, 0xbc, 0xbc, 0xbb, 0xac, 0xaa, 0x99, 0x88, 0x10, 0x22, 0x33, 0x23, 0x11, 0xb9, + 0xdb, 0xab, 0x9b, 0x28, 0x65, 0x45, 0x44, 0x43, 0x34, 0x33, 0x34, 0x34, 0x42, 0x33, 0x53, 0x43, + 0x43, 0x33, 0x53, 0x33, 0x44, 0x33, 0x43, 0x24, 0x32, 0x33, 0x34, 0x43, 0x43, 0x43, 0x43, 0x33, + 0x34, 0x33, 0x25, 0x24, 0x33, 0x24, 0x33, 0x32, 0x24, 0x33, 0x24, 0x24, 0x33, 0x34, 0x24, 0x24, + 0x43, 0x42, 0x33, 0x43, 0x32, 0x23, 0x23, 0x23, 0x33, 0x23, 0x33, 0x24, 0x23, 0x33, 0x32, 0x33, + 0x33, 0xb0, 0xde, 0xcc, 0xbc, 0xab, 0xbb, 0xbb, 0xbd, 0xbd, 0xbc, 0xbc, 0xcb, 0xcb, 0xcb, 0xbb, + 0xbc, 0xcb, 0xbb, 0xbb, 0xcb, 0xcb, 0xbc, 0xbd, 0xcb, 0xac, 0xba, 0xba, 0xba, 0xbc, 0xbc, 0xcb, + 0xbc, 0xca, 0xba, 0xbb, 0xcb, 0xcb, 0xba, 0xbb, 0xbb, 0xba, 0xca, 0xba, 0xcc, 0xba, 0xac, 0xaa, + 0xa9, 0x88, 0x88, 0x88, 0xa9, 0xaa, 0xab, 0x99, 0x30, 0x55, 0x44, 0x34, 0x35, 0x33, 0x24, 0x22, + 0x21, 0x22, 0x43, 0x44, 0x53, 0x34, 0x53, 0x33, 0x34, 0x43, 0x33, 0x43, 0x33, 0x43, 0x32, 0x34, + 0x53, 0x43, 0x43, 0x34, 0x33, 0x25, 0x33, 0x33, 0x43, 0x33, 0x33, 0x34, 0x43, 0x33, 0x34, 0x34, + 0x34, 0x34, 0x43, 0x23, 0x33, 0x33, 0x22, 0x22, 0x33, 0x34, 0x45, 0x33, 0x24, 0x24, 0x33, 0x24, + 0x23, 0x32, 0x32, 0x33, 0x43, 0x32, 0x43, 0x34, 0x44, 0x43, 0x43, 0x33, 0x34, 0x34, 0x43, 0x33, + 0x43, 0x32, 0x24, 0x32, 0x12, 0x32, 0x32, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, 0x33, 0x34, 0x33, + 0x24, 0x33, 0x24, 0x43, 0x33, 0x35, 0x34, 0x43, 0x32, 0x22, 0x22, 0x33, 0x35, 0x33, 0x34, 0x34, + 0x34, 0x43, 0x34, 0x33, 0x33, 0x13, 0x98, 0xcc, 0xbd, 0xba, 0xaa, 0x9a, 0xaa, 0xa9, 0xab, 0xab, + 0xbb, 0xdd, 0xdc, 0xbd, 0xbc, 0xbc, 0xac, 0xab, 0xbb, 0xbc, 0xbd, 0xcc, 0xcb, 0xbb, 0xcb, 0xbb, + 0xbc, 0xcb, 0xbc, 0xbb, 0xcb, 0xcb, 0xca, 0xba, 0xbc, 0xbc, 0xac, 0xcb, 0xbb, 0xcb, 0xcb, 0xbb, + 0xbc, 0xbb, 0xbb, 0xbb, 0xcb, 0xcb, 0xab, 0xbc, 0xcb, 0xcb, 0xbc, 0x7c, 0x02, 0x00, 0x22, 0x56, + 0xf7, 0x02, 0x01, 0x00, 0xe9, 0x02, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0xa8, 0x9a, 0xa0, 0x2d, + 0xfc, 0xf4, 0x9f, 0x16, 0x80, 0xa0, 0xaa, 0x19, 0x35, 0x80, 0xab, 0x10, 0x12, 0xcc, 0x71, 0x84, + 0x9c, 0x10, 0x00, 0x93, 0x29, 0xfd, 0x41, 0xbb, 0x47, 0x9a, 0x98, 0x40, 0xa0, 0x0a, 0x43, 0xa0, + 0x9e, 0x32, 0x98, 0xa4, 0x1f, 0xa3, 0x28, 0xc1, 0x1b, 0x14, 0x90, 0x9a, 0x11, 0xb0, 0x2a, 0x14, + 0xaa, 0x10, 0xa8, 0xad, 0x20, 0x13, 0xa9, 0x9a, 0x39, 0xa4, 0x9d, 0x52, 0xd8, 0x9a, 0x10, 0x14, + 0xdc, 0x08, 0x80, 0x80, 0x88, 0x08, 0x88, 0x88, 0x89, 0x88, 0x88, 0x89, 0x88, 0x08, 0x08, 0x00, + 0x11, 0x11, 0x31, 0x32, 0x21, 0x32, 0x52, 0xd3, 0x77, 0x77, 0xf2, 0x1a, 0x33, 0x82, 0xbc, 0x21, + 0x42, 0xa1, 0x19, 0x12, 0xa8, 0x51, 0x92, 0x62, 0x92, 0x88, 0x00, 0x08, 0x32, 0x45, 0x04, 0xbd, + 0x52, 0x01, 0x88, 0x0b, 0x24, 0x08, 0x88, 0x18, 0x11, 0x80, 0x88, 0x10, 0x80, 0x88, 0x89, 0x99, + 0xa9, 0xbb, 0xbc, 0xcb, 0xbc, 0xbc, 0xdb, 0x8b, 0xff, 0x2b, 0x10, 0xf8, 0x0f, 0x92, 0x2a, 0xb1, + 0xab, 0x8c, 0x02, 0xac, 0x01, 0x9a, 0xfb, 0x0a, 0x02, 0xab, 0x19, 0xf0, 0x8d, 0x20, 0xb1, 0x9d, + 0x08, 0x02, 0xcc, 0x10, 0x9a, 0x11, 0xcd, 0x42, 0xa0, 0xbb, 0x1a, 0x15, 0x89, 0xaa, 0x18, 0x10, + 0x81, 0x9d, 0x91, 0x0a, 0x11, 0x10, 0x10, 0x11, 0x11, 0x12, 0x22, 0x33, 0x44, 0x33, 0x34, 0x35, + 0x43, 0x34, 0x43, 0x43, 0x33, 0x34, 0x43, 0x43, 0x43, 0x21, 0x23, 0x77, 0xa0, 0x51, 0x02, 0x08, + 0x12, 0x31, 0x18, 0x37, 0x0b, 0x35, 0x00, 0x1a, 0x15, 0x1a, 0x37, 0x98, 0x9b, 0x54, 0x82, 0x89, + 0x31, 0x13, 0xcb, 0x21, 0x22, 0x83, 0x29, 0xd2, 0x71, 0xb3, 0x19, 0x82, 0x31, 0xcb, 0x62, 0x01, + 0xc9, 0x2c, 0x06, 0x99, 0x9a, 0x36, 0xaa, 0x09, 0x08, 0x90, 0x29, 0x80, 0x90, 0xbf, 0x42, 0x89, + 0xa2, 0x8f, 0xb2, 0x2a, 0xa2, 0x0c, 0x00, 0xa0, 0x8e, 0x02, 0x9d, 0x92, 0x1b, 0xb3, 0xac, 0x8c, + 0x05, 0x9b, 0xb0, 0x8a, 0x00, 0xba, 0xd9, 0x2c, 0xb2, 0x0d, 0xc9, 0x1a, 0x04, 0xbc, 0x88, 0x19, + 0xf8, 0x1b, 0x81, 0x99, 0xbe, 0x10, 0x11, 0xdb, 0x21, 0xba, 0xda, 0x61, 0xd8, 0x8a, 0x00, 0x10, + 0xb1, 0x8b, 0x90, 0xba, 0x4b, 0xf1, 0x39, 0xd8, 0x98, 0x5a, 0x93, 0xcb, 0x19, 0x92, 0x90, 0x1c, + 0xb3, 0x1c, 0xbc, 0x05, 0x0d, 0x13, 0xb8, 0x8e, 0x23, 0x81, 0xdb, 0x09, 0x11, 0x88, 0x91, 0x1e, + 0x03, 0x8b, 0xb0, 0x68, 0xc9, 0x41, 0x00, 0xa8, 0xaa, 0x0d, 0x33, 0x12, 0x89, 0xdf, 0x50, 0xa1, + 0x98, 0x2a, 0x16, 0x8a, 0xa8, 0x19, 0x31, 0x84, 0xcb, 0x1a, 0x35, 0x98, 0x19, 0x11, 0xca, 0x40, + 0x12, 0x15, 0xaa, 0xd9, 0x79, 0x04, 0x98, 0x8a, 0x43, 0x81, 0x90, 0x1a, 0x24, 0x82, 0x89, 0x41, + 0x03, 0x72, 0xa0, 0x09, 0x73, 0x83, 0x0b, 0x23, 0x18, 0x22, 0x44, 0xc0, 0x39, 0x34, 0x33, 0xa9, + 0x42, 0x81, 0x34, 0x28, 0x17, 0x3b, 0x94, 0x51, 0x90, 0x12, 0x19, 0x04, 0x30, 0x17, 0x9a, 0x82, + 0x5b, 0x07, 0xa8, 0x1a, 0x26, 0x89, 0x9a, 0x33, 0x80, 0x88, 0x09, 0x43, 0x81, 0xb9, 0x2b, 0x37, + 0x82, 0xbc, 0x32, 0x08, 0x83, 0x31, 0xdf, 0x51, 0x91, 0x89, 0x18, 0x81, 0x9a, 0x28, 0xb1, 0x72, + 0xc3, 0xac, 0x30, 0x13, 0xca, 0x28, 0xc0, 0x11, 0x0a, 0xf0, 0x2e, 0x04, 0xca, 0x2b, 0x15, 0xca, + 0x19, 0x12, 0xba, 0x0a, 0x92, 0x8b, 0x10, 0xb1, 0x9f, 0x88, 0xac, 0xa9, 0x28, 0xa4, 0xaf, 0x90, + 0x0a, 0xc1, 0x9c, 0x29, 0xb1, 0x9c, 0xd8, 0x8d, 0x22, 0xc9, 0xcc, 0x38, 0xc2, 0x0a, 0xb0, 0xbb, + 0x08, 0x04, 0xcd, 0x99, 0x00, 0xc8, 0x2a, 0xe2, 0x8c, 0x90, 0x30, 0xea, 0x89, 0x09, 0x11, 0xb8, + 0xbc, 0x89, 0x09, 0x21, 0xd2, 0x9e, 0x09, 0x12, 0xac, 0x01, 0xa8, 0x9c, 0x91, 0x09, 0x88, 0x25, + 0xba, 0x9f, 0x24, 0x99, 0xa0, 0x29, 0x91, 0x52, 0x81, 0xdb, 0x1b, 0x27, 0x00, 0x80, 0x31, 0xa1, + 0x1a, 0x14, 0x89, 0x73, 0x05, 0x98, 0x21, 0x12, 0x10, 0x44, 0x02, 0x88, 0x62, 0x24, 0x88, 0x18, + 0x44, 0x22, 0x21, 0x01, 0x30, 0x35, 0x22, 0x34, 0x23, 0x12, 0x63, 0x24, 0x23, 0x10, 0x44, 0x33, + 0x11, 0x71, 0x24, 0x00, 0x31, 0x23, 0x02, 0x72, 0x14, 0x20, 0x22, 0x22, 0x80, 0x51, 0x23, 0x53, + 0x22, 0x01, 0x9a, 0x52, 0x34, 0x12, 0x18, 0x02, 0x59, 0x07, 0xa9, 0x28, 0x35, 0xb8, 0x9c, 0x51, + 0x82, 0x9c, 0x31, 0x02, 0xeb, 0x28, 0xb1, 0x1b, 0x31, 0xf2, 0x8c, 0x00, 0x00, 0xab, 0x11, 0x9a, + 0xc3, 0xcf, 0x11, 0x18, 0xfa, 0x3d, 0x81, 0x81, 0xae, 0x00, 0x30, 0xd1, 0x0b, 0x81, 0x09, 0xaa, + 0x10, 0x88, 0xa1, 0x8e, 0xd9, 0x29, 0x92, 0x0b, 0xba, 0x08, 0x88, 0x37, 0xef, 0x20, 0x90, 0x09, + 0xa9, 0x02, 0x9c, 0x33, 0xa8, 0xdb, 0x20, 0xe0, 0x1b, 0x14, 0xa2, 0xaf, 0x05, 0x89, 0xca, 0x32, + 0x08, 0xa2, 0x0d, 0x99, 0x41, 0x91, 0xad, 0x10, 0x21, 0xb0, 0x8c, 0x10, 0xc0, 0x68, 0xb2, 0x0d, + 0xa1, 0x08, 0x09, 0x23, 0xeb, 0x1a, 0x84, 0x89, 0x99, 0x08, 0x1a, 0x23, 0xd0, 0xbf, 0x23, 0x19, + 0xb1, 0xa9, 0xbb, 0x73, 0xd1, 0x9b, 0x63, 0xa1, 0x8b, 0x82, 0x99, 0x8b, 0x26, 0x99, 0xca, 0x51, + 0xa8, 0x12, 0x9c, 0x00, 0x0c, 0x27, 0xda, 0x18, 0x22, 0xb9, 0x89, 0x3c, 0x07, 0x9b, 0x82, 0x0b, + 0x23, 0x00, 0x89, 0xaa, 0x91, 0x9f, 0x73, 0x94, 0x9d, 0x00, 0x33, 0xe8, 0x0a, 0x31, 0x83, 0xab, + 0x8a, 0x41, 0x11, 0xb8, 0x4a, 0x13, 0xe9, 0x0c, 0x45, 0x91, 0x9c, 0x00, 0x22, 0x80, 0x9b, 0x63, + 0x98, 0x01, 0x8c, 0x34, 0x90, 0x89, 0x10, 0x63, 0x82, 0x0a, 0xc0, 0x6a, 0x84, 0x1a, 0x12, 0x18, + 0x90, 0x30, 0x04, 0x8a, 0x55, 0x90, 0x13, 0xad, 0x42, 0x01, 0x02, 0x09, 0xa8, 0x71, 0x86, 0x88, + 0x0b, 0x25, 0x9b, 0x23, 0x11, 0xbc, 0x34, 0xa8, 0x89, 0x72, 0xb2, 0x2c, 0x06, 0xba, 0x19, 0x53, + 0xb8, 0x38, 0xc2, 0x0b, 0x32, 0x13, 0xec, 0x29, 0x12, 0x99, 0x89, 0x20, 0x08, 0xb8, 0x2d, 0x15, + 0xb8, 0x8d, 0x03, 0x18, 0xe2, 0x8d, 0x22, 0x88, 0xa9, 0x8b, 0x62, 0xd0, 0x28, 0xc8, 0x09, 0x09, + 0x81, 0xcc, 0x58, 0xa2, 0x9d, 0x10, 0x80, 0x98, 0x9d, 0x81, 0xaa, 0x02, 0xab, 0x80, 0xbf, 0x9b, + 0x02, 0x8b, 0x81, 0x03, 0xff, 0x1d, 0x92, 0xab, 0x00, 0x08, 0x9a, 0x03, 0xcf, 0x88, 0x80, 0xb9, + 0x50, 0xe0, 0x0a, 0x30, 0xc3, 0x9f, 0x11, 0x80, 0x9a, 0x28, 0xa1, 0x8a, 0xa0, 0x0a, 0x33, 0xf8, + 0x8b, 0x03, 0x89, 0xb0, 0x6a, 0xb0, 0x8a, 0x48, 0x92, 0x0a, 0x21, 0x02, 0xee, 0x58, 0x82, 0x8a, + 0x8a, 0x37, 0xb9, 0x19, 0x51, 0xa3, 0x8c, 0x80, 0x42, 0x91, 0x09, 0x11, 0x83, 0x59, 0x87, 0x8b, + 0x15, 0x89, 0x98, 0x45, 0xb9, 0x30, 0x02, 0x81, 0x9d, 0x27, 0x80, 0x88, 0x28, 0x00, 0x02, 0x09, + 0x24, 0x44, 0xa0, 0x30, 0xc8, 0x70, 0x84, 0x0a, 0x12, 0x91, 0x2b, 0x47, 0x88, 0x09, 0x33, 0xc9, + 0x62, 0x81, 0x90, 0x2a, 0x17, 0x09, 0x80, 0x09, 0x43, 0x03, 0x9a, 0x33, 0xaa, 0x24, 0x72, 0xb1, + 0x1c, 0x04, 0x18, 0x12, 0x10, 0xaa, 0x45, 0xaa, 0x08, 0x54, 0xc9, 0x29, 0x14, 0xb8, 0x0a, 0x27, + 0xc8, 0x1a, 0x11, 0x80, 0x88, 0x98, 0xab, 0x73, 0xa3, 0xac, 0x19, 0x04, 0x9a, 0x8a, 0x13, 0xad, + 0x81, 0x89, 0xc9, 0x40, 0xb0, 0xcb, 0x8e, 0x14, 0xab, 0xa8, 0x49, 0xb1, 0x2b, 0xfa, 0x2a, 0xa8, + 0xb1, 0x1d, 0xd1, 0x08, 0xcb, 0x42, 0xca, 0x88, 0x9d, 0x33, 0xa9, 0xda, 0x0c, 0x82, 0xaa, 0x40, + 0xf0, 0x1c, 0x93, 0x9a, 0x99, 0x10, 0xaa, 0x20, 0xd9, 0xae, 0x33, 0xc0, 0x9b, 0x89, 0x03, 0xaf, + 0x22, 0xaa, 0xb0, 0x8d, 0x00, 0x24, 0xdd, 0x10, 0x80, 0x88, 0x8a, 0x80, 0x19, 0x95, 0x9f, 0x00, + 0x31, 0xba, 0x10, 0xaa, 0x88, 0x64, 0xb0, 0x8b, 0x20, 0x03, 0xc9, 0x9a, 0x28, 0x34, 0x84, 0xbf, + 0x21, 0x28, 0x04, 0x9a, 0xaa, 0x42, 0xa8, 0x22, 0x99, 0x90, 0x70, 0x85, 0x9d, 0x21, 0x12, 0x99, + 0xbb, 0x61, 0xa3, 0x1c, 0x93, 0x89, 0x49, 0x27, 0x99, 0xc9, 0x19, 0x42, 0x14, 0xc8, 0x8a, 0x31, + 0x15, 0xd9, 0x29, 0x02, 0x40, 0x13, 0xcb, 0x18, 0x24, 0x80, 0x00, 0x62, 0x23, 0xc9, 0x2b, 0x54, + 0x84, 0x9a, 0x18, 0x25, 0x18, 0x03, 0x29, 0xa1, 0x60, 0x83, 0x58, 0x06, 0xaa, 0x11, 0x33, 0xb1, + 0x19, 0x40, 0x85, 0x50, 0xa1, 0x01, 0xab, 0x15, 0x31, 0x93, 0xbc, 0x2a, 0x37, 0xc0, 0x0a, 0x12, + 0x11, 0xcb, 0x48, 0x03, 0xfa, 0x0c, 0x02, 0x82, 0x9c, 0x81, 0x00, 0x88, 0x00, 0xfb, 0x8c, 0x33, + 0xd9, 0x9c, 0x33, 0xd8, 0x1a, 0x12, 0xaa, 0x9b, 0x98, 0x89, 0x32, 0xf8, 0x8d, 0x31, 0xa0, 0xbd, + 0x50, 0xa1, 0x0b, 0x12, 0xd9, 0x39, 0x13, 0xd9, 0x8c, 0x33, 0xb8, 0x29, 0x17, 0xc9, 0x3a, 0x14, + 0x9a, 0xbb, 0x64, 0x80, 0x13, 0xbb, 0x01, 0x22, 0xba, 0x71, 0x84, 0xba, 0x49, 0x04, 0x89, 0x24, + 0xa9, 0x8b, 0x35, 0x90, 0x9b, 0x37, 0xda, 0x20, 0x82, 0x80, 0x09, 0xa8, 0x1a, 0x44, 0x82, 0xcf, + 0x31, 0x01, 0x90, 0x8e, 0x01, 0x08, 0x12, 0xcb, 0x0a, 0x41, 0xc0, 0x0b, 0x02, 0xc9, 0x8c, 0x35, + 0xb8, 0xdb, 0x1a, 0x23, 0x99, 0xdb, 0x19, 0x91, 0x00, 0xbf, 0x23, 0xac, 0xa9, 0x79, 0xc3, 0x9c, + 0x22, 0xa0, 0x9c, 0x10, 0x81, 0x99, 0xb0, 0x8f, 0x33, 0xb9, 0xda, 0x60, 0xa2, 0x8a, 0x18, 0xa1, + 0x8d, 0x83, 0x1b, 0x03, 0xa8, 0x9c, 0x66, 0xb1, 0x8a, 0x11, 0x01, 0x89, 0x81, 0x09, 0x44, 0x90, + 0x32, 0x10, 0xc0, 0x7a, 0x05, 0x38, 0xf1, 0x1a, 0x23, 0x10, 0x98, 0x42, 0x81, 0xa0, 0x71, 0xa3, + 0x2a, 0xb1, 0x30, 0x65, 0xa2, 0x8e, 0x32, 0x82, 0x09, 0x90, 0x20, 0x03, 0x01, 0x8c, 0x25, 0xb9, + 0x09, 0x55, 0xa2, 0x1a, 0x13, 0xaa, 0xab, 0x55, 0xb0, 0x91, 0x2c, 0x06, 0x08, 0xa9, 0x11, 0xac, + 0x98, 0x72, 0x81, 0x98, 0xba, 0x39, 0x05, 0xab, 0xbc, 0x72, 0x83, 0xc9, 0x8a, 0x03, 0xca, 0x0b, + 0x22, 0x24, 0xdc, 0x08, 0x11, 0xa0, 0xae, 0x20, 0xa2, 0x8c, 0x00, 0x22, 0xce, 0x18, 0x01, 0xa0, + 0xac, 0x08, 0x80, 0x98, 0xad, 0x11, 0xd8, 0xbb, 0x9a, 0x72, 0xa3, 0xaf, 0x8a, 0x32, 0xb8, 0x9b, + 0xb9, 0x0b, 0x90, 0xb9, 0x1e, 0xe2, 0x9d, 0x00, 0x08, 0xab, 0x88, 0xbb, 0xa9, 0x71, 0xf3, 0x8e, + 0x91, 0x18, 0x81, 0x09, 0x99, 0xa9, 0x1b, 0xa1, 0x11, 0xef, 0x51, 0x91, 0x8a, 0x8b, 0x31, 0x80, + 0x20, 0x93, 0xaa, 0x9c, 0x44, 0x15, 0xbb, 0x10, 0x72, 0x82, 0x08, 0x89, 0x34, 0x01, 0x98, 0x62, + 0x25, 0xa8, 0x19, 0x37, 0x98, 0x11, 0x28, 0x01, 0x46, 0xa0, 0x18, 0x42, 0x01, 0x20, 0x25, 0x88, + 0x40, 0x02, 0x00, 0x71, 0x02, 0x99, 0x53, 0x01, 0x98, 0x41, 0x81, 0x72, 0xa2, 0x0a, 0x09, 0x35, + 0x99, 0x98, 0x51, 0x92, 0x99, 0x9a, 0x62, 0xd0, 0x89, 0x09, 0x35, 0xb9, 0x8b, 0xb9, 0x9c, 0x40, + 0xb2, 0xbd, 0x1a, 0xa2, 0xbf, 0x18, 0xb1, 0x9f, 0x81, 0x18, 0xc0, 0x9d, 0x99, 0x29, 0x91, 0x8b, + 0xec, 0x09, 0x99, 0x82, 0xbb, 0xba, 0x1a, 0xfa, 0x8a, 0x00, 0xa9, 0xbe, 0x10, 0x99, 0xb9, 0x8e, + 0x13, 0x9a, 0xc9, 0x1c, 0x02, 0xac, 0x89, 0x72, 0xb0, 0x1a, 0xa9, 0x32, 0x33, 0xd8, 0x8c, 0x32, + 0xb8, 0x19, 0x75, 0xa3, 0x9d, 0x40, 0x15, 0xaa, 0x89, 0x32, 0x11, 0x02, 0x9a, 0x98, 0x71, 0x82, + 0x8b, 0x47, 0x90, 0x09, 0x10, 0x22, 0x8a, 0x92, 0x1e, 0x45, 0x92, 0x9e, 0x20, 0x11, 0x81, 0x89, + 0x82, 0x5a, 0x85, 0x8c, 0x21, 0x81, 0xac, 0x35, 0x98, 0x88, 0x32, 0xd9, 0x28, 0x03, 0xb8, 0x0a, + 0x23, 0x08, 0x26, 0xb0, 0x0a, 0x55, 0xb1, 0x8f, 0x43, 0xa0, 0x9c, 0x30, 0x21, 0xc0, 0x1b, 0x22, + 0x91, 0x8d, 0x34, 0xdb, 0x38, 0x11, 0xe0, 0x1c, 0x04, 0x89, 0x88, 0x18, 0x08, 0x13, 0xdf, 0x28, + 0x02, 0xc8, 0x1a, 0x13, 0x89, 0x90, 0xaa, 0x0a, 0x33, 0xfc, 0x28, 0x18, 0xa2, 0x0e, 0x92, 0x4a, + 0xb2, 0x8d, 0x10, 0x23, 0xab, 0x31, 0xdb, 0x09, 0x72, 0x05, 0xbb, 0x09, 0x54, 0xb0, 0x1a, 0x34, + 0xc8, 0x19, 0x33, 0x11, 0x21, 0xd9, 0x28, 0x54, 0x91, 0x9b, 0x46, 0x81, 0x88, 0x41, 0xa2, 0x49, + 0x04, 0xa8, 0x3a, 0x37, 0xa8, 0x28, 0x80, 0x34, 0xa0, 0x28, 0x44, 0x93, 0x8b, 0x13, 0x48, 0xb0, + 0x71, 0x03, 0x31, 0xc9, 0x8a, 0x72, 0x84, 0x9b, 0x00, 0x20, 0x10, 0x13, 0xdf, 0x38, 0x82, 0xa9, + 0x1a, 0x86, 0x9b, 0x81, 0xaa, 0x30, 0x82, 0xfd, 0x0a, 0x01, 0x90, 0x9e, 0x88, 0x08, 0xa1, 0xac, + 0x19, 0xa0, 0xcc, 0x29, 0xd2, 0xaf, 0x01, 0x98, 0x99, 0x89, 0xb9, 0x9b, 0x98, 0x09, 0xf8, 0xae, + 0x09, 0x01, 0xb8, 0xdb, 0x19, 0xf9, 0x19, 0x99, 0x23, 0xcd, 0x89, 0x19, 0x92, 0xaa, 0x99, 0xca, + 0x1a, 0x42, 0xc0, 0xad, 0x98, 0x89, 0xa9, 0x29, 0x23, 0xd9, 0xaf, 0x19, 0x53, 0xc0, 0x8c, 0x20, + 0x14, 0xcd, 0x18, 0x02, 0x98, 0x8a, 0x21, 0xa1, 0x8d, 0x13, 0x00, 0xe8, 0x0a, 0x03, 0x34, 0xc9, + 0xca, 0x39, 0x85, 0x28, 0x80, 0xb0, 0x1e, 0x23, 0x10, 0x91, 0x2b, 0x87, 0x29, 0xb4, 0x1d, 0x26, + 0x90, 0x99, 0x58, 0x83, 0x09, 0x12, 0x21, 0xa1, 0x6b, 0x14, 0x01, 0x89, 0x63, 0x14, 0xba, 0x52, + 0x11, 0x10, 0x33, 0x33, 0x98, 0x52, 0x11, 0x35, 0x11, 0x30, 0x35, 0x33, 0x88, 0x46, 0x89, 0x34, + 0x21, 0xa1, 0x71, 0xa1, 0x48, 0x23, 0x93, 0x9c, 0x41, 0x32, 0x84, 0x8c, 0x91, 0x5a, 0x92, 0x89, + 0x30, 0x85, 0x8c, 0x02, 0x1b, 0xc0, 0x8b, 0xc8, 0x39, 0x06, 0xdd, 0x0a, 0x32, 0xc8, 0xbc, 0x38, + 0xc0, 0x89, 0x89, 0xc9, 0x9d, 0x08, 0x00, 0xcb, 0x9b, 0xbb, 0x02, 0xbf, 0xb9, 0x1b, 0xc3, 0x9f, + 0x08, 0x92, 0xad, 0x80, 0x99, 0xb8, 0x2a, 0xc0, 0x0b, 0xc9, 0x8c, 0x08, 0x16, 0xdb, 0x09, 0x82, + 0x9a, 0xa8, 0x21, 0x80, 0x02, 0x1b, 0x75, 0xd3, 0x0b, 0x12, 0x11, 0x89, 0x13, 0x22, 0x00, 0x26, + 0x40, 0x85, 0x0c, 0x04, 0x48, 0x05, 0x99, 0x20, 0x03, 0x21, 0x10, 0x35, 0xa9, 0x73, 0xa0, 0x21, + 0x81, 0x26, 0x9b, 0x36, 0x90, 0xa9, 0x78, 0x93, 0x18, 0xa0, 0x0a, 0x90, 0x73, 0x90, 0x08, 0x20, + 0x83, 0xcc, 0x28, 0x01, 0x80, 0x0a, 0xa0, 0x31, 0xfc, 0x2b, 0x34, 0xa9, 0xca, 0x9d, 0x21, 0x94, + 0x8c, 0xa3, 0x8c, 0xd8, 0x58, 0xa3, 0x9b, 0x90, 0x88, 0x9c, 0x24, 0xfb, 0x19, 0x11, 0x90, 0x9b, + 0x90, 0x28, 0x98, 0x82, 0x0e, 0x95, 0x9c, 0x9b, 0x64, 0xb1, 0xac, 0x42, 0x81, 0x89, 0x99, 0x28, + 0x00, 0x23, 0xfa, 0x8b, 0x48, 0x04, 0x18, 0xd9, 0x49, 0xb2, 0x20, 0xba, 0x43, 0x8b, 0x36, 0xa8, + 0x99, 0xab, 0x55, 0x12, 0xc9, 0x2a, 0x03, 0x24, 0xdc, 0x20, 0x10, 0x90, 0x31, 0x23, 0xcb, 0x41, + 0x02, 0xcb, 0x40, 0x14, 0x11, 0x20, 0xb0, 0x48, 0x53, 0x12, 0x92, 0x0d, 0x27, 0x10, 0x98, 0x18, + 0x14, 0x21, 0x32, 0xe8, 0x49, 0x35, 0xb0, 0x2b, 0x04, 0x29, 0x82, 0x40, 0xa1, 0x72, 0xd0, 0x39, + 0x03, 0xd8, 0x0b, 0x25, 0x08, 0xa1, 0x2a, 0xe9, 0x10, 0x08, 0x91, 0xad, 0x99, 0x28, 0xa4, 0xad, + 0xdb, 0x00, 0xab, 0x25, 0xfb, 0x8a, 0x90, 0x8c, 0x00, 0xba, 0x9c, 0x08, 0xb9, 0xcb, 0xbb, 0xca, + 0xbd, 0x18, 0xc9, 0xac, 0x08, 0xae, 0xa8, 0x1a, 0xe0, 0x0a, 0xcb, 0x43, 0xc9, 0x9a, 0x98, 0x98, + 0x21, 0xd8, 0x8c, 0x11, 0x00, 0xad, 0x33, 0x8a, 0xc2, 0x7b, 0xa2, 0x1a, 0x12, 0x11, 0x18, 0x43, + 0x01, 0x04, 0x28, 0x32, 0x17, 0x48, 0x05, 0x08, 0x81, 0x63, 0x12, 0x32, 0x90, 0x72, 0x22, 0x92, + 0x3c, 0x17, 0x00, 0x88, 0x41, 0x81, 0x31, 0x01, 0x21, 0x42, 0x81, 0x60, 0x13, 0x10, 0x98, 0x55, + 0x98, 0x21, 0x28, 0x04, 0x18, 0x00, 0x10, 0x10, 0x89, 0x74, 0x92, 0x8a, 0x24, 0xa0, 0x0d, 0x15, + 0xab, 0x41, 0xa2, 0xac, 0x00, 0x11, 0xb9, 0x29, 0xa2, 0x9f, 0x23, 0xba, 0x99, 0x31, 0xf2, 0xae, + 0x99, 0x52, 0xc0, 0x08, 0x99, 0x81, 0x8d, 0x03, 0x8c, 0x81, 0xa9, 0xa9, 0x30, 0xfc, 0x29, 0x10, + 0xa1, 0x8e, 0x91, 0x3b, 0xc3, 0x8b, 0xa0, 0x89, 0x3b, 0x87, 0x9d, 0x00, 0x18, 0xc0, 0x0a, 0x00, + 0xd2, 0x0d, 0xa0, 0x1c, 0x25, 0xc0, 0x8d, 0x10, 0x00, 0x98, 0x8a, 0x90, 0x10, 0xbc, 0xa2, 0x3d, + 0xd4, 0x0c, 0x01, 0x91, 0xbc, 0x38, 0x82, 0xd9, 0x0c, 0x82, 0x32, 0xed, 0x10, 0xa9, 0x11, 0x89, + 0xb0, 0x9c, 0x11, 0x91, 0x9d, 0x90, 0x40, 0xd9, 0x88, 0x29, 0x95, 0x8e, 0x04, 0x8a, 0x98, 0x2a, + 0x93, 0x99, 0xad, 0x01, 0x2b, 0x17, 0x8c, 0x12, 0x80, 0xda, 0x48, 0x82, 0x99, 0x0a, 0x17, 0xab, + 0x03, 0x1d, 0x83, 0x1b, 0x98, 0x51, 0x05, 0x9f, 0x12, 0x08, 0x90, 0x10, 0x8a, 0x14, 0x18, 0xda, + 0x38, 0x91, 0x0b, 0x35, 0x98, 0xaa, 0x53, 0xa9, 0x02, 0x5a, 0xd0, 0x51, 0xa8, 0x01, 0x1a, 0x94, + 0x1c, 0x06, 0xab, 0x11, 0x32, 0xcc, 0x22, 0x0a, 0x13, 0x19, 0xc3, 0x2c, 0xa2, 0x79, 0x85, 0x9b, + 0x20, 0x83, 0x8c, 0x02, 0x21, 0xa9, 0x63, 0xc9, 0x01, 0x38, 0x83, 0x8b, 0x27, 0xa9, 0x49, 0x05, + 0xab, 0x14, 0x08, 0xc9, 0x51, 0x90, 0x43, 0xc0, 0x1a, 0x13, 0x32, 0xfb, 0x38, 0x30, 0xc3, 0x2c, + 0x94, 0x18, 0xa8, 0x41, 0x91, 0x53, 0xbc, 0x03, 0x3b, 0xb5, 0x69, 0x92, 0x3b, 0xb4, 0x2c, 0xa0, + 0x73, 0xb9, 0x21, 0x10, 0xc8, 0x2a, 0x05, 0x0a, 0x93, 0x2b, 0xb8, 0x64, 0xd8, 0x20, 0x00, 0xa1, + 0x1b, 0x16, 0x9a, 0x01, 0x18, 0x18, 0x84, 0xad, 0x11, 0x33, 0xfb, 0x40, 0x98, 0xa0, 0x18, 0x23, + 0xc9, 0x08, 0x98, 0x30, 0xf1, 0x0b, 0x84, 0x8c, 0xa2, 0x72, 0xdc, 0x10, 0x09, 0x92, 0x2b, 0xa1, + 0x08, 0x8d, 0xa2, 0x1b, 0xb4, 0x0d, 0x02, 0xbd, 0x11, 0x8d, 0x92, 0x8c, 0x22, 0xd0, 0x8d, 0x00, + 0x22, 0xcb, 0x90, 0x0f, 0x14, 0xba, 0x09, 0x10, 0xb9, 0x20, 0xb0, 0x3c, 0xb5, 0x8c, 0x09, 0x15, + 0x9c, 0xa2, 0x39, 0xc1, 0x20, 0xbb, 0x23, 0xdb, 0x0b, 0x26, 0xa0, 0x9a, 0x88, 0x40, 0xb1, 0x3a, + 0xd3, 0x19, 0x92, 0x0f, 0x93, 0x18, 0xab, 0x36, 0xeb, 0x09, 0x04, 0x08, 0xa0, 0xa8, 0x0f, 0x24, + 0xa9, 0x8a, 0x03, 0x39, 0xd1, 0x9b, 0x50, 0x84, 0x9d, 0x88, 0x11, 0x22, 0xe9, 0x19, 0x10, 0x15, + 0xad, 0x02, 0x32, 0xd0, 0x0b, 0x24, 0xaa, 0x12, 0x18, 0x89, 0x86, 0x2d, 0x86, 0x18, 0xd0, 0x38, + 0x93, 0x38, 0xb1, 0x48, 0x09, 0x07, 0x8b, 0x03, 0x38, 0x88, 0x26, 0xaa, 0x23, 0x0a, 0x06, 0x49, + 0x94, 0x2b, 0xb1, 0x73, 0xa0, 0x20, 0x88, 0x11, 0x42, 0xa0, 0x10, 0x0a, 0x07, 0x39, 0xa3, 0x50, + 0xe8, 0x38, 0xa2, 0x19, 0x04, 0x90, 0x9b, 0x31, 0x06, 0xbd, 0x62, 0xb9, 0x30, 0xa9, 0x10, 0x89, + 0x94, 0x9f, 0x22, 0xb0, 0x9e, 0x22, 0xa1, 0xbc, 0x10, 0x10, 0xb1, 0x9d, 0x10, 0x90, 0xdc, 0x1b, + 0x05, 0xaa, 0xa0, 0x99, 0xab, 0x80, 0x28, 0xf8, 0x1b, 0xcb, 0x03, 0x1d, 0xb1, 0x9b, 0x80, 0xae, + 0x43, 0xda, 0x89, 0x20, 0xda, 0x09, 0x13, 0xca, 0x31, 0xe9, 0x19, 0x04, 0xbc, 0x11, 0x21, 0xc9, + 0x30, 0x93, 0xaf, 0x30, 0x84, 0xdb, 0x40, 0xb1, 0x58, 0x83, 0xbe, 0x30, 0x23, 0xb8, 0x18, 0x01, + 0xa9, 0x31, 0x9a, 0x57, 0xba, 0x31, 0x90, 0x12, 0x99, 0x73, 0x81, 0x8b, 0x42, 0x03, 0x89, 0xbd, + 0x73, 0x83, 0xa9, 0x59, 0x93, 0x8b, 0x50, 0x83, 0x8b, 0x25, 0xa9, 0x20, 0x12, 0xda, 0x72, 0xa2, + 0x0a, 0x19, 0x04, 0x0b, 0x15, 0x8b, 0x00, 0x13, 0xbb, 0x73, 0xa2, 0x8d, 0x82, 0x30, 0xb0, 0x21, + 0xdb, 0x32, 0xc1, 0x28, 0x8d, 0x87, 0x1c, 0x94, 0x28, 0xda, 0x21, 0xab, 0x32, 0x03, 0xcb, 0x08, + 0x13, 0xcd, 0x10, 0x31, 0xb8, 0x30, 0xa8, 0xfa, 0x61, 0xc0, 0x18, 0x80, 0x10, 0x98, 0xc9, 0x7a, + 0xb2, 0x1a, 0x08, 0x02, 0xca, 0x38, 0x82, 0x99, 0x9a, 0x16, 0xaf, 0x11, 0x12, 0xcb, 0x11, 0xbb, + 0x15, 0x0b, 0xe0, 0x73, 0xb9, 0x98, 0x1a, 0x13, 0xa9, 0x19, 0x90, 0xa8, 0x0d, 0x91, 0x41, 0xba, + 0xf1, 0x1e, 0x04, 0x8a, 0xc1, 0x49, 0xa1, 0x0c, 0x02, 0xab, 0x13, 0x8d, 0x84, 0x39, 0xa1, 0xdc, + 0x20, 0x00, 0x33, 0xce, 0x20, 0x11, 0xd9, 0x28, 0x01, 0xb0, 0x1d, 0x83, 0x41, 0xd8, 0x20, 0x82, + 0xaa, 0x09, 0x64, 0xa8, 0xa8, 0x6a, 0xa3, 0x39, 0xea, 0x31, 0x80, 0x22, 0xae, 0x31, 0x91, 0x00, + 0x99, 0x38, 0x93, 0x1d, 0x13, 0x19, 0xd2, 0x0e, 0x13, 0x88, 0xe0, 0x2a, 0x15, 0x89, 0x09, 0x80, + 0x89, 0x99, 0xb1, 0x6c, 0xb2, 0x0c, 0xb9, 0x72, 0xa8, 0x80, 0x0d, 0x93, 0x49, 0xd0, 0x0a, 0x11, + 0xda, 0x48, 0x90, 0x99, 0x29, 0xb1, 0x9d, 0x52, 0xc9, 0x8a, 0x42, 0xa0, 0xac, 0x20, 0x21, 0x9a, + 0xa3, 0xef, 0x22, 0x90, 0x9a, 0x12, 0x89, 0x9a, 0x84, 0x0d, 0x14, 0x00, 0xcc, 0x30, 0x92, 0xaa, + 0x23, 0x32, 0xec, 0x09, 0x53, 0x02, 0xba, 0xab, 0x71, 0x95, 0x19, 0x00, 0x80, 0x1a, 0x26, 0xa9, + 0x48, 0x91, 0x98, 0x5c, 0x15, 0xa8, 0x29, 0x22, 0x80, 0x99, 0x25, 0x99, 0x34, 0xa1, 0x18, 0x10, + 0x36, 0x11, 0x0a, 0x05, 0x1a, 0x24, 0x40, 0x15, 0x99, 0x99, 0x70, 0x96, 0x09, 0x10, 0x22, 0xeb, + 0x40, 0x91, 0x11, 0x99, 0x00, 0x41, 0x92, 0xac, 0x53, 0xb8, 0x08, 0x21, 0xa2, 0x89, 0x18, 0x98, + 0x10, 0x01, 0xdf, 0x32, 0xb8, 0xbb, 0x79, 0xf3, 0x3b, 0x81, 0x89, 0xba, 0x42, 0xfc, 0x38, 0xa0, + 0x09, 0xba, 0x20, 0x32, 0xe9, 0xbb, 0x38, 0xa8, 0xea, 0x4a, 0xc2, 0x9a, 0xab, 0x35, 0x90, 0xfb, + 0x19, 0x91, 0x98, 0x0a, 0xd1, 0x39, 0x92, 0xb0, 0xbf, 0x25, 0x9a, 0x0a, 0x01, 0x08, 0x08, 0x08, + 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, 0x6a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x88, 0x01, 0x98, 0x18, 0x00, 0xa8, 0x30, 0xa8, 0x29, 0x88, 0x31, 0xb0, 0xab, 0x30, 0x21, 0x47, + 0xce, 0x48, 0x91, 0x09, 0x00, 0x81, 0xaa, 0x61, 0xa1, 0x9e, 0x33, 0xa8, 0x08, 0x03, 0x8e, 0xa3, + 0x3b, 0x94, 0x80, 0x0b, 0xd9, 0x54, 0xb0, 0x08, 0x8b, 0x25, 0xb8, 0x1a, 0xa2, 0x2b, 0x37, 0xbc, + 0x31, 0x99, 0xba, 0x66, 0xc8, 0x1a, 0x15, 0xbb, 0x51, 0xb0, 0x19, 0x91, 0x31, 0xda, 0x28, 0x91, + 0x39, 0xa6, 0x0d, 0x02, 0xa9, 0x60, 0xc0, 0x38, 0xa8, 0x20, 0xe1, 0x59, 0xc1, 0x29, 0x93, 0xa8, + 0x1b, 0x05, 0x99, 0x28, 0x91, 0x39, 0xed, 0x71, 0xa1, 0x8c, 0x21, 0x91, 0x09, 0x02, 0xb9, 0x89, + 0x58, 0x84, 0x8c, 0x12, 0xc9, 0x48, 0xb1, 0x1b, 0x17, 0xcb, 0x31, 0xb2, 0x0a, 0xa2, 0x3b, 0x07, + 0x9c, 0x11, 0x83, 0x9f, 0x22, 0xa1, 0x30, 0xfb, 0x7b, 0xb2, 0x19, 0x12, 0xac, 0x21, 0x90, 0x08, + 0x20, 0xa8, 0x9b, 0x45, 0xab, 0x94, 0x2c, 0x02, 0x12, 0xcf, 0x30, 0x04, 0xbc, 0x41, 0xb0, 0x49, + 0x91, 0xa8, 0x38, 0xdb, 0x36, 0xba, 0x39, 0x92, 0x9d, 0x25, 0xab, 0x31, 0xb8, 0x4a, 0xb2, 0x59, + 0xe9, 0x41, 0xa0, 0x89, 0x11, 0x0b, 0x96, 0x1d, 0x84, 0x0b, 0x02, 0x9a, 0x32, 0xbc, 0x31, 0x81, + 0x98, 0x32, 0xdf, 0x24, 0xd9, 0x39, 0x14, 0xdb, 0x41, 0xb9, 0x29, 0x03, 0x89, 0x18, 0xb0, 0x18, + 0x28, 0xc8, 0x78, 0xa1, 0x0d, 0x85, 0x1b, 0x83, 0xa8, 0x8e, 0x25, 0xba, 0x30, 0x95, 0x9e, 0x13, + 0x09, 0x90, 0x08, 0x10, 0xba, 0x42, 0x80, 0x48, 0xf9, 0x29, 0xa0, 0x50, 0x92, 0x0c, 0x82, 0x0d, + 0x12, 0x9a, 0x22, 0xd8, 0x28, 0x80, 0x82, 0xac, 0x43, 0x90, 0xeb, 0x72, 0xb8, 0x2a, 0x33, 0xf8, + 0x2b, 0x07, 0xab, 0x21, 0xa0, 0x38, 0xc1, 0x28, 0xb1, 0x39, 0xb1, 0x89, 0x00, 0x10, 0x35, 0xfa, + 0x49, 0xb9, 0x60, 0xb3, 0x0f, 0x03, 0x9b, 0x40, 0x83, 0xae, 0x11, 0x02, 0xaa, 0x83, 0x89, 0x22, + 0x9a, 0x91, 0x1a, 0x82, 0x30, 0xf3, 0x0f, 0x43, 0xd2, 0x0e, 0x13, 0x9a, 0x20, 0xb1, 0x2c, 0x85, + 0x8b, 0x00, 0x11, 0xb9, 0x40, 0xab, 0x47, 0xea, 0x38, 0x91, 0x89, 0x12, 0x99, 0x8b, 0x15, 0x19, + 0xd3, 0x0f, 0x04, 0x9a, 0x32, 0xb8, 0x1b, 0x83, 0x8b, 0x30, 0xa1, 0x73, 0xfa, 0x49, 0x91, 0x19, + 0xb2, 0x2d, 0x03, 0x8b, 0x92, 0x2c, 0x85, 0x8c, 0x42, 0xd8, 0x19, 0x80, 0x32, 0xba, 0x08, 0x33, + 0xcd, 0x10, 0x22, 0xc0, 0x2b, 0x85, 0x9d, 0x52, 0xb1, 0x0c, 0x14, 0xbb, 0x49, 0x05, 0xab, 0x83, + 0x0b, 0x05, 0xbb, 0x72, 0xb1, 0x8c, 0x33, 0xb8, 0x19, 0x91, 0x10, 0x19, 0xe3, 0x2b, 0x15, 0xda, + 0x49, 0x92, 0x1b, 0x81, 0x00, 0x19, 0xc1, 0x8b, 0x45, 0xb0, 0x9a, 0x50, 0xa3, 0x9e, 0x23, 0xb9, + 0x38, 0x84, 0xcb, 0x21, 0x03, 0x9f, 0x21, 0x80, 0x09, 0x9b, 0x27, 0x9c, 0x11, 0x18, 0x98, 0x80, + 0x0c, 0x03, 0x33, 0xdf, 0x41, 0x90, 0x8a, 0x10, 0xb0, 0x70, 0xb8, 0x59, 0x92, 0xbb, 0x40, 0xa1, + 0x31, 0xbb, 0x62, 0xb8, 0x9c, 0x53, 0xa8, 0x21, 0xd8, 0x2b, 0x17, 0xac, 0x31, 0x90, 0x98, 0x39, + 0xa3, 0x0d, 0x02, 0x9b, 0x47, 0xda, 0x28, 0x80, 0x28, 0xa1, 0x9b, 0x52, 0xb1, 0x0e, 0x15, 0xac, + 0x52, 0xd8, 0x28, 0x82, 0x9a, 0x13, 0xba, 0x72, 0xd8, 0x28, 0x91, 0x09, 0x12, 0xb8, 0x0a, 0x84, + 0x1b, 0x07, 0xac, 0x42, 0xb0, 0x0c, 0x24, 0xa9, 0x19, 0x91, 0x1a, 0x04, 0x9b, 0x18, 0x52, 0xd8, + 0x09, 0x33, 0xcb, 0x28, 0x07, 0xbc, 0x20, 0x31, 0x92, 0xdd, 0x40, 0x92, 0x8d, 0x13, 0xba, 0x41, + 0x91, 0x8a, 0x09, 0x15, 0xcb, 0x60, 0xa1, 0x8c, 0x05, 0xa9, 0x10, 0x80, 0x08, 0x01, 0xba, 0x61, + 0xa1, 0x8e, 0x33, 0xa9, 0x0a, 0x14, 0xbb, 0x22, 0x88, 0x2b, 0x87, 0xaa, 0x11, 0x30, 0xf1, 0x2e, + 0x06, 0xdb, 0x40, 0x92, 0xab, 0x43, 0xa9, 0x18, 0x82, 0x0b, 0x92, 0x1b, 0x14, 0xae, 0x54, 0xb9, + 0x28, 0xb8, 0x31, 0xb1, 0x3c, 0x97, 0x9a, 0x21, 0xb8, 0x40, 0xa1, 0x0c, 0x13, 0xbc, 0x72, 0xb0, + 0x48, 0xc8, 0x20, 0xda, 0x52, 0xa1, 0x19, 0xc9, 0x10, 0x01, 0x40, 0xe0, 0x2a, 0x84, 0x9c, 0x32, + 0xb0, 0x3b, 0x82, 0x98, 0x9b, 0x55, 0xc9, 0x00, 0x10, 0x92, 0xae, 0x44, 0xc8, 0x39, 0x91, 0x0a, + 0x91, 0x18, 0x32, 0xea, 0x09, 0x34, 0xe9, 0x29, 0x82, 0x89, 0x88, 0x01, 0x28, 0xd1, 0x39, 0x12, + 0xf2, 0x8f, 0x33, 0xb0, 0x0c, 0x34, 0xcb, 0x39, 0x82, 0xaa, 0x62, 0xb8, 0x08, 0x82, 0x9d, 0x44, + 0xb8, 0x38, 0xf9, 0x40, 0xb1, 0x2b, 0x05, 0xac, 0x20, 0x01, 0x82, 0x9b, 0x20, 0xb9, 0x28, 0x44, + 0xfb, 0x40, 0xa0, 0x09, 0x11, 0x91, 0x9e, 0x42, 0xa0, 0x3b, 0xa3, 0xae, 0x62, 0x80, 0x88, 0x9a, + 0x01, 0x3b, 0x97, 0x09, 0x98, 0x40, 0xe1, 0x4a, 0x82, 0x8d, 0x13, 0xab, 0x72, 0xa8, 0x9a, 0x40, + 0xa3, 0x8e, 0x24, 0xba, 0x29, 0x04, 0x8c, 0x23, 0xfa, 0x39, 0x04, 0xbb, 0x41, 0xb0, 0x18, 0x82, + 0x9a, 0x8c, 0x36, 0xb9, 0x28, 0xc1, 0x4b, 0x85, 0x8f, 0x25, 0xba, 0x30, 0xc8, 0x28, 0x81, 0x22, + 0xdb, 0x89, 0x23, 0x19, 0xe8, 0x61, 0xc0, 0x29, 0xb1, 0x29, 0x05, 0xba, 0x01, 0x00, 0x99, 0x01, + 0x20, 0x01, 0xb0, 0xdc, 0x71, 0xc9, 0x51, 0x92, 0xad, 0x21, 0x01, 0xaa, 0x52, 0xb8, 0x8a, 0x31, + 0x98, 0x32, 0xfb, 0x40, 0xb1, 0x2c, 0x82, 0x9a, 0x23, 0x9f, 0x26, 0xda, 0x38, 0x93, 0x9c, 0x32, + 0xb9, 0x1a, 0x07, 0x0b, 0x93, 0x8c, 0x22, 0x09, 0xc0, 0x3a, 0x04, 0xaa, 0x81, 0x48, 0xd2, 0x2b, + 0x12, 0xd8, 0x29, 0x93, 0x41, 0xf8, 0x19, 0x80, 0x18, 0x92, 0x3a, 0x93, 0xde, 0x71, 0xc1, 0x09, + 0x12, 0xb8, 0x48, 0xc1, 0x2a, 0xa3, 0x4b, 0x92, 0x8a, 0x80, 0xab, 0x47, 0xb8, 0x21, 0xeb, 0x10, + 0x12, 0xb0, 0x3a, 0xb4, 0x0f, 0x14, 0xb9, 0x28, 0x82, 0x8e, 0x22, 0x01, 0xcc, 0x31, 0xa0, 0x10, + 0xb0, 0x3d, 0x96, 0x9b, 0x52, 0xb1, 0x8b, 0x34, 0xfa, 0x39, 0x04, 0xac, 0x22, 0xa8, 0x40, 0xd0, + 0x2b, 0x06, 0xab, 0x22, 0xba, 0x20, 0x04, 0xbd, 0x43, 0xa8, 0x28, 0xb1, 0x2a, 0x90, 0x32, 0xca, + 0xaa, 0x74, 0xb8, 0x21, 0x89, 0x0a, 0x94, 0x1b, 0x00, 0x09, 0x05, 0x0d, 0x26, 0xbe, 0x42, 0xb9, + 0x40, 0x91, 0x0b, 0x02, 0x0a, 0xa8, 0x52, 0xf0, 0x49, 0xb3, 0x0e, 0x13, 0x0a, 0x93, 0x9e, 0x32, + 0xb1, 0x0b, 0x01, 0x12, 0x99, 0x0a, 0x96, 0x9d, 0x53, 0xa0, 0x08, 0xad, 0x54, 0xc8, 0x38, 0xa1, + 0x1b, 0x01, 0x18, 0xa0, 0x20, 0xf9, 0x68, 0xa1, 0x2b, 0x90, 0x18, 0x01, 0x2a, 0x94, 0xca, 0x19, + 0x00, 0x24, 0xa1, 0xaf, 0x25, 0xac, 0x43, 0xbb, 0x24, 0xbc, 0x52, 0xa0, 0x0a, 0x32, 0xd9, 0x28, + 0xb0, 0x59, 0x93, 0x8e, 0x23, 0xbb, 0x21, 0x82, 0x9c, 0x21, 0x84, 0xaf, 0x16, 0xba, 0x11, 0x00, + 0x98, 0x20, 0x90, 0x89, 0xa8, 0x68, 0xb1, 0x38, 0x90, 0x98, 0x5b, 0xa4, 0xbf, 0x46, 0xc8, 0x19, + 0x01, 0x99, 0x31, 0xa0, 0x98, 0x89, 0x58, 0x94, 0xbc, 0x73, 0xc8, 0x39, 0xa2, 0x2a, 0x94, 0x9b, + 0x10, 0x03, 0x8d, 0x23, 0xea, 0x40, 0xb8, 0x30, 0xa0, 0x29, 0xc2, 0x2c, 0x87, 0x9a, 0x19, 0x22, + 0xa2, 0x9e, 0x31, 0x80, 0xaa, 0x42, 0xca, 0x43, 0xda, 0x40, 0xa8, 0x28, 0xa1, 0x2a, 0xa3, 0x0f, + 0x16, 0xab, 0x38, 0xc2, 0x2a, 0x13, 0xd9, 0x3a, 0x85, 0x8b, 0x02, 0xa9, 0x23, 0xae, 0x41, 0x82, + 0x8a, 0xb0, 0x0d, 0x16, 0x99, 0x00, 0x09, 0x01, 0xc8, 0x50, 0xa1, 0x8e, 0x04, 0x0a, 0x13, 0xcc, + 0x51, 0xa0, 0x8b, 0x33, 0x9a, 0x32, 0xec, 0x40, 0xa0, 0x08, 0x20, 0xb2, 0x9f, 0x34, 0xab, 0x20, + 0x01, 0xab, 0x90, 0x70, 0x91, 0x0a, 0x89, 0x31, 0xb0, 0x2a, 0xb2, 0x59, 0x96, 0x8f, 0x03, 0x9a, + 0x42, 0xd8, 0x18, 0x00, 0x10, 0xa0, 0xbb, 0x71, 0xa2, 0x08, 0x9c, 0x53, 0xb1, 0x8d, 0x53, 0xb9, + 0x1a, 0x14, 0xaa, 0x01, 0x28, 0xc1, 0x0c, 0x25, 0xca, 0x30, 0xb1, 0x0d, 0x06, 0x9a, 0x02, 0x0a, + 0x83, 0x9d, 0x31, 0x85, 0xad, 0x21, 0x01, 0xa8, 0x1b, 0x03, 0x81, 0x9c, 0x22, 0xaa, 0x32, 0x89, + 0xb5, 0x0f, 0x05, 0xaa, 0x21, 0x9a, 0x24, 0xbc, 0x41, 0xa2, 0x9a, 0x01, 0x4a, 0xc0, 0x43, 0xca, + 0x29, 0xa4, 0x3c, 0x81, 0xb1, 0x3b, 0xa6, 0x0c, 0x85, 0x0b, 0x83, 0xba, 0x72, 0xd3, 0x0a, 0x00, + 0x81, 0x29, 0x83, 0xae, 0x34, 0xda, 0x48, 0xa1, 0x2b, 0x93, 0x8d, 0x53, 0xb1, 0xab, 0x20, 0x82, + 0x08, 0x9a, 0x54, 0x98, 0xca, 0x48, 0x81, 0xba, 0x44, 0x88, 0xab, 0x21, 0x3b, 0x87, 0x0d, 0x82, + 0x09, 0xb8, 0x33, 0x9a, 0x25, 0xe8, 0x0a, 0x02, 0x09, 0x12, 0xc1, 0x1a, 0x91, 0x1c, 0x47, 0x9f, + 0x21, 0x90, 0x10, 0xca, 0x30, 0x81, 0x88, 0xa9, 0x62, 0xc0, 0x1a, 0x01, 0x00, 0x3a, 0xb5, 0x8e, + 0x22, 0x82, 0xdb, 0x39, 0x04, 0xab, 0x24, 0xba, 0x30, 0x98, 0x18, 0xe9, 0x70, 0xa0, 0x08, 0xa1, + 0x3a, 0xb2, 0x50, 0xc2, 0x1a, 0xd8, 0x5a, 0x16, 0xbc, 0x30, 0x91, 0x08, 0x98, 0x38, 0xc2, 0x2b, + 0x83, 0x8a, 0x31, 0xa8, 0x10, 0xff, 0x44, 0xc9, 0x29, 0x94, 0x0b, 0x22, 0xca, 0x28, 0x11, 0x00, + 0xfb, 0x40, 0x92, 0xa9, 0x89, 0x21, 0x01, 0x92, 0x8e, 0x11, 0x94, 0x0f, 0x02, 0x89, 0x88, 0x12, + 0x8b, 0x02, 0xd1, 0x59, 0xb0, 0x18, 0x15, 0xdc, 0x48, 0x92, 0x8b, 0x31, 0x92, 0xbc, 0x38, 0x03, + 0x8a, 0x02, 0x9b, 0x48, 0xa4, 0x8e, 0x00, 0x44, 0xe9, 0x1a, 0x25, 0xbb, 0x48, 0xa2, 0x8c, 0x32, + 0xc8, 0x38, 0x93, 0xbc, 0x31, 0xb0, 0x18, 0x63, 0xd9, 0x08, 0x21, 0x91, 0x9e, 0x23, 0xab, 0x43, + 0xd0, 0x2a, 0x86, 0xab, 0x42, 0xb0, 0x29, 0xb0, 0x28, 0x82, 0x0a, 0x12, 0x81, 0xdf, 0x42, 0xa8, + 0x19, 0x84, 0xbc, 0x51, 0x14, 0xad, 0x28, 0xa0, 0x28, 0x15, 0xbb, 0x10, 0x9a, 0x27, 0xcb, 0x38, + 0x84, 0xaa, 0x49, 0xb2, 0x1b, 0x24, 0xa9, 0x89, 0x20, 0x99, 0x19, 0x15, 0x89, 0xa4, 0xcf, 0x25, + 0xaa, 0x12, 0x88, 0x89, 0x81, 0x0c, 0x04, 0x88, 0x08, 0x10, 0xba, 0x5b, 0xa4, 0x3a, 0xa1, 0x0a, + 0x35, 0xda, 0xab, 0x73, 0xa4, 0xab, 0x22, 0xa0, 0x02, 0x0f, 0x15, 0x9c, 0x20, 0xa0, 0x48, 0xc0, + 0x09, 0x22, 0xb0, 0x2a, 0x83, 0x0d, 0x81, 0x2b, 0x16, 0xad, 0x21, 0x91, 0x29, 0x91, 0x98, 0x8a, + 0xb9, 0x57, 0xb0, 0x0c, 0x15, 0xca, 0x48, 0xa3, 0x8c, 0x21, 0xb8, 0x30, 0xa0, 0x38, 0xc0, 0x29, + 0xb8, 0x73, 0xf1, 0x19, 0x10, 0x02, 0x98, 0xdb, 0x21, 0x90, 0x32, 0xc2, 0x8f, 0x14, 0x9b, 0x14, + 0xbb, 0x30, 0x93, 0x8c, 0x33, 0xbb, 0x2b, 0x07, 0x8c, 0x92, 0x29, 0x05, 0xaa, 0xaa, 0x54, 0x98, + 0x0b, 0x04, 0x8a, 0x82, 0x1c, 0x82, 0x92, 0xaf, 0x62, 0xa2, 0x8c, 0x02, 0x89, 0x80, 0x59, 0x95, + 0x8e, 0x22, 0xaa, 0x31, 0xc8, 0x0a, 0x26, 0xb9, 0x19, 0x02, 0x8b, 0x82, 0x88, 0x10, 0xb4, 0x8f, + 0x25, 0xab, 0x31, 0xd9, 0x39, 0x05, 0xac, 0x32, 0xba, 0x18, 0x36, 0xda, 0x28, 0xa8, 0x30, 0x91, + 0xac, 0x72, 0x90, 0x0b, 0x04, 0xba, 0x29, 0x05, 0x88, 0xb9, 0x60, 0xb2, 0x0c, 0x81, 0x08, 0x32, + 0xa0, 0xcb, 0x58, 0x92, 0x9e, 0x63, 0xb9, 0x38, 0x90, 0x00, 0x98, 0x89, 0x22, 0x8a, 0x40, 0xb1, + 0x9c, 0x20, 0x84, 0x09, 0xc1, 0x1a, 0x03, 0x20, 0xfa, 0x7c, 0xb1, 0x09, 0x62, 0xc0, 0xa9, 0x68, + 0x92, 0x8c, 0x22, 0x90, 0xc8, 0x3a, 0x04, 0xb9, 0x21, 0x09, 0xc3, 0x8d, 0x25, 0xca, 0x20, 0x01, + 0xc1, 0x0c, 0x23, 0xb1, 0x1b, 0xa3, 0x2d, 0xc3, 0x79, 0xa2, 0x9b, 0x89, 0x27, 0xa9, 0x89, 0x14, + 0xab, 0x21, 0x02, 0x8b, 0xd8, 0x4b, 0x85, 0x29, 0xd1, 0x1c, 0x14, 0xaa, 0x10, 0x10, 0x99, 0x88, + 0x11, 0x71, 0xc9, 0x19, 0x91, 0x2c, 0x86, 0x19, 0xe1, 0x2a, 0x82, 0x02, 0x9d, 0x23, 0xd9, 0x20, + 0xa8, 0x33, 0xaa, 0x92, 0x8f, 0x04, 0x09, 0x83, 0xdb, 0x58, 0xb0, 0x18, 0x15, 0xac, 0x11, 0x81, + 0x88, 0xa9, 0x13, 0x9a, 0x60, 0xa4, 0x8e, 0x23, 0xcb, 0x33, 0xaa, 0x81, 0x1a, 0x23, 0xab, 0x02, + 0xab, 0x88, 0x47, 0xa9, 0x9a, 0x14, 0x0e, 0x17, 0xeb, 0x40, 0x90, 0x09, 0x01, 0x0b, 0x92, 0x29, + 0x81, 0x8a, 0x84, 0x8e, 0x14, 0xaa, 0x03, 0x2a, 0xb0, 0x94, 0x8f, 0x86, 0x0a, 0x83, 0x8c, 0x13, + 0x8a, 0x8a, 0x42, 0xd0, 0x3b, 0x06, 0x9a, 0x39, 0xd0, 0x10, 0x0a, 0x86, 0x29, 0xc2, 0x0e, 0x03, + 0x1a, 0x00, 0x99, 0x20, 0x80, 0xda, 0x72, 0xc0, 0x3b, 0x86, 0x8c, 0x12, 0x8a, 0x13, 0x8c, 0x90, + 0x21, 0xab, 0x34, 0xd9, 0x30, 0xc2, 0x8c, 0x23, 0x98, 0x93, 0x1f, 0x93, 0x9b, 0x25, 0xab, 0x20, + 0x98, 0x32, 0xcd, 0x23, 0x99, 0x11, 0x80, 0x9e, 0x22, 0x98, 0x39, 0x93, 0xcb, 0x40, 0xaa, 0x32, + 0x07, 0xaf, 0x32, 0xd0, 0x49, 0xa2, 0x29, 0xd9, 0x49, 0x82, 0x9a, 0x42, 0xa9, 0x88, 0x3b, 0x95, + 0x89, 0x09, 0x15, 0x9d, 0x22, 0x98, 0x88, 0x1b, 0x06, 0x9f, 0x25, 0xba, 0x21, 0xb0, 0x39, 0xa2, + 0x9b, 0x30, 0x84, 0x0f, 0x25, 0xdb, 0x28, 0x91, 0x00, 0x89, 0x04, 0x8a, 0x90, 0x8a, 0x27, 0xbb, + 0x51, 0xe9, 0x48, 0x92, 0x0b, 0x02, 0xab, 0x32, 0x94, 0x9e, 0x22, 0x80, 0x0b, 0x93, 0x8e, 0x14, + 0x98, 0x98, 0x12, 0xaa, 0x40, 0xd0, 0x48, 0xb0, 0x38, 0xb2, 0x1e, 0x07, 0xac, 0x32, 0xd8, 0x30, + 0x98, 0x01, 0xa9, 0x29, 0x05, 0xab, 0x31, 0xc8, 0x20, 0x9b, 0x47, 0xac, 0x21, 0xc8, 0x30, 0x80, + 0x08, 0xb0, 0x2a, 0x80, 0x17, 0x9e, 0x31, 0xb1, 0x1b, 0x84, 0x0b, 0xa4, 0x6b, 0xb2, 0x0c, 0x22, + 0xb8, 0x29, 0x91, 0x58, 0xc1, 0x10, 0xdb, 0x6a, 0x85, 0xab, 0x32, 0xc0, 0x2b, 0x85, 0x8b, 0x22, + 0xa9, 0x18, 0x28, 0x01, 0xca, 0x3a, 0x94, 0x9a, 0x34, 0xeb, 0x71, 0xd8, 0x49, 0xb2, 0x1b, 0x13, + 0x88, 0x8b, 0x05, 0x9d, 0x42, 0xb0, 0x28, 0xaa, 0x40, 0xb2, 0x2e, 0x84, 0xab, 0x41, 0xa1, 0x8a, + 0x01, 0x18, 0x01, 0xc8, 0x2a, 0x82, 0x95, 0x2f, 0x93, 0xab, 0x28, 0x80, 0x43, 0x88, 0xf8, 0x19, + 0x00, 0x15, 0xae, 0x53, 0xb9, 0x00, 0x18, 0x81, 0xa9, 0x51, 0xe9, 0x48, 0x92, 0x8d, 0x32, 0xb8, + 0x2a, 0x21, 0xda, 0x20, 0x00, 0x21, 0xfb, 0x58, 0x90, 0x8b, 0x33, 0x9a, 0x82, 0xbb, 0x70, 0xd3, + 0x3a, 0x91, 0x00, 0xa8, 0x0f, 0x15, 0x0b, 0x92, 0x09, 0xb0, 0x4a, 0x02, 0xb8, 0x58, 0xd1, 0x28, + 0xa8, 0x12, 0x0a, 0x15, 0xcd, 0x11, 0x00, 0x95, 0x1d, 0x03, 0xaa, 0x8a, 0x24, 0x00, 0xd8, 0x0a, + 0x33, 0x88, 0x99, 0x84, 0x9f, 0x01, 0x14, 0xaa, 0x18, 0xa3, 0x9f, 0x26, 0xba, 0x21, 0x01, 0xbd, + 0x30, 0x04, 0xaa, 0x88, 0x15, 0x9a, 0xb1, 0x4a, 0x83, 0xbd, 0x64, 0xc8, 0x28, 0xa2, 0x0d, 0x14, + 0xaa, 0x10, 0x18, 0x90, 0xa8, 0x79, 0x93, 0xac, 0x12, 0x9a, 0x25, 0xaa, 0x30, 0xc8, 0xb9, 0x73, + 0x91, 0x8b, 0x33, 0xba, 0xba, 0x72, 0xb1, 0x3c, 0x07, 0xbb, 0x31, 0xa2, 0x0e, 0x82, 0x11, 0x9b, + 0x01, 0x1a, 0x05, 0x8b, 0x98, 0x48, 0xa3, 0x8a, 0x21, 0xeb, 0x61, 0xb8, 0x41, 0xad, 0x23, 0x88, + 0x98, 0x22, 0xfb, 0x28, 0x12, 0xc9, 0x42, 0xdb, 0x41, 0x98, 0x89, 0xa2, 0x68, 0xc0, 0x30, 0xb8, + 0x1b, 0x17, 0xbb, 0x53, 0xc9, 0x30, 0xb8, 0x39, 0xb4, 0x5b, 0xa0, 0x30, 0xd8, 0x1a, 0x14, 0xbb, + 0x63, 0x98, 0x98, 0x28, 0xba, 0x63, 0xa0, 0x09, 0x18, 0xb0, 0x59, 0x93, 0xbf, 0x36, 0xca, 0x48, + 0xb0, 0x29, 0x84, 0x0a, 0xa8, 0x28, 0x81, 0x18, 0xa9, 0x37, 0xdc, 0x28, 0x02, 0x19, 0xc1, 0x2a, + 0xa3, 0x1e, 0x94, 0x3b, 0xc3, 0x1b, 0x22, 0xb1, 0x8b, 0x30, 0xb3, 0x29, 0xda, 0x38, 0x82, 0x16, + 0x9d, 0x21, 0xf8, 0x3a, 0x07, 0xab, 0x21, 0xc0, 0x58, 0xa2, 0x8c, 0x13, 0xbb, 0x34, 0xcb, 0x62, + 0xb8, 0x19, 0x11, 0xba, 0x51, 0x81, 0xa9, 0x99, 0x58, 0x91, 0x22, 0xdc, 0x31, 0xf0, 0x6a, 0xb2, + 0x2a, 0x81, 0x89, 0x01, 0x89, 0x00, 0x29, 0xc1, 0x7a, 0xc1, 0x29, 0x81, 0x8a, 0x32, 0xa8, 0xb0, + 0x1d, 0x85, 0x28, 0xb9, 0x28, 0xb6, 0x1f, 0x84, 0x8a, 0x23, 0xeb, 0x30, 0xb1, 0x1b, 0x17, 0xbb, + 0x41, 0xa1, 0x8c, 0x13, 0x08, 0x00, 0xba, 0x19, 0x24, 0xeb, 0x41, 0x90, 0xb0, 0x3c, 0x85, 0x09, + 0xb8, 0x38, 0xc1, 0x28, 0x32, 0xf9, 0x31, 0xbb, 0x98, 0x70, 0xa4, 0x8c, 0x13, 0xab, 0x14, 0x0a, + 0x00, 0xd1, 0x2c, 0x13, 0xa1, 0x9a, 0x02, 0x9c, 0x07, 0x0c, 0x03, 0xa8, 0x2b, 0x13, 0xd0, 0x1d, + 0x84, 0x90, 0x09, 0x22, 0xf9, 0x49, 0xa1, 0x19, 0x81, 0x18, 0xa0, 0xaa, 0x53, 0x9a, 0x17, 0xdb, + 0x30, 0x82, 0x9c, 0x18, 0x44, 0xd8, 0x98, 0x28, 0x80, 0x83, 0x2c, 0xc3, 0x1d, 0x14, 0xaa, 0x01, + 0x99, 0x01, 0x11, 0xa2, 0xbf, 0x45, 0xb9, 0x18, 0x10, 0xb1, 0x2d, 0x93, 0x0a, 0x12, 0x90, 0x48, + 0xf3, 0x8f, 0x14, 0x99, 0x20, 0xc8, 0x58, 0xc1, 0x2a, 0x12, 0xbb, 0x72, 0xc8, 0x00, 0x10, 0x90, + 0x09, 0x00, 0x89, 0x32, 0xaa, 0x11, 0xb9, 0x6a, 0xa5, 0x9e, 0x34, 0xb9, 0x10, 0xa8, 0x29, 0x93, + 0x20, 0xeb, 0x53, 0xc9, 0x2a, 0x16, 0xac, 0x31, 0x89, 0x90, 0x18, 0x91, 0x09, 0x00, 0x58, 0xf1, + 0x69, 0xc8, 0x38, 0x91, 0x19, 0xb1, 0x0b, 0x62, 0x91, 0x0a, 0xaa, 0x41, 0xb1, 0x4a, 0xa3, 0x29, + 0xdc, 0x60, 0x90, 0x98, 0x61, 0xd8, 0x2a, 0x13, 0xb9, 0x19, 0x83, 0x0c, 0x14, 0x9a, 0xa8, 0x38, + 0x15, 0xe9, 0x39, 0xc3, 0x2c, 0x94, 0x2a, 0x02, 0xae, 0x22, 0x08, 0x1c, 0x85, 0x89, 0x88, 0x99, + 0x42, 0x88, 0x20, 0xbd, 0x22, 0x9b, 0x03, 0x32, 0xd2, 0x8e, 0x12, 0xa0, 0x1b, 0x05, 0x81, 0x8d, + 0x82, 0x00, 0x9d, 0x27, 0xca, 0x40, 0xc1, 0x2b, 0x04, 0x9b, 0x14, 0xaa, 0x18, 0x83, 0x9a, 0x01, + 0x99, 0x23, 0xa8, 0x9d, 0x64, 0xb9, 0x28, 0x01, 0xb9, 0x21, 0xaa, 0x62, 0xa0, 0x19, 0x08, 0xa0, + 0x1a, 0x14, 0x9a, 0x10, 0x98, 0x21, 0x89, 0x78, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, + 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0xf7, 0x8f, 0x77, 0x8a, 0x77, 0x91, 0x88, 0x1b, + 0x86, 0x10, 0xfb, 0x18, 0xa2, 0x5b, 0xd0, 0x30, 0x98, 0x10, 0x0c, 0xd2, 0x1b, 0x80, 0x38, 0xc3, + 0x28, 0x9b, 0x27, 0x8a, 0x83, 0x09, 0x9c, 0x92, 0x58, 0xba, 0x88, 0x47, 0x19, 0xd8, 0x41, 0x8a, + 0x04, 0x80, 0xad, 0x00, 0x20, 0x09, 0x81, 0x90, 0x8f, 0x82, 0x11, 0x8d, 0x02, 0x81, 0x92, 0x8e, + 0x91, 0x40, 0xc0, 0x79, 0x80, 0x99, 0x11, 0x89, 0xc0, 0x38, 0x20, 0x37, 0xc9, 0xba, 0x51, 0x99, + 0x12, 0x91, 0x2b, 0xfa, 0x31, 0x88, 0x89, 0xb0, 0x3b, 0xc1, 0x31, 0x63, 0xb8, 0xf1, 0x3d, 0xa2, + 0x30, 0x99, 0xa0, 0x11, 0x2a, 0x9b, 0x17, 0x0f, 0x02, 0x10, 0x91, 0x9b, 0x58, 0x01, 0xb1, 0x8d, + 0x88, 0x28, 0xa3, 0x11, 0x89, 0x39, 0xf8, 0x28, 0xbd, 0x12, 0x01, 0x47, 0xcc, 0x80, 0x20, 0x30, + 0xa2, 0xba, 0x0e, 0x25, 0x99, 0x01, 0xba, 0x30, 0x19, 0x95, 0x9c, 0x71, 0xb8, 0x11, 0x8d, 0x83, + 0x59, 0x92, 0x08, 0xca, 0x31, 0x10, 0xd2, 0x8b, 0x0a, 0x04, 0x0c, 0x81, 0xbc, 0x44, 0x30, 0xfb, + 0x10, 0x9b, 0x21, 0x10, 0xb2, 0x8f, 0x03, 0x54, 0xc8, 0x88, 0x89, 0x24, 0x98, 0x19, 0x91, 0x88, + 0x18, 0x29, 0xb7, 0x0f, 0x02, 0x08, 0xb8, 0x3c, 0x94, 0x28, 0xa0, 0x00, 0xac, 0x22, 0x11, 0x01, + 0x9c, 0xb2, 0x2d, 0xa3, 0x1a, 0x30, 0xd4, 0x8d, 0x21, 0xd8, 0x1a, 0x14, 0x1b, 0x27, 0x8b, 0xa8, + 0x12, 0x3a, 0x27, 0xc0, 0xaa, 0x9c, 0x31, 0x22, 0x94, 0x9b, 0x0d, 0x95, 0x1a, 0x92, 0x8a, 0x14, + 0x38, 0xd0, 0x20, 0x9e, 0x11, 0x43, 0xdb, 0x18, 0x10, 0xb9, 0x28, 0xa1, 0xad, 0x34, 0xaa, 0xa4, + 0x0f, 0x92, 0x60, 0x82, 0x9a, 0x18, 0x81, 0x01, 0x34, 0xcb, 0x03, 0xbf, 0x81, 0x42, 0x80, 0x98, + 0x1a, 0xe2, 0x1d, 0x84, 0x30, 0xa1, 0xaa, 0x9c, 0x82, 0x5c, 0x84, 0xa9, 0x9b, 0x14, 0x08, 0xab, + 0x09, 0x04, 0x3c, 0x05, 0x02, 0x8f, 0x81, 0x10, 0x90, 0x30, 0xb0, 0x49, 0x04, 0x18, 0xf8, 0x19, + 0xba, 0x19, 0x30, 0x96, 0x49, 0xf9, 0x89, 0x31, 0xa8, 0x09, 0x02, 0x3a, 0x84, 0x31, 0x90, 0xac, + 0x48, 0x93, 0x58, 0x93, 0x4c, 0xb4, 0x9a, 0xdd, 0x38, 0x02, 0xa0, 0x0d, 0x08, 0x82, 0x48, 0x80, + 0xc9, 0x40, 0x10, 0xe3, 0x48, 0xa0, 0x99, 0x2a, 0x04, 0xa8, 0x49, 0x17, 0xc9, 0x18, 0xa9, 0x13, + 0x98, 0xba, 0x0e, 0x14, 0x10, 0xac, 0x88, 0x52, 0x99, 0x01, 0x80, 0x80, 0xad, 0x46, 0x90, 0x0a, + 0x88, 0x53, 0xeb, 0x29, 0x01, 0x40, 0x90, 0x81, 0x0c, 0xc3, 0x0a, 0xab, 0x84, 0x38, 0xdb, 0x33, + 0x52, 0xa8, 0xb9, 0x0c, 0x12, 0x91, 0x18, 0x28, 0x82, 0x0c, 0xe6, 0x4d, 0x83, 0x8b, 0x11, 0x8c, + 0x13, 0x00, 0x99, 0x88, 0x9c, 0x73, 0xf0, 0x0b, 0x12, 0x02, 0x8a, 0x30, 0xb3, 0x1d, 0x80, 0x32, + 0xb8, 0xbc, 0x89, 0x41, 0x83, 0xac, 0x73, 0xb2, 0x5b, 0x86, 0x9b, 0x80, 0x09, 0x50, 0x83, 0xaa, + 0x8b, 0x90, 0xc1, 0x0f, 0x14, 0x20, 0xea, 0x18, 0x22, 0xd9, 0x88, 0x63, 0xa8, 0x99, 0x09, 0x21, + 0x34, 0xd8, 0x9b, 0x81, 0x52, 0x98, 0x22, 0xbd, 0x80, 0x50, 0xa0, 0x21, 0xbb, 0x98, 0x78, 0x94, + 0x9e, 0x22, 0x21, 0xd0, 0x0c, 0x12, 0x98, 0x28, 0xc0, 0x38, 0x80, 0xc9, 0x2b, 0x27, 0x98, 0x89, + 0x54, 0xd9, 0x89, 0x30, 0xa4, 0x19, 0x90, 0xae, 0x12, 0x89, 0x42, 0x81, 0xca, 0x08, 0x32, 0xea, + 0x29, 0x11, 0x40, 0xb8, 0x98, 0x3c, 0x84, 0x10, 0xa8, 0x2a, 0xf2, 0x48, 0x32, 0xc3, 0xaf, 0x38, + 0x92, 0x28, 0xbb, 0x20, 0x31, 0x24, 0xfe, 0x09, 0x20, 0x83, 0x8b, 0xb0, 0x9d, 0x61, 0x04, 0xa9, + 0x89, 0x99, 0x65, 0x91, 0x9a, 0x89, 0x32, 0xb2, 0x0b, 0xaa, 0x35, 0x02, 0xa9, 0xaa, 0x29, 0x80, + 0x42, 0xa4, 0xff, 0x28, 0x22, 0xa1, 0xdb, 0x29, 0x06, 0x9b, 0x02, 0x1b, 0xa2, 0x20, 0x21, 0xea, + 0x99, 0x71, 0xb0, 0x00, 0x28, 0x82, 0x10, 0x88, 0xfe, 0x3a, 0x17, 0x98, 0x9b, 0x20, 0x08, 0x00, + 0x11, 0x94, 0x8e, 0x82, 0x09, 0x28, 0x81, 0x80, 0x9a, 0xba, 0x81, 0x2d, 0xb5, 0x4a, 0x99, 0x03, + 0x1c, 0xc2, 0x39, 0x99, 0x57, 0xca, 0x21, 0x98, 0xb9, 0x78, 0xa4, 0x3a, 0xb3, 0x2a, 0xd9, 0x48, + 0x10, 0x11, 0x11, 0xef, 0x29, 0x13, 0x88, 0xba, 0x00, 0x00, 0x88, 0x81, 0x8a, 0x02, 0x52, 0xa2, + 0xcf, 0x90, 0x50, 0x85, 0xa9, 0x8b, 0x04, 0x49, 0x04, 0xa9, 0x8b, 0x33, 0x80, 0xdc, 0x40, 0x02, + 0x08, 0xba, 0xbb, 0xcc, 0x71, 0x94, 0x18, 0xa9, 0x89, 0x22, 0xb8, 0x0c, 0x10, 0x25, 0x08, 0xc8, + 0x30, 0xda, 0x52, 0x91, 0x89, 0x98, 0xab, 0x64, 0x80, 0x08, 0x81, 0x88, 0xcd, 0x01, 0x1a, 0x37, + 0xb8, 0x9e, 0x00, 0x32, 0xb0, 0x3b, 0x86, 0xad, 0x28, 0x25, 0xb9, 0x89, 0x11, 0x00, 0xb9, 0x29, + 0x32, 0xc8, 0x61, 0xb8, 0x39, 0xa3, 0x8d, 0x26, 0x9c, 0x23, 0x99, 0x88, 0xb9, 0x09, 0x9f, 0x57, + 0xb8, 0x89, 0x11, 0x90, 0x10, 0x11, 0xc8, 0xcd, 0x40, 0x02, 0x00, 0xc9, 0x1a, 0x83, 0x00, 0x98, + 0x98, 0x20, 0x36, 0x88, 0xe9, 0x9d, 0x32, 0x22, 0x12, 0xcb, 0xae, 0x10, 0x73, 0x92, 0x8b, 0xb8, + 0x09, 0x32, 0x01, 0xa9, 0xa9, 0x78, 0xc8, 0x09, 0xaa, 0x74, 0x82, 0xb9, 0x8c, 0x21, 0x30, 0x15, + 0xc9, 0xac, 0x41, 0x82, 0x11, 0xba, 0x9b, 0x30, 0x47, 0xc8, 0x8c, 0x10, 0x04, 0x08, 0x80, 0xea, + 0x1a, 0x24, 0x10, 0xa9, 0x8a, 0xaa, 0x61, 0x92, 0x88, 0x18, 0xc1, 0x9a, 0x40, 0xa3, 0x9f, 0x63, + 0xa0, 0x0a, 0x9a, 0x53, 0x01, 0x9a, 0x91, 0x9d, 0x33, 0x8a, 0x43, 0xa0, 0xae, 0x31, 0x18, 0x82, + 0xcd, 0x28, 0x41, 0x94, 0x9e, 0x00, 0x10, 0x11, 0x18, 0xd1, 0x9c, 0x29, 0x17, 0x8b, 0x03, 0xcb, + 0x1a, 0x25, 0xa8, 0x08, 0x10, 0x04, 0xae, 0x28, 0x13, 0xba, 0x68, 0xa1, 0x08, 0xac, 0x13, 0x40, + 0xf1, 0x0a, 0x21, 0x93, 0x8b, 0x88, 0x15, 0x8b, 0x04, 0x9c, 0xd8, 0x48, 0x91, 0x58, 0xb2, 0xac, + 0x18, 0x17, 0x98, 0xa0, 0x8a, 0x22, 0x00, 0x00, 0x8a, 0x88, 0x09, 0x57, 0xc9, 0x0b, 0x04, 0x28, + 0x90, 0x08, 0xfb, 0x18, 0x35, 0xe8, 0x8a, 0x01, 0x21, 0xa1, 0x99, 0x19, 0xb1, 0x72, 0xa8, 0xa8, + 0x89, 0x72, 0x05, 0x99, 0x9b, 0x11, 0x12, 0xab, 0x04, 0x9e, 0x23, 0x1a, 0x94, 0xab, 0x9b, 0x42, + 0x10, 0x05, 0xae, 0x31, 0xb1, 0x19, 0xa2, 0x89, 0x89, 0x05, 0xbc, 0x51, 0xa2, 0x2b, 0x16, 0xba, + 0x90, 0x79, 0x83, 0xd8, 0x0b, 0x83, 0xca, 0x72, 0x91, 0xb8, 0x59, 0xa1, 0x2a, 0x93, 0x2a, 0x98, + 0x45, 0xcb, 0x10, 0x99, 0x89, 0x58, 0x27, 0xdb, 0x28, 0xb8, 0x49, 0x03, 0x99, 0x09, 0xa1, 0x0b, + 0x12, 0x18, 0xc8, 0x40, 0x91, 0xae, 0x11, 0x2a, 0x06, 0x80, 0x88, 0x08, 0x03, 0x63, 0xfa, 0x39, + 0x92, 0x51, 0xea, 0x10, 0x08, 0x90, 0x18, 0xa0, 0x9b, 0x08, 0x38, 0xf2, 0x50, 0xd1, 0x1c, 0x84, + 0x8c, 0x14, 0x80, 0x89, 0x81, 0x1b, 0x93, 0x0c, 0x07, 0x9b, 0x44, 0xb8, 0x09, 0xa8, 0x40, 0x13, + 0xeb, 0x89, 0x00, 0x20, 0x84, 0x9b, 0xac, 0x73, 0xc2, 0x19, 0x91, 0x8a, 0x44, 0xa9, 0x99, 0x0a, + 0x24, 0x81, 0x19, 0xf2, 0x0d, 0x25, 0x90, 0x8a, 0x98, 0x59, 0x82, 0x98, 0xac, 0x40, 0x92, 0x98, + 0x29, 0x97, 0x8d, 0x12, 0x80, 0xb9, 0x20, 0x01, 0x00, 0xaa, 0x8a, 0x05, 0xaf, 0x33, 0x81, 0xa0, + 0x3a, 0xb2, 0x3a, 0x73, 0xc1, 0x8d, 0x63, 0xa0, 0x89, 0x99, 0x20, 0x32, 0xa0, 0xbc, 0x9b, 0x52, + 0x26, 0xa1, 0xcf, 0x10, 0x32, 0xb0, 0xac, 0x21, 0x80, 0x31, 0xa5, 0xbf, 0x30, 0x23, 0x81, 0xdc, + 0x18, 0x02, 0x18, 0x25, 0xea, 0x8b, 0x53, 0x81, 0xb9, 0x1b, 0x13, 0x19, 0x83, 0xae, 0x08, 0x12, + 0x1a, 0x13, 0x99, 0xcf, 0x50, 0x03, 0xcc, 0x21, 0x98, 0x31, 0xb1, 0x8b, 0x28, 0x93, 0x9b, 0x28, + 0x07, 0x9f, 0x63, 0xb0, 0x8a, 0x02, 0x89, 0x32, 0x00, 0xd0, 0xac, 0x31, 0xb1, 0x61, 0xa1, 0x8c, + 0x11, 0x89, 0x33, 0xf9, 0x89, 0x29, 0x07, 0xa9, 0x8a, 0x16, 0x89, 0x98, 0x81, 0x9a, 0x32, 0x30, + 0xd1, 0x58, 0xb8, 0x88, 0x1b, 0x92, 0x49, 0x16, 0x98, 0xc9, 0x0d, 0x23, 0x91, 0x09, 0x83, 0x8c, + 0xf0, 0x3a, 0x14, 0xa8, 0x8c, 0x90, 0x63, 0xc8, 0x48, 0x93, 0xcc, 0x38, 0x05, 0xab, 0x10, 0x81, + 0x38, 0x22, 0xf0, 0x8e, 0x32, 0xa9, 0x53, 0xb0, 0x9d, 0x00, 0x23, 0xa0, 0x8a, 0xc0, 0x19, 0x17, + 0xa9, 0x0a, 0x02, 0x23, 0xaa, 0xd9, 0x58, 0xa0, 0x41, 0xa8, 0xba, 0x4b, 0x27, 0x99, 0x89, 0x00, + 0x8e, 0x34, 0x81, 0xda, 0x1a, 0x22, 0x83, 0xbd, 0x33, 0xb9, 0x9c, 0x24, 0x89, 0x01, 0x0a, 0x15, + 0xaa, 0xeb, 0x40, 0x81, 0x98, 0x19, 0x17, 0xec, 0x20, 0x21, 0xa8, 0x19, 0x88, 0x99, 0x50, 0x94, + 0x1a, 0xa1, 0x8c, 0x26, 0xcc, 0x28, 0x12, 0x18, 0x93, 0xbf, 0x38, 0x13, 0xa9, 0x0b, 0x21, 0xd1, + 0x6a, 0xa2, 0xaa, 0x19, 0x14, 0x11, 0xa2, 0xdf, 0x28, 0x24, 0xc9, 0x18, 0x81, 0x99, 0x18, 0x15, + 0x19, 0xe9, 0x48, 0xa2, 0x9b, 0x28, 0x14, 0x13, 0xfc, 0x1b, 0x01, 0x23, 0xa9, 0x9a, 0x40, 0xb1, + 0x8c, 0x43, 0xb8, 0x18, 0x13, 0x01, 0xfb, 0x0b, 0x02, 0x58, 0x15, 0xc9, 0x0c, 0x22, 0x98, 0x2a, + 0x86, 0x9a, 0x01, 0xc9, 0x5a, 0x05, 0xac, 0x11, 0x91, 0xa8, 0x9b, 0x47, 0xa1, 0x8b, 0x00, 0x12, + 0xc9, 0x0b, 0x45, 0xa8, 0x8c, 0x42, 0x98, 0x80, 0xaa, 0x40, 0x05, 0xba, 0x8b, 0x35, 0xa0, 0x0b, + 0x05, 0x98, 0xac, 0x12, 0x31, 0xb1, 0x9e, 0x21, 0x41, 0xd8, 0x0a, 0x14, 0xc8, 0x2b, 0x83, 0x19, + 0x82, 0xaa, 0x23, 0xcf, 0x35, 0xa9, 0x98, 0x29, 0x13, 0x09, 0xdb, 0x64, 0xc8, 0x0a, 0x32, 0x01, + 0xb9, 0x0c, 0x91, 0x3a, 0xa5, 0x2c, 0x87, 0x9b, 0x99, 0x62, 0x03, 0xbd, 0x48, 0x91, 0x88, 0x30, + 0xd1, 0x19, 0xc0, 0x60, 0x91, 0xa9, 0x1a, 0x32, 0x92, 0xaf, 0x21, 0x13, 0xab, 0x18, 0x80, 0x9a, + 0x31, 0x37, 0xfa, 0x0b, 0x32, 0x03, 0xba, 0x00, 0xaf, 0x51, 0x83, 0xbb, 0x19, 0x03, 0x1b, 0x07, + 0xa9, 0x8e, 0x23, 0x08, 0x80, 0x8b, 0x80, 0x10, 0x10, 0x01, 0xd9, 0xcd, 0x62, 0x81, 0xa9, 0x29, + 0x32, 0x96, 0xae, 0x52, 0xb9, 0x00, 0x30, 0x83, 0xab, 0x8c, 0x25, 0xa8, 0x8c, 0x31, 0x81, 0xbc, + 0x62, 0xa1, 0x8f, 0x21, 0x81, 0x88, 0xac, 0x22, 0x08, 0x15, 0xda, 0x19, 0x04, 0xab, 0x52, 0x91, + 0xab, 0x18, 0x44, 0xb0, 0xab, 0x39, 0x47, 0xb8, 0x9a, 0x10, 0x10, 0x90, 0x19, 0x83, 0xcf, 0x40, + 0x12, 0xb9, 0x9f, 0x63, 0x90, 0xaa, 0x08, 0x19, 0x02, 0x62, 0xc0, 0x9a, 0x21, 0x88, 0x14, 0xa8, + 0xca, 0x30, 0x34, 0xea, 0x2a, 0x01, 0x00, 0x09, 0x91, 0xac, 0x00, 0x73, 0xc0, 0x18, 0x18, 0xf9, + 0x19, 0x02, 0x41, 0xb1, 0x0c, 0x80, 0x93, 0x9f, 0x43, 0x88, 0xb9, 0x20, 0x82, 0x98, 0x0d, 0x26, + 0x82, 0xcd, 0x19, 0x31, 0xb1, 0x60, 0xa0, 0xa9, 0xa9, 0x52, 0xa2, 0x0b, 0xa1, 0x7a, 0x04, 0xdc, + 0x28, 0x01, 0x11, 0xb8, 0x0a, 0x83, 0xab, 0x73, 0x82, 0xc0, 0x9e, 0x53, 0x90, 0x8b, 0x00, 0x21, + 0x02, 0xcd, 0x28, 0x01, 0x89, 0x32, 0x91, 0xbd, 0x1a, 0x26, 0xb8, 0x09, 0x21, 0xa0, 0x80, 0x9a, + 0xfb, 0x79, 0x83, 0x08, 0x88, 0xd9, 0x0b, 0x33, 0x54, 0xe0, 0x1a, 0x01, 0x9a, 0x62, 0xb0, 0x8b, + 0x32, 0xaa, 0x83, 0x8e, 0x22, 0x14, 0x8a, 0xa3, 0xbf, 0x08, 0x63, 0x83, 0x9c, 0x99, 0x22, 0x11, + 0xf9, 0x49, 0x91, 0x1b, 0x03, 0xa9, 0x9a, 0x9a, 0x77, 0xc0, 0x1a, 0xa1, 0x38, 0x33, 0xfa, 0x18, + 0x99, 0x32, 0x91, 0x88, 0x9a, 0x90, 0x70, 0x82, 0xbc, 0x09, 0x44, 0xb0, 0x30, 0xfb, 0x18, 0x10, + 0x11, 0xa0, 0x0c, 0x81, 0x29, 0x35, 0xf9, 0x1a, 0x01, 0x19, 0x00, 0xc0, 0x29, 0x9b, 0x47, 0xb0, + 0x8b, 0x20, 0x83, 0x29, 0xc8, 0x91, 0x4b, 0x93, 0x38, 0xfa, 0xa0, 0x3b, 0x36, 0x02, 0xde, 0x28, + 0x02, 0x00, 0xba, 0x10, 0xa0, 0x38, 0x21, 0x94, 0xcf, 0x28, 0x86, 0x09, 0xa0, 0x8d, 0x44, 0xb0, + 0x0b, 0x03, 0x9b, 0x41, 0x11, 0xb1, 0x9f, 0x48, 0x84, 0x8a, 0x81, 0xab, 0x30, 0x17, 0x9b, 0x00, + 0x8c, 0x13, 0x18, 0xca, 0x33, 0xaf, 0x44, 0xa8, 0xab, 0x31, 0xa1, 0x50, 0x80, 0xe9, 0x38, 0x80, + 0x02, 0xb8, 0x3b, 0xb0, 0x61, 0x83, 0xbf, 0x42, 0x99, 0x10, 0x03, 0xae, 0x89, 0x72, 0x82, 0xab, + 0x10, 0x8a, 0x01, 0x04, 0x09, 0xe8, 0x59, 0xa2, 0x1a, 0x92, 0xca, 0x51, 0x91, 0x99, 0x9c, 0x64, + 0xa0, 0x09, 0x81, 0xc9, 0x10, 0x11, 0x12, 0xeb, 0x39, 0x06, 0x9c, 0x20, 0x80, 0x88, 0x91, 0x89, + 0x33, 0xaa, 0xfa, 0x71, 0xa1, 0x0b, 0x20, 0x03, 0xae, 0x08, 0x53, 0xc8, 0x28, 0xa0, 0x21, 0xdb, + 0x11, 0x38, 0xb1, 0x8a, 0x8a, 0x34, 0x81, 0x09, 0x41, 0xf2, 0x0f, 0x21, 0x01, 0x99, 0xab, 0x63, + 0xb1, 0x2d, 0xa4, 0x3b, 0x92, 0x8b, 0x21, 0xac, 0x13, 0x21, 0xa1, 0xbf, 0x32, 0x28, 0xe0, 0x4a, + 0x92, 0x0b, 0x32, 0xa2, 0xdf, 0x49, 0x13, 0x9a, 0x11, 0xe8, 0x48, 0x91, 0x1b, 0xa2, 0x10, 0x8c, + 0x12, 0x51, 0xf0, 0x2b, 0x93, 0x18, 0xba, 0x58, 0x02, 0xd8, 0x3a, 0xa3, 0x90, 0x0f, 0x05, 0x0a, + 0x90, 0x1b, 0x86, 0x28, 0xc0, 0x28, 0x88, 0xaa, 0x63, 0x90, 0x90, 0xac, 0x43, 0xe9, 0x21, 0x91, + 0x89, 0xa1, 0x3a, 0x87, 0x9d, 0x33, 0x89, 0x88, 0x9a, 0x0a, 0x35, 0x08, 0x22, 0xed, 0x20, 0xa1, + 0x20, 0xc2, 0x8c, 0x02, 0x40, 0xc2, 0xae, 0x31, 0xa3, 0x0b, 0x23, 0x8b, 0xa1, 0x2a, 0x93, 0x23, + 0x8d, 0xe8, 0x65, 0xd8, 0x19, 0x11, 0x88, 0x90, 0x0a, 0x23, 0xac, 0x34, 0x89, 0xa2, 0xbf, 0x39, + 0x15, 0x88, 0xa8, 0xaa, 0x22, 0x51, 0xd9, 0x20, 0x90, 0x9a, 0x57, 0xd9, 0x1a, 0x21, 0x82, 0x8a, + 0xa8, 0x19, 0x41, 0x25, 0xc9, 0xbd, 0x72, 0x91, 0x89, 0x80, 0xca, 0x51, 0x81, 0x90, 0xab, 0x20, + 0x40, 0xb3, 0x8c, 0xb0, 0x71, 0x82, 0xcb, 0x31, 0xd8, 0x41, 0xa8, 0x29, 0x98, 0x80, 0x58, 0x84, + 0x9c, 0x98, 0x41, 0x80, 0xa8, 0x8b, 0x14, 0x81, 0x9b, 0x44, 0xd8, 0xac, 0x73, 0xa0, 0x80, 0x08, + 0x81, 0x0b, 0x04, 0x9c, 0x43, 0x99, 0x8a, 0x32, 0xc9, 0x01, 0xac, 0x74, 0xb1, 0x99, 0x88, 0x48, + 0x86, 0x9b, 0x92, 0x1a, 0x13, 0x99, 0xb1, 0x8c, 0x1a, 0x57, 0x08, 0xdc, 0x28, 0x05, 0x88, 0x99, + 0x8a, 0x22, 0x22, 0xc9, 0x98, 0x89, 0x54, 0xb0, 0x38, 0xfa, 0x39, 0x14, 0xa9, 0xa9, 0x3a, 0x04, + 0xa0, 0x2a, 0xd1, 0x49, 0xa2, 0x8b, 0x22, 0xa1, 0x1e, 0x05, 0xaa, 0x0b, 0x16, 0xa9, 0x80, 0x48, + 0x91, 0x10, 0xe9, 0x41, 0x90, 0x30, 0xdd, 0x21, 0x11, 0xc8, 0x18, 0xfa, 0x30, 0x83, 0x88, 0xa0, + 0xbf, 0x53, 0x92, 0x89, 0xab, 0x02, 0x51, 0x91, 0x0b, 0xd1, 0x49, 0x01, 0x93, 0xaf, 0x23, 0x98, + 0x30, 0xd0, 0x9b, 0x23, 0x50, 0xb3, 0x9f, 0x08, 0x25, 0xa9, 0x99, 0x0a, 0x24, 0x01, 0xba, 0xaa, + 0x3a, 0x37, 0x80, 0xca, 0xab, 0x72, 0x82, 0x98, 0xa8, 0x19, 0x43, 0xb1, 0x0a, 0xc9, 0x61, 0xb2, + 0x0a, 0x20, 0xc9, 0x45, 0xba, 0x09, 0x1b, 0x27, 0x9a, 0x98, 0x18, 0x19, 0x87, 0x8b, 0x92, 0x2c, + 0x86, 0xab, 0x20, 0x02, 0x9a, 0x15, 0x9c, 0xa2, 0x61, 0xa9, 0x80, 0x2a, 0x17, 0xaa, 0xb3, 0x1e, + 0x12, 0x02, 0x80, 0xbd, 0x1a, 0x12, 0x31, 0x83, 0xdf, 0x28, 0x11, 0xa1, 0x8c, 0x21, 0x85, 0x8d, + 0x83, 0xa9, 0x28, 0x13, 0xa8, 0x9a, 0x09, 0x27, 0x0d, 0x83, 0xac, 0x33, 0x89, 0x00, 0xb8, 0x8f, + 0x35, 0xa0, 0x8a, 0xb9, 0x78, 0x81, 0xb8, 0x29, 0x15, 0xda, 0x5a, 0xc3, 0x2a, 0x03, 0x8a, 0x89, + 0x98, 0x49, 0x17, 0xab, 0x98, 0x30, 0x06, 0xcc, 0x20, 0x01, 0x98, 0x81, 0x10, 0xec, 0x31, 0x08, + 0x03, 0xeb, 0x19, 0x23, 0xa1, 0x0c, 0x92, 0x81, 0x40, 0xfb, 0x29, 0x24, 0xb0, 0x1a, 0xa8, 0x18, + 0x82, 0x88, 0x42, 0xfc, 0x39, 0x82, 0x91, 0xac, 0x38, 0x16, 0xbb, 0x21, 0xa8, 0x38, 0xa9, 0x57, + 0xc0, 0x0a, 0x80, 0x38, 0x02, 0x08, 0x99, 0xf9, 0x5d, 0x94, 0x0a, 0xa0, 0x20, 0xc9, 0x58, 0xa0, + 0x18, 0x31, 0xc0, 0x88, 0x9e, 0x21, 0x24, 0xb0, 0x9c, 0x92, 0x10, 0x98, 0x32, 0xa4, 0x8f, 0x28, + 0xa3, 0x28, 0xba, 0x36, 0xab, 0x05, 0xaf, 0x31, 0x88, 0x00, 0x20, 0xd1, 0x8a, 0xb9, 0x70, 0x85, + 0x99, 0x00, 0x99, 0x80, 0x0c, 0x37, 0xc0, 0x8a, 0x29, 0x83, 0x1a, 0x01, 0x80, 0x00, 0x9a, 0xce, + 0x41, 0x83, 0x9a, 0x44, 0xdb, 0x88, 0x2a, 0x16, 0x98, 0x8a, 0x11, 0x98, 0x88, 0x9b, 0x25, 0x61, + 0xd2, 0x8d, 0x11, 0x88, 0x31, 0xa2, 0x8b, 0xca, 0x30, 0x83, 0x98, 0x09, 0x16, 0xac, 0x13, 0xbc, + 0x00, 0x76, 0xd2, 0x1a, 0xa1, 0x09, 0x23, 0xa1, 0x9c, 0x32, 0x98, 0xea, 0x51, 0xa9, 0x52, 0xa8, + 0xa8, 0x09, 0x10, 0x42, 0x12, 0xf0, 0x0f, 0x03, 0x89, 0x01, 0x18, 0xba, 0x31, 0xc9, 0x38, 0xa2, + 0x52, 0xeb, 0x38, 0xa1, 0x2b, 0x16, 0xaa, 0x08, 0x12, 0x08, 0xc9, 0x81, 0x68, 0x91, 0x11, 0xcf, + 0x28, 0x22, 0x02, 0xdb, 0x99, 0x21, 0x02, 0xd8, 0x4a, 0x92, 0x8b, 0x34, 0xe1, 0x8d, 0x34, 0x80, + 0xaa, 0x8b, 0x29, 0x17, 0x08, 0x80, 0xbd, 0x32, 0x88, 0xa1, 0x2b, 0x27, 0xdb, 0x50, 0xb0, 0x09, + 0x01, 0x01, 0x80, 0xac, 0x31, 0x80, 0x23, 0xfb, 0x79, 0x91, 0x9c, 0x22, 0x99, 0x01, 0x00, 0xa0, + 0xad, 0x50, 0x93, 0x1b, 0xb2, 0x1c, 0x34, 0x91, 0x9f, 0x11, 0x00, 0x83, 0x9f, 0x01, 0x09, 0x53, + 0xe0, 0x2a, 0x83, 0x8a, 0x08, 0x92, 0x9e, 0x44, 0x80, 0xba, 0x89, 0x38, 0x34, 0xa3, 0xcf, 0x10, + 0x11, 0x91, 0x10, 0xb9, 0x2b, 0x04, 0xc8, 0x29, 0x99, 0x14, 0x50, 0xd1, 0x9c, 0x30, 0x12, 0x11, + 0xfa, 0x2c, 0x82, 0x40, 0xb0, 0x9b, 0x18, 0x35, 0x8a, 0xf9, 0x48, 0x81, 0x29, 0xa1, 0x8c, 0x09, + 0x13, 0x80, 0x0b, 0x83, 0x9c, 0x02, 0x42, 0x9b, 0x47, 0xeb, 0x1a, 0x02, 0x30, 0xc0, 0x89, 0xa8, + 0x20, 0x27, 0xcb, 0x21, 0x9b, 0x21, 0x25, 0xcb, 0x20, 0x10, 0xa1, 0xdb, 0x29, 0x00, 0x44, 0xc8, + 0x99, 0x5b, 0x94, 0x39, 0xf8, 0x18, 0x91, 0x31, 0xca, 0x8a, 0x35, 0x9c, 0x04, 0x9a, 0xba, 0x45, + 0x01, 0x99, 0x99, 0x8b, 0x38, 0x47, 0xbd, 0x41, 0x81, 0xaa, 0x28, 0x00, 0x01, 0x09, 0xb1, 0x1d, + 0x85, 0x8a, 0x50, 0xb1, 0x9c, 0x12, 0x32, 0xe9, 0x1a, 0x04, 0x1a, 0xe8, 0x29, 0x13, 0xc0, 0x2b, + 0x83, 0xab, 0x68, 0x91, 0x00, 0xaa, 0x72, 0x84, 0xac, 0x9a, 0x72, 0x02, 0x9a, 0x9b, 0x12, 0x8a, + 0x26, 0xc1, 0x0e, 0x02, 0x09, 0x22, 0xea, 0x19, 0x14, 0x99, 0xa0, 0x1c, 0x12, 0x10, 0x88, 0xc8, + 0x1c, 0x43, 0xa2, 0x9e, 0x02, 0x01, 0x22, 0xec, 0x09, 0x40, 0xb2, 0x40, 0xc9, 0x88, 0x11, 0x21, + 0xa2, 0x0c, 0xd9, 0x50, 0xb1, 0x2b, 0x12, 0x83, 0x9f, 0x91, 0x18, 0x19, 0x13, 0xb8, 0xbc, 0x70, + 0x83, 0x8b, 0xe1, 0x4a, 0x83, 0x98, 0x19, 0xc8, 0x70, 0xa2, 0x0b, 0x33, 0xd9, 0x09, 0x22, 0x80, + 0xd2, 0x2d, 0xa3, 0x9d, 0x02, 0x40, 0x83, 0xeb, 0x8b, 0x14, 0x82, 0x8c, 0x23, 0xba, 0x9b, 0x46, + 0xb2, 0x0d, 0x80, 0x41, 0xc0, 0x0a, 0x83, 0x28, 0x81, 0xa9, 0x30, 0xf8, 0x69, 0x92, 0x89, 0x8a, + 0x33, 0xa9, 0xaf, 0x33, 0x89, 0x42, 0xf8, 0x8b, 0x31, 0x01, 0x10, 0xc0, 0x1b, 0xc9, 0x64, 0xc9, + 0x20, 0x00, 0x91, 0x0b, 0x81, 0x48, 0x98, 0x92, 0x0c, 0x14, 0x9a, 0x31, 0xa4, 0xcf, 0x24, 0x98, + 0xa0, 0x8c, 0x12, 0x53, 0xd8, 0x88, 0x28, 0xd1, 0x29, 0x02, 0x89, 0x88, 0x31, 0xc0, 0x9c, 0x3a, + 0x67, 0x99, 0xaa, 0x28, 0x24, 0xb8, 0x8c, 0x22, 0x98, 0x23, 0x00, 0xcd, 0x99, 0x50, 0x22, 0xc3, + 0xbf, 0x31, 0x14, 0xab, 0x88, 0x31, 0xa9, 0x20, 0x90, 0x98, 0x4d, 0x06, 0xaa, 0xb9, 0x49, 0x16, + 0xa9, 0x09, 0x00, 0x10, 0x02, 0x88, 0xef, 0x31, 0x01, 0xb8, 0x29, 0xe8, 0x50, 0xa1, 0x09, 0xb8, + 0x52, 0xa9, 0x10, 0x02, 0xbc, 0x73, 0xb1, 0x89, 0x08, 0x82, 0x40, 0xa0, 0xca, 0x2d, 0x27, 0xab, + 0x08, 0x80, 0x02, 0x1a, 0x04, 0xcb, 0x89, 0x24, 0x98, 0x12, 0xcc, 0x28, 0x93, 0x8e, 0x14, 0x29, + 0xe0, 0x1b, 0x02, 0x31, 0xa9, 0x22, 0x9e, 0x02, 0x18, 0x00, 0xc8, 0x08, 0x38, 0xa6, 0x9f, 0x30, + 0x23, 0x91, 0xde, 0x29, 0x14, 0x98, 0x09, 0xb1, 0x0c, 0x25, 0x08, 0xdd, 0x30, 0x83, 0x80, 0xb9, + 0x09, 0x1a, 0x27, 0x08, 0xa8, 0xab, 0x38, 0x27, 0xd8, 0x8a, 0x21, 0x82, 0x28, 0xda, 0x80, 0x60, + 0xa2, 0x8d, 0x02, 0x9a, 0x11, 0x25, 0xec, 0x00, 0x20, 0x90, 0x08, 0x98, 0x10, 0x23, 0xa1, 0xcf, + 0x32, 0xb0, 0x2a, 0x25, 0xc9, 0x89, 0x08, 0x24, 0xad, 0x34, 0xab, 0x82, 0x0e, 0x04, 0x08, 0x08, + 0xca, 0x39, 0x22, 0xa2, 0xcb, 0x38, 0x13, 0xa3, 0xdf, 0x12, 0x99, 0x11, 0x48, 0xe2, 0x0b, 0x81, + 0x53, 0xa0, 0xaa, 0x3b, 0x07, 0x9a, 0x02, 0x99, 0x40, 0x85, 0xab, 0xea, 0x61, 0x80, 0x80, 0x08, + 0xb9, 0x4a, 0x06, 0x1b, 0xd1, 0x2a, 0x94, 0x09, 0x90, 0x18, 0xa1, 0x1a, 0x16, 0xcb, 0x18, 0x00, + 0x83, 0x49, 0xb2, 0x8f, 0x03, 0x09, 0x92, 0x28, 0xc8, 0x10, 0xa8, 0x38, 0x00, 0x06, 0x8f, 0x12, + 0x80, 0xbf, 0x53, 0xa1, 0x8b, 0x05, 0xa9, 0x19, 0x02, 0x14, 0xbe, 0x11, 0x21, 0xa9, 0x22, 0xfb, + 0x38, 0x90, 0x13, 0x8e, 0xc2, 0x3a, 0x04, 0x00, 0x98, 0xbd, 0x50, 0x02, 0x99, 0xa9, 0x34, 0xaa, + 0x84, 0x8d, 0x92, 0x69, 0x92, 0x08, 0xb9, 0xa9, 0x41, 0x35, 0xf9, 0x0b, 0x22, 0x01, 0xba, 0x90, + 0x38, 0x84, 0x88, 0x30, 0xde, 0x40, 0x92, 0x99, 0x01, 0xe8, 0x49, 0x94, 0x0b, 0x98, 0x63, 0xb0, + 0x1a, 0xa0, 0x58, 0x91, 0x08, 0xb0, 0x5b, 0xc2, 0x0a, 0x35, 0xca, 0x01, 0x29, 0xd9, 0x29, 0x13, + 0x10, 0xb8, 0x1a, 0xcf, 0x53, 0x82, 0xbd, 0x51, 0x91, 0xaa, 0x12, 0x00, 0x89, 0x03, 0xa9, 0xae, + 0x15, 0x18, 0x11, 0xe1, 0x8c, 0x28, 0x15, 0xaa, 0x0b, 0x33, 0x00, 0xa9, 0x1b, 0x23, 0xa9, 0x08, + 0x11, 0x28, 0xf8, 0x68, 0xa8, 0x11, 0xcf, 0x44, 0xa9, 0x09, 0x89, 0x17, 0x8a, 0x80, 0x98, 0x28, + 0xa2, 0x1b, 0x13, 0x1b, 0xd1, 0x30, 0xbc, 0x35, 0x8b, 0x83, 0xa8, 0xbd, 0x79, 0x24, 0xc1, 0xac, + 0x10, 0x24, 0xc8, 0x08, 0xa8, 0x48, 0x22, 0xd0, 0x0c, 0x03, 0x08, 0x80, 0x80, 0xbd, 0x31, 0x22, + 0x07, 0xaf, 0x82, 0x48, 0x91, 0xba, 0x18, 0x51, 0xb2, 0x9a, 0x23, 0xca, 0x41, 0x98, 0x80, 0x89, + 0x23, 0x3b, 0xc7, 0x0d, 0x82, 0x28, 0x94, 0xad, 0x31, 0xa2, 0x2b, 0xc1, 0x29, 0x42, 0xea, 0x58, + 0xb1, 0x1b, 0x03, 0xba, 0x51, 0xa1, 0x11, 0x9a, 0xca, 0x08, 0x74, 0x82, 0xb9, 0x9c, 0x41, 0x08, + 0x04, 0x8d, 0x81, 0x81, 0xbb, 0x44, 0x08, 0xc1, 0x28, 0xe9, 0x30, 0xca, 0x61, 0x92, 0xab, 0x98, + 0x30, 0x12, 0x81, 0xaa, 0x3a, 0x47, 0xac, 0x29, 0x93, 0x1a, 0x31, 0x90, 0xa1, 0xff, 0x33, 0xa0, + 0x8b, 0x84, 0x9b, 0x15, 0x99, 0x08, 0x29, 0x04, 0xcb, 0x49, 0xc0, 0x18, 0x49, 0x95, 0x9b, 0x10, + 0x91, 0x1a, 0x22, 0xa9, 0x22, 0xbb, 0x1d, 0xa2, 0x2f, 0x47, 0xaa, 0x99, 0x21, 0xd1, 0x3c, 0x06, + 0x89, 0x88, 0x11, 0xbc, 0x41, 0x98, 0x33, 0xcc, 0x08, 0x82, 0x29, 0x15, 0xae, 0x18, 0x12, 0x88, + 0x99, 0x8a, 0x13, 0x01, 0xb4, 0x4c, 0xf8, 0x39, 0x84, 0x1b, 0x81, 0x09, 0x42, 0xfa, 0x5b, 0x82, + 0x08, 0x99, 0x92, 0x0b, 0x14, 0x1b, 0x94, 0x1b, 0xc8, 0x28, 0x83, 0xaa, 0xcc, 0x72, 0x95, 0xad, + 0x41, 0x98, 0x08, 0x82, 0x19, 0x18, 0xb9, 0x50, 0xb9, 0x43, 0xca, 0x32, 0x90, 0xfb, 0x48, 0x82, + 0x00, 0xba, 0x00, 0x4a, 0xa4, 0xaa, 0x70, 0xa2, 0x19, 0xb2, 0x9f, 0x15, 0x9a, 0x23, 0x9b, 0xa8, + 0x59, 0x80, 0x80, 0xac, 0x63, 0xa1, 0x9c, 0x01, 0x88, 0x64, 0xb0, 0x8a, 0x88, 0x08, 0x54, 0x90, + 0xc0, 0x1c, 0x23, 0x91, 0xba, 0x8f, 0x26, 0x99, 0x80, 0x89, 0x1a, 0x13, 0xc8, 0x38, 0xa9, 0xb3, + 0x4f, 0x02, 0xc8, 0x2b, 0x33, 0xd0, 0xab, 0x69, 0x83, 0x28, 0xbc, 0x04, 0x0a, 0x92, 0x19, 0x15, + 0x99, 0xcb, 0x52, 0x10, 0xe0, 0x19, 0x01, 0x98, 0x1a, 0x01, 0x58, 0xd1, 0x8d, 0x23, 0x82, 0xbe, + 0x31, 0x11, 0xa9, 0x9a, 0x31, 0xa0, 0x40, 0x10, 0xe0, 0x38, 0xc0, 0x58, 0x93, 0xaa, 0xbd, 0x72, + 0x84, 0x9c, 0x08, 0x41, 0xa1, 0x8b, 0x81, 0x2a, 0x95, 0x28, 0x99, 0xd0, 0x0c, 0x53, 0x91, 0xb0, + 0x9f, 0x23, 0x03, 0x9c, 0xa8, 0x58, 0x00, 0x00, 0xa0, 0x8b, 0x0b, 0x27, 0x3a, 0xc4, 0x8b, 0x08, + 0x32, 0xc3, 0x0b, 0x40, 0xb4, 0x8d, 0x08, 0x14, 0xa9, 0x1a, 0x07, 0xa9, 0x99, 0xa1, 0x73, 0xc1, + 0x10, 0x9a, 0xb1, 0x5a, 0x03, 0x82, 0xdc, 0x19, 0x05, 0x98, 0x09, 0x08, 0x22, 0x11, 0xfb, 0x1a, + 0x18, 0x34, 0xa1, 0x9e, 0xa8, 0x51, 0x80, 0x12, 0xdb, 0x28, 0xb2, 0x60, 0xb0, 0x8c, 0x43, 0x98, + 0x98, 0xc9, 0x58, 0x93, 0x19, 0x11, 0xfc, 0x20, 0x80, 0x01, 0xaa, 0x08, 0x34, 0xb1, 0x9d, 0x90, + 0x50, 0x11, 0x94, 0x8f, 0x81, 0x09, 0x33, 0xa0, 0x8c, 0xc9, 0x39, 0x17, 0x98, 0xa8, 0x18, 0x18, + 0xc3, 0x1c, 0x13, 0xc0, 0x1a, 0x19, 0x07, 0x0d, 0x90, 0x42, 0xa8, 0xba, 0x60, 0x91, 0x1b, 0x87, + 0x8a, 0xa0, 0x11, 0x21, 0xaa, 0x93, 0x1c, 0x11, 0xa5, 0x2c, 0xe0, 0x29, 0x02, 0x84, 0xad, 0x48, + 0x81, 0xa8, 0x40, 0xd8, 0x18, 0x08, 0x81, 0x30, 0xca, 0x11, 0x98, 0x39, 0xa6, 0x0c, 0x21, 0xa2, + 0x3a, 0x91, 0x85, 0xaf, 0x49, 0x04, 0x98, 0x9d, 0x02, 0x12, 0x9b, 0x12, 0xb8, 0x2d, 0x91, 0x42, + 0xb9, 0xa9, 0x30, 0x2a, 0x17, 0x8f, 0x20, 0x82, 0x8b, 0x29, 0x93, 0x10, 0x1b, 0x97, 0xab, 0x42, + 0x99, 0x06, 0xbb, 0x20, 0xa0, 0x8e, 0x27, 0xaa, 0x98, 0x30, 0x89, 0x04, 0x8a, 0x18, 0x9a, 0x17, + 0x1f, 0xa2, 0x89, 0x28, 0x03, 0x8c, 0xa2, 0x0c, 0x06, 0x19, 0x94, 0x9d, 0x32, 0xe0, 0x39, 0xa2, + 0x0d, 0x41, 0x81, 0xaa, 0x8a, 0x02, 0x40, 0x82, 0xea, 0x0a, 0x18, 0x15, 0xa0, 0x1b, 0xe1, 0x2a, + 0x74, 0xc0, 0x0a, 0x11, 0x11, 0xa1, 0x8f, 0x01, 0x00, 0x10, 0x01, 0xd8, 0x8d, 0x11, 0x24, 0x9a, + 0xa9, 0x30, 0xa1, 0x0b, 0x16, 0xab, 0x00, 0x81, 0x51, 0xea, 0x20, 0x21, 0xaa, 0x14, 0xad, 0x81, + 0x48, 0x92, 0x89, 0x9b, 0x82, 0x51, 0xb0, 0x61, 0xda, 0x28, 0x10, 0x81, 0xcc, 0x19, 0x37, 0xb9, + 0x18, 0xb1, 0x8f, 0x22, 0x12, 0xc8, 0x2a, 0x90, 0x9a, 0x62, 0x83, 0xe8, 0x2a, 0xb3, 0x20, 0xa8, + 0x39, 0x07, 0x8d, 0x08, 0x00, 0x00, 0x0c, 0x17, 0xa9, 0x8c, 0x32, 0xa0, 0x29, 0xa0, 0x2a, 0x84, + 0xcb, 0x30, 0x52, 0xf8, 0x49, 0x81, 0x99, 0x09, 0x28, 0x04, 0xa9, 0x8c, 0x80, 0x63, 0xa8, 0xa9, + 0x46, 0xcb, 0x00, 0x01, 0x00, 0xb0, 0x38, 0x00, 0xa3, 0xac, 0x0e, 0x07, 0x99, 0x40, 0xc0, 0x18, + 0x99, 0x41, 0x93, 0x8c, 0xa8, 0x59, 0x92, 0x89, 0x99, 0x43, 0xc8, 0x08, 0x9b, 0x27, 0x0b, 0x91, + 0x31, 0xf9, 0x8d, 0x24, 0x00, 0x80, 0xc9, 0x09, 0x20, 0x06, 0x9a, 0x89, 0x04, 0xab, 0x30, 0xa4, + 0x0c, 0xb0, 0x73, 0x00, 0xda, 0x09, 0x43, 0x00, 0xea, 0x28, 0x91, 0x89, 0x50, 0xa3, 0x9c, 0x20, + 0x91, 0x2b, 0x96, 0x0b, 0x02, 0x01, 0xc8, 0x8c, 0x21, 0x15, 0x9c, 0x80, 0x40, 0xd9, 0x09, 0x73, + 0x90, 0xbb, 0x52, 0xa1, 0xab, 0x23, 0x48, 0xd0, 0x09, 0x30, 0x98, 0x80, 0x28, 0x98, 0xa3, 0x0f, + 0x80, 0x06, 0x3b, 0xb2, 0x9c, 0x99, 0x32, 0xa0, 0x73, 0xa1, 0x9e, 0x11, 0x01, 0x91, 0x99, 0x19, + 0x98, 0x35, 0xc9, 0x6a, 0x84, 0xaa, 0x18, 0xa9, 0x80, 0x44, 0x89, 0xa0, 0x0b, 0x9d, 0x47, 0xbb, + 0x08, 0x05, 0x89, 0x32, 0xfb, 0x29, 0x01, 0x01, 0x9b, 0x43, 0xfa, 0x49, 0x02, 0xb9, 0x39, 0x81, + 0xa1, 0x40, 0xdc, 0x22, 0x11, 0xea, 0x2a, 0x05, 0xab, 0x01, 0x21, 0x90, 0x9c, 0x53, 0xb9, 0x08, + 0x03, 0x9d, 0x33, 0xe9, 0x19, 0x24, 0xe0, 0x0a, 0x33, 0xc9, 0x20, 0x10, 0xd2, 0x1c, 0x02, 0x98, + 0x08, 0x01, 0x8b, 0x15, 0xc9, 0x2e, 0x85, 0x1b, 0x93, 0x9a, 0x88, 0x43, 0xc9, 0x58, 0xc0, 0x1a, + 0x04, 0x88, 0x80, 0x9a, 0x09, 0x42, 0x90, 0x09, 0xd3, 0x3c, 0xa3, 0x24, 0xcf, 0x31, 0x10, 0xc8, + 0x10, 0x01, 0xa9, 0xba, 0x56, 0x9a, 0x90, 0x48, 0x80, 0xd2, 0x1e, 0x12, 0x81, 0xab, 0x51, 0xd0, + 0x29, 0x01, 0xa3, 0x0d, 0x08, 0xc1, 0x41, 0x08, 0xb3, 0x0e, 0xa2, 0x19, 0x22, 0x84, 0xbe, 0x41, + 0x81, 0xb8, 0x28, 0xbb, 0x64, 0x90, 0x81, 0x8b, 0xb8, 0x58, 0x23, 0xc2, 0xaf, 0x02, 0x40, 0xb1, + 0x8a, 0x80, 0x28, 0x11, 0xaa, 0xa0, 0x0b, 0x75, 0x96, 0xac, 0x30, 0xa0, 0x40, 0xa0, 0x19, 0xa8, + 0x58, 0x93, 0xac, 0x01, 0x39, 0x84, 0x02, 0xdf, 0x21, 0x81, 0x89, 0x20, 0xc8, 0x09, 0x19, 0x15, + 0xab, 0x11, 0x21, 0xec, 0x18, 0x23, 0x98, 0x18, 0xf8, 0x3a, 0x34, 0xc1, 0x9d, 0x41, 0xb3, 0x0c, + 0x81, 0x88, 0x08, 0x23, 0xe9, 0x28, 0x89, 0x06, 0x9a, 0x81, 0xaa, 0x71, 0x85, 0xbc, 0x28, 0x01, + 0x92, 0x50, 0xfa, 0x08, 0x41, 0xa1, 0x9a, 0x29, 0x91, 0x50, 0x90, 0xab, 0x28, 0x24, 0xb9, 0x10, + 0xc8, 0x1d, 0x27, 0xa8, 0xaa, 0x21, 0x38, 0xb1, 0xcb, 0x3c, 0x07, 0x9a, 0x32, 0xda, 0x10, 0x21, + 0xa0, 0x0a, 0xeb, 0x52, 0x93, 0x0c, 0xa0, 0x19, 0x90, 0x40, 0x03, 0xcc, 0x38, 0x92, 0x8b, 0x17, + 0xba, 0x40, 0xc0, 0x49, 0xa1, 0x20, 0xab, 0x13, 0x8d, 0x31, 0xd4, 0x2c, 0x83, 0x9c, 0x13, 0x9a, + 0x04, 0x9d, 0x31, 0xa3, 0x9e, 0x51, 0x82, 0x9c, 0x28, 0x91, 0x12, 0x8a, 0xc0, 0x8d, 0x35, 0xb8, + 0x18, 0x08, 0xfa, 0x51, 0x91, 0xaa, 0x29, 0x13, 0x9a, 0x15, 0xcd, 0x31, 0x00, 0xb9, 0x13, 0x9b, + 0x12, 0x82, 0xa9, 0x8f, 0x17, 0x0a, 0xa0, 0x29, 0xb9, 0x35, 0xb1, 0x1a, 0xb8, 0xaa, 0x75, 0xb3, + 0xab, 0x29, 0x14, 0x99, 0xb9, 0x5a, 0x95, 0x2b, 0x80, 0xb3, 0x1e, 0x98, 0x14, 0x18, 0xb9, 0x8a, + 0x45, 0x99, 0xa0, 0x5b, 0x02, 0x93, 0x9f, 0x11, 0x91, 0x02, 0x9b, 0x87, 0x8d, 0xa0, 0x72, 0xb2, + 0x9b, 0x09, 0x43, 0xc2, 0x3b, 0x83, 0xea, 0x3a, 0x04, 0xa8, 0x4a, 0x82, 0xdb, 0x59, 0x91, 0x19, + 0x20, 0xa8, 0x38, 0xba, 0x82, 0x5a, 0xb5, 0x2d, 0x12, 0xa1, 0x9f, 0x21, 0xa0, 0x08, 0x22, 0x9a, + 0x91, 0x2b, 0x97, 0x1d, 0x83, 0x8c, 0x22, 0x8a, 0x82, 0xc0, 0x5b, 0x04, 0xfa, 0x29, 0x21, 0xb2, + 0x1c, 0x10, 0x81, 0x9c, 0x42, 0x93, 0x9e, 0x0a, 0x17, 0x09, 0xaa, 0x00, 0x41, 0xa0, 0x18, 0xa1, + 0x8d, 0x80, 0x71, 0xb2, 0x0d, 0x08, 0x22, 0x99, 0xa2, 0x0e, 0x03, 0x08, 0x89, 0x20, 0xd0, 0x48, + 0x85, 0xbc, 0x51, 0xb9, 0x52, 0xa9, 0x98, 0x40, 0xb2, 0x2a, 0xa1, 0xea, 0x5a, 0x25, 0xb9, 0x99, + 0x10, 0xab, 0x47, 0x99, 0x88, 0x98, 0x20, 0x8a, 0x17, 0xac, 0x11, 0x01, 0x09, 0x81, 0xac, 0x32, + 0x13, 0xfa, 0x1b, 0x14, 0x99, 0x28, 0x13, 0xcf, 0x00, 0x31, 0x03, 0xdc, 0x18, 0x12, 0x09, 0xa1, + 0x2b, 0xb1, 0x30, 0x40, 0x96, 0xce, 0x28, 0x25, 0xb9, 0x1b, 0x01, 0x08, 0x13, 0x80, 0xad, 0xc0, + 0x7a, 0x94, 0x89, 0x98, 0x28, 0xa2, 0x09, 0x40, 0xe0, 0x08, 0x22, 0x89, 0xa2, 0x0d, 0x23, 0x9a, + 0xab, 0x55, 0xa3, 0x9f, 0x23, 0xc9, 0x2a, 0x14, 0xba, 0x20, 0xa4, 0x8c, 0x00, 0x23, 0xb8, 0x1b, + 0xf1, 0x39, 0x32, 0xc2, 0x09, 0xac, 0x90, 0x65, 0x98, 0x98, 0x08, 0x41, 0xc0, 0x18, 0xa1, 0x1c, + 0x04, 0x21, 0xfb, 0x0d, 0x24, 0xa0, 0x09, 0xa8, 0x52, 0xd8, 0x28, 0x01, 0xaa, 0x11, 0x11, 0xe0, + 0x8c, 0x13, 0x41, 0xd8, 0x09, 0x88, 0x41, 0xb0, 0x40, 0x91, 0xbc, 0x30, 0x05, 0xbc, 0x53, 0xa8, + 0x19, 0x11, 0xf9, 0x38, 0x93, 0x0a, 0x90, 0x29, 0xf1, 0x29, 0x81, 0x51, 0xc1, 0x9b, 0x88, 0x51, + 0x01, 0xa0, 0x88, 0x0c, 0xa3, 0x3c, 0x01, 0xa2, 0x69, 0x92, 0xbf, 0x42, 0xa0, 0x41, 0xa0, 0xc9, + 0x1e, 0x23, 0x02, 0xad, 0x80, 0x28, 0x22, 0xaa, 0xaa, 0x23, 0x18, 0x92, 0x55, 0xfb, 0x2d, 0x03, + 0x18, 0xdb, 0x20, 0x01, 0xb0, 0x2a, 0x15, 0xba, 0x32, 0xb0, 0x9f, 0x05, 0x19, 0x84, 0xaa, 0x0b, + 0x33, 0x90, 0x1a, 0xd0, 0x01, 0x5b, 0xc5, 0x2b, 0x81, 0x12, 0xac, 0x81, 0x88, 0x41, 0x90, 0xd8, + 0x6a, 0x02, 0xb8, 0x10, 0xbd, 0x51, 0x84, 0x0a, 0xb0, 0x1b, 0x20, 0x16, 0x90, 0xbc, 0x2b, 0x17, + 0x89, 0xa3, 0x1e, 0x84, 0x9a, 0x18, 0x80, 0x80, 0x0b, 0x37, 0xdc, 0x31, 0xa8, 0x31, 0xda, 0x08, + 0x41, 0xb2, 0x1b, 0x98, 0x30, 0x88, 0x02, 0x3a, 0xf4, 0x1c, 0x32, 0x90, 0x88, 0xdb, 0x38, 0x93, + 0x8b, 0x35, 0xa8, 0xbc, 0x91, 0x60, 0x22, 0xcc, 0x32, 0xbf, 0x33, 0x80, 0x99, 0xa3, 0x1c, 0x12, + 0x90, 0x31, 0xd9, 0x9a, 0x50, 0x24, 0xed, 0x41, 0x90, 0x89, 0x88, 0x08, 0x81, 0x70, 0xa9, 0x88, + 0x40, 0xb0, 0x1a, 0x94, 0x8d, 0x34, 0xba, 0x28, 0x91, 0x9e, 0x35, 0xb8, 0x8a, 0x11, 0x08, 0x84, + 0x8c, 0x23, 0x0a, 0xfb, 0x52, 0x80, 0xaa, 0x08, 0x32, 0xc9, 0x08, 0x31, 0xc2, 0x8f, 0x14, 0xac, + 0x24, 0xb9, 0x81, 0x9a, 0x73, 0x91, 0x9b, 0x11, 0xa8, 0x19, 0x43, 0xa1, 0x0a, 0xdc, 0x62, 0xa1, + 0x89, 0x80, 0x02, 0xb0, 0x4c, 0xa4, 0x3c, 0xa2, 0x9a, 0x09, 0x21, 0x07, 0x8e, 0x02, 0x89, 0x13, + 0xad, 0x22, 0xb9, 0x2b, 0x35, 0xa1, 0xad, 0x31, 0xa8, 0x90, 0x51, 0xa1, 0x51, 0xba, 0x98, 0x11, + 0x7a, 0xd2, 0x38, 0xba, 0x88, 0x55, 0xa9, 0x89, 0x08, 0x82, 0x31, 0xe9, 0x8b, 0x25, 0x20, 0xf8, + 0x39, 0xa9, 0x11, 0x80, 0x31, 0xf9, 0x3a, 0x13, 0xd9, 0x50, 0xd9, 0x20, 0x01, 0xb8, 0x10, 0x0a, + 0xb4, 0x5b, 0xa2, 0x1b, 0x02, 0x18, 0xa4, 0xbf, 0x52, 0x02, 0x99, 0x8b, 0xc0, 0x49, 0x22, 0x02, + 0xcb, 0xa9, 0x9a, 0x72, 0x87, 0x9b, 0x22, 0xba, 0x09, 0x34, 0xc8, 0x18, 0xa1, 0x03, 0xaf, 0x04, + 0x18, 0xb8, 0x42, 0xca, 0x32, 0xac, 0x35, 0xb9, 0xab, 0x52, 0x12, 0xca, 0x09, 0x11, 0x22, 0xa1, + 0xbf, 0x10, 0x08, 0x62, 0xb1, 0x1c, 0xa1, 0x8a, 0x13, 0x70, 0xda, 0x38, 0x84, 0x9b, 0x89, 0x24, + 0x01, 0xca, 0x0a, 0x15, 0xc9, 0x58, 0xa3, 0x0a, 0xb8, 0x71, 0xc1, 0x8b, 0x31, 0x20, 0xc1, 0x9b, + 0x41, 0xa2, 0x2b, 0x85, 0x9b, 0xaa, 0x55, 0xd9, 0x30, 0x90, 0x21, 0xb0, 0xbf, 0x51, 0x82, 0x98, + 0x2a, 0xb1, 0x29, 0x20, 0x84, 0xde, 0x38, 0x92, 0x43, 0xdb, 0x08, 0x01, 0x10, 0xb1, 0x0c, 0x02, + 0x3a, 0xb1, 0x88, 0x7a, 0xc3, 0x4b, 0xc3, 0x0b, 0x32, 0xa8, 0x48, 0xe1, 0x1b, 0x22, 0xd3, 0x4c, + 0xb1, 0x80, 0x1b, 0x07, 0x8a, 0x82, 0x19, 0x93, 0x9f, 0x30, 0x03, 0x9d, 0x80, 0x49, 0x94, 0x8a, + 0x99, 0x02, 0x99, 0x37, 0x8e, 0x93, 0x9d, 0x42, 0x82, 0xbc, 0x28, 0x12, 0x90, 0x99, 0x21, 0x8a, + 0xb2, 0x71, 0x98, 0xb9, 0x5b, 0x25, 0xb1, 0xaf, 0x30, 0x13, 0x9a, 0x89, 0x99, 0x52, 0x92, 0x8b, + 0xc2, 0x0d, 0x16, 0x88, 0x9a, 0xa8, 0x38, 0x16, 0xb8, 0xb9, 0x48, 0x92, 0x13, 0x8a, 0xf9, 0x3a, + 0x17, 0x0b, 0xb8, 0x30, 0x83, 0x89, 0xac, 0x23, 0x11, 0xbf, 0x54, 0x9a, 0x00, 0x89, 0x21, 0x92, + 0xcf, 0x52, 0x90, 0xa8, 0x28, 0x80, 0xb8, 0x48, 0x82, 0x10, 0xfb, 0x10, 0x10, 0x18, 0x88, 0x11, + 0xb8, 0xef, 0x51, 0x82, 0xba, 0x30, 0x89, 0x12, 0xda, 0x49, 0x82, 0x08, 0x10, 0xe9, 0x99, 0x3a, + 0x17, 0x08, 0xd0, 0x8c, 0x14, 0x80, 0x88, 0xa0, 0x49, 0xa3, 0x1b, 0xc3, 0x1c, 0x13, 0x10, 0xd8, + 0x9c, 0x48, 0x16, 0xaa, 0x18, 0x89, 0x10, 0x30, 0xd0, 0x01, 0xad, 0x44, 0xa0, 0x8c, 0x18, 0x14, + 0x99, 0x81, 0xb8, 0x4a, 0x90, 0x20, 0x01, 0xea, 0x38, 0x91, 0x92, 0xae, 0x71, 0xc4, 0x0c, 0x13, + 0x8a, 0x12, 0xba, 0x69, 0x93, 0xab, 0x10, 0x40, 0xc1, 0x18, 0x88, 0xb8, 0x39, 0x85, 0x29, 0xea, + 0x2b, 0x26, 0x90, 0x9d, 0x00, 0x32, 0xc1, 0x19, 0xd0, 0x19, 0x12, 0x58, 0xa1, 0xae, 0x31, 0x01, + 0x01, 0xcd, 0x30, 0x83, 0x8b, 0xb4, 0x3d, 0x85, 0x0a, 0xb1, 0x0b, 0x31, 0x98, 0x73, 0xe0, 0x19, + 0xa9, 0x25, 0x9a, 0x80, 0x28, 0x90, 0x21, 0xeb, 0x28, 0x24, 0xd8, 0x1a, 0x88, 0x21, 0x01, 0x90, + 0x3a, 0x97, 0x8f, 0x03, 0x88, 0x8b, 0x35, 0xc9, 0x00, 0x9c, 0x83, 0x61, 0xb0, 0xab, 0x44, 0xb8, + 0x1a, 0x24, 0xa9, 0x00, 0xa9, 0x9a, 0x15, 0x0e, 0x04, 0x08, 0xc0, 0x8a, 0x24, 0x18, 0xd0, 0x29, + 0x20, 0xb4, 0x8f, 0x01, 0x13, 0xa9, 0x09, 0x80, 0x99, 0x39, 0xa4, 0x73, 0xe4, 0x0b, 0x12, 0xa8, + 0x19, 0x14, 0x0a, 0xd1, 0x3b, 0xc1, 0x41, 0x88, 0x81, 0x8a, 0xb0, 0x10, 0xdd, 0x76, 0xa0, 0x8a, + 0x00, 0xa1, 0x30, 0xb1, 0x20, 0xdb, 0x31, 0x90, 0x02, 0xbf, 0x42, 0x83, 0xac, 0x80, 0x98, 0x60, + 0x03, 0xba, 0x2a, 0xc9, 0x41, 0x09, 0x03, 0x0b, 0x80, 0xbb, 0x45, 0xc8, 0x9a, 0x55, 0xa3, 0xad, + 0x10, 0x11, 0x80, 0x10, 0xeb, 0x31, 0xb9, 0x1c, 0x27, 0xab, 0x82, 0x19, 0x90, 0x10, 0xc8, 0x78, + 0xa0, 0x01, 0x8a, 0x9a, 0x40, 0x43, 0xa1, 0x8f, 0x83, 0x9e, 0x33, 0x88, 0xc1, 0x29, 0x98, 0x12, + 0x9a, 0xc8, 0x74, 0xc0, 0x19, 0xa2, 0x3b, 0x83, 0x88, 0x10, 0xd0, 0x0c, 0x22, 0x96, 0x9e, 0x22, + 0x80, 0x98, 0x10, 0xab, 0x34, 0xb9, 0x30, 0xb9, 0x92, 0x8f, 0x34, 0x08, 0xd1, 0x8c, 0x81, 0x73, + 0xd1, 0x1a, 0x12, 0xb9, 0x10, 0x10, 0x81, 0x9e, 0x13, 0x8b, 0x27, 0xad, 0x10, 0x13, 0xcb, 0x42, + 0xaa, 0x12, 0x09, 0x91, 0xa8, 0x1c, 0x84, 0x1a, 0x85, 0x8d, 0x82, 0x3b, 0x06, 0xaa, 0x0c, 0x06, + 0x89, 0x90, 0x18, 0xa2, 0x00, 0x0d, 0x25, 0xbb, 0x89, 0x63, 0x01, 0xd9, 0x09, 0x81, 0x40, 0xd1, + 0x4b, 0xa4, 0x0c, 0x92, 0x18, 0x03, 0xab, 0x00, 0x18, 0x21, 0xfb, 0x7a, 0x92, 0x9b, 0x00, 0x25, + 0xac, 0x31, 0x90, 0x8b, 0x82, 0x0b, 0x44, 0x81, 0xbf, 0x52, 0x88, 0x88, 0x80, 0x8b, 0x24, 0xa8, + 0x29, 0xb1, 0x9f, 0x42, 0x01, 0xd8, 0x19, 0x01, 0x08, 0x93, 0x9f, 0x42, 0x90, 0x89, 0x0a, 0x07, + 0x0e, 0x83, 0x0a, 0x08, 0xa1, 0x49, 0xa2, 0x1a, 0x93, 0x8b, 0x29, 0x95, 0x0b, 0x81, 0x51, 0xf0, + 0x18, 0x8a, 0x94, 0x8b, 0x45, 0xa9, 0x01, 0x8c, 0x09, 0x27, 0x99, 0x09, 0x91, 0x9f, 0x14, 0x18, + 0x88, 0xc8, 0x3a, 0x24, 0xe9, 0x28, 0x01, 0xa8, 0x19, 0x18, 0xb0, 0x78, 0xd8, 0x48, 0x93, 0x9c, + 0x00, 0x81, 0x20, 0xb0, 0x38, 0xb0, 0x8b, 0xad, 0x47, 0x81, 0x9f, 0x22, 0x98, 0x88, 0x19, 0x11, + 0x12, 0xb9, 0x9c, 0x10, 0x43, 0x91, 0x0a, 0xfa, 0x28, 0x28, 0x03, 0xa8, 0xce, 0x51, 0xa2, 0x8a, + 0xb9, 0x58, 0x03, 0x39, 0xf3, 0x0f, 0x03, 0x8a, 0x22, 0xba, 0x30, 0xa0, 0x1b, 0x26, 0xcb, 0x38, + 0x25, 0xe9, 0x1a, 0x10, 0x31, 0x90, 0xbb, 0x0b, 0x17, 0xbb, 0x63, 0xb8, 0x18, 0x90, 0x19, 0x23, + 0xdd, 0x09, 0x63, 0xb1, 0x8a, 0x11, 0x90, 0x2a, 0x84, 0x09, 0xaa, 0x90, 0x78, 0x15, 0xa8, 0xae, + 0x42, 0xb9, 0x31, 0x98, 0x01, 0x8a, 0x12, 0x49, 0xf0, 0x8b, 0x72, 0xa1, 0x9a, 0x28, 0x93, 0x2a, + 0x86, 0xae, 0x10, 0x21, 0x01, 0x91, 0xae, 0x28, 0x16, 0x99, 0x8a, 0xa0, 0x69, 0x93, 0x1c, 0x91, + 0x8b, 0x40, 0x84, 0x9b, 0x18, 0x82, 0x20, 0xd8, 0x0c, 0x04, 0x01, 0x9b, 0x19, 0x87, 0x0e, 0x05, + 0x9a, 0x88, 0x02, 0x29, 0xc0, 0x20, 0xbb, 0x52, 0xa0, 0x80, 0x1b, 0xd0, 0x73, 0x98, 0x00, 0xa8, + 0x2a, 0x82, 0x30, 0x9a, 0xc2, 0x48, 0xec, 0x73, 0xc0, 0x39, 0x90, 0x09, 0x12, 0xf8, 0x38, 0xa2, + 0x9a, 0x3b, 0x07, 0x0d, 0x80, 0x22, 0xb9, 0x18, 0x19, 0x24, 0xfa, 0x09, 0x22, 0x88, 0x88, 0x28, + 0xb0, 0x8d, 0x43, 0x22, 0xe8, 0x9c, 0x42, 0x82, 0x8a, 0x10, 0xe9, 0x28, 0x98, 0x85, 0x1b, 0xa2, + 0x09, 0x21, 0xb3, 0xbf, 0x06, 0x9a, 0x02, 0x20, 0xe8, 0x39, 0xd1, 0x28, 0x15, 0xaa, 0x89, 0x83, + 0x3a, 0xa2, 0x06, 0x8f, 0x92, 0x19, 0x13, 0xda, 0x20, 0x02, 0xda, 0x2a, 0x85, 0x0a, 0x31, 0xc1, + 0x8e, 0x01, 0x08, 0x34, 0xc9, 0xbc, 0x43, 0x00, 0xa1, 0x1b, 0x91, 0x38, 0x95, 0x8d, 0x90, 0x80, + 0x79, 0x96, 0x8a, 0x90, 0x10, 0x91, 0x20, 0xa8, 0xa0, 0x4a, 0xe1, 0x58, 0x80, 0x0a, 0x10, 0xf0, + 0x2a, 0x84, 0x18, 0xb8, 0x08, 0x99, 0x35, 0xad, 0x23, 0x80, 0xdb, 0x49, 0x81, 0x20, 0xd8, 0x30, + 0x88, 0xa8, 0x60, 0xa1, 0xbb, 0x59, 0x16, 0xc8, 0x2a, 0xa0, 0x49, 0x13, 0xca, 0x18, 0xc0, 0x3a, + 0x23, 0x95, 0xaf, 0x12, 0x18, 0xc1, 0x1b, 0x12, 0x23, 0xcb, 0xa1, 0x2d, 0x93, 0x40, 0xa2, 0xbe, + 0x30, 0x84, 0x29, 0xc3, 0x8e, 0x11, 0x12, 0xca, 0x41, 0xfa, 0x48, 0x01, 0x98, 0x0c, 0x91, 0x30, + 0x80, 0x82, 0x8e, 0x03, 0xaa, 0x21, 0x19, 0x94, 0x0b, 0xe8, 0x30, 0x81, 0x99, 0x62, 0xc0, 0x0c, + 0x82, 0x38, 0xe8, 0x41, 0x99, 0x12, 0xad, 0x22, 0x81, 0xd9, 0x78, 0xa1, 0x8a, 0x10, 0xa3, 0x09, + 0xa0, 0x79, 0xb1, 0x1a, 0xba, 0x47, 0x98, 0x88, 0x19, 0xc8, 0x4a, 0x14, 0xc8, 0x1a, 0xa1, 0x68, + 0xb3, 0x0b, 0x90, 0x48, 0xa8, 0x22, 0xd9, 0x2b, 0x16, 0xa8, 0x80, 0xda, 0x61, 0x92, 0x9b, 0x88, + 0x63, 0xb8, 0x00, 0x88, 0x9a, 0x36, 0xca, 0x20, 0xc1, 0x8b, 0x73, 0x92, 0x8c, 0x90, 0x28, 0x20, + 0xa0, 0x89, 0x80, 0x99, 0x50, 0x24, 0xfa, 0x3a, 0x81, 0x80, 0x09, 0x9a, 0x47, 0xc9, 0x89, 0x22, + 0xb1, 0x8a, 0x31, 0xb2, 0x1d, 0x96, 0x2b, 0xc3, 0x29, 0x9a, 0x26, 0xb8, 0x2b, 0x07, 0xac, 0x21, + 0x90, 0x00, 0x10, 0xc9, 0x2b, 0x15, 0x99, 0x24, 0xdd, 0x29, 0x23, 0xaa, 0x10, 0xab, 0x72, 0xa2, + 0x8a, 0x89, 0x28, 0x82, 0x37, 0xf9, 0x0a, 0x02, 0x20, 0xa1, 0x0c, 0x00, 0x31, 0xd1, 0x8d, 0x13, + 0x8a, 0x25, 0xad, 0x81, 0x19, 0x13, 0x8a, 0xc2, 0x9f, 0x25, 0xb1, 0x1b, 0x80, 0x20, 0x91, 0x8a, + 0x90, 0x62, 0xea, 0x30, 0x14, 0xfb, 0x39, 0x83, 0x9b, 0x32, 0xa2, 0x8e, 0x81, 0x80, 0x19, 0x84, + 0x8c, 0x03, 0xba, 0x01, 0x78, 0xc1, 0x3a, 0xb2, 0x8c, 0x24, 0xd9, 0x58, 0xb3, 0x1c, 0x91, 0x18, + 0x89, 0x33, 0xe9, 0x29, 0x84, 0x89, 0x10, 0xc9, 0x80, 0x5b, 0x07, 0xaa, 0x10, 0x0a, 0x82, 0x32, + 0xdb, 0x08, 0x8c, 0x25, 0xb0, 0x9a, 0x21, 0xa1, 0x39, 0xf3, 0x0d, 0x16, 0xb9, 0x39, 0x85, 0x9c, + 0x18, 0x42, 0xc9, 0x29, 0x04, 0xba, 0x20, 0x98, 0x22, 0x21, 0xfb, 0x3b, 0x86, 0xab, 0x24, 0xa8, + 0x09, 0x81, 0x99, 0x11, 0x91, 0x63, 0xa1, 0xef, 0x30, 0x12, 0xaa, 0x89, 0x80, 0x20, 0x92, 0x08, + 0xc9, 0x4a, 0x86, 0x18, 0xc0, 0x1b, 0x00, 0x43, 0xd9, 0x31, 0xcc, 0x73, 0xa8, 0x8a, 0x22, 0xb9, + 0x42, 0x09, 0xb1, 0x0c, 0x30, 0x03, 0xb8, 0xcf, 0x51, 0xa2, 0x09, 0x80, 0xa8, 0x19, 0x38, 0x17, + 0x9b, 0xca, 0x60, 0x01, 0xa9, 0x1a, 0xa3, 0x1c, 0x45, 0xc0, 0x0c, 0x83, 0x09, 0x22, 0xa8, 0x8f, + 0x32, 0xa9, 0x28, 0x84, 0x9d, 0x21, 0x20, 0xc0, 0x9d, 0x23, 0x11, 0xc1, 0x8e, 0x81, 0x48, 0x92, + 0x2a, 0xc1, 0x9c, 0x33, 0x98, 0x21, 0xec, 0x20, 0x33, 0xda, 0x1b, 0x84, 0x8a, 0x25, 0xa9, 0x0a, + 0x08, 0x38, 0x37, 0xe9, 0x8b, 0x23, 0x80, 0x99, 0x31, 0xc8, 0x3a, 0xb3, 0x9d, 0x22, 0x88, 0x45, + 0xc9, 0xbd, 0x52, 0x80, 0x08, 0x00, 0xd9, 0x59, 0xa2, 0x29, 0x80, 0x98, 0x0a, 0x37, 0xdb, 0x18, + 0x10, 0x81, 0x10, 0xdb, 0x41, 0x92, 0xcb, 0x60, 0xa2, 0x9b, 0x22, 0xa0, 0xac, 0x35, 0xc8, 0x18, + 0x98, 0x98, 0x31, 0xd2, 0x3b, 0x05, 0xca, 0x59, 0xa3, 0x1e, 0x83, 0x99, 0x18, 0x23, 0xdd, 0x51, + 0x90, 0x8a, 0x30, 0xa8, 0x28, 0xb8, 0x32, 0x8a, 0xc4, 0x1e, 0x05, 0xab, 0x31, 0x00, 0xaa, 0xa0, + 0x3a, 0x84, 0x01, 0x9c, 0x21, 0xd1, 0x2d, 0x16, 0xc9, 0x2b, 0x05, 0x09, 0xa8, 0x58, 0xb1, 0x28, + 0xaa, 0x01, 0x53, 0xeb, 0x52, 0xb9, 0x10, 0x18, 0x91, 0xab, 0x10, 0x11, 0x32, 0xde, 0x30, 0x82, + 0xbd, 0x61, 0xa2, 0x0c, 0x23, 0xda, 0x2a, 0x85, 0x99, 0x20, 0xd2, 0x8c, 0x34, 0x91, 0x9c, 0x22, + 0x9c, 0x24, 0xb9, 0x09, 0x31, 0xd0, 0x40, 0x99, 0xb8, 0x5b, 0x14, 0x08, 0xca, 0x1b, 0x25, 0x91, + 0x8f, 0x02, 0x09, 0xa1, 0x30, 0xd9, 0x29, 0x83, 0x18, 0x98, 0xf9, 0x49, 0x04, 0xa8, 0x0b, 0x13, + 0xac, 0x53, 0xa8, 0x19, 0xa8, 0x59, 0x14, 0xcb, 0x28, 0x91, 0x98, 0x4b, 0x07, 0x8e, 0x11, 0x00, + 0x9a, 0x10, 0x01, 0x98, 0x0b, 0xb1, 0x72, 0xd5, 0x2a, 0x92, 0x0a, 0x12, 0x98, 0xbb, 0x65, 0xb8, + 0x1b, 0x17, 0xbb, 0x30, 0x82, 0x8a, 0x98, 0x00, 0x61, 0xa1, 0xae, 0x41, 0x83, 0xbb, 0x00, 0x21, + 0xa8, 0x71, 0xa0, 0x9a, 0x99, 0x72, 0x82, 0xc9, 0x0d, 0x15, 0x09, 0xa9, 0x20, 0x98, 0x41, 0xb8, + 0x8b, 0x10, 0x99, 0x67, 0xc9, 0x18, 0x88, 0x32, 0x99, 0xa8, 0x0a, 0x22, 0x05, 0x8b, 0xc0, 0x1d, + 0x27, 0xa8, 0x9a, 0x81, 0x1a, 0x26, 0xa0, 0xaa, 0x28, 0xd0, 0x49, 0x03, 0xda, 0x3a, 0x85, 0x8a, + 0x81, 0x8a, 0x21, 0x21, 0xf8, 0x19, 0x90, 0x38, 0x80, 0x25, 0xad, 0x23, 0xac, 0x33, 0xf1, 0x2b, + 0x04, 0x9a, 0x81, 0x08, 0xa1, 0x6a, 0x86, 0xaa, 0x88, 0xb8, 0x70, 0x83, 0x9a, 0x0a, 0x03, 0xbf, + 0x44, 0xa0, 0x99, 0x29, 0x03, 0x98, 0x89, 0x88, 0x37, 0xda, 0x00, 0x98, 0x3a, 0x05, 0x08, 0xa9, + 0xba, 0x54, 0x03, 0x9d, 0x98, 0x41, 0x00, 0x9a, 0xb0, 0x9f, 0x45, 0xa0, 0x9a, 0x11, 0xb9, 0x38, + 0x27, 0xc9, 0x19, 0x92, 0x09, 0x82, 0xaa, 0x69, 0x84, 0x0a, 0xb9, 0x61, 0xca, 0x41, 0x80, 0x88, + 0x18, 0xd8, 0x58, 0xb8, 0x52, 0xb9, 0xa0, 0x39, 0x86, 0x8c, 0x22, 0x91, 0x9e, 0x12, 0x0a, 0x12, + 0x90, 0x8b, 0x35, 0xec, 0x28, 0x12, 0x91, 0x8c, 0x12, 0xaa, 0x48, 0x82, 0xbb, 0x40, 0x90, 0x21, + 0x9e, 0x93, 0x1c, 0x03, 0x02, 0xaf, 0x22, 0x08, 0x90, 0x1c, 0x17, 0x9d, 0x81, 0x10, 0x8a, 0x35, + 0xb9, 0x09, 0x21, 0xf0, 0x4b, 0x82, 0xa8, 0x2a, 0x05, 0xbb, 0x41, 0xc8, 0x30, 0x01, 0xbe, 0x63, + 0xba, 0x43, 0xa8, 0xb8, 0x6a, 0x91, 0x80, 0x89, 0x00, 0x61, 0xb0, 0x8a, 0x13, 0xac, 0x52, 0x83, + 0x9c, 0xda, 0x51, 0x92, 0x0a, 0xa1, 0x1d, 0x05, 0x0b, 0x91, 0x89, 0x09, 0x16, 0x90, 0xcb, 0x38, + 0x82, 0x52, 0xfa, 0x18, 0x10, 0x91, 0x08, 0x90, 0x19, 0x28, 0x07, 0xac, 0x81, 0x29, 0x02, 0x53, + 0xfc, 0x28, 0x88, 0x11, 0x80, 0x9c, 0x43, 0xc9, 0x29, 0x93, 0x19, 0xa9, 0x52, 0xda, 0x49, 0x84, + 0x9c, 0x02, 0x0a, 0x05, 0xb9, 0x19, 0x11, 0x23, 0xbb, 0x22, 0xf8, 0x1c, 0x24, 0x98, 0xa0, 0x0f, + 0x13, 0x80, 0xac, 0x31, 0x81, 0x89, 0x11, 0xcc, 0x0a, 0x55, 0x90, 0xab, 0x02, 0x9c, 0x37, 0xc9, + 0x10, 0x0a, 0x11, 0x02, 0x9b, 0xe8, 0x69, 0x92, 0x89, 0x81, 0x8c, 0x32, 0x91, 0x8c, 0x83, 0x9f, + 0x33, 0x81, 0xbc, 0x61, 0xa0, 0x09, 0x11, 0xeb, 0x21, 0x11, 0xa0, 0x99, 0x08, 0x22, 0x8a, 0xf3, + 0x7a, 0xc1, 0x18, 0x80, 0x12, 0xc9, 0x0a, 0x25, 0xc9, 0x01, 0x0c, 0x16, 0xbb, 0x22, 0x00, 0xb0, + 0x0e, 0x22, 0x91, 0x19, 0xe9, 0x29, 0x14, 0x9b, 0x13, 0xa9, 0xaa, 0x41, 0x94, 0x8c, 0x02, 0x1a, + 0x27, 0xdb, 0x08, 0x80, 0x52, 0x90, 0xc8, 0x0c, 0x24, 0xa8, 0x11, 0xa9, 0x9b, 0x36, 0xa9, 0x08, + 0x0b, 0x05, 0x48, 0xf3, 0x0c, 0x81, 0x31, 0x81, 0xba, 0x8c, 0x92, 0x73, 0xd0, 0x29, 0x91, 0x28, + 0x89, 0xa2, 0x2a, 0xa0, 0x46, 0xca, 0x10, 0xbb, 0x67, 0xa9, 0x88, 0x08, 0x00, 0x04, 0x9d, 0x12, + 0x89, 0x18, 0x02, 0xca, 0x18, 0x28, 0x14, 0xda, 0x28, 0xca, 0x54, 0xa8, 0x08, 0x08, 0xa8, 0x31, + 0x89, 0xb1, 0x38, 0x02, 0xc9, 0x91, 0x8e, 0x73, 0xa3, 0x8f, 0x03, 0x9c, 0x04, 0x89, 0x01, 0x91, + 0x0e, 0x84, 0x0b, 0x94, 0x2c, 0x02, 0xa9, 0x0b, 0x25, 0x8a, 0x80, 0x1a, 0x04, 0xa8, 0x8b, 0x53, + 0xb8, 0x3a, 0x85, 0xac, 0x89, 0x34, 0x28, 0xe2, 0x9a, 0x70, 0x91, 0xbc, 0x42, 0x80, 0xa8, 0x2a, + 0x02, 0xb9, 0x3a, 0x27, 0x9c, 0x11, 0x18, 0x80, 0xa0, 0x0b, 0x74, 0x90, 0xb1, 0x9f, 0x12, 0x08, + 0x83, 0x68, 0xfa, 0x28, 0x92, 0x89, 0x00, 0x92, 0x1a, 0xc1, 0x3a, 0xa8, 0x41, 0x24, 0xfc, 0x39, + 0x91, 0x18, 0x32, 0xb0, 0xaf, 0x52, 0xa8, 0x11, 0xab, 0x52, 0x90, 0x99, 0x31, 0xec, 0x41, 0xa9, + 0x33, 0xc9, 0x8c, 0x23, 0x91, 0x0c, 0x82, 0x80, 0xae, 0x34, 0x10, 0xfa, 0x20, 0x89, 0x24, 0xdc, + 0x30, 0x81, 0x88, 0x88, 0x19, 0x94, 0x8e, 0x14, 0x9a, 0x02, 0x9b, 0x24, 0xb9, 0x29, 0xb1, 0x71, + 0xc0, 0x29, 0x92, 0x9d, 0x42, 0x80, 0x89, 0xa8, 0x39, 0x85, 0x1a, 0xc2, 0x8b, 0x42, 0xa0, 0x88, + 0x50, 0xd8, 0x80, 0x4b, 0x86, 0xba, 0x51, 0xa1, 0x8b, 0x20, 0x93, 0x09, 0xb9, 0x49, 0xb2, 0x19, + 0x5a, 0x07, 0xd9, 0x2b, 0x03, 0x18, 0xb1, 0x3c, 0x07, 0xad, 0x48, 0x83, 0x8b, 0x09, 0x41, 0xc8, + 0x29, 0xa0, 0x41, 0xc8, 0x18, 0x81, 0x01, 0xeb, 0x5a, 0x04, 0x9c, 0x81, 0x20, 0xd1, 0x38, 0x82, + 0x9e, 0x02, 0x38, 0x91, 0xfa, 0x49, 0x02, 0x91, 0xcb, 0x29, 0x84, 0x29, 0xb3, 0x1c, 0x95, 0x8c, + 0x14, 0xab, 0x00, 0x09, 0x17, 0xba, 0x10, 0xba, 0x55, 0xa0, 0x9b, 0x25, 0xac, 0x13, 0x08, 0x18, + 0xc0, 0x1a, 0x21, 0xb8, 0x20, 0x51, 0xd8, 0x11, 0x9b, 0x12, 0x09, 0xb2, 0x6a, 0xd2, 0x9d, 0x23, + 0x08, 0xa8, 0x29, 0x21, 0xf0, 0x4d, 0x85, 0x9c, 0x21, 0x08, 0x81, 0xbb, 0x48, 0x84, 0x8a, 0x91, + 0x49, 0xd3, 0x0d, 0x15, 0x88, 0xa9, 0x00, 0x32, 0xf9, 0x0a, 0x13, 0x01, 0xc9, 0x29, 0x09, 0x88, + 0x24, 0xab, 0x63, 0xca, 0x8a, 0x43, 0xb2, 0x0e, 0x04, 0x8a, 0x10, 0xa9, 0x41, 0x80, 0x8a, 0x87, + 0x8c, 0x82, 0x31, 0xa9, 0x01, 0xf9, 0x2b, 0x07, 0x8b, 0x03, 0x9a, 0x11, 0xa8, 0x00, 0x9d, 0x63, + 0xa2, 0x9b, 0x09, 0x82, 0x48, 0x92, 0xac, 0x12, 0x40, 0xdb, 0x24, 0xac, 0x22, 0x09, 0x85, 0xab, + 0x9a, 0x47, 0xa0, 0xaa, 0x42, 0xb0, 0x09, 0x99, 0x23, 0x30, 0x84, 0xff, 0x20, 0x80, 0x8a, 0x27, + 0xca, 0x10, 0x09, 0x01, 0x09, 0x00, 0x98, 0x01, 0x9c, 0x30, 0x96, 0x2a, 0x02, 0xdc, 0x18, 0x01, + 0x21, 0x91, 0x9a, 0x91, 0xaf, 0x17, 0x9b, 0x13, 0x8a, 0x02, 0x00, 0xbc, 0x33, 0x0d, 0x85, 0x4a, + 0xd1, 0x0c, 0x21, 0x12, 0xba, 0x82, 0x2c, 0xf3, 0x3b, 0x85, 0x8a, 0x19, 0x04, 0x8c, 0x93, 0x1e, + 0x93, 0x49, 0xc1, 0x88, 0x18, 0xa0, 0x61, 0xa0, 0x18, 0xc8, 0x19, 0x03, 0x88, 0x19, 0x82, 0x81, + 0xbf, 0x13, 0xad, 0x65, 0xa8, 0x00, 0xab, 0x18, 0x62, 0x82, 0x9c, 0xa0, 0x49, 0x91, 0x32, 0xcc, + 0x81, 0x58, 0xb3, 0x8d, 0xa2, 0x48, 0x91, 0x82, 0x8c, 0xb1, 0x61, 0x90, 0x8a, 0x28, 0x81, 0x29, + 0xf3, 0x2c, 0xa2, 0x50, 0xc8, 0x30, 0xaa, 0x80, 0x42, 0xb0, 0x2b, 0x02, 0xc9, 0x2e, 0x17, 0x9b, + 0x03, 0xdb, 0x30, 0x91, 0x01, 0x88, 0xd0, 0x3b, 0x07, 0xaa, 0x88, 0x22, 0x90, 0x19, 0xb2, 0xaa, + 0x79, 0x03, 0x01, 0x9e, 0xc0, 0x70, 0x91, 0x98, 0x89, 0x83, 0x1d, 0x85, 0x8c, 0x11, 0x88, 0x29, + 0xb3, 0x2c, 0xc4, 0x4c, 0x84, 0x8c, 0x82, 0x8a, 0x33, 0xd9, 0x18, 0x98, 0x42, 0x98, 0x02, 0xcc, + 0x19, 0x23, 0x29, 0x84, 0xde, 0x30, 0x90, 0x30, 0xa8, 0x9c, 0x23, 0xaa, 0x36, 0xb8, 0x0b, 0x84, + 0x8b, 0x41, 0xa9, 0x81, 0x2b, 0x95, 0xaa, 0x2b, 0x96, 0x60, 0xa2, 0x9a, 0x8c, 0x32, 0x12, 0x88, + 0xca, 0xce, 0x72, 0xa2, 0x89, 0x88, 0x89, 0x53, 0xa8, 0x91, 0x0e, 0x13, 0x80, 0x9a, 0xc0, 0x29, + 0x33, 0x84, 0xad, 0x10, 0x98, 0x52, 0xc0, 0x1a, 0x13, 0xa9, 0x12, 0xcf, 0x14, 0x88, 0x90, 0x2a, + 0xe2, 0x3a, 0x81, 0x22, 0x28, 0xf9, 0x59, 0xd8, 0x28, 0x82, 0x1a, 0xa4, 0x8b, 0x13, 0xcc, 0x25, + 0x9b, 0x14, 0x9a, 0x90, 0x1c, 0x05, 0x0b, 0x33, 0xfa, 0x09, 0x21, 0x98, 0x32, 0xcc, 0x31, 0xc8, + 0x38, 0x92, 0x9a, 0x20, 0x92, 0x8d, 0x01, 0x11, 0x02, 0xcf, 0x06, 0x0a, 0x12, 0x9d, 0x03, 0x8b, + 0x22, 0x89, 0x12, 0xcc, 0x49, 0x94, 0x0e, 0x14, 0xab, 0x30, 0xb8, 0x28, 0x91, 0x49, 0xa5, 0x8e, + 0x82, 0x0a, 0x26, 0xba, 0x20, 0xa9, 0x11, 0xa2, 0x6b, 0xc3, 0xaa, 0x73, 0xb0, 0x89, 0x09, 0x25, + 0xaa, 0x11, 0xca, 0x49, 0x15, 0xcb, 0x48, 0xa0, 0x19, 0x23, 0xba, 0xb9, 0x7b, 0x84, 0x0a, 0xa8, + 0x29, 0x00, 0x05, 0x8e, 0x93, 0x1c, 0x06, 0x9a, 0x81, 0x99, 0x33, 0xa1, 0x89, 0xda, 0x72, 0x98, + 0x08, 0x80, 0xab, 0x50, 0x04, 0xbb, 0x31, 0xb3, 0xbf, 0x35, 0xab, 0x00, 0x22, 0xa9, 0x08, 0xa0, + 0x3b, 0x37, 0xbb, 0x19, 0x22, 0xf0, 0x48, 0xa1, 0x99, 0x28, 0xd1, 0x59, 0xb2, 0x1c, 0x83, 0xaa, + 0x62, 0x93, 0x8c, 0xa9, 0x52, 0xab, 0x25, 0xa9, 0x8a, 0x20, 0x01, 0x14, 0xae, 0x21, 0xa9, 0x13, + 0xaa, 0x60, 0x95, 0x9f, 0x33, 0xab, 0x00, 0x9b, 0x37, 0xb0, 0x8d, 0x03, 0x10, 0xb0, 0x1a, 0x81, + 0x89, 0x24, 0xad, 0x43, 0xda, 0x50, 0x90, 0x80, 0x8a, 0x8a, 0x45, 0x90, 0x9b, 0x80, 0x18, 0x03, + 0x8f, 0x85, 0x9c, 0x34, 0xca, 0x30, 0xb0, 0x29, 0x15, 0xbb, 0x00, 0x1a, 0x87, 0x1b, 0x93, 0x99, + 0x3a, 0xd3, 0x48, 0xb0, 0x18, 0x92, 0xaa, 0x20, 0x81, 0x53, 0xfa, 0x29, 0x82, 0xc9, 0x10, 0x23, + 0x98, 0xed, 0x50, 0xa1, 0x1a, 0x12, 0x01, 0xdc, 0x09, 0x43, 0x01, 0xb9, 0xbb, 0x79, 0x03, 0x1b, + 0x82, 0x9e, 0x22, 0xbb, 0x72, 0x93, 0x9f, 0x31, 0x90, 0x9a, 0x10, 0x21, 0xbb, 0x36, 0xfc, 0x38, + 0x81, 0x10, 0xb8, 0x80, 0x0b, 0x25, 0xb0, 0x1a, 0xa3, 0x0e, 0x16, 0xaa, 0x88, 0x80, 0x40, 0x01, + 0x90, 0xcd, 0x60, 0xa1, 0x28, 0x99, 0x81, 0x2b, 0xa2, 0x09, 0x42, 0xcb, 0x31, 0x96, 0x9e, 0x88, + 0x45, 0xc8, 0x29, 0x91, 0x0a, 0x12, 0xab, 0x35, 0xca, 0x18, 0xa1, 0x52, 0xb9, 0x3a, 0x85, 0x0b, + 0xd1, 0x4a, 0x93, 0x8c, 0x14, 0xaa, 0x20, 0xa1, 0x8b, 0x73, 0x90, 0xb9, 0x2a, 0x43, 0xf9, 0x60, + 0xb0, 0x2a, 0x81, 0xa9, 0x62, 0xd0, 0x28, 0x90, 0x28, 0x90, 0x99, 0x10, 0x8c, 0x27, 0xca, 0x10, + 0x80, 0x11, 0x80, 0xbb, 0x03, 0x9b, 0x63, 0x98, 0xd0, 0x1c, 0x37, 0xf1, 0x2a, 0x80, 0x18, 0x82, + 0x89, 0x99, 0xa1, 0x69, 0x94, 0x19, 0xdc, 0x48, 0x01, 0x88, 0x89, 0x80, 0x02, 0x80, 0x98, 0x8b, + 0x06, 0x09, 0xb9, 0x53, 0xea, 0x20, 0x82, 0x81, 0xba, 0x38, 0x13, 0x1a, 0x97, 0xaf, 0x32, 0x90, + 0x28, 0xe8, 0x39, 0x90, 0x10, 0x20, 0xc2, 0x8f, 0x00, 0x13, 0x8b, 0x24, 0xcc, 0x88, 0x60, 0x93, + 0xac, 0x21, 0xa0, 0x69, 0xa3, 0xab, 0x20, 0x13, 0xda, 0x11, 0xbe, 0x40, 0x33, 0xb0, 0xab, 0xac, + 0x43, 0x32, 0xb5, 0x8f, 0x82, 0x2a, 0x84, 0xbb, 0x18, 0x33, 0x00, 0xb0, 0x9e, 0x80, 0x74, 0xb1, + 0x0b, 0x80, 0x99, 0x64, 0xb1, 0x8b, 0x08, 0x10, 0x13, 0xa9, 0x00, 0xbf, 0x73, 0xc1, 0x28, 0xb8, + 0x30, 0xc8, 0x40, 0x90, 0x08, 0x89, 0x81, 0x0c, 0x14, 0x32, 0xcf, 0x31, 0xb8, 0x02, 0x29, 0xd2, + 0x48, 0xc0, 0x0b, 0x23, 0x81, 0x2c, 0x92, 0xda, 0x1b, 0x27, 0xba, 0x43, 0xea, 0x18, 0x12, 0xb9, + 0x30, 0xd8, 0x30, 0x03, 0xc0, 0x0e, 0x12, 0x0a, 0x23, 0xd8, 0x8b, 0x02, 0x20, 0x20, 0xe8, 0x08, + 0x40, 0x91, 0xcc, 0x10, 0x11, 0x81, 0x82, 0xaf, 0x38, 0x93, 0x32, 0xec, 0x1a, 0x13, 0x80, 0x01, + 0xac, 0x84, 0x1e, 0x05, 0xa8, 0x8d, 0x33, 0x98, 0x91, 0x0c, 0x04, 0xba, 0x59, 0x13, 0xd9, 0x88, + 0x39, 0xe3, 0x39, 0x82, 0x89, 0x20, 0xed, 0x58, 0x92, 0x89, 0x01, 0xca, 0x30, 0x02, 0x99, 0x8b, + 0x27, 0xac, 0x32, 0xb8, 0x09, 0x01, 0x89, 0x25, 0xbc, 0x21, 0x12, 0xd1, 0x1d, 0x21, 0xa1, 0x2a, + 0x93, 0xce, 0x38, 0x93, 0x49, 0xf3, 0x1c, 0x11, 0x81, 0x01, 0xae, 0x22, 0xa9, 0x71, 0xb0, 0x1b, + 0x23, 0xa9, 0x00, 0xaa, 0x26, 0xb9, 0x00, 0x11, 0xa2, 0x9f, 0x34, 0xd0, 0x8c, 0x33, 0x19, 0xa1, + 0xbc, 0x59, 0x85, 0x0a, 0xb1, 0x29, 0x91, 0x20, 0xb3, 0x3a, 0xfc, 0x00, 0x59, 0x95, 0x8c, 0x11, + 0xa0, 0x39, 0xb4, 0x2c, 0xa2, 0x2a, 0x80, 0x02, 0x89, 0x90, 0x19, 0x84, 0x3a, 0xfb, 0x6c, 0x02, + 0xbb, 0x30, 0x22, 0xf9, 0x2b, 0x23, 0xeb, 0x40, 0x81, 0x01, 0xea, 0x0a, 0x41, 0x05, 0xbb, 0x10, + 0xb8, 0x3b, 0x37, 0xaa, 0x88, 0x29, 0xb1, 0x50, 0xd0, 0x39, 0xa0, 0x32, 0x88, 0xfb, 0x48, 0x91, + 0x11, 0xcb, 0x20, 0x91, 0x41, 0xca, 0x22, 0xa8, 0x9a, 0x61, 0xc2, 0x9e, 0x41, 0x85, 0xab, 0x11, + 0xba, 0x61, 0x91, 0x21, 0xfb, 0x10, 0x98, 0x32, 0xb0, 0x89, 0x00, 0xa8, 0x51, 0xc2, 0x8d, 0x21, + 0x10, 0x82, 0xa9, 0xae, 0x51, 0xa1, 0x62, 0xc8, 0x9a, 0x40, 0xa3, 0x2a, 0x82, 0xdb, 0x30, 0xa2, + 0x0d, 0x03, 0x1b, 0x15, 0xa9, 0xac, 0x19, 0x35, 0xb9, 0x44, 0xfb, 0x29, 0x82, 0x11, 0xa9, 0x8a, + 0x21, 0x22, 0x81, 0xbf, 0x21, 0x90, 0x59, 0x05, 0xbd, 0x28, 0x10, 0x11, 0x09, 0xc9, 0x10, 0x9a, + 0x73, 0xb3, 0x9c, 0x33, 0xaa, 0xc8, 0x6b, 0xa3, 0x1c, 0x14, 0xaa, 0x99, 0x38, 0x04, 0x60, 0xd0, + 0x9b, 0x33, 0x81, 0x9c, 0x13, 0xac, 0x35, 0xb9, 0x28, 0xeb, 0x30, 0x15, 0x9a, 0x00, 0xd8, 0x0b, + 0x35, 0xb0, 0x0c, 0x12, 0xb9, 0x60, 0xa0, 0x88, 0x98, 0x53, 0xab, 0x27, 0xbb, 0x1b, 0x35, 0xa8, + 0x8a, 0x00, 0x89, 0x42, 0xd0, 0x39, 0xc1, 0x21, 0x88, 0xa2, 0x9f, 0x02, 0x21, 0x80, 0x82, 0xff, + 0x30, 0x82, 0x98, 0x99, 0x81, 0x19, 0x25, 0xf8, 0x28, 0x98, 0x1a, 0x36, 0xc8, 0x8b, 0x08, 0x51, + 0x81, 0xb9, 0x1a, 0x81, 0x38, 0x21, 0xb1, 0x0b, 0xf9, 0x3a, 0x44, 0xd0, 0x2a, 0x84, 0x9a, 0x99, + 0x21, 0x2a, 0x07, 0xab, 0x21, 0x89, 0xa5, 0x2e, 0x83, 0x8a, 0x0a, 0x06, 0x8b, 0x81, 0x88, 0x39, + 0x94, 0x8a, 0x01, 0xc9, 0xcc, 0x74, 0x81, 0x99, 0x8a, 0xa8, 0x71, 0x91, 0x09, 0x98, 0x01, 0x18, + 0x23, 0xfc, 0x4a, 0x84, 0x0b, 0x11, 0xd8, 0x1c, 0x15, 0x99, 0x90, 0x2a, 0x83, 0x9a, 0x10, 0x08, + 0xa0, 0x11, 0x0b, 0xd9, 0x13, 0x4d, 0x16, 0xa9, 0xcb, 0x5b, 0x87, 0x88, 0x08, 0xa0, 0x8a, 0x53, + 0x90, 0x89, 0x00, 0xad, 0x44, 0xb0, 0x08, 0x9a, 0x32, 0x92, 0x8c, 0x81, 0x0b, 0xd3, 0x1c, 0x37, + 0xb0, 0x9c, 0x18, 0x15, 0x9a, 0x12, 0xcb, 0x21, 0x8a, 0x52, 0xa1, 0xae, 0x40, 0x84, 0x9a, 0xa0, + 0x20, 0x42, 0x84, 0xbe, 0x0b, 0x16, 0x01, 0x9a, 0xb9, 0x19, 0x44, 0xa3, 0x8c, 0xc9, 0x48, 0x15, + 0xa8, 0xba, 0x19, 0x46, 0xb8, 0x89, 0x89, 0x42, 0x91, 0x2a, 0xc0, 0x0b, 0x10, 0x17, 0x99, 0x99, + 0x39, 0x94, 0x19, 0xfa, 0x48, 0x01, 0x80, 0xcb, 0x5a, 0x04, 0x99, 0x99, 0x12, 0xda, 0x70, 0x91, + 0x8a, 0x80, 0x10, 0x00, 0x88, 0xd8, 0x5a, 0x05, 0xcb, 0x30, 0xa1, 0x18, 0x98, 0x89, 0x21, 0x44, + 0xfa, 0x18, 0x89, 0x22, 0x12, 0xbc, 0x98, 0x99, 0x64, 0x01, 0xb8, 0x9f, 0x23, 0x01, 0xe8, 0x1a, + 0x23, 0x82, 0xac, 0xaa, 0x73, 0xa0, 0x00, 0x18, 0xd9, 0x40, 0x91, 0x81, 0xbc, 0x41, 0x10, 0x93, + 0xaf, 0x18, 0x34, 0x98, 0xca, 0x19, 0x20, 0x84, 0x9a, 0x02, 0x9a, 0x12, 0x28, 0xfa, 0x39, 0x00, + 0x24, 0xda, 0xad, 0x51, 0x33, 0xea, 0x0a, 0x01, 0x41, 0xb0, 0x9c, 0x31, 0x93, 0x5a, 0xd0, 0x09, + 0x89, 0x63, 0xa8, 0x01, 0x9a, 0x98, 0x60, 0x91, 0x8a, 0x3a, 0x87, 0x8a, 0xc9, 0x48, 0x23, 0xc1, + 0xad, 0x21, 0x00, 0x91, 0x51, 0xda, 0x18, 0x18, 0x22, 0xd8, 0x0a, 0x11, 0x14, 0xea, 0x29, 0x11, + 0x90, 0x10, 0xda, 0x40, 0xa0, 0x20, 0x81, 0xfb, 0x59, 0x93, 0x8b, 0x91, 0x1a, 0x41, 0x95, 0x8e, + 0x98, 0x31, 0x80, 0x01, 0xcc, 0x32, 0x98, 0x80, 0x21, 0xec, 0x41, 0x00, 0x80, 0x9c, 0x23, 0x1a, + 0xc4, 0x0c, 0x01, 0x41, 0xb9, 0x00, 0x0c, 0x00, 0x34, 0xe8, 0x8d, 0x32, 0x01, 0xba, 0x01, 0x1a, + 0x08, 0x86, 0x0a, 0x80, 0xd8, 0x40, 0x81, 0x9d, 0x25, 0xa1, 0x9d, 0x10, 0x12, 0x81, 0xa0, 0x8e, + 0xa2, 0x29, 0x25, 0x80, 0xfd, 0x38, 0x82, 0x18, 0xa8, 0x9b, 0x50, 0x92, 0x09, 0x88, 0x38, 0xaa, + 0x23, 0xde, 0x41, 0x80, 0x11, 0x90, 0xbd, 0x30, 0x51, 0x92, 0xbc, 0xca, 0x45, 0x88, 0x80, 0x0c, + 0xb2, 0x39, 0x44, 0xe0, 0x0a, 0x10, 0x02, 0xaa, 0x30, 0xa9, 0xa8, 0x70, 0xc2, 0x30, 0xab, 0x04, + 0x2a, 0xb1, 0x40, 0xeb, 0x18, 0x22, 0xb1, 0x59, 0xf0, 0x2a, 0x02, 0x01, 0x8a, 0xb8, 0x2c, 0x33, + 0x04, 0xbd, 0x81, 0x29, 0x27, 0xcb, 0xba, 0x72, 0x83, 0x98, 0x9d, 0x11, 0x21, 0x12, 0xfb, 0x8a, + 0x40, 0x02, 0x98, 0xaa, 0xaa, 0x72, 0x04, 0xb8, 0x8c, 0x98, 0x64, 0x90, 0x89, 0xa0, 0x1a, 0x24, + 0x88, 0xa9, 0x38, 0xe8, 0x60, 0xb8, 0x29, 0x21, 0xa3, 0x8e, 0xa8, 0x50, 0x81, 0x08, 0x82, 0xbc, + 0x29, 0x28, 0x14, 0x98, 0xac, 0x38, 0xa1, 0x72, 0xf2, 0x2a, 0xa1, 0x28, 0x82, 0x9a, 0x84, 0xaf, + 0x53, 0x82, 0x9b, 0xaa, 0x52, 0x81, 0x88, 0xb1, 0x1b, 0x91, 0x45, 0xa8, 0xac, 0x11, 0x80, 0x32, + 0xf9, 0x0a, 0x08, 0x33, 0x22, 0xfa, 0x8f, 0x14, 0x81, 0xaa, 0x29, 0x84, 0x18, 0x98, 0xc8, 0x1b, + 0x25, 0x12, 0xf9, 0x9c, 0x43, 0x80, 0x82, 0x9d, 0x10, 0x91, 0x08, 0x22, 0xd8, 0x0a, 0x92, 0x5a, + 0xb3, 0x1c, 0x91, 0x08, 0x80, 0x20, 0xb3, 0x2e, 0xe8, 0x50, 0x00, 0x11, 0xdd, 0x40, 0x98, 0x11, + 0x88, 0xa0, 0x38, 0xb8, 0xaa, 0x61, 0x82, 0x48, 0xc1, 0xae, 0x28, 0x14, 0x00, 0xd8, 0x09, 0x91, + 0x3a, 0x37, 0xda, 0x89, 0x10, 0x42, 0xa0, 0xbb, 0x40, 0x01, 0x91, 0xab, 0x00, 0x18, 0x48, 0x87, + 0x9c, 0x88, 0x50, 0xa1, 0x89, 0x00, 0x42, 0xea, 0x42, 0xab, 0x92, 0x0b, 0x64, 0xa1, 0xac, 0x20, + 0x11, 0x93, 0x9c, 0x8b, 0x27, 0x9a, 0x81, 0x81, 0x9d, 0x52, 0x90, 0x8a, 0x00, 0x91, 0x8d, 0x27, + 0x9a, 0x80, 0x0b, 0x93, 0x6b, 0x86, 0xbb, 0x11, 0x89, 0x13, 0x91, 0x9b, 0x12, 0xc9, 0x72, 0xb1, + 0x8a, 0x21, 0x10, 0xb4, 0xaf, 0x40, 0x11, 0x98, 0xca, 0x2c, 0x15, 0x09, 0x90, 0x8b, 0x90, 0x70, + 0x95, 0x8b, 0x09, 0x22, 0x11, 0xfb, 0x28, 0x92, 0xaa, 0x13, 0x28, 0x03, 0xdd, 0x18, 0x02, 0xa9, + 0x48, 0x07, 0xbc, 0x01, 0x30, 0x81, 0xa9, 0x80, 0x8f, 0x24, 0x98, 0x8a, 0x11, 0x13, 0xdb, 0x9b, + 0x40, 0x36, 0xb0, 0xbc, 0x39, 0x92, 0x60, 0xb2, 0x8d, 0x12, 0x8a, 0x33, 0xa8, 0xbc, 0x49, 0x25, + 0xa0, 0x9f, 0x11, 0x08, 0x23, 0xca, 0x8a, 0x32, 0xb8, 0x3b, 0x27, 0xd8, 0x19, 0x10, 0xa2, 0x8f, + 0x11, 0x42, 0xe8, 0x8a, 0x21, 0x12, 0xab, 0x19, 0x07, 0xbb, 0x41, 0xa2, 0xa9, 0x49, 0x05, 0xa9, + 0x9c, 0x00, 0x54, 0x88, 0x99, 0x89, 0x48, 0xa1, 0x1a, 0xe1, 0x59, 0x04, 0xcb, 0x29, 0x00, 0x42, + 0xc0, 0x9c, 0x02, 0x18, 0x82, 0x11, 0xca, 0x8a, 0x30, 0x17, 0xbc, 0x31, 0x82, 0x0a, 0xa0, 0x00, + 0x0c, 0x36, 0xe0, 0x8b, 0x30, 0x13, 0x99, 0xbd, 0x44, 0x80, 0x80, 0xb9, 0x1a, 0xc1, 0x70, 0xa3, + 0xac, 0x20, 0x09, 0xa1, 0x38, 0x51, 0xc2, 0x2b, 0x99, 0x90, 0x58, 0x26, 0xba, 0xc8, 0x2c, 0x24, + 0x99, 0x12, 0xcb, 0x19, 0x14, 0x1b, 0x06, 0x9e, 0x24, 0xaa, 0xb1, 0x8b, 0x35, 0x98, 0x11, 0xc9, + 0x0b, 0x92, 0x38, 0x34, 0xa8, 0x09, 0x89, 0xea, 0x19, 0x51, 0x02, 0x42, 0xfd, 0x3b, 0x04, 0x00, + 0x09, 0xc0, 0x0b, 0x25, 0xaa, 0x10, 0x1a, 0x07, 0xa9, 0x89, 0xc9, 0x78, 0x94, 0x0b, 0x92, 0x8a, + 0x41, 0xb2, 0x0c, 0x81, 0x20, 0x91, 0xe9, 0x29, 0x12, 0x04, 0x1a, 0xf2, 0x0f, 0x13, 0x08, 0xa1, + 0xbb, 0x50, 0x81, 0x88, 0xa8, 0x49, 0x02, 0xdb, 0x51, 0xb9, 0x41, 0xa0, 0xa8, 0x3a, 0x95, 0x2b, + 0x04, 0xba, 0x3a, 0x83, 0x21, 0xac, 0xb8, 0x70, 0x85, 0x9d, 0x12, 0x18, 0xab, 0x98, 0x73, 0xa9, + 0x22, 0xb0, 0x1c, 0xb3, 0x6b, 0x84, 0xdb, 0x30, 0x98, 0x21, 0x81, 0xdc, 0x18, 0x14, 0x90, 0x08, + 0x91, 0x8c, 0x33, 0xb1, 0x0f, 0xb2, 0x79, 0xa3, 0x9c, 0x90, 0x31, 0x89, 0x17, 0xdb, 0x29, 0x02, + 0x22, 0xbc, 0x28, 0x91, 0x3a, 0xa5, 0x8e, 0x02, 0x08, 0x31, 0xa3, 0xdf, 0x38, 0x04, 0x98, 0x1a, + 0x91, 0x1a, 0x94, 0x1b, 0x04, 0xdb, 0x39, 0x94, 0x8c, 0x12, 0x00, 0xa1, 0x0b, 0x40, 0xd9, 0x39, + 0x82, 0x30, 0x91, 0xeb, 0x2a, 0xc8, 0x73, 0x81, 0xe9, 0x30, 0x91, 0x98, 0x29, 0xa3, 0x7a, 0xc2, + 0x1c, 0xb1, 0x1b, 0x37, 0x91, 0xcb, 0x1b, 0x84, 0x08, 0x21, 0xa9, 0x0a, 0x13, 0x99, 0xb8, 0x69, + 0x00, 0x02, 0x81, 0xef, 0x33, 0xda, 0x61, 0x90, 0x9a, 0x28, 0x92, 0x40, 0xdb, 0x31, 0xa8, 0x10, + 0x89, 0x01, 0xca, 0x2b, 0x67, 0xa9, 0x8a, 0x90, 0x72, 0xa1, 0x0a, 0x90, 0x90, 0x30, 0xb1, 0x33, + 0xcf, 0x32, 0x98, 0x88, 0xa1, 0x2d, 0x06, 0x8a, 0x91, 0x89, 0x02, 0x30, 0xc0, 0x09, 0x99, 0x81, + 0x6a, 0xa4, 0x0c, 0x92, 0x3a, 0x12, 0xe9, 0x8a, 0x53, 0x81, 0x00, 0xea, 0x38, 0xd9, 0x52, 0xa8, + 0x19, 0x93, 0x8f, 0x22, 0xb0, 0x0a, 0x02, 0x20, 0x15, 0xcf, 0x11, 0x10, 0xa1, 0x10, 0x9b, 0x01, + 0x89, 0x44, 0x08, 0xf0, 0x2b, 0x91, 0x53, 0xb9, 0x00, 0x29, 0xc2, 0x0b, 0x84, 0x8c, 0x22, 0x10, + 0x96, 0xaf, 0x30, 0x13, 0xb9, 0x39, 0xea, 0x28, 0x32, 0xa2, 0x8d, 0xb0, 0x3d, 0x17, 0xc9, 0x28, + 0x98, 0x11, 0x1b, 0x85, 0x9b, 0x10, 0x71, 0xd1, 0x19, 0xa0, 0x38, 0x82, 0xa0, 0x1b, 0x02, 0xae, + 0x72, 0x92, 0x9c, 0x00, 0x19, 0x14, 0xb9, 0x0a, 0x88, 0x37, 0xa9, 0xea, 0x28, 0x82, 0x42, 0xc9, + 0x09, 0x90, 0x48, 0x17, 0xbc, 0x10, 0x11, 0x08, 0xa0, 0x8b, 0x00, 0x62, 0x92, 0x9b, 0xe0, 0x4b, + 0x05, 0x98, 0x9a, 0x41, 0xb0, 0x20, 0x9a, 0x91, 0x0d, 0x33, 0x91, 0xca, 0x3a, 0x25, 0xb8, 0x0d, + 0x13, 0x99, 0x18, 0x81, 0x70, 0xc1, 0x1a, 0x94, 0x1c, 0xd0, 0x39, 0x43, 0xe8, 0x28, 0xb0, 0x2b, + 0x04, 0x8a, 0x14, 0xaa, 0xdb, 0x71, 0x90, 0x11, 0x9a, 0x98, 0x4a, 0xa3, 0x4b, 0x91, 0x90, 0x5c, + 0x94, 0xbb, 0x09, 0x63, 0x92, 0x90, 0xac, 0x10, 0x20, 0x10, 0x05, 0xbe, 0x28, 0x32, 0xd1, 0x0c, + 0x01, 0x20, 0x90, 0x09, 0x09, 0xe9, 0x38, 0x27, 0xb8, 0xae, 0x53, 0x80, 0xb9, 0x20, 0x91, 0x8a, + 0x23, 0xbb, 0x54, 0xdb, 0x31, 0x88, 0x00, 0x0b, 0xa3, 0x1f, 0x24, 0xb8, 0xab, 0x32, 0x9a, 0x47, + 0xa8, 0xab, 0x98, 0x1a, 0x77, 0xb0, 0x09, 0x90, 0x18, 0x03, 0x0a, 0xc9, 0x31, 0x11, 0xb9, 0x1a, + 0xa0, 0x61, 0x12, 0xce, 0x10, 0x19, 0x05, 0x91, 0xaa, 0xaf, 0x44, 0xa1, 0x0a, 0x98, 0x32, 0xa9, + 0x89, 0x64, 0xc9, 0x89, 0x43, 0x91, 0xc9, 0x0c, 0x26, 0x99, 0x98, 0x1a, 0x03, 0xa8, 0x8a, 0x64, + 0xd0, 0x2a, 0x82, 0x99, 0x81, 0x99, 0x51, 0x23, 0xfb, 0x5a, 0xb1, 0x19, 0x82, 0xb9, 0x52, 0xa1, + 0x9b, 0x21, 0x91, 0x20, 0xc9, 0x51, 0xb0, 0x9f, 0x31, 0x14, 0xa0, 0xcc, 0x41, 0xd8, 0x29, 0x84, + 0x00, 0xba, 0x89, 0x44, 0x80, 0xb9, 0x2b, 0xb3, 0x69, 0xa1, 0x21, 0x8d, 0x02, 0x28, 0xa1, 0x88, + 0xaf, 0x63, 0x03, 0xcb, 0x8a, 0x22, 0x11, 0xf9, 0x0b, 0x35, 0xb0, 0x0d, 0x13, 0xab, 0x09, 0x43, + 0x12, 0xea, 0x8b, 0x63, 0xc0, 0x28, 0x90, 0x29, 0xc8, 0x40, 0x80, 0xb2, 0x1d, 0x12, 0x00, 0xc9, + 0x38, 0xb0, 0x1b, 0x56, 0xb0, 0x9b, 0x39, 0x95, 0x0c, 0x33, 0xc1, 0x8a, 0x81, 0x89, 0x94, 0x0f, + 0x24, 0xa9, 0x8a, 0x01, 0x28, 0xf1, 0x4b, 0x86, 0x8a, 0x10, 0xa9, 0x48, 0xb1, 0x48, 0xa1, 0x8b, + 0x22, 0xc8, 0x09, 0x54, 0xa1, 0xbb, 0x09, 0x01, 0x60, 0x84, 0x99, 0xbc, 0x9a, 0x46, 0x91, 0x19, + 0xb9, 0x38, 0x92, 0x1a, 0xa5, 0x8d, 0x32, 0x13, 0xf9, 0x8c, 0x32, 0x82, 0x9d, 0x11, 0x30, 0xca, + 0x99, 0x52, 0xa8, 0x80, 0x62, 0xa1, 0xaf, 0x11, 0x41, 0xb1, 0x19, 0xb9, 0x88, 0x78, 0x83, 0x8b, + 0xb1, 0x8c, 0x01, 0x44, 0x98, 0x98, 0x01, 0xad, 0x35, 0xca, 0x28, 0x93, 0x9d, 0x33, 0x91, 0xab, + 0xab, 0x43, 0x33, 0xfc, 0x10, 0x09, 0x33, 0xc8, 0x3a, 0xa1, 0xb9, 0x2e, 0x07, 0x99, 0x80, 0x40, + 0x92, 0xba, 0xdb, 0x70, 0x02, 0x88, 0xbd, 0x31, 0x32, 0xc0, 0x8d, 0x81, 0x21, 0xa1, 0x09, 0x98, + 0xb8, 0x6c, 0x14, 0x91, 0xbf, 0x30, 0x22, 0xc0, 0x0a, 0x11, 0x30, 0xf0, 0x2a, 0x82, 0x09, 0x82, + 0xaa, 0x2b, 0x16, 0x99, 0x30, 0xc2, 0xaf, 0x40, 0x04, 0x89, 0x88, 0xbf, 0x63, 0xa0, 0x08, 0x00, + 0x89, 0x98, 0x38, 0x17, 0xcb, 0x18, 0x11, 0x82, 0x9a, 0x9a, 0x52, 0x90, 0x8c, 0x14, 0x9a, 0x18, + 0x83, 0x0c, 0x85, 0x8b, 0xa8, 0x35, 0x9b, 0x85, 0x8f, 0x14, 0xba, 0x09, 0x42, 0x82, 0xb9, 0x0c, + 0x13, 0x98, 0xaa, 0x74, 0x90, 0x99, 0x9c, 0x34, 0x08, 0x82, 0xcb, 0x09, 0x42, 0xc8, 0x20, 0x33, + 0xef, 0x38, 0x01, 0x98, 0x98, 0x28, 0x13, 0x81, 0xbf, 0x20, 0x12, 0x98, 0x0b, 0x41, 0xa4, 0x9f, + 0x02, 0x08, 0x22, 0x98, 0xa0, 0x8e, 0xa9, 0x46, 0xa0, 0x00, 0xdb, 0x49, 0x13, 0xaa, 0x2b, 0xb2, + 0x68, 0x01, 0x9a, 0x12, 0xbd, 0x61, 0x91, 0x09, 0xc9, 0x18, 0x64, 0xb1, 0x8a, 0x80, 0x00, 0x08, + 0xd8, 0x68, 0x92, 0x29, 0xe9, 0x1a, 0x22, 0x99, 0x30, 0xa4, 0xaf, 0x30, 0x11, 0x00, 0xc1, 0x0e, + 0x23, 0xca, 0x38, 0xa2, 0x18, 0x80, 0x88, 0x13, 0x8d, 0x13, 0xdc, 0x48, 0x16, 0xcb, 0x10, 0xb8, + 0x48, 0x04, 0xa8, 0xab, 0x01, 0x29, 0x15, 0x9c, 0x11, 0x0a, 0x02, 0xd2, 0x8f, 0x13, 0x11, 0xa0, + 0xb8, 0x0f, 0x24, 0x80, 0x99, 0xaa, 0x52, 0xa0, 0x58, 0xd8, 0x1a, 0x24, 0x00, 0xea, 0x09, 0x28, + 0x33, 0xb0, 0x9d, 0x08, 0x83, 0x8a, 0x11, 0x84, 0x9e, 0x34, 0xca, 0x80, 0x2a, 0x23, 0x82, 0xfa, + 0x09, 0x22, 0x81, 0x00, 0x9f, 0x22, 0x01, 0xac, 0x18, 0x83, 0x1e, 0x14, 0x98, 0xcb, 0x38, 0xb4, + 0x29, 0x33, 0xb8, 0xbb, 0x9f, 0x22, 0x82, 0x5a, 0x94, 0x8a, 0xaf, 0x62, 0x92, 0xa9, 0x0d, 0x14, + 0x89, 0x00, 0xa8, 0x8a, 0x52, 0x02, 0x99, 0xbd, 0x30, 0x31, 0x14, 0xc9, 0xad, 0x52, 0xb0, 0x10, + 0xa8, 0x22, 0x81, 0xda, 0x9a, 0x53, 0xa1, 0x50, 0x92, 0xcf, 0x10, 0x12, 0x81, 0x99, 0xaa, 0x43, + 0xb8, 0x08, 0x38, 0x15, 0xcd, 0x41, 0x90, 0x29, 0x91, 0xaa, 0x8a, 0x73, 0xa5, 0xab, 0x00, 0x00, + 0x33, 0xc9, 0x32, 0xcc, 0x99, 0x75, 0xb8, 0x1a, 0x08, 0x44, 0xb9, 0x99, 0x29, 0x82, 0x22, 0xac, + 0x80, 0x81, 0x3a, 0x17, 0x89, 0xca, 0x20, 0x01, 0xe1, 0x0e, 0x25, 0x90, 0x9a, 0x91, 0x09, 0x31, + 0xc0, 0x29, 0x04, 0xce, 0x42, 0xb0, 0x18, 0x00, 0xb9, 0x61, 0xd0, 0x3b, 0x15, 0xa8, 0x8a, 0x11, + 0x92, 0xbc, 0x34, 0xdb, 0x52, 0x98, 0x18, 0xa9, 0x28, 0x19, 0x07, 0xc9, 0x2b, 0x14, 0xa9, 0x29, + 0x82, 0x0a, 0x80, 0x50, 0xf8, 0x28, 0x18, 0x04, 0x0c, 0xd8, 0x58, 0x91, 0x0a, 0x90, 0x28, 0x98, + 0x43, 0xe8, 0x8b, 0x24, 0x18, 0xa2, 0xad, 0x21, 0x81, 0x03, 0xae, 0x01, 0x40, 0xc0, 0x48, 0xb0, + 0x1d, 0x25, 0xb9, 0x0a, 0x11, 0x89, 0x03, 0x08, 0xaf, 0x16, 0x9a, 0x90, 0x18, 0x43, 0xa0, 0x9a, + 0x18, 0xeb, 0x61, 0x91, 0x09, 0xc8, 0x58, 0x81, 0xa9, 0x89, 0x41, 0x04, 0xca, 0x0a, 0x33, 0xc2, + 0x0c, 0x31, 0xf8, 0x39, 0x81, 0x80, 0x9c, 0x14, 0x10, 0xba, 0x80, 0x29, 0x25, 0x90, 0xce, 0x40, + 0xa2, 0x8a, 0x42, 0xd8, 0x39, 0x23, 0xe8, 0x8c, 0x33, 0x98, 0x89, 0x80, 0xca, 0x50, 0x02, 0xa2, + 0xac, 0x8a, 0x37, 0x80, 0xca, 0x28, 0x80, 0x22, 0x9c, 0x02, 0x9e, 0x33, 0xa8, 0xb9, 0x62, 0xb9, + 0x53, 0x91, 0xe9, 0x1e, 0x14, 0x09, 0xc8, 0x38, 0x80, 0x00, 0x99, 0x80, 0x40, 0xc1, 0x19, 0x99, + 0x90, 0x72, 0x96, 0xba, 0x9b, 0x34, 0x13, 0xca, 0x09, 0x10, 0x11, 0x91, 0xab, 0x09, 0x16, 0x0b, + 0xc3, 0x9d, 0x52, 0x11, 0xb2, 0xaf, 0x11, 0x08, 0x25, 0xba, 0x99, 0x29, 0x26, 0xb8, 0x1b, 0xd1, + 0x4a, 0x03, 0x20, 0xb8, 0x9a, 0x9a, 0x33, 0x1d, 0x07, 0xbb, 0x38, 0xb1, 0x40, 0xa1, 0x39, 0xcf, + 0x33, 0x8b, 0x06, 0x0b, 0xc3, 0x7a, 0xb2, 0x89, 0x1a, 0x84, 0x1b, 0x12, 0xa1, 0x8f, 0x03, 0x1a, + 0xa3, 0x2a, 0x99, 0x21, 0xc9, 0xca, 0x79, 0x95, 0x1a, 0x01, 0xbc, 0x19, 0x55, 0x90, 0x0b, 0x88, + 0x08, 0x13, 0x09, 0xec, 0x40, 0x83, 0xab, 0x19, 0xa8, 0x74, 0x81, 0xc8, 0x0c, 0x13, 0x19, 0xe0, + 0x30, 0xb0, 0x59, 0xb1, 0x0c, 0x08, 0x25, 0x98, 0x98, 0xab, 0x41, 0x23, 0x91, 0xed, 0x29, 0x13, + 0x18, 0xd9, 0x88, 0x51, 0xb0, 0x38, 0xba, 0x11, 0x80, 0x10, 0xa9, 0x80, 0x6c, 0x06, 0xad, 0x20, + 0x08, 0x42, 0xda, 0x81, 0x19, 0xa1, 0x22, 0x01, 0xfc, 0x28, 0x92, 0x48, 0xb2, 0x0d, 0x92, 0x11, + 0x9a, 0xb0, 0x73, 0xd0, 0x19, 0x00, 0x02, 0x99, 0x99, 0x23, 0xca, 0x45, 0xac, 0x13, 0x8b, 0xa2, + 0x6a, 0x92, 0xa9, 0x9d, 0x27, 0xaa, 0x88, 0x51, 0xa0, 0x08, 0x99, 0x00, 0x38, 0x87, 0x9b, 0x90, + 0x01, 0x0e, 0x37, 0xdb, 0x2a, 0x23, 0x98, 0x98, 0xa8, 0x38, 0x15, 0x99, 0xdb, 0x30, 0x00, 0x12, + 0x9b, 0xb3, 0xbf, 0x70, 0x12, 0xaa, 0x89, 0x1a, 0x37, 0xcb, 0x18, 0x40, 0xc1, 0x1b, 0x90, 0x35, + 0xca, 0x10, 0x89, 0x81, 0x18, 0x99, 0x35, 0x9c, 0xb8, 0x58, 0xa3, 0x0c, 0x24, 0xa0, 0xae, 0x13, + 0x19, 0x06, 0x9a, 0xcb, 0x51, 0x01, 0xa0, 0x0c, 0x12, 0x8a, 0x10, 0x01, 0x10, 0xde, 0x51, 0x91, + 0xb9, 0x19, 0x12, 0x03, 0xb9, 0xac, 0x73, 0xc2, 0x08, 0x98, 0x18, 0x91, 0x11, 0x39, 0xf2, 0x3d, + 0x90, 0x23, 0xa9, 0xfd, 0x59, 0x84, 0x99, 0x90, 0x00, 0x2a, 0x85, 0x9b, 0x81, 0x19, 0x11, 0x14, + 0xad, 0xa1, 0x4c, 0x85, 0x8a, 0x89, 0x31, 0xa0, 0x28, 0xda, 0x21, 0x00, 0x99, 0x23, 0xbf, 0x23, + 0x80, 0x11, 0xba, 0x00, 0x21, 0xac, 0x23, 0xad, 0x4a, 0x27, 0x9e, 0x10, 0x04, 0x9b, 0x81, 0x8a, + 0x27, 0xac, 0x18, 0x12, 0x2b, 0x87, 0x9d, 0x01, 0x08, 0x08, 0x43, 0xea, 0x28, 0x90, 0x38, 0x92, + 0x9e, 0x32, 0xd8, 0x28, 0x90, 0x01, 0x28, 0xb1, 0x09, 0xa9, 0x00, 0x65, 0xe0, 0x39, 0xb0, 0x22, + 0x9c, 0x11, 0x9a, 0x31, 0x11, 0xb8, 0x9c, 0x03, 0x9f, 0x54, 0x02, 0xcb, 0x1b, 0x93, 0x38, 0xa8, + 0x20, 0x80, 0xe1, 0x4a, 0xe0, 0x60, 0xb0, 0x38, 0xb8, 0x09, 0x31, 0x98, 0x85, 0x2d, 0xb4, 0x2d, + 0xb1, 0x4a, 0x84, 0x18, 0xda, 0x20, 0x08, 0xc2, 0x39, 0xc2, 0x29, 0x40, 0xc5, 0x8f, 0x13, 0x8a, + 0x22, 0xa9, 0x89, 0x19, 0x22, 0x03, 0xae, 0x28, 0x84, 0x1a, 0xd8, 0x19, 0x10, 0x15, 0x9a, 0x99, + 0xba, 0x71, 0x12, 0x81, 0xca, 0x8c, 0x12, 0x19, 0x83, 0x31, 0x10, 0xfd, 0x0a, 0x11, 0x32, 0xe9, + 0x58, 0xb1, 0x91, 0x8f, 0x05, 0x0a, 0x11, 0x88, 0xcb, 0x48, 0x11, 0x80, 0x08, 0xba, 0x18, 0x30, + 0xa2, 0x8e, 0x04, 0x09, 0x15, 0xeb, 0x2a, 0x81, 0x54, 0xc8, 0x89, 0x8a, 0x14, 0x28, 0xc0, 0x39, + 0xb0, 0x18, 0x23, 0xce, 0x31, 0xa8, 0x35, 0xba, 0xcb, 0x6a, 0x04, 0x88, 0xa9, 0x09, 0x42, 0xc1, + 0x4b, 0xa5, 0x8c, 0x12, 0x02, 0xdb, 0x89, 0x33, 0x13, 0xd8, 0x9f, 0x33, 0x99, 0x91, 0x18, 0xba, + 0x52, 0x80, 0x91, 0x9b, 0x18, 0x23, 0x91, 0x05, 0xdf, 0x11, 0x30, 0xa4, 0x9c, 0x80, 0x30, 0xb2, + 0x0e, 0x43, 0xb8, 0x0b, 0x81, 0x40, 0xa3, 0x9e, 0x30, 0x82, 0xca, 0x3a, 0x02, 0x04, 0xae, 0x23, + 0x98, 0xa9, 0x4b, 0x27, 0xca, 0x8a, 0x22, 0x32, 0xd1, 0x8b, 0xa1, 0x61, 0xc8, 0x40, 0x80, 0xba, + 0x58, 0x92, 0x2a, 0xf0, 0x1a, 0x54, 0xc8, 0x1b, 0x12, 0x18, 0xa8, 0x01, 0x9a, 0x83, 0x8c, 0x44, + 0xb0, 0x0b, 0x94, 0x2b, 0xa3, 0x8b, 0x28, 0x96, 0x5b, 0xe3, 0x0c, 0x33, 0xb1, 0x0c, 0x81, 0x28, + 0x03, 0xcc, 0x1a, 0x15, 0x88, 0x10, 0xb8, 0x8d, 0x90, 0x70, 0x95, 0x0c, 0x81, 0x18, 0x90, 0xa9, + 0x4a, 0x06, 0xba, 0x18, 0x01, 0x8a, 0x47, 0xaa, 0xa0, 0x0d, 0x15, 0x88, 0x90, 0x88, 0x9a, 0x27, + 0x9a, 0xba, 0x72, 0xb1, 0x00, 0x99, 0x13, 0x9a, 0x00, 0x51, 0xf8, 0x29, 0x02, 0x09, 0x89, 0xaa, + 0x73, 0xa1, 0x8b, 0x81, 0x18, 0x21, 0x11, 0xf0, 0x8c, 0x08, 0x27, 0xda, 0x31, 0xa8, 0x10, 0xa9, + 0x01, 0x01, 0x98, 0x28, 0x32, 0xf9, 0x3d, 0xa1, 0x38, 0xb1, 0x19, 0x80, 0xfb, 0x70, 0xc3, 0x1a, + 0x81, 0x81, 0x9e, 0x23, 0x31, 0xf8, 0x2b, 0x01, 0x80, 0x88, 0x99, 0x43, 0x08, 0xd8, 0x3a, 0xa1, + 0x58, 0xb1, 0x19, 0xca, 0x32, 0x28, 0x07, 0xcb, 0x89, 0x42, 0x30, 0xf8, 0x0c, 0x12, 0x21, 0xb8, + 0x9a, 0x98, 0x18, 0x54, 0x90, 0xa3, 0xbf, 0x34, 0x08, 0xea, 0x30, 0x10, 0xa1, 0x8f, 0x20, 0x00, + 0x03, 0xbb, 0x0a, 0x13, 0x9b, 0x27, 0xb8, 0xab, 0x18, 0x14, 0x22, 0xdb, 0x9a, 0x72, 0xb1, 0x28, + 0xcb, 0x64, 0x98, 0xa8, 0x2b, 0x06, 0x99, 0x09, 0x00, 0x12, 0x9b, 0x11, 0x2a, 0xa4, 0xbb, 0x58, + 0x97, 0x8e, 0x23, 0x8a, 0x90, 0x1c, 0x92, 0x61, 0xb0, 0x89, 0x09, 0x14, 0x8a, 0x08, 0x82, 0x39, + 0xc4, 0x0f, 0x92, 0x3a, 0x92, 0x31, 0xd8, 0xad, 0x68, 0x14, 0xb8, 0xab, 0x20, 0x04, 0x89, 0x00, + 0xd0, 0x4b, 0x94, 0x19, 0xa1, 0x9c, 0x81, 0x42, 0x88, 0x99, 0x25, 0xbc, 0x00, 0x00, 0x59, 0x07, + 0xaa, 0xb9, 0x61, 0x80, 0x10, 0x9b, 0x10, 0x9a, 0x88, 0x55, 0xc9, 0x20, 0x00, 0xda, 0x30, 0x81, + 0x18, 0xc0, 0xaa, 0x7a, 0x84, 0x9a, 0xa8, 0x70, 0xa1, 0x29, 0x01, 0xfa, 0x39, 0x83, 0x18, 0xe9, + 0x28, 0x11, 0xc0, 0x2a, 0x92, 0x3b, 0x04, 0xc8, 0x0b, 0x53, 0x80, 0x83, 0x9f, 0x88, 0x18, 0x32, + 0x03, 0xfd, 0x19, 0x21, 0x00, 0x98, 0xbc, 0x42, 0x12, 0xb8, 0x99, 0x18, 0x01, 0x33, 0x31, 0xfc, + 0x0f, 0x93, 0x70, 0x90, 0xaa, 0x19, 0x15, 0x9a, 0x82, 0x0a, 0x99, 0x80, 0x69, 0x05, 0xab, 0x00, + 0x1a, 0xb3, 0x2b, 0x00, 0x47, 0xca, 0x19, 0x12, 0xba, 0x12, 0x2a, 0x17, 0xbf, 0x30, 0x13, 0x99, + 0x20, 0xde, 0x40, 0x91, 0x88, 0x80, 0x0a, 0x34, 0xc0, 0x2a, 0xd0, 0x19, 0x11, 0x32, 0xe9, 0x9a, + 0x20, 0x15, 0x9c, 0x03, 0x1a, 0xa3, 0x9a, 0x8e, 0x45, 0x90, 0x89, 0x99, 0xba, 0x54, 0xb9, 0x41, + 0x81, 0x9d, 0x11, 0x89, 0x53, 0xb8, 0x88, 0x00, 0xa8, 0x1b, 0x45, 0x91, 0xbd, 0x62, 0xa1, 0x9a, + 0x1a, 0x05, 0x48, 0xb1, 0xdb, 0x48, 0x82, 0x9a, 0x13, 0xbc, 0x02, 0x29, 0x16, 0xda, 0x3a, 0x03, + 0x18, 0xc8, 0xbb, 0x68, 0x04, 0x89, 0x92, 0x9b, 0x18, 0x01, 0x81, 0x50, 0xf8, 0x59, 0xb1, 0x39, + 0xc9, 0x28, 0x35, 0xd0, 0x9b, 0x89, 0x53, 0x92, 0x0a, 0x02, 0xcc, 0x19, 0x33, 0x99, 0x01, 0x8b, + 0x89, 0x02, 0x7a, 0xa3, 0x78, 0xc0, 0x0b, 0x21, 0x98, 0x12, 0xbb, 0x68, 0x04, 0xbb, 0xad, 0x63, + 0x02, 0xba, 0x81, 0x1b, 0x05, 0x88, 0x98, 0xea, 0x38, 0x26, 0xc8, 0x9c, 0x31, 0x05, 0xa9, 0x8a, + 0x01, 0x29, 0x44, 0xc0, 0x9d, 0x38, 0x14, 0xca, 0x10, 0xa0, 0x31, 0x92, 0x8c, 0xa2, 0x1e, 0x25, + 0xa9, 0x99, 0x0b, 0x25, 0x81, 0xac, 0x01, 0x98, 0x20, 0x22, 0xa0, 0xac, 0x73, 0xa9, 0x98, 0x34, + 0x9d, 0x95, 0x1c, 0x92, 0x1b, 0x13, 0x22, 0xb9, 0xcd, 0x39, 0x04, 0x8d, 0x15, 0x88, 0x8b, 0x93, + 0x0e, 0x02, 0x00, 0x20, 0xbc, 0x10, 0x42, 0x82, 0xdf, 0x40, 0x81, 0xa8, 0x19, 0xa1, 0x08, 0x71, + 0xb2, 0x0c, 0x98, 0x19, 0x63, 0xc1, 0x2b, 0x83, 0x89, 0xab, 0x14, 0x9b, 0x46, 0xa1, 0xac, 0x10, + 0x98, 0x63, 0x91, 0xbb, 0x39, 0x82, 0x01, 0x0b, 0xc8, 0x73, 0x94, 0xac, 0x88, 0x40, 0x13, 0xc8, + 0x9d, 0x81, 0x40, 0x02, 0xab, 0x00, 0x0a, 0x27, 0xc9, 0x8b, 0x04, 0x38, 0x87, 0xcb, 0x29, 0x02, + 0x18, 0x01, 0xbd, 0x42, 0x98, 0x81, 0x08, 0xcb, 0x72, 0xa3, 0xab, 0x8b, 0x04, 0x59, 0x03, 0xba, + 0x8c, 0x22, 0x89, 0x12, 0x08, 0xda, 0x4a, 0x15, 0xba, 0x4a, 0xa3, 0x4a, 0xa5, 0xaf, 0x42, 0x88, + 0x08, 0x80, 0x88, 0x9a, 0x20, 0x03, 0x09, 0xc0, 0x1c, 0x27, 0x9a, 0x80, 0xa9, 0x31, 0xbf, 0x63, + 0x91, 0x9a, 0x91, 0x3a, 0x07, 0xab, 0x29, 0x83, 0x48, 0xb0, 0x0b, 0x00, 0x00, 0x28, 0x07, 0x9f, + 0x81, 0x29, 0x35, 0xc9, 0x8c, 0x32, 0xa1, 0x9b, 0x30, 0x88, 0x52, 0x99, 0xb9, 0x8e, 0x31, 0x15, + 0xaa, 0x90, 0x0d, 0x44, 0xa9, 0x08, 0x81, 0x09, 0x03, 0xdb, 0x0c, 0x37, 0xa8, 0x8a, 0x94, 0x8e, + 0x13, 0x99, 0x22, 0x98, 0x81, 0xac, 0x08, 0xb1, 0x7c, 0x05, 0xa8, 0x9d, 0x21, 0x02, 0x18, 0xb0, + 0x1b, 0x01, 0x9a, 0x46, 0xbb, 0x08, 0x32, 0x90, 0xdc, 0x21, 0x0a, 0x06, 0x19, 0xd0, 0x8a, 0x41, + 0xb1, 0x1c, 0x15, 0x1b, 0xa2, 0x9d, 0x82, 0x19, 0x54, 0x91, 0x9c, 0xa9, 0x59, 0x23, 0xc9, 0x30, + 0xb9, 0xb0, 0x1c, 0x27, 0x99, 0x11, 0xda, 0x19, 0x84, 0x89, 0x11, 0x81, 0x99, 0x02, 0xcf, 0x33, + 0x98, 0x0a, 0x25, 0xa8, 0xfb, 0x3a, 0x06, 0x09, 0xc2, 0x0a, 0x02, 0x18, 0x99, 0x21, 0x23, 0xbe, + 0x43, 0xcd, 0x28, 0x14, 0x99, 0x18, 0xc8, 0x1a, 0x21, 0x16, 0xea, 0x29, 0x01, 0x00, 0xb8, 0x18, + 0x03, 0x90, 0x1b, 0x85, 0xbf, 0x30, 0x14, 0x88, 0xb0, 0x0e, 0x93, 0x3b, 0x02, 0x33, 0xbd, 0x88, + 0x88, 0x0c, 0x47, 0xa8, 0x8a, 0x89, 0x34, 0xc1, 0x0c, 0x15, 0xba, 0x09, 0x51, 0x91, 0xbb, 0x38, + 0x26, 0xd9, 0x89, 0x20, 0x85, 0xab, 0x11, 0x29, 0x26, 0xab, 0x99, 0x1c, 0x33, 0x11, 0xd0, 0x8b, + 0x99, 0x31, 0x27, 0xb8, 0xbc, 0x38, 0x04, 0x18, 0xa3, 0xaf, 0x35, 0xa9, 0x8a, 0x10, 0x08, 0x04, + 0x9a, 0x88, 0x2a, 0xa4, 0x6a, 0xc2, 0x0c, 0x02, 0x24, 0xcb, 0xca, 0x60, 0x02, 0x09, 0x99, 0x99, + 0x28, 0x93, 0x79, 0xa1, 0x1a, 0xb1, 0x58, 0xc0, 0x2b, 0x84, 0x89, 0x28, 0xd0, 0x8c, 0x25, 0x90, + 0xbb, 0x72, 0x01, 0xf8, 0x3a, 0x93, 0x29, 0xa2, 0x0a, 0xc9, 0x29, 0x53, 0xc3, 0x9d, 0x02, 0x20, + 0xc9, 0x30, 0x80, 0x90, 0x30, 0x82, 0xfb, 0x8d, 0x62, 0x92, 0xba, 0x28, 0x14, 0xc9, 0x19, 0xb8, + 0x58, 0x33, 0xb0, 0xcc, 0x1a, 0x14, 0x30, 0xd0, 0x09, 0xb8, 0x2b, 0x16, 0x32, 0xca, 0x9c, 0x32, + 0xd9, 0x29, 0x33, 0x83, 0x8f, 0x91, 0x4a, 0xb1, 0x0c, 0x43, 0xb0, 0x0a, 0x08, 0x12, 0x90, 0x8b, + 0x02, 0x35, 0xcf, 0x10, 0x10, 0x11, 0x80, 0xda, 0x71, 0xd1, 0x8c, 0x31, 0x03, 0xbb, 0x00, 0x00, + 0x82, 0x1b, 0x05, 0x89, 0xfb, 0x78, 0x81, 0xa9, 0x0a, 0x22, 0x24, 0xa9, 0xdc, 0x48, 0x81, 0x28, + 0xb1, 0x0c, 0x93, 0x28, 0x80, 0xf0, 0x1c, 0x23, 0x1a, 0xb3, 0x8e, 0x88, 0x64, 0xb0, 0x89, 0x89, + 0x32, 0x83, 0xed, 0x30, 0xa1, 0x28, 0x93, 0xac, 0x88, 0x09, 0x37, 0xa0, 0x89, 0xad, 0x53, 0x80, + 0x09, 0x80, 0x81, 0xac, 0x88, 0x30, 0x24, 0xb0, 0x1c, 0xa2, 0x98, 0x0b, 0x14, 0xbb, 0x27, 0x8c, + 0x16, 0xbc, 0x32, 0x98, 0x00, 0x98, 0x0c, 0x25, 0xd9, 0x2a, 0x15, 0x89, 0xa2, 0x9d, 0x01, 0x10, + 0x11, 0x24, 0xeb, 0x08, 0xc9, 0x38, 0x03, 0x08, 0x09, 0xa6, 0x0e, 0xb2, 0x2a, 0x35, 0x83, 0xaf, + 0x08, 0x00, 0x21, 0x98, 0x10, 0x89, 0xd0, 0x0c, 0x34, 0xa8, 0x22, 0x80, 0xbb, 0xbd, 0x19, 0x75, + 0x03, 0xbc, 0x19, 0x91, 0x0a, 0x23, 0x00, 0x01, 0xb9, 0x18, 0xfb, 0x2a, 0x00, 0x15, 0x28, 0xfb, + 0x6a, 0xa0, 0x08, 0x63, 0xa0, 0x8b, 0xb8, 0x3a, 0x25, 0x11, 0x90, 0xac, 0x99, 0xab, 0x64, 0x10, + 0xb3, 0x0a, 0xb8, 0xbc, 0x71, 0x83, 0x29, 0x82, 0xcf, 0x09, 0x53, 0x82, 0xaa, 0x80, 0x9c, 0x34, + 0xc0, 0x8c, 0x52, 0x81, 0xab, 0x22, 0xdb, 0x40, 0x12, 0xa8, 0xaa, 0x29, 0x14, 0x12, 0xf8, 0x8c, + 0x23, 0x08, 0xa3, 0x9f, 0x19, 0x34, 0x98, 0xa0, 0x8d, 0x12, 0x0a, 0x06, 0x9d, 0x23, 0x8a, 0x10, + 0xca, 0x29, 0x14, 0x11, 0xca, 0x4a, 0xc1, 0x2c, 0x05, 0xa9, 0x20, 0xc0, 0x19, 0x28, 0x02, 0x18, + 0xea, 0x0b, 0x17, 0x18, 0xb0, 0x1b, 0x83, 0x1b, 0x01, 0x94, 0xff, 0x48, 0x04, 0xb9, 0x8a, 0x12, + 0x09, 0x23, 0xc9, 0x89, 0x10, 0x33, 0xe9, 0x19, 0x91, 0x30, 0x81, 0xdb, 0x2a, 0x15, 0x19, 0x16, + 0xec, 0x0a, 0x34, 0xa0, 0x8a, 0x80, 0x08, 0x21, 0x91, 0x9c, 0x00, 0x90, 0x62, 0xa0, 0xbb, 0x74, + 0xb0, 0x89, 0x10, 0x81, 0x0a, 0x06, 0xa9, 0x9a, 0x42, 0xb1, 0x89, 0x0d, 0x47, 0xb9, 0x8a, 0x10, + 0x23, 0x08, 0x02, 0xaf, 0xd8, 0x69, 0x05, 0xba, 0x18, 0x01, 0x89, 0x02, 0x9d, 0x32, 0x82, 0xab, + 0xb9, 0x39, 0x54, 0x15, 0xbd, 0x00, 0x09, 0x13, 0x12, 0xea, 0x9a, 0x50, 0x14, 0xca, 0x8a, 0x11, + 0x52, 0xb2, 0x9d, 0x18, 0x22, 0x9a, 0x20, 0xa8, 0x18, 0x8a, 0x15, 0xbb, 0x41, 0xa2, 0x2a, 0xf3, + 0x9f, 0x36, 0xb9, 0x09, 0x01, 0x80, 0x1a, 0x95, 0x0d, 0x12, 0x08, 0xb8, 0x19, 0x02, 0x21, 0xac, + 0x11, 0xcb, 0x73, 0xb6, 0x8b, 0x81, 0x19, 0x64, 0xb1, 0x9e, 0x30, 0x80, 0x02, 0x8a, 0xba, 0x49, + 0x03, 0x34, 0xdc, 0x09, 0x20, 0x14, 0xbb, 0xab, 0x58, 0x05, 0x08, 0xb1, 0xad, 0x30, 0x23, 0xa0, + 0xac, 0x32, 0x01, 0xa9, 0x1c, 0xc2, 0x70, 0x93, 0xcc, 0x1a, 0x22, 0x32, 0xd2, 0x8d, 0x02, 0x9a, + 0x41, 0x82, 0x9a, 0x09, 0x10, 0xb0, 0xbf, 0x55, 0x01, 0xda, 0x2a, 0x22, 0x92, 0xdb, 0x19, 0x13, + 0x88, 0x33, 0xfc, 0x8a, 0x43, 0x90, 0x29, 0xe8, 0x19, 0x33, 0x92, 0x9f, 0x01, 0x29, 0x84, 0x8b, + 0xb9, 0x7a, 0x85, 0x9a, 0x88, 0x00, 0x21, 0x00, 0xcb, 0x99, 0x62, 0x02, 0x90, 0xdc, 0x19, 0x43, + 0x82, 0xcb, 0x0a, 0x12, 0x38, 0x84, 0xac, 0x28, 0x22, 0xfa, 0x2a, 0x01, 0x24, 0xab, 0x91, 0xaa, + 0x08, 0x71, 0x87, 0x9c, 0x80, 0x41, 0x81, 0xad, 0x28, 0x23, 0x91, 0xbe, 0x00, 0x21, 0x13, 0xa9, + 0x9a, 0x9c, 0x54, 0x91, 0xa9, 0x88, 0x29, 0x16, 0x90, 0xfb, 0x29, 0x34, 0x80, 0xcc, 0x89, 0x70, + 0x83, 0xab, 0x9a, 0x42, 0x92, 0x08, 0x90, 0xbc, 0x40, 0x32, 0xa1, 0xbc, 0x19, 0x22, 0x13, 0xdb, + 0x8c, 0x36, 0xc0, 0x9b, 0x18, 0x36, 0xa8, 0xa8, 0x1b, 0x33, 0xc8, 0x28, 0x93, 0xcf, 0x22, 0x21, + 0xa2, 0xaf, 0x38, 0x34, 0xe9, 0x1a, 0x80, 0x32, 0xa1, 0xad, 0x21, 0x03, 0xcc, 0x18, 0x08, 0x23, + 0x22, 0xb0, 0xaf, 0x0b, 0x25, 0x22, 0xc0, 0xac, 0x2b, 0x26, 0x90, 0xb9, 0x1b, 0x26, 0x98, 0xad, + 0x31, 0x32, 0xc0, 0x08, 0xca, 0x18, 0x22, 0x23, 0xdf, 0x28, 0x03, 0x08, 0xc0, 0x8a, 0x20, 0x27, + 0xc9, 0x9a, 0x00, 0x44, 0x90, 0x89, 0xdb, 0x50, 0x82, 0x90, 0xac, 0x02, 0x20, 0x24, 0xea, 0x8a, + 0x41, 0x92, 0xaa, 0x89, 0x41, 0x92, 0x09, 0xb8, 0xaa, 0x64, 0x14, 0xca, 0xab, 0x08, 0x65, 0x91, + 0xab, 0x20, 0xa0, 0x29, 0x15, 0xb9, 0xbb, 0x74, 0xa1, 0x8b, 0x12, 0x8b, 0x42, 0xc1, 0x1b, 0x81, + 0x38, 0x21, 0xf0, 0x1c, 0x05, 0xb8, 0x08, 0x08, 0x88, 0x32, 0x9a, 0x33, 0xf8, 0x0f, 0x14, 0x80, + 0x8b, 0x01, 0x88, 0xb9, 0x69, 0x04, 0x8a, 0xd0, 0x0b, 0x62, 0x92, 0x9b, 0x19, 0x04, 0x89, 0x84, + 0x9d, 0x13, 0x0a, 0xc1, 0x50, 0xc8, 0x19, 0x20, 0x06, 0xbc, 0x20, 0x12, 0x80, 0xcb, 0x30, 0xa0, + 0x49, 0x91, 0x10, 0xea, 0x8a, 0x25, 0x80, 0x99, 0x09, 0x11, 0xb1, 0x0c, 0x24, 0x18, 0x27, 0xfb, + 0x0b, 0x13, 0x8a, 0x34, 0x90, 0xaa, 0x8c, 0xbb, 0x77, 0x90, 0x0a, 0x08, 0x80, 0x19, 0x12, 0x88, + 0xc8, 0x8d, 0x24, 0xc8, 0x38, 0xa4, 0x49, 0xd2, 0x0b, 0x21, 0x98, 0x80, 0x39, 0x83, 0x8c, 0x93, + 0x8f, 0xa3, 0x7b, 0xa1, 0x18, 0x80, 0x91, 0x8d, 0x31, 0x02, 0xc8, 0x8a, 0x99, 0x21, 0x52, 0x04, + 0xf9, 0x0b, 0x04, 0x28, 0xa2, 0xbc, 0x34, 0xa0, 0x1a, 0x91, 0x8e, 0x13, 0x31, 0xa4, 0xdf, 0x20, + 0x91, 0x18, 0x02, 0xd9, 0x39, 0xa2, 0x5a, 0xd1, 0x0b, 0x21, 0x17, 0xba, 0x08, 0x1a, 0x15, 0x98, + 0x82, 0xb8, 0x9f, 0x44, 0xb0, 0x1a, 0x01, 0x10, 0xd0, 0x8b, 0x32, 0x80, 0x11, 0x90, 0xaf, 0x88, + 0x41, 0x24, 0xe8, 0x1a, 0x90, 0x8a, 0x71, 0x83, 0xaa, 0x00, 0x98, 0xab, 0x51, 0x25, 0xc8, 0x9b, + 0x02, 0x59, 0x94, 0x9c, 0x12, 0x88, 0xa8, 0x20, 0x91, 0x38, 0x21, 0xf3, 0x9d, 0x9a, 0x37, 0x99, + 0x09, 0x93, 0x8e, 0x43, 0xb0, 0x9d, 0x32, 0x81, 0x28, 0xda, 0x28, 0x81, 0xa9, 0x51, 0xc0, 0x09, + 0x08, 0x45, 0xd8, 0x8a, 0x42, 0xa0, 0x88, 0x19, 0xa4, 0x1d, 0x02, 0x10, 0xca, 0x19, 0x03, 0x91, + 0x4b, 0xb2, 0xad, 0x35, 0x99, 0xa8, 0x18, 0xa0, 0x60, 0xb1, 0x3a, 0x04, 0xcb, 0x8f, 0x36, 0xb8, + 0x19, 0x90, 0x2a, 0x14, 0xcc, 0x48, 0x01, 0x99, 0x09, 0xb8, 0x2c, 0x37, 0xa8, 0x8b, 0xd1, 0x3b, + 0x27, 0x90, 0xaa, 0x80, 0x0a, 0x17, 0xa9, 0x18, 0x01, 0x98, 0x19, 0x93, 0xcc, 0x59, 0x15, 0xba, + 0x9a, 0x31, 0x20, 0x03, 0xcc, 0x1b, 0x04, 0x8a, 0x11, 0xa1, 0x5b, 0x16, 0xda, 0x18, 0x01, 0xc9, + 0x50, 0xa1, 0x0a, 0x22, 0xb0, 0x9a, 0x59, 0x92, 0x20, 0xc0, 0xaf, 0x15, 0x2a, 0x93, 0xad, 0x29, + 0x15, 0xa8, 0xaa, 0x11, 0x21, 0x16, 0xbb, 0xa9, 0x0a, 0x33, 0x37, 0xba, 0xbb, 0x10, 0x44, 0x31, + 0xf0, 0x2f, 0x00, 0x80, 0x89, 0x01, 0x8a, 0x43, 0xaa, 0x92, 0x9f, 0x22, 0x03, 0x9b, 0x81, 0x98, + 0x31, 0xfb, 0x3a, 0x01, 0x41, 0xa3, 0xbf, 0x00, 0x31, 0x98, 0x22, 0x8a, 0xa3, 0x9f, 0x81, 0x78, + 0x96, 0x9a, 0x98, 0x00, 0x10, 0x53, 0xa2, 0xcb, 0x9f, 0x43, 0x81, 0xa8, 0x8d, 0x22, 0x00, 0xa9, + 0x1a, 0x12, 0xa2, 0x3b, 0xa5, 0x9f, 0x31, 0x15, 0xa9, 0xba, 0x2a, 0x15, 0x23, 0xec, 0x88, 0x30, + 0xa3, 0x0c, 0xb1, 0x68, 0x91, 0x08, 0xa8, 0x89, 0x20, 0x54, 0x82, 0xcf, 0x19, 0x24, 0xa9, 0x10, + 0xa9, 0x90, 0x28, 0x02, 0x31, 0xb9, 0xa9, 0x78, 0xb1, 0x8e, 0x44, 0xa0, 0x88, 0x9b, 0x12, 0x22, + 0xb0, 0x8f, 0x82, 0x6a, 0xb3, 0x8d, 0x01, 0x21, 0x99, 0x82, 0x0c, 0xc1, 0x0e, 0x24, 0x00, 0x9b, + 0x12, 0xa9, 0xb9, 0x1b, 0x77, 0x91, 0xbb, 0x39, 0x04, 0x9a, 0x33, 0xc9, 0x09, 0x9d, 0x17, 0x8a, + 0x82, 0x89, 0x00, 0x31, 0xfb, 0x1a, 0x32, 0x02, 0xda, 0x3a, 0x15, 0xfa, 0x28, 0x92, 0x1a, 0xa3, + 0x8c, 0x23, 0x99, 0x19, 0x73, 0xb1, 0xaf, 0x30, 0x02, 0x99, 0x00, 0x80, 0x80, 0x9a, 0x22, 0xec, + 0x52, 0xa0, 0x28, 0x90, 0xa9, 0x69, 0xb2, 0x78, 0xc1, 0x8b, 0x30, 0xa3, 0x0a, 0x09, 0x36, 0xd0, + 0xac, 0x38, 0x14, 0x18, 0x80, 0xd8, 0x8e, 0x22, 0x11, 0x91, 0xcb, 0x0a, 0x23, 0x20, 0xa0, 0x1a, + 0x52, 0xd1, 0x9b, 0x2b, 0x37, 0xa9, 0x08, 0xb8, 0x1b, 0x26, 0xb9, 0x62, 0xc0, 0x8a, 0x30, 0x04, + 0xcb, 0x20, 0x11, 0xd1, 0x1b, 0x01, 0x91, 0x9b, 0x69, 0x84, 0x8a, 0xb9, 0x39, 0x47, 0xa9, 0x09, + 0xa9, 0x89, 0x46, 0x80, 0x98, 0x8c, 0xa1, 0x79, 0x93, 0x0b, 0xb0, 0x2b, 0x37, 0xca, 0x19, 0x10, + 0x02, 0xa9, 0xbb, 0x72, 0xc1, 0x38, 0x11, 0xe8, 0x1a, 0x93, 0x2c, 0x84, 0x9a, 0x44, 0xc9, 0x8b, + 0x63, 0xb0, 0x2b, 0x15, 0xc9, 0x0b, 0x23, 0xa8, 0x31, 0x91, 0xc9, 0x2b, 0xa2, 0x79, 0x94, 0x8d, + 0x12, 0xaa, 0x38, 0x83, 0xb8, 0x9c, 0x53, 0x03, 0xcc, 0x10, 0x28, 0xd8, 0x70, 0x92, 0xac, 0x00, + 0x01, 0x32, 0xc8, 0x8a, 0x03, 0xbb, 0x31, 0x09, 0x27, 0xa1, 0x0d, 0xc9, 0x1a, 0x63, 0xa3, 0x1b, + 0xb3, 0xac, 0x19, 0x25, 0xa8, 0x21, 0xbb, 0x11, 0x82, 0xbf, 0x47, 0xb0, 0x0c, 0x04, 0xba, 0x29, + 0x23, 0x22, 0xe8, 0xab, 0x1a, 0x26, 0x8b, 0x23, 0x09, 0xd9, 0x19, 0x11, 0x90, 0x1a, 0xd4, 0x5a, + 0x85, 0x9d, 0x00, 0x30, 0x82, 0xaa, 0x9a, 0x13, 0x40, 0xb2, 0x8c, 0x81, 0x30, 0xcc, 0x64, 0xe8, + 0x2a, 0x14, 0xa8, 0x99, 0x8a, 0x34, 0x91, 0x98, 0x8c, 0x91, 0x59, 0xc1, 0x50, 0xa1, 0x9c, 0x32, + 0xc1, 0x5b, 0xa4, 0x8c, 0x22, 0x89, 0x89, 0x42, 0xc0, 0x09, 0x00, 0x90, 0x2a, 0xc1, 0x68, 0x93, + 0x9f, 0x11, 0x12, 0x9b, 0x00, 0x20, 0xfb, 0x29, 0x42, 0x91, 0x8a, 0xaa, 0x31, 0x84, 0x0d, 0x01, + 0x89, 0x09, 0x25, 0xac, 0x90, 0x79, 0xb4, 0x0a, 0xa0, 0x29, 0x15, 0x28, 0xd8, 0x0a, 0x28, 0xa0, + 0x34, 0xea, 0x1a, 0x83, 0x29, 0x15, 0xcb, 0x28, 0xac, 0x36, 0xd9, 0x18, 0x23, 0xdb, 0x38, 0x81, + 0x0a, 0x82, 0xa9, 0x29, 0x87, 0x0e, 0x13, 0x89, 0xba, 0x22, 0x9b, 0x41, 0x80, 0x33, 0xde, 0x18, + 0x81, 0x21, 0x04, 0xcd, 0x20, 0x00, 0x11, 0xa0, 0x9c, 0x22, 0x08, 0xb1, 0x1e, 0xb0, 0x70, 0x85, + 0xba, 0x9a, 0x31, 0x23, 0x81, 0x9d, 0xc1, 0x69, 0xd2, 0x2a, 0x84, 0x89, 0x01, 0x81, 0xda, 0x0a, + 0x43, 0x04, 0xca, 0x89, 0x18, 0x51, 0x91, 0xb9, 0x0b, 0x15, 0x99, 0x12, 0xac, 0x42, 0x13, 0xfb, + 0x0a, 0x99, 0x72, 0x93, 0x8c, 0x98, 0x30, 0x91, 0xba, 0x70, 0xb4, 0x1b, 0x03, 0x98, 0x8c, 0x63, + 0x98, 0x09, 0xb9, 0x2a, 0x45, 0x92, 0xad, 0x02, 0x8a, 0x36, 0xea, 0x18, 0x10, 0xa0, 0x1a, 0x82, + 0x19, 0xa8, 0x33, 0x8d, 0x96, 0x9c, 0x72, 0xb1, 0x9b, 0x32, 0x82, 0x99, 0x9b, 0x15, 0x9a, 0x84, + 0x8c, 0x33, 0xe1, 0x38, 0xb0, 0x9c, 0x32, 0x30, 0xd1, 0x8d, 0x33, 0xb9, 0x88, 0x12, 0x8f, 0x13, + 0x10, 0xd9, 0x0c, 0x34, 0xa1, 0xcb, 0x30, 0x80, 0x92, 0x60, 0xe8, 0x38, 0xa1, 0x3a, 0xa2, 0xfa, + 0x3a, 0x17, 0x98, 0xaa, 0x98, 0x50, 0x12, 0xba, 0x2a, 0x02, 0x08, 0x82, 0xce, 0x30, 0x23, 0xc8, + 0x0a, 0xb9, 0x7b, 0x15, 0x91, 0xcb, 0x8a, 0x43, 0x13, 0xb9, 0x9d, 0x31, 0xb2, 0x0c, 0x01, 0x08, + 0x88, 0x54, 0xc1, 0xac, 0x18, 0x53, 0x91, 0xbc, 0x41, 0x81, 0x09, 0xc9, 0x08, 0x30, 0x34, 0xe0, + 0x8b, 0x81, 0x31, 0x24, 0xe8, 0x8b, 0x02, 0x0a, 0x17, 0xb9, 0x88, 0x34, 0xa8, 0xcd, 0x38, 0x23, + 0x11, 0xfa, 0x1b, 0x03, 0xba, 0x70, 0x91, 0x09, 0x90, 0x2a, 0x84, 0xad, 0x52, 0x81, 0x88, 0xdb, + 0x28, 0x12, 0x30, 0xb2, 0x9f, 0x81, 0x88, 0x12, 0x30, 0x86, 0xcb, 0x0a, 0x21, 0xa9, 0x20, 0x33, + 0xe8, 0x8d, 0x22, 0x00, 0xd1, 0x8d, 0x44, 0xb1, 0x0c, 0x88, 0x31, 0x11, 0xda, 0x18, 0x90, 0x0b, + 0x47, 0xaa, 0x21, 0x99, 0x41, 0xc1, 0x9d, 0x80, 0x63, 0xa1, 0x8b, 0xa8, 0x59, 0x05, 0x99, 0x8a, + 0x81, 0x2a, 0x04, 0x01, 0xdd, 0x29, 0x52, 0x91, 0xda, 0x1a, 0x24, 0x90, 0x98, 0xa9, 0x70, 0xa1, + 0x88, 0x88, 0x08, 0x20, 0x00, 0x12, 0xff, 0x38, 0x12, 0xa1, 0x9c, 0x80, 0x40, 0x93, 0x9d, 0x11, + 0x81, 0x88, 0x99, 0x03, 0x9d, 0x02, 0x38, 0x15, 0xfb, 0x1b, 0x23, 0xa0, 0x89, 0x61, 0xa1, 0x9c, + 0x28, 0x89, 0x57, 0xb9, 0x1b, 0x14, 0xa9, 0x11, 0xaa, 0x12, 0xb8, 0x41, 0x01, 0xe0, 0x8e, 0x24, + 0x92, 0x9c, 0x99, 0x62, 0xa2, 0xab, 0x10, 0x12, 0x22, 0xfb, 0x8c, 0x15, 0x9a, 0x52, 0xb8, 0x09, + 0x99, 0x50, 0x04, 0xbb, 0x08, 0x40, 0x92, 0xab, 0x38, 0x12, 0x08, 0xc0, 0x0c, 0x92, 0x2b, 0x37, + 0xb8, 0x09, 0xea, 0x41, 0xc0, 0x28, 0x92, 0x21, 0xf8, 0x8b, 0x22, 0x21, 0x92, 0xae, 0x20, 0x81, + 0x9b, 0x12, 0x82, 0x6c, 0xb3, 0x1c, 0x90, 0xaa, 0x71, 0x24, 0xd9, 0x8b, 0x82, 0x63, 0xb0, 0x9b, + 0x42, 0xc1, 0x38, 0xc8, 0x8a, 0x53, 0xa1, 0x0a, 0xb2, 0x9e, 0x21, 0x44, 0xa0, 0xbc, 0x1a, 0x43, + 0x02, 0x9a, 0xbc, 0x72, 0xb3, 0x8c, 0x22, 0xb9, 0x50, 0x93, 0xac, 0x00, 0x39, 0x94, 0x28, 0xcb, + 0x18, 0x22, 0x90, 0x10, 0xc9, 0x0c, 0x34, 0xd1, 0x8e, 0x82, 0x38, 0x93, 0x08, 0xd9, 0x28, 0xdc, + 0x43, 0x81, 0xac, 0x63, 0xb0, 0x0a, 0x00, 0x01, 0x10, 0xdb, 0x31, 0x31, 0xe1, 0xab, 0x71, 0x93, + 0x9c, 0x08, 0x21, 0x9a, 0x34, 0xcb, 0x18, 0x80, 0xaa, 0x46, 0xe9, 0x20, 0x00, 0xb0, 0x28, 0xea, + 0x52, 0x88, 0x98, 0x09, 0x99, 0x55, 0xb8, 0x88, 0x89, 0x15, 0x8b, 0x05, 0x9a, 0xa9, 0x61, 0x91, + 0x89, 0xa9, 0x48, 0x94, 0x0a, 0xb1, 0x58, 0xb1, 0x4a, 0x93, 0xbf, 0x42, 0x02, 0xa8, 0xbc, 0x21, + 0x00, 0x62, 0xd0, 0x8a, 0x12, 0x11, 0x9a, 0x1a, 0x00, 0x24, 0xbb, 0x02, 0x9e, 0x82, 0x6a, 0x84, + 0x0b, 0xa8, 0x28, 0x39, 0xc7, 0x1d, 0x04, 0x99, 0x18, 0x00, 0x88, 0x89, 0x30, 0x85, 0xad, 0x18, + 0x12, 0xa0, 0x31, 0xa0, 0xd9, 0x00, 0xad, 0x73, 0xb4, 0x09, 0xb9, 0x62, 0xb0, 0x89, 0x18, 0x14, + 0x00, 0xec, 0x20, 0x80, 0x30, 0x92, 0x88, 0xaf, 0x12, 0x20, 0xb2, 0x0b, 0xc9, 0x70, 0x92, 0xcb, + 0x19, 0x26, 0x99, 0xa8, 0x20, 0x08, 0xc2, 0x2d, 0x15, 0x99, 0x9c, 0x32, 0xb8, 0x1a, 0x01, 0x24, + 0x11, 0xfa, 0x19, 0xb9, 0x62, 0x90, 0x41, 0xcb, 0x81, 0x0c, 0x17, 0xb9, 0x20, 0x90, 0x9a, 0x58, + 0x93, 0x1c, 0x03, 0xea, 0x29, 0x82, 0x8a, 0x11, 0x14, 0xa9, 0xb9, 0x1d, 0x44, 0x91, 0xad, 0x18, + 0x34, 0xa9, 0x88, 0xa1, 0x8e, 0x42, 0xa1, 0x8b, 0x85, 0x8d, 0x34, 0xa9, 0x19, 0x98, 0x20, 0x9a, + 0x85, 0x0e, 0x44, 0xc8, 0x0b, 0x11, 0x08, 0x20, 0x11, 0xeb, 0x19, 0x80, 0x28, 0x16, 0xe9, 0x3a, + 0xa4, 0x8a, 0x02, 0x90, 0x61, 0xd1, 0x8b, 0x12, 0x01, 0xb8, 0x30, 0xfa, 0x40, 0xa2, 0x19, 0x90, + 0x09, 0x41, 0xa3, 0xcf, 0x12, 0x12, 0x99, 0x98, 0xea, 0x68, 0x03, 0xba, 0x0a, 0x11, 0x12, 0x20, + 0xfa, 0x1b, 0x04, 0x0b, 0x81, 0x33, 0xaf, 0x30, 0x82, 0xae, 0x32, 0xb1, 0x78, 0xd1, 0x0b, 0x33, + 0x80, 0xba, 0x10, 0x01, 0xa9, 0x51, 0x81, 0x89, 0xc8, 0x2a, 0x02, 0x00, 0x0f, 0x16, 0xa9, 0xcb, + 0x48, 0x24, 0xb0, 0xac, 0x2b, 0x47, 0xa9, 0x88, 0x99, 0x33, 0xba, 0x42, 0xb8, 0x29, 0x44, 0xd9, + 0x1a, 0x88, 0x42, 0x01, 0xb8, 0xaf, 0x22, 0x24, 0xc8, 0x9c, 0x18, 0x34, 0xa0, 0x88, 0xac, 0x41, + 0xa0, 0x31, 0xfa, 0x1b, 0x13, 0x52, 0xd8, 0x9a, 0x30, 0x16, 0xab, 0x98, 0x20, 0x13, 0x10, 0xf9, + 0x2b, 0x81, 0x31, 0xb1, 0x09, 0x98, 0x1b, 0x17, 0xa8, 0x0b, 0x82, 0x35, 0xef, 0x20, 0x18, 0x03, + 0xad, 0x18, 0x21, 0x81, 0x9c, 0x50, 0xc3, 0x1c, 0x82, 0x9a, 0x19, 0x37, 0xa9, 0xba, 0x1a, 0x63, + 0x12, 0xb9, 0x0c, 0x90, 0x31, 0x21, 0xd1, 0xaf, 0x31, 0x23, 0xd0, 0x8b, 0x01, 0x10, 0x23, 0xf9, + 0x8c, 0x15, 0x09, 0x91, 0x9b, 0x19, 0x27, 0xa9, 0x99, 0x18, 0x22, 0x32, 0xf9, 0x8a, 0x8a, 0x45, + 0x90, 0xa8, 0x89, 0x01, 0x30, 0xf0, 0x29, 0x93, 0x19, 0x81, 0xdc, 0x48, 0x12, 0x01, 0xbd, 0x88, + 0x00, 0x34, 0xc1, 0x8a, 0x21, 0xa8, 0x62, 0xfb, 0x08, 0x61, 0xa1, 0x8b, 0x80, 0x28, 0x12, 0x88, + 0xab, 0x10, 0x23, 0x22, 0xfb, 0x8e, 0x42, 0x82, 0xa8, 0xbd, 0x48, 0x85, 0x89, 0x98, 0x30, 0x81, + 0x18, 0xf1, 0x1d, 0x21, 0x22, 0xd9, 0x9b, 0x09, 0x36, 0x00, 0xb0, 0x0c, 0xc8, 0x49, 0x13, 0x80, + 0xad, 0x53, 0xb9, 0x99, 0x32, 0xa0, 0x44, 0xe8, 0x8c, 0x32, 0x00, 0x81, 0xba, 0x89, 0x60, 0xa3, + 0x1b, 0xc8, 0x31, 0x31, 0xb4, 0xbf, 0x21, 0x01, 0x01, 0xdb, 0x28, 0x21, 0xb3, 0x8c, 0xd9, 0x69, + 0x03, 0x01, 0xaf, 0x80, 0x30, 0x04, 0xb9, 0x9b, 0x42, 0x91, 0x18, 0xe8, 0x2b, 0x26, 0x08, 0xa8, + 0xcb, 0x58, 0x03, 0xba, 0x10, 0x98, 0x02, 0x3a, 0xa4, 0x8c, 0x89, 0x66, 0xd8, 0x0a, 0x11, 0x31, + 0xc0, 0x8b, 0x88, 0x61, 0xa2, 0x8b, 0xa8, 0x72, 0x82, 0x9b, 0x00, 0xa9, 0x58, 0x02, 0x88, 0xcc, + 0x31, 0x82, 0x00, 0xdc, 0x51, 0x91, 0xab, 0x18, 0x14, 0x8a, 0x13, 0xba, 0xbc, 0x28, 0x43, 0x36, + 0xde, 0x21, 0x90, 0x80, 0x0a, 0x04, 0x8b, 0x04, 0xcb, 0x50, 0x82, 0x99, 0x88, 0x8a, 0x12, 0x57, + 0xe8, 0x8a, 0x32, 0xa0, 0x18, 0xa1, 0xc9, 0x2a, 0x17, 0x89, 0x98, 0x09, 0x42, 0x81, 0xcc, 0x0a, + 0x34, 0x10, 0xf8, 0x8a, 0x22, 0x11, 0xb0, 0x1c, 0x90, 0x48, 0x13, 0xdb, 0x01, 0x9d, 0x73, 0x81, + 0xbc, 0x18, 0x33, 0xa2, 0xac, 0x88, 0x30, 0x24, 0xa0, 0xac, 0xa9, 0x71, 0x02, 0x90, 0xbd, 0x12, + 0x29, 0x93, 0x0a, 0x89, 0x63, 0xc0, 0x8a, 0x82, 0x0c, 0x37, 0xd8, 0x2a, 0xa0, 0x00, 0x20, 0x21, + 0xe0, 0x8c, 0x21, 0x10, 0x03, 0xdc, 0x28, 0x83, 0xba, 0x59, 0x84, 0x9a, 0x11, 0x28, 0x93, 0xcf, + 0x09, 0x11, 0x73, 0x91, 0xba, 0x0a, 0x81, 0x40, 0x21, 0xc4, 0x9f, 0x30, 0x81, 0x9a, 0x10, 0x20, + 0xa2, 0x9c, 0x99, 0x59, 0x27, 0x90, 0x9a, 0xa9, 0x0b, 0x27, 0x08, 0x91, 0x8d, 0x13, 0x9b, 0xa1, + 0x3c, 0x17, 0x99, 0x9a, 0x11, 0x90, 0x11, 0x19, 0xb3, 0x9e, 0xa8, 0x61, 0x91, 0x09, 0x20, 0x02, + 0xfb, 0x8b, 0x28, 0x73, 0x96, 0x9c, 0x01, 0x11, 0x98, 0xaa, 0x41, 0x81, 0x99, 0x24, 0xad, 0x88, + 0x22, 0x24, 0x09, 0xf8, 0x1e, 0x03, 0x8a, 0x81, 0x23, 0xfb, 0x89, 0x20, 0x82, 0x48, 0xc0, 0x28, + 0xca, 0x00, 0x19, 0x36, 0xb1, 0x9e, 0x80, 0x51, 0x92, 0xad, 0x30, 0x83, 0x98, 0x9d, 0x42, 0x92, + 0x9c, 0x33, 0xb8, 0xbc, 0x70, 0x02, 0x89, 0xd9, 0x48, 0x92, 0x8a, 0x99, 0x52, 0x91, 0xa9, 0xa8, + 0x38, 0x03, 0x8a, 0x11, 0x0b, 0xc4, 0x8f, 0x52, 0xa1, 0x8a, 0x00, 0x21, 0xb2, 0xaf, 0x72, 0xc3, + 0x0b, 0x02, 0x08, 0x84, 0x9d, 0x12, 0x89, 0x01, 0x88, 0xa2, 0x8c, 0x11, 0x43, 0xc8, 0xbd, 0x30, + 0x14, 0x02, 0xdc, 0x09, 0x00, 0x25, 0x98, 0xbd, 0x42, 0x91, 0x9b, 0x24, 0xa0, 0x2b, 0x94, 0x0b, + 0x02, 0xc9, 0x79, 0x06, 0xba, 0x8c, 0x42, 0x92, 0x1b, 0xa2, 0x8a, 0x01, 0x11, 0xc9, 0x70, 0xe0, + 0x49, 0x92, 0xab, 0x20, 0x81, 0x12, 0xcc, 0x18, 0x21, 0x13, 0xbf, 0x32, 0x80, 0x90, 0x80, 0xbb, + 0x43, 0x43, 0xe0, 0x19, 0xb0, 0x30, 0x18, 0xc1, 0x69, 0x83, 0xae, 0x11, 0x8a, 0x23, 0x99, 0xb9, + 0x18, 0xac, 0x63, 0x01, 0xe9, 0x39, 0x04, 0x90, 0xdb, 0x2a, 0x17, 0x09, 0xa0, 0x1a, 0xc8, 0x30, + 0x45, 0xd9, 0x2a, 0x80, 0x12, 0xa8, 0x9a, 0x41, 0x44, 0xca, 0x89, 0x08, 0x08, 0x34, 0xda, 0x00, + 0x09, 0x00, 0x02, 0xce, 0x21, 0x38, 0x06, 0xbc, 0x0b, 0x53, 0x81, 0x09, 0xcb, 0x61, 0xa0, 0x28, + 0x91, 0x0a, 0x14, 0x9a, 0xd8, 0x8b, 0x44, 0x23, 0xb9, 0xbe, 0x40, 0x81, 0x22, 0x9b, 0xa8, 0x8b, + 0x53, 0x12, 0xfb, 0x0a, 0x43, 0xa0, 0xb8, 0x3b, 0x93, 0x4c, 0x86, 0xba, 0x8b, 0x35, 0xa1, 0x8d, + 0x10, 0x23, 0x01, 0xdf, 0x51, 0xa0, 0x08, 0x09, 0x04, 0xa9, 0x88, 0x22, 0xba, 0x38, 0x22, 0x91, + 0xfa, 0x9c, 0x62, 0x91, 0x9a, 0x18, 0x04, 0xa8, 0xac, 0x20, 0x52, 0x91, 0x99, 0xe8, 0x0c, 0x25, + 0x00, 0x91, 0xca, 0x1b, 0x17, 0xa9, 0x28, 0xb9, 0x55, 0xb8, 0x19, 0x99, 0x43, 0x89, 0x90, 0x2a, + 0xeb, 0x50, 0x03, 0xa9, 0x8e, 0x22, 0x18, 0xc0, 0x8c, 0x12, 0x21, 0x91, 0xeb, 0x89, 0x51, 0x01, + 0xa9, 0x20, 0xbb, 0x43, 0x98, 0x31, 0xca, 0x19, 0x27, 0xab, 0xc1, 0x3b, 0x27, 0x98, 0xba, 0x30, + 0x03, 0xa9, 0xc9, 0x68, 0xa0, 0x20, 0xaa, 0xc0, 0x1d, 0x27, 0x98, 0xc9, 0x1b, 0x26, 0x00, 0xdb, + 0x28, 0x83, 0x89, 0x90, 0x08, 0x98, 0x51, 0xa3, 0x2a, 0xd9, 0x08, 0x71, 0xc2, 0x0c, 0x81, 0x52, + 0xb8, 0x9b, 0x21, 0x11, 0x01, 0xb8, 0x9f, 0x14, 0x8b, 0x24, 0xb8, 0x09, 0x21, 0xfb, 0x1a, 0x24, + 0xa0, 0x11, 0xda, 0x89, 0x40, 0x16, 0xa8, 0x8d, 0x81, 0x38, 0x86, 0xab, 0x80, 0x42, 0x98, 0x29, + 0xe8, 0x1b, 0x44, 0x90, 0xa9, 0x8b, 0x33, 0x00, 0xa2, 0xdf, 0x42, 0x92, 0x8b, 0x92, 0x0b, 0x02, + 0x44, 0xdb, 0x10, 0xba, 0x52, 0x81, 0xb9, 0x49, 0x90, 0x32, 0xca, 0xaa, 0x78, 0x04, 0xa8, 0x9b, + 0x13, 0x1a, 0x84, 0xac, 0x41, 0xa8, 0x39, 0xd2, 0x2e, 0x14, 0x80, 0x9b, 0xc9, 0x68, 0x93, 0x99, + 0x00, 0xb8, 0x50, 0x91, 0x88, 0xca, 0x51, 0x01, 0xa0, 0x9f, 0x21, 0x01, 0x99, 0xa1, 0x3b, 0x06, + 0xbb, 0x19, 0x15, 0x0c, 0x27, 0xb8, 0xba, 0x4b, 0x17, 0x99, 0x18, 0xc8, 0x29, 0x01, 0x31, 0xca, + 0x08, 0x88, 0x21, 0xba, 0x18, 0x54, 0xb0, 0x28, 0xdc, 0x88, 0x3a, 0x57, 0x9a, 0x89, 0x10, 0x90, + 0x21, 0xc8, 0x1a, 0x34, 0xea, 0x39, 0x12, 0xd8, 0x38, 0xc8, 0x51, 0x88, 0xb9, 0x40, 0x91, 0x09, + 0x08, 0x01, 0xbe, 0x30, 0x43, 0xd1, 0x8d, 0x81, 0x48, 0x04, 0xbd, 0x30, 0xa0, 0x31, 0x90, 0xc8, + 0x0f, 0x03, 0x31, 0xb2, 0xbc, 0x3a, 0x15, 0x99, 0x21, 0xdb, 0x40, 0x80, 0xa9, 0x80, 0x21, 0xb2, + 0x0d, 0x34, 0xc9, 0x38, 0xa9, 0x23, 0xe9, 0x2a, 0xc1, 0x38, 0x38, 0xf3, 0x0f, 0x03, 0xa8, 0x48, + 0xa3, 0x9c, 0x89, 0x46, 0x98, 0x88, 0xbb, 0x41, 0x04, 0xaa, 0x20, 0x80, 0xb8, 0x2b, 0x27, 0xe9, + 0x2a, 0x04, 0x09, 0x90, 0xcc, 0x51, 0x81, 0x98, 0x89, 0x22, 0xd8, 0x39, 0xa1, 0x18, 0x9a, 0x15, + 0x00, 0xeb, 0x2a, 0x15, 0x10, 0xe9, 0x0a, 0x22, 0x92, 0x5a, 0xd1, 0x2a, 0x93, 0x9a, 0x09, 0x42, + 0x94, 0x0d, 0x04, 0xac, 0x01, 0x0b, 0x44, 0xb2, 0x9f, 0x22, 0xa0, 0x9a, 0x43, 0x02, 0xcc, 0x28, + 0xb0, 0x61, 0x80, 0x0a, 0x91, 0x8c, 0x12, 0x80, 0x00, 0xbb, 0x67, 0xb8, 0x08, 0xa9, 0x38, 0x26, + 0xa0, 0xae, 0x30, 0x13, 0xa8, 0xbb, 0x39, 0x14, 0x08, 0xaa, 0x81, 0xcf, 0x72, 0x82, 0xb9, 0x9b, + 0x32, 0x23, 0xda, 0x30, 0x91, 0xcb, 0x48, 0x84, 0xad, 0x52, 0x90, 0x08, 0xba, 0x29, 0x36, 0xc8, + 0x2a, 0x92, 0x8a, 0x18, 0x85, 0x1c, 0x94, 0x99, 0x89, 0x38, 0xb1, 0x38, 0x13, 0xf9, 0x6a, 0xc0, + 0x1a, 0x22, 0xc0, 0x49, 0x14, 0xda, 0x9b, 0x51, 0x12, 0xa8, 0x8c, 0x21, 0x00, 0x90, 0x1b, 0x32, + 0xb1, 0x9f, 0x15, 0xbd, 0x41, 0x80, 0x20, 0xd1, 0x8c, 0x21, 0x11, 0x80, 0x8a, 0x02, 0x09, 0xc0, + 0xaf, 0x51, 0x81, 0x00, 0xa0, 0x9b, 0xa9, 0x74, 0x94, 0x9b, 0x9a, 0x62, 0x81, 0x98, 0x9b, 0x34, + 0x90, 0xbd, 0x41, 0x11, 0xa0, 0x0d, 0x13, 0x8b, 0x92, 0x3a, 0x91, 0x9e, 0x21, 0x24, 0x8a, 0xfa, + 0x2b, 0x31, 0x05, 0x9d, 0x20, 0x21, 0xd8, 0x0b, 0x81, 0x54, 0xa8, 0x9a, 0x0b, 0x25, 0xa8, 0x41, + 0xc0, 0x0b, 0x90, 0x39, 0x47, 0xdb, 0x29, 0x33, 0xb8, 0x9d, 0x20, 0x10, 0x02, 0x88, 0xfa, 0x30, + 0x98, 0x32, 0x98, 0xcc, 0x28, 0x22, 0xa2, 0x9f, 0x24, 0x9b, 0x13, 0xad, 0x11, 0x23, 0xdc, 0x21, + 0x90, 0x08, 0xa0, 0x8a, 0x14, 0x9c, 0x01, 0x64, 0x92, 0x9f, 0x01, 0x28, 0x02, 0xd9, 0x39, 0x90, + 0x90, 0x89, 0x73, 0xc3, 0x8b, 0x90, 0x28, 0x43, 0xb8, 0x8a, 0x90, 0xb9, 0x73, 0x08, 0xc2, 0x9d, + 0x33, 0x31, 0xe9, 0x88, 0x0b, 0x17, 0x08, 0xba, 0x50, 0xa1, 0x98, 0x2b, 0xb3, 0x70, 0xb2, 0x0a, + 0xa0, 0xab, 0x67, 0xa1, 0x8b, 0xa0, 0x51, 0xa1, 0x08, 0x8b, 0x02, 0x09, 0x08, 0xa3, 0x9e, 0x11, + 0x44, 0xb2, 0x9e, 0x18, 0x10, 0x30, 0xb3, 0xaf, 0x63, 0xc0, 0x1b, 0x83, 0x08, 0x31, 0xf9, 0x89, + 0x21, 0x83, 0xab, 0x43, 0xfb, 0x38, 0x14, 0xda, 0x29, 0x81, 0x00, 0x1a, 0x15, 0xbd, 0x28, 0x13, + 0xa9, 0x41, 0xea, 0x19, 0x23, 0x02, 0xbe, 0x10, 0x81, 0x30, 0xb3, 0xcf, 0x42, 0x90, 0x1a, 0x91, + 0x09, 0x21, 0x92, 0x8f, 0x11, 0x00, 0x80, 0x01, 0xad, 0x01, 0x39, 0xb3, 0xa9, 0xff, 0x43, 0x80, + 0xb1, 0x8e, 0x31, 0x80, 0x08, 0x82, 0xaf, 0x13, 0x09, 0x04, 0xa9, 0x8b, 0x34, 0xa0, 0xca, 0x69, + 0x92, 0x01, 0xbb, 0x99, 0x72, 0x94, 0x8c, 0x80, 0x12, 0x88, 0x98, 0x80, 0xbd, 0x62, 0x03, 0x9b, + 0xc1, 0x8e, 0x32, 0x12, 0xa8, 0x8d, 0x03, 0xab, 0x11, 0x92, 0x70, 0xa5, 0xad, 0x21, 0x20, 0x92, + 0x19, 0xa8, 0xba, 0x1c, 0x24, 0x44, 0xeb, 0x88, 0x40, 0xb1, 0x2b, 0xc0, 0x50, 0x91, 0x98, 0x0b, + 0x33, 0x90, 0xd9, 0x28, 0x99, 0x37, 0xbb, 0x01, 0x99, 0x20, 0x45, 0xb1, 0xdf, 0x28, 0x25, 0xb8, + 0x0b, 0x11, 0x20, 0xb0, 0x8c, 0x21, 0xb8, 0x70, 0x93, 0xba, 0xab, 0x25, 0x18, 0x94, 0xbc, 0x10, + 0x24, 0xd9, 0x28, 0x88, 0x25, 0xb9, 0xcc, 0x49, 0x23, 0x90, 0xaa, 0x80, 0x1a, 0x93, 0x7a, 0xa3, + 0x9c, 0x18, 0x36, 0xd8, 0xab, 0x62, 0x92, 0x99, 0x8c, 0x23, 0x11, 0xd0, 0x8c, 0x12, 0x22, 0xa9, + 0xbb, 0x21, 0x89, 0x57, 0xa0, 0xac, 0x80, 0x21, 0x23, 0xc9, 0x8b, 0x72, 0xb3, 0x8d, 0x00, 0x00, + 0x33, 0xf8, 0x1a, 0x91, 0x1a, 0x23, 0x91, 0xad, 0x00, 0x72, 0xa3, 0x9e, 0x08, 0x33, 0x01, 0xfb, + 0x0a, 0x23, 0x88, 0x10, 0x92, 0xaf, 0x12, 0x00, 0x99, 0x20, 0x98, 0x04, 0x08, 0xfa, 0x3b, 0x04, + 0x89, 0x20, 0xd0, 0x2c, 0x06, 0xac, 0x30, 0x13, 0x9b, 0x81, 0x9f, 0x42, 0x90, 0x1a, 0x85, 0xbb, + 0x18, 0x23, 0xb9, 0x20, 0x72, 0xb1, 0xad, 0x89, 0x45, 0xa0, 0x80, 0x9a, 0x90, 0x39, 0x26, 0xb8, + 0xbc, 0x38, 0x35, 0xa1, 0xbe, 0x30, 0x23, 0xb9, 0x01, 0xbe, 0x52, 0x80, 0x90, 0x08, 0x38, 0xf1, + 0x1a, 0x03, 0x9c, 0x43, 0x90, 0x80, 0xcc, 0x38, 0x33, 0xb2, 0xaf, 0x42, 0xa0, 0x8d, 0x22, 0xa0, + 0x20, 0xd9, 0x29, 0x92, 0x0a, 0x24, 0x98, 0x81, 0x9e, 0x84, 0x0a, 0x84, 0x9a, 0x60, 0x85, 0x9c, + 0x90, 0x38, 0x12, 0xb0, 0x9a, 0x10, 0x98, 0x14, 0x0a, 0xb2, 0xaf, 0x51, 0x11, 0xd9, 0x8c, 0x45, + 0xa8, 0x09, 0xb0, 0x3c, 0x16, 0xaa, 0x18, 0x02, 0x99, 0xb9, 0x61, 0x91, 0xab, 0x45, 0x90, 0xaa, + 0xbc, 0x72, 0x13, 0xb9, 0x0b, 0x02, 0x8a, 0x51, 0x03, 0xbc, 0x99, 0x11, 0x18, 0x81, 0xa9, 0x0a, + 0xbd, 0x77, 0xa9, 0x28, 0x81, 0x09, 0x98, 0x20, 0xa8, 0x9c, 0x46, 0xba, 0x22, 0xcb, 0x50, 0x13, + 0xcb, 0x0d, 0x03, 0x68, 0x92, 0xab, 0x9a, 0x24, 0x89, 0x33, 0xfa, 0x0a, 0x14, 0x09, 0x91, 0x9d, + 0x20, 0x14, 0xaa, 0x9a, 0x18, 0x33, 0xa9, 0x32, 0x88, 0xef, 0x30, 0x10, 0x85, 0xbc, 0x20, 0x04, + 0xba, 0x28, 0x05, 0x8a, 0x90, 0xaa, 0x34, 0x00, 0xf9, 0x48, 0x82, 0x80, 0xac, 0x11, 0xba, 0x50, + 0x16, 0xba, 0x18, 0xa9, 0x22, 0xea, 0x32, 0x89, 0x33, 0xcf, 0x20, 0xb0, 0x58, 0x84, 0x99, 0xbc, + 0x52, 0x81, 0x10, 0x01, 0xfb, 0x19, 0x84, 0x09, 0x81, 0xb9, 0x51, 0xb0, 0x0b, 0x12, 0x22, 0xcb, + 0x88, 0x8a, 0x37, 0xb9, 0x10, 0xc0, 0x1e, 0x14, 0x09, 0xc0, 0x0b, 0x58, 0x05, 0x9a, 0x80, 0x89, + 0x34, 0xfa, 0x18, 0x81, 0x18, 0x82, 0xcc, 0x49, 0x04, 0x88, 0x9a, 0x11, 0x9c, 0x26, 0x99, 0xac, + 0x34, 0xa0, 0x18, 0xad, 0x28, 0x41, 0x92, 0x0c, 0xa2, 0x9f, 0x63, 0xa1, 0x8a, 0x88, 0x20, 0x02, + 0x99, 0xad, 0x50, 0x03, 0xaa, 0x00, 0xad, 0x52, 0x11, 0xc9, 0x1a, 0x82, 0x40, 0xa2, 0xae, 0x29, + 0x14, 0x11, 0xda, 0x88, 0xa0, 0x51, 0x04, 0xca, 0x89, 0x01, 0x88, 0x43, 0xe8, 0x28, 0x92, 0x9a, + 0x18, 0x80, 0x44, 0xb0, 0xae, 0x22, 0x2a, 0x87, 0x9c, 0x01, 0x11, 0x89, 0x91, 0x8b, 0x16, 0x99, + 0x10, 0x18, 0xd8, 0x1c, 0x35, 0xd8, 0x9b, 0x62, 0x92, 0x99, 0xb9, 0x30, 0x04, 0x18, 0xc9, 0x8a, + 0x09, 0x25, 0x80, 0xcb, 0x38, 0x14, 0x9a, 0xc9, 0x69, 0x05, 0x0a, 0xc0, 0x0a, 0x22, 0x01, 0x88, + 0xa9, 0x40, 0xfa, 0x31, 0xa0, 0x0a, 0x24, 0x10, 0xf9, 0x9c, 0x21, 0x53, 0xb1, 0xad, 0x88, 0x72, + 0x91, 0xa9, 0x89, 0x24, 0x89, 0x81, 0x8b, 0xb8, 0x72, 0x91, 0x81, 0xae, 0x52, 0xa8, 0x22, 0xda, + 0x39, 0x02, 0xa8, 0x89, 0x88, 0x71, 0x94, 0x8b, 0xa8, 0x09, 0x31, 0x16, 0xc9, 0xa9, 0x49, 0x12, + 0xa8, 0x8d, 0x53, 0xa0, 0x8b, 0x88, 0x20, 0x24, 0xcb, 0x10, 0x00, 0xd8, 0x59, 0x84, 0x99, 0x8f, + 0x16, 0xa9, 0x18, 0x88, 0x21, 0xa2, 0xac, 0x41, 0x90, 0x88, 0x0a, 0xb2, 0x4a, 0x16, 0x9a, 0xcb, + 0x40, 0x93, 0xa9, 0x10, 0x01, 0x08, 0x19, 0xf9, 0x5b, 0x80, 0x35, 0xca, 0xab, 0x21, 0x52, 0x04, + 0x9c, 0xc9, 0x39, 0x12, 0x01, 0x80, 0xbb, 0x44, 0xa9, 0x00, 0x9d, 0x61, 0x04, 0xeb, 0x1a, 0x12, + 0x21, 0xc0, 0x8a, 0x08, 0x01, 0x11, 0xcb, 0x18, 0x82, 0x62, 0x82, 0xef, 0x10, 0x12, 0x00, 0xab, + 0x48, 0x81, 0x82, 0x9f, 0x12, 0x18, 0x88, 0x83, 0x9e, 0xa8, 0x71, 0x02, 0xaa, 0x8a, 0x20, 0x02, + 0x18, 0xd8, 0x40, 0xb0, 0x09, 0x89, 0xba, 0x78, 0xa3, 0x33, 0xdd, 0x8b, 0x15, 0x21, 0xc8, 0x18, + 0x9a, 0x05, 0x9c, 0x12, 0x22, 0xb0, 0x09, 0x9c, 0xa8, 0x77, 0xb0, 0x09, 0x80, 0x30, 0xc0, 0x0a, + 0x28, 0x43, 0xe9, 0x1c, 0x04, 0x9c, 0x23, 0x89, 0x80, 0x8a, 0x90, 0x69, 0xb2, 0x0d, 0x44, 0xb0, + 0x9b, 0x19, 0x14, 0x08, 0x11, 0xc2, 0x9f, 0x12, 0x08, 0x41, 0xc2, 0xac, 0x51, 0x90, 0x98, 0x18, + 0x00, 0x22, 0xcc, 0x89, 0x28, 0x27, 0xc9, 0x89, 0x80, 0x38, 0x14, 0xaa, 0x9a, 0x12, 0xb9, 0x73, + 0xe5, 0x09, 0x81, 0x20, 0xb3, 0x8f, 0x22, 0x90, 0x89, 0x81, 0x10, 0x92, 0x9e, 0x34, 0xd1, 0x0b, + 0x02, 0x18, 0x81, 0xac, 0x23, 0x20, 0xf8, 0x0e, 0x23, 0x80, 0xb9, 0x8b, 0x16, 0x98, 0x99, 0x1a, + 0x27, 0x99, 0x9a, 0x60, 0xb0, 0x1b, 0x24, 0x92, 0xcb, 0x0a, 0x46, 0xc0, 0x8a, 0x11, 0x31, 0xc8, + 0x9c, 0x41, 0x93, 0x29, 0xe8, 0x18, 0x8b, 0x24, 0x09, 0x11, 0xa8, 0xbf, 0x31, 0x21, 0xd1, 0x3b, + 0x94, 0x0b, 0x98, 0x08, 0x72, 0x82, 0xca, 0x18, 0x98, 0x29, 0x37, 0xb8, 0xac, 0x00, 0x63, 0xb1, + 0x0c, 0x80, 0x33, 0xa0, 0xba, 0x8d, 0x22, 0x23, 0xa9, 0x51, 0xba, 0xbc, 0x68, 0x83, 0x8b, 0x80, + 0x08, 0x02, 0xf0, 0x2d, 0x85, 0x39, 0xe1, 0x1a, 0x91, 0x01, 0x19, 0x42, 0xb0, 0x9c, 0x98, 0x18, + 0x64, 0x82, 0x99, 0x99, 0xa9, 0x39, 0x47, 0xd0, 0x8b, 0x23, 0xc1, 0x0b, 0x02, 0x02, 0x09, 0x93, + 0xbf, 0x1a, 0x35, 0x21, 0x98, 0xde, 0x18, 0x12, 0x08, 0x80, 0x09, 0x80, 0x30, 0xb9, 0x63, 0xf8, + 0x3a, 0x82, 0x19, 0x93, 0x8d, 0x99, 0x43, 0x12, 0xbf, 0x24, 0xca, 0x38, 0x91, 0x20, 0xa9, 0x9b, + 0x53, 0xa8, 0x13, 0x0c, 0xe3, 0x48, 0xb8, 0x10, 0xbc, 0x44, 0x11, 0xf9, 0x09, 0x12, 0x80, 0x30, + 0xd1, 0x9d, 0x30, 0x35, 0xc8, 0xad, 0x32, 0x91, 0x10, 0xca, 0x11, 0x01, 0x8a, 0x23, 0xac, 0xb9, + 0x72, 0x86, 0xac, 0x00, 0x31, 0x81, 0xaa, 0x8c, 0x20, 0x23, 0x88, 0xd1, 0x1b, 0x25, 0xa9, 0x9a, + 0x21, 0xea, 0x70, 0x95, 0xac, 0x10, 0x20, 0x01, 0x88, 0xaa, 0x1a, 0x26, 0xb8, 0x39, 0xd0, 0x39, + 0x92, 0x30, 0xfa, 0x30, 0xc9, 0x20, 0x01, 0x02, 0xcc, 0x0a, 0x22, 0x88, 0x22, 0x20, 0xfa, 0x9b, + 0x45, 0xb8, 0x18, 0x08, 0x24, 0xea, 0x8a, 0x30, 0x27, 0xca, 0x19, 0x90, 0x8a, 0x46, 0x80, 0xb8, + 0xab, 0x21, 0x34, 0xc1, 0x9f, 0x21, 0x00, 0x82, 0xad, 0x21, 0x80, 0x08, 0x09, 0x12, 0xbb, 0x40, + 0x36, 0xfb, 0x1b, 0x15, 0x98, 0xa9, 0x80, 0x58, 0x05, 0xaa, 0x00, 0x8a, 0x32, 0xb0, 0xab, 0x3a, + 0x06, 0x51, 0xf9, 0x08, 0x09, 0x32, 0x01, 0xea, 0x1b, 0x03, 0x12, 0xba, 0x08, 0x29, 0x44, 0xf9, + 0x0a, 0x00, 0x43, 0x98, 0x91, 0x0e, 0x11, 0x11, 0xda, 0x00, 0x99, 0x72, 0x96, 0xac, 0x11, 0x18, + 0x12, 0x98, 0xbc, 0x50, 0xa0, 0x08, 0x38, 0x86, 0x9c, 0x92, 0x8a, 0x80, 0x44, 0x11, 0xc1, 0xaf, + 0x10, 0x22, 0x82, 0xaa, 0xa8, 0x8a, 0x45, 0x00, 0xb8, 0x8c, 0x24, 0xa0, 0x99, 0x9b, 0x34, 0x02, + 0xb8, 0xcb, 0x39, 0x54, 0xa1, 0x9a, 0x1a, 0x93, 0x78, 0xb7, 0x8e, 0x02, 0x21, 0xb8, 0x80, 0x9a, + 0x12, 0x12, 0xbc, 0x63, 0x90, 0x00, 0xeb, 0x00, 0x09, 0x27, 0x99, 0x8a, 0xa2, 0x1c, 0x17, 0xaa, + 0x18, 0x10, 0x80, 0x89, 0xcc, 0x72, 0x81, 0x80, 0xbc, 0x18, 0x33, 0x83, 0x08, 0xfd, 0x28, 0x12, + 0xa1, 0x0c, 0xc1, 0x59, 0x84, 0x9a, 0x99, 0x11, 0x31, 0xc3, 0x9e, 0x10, 0x32, 0xa1, 0x9d, 0x88, + 0x11, 0x20, 0x85, 0xcc, 0x09, 0x34, 0x12, 0xc8, 0xbe, 0x40, 0x03, 0xa0, 0x1a, 0xc2, 0x1c, 0x04, + 0x88, 0x99, 0x10, 0x43, 0xf8, 0x2a, 0xa1, 0x62, 0xb9, 0x09, 0x09, 0x13, 0x88, 0x09, 0xb0, 0x19, + 0x04, 0x18, 0xc1, 0x4c, 0x07, 0x9c, 0x80, 0x28, 0x13, 0x11, 0xfc, 0x2b, 0x23, 0x92, 0x9c, 0x91, + 0x2a, 0x07, 0x99, 0x08, 0xab, 0x51, 0x92, 0x98, 0xbe, 0x63, 0x11, 0x98, 0xad, 0x18, 0x52, 0xa1, + 0x8a, 0x99, 0x31, 0x11, 0x04, 0xbe, 0x18, 0x23, 0xaa, 0x62, 0xd9, 0x20, 0x81, 0x80, 0xec, 0x48, + 0x03, 0xa8, 0x9b, 0x18, 0x24, 0x88, 0xe9, 0x3a, 0x82, 0x80, 0x18, 0xa3, 0x9e, 0x12, 0x0a, 0x33, + 0xa9, 0x8a, 0x36, 0xf9, 0x9a, 0x71, 0x84, 0x9d, 0x01, 0x80, 0x20, 0x90, 0x8a, 0x01, 0xb9, 0x42, + 0x28, 0xe1, 0x2b, 0x84, 0xba, 0x19, 0x31, 0x38, 0x07, 0xfb, 0x1b, 0x34, 0x88, 0xa8, 0xab, 0x28, + 0x56, 0xc0, 0x8a, 0x01, 0x81, 0x10, 0x91, 0x8d, 0x24, 0x9a, 0x04, 0xbb, 0x18, 0x41, 0xa4, 0x9e, + 0x11, 0x88, 0x51, 0xb1, 0x0f, 0x02, 0x89, 0x10, 0x90, 0x89, 0x13, 0xbd, 0x38, 0x23, 0xc9, 0x70, + 0x92, 0xbf, 0x40, 0x92, 0x28, 0xa8, 0x80, 0x0a, 0x13, 0xea, 0x68, 0xa2, 0x0a, 0x92, 0xaa, 0x61, + 0x82, 0xbb, 0x08, 0x91, 0x2a, 0x47, 0xa8, 0xac, 0x48, 0x02, 0x88, 0xba, 0x29, 0x45, 0xc1, 0x1b, + 0x82, 0x9a, 0x19, 0xa5, 0x4a, 0x82, 0x81, 0xbd, 0x53, 0xea, 0x30, 0x81, 0x00, 0xdb, 0x38, 0x00, + 0x43, 0xc9, 0x89, 0x8a, 0x32, 0x21, 0x10, 0xb1, 0xdf, 0x42, 0xa1, 0xac, 0x59, 0x84, 0x0a, 0xa0, + 0x28, 0x00, 0xca, 0x70, 0x81, 0x98, 0x9c, 0x22, 0x88, 0x90, 0x1a, 0xb1, 0x72, 0xe2, 0x88, 0x29, + 0x13, 0x8b, 0x07, 0xab, 0x08, 0x30, 0x92, 0x12, 0xcf, 0x22, 0x8a, 0x84, 0xac, 0x52, 0xa1, 0x08, + 0x99, 0xa9, 0x62, 0x91, 0x0a, 0x31, 0xfa, 0x1b, 0x24, 0xa1, 0x8a, 0x00, 0x01, 0xcc, 0x70, 0xa4, + 0x0b, 0x92, 0x00, 0x0a, 0x92, 0x2d, 0x86, 0x8b, 0x81, 0x41, 0xcb, 0x28, 0x20, 0x92, 0xab, 0x80, + 0x78, 0x95, 0xac, 0x21, 0x80, 0x51, 0xd8, 0x8a, 0x1a, 0x36, 0xa8, 0x8a, 0x02, 0x8e, 0x23, 0x0a, + 0xa2, 0x0e, 0x14, 0x99, 0x98, 0x1a, 0x03, 0x10, 0xf9, 0x59, 0xb1, 0x3a, 0x82, 0x20, 0xcd, 0x41, + 0x80, 0x09, 0x19, 0xea, 0x52, 0x98, 0x90, 0x0a, 0x81, 0x34, 0xbc, 0x32, 0xa8, 0x99, 0x40, 0xf8, + 0x30, 0xb8, 0x40, 0x00, 0xf1, 0x0d, 0x14, 0x88, 0x99, 0x02, 0x19, 0x91, 0x99, 0x31, 0x21, 0xf3, + 0x9e, 0x41, 0x80, 0x99, 0x32, 0xc8, 0x88, 0x9a, 0x20, 0x28, 0x86, 0x48, 0xd2, 0xac, 0x31, 0x91, + 0x99, 0x22, 0xba, 0x42, 0x01, 0xea, 0x02, 0x1e, 0x94, 0x40, 0xf8, 0x0a, 0x24, 0xa9, 0x30, 0xb3, + 0xbf, 0x32, 0x81, 0x91, 0x8a, 0x20, 0x02, 0xaa, 0xaf, 0x41, 0x32, 0xc0, 0x8d, 0x82, 0x8b, 0x52, + 0x82, 0x9d, 0x12, 0xbc, 0x42, 0x02, 0xac, 0x20, 0x20, 0x94, 0xbe, 0x20, 0x14, 0x90, 0x99, 0xa8, + 0x2a, 0x83, 0x43, 0x01, 0xda, 0x9b, 0x31, 0x81, 0x0a, 0x08, 0x57, 0xd1, 0x9c, 0x10, 0x20, 0x16, + 0xcb, 0x00, 0x88, 0x02, 0xc9, 0x59, 0x83, 0x8b, 0x18, 0x88, 0xb9, 0x39, 0x67, 0xb1, 0x9e, 0x12, + 0x21, 0xc8, 0x1b, 0x14, 0x80, 0xa0, 0xaf, 0x63, 0xa8, 0x49, 0x91, 0xaa, 0x00, 0x10, 0x22, 0xc2, + 0x9f, 0x21, 0x11, 0xc0, 0x9b, 0x51, 0x82, 0x0a, 0xb9, 0x30, 0x01, 0x08, 0xb9, 0x32, 0xfd, 0x38, + 0x15, 0xbc, 0x32, 0xa8, 0x33, 0xda, 0x9c, 0x63, 0x81, 0x9a, 0x19, 0x83, 0xbb, 0x30, 0x83, 0x49, + 0xe1, 0x19, 0x99, 0x81, 0x2c, 0x27, 0xc8, 0x8c, 0x03, 0x10, 0xb2, 0x9c, 0x19, 0x47, 0xa9, 0x89, + 0x89, 0x23, 0x81, 0xa8, 0xa8, 0xaf, 0x26, 0x00, 0x90, 0xbc, 0x38, 0x27, 0xb9, 0x99, 0x18, 0x16, + 0xaa, 0x88, 0x10, 0x82, 0x28, 0xb9, 0xfb, 0x59, 0x04, 0x89, 0xa8, 0x9c, 0x43, 0x01, 0xb1, 0x9e, + 0x10, 0x00, 0x33, 0xfb, 0x30, 0x82, 0xa9, 0x11, 0xca, 0x29, 0x24, 0x08, 0xd3, 0xaf, 0x42, 0x02, + 0xab, 0x89, 0x30, 0x83, 0x9d, 0x11, 0x11, 0xb9, 0x19, 0x91, 0xee, 0x39, 0x15, 0x10, 0xc9, 0x2a, + 0xa3, 0x0c, 0x11, 0x20, 0x26, 0xbc, 0x88, 0x9c, 0x37, 0xa8, 0x89, 0x80, 0x08, 0x21, 0xab, 0x27, + 0xca, 0x39, 0x83, 0xbc, 0x80, 0x48, 0x27, 0xab, 0xab, 0x40, 0x12, 0xa8, 0x40, 0xd8, 0x3a, 0x94, + 0xab, 0x20, 0x14, 0x1a, 0xa3, 0x9e, 0x20, 0x11, 0x22, 0xcc, 0xa8, 0x8f, 0x27, 0xa8, 0x8a, 0x21, + 0x01, 0xb8, 0x9e, 0x23, 0x00, 0x81, 0x39, 0xf1, 0x0d, 0x21, 0x82, 0xbb, 0x88, 0x72, 0x83, 0xda, + 0x8b, 0x41, 0x13, 0xa8, 0x88, 0xcc, 0x30, 0x24, 0xb0, 0xaa, 0x99, 0x58, 0x16, 0xba, 0x8a, 0x35, + 0x00, 0xda, 0x9b, 0x58, 0x15, 0x99, 0x9a, 0x91, 0x1c, 0x17, 0x8b, 0x01, 0x09, 0x90, 0x23, 0xca, + 0x8a, 0x53, 0x91, 0x9a, 0xb9, 0x71, 0x92, 0x99, 0x18, 0xea, 0x61, 0xa1, 0x8b, 0x02, 0x21, 0xa0, + 0xad, 0x14, 0xab, 0x53, 0x91, 0x1a, 0xd9, 0x40, 0x82, 0xda, 0x1a, 0x45, 0xc1, 0x8c, 0x12, 0x91, + 0x2a, 0xb1, 0x48, 0xa8, 0x10, 0x18, 0xd3, 0x0e, 0x11, 0x23, 0xdc, 0x18, 0x90, 0x32, 0xb8, 0x8c, + 0x42, 0x82, 0x99, 0x80, 0xce, 0x62, 0xa1, 0x09, 0x19, 0x93, 0x0f, 0x05, 0x98, 0x89, 0x81, 0x29, + 0xc3, 0x0c, 0x23, 0x80, 0xa8, 0xcc, 0x1a, 0x35, 0x80, 0x08, 0xc9, 0x29, 0x12, 0xa9, 0x8a, 0x53, + 0x81, 0x18, 0xfc, 0x0b, 0x54, 0x02, 0xbc, 0x0a, 0x31, 0x83, 0x2b, 0x87, 0x8d, 0x82, 0x19, 0xa2, + 0x8b, 0x20, 0x36, 0xb9, 0xea, 0x1b, 0x16, 0x80, 0x90, 0x8a, 0x88, 0x21, 0xb2, 0xab, 0x61, 0xa0, + 0x54, 0xda, 0x09, 0x20, 0x23, 0x81, 0xbf, 0x20, 0x80, 0x22, 0xc8, 0x39, 0xc1, 0xcb, 0x78, 0xa4, + 0x0b, 0x22, 0x98, 0x1a, 0xa0, 0x3b, 0x37, 0xeb, 0x38, 0x02, 0xeb, 0x40, 0x90, 0x08, 0xa0, 0x19, + 0x82, 0x19, 0x84, 0xbc, 0x52, 0xba, 0x22, 0xa0, 0x0b, 0x93, 0x5a, 0x15, 0xa9, 0xb1, 0x9f, 0x17, + 0x09, 0xa9, 0x28, 0x00, 0x80, 0x19, 0xb4, 0x0c, 0x14, 0x98, 0xb8, 0x8e, 0x53, 0x04, 0xca, 0x99, + 0x38, 0x94, 0x8a, 0x42, 0xd0, 0x2b, 0x03, 0x8a, 0x83, 0xab, 0x29, 0x06, 0xbe, 0x41, 0x11, 0xa0, + 0x4b, 0xf2, 0x2c, 0x05, 0x8a, 0x10, 0x90, 0x8c, 0x23, 0x98, 0x91, 0x1a, 0xb1, 0x20, 0xdc, 0x51, + 0x12, 0xa0, 0xaf, 0x18, 0x16, 0xb9, 0x21, 0xa9, 0x00, 0x19, 0xa2, 0x2b, 0xa5, 0x49, 0x91, 0xb0, + 0x8f, 0x14, 0x40, 0xe0, 0x0a, 0x82, 0x18, 0x02, 0xb8, 0x09, 0x81, 0xba, 0xaa, 0x77, 0xb1, 0x18, + 0x80, 0x98, 0xae, 0x22, 0x42, 0x92, 0xdc, 0x29, 0x84, 0x9b, 0x41, 0x90, 0x80, 0x18, 0xca, 0x21, + 0x88, 0x35, 0xb8, 0xca, 0x1d, 0x84, 0x2a, 0x14, 0xa0, 0x0c, 0xb2, 0x8c, 0x21, 0x22, 0x26, 0xfb, + 0x1a, 0x02, 0x9a, 0x23, 0x18, 0x81, 0xfb, 0x0c, 0x24, 0x88, 0xb0, 0x50, 0xc8, 0x89, 0x42, 0x91, + 0x8a, 0x08, 0x02, 0xda, 0x70, 0xc0, 0x19, 0x13, 0x89, 0x91, 0x8c, 0x99, 0x45, 0x90, 0x38, 0xc0, + 0xbe, 0x50, 0x84, 0xab, 0x32, 0xb1, 0x8c, 0x10, 0x00, 0x29, 0x86, 0x8a, 0xa1, 0x8e, 0x22, 0x12, + 0xbb, 0x32, 0xb9, 0x08, 0x1b, 0x05, 0x03, 0xbf, 0x61, 0xa0, 0x2b, 0x93, 0x1c, 0x06, 0x8b, 0xa0, + 0x29, 0x02, 0x28, 0x20, 0xfb, 0x21, 0xdc, 0x48, 0x13, 0x99, 0x99, 0x8a, 0x23, 0x13, 0xb8, 0x9f, + 0x93, 0x8e, 0x23, 0x13, 0xdc, 0x29, 0x02, 0x02, 0xbd, 0x23, 0x09, 0x11, 0xc3, 0x8e, 0x14, 0xdb, + 0x30, 0x82, 0x88, 0xba, 0x2a, 0x17, 0x9a, 0x22, 0x20, 0xd0, 0x9b, 0x99, 0x42, 0x73, 0xf2, 0x0a, + 0x80, 0x80, 0x51, 0x92, 0x9a, 0xab, 0x20, 0x21, 0x87, 0x9b, 0x24, 0xd0, 0x8f, 0x13, 0x88, 0x11, + 0xa9, 0x8b, 0x34, 0xa9, 0x32, 0xba, 0x20, 0x00, 0xda, 0x0b, 0x73, 0xa1, 0x0c, 0x26, 0xda, 0x9a, + 0x23, 0x12, 0xc0, 0x29, 0xc2, 0x2c, 0xa4, 0x2c, 0x05, 0xba, 0x19, 0x83, 0x88, 0x00, 0x20, 0x04, + 0xae, 0x00, 0x28, 0x93, 0x3c, 0xf2, 0x59, 0x90, 0x90, 0x8a, 0x51, 0xc8, 0x39, 0x04, 0xc9, 0x9a, + 0x32, 0x23, 0x90, 0xdd, 0x20, 0xb8, 0x30, 0x35, 0xf1, 0x0a, 0x91, 0x28, 0xa0, 0x28, 0x30, 0xd4, + 0x0c, 0x92, 0x38, 0xa2, 0x18, 0xda, 0x29, 0x14, 0xa8, 0x8c, 0x53, 0xa2, 0x8d, 0x12, 0x89, 0xca, + 0x52, 0x00, 0xa3, 0x0d, 0xb8, 0x50, 0xf2, 0x39, 0x84, 0xca, 0x19, 0x02, 0x28, 0x82, 0xbb, 0x1a, + 0x00, 0x37, 0x8b, 0x93, 0x8f, 0x01, 0x32, 0xfa, 0x19, 0x28, 0x03, 0x89, 0xeb, 0x19, 0x35, 0xc1, + 0x0a, 0x83, 0x9c, 0x21, 0x84, 0xbb, 0x99, 0x71, 0x94, 0x9b, 0x9a, 0x64, 0x90, 0x99, 0x0b, 0x22, + 0x28, 0x23, 0xac, 0xd9, 0x3b, 0x16, 0x08, 0xa0, 0x0b, 0x91, 0x50, 0x01, 0xa9, 0x49, 0xf0, 0x1a, + 0x11, 0x08, 0x06, 0xcb, 0x10, 0x99, 0x58, 0x93, 0x8b, 0x38, 0xb2, 0x4a, 0xe9, 0x48, 0xa2, 0x1a, + 0x81, 0x08, 0x8c, 0x37, 0x9e, 0x81, 0x00, 0x11, 0x10, 0xfa, 0x19, 0x22, 0x90, 0x10, 0xfb, 0x18, + 0x11, 0x23, 0xca, 0xba, 0x4a, 0x35, 0xc0, 0x0e, 0x01, 0x20, 0xa0, 0x0a, 0x01, 0x8c, 0x24, 0xa1, + 0x9d, 0x21, 0x80, 0x99, 0x15, 0xaa, 0x10, 0x13, 0xcf, 0x30, 0x82, 0x18, 0x00, 0xe1, 0x4b, 0x93, + 0xbb, 0x40, 0xc8, 0x51, 0x92, 0xda, 0x19, 0x25, 0xa9, 0x8a, 0x80, 0x11, 0x88, 0x61, 0xf9, 0x49, + 0x92, 0x09, 0xa0, 0xcb, 0x78, 0x85, 0x0a, 0x91, 0x9b, 0x30, 0x84, 0x09, 0x98, 0x8a, 0x8a, 0x46, + 0xc9, 0x18, 0x81, 0x88, 0x01, 0xcd, 0x73, 0xa1, 0x88, 0x89, 0x82, 0x89, 0x12, 0x18, 0xba, 0x18, + 0xb0, 0x72, 0xb8, 0x1d, 0x86, 0x0a, 0x11, 0x88, 0xba, 0x01, 0x7a, 0xa7, 0x0b, 0x02, 0x10, 0xbd, + 0x53, 0x90, 0x9b, 0x31, 0x98, 0x14, 0x9e, 0x32, 0xa9, 0x88, 0x23, 0xbf, 0x33, 0xb9, 0x72, 0xa1, + 0xac, 0x30, 0xb3, 0x2b, 0x04, 0xb9, 0x50, 0x80, 0xc9, 0x1c, 0x14, 0x90, 0x8a, 0x22, 0xd9, 0x09, + 0x55, 0xc8, 0x1a, 0x92, 0x58, 0xb1, 0x8c, 0x31, 0x02, 0xc9, 0x8a, 0x12, 0xda, 0x50, 0x03, 0xa9, + 0x1a, 0xa2, 0x1c, 0x89, 0x27, 0x08, 0xd9, 0x09, 0x91, 0x19, 0x55, 0xb1, 0x9e, 0x81, 0x28, 0x05, + 0xba, 0x31, 0xc1, 0x0b, 0x41, 0xb0, 0x38, 0xa3, 0x59, 0xfa, 0x3a, 0x03, 0x01, 0xab, 0x91, 0x8c, + 0x23, 0x18, 0x98, 0x01, 0x9f, 0x24, 0xc9, 0x19, 0xa0, 0x79, 0x83, 0x8a, 0xa0, 0xad, 0x54, 0xa1, + 0x8a, 0x82, 0x29, 0xa2, 0x0c, 0x02, 0xa9, 0x71, 0xb1, 0x1a, 0xa8, 0x9a, 0x56, 0xb1, 0x1c, 0xa1, + 0x20, 0x0b, 0x07, 0x1a, 0xb1, 0x0b, 0xb2, 0x3c, 0x07, 0x18, 0xbc, 0x41, 0xb2, 0x0f, 0x83, 0x2a, + 0x04, 0xba, 0x20, 0x91, 0x8b, 0x91, 0x59, 0xb3, 0x1d, 0x23, 0xa8, 0xbf, 0x44, 0x88, 0x90, 0x88, + 0xab, 0x73, 0xb1, 0x48, 0xa1, 0xad, 0x20, 0x80, 0x30, 0x82, 0xaa, 0x1c, 0x15, 0xb9, 0xab, 0x74, + 0xa1, 0x89, 0x98, 0x1a, 0x17, 0xaa, 0x32, 0xc9, 0xaa, 0x62, 0x13, 0xda, 0x1a, 0x01, 0x24, 0xbc, + 0x11, 0x8a, 0x82, 0x60, 0xe8, 0x18, 0x91, 0x28, 0x91, 0x90, 0x9c, 0x32, 0x07, 0xab, 0xb8, 0x4b, + 0x17, 0x99, 0x99, 0x38, 0xb3, 0x9b, 0x70, 0x93, 0x8a, 0x80, 0xa8, 0x50, 0x01, 0x88, 0x91, 0xdf, + 0x30, 0x83, 0x8c, 0x01, 0x01, 0x0c, 0x15, 0xac, 0x30, 0xb2, 0x49, 0xb3, 0xcf, 0x51, 0x81, 0xa9, + 0x19, 0x83, 0x9a, 0x60, 0xb1, 0x8d, 0x23, 0x00, 0x00, 0xfa, 0x09, 0x23, 0x01, 0xb9, 0x89, 0x19, + 0x42, 0x03, 0xfb, 0x0c, 0x23, 0x01, 0xeb, 0x28, 0x80, 0x52, 0xb0, 0xac, 0x1a, 0x27, 0x98, 0xb8, + 0x0b, 0x63, 0x01, 0xa1, 0xcd, 0x38, 0x13, 0x90, 0x9a, 0x99, 0x49, 0x17, 0xba, 0x19, 0x11, 0x02, + 0x9b, 0xb2, 0x8f, 0x14, 0x52, 0xc0, 0xac, 0x30, 0x04, 0xa8, 0x9c, 0x31, 0x83, 0x98, 0xbd, 0x00, + 0x73, 0x91, 0x99, 0x9a, 0x19, 0x64, 0x91, 0x08, 0xeb, 0x18, 0x31, 0xb2, 0x9c, 0x21, 0x01, 0x04, + 0xbe, 0x28, 0x33, 0xb1, 0x9d, 0x88, 0x73, 0xb0, 0x09, 0x01, 0x9c, 0x31, 0x92, 0x08, 0xbe, 0x61, + 0x01, 0x80, 0xbc, 0x48, 0x12, 0xaa, 0x08, 0x20, 0x04, 0xdb, 0x1b, 0x03, 0x55, 0xc8, 0x0b, 0x82, + 0x0c, 0x44, 0x90, 0xe8, 0x1c, 0x14, 0x80, 0xa9, 0x8a, 0x50, 0x03, 0xba, 0x9a, 0x32, 0x01, 0x12, + 0xcc, 0x8c, 0x44, 0xa1, 0x89, 0xb9, 0x58, 0x12, 0x81, 0xcd, 0x88, 0x58, 0x24, 0xca, 0xaa, 0x31, + 0x24, 0xe0, 0x1b, 0x02, 0x10, 0xa0, 0x0a, 0xb9, 0x61, 0x11, 0x82, 0xaf, 0x18, 0x22, 0xb0, 0x1b, + 0xc2, 0x70, 0x82, 0xda, 0x8a, 0x43, 0x13, 0xea, 0x8a, 0x18, 0x34, 0x00, 0xbb, 0x8a, 0x20, 0x33, + 0x10, 0xfb, 0x1f, 0x13, 0x09, 0xc8, 0x2a, 0xa3, 0x62, 0xc8, 0x8b, 0x41, 0x14, 0xab, 0x08, 0x99, + 0x31, 0x04, 0xcd, 0x20, 0x80, 0x28, 0x13, 0xcd, 0x0a, 0x51, 0x04, 0xcb, 0x89, 0x43, 0x91, 0x99, + 0x88, 0x09, 0x82, 0xaa, 0x63, 0xa2, 0x5a, 0xd2, 0x8e, 0x21, 0x21, 0x81, 0xea, 0x8b, 0x23, 0x20, + 0x92, 0xcc, 0x2a, 0x25, 0x98, 0x9b, 0x30, 0x24, 0xe9, 0x1b, 0xb2, 0x6a, 0x05, 0x98, 0xdb, 0x28, + 0x13, 0x11, 0xbd, 0x28, 0x28, 0x13, 0x80, 0xfb, 0x2b, 0x11, 0x63, 0xd0, 0x9c, 0x23, 0x01, 0x09, + 0xa8, 0x8d, 0x14, 0x80, 0x88, 0x9a, 0x21, 0x20, 0xa1, 0xba, 0x9a, 0x78, 0x97, 0x8b, 0x01, 0x00, + 0x10, 0x04, 0xff, 0x40, 0x81, 0x8a, 0x80, 0x08, 0x11, 0x98, 0x18, 0x98, 0x10, 0x9a, 0x34, 0xfb, + 0x39, 0x24, 0xd0, 0x8e, 0x11, 0x12, 0x01, 0xdc, 0x19, 0x33, 0xa1, 0xaa, 0x99, 0x60, 0x91, 0x30, + 0xf9, 0x1b, 0x22, 0x22, 0x89, 0xfb, 0x0a, 0x44, 0xa0, 0x1a, 0x98, 0x29, 0x05, 0xdc, 0x49, 0x04, + 0x0a, 0x99, 0x08, 0x09, 0x22, 0x12, 0xb1, 0xcf, 0x30, 0x03, 0xa8, 0x99, 0x30, 0xa1, 0xcb, 0x79, + 0x82, 0x09, 0x98, 0x00, 0xbe, 0x44, 0x80, 0x9b, 0x12, 0x9a, 0x63, 0xb0, 0xab, 0x38, 0x14, 0x21, + 0xe9, 0xcc, 0x71, 0x83, 0xbb, 0x29, 0x91, 0x38, 0x84, 0xaa, 0x98, 0x31, 0x10, 0x04, 0xdf, 0x10, + 0x21, 0x93, 0x9e, 0x10, 0x80, 0x41, 0xb1, 0xbe, 0x39, 0x27, 0xc8, 0x08, 0x88, 0x80, 0x30, 0xa2, + 0x9b, 0xc8, 0x71, 0x83, 0xaa, 0x00, 0x88, 0x90, 0x34, 0xbd, 0x32, 0xf9, 0x39, 0x84, 0x8a, 0x10, + 0xaa, 0x08, 0x51, 0x04, 0xbb, 0x80, 0xcb, 0x72, 0xb3, 0x1b, 0xb8, 0x73, 0xb1, 0x1b, 0xb0, 0x61, + 0x02, 0xd9, 0x1a, 0xa1, 0x60, 0x82, 0xab, 0xab, 0x62, 0x12, 0x90, 0xbb, 0x1c, 0x26, 0xa8, 0x20, + 0xca, 0x8a, 0x73, 0x91, 0xaa, 0x30, 0xb1, 0x2a, 0xc1, 0x8a, 0x52, 0x24, 0xea, 0x89, 0x80, 0x40, + 0x13, 0xbb, 0x8a, 0x83, 0x0d, 0x04, 0x23, 0xba, 0xac, 0x00, 0x00, 0x0b, 0x37, 0x83, 0x9b, 0xfa, + 0x0c, 0x24, 0x20, 0xb9, 0x23, 0xae, 0x91, 0x39, 0x14, 0xa8, 0x9e, 0x00, 0x18, 0x33, 0xd8, 0x30, + 0xd2, 0x1b, 0x13, 0xe9, 0x0c, 0x24, 0x02, 0xb9, 0xaa, 0x1a, 0x36, 0xb9, 0x11, 0x13, 0xbc, 0x09, + 0x04, 0xac, 0x60, 0xa0, 0x44, 0xfb, 0x09, 0x21, 0x84, 0x1a, 0xc0, 0x0a, 0x11, 0x82, 0x0a, 0x04, + 0xcb, 0x00, 0xdb, 0x51, 0x82, 0x88, 0x28, 0xb2, 0x0e, 0x98, 0x72, 0xa1, 0x8a, 0x30, 0x01, 0xca, + 0x18, 0xab, 0x57, 0xb9, 0x39, 0xb1, 0x4a, 0x81, 0x09, 0x98, 0x00, 0x8e, 0x14, 0x9c, 0x12, 0x22, + 0x92, 0xed, 0x0a, 0x22, 0x03, 0xeb, 0x61, 0xa0, 0x08, 0x9b, 0x42, 0x02, 0x09, 0xc9, 0x0c, 0x85, + 0x8a, 0x26, 0xb9, 0x9a, 0x31, 0x01, 0x91, 0xbf, 0x43, 0x00, 0xa0, 0x0c, 0x90, 0x51, 0x93, 0xad, + 0x08, 0x03, 0x1b, 0x84, 0x8b, 0x91, 0x2c, 0x27, 0x9a, 0xca, 0x39, 0x25, 0x81, 0xac, 0x89, 0x16, + 0x9b, 0x81, 0x38, 0x83, 0x9c, 0x90, 0x68, 0xd2, 0x29, 0x22, 0xc1, 0xaf, 0x23, 0x89, 0x00, 0x08, + 0x88, 0x34, 0xdc, 0x18, 0x28, 0x83, 0xaa, 0x2a, 0x02, 0x22, 0xbe, 0x51, 0xa1, 0x9c, 0x01, 0x60, + 0xd1, 0x8a, 0x62, 0x82, 0xac, 0x11, 0x90, 0xa9, 0x20, 0x33, 0xb2, 0x8d, 0xa3, 0x0e, 0x92, 0x40, + 0x93, 0xcb, 0x8b, 0x42, 0x13, 0x88, 0xf1, 0x8d, 0x20, 0x23, 0xb9, 0x0e, 0x24, 0x80, 0xcb, 0x88, + 0x33, 0x08, 0xa9, 0x43, 0xbd, 0x22, 0x62, 0xf1, 0x0b, 0x12, 0x81, 0x8a, 0x92, 0x0c, 0x93, 0x3d, + 0x87, 0x8a, 0x98, 0x23, 0xa0, 0xbc, 0x70, 0x83, 0xba, 0x19, 0xa2, 0x4b, 0x84, 0x8b, 0x80, 0x18, + 0xa3, 0x8c, 0x06, 0x19, 0x13, 0xdb, 0x0a, 0x81, 0x2c, 0x47, 0xa8, 0xda, 0x38, 0x10, 0x92, 0x8b, + 0x82, 0x1e, 0x05, 0x8b, 0x81, 0x1a, 0x88, 0x43, 0xb8, 0xbe, 0x61, 0xa3, 0x09, 0xb8, 0x20, 0x24, + 0xb8, 0x9f, 0x11, 0x22, 0x99, 0x91, 0x9c, 0x9a, 0x73, 0xa5, 0x18, 0xfa, 0x38, 0x01, 0x20, 0xd8, + 0x2b, 0x13, 0x90, 0xad, 0x21, 0x01, 0x80, 0x9d, 0x32, 0x02, 0xdd, 0x40, 0x91, 0xaa, 0x31, 0x91, + 0x81, 0xdb, 0x50, 0x82, 0x99, 0x09, 0xb8, 0x21, 0x4b, 0x27, 0x0d, 0xa1, 0x1b, 0xb0, 0x70, 0x04, + 0xaa, 0x8a, 0x02, 0x08, 0x18, 0x13, 0xcc, 0x90, 0x69, 0x84, 0xba, 0x1a, 0x24, 0x81, 0xcd, 0x48, + 0xb1, 0x49, 0x03, 0xfa, 0x29, 0xb1, 0x38, 0x13, 0xa0, 0xab, 0x60, 0xa3, 0x9f, 0x04, 0x18, 0x92, + 0x8c, 0xa8, 0x58, 0x82, 0x99, 0x40, 0xf8, 0x29, 0x81, 0x88, 0x28, 0xa4, 0x0d, 0x03, 0xba, 0x40, + 0xb0, 0x30, 0xa3, 0x0b, 0xfb, 0x63, 0xb9, 0x38, 0x83, 0x89, 0xc8, 0x9d, 0x52, 0x13, 0x09, 0xf8, + 0x0a, 0x82, 0x20, 0x83, 0x9c, 0x11, 0xa0, 0x0d, 0xa2, 0x59, 0x92, 0x30, 0xc9, 0xbd, 0x41, 0x43, + 0xe9, 0x18, 0x98, 0x28, 0x02, 0x8a, 0xa0, 0x79, 0x13, 0xc9, 0xac, 0x59, 0x84, 0x08, 0x80, 0xba, + 0x1b, 0x20, 0x37, 0xd9, 0x39, 0xa2, 0x0c, 0x01, 0xa8, 0x50, 0x83, 0xcb, 0x28, 0xa0, 0x19, 0x34, + 0xe9, 0x28, 0xb3, 0x3a, 0xc3, 0x0e, 0x13, 0x92, 0xac, 0x99, 0x50, 0x02, 0x01, 0xaa, 0xeb, 0x51, + 0x92, 0x9d, 0x32, 0xa2, 0x29, 0xf2, 0x1a, 0x01, 0x19, 0x03, 0xd0, 0x9e, 0x14, 0x08, 0x04, 0xea, + 0x19, 0x82, 0x18, 0x92, 0xbb, 0x63, 0xb0, 0x08, 0x90, 0x29, 0xf0, 0x59, 0x82, 0x0a, 0x98, 0x31, + 0xa1, 0xaa, 0x80, 0xab, 0x55, 0xca, 0x75, 0xc0, 0x0a, 0x01, 0x19, 0x02, 0xa9, 0x09, 0x13, 0xba, + 0x52, 0xa8, 0x99, 0x32, 0x81, 0xfd, 0x1a, 0x16, 0x18, 0xa0, 0xb9, 0x9d, 0x34, 0x82, 0x99, 0x09, + 0xcb, 0x74, 0xa0, 0x09, 0x90, 0x19, 0x26, 0xea, 0x2a, 0x82, 0x30, 0xb2, 0xac, 0x38, 0xa1, 0x41, + 0xb1, 0x8c, 0x12, 0x41, 0xd2, 0xae, 0x28, 0x05, 0x00, 0xaa, 0x9a, 0x43, 0x18, 0x01, 0xaa, 0x0e, + 0x23, 0x88, 0xac, 0x42, 0x98, 0x43, 0xd9, 0x9c, 0x41, 0x82, 0x21, 0xd8, 0x9b, 0x39, 0x07, 0x9a, + 0x21, 0x90, 0x1b, 0xa2, 0x8f, 0x84, 0x18, 0x00, 0x82, 0xae, 0x0a, 0x35, 0xa0, 0x9b, 0x11, 0x21, + 0xeb, 0x32, 0xa9, 0x71, 0xc1, 0x1a, 0xa0, 0x91, 0x78, 0xa2, 0x19, 0x80, 0xaa, 0x89, 0x12, 0x60, + 0x93, 0x1c, 0xf2, 0x2b, 0x93, 0x80, 0x08, 0xb0, 0x21, 0x9a, 0x19, 0x64, 0x92, 0x9d, 0x41, 0xe9, + 0x1a, 0x53, 0xa0, 0x09, 0xda, 0x48, 0x83, 0x1a, 0xa0, 0x0a, 0x22, 0x89, 0x37, 0xec, 0x39, 0x13, + 0xba, 0x0a, 0x21, 0x80, 0x42, 0xb9, 0xca, 0x2b, 0x47, 0xa1, 0xad, 0x28, 0x14, 0x8a, 0x80, 0xbb, + 0x50, 0x82, 0x39, 0xc9, 0x8b, 0x64, 0x91, 0x9a, 0x09, 0x02, 0xb8, 0x70, 0xa8, 0x18, 0x04, 0xbc, + 0x28, 0x21, 0x82, 0x10, 0x8a, 0xc8, 0x31, 0xbf, 0x64, 0x81, 0xbd, 0x38, 0x82, 0x8b, 0x25, 0x98, + 0x91, 0xdf, 0x21, 0x02, 0xa8, 0x10, 0x9a, 0x12, 0x8b, 0x07, 0x9a, 0x11, 0x88, 0x88, 0x48, 0xe0, + 0x39, 0x05, 0x99, 0x99, 0xc8, 0x6a, 0x05, 0xaa, 0x28, 0xa2, 0x39, 0xe0, 0x28, 0xb1, 0x0d, 0x24, + 0xa0, 0x9c, 0x02, 0x29, 0x85, 0x90, 0x9d, 0x31, 0xb1, 0x8a, 0x53, 0x92, 0xab, 0x18, 0x01, 0xbe, + 0x73, 0xa1, 0x58, 0xc1, 0x9b, 0x33, 0xb0, 0x43, 0xda, 0x89, 0x00, 0xbb, 0x75, 0x81, 0xaa, 0x1a, + 0x82, 0x48, 0xd1, 0x29, 0x82, 0x80, 0xca, 0x20, 0x02, 0x81, 0x8f, 0x83, 0xad, 0x62, 0x91, 0x09, + 0x92, 0x9d, 0x34, 0xb9, 0x18, 0xb0, 0x1b, 0x57, 0xa9, 0x09, 0x80, 0x18, 0xb0, 0x30, 0x84, 0xbd, + 0x30, 0x22, 0xa3, 0x9f, 0x90, 0x30, 0xc1, 0x2a, 0x85, 0x09, 0x08, 0xb3, 0x1c, 0xe1, 0x29, 0x15, + 0xa1, 0xad, 0x22, 0x4b, 0x07, 0xab, 0x98, 0x11, 0x11, 0x10, 0x98, 0xca, 0x1b, 0x37, 0x88, 0xba, + 0x9a, 0x61, 0x84, 0xba, 0x0a, 0x33, 0x98, 0x41, 0xfb, 0x1b, 0x22, 0x21, 0x93, 0xad, 0x0c, 0x25, + 0x89, 0x82, 0xba, 0x9b, 0x47, 0x99, 0x90, 0x2b, 0x07, 0x8c, 0x00, 0x02, 0x8c, 0x13, 0x09, 0xa0, + 0x1c, 0x03, 0x80, 0xad, 0x22, 0xc9, 0x51, 0x88, 0x98, 0x39, 0xfb, 0x51, 0x00, 0x90, 0x0a, 0xd9, + 0x28, 0x00, 0x47, 0xaa, 0xba, 0x68, 0x82, 0x08, 0x80, 0xba, 0x58, 0x80, 0x88, 0x21, 0x29, 0xf3, + 0x8c, 0x82, 0x2b, 0x06, 0x89, 0x98, 0x88, 0x8a, 0x37, 0xb0, 0xbd, 0x38, 0x17, 0xa0, 0x8b, 0x11, + 0x0a, 0x04, 0x1a, 0xc1, 0x0a, 0x01, 0x30, 0x93, 0xcc, 0x61, 0xa0, 0x08, 0xaa, 0x42, 0x29, 0x97, + 0x0c, 0xb0, 0x78, 0xc2, 0x1a, 0x02, 0x89, 0x0a, 0x81, 0x59, 0xb2, 0x2b, 0x13, 0xc9, 0xac, 0x71, + 0x83, 0xba, 0xab, 0x74, 0x90, 0x80, 0x9a, 0x22, 0x08, 0x98, 0x99, 0x38, 0x16, 0xa8, 0xce, 0x48, + 0x92, 0x30, 0x90, 0xeb, 0x19, 0x11, 0x45, 0xc0, 0x8c, 0x08, 0x24, 0xa8, 0xba, 0x71, 0xb1, 0x09, + 0x81, 0x10, 0x88, 0x11, 0xc8, 0xab, 0x22, 0x51, 0x05, 0xad, 0x89, 0x50, 0x02, 0xcb, 0x28, 0x91, + 0x40, 0xa1, 0xa8, 0x1b, 0x86, 0x9b, 0x25, 0xaa, 0x99, 0x54, 0xa8, 0x88, 0x09, 0x2a, 0x37, 0xbf, + 0x11, 0x31, 0xd1, 0x19, 0x88, 0x82, 0x0b, 0x04, 0x9a, 0x18, 0x22, 0x9a, 0xa2, 0x9f, 0x17, 0x9b, + 0x11, 0x80, 0xa9, 0x30, 0x14, 0xdc, 0x30, 0x9a, 0x46, 0xea, 0x10, 0x81, 0x81, 0x9a, 0x80, 0x19, + 0x04, 0x18, 0xd1, 0x8d, 0x32, 0x91, 0x88, 0xdb, 0x49, 0x07, 0x9a, 0x00, 0x09, 0x88, 0x42, 0xc8, + 0x31, 0xcd, 0x43, 0x90, 0xc9, 0x49, 0x82, 0x98, 0x89, 0xb9, 0x71, 0x95, 0x8a, 0xb8, 0x40, 0x80, + 0x11, 0x81, 0xcc, 0x39, 0x03, 0x88, 0xab, 0x10, 0x62, 0xe1, 0x0b, 0x14, 0x00, 0x90, 0xab, 0x08, + 0x81, 0x62, 0x02, 0xfb, 0x2a, 0x13, 0x08, 0xb1, 0x9f, 0x61, 0x92, 0x9a, 0x98, 0x28, 0x22, 0x90, + 0x9d, 0x92, 0x5b, 0xa3, 0x9e, 0x33, 0xa8, 0x38, 0xb3, 0x9c, 0x0b, 0x14, 0x78, 0x86, 0xaf, 0x31, + 0x81, 0x9a, 0x01, 0x0a, 0x22, 0xa0, 0x9b, 0x30, 0x98, 0x43, 0x08, 0xd1, 0x9f, 0x12, 0x31, 0x83, + 0xbf, 0x39, 0x04, 0xa8, 0xaa, 0x63, 0xb1, 0x0a, 0x08, 0x24, 0xcb, 0x0a, 0x44, 0xb0, 0x8d, 0x23, + 0x98, 0x80, 0xac, 0x62, 0x92, 0x9b, 0x00, 0x42, 0xe0, 0x0c, 0x13, 0x30, 0xc9, 0x09, 0x8b, 0x44, + 0x82, 0xc9, 0x0a, 0x90, 0x71, 0xa2, 0x99, 0x29, 0xf9, 0x78, 0xa2, 0x9b, 0x28, 0x23, 0x91, 0xbb, + 0xac, 0x71, 0xa3, 0x1c, 0x93, 0x8b, 0x21, 0x12, 0xca, 0x9a, 0x68, 0x84, 0x89, 0xc9, 0x28, 0x10, + 0x17, 0xbb, 0x29, 0x80, 0x10, 0x13, 0x9e, 0x11, 0x3a, 0xa4, 0x89, 0xcd, 0x31, 0x20, 0x05, 0xdb, + 0x09, 0x10, 0x21, 0x00, 0xba, 0x80, 0x31, 0xda, 0x08, 0x10, 0x61, 0x83, 0xaa, 0xce, 0x68, 0xa2, + 0x6b, 0xa3, 0x0b, 0xab, 0x17, 0x99, 0x10, 0x11, 0xb9, 0x0b, 0xa8, 0x62, 0x31, 0xe9, 0x39, 0xa1, + 0x99, 0x0b, 0x22, 0x36, 0xb8, 0x9b, 0xd9, 0x69, 0x81, 0x24, 0xbb, 0xc9, 0x3a, 0x17, 0xa8, 0x89, + 0x20, 0x81, 0x21, 0xfc, 0x30, 0xd1, 0x58, 0xa2, 0x8d, 0x01, 0x00, 0x19, 0x02, 0x8b, 0xa9, 0x52, + 0xa9, 0x91, 0x3b, 0x07, 0x9a, 0x93, 0x2d, 0xb2, 0x4b, 0x82, 0x80, 0x11, 0xbf, 0x33, 0x9b, 0x14, + 0x1a, 0xc3, 0x0d, 0x11, 0x12, 0xbc, 0x33, 0x9c, 0x24, 0xd9, 0x8b, 0x73, 0xa1, 0x29, 0xa0, 0xaa, + 0x08, 0x45, 0xb8, 0x28, 0xf0, 0x29, 0x80, 0x04, 0xac, 0x21, 0x01, 0x89, 0x91, 0xac, 0x42, 0x03, + 0x9b, 0x27, 0xbf, 0x41, 0x91, 0x89, 0x00, 0x8b, 0x26, 0xca, 0x10, 0x81, 0x80, 0x38, 0xf2, 0x1d, + 0x82, 0x18, 0x21, 0xd9, 0x1b, 0x02, 0x21, 0xd0, 0x1a, 0x12, 0xd0, 0x49, 0x92, 0x09, 0xa8, 0x8a, + 0x25, 0x98, 0x89, 0x91, 0x0a, 0x47, 0xc0, 0x0a, 0x11, 0xba, 0x73, 0xa9, 0x00, 0x9b, 0x36, 0x80, + 0xfa, 0x2a, 0x85, 0x29, 0xd8, 0x18, 0x10, 0x80, 0x20, 0xf2, 0x0c, 0x03, 0x00, 0x19, 0xe0, 0x2c, + 0x15, 0x98, 0x99, 0x10, 0x9a, 0x34, 0x8a, 0xa8, 0x11, 0x8a, 0x32, 0xb9, 0x34, 0xff, 0x21, 0x01, + 0xa8, 0x8a, 0x31, 0x84, 0xb8, 0x9e, 0x23, 0x98, 0x08, 0x18, 0x13, 0xcf, 0x50, 0x81, 0xaa, 0x09, + 0x35, 0xa8, 0xb8, 0x2b, 0xa0, 0x67, 0xb0, 0x9b, 0x21, 0x93, 0x0b, 0x14, 0x99, 0xfa, 0x30, 0x80, + 0x13, 0xbc, 0x81, 0x43, 0xcd, 0x21, 0x11, 0xa2, 0x9f, 0x02, 0x21, 0xe9, 0x28, 0x82, 0x98, 0x8a, + 0x10, 0x33, 0xb0, 0x0b, 0xfa, 0x20, 0x18, 0x16, 0xab, 0x99, 0x29, 0x13, 0x52, 0xc8, 0xda, 0x6b, + 0x16, 0xca, 0x28, 0x91, 0x00, 0x09, 0x90, 0x0a, 0x03, 0x8a, 0x34, 0xd8, 0x8d, 0x22, 0x21, 0xe9, + 0x30, 0xa8, 0x98, 0x29, 0xa4, 0x4a, 0xd0, 0x40, 0xd9, 0x31, 0xa0, 0x08, 0x10, 0xa1, 0x0a, 0x38, + 0x27, 0xaf, 0x22, 0xaa, 0x30, 0xb3, 0x0f, 0x85, 0x9a, 0x02, 0x00, 0x11, 0xcb, 0x99, 0x53, 0x98, + 0xa2, 0x69, 0xda, 0x20, 0x80, 0x32, 0xf9, 0x1a, 0x01, 0x02, 0x89, 0x92, 0x9b, 0x68, 0xc1, 0x22, + 0xaf, 0x32, 0x01, 0xbb, 0x01, 0x28, 0x25, 0xfa, 0x0a, 0x11, 0x43, 0xa9, 0x88, 0xfb, 0x58, 0x12, + 0xb0, 0x8e, 0x02, 0x8b, 0x34, 0x9a, 0xa0, 0x30, 0xc2, 0x0c, 0x90, 0x72, 0x80, 0x90, 0x9a, 0x09, + 0x34, 0x90, 0xdb, 0x38, 0x82, 0x19, 0xb3, 0xbf, 0x54, 0x82, 0xba, 0x0b, 0x23, 0x8d, 0x25, 0xa8, + 0xaa, 0x18, 0x92, 0x00, 0x5b, 0xd1, 0x58, 0xa1, 0xab, 0x40, 0x93, 0x3c, 0xa3, 0xb9, 0x9f, 0x16, + 0x19, 0xb0, 0x38, 0xc0, 0x51, 0xb8, 0x08, 0x90, 0x21, 0xa8, 0x01, 0x98, 0x0d, 0xa1, 0x64, 0xb9, + 0x09, 0xaa, 0x33, 0x59, 0x87, 0x0c, 0x93, 0x9e, 0x20, 0x13, 0x88, 0xbc, 0x28, 0x03, 0x41, 0xe1, + 0x8b, 0x10, 0x22, 0x91, 0x8a, 0x88, 0x01, 0x8a, 0x83, 0xbb, 0x79, 0xa4, 0x61, 0xfb, 0x29, 0x34, + 0xa0, 0xdc, 0x09, 0x33, 0x01, 0xa9, 0x81, 0x9e, 0x32, 0x00, 0xa9, 0x29, 0xc8, 0x27, 0x9a, 0xf9, + 0x69, 0x93, 0x8b, 0x89, 0x21, 0x81, 0x12, 0xba, 0xba, 0x73, 0xc1, 0x29, 0xb1, 0x88, 0x18, 0x26, + 0xa9, 0xcc, 0x61, 0x82, 0xa9, 0x88, 0x0a, 0x25, 0x98, 0x09, 0xa9, 0xcb, 0x70, 0x83, 0xab, 0x29, + 0x04, 0x9a, 0x42, 0xb1, 0x0d, 0x22, 0xb9, 0x99, 0x48, 0x86, 0x2a, 0xb0, 0xaa, 0x78, 0xa3, 0x19, + 0x8a, 0x07, 0xab, 0x10, 0x03, 0xad, 0x32, 0xc1, 0x0a, 0x1a, 0x36, 0xa0, 0xab, 0x0c, 0x07, 0x19, + 0xd1, 0x1b, 0x24, 0x90, 0x99, 0x90, 0x9e, 0x43, 0x83, 0x19, 0xf9, 0x4a, 0x90, 0x11, 0x89, 0xa0, + 0x29, 0x05, 0xcc, 0x50, 0x81, 0x9b, 0x23, 0xba, 0x80, 0x71, 0xc1, 0x08, 0xa9, 0x32, 0xa2, 0x0c, + 0xb3, 0x6a, 0x92, 0x8d, 0x12, 0x08, 0xb8, 0x28, 0x91, 0x8c, 0x17, 0x8c, 0x92, 0x4a, 0x91, 0x31, + 0xbc, 0x21, 0x19, 0x84, 0x8f, 0x02, 0x9a, 0x48, 0x85, 0xbc, 0x38, 0x82, 0x20, 0xaa, 0x81, 0xac, + 0x27, 0xba, 0x53, 0xca, 0x00, 0x39, 0x93, 0xcd, 0x68, 0x83, 0xab, 0x32, 0xda, 0x30, 0x83, 0xbd, + 0x52, 0xb8, 0x18, 0x02, 0x89, 0x98, 0xa8, 0x79, 0x94, 0xad, 0x50, 0x92, 0x89, 0xa0, 0x10, 0xa9, + 0x81, 0x5b, 0x05, 0x8a, 0x89, 0x11, 0x92, 0x8f, 0x14, 0x98, 0xbb, 0x33, 0x80, 0x17, 0xad, 0x21, + 0x80, 0xba, 0x51, 0x90, 0x20, 0xb9, 0x18, 0xa1, 0x1d, 0x85, 0x88, 0x8b, 0x10, 0x32, 0xad, 0x37, + 0xbb, 0x89, 0x44, 0xb1, 0x9d, 0x42, 0x90, 0x9a, 0x80, 0x38, 0x26, 0xd9, 0x9c, 0x32, 0x89, 0x24, + 0x98, 0xb9, 0x89, 0x19, 0x21, 0x27, 0xaf, 0x22, 0x81, 0xdb, 0x28, 0x82, 0x63, 0xd9, 0x09, 0x10, + 0x00, 0x01, 0x09, 0x80, 0xfa, 0x5a, 0x83, 0x99, 0x9b, 0x44, 0xb0, 0xa9, 0x38, 0x84, 0xa9, 0x41, + 0xb1, 0x19, 0xec, 0x38, 0x04, 0x08, 0xb1, 0x8a, 0xaa, 0x71, 0x95, 0x1b, 0x81, 0xbb, 0x30, 0x72, + 0xc0, 0x89, 0x28, 0x04, 0xa9, 0x88, 0xaa, 0x72, 0x95, 0x0a, 0xca, 0x51, 0x91, 0x89, 0x00, 0xb1, + 0x1b, 0x25, 0xc2, 0x8f, 0x10, 0x31, 0x81, 0xbc, 0x9a, 0x73, 0x91, 0x8a, 0x94, 0x8c, 0x33, 0x99, + 0xa1, 0x9c, 0x51, 0x93, 0x08, 0xdb, 0x10, 0x42, 0xb1, 0x89, 0x8a, 0xc8, 0x71, 0x98, 0x20, 0xb1, + 0x0b, 0x83, 0xeb, 0x4a, 0x06, 0x8b, 0x32, 0xfa, 0x19, 0x22, 0xa9, 0x48, 0xa1, 0x0b, 0x18, 0x14, + 0xa2, 0x8f, 0x05, 0xcb, 0x51, 0xa0, 0x09, 0x80, 0x80, 0x53, 0xd0, 0x9b, 0x33, 0xa0, 0x28, 0xb3, + 0x8f, 0x81, 0x2a, 0x06, 0x99, 0x88, 0xa0, 0x30, 0xa4, 0xaf, 0x23, 0x13, 0xaa, 0xa1, 0x9d, 0x53, + 0xb8, 0x10, 0x90, 0x9a, 0x36, 0x9a, 0x83, 0xea, 0x3b, 0x06, 0x9a, 0x01, 0xd9, 0x50, 0x81, 0xa8, + 0x1a, 0x90, 0x10, 0x81, 0x71, 0xe3, 0x0b, 0x11, 0x11, 0xa9, 0x9a, 0x45, 0xd8, 0x08, 0x08, 0x04, + 0x8a, 0x92, 0x9b, 0x36, 0xea, 0x09, 0x23, 0xa9, 0x11, 0x09, 0xa8, 0x1a, 0xa0, 0x65, 0x90, 0xa0, + 0x9e, 0x33, 0x81, 0xab, 0x51, 0xc2, 0x9c, 0x28, 0x24, 0x12, 0xfd, 0x28, 0x92, 0x19, 0x99, 0x31, + 0xaa, 0x13, 0x8b, 0x98, 0x20, 0x44, 0xfb, 0x59, 0x81, 0xab, 0x42, 0x80, 0xb9, 0x0b, 0x24, 0x44, + 0xec, 0x28, 0x02, 0xa0, 0xaa, 0x32, 0x01, 0xbf, 0x45, 0xa9, 0x09, 0x80, 0x88, 0x41, 0xa1, 0xaa, + 0x10, 0xc1, 0x48, 0x04, 0xaa, 0x19, 0xb9, 0x4a, 0x37, 0xaa, 0xb9, 0x40, 0x14, 0xac, 0x20, 0x32, + 0xf9, 0x0b, 0x21, 0x02, 0x98, 0x8b, 0x06, 0xcb, 0x38, 0x22, 0xa2, 0xcc, 0x1a, 0x44, 0xc0, 0x89, + 0x1a, 0x35, 0xa9, 0x98, 0xad, 0x43, 0x12, 0xb8, 0x4a, 0x93, 0xab, 0x8d, 0x17, 0xaa, 0x18, 0x11, + 0x33, 0xbf, 0x28, 0x12, 0x88, 0xb9, 0xac, 0x72, 0x93, 0x0b, 0x94, 0xad, 0x51, 0xa1, 0x09, 0x88, + 0x80, 0x21, 0x41, 0xd1, 0x8c, 0x80, 0x29, 0x15, 0x89, 0x9b, 0x25, 0xad, 0x20, 0x62, 0xc0, 0x9b, + 0x33, 0x98, 0x89, 0x14, 0x00, 0xcd, 0x00, 0x41, 0xa1, 0xac, 0x50, 0x82, 0xab, 0x10, 0x12, 0xa8, + 0x39, 0xc3, 0x0c, 0x13, 0x0c, 0x07, 0x9c, 0x33, 0x99, 0xa8, 0x90, 0x0f, 0x12, 0x24, 0xaa, 0xb9, + 0x8e, 0x23, 0x23, 0xda, 0x18, 0xa0, 0x29, 0x05, 0x8b, 0x94, 0x8c, 0x33, 0xfb, 0x5b, 0x13, 0x8a, + 0x88, 0x0a, 0x00, 0xd9, 0x71, 0xb3, 0x8c, 0x11, 0x81, 0x99, 0x9b, 0x72, 0x92, 0x1b, 0x91, 0x89, + 0x9e, 0x44, 0x81, 0xac, 0x20, 0x01, 0xc9, 0x58, 0xa2, 0x0c, 0x81, 0x22, 0xaa, 0x81, 0x3b, 0x17, + 0xbf, 0x32, 0x82, 0xb9, 0x0a, 0x22, 0x32, 0xf0, 0x3d, 0xa2, 0x8c, 0x42, 0x92, 0xab, 0xa8, 0x71, + 0x91, 0xaa, 0x1a, 0x43, 0x01, 0xa8, 0x8d, 0x01, 0x51, 0xb8, 0x18, 0x0a, 0x85, 0x2a, 0x86, 0xac, + 0x9b, 0x64, 0x92, 0xbb, 0x10, 0x20, 0x05, 0xac, 0x10, 0x80, 0x99, 0x28, 0x36, 0xea, 0x19, 0x13, + 0xda, 0x28, 0x92, 0x30, 0xd8, 0x8b, 0x53, 0x80, 0x88, 0xb1, 0x8f, 0x24, 0x98, 0x8b, 0x33, 0x8b, + 0x11, 0xc1, 0x0c, 0x14, 0xac, 0x33, 0xa0, 0xbd, 0x70, 0x82, 0x99, 0xbc, 0x62, 0x92, 0x89, 0xa8, + 0x38, 0x14, 0xac, 0x11, 0x10, 0xc9, 0x40, 0x81, 0xc8, 0x0d, 0x34, 0x90, 0xc8, 0x9a, 0x50, 0xa2, + 0x21, 0xbc, 0x11, 0x08, 0x90, 0x18, 0x90, 0x9a, 0x66, 0x90, 0xbc, 0x58, 0x12, 0xa9, 0x00, 0xaf, + 0x53, 0x91, 0x99, 0x88, 0xa9, 0x52, 0xa8, 0x22, 0x89, 0xc9, 0x50, 0xc1, 0x3a, 0x02, 0x00, 0xeb, + 0x30, 0xa9, 0x44, 0xb9, 0x1a, 0xa1, 0x30, 0x26, 0xeb, 0xab, 0x46, 0x91, 0xba, 0x29, 0x22, 0x90, + 0x10, 0xe0, 0x0d, 0x22, 0x11, 0xb0, 0x8e, 0x00, 0x42, 0xb1, 0x9d, 0x21, 0x81, 0x31, 0xe9, 0x99, + 0x29, 0x15, 0x01, 0xca, 0x0c, 0x03, 0x11, 0x89, 0x94, 0x0e, 0x83, 0x89, 0xa9, 0x32, 0xca, 0x53, + 0x88, 0xc8, 0x39, 0xb2, 0x2d, 0x06, 0x8c, 0x04, 0x9d, 0x11, 0x12, 0x8a, 0xc0, 0x1c, 0x14, 0x8a, + 0x81, 0x00, 0x9a, 0x24, 0x10, 0xd9, 0xab, 0x58, 0x16, 0xa9, 0x8a, 0x30, 0xb2, 0x61, 0xf9, 0x08, + 0x19, 0x33, 0x98, 0xda, 0x2b, 0x16, 0x08, 0xa9, 0x9a, 0x11, 0x44, 0xb2, 0x9e, 0x08, 0x12, 0x52, + 0xf9, 0x1a, 0x12, 0x00, 0x80, 0xbb, 0x00, 0x30, 0x27, 0xab, 0xcb, 0x31, 0x12, 0x81, 0xda, 0x1b, + 0x15, 0x21, 0xfb, 0x09, 0x31, 0x92, 0x9b, 0x12, 0x09, 0xd9, 0x61, 0x98, 0x83, 0x8f, 0x81, 0x38, + 0xb1, 0x5a, 0xb2, 0x09, 0x8a, 0x16, 0xba, 0x2c, 0x05, 0x1a, 0x92, 0x9b, 0x09, 0x35, 0x9a, 0x02, + 0xdc, 0x2a, 0x37, 0xb9, 0x1a, 0xa0, 0x21, 0x12, 0xb9, 0xaa, 0x9b, 0x14, 0x65, 0xe9, 0x18, 0x80, + 0x12, 0x9b, 0x10, 0x01, 0x99, 0x72, 0xf0, 0x28, 0x88, 0x80, 0x51, 0xe8, 0x19, 0x01, 0x18, 0x82, + 0xca, 0x39, 0x84, 0xab, 0x20, 0xb1, 0x61, 0xa8, 0x18, 0xbb, 0x23, 0x90, 0x71, 0x83, 0xbe, 0x20, + 0x82, 0x3a, 0x96, 0x9c, 0x11, 0x80, 0xaa, 0x33, 0xb8, 0x0b, 0x02, 0x98, 0x71, 0xf4, 0x4b, 0x83, + 0x8a, 0x80, 0xb9, 0x71, 0xa1, 0x09, 0x89, 0x03, 0x9a, 0x10, 0x96, 0x9f, 0x33, 0x81, 0x99, 0xcc, + 0x50, 0x02, 0xa8, 0x8b, 0x00, 0x12, 0x9b, 0x57, 0xcb, 0x11, 0x09, 0x02, 0x81, 0xae, 0x43, 0x99, + 0x18, 0x80, 0xa0, 0x3a, 0x92, 0x98, 0x59, 0xb1, 0x0c, 0x01, 0x12, 0x2b, 0x07, 0x8f, 0x12, 0xb9, + 0x9d, 0x44, 0x92, 0x9b, 0xa3, 0x9d, 0x22, 0x11, 0xa1, 0x18, 0xae, 0x35, 0xb9, 0x00, 0x13, 0x9d, + 0x01, 0x00, 0xb9, 0x32, 0x9b, 0x25, 0xbc, 0x51, 0xc0, 0x3b, 0xa1, 0x73, 0xc0, 0x1c, 0x04, 0xaa, + 0x39, 0x95, 0x9b, 0x12, 0x18, 0x91, 0x9a, 0x2a, 0x57, 0xc8, 0x0b, 0x13, 0x80, 0x29, 0xc3, 0x0f, + 0x11, 0x10, 0xa0, 0xab, 0x12, 0x39, 0x37, 0xfb, 0x28, 0x90, 0x01, 0x39, 0xe1, 0x1c, 0x04, 0x0a, + 0x01, 0x9a, 0x00, 0x00, 0x11, 0x91, 0x9a, 0x4a, 0x15, 0xea, 0x10, 0x21, 0xcb, 0x42, 0xd9, 0x29, + 0x83, 0x2b, 0xa2, 0x9d, 0x33, 0xaa, 0x14, 0x61, 0xe9, 0x89, 0x3a, 0x85, 0x89, 0x01, 0x89, 0xba, + 0x53, 0x09, 0x93, 0xcb, 0x39, 0x06, 0x09, 0xb0, 0x2a, 0xd9, 0x72, 0xb0, 0x10, 0xbb, 0x41, 0x92, + 0x1a, 0xd1, 0x0c, 0x36, 0xc8, 0x1a, 0xa1, 0x69, 0x83, 0x9d, 0x80, 0x10, 0x02, 0x01, 0xbb, 0x99, + 0x43, 0x28, 0xd2, 0x0e, 0x21, 0x80, 0x3a, 0xf3, 0x1c, 0x14, 0x99, 0x88, 0x99, 0x39, 0x03, 0x20, + 0xcc, 0x29, 0x93, 0x9b, 0xb2, 0x32, 0x1b, 0x17, 0xac, 0x10, 0x10, 0x01, 0x98, 0x9b, 0x00, 0x29, + 0x12, 0x99, 0x29, 0x11, 0xb1, 0xab, 0x31, 0x91, 0x51, 0xc1, 0x3a, 0xf0, 0x38, 0xa2, 0x0a, 0x10, + 0x02, 0x99, 0xab, 0x31, 0xa9, 0x33, 0x91, 0x9c, 0x99, 0x53, 0x81, 0x09, 0xdb, 0x31, 0x99, 0x11, + 0x33, 0xa9, 0xb9, 0x31, 0xb1, 0x2c, 0x03, 0x9b, 0x01, 0x9a, 0x29, 0x91, 0x31, 0xa1, 0x9b, 0x30, + 0x21, 0xa0, 0x9b, 0x31, 0xa1, 0x19, 0x99, 0x92, 0x99, 0x31, 0xb1, 0x1b, 0x21, 0x11, 0xaa, 0x29, + 0x11, 0x00, 0x11, 0xa9, 0x1b, 0x12, 0x00, 0x92, 0xaa, 0x29, 0x13, 0xa9, 0x10, 0x99, 0x11, 0x01, + 0x90, 0xa9, 0x21, 0x11, 0x90, 0xa9, 0x19, 0x21, 0x90, 0x99, 0x11, 0x90, 0x19, 0x01, 0x09, 0x19, + 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x70, 0xff, 0x71, 0x77, 0xb1, 0x22, 0xbc, 0xe9, + 0x39, 0x13, 0x18, 0xfc, 0x1a, 0x98, 0x42, 0x14, 0x99, 0xc9, 0x39, 0x21, 0x92, 0x37, 0xcb, 0xba, + 0x20, 0x28, 0xd4, 0x49, 0xa1, 0x09, 0x99, 0x42, 0x01, 0xc9, 0x59, 0x83, 0x9a, 0x19, 0xbb, 0x12, + 0x20, 0x9c, 0x01, 0x27, 0x8f, 0xb2, 0x31, 0xba, 0xb2, 0x79, 0x84, 0x2a, 0xb2, 0x9e, 0x20, 0x00, + 0x02, 0xcb, 0x21, 0xb9, 0x29, 0x37, 0x8b, 0xb0, 0x98, 0x70, 0x90, 0x93, 0x0e, 0x10, 0x83, 0x48, + 0xc2, 0x9c, 0xbb, 0x20, 0x25, 0xa0, 0x1b, 0xf8, 0x60, 0x82, 0x0a, 0x90, 0x31, 0x8a, 0xe3, 0x3a, + 0xeb, 0x20, 0x23, 0x98, 0x90, 0x09, 0x88, 0xab, 0xc2, 0x0b, 0x88, 0x77, 0x91, 0xa0, 0x51, 0xd9, + 0x1a, 0x82, 0x29, 0xb1, 0x30, 0x22, 0xf8, 0x29, 0xa9, 0x90, 0x09, 0x89, 0x04, 0xaf, 0x73, 0x92, + 0x28, 0x88, 0xb0, 0x0d, 0x00, 0x02, 0x0c, 0x34, 0xa8, 0xeb, 0x11, 0x0d, 0xc2, 0x19, 0x39, 0x87, + 0x00, 0x88, 0x90, 0x32, 0x90, 0xec, 0x19, 0x01, 0x9a, 0x80, 0x08, 0x73, 0x81, 0x18, 0x82, 0x29, + 0xf2, 0x8f, 0xa1, 0x39, 0x12, 0x90, 0x41, 0x90, 0xfa, 0x00, 0x38, 0x95, 0x09, 0xc0, 0x0c, 0x92, + 0x18, 0x01, 0x01, 0x3a, 0xa5, 0x4a, 0xb8, 0x28, 0x32, 0x28, 0xfc, 0x9b, 0x1b, 0x45, 0x91, 0x08, + 0xba, 0x38, 0xa8, 0x37, 0xaa, 0x21, 0x81, 0x0d, 0xf8, 0x4c, 0x08, 0x04, 0x89, 0xa8, 0x8a, 0x11, + 0x42, 0x51, 0xb0, 0xab, 0x12, 0x0e, 0xb8, 0x60, 0x88, 0x00, 0x2b, 0xa3, 0x0d, 0x24, 0x9b, 0x10, + 0x03, 0x9c, 0x21, 0xf9, 0x20, 0xac, 0x27, 0x1b, 0xa2, 0xa9, 0x98, 0x4b, 0x05, 0x32, 0xbd, 0x03, + 0xca, 0x9a, 0x61, 0x81, 0x00, 0x9b, 0x21, 0xb0, 0x63, 0xaa, 0xa1, 0x73, 0xd8, 0x11, 0x8b, 0x32, + 0xf8, 0x2a, 0x91, 0xab, 0x26, 0x89, 0x62, 0xc8, 0x20, 0xba, 0x31, 0x81, 0x88, 0x10, 0xde, 0x41, + 0xa9, 0x12, 0x9a, 0x10, 0x01, 0x9a, 0x93, 0x4c, 0x34, 0xfc, 0x32, 0xab, 0x91, 0x42, 0x89, 0xa0, + 0x31, 0xba, 0xac, 0x81, 0x29, 0x11, 0x88, 0x27, 0x0c, 0xab, 0x17, 0x22, 0xaa, 0x38, 0xb6, 0x1f, + 0xa2, 0x89, 0x98, 0x19, 0x25, 0xc9, 0x59, 0xb8, 0x18, 0x45, 0x89, 0xb1, 0x2c, 0x01, 0xd9, 0x3b, + 0x03, 0x29, 0xf0, 0x2a, 0x12, 0x90, 0x31, 0xb1, 0xad, 0x11, 0x24, 0xc9, 0x4a, 0xf3, 0x2b, 0x80, + 0x84, 0x3d, 0xb2, 0x18, 0xb8, 0x18, 0x20, 0x21, 0x88, 0x29, 0xa4, 0xfa, 0x2f, 0xa3, 0x20, 0x18, + 0xf2, 0x1c, 0x82, 0x19, 0x81, 0x09, 0x31, 0xf0, 0x3a, 0x03, 0xcb, 0x62, 0xa8, 0x98, 0x00, 0x08, + 0xa0, 0x0e, 0x06, 0x9a, 0x31, 0xd3, 0x2a, 0x82, 0x9a, 0x14, 0x9f, 0x12, 0x10, 0x0c, 0x83, 0xb8, + 0x2a, 0x88, 0x86, 0x1a, 0x8c, 0x85, 0x1c, 0x03, 0x88, 0xa9, 0x30, 0xa9, 0x42, 0xf8, 0x50, 0xba, + 0x11, 0x41, 0xca, 0x01, 0x80, 0x1d, 0xb3, 0x71, 0xb8, 0x01, 0x3a, 0xc1, 0x19, 0xd3, 0x59, 0xa8, + 0x12, 0x00, 0xbc, 0x29, 0x96, 0x3c, 0x93, 0x8a, 0x81, 0x98, 0x60, 0xd0, 0x10, 0x18, 0xc8, 0x33, + 0xaf, 0x11, 0x88, 0x20, 0x80, 0x8c, 0x17, 0x09, 0x90, 0x89, 0x09, 0x83, 0x8d, 0x12, 0x0a, 0x84, + 0x88, 0x8b, 0xba, 0x14, 0x54, 0xba, 0x16, 0x8e, 0xa8, 0x23, 0x28, 0x81, 0xa9, 0x13, 0xab, 0x9f, + 0x17, 0x99, 0x0a, 0x92, 0x80, 0x09, 0x80, 0x81, 0xad, 0x63, 0x00, 0x33, 0xd9, 0x31, 0xbb, 0x08, + 0xab, 0xbd, 0x20, 0x15, 0x19, 0x8d, 0x06, 0x10, 0x8a, 0x91, 0x72, 0xc8, 0x20, 0xd9, 0x1a, 0x03, + 0x2b, 0xa5, 0x89, 0x30, 0xfa, 0x20, 0x01, 0x2c, 0x87, 0x8a, 0x12, 0xad, 0x83, 0x39, 0xb9, 0x95, + 0x1a, 0xa2, 0x10, 0xad, 0x14, 0x28, 0x19, 0xc3, 0x59, 0xb9, 0x10, 0x02, 0xad, 0x26, 0xbc, 0x23, + 0x9c, 0x10, 0xc4, 0x4b, 0x93, 0x1a, 0x58, 0xf2, 0x38, 0xc8, 0x10, 0x80, 0x09, 0x10, 0xc1, 0x59, + 0xb8, 0x10, 0x93, 0x2a, 0x9a, 0xd3, 0x70, 0x98, 0x80, 0x22, 0xad, 0x00, 0x81, 0x00, 0x10, 0xad, + 0x85, 0x2c, 0xa3, 0x80, 0x1b, 0x14, 0x81, 0xac, 0x29, 0x86, 0x0c, 0x92, 0x30, 0xe9, 0x10, 0x9b, + 0x05, 0x59, 0xc8, 0x93, 0x1d, 0x21, 0xc3, 0x09, 0x31, 0xcc, 0x12, 0xaa, 0x48, 0xd1, 0x31, 0x90, + 0x99, 0x00, 0xad, 0x26, 0x08, 0x0b, 0x86, 0x1c, 0xa2, 0x00, 0x8b, 0x90, 0x68, 0xa2, 0x1b, 0x99, + 0x85, 0x1e, 0x94, 0x98, 0x20, 0x92, 0x18, 0xfb, 0x30, 0xb3, 0x4c, 0xd1, 0x18, 0x18, 0xb0, 0x40, + 0xd2, 0x4b, 0xb1, 0x01, 0x3a, 0x94, 0x39, 0xfb, 0x41, 0xc0, 0x29, 0xa0, 0x20, 0x8a, 0x91, 0x72, + 0xb8, 0x9a, 0x15, 0x0a, 0xa2, 0x22, 0xc9, 0x5b, 0xb8, 0x02, 0x0f, 0x96, 0x39, 0xd0, 0x10, 0x8a, + 0x03, 0x0a, 0x84, 0x1d, 0xa1, 0x22, 0xab, 0x02, 0x9c, 0x14, 0x29, 0xf1, 0x08, 0x10, 0x88, 0x22, + 0xcb, 0x21, 0x3a, 0xf3, 0x5a, 0xa1, 0x89, 0x99, 0x05, 0x0d, 0x86, 0x1a, 0x90, 0x82, 0x9b, 0x05, + 0x0d, 0xb3, 0x59, 0x90, 0x80, 0x29, 0xf0, 0x38, 0x81, 0x89, 0x93, 0x0d, 0x38, 0xc1, 0x30, 0x98, + 0x89, 0x0a, 0xa4, 0x4a, 0xd0, 0x73, 0xa9, 0xa2, 0x59, 0xc0, 0x22, 0x9c, 0x92, 0x20, 0xac, 0x05, + 0x9a, 0x30, 0xa0, 0xa2, 0x7a, 0xb0, 0x31, 0xbc, 0x26, 0x9a, 0x91, 0x19, 0xaa, 0x16, 0x8d, 0x04, + 0x8b, 0x28, 0x82, 0x0b, 0x23, 0xab, 0x05, 0x1e, 0x92, 0x08, 0x09, 0xb1, 0x08, 0x9e, 0x44, 0x08, + 0xf1, 0x29, 0x98, 0x12, 0x4b, 0x96, 0x8c, 0x01, 0x01, 0x8b, 0x92, 0x0c, 0x86, 0x8b, 0x04, 0x09, + 0x98, 0x15, 0x8d, 0xa3, 0x3b, 0xa3, 0x1c, 0x81, 0x94, 0x2b, 0xb2, 0x38, 0xa8, 0xbd, 0x43, 0x22, + 0xaf, 0x24, 0x0a, 0xa8, 0x92, 0x3b, 0xfa, 0x61, 0x10, 0xc9, 0x40, 0xb9, 0x30, 0xb9, 0x03, 0x38, + 0xed, 0x42, 0xa9, 0x10, 0x82, 0x0c, 0x83, 0x89, 0x40, 0xea, 0x21, 0x88, 0x99, 0x12, 0x8a, 0x50, + 0xc1, 0x19, 0x10, 0xbe, 0x44, 0x9a, 0x02, 0x10, 0x9a, 0x10, 0xf8, 0x50, 0xa8, 0x12, 0x8b, 0xb1, + 0x49, 0xa9, 0x17, 0xbb, 0x52, 0x8b, 0xa1, 0x53, 0xac, 0x14, 0xa9, 0x28, 0xa1, 0x09, 0x00, 0xb8, + 0x55, 0xac, 0x93, 0x20, 0x0c, 0x86, 0x8b, 0x12, 0xab, 0x21, 0x96, 0x0f, 0x13, 0x9a, 0x28, 0xa1, + 0x19, 0x18, 0xc9, 0x22, 0x2f, 0xa3, 0x18, 0x8d, 0xa3, 0x79, 0xa0, 0x81, 0x89, 0x00, 0x0a, 0x96, + 0x5a, 0xc9, 0x21, 0x09, 0x93, 0xaa, 0x01, 0x1b, 0xb3, 0x74, 0xaa, 0x93, 0x3c, 0xd2, 0x20, 0x80, + 0x8e, 0x21, 0xc1, 0x48, 0xa0, 0x90, 0x58, 0xda, 0x12, 0x10, 0x80, 0x08, 0xf0, 0x3a, 0xb2, 0x31, + 0xab, 0x87, 0x1c, 0xb0, 0x23, 0xab, 0x24, 0x02, 0xca, 0x59, 0xe0, 0x18, 0x08, 0x91, 0x21, 0x9c, + 0x23, 0xca, 0x38, 0x14, 0x99, 0x90, 0xbb, 0x27, 0xaf, 0x84, 0x19, 0x00, 0x00, 0x89, 0x15, 0xac, + 0x02, 0x09, 0x90, 0x35, 0xcd, 0x11, 0x08, 0x89, 0x28, 0xb2, 0x34, 0xbf, 0x86, 0x0a, 0x40, 0xd1, + 0x39, 0x90, 0xa9, 0x24, 0xba, 0x30, 0xa8, 0x50, 0xa8, 0x81, 0xaa, 0x81, 0x78, 0xc2, 0x31, 0xea, + 0x20, 0x09, 0xe2, 0x58, 0x98, 0x08, 0x00, 0x08, 0x1a, 0x82, 0x8f, 0x15, 0x8b, 0x82, 0x89, 0x18, + 0xc0, 0x49, 0xc4, 0x4b, 0xa4, 0x8a, 0x03, 0xaa, 0x42, 0xb1, 0x2c, 0xa5, 0x0b, 0x81, 0x81, 0x98, + 0x20, 0x3a, 0xf9, 0x21, 0x8a, 0x12, 0x10, 0x22, 0xab, 0x87, 0xaf, 0x28, 0x95, 0x0d, 0x86, 0x8b, + 0x12, 0x80, 0x1b, 0xb5, 0x29, 0x00, 0xb8, 0x52, 0xbc, 0x15, 0xab, 0x41, 0xb8, 0x3a, 0x85, 0x9c, + 0x14, 0xa9, 0x31, 0xc0, 0x08, 0x89, 0x14, 0xc0, 0x4a, 0xb1, 0x1a, 0x12, 0x9a, 0x94, 0x1d, 0x80, + 0x23, 0xa9, 0xaa, 0x47, 0xf8, 0x58, 0xa1, 0x9a, 0x21, 0xc8, 0x31, 0x8b, 0x93, 0x20, 0x9e, 0x82, + 0x40, 0x8a, 0x81, 0x11, 0xfc, 0x41, 0xa8, 0x28, 0x90, 0x92, 0x2d, 0x29, 0xb3, 0x1a, 0x87, 0x8d, + 0x84, 0x0c, 0x82, 0x91, 0x0b, 0x86, 0x1b, 0x92, 0x21, 0xb8, 0x2e, 0x95, 0x0a, 0x00, 0xa0, 0x1c, + 0xa4, 0x3a, 0x82, 0xb0, 0x5a, 0x94, 0x0b, 0x10, 0xc3, 0x5b, 0xa0, 0xb2, 0x1e, 0x10, 0x06, 0x8d, + 0x02, 0x8a, 0x91, 0x31, 0x9c, 0x04, 0x0a, 0x11, 0xdb, 0x00, 0x61, 0xd0, 0x39, 0xa2, 0x90, 0x3d, + 0xa5, 0x3b, 0x98, 0x11, 0xa8, 0x39, 0x10, 0xc5, 0x2d, 0xb1, 0x31, 0xb9, 0x59, 0xc4, 0x1a, 0x21, + 0xc1, 0x1a, 0x88, 0x02, 0x90, 0x7c, 0xa4, 0x9a, 0x28, 0x8b, 0x86, 0x99, 0x41, 0xb8, 0x0a, 0x17, + 0x8b, 0x80, 0x11, 0xba, 0x4a, 0xb3, 0x3a, 0x18, 0xc3, 0x41, 0xa8, 0x49, 0xf2, 0x2c, 0x84, 0x9a, + 0x91, 0x2c, 0x41, 0xe2, 0x58, 0xb8, 0x19, 0x01, 0x90, 0x91, 0x4c, 0x91, 0xb1, 0x5a, 0xa0, 0x20, + 0xc3, 0x5b, 0xb8, 0x18, 0x21, 0xac, 0x02, 0x90, 0x54, 0xbc, 0x15, 0xba, 0x39, 0xb1, 0x16, 0x1a, + 0xbb, 0x17, 0xab, 0x34, 0xac, 0x10, 0x00, 0x38, 0xf8, 0x19, 0x32, 0xca, 0x32, 0xe9, 0x20, 0xa2, + 0x1b, 0xa2, 0x19, 0x53, 0xc9, 0x81, 0x1c, 0x10, 0x90, 0x16, 0x9d, 0x81, 0x88, 0x08, 0x11, 0x08, + 0x85, 0x4a, 0xc3, 0x9e, 0x22, 0xaa, 0x34, 0xa8, 0x0a, 0xb9, 0x28, 0x95, 0x2c, 0x24, 0xd8, 0x48, + 0xcb, 0x15, 0x1b, 0x91, 0x80, 0xb9, 0x78, 0xb1, 0x01, 0x18, 0xc1, 0x2c, 0xc2, 0x11, 0x1c, 0xa2, + 0x71, 0xd0, 0x40, 0xa9, 0x80, 0x11, 0x0c, 0x12, 0xd9, 0x41, 0xba, 0x11, 0x01, 0x1b, 0xa6, 0x29, + 0x81, 0x9f, 0x13, 0x00, 0x09, 0xa3, 0x0c, 0xf1, 0x48, 0x08, 0xa8, 0x21, 0xab, 0x22, 0xc8, 0x33, + 0x9b, 0x21, 0x3a, 0x97, 0x5b, 0xc0, 0x08, 0x0d, 0x05, 0x1e, 0xa2, 0x20, 0x0b, 0xc3, 0x3a, 0xa1, + 0x20, 0x02, 0x90, 0x5d, 0xc1, 0x00, 0x8a, 0x28, 0xf3, 0x2a, 0x11, 0x90, 0x88, 0x8d, 0x04, 0x08, + 0x12, 0x0a, 0x80, 0xd1, 0x50, 0xea, 0x38, 0xa2, 0x10, 0x8c, 0xa2, 0x50, 0xbb, 0x36, 0xbc, 0x14, + 0x8c, 0x12, 0x01, 0xdb, 0x42, 0xad, 0x05, 0x09, 0x80, 0x90, 0x3a, 0xc3, 0x3b, 0xb3, 0x10, 0x10, + 0xda, 0x11, 0xba, 0x73, 0xb8, 0x01, 0x19, 0x89, 0x07, 0x0b, 0x21, 0xda, 0x86, 0x0c, 0x00, 0x02, + 0x8a, 0x01, 0xb9, 0x80, 0x7a, 0xc2, 0x2a, 0x02, 0x10, 0xb8, 0x90, 0x60, 0xfb, 0x53, 0xba, 0x11, + 0x09, 0x09, 0xa6, 0x3b, 0xa3, 0x9c, 0x43, 0x90, 0x39, 0xf1, 0x4b, 0x80, 0x18, 0xa3, 0x0c, 0x29, + 0xf0, 0x28, 0x91, 0x48, 0xc3, 0x29, 0x0b, 0xa4, 0x18, 0x89, 0x83, 0x0f, 0x23, 0xe9, 0x20, 0xa9, + 0x14, 0x9c, 0x91, 0x60, 0xa9, 0x32, 0xbb, 0x02, 0x08, 0x61, 0xe1, 0x1a, 0x01, 0x98, 0x42, 0xb9, + 0x80, 0x0e, 0x81, 0x13, 0x8d, 0x02, 0x00, 0x10, 0x88, 0x90, 0xcb, 0x33, 0x5e, 0xf2, 0x29, 0x3a, + 0xd2, 0x41, 0xaa, 0x00, 0x80, 0x29, 0x91, 0xd8, 0x79, 0xa0, 0x3a, 0xa1, 0x31, 0xa0, 0x9c, 0x63, + 0xb8, 0x5a, 0xf1, 0x38, 0xa8, 0x10, 0x80, 0x08, 0x82, 0x9a, 0x6a, 0xd9, 0x24, 0x99, 0x08, 0x92, + 0x1a, 0x0b, 0x86, 0x88, 0x0b, 0x84, 0xc8, 0x70, 0xb9, 0x85, 0x0a, 0x10, 0x98, 0x80, 0x63, 0xbd, + 0x04, 0x1c, 0x83, 0x1a, 0x81, 0x09, 0x99, 0x12, 0x1e, 0xc3, 0x39, 0x80, 0x08, 0xa2, 0x8d, 0x04, + 0x99, 0x50, 0xe2, 0x3b, 0xa6, 0x2a, 0x91, 0xa9, 0x22, 0x2b, 0x94, 0xb0, 0x1e, 0x94, 0x1b, 0x86, + 0x8c, 0x83, 0x18, 0x08, 0x91, 0x1a, 0xa1, 0x3a, 0xf3, 0x49, 0xb8, 0x00, 0x11, 0xd3, 0x09, 0x3b, + 0x84, 0xb9, 0x71, 0xe3, 0x29, 0xa1, 0x38, 0xc9, 0x30, 0x81, 0xfa, 0x69, 0xb0, 0x19, 0x01, 0x50, + 0x99, 0x92, 0x2c, 0xa1, 0x21, 0x9c, 0x21, 0xf1, 0x38, 0x98, 0xb1, 0x7b, 0xa0, 0x81, 0x39, 0xa1, + 0x8a, 0x68, 0xc1, 0x11, 0x2c, 0x81, 0x95, 0x0d, 0x81, 0x89, 0x21, 0xab, 0x25, 0xad, 0x41, 0x98, + 0x99, 0x23, 0x0a, 0x06, 0x0e, 0x81, 0x01, 0x89, 0x02, 0xba, 0x98, 0x2e, 0xa7, 0x2a, 0x80, 0x00, + 0x80, 0x10, 0x9b, 0x96, 0x4b, 0x93, 0x89, 0xd3, 0x2d, 0x85, 0x0b, 0x00, 0x91, 0x1c, 0xc2, 0x21, + 0xbb, 0x40, 0x96, 0x0a, 0x68, 0xc0, 0x31, 0xdb, 0x22, 0xa0, 0x2b, 0xc2, 0x01, 0x3e, 0xc4, 0x38, + 0xcb, 0x13, 0x19, 0x81, 0x18, 0xa3, 0x3c, 0xe1, 0x20, 0xab, 0x33, 0x0e, 0xb5, 0x3b, 0xb1, 0x18, + 0x38, 0x95, 0x09, 0x02, 0x9f, 0x85, 0x2b, 0xa3, 0x0a, 0x81, 0x10, 0x9f, 0x05, 0x0e, 0x84, 0x89, + 0x20, 0xa8, 0x09, 0x41, 0xd9, 0x22, 0x8b, 0xa4, 0x3a, 0xb8, 0x25, 0xbb, 0x30, 0x98, 0xf0, 0x52, + 0xba, 0x13, 0x9c, 0x33, 0xd1, 0x2a, 0x93, 0x9b, 0x32, 0xaa, 0x32, 0xe1, 0x58, 0xe8, 0x28, 0x80, + 0x92, 0x19, 0xca, 0x33, 0xc9, 0x69, 0xb3, 0x09, 0x31, 0xda, 0x3b, 0x95, 0x2b, 0xe3, 0x30, 0x8c, + 0x95, 0x3b, 0xb1, 0x2a, 0x21, 0xb0, 0x10, 0x02, 0x0f, 0x93, 0xc9, 0x73, 0xbb, 0x04, 0x2a, 0xc8, + 0x10, 0x00, 0x18, 0xb2, 0x59, 0x3a, 0xd6, 0x5b, 0xb1, 0x18, 0x19, 0xa0, 0x29, 0x81, 0x2c, 0xc4, + 0x58, 0xa8, 0x11, 0x19, 0xc8, 0x40, 0xa8, 0x9b, 0x24, 0xa9, 0x40, 0xa1, 0x81, 0x0d, 0xb8, 0x15, + 0x80, 0x39, 0xf3, 0x30, 0x8c, 0x9a, 0x17, 0x0c, 0x11, 0xd0, 0x29, 0x81, 0xa8, 0x71, 0xb9, 0x15, + 0x8c, 0x91, 0x12, 0x8c, 0x02, 0x8a, 0x92, 0x28, 0xa0, 0x08, 0x2b, 0x16, 0xd8, 0x48, 0xa8, 0x98, + 0x51, 0xa0, 0x29, 0xcc, 0x14, 0x20, 0xcc, 0x24, 0x8c, 0x80, 0x04, 0x2b, 0xd0, 0x21, 0xa9, 0x91, + 0x79, 0xd1, 0x38, 0x99, 0x10, 0xc0, 0x21, 0x3a, 0xf3, 0x39, 0xb1, 0x0a, 0x02, 0x12, 0x9d, 0x02, + 0x3c, 0xd4, 0x49, 0xa8, 0x83, 0x0c, 0x04, 0x8b, 0x92, 0x2c, 0xb3, 0x3a, 0x80, 0x95, 0x0e, 0x32, + 0xd1, 0x19, 0x00, 0xb2, 0x1d, 0x80, 0x30, 0xf2, 0x58, 0xb9, 0x81, 0x69, 0x90, 0x80, 0x98, 0x48, + 0xc0, 0x28, 0x98, 0x12, 0x8f, 0x84, 0x19, 0xb9, 0x42, 0xa9, 0x03, 0x39, 0xf8, 0x10, 0x28, 0xb8, + 0xa9, 0x62, 0xaa, 0x24, 0xba, 0x40, 0x9a, 0x17, 0x8b, 0xa8, 0x21, 0x9a, 0x86, 0x0b, 0x41, 0xe8, + 0x20, 0x2a, 0xd0, 0x23, 0x0d, 0x83, 0x0a, 0x92, 0x2c, 0xd8, 0x21, 0x19, 0xa3, 0x9a, 0x12, 0x1f, + 0xb5, 0x38, 0x2a, 0xe3, 0x28, 0xb9, 0x30, 0xc1, 0x01, 0x82, 0x2c, 0xa0, 0x91, 0x3a, 0xa2, 0x8e, + 0x23, 0xab, 0x27, 0x9b, 0x02, 0x09, 0xb0, 0x39, 0xfb, 0x16, 0x2e, 0xc3, 0x28, 0x0c, 0xa4, 0x29, + 0x0a, 0x94, 0x98, 0x60, 0xc9, 0x03, 0x9b, 0x31, 0x82, 0xb8, 0x41, 0xcd, 0x31, 0xb8, 0x01, 0x11, + 0x8d, 0x96, 0x1b, 0x11, 0xb0, 0x52, 0xc9, 0x38, 0xd1, 0x20, 0x19, 0xe3, 0x3a, 0xa9, 0x03, 0x3b, + 0x03, 0xf9, 0x41, 0x0b, 0xc4, 0x29, 0x08, 0xa1, 0x48, 0xa1, 0x0d, 0x87, 0x1d, 0x91, 0xa1, 0x58, + 0xa9, 0x01, 0x00, 0x1b, 0x93, 0x9a, 0x54, 0xc9, 0x40, 0xba, 0x01, 0x49, 0x00, 0xb1, 0x2a, 0xa4, + 0x1c, 0xaa, 0x33, 0x18, 0x30, 0xa9, 0xea, 0x13, 0x39, 0x1c, 0xf4, 0x28, 0x98, 0xa1, 0x68, 0xaa, + 0x87, 0x2c, 0x82, 0xb9, 0x43, 0x9c, 0x90, 0x13, 0x2d, 0x82, 0x9a, 0x20, 0xca, 0x63, 0xba, 0x24, + 0xd9, 0x38, 0xa1, 0x81, 0x6a, 0xb9, 0x13, 0x8e, 0x92, 0x20, 0x8b, 0x83, 0x90, 0x59, 0xd9, 0x34, + 0x8c, 0x83, 0x2b, 0xf8, 0x60, 0xb9, 0x11, 0x3a, 0xe1, 0x21, 0x1b, 0x90, 0x91, 0x6a, 0x90, 0x18, + 0xa0, 0x30, 0x9d, 0x94, 0x4b, 0xa1, 0x08, 0x90, 0x2a, 0x85, 0x3c, 0xf2, 0x20, 0x0b, 0xa4, 0x48, + 0xaa, 0x83, 0x8c, 0x23, 0x08, 0xf9, 0x41, 0xba, 0x32, 0xba, 0x84, 0x1b, 0x22, 0xa4, 0x0d, 0x00, + 0x0b, 0x97, 0x89, 0x5b, 0xa4, 0x89, 0x28, 0x90, 0x0b, 0x94, 0x39, 0x18, 0xb0, 0x85, 0x0f, 0xa2, + 0x32, 0x9f, 0x84, 0x2b, 0x81, 0x00, 0x8a, 0xa6, 0x3e, 0xc2, 0x10, 0x08, 0xb1, 0x5a, 0xb0, 0x28, + 0xa8, 0x13, 0x2a, 0xb3, 0x09, 0x0e, 0x95, 0x11, 0x1f, 0xa1, 0xa2, 0x5b, 0x90, 0xb1, 0x7a, 0x98, + 0x90, 0x12, 0x0a, 0x04, 0xb9, 0x50, 0xf9, 0x48, 0x98, 0x01, 0x0a, 0xa2, 0x11, 0xae, 0x43, 0xaa, + 0x22, 0x39, 0xe8, 0x00, 0x29, 0x30, 0xd9, 0x13, 0x0c, 0xc0, 0x59, 0xa2, 0x9a, 0x40, 0x80, 0xb8, + 0x21, 0x3a, 0xd8, 0x22, 0x07, 0x8f, 0x82, 0x8a, 0x03, 0x09, 0x98, 0x06, 0x0e, 0x92, 0x0a, 0x91, + 0x40, 0x81, 0x99, 0x48, 0xd1, 0x08, 0x08, 0x09, 0xa5, 0x38, 0xcb, 0x01, 0x82, 0x4d, 0xa4, 0x0c, + 0x12, 0xa9, 0x5a, 0x92, 0x0c, 0x84, 0x3b, 0xf2, 0x00, 0x2a, 0xc1, 0x41, 0xc9, 0x40, 0x99, 0x10, + 0x10, 0xc2, 0x59, 0xc0, 0x19, 0x98, 0x13, 0xab, 0x32, 0xb9, 0x2a, 0x14, 0x9d, 0x15, 0x99, 0x4a, + 0xa0, 0x05, 0x0c, 0xaa, 0x15, 0x39, 0xb8, 0x1b, 0xa0, 0xc0, 0x72, 0x98, 0x01, 0x19, 0xb3, 0x6c, + 0xc2, 0x19, 0x19, 0xc0, 0x18, 0x21, 0xf8, 0x68, 0x88, 0xa8, 0x20, 0x98, 0x20, 0x19, 0xa5, 0x1b, + 0x30, 0xfb, 0x32, 0xab, 0x02, 0x08, 0xf9, 0x78, 0xa8, 0x01, 0x19, 0x11, 0xa8, 0x41, 0xda, 0x09, + 0x03, 0x1a, 0x82, 0x8d, 0x05, 0x0c, 0xa1, 0x21, 0x1d, 0xa3, 0x98, 0x33, 0x0f, 0xa2, 0xa8, 0x70, + 0xc1, 0x49, 0x91, 0xb9, 0x48, 0x91, 0x0c, 0x85, 0x18, 0x8c, 0x91, 0x02, 0x2c, 0x91, 0x18, 0x18, + 0x12, 0xbf, 0x16, 0x8b, 0x13, 0xba, 0x3c, 0xa3, 0x28, 0x0b, 0xa9, 0x87, 0x2e, 0x03, 0x1a, 0xba, + 0x16, 0x0d, 0x95, 0x1c, 0xa2, 0x28, 0x08, 0xb1, 0x88, 0x1c, 0x17, 0xbb, 0x04, 0x19, 0x88, 0xa4, + 0x1d, 0x92, 0x09, 0x02, 0x88, 0x29, 0xbb, 0x36, 0xe8, 0x19, 0x03, 0x1c, 0xc1, 0x82, 0x3c, 0x90, + 0x25, 0xbb, 0x82, 0x0d, 0x04, 0x1b, 0x90, 0x44, 0x9f, 0x84, 0x1c, 0x81, 0x18, 0x80, 0x90, 0x4c, + 0xd2, 0x49, 0x90, 0x08, 0x81, 0xa9, 0x31, 0xb8, 0x2c, 0xc4, 0x4a, 0x92, 0x08, 0x02, 0x9c, 0x12, + 0x8b, 0x01, 0x18, 0x82, 0x60, 0xbe, 0x05, 0x1b, 0xc1, 0x12, 0x89, 0x89, 0x53, 0xf8, 0x59, 0xa0, + 0x20, 0x9a, 0x82, 0x49, 0xea, 0x32, 0xc9, 0x10, 0x11, 0x88, 0x08, 0x9d, 0x24, 0x9d, 0x14, 0x8a, + 0x08, 0x83, 0x1c, 0xc2, 0x2a, 0x23, 0xca, 0x81, 0x08, 0x5a, 0xf1, 0x30, 0x9b, 0x04, 0xa8, 0x04, + 0x0e, 0x93, 0x00, 0x0a, 0xb1, 0x5b, 0xa2, 0x2a, 0x81, 0x91, 0x8e, 0x05, 0x1d, 0x93, 0x2a, 0xc1, + 0x38, 0x81, 0xaa, 0x49, 0xb5, 0x1a, 0xb0, 0x1a, 0x84, 0x79, 0xb2, 0x1b, 0xa8, 0x25, 0x2c, 0xd4, + 0x28, 0x98, 0x88, 0xb3, 0x20, 0x1f, 0x94, 0x98, 0x9a, 0x21, 0xa2, 0x79, 0xc0, 0x22, 0x9c, 0x04, + 0x89, 0xa8, 0x48, 0xa4, 0x19, 0x8d, 0x93, 0x1a, 0x88, 0x14, 0xa0, 0x0f, 0x86, 0x09, 0x08, 0x90, + 0x01, 0xb8, 0x60, 0xb8, 0x8b, 0x07, 0x19, 0xa8, 0x08, 0x81, 0x38, 0x0c, 0x87, 0x1b, 0xa1, 0x20, + 0xe8, 0x48, 0x89, 0x03, 0x9c, 0x13, 0xaa, 0x4b, 0x14, 0xe8, 0x59, 0xb0, 0x00, 0x88, 0x31, 0xa8, + 0x1c, 0x02, 0xc0, 0x34, 0xaf, 0x03, 0x09, 0x00, 0x80, 0xc0, 0x6b, 0xb2, 0x3a, 0xe1, 0x42, 0x0b, + 0xa2, 0x0a, 0xa2, 0x7b, 0xa1, 0x01, 0x2b, 0xf0, 0x28, 0x81, 0x2b, 0x95, 0x0a, 0x88, 0x20, 0xb8, + 0x15, 0x8f, 0x04, 0x8a, 0x82, 0x1a, 0x99, 0x12, 0xb0, 0x58, 0xcb, 0x05, 0x2c, 0x08, 0x83, 0xca, + 0x61, 0xa9, 0x14, 0xab, 0x02, 0x09, 0xae, 0x16, 0x9a, 0x13, 0x8c, 0x83, 0x19, 0x1a, 0xa1, 0x2c, + 0x05, 0x98, 0x29, 0xcb, 0x43, 0x8a, 0xe8, 0x41, 0xa0, 0x49, 0xa2, 0xab, 0x28, 0xa4, 0x6d, 0xc1, + 0x31, 0x0c, 0x81, 0x8a, 0x84, 0x0c, 0x01, 0x80, 0xc8, 0x31, 0x8b, 0x97, 0x1b, 0x15, 0x9a, 0x80, + 0x10, 0xac, 0x15, 0x0b, 0xa3, 0x0d, 0x22, 0xd8, 0x10, 0x09, 0x20, 0x09, 0xa1, 0x27, 0x9c, 0x12, + 0xba, 0xa4, 0x2d, 0x93, 0x29, 0xf9, 0x78, 0x99, 0x81, 0x01, 0xa8, 0x5a, 0xb3, 0x3b, 0x89, 0x91, + 0x60, 0xd0, 0x48, 0xaa, 0x12, 0xa8, 0x1a, 0x15, 0x9c, 0x14, 0xb9, 0x38, 0xa8, 0x10, 0xa4, 0x48, + 0xc8, 0x2b, 0xc4, 0x38, 0x21, 0xda, 0x11, 0xaa, 0x3a, 0xb4, 0x51, 0x99, 0xa2, 0x1b, 0x21, 0x06, + 0x8f, 0x84, 0x1a, 0x92, 0x3c, 0xd9, 0x82, 0x4c, 0xb3, 0x4b, 0xc2, 0x29, 0x08, 0x88, 0x50, 0xc1, + 0x10, 0x1a, 0xd2, 0x00, 0x0b, 0x83, 0x80, 0xb1, 0x3c, 0xba, 0x91, 0x77, 0x98, 0x2a, 0xa2, 0x8a, + 0x15, 0x1d, 0xc1, 0x00, 0x30, 0xca, 0x20, 0xc2, 0x5a, 0xc0, 0x38, 0x93, 0xda, 0x68, 0xa0, 0x11, + 0x08, 0x98, 0xaa, 0x22, 0x83, 0x0f, 0x91, 0x88, 0x81, 0x48, 0xcc, 0x42, 0x80, 0x91, 0x5a, 0xeb, + 0x15, 0x99, 0x19, 0x82, 0xc9, 0x51, 0xaa, 0x03, 0x0e, 0x13, 0xaa, 0x20, 0x90, 0x29, 0x12, 0xae, + 0x05, 0xa9, 0x7a, 0xa1, 0x88, 0x18, 0x29, 0xc2, 0x38, 0xc1, 0x0c, 0x10, 0x83, 0x08, 0xdb, 0x51, + 0x88, 0xb3, 0x78, 0xac, 0x13, 0x0a, 0x93, 0x0d, 0x03, 0x91, 0x2f, 0xc1, 0x18, 0x03, 0x0c, 0x80, + 0x98, 0x51, 0xb0, 0x49, 0xc9, 0x42, 0xa9, 0x28, 0x99, 0xc4, 0x78, 0xa8, 0x09, 0x94, 0x08, 0x1a, + 0xa4, 0x29, 0xc8, 0x32, 0x8e, 0x94, 0x89, 0x21, 0xaa, 0x01, 0x33, 0x1b, 0xe8, 0x91, 0x00, 0x8f, + 0x35, 0xe9, 0x20, 0xb9, 0x40, 0xa1, 0x08, 0x22, 0xcd, 0x23, 0x8a, 0x04, 0x9b, 0x12, 0xc9, 0x29, + 0x93, 0x1f, 0xa5, 0x19, 0x90, 0x1a, 0x92, 0x07, 0x1c, 0x90, 0x82, 0x90, 0x0a, 0x00, 0xc1, 0x21, + 0x8b, 0x8b, 0x12, 0x27, 0xca, 0x5b, 0xb0, 0x33, 0x10, 0xbf, 0x06, 0x2b, 0x82, 0xa9, 0x38, 0xf8, + 0x29, 0x91, 0x69, 0xb0, 0x82, 0x2c, 0xb0, 0x35, 0xab, 0x48, 0xc8, 0x31, 0x08, 0x9a, 0x98, 0x02, + 0x97, 0x1e, 0xb2, 0x19, 0x81, 0x89, 0x33, 0xb2, 0x2c, 0xc9, 0x70, 0xc2, 0x28, 0x99, 0xc2, 0x70, + 0xc0, 0x39, 0xa8, 0x92, 0x49, 0xb1, 0x39, 0xab, 0x94, 0x51, 0x8a, 0x00, 0xb0, 0x11, 0x4c, 0x98, + 0x86, 0x9c, 0x33, 0xdb, 0x30, 0x88, 0x90, 0x99, 0xa0, 0x27, 0x8c, 0x20, 0xa2, 0x1b, 0x17, 0x8e, + 0x93, 0x19, 0x81, 0xc0, 0x49, 0xf3, 0x2a, 0x81, 0x80, 0x81, 0x88, 0x6b, 0xe2, 0x28, 0xa1, 0x20, + 0x89, 0xa5, 0x2b, 0xa9, 0x22, 0x99, 0x98, 0x2d, 0x01, 0xa6, 0x11, 0x1d, 0xb1, 0x04, 0x2a, 0x9a, + 0x13, 0xb8, 0x93, 0x4e, 0xe8, 0x38, 0xa8, 0x12, 0x5b, 0xe1, 0x20, 0x0c, 0x04, 0x8a, 0x91, 0x48, + 0xaa, 0x06, 0x8c, 0x82, 0x1a, 0x80, 0x82, 0xb2, 0x3e, 0x98, 0xe3, 0x58, 0x98, 0x11, 0xb0, 0x28, + 0x1b, 0xda, 0x27, 0xaa, 0x11, 0x9a, 0x81, 0x02, 0x0d, 0x04, 0xaa, 0x85, 0x1c, 0x91, 0x11, 0x8a, + 0x96, 0x2c, 0xa1, 0x91, 0x38, 0x99, 0x10, 0xd9, 0x52, 0x1b, 0x82, 0xc0, 0x19, 0x3e, 0xd3, 0x01, + 0x99, 0x20, 0x8c, 0x07, 0x1b, 0x91, 0x80, 0x09, 0x95, 0x2e, 0x93, 0x0a, 0x01, 0xda, 0x48, 0xb0, + 0x30, 0x90, 0x1a, 0x13, 0xad, 0x27, 0x9b, 0x38, 0xb3, 0x89, 0x2f, 0xe1, 0x21, 0x98, 0x20, 0xb9, + 0x88, 0x40, 0x80, 0x41, 0xf8, 0x28, 0x99, 0x02, 0x05, 0xbb, 0x50, 0xa9, 0xa1, 0x5a, 0x9a, 0x06, + 0x0a, 0x13, 0xbc, 0x28, 0x12, 0x0b, 0x86, 0x8a, 0x82, 0xdc, 0x51, 0x89, 0xa0, 0x22, 0x1a, 0x81, + 0x9f, 0x05, 0x2a, 0xb9, 0x23, 0x80, 0x0c, 0x22, 0xcd, 0x82, 0x59, 0x90, 0x10, 0xa8, 0x80, 0x1f, + 0x95, 0x10, 0x08, 0xba, 0x02, 0x0b, 0x28, 0xa3, 0x5a, 0xb2, 0x92, 0x8f, 0x10, 0x12, 0x84, 0x2f, + 0xb9, 0x84, 0x2b, 0x80, 0x00, 0xaa, 0x87, 0x4e, 0xb1, 0x29, 0xa3, 0x1b, 0x32, 0xe0, 0x39, 0xc1, + 0x3a, 0xd3, 0x1c, 0x23, 0xb9, 0x21, 0xea, 0x30, 0x80, 0x38, 0x95, 0x9c, 0x40, 0xb8, 0x00, 0x99, + 0x34, 0x9d, 0xa2, 0x03, 0x2e, 0xe1, 0x50, 0xb9, 0x21, 0x10, 0xc1, 0x39, 0xc9, 0x22, 0xab, 0x05, + 0x29, 0xab, 0xa4, 0x2a, 0x52, 0xbb, 0x24, 0xe8, 0x4a, 0x80, 0x90, 0x11, 0xe8, 0x50, 0xa9, 0x84, + 0x88, 0x89, 0x91, 0x98, 0x22, 0x38, 0x8d, 0xa6, 0x2c, 0xa4, 0x2b, 0x81, 0x04, 0x8f, 0x11, 0xa8, + 0x11, 0x18, 0xb8, 0x09, 0x18, 0x17, 0x8c, 0x20, 0xe0, 0x20, 0x88, 0x18, 0xa2, 0x1c, 0x23, 0xaf, + 0x32, 0x90, 0x89, 0xf2, 0x4b, 0x92, 0x18, 0x13, 0xfb, 0x41, 0xc9, 0x20, 0xa8, 0x10, 0x12, 0x9d, + 0x14, 0x9b, 0x20, 0xc0, 0x08, 0x22, 0x0a, 0x05, 0x0d, 0xb3, 0x0a, 0x8a, 0x07, 0x19, 0xa1, 0x3c, + 0xf1, 0x30, 0x89, 0x13, 0x8c, 0x91, 0x09, 0x98, 0x53, 0xab, 0x86, 0x1d, 0x98, 0x11, 0x10, 0x88, + 0x11, 0xe8, 0x68, 0xb0, 0x89, 0x20, 0xa1, 0x11, 0x80, 0xd8, 0x1d, 0x31, 0xf8, 0x21, 0x30, 0xaa, + 0x83, 0x9f, 0x13, 0x3a, 0xb0, 0x22, 0xaf, 0x92, 0x28, 0x99, 0x06, 0x1b, 0xa6, 0x2c, 0xa2, 0x19, + 0x00, 0x91, 0x3b, 0xc3, 0x3a, 0x92, 0xf0, 0x7a, 0x98, 0x10, 0x92, 0x8d, 0x92, 0x40, 0xab, 0x86, + 0x3a, 0xd9, 0x12, 0x89, 0xa1, 0x78, 0xd0, 0x20, 0x88, 0x92, 0x3a, 0xc0, 0x21, 0xba, 0x00, 0x18, + 0x93, 0x3c, 0xf1, 0x28, 0x2a, 0x85, 0x28, 0xfc, 0x43, 0xba, 0x82, 0x28, 0x00, 0xa0, 0x9f, 0x83, + 0x88, 0x60, 0x98, 0xb0, 0x58, 0xb1, 0x10, 0x1b, 0x84, 0x09, 0xa1, 0x10, 0xbf, 0x05, 0x1a, 0xa8, + 0x05, 0x2c, 0xa3, 0x1c, 0x81, 0x18, 0x0c, 0x06, 0x29, 0xe8, 0x28, 0xa8, 0x28, 0x82, 0x88, 0x9a, + 0x90, 0x14, 0x00, 0x8d, 0x05, 0x19, 0x0a, 0xa5, 0x8b, 0x51, 0xa0, 0xb1, 0x1c, 0x94, 0x0a, 0x38, + 0xb8, 0x53, 0xb0, 0x8f, 0x85, 0x1a, 0x82, 0x30, 0xfb, 0x48, 0xa2, 0x8b, 0x49, 0xc3, 0x2a, 0x38, + 0xc1, 0x3a, 0xe1, 0x20, 0x9a, 0x03, 0x08, 0x12, 0xba, 0x11, 0x95, 0x0f, 0x22, 0xf3, 0x4b, 0xa1, + 0x89, 0x21, 0xbc, 0x25, 0x8b, 0x10, 0x92, 0x3b, 0x21, 0xd2, 0x19, 0x9d, 0x07, 0x9a, 0x19, 0x85, + 0xaa, 0x62, 0xb8, 0x09, 0x11, 0x8b, 0x06, 0x9a, 0x11, 0xa8, 0x41, 0xaa, 0x24, 0xea, 0x21, 0x9b, + 0x93, 0x49, 0x89, 0x88, 0x27, 0xbb, 0x1a, 0x21, 0x09, 0x07, 0x0e, 0x88, 0x92, 0x29, 0x13, 0x8a, + 0x96, 0x8c, 0x09, 0x08, 0xa1, 0x61, 0xc9, 0x25, 0x9b, 0x13, 0xdb, 0x49, 0x95, 0xaa, 0x41, 0xd9, + 0x21, 0xa0, 0x0a, 0x24, 0x19, 0x99, 0xd1, 0x3a, 0xa8, 0x50, 0x95, 0x8b, 0x13, 0xf9, 0x49, 0xa0, + 0x20, 0xa1, 0x0b, 0x01, 0xaa, 0x65, 0xa8, 0x18, 0xb8, 0x32, 0xac, 0x28, 0x82, 0xc8, 0x3b, 0x07, + 0x22, 0x9f, 0x01, 0x8a, 0x01, 0x42, 0xc0, 0x8b, 0x38, 0xc5, 0x19, 0x01, 0x81, 0x29, 0xbd, 0x92, + 0x61, 0x00, 0x98, 0x81, 0x8c, 0x11, 0x90, 0x28, 0x9b, 0xa1, 0x20, 0x1d, 0x07, 0x8d, 0x14, 0x8e, + 0x94, 0x38, 0xa9, 0xa5, 0x1c, 0x02, 0xba, 0x15, 0x1a, 0x88, 0xc4, 0x2c, 0x92, 0x19, 0x01, 0xb9, + 0x53, 0x89, 0x19, 0xc3, 0x3a, 0x93, 0xbf, 0x15, 0x08, 0x9a, 0xc2, 0x59, 0x81, 0x18, 0xa0, 0x98, + 0x6b, 0xb8, 0x21, 0xa9, 0x81, 0x71, 0xc1, 0x18, 0x90, 0x8a, 0x24, 0xb8, 0x30, 0xac, 0x96, 0x4a, + 0xec, 0x33, 0x8b, 0x04, 0x89, 0x88, 0x09, 0xa8, 0x46, 0xaa, 0x21, 0xcb, 0x28, 0x81, 0x1c, 0x86, + 0xa9, 0x33, 0x8d, 0x80, 0x82, 0x1a, 0xa2, 0x3b, 0xc2, 0x51, 0xd9, 0x21, 0x0b, 0xc4, 0x4a, 0x10, + 0xc3, 0x0e, 0x13, 0xab, 0x22, 0x00, 0xd0, 0x58, 0x8b, 0xa6, 0x1b, 0x22, 0xd9, 0x20, 0x92, 0x3c, + 0xc1, 0x38, 0x90, 0xaa, 0x6a, 0xb4, 0x39, 0x80, 0x08, 0xc1, 0x19, 0x58, 0xf8, 0x11, 0x1a, 0xa1, + 0x18, 0xa4, 0x2a, 0xb1, 0x63, 0xcb, 0x90, 0x22, 0x39, 0x9a, 0x87, 0x1f, 0x00, 0xa0, 0x10, 0x01, + 0x8d, 0x23, 0xc9, 0x5a, 0xb1, 0x49, 0x80, 0xa0, 0x59, 0xfa, 0x52, 0x9b, 0x13, 0x98, 0x8a, 0x22, + 0xbd, 0x25, 0x9b, 0x11, 0x91, 0x19, 0x0a, 0xc2, 0x60, 0xb8, 0x41, 0xc9, 0x20, 0x90, 0x1a, 0x18, + 0xb3, 0x3a, 0x38, 0xfa, 0x70, 0xb8, 0x28, 0xa4, 0x3c, 0xa2, 0xae, 0x34, 0x9a, 0x28, 0xb3, 0x0c, + 0x85, 0x1d, 0x02, 0x89, 0x22, 0x9c, 0x1b, 0xa5, 0x2a, 0x02, 0xd9, 0x50, 0x98, 0x88, 0x12, 0x9b, + 0x92, 0x60, 0xc9, 0x04, 0x1a, 0x80, 0x0b, 0xa0, 0x86, 0x2e, 0x80, 0x81, 0x00, 0xca, 0x78, 0xb1, + 0x10, 0x82, 0xad, 0x30, 0xc1, 0x70, 0xa8, 0x08, 0xa1, 0x38, 0xa1, 0x1a, 0x31, 0xf1, 0x6b, 0xc0, + 0x48, 0x98, 0x81, 0x3a, 0xd1, 0x10, 0x89, 0x12, 0xba, 0x15, 0x99, 0x2c, 0xb1, 0x20, 0x14, 0xac, + 0x28, 0xb0, 0x26, 0x8d, 0x02, 0x90, 0x8c, 0x12, 0x0c, 0x07, 0x98, 0x19, 0xe0, 0x40, 0x98, 0x91, + 0x19, 0xa1, 0x31, 0x9f, 0x24, 0xab, 0x03, 0x0a, 0x11, 0x99, 0xc0, 0x3a, 0x09, 0x07, 0x80, 0xca, + 0x40, 0x01, 0x9b, 0x96, 0x2d, 0x91, 0x82, 0x2c, 0xd0, 0x40, 0xa1, 0x4a, 0xc1, 0x89, 0x12, 0x8a, + 0x12, 0xd0, 0x4b, 0x95, 0x1b, 0x81, 0x89, 0x11, 0x00, 0x1a, 0xe6, 0x6a, 0x98, 0x88, 0x21, 0xaa, + 0x30, 0x90, 0x0a, 0x34, 0xbf, 0x22, 0xa2, 0x0c, 0x24, 0xbb, 0x85, 0x90, 0x2a, 0xd0, 0x58, 0xa1, + 0x0a, 0x22, 0xfa, 0x31, 0xc9, 0x30, 0x82, 0x9a, 0x71, 0xd9, 0x10, 0x08, 0x80, 0x11, 0x8a, 0xb5, + 0x2d, 0x08, 0xa3, 0x2a, 0x22, 0x9d, 0x93, 0x89, 0x62, 0xd8, 0x1a, 0x24, 0xf9, 0x21, 0x8b, 0x81, + 0x02, 0x0d, 0x14, 0xb9, 0x31, 0xab, 0x18, 0x98, 0x12, 0x05, 0x9f, 0x83, 0xa0, 0x5a, 0xa2, 0x8a, + 0x06, 0x0c, 0x20, 0xc4, 0x1b, 0x02, 0x8c, 0x20, 0x11, 0xd9, 0x22, 0x0a, 0xb2, 0x1d, 0x84, 0x2b, + 0x92, 0xb2, 0x5c, 0xb0, 0x0a, 0x14, 0xa9, 0x3a, 0x87, 0xaa, 0x39, 0x90, 0x21, 0xa6, 0x3c, 0x90, + 0xf2, 0x31, 0x9c, 0x84, 0x89, 0x19, 0x90, 0x09, 0x17, 0xbb, 0x13, 0x91, 0x1f, 0x94, 0x09, 0x02, + 0xab, 0x22, 0xba, 0x11, 0x4c, 0xa7, 0x0a, 0x80, 0xb2, 0x5b, 0xb5, 0x3a, 0xb1, 0x18, 0x05, 0x8d, + 0x03, 0xcb, 0x51, 0xb8, 0x58, 0xb3, 0x2e, 0xa2, 0x0b, 0x12, 0xb0, 0x58, 0xc0, 0x20, 0xb0, 0x4a, + 0xb4, 0x4b, 0x91, 0xa9, 0x78, 0xb1, 0x28, 0xc0, 0x4a, 0xc0, 0x12, 0x90, 0x39, 0xd2, 0x0a, 0x14, + 0xca, 0x50, 0xc1, 0x49, 0xc0, 0x30, 0xa9, 0x20, 0x98, 0x98, 0x14, 0xac, 0x34, 0xeb, 0x32, 0xc9, + 0x20, 0x80, 0x00, 0x80, 0x0d, 0x13, 0xaf, 0x25, 0xab, 0x23, 0xbb, 0x31, 0xa3, 0x1e, 0x83, 0xaa, + 0x31, 0xaa, 0x17, 0xdb, 0x22, 0xab, 0x12, 0x22, 0x8e, 0x04, 0x9b, 0x84, 0x2c, 0x81, 0xa0, 0x20, + 0xe8, 0x58, 0xa0, 0x18, 0xb3, 0x8e, 0x12, 0x99, 0x13, 0x00, 0x1c, 0xb2, 0x7a, 0xc0, 0x49, 0xa1, + 0x0b, 0x33, 0x9e, 0x22, 0x99, 0x30, 0x9a, 0xb9, 0x20, 0x65, 0xba, 0x21, 0x98, 0xb8, 0x71, 0xf0, + 0x11, 0x98, 0x18, 0xa8, 0x31, 0xa1, 0x4b, 0x02, 0xf9, 0x30, 0xd0, 0x39, 0xa1, 0xa9, 0x36, 0x9c, + 0x94, 0x19, 0x99, 0x91, 0x41, 0x88, 0x98, 0x2c, 0xb3, 0xa0, 0x78, 0xb2, 0x9b, 0x15, 0x8a, 0x83, + 0x8f, 0x14, 0x9a, 0x31, 0xf8, 0x4a, 0x91, 0x8a, 0x14, 0xac, 0x32, 0x91, 0x8a, 0x94, 0x2a, 0x98, + 0x2b, 0x87, 0xaa, 0x41, 0xa0, 0x0c, 0x03, 0x0c, 0x31, 0xf1, 0x19, 0x00, 0xc1, 0x70, 0xc1, 0x28, + 0x98, 0x80, 0x21, 0xc9, 0x10, 0xbb, 0x21, 0x04, 0x2f, 0xa4, 0x2a, 0x11, 0xda, 0x41, 0xe0, 0x28, + 0x90, 0x00, 0x10, 0x98, 0x89, 0x89, 0x93, 0x2a, 0x40, 0xe1, 0x41, 0xaa, 0x18, 0x04, 0x10, 0x9f, + 0x20, 0xa1, 0x1d, 0x84, 0x8b, 0x31, 0xe2, 0x2a, 0x94, 0x4b, 0xb2, 0x0a, 0x10, 0xaa, 0x24, 0xba, + 0x24, 0x2a, 0xf0, 0x78, 0xaa, 0x22, 0xc9, 0x20, 0x92, 0x1b, 0xa6, 0x09, 0x0a, 0x86, 0x8a, 0x21, + 0xc8, 0x38, 0xa0, 0x18, 0x30, 0x1c, 0x87, 0xad, 0x13, 0xab, 0x43, 0xa8, 0x2d, 0x85, 0x2b, 0xb3, + 0x1c, 0x91, 0x10, 0xa0, 0xa2, 0x5e, 0xb1, 0x4a, 0xb2, 0x1a, 0x80, 0x21, 0xe8, 0x69, 0xb2, 0x0a, + 0x01, 0x1a, 0x02, 0xd0, 0x58, 0xb0, 0x18, 0x20, 0xad, 0x93, 0x7a, 0x00, 0xd0, 0x49, 0xd1, 0x28, + 0x80, 0x92, 0x5a, 0xb9, 0x04, 0x9c, 0x41, 0xa8, 0x10, 0xa0, 0x4c, 0xc1, 0x21, 0xa1, 0x0a, 0x08, + 0xa0, 0x51, 0xa8, 0x03, 0xb9, 0x59, 0xf3, 0x3b, 0xa2, 0x30, 0x94, 0x9d, 0x10, 0xba, 0x15, 0x3b, + 0xa2, 0x94, 0x2d, 0xa3, 0x0e, 0x82, 0x88, 0x20, 0xc2, 0x58, 0xe9, 0x28, 0x81, 0x88, 0x08, 0x02, + 0x0a, 0xab, 0x64, 0xba, 0x12, 0x20, 0x1c, 0xf0, 0x58, 0x91, 0x0b, 0x93, 0xab, 0x53, 0x99, 0x22, + 0xfa, 0x20, 0x93, 0x0d, 0x12, 0xbb, 0x06, 0x9b, 0x13, 0x8b, 0x22, 0x98, 0xaa, 0x95, 0x48, 0x00, + 0xa8, 0x01, 0x81, 0xfe, 0x38, 0x01, 0xa0, 0x51, 0xda, 0x80, 0x01, 0x20, 0x01, 0x80, 0x91, 0xec, + 0x78, 0xb8, 0x29, 0x82, 0x0d, 0x24, 0x8b, 0x82, 0x8c, 0x19, 0xa7, 0x4a, 0x81, 0x00, 0xa9, 0xb1, + 0x3d, 0xa8, 0x14, 0x29, 0xb0, 0x3b, 0x95, 0x8a, 0x4b, 0xa1, 0x87, 0x0a, 0x83, 0xb9, 0x2f, 0xa7, + 0x19, 0x98, 0x18, 0x11, 0xa9, 0x30, 0xc8, 0x82, 0x78, 0xb8, 0x31, 0xda, 0x12, 0x18, 0xbd, 0x44, + 0xca, 0x41, 0x89, 0x90, 0x01, 0x8b, 0x12, 0xca, 0x53, 0xa0, 0x28, 0xa9, 0xa1, 0x38, 0xcb, 0x60, + 0xd2, 0x38, 0x11, 0xc8, 0x09, 0x81, 0x1a, 0xba, 0x42, 0x07, 0x0f, 0x81, 0x08, 0x90, 0x32, 0x0c, + 0x93, 0x0e, 0xa2, 0x0a, 0x12, 0xa4, 0x3e, 0xb2, 0x90, 0x21, 0xaa, 0x7c, 0xb0, 0xa2, 0x4a, 0x98, + 0x16, 0x99, 0x1a, 0xb1, 0xb1, 0x71, 0xe1, 0x28, 0xa0, 0x4a, 0xb5, 0x1b, 0x03, 0xaa, 0x60, 0xc1, + 0x39, 0xc1, 0x28, 0x92, 0xab, 0x06, 0x0b, 0x02, 0xa8, 0x1b, 0xa3, 0x78, 0x92, 0x9b, 0x98, 0x34, + 0x1a, 0xd2, 0x2b, 0xa9, 0x02, 0x17, 0x1a, 0xad, 0x24, 0xa9, 0x18, 0x0b, 0x22, 0x87, 0x0e, 0x03, + 0xbb, 0x41, 0xc2, 0x2a, 0xb2, 0x3a, 0xa3, 0x98, 0x7a, 0xf2, 0x58, 0xa8, 0x18, 0x88, 0x08, 0x01, + 0x09, 0xa2, 0x20, 0x9f, 0x22, 0x92, 0xae, 0x53, 0x99, 0x18, 0xa2, 0x2a, 0xa8, 0x93, 0x01, 0x9f, + 0x05, 0xb9, 0x30, 0xb9, 0x25, 0x0a, 0xe3, 0x68, 0xc9, 0x41, 0xa9, 0x01, 0x09, 0xa1, 0x08, 0xa8, + 0x71, 0xa8, 0x92, 0xb0, 0x79, 0x90, 0x20, 0x98, 0xd2, 0x4c, 0xb2, 0x00, 0x0b, 0x04, 0x8b, 0x87, + 0x8c, 0x81, 0x18, 0x21, 0x80, 0x9b, 0x07, 0x8c, 0x94, 0x2c, 0xb3, 0x00, 0x8a, 0x82, 0x4b, 0xd3, + 0x38, 0xb9, 0x12, 0x2e, 0x92, 0x01, 0x1f, 0xa3, 0x09, 0x2a, 0x94, 0x18, 0xe8, 0x38, 0xb8, 0x82, + 0x3d, 0x14, 0xba, 0x28, 0x92, 0x99, 0x7a, 0xc3, 0x8a, 0x11, 0x01, 0x9d, 0x12, 0x00, 0x81, 0x98, + 0x3f, 0xc5, 0x39, 0x9a, 0x14, 0x9e, 0x84, 0x38, 0xca, 0x21, 0x88, 0x8a, 0x15, 0xaa, 0x10, 0x09, + 0x03, 0x90, 0x0b, 0x89, 0x87, 0xba, 0x28, 0x9a, 0x33, 0x77, 0xdb, 0x11, 0x09, 0x23, 0xba, 0x21, + 0xbc, 0x23, 0xaa, 0x86, 0x1a, 0xdb, 0x26, 0xbb, 0x32, 0x9b, 0x07, 0x1a, 0x80, 0xc8, 0x30, 0x81, + 0xaa, 0x22, 0xf8, 0x7a, 0x98, 0x00, 0x28, 0xb9, 0x53, 0xca, 0x21, 0x99, 0x00, 0x82, 0x39, 0xe9, + 0x11, 0x3c, 0xf1, 0x48, 0xa8, 0x21, 0xb9, 0x04, 0x9b, 0x15, 0xb9, 0x02, 0x4b, 0xe9, 0x32, 0x9c, + 0x33, 0xca, 0x12, 0x8a, 0x81, 0x89, 0x63, 0xa8, 0x8b, 0x05, 0x8e, 0x13, 0xaa, 0x30, 0xa2, 0x0b, + 0x23, 0xdf, 0x73, 0x99, 0x11, 0xab, 0x22, 0xa9, 0x80, 0x78, 0xba, 0x33, 0xaa, 0x82, 0x1c, 0x80, + 0x22, 0x21, 0xad, 0x07, 0x9c, 0x31, 0xb0, 0x1a, 0x91, 0x3c, 0xa4, 0x9c, 0x25, 0x9c, 0x14, 0xa9, + 0x10, 0x00, 0x1d, 0x87, 0x8c, 0x03, 0x0b, 0x91, 0x08, 0x29, 0xb6, 0x3b, 0xa3, 0x1a, 0x93, 0x1a, + 0x83, 0xcc, 0x5a, 0xb4, 0x28, 0x3b, 0xa5, 0x0b, 0x9a, 0x53, 0x1a, 0xa7, 0x1d, 0x91, 0x08, 0x38, + 0xb1, 0x2b, 0x14, 0x8c, 0xc2, 0x38, 0x92, 0x2c, 0x93, 0xe3, 0x3d, 0xa1, 0x18, 0xb1, 0x6a, 0xa9, + 0x04, 0x20, 0x8d, 0xd3, 0x29, 0x80, 0x22, 0x1a, 0xf2, 0x3b, 0xa4, 0x3a, 0x99, 0x83, 0x1a, 0xa2, + 0x20, 0xdf, 0x43, 0x89, 0x92, 0xab, 0x94, 0x58, 0x9a, 0x81, 0xb8, 0x54, 0x8a, 0x94, 0x8b, 0x39, + 0xd3, 0x2a, 0x96, 0x2c, 0xb8, 0x12, 0x39, 0xc2, 0x20, 0xa2, 0x2e, 0xa8, 0x00, 0x01, 0x0c, 0x07, + 0xaa, 0x01, 0x99, 0x12, 0x4a, 0x1a, 0xf3, 0x20, 0x09, 0x00, 0xb1, 0x2f, 0x05, 0x9a, 0x29, 0xd2, + 0x4b, 0xc1, 0x31, 0x99, 0x11, 0x0b, 0xb0, 0x01, 0x2a, 0x35, 0xa9, 0x20, 0xbe, 0xa1, 0x34, 0x78, + 0xf3, 0x18, 0xaa, 0x89, 0x25, 0xa8, 0x41, 0xba, 0x11, 0x8a, 0x19, 0xa6, 0x38, 0x49, 0xf1, 0x28, + 0xba, 0x42, 0xb8, 0x30, 0x08, 0xbb, 0x17, 0xac, 0x22, 0x81, 0x19, 0xa2, 0x09, 0xbc, 0x53, 0x01, + 0xca, 0x71, 0xc9, 0x11, 0x08, 0xab, 0x64, 0xa0, 0x0a, 0xa1, 0x8a, 0x33, 0x91, 0x88, 0x00, 0x1e, + 0xa7, 0x3a, 0x98, 0x91, 0x21, 0x09, 0xba, 0xf0, 0x6a, 0x20, 0xb8, 0x20, 0x08, 0xab, 0x87, 0x0c, + 0x11, 0x08, 0x05, 0x8b, 0xd0, 0x41, 0x99, 0xc8, 0x40, 0xa2, 0x3b, 0xb3, 0xaa, 0x41, 0x59, 0xf1, + 0x20, 0x9a, 0x93, 0x49, 0xc1, 0x19, 0xa2, 0x18, 0x2c, 0xa5, 0x2b, 0x82, 0xba, 0x15, 0x29, 0x9f, + 0x94, 0x39, 0xa1, 0x3a, 0xc4, 0x4b, 0xb2, 0x0a, 0x3a, 0x97, 0x3a, 0x89, 0xb9, 0x40, 0x83, 0x0f, + 0x83, 0x09, 0x12, 0xbb, 0x29, 0x87, 0xbb, 0x32, 0xb0, 0x14, 0x0e, 0xb4, 0x2c, 0xa2, 0x42, 0xbc, + 0x63, 0xb9, 0x91, 0x51, 0x9c, 0x03, 0x98, 0x5b, 0xc0, 0x21, 0x89, 0x91, 0x20, 0xdb, 0x33, 0xca, + 0x63, 0xba, 0x81, 0x20, 0x9b, 0x16, 0xd0, 0x5b, 0xa2, 0x1a, 0x92, 0x99, 0x40, 0xc0, 0x30, 0xe0, + 0x28, 0x81, 0x09, 0x91, 0x9c, 0x42, 0xb3, 0x2a, 0xa2, 0x0f, 0x91, 0x13, 0x2d, 0xc2, 0x19, 0x02, + 0x8a, 0xa9, 0x06, 0x0a, 0x08, 0x2a, 0xf3, 0x38, 0x01, 0xb1, 0x2c, 0x84, 0x99, 0x01, 0xbe, 0x13, + 0x90, 0x4e, 0x85, 0x9b, 0x28, 0x89, 0x82, 0x08, 0x63, 0xe8, 0x29, 0xa2, 0x89, 0x12, 0x10, 0x9a, + 0xf4, 0x3b, 0x19, 0xb7, 0x18, 0x30, 0xca, 0x12, 0x09, 0x10, 0xc0, 0x1b, 0x23, 0x9e, 0x25, 0xaa, + 0x89, 0x08, 0x44, 0xb9, 0xb8, 0x70, 0xe8, 0x12, 0x10, 0xc0, 0x28, 0x88, 0x89, 0x81, 0x1a, 0x03, + 0xcb, 0x74, 0xb9, 0x99, 0x04, 0x20, 0xa2, 0x9d, 0x31, 0xf9, 0x51, 0xa8, 0x18, 0x28, 0x9c, 0x05, + 0xac, 0x24, 0x8b, 0x84, 0x0a, 0x19, 0xb3, 0x1c, 0x04, 0xdb, 0x43, 0x9a, 0x92, 0x1a, 0x84, 0x1b, + 0xc3, 0x68, 0xb9, 0x20, 0x8c, 0x96, 0x4a, 0xb0, 0x18, 0x81, 0x88, 0x29, 0xb2, 0x49, 0xa6, 0x2f, + 0xc2, 0x28, 0x00, 0x88, 0x1b, 0xa4, 0x2a, 0xb2, 0x8b, 0x23, 0x2b, 0x97, 0x19, 0x11, 0xbc, 0x51, + 0xc0, 0x1a, 0x86, 0x2a, 0xd2, 0x29, 0xb8, 0x80, 0x73, 0xc9, 0x21, 0xa8, 0x49, 0xe2, 0x38, 0x90, + 0x88, 0x20, 0xd9, 0x31, 0xc9, 0x50, 0xc8, 0x10, 0x81, 0x8b, 0x86, 0x0a, 0x12, 0xaa, 0x10, 0x83, + 0x2c, 0xd1, 0x48, 0x99, 0x91, 0x38, 0xce, 0x17, 0x8a, 0x81, 0x8a, 0x03, 0x08, 0x09, 0xc1, 0x2a, + 0x06, 0x8c, 0x04, 0xac, 0x33, 0xba, 0x18, 0x13, 0x1e, 0xa5, 0x3c, 0xb1, 0x29, 0x22, 0xab, 0x12, + 0xe8, 0x3a, 0x01, 0x0a, 0x13, 0x8f, 0x87, 0x1c, 0x91, 0x29, 0x90, 0x21, 0x9b, 0xb3, 0x7a, 0xb0, + 0x18, 0x92, 0x1c, 0x92, 0x00, 0x32, 0xbe, 0x21, 0xd4, 0x6c, 0xa1, 0x2a, 0x81, 0x0a, 0x21, 0xc0, + 0x0c, 0x01, 0x10, 0x90, 0x78, 0xc2, 0x2a, 0x90, 0x90, 0x19, 0x81, 0x03, 0x9c, 0x33, 0xcf, 0x84, + 0x3b, 0x93, 0x93, 0x1f, 0xd3, 0x29, 0x91, 0x89, 0x13, 0x0c, 0x43, 0xd9, 0x0a, 0x84, 0x2d, 0x83, + 0x9b, 0x04, 0xaa, 0x58, 0xd3, 0x2b, 0x12, 0xaa, 0x24, 0xab, 0x91, 0x4a, 0x83, 0x90, 0xaf, 0x15, + 0x2a, 0xe2, 0x28, 0xba, 0x23, 0x00, 0x88, 0x99, 0x39, 0x07, 0xb8, 0x2b, 0xa2, 0x3a, 0xf1, 0x70, + 0xb8, 0x30, 0x82, 0x9e, 0x88, 0x21, 0x90, 0x50, 0x98, 0xf1, 0x30, 0xa8, 0x00, 0x08, 0x30, 0xca, + 0x84, 0x2b, 0xaa, 0x84, 0x2a, 0x14, 0xdc, 0x41, 0x91, 0x09, 0x88, 0xa0, 0x6a, 0xc2, 0x60, 0xd9, + 0x28, 0x88, 0xa3, 0x18, 0x08, 0xa8, 0x10, 0x23, 0x9d, 0x01, 0xa1, 0x03, 0xff, 0x05, 0x88, 0x18, + 0xb0, 0x2c, 0x94, 0x2a, 0x91, 0x8a, 0x24, 0xac, 0x84, 0x8c, 0x13, 0x01, 0x9b, 0x96, 0x1e, 0x82, + 0x08, 0x88, 0x80, 0x01, 0x98, 0x28, 0xe9, 0x29, 0x43, 0xca, 0xa1, 0x59, 0x01, 0xc0, 0x49, 0xb0, + 0x41, 0x9d, 0x85, 0x89, 0x3a, 0xa4, 0x9a, 0x14, 0x0d, 0xa1, 0x81, 0x78, 0xb0, 0x09, 0x82, 0x38, + 0xc9, 0x28, 0x04, 0x9d, 0x24, 0xbd, 0x30, 0x01, 0x08, 0xb1, 0x2a, 0x85, 0x8c, 0x03, 0x8d, 0x13, + 0xc1, 0x69, 0xb8, 0x8a, 0x15, 0x99, 0x80, 0xa2, 0x3a, 0xa0, 0x62, 0xe2, 0x3a, 0x80, 0x90, 0x88, + 0x90, 0x6a, 0xb2, 0x18, 0xab, 0x85, 0x4b, 0x94, 0x8b, 0x22, 0x8b, 0xa0, 0x07, 0x8e, 0x14, 0x8c, + 0x93, 0x0b, 0x12, 0xa8, 0x4b, 0xa4, 0x2b, 0x83, 0x00, 0x85, 0xaf, 0x04, 0x90, 0x8c, 0x13, 0x89, + 0xc1, 0x7a, 0xb1, 0x18, 0x21, 0x08, 0x8c, 0xc1, 0x50, 0x99, 0x90, 0x43, 0x9d, 0xb1, 0x40, 0x90, + 0x98, 0x52, 0xc0, 0x3a, 0xb2, 0x22, 0xad, 0x04, 0x0a, 0x98, 0x01, 0x40, 0x9c, 0xf2, 0x61, 0xa9, + 0x00, 0x81, 0x18, 0x2a, 0xa4, 0x01, 0xaf, 0x83, 0x88, 0x28, 0xb3, 0x3d, 0xb3, 0x0a, 0x63, 0xea, + 0x30, 0x81, 0x9b, 0x82, 0x11, 0x9a, 0x98, 0x42, 0x88, 0x2d, 0xc7, 0x59, 0xc9, 0x22, 0x8a, 0x92, + 0x19, 0x02, 0xa9, 0x5b, 0xb3, 0x0b, 0x23, 0xe8, 0x3c, 0xb0, 0x36, 0xaa, 0x08, 0xa0, 0x28, 0x18, + 0x00, 0x17, 0xbf, 0x42, 0x98, 0x99, 0x33, 0xa9, 0x94, 0x0e, 0x01, 0xc8, 0x51, 0x99, 0xa2, 0x10, + 0x18, 0xb3, 0x8f, 0x85, 0x1b, 0xa0, 0x03, 0x7b, 0xd2, 0x39, 0xa9, 0x13, 0x8b, 0x1a, 0x94, 0x89, + 0x24, 0x8b, 0xba, 0x36, 0x0b, 0xe9, 0x51, 0xa0, 0x10, 0x8b, 0xa0, 0x21, 0x81, 0x79, 0xf1, 0x28, + 0x90, 0x11, 0xac, 0x83, 0x48, 0xc8, 0x40, 0xba, 0x14, 0x1c, 0x12, 0xaa, 0x10, 0x18, 0x9c, 0x17, + 0x8d, 0x82, 0x89, 0x30, 0xc1, 0x58, 0xc9, 0x20, 0x83, 0x9d, 0x20, 0xa0, 0x40, 0x90, 0x00, 0xcb, + 0x20, 0x83, 0x3a, 0xc1, 0x0a, 0x06, 0x0d, 0x91, 0x11, 0x9d, 0x05, 0x09, 0xc1, 0x40, 0x80, 0xcb, + 0x18, 0x85, 0x28, 0xbb, 0x17, 0x8b, 0x01, 0x08, 0xb8, 0x00, 0x30, 0x13, 0xdf, 0x14, 0x9a, 0x18, + 0x08, 0x12, 0xa0, 0x1f, 0x94, 0x8b, 0x40, 0x83, 0xad, 0x11, 0x10, 0xc9, 0x41, 0x98, 0x98, 0x3a, + 0x42, 0xf0, 0x59, 0x98, 0x09, 0xc2, 0x48, 0x00, 0xc9, 0x33, 0xbb, 0x41, 0xc8, 0x20, 0xb2, 0x0e, + 0x03, 0x9a, 0x04, 0x1a, 0x30, 0xf9, 0x58, 0x09, 0x98, 0x10, 0x99, 0x1b, 0x10, 0xc2, 0x71, 0xa1, + 0x19, 0x10, 0xdc, 0x25, 0x8c, 0x80, 0x81, 0x3a, 0xb2, 0x19, 0xa0, 0x81, 0x79, 0xf1, 0x30, 0x98, + 0x08, 0x80, 0xd9, 0x30, 0x59, 0xc3, 0x8a, 0x02, 0x9a, 0x40, 0xc8, 0x23, 0x9d, 0x31, 0x85, 0xae, + 0x23, 0x0c, 0x01, 0x98, 0x30, 0xea, 0x50, 0xa1, 0x89, 0x21, 0xca, 0x22, 0xaa, 0x52, 0xba, 0x83, + 0x4a, 0xc0, 0x48, 0xa8, 0x84, 0x2f, 0xc3, 0x10, 0x99, 0x01, 0x98, 0x88, 0x14, 0xba, 0x63, 0xca, + 0x28, 0x96, 0x0b, 0x11, 0xa9, 0x68, 0xc2, 0x39, 0xd0, 0x29, 0x01, 0xa9, 0x52, 0xaa, 0x23, 0xba, + 0x48, 0xf2, 0x5b, 0x91, 0x08, 0x08, 0x81, 0x89, 0xca, 0x27, 0x0d, 0x83, 0x9a, 0x10, 0x88, 0x88, + 0x11, 0x0b, 0x87, 0x1a, 0x01, 0xbb, 0x14, 0x8c, 0x22, 0xf2, 0x4a, 0xa2, 0x0c, 0x84, 0x8a, 0x20, + 0xb0, 0x23, 0xbd, 0x71, 0xa8, 0x20, 0x93, 0x8f, 0x93, 0x89, 0x04, 0x8c, 0x10, 0xb1, 0x50, 0xc0, + 0x19, 0x82, 0x0a, 0x53, 0xbc, 0x04, 0x8b, 0x21, 0x92, 0x0c, 0xa2, 0x28, 0x08, 0x91, 0xe8, 0x2c, + 0x07, 0x2b, 0xc1, 0x18, 0x39, 0xd1, 0x30, 0xc0, 0x3a, 0x84, 0x0a, 0xb8, 0x0a, 0x73, 0xc0, 0x38, + 0xa1, 0x0e, 0x93, 0x1a, 0x01, 0x2a, 0xa5, 0x00, 0x4b, 0xc9, 0x32, 0xb0, 0x3c, 0xc1, 0x8c, 0x25, + 0x9b, 0x14, 0xba, 0x42, 0xc0, 0x59, 0xc0, 0x29, 0x02, 0x9b, 0x24, 0xfb, 0x40, 0x89, 0x80, 0x81, + 0x1c, 0x93, 0x0b, 0x13, 0x90, 0x7a, 0xb8, 0x10, 0x98, 0x8a, 0x49, 0xf3, 0x50, 0x80, 0xc1, 0x2a, + 0xb1, 0x5b, 0xa3, 0x8a, 0x52, 0xc8, 0x20, 0xc8, 0x1a, 0x05, 0x0c, 0x86, 0x8b, 0x11, 0xa0, 0x3a, + 0xb4, 0x2a, 0x80, 0x88, 0x17, 0x9c, 0x19, 0x81, 0x98, 0x42, 0x0b, 0xa3, 0x30, 0xca, 0x00, 0x8c, + 0x27, 0x9b, 0x81, 0x29, 0xc0, 0x92, 0x0f, 0x12, 0xa2, 0x7a, 0xa0, 0x8a, 0x11, 0x88, 0x31, 0xe2, + 0x4b, 0xb1, 0x09, 0x30, 0xba, 0x94, 0x2a, 0x31, 0xa1, 0xbf, 0x47, 0xbb, 0x13, 0x08, 0x8c, 0x83, + 0x20, 0xf8, 0x1a, 0x20, 0xc1, 0x38, 0x92, 0xc2, 0x5d, 0xb1, 0x82, 0x0d, 0x83, 0x2a, 0xb0, 0x68, + 0xa8, 0x01, 0x28, 0xea, 0x18, 0x11, 0x28, 0xd4, 0x3b, 0x94, 0x19, 0x9a, 0x90, 0x21, 0xf3, 0x59, + 0xaa, 0x02, 0x11, 0xa9, 0x81, 0x68, 0xd9, 0x12, 0x0b, 0x94, 0x4b, 0xf0, 0x51, 0xa8, 0x10, 0xa8, + 0x19, 0xa8, 0x29, 0x17, 0x9d, 0x23, 0x99, 0x88, 0x08, 0x10, 0x00, 0xaa, 0x16, 0x0f, 0x82, 0x88, + 0x88, 0x0a, 0x30, 0xb2, 0x03, 0x1e, 0x18, 0xb1, 0x32, 0x20, 0xcf, 0x14, 0x8b, 0x10, 0xb8, 0x11, + 0xc1, 0x3c, 0xc3, 0x20, 0x51, 0xb0, 0x80, 0xab, 0x91, 0x78, 0x90, 0xe1, 0x50, 0xb9, 0x28, 0x18, + 0x08, 0x94, 0x0f, 0x15, 0xaa, 0x22, 0xac, 0x20, 0x84, 0x9e, 0x05, 0x0c, 0x82, 0x19, 0x9a, 0x93, + 0x60, 0xa1, 0x0a, 0x92, 0x8a, 0xa8, 0x14, 0x19, 0x92, 0xb9, 0x84, 0x0f, 0xb2, 0x16, 0x9c, 0x62, + 0xa9, 0x91, 0x29, 0x99, 0x05, 0x0b, 0x12, 0xea, 0x58, 0xa0, 0x39, 0xb9, 0x31, 0x10, 0xd9, 0x71, + 0xc8, 0x01, 0x08, 0xa0, 0x08, 0x82, 0x18, 0xf0, 0x30, 0x89, 0xb3, 0x2d, 0x84, 0x1b, 0xa5, 0x39, + 0x9a, 0xf0, 0x50, 0xa0, 0x80, 0x10, 0xaa, 0x22, 0x1a, 0x96, 0x9c, 0x38, 0x12, 0xbb, 0x60, 0xb1, + 0x1c, 0x10, 0x83, 0x0d, 0x91, 0x52, 0xca, 0x21, 0x99, 0x89, 0x50, 0xc2, 0x59, 0xa8, 0x08, 0x80, + 0x8a, 0x28, 0xb5, 0x5a, 0x80, 0xa0, 0x12, 0x1b, 0xa8, 0x00, 0x04, 0xca, 0x8f, 0x07, 0xaa, 0x20, + 0x84, 0x0b, 0x21, 0x98, 0xd0, 0x38, 0x2a, 0xb6, 0x09, 0x01, 0x0b, 0xc2, 0x58, 0x92, 0x9f, 0x82, + 0x41, 0x0c, 0xa5, 0x29, 0xb9, 0x31, 0xc1, 0x12, 0x8e, 0x23, 0x98, 0x9e, 0x21, 0x00, 0x0a, 0x13, + 0xa0, 0xbe, 0x45, 0x9a, 0xa0, 0x41, 0xc0, 0x28, 0xa9, 0x15, 0x8b, 0x90, 0x21, 0x80, 0x8e, 0x03, + 0x99, 0x21, 0x08, 0xf1, 0x59, 0x0a, 0xb4, 0x5a, 0x91, 0x09, 0xd1, 0x3a, 0x98, 0x03, 0x94, 0x08, + 0x1f, 0xa3, 0x80, 0x0b, 0x38, 0xf8, 0x43, 0x19, 0xfa, 0x21, 0x88, 0x88, 0x01, 0xb9, 0x38, 0x49, + 0xf0, 0x19, 0x33, 0x0b, 0x84, 0x9c, 0x18, 0x90, 0x14, 0x8d, 0x90, 0x81, 0x78, 0xa0, 0x09, 0x95, + 0x2b, 0xb0, 0xb0, 0x79, 0xb2, 0x38, 0x92, 0x0b, 0x91, 0x79, 0xe0, 0x00, 0x3a, 0xc0, 0x18, 0x11, + 0xa0, 0x29, 0x16, 0x0b, 0xa2, 0x2c, 0xb0, 0xa0, 0x6b, 0x86, 0x8b, 0x21, 0xb3, 0x8f, 0x00, 0x88, + 0x85, 0x1b, 0x82, 0xa8, 0x62, 0xaa, 0x90, 0x11, 0x1b, 0x95, 0x1b, 0x90, 0x23, 0x8c, 0x68, 0xf0, + 0x50, 0x99, 0x80, 0x1a, 0xb3, 0x7b, 0xb2, 0x18, 0xaa, 0x86, 0x2a, 0x89, 0x02, 0xaa, 0x62, 0xd8, + 0x38, 0x98, 0x01, 0x12, 0xf9, 0x3c, 0x01, 0xab, 0x24, 0x18, 0x92, 0x0f, 0x92, 0x19, 0x1c, 0x87, + 0x9a, 0x02, 0x99, 0x81, 0x10, 0xa0, 0x16, 0x9f, 0x22, 0x89, 0x88, 0x01, 0xaa, 0x23, 0x2c, 0xa5, + 0x8b, 0x41, 0xa9, 0x11, 0xbc, 0x15, 0x2a, 0xf9, 0x42, 0x89, 0x80, 0x08, 0x98, 0x8d, 0x24, 0x91, + 0x1d, 0x01, 0xa1, 0x3a, 0xab, 0x87, 0x1a, 0xb2, 0x18, 0x99, 0x4b, 0x82, 0xc2, 0x4c, 0x95, 0x29, + 0x09, 0xf0, 0x48, 0x89, 0x81, 0xa1, 0x29, 0xe8, 0x30, 0xc8, 0x40, 0xa1, 0x21, 0x2d, 0xd1, 0x28, + 0xb8, 0x51, 0x98, 0x18, 0x88, 0x19, 0xb2, 0xeb, 0x71, 0xc8, 0x21, 0x88, 0x00, 0x91, 0x8a, 0x43, + 0xea, 0x48, 0xa8, 0x14, 0x9f, 0x12, 0x08, 0xa0, 0x11, 0x88, 0x1c, 0x92, 0x80, 0xc0, 0x79, 0x91, + 0x90, 0x1e, 0xa3, 0x10, 0x0a, 0x14, 0x9d, 0x98, 0x63, 0xa8, 0x39, 0xb8, 0x11, 0x8b, 0x33, 0xcb, + 0xb3, 0x5f, 0x93, 0x8b, 0x19, 0x07, 0x8b, 0x00, 0x88, 0xb2, 0x4c, 0x01, 0xca, 0x50, 0x80, 0xa1, + 0x80, 0x2b, 0x92, 0xb9, 0x73, 0xb0, 0x3a, 0xb2, 0x10, 0xfa, 0x49, 0x83, 0xdb, 0x41, 0xa8, 0x32, + 0x9d, 0x83, 0x21, 0x9c, 0x17, 0xbb, 0x18, 0x88, 0x92, 0x0c, 0x42, 0xb8, 0x14, 0x8a, 0xa0, 0x78, + 0xc9, 0x23, 0x18, 0xaa, 0x18, 0xe2, 0x1d, 0x10, 0xb3, 0x79, 0xb0, 0x21, 0xc9, 0x10, 0xb0, 0x52, + 0x90, 0x0a, 0xa1, 0x99, 0x5e, 0xa4, 0x2c, 0xb2, 0x1a, 0x01, 0xa1, 0x71, 0xc8, 0x18, 0x02, 0x99, + 0x28, 0xd8, 0x38, 0xa9, 0x71, 0xd1, 0x20, 0x89, 0x08, 0x12, 0xda, 0x10, 0xa1, 0x2e, 0x83, 0x28, + 0xac, 0x43, 0xb8, 0xba, 0x54, 0xa8, 0x88, 0x19, 0x13, 0x0a, 0xb2, 0xba, 0x7a, 0x90, 0x23, 0x08, + 0xf1, 0x7c, 0xb8, 0x22, 0x0b, 0x82, 0x92, 0x8f, 0x02, 0x0b, 0x82, 0x09, 0x19, 0x80, 0x72, 0xd9, + 0x41, 0x90, 0x90, 0x29, 0xd9, 0x42, 0xbb, 0x31, 0xca, 0x31, 0xcb, 0x51, 0x84, 0x0d, 0x03, 0xba, + 0x41, 0x89, 0x94, 0x8c, 0x13, 0x90, 0x9e, 0x00, 0x81, 0x20, 0x19, 0xf3, 0x3a, 0x82, 0x98, 0x41, + 0xab, 0x85, 0x2b, 0x91, 0x87, 0x8f, 0x92, 0x3a, 0xa4, 0x09, 0x29, 0xc2, 0x38, 0xa8, 0x38, 0x05, + 0x0d, 0xb1, 0x19, 0x49, 0xd4, 0x29, 0x88, 0x8a, 0x85, 0x08, 0x1a, 0x83, 0xb1, 0x2f, 0x93, 0x19, + 0xa1, 0x48, 0x0a, 0xfc, 0x32, 0xc9, 0x42, 0x99, 0xa1, 0x22, 0xaf, 0x13, 0x9a, 0x12, 0x11, 0xb8, + 0x30, 0xcb, 0x07, 0x8c, 0x11, 0xa9, 0x85, 0x3c, 0xc0, 0x00, 0x28, 0xb1, 0x58, 0xb1, 0x50, 0xd8, + 0x10, 0x88, 0xb9, 0x54, 0xba, 0x21, 0x8a, 0x22, 0x80, 0x8e, 0x04, 0x9d, 0x04, 0x29, 0xa1, 0xa0, + 0x5b, 0xc0, 0x89, 0x33, 0x1a, 0xc2, 0x02, 0xa9, 0x0f, 0x13, 0x23, 0xe8, 0x39, 0xa9, 0xe9, 0x01, + 0x60, 0xb9, 0x04, 0x1b, 0x93, 0x0a, 0x10, 0xa6, 0x2e, 0xb2, 0x1a, 0x81, 0x01, 0x20, 0xf8, 0x29, + 0x02, 0xba, 0x22, 0x8c, 0x14, 0x89, 0x00, 0x00, 0x39, 0x95, 0x8f, 0xa1, 0x00, 0x49, 0xc8, 0x83, + 0x0f, 0x04, 0x18, 0xa8, 0x90, 0x3c, 0x94, 0x0a, 0x91, 0x10, 0x1b, 0xd8, 0x20, 0x8b, 0x07, 0x1a, + 0x09, 0x83, 0x2a, 0xb1, 0x12, 0xf3, 0x4a, 0x1b, 0xf3, 0x28, 0x3c, 0xe2, 0x11, 0x2a, 0xd2, 0x38, + 0xd0, 0x21, 0x0b, 0x93, 0x60, 0xd8, 0x00, 0x8b, 0x12, 0x01, 0x3c, 0xa2, 0xba, 0x78, 0xa0, 0x02, + 0xa9, 0x30, 0x81, 0xa2, 0x3c, 0xd4, 0x2b, 0x90, 0x91, 0xbf, 0x24, 0x41, 0xf9, 0x11, 0x1b, 0x82, + 0x19, 0x82, 0x02, 0xbe, 0x13, 0xab, 0x09, 0x23, 0x2d, 0xc6, 0x49, 0x00, 0xd0, 0x30, 0xb8, 0x40, + 0x91, 0x1a, 0xb2, 0x9d, 0x42, 0xe8, 0x3b, 0x95, 0x3a, 0xd0, 0x30, 0x1a, 0xa5, 0x3a, 0xb1, 0x19, + 0x88, 0x13, 0xbb, 0x81, 0x1f, 0xb6, 0x29, 0x18, 0xa8, 0x03, 0x1c, 0xc9, 0x37, 0x8d, 0x83, 0x1a, + 0x90, 0x18, 0xc8, 0x52, 0xcb, 0x31, 0xa9, 0x52, 0x9a, 0xa0, 0x28, 0xcb, 0x46, 0xaa, 0x13, 0x89, + 0xa8, 0x42, 0xca, 0x51, 0xb9, 0x81, 0x1b, 0x80, 0x15, 0x0c, 0x88, 0x22, 0xba, 0x32, 0x2b, 0x87, + 0xab, 0x98, 0x04, 0x8e, 0x17, 0x8b, 0x81, 0x89, 0x09, 0x05, 0x0e, 0x04, 0x8a, 0x00, 0xb0, 0x29, + 0x92, 0x79, 0xd2, 0x28, 0x98, 0xa8, 0x49, 0xb3, 0x7b, 0xc1, 0x38, 0x99, 0xa2, 0x1c, 0x03, 0x80, + 0x1a, 0x94, 0x9c, 0x33, 0xbc, 0x25, 0xab, 0x21, 0x95, 0x0f, 0x92, 0x19, 0x93, 0x8c, 0x44, 0xea, + 0x38, 0x91, 0x09, 0x12, 0xba, 0x48, 0xb0, 0x28, 0x99, 0x12, 0xad, 0x32, 0xb3, 0x4e, 0x93, 0xaa, + 0x1a, 0x52, 0xe1, 0x3a, 0x83, 0xc9, 0x48, 0xaa, 0x23, 0xd9, 0x59, 0xa2, 0x8c, 0x25, 0xb9, 0x81, + 0x09, 0x41, 0xf8, 0x39, 0x81, 0x9a, 0x24, 0x9d, 0x85, 0x9a, 0x30, 0xb1, 0x0a, 0x22, 0x89, 0xb2, + 0x5a, 0x04, 0x8e, 0x12, 0xaa, 0x22, 0xb9, 0x3e, 0xc5, 0x3a, 0xa0, 0x11, 0x84, 0x2b, 0xa2, 0xcb, + 0x71, 0xc0, 0x49, 0x90, 0x9a, 0x83, 0x2b, 0xa2, 0x21, 0x28, 0x88, 0xb5, 0x0e, 0x31, 0xf3, 0x38, + 0x99, 0x8a, 0x06, 0x8b, 0x81, 0xa9, 0x45, 0xac, 0x13, 0xba, 0x41, 0x02, 0xcb, 0x24, 0x0b, 0x02, + 0xac, 0x18, 0x84, 0x1c, 0xb1, 0x7b, 0xd1, 0x29, 0x91, 0x09, 0x21, 0x85, 0x8a, 0xa2, 0x40, 0xf8, + 0x20, 0x0a, 0x81, 0xa0, 0x3c, 0xd2, 0x0a, 0x23, 0x0a, 0xb3, 0x12, 0x7b, 0xd9, 0x31, 0x88, 0x11, + 0xb9, 0x0b, 0x04, 0xce, 0x52, 0xb0, 0x20, 0x9b, 0x97, 0x8a, 0x32, 0x81, 0xad, 0x25, 0x8c, 0x01, + 0x88, 0x2a, 0xc3, 0x1d, 0x83, 0x8c, 0x11, 0x02, 0x90, 0x8b, 0x42, 0xe2, 0x30, 0x89, 0xc0, 0x19, + 0x01, 0x9b, 0x80, 0x07, 0x1e, 0x94, 0x1d, 0x03, 0x9a, 0x02, 0x00, 0x8e, 0x94, 0x3b, 0xa3, 0x89, + 0x30, 0xf8, 0x48, 0xb1, 0x1a, 0x91, 0x18, 0x62, 0xfa, 0x31, 0x8a, 0x98, 0x11, 0x1b, 0x12, 0xa1, + 0x30, 0x8e, 0xb5, 0x5a, 0xa1, 0x8a, 0x02, 0x9b, 0x21, 0xb4, 0x3f, 0xe4, 0x39, 0xa1, 0x29, 0x12, + 0xb8, 0x78, 0xe8, 0x28, 0x91, 0x89, 0x11, 0xa8, 0x20, 0xb8, 0x41, 0xd8, 0x31, 0x01, 0xab, 0xa1, + 0x22, 0x1c, 0xc9, 0x21, 0x85, 0x1a, 0x90, 0x15, 0xdf, 0x31, 0x99, 0x11, 0x08, 0x90, 0x20, 0xbe, + 0x17, 0x9b, 0x23, 0x99, 0x80, 0x09, 0xac, 0x27, 0x0c, 0x93, 0x09, 0xa8, 0x20, 0xa2, 0x39, 0xcc, + 0x33, 0x89, 0x88, 0x70, 0xc0, 0x19, 0x94, 0x1b, 0x01, 0xab, 0x97, 0x3b, 0x08, 0x95, 0x9b, 0x85, + 0x1e, 0xa4, 0x29, 0x09, 0x92, 0x4a, 0x91, 0x09, 0xc9, 0x31, 0x9b, 0x82, 0x91, 0x2f, 0xb4, 0x38, + 0x2a, 0xb6, 0x29, 0x98, 0x9b, 0x86, 0x3a, 0xa6, 0x2c, 0xb2, 0x2a, 0xc8, 0x04, 0x3c, 0xc5, 0x29, + 0x90, 0x18, 0x98, 0x32, 0x8c, 0xb2, 0x73, 0xba, 0x03, 0xa9, 0x0b, 0x80, 0x42, 0xa2, 0x4b, 0xd4, + 0x19, 0x01, 0xd9, 0x52, 0xc8, 0x38, 0x98, 0x91, 0x83, 0x1c, 0x00, 0x92, 0x3e, 0xe1, 0x18, 0x20, + 0x09, 0x89, 0xd8, 0x50, 0x9b, 0x06, 0x1a, 0x12, 0x8c, 0x81, 0x01, 0x9e, 0x13, 0x9b, 0x85, 0x19, + 0xb1, 0x9f, 0x31, 0x03, 0x1a, 0xa4, 0x9a, 0x48, 0xba, 0x06, 0x1b, 0xa2, 0x0a, 0x91, 0x1c, 0x02, + 0x37, 0x9e, 0x02, 0x9a, 0x93, 0x4c, 0xc3, 0x39, 0xa9, 0x94, 0x4c, 0xb1, 0x38, 0xa0, 0x0c, 0x43, + 0xca, 0x03, 0x8c, 0x10, 0xb3, 0x7b, 0x93, 0xab, 0x05, 0x8c, 0x00, 0x88, 0x32, 0x82, 0xae, 0x02, + 0x9a, 0x91, 0x78, 0xa1, 0x48, 0xa0, 0x80, 0x1e, 0xa3, 0x20, 0xb9, 0x00, 0x0a, 0x63, 0xe8, 0x08, + 0x30, 0xc8, 0x22, 0xab, 0x01, 0x85, 0x8f, 0x22, 0x09, 0x97, 0x0a, 0x89, 0x93, 0x2d, 0xa2, 0x1a, + 0x80, 0x22, 0xc9, 0x03, 0x3c, 0x81, 0x9a, 0x82, 0x44, 0xae, 0x31, 0xf8, 0x33, 0x9e, 0x90, 0x13, + 0x8a, 0x05, 0xb9, 0x30, 0x08, 0xb8, 0xb3, 0x6e, 0xb2, 0x09, 0x28, 0xd8, 0x48, 0xa1, 0x09, 0x92, + 0x2a, 0x63, 0xb0, 0xa9, 0x1a, 0x82, 0x1b, 0x93, 0xa4, 0x0b, 0x53, 0xba, 0xf1, 0x60, 0x9a, 0x84, + 0x88, 0x49, 0xe2, 0x91, 0x6a, 0xa0, 0x08, 0x90, 0x21, 0xad, 0x13, 0x0b, 0xa5, 0x5b, 0xa1, 0x12, + 0x0b, 0x85, 0x8c, 0x98, 0x40, 0xb0, 0x81, 0x50, 0xcb, 0x11, 0x08, 0x20, 0x82, 0x99, 0xa2, 0x18, + 0xbf, 0x32, 0x13, 0xcf, 0x13, 0x89, 0x89, 0x23, 0x9e, 0x85, 0x0b, 0x35, 0xc9, 0x4a, 0xa2, 0x8a, + 0x0a, 0xa1, 0x45, 0xbb, 0x33, 0xeb, 0x38, 0x02, 0xb1, 0x2a, 0xca, 0x64, 0xc0, 0x19, 0x29, 0xc4, + 0x3a, 0x92, 0x8b, 0x89, 0x06, 0x9a, 0x81, 0x58, 0xc0, 0x38, 0xb3, 0x1a, 0x02, 0xaa, 0x14, 0xae, + 0x89, 0x27, 0x9a, 0x81, 0xa9, 0x02, 0x4c, 0x04, 0xd9, 0x19, 0x24, 0x8d, 0xa2, 0x1a, 0x92, 0x4a, + 0x91, 0x05, 0x8f, 0x82, 0x09, 0xa1, 0x60, 0xb0, 0x28, 0x98, 0x8a, 0x31, 0x88, 0x05, 0x9c, 0x0a, + 0x87, 0x2b, 0xb4, 0x2a, 0x92, 0x0a, 0x01, 0xd0, 0x4e, 0xb3, 0x3b, 0xa1, 0x22, 0x9b, 0x96, 0x0c, + 0xa3, 0x58, 0xf2, 0x39, 0xb9, 0x23, 0x0b, 0x91, 0x43, 0xb9, 0x10, 0x8e, 0xa3, 0x29, 0x32, 0xe2, + 0x49, 0xb8, 0xab, 0x23, 0x1a, 0x16, 0xea, 0x28, 0x11, 0x92, 0x0c, 0x81, 0x93, 0x1d, 0x93, 0xf9, + 0x68, 0xa0, 0x80, 0x1a, 0x92, 0x28, 0xb8, 0x22, 0x0d, 0xb5, 0x4a, 0xa1, 0x00, 0x48, 0xc1, 0x09, + 0xa0, 0x3b, 0x96, 0x0c, 0x03, 0x9c, 0x34, 0x8b, 0x01, 0x80, 0x8f, 0x85, 0x0b, 0x13, 0x99, 0x98, + 0x98, 0x60, 0x83, 0x0c, 0xb1, 0x99, 0x19, 0x58, 0xe2, 0x11, 0x1c, 0xa5, 0x2c, 0x83, 0x11, 0x9c, + 0x82, 0x8e, 0x93, 0x2b, 0x03, 0x82, 0x8d, 0xa3, 0x3b, 0x09, 0x07, 0xa9, 0x2a, 0x26, 0xc8, 0x8b, + 0x13, 0xab, 0x01, 0x81, 0x4a, 0xe8, 0x33, 0x28, 0xad, 0x13, 0xa1, 0x3b, 0xac, 0x27, 0xb8, 0x2b, + 0xa2, 0x99, 0x4b, 0xb2, 0x69, 0xa8, 0x33, 0xb1, 0x5a, 0x01, 0xe9, 0x3c, 0x06, 0x99, 0x99, 0x90, + 0x29, 0x1e, 0x86, 0x89, 0x8a, 0x24, 0x99, 0x91, 0x6a, 0xb2, 0x31, 0xbf, 0x04, 0x8b, 0x11, 0x13, + 0xcd, 0x21, 0xa3, 0x29, 0x89, 0xb3, 0x0c, 0x88, 0x23, 0xea, 0x63, 0x99, 0xc0, 0x40, 0xa8, 0x04, + 0x0d, 0x91, 0x02, 0x9a, 0x32, 0xbd, 0x14, 0x09, 0x90, 0x91, 0x1b, 0x15, 0x9b, 0x03, 0x18, 0xc5, + 0x39, 0xbc, 0xc3, 0x0c, 0x62, 0xc2, 0x69, 0x90, 0x99, 0x10, 0x88, 0x10, 0x93, 0x2f, 0xc2, 0x1a, + 0x88, 0x10, 0x39, 0x97, 0x3b, 0xf8, 0x38, 0x99, 0x04, 0x29, 0xe2, 0x19, 0x00, 0x92, 0x3a, 0xf1, + 0x28, 0x98, 0x0a, 0x04, 0x8c, 0x21, 0xa2, 0x2b, 0x82, 0x0a, 0x82, 0x31, 0x73, 0xf0, 0x5c, 0xb9, + 0x12, 0x19, 0xc9, 0x22, 0xaa, 0x14, 0x08, 0xd0, 0x60, 0x98, 0x80, 0x39, 0xf2, 0x29, 0x90, 0x10, + 0xa8, 0x20, 0xb8, 0xaa, 0x74, 0xc8, 0x33, 0xda, 0x28, 0x80, 0x08, 0x22, 0xdb, 0x43, 0xcb, 0x21, + 0x99, 0x01, 0x10, 0xca, 0x11, 0x3a, 0xb4, 0x0a, 0x61, 0xa5, 0x0d, 0x92, 0x11, 0x1d, 0xd3, 0x3a, + 0x80, 0x08, 0x0a, 0x97, 0x0c, 0x14, 0x99, 0xa9, 0x58, 0x92, 0x09, 0x00, 0x94, 0x8f, 0x03, 0x09, + 0x89, 0xa2, 0x3a, 0xc2, 0x1c, 0x85, 0x09, 0x0a, 0x04, 0x12, 0x8f, 0x83, 0x99, 0x19, 0x00, 0xb1, + 0x91, 0x3e, 0xa5, 0x8b, 0x81, 0x7a, 0xa1, 0x39, 0x83, 0xb9, 0x2f, 0xa4, 0x2c, 0x91, 0x08, 0x18, + 0xc1, 0x59, 0xa1, 0x11, 0x8c, 0xa0, 0x12, 0x1e, 0x05, 0x9b, 0x82, 0x49, 0xbc, 0x06, 0x29, 0xa8, + 0x21, 0xa9, 0x29, 0xa0, 0xbb, 0x27, 0x0a, 0x11, 0xb8, 0x2a, 0xaa, 0x73, 0xe8, 0x22, 0x29, 0xc0, + 0x80, 0x0e, 0x04, 0x89, 0x18, 0x99, 0x90, 0x22, 0x60, 0xb8, 0x83, 0x0c, 0xca, 0x33, 0x9b, 0x17, + 0x8d, 0xa2, 0x51, 0x99, 0x98, 0x20, 0xd4, 0x4b, 0xb2, 0x1a, 0x21, 0x19, 0x92, 0xab, 0x7b, 0xb4, + 0x2c, 0xb1, 0x29, 0xb1, 0x32, 0x13, 0xbf, 0x62, 0xc8, 0x11, 0x2a, 0xb0, 0x13, 0x0f, 0xa3, 0x20, + 0xaa, 0xa1, 0x30, 0xa8, 0x52, 0xb9, 0x10, 0x0c, 0xc3, 0x1b, 0x71, 0xa4, 0x4a, 0xc1, 0x0a, 0x23, + 0xbb, 0x33, 0xdc, 0x49, 0x90, 0x18, 0x86, 0x0e, 0x92, 0x18, 0x18, 0xc2, 0x49, 0xd9, 0x21, 0x81, + 0x89, 0x11, 0xc9, 0x58, 0xd9, 0x12, 0x0a, 0xa1, 0x01, 0x1a, 0x13, 0x53, 0xba, 0xc1, 0x3a, 0xd2, + 0x18, 0x3b, 0x87, 0x89, 0x89, 0xa1, 0x2d, 0xa1, 0x70, 0x92, 0x0c, 0x83, 0xa8, 0x50, 0xa1, 0xbb, + 0x11, 0x1f, 0xa6, 0x1a, 0x91, 0x09, 0x92, 0x18, 0x62, 0xb0, 0x41, 0x9a, 0xd0, 0x19, 0x29, 0x95, + 0x0c, 0x84, 0xac, 0x22, 0x90, 0x40, 0xd0, 0x59, 0x91, 0x8a, 0x01, 0x0a, 0x85, 0x0c, 0x11, 0xe8, + 0x4a, 0x92, 0x1b, 0x94, 0x39, 0xa0, 0xb9, 0x63, 0xab, 0x02, 0x08, 0x0b, 0x93, 0x70, 0xb2, 0x18, + 0x90, 0x0a, 0xb2, 0x9f, 0x52, 0xdb, 0x24, 0xa9, 0x30, 0xc8, 0x38, 0xb2, 0x1e, 0x84, 0x0a, 0x38, + 0xf1, 0x29, 0xb1, 0x51, 0xb0, 0x09, 0x02, 0x99, 0x38, 0xb2, 0x50, 0xf8, 0x38, 0xc8, 0x00, 0x29, + 0x01, 0xb8, 0x38, 0x07, 0x9f, 0x14, 0x89, 0x01, 0xa9, 0x28, 0xd8, 0x29, 0x01, 0x89, 0x33, 0xfb, + 0x43, 0xbb, 0x41, 0xa9, 0x09, 0x24, 0x99, 0x02, 0xbd, 0x03, 0x0b, 0x83, 0x92, 0x1f, 0x95, 0x0b, + 0x95, 0x3a, 0xc1, 0x28, 0xb0, 0x3a, 0x09, 0xa3, 0x78, 0xfb, 0x50, 0x98, 0x08, 0x82, 0x1a, 0x93, + 0x0a, 0x84, 0xad, 0x30, 0xd8, 0x40, 0xb8, 0x20, 0x82, 0xad, 0x43, 0xc9, 0x50, 0x91, 0x51, 0xf9, + 0x18, 0x90, 0x08, 0x10, 0x98, 0x28, 0xd0, 0x41, 0xa9, 0x18, 0x13, 0x19, 0xc0, 0x2a, 0xb1, 0xca, + 0x71, 0xb0, 0x40, 0x99, 0x01, 0xaa, 0x52, 0xa2, 0x1a, 0xac, 0x94, 0x60, 0xca, 0x32, 0x9c, 0x83, + 0x1a, 0x91, 0x20, 0xf9, 0x31, 0x9a, 0x21, 0x9a, 0x97, 0x3c, 0xa2, 0xb2, 0x4c, 0x02, 0xda, 0x11, + 0x19, 0xb9, 0x32, 0xd9, 0x2b, 0x16, 0x08, 0x9a, 0x93, 0x0f, 0x23, 0xa0, 0x18, 0xbb, 0x91, 0x5c, + 0x83, 0xb0, 0x0f, 0x04, 0x0d, 0x84, 0x0b, 0x11, 0x83, 0x8b, 0x00, 0x8c, 0x15, 0x89, 0xb9, 0x1a, + 0x04, 0x08, 0x8d, 0x94, 0x19, 0x13, 0x9f, 0x03, 0x19, 0x02, 0x18, 0xfa, 0x3a, 0x02, 0xb9, 0x34, + 0xbb, 0x0d, 0x86, 0x3a, 0xe3, 0x39, 0x81, 0x99, 0x09, 0xb2, 0x5a, 0xba, 0x32, 0x99, 0x91, 0x46, + 0xd8, 0x19, 0x29, 0xd2, 0x30, 0xc1, 0x2a, 0xa2, 0xac, 0x47, 0xb9, 0x10, 0xc1, 0x3b, 0xd2, 0x20, + 0x02, 0xa9, 0x72, 0xc8, 0x2a, 0xa2, 0x38, 0xa3, 0x8e, 0x04, 0x99, 0x0a, 0x94, 0x8a, 0x01, 0x11, + 0xfb, 0x41, 0x01, 0x9a, 0x19, 0x23, 0xa0, 0x2b, 0xe1, 0xac, 0x55, 0xba, 0x10, 0x08, 0x40, 0xa4, + 0x0c, 0x82, 0x99, 0x40, 0xc8, 0x00, 0x90, 0x60, 0xf0, 0x18, 0x90, 0x08, 0x11, 0x01, 0x89, 0x2a, + 0x84, 0xac, 0x25, 0x9b, 0x12, 0x9c, 0x11, 0xb2, 0xbf, 0x05, 0x09, 0x11, 0xc0, 0x20, 0x99, 0x73, + 0xb0, 0x0b, 0x32, 0xaa, 0x10, 0xaa, 0x31, 0xd2, 0x1d, 0x03, 0xb1, 0x3b, 0x99, 0x91, 0x31, 0x25, + 0x39, 0xf1, 0x29, 0x90, 0xbb, 0x31, 0xd1, 0x3c, 0xa5, 0x30, 0xc1, 0x3a, 0x94, 0x9e, 0x21, 0xa0, + 0x30, 0xaa, 0x01, 0x99, 0x5b, 0xa3, 0x9b, 0x44, 0x90, 0x59, 0xb0, 0x3a, 0xf1, 0x0c, 0x11, 0xa0, + 0x70, 0x91, 0x99, 0xa9, 0x38, 0xb2, 0x63, 0x01, 0x90, 0x9b, 0x92, 0x9c, 0xd9, 0x41, 0x9a, 0x33, + 0xbb, 0x93, 0x4b, 0x99, 0x27, 0xbb, 0x12, 0x8c, 0x05, 0x99, 0x09, 0x03, 0xa9, 0x1d, 0xa2, 0xa8, + 0x29, 0x43, 0xbb, 0x35, 0x2a, 0xa0, 0x91, 0x1b, 0xc2, 0x2a, 0x03, 0xac, 0x04, 0x3d, 0xa4, 0x0b, + 0x0b, 0x15, 0x19, 0x94, 0x1d, 0xa2, 0x29, 0x92, 0xb8, 0x2c, 0xb8, 0x30, 0xc0, 0x30, 0x03, 0xbd, + 0x32, 0xb9, 0x30, 0x11, 0x13, 0x30, 0xca, 0x01, 0x0a, 0xd9, 0x30, 0xb3, 0x9d, 0x13, 0xb9, 0x09, + 0x21, 0x32, 0xba, 0x52, 0xb1, 0x9b, 0x04, 0x1a, 0x12, 0x9a, 0x43, 0xca, 0x00, 0x00, 0x10, 0xa3, + 0x1b, 0x93, 0x9a, 0x32, 0xb9, 0x39, 0x01, 0x2a, 0xb2, 0xab, 0x04, 0x0a, 0x11, 0x91, 0x39, 0xa1, + 0x10, 0x9a, 0x01, 0x19, 0x00, 0x92, 0x0c, 0x04, 0x1b, 0x92, 0x9a, 0x10, 0x9b, 0x33, 0xa0, 0x1a, + 0x92, 0x0b, 0x04, 0x0a, 0x12, 0x99, 0x99, 0x90, 0x2a, 0xb0, 0x31, 0x93, 0x09, 0x99, 0xa0, 0x11, + 0x09, 0x23, 0x90, 0xa9, 0x11, 0x9a, 0x91, 0x29, 0x91, 0x99, 0x11, 0xa0, 0x20, 0x01, 0x10, 0x91, + 0x09, 0x90, 0x99, 0x10, 0x99, 0x11, 0x91, 0x10, 0x90, 0x10, 0x09, 0x91, 0x19, 0x91, 0x10, 0x09, + 0x91, 0x09, 0x10, 0x00, 0x00, 0x90, 0x10, 0x90, 0x10, 0x00, 0x09, 0x01, 0x90, 0x10, 0x09, 0x10, + 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, + 0x34, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x77, 0x7f, 0x77, 0x4c, 0xf5, 0x19, 0xb5, 0x2f, + 0x92, 0x10, 0xa8, 0xcc, 0x75, 0xf8, 0x48, 0x81, 0x99, 0x28, 0xa8, 0x69, 0xc0, 0x12, 0x89, 0x99, + 0x82, 0x31, 0x06, 0x9e, 0x31, 0xba, 0x23, 0x9b, 0xa8, 0x52, 0xb8, 0x50, 0xb9, 0x93, 0x1a, 0x4a, + 0xb4, 0x0b, 0x93, 0x28, 0x11, 0xf9, 0x11, 0x3c, 0x94, 0x0c, 0x83, 0x9b, 0x12, 0x80, 0x28, 0x95, + 0x8f, 0x86, 0x8b, 0x12, 0x9b, 0x43, 0xc9, 0x19, 0x93, 0x88, 0x49, 0xb9, 0x84, 0x3d, 0xd1, 0x51, + 0xd9, 0x21, 0xa8, 0x31, 0xf8, 0x30, 0x98, 0x90, 0x20, 0x99, 0xa1, 0x2b, 0x85, 0x5a, 0xc1, 0x0a, + 0x30, 0xa8, 0xc1, 0x50, 0x89, 0xa0, 0x21, 0xd8, 0x7a, 0xa2, 0x10, 0x89, 0xc0, 0x5b, 0xa2, 0x00, + 0x88, 0x28, 0xac, 0x17, 0x8d, 0x04, 0x0c, 0x93, 0x8b, 0x31, 0xb1, 0x4b, 0xd1, 0x59, 0xb1, 0x29, + 0x88, 0x81, 0x98, 0x79, 0xc1, 0x10, 0x1a, 0x28, 0xd3, 0x19, 0x32, 0xbf, 0x13, 0xa1, 0x31, 0x0f, + 0xa3, 0x89, 0x28, 0x00, 0x9c, 0x86, 0x9a, 0x22, 0xca, 0x33, 0x0f, 0x82, 0x1a, 0x82, 0x98, 0x08, + 0x40, 0xa8, 0x1a, 0xc3, 0x59, 0xd1, 0x89, 0x52, 0x99, 0x41, 0xcb, 0x93, 0x1b, 0x42, 0xe1, 0x28, + 0xa8, 0x68, 0xe1, 0x29, 0x93, 0x3b, 0xe3, 0x38, 0xb8, 0x19, 0x82, 0x18, 0x11, 0x9f, 0x13, 0x8b, + 0x92, 0x92, 0x2b, 0x1b, 0x87, 0xcb, 0x51, 0x88, 0x98, 0x87, 0x8c, 0x31, 0xa8, 0x12, 0x89, 0xc8, + 0x28, 0x09, 0x83, 0xcb, 0x34, 0x60, 0xd0, 0x08, 0xcb, 0x34, 0xa8, 0x49, 0xf1, 0x28, 0x90, 0x18, + 0x98, 0x32, 0x8d, 0x02, 0xca, 0x40, 0xb1, 0x28, 0x81, 0xa8, 0x3a, 0x32, 0xf8, 0x0b, 0x34, 0x93, + 0x1b, 0xbc, 0xd2, 0x52, 0x80, 0x29, 0xc8, 0x0c, 0x05, 0x8a, 0x82, 0x19, 0xa8, 0x16, 0xbd, 0x28, + 0x21, 0x01, 0xb9, 0x87, 0x9f, 0x04, 0x88, 0x09, 0x92, 0x11, 0x8b, 0xc2, 0x7b, 0xa2, 0xa8, 0x52, + 0xa0, 0x1c, 0x80, 0x82, 0x09, 0x10, 0x9a, 0x0a, 0x87, 0x0e, 0x03, 0x8b, 0x01, 0x84, 0x9d, 0x29, + 0x85, 0x99, 0x53, 0xca, 0x10, 0x8a, 0x33, 0x0c, 0xc1, 0x61, 0xa9, 0x91, 0x4b, 0xb2, 0x40, 0xaa, + 0x83, 0x0d, 0x01, 0x80, 0x82, 0xca, 0x20, 0x24, 0xcb, 0x11, 0xab, 0x48, 0x86, 0x0a, 0xaa, 0x03, + 0x20, 0x14, 0xbf, 0x22, 0x12, 0x0d, 0xd0, 0x49, 0x85, 0x1b, 0xc1, 0x1a, 0x82, 0x18, 0x24, 0xba, + 0xea, 0x51, 0xb0, 0x4b, 0x92, 0x90, 0x5a, 0xb0, 0x29, 0xa0, 0x71, 0xc1, 0x89, 0x81, 0x08, 0x13, + 0x1b, 0x14, 0xcf, 0x12, 0x80, 0x99, 0x61, 0xb9, 0x31, 0xc0, 0x1b, 0x85, 0x09, 0x88, 0x13, 0x8e, + 0x91, 0x48, 0xc3, 0x3c, 0x89, 0x97, 0x2b, 0x90, 0x10, 0xc0, 0x38, 0x83, 0xcb, 0x08, 0x34, 0x0e, + 0x82, 0x9b, 0x51, 0xd0, 0x38, 0xa0, 0x10, 0x98, 0x60, 0xcb, 0x12, 0xa8, 0x70, 0xc0, 0x30, 0xd8, + 0x20, 0x88, 0x08, 0x80, 0x88, 0x24, 0xbd, 0x01, 0x10, 0x82, 0x20, 0xe9, 0x2a, 0xa3, 0x4b, 0xa2, + 0xf0, 0x61, 0x09, 0xc8, 0x10, 0x0a, 0x05, 0x0b, 0x92, 0x8a, 0x19, 0x83, 0x23, 0xad, 0x30, 0x11, + 0xfa, 0x1c, 0x16, 0xb9, 0x42, 0xda, 0x21, 0x8b, 0x04, 0x00, 0x9b, 0x80, 0x52, 0xe9, 0x38, 0xb0, + 0x48, 0xa1, 0x38, 0xea, 0x30, 0xb1, 0x20, 0x89, 0x89, 0xa8, 0x32, 0x81, 0x9c, 0xa5, 0x7c, 0xc2, + 0x08, 0xa1, 0x49, 0x03, 0xa8, 0x8d, 0x80, 0x00, 0x51, 0xd8, 0x11, 0x09, 0xa0, 0x31, 0xcf, 0x86, + 0x18, 0xa8, 0x00, 0x90, 0x48, 0xb0, 0x30, 0xca, 0x14, 0x08, 0xbb, 0x33, 0xbd, 0x17, 0x3b, 0xc9, + 0x20, 0xa1, 0x5b, 0x02, 0xba, 0x91, 0x6b, 0xb0, 0x20, 0x80, 0x38, 0xf1, 0x10, 0x0f, 0x84, 0x88, + 0x00, 0xa0, 0x19, 0x13, 0x8b, 0x89, 0x07, 0x8d, 0x13, 0x9d, 0x83, 0x19, 0x08, 0xb2, 0x30, 0x8d, + 0x22, 0xb8, 0x02, 0x0d, 0x42, 0xf2, 0x4c, 0xc1, 0x20, 0xb1, 0x69, 0xb8, 0x10, 0xb0, 0x4a, 0x02, + 0x99, 0x90, 0x48, 0xd3, 0x3e, 0xb4, 0x3a, 0xa1, 0x28, 0xc9, 0x00, 0x38, 0x12, 0xf0, 0x28, 0xa9, + 0x21, 0x0c, 0x87, 0x8a, 0x18, 0x13, 0xcb, 0x0a, 0x53, 0xb8, 0x31, 0xfa, 0x22, 0xab, 0x34, 0xd9, + 0x01, 0x19, 0x13, 0xbe, 0x42, 0xb9, 0x43, 0xcb, 0x31, 0xca, 0x31, 0x80, 0x80, 0xad, 0x53, 0xc8, + 0x30, 0x9c, 0x05, 0x89, 0x02, 0x9a, 0x01, 0x98, 0x20, 0xa4, 0x1c, 0x00, 0x42, 0xdd, 0x22, 0x9a, + 0x33, 0xfa, 0x40, 0xa9, 0x00, 0x81, 0x10, 0x9d, 0x05, 0x9a, 0x92, 0x0c, 0x15, 0x99, 0x00, 0x9a, + 0x24, 0xbb, 0x53, 0xa8, 0x10, 0x89, 0x03, 0xc8, 0x4c, 0xc2, 0x41, 0xb8, 0x3a, 0xd3, 0x1c, 0xa2, + 0x38, 0x9a, 0x23, 0xf1, 0x29, 0x98, 0x72, 0xd0, 0x20, 0x9a, 0x20, 0x9a, 0x02, 0x42, 0x1b, 0xfa, + 0x52, 0x8d, 0x02, 0x90, 0x10, 0xba, 0x52, 0x99, 0x90, 0x39, 0x87, 0x9b, 0x03, 0x9b, 0x81, 0x40, + 0x10, 0xfa, 0x21, 0x2b, 0xc8, 0x82, 0x21, 0x09, 0xa3, 0x9f, 0x84, 0x8a, 0x79, 0xb0, 0x18, 0x91, + 0x2b, 0x93, 0x8a, 0x23, 0x34, 0x9c, 0x99, 0xf3, 0x70, 0xa8, 0x10, 0x81, 0x9c, 0x11, 0x82, 0x0f, + 0x83, 0x2b, 0xb4, 0x9c, 0x22, 0xa0, 0x42, 0x0d, 0xa1, 0x88, 0x19, 0x11, 0xa2, 0x4d, 0x92, 0xc0, + 0x5a, 0xb1, 0x31, 0x19, 0xa1, 0xc9, 0x58, 0x02, 0x0a, 0xd9, 0x48, 0xa8, 0x59, 0xb0, 0x2a, 0xf3, + 0x5a, 0x91, 0x99, 0x3a, 0xb4, 0x40, 0xa9, 0x32, 0x8c, 0x13, 0xbe, 0x33, 0xcb, 0x54, 0xca, 0x32, + 0xbb, 0x11, 0x02, 0x8c, 0x84, 0x20, 0xba, 0x0a, 0x33, 0xdb, 0x84, 0x79, 0xb0, 0x00, 0xb9, 0x59, + 0x95, 0x0d, 0x03, 0xb9, 0x20, 0x80, 0x18, 0xc8, 0x34, 0x9f, 0x94, 0x8a, 0x22, 0x00, 0xbb, 0x04, + 0x1d, 0x83, 0xa9, 0x73, 0xab, 0x85, 0x1a, 0x81, 0x8a, 0x05, 0x8b, 0x93, 0x0d, 0x03, 0x8a, 0x14, + 0xbe, 0x42, 0xb8, 0x30, 0xc9, 0x28, 0x12, 0xf8, 0x40, 0x99, 0x92, 0x38, 0xc9, 0x38, 0xc2, 0x61, + 0xa9, 0x88, 0x18, 0xa1, 0x20, 0xc2, 0x4b, 0xa4, 0x8c, 0x01, 0x20, 0xd8, 0x02, 0x3b, 0x92, 0x9f, + 0x04, 0x81, 0x1d, 0x83, 0x9a, 0x81, 0x4b, 0x97, 0x08, 0xb9, 0x21, 0x00, 0x9a, 0x83, 0x19, 0xad, + 0x30, 0x07, 0x9e, 0x21, 0x88, 0x38, 0xd0, 0x38, 0x90, 0xc9, 0x71, 0xc0, 0x20, 0xa1, 0x10, 0xba, + 0x42, 0x98, 0x01, 0xbd, 0x42, 0xa8, 0x18, 0x03, 0x8f, 0xa2, 0x51, 0x9a, 0xab, 0x16, 0x1a, 0xb3, + 0x2c, 0xb2, 0x71, 0x99, 0x00, 0x11, 0x9d, 0x05, 0x89, 0x8b, 0x11, 0x84, 0x9a, 0x10, 0x90, 0x8a, + 0x53, 0xda, 0xa2, 0x59, 0xb0, 0x21, 0xf8, 0x3a, 0x86, 0x09, 0x98, 0x92, 0x4b, 0xb4, 0x38, 0xca, + 0x11, 0xa2, 0x79, 0xd9, 0x11, 0x88, 0x10, 0xa1, 0x3a, 0xe1, 0x1a, 0x03, 0x80, 0xac, 0x63, 0x90, + 0x0a, 0x81, 0x08, 0xc4, 0x7b, 0xd1, 0x08, 0x21, 0x0b, 0x85, 0xbb, 0x51, 0xb0, 0x28, 0x88, 0x93, + 0x8e, 0x05, 0x0b, 0xa1, 0x09, 0x35, 0x9a, 0x80, 0xbb, 0x16, 0x3a, 0xc1, 0x00, 0x89, 0xa0, 0x42, + 0xdb, 0x20, 0x41, 0xc0, 0x89, 0x8a, 0x30, 0x93, 0x72, 0xf0, 0x5b, 0xa1, 0x09, 0x83, 0x1b, 0x13, + 0x9c, 0xb3, 0x3c, 0xb2, 0x70, 0xa1, 0x1b, 0xb1, 0x6a, 0x91, 0x1a, 0x91, 0x99, 0x51, 0xc0, 0xab, + 0x72, 0xa1, 0x28, 0xd8, 0x19, 0x13, 0x0a, 0x96, 0x0c, 0x13, 0x8c, 0x82, 0xaa, 0x73, 0xb8, 0x10, + 0x1b, 0xc3, 0x99, 0x25, 0x1b, 0xd0, 0x18, 0x33, 0xac, 0x90, 0x22, 0xc8, 0x38, 0xa2, 0x9b, 0xc1, + 0x7a, 0x94, 0x89, 0x2a, 0x96, 0x08, 0x0b, 0x93, 0x0b, 0x05, 0x19, 0xb0, 0xae, 0x26, 0x9a, 0x11, + 0xca, 0x41, 0x8a, 0xb5, 0x58, 0x99, 0x81, 0x18, 0x99, 0xa3, 0x5b, 0xa3, 0x9c, 0x93, 0x2d, 0x81, + 0x20, 0xb3, 0x8e, 0x19, 0x12, 0x86, 0x8e, 0x12, 0xa0, 0x98, 0x6b, 0xb2, 0x29, 0x22, 0x9c, 0x86, + 0x0e, 0x13, 0x9a, 0xa1, 0x20, 0xa0, 0x9b, 0x06, 0x1b, 0x93, 0xa9, 0x72, 0xdb, 0x02, 0x1c, 0x04, + 0x9b, 0x30, 0x95, 0x1d, 0x90, 0x22, 0x98, 0x9a, 0x43, 0xca, 0x00, 0x22, 0x0a, 0x0a, 0xa8, 0x07, + 0x0f, 0x91, 0x40, 0xc1, 0x1b, 0x02, 0x09, 0xb2, 0x48, 0xe9, 0x40, 0xb8, 0x13, 0xbc, 0x62, 0x98, + 0x20, 0xb8, 0x48, 0xc1, 0x2d, 0x84, 0x1a, 0xd3, 0x3a, 0xb2, 0x1c, 0x04, 0x1a, 0xb0, 0x20, 0x01, + 0xbd, 0x23, 0x00, 0x9d, 0x06, 0x8b, 0x93, 0x1c, 0x23, 0xb8, 0x20, 0x9f, 0x24, 0xc8, 0x28, 0x0a, + 0xa5, 0x3a, 0xa8, 0x92, 0x81, 0x7b, 0xa0, 0x90, 0x8a, 0x25, 0x08, 0xfa, 0x30, 0x90, 0x11, 0xc8, + 0x5a, 0xd0, 0x22, 0x8a, 0x08, 0xc3, 0x3b, 0x23, 0xdd, 0x02, 0x18, 0x93, 0x8d, 0x11, 0x8a, 0x10, + 0x12, 0xc8, 0x59, 0x90, 0x90, 0x53, 0xbb, 0x23, 0xc9, 0x2a, 0x82, 0xd2, 0x5c, 0xa2, 0x2a, 0xe1, + 0x40, 0xda, 0x31, 0x89, 0x11, 0xe9, 0x18, 0x22, 0x1a, 0xe1, 0x40, 0xa9, 0x00, 0x10, 0x9b, 0x95, + 0x3c, 0x96, 0x1c, 0x91, 0x58, 0xb1, 0x8c, 0x04, 0x8a, 0x12, 0xaa, 0x31, 0xb8, 0x08, 0x2a, 0xa6, + 0x1c, 0x15, 0xba, 0x80, 0x21, 0x10, 0x89, 0xb0, 0x83, 0x2f, 0xf3, 0x18, 0x11, 0x9c, 0x33, 0xba, + 0x2b, 0xa3, 0x4d, 0xa6, 0x4b, 0xb0, 0x38, 0xe3, 0x4b, 0x92, 0x29, 0xb1, 0x29, 0xfa, 0x51, 0x88, + 0x90, 0x80, 0x1c, 0xa4, 0x49, 0xc1, 0x3a, 0xa1, 0x38, 0xa1, 0x0e, 0x09, 0x15, 0x2a, 0xba, 0x20, + 0xaa, 0x52, 0x91, 0x49, 0xd9, 0x40, 0xb1, 0x1c, 0x81, 0x04, 0xc0, 0x2c, 0x02, 0xca, 0x53, 0x9b, + 0x06, 0x9c, 0x11, 0x88, 0x98, 0x33, 0xc8, 0x1a, 0x84, 0x1c, 0x93, 0x09, 0x98, 0x24, 0xbc, 0x1a, + 0x84, 0x20, 0x9a, 0x87, 0x9a, 0x68, 0xb1, 0x98, 0x1c, 0x25, 0x8c, 0x93, 0x8c, 0x03, 0x0b, 0x07, + 0xa9, 0x00, 0x09, 0x82, 0x91, 0x0f, 0x14, 0x9a, 0x91, 0x39, 0x98, 0x15, 0x8d, 0x91, 0x09, 0x09, + 0x10, 0x83, 0x89, 0x5b, 0xa4, 0x0b, 0x91, 0x64, 0xb0, 0x3c, 0xc3, 0x99, 0x30, 0xe8, 0x31, 0x90, + 0x08, 0xb9, 0x38, 0xed, 0x64, 0xb8, 0x29, 0x88, 0xb3, 0x2c, 0x02, 0x30, 0xad, 0x14, 0x9a, 0x09, + 0xb2, 0x70, 0xf2, 0x28, 0x81, 0xaa, 0x41, 0x88, 0x01, 0xab, 0x62, 0xac, 0x83, 0x1a, 0x23, 0xcc, + 0x32, 0xaa, 0xa8, 0x63, 0x18, 0xba, 0x05, 0x8d, 0x12, 0xaa, 0x44, 0xb8, 0x38, 0xab, 0x86, 0x0c, + 0x11, 0x81, 0x8a, 0x80, 0xa9, 0x41, 0x1a, 0x07, 0x0c, 0xa0, 0x39, 0x93, 0xab, 0x1a, 0x27, 0x88, + 0xd9, 0x50, 0xc0, 0x39, 0x94, 0x1c, 0xb2, 0x4a, 0xc2, 0x48, 0xd1, 0x39, 0xb2, 0x2c, 0xa6, 0x1c, + 0x83, 0x89, 0x80, 0x18, 0x81, 0x09, 0x88, 0x88, 0x90, 0x24, 0x2c, 0xf9, 0x41, 0xb8, 0x48, 0xca, + 0x43, 0xb9, 0x39, 0xd3, 0x39, 0x01, 0xb8, 0x28, 0xaa, 0x25, 0xa8, 0x2a, 0x90, 0x27, 0x9f, 0x04, + 0x9c, 0x32, 0xb8, 0x31, 0xf9, 0x49, 0x91, 0x28, 0xb9, 0x10, 0xa1, 0x4b, 0xb2, 0x0a, 0x01, 0x09, + 0x27, 0x9f, 0x12, 0xa8, 0x51, 0xb9, 0x80, 0x20, 0x31, 0xac, 0x93, 0x6a, 0xc8, 0x42, 0xc8, 0x29, + 0x91, 0x90, 0x81, 0x0b, 0x32, 0xe5, 0x2b, 0x20, 0xd8, 0x30, 0x9a, 0x05, 0x8e, 0x12, 0xa9, 0x21, + 0x99, 0x63, 0xf9, 0x30, 0x99, 0x12, 0xb8, 0x0a, 0x84, 0x4c, 0xb2, 0x39, 0xb8, 0x49, 0x05, 0xcb, + 0x21, 0x98, 0xa9, 0x20, 0x51, 0xf8, 0x48, 0x90, 0x8a, 0x02, 0x2b, 0xa4, 0x0a, 0x1d, 0x06, 0x8b, + 0x81, 0x30, 0xc8, 0x39, 0x89, 0x86, 0x0d, 0x22, 0xc9, 0x10, 0x11, 0x89, 0xd0, 0x58, 0x98, 0x22, + 0xfa, 0x58, 0xb0, 0x39, 0xa1, 0x3c, 0xb1, 0x38, 0xb0, 0x4a, 0x90, 0x10, 0x02, 0x0e, 0xa8, 0x20, + 0x04, 0x2c, 0xc3, 0x3b, 0xa8, 0x34, 0xb0, 0x1b, 0x20, 0x22, 0xcf, 0x37, 0xad, 0x32, 0xc9, 0x00, + 0x80, 0x80, 0x09, 0xc1, 0x4d, 0xa3, 0x0a, 0x04, 0x8c, 0x13, 0xbb, 0x16, 0x0b, 0x00, 0xb0, 0x41, + 0x8a, 0x12, 0xd1, 0x59, 0xbb, 0x15, 0x09, 0x38, 0xf9, 0x30, 0xb8, 0x49, 0xc1, 0x48, 0xa8, 0x82, + 0x2b, 0xf1, 0x08, 0x51, 0xb1, 0x9b, 0x41, 0xb8, 0x41, 0x9a, 0x23, 0xba, 0x30, 0xc9, 0x38, 0x98, + 0x22, 0x1a, 0xe9, 0x3b, 0x86, 0x21, 0x8b, 0x81, 0x00, 0xa0, 0xaf, 0x35, 0xca, 0x51, 0xc8, 0x20, + 0xb9, 0x44, 0xad, 0x13, 0x1a, 0xa1, 0x0d, 0x13, 0x9a, 0x32, 0x9b, 0x82, 0x0c, 0x90, 0x06, 0x2e, + 0x93, 0x2a, 0xc8, 0x09, 0x60, 0x98, 0x03, 0xb8, 0x8a, 0x28, 0x14, 0xaa, 0x84, 0x7b, 0xc2, 0x9a, + 0x38, 0xd0, 0x32, 0xaa, 0x09, 0x85, 0x8e, 0x03, 0x3a, 0xf4, 0x38, 0x90, 0xa8, 0x32, 0x8b, 0x12, + 0xb8, 0x80, 0x11, 0x5c, 0xcf, 0x26, 0xaa, 0x08, 0x03, 0x9b, 0x80, 0x51, 0xd2, 0x1b, 0x84, 0x19, + 0x89, 0x91, 0x59, 0xc8, 0x10, 0x18, 0xd1, 0x18, 0x40, 0xb2, 0x1c, 0x84, 0x09, 0x99, 0x29, 0xd4, + 0x5b, 0x91, 0x88, 0xb0, 0x21, 0x02, 0x9f, 0xa7, 0x4a, 0xb2, 0x8a, 0x04, 0x1b, 0xa5, 0x1b, 0x84, + 0x0a, 0x11, 0xb8, 0x08, 0x4a, 0xb1, 0xa0, 0x50, 0xea, 0x52, 0xc8, 0x38, 0x91, 0x89, 0x28, 0x99, + 0x02, 0x9c, 0x27, 0xca, 0x29, 0x92, 0x19, 0x04, 0xa8, 0x0a, 0x00, 0x14, 0x8e, 0xa1, 0x58, 0xb8, + 0x53, 0xf9, 0x28, 0xa0, 0x40, 0xb1, 0x1a, 0xa8, 0x00, 0x25, 0x0a, 0xd2, 0x1b, 0x04, 0x9a, 0x60, + 0xa8, 0x11, 0x0c, 0x12, 0xcc, 0x58, 0x92, 0x09, 0x9a, 0x01, 0x10, 0x80, 0xb9, 0x79, 0xe2, 0x38, + 0x18, 0xc8, 0x49, 0x02, 0x91, 0x8e, 0x12, 0xb8, 0x58, 0xa1, 0x08, 0x9d, 0x32, 0xb4, 0x0c, 0x90, + 0x22, 0x29, 0xe0, 0x00, 0x0e, 0x84, 0x49, 0xb1, 0x0b, 0x01, 0x28, 0xc1, 0x2b, 0x08, 0x04, 0x30, + 0xbd, 0x13, 0x39, 0x07, 0xd9, 0x2b, 0x80, 0x22, 0xd3, 0x0e, 0x12, 0x8a, 0x04, 0xab, 0x12, 0x0d, + 0x07, 0x0b, 0x88, 0x08, 0x04, 0x89, 0xa8, 0x09, 0x33, 0xa9, 0xa0, 0x0e, 0x52, 0xa1, 0x0c, 0xa2, + 0x2c, 0x05, 0x09, 0xb2, 0x2d, 0x84, 0x8b, 0x33, 0xaf, 0x21, 0x91, 0x20, 0x8f, 0x92, 0x21, 0x08, + 0xaa, 0x02, 0x2b, 0x96, 0x0d, 0x93, 0xad, 0x61, 0x90, 0x90, 0x18, 0x0b, 0x84, 0x98, 0x12, 0x0d, + 0x12, 0xc0, 0x3a, 0xb2, 0x73, 0x99, 0x93, 0x9f, 0x02, 0x92, 0x4a, 0xb1, 0x9c, 0x44, 0xd8, 0x28, + 0x00, 0x90, 0x1b, 0x05, 0xcb, 0x18, 0x32, 0xb5, 0x1e, 0xa1, 0x39, 0x85, 0x8b, 0x01, 0x8b, 0x04, + 0x10, 0xd8, 0x18, 0x81, 0x19, 0x20, 0xbb, 0xa4, 0x9c, 0x72, 0xb4, 0x0d, 0x03, 0x88, 0x88, 0x9a, + 0x15, 0x88, 0x09, 0xc3, 0x0d, 0x15, 0x8c, 0x95, 0x0b, 0x81, 0x51, 0xc9, 0x29, 0xa2, 0x3b, 0x95, + 0x2b, 0x91, 0x09, 0x82, 0x59, 0xe8, 0x48, 0x81, 0x9a, 0x91, 0x4a, 0xc3, 0x1c, 0x06, 0x8c, 0x11, + 0xa9, 0x42, 0xc9, 0x31, 0xca, 0x21, 0x99, 0x21, 0x8d, 0x04, 0x1a, 0xc3, 0x3b, 0x80, 0x02, 0xaa, + 0x68, 0xa0, 0x80, 0x21, 0x12, 0xdf, 0x21, 0x81, 0x88, 0xab, 0x02, 0x01, 0x38, 0xe0, 0x79, 0xd1, + 0x39, 0xc3, 0x1a, 0x80, 0x32, 0xcb, 0x08, 0x12, 0x0e, 0x97, 0x2b, 0x93, 0x0c, 0x05, 0x9a, 0x91, + 0x3b, 0x87, 0x8b, 0x92, 0x2a, 0x93, 0x1b, 0x97, 0x8b, 0x11, 0xb0, 0x20, 0xb0, 0x78, 0x80, 0x88, + 0x1a, 0x81, 0x1b, 0xf3, 0x51, 0xab, 0x11, 0xa0, 0x00, 0x19, 0x33, 0x9d, 0x86, 0x9c, 0x32, 0xd0, + 0x31, 0x98, 0x0d, 0x04, 0x9c, 0x85, 0x29, 0xaa, 0x94, 0x0a, 0x38, 0xb3, 0x1d, 0x85, 0x1d, 0xa3, + 0x0d, 0x03, 0x08, 0x91, 0x0c, 0xb2, 0x2b, 0x27, 0x9b, 0xa0, 0x40, 0x92, 0x11, 0xcb, 0x10, 0x4b, + 0x87, 0x8d, 0x82, 0x0a, 0x14, 0xb8, 0x5b, 0xd1, 0x30, 0xb8, 0x20, 0xaa, 0x10, 0x11, 0x02, 0xce, + 0x41, 0xb1, 0x38, 0xd3, 0x2c, 0x92, 0x90, 0x1a, 0x43, 0xd9, 0x50, 0xc0, 0x39, 0xb1, 0x31, 0xa9, + 0x08, 0x91, 0xdb, 0x52, 0xa1, 0x3b, 0xc1, 0x39, 0xf1, 0x58, 0xa8, 0x28, 0xb2, 0x3e, 0xb1, 0x20, + 0x91, 0x2b, 0x82, 0xcc, 0x37, 0xdb, 0x32, 0xba, 0x30, 0xb8, 0x42, 0xca, 0x31, 0x9d, 0x25, 0xc9, + 0x30, 0xb8, 0x01, 0x8c, 0x23, 0x88, 0x11, 0xca, 0x10, 0xa9, 0x26, 0x8c, 0xa0, 0x31, 0xbc, 0x07, + 0x0a, 0x81, 0x8a, 0x14, 0xbb, 0x41, 0xca, 0x40, 0x93, 0x09, 0x99, 0x39, 0xe2, 0x44, 0xbb, 0x59, + 0xb5, 0x2d, 0xa3, 0x1b, 0x85, 0x8a, 0x13, 0xac, 0x82, 0x09, 0x14, 0x9e, 0x02, 0x88, 0x08, 0x08, + 0x14, 0xda, 0x41, 0xa8, 0x08, 0x80, 0x28, 0xc2, 0x08, 0x21, 0x9f, 0x05, 0x9a, 0x10, 0x13, 0xbc, + 0x14, 0x0e, 0xa2, 0x59, 0xb0, 0x40, 0xd9, 0x31, 0xb0, 0x2c, 0xa4, 0x08, 0x21, 0x9e, 0x82, 0x20, + 0xa9, 0x18, 0x05, 0x9c, 0x12, 0x8c, 0x05, 0x0b, 0x81, 0x08, 0x80, 0x9b, 0x54, 0xbc, 0x36, 0xc9, + 0x10, 0x89, 0x91, 0x28, 0x82, 0x0c, 0x99, 0x23, 0xcc, 0x35, 0xac, 0x43, 0xda, 0x39, 0xa1, 0x21, + 0x8b, 0x31, 0xf0, 0x09, 0x04, 0x2a, 0xa1, 0x39, 0xfa, 0x51, 0xb0, 0x3a, 0xb2, 0x59, 0xb1, 0x19, + 0xc3, 0x5b, 0xb4, 0x2b, 0xd3, 0x1a, 0x31, 0xc2, 0x1a, 0x8a, 0x04, 0x19, 0xf1, 0x39, 0xb1, 0x00, + 0x52, 0xc8, 0x2b, 0xa4, 0x38, 0xa1, 0x1d, 0x00, 0x12, 0xad, 0x88, 0x25, 0xb0, 0x3a, 0xa5, 0x0e, + 0x82, 0x18, 0xa9, 0x42, 0xdc, 0x32, 0x90, 0x8a, 0x03, 0x29, 0xb8, 0x82, 0x9e, 0x61, 0xb1, 0x2c, + 0x85, 0x0b, 0xb0, 0x31, 0xa2, 0x2b, 0x12, 0x9c, 0x07, 0x0e, 0x91, 0x88, 0x43, 0xcb, 0x11, 0x29, + 0xb1, 0x70, 0xd8, 0x11, 0x88, 0x99, 0x00, 0x80, 0x30, 0x89, 0xa6, 0x4c, 0x98, 0x93, 0x9c, 0x15, + 0x9a, 0x10, 0x02, 0xcc, 0x12, 0x6b, 0xa2, 0x19, 0xd8, 0x39, 0x80, 0x14, 0xac, 0x21, 0x81, 0x99, + 0xf2, 0x2f, 0x84, 0x0a, 0x93, 0x1b, 0xc9, 0x52, 0x90, 0x88, 0x19, 0x98, 0x05, 0x8b, 0x81, 0x3b, + 0x07, 0x9a, 0x0b, 0x01, 0x33, 0x89, 0x92, 0xc0, 0xcf, 0x31, 0x85, 0x8c, 0x00, 0x12, 0x8a, 0xd0, + 0x48, 0x90, 0x88, 0x33, 0xdc, 0x31, 0xc9, 0x40, 0x99, 0x22, 0xea, 0x32, 0x8b, 0x98, 0x83, 0x32, + 0xac, 0x81, 0xf0, 0x4a, 0x23, 0xad, 0x85, 0x1c, 0x81, 0x00, 0x92, 0x1d, 0x92, 0x88, 0x01, 0x8c, + 0x22, 0x12, 0xa0, 0x8f, 0xb2, 0x2a, 0x08, 0x23, 0xbc, 0x03, 0x79, 0xa1, 0xfa, 0x21, 0x10, 0xc0, + 0x00, 0xa8, 0x7a, 0xa5, 0x29, 0xb9, 0x21, 0x80, 0xd2, 0x69, 0xd0, 0x48, 0xa0, 0x28, 0x9b, 0x01, + 0x43, 0xba, 0xa8, 0x58, 0xa2, 0x68, 0xda, 0x08, 0x40, 0x90, 0x00, 0xb1, 0x0d, 0x31, 0xa2, 0xf2, + 0x3a, 0x00, 0x99, 0x05, 0x0c, 0xa3, 0x60, 0xa9, 0x08, 0x98, 0x11, 0x93, 0x1c, 0xba, 0x80, 0x17, + 0x0a, 0x23, 0xdb, 0x21, 0xdb, 0x04, 0x9b, 0x43, 0xa8, 0xa2, 0x3d, 0xe1, 0x30, 0x18, 0xb1, 0x2b, + 0xf9, 0x24, 0x1a, 0xa0, 0x01, 0xb0, 0x71, 0xaa, 0x82, 0x0c, 0x33, 0xb9, 0x88, 0xa0, 0x48, 0x2b, + 0x87, 0x1b, 0x01, 0xd8, 0x31, 0x9a, 0x8a, 0x07, 0x8c, 0x94, 0x2d, 0x93, 0xca, 0x52, 0x90, 0x8a, + 0x21, 0xb0, 0x3b, 0xd4, 0x78, 0xa0, 0x09, 0x12, 0xad, 0x43, 0xb8, 0x01, 0x9b, 0x25, 0x9e, 0x94, + 0x49, 0x99, 0x02, 0xa9, 0x10, 0x29, 0xe1, 0x31, 0xba, 0x19, 0x22, 0x90, 0x9c, 0x03, 0x60, 0xc2, + 0x2c, 0xc1, 0x59, 0xa0, 0x28, 0x82, 0x99, 0x9d, 0x26, 0xba, 0x20, 0x81, 0x8a, 0x97, 0x2e, 0xa1, + 0x10, 0x80, 0x20, 0xc8, 0x19, 0x98, 0x22, 0x1a, 0xb1, 0x01, 0x8f, 0x02, 0x19, 0x82, 0x33, 0x8d, + 0xc9, 0x80, 0x2a, 0x27, 0x48, 0xdd, 0x22, 0x9a, 0x22, 0x09, 0xd8, 0x32, 0xd8, 0x18, 0x88, 0x88, + 0x45, 0xd8, 0x08, 0x8a, 0x13, 0xab, 0x74, 0xc8, 0x29, 0xc3, 0x28, 0xc0, 0x41, 0xb8, 0x11, 0xb9, + 0x4a, 0x85, 0x9a, 0x25, 0x9d, 0x93, 0x2a, 0x90, 0x18, 0x88, 0x02, 0x9c, 0x84, 0x0e, 0x03, 0x98, + 0x3a, 0xd1, 0x2a, 0x95, 0x00, 0x88, 0x0b, 0x07, 0x9a, 0x1a, 0x54, 0xea, 0x22, 0x99, 0x29, 0xc8, + 0x24, 0x9b, 0x00, 0xa1, 0x19, 0x81, 0x59, 0xf0, 0x40, 0xaa, 0x02, 0xa0, 0x59, 0x90, 0x0b, 0x96, + 0x3a, 0xa1, 0x19, 0xa2, 0x3d, 0x96, 0x1a, 0x80, 0x10, 0xf9, 0x48, 0xb0, 0x29, 0xa3, 0x29, 0x99, + 0x32, 0xf9, 0x40, 0xaa, 0x22, 0xf1, 0x38, 0xa0, 0x11, 0x9b, 0x14, 0xba, 0x29, 0x00, 0x22, 0xd9, + 0x71, 0xb8, 0x30, 0xf9, 0x41, 0xd0, 0x38, 0xb0, 0x3a, 0xa3, 0x1e, 0x94, 0x19, 0xb0, 0x69, 0xc1, + 0x39, 0xa2, 0x19, 0x99, 0x30, 0xa1, 0x2b, 0x97, 0x2b, 0x88, 0x18, 0xf1, 0x40, 0x98, 0x09, 0xa4, + 0x1a, 0x92, 0x01, 0x9f, 0x84, 0x18, 0x00, 0xda, 0x48, 0xc0, 0x20, 0x08, 0x38, 0xc9, 0x21, 0x91, + 0x1b, 0x5b, 0xa4, 0x90, 0x9c, 0x18, 0x62, 0xe1, 0x48, 0xc8, 0x21, 0xa9, 0x12, 0x83, 0x1d, 0xd8, + 0x32, 0xeb, 0x60, 0xa0, 0x89, 0x02, 0x08, 0xb1, 0x29, 0xb1, 0x49, 0x03, 0xcb, 0x41, 0xad, 0x04, + 0x22, 0xbd, 0x10, 0x12, 0xaa, 0x31, 0xa8, 0x8d, 0x27, 0x9a, 0x01, 0xc0, 0x1a, 0x37, 0xbc, 0x82, + 0x30, 0xe9, 0x30, 0x98, 0xa1, 0x30, 0xc8, 0x09, 0x02, 0x0f, 0x04, 0xa0, 0x2b, 0xb8, 0x35, 0xd9, + 0x28, 0x91, 0x19, 0xb3, 0x2a, 0x21, 0xea, 0x53, 0xc9, 0x48, 0xe2, 0x2a, 0x91, 0x02, 0x1a, 0xb2, + 0x3a, 0xd8, 0x11, 0x90, 0x70, 0xb9, 0x08, 0x34, 0xbc, 0x29, 0x15, 0xac, 0x23, 0x9d, 0x22, 0x0b, + 0xa1, 0x63, 0xb1, 0x9f, 0x23, 0xd9, 0x58, 0x91, 0x98, 0x90, 0x00, 0x80, 0x02, 0xa0, 0x8a, 0x54, + 0xab, 0x24, 0xca, 0x08, 0x13, 0x1b, 0xb8, 0x85, 0x1f, 0x06, 0x0c, 0x98, 0x03, 0x0d, 0x82, 0x98, + 0x90, 0x52, 0xba, 0x10, 0x90, 0x15, 0x8c, 0x92, 0x01, 0x8e, 0x25, 0xab, 0xa6, 0x4b, 0x91, 0x09, + 0x91, 0x08, 0x98, 0x40, 0xc1, 0x08, 0x21, 0x9d, 0x32, 0xf0, 0x4a, 0x91, 0x18, 0xa8, 0x92, 0x3c, + 0xc1, 0x33, 0xa9, 0x88, 0x89, 0x95, 0x2b, 0xc4, 0x7a, 0xa0, 0x08, 0x00, 0x9e, 0x33, 0xc2, 0x29, + 0xa9, 0x39, 0xa4, 0x21, 0x98, 0x1d, 0xd2, 0x20, 0x08, 0x0a, 0xf2, 0x70, 0xc8, 0x19, 0x22, 0xc0, + 0x29, 0x90, 0x19, 0xa2, 0x49, 0x94, 0x9d, 0x11, 0x12, 0x8b, 0x95, 0x1c, 0x23, 0xc9, 0x5b, 0xe2, + 0x38, 0x90, 0x19, 0xb8, 0x03, 0x3e, 0x90, 0x83, 0x9b, 0x18, 0x34, 0xd8, 0xb9, 0x53, 0x1c, 0xa3, + 0xaa, 0x59, 0x89, 0x33, 0x90, 0xcb, 0x98, 0x70, 0xb1, 0x04, 0xba, 0x3e, 0x96, 0x88, 0x9a, 0x04, + 0x29, 0xa9, 0x01, 0x8a, 0xa3, 0x3a, 0x47, 0xec, 0x28, 0x11, 0x88, 0xa1, 0x89, 0x4b, 0xa5, 0x09, + 0x3a, 0x86, 0xac, 0x53, 0xc0, 0x19, 0x29, 0xc2, 0x39, 0xc0, 0x29, 0x85, 0x0a, 0x08, 0x8a, 0x03, + 0x1e, 0x84, 0x0a, 0x00, 0xc0, 0x52, 0x89, 0xb8, 0x31, 0xc1, 0x39, 0x89, 0xb0, 0x04, 0x38, 0xaf, + 0x05, 0x19, 0xa9, 0x20, 0xda, 0x34, 0x9d, 0x02, 0x99, 0x48, 0x83, 0xc9, 0x3a, 0xb1, 0x38, 0x83, + 0x22, 0x2d, 0xdb, 0x07, 0x2b, 0xb3, 0x0c, 0x13, 0xaa, 0xd1, 0x7a, 0xb1, 0x29, 0x92, 0xba, 0x51, + 0xb8, 0x32, 0xba, 0x62, 0xd9, 0x31, 0xa9, 0x48, 0x93, 0x8c, 0x48, 0xe3, 0x2b, 0x84, 0x8c, 0x33, + 0x9e, 0x11, 0x90, 0x18, 0x09, 0x92, 0x8a, 0x22, 0xac, 0x86, 0x0d, 0x83, 0x29, 0xa4, 0xbb, 0x34, + 0x9c, 0x93, 0x50, 0xb9, 0x80, 0x21, 0x2c, 0xe4, 0x3a, 0x84, 0x9c, 0x01, 0x80, 0x88, 0x31, 0xa7, + 0x1c, 0x90, 0x00, 0x83, 0x8d, 0x41, 0xaa, 0x85, 0x8a, 0x18, 0xb9, 0x46, 0x99, 0xa0, 0x4c, 0xb1, + 0x21, 0x09, 0x88, 0x81, 0xa9, 0x49, 0x1a, 0xc5, 0x7b, 0x92, 0xab, 0x38, 0x91, 0x82, 0x09, 0x93, + 0x1e, 0x18, 0xf2, 0x40, 0x0a, 0x92, 0x11, 0xd9, 0x09, 0x32, 0xe0, 0x52, 0x9c, 0x83, 0x0a, 0xb1, + 0x71, 0xc9, 0x00, 0x12, 0x9d, 0x04, 0x99, 0x00, 0x08, 0x10, 0x89, 0xf1, 0x59, 0xa2, 0x1b, 0x03, + 0x88, 0xc1, 0x4c, 0x91, 0xb1, 0x30, 0x31, 0xfb, 0x80, 0x11, 0x09, 0x13, 0xbf, 0x17, 0xaa, 0x28, + 0xb8, 0x30, 0x91, 0xb0, 0x79, 0xc8, 0x10, 0x11, 0x98, 0x81, 0x3a, 0xf2, 0x1a, 0x04, 0x1a, 0x90, + 0x14, 0xad, 0x30, 0xd3, 0x40, 0x89, 0x9b, 0x14, 0x9b, 0x38, 0x04, 0xbd, 0x34, 0xab, 0x98, 0x24, + 0x1d, 0xa2, 0x02, 0xad, 0x71, 0xa0, 0x2c, 0x95, 0x0a, 0x08, 0x92, 0x5a, 0xa8, 0x91, 0x3c, 0x87, + 0x8d, 0x02, 0x00, 0x8b, 0x83, 0x19, 0x91, 0x90, 0x4c, 0xa3, 0x8c, 0x11, 0x85, 0x8b, 0x0a, 0x06, + 0x8b, 0x22, 0xa0, 0x89, 0xa0, 0x36, 0x9e, 0xb0, 0x71, 0xb0, 0x18, 0x18, 0xc0, 0x49, 0x09, 0x95, + 0x1d, 0x80, 0x10, 0x20, 0xbc, 0x23, 0x08, 0xd8, 0x68, 0xa0, 0x1a, 0x95, 0x0a, 0x81, 0x08, 0x92, + 0x9b, 0x68, 0xc1, 0x40, 0xdb, 0x32, 0x1a, 0xc1, 0x38, 0x93, 0x8e, 0x00, 0x21, 0x8b, 0xb4, 0x4a, + 0xa2, 0x99, 0x43, 0x98, 0xbb, 0x60, 0x92, 0xda, 0x48, 0xb3, 0x2d, 0x92, 0x48, 0xda, 0x81, 0x40, + 0x98, 0xd1, 0x79, 0xb2, 0x0b, 0x13, 0xa9, 0x30, 0x0b, 0x13, 0xd8, 0x9a, 0x43, 0x10, 0xce, 0x41, + 0x89, 0xa2, 0x2c, 0x01, 0xf3, 0x59, 0xa0, 0x08, 0x98, 0x49, 0x92, 0x09, 0xa8, 0x42, 0xbb, 0x34, + 0xa9, 0x09, 0x13, 0x2e, 0xc5, 0x0b, 0x22, 0x00, 0x1a, 0xf1, 0x28, 0xa8, 0x88, 0x15, 0x0d, 0x03, + 0x89, 0xc8, 0x3a, 0x91, 0x44, 0x9c, 0x81, 0xa0, 0x1a, 0x15, 0x98, 0x18, 0xa9, 0x75, 0xbb, 0x04, + 0x1b, 0x23, 0xcd, 0x32, 0xb9, 0x18, 0xc1, 0x50, 0xa0, 0x2a, 0x93, 0x0c, 0x92, 0x89, 0x27, 0x9e, + 0x20, 0x82, 0x9c, 0x32, 0xa0, 0x5a, 0x90, 0xaa, 0x32, 0x9e, 0x03, 0x00, 0x1c, 0x82, 0x91, 0x9d, + 0x23, 0x18, 0xa3, 0xbb, 0x1c, 0x16, 0x9b, 0x73, 0xf1, 0x20, 0x8a, 0x11, 0xa9, 0x92, 0x08, 0x29, + 0xf3, 0x4b, 0xc1, 0x28, 0x81, 0x10, 0xc8, 0x4c, 0xe3, 0x49, 0x98, 0x01, 0x01, 0x8e, 0x94, 0x28, + 0xa9, 0x32, 0xb9, 0x5b, 0xb3, 0x2d, 0x92, 0x88, 0x18, 0x93, 0x1e, 0xd0, 0x28, 0x11, 0xe0, 0x31, + 0xab, 0x21, 0x11, 0xba, 0x09, 0x78, 0xc4, 0x18, 0x0b, 0x04, 0xda, 0x53, 0xb8, 0x11, 0xac, 0x30, + 0x95, 0x8c, 0x22, 0x09, 0xd0, 0x28, 0x91, 0x58, 0xc0, 0x38, 0xc8, 0x28, 0xa2, 0x5c, 0xb2, 0x0a, + 0x12, 0xc9, 0x40, 0x88, 0xa1, 0x68, 0xc1, 0x0b, 0x82, 0x38, 0x00, 0xaa, 0x09, 0x04, 0x0b, 0x63, + 0xaa, 0x94, 0xcc, 0x70, 0xc1, 0x28, 0x98, 0x18, 0x82, 0x2b, 0xa1, 0x09, 0x11, 0x71, 0xf8, 0x4a, + 0x80, 0x18, 0xca, 0x50, 0x81, 0x0c, 0x93, 0x28, 0xd9, 0x58, 0xa0, 0x18, 0x9a, 0x42, 0xc1, 0x18, + 0x80, 0x2a, 0xa1, 0x8b, 0x26, 0xbb, 0x18, 0x26, 0xac, 0x20, 0xa1, 0x88, 0x2b, 0x44, 0xf1, 0x5a, + 0x09, 0xa3, 0x8d, 0x41, 0x80, 0x98, 0xa9, 0x52, 0xb8, 0x29, 0xa6, 0x1a, 0xa9, 0x23, 0x89, 0xa9, + 0x80, 0x37, 0xad, 0x82, 0x2b, 0x05, 0xaa, 0x34, 0xd9, 0x39, 0x98, 0x04, 0xa8, 0x3d, 0x92, 0x0a, + 0xb0, 0x43, 0x3b, 0xe0, 0x20, 0xb1, 0x1d, 0x51, 0xd0, 0x00, 0x0b, 0x03, 0xa1, 0x1e, 0x95, 0x1b, + 0x81, 0x95, 0x0c, 0x91, 0x11, 0x08, 0xb8, 0x34, 0x8d, 0x01, 0x89, 0x12, 0x9b, 0x6a, 0xe2, 0x21, + 0x9e, 0x13, 0xa9, 0x20, 0xa8, 0x39, 0x83, 0xb1, 0x7c, 0xc3, 0x1b, 0x21, 0xd8, 0x49, 0x90, 0x81, + 0x89, 0x33, 0x9d, 0x90, 0x34, 0x9e, 0x21, 0x88, 0xac, 0x24, 0xa9, 0x01, 0x3b, 0xd3, 0x80, 0x3a, + 0x90, 0xf3, 0x7a, 0xa3, 0x8c, 0x24, 0xbb, 0x62, 0xb9, 0x11, 0x09, 0xa2, 0x1a, 0x88, 0x81, 0x31, + 0xeb, 0x03, 0x8f, 0x23, 0xda, 0x33, 0x9c, 0x02, 0x01, 0x1f, 0xa2, 0x09, 0x68, 0xa1, 0x99, 0x2b, + 0x97, 0x3a, 0x91, 0x9a, 0x32, 0xb9, 0x40, 0xaa, 0x15, 0x0b, 0x09, 0xb5, 0x2d, 0xc2, 0x5a, 0x92, + 0x0a, 0x91, 0x0b, 0x07, 0x0a, 0xa2, 0x0e, 0x05, 0x8c, 0x12, 0x8a, 0x92, 0x19, 0x91, 0x89, 0x4c, + 0xd0, 0x52, 0xa9, 0x20, 0x8a, 0x91, 0x30, 0x2b, 0xa5, 0x29, 0x8a, 0xb2, 0xbc, 0x62, 0x21, 0xc8, + 0x4a, 0xd2, 0x09, 0x20, 0x31, 0xfb, 0x38, 0x00, 0x0b, 0xc6, 0x5c, 0xa2, 0x29, 0xd8, 0x30, 0xa8, + 0x20, 0xb2, 0x4b, 0xc1, 0x09, 0x05, 0x8c, 0x02, 0x80, 0x10, 0xaa, 0x23, 0xdb, 0x69, 0x92, 0x9a, + 0x88, 0x33, 0xab, 0x30, 0xf0, 0x79, 0xb0, 0x18, 0x28, 0xc8, 0x34, 0xda, 0x30, 0x89, 0x11, 0xe0, + 0x3a, 0xc1, 0x30, 0xb1, 0x3c, 0xb2, 0x1c, 0x91, 0x64, 0x9b, 0x80, 0x12, 0x0e, 0x95, 0x1b, 0x94, + 0x09, 0x09, 0x94, 0x8a, 0x19, 0x15, 0x9c, 0x02, 0xac, 0x25, 0xa9, 0x11, 0x8c, 0x06, 0x9c, 0x12, + 0xa1, 0x1a, 0x82, 0x10, 0xab, 0x98, 0x35, 0xa8, 0x12, 0x8e, 0x84, 0x2a, 0x09, 0xf4, 0x28, 0x98, + 0x4b, 0xc2, 0x18, 0x08, 0x20, 0xf1, 0x40, 0xca, 0x32, 0xb1, 0x2d, 0xa3, 0x2a, 0xa4, 0x2e, 0x82, + 0xba, 0x45, 0x8c, 0x82, 0x1a, 0x88, 0x11, 0xc8, 0x28, 0x01, 0xb9, 0x24, 0x0e, 0x91, 0xa8, 0x22, + 0x9a, 0x06, 0xaa, 0x39, 0xa3, 0xac, 0x37, 0x8b, 0xa1, 0x0b, 0x16, 0x2b, 0xc4, 0x28, 0x9a, 0x08, + 0x00, 0x93, 0x4d, 0xf1, 0x3a, 0x93, 0x19, 0x09, 0xb0, 0x80, 0x73, 0xc9, 0x38, 0x98, 0x20, 0xf3, + 0x6b, 0xb8, 0x21, 0x00, 0x9a, 0x11, 0x9a, 0x22, 0x0b, 0xd4, 0x4c, 0x81, 0x82, 0x2a, 0xd8, 0x38, + 0x91, 0x7a, 0xe2, 0x2b, 0x83, 0x90, 0x2b, 0x92, 0x18, 0xc1, 0x1c, 0x16, 0xbc, 0x43, 0x89, 0x98, + 0x81, 0x29, 0x20, 0xf0, 0x5a, 0xa8, 0x40, 0xb8, 0x88, 0x71, 0xb8, 0x92, 0x5a, 0xc0, 0x32, 0xac, + 0x32, 0x9b, 0xb2, 0x41, 0x0d, 0xa4, 0x0a, 0x28, 0x93, 0x8a, 0x94, 0x0e, 0x23, 0x9a, 0x13, 0xbb, + 0xb9, 0x73, 0xa0, 0x21, 0x80, 0xb8, 0x40, 0xae, 0xa3, 0x59, 0x2b, 0xa7, 0x0b, 0x81, 0x89, 0x41, + 0xe3, 0x2a, 0x04, 0xab, 0x48, 0xd1, 0x30, 0xa0, 0x39, 0xc1, 0x89, 0x39, 0xb3, 0x44, 0xfb, 0x39, + 0xb0, 0x83, 0x2c, 0xc2, 0x40, 0x90, 0x88, 0x1c, 0xa1, 0x34, 0x19, 0xf8, 0x5a, 0x98, 0x01, 0x98, + 0x12, 0xb8, 0x28, 0x84, 0xfa, 0x38, 0x38, 0xb1, 0x04, 0xaf, 0x31, 0xc8, 0x20, 0x01, 0x99, 0x80, + 0x1e, 0x84, 0x99, 0x38, 0xa3, 0x1f, 0x92, 0xb9, 0x53, 0x2b, 0xb4, 0x29, 0x1c, 0xc4, 0x30, 0x9a, + 0x22, 0xb0, 0x82, 0x9e, 0x40, 0xd8, 0x30, 0x91, 0x9a, 0x18, 0x81, 0xb9, 0x47, 0x8c, 0x32, 0xf8, + 0x09, 0x20, 0x99, 0x49, 0xb5, 0x29, 0xc8, 0x58, 0xd2, 0x28, 0x88, 0x80, 0x08, 0x9a, 0x23, 0x0b, + 0x12, 0x05, 0xdb, 0x2d, 0x93, 0x13, 0x1c, 0xa2, 0xb0, 0x4d, 0xb0, 0x18, 0x10, 0x22, 0x95, 0xaf, + 0x11, 0x9a, 0x33, 0xf2, 0x29, 0x9a, 0x12, 0x91, 0x38, 0x28, 0xf9, 0x60, 0xd0, 0x28, 0x98, 0x58, + 0xa2, 0x10, 0xab, 0x08, 0x01, 0x10, 0x01, 0x8e, 0x96, 0x0e, 0x82, 0x88, 0x88, 0x32, 0x9a, 0xb5, + 0x1e, 0x83, 0x09, 0x11, 0x88, 0x0b, 0x95, 0x1f, 0x93, 0x8a, 0x01, 0x01, 0x18, 0x9f, 0x82, 0x41, + 0x9b, 0x96, 0x8a, 0x08, 0x18, 0x83, 0x3d, 0xd2, 0xa0, 0x79, 0xb1, 0x19, 0x83, 0x29, 0xd1, 0x19, + 0x10, 0xb8, 0x38, 0xa0, 0x20, 0x19, 0xd5, 0x2a, 0xbc, 0x52, 0x14, 0xad, 0x31, 0xfa, 0x21, 0x98, + 0x11, 0x19, 0xb3, 0x0e, 0xa2, 0x30, 0x2b, 0x97, 0x2b, 0xa1, 0x2b, 0xa2, 0x59, 0x94, 0x8d, 0x03, + 0xca, 0x41, 0xc9, 0x41, 0xb8, 0x29, 0x90, 0x28, 0x89, 0x27, 0xaa, 0x11, 0x9f, 0x84, 0x28, 0xbb, + 0x27, 0x9b, 0x92, 0x29, 0x90, 0x19, 0x8a, 0x16, 0x8a, 0xa8, 0x31, 0xca, 0x52, 0xbb, 0x15, 0x8d, + 0x32, 0xb8, 0x08, 0x05, 0x9d, 0x12, 0x98, 0x0a, 0x33, 0xd0, 0x39, 0xb1, 0x0e, 0x84, 0x2a, 0x81, + 0x8a, 0x42, 0xf0, 0x4b, 0xd2, 0x39, 0x11, 0xc8, 0x20, 0xab, 0x23, 0x00, 0x81, 0x20, 0xfb, 0x40, + 0x9c, 0x04, 0x89, 0x98, 0x03, 0x8f, 0x82, 0x80, 0x88, 0x40, 0xa8, 0x08, 0x8e, 0x03, 0x1c, 0x87, + 0x1a, 0x10, 0x99, 0xa9, 0x79, 0xa3, 0x1d, 0x04, 0xab, 0x02, 0xa0, 0x7b, 0x92, 0x19, 0x89, 0x00, + 0xbb, 0x17, 0x8a, 0x02, 0xbb, 0x30, 0x80, 0x1c, 0x94, 0x49, 0xd3, 0x28, 0x8a, 0xa0, 0x78, 0xb3, + 0x2c, 0x92, 0xca, 0x60, 0x98, 0x81, 0x29, 0xb4, 0x7b, 0xc0, 0x08, 0x01, 0x09, 0x03, 0xca, 0x38, + 0xaa, 0x04, 0x28, 0xc8, 0x88, 0xa2, 0x7d, 0xb1, 0x18, 0x42, 0xac, 0x23, 0xdc, 0x30, 0x08, 0x91, + 0x01, 0x0c, 0xa1, 0x14, 0x8d, 0x12, 0xb8, 0x24, 0x9f, 0x02, 0x88, 0x10, 0x99, 0x42, 0xa8, 0xaa, + 0x78, 0xa1, 0x19, 0x12, 0xcc, 0x42, 0xf8, 0x5a, 0xa1, 0x18, 0x08, 0xa1, 0x09, 0x92, 0x4a, 0xb8, + 0x14, 0x09, 0xa9, 0x62, 0xcb, 0x33, 0x98, 0x91, 0x9e, 0x91, 0x71, 0xa0, 0x80, 0x10, 0xe8, 0x20, + 0x99, 0x11, 0x10, 0xd2, 0x59, 0xb0, 0x1a, 0x82, 0x3b, 0x06, 0xc9, 0x22, 0xbd, 0x24, 0x9a, 0x23, + 0xa9, 0x82, 0xdb, 0x3a, 0x88, 0x47, 0x8c, 0x02, 0xea, 0x30, 0x08, 0x99, 0x13, 0x9b, 0x14, 0x99, + 0xaa, 0x71, 0x80, 0x81, 0x8d, 0x91, 0x30, 0xb0, 0x71, 0xda, 0x13, 0xab, 0x31, 0xc9, 0x40, 0x83, + 0x0e, 0xa2, 0x00, 0x08, 0x48, 0xc9, 0x14, 0xab, 0x81, 0x84, 0x0f, 0x02, 0xa1, 0x19, 0x81, 0x8d, + 0x92, 0x83, 0x2c, 0x32, 0xbc, 0x05, 0x8c, 0x80, 0x30, 0x83, 0xbb, 0x70, 0xd0, 0x08, 0x15, 0xaa, + 0x29, 0xc2, 0x32, 0xbc, 0x02, 0x3d, 0x95, 0x8b, 0x80, 0xd1, 0x58, 0x81, 0x20, 0xbc, 0x14, 0xab, + 0x42, 0x9a, 0x24, 0x98, 0x8a, 0xc1, 0x3a, 0xc9, 0x45, 0x90, 0xab, 0x84, 0x8b, 0x24, 0xa8, 0x90, + 0x2a, 0xd2, 0x3b, 0xf8, 0x22, 0x13, 0xab, 0x19, 0xf1, 0x4b, 0x05, 0x99, 0x11, 0xbb, 0x02, 0x1b, + 0x63, 0xda, 0x24, 0x8c, 0x00, 0x98, 0x11, 0x98, 0x19, 0x9a, 0x16, 0xba, 0x5b, 0xa4, 0x8c, 0x25, + 0x88, 0xa9, 0x92, 0x0f, 0x84, 0x08, 0x10, 0xb9, 0x28, 0xd1, 0x40, 0xb8, 0x38, 0x03, 0xb9, 0x2b, + 0xbb, 0x37, 0x02, 0xcc, 0x18, 0xa3, 0x9e, 0x44, 0xd1, 0x2a, 0xb3, 0x3b, 0xa2, 0x3b, 0x17, 0xaa, + 0x08, 0x91, 0x8d, 0x32, 0x22, 0xf1, 0x3b, 0xb2, 0x29, 0x09, 0x97, 0x9a, 0x34, 0xba, 0x80, 0x80, + 0x2c, 0x17, 0x8b, 0xb1, 0x49, 0xd0, 0x31, 0x8c, 0x05, 0x9a, 0x91, 0x19, 0x99, 0x05, 0x29, 0xb3, + 0x1d, 0x92, 0x98, 0x7b, 0xd2, 0x18, 0x12, 0x9b, 0x08, 0x03, 0xad, 0x23, 0xa9, 0x1a, 0xc3, 0x44, + 0x9f, 0x12, 0x18, 0x98, 0x08, 0x89, 0x08, 0x5b, 0xa4, 0x8a, 0x32, 0x9d, 0xa3, 0x3e, 0x33, 0xfa, + 0x30, 0xb8, 0x10, 0x5b, 0xb4, 0x5b, 0xa1, 0x18, 0x9c, 0x80, 0x42, 0xc0, 0x28, 0xa2, 0x8a, 0x8a, + 0x87, 0x2b, 0x99, 0x85, 0xa9, 0x30, 0x01, 0x02, 0x39, 0xfa, 0x0d, 0x93, 0x3a, 0x06, 0x09, 0x1a, + 0xf2, 0x38, 0x91, 0x0b, 0x90, 0x49, 0x94, 0x8a, 0x8f, 0x02, 0x00, 0x20, 0xa9, 0x0d, 0x85, 0x3b, + 0xa4, 0x2b, 0xb2, 0x58, 0xb8, 0x81, 0x9a, 0x42, 0x00, 0xdc, 0x26, 0xbb, 0x23, 0x9a, 0x04, 0xac, + 0x70, 0xb2, 0x8a, 0xa0, 0x51, 0x99, 0x12, 0x99, 0xa8, 0x60, 0x81, 0xab, 0x89, 0x68, 0xc0, 0x21, + 0xf9, 0x78, 0x90, 0x19, 0x90, 0x88, 0x58, 0xb1, 0x29, 0x99, 0x08, 0x20, 0xd2, 0x39, 0xc0, 0x29, + 0x11, 0xd8, 0x38, 0xc0, 0x25, 0xcc, 0x11, 0x21, 0x98, 0x8a, 0x00, 0x98, 0x91, 0x72, 0x90, 0x9d, + 0x23, 0x9a, 0x35, 0x9d, 0x91, 0x32, 0xcb, 0x15, 0x9b, 0x09, 0x53, 0x90, 0xbd, 0x11, 0x40, 0x91, + 0x0f, 0x93, 0x99, 0x30, 0xa3, 0x0e, 0x83, 0x2c, 0x85, 0xa9, 0x18, 0x82, 0x4a, 0xe0, 0x49, 0xb0, + 0x20, 0x98, 0x91, 0x3a, 0xa3, 0x1a, 0x98, 0xfb, 0x70, 0xc3, 0x8a, 0x83, 0x9d, 0x32, 0xa0, 0x81, + 0x4b, 0xc1, 0x31, 0xb0, 0x99, 0x51, 0xa2, 0x0f, 0xc2, 0x12, 0x2c, 0xb3, 0x8b, 0x81, 0x59, 0x90, + 0x02, 0x9f, 0x20, 0x13, 0xa9, 0x29, 0xd8, 0x50, 0xa2, 0x0a, 0xb1, 0x1f, 0x86, 0x19, 0xa8, 0xa2, + 0x70, 0xb9, 0x38, 0xb2, 0x2a, 0x38, 0xb4, 0x1b, 0x89, 0xa1, 0x54, 0xdb, 0x28, 0x93, 0x9a, 0x71, + 0xa9, 0x28, 0xa4, 0x32, 0x8f, 0xa1, 0x19, 0x85, 0x1a, 0xb8, 0x07, 0x0b, 0x92, 0x01, 0xea, 0x31, + 0xa8, 0x39, 0x91, 0xba, 0x36, 0xda, 0x29, 0xb1, 0x03, 0x1a, 0x00, 0x90, 0x29, 0x06, 0xbd, 0x02, + 0x38, 0x06, 0xb9, 0x10, 0xad, 0x06, 0x4b, 0x82, 0xcb, 0x11, 0x10, 0x9c, 0x82, 0x50, 0x90, 0x9d, + 0xa1, 0x62, 0x98, 0x08, 0x83, 0x9e, 0x30, 0x90, 0x03, 0xad, 0x34, 0xac, 0x22, 0x8c, 0x83, 0x90, + 0x4a, 0x99, 0x11, 0xc1, 0x51, 0xba, 0x24, 0x30, 0x9c, 0xe1, 0x1a, 0x13, 0x99, 0x0d, 0x85, 0x89, + 0x11, 0xca, 0x23, 0x18, 0x18, 0xcc, 0xa1, 0x3f, 0x94, 0x3b, 0xa3, 0x31, 0xaf, 0x13, 0xc8, 0x40, + 0x90, 0x2b, 0xb5, 0x2d, 0x95, 0x1a, 0xa3, 0x1b, 0x01, 0xab, 0x44, 0xa8, 0x10, 0x8c, 0x04, 0x8d, + 0x83, 0x8b, 0x14, 0x9c, 0x02, 0x91, 0x2b, 0xb1, 0x60, 0xa8, 0x13, 0xbd, 0x12, 0x0c, 0xc0, 0x52, + 0x80, 0x98, 0x59, 0xa9, 0x81, 0x83, 0x51, 0xab, 0xf3, 0x40, 0x09, 0xd9, 0x21, 0x1b, 0x93, 0x89, + 0x89, 0x01, 0x40, 0xb2, 0x99, 0x8b, 0x23, 0xdf, 0x07, 0x8c, 0x84, 0x9a, 0x52, 0xc9, 0x01, 0x10, + 0x80, 0x99, 0x01, 0xac, 0x23, 0x19, 0x17, 0xb8, 0x39, 0xc9, 0x13, 0x0c, 0x83, 0x99, 0x24, 0xac, + 0x03, 0xa9, 0x61, 0xb8, 0x29, 0x11, 0xd8, 0x20, 0xfb, 0x09, 0x82, 0x32, 0xd9, 0x2a, 0x35, 0xbd, + 0x23, 0xb2, 0x1b, 0x1c, 0x05, 0xb3, 0x5d, 0xa1, 0x18, 0x89, 0x23, 0xb9, 0xa5, 0x1f, 0x92, 0x0b, + 0x32, 0xe1, 0x49, 0xb9, 0x12, 0xbb, 0x07, 0x08, 0xaa, 0x00, 0x8b, 0x27, 0x1b, 0xa2, 0x08, 0xb9, + 0x50, 0xa0, 0x34, 0xba, 0x09, 0x8f, 0x03, 0xa3, 0x3c, 0xc2, 0x2a, 0xc8, 0x43, 0x0b, 0x82, 0xe8, + 0x40, 0xb9, 0x39, 0xa7, 0x29, 0x99, 0x83, 0x3c, 0xc1, 0x39, 0x14, 0xac, 0x13, 0xe8, 0x72, 0x9a, + 0x00, 0x88, 0x01, 0x39, 0xa8, 0xd1, 0x1a, 0x82, 0x79, 0xd1, 0x48, 0xb9, 0x30, 0xc8, 0x11, 0x20, + 0xd1, 0x38, 0xa1, 0x90, 0x58, 0xb1, 0x8b, 0x83, 0x29, 0x32, 0xac, 0xda, 0x29, 0x47, 0x8b, 0x18, + 0xf0, 0x39, 0xa1, 0x88, 0x80, 0x81, 0x2a, 0x86, 0x89, 0x9a, 0x22, 0x00, 0x07, 0xaf, 0x03, 0x08, + 0x21, 0xa9, 0x0d, 0x05, 0x19, 0xa8, 0x38, 0xf9, 0x22, 0x0d, 0x02, 0xa9, 0x22, 0x9b, 0x18, 0xa5, + 0x3c, 0xa5, 0x0c, 0x02, 0x9a, 0x48, 0xa1, 0x11, 0x2d, 0x84, 0x9a, 0xe1, 0x29, 0x40, 0x02, 0x89, + 0xd1, 0x2a, 0xb8, 0x49, 0x25, 0xbc, 0x23, 0x8d, 0x93, 0x18, 0x8a, 0x72, 0xc1, 0x08, 0x90, 0x98, + 0x48, 0xb9, 0x73, 0xb9, 0x28, 0x18, 0x91, 0x42, 0xbd, 0x05, 0x8c, 0x83, 0x2a, 0xb2, 0x49, 0xab, + 0x04, 0xb8, 0x89, 0x36, 0x9e, 0x43, 0x9b, 0x01, 0xb1, 0x0c, 0x28, 0x01, 0x24, 0xbc, 0x19, 0x07, + 0x9b, 0x21, 0x90, 0x90, 0xb4, 0x3e, 0xb1, 0x88, 0x21, 0x91, 0xa9, 0xbf, 0x47, 0xb8, 0x19, 0x80, + 0x08, 0x21, 0xbc, 0x83, 0x59, 0x84, 0x19, 0xfa, 0x1a, 0x01, 0x20, 0x88, 0x90, 0x59, 0xb0, 0x91, + 0x8b, 0x32, 0x17, 0xcd, 0x40, 0xa0, 0x08, 0x21, 0xb9, 0x02, 0x0c, 0x38, 0x97, 0xab, 0x14, 0x1b, + 0x82, 0x89, 0x80, 0x20, 0x31, 0xfa, 0x7a, 0xb8, 0x51, 0xa8, 0x20, 0xa9, 0x8a, 0x27, 0x0a, 0xfa, + 0x40, 0x88, 0x08, 0x81, 0xbb, 0x48, 0x91, 0x11, 0x89, 0x08, 0x38, 0x17, 0x8f, 0x01, 0x89, 0x41, + 0xb8, 0x30, 0xbc, 0x25, 0xa9, 0x18, 0x00, 0xe0, 0x11, 0x38, 0xe2, 0x18, 0xba, 0x42, 0x1c, 0xd3, + 0x29, 0x88, 0x80, 0x89, 0x23, 0xe8, 0x29, 0x20, 0xc0, 0x72, 0x98, 0xb8, 0x5b, 0x92, 0x21, 0xa1, + 0xce, 0x28, 0x02, 0x10, 0xbb, 0x84, 0x0a, 0x24, 0x9b, 0x17, 0xbc, 0x20, 0x20, 0x89, 0x0a, 0x47, + 0xac, 0x21, 0x91, 0x8b, 0x32, 0xb8, 0xab, 0x21, 0x43, 0xdb, 0x02, 0x0d, 0xa1, 0x71, 0x81, 0xb8, + 0x8b, 0x42, 0x20, 0xa9, 0xa9, 0x87, 0x2c, 0x21, 0xe3, 0x5b, 0x80, 0x01, 0xa9, 0x0b, 0x32, 0x0a, + 0x86, 0x9b, 0x89, 0x31, 0xf2, 0x31, 0x9d, 0xb2, 0x69, 0x84, 0xbb, 0x20, 0x91, 0x39, 0xfa, 0x48, + 0xc2, 0x20, 0xb8, 0x79, 0xb8, 0x30, 0xa2, 0xb8, 0x48, 0x29, 0xb3, 0x68, 0xc9, 0x1a, 0x81, 0x01, + 0x90, 0x7b, 0xc0, 0x81, 0x8c, 0x08, 0x33, 0x99, 0x14, 0x1a, 0xf2, 0x2b, 0x22, 0xc4, 0x1c, 0x95, + 0x0c, 0x81, 0x80, 0x48, 0xa9, 0x51, 0xb1, 0x38, 0xcc, 0x41, 0x98, 0x98, 0x20, 0xc1, 0x2a, 0x08, + 0x02, 0x09, 0x31, 0x12, 0xff, 0x30, 0x0b, 0x25, 0xc9, 0x38, 0xb9, 0x10, 0x82, 0x20, 0xf9, 0x60, + 0xb1, 0x9b, 0x14, 0x0b, 0x13, 0x3a, 0xea, 0x01, 0x20, 0x98, 0xa2, 0x20, 0x20, 0xc1, 0xb9, 0xff, + 0x51, 0x80, 0x10, 0xcb, 0x18, 0x10, 0x91, 0x30, 0xfb, 0x30, 0x00, 0xc0, 0x18, 0x59, 0xa0, 0x11, + 0x9c, 0x50, 0xc0, 0x09, 0x22, 0xa9, 0x19, 0x82, 0xb8, 0x4c, 0x89, 0x55, 0xc8, 0x49, 0xa8, 0x90, + 0x1c, 0xa2, 0x31, 0x9e, 0x14, 0x9d, 0x12, 0x09, 0x23, 0x08, 0xaa, 0x40, 0xf9, 0x88, 0x52, 0x98, + 0xa0, 0x49, 0xd9, 0x10, 0x22, 0x98, 0x2b, 0x94, 0x8c, 0x12, 0x8c, 0x33, 0xf0, 0x48, 0xb8, 0x08, + 0x10, 0x25, 0x9f, 0x01, 0x00, 0x1c, 0xa2, 0x39, 0x92, 0x3a, 0xe2, 0x5b, 0x81, 0x08, 0x80, 0x89, + 0xb9, 0x20, 0xa0, 0x75, 0xb8, 0x68, 0xa0, 0xbb, 0x62, 0x98, 0x11, 0xaa, 0x18, 0x01, 0x90, 0x35, + 0xdc, 0x08, 0x48, 0x84, 0x8c, 0x01, 0x98, 0x11, 0x8a, 0x11, 0xe0, 0x29, 0x08, 0x84, 0xfc, 0x40, + 0x82, 0x0c, 0x91, 0x28, 0xa9, 0x20, 0x89, 0x99, 0x98, 0x61, 0xa1, 0x0e, 0x85, 0x1a, 0x91, 0x9c, + 0x16, 0x89, 0x20, 0xa1, 0x9c, 0x32, 0x9a, 0x08, 0x87, 0x09, 0x10, 0xbc, 0x73, 0xc8, 0x30, 0xb8, + 0x19, 0x99, 0x4b, 0x07, 0x99, 0x01, 0x8b, 0x82, 0x98, 0x01, 0x23, 0xcb, 0x0b, 0x17, 0x99, 0x22, + 0xa0, 0x78, 0xe9, 0x29, 0x23, 0xa8, 0x00, 0x80, 0xae, 0x21, 0x93, 0x2a, 0xe3, 0x3a, 0x94, 0xbc, + 0x33, 0x9b, 0x05, 0x2a, 0x05, 0xaf, 0x11, 0x10, 0x91, 0x99, 0x38, 0x90, 0xb9, 0x19, 0x86, 0x0e, + 0x15, 0xbb, 0x81, 0x3c, 0x05, 0x90, 0x99, 0x29, 0x91, 0xa3, 0xaf, 0x42, 0x8a, 0x23, 0xbb, 0x92, + 0x99, 0x79, 0x12, 0x89, 0xa0, 0x78, 0xc1, 0x0a, 0x30, 0xa9, 0x43, 0xfb, 0x3b, 0x04, 0x11, 0xae, + 0x11, 0x01, 0x0c, 0x04, 0x9c, 0x21, 0x80, 0x23, 0xa2, 0xdf, 0x11, 0x00, 0x81, 0x08, 0x1b, 0x81, + 0xc3, 0x0b, 0x59, 0xd2, 0x18, 0x42, 0xa8, 0x9c, 0x51, 0xa3, 0x8e, 0x02, 0x8a, 0x13, 0x09, 0x24, + 0xcc, 0x8a, 0x33, 0x38, 0xb4, 0x9d, 0x32, 0xc9, 0x0a, 0x98, 0x07, 0x1d, 0x94, 0x99, 0x29, 0x91, + 0x32, 0xe9, 0x11, 0x0a, 0x02, 0xa8, 0x5a, 0xd2, 0x39, 0xb2, 0x9a, 0x3b, 0x27, 0xb8, 0x1d, 0xc1, + 0x31, 0xa1, 0x39, 0xca, 0x10, 0xd1, 0x51, 0xb8, 0xba, 0x71, 0xa3, 0x0c, 0x83, 0x09, 0x18, 0xb0, + 0x6a, 0xd1, 0x49, 0x88, 0x90, 0x08, 0x23, 0x0c, 0xe2, 0x39, 0x90, 0x21, 0xb1, 0x8f, 0x84, 0x39, + 0xa4, 0xba, 0x9d, 0x44, 0x80, 0x99, 0x00, 0xa9, 0x40, 0x38, 0xa6, 0x9d, 0x02, 0x4a, 0xb2, 0x30, + 0x8a, 0xb0, 0x0e, 0x11, 0x05, 0x0a, 0x91, 0x9c, 0x23, 0x98, 0x02, 0x08, 0x9f, 0x12, 0x29, 0xeb, + 0x30, 0x84, 0x1a, 0xba, 0xb2, 0x25, 0x1e, 0x85, 0xa9, 0x48, 0xb1, 0x3c, 0xb4, 0x38, 0x90, 0xba, + 0x12, 0x89, 0x43, 0xdb, 0x2a, 0xc4, 0x8d, 0x02, 0x99, 0x93, 0x73, 0xb0, 0xa9, 0x30, 0xb0, 0x59, + 0x93, 0x2c, 0xa7, 0x0a, 0x90, 0x20, 0x54, 0xf0, 0x08, 0x81, 0x98, 0x88, 0x11, 0x90, 0x18, 0x9c, + 0xb1, 0x70, 0x91, 0x08, 0xb0, 0x1a, 0x99, 0x59, 0xc2, 0x5a, 0x91, 0x33, 0x21, 0xcf, 0x02, 0x18, + 0x08, 0x31, 0xf3, 0x3d, 0xb2, 0x4b, 0xb2, 0x1c, 0x12, 0x88, 0xb2, 0x8f, 0x31, 0xc8, 0x41, 0xa0, + 0x88, 0x9a, 0x32, 0x94, 0x2b, 0xb0, 0x61, 0x0a, 0x87, 0x0a, 0x00, 0xc9, 0x29, 0x43, 0xd8, 0x2b, + 0x83, 0x89, 0x30, 0xca, 0xa5, 0x4b, 0x81, 0x80, 0xb8, 0x0c, 0x99, 0x68, 0x93, 0x3a, 0xb5, 0x4a, + 0x80, 0xba, 0x37, 0xac, 0x88, 0x10, 0x81, 0x51, 0xd0, 0x8b, 0x92, 0x3b, 0x87, 0x0a, 0x30, 0xe8, + 0x18, 0x90, 0x72, 0xd0, 0x18, 0x80, 0x08, 0x90, 0x02, 0x39, 0xd4, 0x1a, 0x11, 0xa8, 0x9d, 0x24, + 0x08, 0x01, 0xae, 0x38, 0xa3, 0x2c, 0x00, 0x18, 0xd0, 0x60, 0xa1, 0x0d, 0x38, 0x84, 0x80, 0x99, + 0x9b, 0x20, 0x43, 0x9a, 0x04, 0xbf, 0x23, 0xa0, 0x29, 0x98, 0x91, 0x41, 0xa0, 0xbd, 0x27, 0xba, + 0x21, 0x82, 0x08, 0xdf, 0x40, 0x92, 0x89, 0x30, 0xa8, 0xa1, 0x3a, 0x80, 0x41, 0xc1, 0x20, 0xec, + 0x29, 0x23, 0x2a, 0xf4, 0x8b, 0x81, 0x53, 0xb8, 0x20, 0xba, 0x51, 0xa0, 0xb0, 0x8f, 0x13, 0x12, + 0xc0, 0x09, 0x0c, 0x88, 0x17, 0x8a, 0xb8, 0x8b, 0x47, 0xa8, 0x09, 0x81, 0x01, 0x88, 0xb1, 0x0a, + 0x62, 0x99, 0x13, 0xae, 0x20, 0x03, 0x89, 0xfb, 0x69, 0xb0, 0x12, 0xcb, 0x32, 0xb9, 0x43, 0x90, + 0xc9, 0x2a, 0x05, 0x09, 0x19, 0x08, 0xc3, 0x6b, 0x01, 0xcb, 0x25, 0x9b, 0x23, 0xac, 0x20, 0x22, + 0xa9, 0x99, 0xa8, 0xcb, 0x7a, 0xc4, 0x38, 0xa0, 0x0d, 0x84, 0x0a, 0x3a, 0x04, 0x98, 0xb2, 0x3f, + 0xa5, 0x1a, 0x23, 0xcc, 0x20, 0x81, 0x09, 0x34, 0xbc, 0x1a, 0xa4, 0x0c, 0x34, 0xbb, 0x41, 0xaa, + 0x93, 0x0e, 0x30, 0xe3, 0x1a, 0x80, 0x02, 0x2b, 0x11, 0xa9, 0x08, 0xb0, 0x77, 0xc0, 0x10, 0xba, + 0x41, 0x21, 0xd0, 0x1b, 0xa2, 0x8c, 0x83, 0x8c, 0x33, 0x01, 0xd9, 0x10, 0xab, 0x62, 0x05, 0xbc, + 0x04, 0x0b, 0xa3, 0x59, 0x91, 0x1b, 0x96, 0x8b, 0x10, 0xa1, 0x31, 0xb8, 0x9a, 0x9b, 0x67, 0xaa, + 0x43, 0xb9, 0x18, 0x80, 0x00, 0xa1, 0x19, 0x29, 0xf0, 0x30, 0x80, 0x3b, 0xc2, 0x17, 0x0a, 0xea, + 0x40, 0xb8, 0x21, 0x19, 0xbb, 0x64, 0xc0, 0x19, 0x92, 0x0a, 0x01, 0x00, 0x21, 0xc9, 0x91, 0x8c, + 0x35, 0xbf, 0x26, 0xa8, 0x1a, 0x80, 0x21, 0x80, 0xb2, 0xaf, 0x14, 0xa9, 0x13, 0x82, 0x9e, 0x9a, + 0x62, 0xa1, 0x20, 0xca, 0x21, 0xb0, 0x1a, 0xa9, 0x26, 0x8b, 0x04, 0xba, 0x30, 0xa5, 0x0d, 0x24, + 0xba, 0x11, 0x9b, 0x14, 0x11, 0xce, 0x24, 0x9c, 0x83, 0x1c, 0xa2, 0x0b, 0x03, 0x2b, 0xb1, 0x8b, + 0x17, 0x0a, 0x23, 0x9f, 0x13, 0x0b, 0x21, 0xe9, 0x18, 0x0b, 0xa3, 0x5a, 0xd0, 0x19, 0x82, 0xba, + 0x8a, 0x93, 0x49, 0x09, 0x30, 0xf1, 0x5a, 0xb1, 0x0b, 0x84, 0xc8, 0x4a, 0xb1, 0x39, 0xe9, 0x1a, + 0x31, 0xa1, 0x81, 0x9e, 0x81, 0x8d, 0x11, 0x02, 0xba, 0x1b, 0xb0, 0x2b, 0xc1, 0x53, 0xb2, 0xaf, + 0x89, 0x11, 0x99, 0x81, 0xab, 0xb0, 0x23, 0x0f, 0xb3, 0x9c, 0x10, 0x9a, 0x9b, 0xb3, 0x0b, 0x8d, + 0x00, 0xb8, 0x9b, 0xb9, 0x0b, 0xa9, 0x9b, 0x7f, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, + 0xd0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xe0, 0x71, 0x89, 0x83, 0xfc, 0x2e, 0x47, 0xaf, + 0x14, 0x98, 0x89, 0x11, 0xab, 0x16, 0x0c, 0xa3, 0x88, 0x2a, 0x00, 0x54, 0xe1, 0x2b, 0x84, 0x1b, + 0xa3, 0x8a, 0x0a, 0x86, 0x0a, 0x83, 0x2c, 0xb8, 0xa2, 0x63, 0xba, 0x38, 0x98, 0x12, 0x00, 0x0f, + 0xb2, 0x71, 0xb8, 0x28, 0xc2, 0x19, 0x01, 0x88, 0x31, 0xf0, 0x69, 0xc0, 0x29, 0xa2, 0x2a, 0x03, + 0x9e, 0x30, 0xa0, 0x90, 0x83, 0x2c, 0xe1, 0x22, 0x8c, 0x86, 0x0c, 0x83, 0x0a, 0x13, 0x9f, 0x04, + 0x89, 0x88, 0x82, 0x19, 0xb9, 0x50, 0xb0, 0x43, 0xbc, 0x01, 0x12, 0x1c, 0xaa, 0x87, 0x19, 0x0a, + 0x82, 0xba, 0x55, 0x89, 0x91, 0x08, 0xda, 0x52, 0x8a, 0x81, 0x88, 0x91, 0x4d, 0xe3, 0x39, 0xd3, + 0x49, 0xb8, 0x18, 0x22, 0xbb, 0x32, 0xbc, 0x26, 0xab, 0x02, 0x19, 0x88, 0xb8, 0x37, 0x8d, 0x91, + 0x00, 0x41, 0x9c, 0x20, 0xd3, 0x2c, 0x12, 0x8a, 0xc4, 0x59, 0x99, 0x08, 0x01, 0xa0, 0x6b, 0xa0, + 0x19, 0x92, 0x2d, 0xd3, 0x38, 0xa8, 0x30, 0x80, 0x8a, 0x00, 0x05, 0xba, 0x40, 0xba, 0x25, 0xad, + 0x00, 0x06, 0x0a, 0x94, 0x1d, 0xb1, 0x28, 0x22, 0xbc, 0x04, 0x8b, 0x35, 0xbe, 0x33, 0xc8, 0x42, + 0x9c, 0x03, 0x9b, 0x30, 0x88, 0x10, 0xe2, 0x4b, 0xa2, 0x2a, 0x18, 0xb8, 0xa2, 0x79, 0xb0, 0x8b, + 0x07, 0x09, 0x59, 0xf1, 0x18, 0x11, 0x0a, 0x92, 0x08, 0x8b, 0x92, 0x38, 0xb0, 0x2d, 0x05, 0x23, + 0x9f, 0xa1, 0x2d, 0x84, 0x99, 0x32, 0xae, 0x23, 0x9a, 0x01, 0x2b, 0xb6, 0x28, 0x90, 0x0e, 0x22, + 0x9b, 0x12, 0x80, 0xb9, 0x22, 0x13, 0xbf, 0x48, 0x23, 0xc0, 0xa1, 0x2c, 0x0b, 0x07, 0x98, 0x11, + 0xdb, 0x48, 0xb2, 0x39, 0x98, 0x00, 0x6b, 0xc2, 0x8d, 0x11, 0x02, 0x80, 0x3c, 0xf3, 0x4d, 0x80, + 0x98, 0x20, 0x88, 0xa2, 0x3a, 0xea, 0x53, 0x99, 0x09, 0x15, 0xca, 0x10, 0x18, 0xa1, 0x18, 0xa1, + 0x9a, 0x79, 0xe1, 0x28, 0xb2, 0x19, 0x40, 0xd0, 0x8a, 0x51, 0x90, 0x2a, 0x96, 0x8b, 0xa2, 0x39, + 0xa3, 0x4a, 0x8c, 0x87, 0x0a, 0xb0, 0x42, 0x9a, 0x94, 0x3b, 0xd0, 0x10, 0x80, 0x10, 0x98, 0x9b, + 0x53, 0xb3, 0x0c, 0xa2, 0x8c, 0x63, 0xa0, 0x99, 0x3a, 0x91, 0x42, 0xf3, 0x1c, 0x22, 0xc1, 0x18, + 0xac, 0x73, 0xc1, 0x10, 0xc9, 0x21, 0x98, 0x21, 0xa3, 0x9b, 0x0f, 0x15, 0xcb, 0x32, 0x09, 0xa9, + 0x33, 0xad, 0x12, 0x0a, 0x17, 0xab, 0x18, 0x88, 0x20, 0xb3, 0x58, 0xf3, 0x1c, 0x02, 0x89, 0x1a, + 0x86, 0x0b, 0x13, 0xcc, 0x31, 0xa0, 0x80, 0x38, 0xf3, 0x19, 0x88, 0x62, 0xe9, 0x01, 0x59, 0xc8, + 0x11, 0x89, 0x11, 0xab, 0x34, 0xb0, 0x8c, 0x20, 0xb5, 0x5a, 0xa8, 0x09, 0x14, 0x9d, 0x13, 0x8a, + 0x02, 0x8a, 0x96, 0x1e, 0x81, 0x89, 0x06, 0x0c, 0x03, 0x8d, 0x02, 0x88, 0x08, 0x88, 0x30, 0xc5, + 0x0c, 0x81, 0x21, 0x88, 0x02, 0xbd, 0x32, 0xd8, 0x22, 0x89, 0x0d, 0x07, 0x19, 0x8d, 0x91, 0x48, + 0xb1, 0x28, 0xb0, 0x98, 0x48, 0x18, 0xa4, 0x0c, 0x22, 0x90, 0xbe, 0x70, 0x92, 0x1b, 0x84, 0x0e, + 0x92, 0x39, 0x01, 0xb0, 0x1c, 0x00, 0x05, 0x9e, 0x13, 0x9b, 0x33, 0xab, 0x85, 0x8d, 0x23, 0x8b, + 0x82, 0x89, 0x09, 0x1a, 0x13, 0xc0, 0x5b, 0xf0, 0x25, 0x9c, 0x01, 0x99, 0x33, 0x81, 0xda, 0x19, + 0x88, 0x10, 0x15, 0x0f, 0x81, 0x08, 0x88, 0xe4, 0x5b, 0xa1, 0x02, 0x8b, 0x00, 0x98, 0x15, 0x0c, + 0x92, 0x2b, 0x84, 0xb0, 0x1c, 0xa4, 0x5c, 0xb1, 0x83, 0x0d, 0x11, 0xc8, 0x32, 0x90, 0x0c, 0xb8, + 0x24, 0x8c, 0x02, 0x88, 0x32, 0x8f, 0xf3, 0x48, 0x90, 0x08, 0x00, 0x99, 0x30, 0xb2, 0x99, 0x79, + 0xd1, 0x39, 0xc2, 0x3b, 0xa1, 0x81, 0x30, 0xaa, 0xb5, 0x4a, 0x82, 0x1b, 0xd2, 0x28, 0x34, 0xcf, + 0x42, 0xab, 0x24, 0xba, 0x15, 0x8d, 0x02, 0xba, 0x33, 0x80, 0x0a, 0x99, 0x44, 0xfa, 0x61, 0xbb, + 0x23, 0xa9, 0x83, 0x8d, 0x81, 0x21, 0x11, 0x9e, 0x02, 0x0b, 0xb4, 0x7a, 0xb1, 0x88, 0x40, 0xa1, + 0x9c, 0x10, 0x05, 0x0b, 0x93, 0x1e, 0xa3, 0x2b, 0x86, 0x0c, 0x91, 0x30, 0xb1, 0x0f, 0x84, 0x1b, + 0x95, 0x0c, 0x93, 0x0c, 0x12, 0x08, 0xb8, 0x3c, 0x05, 0x8c, 0xb3, 0x6b, 0x91, 0x29, 0xa1, 0x1a, + 0x92, 0x89, 0x43, 0xd9, 0x10, 0x10, 0xb4, 0x0f, 0xa3, 0x29, 0x84, 0x8f, 0x84, 0x0a, 0x00, 0x80, + 0xb1, 0x5c, 0xb2, 0x19, 0xe0, 0x48, 0x92, 0x0a, 0xa1, 0x39, 0xb4, 0x1b, 0x05, 0x8a, 0x82, 0x39, + 0x80, 0xfb, 0x23, 0x0b, 0x05, 0xbb, 0x43, 0xfb, 0x30, 0xa9, 0x93, 0x2a, 0x12, 0xbc, 0x03, 0x2a, + 0x27, 0x8e, 0x82, 0x0b, 0x92, 0x3b, 0x10, 0x96, 0x08, 0x0f, 0xb6, 0x3a, 0x81, 0x09, 0x91, 0x0c, + 0x85, 0x0a, 0x98, 0x71, 0xc1, 0x29, 0x90, 0x09, 0x08, 0x03, 0x80, 0x8f, 0xa4, 0x01, 0x1c, 0x00, + 0x92, 0x10, 0xe8, 0x49, 0xb0, 0x98, 0x16, 0x8c, 0x11, 0xa9, 0x30, 0xa8, 0x28, 0x22, 0xa5, 0x89, + 0x2a, 0xab, 0x47, 0x8c, 0x12, 0xc8, 0x1a, 0x31, 0xf0, 0x59, 0xb0, 0x40, 0xc9, 0x29, 0x11, 0x0a, + 0xb4, 0x29, 0x99, 0x98, 0x20, 0x21, 0xf8, 0x42, 0x09, 0xcb, 0x24, 0x0b, 0x94, 0x20, 0x99, 0x9b, + 0x35, 0xa0, 0x08, 0x9d, 0x13, 0xac, 0x15, 0xbb, 0x42, 0xdc, 0x24, 0xa9, 0xa9, 0x62, 0x99, 0x83, + 0x1b, 0xa5, 0x29, 0xb2, 0x1f, 0x93, 0x2c, 0x95, 0x0c, 0x94, 0x0a, 0x10, 0xb1, 0x38, 0x80, 0xa3, + 0xac, 0x20, 0x83, 0x2f, 0xa0, 0x16, 0x9b, 0x81, 0xab, 0x74, 0xc8, 0x38, 0x80, 0x8b, 0x12, 0x89, + 0x01, 0x2d, 0xc7, 0x39, 0xb0, 0x29, 0x12, 0xb0, 0x2d, 0xd2, 0x48, 0x90, 0x19, 0xa5, 0x4c, 0xb1, + 0x10, 0xa0, 0x59, 0xb1, 0x39, 0xd8, 0x38, 0x90, 0x39, 0xe3, 0x1d, 0x13, 0x8c, 0x82, 0x9b, 0x32, + 0x01, 0x9f, 0x85, 0x19, 0xa0, 0x03, 0x9c, 0x23, 0x0b, 0x87, 0x9a, 0x88, 0x12, 0x9a, 0x23, 0xdb, + 0x43, 0xe8, 0x18, 0x00, 0x00, 0x1c, 0xb1, 0x32, 0xe8, 0x5b, 0x01, 0xd0, 0x30, 0xa0, 0x09, 0xc1, + 0x71, 0x98, 0x80, 0x8a, 0x03, 0x90, 0x3b, 0x90, 0xc1, 0x0c, 0x72, 0xd1, 0x1a, 0x02, 0x98, 0x22, + 0xad, 0x14, 0x99, 0x8a, 0x27, 0x9d, 0x13, 0x89, 0x91, 0x1b, 0x85, 0x19, 0xb8, 0x1c, 0x85, 0x8a, + 0x21, 0xe1, 0x29, 0x08, 0x94, 0xba, 0x5b, 0xa4, 0x38, 0xd9, 0x21, 0x8a, 0x87, 0x0a, 0x01, 0xc2, + 0x5b, 0x92, 0xb9, 0x29, 0x40, 0xc1, 0x08, 0x00, 0xa8, 0x18, 0x85, 0x1e, 0xa8, 0x23, 0x0c, 0x02, + 0xaf, 0x62, 0xa0, 0x80, 0x18, 0xb8, 0x62, 0xa9, 0x93, 0x1c, 0x11, 0xb8, 0x06, 0x0e, 0x81, 0x18, + 0x18, 0xa8, 0x21, 0xbc, 0x40, 0x01, 0xb9, 0x3b, 0x17, 0xa9, 0x28, 0x88, 0x30, 0xfa, 0x24, 0x9e, + 0x10, 0xa3, 0x59, 0xb0, 0x0c, 0x05, 0x9a, 0x82, 0x28, 0xe0, 0x59, 0xa0, 0x18, 0xa8, 0x48, 0x94, + 0x09, 0xa8, 0x4b, 0xb3, 0x31, 0x8c, 0x91, 0x08, 0x0a, 0xa6, 0x0c, 0x12, 0x22, 0xad, 0x90, 0x09, + 0x32, 0x88, 0x27, 0xcf, 0x14, 0xa9, 0x30, 0xb8, 0x30, 0xc3, 0x3a, 0xca, 0x32, 0x8b, 0x27, 0xab, + 0x20, 0xbb, 0x26, 0xba, 0x31, 0xa9, 0x19, 0x14, 0xcc, 0x0a, 0x17, 0x8a, 0x02, 0xac, 0x31, 0xa2, + 0x79, 0xc0, 0x38, 0xb1, 0x39, 0xb8, 0x1a, 0x27, 0x8d, 0xb2, 0x30, 0xaa, 0x49, 0xa4, 0x18, 0x8d, + 0x21, 0xa4, 0x8b, 0x10, 0x82, 0xbb, 0x35, 0xba, 0x19, 0xd9, 0x35, 0xa8, 0xa8, 0x71, 0x98, 0xa0, + 0x48, 0xb8, 0x48, 0x91, 0x10, 0xeb, 0x5a, 0xa3, 0x1a, 0x92, 0x0e, 0xa3, 0x68, 0xaa, 0x05, 0x2b, + 0x98, 0x92, 0x3a, 0xc8, 0x42, 0xb8, 0x3b, 0xe0, 0x20, 0x08, 0x22, 0xd9, 0x89, 0x30, 0x50, 0xf1, + 0x29, 0x11, 0xa9, 0xc9, 0x44, 0xba, 0x22, 0xa2, 0x7b, 0xe0, 0x38, 0xa2, 0x09, 0x89, 0x03, 0xc9, + 0x49, 0xb1, 0x58, 0x99, 0x08, 0xa6, 0x1d, 0xb1, 0x50, 0xa0, 0x0a, 0x62, 0xd8, 0x20, 0x0a, 0x83, + 0xa8, 0x29, 0x94, 0x8b, 0x20, 0xa3, 0x98, 0x28, 0x7c, 0xf1, 0x18, 0x88, 0x23, 0xcc, 0x21, 0x90, + 0x28, 0xa9, 0x03, 0x8f, 0x04, 0x2c, 0xb2, 0x1c, 0x04, 0x0a, 0x02, 0x8c, 0x33, 0xfc, 0x31, 0xb0, + 0x40, 0xbb, 0x43, 0xbb, 0x50, 0xa1, 0x28, 0x9b, 0x13, 0xb0, 0x1e, 0x03, 0xc0, 0x6b, 0xc2, 0x39, + 0xb8, 0x30, 0x01, 0x8a, 0xe3, 0x5b, 0x83, 0xab, 0xa3, 0x79, 0xb8, 0x02, 0x1a, 0x08, 0xc1, 0x33, + 0x8b, 0xe8, 0x48, 0x82, 0x88, 0x8f, 0x04, 0x09, 0x01, 0xbb, 0x24, 0x0e, 0x94, 0x09, 0x28, 0xc9, + 0x22, 0xa1, 0x1f, 0x91, 0x21, 0xc8, 0x29, 0x91, 0x09, 0x10, 0x12, 0xbc, 0x34, 0x09, 0x2b, 0x97, + 0x1b, 0x12, 0xbc, 0x21, 0x38, 0xfa, 0x52, 0xba, 0x22, 0x9c, 0x84, 0x0f, 0x93, 0x18, 0x91, 0x8c, + 0x11, 0x93, 0x30, 0x8f, 0x85, 0x0b, 0x01, 0xa0, 0x3a, 0xf1, 0x51, 0xc8, 0x38, 0x99, 0x24, 0xda, + 0x39, 0xb2, 0x39, 0x91, 0x0b, 0x04, 0x9b, 0x91, 0x41, 0xda, 0x50, 0xa2, 0x0b, 0x98, 0x14, 0x91, + 0x19, 0x09, 0xf1, 0x41, 0x9c, 0x11, 0xc2, 0x4b, 0x93, 0xab, 0x40, 0xc9, 0x72, 0xb9, 0x23, 0x9c, + 0x32, 0xfb, 0x22, 0xa8, 0x22, 0xba, 0x02, 0x8f, 0x06, 0x88, 0x09, 0xc0, 0x40, 0xa9, 0x33, 0xbd, + 0x23, 0x99, 0x31, 0xe9, 0x08, 0x49, 0xa2, 0xa2, 0x1d, 0x91, 0x09, 0x23, 0x98, 0x02, 0x8f, 0x24, + 0xea, 0x10, 0x28, 0x82, 0xcc, 0x31, 0x90, 0x1c, 0x96, 0x3a, 0xd2, 0x1a, 0x82, 0x0a, 0x29, 0x05, + 0xbb, 0x50, 0xb0, 0x40, 0x99, 0x00, 0x3a, 0xc4, 0x9b, 0x30, 0x91, 0x82, 0x7a, 0xc0, 0x88, 0x34, + 0x9b, 0xfa, 0x31, 0xb3, 0x4c, 0xc0, 0x28, 0xa1, 0x59, 0xa2, 0x0b, 0xa1, 0x38, 0x10, 0xf8, 0x6a, + 0xa2, 0x09, 0xa0, 0x02, 0x4a, 0xc2, 0x29, 0xab, 0x91, 0x00, 0x50, 0xa0, 0x98, 0x44, 0xbb, 0x30, + 0x29, 0x27, 0xfb, 0x41, 0xa9, 0x09, 0x03, 0x8d, 0x13, 0x89, 0x88, 0x99, 0xa2, 0x1f, 0x27, 0x9d, + 0x01, 0x28, 0xb9, 0x30, 0x00, 0xc3, 0x4c, 0xa2, 0x9a, 0x20, 0x9a, 0x47, 0x9d, 0x12, 0x88, 0x8b, + 0x05, 0x08, 0x98, 0x1a, 0xa7, 0x2c, 0xa1, 0x38, 0xa1, 0x1d, 0x93, 0x0a, 0x0a, 0x07, 0x90, 0x3b, + 0xd1, 0x28, 0xa1, 0x3a, 0x15, 0x9c, 0x83, 0x3d, 0xd0, 0x28, 0x10, 0x90, 0x89, 0x08, 0xa8, 0x13, + 0x70, 0xe1, 0x28, 0xa9, 0x31, 0xb8, 0x89, 0x30, 0x04, 0x89, 0x9f, 0x06, 0xab, 0x63, 0xd0, 0x38, + 0xa9, 0x22, 0x9b, 0x15, 0xac, 0x33, 0xdb, 0x51, 0xd8, 0x48, 0xa1, 0x08, 0x09, 0x11, 0x09, 0x90, + 0x98, 0x11, 0x2c, 0xb5, 0x10, 0x0e, 0x13, 0xac, 0x04, 0x0d, 0x85, 0x9a, 0x31, 0xca, 0x32, 0x88, + 0xaa, 0x03, 0x2c, 0x85, 0x8a, 0x81, 0x49, 0xf3, 0x5a, 0xd1, 0x29, 0x83, 0x0b, 0x83, 0x9f, 0x23, + 0x98, 0x00, 0x8b, 0x02, 0xba, 0x44, 0xab, 0x18, 0x80, 0x70, 0xe2, 0x2a, 0x82, 0x99, 0x05, 0x8c, + 0x10, 0x81, 0x81, 0x1a, 0xa8, 0x06, 0x0e, 0x04, 0xba, 0x22, 0x09, 0x98, 0xa1, 0x09, 0x45, 0xfb, + 0x11, 0x91, 0x0b, 0x83, 0x3b, 0xe4, 0x39, 0x90, 0x1b, 0x94, 0x39, 0x94, 0x8f, 0x95, 0x19, 0x82, + 0x9b, 0x20, 0xb8, 0x44, 0xca, 0x12, 0x9a, 0x43, 0xb0, 0x8c, 0x12, 0x90, 0x0d, 0x93, 0x32, 0xaf, + 0x15, 0xa9, 0x2a, 0xa1, 0x51, 0xb9, 0xb8, 0x70, 0xc2, 0x18, 0x90, 0x83, 0xab, 0x03, 0x7a, 0xd0, + 0x28, 0x94, 0x0c, 0x01, 0x00, 0x80, 0xab, 0x07, 0x2a, 0x92, 0x8f, 0x04, 0xaa, 0x32, 0xda, 0x22, + 0x9b, 0x13, 0xab, 0x13, 0x1a, 0x82, 0xc8, 0x08, 0x9a, 0x72, 0xb0, 0x25, 0xbc, 0x22, 0x2b, 0x93, + 0x99, 0x82, 0x6c, 0xd2, 0x6a, 0xc3, 0x2c, 0x94, 0x0b, 0x81, 0x08, 0xa0, 0x39, 0xf9, 0x41, 0xa9, + 0x30, 0xd2, 0x39, 0xb2, 0x3c, 0xa3, 0x09, 0x18, 0x0b, 0xa5, 0x49, 0x11, 0x9d, 0x94, 0x2d, 0x93, + 0x98, 0x04, 0x8e, 0x13, 0xab, 0x23, 0x9c, 0x04, 0x3b, 0xe8, 0x21, 0x9c, 0x11, 0x43, 0xeb, 0x08, + 0x12, 0x8b, 0x85, 0x0a, 0x03, 0xab, 0x04, 0x9a, 0x00, 0x38, 0xa1, 0xa0, 0xaa, 0x78, 0x01, 0xd3, + 0x29, 0x82, 0x88, 0xc0, 0x3e, 0x86, 0x9b, 0x14, 0x9c, 0x82, 0x2a, 0xb7, 0x3b, 0xb3, 0x28, 0xc9, + 0x39, 0xa4, 0x3b, 0xa6, 0x29, 0x9a, 0x82, 0x3a, 0xf3, 0x79, 0x88, 0x88, 0x89, 0x08, 0x84, 0x39, + 0x80, 0xbb, 0x81, 0x02, 0x41, 0xab, 0x94, 0x63, 0xcb, 0xa8, 0x42, 0x8c, 0xb4, 0x3a, 0x38, 0xf0, + 0x3a, 0xa3, 0x40, 0x9d, 0x14, 0xa8, 0x3a, 0xc4, 0x29, 0x82, 0x1b, 0x88, 0xa4, 0xb0, 0x4f, 0xa5, + 0x8a, 0x38, 0xe0, 0x10, 0x80, 0x22, 0xfa, 0x38, 0xa2, 0x88, 0x10, 0xa9, 0x12, 0x9b, 0x94, 0x2a, + 0xdb, 0x43, 0x04, 0xbc, 0x62, 0x90, 0x88, 0x09, 0x29, 0xd9, 0x51, 0xc0, 0x39, 0x9b, 0x16, 0xc9, + 0x68, 0xc9, 0x33, 0xca, 0x30, 0xb0, 0x58, 0xc8, 0x21, 0xa8, 0x28, 0x82, 0x9b, 0xa0, 0x33, 0x0e, + 0xa1, 0x02, 0x0f, 0x15, 0x9c, 0x32, 0xaa, 0x10, 0x90, 0x29, 0xd0, 0x48, 0x94, 0xac, 0x31, 0x98, + 0x28, 0x40, 0xe0, 0x08, 0x30, 0xd0, 0x29, 0x9a, 0x06, 0x0b, 0x05, 0x9e, 0x12, 0x0a, 0x23, 0xcb, + 0x82, 0x1b, 0x12, 0x91, 0x32, 0xcd, 0x48, 0xa2, 0x0c, 0x05, 0x0c, 0xa4, 0x1a, 0x92, 0xac, 0x45, + 0x9a, 0x81, 0x0a, 0x81, 0x09, 0x83, 0x8c, 0x42, 0xcb, 0x32, 0x82, 0x9f, 0x24, 0x89, 0xb1, 0x2a, + 0x04, 0x9e, 0x14, 0x0a, 0xb1, 0x1e, 0x23, 0xd9, 0x00, 0x18, 0xc3, 0x10, 0x2b, 0xf2, 0x49, 0xa0, + 0x32, 0xca, 0x19, 0x01, 0x28, 0xf8, 0x20, 0x89, 0x02, 0x92, 0x1c, 0x92, 0x51, 0x98, 0xd9, 0x08, + 0x29, 0x42, 0xf9, 0x39, 0x92, 0x3b, 0xb6, 0x3c, 0xc1, 0x79, 0xc1, 0x29, 0xa0, 0x30, 0xb2, 0x1b, + 0xa1, 0x0a, 0x15, 0xaa, 0xb8, 0x51, 0x10, 0xc0, 0x19, 0xb8, 0x72, 0xb1, 0x28, 0xa8, 0x50, 0xd1, + 0x38, 0xe3, 0x1c, 0x83, 0x28, 0xf1, 0x28, 0x19, 0x92, 0xa0, 0x19, 0x92, 0x09, 0x80, 0x3b, 0xf0, + 0x9c, 0x36, 0x98, 0x1d, 0xb2, 0x38, 0x89, 0x38, 0xc2, 0x20, 0x00, 0x9f, 0x85, 0x3a, 0xa4, 0x3c, + 0xf2, 0x3a, 0x10, 0x99, 0x21, 0xca, 0x38, 0x04, 0x9d, 0x02, 0x10, 0xc9, 0x40, 0xc1, 0x0c, 0x13, + 0x20, 0xe9, 0x10, 0x89, 0x23, 0xb8, 0x1b, 0xb3, 0x69, 0x88, 0x94, 0x9c, 0x22, 0x0b, 0xb5, 0x48, + 0x8d, 0x03, 0xad, 0x36, 0xcb, 0x21, 0x91, 0x1a, 0xa0, 0x58, 0x90, 0x81, 0x1a, 0xdb, 0x51, 0xc1, + 0x48, 0xd8, 0x20, 0x89, 0x04, 0xac, 0x31, 0xc8, 0x50, 0xa8, 0x21, 0xaa, 0x30, 0xa8, 0x15, 0xac, + 0x24, 0xa9, 0x1a, 0x94, 0x29, 0xe9, 0x50, 0xb1, 0x1b, 0x03, 0x8c, 0x85, 0x0c, 0x93, 0x1d, 0xa3, + 0x29, 0xc1, 0x49, 0xb2, 0x48, 0xb9, 0x02, 0x39, 0xb4, 0x1d, 0x93, 0x2b, 0x93, 0x39, 0xb7, 0x0f, + 0x83, 0x19, 0xc1, 0x3a, 0x90, 0x80, 0x01, 0x8c, 0x16, 0x9b, 0x43, 0xe9, 0x08, 0x10, 0x82, 0x8b, + 0x19, 0xe3, 0x79, 0xc0, 0x30, 0xb0, 0x5a, 0xa1, 0x09, 0x98, 0x61, 0xb1, 0x2a, 0xc9, 0x43, 0x8a, + 0x28, 0xc1, 0x0a, 0x32, 0xba, 0x03, 0x8d, 0x25, 0xa8, 0x89, 0x80, 0x99, 0x02, 0x1f, 0x96, 0x8c, + 0x03, 0x1b, 0xb1, 0x22, 0x11, 0x3b, 0xf3, 0x2b, 0x24, 0xad, 0x53, 0xc8, 0x49, 0xc1, 0x3a, 0xa3, + 0x08, 0x2b, 0xf2, 0x08, 0x30, 0xc0, 0x39, 0xd3, 0x38, 0xc9, 0x2a, 0x84, 0x18, 0xa0, 0x88, 0xcc, + 0x71, 0x92, 0x09, 0x0c, 0x15, 0x89, 0xa1, 0x19, 0xb0, 0x70, 0xd1, 0x39, 0xc0, 0x38, 0x02, 0xac, + 0x13, 0x8c, 0x14, 0x9c, 0x82, 0x89, 0x48, 0xb0, 0x03, 0x8f, 0x13, 0x0a, 0x12, 0xf9, 0x39, 0x01, + 0xab, 0x21, 0x14, 0xac, 0x15, 0xbb, 0x23, 0x1b, 0xa6, 0x2a, 0x98, 0x20, 0xae, 0x25, 0xaa, 0x41, + 0xba, 0x24, 0xbc, 0x23, 0x8c, 0x33, 0xfb, 0x20, 0x88, 0x38, 0xc1, 0x08, 0x00, 0x3d, 0x96, 0x0c, + 0x02, 0x9b, 0x04, 0x1b, 0x96, 0x0c, 0x83, 0x2c, 0x83, 0x8c, 0x14, 0x8c, 0xa1, 0x39, 0x02, 0x0a, + 0xa2, 0x4a, 0xeb, 0x41, 0xa0, 0x89, 0x28, 0xc4, 0x4b, 0xb2, 0x19, 0x88, 0x31, 0xa2, 0x8d, 0x83, + 0x9e, 0x72, 0xa0, 0x08, 0x90, 0x20, 0x89, 0x85, 0x9c, 0x53, 0xd9, 0x30, 0xc0, 0x3a, 0xa3, 0x4b, + 0xc4, 0x1a, 0xa8, 0x31, 0xe2, 0x39, 0x98, 0x83, 0x8b, 0x10, 0x15, 0x8b, 0xa2, 0x08, 0x82, 0x0f, + 0x33, 0xfb, 0x20, 0x89, 0x10, 0xa2, 0x0b, 0x51, 0xb1, 0x08, 0xb3, 0x2f, 0xc8, 0x24, 0x8c, 0x03, + 0x0d, 0x23, 0xea, 0x58, 0xa9, 0x21, 0x90, 0x8c, 0x33, 0xd9, 0x00, 0x49, 0xd2, 0x18, 0x00, 0x89, + 0xa3, 0x8e, 0x14, 0x98, 0x00, 0x98, 0x04, 0x0f, 0x06, 0x9b, 0x01, 0x18, 0x89, 0x81, 0x19, 0xb2, + 0x1c, 0x04, 0x0f, 0xb4, 0x3a, 0x93, 0xac, 0x03, 0x3b, 0xd2, 0x83, 0x5a, 0xd0, 0x28, 0x81, 0x20, + 0xd9, 0x30, 0x8b, 0x86, 0x89, 0x30, 0xd9, 0x32, 0x9c, 0x31, 0xea, 0x42, 0xba, 0x30, 0xda, 0x21, + 0x13, 0x8f, 0x82, 0x1b, 0x02, 0xa1, 0x2b, 0xd2, 0x29, 0x92, 0x43, 0xcd, 0x53, 0xba, 0x32, 0xc9, + 0x30, 0x89, 0x81, 0x9c, 0x22, 0x03, 0xad, 0x52, 0xe9, 0x41, 0xaa, 0x93, 0x2b, 0x95, 0x1d, 0x94, + 0x1a, 0x01, 0x8b, 0x13, 0xcb, 0x22, 0x8b, 0x06, 0x9d, 0x21, 0x91, 0x2a, 0x88, 0x05, 0xad, 0x40, + 0xa2, 0x29, 0x98, 0x39, 0xe2, 0x4b, 0xa5, 0x2a, 0x09, 0x84, 0x0b, 0x81, 0x8d, 0x16, 0xa9, 0xb9, + 0x60, 0x90, 0x89, 0x03, 0x0c, 0xa5, 0x4b, 0xb1, 0x3b, 0xa3, 0x11, 0x8a, 0x82, 0x0a, 0x04, 0x83, + 0x0e, 0x86, 0x9c, 0x12, 0xb8, 0x10, 0x80, 0x38, 0xf3, 0x70, 0xca, 0x21, 0xa0, 0x19, 0x93, 0x0b, + 0xad, 0x45, 0xa9, 0x20, 0xb9, 0x22, 0x0a, 0xb2, 0x20, 0x11, 0x78, 0xf9, 0x18, 0x48, 0xb0, 0x32, + 0xc9, 0xab, 0x41, 0xa2, 0x4a, 0xa8, 0x28, 0x87, 0x8d, 0x04, 0xaa, 0x33, 0xab, 0x03, 0x9f, 0x14, + 0x8b, 0x82, 0x9b, 0x36, 0xcb, 0x22, 0xb8, 0x4a, 0x80, 0xa2, 0x1a, 0x18, 0xf9, 0x62, 0x98, 0x00, + 0xa9, 0x82, 0x3a, 0xa1, 0xb2, 0x7b, 0xa7, 0x1c, 0x92, 0x18, 0x00, 0x80, 0x8d, 0xa3, 0x1c, 0x03, + 0x3a, 0xf2, 0x6b, 0x90, 0x09, 0x92, 0x3a, 0xb4, 0x2b, 0x94, 0x9c, 0x12, 0x10, 0x10, 0xfb, 0x41, + 0x89, 0x83, 0x8e, 0x05, 0x8c, 0x12, 0xa8, 0x08, 0x88, 0x49, 0xb3, 0x88, 0x0e, 0x85, 0x0a, 0x93, + 0x09, 0xba, 0x43, 0x01, 0x99, 0x8d, 0x14, 0xc0, 0x40, 0xbc, 0x42, 0xc8, 0x41, 0xb8, 0x10, 0x08, + 0x14, 0xa8, 0x9d, 0x32, 0x1a, 0xc4, 0x0d, 0x02, 0x0b, 0x96, 0x39, 0xd1, 0x2a, 0x85, 0x1b, 0xb1, + 0x19, 0x22, 0x9a, 0x99, 0x32, 0xbb, 0x49, 0x17, 0xcd, 0x20, 0x21, 0xc0, 0x31, 0x0c, 0xb3, 0x6b, + 0xb3, 0x1b, 0x91, 0x2a, 0x92, 0xc9, 0x8a, 0x71, 0xa2, 0x09, 0x8a, 0x95, 0x5d, 0xb4, 0x1a, 0xa1, + 0x39, 0xc1, 0x4a, 0xd0, 0x31, 0x88, 0x8c, 0x04, 0x1b, 0x90, 0x63, 0xc8, 0x19, 0x88, 0x13, 0x91, + 0x8f, 0x05, 0xab, 0x24, 0xac, 0x82, 0x28, 0x82, 0x9c, 0x82, 0x88, 0x72, 0xb8, 0x88, 0x39, 0xd3, + 0x5b, 0xc2, 0x19, 0x90, 0x32, 0xdb, 0x30, 0x98, 0x62, 0xc1, 0x19, 0x9a, 0x24, 0x99, 0x88, 0xa2, + 0x0b, 0x50, 0xb2, 0x9d, 0x41, 0xa0, 0x70, 0xd9, 0x28, 0x20, 0x98, 0xb1, 0x30, 0xb9, 0x2c, 0x27, + 0xbc, 0x11, 0x1a, 0xa5, 0x1b, 0x31, 0x80, 0xa0, 0x7b, 0xa3, 0xac, 0x28, 0x04, 0x0a, 0xc1, 0x3c, + 0x93, 0x88, 0x3a, 0xa5, 0x0b, 0x12, 0x9b, 0x9a, 0x18, 0x37, 0x4b, 0xf1, 0x3b, 0xb0, 0x63, 0xb9, + 0x41, 0xeb, 0x40, 0x80, 0x90, 0x2a, 0x03, 0x0a, 0x8a, 0xb2, 0x39, 0x31, 0x08, 0xf3, 0x0f, 0x11, + 0x89, 0x83, 0x8d, 0x33, 0xad, 0x22, 0xa8, 0x1c, 0x83, 0x21, 0xcb, 0x99, 0x43, 0x42, 0xb8, 0xb8, + 0x7b, 0xc1, 0x81, 0x5b, 0x86, 0x0d, 0x93, 0x0b, 0x11, 0xb9, 0x34, 0xa9, 0xb8, 0x09, 0x21, 0xa2, + 0x78, 0xc0, 0x09, 0x11, 0x00, 0xd8, 0x39, 0xb5, 0x5a, 0xc9, 0x22, 0x90, 0x2a, 0x86, 0x1a, 0xc0, + 0x40, 0xa8, 0x28, 0xca, 0x41, 0xb8, 0x4a, 0xb3, 0x9a, 0x79, 0x96, 0x2b, 0xd8, 0x38, 0x82, 0x0c, + 0x92, 0x59, 0xd9, 0x12, 0x90, 0x89, 0x00, 0x80, 0x93, 0xaf, 0x54, 0xa0, 0x19, 0xa8, 0x51, 0xb8, + 0x22, 0xcc, 0x33, 0xda, 0x48, 0xa1, 0x88, 0x1a, 0x06, 0xab, 0x51, 0xb0, 0x10, 0xaa, 0x13, 0x8d, + 0x01, 0x18, 0x90, 0x52, 0xcc, 0x11, 0x01, 0x98, 0x30, 0xab, 0x85, 0x69, 0xc0, 0x19, 0x22, 0x09, + 0x91, 0xcf, 0x33, 0x1b, 0xb2, 0x2d, 0x93, 0x0c, 0x14, 0xc8, 0x88, 0x69, 0xa2, 0xa9, 0x2b, 0x04, + 0xc0, 0x58, 0xb0, 0x09, 0x81, 0x60, 0xa0, 0x80, 0x1b, 0x06, 0xaa, 0x81, 0x59, 0xd0, 0x39, 0x84, + 0x99, 0x89, 0x02, 0x89, 0x10, 0xaa, 0x00, 0x12, 0xc9, 0x54, 0xcc, 0x30, 0xb5, 0x4c, 0xc8, 0x20, + 0x18, 0xbb, 0x45, 0x98, 0x29, 0xa0, 0x20, 0xa9, 0x44, 0xab, 0xc2, 0x1e, 0x03, 0x08, 0x10, 0xba, + 0x45, 0xda, 0x00, 0x30, 0xe9, 0x31, 0xb8, 0x09, 0x09, 0x15, 0x0c, 0xb4, 0x2d, 0x86, 0x9b, 0x03, + 0x8b, 0x15, 0x9b, 0x04, 0x8c, 0x93, 0x49, 0xa0, 0x19, 0x9a, 0x02, 0x39, 0xc1, 0x19, 0x43, 0x09, + 0xc1, 0x38, 0x8a, 0x93, 0x87, 0x9f, 0x82, 0x1c, 0xc3, 0x60, 0x9a, 0x03, 0x8b, 0x00, 0x92, 0x8b, + 0x51, 0x91, 0x8e, 0x05, 0x8b, 0x13, 0x99, 0xa0, 0x6c, 0xd2, 0x30, 0xc8, 0x48, 0x90, 0x08, 0x80, + 0x29, 0x88, 0xa3, 0x9c, 0x18, 0x01, 0xe8, 0x2b, 0xb0, 0x57, 0xab, 0x23, 0xba, 0x59, 0x82, 0x01, + 0x9d, 0x10, 0x91, 0x18, 0x9a, 0x01, 0x21, 0xc8, 0x4a, 0xa6, 0x6b, 0xb0, 0x10, 0xa9, 0x29, 0x42, + 0x81, 0xfb, 0x58, 0xb9, 0x02, 0x4a, 0xf1, 0x39, 0xc2, 0x58, 0xa8, 0x10, 0x18, 0x80, 0x99, 0x20, + 0xda, 0x22, 0x0c, 0x96, 0xab, 0x15, 0x8b, 0x05, 0x89, 0xa1, 0x1b, 0x94, 0x88, 0x24, 0x9f, 0x12, + 0x01, 0xcb, 0x48, 0xa1, 0x89, 0x21, 0x84, 0xbf, 0x33, 0x98, 0x80, 0x18, 0x10, 0xd1, 0x1a, 0xa3, + 0x4a, 0xd9, 0x83, 0x68, 0xdb, 0x22, 0x30, 0xe9, 0x30, 0xa9, 0x04, 0x8b, 0x82, 0x8a, 0x82, 0x18, + 0x80, 0xbc, 0x59, 0x07, 0x8b, 0xb2, 0x1b, 0x17, 0xbc, 0x52, 0xa9, 0x11, 0x29, 0xb0, 0x09, 0x72, + 0xb8, 0x09, 0x82, 0x08, 0x31, 0xf9, 0x29, 0x81, 0x31, 0xf0, 0x29, 0xb9, 0x04, 0x89, 0x88, 0x19, + 0x04, 0x8c, 0x34, 0xf0, 0x18, 0x11, 0xd1, 0x18, 0xa8, 0x00, 0x2a, 0xa5, 0x4b, 0xa3, 0x2b, 0xb2, + 0x2a, 0xf1, 0x79, 0xb0, 0x11, 0xa0, 0x1c, 0x83, 0x3a, 0xa1, 0x08, 0x9b, 0x87, 0x3d, 0xb3, 0x0b, + 0x01, 0x36, 0xea, 0x2a, 0x84, 0x1a, 0xc0, 0x29, 0x80, 0x01, 0x0e, 0x84, 0x1c, 0xa3, 0x59, 0xb0, + 0x4a, 0xd2, 0x59, 0xb0, 0x49, 0xa1, 0x0a, 0x81, 0x38, 0xb1, 0x30, 0xab, 0xa0, 0x79, 0xc1, 0x21, + 0x99, 0x92, 0x98, 0x19, 0xf0, 0x5a, 0x91, 0x02, 0x9f, 0x03, 0x8a, 0x51, 0xa9, 0x02, 0x5a, 0xc2, + 0x1a, 0x02, 0x9b, 0x15, 0x8a, 0xe2, 0x1c, 0x92, 0x73, 0xd8, 0x10, 0xa8, 0x31, 0xa8, 0x19, 0x98, + 0x30, 0xc0, 0x4b, 0xb3, 0x1c, 0x23, 0xb2, 0x1d, 0x9e, 0x16, 0x8a, 0x82, 0x1a, 0x93, 0x0c, 0x02, + 0x83, 0x9e, 0x42, 0xf8, 0x29, 0x91, 0x20, 0xa0, 0x09, 0x08, 0x30, 0xe3, 0x3a, 0x89, 0xd5, 0x59, + 0xb0, 0x01, 0x0a, 0x81, 0x18, 0x58, 0xf2, 0x1a, 0x01, 0x99, 0x02, 0x88, 0x21, 0xc9, 0x6a, 0xa3, + 0x39, 0xe8, 0x4a, 0x93, 0xac, 0x24, 0x89, 0xb8, 0x58, 0xc2, 0x38, 0x08, 0xdb, 0x32, 0xa8, 0x08, + 0x82, 0xbd, 0x25, 0x88, 0x8a, 0xd3, 0x48, 0x00, 0xba, 0x20, 0x83, 0x8c, 0x32, 0xa5, 0x1f, 0xb3, + 0x2a, 0x60, 0xb1, 0x19, 0x89, 0x19, 0xb0, 0x2d, 0x07, 0x0c, 0x81, 0x0a, 0x83, 0x49, 0xe9, 0x32, + 0xca, 0x30, 0x80, 0xca, 0x59, 0x85, 0x8b, 0x02, 0x98, 0xac, 0x62, 0xa2, 0x2c, 0xc3, 0x3b, 0x82, + 0x11, 0x8d, 0x14, 0xbb, 0x59, 0xb1, 0x8d, 0x24, 0x98, 0x09, 0xb2, 0x48, 0x90, 0x8a, 0x32, 0x91, + 0x9a, 0x1a, 0xa6, 0x1e, 0x84, 0x90, 0x8b, 0x89, 0x86, 0x48, 0xb9, 0xa3, 0x5c, 0xe0, 0x50, 0xa8, + 0x20, 0xa8, 0x11, 0xa9, 0x38, 0xf2, 0x48, 0x99, 0x80, 0x88, 0x61, 0xa8, 0x80, 0x81, 0x2b, 0x06, + 0xbc, 0x32, 0x9a, 0x99, 0x16, 0x9c, 0x11, 0x11, 0x18, 0xc9, 0x1b, 0x06, 0x80, 0x99, 0x40, 0xc3, + 0x19, 0x0c, 0xb4, 0x1b, 0x14, 0xc8, 0x09, 0x80, 0x70, 0xc8, 0x82, 0x3c, 0x96, 0x0a, 0x91, 0x09, + 0x10, 0x85, 0x9c, 0x00, 0x88, 0x92, 0x69, 0xd2, 0x29, 0x02, 0xd8, 0x11, 0x0a, 0x93, 0x0a, 0x94, + 0x1d, 0x80, 0x00, 0xc9, 0x29, 0x16, 0x0a, 0xc2, 0x1b, 0xa8, 0x64, 0x89, 0x01, 0xa9, 0x10, 0x50, + 0xf0, 0x19, 0x81, 0x88, 0x38, 0xd2, 0x4b, 0x91, 0x18, 0x84, 0x8c, 0xe0, 0x60, 0xb0, 0x21, 0xb8, + 0x3b, 0xa4, 0x3b, 0xb1, 0x2a, 0x07, 0xa8, 0x8c, 0x10, 0x03, 0x2c, 0x85, 0x9c, 0x31, 0xd0, 0x18, + 0x80, 0x11, 0xa0, 0x81, 0x8e, 0x84, 0x2a, 0x82, 0x69, 0xe1, 0x1a, 0x02, 0x2a, 0xb3, 0x1d, 0xa0, + 0x98, 0x51, 0x92, 0x0e, 0x84, 0x0c, 0x82, 0x8a, 0x18, 0x14, 0x9b, 0x02, 0xb9, 0x4a, 0x33, 0xc4, + 0x2a, 0xa9, 0x72, 0xe0, 0x4a, 0x91, 0x08, 0x00, 0x9b, 0x09, 0x13, 0x23, 0xad, 0x0a, 0x92, 0x62, + 0xac, 0x33, 0xa1, 0x0e, 0x18, 0x92, 0x8d, 0x52, 0xb1, 0x2b, 0x1b, 0x07, 0x0c, 0x20, 0xb8, 0x32, + 0xab, 0x24, 0x9a, 0xb8, 0x1d, 0x17, 0x0e, 0x91, 0x30, 0xb8, 0x38, 0x90, 0x8b, 0x04, 0x49, 0xa3, + 0xbd, 0x3b, 0x17, 0x8a, 0xb0, 0x33, 0x9f, 0x12, 0x90, 0x88, 0x8b, 0x25, 0xb0, 0x2a, 0x04, 0x19, + 0xd8, 0x51, 0xc8, 0x28, 0x0c, 0xc3, 0x2b, 0x25, 0x19, 0xe0, 0x2b, 0xa3, 0x5a, 0x82, 0x0c, 0xa1, + 0x4a, 0x88, 0x11, 0xb9, 0x48, 0x13, 0xfb, 0x29, 0x29, 0x81, 0x10, 0xb2, 0x2e, 0xe0, 0x70, 0xa0, + 0x09, 0x01, 0x8a, 0x81, 0x09, 0x08, 0x70, 0xc4, 0x0c, 0x03, 0xa9, 0x33, 0xbc, 0x05, 0x1c, 0x84, + 0x89, 0xc9, 0x41, 0x89, 0x02, 0x99, 0x1b, 0x80, 0x16, 0x0b, 0xc0, 0x19, 0x22, 0xb1, 0x1c, 0x14, + 0xad, 0x05, 0x9a, 0x01, 0x68, 0xd3, 0x2b, 0xa1, 0x19, 0x03, 0x09, 0xd8, 0x62, 0xa9, 0x09, 0x02, + 0x2a, 0xe2, 0x3a, 0xb2, 0x10, 0x8b, 0x06, 0x99, 0x1a, 0xc2, 0x6b, 0xa3, 0x29, 0x08, 0xf8, 0x48, + 0x80, 0x82, 0x1d, 0x93, 0x2c, 0xb0, 0x10, 0x08, 0x10, 0xd9, 0x20, 0x38, 0xf3, 0x30, 0x9c, 0x01, + 0x99, 0x72, 0xb0, 0x2b, 0xb2, 0x72, 0xc9, 0x00, 0x49, 0xd2, 0x1b, 0x02, 0x08, 0x90, 0x41, 0xab, + 0x40, 0x97, 0x1c, 0xb1, 0x69, 0xa2, 0x0c, 0xa3, 0x1a, 0x83, 0x08, 0x90, 0x1c, 0xb2, 0x68, 0xb1, + 0x0b, 0x52, 0x93, 0xae, 0x11, 0x09, 0xd8, 0x61, 0xa8, 0x02, 0x0c, 0x84, 0x1c, 0x91, 0x02, 0x00, + 0xbc, 0x33, 0x01, 0xf0, 0x5a, 0xb1, 0x88, 0x08, 0xa0, 0x31, 0x11, 0xaf, 0x12, 0x20, 0x88, 0x96, + 0x0d, 0x88, 0x23, 0xbc, 0x00, 0x29, 0x02, 0x33, 0xae, 0x93, 0x1f, 0x04, 0xa8, 0x8a, 0x33, 0x82, + 0x9e, 0x04, 0x1d, 0xa2, 0x10, 0x1b, 0x99, 0x85, 0x1c, 0xb3, 0x1b, 0x23, 0x88, 0x05, 0xaf, 0x31, + 0x91, 0x9b, 0x21, 0xc9, 0x13, 0x3d, 0xd3, 0x28, 0x8e, 0x15, 0x99, 0x19, 0x10, 0x81, 0x0a, 0x84, + 0x0d, 0x85, 0x9d, 0x14, 0x9b, 0x02, 0x2b, 0xa5, 0x1b, 0xa2, 0x28, 0x33, 0xcc, 0x02, 0x9f, 0x12, + 0x31, 0xca, 0xb0, 0x78, 0xb1, 0x10, 0x2a, 0x90, 0x01, 0xc8, 0x6b, 0xb3, 0x2d, 0x85, 0x8b, 0x01, + 0x99, 0x63, 0xda, 0x21, 0x98, 0x00, 0x1c, 0x85, 0xaa, 0x30, 0xb1, 0x08, 0x00, 0x61, 0xc8, 0x08, + 0x0b, 0x23, 0x0c, 0x95, 0x19, 0xb8, 0x9c, 0x37, 0x99, 0x81, 0x0d, 0x85, 0x8b, 0x04, 0x9b, 0x12, + 0x88, 0x81, 0x9d, 0x05, 0x2a, 0xb5, 0x0b, 0x02, 0x18, 0xd9, 0x18, 0x20, 0x81, 0x01, 0xea, 0x38, + 0x89, 0x37, 0x8d, 0x98, 0x00, 0x14, 0xbc, 0x22, 0x99, 0x13, 0x2b, 0xa5, 0xae, 0x12, 0x41, 0xe8, + 0x19, 0x04, 0x9a, 0x01, 0x90, 0x20, 0x8c, 0x02, 0x89, 0xca, 0x00, 0x73, 0xb0, 0x18, 0x89, 0x85, + 0x1e, 0x84, 0x98, 0x19, 0x83, 0x8c, 0x99, 0x00, 0x71, 0xa4, 0x8d, 0x03, 0x0d, 0x93, 0x2a, 0xa3, + 0x1b, 0x42, 0xeb, 0x02, 0x0c, 0x05, 0x8a, 0x08, 0xa1, 0x49, 0xc1, 0x08, 0x01, 0x02, 0x9a, 0x10, + 0x90, 0x68, 0x85, 0xad, 0x40, 0xd0, 0x18, 0x12, 0x9d, 0x14, 0x9b, 0x13, 0x8d, 0x04, 0x0a, 0xa1, + 0x18, 0x83, 0xaf, 0x05, 0x0b, 0x83, 0x89, 0x12, 0xaa, 0xab, 0x74, 0xa8, 0x08, 0x41, 0xb0, 0x99, + 0x09, 0x16, 0x0a, 0xa2, 0x98, 0x0c, 0xa9, 0x37, 0xad, 0x33, 0x9a, 0x95, 0x0c, 0x82, 0x20, 0x08, + 0xda, 0x21, 0xbb, 0x43, 0x08, 0xb0, 0x6b, 0xa3, 0x09, 0x9c, 0x00, 0x16, 0x8c, 0x01, 0x82, 0x8c, + 0x01, 0x16, 0xad, 0x12, 0x18, 0xb0, 0x8b, 0x34, 0xba, 0x15, 0x1d, 0x95, 0x0d, 0x12, 0x99, 0x88, + 0x89, 0x52, 0xd0, 0x29, 0x90, 0x91, 0x28, 0x31, 0xdc, 0x92, 0x40, 0x98, 0xa2, 0x3d, 0x83, 0x98, + 0x98, 0x29, 0x09, 0x17, 0x19, 0xd8, 0x0f, 0x13, 0x8a, 0x80, 0x0a, 0x27, 0xac, 0x80, 0x39, 0x85, + 0xa9, 0x40, 0xd0, 0x88, 0x30, 0x93, 0xcb, 0x50, 0xa1, 0x2a, 0xf9, 0x42, 0xa9, 0x10, 0x88, 0x28, + 0xc9, 0x34, 0x8a, 0xa3, 0x0f, 0x13, 0xca, 0x28, 0xa1, 0x21, 0x9a, 0xa1, 0x28, 0x29, 0xa6, 0x68, + 0xc8, 0x09, 0x90, 0x7b, 0xa2, 0x98, 0x2a, 0x04, 0xa8, 0x1b, 0x20, 0x03, 0xd8, 0x4c, 0xb9, 0x26, + 0x1a, 0x05, 0xac, 0x01, 0x00, 0xa0, 0x1b, 0x10, 0xb8, 0x34, 0xff, 0x33, 0xaa, 0x22, 0x9a, 0xa1, + 0x1b, 0x52, 0xd2, 0x09, 0x88, 0x22, 0xab, 0x33, 0x80, 0xda, 0x22, 0x8e, 0x85, 0x19, 0x91, 0x15, + 0xad, 0x52, 0xdb, 0x32, 0x09, 0xc8, 0x19, 0x04, 0xab, 0x03, 0xab, 0x36, 0xba, 0x11, 0xa8, 0x09, + 0x65, 0xd0, 0x08, 0x88, 0x11, 0x08, 0x98, 0x80, 0x49, 0xa1, 0x31, 0xce, 0x12, 0x61, 0xc9, 0x19, + 0x08, 0x04, 0xab, 0x21, 0xb1, 0x71, 0xda, 0x30, 0xc8, 0x58, 0x80, 0x89, 0x89, 0x11, 0x21, 0xf9, + 0x48, 0xa0, 0x00, 0x8a, 0x83, 0x19, 0x9b, 0x55, 0x80, 0xba, 0x29, 0x14, 0xca, 0x51, 0xc0, 0x20, + 0xad, 0x31, 0x02, 0x0b, 0x90, 0x22, 0xe9, 0x3b, 0xe0, 0x42, 0xb9, 0x02, 0x8e, 0x14, 0x0a, 0xb3, + 0x4b, 0xa8, 0x15, 0x9a, 0xb0, 0x7b, 0x01, 0x91, 0x1b, 0x08, 0x96, 0x1c, 0xc1, 0x38, 0x98, 0x22, + 0xaa, 0x80, 0x3b, 0x07, 0x1a, 0xb2, 0x1e, 0x82, 0xac, 0x33, 0x99, 0x59, 0xb3, 0xbb, 0x6b, 0x90, + 0x83, 0x71, 0xe1, 0x19, 0x88, 0x12, 0x0c, 0x86, 0x8a, 0x80, 0x91, 0x89, 0x3a, 0x83, 0x84, 0x09, + 0xde, 0x41, 0x98, 0x24, 0xac, 0x01, 0x80, 0x38, 0xf2, 0x2c, 0x83, 0x99, 0x01, 0xae, 0x33, 0x02, + 0x98, 0xac, 0x23, 0x1a, 0xb3, 0x98, 0x1f, 0x96, 0x1a, 0x92, 0x8a, 0x22, 0x92, 0x0a, 0xbf, 0x43, + 0x90, 0x12, 0xbd, 0x73, 0xa9, 0x91, 0x40, 0xaa, 0x81, 0x9a, 0x00, 0x3a, 0xa6, 0x68, 0xb0, 0xa9, + 0x72, 0x90, 0x98, 0x10, 0x81, 0xab, 0x08, 0x45, 0xf9, 0x38, 0xb1, 0x28, 0xc0, 0x38, 0x02, 0x9b, + 0xb9, 0x73, 0xc9, 0x41, 0x00, 0xb9, 0x28, 0x01, 0xb9, 0x2b, 0xf1, 0x61, 0x88, 0xa8, 0x29, 0x02, + 0x28, 0x96, 0x9f, 0x11, 0x82, 0x8c, 0x94, 0x2a, 0xa1, 0x40, 0xc8, 0x29, 0x02, 0x91, 0xda, 0x50, + 0xb8, 0x22, 0x0a, 0x93, 0x9a, 0x89, 0x00, 0x7a, 0xe2, 0x2a, 0x01, 0xb1, 0x2b, 0x28, 0x92, 0xfc, + 0x72, 0xc0, 0x10, 0x1a, 0x95, 0x1b, 0x81, 0x20, 0xca, 0x22, 0x8d, 0x04, 0x8a, 0x52, 0xf8, 0x19, + 0x01, 0x01, 0xbb, 0x21, 0x80, 0x48, 0xb9, 0x11, 0x0a, 0x06, 0xc9, 0x1a, 0xb3, 0x70, 0x99, 0xa0, + 0x70, 0xa1, 0x29, 0x08, 0xe9, 0x70, 0xb0, 0x10, 0x9a, 0x13, 0x29, 0xb8, 0x89, 0x18, 0x95, 0x2e, + 0xd3, 0x1a, 0x02, 0x81, 0x89, 0x88, 0x10, 0x05, 0x9a, 0x09, 0x94, 0xbc, 0x60, 0x92, 0x9a, 0x21, + 0x2c, 0xa7, 0x09, 0x39, 0xe3, 0x49, 0xa0, 0x82, 0x0f, 0x13, 0x98, 0xaa, 0x09, 0x63, 0xb0, 0x2a, + 0xb1, 0x39, 0xa9, 0x27, 0xac, 0x81, 0x61, 0x91, 0xba, 0x2c, 0x85, 0x98, 0x09, 0x22, 0xbb, 0x62, + 0xa0, 0x8a, 0x31, 0x81, 0x40, 0xe9, 0x98, 0x34, 0xbb, 0x13, 0x8f, 0x01, 0x80, 0x1a, 0xc4, 0x59, + 0xb9, 0x42, 0xc8, 0x21, 0x9d, 0x13, 0x18, 0xc9, 0x01, 0x28, 0x80, 0x2a, 0xf1, 0x51, 0x98, 0x88, + 0x88, 0xb8, 0x52, 0x24, 0xf0, 0x1c, 0x01, 0x03, 0xbd, 0x30, 0x80, 0x00, 0xb8, 0x19, 0x90, 0x41, + 0x21, 0x95, 0xdf, 0x12, 0x11, 0xd8, 0x39, 0x83, 0x88, 0x99, 0x19, 0x22, 0xc9, 0x53, 0xac, 0xa0, + 0x2a, 0x27, 0xaa, 0x2a, 0x96, 0x2b, 0xd2, 0x39, 0xb8, 0x72, 0xb8, 0x10, 0x0a, 0x00, 0x85, 0x0a, + 0x9a, 0x33, 0xbd, 0x16, 0x8a, 0xa0, 0x48, 0x81, 0x92, 0x0e, 0xa1, 0x48, 0xa8, 0x13, 0x99, 0x8f, + 0x33, 0xb9, 0x89, 0x42, 0x21, 0xea, 0x89, 0x30, 0xb1, 0x35, 0x8d, 0xa3, 0x9c, 0x13, 0x0c, 0x81, + 0xb2, 0x60, 0xe9, 0x21, 0xa9, 0x32, 0x98, 0x11, 0xf9, 0x49, 0x92, 0x1a, 0xa5, 0x3b, 0xc1, 0x8a, + 0x23, 0x81, 0xbd, 0x52, 0xc8, 0x38, 0xd3, 0x4a, 0x81, 0x80, 0x8b, 0x88, 0x1a, 0x05, 0x91, 0x0e, + 0x84, 0x19, 0xa0, 0x88, 0x52, 0xc1, 0x9a, 0x62, 0x98, 0x21, 0xa9, 0xa9, 0x7b, 0xd1, 0x19, 0x82, + 0x1b, 0x93, 0x0e, 0x13, 0xba, 0x72, 0x92, 0x8b, 0x98, 0x23, 0xbb, 0x61, 0x80, 0xa0, 0xa8, 0x49, + 0xa0, 0x28, 0x01, 0x4b, 0xf1, 0x3d, 0x58, 0xb0, 0xa1, 0x7b, 0xb8, 0x38, 0x81, 0x10, 0xc8, 0x1a, + 0x02, 0x89, 0x28, 0x81, 0x27, 0x9e, 0x01, 0x31, 0xdd, 0x22, 0x90, 0xb0, 0x3c, 0x02, 0x90, 0x89, + 0x09, 0x23, 0xab, 0x07, 0x2e, 0xb0, 0x21, 0x12, 0x8f, 0xb0, 0x34, 0x9a, 0xa0, 0x79, 0x83, 0xac, + 0x28, 0x98, 0x22, 0x88, 0xa8, 0x2e, 0xa5, 0x2b, 0x93, 0x08, 0x2a, 0x96, 0x99, 0x0d, 0x02, 0x20, + 0xc0, 0x8a, 0x31, 0x35, 0xdd, 0x12, 0x2a, 0xf0, 0x50, 0xb8, 0x20, 0x2b, 0xa3, 0x30, 0xda, 0x10, + 0x9b, 0x14, 0x8a, 0x2c, 0xb5, 0x28, 0x2a, 0xa5, 0xcb, 0x71, 0x90, 0x81, 0x8b, 0x91, 0x32, 0xa9, + 0x81, 0x48, 0xe0, 0x31, 0xab, 0xc9, 0x62, 0x80, 0x22, 0xcf, 0x21, 0x10, 0x91, 0x0d, 0xa2, 0x20, + 0x99, 0x88, 0x80, 0x08, 0x71, 0xe2, 0x88, 0x1a, 0x04, 0x12, 0xbd, 0x32, 0xaa, 0x84, 0x8c, 0x12, + 0x91, 0x2a, 0x92, 0xea, 0x3b, 0x37, 0xb9, 0x98, 0x59, 0x92, 0xb9, 0x59, 0xc1, 0x20, 0x19, 0xc0, + 0x29, 0xe9, 0x31, 0x23, 0xdd, 0x29, 0x02, 0x18, 0x84, 0x9c, 0x82, 0x80, 0x29, 0xb1, 0x8a, 0x52, + 0x84, 0xcf, 0x32, 0x90, 0x29, 0xa1, 0x1a, 0xc1, 0x33, 0x1c, 0xf8, 0x81, 0x39, 0x82, 0x8d, 0x02, + 0x08, 0x90, 0xab, 0x70, 0xe1, 0x4a, 0x13, 0xbb, 0x20, 0x11, 0xc9, 0x30, 0x3a, 0xc7, 0x0a, 0x00, + 0x04, 0x9d, 0x22, 0x10, 0xe9, 0x11, 0x99, 0x81, 0x28, 0xc0, 0x01, 0x0f, 0x93, 0x18, 0x10, 0xaa, + 0x17, 0x0e, 0x92, 0x1a, 0x01, 0x12, 0xa9, 0x8d, 0x90, 0x75, 0xa8, 0x99, 0x30, 0xb2, 0x0c, 0x03, + 0x1a, 0x19, 0xa5, 0x89, 0xbc, 0x73, 0xa3, 0x9b, 0xa8, 0x78, 0x91, 0x99, 0x42, 0xa8, 0x00, 0x1b, + 0xb4, 0x1a, 0x09, 0x17, 0xaa, 0xa9, 0x4a, 0x87, 0x88, 0x19, 0x00, 0x90, 0x2b, 0x05, 0x10, 0xfc, + 0x30, 0xa0, 0x29, 0xa0, 0x08, 0x42, 0xe9, 0x0a, 0x61, 0xc8, 0x31, 0x8b, 0xa3, 0x3a, 0x90, 0x53, + 0xbe, 0x52, 0x90, 0x09, 0xaa, 0x20, 0x33, 0xdb, 0x80, 0x50, 0xc1, 0x4a, 0x84, 0x9b, 0x09, 0x03, + 0x88, 0xbc, 0x31, 0x43, 0xe9, 0x09, 0x20, 0x93, 0x2c, 0xa3, 0x8c, 0x18, 0x07, 0x1d, 0xc2, 0x4a, + 0x01, 0xa8, 0x09, 0xa0, 0x60, 0xc8, 0x21, 0xa9, 0x13, 0x1c, 0x05, 0xba, 0x58, 0xd2, 0x5b, 0x91, + 0x8a, 0x08, 0x12, 0x01, 0xbc, 0x38, 0x82, 0x49, 0xa1, 0x28, 0xc8, 0x2d, 0xa6, 0x0d, 0x13, 0x1a, + 0x91, 0xb8, 0x3c, 0x94, 0x01, 0x0f, 0x04, 0x8c, 0x01, 0x20, 0xd8, 0x40, 0x99, 0x83, 0x8e, 0x02, + 0x90, 0x0a, 0x14, 0x99, 0xc0, 0x68, 0x90, 0x88, 0x30, 0xd8, 0x08, 0x88, 0x05, 0x0c, 0xa0, 0x41, + 0xa0, 0x80, 0x1d, 0x84, 0x09, 0x09, 0x04, 0x8b, 0xd0, 0x61, 0xb8, 0x08, 0x30, 0x02, 0xbc, 0x08, + 0x51, 0xd8, 0x22, 0x8c, 0x92, 0x1a, 0x84, 0x09, 0x49, 0xe2, 0x4a, 0xa0, 0x98, 0x3a, 0xb4, 0x69, + 0x88, 0x91, 0x9b, 0x73, 0x90, 0x09, 0x9a, 0xc1, 0x78, 0xb2, 0x0a, 0x32, 0x09, 0xc4, 0x2c, 0x81, + 0x80, 0xaa, 0x70, 0xb0, 0x0b, 0x63, 0xc8, 0x28, 0x88, 0x28, 0xc1, 0x1d, 0x04, 0x88, 0x98, 0x58, + 0xd0, 0x38, 0x91, 0x90, 0x18, 0xa9, 0x11, 0xc9, 0x7b, 0x93, 0x1a, 0xd2, 0x6a, 0xa2, 0x9a, 0x28, + 0x06, 0xbb, 0x01, 0x09, 0x01, 0x22, 0xdc, 0x00, 0x32, 0xba, 0x43, 0xfa, 0x40, 0x08, 0xc0, 0x29, + 0x08, 0x12, 0x21, 0xec, 0x88, 0x21, 0x28, 0xc4, 0x0c, 0x00, 0x04, 0x29, 0xe9, 0x00, 0x39, 0x94, + 0x99, 0x8a, 0x12, 0x0b, 0xc6, 0x2c, 0x92, 0x19, 0x31, 0xa6, 0x8b, 0x1a, 0x17, 0x9a, 0x89, 0x12, + 0x88, 0x22, 0xbc, 0x01, 0x0b, 0x35, 0xa2, 0xbe, 0x88, 0x71, 0xa3, 0x9e, 0x01, 0x04, 0x8b, 0x82, + 0x0a, 0xa0, 0x61, 0xb2, 0x9d, 0x09, 0x35, 0xa1, 0x0b, 0x80, 0x21, 0xb9, 0x48, 0x9b, 0x87, 0x2a, + 0xb1, 0x0a, 0x10, 0x83, 0x72, 0xfb, 0x18, 0x12, 0x99, 0xb9, 0x14, 0x1d, 0x04, 0x98, 0x1c, 0xb1, + 0x71, 0xb0, 0x19, 0x0a, 0xa5, 0x59, 0xc0, 0x18, 0x10, 0x91, 0x8a, 0x10, 0x90, 0x0b, 0x17, 0x1a, + 0xf0, 0x39, 0x93, 0x08, 0x8b, 0x05, 0x1a, 0xba, 0x05, 0x0e, 0x02, 0x88, 0x08, 0xb9, 0x2a, 0x07, + 0x58, 0xe8, 0x28, 0x90, 0x81, 0x2b, 0xc3, 0x4b, 0x92, 0x10, 0x99, 0x0a, 0x17, 0x9b, 0x82, 0xa8, + 0x3a, 0x26, 0xad, 0x03, 0x2b, 0xb2, 0x90, 0x28, 0xa8, 0xf1, 0x4a, 0x12, 0xcd, 0x31, 0x13, 0xaa, + 0x80, 0x8c, 0x07, 0x4b, 0xb0, 0x38, 0xf8, 0x49, 0xb3, 0x29, 0x89, 0x28, 0xa3, 0xad, 0x48, 0x02, + 0xd9, 0x11, 0x08, 0xe0, 0x40, 0xb2, 0x2d, 0x92, 0x01, 0xab, 0x98, 0x44, 0x19, 0xc0, 0x29, 0xa0, + 0x24, 0xac, 0x35, 0xdb, 0x08, 0x40, 0xd0, 0x29, 0x00, 0x02, 0x1d, 0xc2, 0x49, 0x80, 0xb8, 0x62, + 0xc9, 0x30, 0x98, 0x91, 0x0c, 0x24, 0xb8, 0x08, 0x08, 0x98, 0x28, 0xd1, 0x28, 0x42, 0xfc, 0x00, + 0x50, 0xa0, 0x99, 0x28, 0x13, 0xd0, 0x0a, 0x18, 0x12, 0x06, 0x9b, 0x10, 0xd8, 0x48, 0x82, 0x1b, + 0xdc, 0x61, 0xb0, 0x89, 0x20, 0x04, 0x99, 0xa1, 0x0b, 0x92, 0x61, 0x99, 0x98, 0x00, 0x5b, 0x94, + 0xba, 0x20, 0x52, 0xc2, 0xcb, 0x78, 0x90, 0x11, 0x9b, 0x32, 0xd9, 0x2a, 0x43, 0xc9, 0xb8, 0x72, + 0xa8, 0x90, 0x09, 0x93, 0x5b, 0xa5, 0x0c, 0x13, 0x98, 0x99, 0x88, 0x23, 0x8b, 0x26, 0xdd, 0x01, + 0x1b, 0x07, 0x80, 0x8a, 0x90, 0x3a, 0x85, 0x8a, 0x19, 0x93, 0x2b, 0x84, 0x8f, 0x00, 0x32, 0x81, + 0xdf, 0x21, 0x81, 0x08, 0x0b, 0x85, 0x0b, 0x22, 0xb1, 0x9e, 0x11, 0x30, 0xf3, 0x2b, 0x98, 0x32, + 0x99, 0x18, 0x14, 0xeb, 0x31, 0x88, 0xc0, 0x59, 0x81, 0x94, 0xaf, 0x14, 0x0a, 0x90, 0x39, 0x95, + 0x9c, 0x10, 0x18, 0xa3, 0x0d, 0x13, 0xba, 0x80, 0x61, 0xa8, 0x10, 0x89, 0xa3, 0x0c, 0x21, 0x05, + 0x0d, 0xb2, 0x69, 0xb1, 0x98, 0x61, 0xd0, 0x28, 0xb8, 0x30, 0xa8, 0x22, 0xab, 0xc1, 0x78, 0xa2, + 0x9a, 0x42, 0xd2, 0x1b, 0x01, 0xc1, 0x2b, 0x84, 0x23, 0xbc, 0x80, 0x40, 0xb3, 0x00, 0x8e, 0x84, + 0x0c, 0x12, 0xa0, 0x0a, 0x31, 0x13, 0xed, 0x1b, 0x85, 0x21, 0x8e, 0x93, 0x2b, 0xb2, 0x5b, 0x23, + 0xe8, 0x2a, 0x91, 0xc8, 0x5b, 0x83, 0x09, 0x02, 0x8d, 0x92, 0x39, 0x18, 0x04, 0x9d, 0xa0, 0x39, + 0xa3, 0x0a, 0x58, 0xa4, 0x1b, 0x99, 0xa2, 0x71, 0xc8, 0x44, 0xdb, 0x10, 0x18, 0x93, 0x19, 0xbb, + 0x88, 0x47, 0xeb, 0x21, 0x99, 0x03, 0xaa, 0x41, 0xa8, 0xa0, 0x51, 0x09, 0xb1, 0x3c, 0x15, 0xb9, + 0x9b, 0x22, 0x21, 0x1c, 0xb6, 0x2a, 0x9b, 0x45, 0x92, 0xdc, 0x2a, 0x84, 0x10, 0xfa, 0x38, 0x01, + 0xa0, 0x39, 0xb0, 0xaa, 0x70, 0x97, 0x8a, 0x98, 0x41, 0x91, 0x8a, 0x00, 0x10, 0x00, 0xd9, 0x09, + 0xca, 0x45, 0x18, 0xc8, 0x18, 0x29, 0x95, 0x0a, 0xaa, 0x16, 0xac, 0x24, 0xab, 0x10, 0x00, 0x33, + 0xca, 0x9b, 0x15, 0x10, 0xab, 0x13, 0xae, 0x32, 0x80, 0x8d, 0x85, 0x1d, 0x94, 0x29, 0xc8, 0x20, + 0xa8, 0x52, 0xa0, 0xa9, 0x20, 0xa8, 0x24, 0xcb, 0x10, 0x34, 0xfa, 0x19, 0x0a, 0x15, 0x19, 0xc1, + 0x9c, 0x42, 0x10, 0xd0, 0x2a, 0x22, 0xc9, 0x8a, 0x22, 0xc8, 0x5a, 0x93, 0x20, 0x9d, 0x82, 0x44, + 0xca, 0x18, 0x39, 0xa5, 0xad, 0x30, 0xa1, 0x50, 0xc9, 0x03, 0x8d, 0x02, 0x38, 0xe1, 0x0a, 0x22, + 0x80, 0x9a, 0x13, 0x99, 0x04, 0xae, 0x11, 0xa1, 0x4b, 0x14, 0xa8, 0x9a, 0x01, 0x35, 0xc0, 0x4a, + 0xfa, 0x11, 0x91, 0x0f, 0x04, 0x9a, 0x81, 0x28, 0xa0, 0x31, 0xa8, 0x90, 0xb0, 0x4a, 0x69, 0xb2, + 0x91, 0x1f, 0x92, 0x8b, 0x11, 0x25, 0xeb, 0x40, 0xb9, 0x11, 0x20, 0xa0, 0x13, 0x9f, 0x86, 0x08, + 0xa9, 0x08, 0x20, 0xc0, 0x23, 0xaf, 0x22, 0x89, 0x03, 0x82, 0x8d, 0x99, 0x02, 0x01, 0x1c, 0x00, + 0xd3, 0x2c, 0xc3, 0x7b, 0xa3, 0x2c, 0x84, 0xaa, 0x18, 0x08, 0x94, 0x2a, 0x95, 0x0e, 0x02, 0x0b, + 0x82, 0x01, 0xbc, 0x60, 0xc1, 0x1b, 0x23, 0x19, 0xc1, 0x2c, 0xa4, 0x4a, 0xb0, 0x21, 0xb8, 0x8e, + 0x04, 0x2b, 0x96, 0x1b, 0x03, 0xa0, 0x18, 0xab, 0x92, 0x49, 0x88, 0x21, 0xfa, 0x6a, 0xa2, 0x19, + 0xc9, 0x44, 0xba, 0x13, 0x8d, 0x80, 0x12, 0x80, 0xc2, 0x3c, 0xa8, 0x11, 0x01, 0xaa, 0x68, 0xa0, + 0x13, 0xbf, 0x33, 0x38, 0xc2, 0x8b, 0x91, 0x0b, 0x17, 0x1d, 0xd3, 0x3a, 0xb4, 0x5b, 0xb2, 0x2d, + 0x85, 0x19, 0xa9, 0x1b, 0x86, 0x89, 0x00, 0x0a, 0x92, 0x30, 0xa8, 0xb0, 0x4d, 0x84, 0x80, 0xbb, + 0x3a, 0x11, 0x07, 0x29, 0xb1, 0x8d, 0x80, 0x48, 0xe3, 0x0a, 0x33, 0x09, 0xfa, 0x38, 0xa3, 0x5a, + 0xa8, 0x02, 0xbb, 0x49, 0x02, 0xd9, 0x09, 0x49, 0xb3, 0x70, 0xd9, 0x21, 0x88, 0x20, 0xc1, 0x0b, + 0x33, 0x0b, 0x97, 0x8d, 0xa2, 0x58, 0xb1, 0x80, 0x0a, 0x21, 0x84, 0x9d, 0x01, 0x00, 0x88, 0x22, + 0xfa, 0x31, 0xf0, 0x39, 0x90, 0xad, 0x35, 0x98, 0xa8, 0x3a, 0x96, 0x19, 0x88, 0x11, 0x88, 0xca, + 0x14, 0x8b, 0xb2, 0x68, 0xb2, 0xac, 0x71, 0x80, 0xb1, 0x2a, 0x02, 0xc1, 0x0b, 0x49, 0x87, 0x0c, + 0x91, 0x28, 0xca, 0x43, 0x88, 0xbb, 0x01, 0x5a, 0x84, 0x89, 0x0a, 0x33, 0xfb, 0x51, 0xb8, 0x48, + 0x9a, 0x11, 0xb9, 0x40, 0x92, 0x6a, 0xd0, 0x28, 0x88, 0x10, 0xba, 0x42, 0xd9, 0x30, 0x92, 0x0d, + 0xb1, 0x62, 0xd9, 0x21, 0x98, 0x19, 0x82, 0x89, 0x02, 0x0e, 0x15, 0xab, 0x01, 0x28, 0x91, 0x89, + 0x88, 0x08, 0xf0, 0x6c, 0x95, 0x8a, 0x88, 0x30, 0x90, 0xaa, 0x31, 0x93, 0x9f, 0x11, 0xb3, 0x1d, + 0x84, 0x48, 0xe9, 0x20, 0x80, 0x81, 0x9b, 0x10, 0x03, 0xaf, 0x33, 0x81, 0xcc, 0x31, 0x00, 0xb1, + 0x80, 0x3c, 0xd1, 0x50, 0xb9, 0x61, 0xc9, 0x41, 0xa8, 0x19, 0xa9, 0x16, 0x9a, 0x81, 0xa0, 0x18, + 0x02, 0x70, 0xe8, 0x20, 0x0a, 0x92, 0x0c, 0x81, 0x80, 0x2b, 0x93, 0x43, 0x9e, 0x14, 0x88, 0x9a, + 0x11, 0x39, 0xd1, 0x3a, 0xd2, 0x2c, 0xa2, 0x61, 0xb0, 0x8a, 0x30, 0x08, 0x48, 0xf0, 0x1a, 0x28, + 0xa3, 0x42, 0xac, 0x02, 0x3a, 0xf3, 0x1e, 0x81, 0x81, 0x20, 0xb8, 0x38, 0xbd, 0x36, 0xb8, 0x08, + 0x01, 0xb2, 0x09, 0xad, 0x52, 0xa2, 0x2c, 0x93, 0xeb, 0x31, 0x89, 0x06, 0xbb, 0x51, 0x90, 0x80, + 0xac, 0x71, 0xa0, 0x28, 0x9a, 0x82, 0x8d, 0x05, 0x80, 0x88, 0xb0, 0x38, 0xc8, 0x22, 0x40, 0xa4, + 0x1d, 0xe0, 0x39, 0x91, 0x10, 0xa2, 0x8a, 0x91, 0x1f, 0x84, 0x11, 0x0a, 0xa9, 0x12, 0xbe, 0x10, + 0x43, 0x98, 0x23, 0xcd, 0x39, 0xc0, 0x79, 0xa2, 0x0a, 0x90, 0x18, 0x02, 0x8c, 0x12, 0x40, 0xc4, + 0x1d, 0x81, 0xa8, 0x39, 0xa3, 0x41, 0xcb, 0x11, 0x90, 0x82, 0xac, 0x64, 0xa8, 0x9b, 0x32, 0xba, + 0x33, 0x3a, 0xf2, 0x90, 0x2a, 0x12, 0x98, 0x02, 0x9c, 0x72, 0xf0, 0x29, 0x90, 0x38, 0x83, 0x1a, + 0xa4, 0xaf, 0x33, 0x8b, 0x07, 0x9d, 0x02, 0x91, 0x0c, 0x93, 0x48, 0xb1, 0x5a, 0xc0, 0x1b, 0x04, + 0x19, 0x80, 0x91, 0x2b, 0xa8, 0x86, 0x3c, 0xc2, 0x29, 0x00, 0xc0, 0x2b, 0x92, 0x69, 0x93, 0xba, + 0x68, 0xc0, 0x48, 0x90, 0x90, 0x19, 0xb1, 0x1b, 0x9e, 0x27, 0x9a, 0x22, 0xca, 0x19, 0x43, 0x9a, + 0x94, 0x1c, 0x92, 0x38, 0xc2, 0x0e, 0x12, 0x8c, 0x14, 0xbd, 0x43, 0x9a, 0x02, 0x18, 0xa9, 0x22, + 0x8a, 0x86, 0x0d, 0xa1, 0x12, 0xab, 0x05, 0xab, 0x08, 0x73, 0xb1, 0x0b, 0x04, 0x1b, 0xa5, 0x0c, + 0x15, 0x99, 0x00, 0xd9, 0x08, 0x24, 0x1b, 0xe1, 0x40, 0xda, 0x21, 0x98, 0x20, 0x08, 0x98, 0x31, + 0x89, 0xf1, 0x59, 0xa0, 0x09, 0x89, 0x33, 0xbe, 0x25, 0xa9, 0x28, 0xb1, 0x62, 0xb9, 0x18, 0x18, + 0xe2, 0x48, 0xb8, 0x21, 0x98, 0xcb, 0x54, 0x98, 0x08, 0x8a, 0xa5, 0x0f, 0x85, 0x1a, 0xa1, 0x28, + 0x02, 0xda, 0x11, 0x1b, 0x85, 0x8b, 0x92, 0xa9, 0x2a, 0x27, 0x08, 0x9b, 0x14, 0xca, 0x29, 0x18, + 0x07, 0xab, 0x13, 0x0a, 0xd8, 0x10, 0x21, 0xa1, 0x29, 0x8d, 0x97, 0x8f, 0x02, 0x12, 0x8b, 0x82, + 0x8a, 0xa9, 0x32, 0x52, 0xf1, 0x2a, 0x92, 0x19, 0xc9, 0x62, 0x98, 0x88, 0x0a, 0x14, 0xab, 0x22, + 0x15, 0x9f, 0x01, 0x2b, 0x82, 0xba, 0x73, 0xa0, 0x2b, 0x91, 0xa1, 0x2d, 0x95, 0x2b, 0xb2, 0x1a, + 0x44, 0xda, 0x22, 0x8a, 0x94, 0x1d, 0x81, 0xa8, 0x09, 0x70, 0xb1, 0x1a, 0x21, 0x91, 0xbb, 0x22, + 0x28, 0x9a, 0xa7, 0x4d, 0xc2, 0x3a, 0x02, 0xb0, 0x8b, 0x30, 0x97, 0x8d, 0x81, 0x30, 0x8a, 0x21, + 0xd1, 0x19, 0x99, 0x72, 0xa1, 0xbb, 0x54, 0xa9, 0xa8, 0x18, 0x04, 0x19, 0xc3, 0x48, 0xda, 0x29, + 0x15, 0x09, 0x99, 0x18, 0x19, 0x91, 0xaa, 0x92, 0x4a, 0x33, 0xa9, 0xff, 0x20, 0x20, 0xc5, 0x2b, + 0xa2, 0x28, 0xa0, 0x20, 0xf1, 0x39, 0x93, 0x89, 0xba, 0x68, 0x94, 0x8c, 0x53, 0xbb, 0x84, 0x3a, + 0x93, 0x0d, 0x92, 0x38, 0xf1, 0x1c, 0x01, 0x01, 0x89, 0x00, 0x82, 0x9d, 0xb0, 0x71, 0xc3, 0x09, + 0x13, 0xac, 0x12, 0x8a, 0x32, 0xb9, 0x44, 0x9b, 0xcc, 0x21, 0x08, 0x16, 0x8b, 0x01, 0xb8, 0x68, + 0xa0, 0x29, 0x90, 0x79, 0xf2, 0x3b, 0xa2, 0x48, 0xc1, 0x30, 0xd8, 0x1c, 0x85, 0x1b, 0xa2, 0x49, + 0x90, 0x89, 0x19, 0x01, 0x12, 0x0c, 0x86, 0xab, 0xa0, 0x78, 0x91, 0x88, 0x31, 0xb9, 0x10, 0xac, + 0x33, 0x1a, 0x17, 0x9e, 0x83, 0x8e, 0x12, 0x80, 0x20, 0xba, 0x82, 0x8f, 0x02, 0x89, 0x24, 0x08, + 0xe9, 0x80, 0x0a, 0x63, 0x80, 0x00, 0xb8, 0x1a, 0xb3, 0x7a, 0xb1, 0x2a, 0x84, 0x9b, 0xb8, 0x0d, + 0x47, 0x99, 0x00, 0x89, 0xc8, 0x49, 0x93, 0x28, 0x9d, 0x22, 0xc8, 0x29, 0xc3, 0x58, 0xb2, 0x1a, + 0xb0, 0x2a, 0x82, 0x72, 0xb3, 0x0d, 0x02, 0x9b, 0x83, 0x8c, 0x01, 0x08, 0x83, 0xaa, 0xab, 0x37, + 0x23, 0xba, 0xb8, 0x1d, 0x95, 0x39, 0xd8, 0x08, 0x00, 0x78, 0xf3, 0x1b, 0x03, 0x0c, 0x06, 0x8b, + 0x01, 0x99, 0x38, 0x90, 0x13, 0x9a, 0x12, 0xc9, 0x9d, 0x41, 0x00, 0x83, 0x9f, 0x04, 0x9c, 0x41, + 0x80, 0x00, 0x9c, 0x22, 0xd8, 0x39, 0xd1, 0x28, 0x22, 0xeb, 0x01, 0x09, 0x20, 0x14, 0xca, 0x11, + 0x9c, 0x24, 0x98, 0x89, 0x88, 0x50, 0xb5, 0x1c, 0xc0, 0x48, 0x92, 0x1a, 0xe2, 0x3a, 0x94, 0x89, + 0x81, 0x0c, 0x16, 0x9a, 0x98, 0x08, 0x11, 0x01, 0x88, 0xf0, 0x3b, 0x85, 0x11, 0xaa, 0x99, 0x63, + 0x98, 0x98, 0xac, 0x21, 0x24, 0x82, 0x9e, 0x10, 0x90, 0x28, 0xc2, 0x0a, 0x69, 0xa4, 0x8a, 0xba, + 0x71, 0x01, 0x80, 0xa8, 0xdb, 0x60, 0xa1, 0x28, 0xd9, 0x41, 0xa0, 0x00, 0xb9, 0x6a, 0x83, 0x3a, + 0xf8, 0x2a, 0x01, 0x00, 0x28, 0x9a, 0x13, 0xbb, 0x62, 0xd0, 0x2a, 0x82, 0x02, 0xad, 0x88, 0x42, + 0xd0, 0x5a, 0xa8, 0x32, 0xc9, 0x3b, 0xa7, 0x2a, 0x81, 0x20, 0xac, 0x81, 0x38, 0x12, 0xb8, 0x73, + 0xcc, 0x01, 0x3a, 0x95, 0x1c, 0x92, 0x2a, 0x94, 0x9b, 0x20, 0xa2, 0x2b, 0xa3, 0xaa, 0xbf, 0x71, + 0xa2, 0x29, 0x01, 0x99, 0x31, 0xf0, 0x2a, 0x80, 0x20, 0xb1, 0xac, 0x59, 0x05, 0x9b, 0xa1, 0x61, + 0xa0, 0x80, 0x0d, 0x84, 0x0b, 0x13, 0x93, 0x1e, 0xa0, 0x19, 0x84, 0x2e, 0x92, 0x9c, 0x40, 0x98, + 0x21, 0xdb, 0x52, 0xb0, 0x18, 0x80, 0xa9, 0x48, 0xa0, 0x03, 0x9f, 0x01, 0x22, 0x9b, 0x24, 0xc9, + 0x72, 0x99, 0xa8, 0x89, 0x64, 0xa9, 0x20, 0xba, 0x42, 0xa8, 0xa8, 0x18, 0x48, 0xb5, 0x2d, 0xd3, + 0x1b, 0x11, 0x03, 0x1a, 0xa0, 0x1a, 0x81, 0xac, 0x05, 0x40, 0x8c, 0xc2, 0x30, 0xbb, 0x47, 0xa8, + 0x10, 0x09, 0xa9, 0x9b, 0x82, 0x70, 0x84, 0xbb, 0x18, 0x30, 0xf8, 0x58, 0x80, 0x98, 0x81, 0x9f, + 0x13, 0x0b, 0x25, 0xa9, 0x00, 0xa8, 0x09, 0x02, 0x39, 0xf0, 0x6a, 0xb0, 0x41, 0xdb, 0x52, 0xa0, + 0x18, 0xb0, 0x19, 0x91, 0x3b, 0x87, 0x18, 0xdb, 0x48, 0xa1, 0x18, 0x80, 0x12, 0xbb, 0x20, 0xdc, + 0x23, 0x8c, 0x34, 0xa2, 0xbf, 0x14, 0x89, 0x00, 0x19, 0x13, 0x8a, 0xf1, 0x3a, 0xb2, 0x2a, 0x37, + 0xb9, 0xca, 0x48, 0x02, 0x8a, 0xa0, 0x62, 0xdb, 0x22, 0xba, 0x31, 0x03, 0x01, 0xce, 0x08, 0x00, + 0x00, 0x22, 0x89, 0xc0, 0x30, 0x0a, 0x73, 0xf8, 0x68, 0xb0, 0x2a, 0x90, 0x38, 0x01, 0x98, 0xba, + 0x52, 0xd8, 0x72, 0xc8, 0x19, 0x90, 0x42, 0xcb, 0x21, 0x88, 0x01, 0xb0, 0x32, 0xdc, 0x40, 0x90, + 0x90, 0x9c, 0x53, 0x91, 0x88, 0xa8, 0x20, 0x01, 0xa9, 0xc8, 0x38, 0x04, 0x0f, 0xd3, 0x2c, 0x15, + 0x00, 0xaa, 0x89, 0x81, 0x31, 0xa0, 0x98, 0x2c, 0x03, 0x00, 0xdf, 0x39, 0x14, 0xa8, 0x8a, 0x0a, + 0x02, 0x2a, 0x06, 0x88, 0xa0, 0x2e, 0xa5, 0x2c, 0x04, 0xaa, 0x23, 0xab, 0x19, 0x83, 0x5a, 0xb2, + 0x34, 0xcf, 0x14, 0x89, 0x92, 0x9c, 0x02, 0x09, 0xc0, 0x08, 0x19, 0xd3, 0x70, 0xa2, 0x99, 0x08, + 0x20, 0x88, 0xc1, 0x6b, 0x91, 0x03, 0x1b, 0xf9, 0x69, 0x92, 0x8a, 0x00, 0x99, 0x84, 0x1d, 0x83, + 0x3a, 0xb3, 0x2c, 0xc0, 0x0d, 0x23, 0x92, 0x9c, 0x10, 0xbb, 0x22, 0x72, 0x81, 0x0a, 0xa0, 0x0b, + 0x86, 0x0f, 0x13, 0xa0, 0x0b, 0x93, 0x1c, 0xa3, 0x20, 0x48, 0xb6, 0x8f, 0x03, 0x80, 0x09, 0x89, + 0x12, 0x21, 0xaa, 0xf9, 0x69, 0x9a, 0x15, 0xbc, 0x32, 0x99, 0x12, 0xa8, 0x01, 0x1b, 0x01, 0xb4, + 0x9f, 0xa0, 0x73, 0xb3, 0x0d, 0x91, 0x68, 0x90, 0x18, 0x98, 0x80, 0x18, 0x83, 0xcb, 0x2b, 0x27, + 0xb9, 0x9d, 0x52, 0xa1, 0x0a, 0x80, 0x01, 0x9d, 0x23, 0x11, 0xfa, 0x2a, 0x22, 0x01, 0xd9, 0x4a, + 0x93, 0x0d, 0x03, 0x0b, 0xa8, 0x25, 0x10, 0xdc, 0x20, 0x80, 0x13, 0xdb, 0x21, 0xcc, 0x21, 0x10, + 0x89, 0xd1, 0x70, 0xa1, 0x99, 0x09, 0x23, 0x20, 0xdc, 0x11, 0x9a, 0x13, 0x32, 0xce, 0x20, 0x01, + 0x81, 0xeb, 0x39, 0x05, 0x8a, 0x01, 0x9a, 0xc1, 0x7b, 0x97, 0x8a, 0x81, 0x10, 0xa8, 0x09, 0x01, + 0x11, 0x09, 0xb1, 0x8d, 0x12, 0x42, 0x8b, 0xe4, 0x1a, 0x10, 0x99, 0x90, 0x40, 0xa6, 0x5a, 0xc8, + 0x01, 0x9a, 0x44, 0x91, 0xbb, 0x31, 0x0b, 0xc3, 0x40, 0x99, 0x40, 0xd8, 0x19, 0x90, 0x09, 0x53, + 0x99, 0xc1, 0x70, 0xbc, 0x24, 0x99, 0x12, 0xb9, 0x28, 0xfa, 0x40, 0x08, 0x00, 0x84, 0x8c, 0x81, + 0x28, 0xa1, 0x29, 0x81, 0xe9, 0x8b, 0x38, 0x86, 0x30, 0xba, 0x90, 0x2c, 0xc3, 0x1c, 0x14, 0x98, + 0x5b, 0xe1, 0x28, 0x92, 0x5b, 0x94, 0x8b, 0x8a, 0x21, 0x0a, 0x07, 0x8b, 0x88, 0x22, 0x2a, 0xc4, + 0x0c, 0x32, 0xc0, 0x0a, 0x81, 0x38, 0xc2, 0x8a, 0x00, 0x10, 0x11, 0x18, 0x00, 0xbf, 0x92, 0x79, + 0xc5, 0x8a, 0x28, 0x21, 0xe5, 0x2b, 0x82, 0x11, 0xb1, 0x2b, 0xe2, 0x68, 0xa0, 0x88, 0x28, 0x8b, + 0x17, 0x9a, 0x21, 0x9c, 0xb1, 0x52, 0xab, 0x06, 0x8b, 0x04, 0x9a, 0x22, 0xaa, 0x24, 0xcc, 0x91, + 0x1c, 0x04, 0xb0, 0x40, 0x99, 0x04, 0xab, 0x72, 0xb8, 0x40, 0xc9, 0x31, 0xbb, 0x16, 0x8c, 0x13, + 0x9a, 0x81, 0x99, 0x41, 0xcb, 0x25, 0xb9, 0x10, 0x9b, 0x83, 0x79, 0xb2, 0x09, 0x9c, 0x14, 0x08, + 0xab, 0x34, 0x89, 0x90, 0x8b, 0x23, 0x2a, 0x17, 0x10, 0xfb, 0x3a, 0x93, 0x39, 0xc9, 0x18, 0x09, + 0x95, 0x09, 0x9c, 0x10, 0x81, 0x37, 0xde, 0x30, 0x11, 0xc0, 0x1a, 0x98, 0x06, 0x0a, 0x11, 0xb8, + 0x8d, 0x35, 0x89, 0xcb, 0x32, 0x82, 0x0c, 0x91, 0x0a, 0x34, 0xad, 0x24, 0xae, 0x12, 0x02, 0xa9, + 0x9c, 0x43, 0x11, 0xb0, 0x0d, 0x83, 0xbb, 0x60, 0xe0, 0x28, 0x88, 0x42, 0xb0, 0x0c, 0x03, 0x18, + 0xa8, 0x01, 0x0e, 0xa1, 0x79, 0x92, 0xba, 0x70, 0x91, 0x89, 0x99, 0x32, 0x80, 0x8e, 0x11, 0xa1, + 0x0e, 0x14, 0x88, 0xc8, 0x3b, 0x12, 0xe1, 0x29, 0x18, 0xb2, 0x39, 0x95, 0x9d, 0x22, 0x10, 0xa2, + 0xad, 0x12, 0x48, 0xb2, 0x0c, 0x03, 0xbc, 0x51, 0xd0, 0x31, 0x8a, 0x84, 0x9c, 0x81, 0x1a, 0x04, + 0xa8, 0x88, 0x2a, 0xc3, 0x73, 0xa0, 0xad, 0x34, 0x8a, 0xc1, 0x10, 0x30, 0xa9, 0xa1, 0x48, 0x91, + 0xac, 0x33, 0x19, 0xe1, 0x1c, 0x92, 0x02, 0x20, 0x2b, 0x07, 0x9f, 0x04, 0x0b, 0xc0, 0x68, 0xb1, + 0x39, 0xd8, 0x30, 0x99, 0x14, 0x89, 0x9a, 0x05, 0x1b, 0xd3, 0x2b, 0x83, 0x28, 0xac, 0x00, 0x10, + 0x17, 0x90, 0x9e, 0x82, 0x58, 0xb2, 0x8b, 0x33, 0xb0, 0x1e, 0x83, 0x8c, 0xa1, 0x31, 0x0d, 0xd1, + 0x28, 0x31, 0xc1, 0x39, 0xd1, 0x49, 0xb1, 0x39, 0xc0, 0x2a, 0x26, 0xad, 0x02, 0x80, 0x29, 0x82, + 0xca, 0x73, 0xc9, 0x21, 0x09, 0xa8, 0x13, 0x9f, 0x34, 0xca, 0x08, 0x28, 0xb1, 0x70, 0xc8, 0x3a, + 0x90, 0x02, 0x80, 0x9c, 0x34, 0x80, 0xa9, 0x80, 0x0c, 0x15, 0x99, 0x0b, 0xb8, 0x70, 0x95, 0x19, + 0xc9, 0x50, 0x90, 0xa0, 0x1b, 0x13, 0x09, 0x94, 0x9e, 0x11, 0x91, 0x70, 0xd1, 0x1a, 0x00, 0x93, + 0x1c, 0x81, 0x98, 0x52, 0xa9, 0x98, 0xad, 0x26, 0xa8, 0x01, 0x8b, 0x83, 0x28, 0x04, 0x9f, 0x12, + 0x90, 0x38, 0xc8, 0x19, 0x20, 0x21, 0xf1, 0x0f, 0x82, 0x10, 0x90, 0xa1, 0x0b, 0x22, 0x41, 0xfa, + 0x8a, 0x42, 0x92, 0x8e, 0x02, 0x89, 0x22, 0x89, 0xa2, 0x9a, 0x5b, 0x15, 0xda, 0x88, 0x42, 0x99, + 0x93, 0x09, 0xda, 0x43, 0x80, 0xc9, 0x08, 0x89, 0x33, 0xa4, 0x9c, 0x50, 0xb0, 0x85, 0x0e, 0xa1, + 0x28, 0x03, 0x9d, 0x23, 0xea, 0x30, 0x82, 0x01, 0xaf, 0x42, 0x98, 0xa8, 0x18, 0x58, 0xd3, 0x2b, + 0xc3, 0x49, 0xa0, 0x12, 0x9c, 0x91, 0x19, 0x73, 0xb8, 0x2a, 0xa1, 0x32, 0xea, 0x29, 0x81, 0x09, + 0x14, 0xbb, 0x8e, 0x35, 0x99, 0x88, 0x20, 0x01, 0xcc, 0x32, 0x3a, 0xf0, 0x4c, 0x81, 0xa0, 0x29, + 0x81, 0xa9, 0x10, 0x16, 0xba, 0x20, 0x38, 0xe1, 0x9a, 0x31, 0x13, 0xcc, 0x9d, 0x17, 0xb9, 0x30, + 0x91, 0x81, 0xad, 0x31, 0x83, 0xb9, 0x1a, 0x37, 0xac, 0x12, 0x8b, 0x96, 0x3b, 0xa6, 0x9b, 0x21, + 0x90, 0x21, 0xab, 0x24, 0xa9, 0x80, 0x8b, 0x13, 0xcb, 0x38, 0x87, 0x29, 0xdd, 0x52, 0x88, 0xb8, + 0x31, 0xb8, 0x8c, 0x02, 0x58, 0xa3, 0x5a, 0xa4, 0xbd, 0x32, 0x11, 0xd9, 0x28, 0xa1, 0x40, 0xfa, + 0x50, 0xa0, 0x19, 0x80, 0x11, 0xdb, 0x38, 0x90, 0x03, 0x9c, 0x13, 0x9a, 0x35, 0xca, 0x80, 0x8a, + 0x43, 0xa3, 0xcd, 0x4a, 0x85, 0x89, 0xb0, 0x48, 0x98, 0x31, 0xd1, 0x18, 0xb0, 0x61, 0xc2, 0x0b, + 0x01, 0x18, 0xa4, 0x3b, 0xd1, 0x1a, 0x04, 0xb0, 0x09, 0x0a, 0x06, 0x90, 0x9c, 0x62, 0xe0, 0x29, + 0x11, 0x09, 0xd1, 0x48, 0xa8, 0x0a, 0x84, 0x38, 0xb1, 0x88, 0x78, 0xc1, 0x8a, 0x53, 0xb8, 0x09, + 0x81, 0xbb, 0x41, 0x32, 0xa1, 0xfd, 0x38, 0x11, 0xb9, 0x09, 0x14, 0x19, 0xb1, 0x28, 0xcd, 0x53, + 0x81, 0x91, 0xbd, 0x10, 0x18, 0x11, 0x30, 0xf8, 0x48, 0x21, 0xa0, 0x9f, 0x18, 0x12, 0xda, 0x41, + 0xb8, 0x11, 0x99, 0x40, 0xd2, 0x1a, 0x12, 0x03, 0xee, 0x49, 0x03, 0x9a, 0xa1, 0x3a, 0xc1, 0x1a, + 0x34, 0xa0, 0xce, 0x41, 0x82, 0xab, 0x31, 0x12, 0xa0, 0x8f, 0x12, 0xea, 0x30, 0x23, 0xc8, 0xad, + 0x22, 0x80, 0xd2, 0x49, 0x02, 0xc9, 0x21, 0xa9, 0x00, 0x10, 0x90, 0x93, 0xcf, 0x04, 0x18, 0xa1, + 0x1a, 0x12, 0xaa, 0x1a, 0xb2, 0xa0, 0x7c, 0x17, 0xbc, 0x21, 0x18, 0x92, 0x2b, 0x89, 0x06, 0xad, + 0x38, 0x10, 0xa9, 0x63, 0xb0, 0x8b, 0x81, 0x48, 0xc4, 0x2c, 0x82, 0x08, 0xda, 0x61, 0x90, 0x0b, + 0x03, 0x28, 0xf8, 0x29, 0x92, 0x39, 0xb2, 0x1d, 0xa4, 0x0c, 0x23, 0x11, 0xbd, 0x11, 0x11, 0x8e, + 0x94, 0x9a, 0x11, 0x25, 0xda, 0x88, 0x49, 0xa2, 0x18, 0xa0, 0x09, 0x32, 0xd0, 0x0b, 0x81, 0x72, + 0x98, 0xa1, 0x2b, 0x91, 0x3b, 0xa5, 0xc9, 0x4a, 0x40, 0x95, 0x8b, 0x82, 0x1b, 0x12, 0x08, 0xfa, + 0x3b, 0x22, 0xf0, 0x0b, 0x22, 0x06, 0x8d, 0x02, 0xa8, 0x2a, 0x04, 0x80, 0x9a, 0x09, 0x83, 0x1a, + 0x04, 0x1d, 0x87, 0x8b, 0xb0, 0x8d, 0x33, 0x24, 0xf3, 0x2c, 0xb2, 0x39, 0x02, 0x80, 0xba, 0x2a, + 0x83, 0xaf, 0x30, 0xb1, 0x71, 0xb0, 0x99, 0x1b, 0x25, 0x00, 0xa2, 0x9f, 0x23, 0xa9, 0x13, 0xdd, + 0x41, 0x84, 0x0b, 0xd8, 0x18, 0x11, 0x92, 0x3a, 0xb1, 0x9e, 0x53, 0xa0, 0xa9, 0x39, 0x04, 0x00, + 0xdd, 0x18, 0x82, 0x48, 0xb2, 0x8b, 0x90, 0x71, 0x91, 0x88, 0xb9, 0x71, 0xc0, 0x10, 0xc9, 0x42, + 0x00, 0x99, 0xa9, 0x3b, 0x07, 0x1a, 0x80, 0xab, 0x31, 0x24, 0xf8, 0x0b, 0x23, 0x21, 0xc1, 0x9f, + 0x12, 0x98, 0x20, 0x90, 0x09, 0x09, 0x04, 0x00, 0xac, 0x3a, 0x27, 0xaa, 0xa0, 0x0d, 0x21, 0x24, + 0xac, 0x11, 0x10, 0x99, 0x80, 0x9b, 0x11, 0x09, 0x67, 0xfa, 0x18, 0x01, 0x23, 0xca, 0x0a, 0x81, + 0xa9, 0x61, 0xb0, 0x49, 0xd8, 0x61, 0xa8, 0x08, 0x09, 0x11, 0x94, 0x0f, 0x82, 0x18, 0x99, 0x42, + 0xb0, 0x9d, 0x40, 0x83, 0xac, 0x00, 0x23, 0xc8, 0x09, 0xa9, 0x34, 0x9a, 0x42, 0xd0, 0x9a, 0x61, + 0x94, 0x9c, 0x02, 0x0a, 0x92, 0x19, 0x92, 0xaf, 0x64, 0x98, 0x80, 0x8b, 0x24, 0x8a, 0xa2, 0x8e, + 0x02, 0x18, 0x83, 0x9a, 0xaa, 0x30, 0x13, 0xdd, 0x50, 0x82, 0xba, 0x11, 0x88, 0x29, 0x27, 0xb0, + 0x89, 0xbd, 0x68, 0x01, 0xa8, 0x29, 0x89, 0x84, 0x8c, 0x24, 0xb0, 0x2a, 0x81, 0x80, 0xcc, 0x5a, + 0x84, 0x19, 0xb0, 0x58, 0xf8, 0x3a, 0x94, 0x29, 0xd2, 0x39, 0xb3, 0x8f, 0x23, 0xa8, 0x09, 0x30, + 0xc2, 0x0f, 0x02, 0x2b, 0xa3, 0x1b, 0x94, 0x9a, 0x32, 0x81, 0xa8, 0x38, 0x84, 0xaf, 0x88, 0x12, + 0x71, 0xc9, 0x20, 0x99, 0x19, 0x80, 0x13, 0xa8, 0x9b, 0x52, 0xa0, 0xb0, 0x8f, 0x37, 0x8c, 0x82, + 0x99, 0x81, 0x1d, 0x15, 0xa9, 0x28, 0x90, 0x88, 0xc8, 0x6a, 0xa4, 0x0c, 0x03, 0x98, 0x09, 0x18, + 0x96, 0xab, 0x3b, 0x07, 0x88, 0x8a, 0x85, 0x8b, 0x23, 0x80, 0xf8, 0x2c, 0x04, 0x1a, 0xc1, 0x6a, + 0xa2, 0x0a, 0x02, 0x8a, 0xca, 0x60, 0x82, 0x9a, 0x8a, 0x32, 0x83, 0x8e, 0x03, 0x8c, 0x81, 0x88, + 0x21, 0xca, 0x72, 0x82, 0xc9, 0x9c, 0x42, 0x91, 0x88, 0x08, 0x09, 0x8b, 0x47, 0xa9, 0x09, 0x88, + 0x44, 0xb8, 0xad, 0x30, 0x13, 0x90, 0xb0, 0x9d, 0x98, 0x73, 0x91, 0x8b, 0x31, 0x15, 0xca, 0x3a, + 0xe0, 0x40, 0x80, 0x09, 0xf9, 0x49, 0x02, 0x99, 0x99, 0x42, 0xa1, 0x8c, 0x12, 0x0b, 0xa1, 0x73, + 0xb5, 0x9d, 0x22, 0x08, 0x89, 0x09, 0xa3, 0x0a, 0x28, 0xa1, 0x02, 0x09, 0x65, 0xa0, 0xbc, 0x0c, + 0x27, 0xa0, 0x09, 0x80, 0x9b, 0x39, 0x84, 0x11, 0xa8, 0x61, 0xa1, 0xcd, 0x48, 0x02, 0x20, 0xdb, + 0x00, 0x09, 0x88, 0x35, 0xe9, 0x0a, 0x23, 0x9a, 0xa8, 0x30, 0x09, 0x07, 0x00, 0xaa, 0x09, 0x11, + 0x72, 0xd8, 0x09, 0x20, 0xc0, 0x0b, 0x15, 0x28, 0xc8, 0x32, 0xec, 0x39, 0x03, 0x09, 0xa8, 0x10, + 0x99, 0x09, 0x14, 0x9b, 0x43, 0xab, 0xa5, 0x1e, 0x82, 0x29, 0x17, 0xdb, 0x08, 0x09, 0x26, 0xb9, + 0x21, 0xbb, 0x30, 0xb9, 0x53, 0xca, 0x38, 0x02, 0x94, 0xaf, 0x04, 0x01, 0x9a, 0x01, 0x8b, 0x51, + 0x92, 0xa9, 0x8c, 0x25, 0x10, 0xf1, 0x1b, 0x00, 0x80, 0xa2, 0x2b, 0xf1, 0x48, 0x23, 0xbc, 0x18, + 0x98, 0x23, 0x18, 0xba, 0xb9, 0x72, 0x86, 0x9b, 0x08, 0x40, 0x94, 0x8c, 0x88, 0x49, 0xa4, 0x09, + 0xa9, 0x08, 0x26, 0xbb, 0x22, 0xca, 0x31, 0xa8, 0x22, 0xdf, 0x32, 0x98, 0x31, 0xad, 0x01, 0x31, + 0x85, 0x0b, 0xf9, 0x58, 0xa1, 0x1b, 0x02, 0x9b, 0x24, 0xa9, 0xb8, 0x3a, 0x17, 0x89, 0x0a, 0x09, + 0x07, 0x0b, 0x10, 0xa1, 0x28, 0xb0, 0x48, 0xf2, 0x0f, 0x23, 0xaa, 0x88, 0x20, 0x81, 0x90, 0x30, + 0x9b, 0xa7, 0x3c, 0xa1, 0x80, 0x0b, 0x12, 0x86, 0x8f, 0x14, 0x99, 0x28, 0x82, 0xc9, 0x1a, 0x32, + 0xaa, 0x88, 0x07, 0x1d, 0xa3, 0x3b, 0xf0, 0x1b, 0x17, 0x9a, 0x81, 0x0b, 0x82, 0x58, 0xa1, 0x88, + 0x08, 0x09, 0x07, 0xac, 0x12, 0x19, 0x85, 0xaa, 0x81, 0x8b, 0x27, 0xa0, 0x8c, 0x93, 0x2b, 0x02, + 0x02, 0xdc, 0x30, 0xa0, 0x19, 0xb9, 0x74, 0xb8, 0x31, 0xf8, 0x2b, 0x14, 0x98, 0x88, 0x09, 0x10, + 0x92, 0x11, 0x0b, 0xf8, 0x58, 0xa2, 0xaa, 0x69, 0xa1, 0x88, 0x18, 0x48, 0xc2, 0x8c, 0x44, 0xd9, + 0x09, 0x31, 0xc1, 0x18, 0x80, 0x11, 0xab, 0x22, 0x21, 0xfb, 0x2a, 0x88, 0xb3, 0x8f, 0x17, 0x89, + 0xb8, 0x60, 0xa1, 0x0b, 0x14, 0x99, 0x99, 0x28, 0x84, 0x19, 0xa0, 0xaa, 0x45, 0xbd, 0x35, 0xcb, + 0x30, 0xa8, 0x41, 0xd8, 0x29, 0x84, 0x8a, 0xb1, 0x48, 0xc8, 0x10, 0x90, 0x42, 0xe9, 0x41, 0xa8, + 0xa8, 0x21, 0x14, 0x99, 0x9a, 0x38, 0xd8, 0x2a, 0x25, 0xc0, 0x9c, 0x33, 0xaa, 0x80, 0x3c, 0x17, + 0x9a, 0x0c, 0x02, 0x80, 0x38, 0x91, 0xc2, 0x8e, 0x41, 0xb0, 0x90, 0x71, 0xb0, 0x0b, 0x11, 0x80, + 0x53, 0xda, 0x40, 0xc8, 0x58, 0xb8, 0x21, 0xac, 0x31, 0x91, 0x8a, 0x00, 0x31, 0xa8, 0x32, 0xbe, + 0x55, 0xda, 0x48, 0xc0, 0x39, 0x01, 0x10, 0xcd, 0x41, 0x88, 0x91, 0x1b, 0x04, 0xcb, 0x51, 0x90, + 0x99, 0x20, 0x11, 0xa2, 0xae, 0x20, 0x01, 0xa8, 0x11, 0x0a, 0x21, 0x90, 0x25, 0xce, 0x29, 0x16, + 0xa9, 0xa9, 0x10, 0x18, 0x12, 0xbc, 0x38, 0x84, 0x5a, 0xd3, 0x0c, 0x00, 0x23, 0x88, 0x91, 0x8d, + 0x91, 0x60, 0x84, 0xae, 0x22, 0x89, 0x82, 0x9c, 0x23, 0xcb, 0x44, 0xda, 0x30, 0xdb, 0x63, 0x98, + 0x80, 0xbb, 0x25, 0x8a, 0x80, 0x28, 0x83, 0xac, 0x60, 0xc0, 0x28, 0x12, 0xa1, 0xbc, 0x08, 0x23, + 0xa3, 0x1e, 0xa3, 0xab, 0x51, 0x81, 0x90, 0xd9, 0x6a, 0xa4, 0x9c, 0x42, 0xa9, 0x20, 0x82, 0xc9, + 0x29, 0x82, 0x08, 0x98, 0x8b, 0x74, 0xd3, 0x0a, 0x82, 0x2b, 0x94, 0x4a, 0xc3, 0x8f, 0x22, 0x99, + 0x81, 0x19, 0x80, 0x02, 0xb8, 0x1b, 0x14, 0x1c, 0x07, 0xdb, 0x08, 0x28, 0x16, 0xb9, 0x08, 0x88, + 0x00, 0x08, 0x22, 0xbb, 0x24, 0x11, 0xf8, 0x9f, 0x34, 0xa8, 0x39, 0xb9, 0x11, 0x30, 0xaa, 0x04, + 0x9e, 0x51, 0x81, 0xc9, 0x1c, 0x04, 0x00, 0x99, 0x08, 0xa8, 0x1b, 0x16, 0xab, 0x04, 0x9a, 0x30, + 0x85, 0xae, 0x34, 0xb0, 0x89, 0x20, 0xc9, 0x38, 0x13, 0xa0, 0x09, 0x9a, 0x97, 0x3b, 0xf0, 0x4a, + 0x96, 0x8a, 0x80, 0x20, 0x91, 0x2a, 0xf1, 0x3a, 0x90, 0x18, 0x84, 0x9d, 0x11, 0x02, 0x18, 0xc8, + 0x21, 0xcc, 0x72, 0x90, 0xb8, 0x48, 0xb1, 0x28, 0x89, 0x82, 0x5b, 0xb2, 0x2b, 0xeb, 0x71, 0xa2, + 0x0b, 0x98, 0x41, 0x80, 0x1a, 0xe1, 0x38, 0x98, 0x13, 0xaa, 0x8a, 0x22, 0x2b, 0xe7, 0x3c, 0x94, + 0x10, 0x98, 0xc9, 0x30, 0x89, 0x50, 0xb1, 0x80, 0x9c, 0x52, 0xa0, 0x08, 0x00, 0x10, 0xc9, 0x49, + 0xd0, 0x40, 0x92, 0xbb, 0x09, 0x02, 0x72, 0xb2, 0xea, 0x40, 0xa8, 0x20, 0xe8, 0x30, 0x08, 0x82, + 0xa8, 0xac, 0x73, 0xb8, 0x51, 0xa1, 0x9b, 0x39, 0x03, 0xe8, 0x59, 0x80, 0x82, 0xdb, 0x29, 0x02, + 0x1a, 0x87, 0x8d, 0x92, 0x4b, 0x96, 0x1a, 0x89, 0x20, 0xc0, 0x18, 0x01, 0xab, 0x34, 0x10, 0xf9, + 0x0a, 0x24, 0x88, 0x91, 0xac, 0x42, 0xc8, 0x12, 0x88, 0xba, 0x62, 0xa0, 0x8a, 0x2a, 0x94, 0x33, + 0xbf, 0x14, 0xa9, 0x31, 0x89, 0x88, 0x10, 0x99, 0x84, 0xaa, 0x0f, 0x86, 0x38, 0xd0, 0x0a, 0xb1, + 0x71, 0xa0, 0x30, 0xcb, 0x33, 0xd9, 0x28, 0x81, 0x8a, 0x90, 0x48, 0xb3, 0x1a, 0x89, 0x06, 0x29, + 0xbb, 0x05, 0x8b, 0xc2, 0x71, 0xe3, 0x1b, 0x22, 0x90, 0x9c, 0x22, 0x90, 0x9b, 0x93, 0x2e, 0x95, + 0x39, 0x93, 0xbb, 0x01, 0x39, 0x01, 0xf8, 0x79, 0xa9, 0x02, 0x2a, 0xb8, 0x31, 0x81, 0x88, 0xda, + 0x89, 0x45, 0x0a, 0xb4, 0x1c, 0xa1, 0x78, 0xc0, 0x29, 0x80, 0x30, 0xb1, 0xad, 0x63, 0x80, 0x88, + 0xac, 0x24, 0x98, 0x39, 0xe0, 0x89, 0x32, 0x88, 0x48, 0xf9, 0x49, 0xa1, 0x19, 0x88, 0x33, 0xea, + 0x29, 0x02, 0x0a, 0xb0, 0x7a, 0xb2, 0x1f, 0x82, 0x28, 0xb0, 0x3a, 0x87, 0x8c, 0x00, 0x02, 0xa0, + 0x1d, 0x84, 0xaa, 0x31, 0x89, 0x90, 0x2a, 0x03, 0x4a, 0xf2, 0x1f, 0x84, 0x1a, 0x91, 0x38, 0xc8, + 0x00, 0x19, 0x90, 0xd0, 0x6a, 0x82, 0x89, 0x9a, 0x24, 0x1a, 0xa1, 0x40, 0xd8, 0x8c, 0x34, 0xb9, + 0x28, 0xcb, 0x36, 0xba, 0x22, 0xb0, 0xab, 0x73, 0xb1, 0xa9, 0x51, 0x98, 0x01, 0xb8, 0x4a, 0x93, + 0x0e, 0x94, 0x9b, 0x08, 0x73, 0xa2, 0xab, 0x19, 0x36, 0xea, 0x20, 0xb2, 0x0c, 0x14, 0x99, 0x90, + 0x2b, 0x15, 0x90, 0x9c, 0x19, 0x05, 0x19, 0xa0, 0x28, 0xba, 0x2c, 0x87, 0x89, 0x99, 0x13, 0x11, + 0xd9, 0x2a, 0x12, 0xa3, 0x1b, 0xa6, 0x2d, 0xb2, 0x38, 0xd1, 0x1c, 0x27, 0xb8, 0x0b, 0xb0, 0x20, + 0x42, 0x91, 0xa1, 0xbf, 0x23, 0x39, 0x93, 0xa8, 0xcd, 0x21, 0x48, 0xe8, 0x48, 0x89, 0x15, 0xd8, + 0x1b, 0x13, 0x18, 0xa2, 0x8c, 0xa1, 0x1b, 0x27, 0x99, 0xaa, 0x34, 0xb8, 0x9c, 0x13, 0x2a, 0x95, + 0x5b, 0xd1, 0x89, 0x20, 0x05, 0x99, 0x8c, 0x03, 0x28, 0x90, 0xaf, 0x03, 0x29, 0x05, 0xbb, 0x10, + 0x98, 0x45, 0xb8, 0x99, 0x0b, 0x27, 0xb9, 0x38, 0xa1, 0x09, 0x01, 0x88, 0xba, 0x32, 0x54, 0xe2, + 0x0f, 0x02, 0x39, 0xc0, 0x10, 0xab, 0x42, 0x88, 0x22, 0xf9, 0x3b, 0xa4, 0x2a, 0x90, 0x98, 0x31, + 0x03, 0x98, 0x0d, 0xc0, 0x72, 0xd2, 0x2a, 0xc1, 0x40, 0x98, 0x81, 0x1d, 0xa2, 0x58, 0xb1, 0x8b, + 0x12, 0x91, 0x0c, 0x02, 0x9c, 0x27, 0x0b, 0x82, 0xcb, 0x41, 0x09, 0xa2, 0x0b, 0x98, 0x54, 0x90, + 0x9c, 0x12, 0x88, 0x21, 0x8e, 0x85, 0xab, 0x31, 0x02, 0xe0, 0x1c, 0x13, 0x10, 0xf8, 0x28, 0x80, + 0xb8, 0x62, 0xc9, 0x08, 0x53, 0x99, 0xc1, 0x2b, 0x22, 0x01, 0xdb, 0x08, 0x49, 0xd2, 0x48, 0xb8, + 0x18, 0x01, 0x24, 0xba, 0x88, 0x8b, 0x61, 0x93, 0xc9, 0x0f, 0x33, 0xa0, 0x9b, 0x11, 0x48, 0xc3, + 0x19, 0xe9, 0x39, 0x93, 0x20, 0xc9, 0x0a, 0x45, 0xbb, 0x01, 0x1e, 0x06, 0x8b, 0x81, 0x1b, 0x83, + 0x4a, 0x93, 0x8b, 0x09, 0x61, 0xb3, 0x8b, 0x8c, 0x06, 0xaa, 0x18, 0x28, 0x82, 0x89, 0x24, 0xff, + 0x31, 0x81, 0x8a, 0xaa, 0x72, 0xb0, 0x10, 0x88, 0x88, 0x41, 0xc2, 0x8a, 0x99, 0x2a, 0x27, 0x9c, + 0x12, 0x29, 0xd3, 0x2a, 0xa1, 0x98, 0x38, 0x93, 0x99, 0xaf, 0x17, 0x9c, 0x23, 0x09, 0x89, 0xa2, + 0x2c, 0x07, 0x8d, 0x83, 0x09, 0x8a, 0x22, 0x90, 0x9c, 0x23, 0x18, 0xaa, 0x9f, 0x16, 0x99, 0x28, + 0xc2, 0x39, 0xa0, 0x41, 0xa8, 0xa0, 0x79, 0xa4, 0x8b, 0xc9, 0x20, 0x43, 0xb8, 0x49, 0xe0, 0x38, + 0xa8, 0x21, 0xda, 0x41, 0x88, 0xa0, 0x9a, 0x61, 0x82, 0x09, 0xa8, 0xaa, 0x38, 0x06, 0x1b, 0xc2, + 0x51, 0xb9, 0x1a, 0x03, 0x00, 0x71, 0xd9, 0x91, 0x8d, 0x43, 0x98, 0xa8, 0x5a, 0x12, 0xbc, 0x11, + 0x19, 0x96, 0x1c, 0x82, 0x99, 0x9a, 0x27, 0x89, 0x98, 0x01, 0x08, 0x01, 0x8e, 0x05, 0x89, 0x89, + 0xa0, 0x0a, 0x01, 0x54, 0xb1, 0x8b, 0x29, 0x23, 0xc9, 0x0a, 0x01, 0x73, 0xf9, 0x39, 0xa2, 0x21, + 0xaf, 0x06, 0x9a, 0x12, 0xa0, 0x09, 0xa8, 0x64, 0xba, 0x43, 0xba, 0x21, 0x9c, 0x02, 0x21, 0x9c, + 0x02, 0x08, 0xea, 0x18, 0x16, 0x8a, 0x82, 0xe8, 0x30, 0xb0, 0x22, 0xda, 0x48, 0xa0, 0xa8, 0x21, + 0x99, 0x25, 0xa9, 0x29, 0xda, 0x88, 0x61, 0x12, 0xdb, 0x32, 0x9a, 0x23, 0xdb, 0x42, 0xc9, 0x2a, + 0x95, 0x8e, 0x10, 0x33, 0xb9, 0x53, 0xbe, 0x32, 0x9b, 0x21, 0x90, 0x39, 0xfc, 0x41, 0xb0, 0x08, + 0x20, 0x05, 0xbd, 0x31, 0x98, 0x21, 0x90, 0x00, 0xc9, 0x0c, 0x34, 0xd3, 0x0c, 0x11, 0x80, 0x99, + 0x31, 0xa0, 0x9e, 0x15, 0x98, 0xab, 0x42, 0x01, 0xa3, 0x8d, 0x91, 0x39, 0xe1, 0x20, 0xb9, 0x08, + 0x37, 0xb0, 0x0b, 0x90, 0x32, 0x83, 0xaf, 0xa1, 0x8a, 0x72, 0x83, 0x9f, 0x20, 0x05, 0x9b, 0x08, + 0x89, 0x33, 0xb8, 0x89, 0x00, 0x80, 0x72, 0x04, 0xbf, 0x20, 0x01, 0x09, 0xbb, 0x24, 0x99, 0x11, + 0x8c, 0x07, 0x0e, 0x13, 0x98, 0xb9, 0x49, 0x14, 0xc8, 0x1b, 0x04, 0x98, 0x38, 0xa0, 0x89, 0x8b, + 0x07, 0x1a, 0xd8, 0x28, 0x10, 0xb1, 0x49, 0xb1, 0x0b, 0x04, 0x10, 0xbd, 0x21, 0x42, 0xc8, 0x38, + 0xf9, 0x39, 0x22, 0x08, 0xf1, 0x49, 0x8a, 0x23, 0x9d, 0x83, 0x2b, 0xa1, 0x24, 0xca, 0x0c, 0x94, + 0x48, 0xda, 0x01, 0x40, 0xb8, 0x22, 0xea, 0x30, 0x1b, 0x07, 0x8b, 0x91, 0x0a, 0x43, 0xb9, 0xd9, + 0x3a, 0x26, 0xb9, 0x30, 0xb8, 0x12, 0x10, 0xc9, 0x9d, 0x43, 0x90, 0x04, 0xaf, 0x13, 0x88, 0x01, + 0xa9, 0x88, 0x0b, 0x65, 0xc8, 0x2a, 0x90, 0x34, 0xc8, 0x08, 0xaa, 0x42, 0x92, 0xbc, 0x18, 0x43, + 0x8b, 0x84, 0x8d, 0x04, 0x18, 0x90, 0xa9, 0x89, 0x78, 0x94, 0x1b, 0xc8, 0x4a, 0x85, 0x8a, 0x90, + 0x29, 0xa2, 0x30, 0xc9, 0x2d, 0x04, 0xa8, 0x2a, 0xd8, 0x72, 0x90, 0xa0, 0x9a, 0x63, 0xab, 0x04, + 0x29, 0xa0, 0xab, 0x44, 0x90, 0x8b, 0x12, 0x30, 0xf9, 0x2f, 0x93, 0x08, 0xa9, 0x42, 0xd8, 0x28, + 0x00, 0x00, 0xa9, 0x11, 0xba, 0x0a, 0x71, 0x13, 0xbd, 0x24, 0x8c, 0x01, 0x98, 0x58, 0x91, 0x88, + 0x9c, 0x83, 0x0d, 0x04, 0x38, 0xc8, 0x00, 0x99, 0x01, 0x39, 0xf8, 0x40, 0x20, 0xf9, 0x18, 0x12, + 0x99, 0x11, 0xdc, 0x58, 0xa0, 0x19, 0x12, 0xb0, 0x3a, 0xa4, 0x0c, 0x25, 0xda, 0x21, 0xc8, 0x1a, + 0x83, 0x28, 0x98, 0x02, 0xac, 0x42, 0x2a, 0xb6, 0x8b, 0x73, 0xc8, 0x19, 0x81, 0x32, 0xac, 0x98, + 0x11, 0x30, 0xea, 0x42, 0xdb, 0x30, 0x02, 0xad, 0x28, 0x13, 0x18, 0xe3, 0x4b, 0xd1, 0x21, 0x0a, + 0x91, 0xac, 0x32, 0x85, 0x0e, 0xa2, 0x41, 0x89, 0xa1, 0xaa, 0x11, 0x18, 0x94, 0x89, 0x8c, 0x31, + 0xa4, 0x9e, 0x72, 0xa1, 0x8a, 0x19, 0xa8, 0x81, 0x73, 0x88, 0xc1, 0x10, 0x19, 0x81, 0xfc, 0x38, + 0x03, 0x9c, 0x28, 0x14, 0x9b, 0x80, 0x40, 0x98, 0xaa, 0x06, 0x1a, 0x9d, 0x04, 0x40, 0xe8, 0x0a, + 0x05, 0x99, 0x29, 0x92, 0x98, 0x2b, 0x02, 0xa0, 0x99, 0x56, 0x98, 0xaa, 0x08, 0x33, 0xa8, 0x29, + 0xca, 0x31, 0xd4, 0x5c, 0x90, 0x98, 0x24, 0x8c, 0x00, 0x98, 0x85, 0x3b, 0xc0, 0x98, 0x8a, 0x36, + 0xb9, 0xa8, 0x61, 0x8a, 0x83, 0xbc, 0x38, 0x85, 0x1b, 0x33, 0xe0, 0x82, 0x4b, 0x92, 0x9d, 0x16, + 0x8a, 0x88, 0xbb, 0x27, 0xa9, 0x10, 0xa0, 0x22, 0xac, 0x21, 0xa4, 0x0e, 0xa0, 0x62, 0xca, 0x31, + 0x01, 0xca, 0x08, 0x15, 0xab, 0x32, 0xd9, 0x31, 0xb8, 0x00, 0x10, 0x09, 0x23, 0xa2, 0xd9, 0x0d, + 0x84, 0x0e, 0xa0, 0x40, 0xa0, 0x43, 0xba, 0x92, 0x0b, 0x20, 0x01, 0xf4, 0x4a, 0x90, 0x98, 0x22, + 0x0f, 0x85, 0x1a, 0xa2, 0x9d, 0x22, 0x10, 0xa1, 0x0d, 0x83, 0x1b, 0x86, 0x28, 0xd8, 0x98, 0x5c, + 0xb4, 0x1a, 0x10, 0x10, 0xd3, 0x0c, 0x08, 0x02, 0xa0, 0x58, 0xa0, 0x1d, 0x05, 0x88, 0xcb, 0x41, + 0x81, 0xa9, 0x88, 0x79, 0xb2, 0x3a, 0x93, 0x9b, 0xaa, 0x55, 0xb0, 0x2b, 0xa2, 0x44, 0xd9, 0x39, + 0xd0, 0x20, 0x91, 0x88, 0xb9, 0x29, 0x22, 0x05, 0xcb, 0x41, 0xb0, 0x19, 0x21, 0xc9, 0xd9, 0x51, + 0x01, 0x88, 0x09, 0x15, 0x9a, 0x9c, 0x82, 0x83, 0x0e, 0x24, 0xba, 0x08, 0x41, 0x83, 0x9e, 0xa0, + 0x0d, 0x16, 0x0c, 0x83, 0xac, 0x12, 0x48, 0xb3, 0x9d, 0x32, 0x98, 0x98, 0x4b, 0x95, 0x1d, 0x03, + 0x80, 0xba, 0x8a, 0x26, 0xb8, 0xa9, 0x61, 0x91, 0x0a, 0x13, 0xcb, 0x39, 0x02, 0xf3, 0x2b, 0x1a, + 0x33, 0xc6, 0x2d, 0xa2, 0x08, 0x0a, 0xa2, 0x58, 0xa1, 0x38, 0xb1, 0x0c, 0xa1, 0x73, 0xb0, 0x1a, + 0xc8, 0x68, 0x91, 0x00, 0x99, 0x0a, 0x86, 0x0a, 0x09, 0x02, 0xaa, 0x33, 0xae, 0x34, 0x99, 0x04, + 0x8b, 0xf9, 0x10, 0x81, 0xb8, 0x29, 0x42, 0xa2, 0x89, 0x24, 0xaf, 0x34, 0xbc, 0x42, 0xd9, 0x40, + 0x01, 0xbb, 0x08, 0x35, 0xcb, 0x12, 0x0a, 0xd3, 0x2a, 0x11, 0xc9, 0x31, 0x08, 0x00, 0xdc, 0x51, + 0x98, 0x88, 0xd9, 0x71, 0x98, 0x18, 0xa1, 0x18, 0x09, 0x32, 0xc1, 0x2a, 0x12, 0xea, 0x29, 0xa9, + 0x15, 0x18, 0xbc, 0x31, 0x81, 0xa0, 0x1d, 0xf1, 0x20, 0x80, 0x30, 0xf8, 0x20, 0x08, 0x2b, 0x96, + 0x8b, 0x21, 0x99, 0x03, 0x9e, 0x21, 0x13, 0x9b, 0xbd, 0x36, 0x88, 0x08, 0x19, 0xc1, 0xb8, 0x7c, + 0x93, 0xdb, 0x50, 0xa2, 0x9b, 0x81, 0x51, 0x99, 0xb1, 0x30, 0x8a, 0x9a, 0x15, 0x10, 0xea, 0x40, + 0x22, 0xe9, 0x09, 0x14, 0xba, 0x09, 0x90, 0x14, 0x39, 0xbb, 0x16, 0x18, 0x9a, 0x19, 0xf0, 0x1c, + 0x34, 0xc1, 0x1a, 0x08, 0x00, 0x98, 0x10, 0x9c, 0x15, 0x98, 0x0d, 0xa8, 0x17, 0x5a, 0xb8, 0x09, + 0x21, 0xa0, 0x29, 0xd9, 0x11, 0x4b, 0xa5, 0x2a, 0x89, 0x21, 0x42, 0xfb, 0x08, 0x22, 0xac, 0x24, + 0xab, 0x81, 0x29, 0x12, 0xcf, 0x11, 0x11, 0x81, 0xbc, 0x33, 0xb2, 0x2d, 0x90, 0x24, 0xab, 0x22, + 0x19, 0xc8, 0x72, 0xa1, 0xae, 0x23, 0xbb, 0x42, 0xa2, 0x1b, 0x85, 0xbb, 0x72, 0xb2, 0x8b, 0x04, + 0xac, 0x12, 0x8a, 0x11, 0x16, 0x9c, 0x89, 0x06, 0x09, 0xa1, 0x09, 0x88, 0x01, 0x89, 0x84, 0x71, + 0xf1, 0x18, 0x98, 0x90, 0x2a, 0x15, 0xa9, 0x48, 0xfa, 0x32, 0xa9, 0x18, 0x13, 0xa8, 0x9b, 0x20, + 0xaa, 0x11, 0x52, 0x97, 0x9f, 0x22, 0x89, 0xa1, 0x6a, 0x92, 0x9c, 0x80, 0x32, 0x98, 0xaa, 0x45, + 0xaa, 0x0a, 0x93, 0x71, 0xd9, 0x13, 0x99, 0x99, 0x88, 0x17, 0x09, 0x91, 0xab, 0x49, 0x83, 0x99, + 0x81, 0x1c, 0x93, 0x10, 0xf9, 0x3e, 0x03, 0x89, 0xb0, 0x1d, 0x04, 0x10, 0x99, 0x8b, 0x91, 0x73, + 0xc3, 0x39, 0xd9, 0x20, 0x04, 0xba, 0x9c, 0x42, 0x88, 0x82, 0x9f, 0x22, 0x18, 0x96, 0x9c, 0x20, + 0x80, 0x10, 0xb9, 0x80, 0xaa, 0x74, 0xd2, 0x08, 0x89, 0x42, 0xb0, 0x8a, 0x98, 0x43, 0x0a, 0x07, + 0xca, 0x39, 0x05, 0x99, 0xba, 0x21, 0x91, 0x60, 0xf8, 0x38, 0x88, 0x03, 0xab, 0x01, 0x0b, 0x84, + 0x34, 0x9d, 0xb0, 0x39, 0x92, 0xb9, 0x41, 0x1c, 0xa4, 0x38, 0xe9, 0x30, 0x89, 0x86, 0x1b, 0x98, + 0x18, 0x07, 0x8a, 0x91, 0x9a, 0x21, 0x15, 0xab, 0xa8, 0x41, 0xa8, 0x09, 0x95, 0x1b, 0x08, 0x17, + 0x8c, 0xd0, 0x49, 0x80, 0x80, 0x0b, 0x86, 0xaa, 0x70, 0xb3, 0xba, 0x48, 0x85, 0x98, 0xb9, 0x61, + 0xb0, 0x40, 0x98, 0x90, 0x89, 0x32, 0xa9, 0xd9, 0x2a, 0x27, 0xcb, 0x08, 0x12, 0x09, 0x31, 0xa8, + 0xbd, 0x42, 0x28, 0x13, 0xef, 0x28, 0x32, 0xb8, 0x1a, 0x00, 0x98, 0x30, 0xd9, 0x89, 0x12, 0x50, + 0xb1, 0xbd, 0x53, 0x02, 0x9a, 0xb2, 0x0f, 0x82, 0x10, 0xb2, 0x1d, 0x80, 0x63, 0xa8, 0xca, 0x40, + 0x90, 0x08, 0x12, 0xba, 0x0b, 0x74, 0xd3, 0x0c, 0x21, 0x80, 0xa9, 0x10, 0x09, 0x04, 0x8b, 0x37, + 0xcd, 0x18, 0x22, 0x92, 0x8d, 0x13, 0x9c, 0x81, 0x09, 0x24, 0xbc, 0x43, 0xad, 0x03, 0x09, 0x31, + 0x31, 0xfa, 0x1b, 0x01, 0x9a, 0x23, 0xa8, 0x10, 0xba, 0x46, 0xa9, 0x18, 0x02, 0x01, 0x8d, 0xa1, + 0x0c, 0x43, 0x88, 0x84, 0xbb, 0x0f, 0x03, 0x0a, 0x13, 0x9f, 0x05, 0x8a, 0x39, 0xd8, 0x41, 0x01, + 0x9b, 0xa9, 0x51, 0xa8, 0x02, 0x40, 0xad, 0x03, 0xad, 0x73, 0xb9, 0x13, 0x89, 0x80, 0x9a, 0x63, + 0xd9, 0x50, 0xa8, 0x80, 0x2a, 0x03, 0x9b, 0x00, 0x11, 0x98, 0xa9, 0x20, 0x11, 0xc5, 0x0e, 0x21, + 0x13, 0xb8, 0xac, 0x88, 0xe8, 0x73, 0x98, 0x88, 0x80, 0x80, 0x40, 0xfa, 0x43, 0x88, 0xa9, 0x4b, + 0xc4, 0x39, 0x88, 0x21, 0xbc, 0x38, 0x04, 0x90, 0x9e, 0x23, 0xc1, 0x29, 0xad, 0x13, 0x00, 0x31, + 0xd1, 0x9c, 0x03, 0x48, 0xc1, 0x28, 0x80, 0x89, 0x0a, 0xca, 0x41, 0x45, 0xb0, 0x9a, 0xab, 0x37, + 0x9b, 0x12, 0x8c, 0x94, 0x1b, 0x94, 0xab, 0x32, 0x16, 0x8c, 0xea, 0x39, 0x03, 0x01, 0x9b, 0x02, + 0x2b, 0xa7, 0x2a, 0x12, 0xdc, 0x43, 0x98, 0xa9, 0x09, 0x42, 0xc1, 0x8b, 0x43, 0x88, 0xfa, 0x61, + 0xc8, 0x10, 0x91, 0x08, 0x88, 0xa8, 0x54, 0xc9, 0x20, 0x80, 0x99, 0x29, 0x92, 0x91, 0x1e, 0xb4, + 0x3b, 0x01, 0x44, 0xda, 0x38, 0x80, 0x89, 0xc1, 0x1e, 0x02, 0x10, 0x88, 0x93, 0x9f, 0x15, 0x08, + 0xba, 0x1b, 0x27, 0xb9, 0x00, 0x98, 0x38, 0x01, 0x02, 0xdd, 0x39, 0x81, 0xb2, 0x1c, 0x22, 0x81, + 0xc1, 0x3c, 0xa5, 0x6a, 0xc2, 0x29, 0xe8, 0x30, 0x80, 0x01, 0xac, 0x10, 0x12, 0x9a, 0x82, 0x1d, + 0x05, 0xaa, 0x90, 0x2b, 0x10, 0x36, 0xe0, 0x9b, 0x61, 0x92, 0xa9, 0x1a, 0x11, 0x81, 0x20, 0xdd, + 0x21, 0x30, 0x95, 0x8d, 0xa3, 0x2c, 0x92, 0x13, 0xbd, 0x09, 0x51, 0xa3, 0x0b, 0x9d, 0x33, 0x14, + 0x9e, 0x02, 0x9a, 0x00, 0x05, 0x9a, 0x9a, 0x63, 0xa2, 0x9b, 0x08, 0x24, 0xd8, 0x38, 0xa9, 0x02, + 0xaa, 0x64, 0xb8, 0x9b, 0x34, 0x01, 0xc8, 0x8a, 0x09, 0x26, 0xba, 0x38, 0xf9, 0x61, 0x88, 0x18, + 0xb8, 0x09, 0x58, 0xc3, 0x0c, 0x94, 0x39, 0xc1, 0x18, 0x9a, 0x05, 0x2b, 0xb4, 0x8c, 0x13, 0x18, + 0x90, 0xa9, 0x29, 0x17, 0x08, 0x8a, 0xe0, 0x4b, 0x95, 0x8a, 0x18, 0x08, 0x14, 0xbb, 0x84, 0x1f, + 0xa1, 0x51, 0xa0, 0x9a, 0x10, 0x32, 0xa9, 0x8b, 0x10, 0xa1, 0x1f, 0x17, 0xbb, 0x40, 0x81, 0xa0, + 0x9c, 0x22, 0x18, 0x15, 0xfb, 0x39, 0xa2, 0x61, 0xb9, 0x89, 0x90, 0x61, 0x80, 0xc8, 0x2a, 0x13, + 0x92, 0x0f, 0xa2, 0x39, 0xa1, 0x31, 0xc8, 0x9e, 0x32, 0x01, 0xbb, 0x52, 0xb0, 0x39, 0xd8, 0x18, + 0x91, 0x78, 0x96, 0xac, 0x21, 0x08, 0x03, 0x9a, 0xaa, 0x42, 0x9a, 0x91, 0x4a, 0xc2, 0x52, 0xb9, + 0x09, 0x1a, 0x33, 0x05, 0x0e, 0xb1, 0x9f, 0x42, 0x92, 0x09, 0xa0, 0x1c, 0x93, 0x30, 0x98, 0x8a, + 0x59, 0x94, 0xab, 0x80, 0x61, 0x90, 0xe0, 0x49, 0xa1, 0x99, 0x03, 0x19, 0xd0, 0x58, 0x10, 0xc0, + 0x9c, 0x50, 0x82, 0x81, 0xcc, 0x40, 0xa1, 0x1a, 0x06, 0xac, 0x11, 0x11, 0x91, 0x8d, 0x12, 0x01, + 0xc8, 0x39, 0xc9, 0x39, 0x04, 0x99, 0x18, 0x9d, 0x25, 0x91, 0x9e, 0x12, 0x90, 0x89, 0x33, 0xcd, + 0x33, 0x98, 0x91, 0xbd, 0x62, 0x91, 0x8b, 0x82, 0x19, 0xb1, 0x64, 0x98, 0xb9, 0x4a, 0x86, 0x89, + 0x89, 0x98, 0x22, 0x8e, 0x83, 0x39, 0xf3, 0x5a, 0xa1, 0x08, 0x89, 0x20, 0x92, 0x0a, 0xc9, 0x24, + 0xcb, 0x6a, 0x92, 0xa9, 0x20, 0x32, 0xf0, 0x2b, 0x94, 0x1a, 0xb3, 0x69, 0xd1, 0x09, 0x02, 0x08, + 0xa8, 0x19, 0x33, 0xda, 0x18, 0x29, 0xa5, 0x1d, 0x85, 0x0c, 0x81, 0x98, 0x32, 0xb2, 0x9f, 0x83, + 0x99, 0x63, 0xa9, 0x08, 0x9a, 0x26, 0xa0, 0x9b, 0x03, 0x2b, 0x07, 0x9d, 0x02, 0x18, 0xc1, 0x39, + 0x98, 0x23, 0x08, 0xcb, 0x8a, 0x01, 0x47, 0x9a, 0xb0, 0x40, 0x9d, 0x86, 0x09, 0x89, 0x81, 0x20, + 0xc0, 0x3b, 0x84, 0x68, 0xa0, 0x08, 0xaa, 0x8a, 0x64, 0xa0, 0xba, 0x78, 0xa3, 0x0d, 0x01, 0x29, + 0xb1, 0x21, 0x9c, 0x92, 0x30, 0x01, 0xc8, 0x1c, 0x81, 0x40, 0xf1, 0x1a, 0x23, 0xad, 0x43, 0xab, + 0x04, 0x0b, 0x86, 0x1a, 0xa1, 0x8e, 0x02, 0x40, 0xa0, 0xa9, 0x28, 0xa9, 0x33, 0x89, 0xa9, 0x37, + 0xbc, 0x73, 0xc8, 0x01, 0x19, 0x81, 0xb8, 0x8c, 0x24, 0x89, 0xa8, 0x25, 0x8f, 0x12, 0xb0, 0x09, + 0x8a, 0x45, 0x91, 0xac, 0x88, 0x44, 0xa8, 0x00, 0x91, 0x8f, 0x02, 0x18, 0xd2, 0x5a, 0x91, 0x28, + 0xd0, 0x29, 0x88, 0x20, 0x92, 0xcc, 0x00, 0x39, 0x86, 0x98, 0x0a, 0x03, 0xc8, 0x1b, 0x35, 0xab, + 0x24, 0xa9, 0x9a, 0x48, 0x89, 0x17, 0x9b, 0x02, 0x9f, 0x14, 0x88, 0x8b, 0x83, 0x20, 0xa1, 0xca, + 0x1b, 0x15, 0x1b, 0x85, 0xba, 0x00, 0x21, 0x13, 0xbf, 0x43, 0xc8, 0x81, 0x1c, 0x14, 0x89, 0x82, + 0x9c, 0xaa, 0x84, 0x79, 0xa6, 0x0a, 0x88, 0x10, 0x10, 0xc8, 0x30, 0xab, 0x86, 0x1a, 0xb0, 0x19, + 0x24, 0x28, 0xf1, 0x1d, 0x22, 0x89, 0xa1, 0x0c, 0x91, 0x52, 0x8a, 0xb3, 0x0f, 0x05, 0x99, 0x8a, + 0x15, 0xa9, 0x01, 0x19, 0xa8, 0x30, 0x53, 0xf0, 0x19, 0x00, 0x09, 0xa5, 0x0c, 0x91, 0x88, 0x32, + 0x48, 0xf0, 0x3b, 0x83, 0x0a, 0xd1, 0x29, 0x10, 0xa0, 0x8a, 0x62, 0x92, 0x9c, 0x00, 0x83, 0x9f, + 0x35, 0xb8, 0x2a, 0x82, 0xa0, 0x40, 0xda, 0x30, 0xa1, 0x9b, 0x20, 0x80, 0xfa, 0x78, 0xb3, 0xa9, + 0x0c, 0x34, 0xa8, 0x20, 0x9c, 0x91, 0x53, 0x9b, 0x85, 0x9e, 0x42, 0x90, 0x8a, 0x88, 0x31, 0x90, + 0x12, 0xb8, 0x8b, 0x88, 0x53, 0xfd, 0x30, 0x83, 0x02, 0xce, 0x28, 0x80, 0x21, 0x92, 0xac, 0x18, + 0x39, 0x86, 0x18, 0xec, 0x42, 0xb0, 0x1b, 0x92, 0x48, 0xb0, 0x48, 0xb1, 0x0e, 0x12, 0x81, 0x00, + 0xc9, 0x3b, 0x06, 0xaa, 0x19, 0x16, 0xbb, 0x44, 0xd8, 0x2a, 0x82, 0x08, 0x88, 0x8a, 0x24, 0xc9, + 0x3a, 0xb4, 0x1b, 0x22, 0x10, 0xf8, 0x0d, 0x21, 0x85, 0x0b, 0x83, 0xcb, 0x59, 0x02, 0x28, 0xfb, + 0x41, 0xb9, 0x11, 0xaa, 0x35, 0x9a, 0x81, 0xac, 0x32, 0xa8, 0x41, 0xc8, 0x18, 0xca, 0x73, 0xb8, + 0x88, 0x01, 0x28, 0x91, 0x08, 0x9a, 0x44, 0x01, 0xd1, 0x0c, 0x91, 0x39, 0x15, 0x9a, 0xaa, 0x90, + 0x35, 0x98, 0xce, 0x48, 0x03, 0xba, 0x30, 0x9a, 0x30, 0x93, 0x14, 0xbc, 0x8d, 0x36, 0xd9, 0x8a, + 0x21, 0x15, 0xa8, 0x8d, 0x25, 0xbb, 0x58, 0xa2, 0x09, 0x9b, 0x26, 0xab, 0x91, 0x29, 0x86, 0x0c, + 0x83, 0xbb, 0x32, 0x80, 0x82, 0x08, 0x98, 0x41, 0xc0, 0x9a, 0x37, 0xdc, 0x12, 0x0d, 0x83, 0x0a, + 0x02, 0x8b, 0x22, 0x89, 0x59, 0xb2, 0x8f, 0x12, 0x00, 0x8b, 0x04, 0xd0, 0x8a, 0x20, 0x13, 0x08, + 0x60, 0xe8, 0xb8, 0x78, 0x91, 0x01, 0xcb, 0x31, 0x98, 0x8b, 0x40, 0x84, 0x9b, 0x80, 0xa0, 0xa9, + 0x72, 0x15, 0x99, 0xbc, 0x15, 0x0a, 0x12, 0x89, 0x82, 0x9f, 0x02, 0x2a, 0xe0, 0x49, 0x83, 0x8b, + 0x92, 0x0d, 0x16, 0xbb, 0x42, 0x9b, 0x12, 0x88, 0x0a, 0xa2, 0x3b, 0x26, 0xa0, 0xcc, 0x40, 0x93, + 0x8c, 0x14, 0x8a, 0xc9, 0x52, 0x91, 0x0a, 0x89, 0x81, 0x8a, 0xa8, 0x53, 0xa8, 0x11, 0x0c, 0x87, + 0x0d, 0x21, 0x94, 0x9f, 0x21, 0x81, 0x8a, 0x81, 0x80, 0x18, 0x0b, 0x07, 0x99, 0x1c, 0x03, 0x89, + 0x99, 0x83, 0x3b, 0x13, 0xbb, 0x13, 0xff, 0x70, 0x92, 0xaa, 0x02, 0x8c, 0x24, 0x89, 0x99, 0x8a, + 0x14, 0x9b, 0x80, 0x61, 0xc2, 0x4a, 0xd1, 0x99, 0x51, 0x80, 0x08, 0xc9, 0x29, 0x83, 0x43, 0xea, + 0x19, 0x00, 0x82, 0x82, 0x0e, 0x02, 0x48, 0xb0, 0x39, 0xfc, 0x30, 0x93, 0x8b, 0xb0, 0x4b, 0xb2, + 0x41, 0x80, 0xbb, 0x32, 0xc3, 0x8d, 0x18, 0x25, 0xd9, 0x52, 0xc0, 0x19, 0x10, 0x90, 0x98, 0x4a, + 0xc2, 0x38, 0xa9, 0x14, 0x88, 0x8c, 0x16, 0x88, 0xdd, 0x41, 0xa1, 0x0a, 0x90, 0x08, 0x82, 0x10, + 0x18, 0xf2, 0x4a, 0x10, 0x80, 0xb8, 0x59, 0x12, 0xc9, 0xaa, 0x52, 0xb9, 0x72, 0xd1, 0x0b, 0x14, + 0x0a, 0xb0, 0x28, 0x02, 0x21, 0xdb, 0x10, 0x9a, 0x37, 0xba, 0x90, 0x0a, 0x06, 0x9a, 0x22, 0xcb, + 0x18, 0x23, 0x8b, 0xa7, 0x1d, 0x11, 0x81, 0xd8, 0x1a, 0x22, 0x21, 0xf0, 0x1b, 0x23, 0x10, 0x99, + 0xe8, 0x20, 0x89, 0x25, 0xcd, 0x20, 0x84, 0x19, 0xa0, 0x90, 0x0d, 0x11, 0xb4, 0x0e, 0x90, 0x42, + 0x81, 0xb9, 0x0b, 0x53, 0xa9, 0x24, 0xcb, 0x88, 0x71, 0xc3, 0x09, 0x18, 0x11, 0xba, 0x03, 0xab, + 0x31, 0xed, 0x53, 0xba, 0x40, 0x01, 0x90, 0xae, 0x20, 0x11, 0x10, 0xc1, 0x09, 0xa9, 0x42, 0x93, + 0x8a, 0x99, 0xab, 0x27, 0x89, 0xb1, 0x6a, 0x06, 0xcc, 0x22, 0x8a, 0x81, 0x41, 0xc2, 0x8d, 0x01, + 0x01, 0x9c, 0x02, 0x02, 0x18, 0xca, 0x80, 0x60, 0x00, 0x03, 0x8b, 0xfb, 0x58, 0x91, 0x9c, 0x32, + 0x99, 0xa0, 0x31, 0xbe, 0x01, 0x68, 0x05, 0xaa, 0x8c, 0x13, 0x08, 0x12, 0x3a, 0xc2, 0xbc, 0x48, + 0x02, 0xad, 0x63, 0x91, 0xba, 0x9a, 0x33, 0x12, 0x03, 0x8d, 0x88, 0xd1, 0x5a, 0x82, 0xba, 0xca, + 0x72, 0xc4, 0x0b, 0x13, 0x10, 0xa8, 0x58, 0xc8, 0x0b, 0x34, 0x00, 0xd9, 0x2b, 0x06, 0x8a, 0x90, + 0x0b, 0x04, 0x2b, 0x94, 0xbb, 0x48, 0x42, 0xb2, 0x9c, 0x22, 0x0a, 0xb0, 0x10, 0xcb, 0x40, 0x37, + 0xb9, 0x9e, 0x28, 0x21, 0x82, 0xbc, 0x41, 0x80, 0x90, 0x11, 0xc8, 0x9e, 0x44, 0xb1, 0x9b, 0x09, + 0x34, 0x00, 0x81, 0xaa, 0x0c, 0xe1, 0x70, 0xb0, 0x09, 0x22, 0x01, 0xda, 0x1c, 0x07, 0x09, 0xa9, + 0x18, 0x91, 0x3c, 0x86, 0x09, 0xb0, 0x5a, 0x92, 0x89, 0x99, 0x31, 0xc1, 0x50, 0xa0, 0xc8, 0x69, + 0x81, 0xa9, 0x39, 0x88, 0x01, 0xb8, 0x78, 0xd2, 0x2b, 0x03, 0xa8, 0x09, 0x08, 0x92, 0xa0, 0x78, + 0xd3, 0x00, 0x9a, 0x42, 0xfa, 0x41, 0x91, 0x89, 0x0a, 0x21, 0x98, 0x08, 0x21, 0x8b, 0xb1, 0xbb, + 0x27, 0x8f, 0x93, 0x30, 0x10, 0xec, 0x09, 0x12, 0x38, 0x88, 0x22, 0xf0, 0x3a, 0xb4, 0x5b, 0xd1, + 0x48, 0xc1, 0x8a, 0x21, 0x91, 0x9b, 0x73, 0xd1, 0x2a, 0x82, 0x1b, 0x94, 0x2a, 0xa3, 0x8c, 0x81, + 0x18, 0xb0, 0x70, 0x82, 0xca, 0x88, 0x28, 0x03, 0x8a, 0x71, 0xd8, 0x18, 0x00, 0xa4, 0x0b, 0x1b, + 0x07, 0xa9, 0x98, 0x8a, 0x71, 0x83, 0x89, 0x00, 0xba, 0x4a, 0x17, 0x99, 0x8a, 0x02, 0x1a, 0xd0, + 0x3a, 0x91, 0x73, 0xe1, 0x09, 0xb9, 0x63, 0x91, 0x90, 0x9d, 0x24, 0x90, 0x09, 0x98, 0x28, 0x90, + 0x42, 0xf9, 0x1a, 0x13, 0x81, 0x9b, 0x01, 0xaa, 0x36, 0x8a, 0xb2, 0x9f, 0x31, 0x33, 0xfb, 0x0c, + 0x23, 0xa1, 0x8d, 0x12, 0x98, 0x93, 0x78, 0xc8, 0x08, 0x10, 0x80, 0x01, 0x8f, 0x13, 0x1b, 0x84, + 0x8c, 0x10, 0x98, 0x28, 0xa1, 0xae, 0x32, 0x20, 0x06, 0xad, 0x00, 0x10, 0x10, 0x99, 0x88, 0x0a, + 0x80, 0x66, 0xb9, 0x18, 0x30, 0xc2, 0x8a, 0xdb, 0x51, 0x12, 0xb9, 0x99, 0x48, 0x11, 0xb1, 0x0b, + 0x04, 0xbc, 0x74, 0xc8, 0x8a, 0x20, 0x52, 0xa2, 0xbc, 0x19, 0x25, 0x88, 0x89, 0xf3, 0x4a, 0x82, + 0x99, 0x99, 0x99, 0x37, 0x9a, 0x02, 0x9f, 0x12, 0x80, 0x00, 0x9b, 0x22, 0x30, 0xd1, 0x2c, 0x92, + 0x39, 0x84, 0xcc, 0x99, 0x59, 0x14, 0xa8, 0x9e, 0x32, 0xa0, 0x19, 0x94, 0x1b, 0x00, 0x85, 0x0c, + 0xe8, 0x29, 0x25, 0xa9, 0x80, 0xaa, 0x42, 0x82, 0x8a, 0x98, 0x30, 0x83, 0xa0, 0xcf, 0x12, 0x18, + 0x23, 0xfb, 0x8a, 0x21, 0xa8, 0x19, 0x19, 0x07, 0x3e, 0xb4, 0x0a, 0x10, 0x22, 0xa1, 0x9d, 0xb9, + 0x60, 0x00, 0x01, 0xb8, 0x29, 0x11, 0xc0, 0x99, 0x61, 0x93, 0xbd, 0x71, 0xc0, 0x18, 0x21, 0xb1, + 0x9b, 0x1a, 0x07, 0x0b, 0x88, 0x20, 0xa8, 0x30, 0xd2, 0x49, 0x18, 0x84, 0xc9, 0x3b, 0x93, 0x1a, + 0xc3, 0x40, 0x9f, 0x03, 0x39, 0xa2, 0x9f, 0x11, 0x82, 0x3a, 0xc4, 0x1d, 0x82, 0x11, 0xaf, 0x21, + 0x12, 0xc1, 0x39, 0xca, 0x80, 0x43, 0xca, 0x08, 0x52, 0xd0, 0x4a, 0xa1, 0x2a, 0xa2, 0x3a, 0x86, + 0xab, 0x88, 0x60, 0x91, 0x8c, 0x14, 0x99, 0x98, 0x48, 0xb3, 0x0c, 0x81, 0x28, 0xb2, 0x8e, 0x33, + 0x89, 0x1a, 0x27, 0xcd, 0x29, 0x11, 0xb2, 0x29, 0xb9, 0x36, 0xfb, 0x38, 0x82, 0x08, 0x19, 0x90, + 0xab, 0x51, 0x92, 0x1b, 0xb0, 0x72, 0xf0, 0x08, 0x00, 0x91, 0x01, 0x9b, 0x16, 0xbb, 0x48, 0x85, + 0x1a, 0xba, 0x43, 0xc0, 0x9b, 0x21, 0x17, 0xaa, 0x28, 0xa8, 0x98, 0x49, 0x35, 0xd8, 0x0b, 0x25, + 0xb9, 0x8a, 0x32, 0x91, 0x0d, 0xb2, 0x38, 0xe9, 0x49, 0x05, 0xa9, 0x09, 0x00, 0x92, 0x2a, 0x02, + 0xb8, 0x08, 0x9e, 0x27, 0xb8, 0x0a, 0x21, 0xc9, 0x0a, 0x88, 0x37, 0x0a, 0x92, 0x89, 0x9b, 0x34, + 0xdc, 0x28, 0x98, 0x35, 0xaa, 0x92, 0x0c, 0x90, 0x54, 0x83, 0xac, 0x8a, 0x05, 0x09, 0x8b, 0x01, + 0x32, 0xf9, 0x1a, 0x00, 0xac, 0x44, 0xa3, 0x0e, 0x91, 0x12, 0x1b, 0x94, 0x39, 0x90, 0xae, 0x14, + 0x2a, 0x98, 0x10, 0x85, 0x8e, 0x20, 0xb8, 0x08, 0x42, 0xa8, 0xb3, 0x8e, 0x30, 0xa1, 0x5a, 0xf2, + 0x3a, 0x91, 0x10, 0xd1, 0x1a, 0x24, 0x0a, 0xa3, 0x8d, 0x02, 0x1a, 0x07, 0x8a, 0xaa, 0x69, 0x83, + 0xba, 0x29, 0x12, 0x88, 0xb2, 0xbf, 0x31, 0x02, 0x73, 0xda, 0x00, 0x09, 0x85, 0xab, 0x01, 0x10, + 0xa4, 0x0f, 0x05, 0x9a, 0x82, 0x09, 0x12, 0xbb, 0x88, 0x36, 0xda, 0x2a, 0x83, 0x49, 0xa2, 0x29, + 0xc9, 0x0b, 0x07, 0x89, 0xaa, 0x26, 0xa9, 0x98, 0x20, 0x01, 0x99, 0x01, 0xda, 0x31, 0xaa, 0x46, + 0xb8, 0x88, 0x8b, 0x46, 0xf0, 0x3a, 0xb1, 0x58, 0x98, 0x01, 0xca, 0x41, 0x82, 0xa9, 0x1a, 0x33, + 0xd8, 0x00, 0x0b, 0x17, 0xca, 0x30, 0x88, 0xbb, 0x20, 0x33, 0x98, 0x9d, 0x98, 0x27, 0xb8, 0x30, + 0x88, 0xb9, 0x6a, 0xa4, 0x99, 0x4c, 0x87, 0x0a, 0xb9, 0x33, 0xb9, 0x18, 0x22, 0x89, 0xfb, 0x63, + 0x98, 0xa9, 0x00, 0x11, 0x2b, 0x95, 0xae, 0x11, 0x38, 0x94, 0x9d, 0x22, 0x81, 0x39, 0xfa, 0x10, + 0x1a, 0x96, 0x2a, 0xc2, 0x2b, 0x01, 0x02, 0x98, 0xaf, 0x53, 0xa8, 0x80, 0x0a, 0x16, 0xaa, 0x20, + 0xb8, 0x49, 0x93, 0x2b, 0xf1, 0x80, 0x1a, 0x15, 0xa0, 0x89, 0x18, 0x81, 0x01, 0xad, 0x88, 0x34, + 0x1a, 0xb4, 0x1d, 0xba, 0x36, 0x11, 0xcd, 0x38, 0x92, 0x80, 0x29, 0xb8, 0x22, 0xd8, 0x72, 0xd0, + 0x8a, 0x42, 0x01, 0xac, 0x00, 0x20, 0xa1, 0x29, 0x9a, 0xe3, 0x7a, 0xb3, 0x8c, 0x00, 0x11, 0x03, + 0x8e, 0x82, 0x9a, 0x62, 0xa0, 0x09, 0x91, 0x49, 0xa1, 0x21, 0xbf, 0x53, 0x99, 0x88, 0xba, 0x12, + 0x32, 0x48, 0xf1, 0x1a, 0x39, 0xa7, 0x0c, 0x02, 0x88, 0x30, 0xc8, 0x2a, 0x99, 0x70, 0xa2, 0x89, + 0x8d, 0x14, 0x89, 0x91, 0x2a, 0x03, 0x0a, 0x91, 0xcd, 0x38, 0x80, 0x23, 0xb9, 0xad, 0x75, 0xa1, + 0x98, 0x18, 0x0a, 0x87, 0x8c, 0x02, 0x09, 0x81, 0x02, 0xcf, 0x32, 0xa8, 0x20, 0x89, 0xa8, 0x34, + 0x9e, 0x23, 0x98, 0x1a, 0xa1, 0xb8, 0x72, 0xd0, 0x10, 0x81, 0x09, 0xa4, 0x1e, 0x82, 0x18, 0xa1, + 0x0a, 0x11, 0x95, 0x2c, 0xd0, 0x01, 0x1b, 0xc0, 0x59, 0xa2, 0x0a, 0x40, 0xa3, 0x0f, 0xa3, 0x40, + 0x99, 0xa0, 0x28, 0x28, 0x13, 0x9f, 0xa1, 0x79, 0xb1, 0x3b, 0xc0, 0x41, 0x88, 0xa9, 0x33, 0xac, + 0x06, 0x0c, 0xa2, 0x2c, 0x85, 0x1b, 0xc8, 0x41, 0x98, 0x08, 0x88, 0x22, 0x90, 0x3a, 0xe2, 0x8a, + 0x81, 0x61, 0xa8, 0x8c, 0x03, 0x11, 0xad, 0x02, 0x07, 0x3b, 0xea, 0x32, 0x98, 0x99, 0x12, 0x0a, + 0x00, 0xa2, 0xad, 0x41, 0xc1, 0x30, 0xf8, 0x20, 0x99, 0x15, 0x99, 0x01, 0xcc, 0x20, 0x91, 0x4a, + 0xc2, 0x52, 0xc9, 0x09, 0x11, 0x43, 0xc8, 0x2a, 0xa3, 0x2c, 0x18, 0x87, 0x8d, 0x28, 0xb3, 0x0b, + 0xaa, 0x72, 0xc3, 0x89, 0x30, 0xc0, 0x8a, 0x43, 0x80, 0xb8, 0x0e, 0x15, 0x98, 0x1a, 0x95, 0x1a, + 0xa8, 0x10, 0x1a, 0xb0, 0x73, 0xb2, 0x8c, 0x23, 0x98, 0x04, 0x9f, 0x02, 0xaa, 0x49, 0x82, 0x8b, + 0x91, 0x73, 0xa0, 0xb9, 0x10, 0x61, 0xc9, 0x32, 0xcb, 0x11, 0x10, 0x2a, 0xd0, 0x08, 0x34, 0xba, + 0xbc, 0x36, 0x98, 0x8a, 0x42, 0xf8, 0x20, 0x08, 0xa1, 0x8b, 0x19, 0x47, 0xba, 0x20, 0x88, 0x09, + 0x82, 0xb0, 0x0a, 0x09, 0x15, 0x8d, 0xa2, 0x3a, 0x05, 0x9d, 0x92, 0x41, 0x98, 0x31, 0xe1, 0x0a, + 0x99, 0x47, 0xa9, 0x98, 0x51, 0xba, 0xa2, 0x3b, 0x04, 0x29, 0xb9, 0x84, 0x9f, 0x43, 0xa9, 0x81, + 0x08, 0x19, 0xfb, 0x71, 0xa8, 0x21, 0xba, 0x13, 0x9c, 0x14, 0x8b, 0x13, 0xd9, 0x51, 0x99, 0x03, + 0x9a, 0x39, 0xb2, 0x10, 0xdf, 0x20, 0x88, 0x32, 0xe8, 0x28, 0xb0, 0x61, 0xaa, 0x03, 0x1b, 0xc9, + 0x43, 0xc0, 0x49, 0x80, 0x91, 0x88, 0x8e, 0x04, 0x18, 0x91, 0x0a, 0x98, 0x58, 0x95, 0xaa, 0x09, + 0x02, 0x81, 0x8f, 0x91, 0x51, 0xa8, 0x08, 0x80, 0x08, 0x28, 0x84, 0x91, 0x8f, 0xa2, 0x63, 0xaa, + 0xa0, 0x38, 0x40, 0xf8, 0x3a, 0x88, 0x42, 0xc0, 0x19, 0xc9, 0x44, 0xa9, 0x80, 0x91, 0x3d, 0x95, + 0x0a, 0x83, 0x1d, 0x90, 0x12, 0x0e, 0xa4, 0x2a, 0xa3, 0x1a, 0x93, 0x8d, 0x05, 0x9b, 0xb8, 0x4a, + 0x13, 0xba, 0x16, 0x2b, 0xa4, 0x9a, 0x34, 0xcb, 0x22, 0x9e, 0x14, 0x1b, 0x94, 0x1e, 0x83, 0x0b, + 0x80, 0x89, 0x03, 0x0d, 0x05, 0x9c, 0x02, 0x1a, 0x91, 0x58, 0xc0, 0x98, 0x3b, 0x85, 0x00, 0x8d, + 0x14, 0x88, 0x98, 0x08, 0x81, 0x30, 0xb1, 0x01, 0xaf, 0x42, 0xb1, 0x28, 0xac, 0x11, 0x39, 0xe1, + 0x18, 0x9a, 0x28, 0x38, 0x37, 0xef, 0x31, 0x00, 0xb8, 0x18, 0x2b, 0x97, 0x1a, 0x12, 0xab, 0x19, + 0x17, 0x89, 0x9d, 0x23, 0xa0, 0x2a, 0xa0, 0x08, 0x86, 0x0d, 0x85, 0x8b, 0x11, 0x82, 0xb9, 0x0c, + 0x25, 0x00, 0xc9, 0x3a, 0x93, 0xcc, 0x51, 0xba, 0x12, 0x1b, 0x25, 0xc0, 0x2b, 0x84, 0x08, 0x8a, + 0x93, 0x1c, 0xe1, 0x60, 0x90, 0xa9, 0x52, 0xa0, 0x09, 0x0b, 0x24, 0xd8, 0x2a, 0x12, 0xe0, 0x3a, + 0x12, 0x98, 0xfb, 0x10, 0x10, 0xd8, 0x21, 0x39, 0xc0, 0x58, 0x91, 0x9b, 0x12, 0x41, 0xb1, 0x8f, + 0x02, 0x20, 0xb0, 0x2a, 0x93, 0xad, 0x30, 0xba, 0x17, 0x1a, 0xa3, 0x0b, 0xb8, 0x68, 0x81, 0xab, + 0x91, 0x7a, 0xb8, 0x15, 0xa8, 0x0d, 0x07, 0x1a, 0xb8, 0x11, 0x12, 0x99, 0xa9, 0x21, 0x82, 0x8f, + 0x02, 0x09, 0xb1, 0x5b, 0xa0, 0x89, 0x23, 0x72, 0xb8, 0x1c, 0x95, 0x1b, 0xc9, 0x61, 0xc0, 0x20, + 0xaa, 0x13, 0x1b, 0x86, 0x08, 0x0b, 0xa4, 0x4b, 0xd1, 0x29, 0x91, 0x01, 0x1d, 0x91, 0x18, 0x05, + 0xb8, 0x1e, 0xa3, 0x71, 0xb9, 0x29, 0x04, 0xc8, 0x29, 0x91, 0x2a, 0xc8, 0x92, 0x6a, 0xd8, 0x20, + 0x12, 0xc9, 0x30, 0xc0, 0x48, 0xb9, 0x31, 0x98, 0x18, 0x85, 0x0e, 0x01, 0x90, 0x39, 0xa1, 0x8c, + 0x37, 0xac, 0x02, 0x18, 0x88, 0xc2, 0x0e, 0x15, 0xab, 0x80, 0x30, 0xba, 0x46, 0xda, 0x10, 0x08, + 0x01, 0x90, 0x1c, 0x05, 0x98, 0x08, 0x88, 0x1a, 0x94, 0x9a, 0x18, 0xba, 0x73, 0x93, 0x90, 0xad, + 0x26, 0x8a, 0xc1, 0x49, 0x91, 0x19, 0xb0, 0x1b, 0x11, 0xb8, 0x77, 0xd9, 0x28, 0x00, 0xa0, 0x28, + 0x80, 0x89, 0x13, 0x9c, 0xb3, 0x8f, 0x05, 0x89, 0xa2, 0x3b, 0x93, 0x18, 0x94, 0x8f, 0x03, 0x99, + 0x32, 0xca, 0x10, 0x28, 0x33, 0xf9, 0x1f, 0x91, 0x11, 0x08, 0xa0, 0x0b, 0x21, 0x03, 0xbe, 0x2a, + 0x35, 0xd2, 0x0c, 0x92, 0x18, 0x83, 0x29, 0xa8, 0xd8, 0x7a, 0x82, 0x9a, 0x10, 0x85, 0x1c, 0xa0, + 0x20, 0xba, 0x33, 0x12, 0xaf, 0x01, 0x8c, 0x24, 0xa8, 0x09, 0x31, 0x9c, 0xa7, 0x4b, 0xa8, 0x30, + 0x92, 0x1c, 0x14, 0xaf, 0x31, 0x10, 0x92, 0x9f, 0x14, 0x9a, 0x98, 0x01, 0x78, 0xc0, 0x3a, 0xb0, + 0x41, 0x0a, 0xa3, 0x2b, 0xd1, 0x19, 0x35, 0xcb, 0x30, 0xa8, 0x23, 0xcd, 0x31, 0xa9, 0x18, 0x84, + 0xa0, 0x0e, 0x14, 0x99, 0x1a, 0x13, 0x80, 0xad, 0x03, 0x58, 0xfa, 0x59, 0x80, 0x90, 0x18, 0x88, + 0x99, 0x40, 0x86, 0x8a, 0x80, 0x28, 0x98, 0xba, 0x31, 0x07, 0xac, 0x1b, 0x16, 0xab, 0x31, 0x20, + 0xe2, 0x8b, 0x41, 0x82, 0xca, 0x38, 0x85, 0x0c, 0x81, 0x3b, 0xb6, 0x5b, 0xb2, 0x8a, 0x20, 0x09, + 0x03, 0x9c, 0x33, 0xa9, 0x98, 0x88, 0x32, 0xfc, 0x2b, 0x07, 0x80, 0xac, 0x14, 0x09, 0x98, 0x23, + 0xca, 0x1b, 0xa2, 0x72, 0xa0, 0x30, 0xc2, 0x9f, 0x22, 0x00, 0x9c, 0x22, 0x9a, 0x23, 0xcf, 0x25, + 0x99, 0x08, 0x08, 0x02, 0xcb, 0x21, 0x88, 0x93, 0x0d, 0x02, 0x89, 0x25, 0xca, 0x99, 0x29, 0x52, + 0xb2, 0xdc, 0x41, 0xa1, 0x0a, 0xb0, 0x52, 0xa9, 0x52, 0xb0, 0x0a, 0x88, 0x63, 0xc2, 0x0a, 0x01, + 0x29, 0xe1, 0x40, 0xa9, 0x29, 0x21, 0xd8, 0x99, 0x3c, 0x05, 0x90, 0x9c, 0x42, 0xcb, 0x32, 0x00, + 0x38, 0xfa, 0x21, 0xc8, 0x2a, 0x94, 0x40, 0x90, 0xb8, 0x69, 0xc0, 0x29, 0x14, 0xba, 0x09, 0xa2, + 0x8c, 0x10, 0x45, 0xb0, 0xcb, 0x22, 0x01, 0xca, 0x40, 0x93, 0x2b, 0xc8, 0x42, 0xac, 0x22, 0x32, + 0xc1, 0xaf, 0x01, 0x10, 0x08, 0x43, 0xea, 0x20, 0x10, 0xb1, 0xad, 0x2a, 0x06, 0xab, 0x43, 0x89, + 0x91, 0x9b, 0x72, 0xb1, 0x08, 0x29, 0x94, 0xdd, 0x68, 0x82, 0x8a, 0xa0, 0x20, 0xba, 0x29, 0x35, + 0xb1, 0xaf, 0x53, 0xa0, 0x0a, 0x12, 0x00, 0xe1, 0x2a, 0x83, 0xad, 0x21, 0x24, 0xc8, 0x8d, 0x02, + 0x18, 0xc0, 0x60, 0x81, 0xab, 0x22, 0x99, 0x81, 0x88, 0x29, 0xc6, 0x1d, 0x82, 0x18, 0x98, 0x30, + 0x03, 0xad, 0x28, 0x80, 0xc8, 0x71, 0x94, 0xac, 0x02, 0x28, 0xb1, 0x2a, 0x31, 0xe3, 0xad, 0x31, + 0x10, 0x99, 0x35, 0xea, 0x18, 0x90, 0x31, 0xf9, 0x28, 0x81, 0x80, 0xac, 0x44, 0xb8, 0x29, 0x93, + 0x00, 0xfb, 0x58, 0xa1, 0x18, 0xb1, 0x59, 0xd1, 0x1a, 0x12, 0x82, 0xac, 0x01, 0x82, 0x1e, 0x83, + 0x8a, 0x18, 0x17, 0xbb, 0x80, 0x59, 0xa0, 0x10, 0xa8, 0x11, 0x23, 0xfa, 0x1a, 0x80, 0x43, 0x8b, + 0xc0, 0x51, 0xb8, 0x29, 0xa0, 0x82, 0x28, 0x79, 0xb3, 0x3b, 0xc1, 0x2a, 0x03, 0x00, 0xcf, 0x23, + 0x98, 0xeb, 0x38, 0x43, 0xe2, 0x1b, 0x12, 0xd9, 0x38, 0x02, 0xc0, 0x19, 0x10, 0xe0, 0x3a, 0x04, + 0x39, 0xe2, 0x0a, 0xa8, 0x1b, 0x45, 0x22, 0xf8, 0x5b, 0xa0, 0x10, 0x08, 0x01, 0xba, 0x2a, 0xb2, + 0x8c, 0x33, 0xa9, 0x27, 0xcb, 0xb0, 0x58, 0x02, 0x18, 0xc2, 0x0e, 0x03, 0x0b, 0x83, 0xae, 0x73, + 0xa1, 0x09, 0xc9, 0x11, 0x30, 0xb1, 0x31, 0xf8, 0x8a, 0x24, 0xa9, 0xa8, 0x40, 0x81, 0xb0, 0xbd, + 0x51, 0x91, 0x42, 0xc8, 0x09, 0x88, 0x24, 0x88, 0x98, 0xca, 0x35, 0x9e, 0x12, 0xab, 0x16, 0x88, + 0x98, 0xba, 0x79, 0xa3, 0x10, 0xb8, 0x89, 0x21, 0x32, 0xf9, 0x1c, 0x12, 0x12, 0xd8, 0x0c, 0x13, + 0x99, 0x11, 0x98, 0x89, 0x3a, 0x23, 0xb5, 0x9f, 0x48, 0x83, 0xaa, 0xd0, 0x1a, 0x42, 0x94, 0x8b, + 0x02, 0x01, 0x99, 0x93, 0x9c, 0x12, 0x29, 0x16, 0xff, 0x20, 0x80, 0x13, 0xba, 0x29, 0x90, 0xab, + 0x54, 0xd9, 0x41, 0xbb, 0x35, 0xaa, 0x80, 0x89, 0x51, 0xc2, 0x2d, 0x92, 0x81, 0x0b, 0x35, 0xc9, + 0x9b, 0x61, 0x81, 0x9c, 0x18, 0x13, 0xb9, 0x08, 0x2b, 0x86, 0x0b, 0x33, 0xc0, 0xac, 0x73, 0xb2, + 0x0b, 0xa2, 0x4a, 0xa2, 0x28, 0xc2, 0x9f, 0x25, 0x89, 0xa1, 0x0b, 0x14, 0x18, 0xf0, 0x1a, 0x01, + 0x20, 0xa0, 0x09, 0xbb, 0x41, 0x04, 0xbb, 0x63, 0x80, 0xaa, 0x31, 0xb0, 0x6b, 0x23, 0xaa, 0xb2, + 0xef, 0x31, 0x10, 0xa9, 0x88, 0x29, 0xb3, 0x3c, 0x16, 0xb9, 0x19, 0x21, 0xb3, 0xbf, 0x40, 0x91, + 0x11, 0xb9, 0x30, 0xfb, 0x7a, 0xa2, 0x20, 0xca, 0x51, 0xc1, 0x0b, 0x33, 0xc8, 0x88, 0x30, 0xf2, + 0x1a, 0xa2, 0x40, 0xc0, 0x39, 0xa1, 0x28, 0x81, 0x29, 0xb0, 0x38, 0xc4, 0x8e, 0x99, 0x32, 0x26, + 0xac, 0x01, 0x99, 0x20, 0x1a, 0x04, 0x89, 0x99, 0x40, 0x12, 0xf9, 0x2f, 0x84, 0x1b, 0x91, 0x1b, + 0xb3, 0x6b, 0x82, 0x99, 0x20, 0x08, 0xa2, 0xbd, 0x71, 0xc1, 0x2a, 0x82, 0x90, 0x99, 0x78, 0xb2, + 0xac, 0x58, 0x83, 0xa0, 0x2c, 0x94, 0x1a, 0x01, 0x18, 0xfa, 0x5c, 0x91, 0x18, 0xd8, 0x40, 0x91, + 0x0a, 0x82, 0x0a, 0xd9, 0x41, 0x81, 0xa9, 0x0a, 0x51, 0xb3, 0x0e, 0x83, 0x09, 0x88, 0x89, 0x32, + 0x9c, 0x34, 0x02, 0xfc, 0x09, 0x23, 0xa9, 0x88, 0x12, 0xa0, 0x1f, 0x05, 0x99, 0x09, 0x19, 0x25, + 0xca, 0x9d, 0x23, 0x01, 0x08, 0xa8, 0x9c, 0x9a, 0x47, 0xb0, 0x0a, 0x32, 0x93, 0xeb, 0x58, 0xa8, + 0x12, 0x89, 0x81, 0xbf, 0x50, 0x83, 0x9b, 0x09, 0x35, 0xc8, 0x0a, 0x83, 0x19, 0xb9, 0x57, 0xd8, + 0x09, 0x11, 0x90, 0x98, 0x28, 0xa2, 0x99, 0x28, 0x10, 0x94, 0x8a, 0x35, 0xaa, 0xfc, 0x39, 0x16, + 0xaa, 0x18, 0x80, 0xba, 0x59, 0x12, 0x02, 0x9b, 0x41, 0xc1, 0x9f, 0x41, 0x81, 0x81, 0x9c, 0x82, + 0x0a, 0x09, 0x16, 0xba, 0x1a, 0x12, 0x0a, 0xa8, 0x33, 0x4a, 0xc2, 0x33, 0x9d, 0xa9, 0x90, 0x67, + 0xaa, 0x98, 0x21, 0xc9, 0x49, 0x13, 0x20, 0xaf, 0x84, 0xab, 0x41, 0x82, 0x98, 0x0b, 0x02, 0xdb, + 0x39, 0x84, 0x38, 0xb2, 0x8f, 0x92, 0x30, 0x84, 0x2a, 0x95, 0xaf, 0x00, 0x18, 0x06, 0x8a, 0x02, + 0x9d, 0x01, 0x1a, 0x84, 0x9a, 0x20, 0x10, 0xc5, 0x2d, 0x02, 0x80, 0x9a, 0x03, 0x0b, 0x21, 0x92, + 0xc8, 0x1c, 0x25, 0x40, 0xfa, 0x09, 0x10, 0x80, 0xb1, 0x38, 0xfb, 0x30, 0x04, 0x9c, 0x02, 0x8b, + 0x85, 0x00, 0x0a, 0xca, 0x64, 0xa1, 0x9a, 0x00, 0x41, 0xd0, 0x19, 0x90, 0x58, 0xc2, 0x08, 0x98, + 0x08, 0x04, 0x8d, 0x02, 0xab, 0x33, 0x8b, 0x86, 0x9d, 0x04, 0x0a, 0x13, 0x9b, 0x91, 0x40, 0x95, + 0x2b, 0xbd, 0x73, 0xb0, 0x1a, 0x83, 0x9b, 0x04, 0x9a, 0x98, 0x51, 0x92, 0xb8, 0x3a, 0x30, 0x97, + 0x8a, 0x30, 0xd0, 0x08, 0x80, 0x32, 0xfc, 0x3b, 0x07, 0x9a, 0x99, 0x43, 0x99, 0x98, 0x22, 0x2b, + 0xe4, 0x38, 0xa0, 0x91, 0x0b, 0x22, 0xf1, 0x4a, 0x05, 0x9a, 0x20, 0x30, 0xea, 0x09, 0x12, 0x99, + 0x29, 0xa6, 0x1c, 0xb1, 0x40, 0xe9, 0x3a, 0x04, 0x0b, 0xc2, 0x39, 0xb1, 0x50, 0x80, 0xa1, 0x8a, + 0x4a, 0x86, 0x8c, 0x92, 0x49, 0xa3, 0x0b, 0xb2, 0x2d, 0x05, 0xb8, 0x2a, 0xf2, 0x28, 0x01, 0x01, + 0xbe, 0x32, 0x89, 0x00, 0x9c, 0x16, 0x9a, 0x32, 0xfa, 0x49, 0x01, 0x88, 0x98, 0x0a, 0x20, 0x80, + 0x02, 0x89, 0xdc, 0x50, 0x01, 0xb9, 0x51, 0x99, 0xab, 0x11, 0x73, 0xe2, 0x0a, 0x14, 0xb9, 0x89, + 0x52, 0xb8, 0x20, 0x09, 0x02, 0xab, 0x11, 0x34, 0xfb, 0x99, 0x40, 0xc0, 0x4b, 0x84, 0x19, 0xca, + 0x63, 0xb8, 0x2a, 0x03, 0x88, 0xa8, 0x49, 0xb2, 0x41, 0x9b, 0x8b, 0x27, 0x9f, 0x15, 0x9c, 0x11, + 0x88, 0x11, 0xc8, 0x39, 0xa3, 0x2b, 0xb8, 0x43, 0xbc, 0x12, 0x8b, 0x17, 0xac, 0x15, 0x89, 0x9a, + 0x31, 0x04, 0x89, 0x9a, 0x38, 0xf8, 0x39, 0x32, 0xd0, 0x9d, 0x13, 0x99, 0xa1, 0x7a, 0x82, 0xb8, + 0x3b, 0x83, 0x99, 0x21, 0x31, 0xf0, 0x8f, 0x31, 0x98, 0x88, 0x42, 0xc9, 0x29, 0x90, 0x02, 0x20, + 0xab, 0x46, 0xfa, 0x20, 0x99, 0x04, 0x9d, 0x11, 0x81, 0x8a, 0x10, 0x21, 0xa8, 0x10, 0x2a, 0x37, + 0xcf, 0x41, 0xb8, 0x28, 0x11, 0x91, 0xaf, 0x33, 0x88, 0xd0, 0x39, 0x84, 0x9d, 0x22, 0x80, 0x9a, + 0x10, 0x33, 0xc1, 0xad, 0x21, 0x18, 0xa8, 0x21, 0x00, 0x19, 0x10, 0x17, 0xbf, 0x48, 0x84, 0x9a, + 0xa8, 0x20, 0x80, 0x88, 0x2a, 0x03, 0xf9, 0x58, 0xa0, 0x9a, 0x40, 0x13, 0x8a, 0xa1, 0x4a, 0xc1, + 0x68, 0xa3, 0x8f, 0x82, 0x28, 0xa1, 0x8d, 0x14, 0xaa, 0x14, 0x9f, 0x12, 0x9b, 0x34, 0x99, 0xa2, + 0x9f, 0x05, 0x0a, 0x90, 0x21, 0x92, 0xbb, 0x71, 0xc8, 0x31, 0x10, 0xa8, 0xbb, 0x39, 0x34, 0xc9, + 0x39, 0x92, 0x9f, 0x21, 0x01, 0x88, 0xea, 0x78, 0xb1, 0x0b, 0x23, 0xaa, 0x51, 0x81, 0xb9, 0x39, + 0xa0, 0x39, 0xc3, 0x2a, 0x47, 0xda, 0x29, 0x92, 0x39, 0xa0, 0x31, 0xf8, 0x0d, 0x04, 0x09, 0x91, + 0x09, 0x19, 0x02, 0xaa, 0x18, 0x15, 0x1a, 0x86, 0xae, 0x90, 0x50, 0x84, 0xaa, 0x00, 0x88, 0x98, + 0x28, 0x14, 0x9b, 0x28, 0x03, 0xfa, 0x0f, 0x24, 0xb9, 0x21, 0x9b, 0x13, 0x80, 0x1a, 0xa5, 0x0c, + 0x43, 0x98, 0xf9, 0x4b, 0x82, 0x80, 0xa9, 0x02, 0xb9, 0x1a, 0x83, 0x2e, 0x94, 0x9b, 0x51, 0x93, + 0x0f, 0x23, 0xaa, 0x00, 0x28, 0xc8, 0x3a, 0x13, 0xa2, 0x30, 0xbb, 0xc1, 0x53, 0xbf, 0x70, 0xc2, + 0x19, 0x89, 0x12, 0xb0, 0x39, 0xda, 0x24, 0x8a, 0x18, 0xf3, 0x1a, 0x12, 0x00, 0x10, 0x8b, 0x96, + 0x9f, 0x34, 0x09, 0xb9, 0x48, 0xb8, 0x20, 0x0a, 0x93, 0x59, 0xc0, 0x18, 0x9c, 0x73, 0xb0, 0x08, + 0x89, 0x22, 0x92, 0x1e, 0xc0, 0x22, 0x8c, 0x05, 0x99, 0x00, 0xc8, 0x59, 0xd2, 0x48, 0xb0, 0x20, + 0x89, 0xaa, 0x13, 0x8b, 0x41, 0x01, 0xb1, 0x8f, 0x33, 0x0a, 0xb8, 0x28, 0x81, 0xe8, 0x70, 0xc0, + 0x21, 0xb8, 0x99, 0x10, 0xa0, 0x65, 0x99, 0x99, 0x33, 0x9e, 0x31, 0xdb, 0x11, 0x10, 0x00, 0xc0, + 0x9a, 0x35, 0xad, 0x35, 0x98, 0xaa, 0x38, 0x00, 0xc0, 0x72, 0x98, 0x91, 0xbc, 0x40, 0x92, 0x29, + 0xe3, 0x1a, 0xb1, 0x7a, 0xa4, 0x19, 0x98, 0x31, 0xda, 0x10, 0x81, 0x9c, 0x24, 0x20, 0xeb, 0x19, + 0x12, 0x00, 0xb1, 0x8a, 0x35, 0x9e, 0x12, 0x88, 0x8b, 0x43, 0xc0, 0xaa, 0x38, 0x80, 0x97, 0x1d, + 0x03, 0x9a, 0x04, 0x8a, 0x88, 0x82, 0x3a, 0xc3, 0xb9, 0x7b, 0xa1, 0x62, 0xca, 0x28, 0xc9, 0x41, + 0xa8, 0x22, 0x9d, 0x25, 0x9b, 0x10, 0x91, 0x99, 0xba, 0x71, 0xa3, 0xa8, 0x0a, 0x12, 0x04, 0x0c, + 0x84, 0x8a, 0x9b, 0x57, 0xd9, 0x29, 0x02, 0x88, 0x9d, 0x13, 0x80, 0x9b, 0x82, 0x48, 0xb0, 0x52, + 0x82, 0xac, 0x91, 0x58, 0x88, 0xab, 0x37, 0x8c, 0x91, 0x18, 0x98, 0x00, 0x81, 0x80, 0x9c, 0xaa, + 0x37, 0x4a, 0xc1, 0x2a, 0xa8, 0x51, 0xc9, 0x21, 0x89, 0x32, 0xc8, 0x99, 0x62, 0xa8, 0x01, 0x8f, + 0x15, 0xb9, 0x59, 0xb8, 0x29, 0x82, 0x09, 0x14, 0xcd, 0x40, 0xb0, 0x11, 0x08, 0x82, 0xbc, 0x30, + 0x14, 0x99, 0xcc, 0x70, 0xc1, 0x3a, 0x92, 0x30, 0xf9, 0x49, 0x91, 0x0a, 0x10, 0x11, 0xf0, 0x2a, + 0x81, 0x9a, 0x13, 0x09, 0x88, 0x08, 0x31, 0x82, 0xf8, 0x2f, 0xa5, 0x19, 0x90, 0x22, 0x9b, 0xb1, + 0x59, 0x91, 0xbc, 0x71, 0x81, 0x99, 0x1b, 0x86, 0x29, 0xb0, 0x41, 0xd9, 0x1a, 0x05, 0xa9, 0x80, + 0x0a, 0x17, 0x8b, 0x21, 0xa8, 0xaa, 0x73, 0x90, 0x9a, 0x12, 0x08, 0xa0, 0xbb, 0x74, 0xb0, 0x2b, + 0xa3, 0x9b, 0x08, 0x67, 0xb0, 0x0a, 0x18, 0x86, 0xab, 0x41, 0xc1, 0x19, 0x04, 0x9a, 0xa1, 0x3a, + 0x24, 0xd9, 0x9a, 0x38, 0x85, 0x19, 0x89, 0x12, 0xf9, 0x3b, 0x93, 0x98, 0x1b, 0x32, 0x84, 0xbe, + 0x50, 0x10, 0x99, 0x20, 0xc2, 0x39, 0xda, 0x21, 0xd8, 0x59, 0x14, 0xdb, 0x18, 0xa8, 0x22, 0x01, + 0x19, 0xe2, 0x0c, 0x03, 0x30, 0x90, 0xa9, 0xad, 0x13, 0x52, 0xdb, 0x02, 0x2d, 0x07, 0xba, 0x29, + 0x02, 0x01, 0xb0, 0x2b, 0xc2, 0x4b, 0x14, 0x98, 0x8d, 0x14, 0xb8, 0x1b, 0x92, 0x69, 0xa1, 0x40, + 0xd9, 0x88, 0x40, 0x92, 0xa8, 0x1e, 0x82, 0x01, 0x90, 0x8f, 0x84, 0x29, 0xa2, 0x0c, 0x82, 0x1b, + 0x16, 0xb9, 0x90, 0x3b, 0x17, 0xab, 0x32, 0xa9, 0x88, 0x18, 0x08, 0xab, 0x68, 0x05, 0xe8, 0x1c, + 0x83, 0x30, 0xbb, 0x93, 0xad, 0x43, 0x1a, 0x14, 0xea, 0x28, 0xa2, 0x20, 0x99, 0xaa, 0x22, 0x05, + 0x9a, 0x28, 0xfb, 0x54, 0xc9, 0x30, 0xa9, 0x02, 0x1a, 0xc3, 0x2d, 0xa1, 0x52, 0xc8, 0x09, 0x00, + 0xa2, 0x1a, 0x03, 0x0f, 0x85, 0x0a, 0x81, 0xa9, 0x23, 0x29, 0x94, 0x9d, 0x98, 0x63, 0x98, 0x0b, + 0x14, 0x99, 0x91, 0x2f, 0x93, 0x9b, 0x23, 0x40, 0xf9, 0x1a, 0x12, 0x22, 0xdc, 0x12, 0x99, 0x8a, + 0x24, 0x9b, 0x91, 0x44, 0x09, 0xf9, 0x1a, 0x12, 0x03, 0xbc, 0x92, 0x6a, 0xc8, 0x24, 0xca, 0x10, + 0x88, 0x14, 0x1b, 0xc1, 0x2b, 0x33, 0x03, 0xfa, 0x1f, 0x12, 0xa0, 0x1a, 0x81, 0x2a, 0xa1, 0x08, + 0xba, 0x70, 0x90, 0x83, 0xad, 0x28, 0x02, 0x8c, 0x95, 0x4c, 0x93, 0x1c, 0xb0, 0x4a, 0xc2, 0x68, + 0x98, 0x00, 0x8a, 0x42, 0x91, 0x9a, 0x0a, 0x82, 0xca, 0x01, 0x70, 0xb8, 0x29, 0x94, 0xaf, 0x34, + 0x90, 0x8a, 0xb9, 0x45, 0xb9, 0x11, 0x88, 0xa0, 0x70, 0xc1, 0x08, 0x99, 0x20, 0x95, 0x8b, 0x05, + 0x19, 0xd0, 0x30, 0xa8, 0x99, 0x30, 0x01, 0xa8, 0x1f, 0x86, 0x8c, 0x02, 0x00, 0x19, 0xc0, 0x58, + 0xc3, 0x1d, 0x83, 0x89, 0x88, 0x31, 0xd0, 0x8b, 0x11, 0x22, 0xc1, 0x1f, 0x84, 0x99, 0x10, 0x91, + 0x38, 0xb8, 0x52, 0xbb, 0x80, 0x71, 0xb4, 0x8a, 0xac, 0x12, 0x33, 0xc9, 0x32, 0xec, 0x11, 0x89, + 0x13, 0xae, 0x33, 0xa8, 0xa9, 0x0b, 0x34, 0xa2, 0x38, 0xb8, 0xac, 0x20, 0x27, 0x2a, 0xc9, 0x25, + 0xab, 0x08, 0x89, 0x03, 0x44, 0x1c, 0xf3, 0x0d, 0x31, 0x88, 0xc0, 0x38, 0x93, 0x9d, 0x01, 0x48, + 0xf0, 0x38, 0x91, 0x88, 0x8b, 0x16, 0x09, 0x99, 0x10, 0x10, 0x90, 0x2d, 0x87, 0x0a, 0x88, 0x00, + 0xa9, 0x29, 0x71, 0xb0, 0x08, 0x8a, 0x24, 0xc9, 0x18, 0x21, 0x22, 0xcf, 0x50, 0xa0, 0xa0, 0x2e, + 0x84, 0x89, 0x02, 0xa9, 0x09, 0x19, 0x27, 0x8c, 0x81, 0xa9, 0x23, 0x9d, 0x11, 0x83, 0x0d, 0x12, + 0x81, 0xbd, 0x29, 0x07, 0x19, 0x98, 0x99, 0x35, 0xba, 0x11, 0xda, 0x31, 0xa8, 0xbb, 0x23, 0x1a, + 0x27, 0xbb, 0x01, 0x1b, 0xd1, 0x71, 0x81, 0x0b, 0x83, 0x09, 0x82, 0x8f, 0x43, 0xa8, 0x1c, 0xc1, + 0x0b, 0x62, 0x03, 0xbb, 0x15, 0x9f, 0x13, 0x9b, 0x21, 0x90, 0x01, 0xaf, 0x34, 0xa9, 0x88, 0x31, + 0x94, 0x9f, 0x21, 0x88, 0x01, 0x19, 0x92, 0xd9, 0x2b, 0x14, 0xd0, 0x19, 0x11, 0x91, 0x8c, 0x23, + 0xb2, 0x1e, 0x92, 0xa0, 0x0b, 0x13, 0x70, 0xe2, 0x1a, 0xa1, 0x49, 0xa2, 0x20, 0xc9, 0x0c, 0x26, + 0xa8, 0x09, 0x18, 0x88, 0x91, 0x1d, 0xd1, 0x08, 0x41, 0xb3, 0x8f, 0x30, 0x87, 0x8a, 0x80, 0x09, + 0x12, 0x99, 0x89, 0x00, 0x90, 0x48, 0x07, 0xaf, 0x11, 0x00, 0x81, 0x9b, 0x30, 0xd8, 0x21, 0x2b, + 0xb6, 0x1d, 0x14, 0x98, 0xaa, 0x31, 0x22, 0xfb, 0x49, 0x81, 0x89, 0x13, 0x9b, 0x80, 0x2c, 0x86, + 0x88, 0xcb, 0x11, 0x01, 0x98, 0x21, 0xa0, 0x0d, 0x90, 0x34, 0xbb, 0x15, 0x20, 0xca, 0x51, 0xcd, + 0x10, 0x23, 0x29, 0xfa, 0x11, 0x3b, 0x95, 0x29, 0xe0, 0x10, 0x09, 0x93, 0x9b, 0x4b, 0x92, 0x20, + 0xad, 0x93, 0x60, 0x89, 0x13, 0xbf, 0x02, 0x79, 0x92, 0x0a, 0xb8, 0x3a, 0x15, 0xb9, 0xbc, 0x51, + 0x02, 0xb9, 0x11, 0x0c, 0x83, 0x62, 0xc8, 0x0a, 0x01, 0x18, 0x96, 0x0e, 0x01, 0x88, 0x01, 0x89, + 0xb0, 0x3a, 0x37, 0xdb, 0x18, 0x19, 0x34, 0xb8, 0x99, 0x9b, 0x41, 0xa3, 0xae, 0x41, 0x82, 0x1c, + 0x93, 0x0e, 0x91, 0x32, 0x11, 0xcb, 0xbb, 0x72, 0xa2, 0x08, 0xda, 0x50, 0xa1, 0x80, 0x89, 0x48, + 0x02, 0x02, 0xfa, 0x2a, 0x81, 0x98, 0x31, 0xbc, 0x05, 0x1b, 0x91, 0x0c, 0x17, 0x0c, 0x83, 0x00, + 0xc9, 0x0c, 0x25, 0x98, 0x09, 0xa0, 0x30, 0xe8, 0x49, 0xa1, 0x00, 0x8a, 0x34, 0xdc, 0x10, 0x10, + 0x12, 0x9a, 0x98, 0xa9, 0x2a, 0x37, 0x08, 0xaf, 0x04, 0x0b, 0x90, 0x11, 0x43, 0x90, 0xca, 0x2a, + 0xc8, 0x60, 0x98, 0x12, 0xcb, 0x10, 0x80, 0x93, 0x09, 0xcb, 0x47, 0x08, 0xcb, 0x40, 0x02, 0x09, + 0x99, 0xab, 0x51, 0xc8, 0x39, 0x02, 0xb8, 0x2a, 0xa5, 0x3c, 0x94, 0x9d, 0x24, 0xca, 0x2a, 0x23, + 0x18, 0x88, 0xc3, 0x8f, 0x13, 0x20, 0xc8, 0x99, 0x55, 0xa8, 0x8a, 0x01, 0x12, 0x9c, 0x80, 0xb0, + 0x21, 0xae, 0x36, 0xaa, 0x88, 0x84, 0x8d, 0x12, 0x01, 0x18, 0xf0, 0x58, 0xa9, 0x11, 0x19, 0x92, + 0x8f, 0x11, 0x93, 0x1e, 0xa0, 0x23, 0x08, 0x9a, 0xa0, 0x11, 0x8b, 0x14, 0xea, 0x1a, 0x41, 0xb2, + 0x0d, 0x34, 0xe9, 0x89, 0x00, 0x28, 0x82, 0x33, 0x2d, 0xca, 0x91, 0x68, 0x80, 0xcd, 0x32, 0x90, + 0x89, 0x28, 0x07, 0xab, 0x80, 0x31, 0x88, 0x1a, 0xd4, 0x98, 0x4b, 0x93, 0x25, 0xdc, 0x3a, 0x03, + 0xa9, 0x59, 0xa1, 0xb8, 0x39, 0x12, 0xb1, 0x9c, 0x37, 0x99, 0xab, 0x00, 0x33, 0xbb, 0x24, 0x90, + 0x39, 0xf8, 0x68, 0x98, 0x29, 0x97, 0x1a, 0x98, 0x0b, 0x94, 0x38, 0x99, 0xd0, 0x59, 0x82, 0x0b, + 0xda, 0x42, 0x09, 0xa3, 0xac, 0x30, 0x86, 0x08, 0x39, 0x99, 0xe3, 0x39, 0x92, 0x1f, 0x84, 0x09, + 0x90, 0x0d, 0x23, 0xac, 0x01, 0x19, 0x83, 0x1b, 0x11, 0xf8, 0x0b, 0x49, 0x07, 0x9d, 0x21, 0x00, + 0x98, 0x1a, 0x84, 0x0a, 0x93, 0x8d, 0x12, 0xa9, 0x38, 0xb5, 0x2d, 0x12, 0x90, 0xc0, 0x1c, 0x03, + 0x8f, 0x80, 0x40, 0x08, 0x82, 0x8d, 0x93, 0x8b, 0x31, 0x34, 0xfa, 0x20, 0x89, 0x01, 0xb2, 0x7b, + 0xb2, 0x3b, 0xf0, 0x08, 0x02, 0x38, 0xc8, 0x39, 0xa1, 0x69, 0xb2, 0x49, 0xb9, 0xcb, 0x71, 0xd3, + 0x18, 0x18, 0x28, 0xd1, 0x88, 0x39, 0x91, 0xab, 0x45, 0xb9, 0x28, 0x03, 0x98, 0xbc, 0x73, 0x91, + 0xcb, 0x81, 0x71, 0xb8, 0x20, 0x80, 0xb8, 0x0c, 0x26, 0xc0, 0x10, 0x89, 0x05, 0xbc, 0x50, 0xa8, + 0x01, 0x90, 0x00, 0xba, 0x28, 0x04, 0x20, 0xac, 0x41, 0xb8, 0x99, 0x53, 0x90, 0xa9, 0x08, 0x42, + 0xd1, 0x4c, 0x84, 0x88, 0x9d, 0x22, 0xb0, 0x2a, 0x06, 0x9a, 0x10, 0x1a, 0x83, 0x0c, 0xda, 0x29, + 0xa6, 0x7a, 0xb1, 0x1b, 0x83, 0x71, 0xb1, 0x8c, 0x82, 0x18, 0xc8, 0x40, 0xc2, 0x3a, 0x02, 0x81, + 0xca, 0x2a, 0x05, 0x98, 0x9b, 0x22, 0xa1, 0x58, 0x04, 0xfa, 0x29, 0x28, 0xe8, 0x10, 0x1a, 0x42, + 0xf0, 0x38, 0xa8, 0x81, 0x29, 0x91, 0x12, 0xbd, 0x30, 0x91, 0x0a, 0x12, 0x14, 0xf9, 0x3a, 0xd0, + 0x68, 0x90, 0x81, 0x8a, 0x0a, 0x86, 0x89, 0x11, 0xb9, 0x09, 0x23, 0x0d, 0xa5, 0x2b, 0x82, 0x29, + 0xcb, 0x01, 0x09, 0x9a, 0x47, 0x98, 0x9a, 0x8a, 0x86, 0x2b, 0x96, 0x1b, 0x21, 0xf9, 0x42, 0xa0, + 0x8b, 0x20, 0x86, 0x8d, 0x81, 0x39, 0xc2, 0x0a, 0x10, 0x19, 0x13, 0xa1, 0xbb, 0x8e, 0x27, 0x8a, + 0x88, 0xaa, 0x44, 0x98, 0x1c, 0x90, 0x25, 0x89, 0x01, 0xeb, 0x21, 0x03, 0xba, 0x28, 0x9d, 0x26, + 0x90, 0xbb, 0x20, 0x19, 0xe1, 0x38, 0xab, 0x26, 0x8a, 0x91, 0x9e, 0x12, 0x33, 0x20, 0xe1, 0x9b, + 0x81, 0x49, 0x95, 0x0a, 0x81, 0x00, 0xbb, 0x1c, 0x35, 0x94, 0x99, 0x0e, 0xa8, 0x02, 0x72, 0xa1, + 0xbb, 0x68, 0x91, 0x8b, 0x92, 0x21, 0x3b, 0xd1, 0xb2, 0x1b, 0x1b, 0x47, 0xa0, 0xac, 0x20, 0x24, + 0xca, 0x28, 0xa3, 0xbc, 0x29, 0xa2, 0x21, 0x04, 0x3d, 0x95, 0x9a, 0x19, 0x38, 0xb5, 0x2c, 0x86, + 0xbb, 0x41, 0x82, 0x09, 0x00, 0xc8, 0x8d, 0x03, 0x18, 0x19, 0xaa, 0xa4, 0x73, 0x9a, 0x11, 0x13, + 0xfc, 0x00, 0x0a, 0xb2, 0x74, 0xa0, 0x18, 0x8a, 0x02, 0x11, 0xac, 0x31, 0xc1, 0x1c, 0x24, 0xac, + 0x10, 0x00, 0x93, 0x9f, 0x83, 0x30, 0xf9, 0x1a, 0x22, 0x81, 0x1a, 0x38, 0xc3, 0x8e, 0x13, 0xa8, + 0x0a, 0x24, 0x90, 0x9d, 0x94, 0x9a, 0x48, 0xa1, 0x39, 0xb4, 0x8f, 0x43, 0xc9, 0x18, 0x80, 0x0a, + 0x05, 0x9a, 0x30, 0x96, 0x0c, 0x28, 0xe3, 0x29, 0x90, 0x80, 0x0a, 0x12, 0x89, 0x80, 0x57, 0xdb, + 0x10, 0x19, 0xb2, 0x1e, 0x92, 0x08, 0x33, 0x9f, 0x05, 0x0a, 0x80, 0x11, 0x90, 0x9a, 0x10, 0xaa, + 0x04, 0x50, 0xc3, 0x1c, 0x93, 0x2a, 0xf9, 0x48, 0x80, 0x9a, 0x18, 0x15, 0x98, 0x8b, 0x16, 0x9a, + 0x00, 0xa1, 0x45, 0x9e, 0x91, 0x00, 0x00, 0x29, 0x86, 0x8a, 0x88, 0xa8, 0x50, 0x92, 0x0b, 0x94, + 0x8b, 0x18, 0x22, 0xfb, 0x79, 0x90, 0x19, 0xc0, 0x28, 0x91, 0x92, 0x2a, 0x0a, 0xb0, 0x46, 0xaa, + 0x32, 0xbd, 0x41, 0x03, 0xbc, 0x09, 0x11, 0x88, 0xd0, 0x0d, 0x16, 0x49, 0xc2, 0x8b, 0x10, 0xa0, + 0x11, 0x1b, 0x86, 0x9c, 0x14, 0xaa, 0x03, 0x0d, 0x14, 0xaa, 0x89, 0x9a, 0x16, 0x2b, 0x95, 0x8b, + 0x40, 0xb2, 0x8a, 0x9c, 0x44, 0xa8, 0x38, 0xdc, 0x51, 0x09, 0x92, 0x09, 0xa8, 0x38, 0xc0, 0x24, + 0x0c, 0xa0, 0x40, 0xa9, 0x90, 0x86, 0x0c, 0x90, 0x91, 0x1a, 0x94, 0x2a, 0xf2, 0x20, 0x31, 0x90, + 0xd1, 0x2b, 0x91, 0x00, 0x88, 0x07, 0x8b, 0xa0, 0x03, 0xae, 0x31, 0x80, 0x05, 0x8d, 0xa1, 0x59, + 0xd9, 0x20, 0x80, 0x91, 0x08, 0xb1, 0xbf, 0x55, 0x80, 0xba, 0x28, 0x01, 0x90, 0x89, 0x44, 0xdb, + 0x12, 0x29, 0xb0, 0x9c, 0x24, 0x09, 0xea, 0x29, 0x03, 0x9c, 0x02, 0x82, 0xab, 0x30, 0x95, 0x0d, + 0x82, 0x08, 0x13, 0xff, 0x20, 0x03, 0xba, 0x21, 0xa9, 0x00, 0x90, 0x29, 0xb8, 0x41, 0x50, 0xa1, + 0xac, 0x35, 0xa1, 0x2b, 0xe3, 0x8b, 0xa8, 0x50, 0xb2, 0x38, 0xa8, 0x17, 0xa9, 0xcb, 0x15, 0x99, + 0x19, 0x14, 0xa9, 0x8c, 0x43, 0xd8, 0x09, 0x12, 0xa0, 0xca, 0x03, 0x48, 0x82, 0x0b, 0x57, 0x9e, + 0x00, 0x10, 0x82, 0x8b, 0x83, 0x9d, 0x01, 0x10, 0x00, 0x8d, 0x04, 0x0f, 0x02, 0x99, 0x00, 0x21, + 0xda, 0x18, 0xb0, 0x21, 0x03, 0xba, 0x80, 0x1d, 0x17, 0x0a, 0x90, 0x19, 0x08, 0x01, 0xdb, 0x19, + 0x38, 0x3a, 0xa6, 0x91, 0xaf, 0x13, 0x2a, 0xc0, 0x1c, 0x85, 0x18, 0x18, 0xdb, 0x30, 0xa3, 0x38, + 0xbe, 0x10, 0x21, 0xb1, 0x12, 0x9f, 0x02, 0x9b, 0x47, 0xbb, 0x21, 0x09, 0xa8, 0x99, 0x25, 0xbc, + 0x35, 0xab, 0xc2, 0x28, 0x81, 0x10, 0xa8, 0x88, 0x20, 0xb9, 0x07, 0x0d, 0x90, 0x09, 0x40, 0x99, + 0x90, 0x01, 0x9b, 0xfb, 0x32, 0x1c, 0x59, 0xb3, 0xbb, 0x6b, 0x1a, 0x05, 0xbb, 0xb1, 0x6a, 0xc2, + 0x21, 0x9a, 0x82, 0x8d, 0x21, 0xa3, 0xc8, 0x0c, 0x61, 0xb9, 0x18, 0x0a, 0x20, 0xab, 0x28, 0x92, + 0x0c, 0x26, 0x09, 0xdb, 0x29, 0x84, 0x8e, 0x00, 0x08, 0x48, 0xa3, 0xbd, 0x20, 0x2b, 0x04, 0xba, + 0x18, 0x0a, 0x84, 0x2e, 0xb0, 0x8c, 0x42, 0x81, 0x9c, 0xbb, 0x7b, 0x81, 0x12, 0x8c, 0x09, 0x49, + 0xa1, 0xa0, 0x81, 0x9e, 0x33, 0x0c, 0xc1, 0x38, 0x29, 0xba, 0xa2, 0x3b, 0x8d, 0x29, 0x50, 0xbb, + 0x93, 0xd2, 0x19, 0x3a, 0x0a, 0x70, 0xb9, 0x92, 0x0b, 0x08, 0x11, 0x32, 0x8f, 0x09, 0x90, 0xa3, + 0xf2, 0xb2, 0x90, 0x00, 0x02, 0xf9, 0x88, 0x70, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, + 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x7f, 0xf3, 0x5a, 0x74, 0xda, 0x32, 0x29, 0xb5, + 0x2d, 0x06, 0x0a, 0x47, 0x2a, 0xf8, 0x1a, 0x81, 0x81, 0x28, 0xf0, 0x29, 0xb0, 0x5a, 0x03, 0xbb, + 0x60, 0xa2, 0xab, 0x0a, 0x05, 0x89, 0x20, 0x07, 0xbb, 0x21, 0x11, 0xce, 0x33, 0x8b, 0xb5, 0x5d, + 0xb2, 0x1b, 0x11, 0x82, 0xab, 0x31, 0xc1, 0x0a, 0x54, 0xf8, 0x28, 0xb1, 0x3a, 0x91, 0x13, 0x2c, + 0xb6, 0x8d, 0x43, 0xb9, 0x81, 0x30, 0xda, 0x11, 0x2a, 0xb4, 0x3a, 0x98, 0x04, 0x3b, 0xc0, 0x90, + 0x90, 0x1f, 0x07, 0x8c, 0x10, 0xa1, 0x3a, 0xa2, 0xaa, 0x50, 0xa3, 0x1b, 0xd8, 0x41, 0x0b, 0x87, + 0x0d, 0x82, 0x08, 0x20, 0xa0, 0x1a, 0xb2, 0x41, 0x1b, 0xb3, 0x6a, 0xb0, 0x59, 0xc1, 0x00, 0x8c, + 0x99, 0x24, 0x9b, 0x13, 0x89, 0xce, 0x53, 0xa8, 0x10, 0xaa, 0x24, 0x8b, 0xa3, 0x4a, 0x83, 0x08, + 0xba, 0x07, 0x8f, 0x12, 0x12, 0xbe, 0x22, 0x40, 0xd9, 0x00, 0x20, 0xa9, 0x83, 0xaa, 0x30, 0xdd, + 0xea, 0x1c, 0x26, 0x28, 0xc1, 0x1a, 0x82, 0xc9, 0x50, 0x01, 0xc8, 0x29, 0x81, 0x12, 0x9e, 0x85, + 0x38, 0x9c, 0x05, 0x28, 0xcb, 0x41, 0xa0, 0x8b, 0x32, 0x90, 0x92, 0x0f, 0x05, 0x9c, 0x12, 0x0a, + 0x12, 0xbd, 0x23, 0xca, 0x9a, 0x45, 0xb8, 0x89, 0x11, 0x19, 0xf0, 0x29, 0x10, 0xcc, 0x52, 0x81, + 0xbb, 0x40, 0x93, 0x0c, 0x88, 0x02, 0x0a, 0x41, 0xa4, 0x0e, 0x82, 0x19, 0x03, 0xfb, 0x5a, 0x02, + 0xca, 0x30, 0xa8, 0x88, 0x61, 0x00, 0xfb, 0x32, 0x98, 0x80, 0x89, 0x02, 0x62, 0xfb, 0x38, 0x81, + 0x88, 0x20, 0xb1, 0x0c, 0x15, 0x1c, 0xa1, 0x99, 0x38, 0x03, 0xbc, 0x12, 0x21, 0xe8, 0x78, 0xd1, + 0x29, 0x81, 0xa8, 0x10, 0xc9, 0x5a, 0x00, 0xa2, 0x19, 0x80, 0x88, 0xaa, 0x00, 0x17, 0xab, 0x30, + 0x00, 0xf1, 0x7b, 0xb2, 0x08, 0x0b, 0xd2, 0x70, 0xa8, 0x20, 0x98, 0x21, 0x8e, 0x94, 0x9a, 0x32, + 0x98, 0x88, 0xfa, 0x42, 0x80, 0xa8, 0x33, 0xcd, 0x20, 0x01, 0xa1, 0x2c, 0xa3, 0x20, 0xaf, 0x85, + 0x38, 0xa0, 0xb8, 0x4a, 0xb4, 0x69, 0xa0, 0x09, 0x08, 0x82, 0x08, 0xc1, 0x1b, 0x83, 0x40, 0xcb, + 0x32, 0xf9, 0x59, 0xd8, 0x21, 0x89, 0x02, 0x2a, 0xd0, 0x88, 0x68, 0xa0, 0x89, 0x13, 0x1b, 0xc3, + 0x19, 0xab, 0x37, 0x0b, 0xb8, 0x24, 0xae, 0x51, 0x91, 0xba, 0x62, 0x89, 0x90, 0x08, 0x01, 0x08, + 0x98, 0x00, 0xf1, 0x5a, 0x02, 0xc8, 0x38, 0x88, 0xa1, 0x5d, 0xb3, 0x0b, 0x48, 0xb9, 0x14, 0xb8, + 0x49, 0xa2, 0xab, 0x69, 0xa1, 0x0a, 0x45, 0xc0, 0xab, 0x62, 0xb8, 0x19, 0x14, 0x9c, 0x32, 0xcb, + 0x24, 0xab, 0x29, 0x85, 0x89, 0x08, 0xa8, 0x23, 0x0e, 0x04, 0xac, 0x62, 0xb8, 0x21, 0xab, 0x28, + 0x05, 0x99, 0x9b, 0x16, 0x0a, 0x81, 0x93, 0x9f, 0x12, 0x91, 0x2c, 0x94, 0xaa, 0x32, 0xb4, 0x0f, + 0x81, 0x10, 0x88, 0x89, 0x48, 0xa0, 0x14, 0x8d, 0xa0, 0x20, 0x2a, 0x14, 0xcb, 0x11, 0x89, 0x05, + 0x8e, 0x01, 0x91, 0x20, 0xb8, 0x0b, 0x06, 0x0c, 0x05, 0x9b, 0x28, 0x99, 0x05, 0x09, 0x8c, 0x04, + 0x89, 0x80, 0xa8, 0x44, 0x8b, 0x90, 0xb6, 0x2f, 0x83, 0x8a, 0x22, 0xc8, 0x8c, 0x35, 0xc9, 0x20, + 0xa8, 0x12, 0xbb, 0x31, 0xa1, 0x0b, 0x12, 0x38, 0xf4, 0x2e, 0x24, 0xdb, 0x28, 0x22, 0xdd, 0x33, + 0x9a, 0x00, 0xa0, 0x48, 0xb1, 0x09, 0x08, 0x35, 0xaf, 0x33, 0x9b, 0xa1, 0x30, 0xa1, 0x8d, 0x82, + 0x42, 0xba, 0xa1, 0x61, 0xbb, 0x15, 0x0a, 0x80, 0x0a, 0x15, 0xca, 0x00, 0x4a, 0xd3, 0x29, 0x93, + 0x2c, 0xd3, 0x4a, 0xa0, 0x29, 0x91, 0x32, 0xaf, 0x22, 0xa8, 0x10, 0x03, 0x8f, 0x92, 0x28, 0x99, + 0x21, 0xbd, 0x27, 0x8c, 0x00, 0x82, 0x8b, 0xa2, 0x38, 0x98, 0xb8, 0x46, 0xaa, 0x00, 0x2b, 0x86, + 0x98, 0x3c, 0xf3, 0x38, 0x98, 0x84, 0x8d, 0x03, 0x09, 0x88, 0xa0, 0x78, 0xc2, 0x2a, 0x91, 0x89, + 0x81, 0x71, 0xf0, 0x28, 0x08, 0x80, 0x98, 0x28, 0xa3, 0x1b, 0xc0, 0x48, 0xa1, 0x6a, 0xb1, 0x91, + 0x3b, 0x91, 0x82, 0x0c, 0x15, 0x9d, 0x82, 0x1b, 0x40, 0xf3, 0x39, 0x88, 0x18, 0xc2, 0x4a, 0x98, + 0x82, 0x0a, 0xa9, 0x13, 0x0e, 0x17, 0x8b, 0x94, 0x89, 0x0b, 0x03, 0x01, 0x1d, 0xa5, 0x2a, 0xd0, + 0x58, 0x81, 0x9a, 0x22, 0xad, 0x33, 0xbb, 0x10, 0x14, 0x9d, 0x42, 0xc0, 0x19, 0x82, 0xbb, 0x32, + 0x83, 0x1b, 0xd3, 0xad, 0x36, 0xaa, 0x89, 0x05, 0x99, 0x59, 0xa3, 0x8f, 0x22, 0xb8, 0x5b, 0xa2, + 0x89, 0x40, 0xa2, 0x9c, 0x10, 0x20, 0x0a, 0x96, 0x8a, 0x19, 0x03, 0x1b, 0x98, 0x0a, 0x57, 0xda, + 0x09, 0x12, 0x10, 0xb1, 0x0b, 0x01, 0xba, 0x64, 0xb0, 0x2b, 0xb0, 0x72, 0xb1, 0x0b, 0x83, 0x10, + 0x9a, 0x90, 0x3f, 0x97, 0x1b, 0x82, 0xa8, 0x38, 0x1b, 0xa7, 0x28, 0x9f, 0x15, 0x89, 0x9a, 0x15, + 0x9a, 0x09, 0x15, 0x9d, 0x11, 0x11, 0xab, 0x12, 0x08, 0x99, 0x0a, 0x27, 0xaa, 0x09, 0x00, 0x20, + 0xf1, 0x09, 0x73, 0xc9, 0x19, 0x05, 0x8c, 0x81, 0x12, 0xaa, 0x8a, 0x45, 0xc9, 0x08, 0x21, 0xb1, + 0x0a, 0x00, 0x33, 0xaf, 0x13, 0x09, 0xb0, 0x49, 0x20, 0xf3, 0x0c, 0x13, 0x98, 0x88, 0x31, 0xa9, + 0x8b, 0x37, 0xeb, 0x20, 0x10, 0xd0, 0x4b, 0xb4, 0x38, 0xa9, 0x90, 0x21, 0xd8, 0x38, 0x13, 0xea, + 0x2a, 0x85, 0x99, 0x0b, 0x17, 0xb8, 0x29, 0x90, 0x84, 0x8c, 0x12, 0xa0, 0x98, 0x3a, 0x07, 0xbc, + 0x43, 0xa9, 0x30, 0x90, 0xb8, 0x5a, 0xa5, 0x0c, 0x94, 0x8a, 0x41, 0xe8, 0x51, 0xa9, 0x08, 0x10, + 0xb1, 0x19, 0x19, 0x23, 0xca, 0x39, 0x03, 0xcd, 0x41, 0x81, 0x8b, 0x80, 0x23, 0x8a, 0x9f, 0x15, + 0x9b, 0x12, 0xb2, 0x3b, 0x00, 0xa4, 0x8e, 0x02, 0x29, 0xd0, 0x91, 0x7a, 0xb0, 0x80, 0x41, 0x9a, + 0xa0, 0x12, 0x38, 0xdc, 0x41, 0xa3, 0x9f, 0x42, 0xb0, 0x20, 0x98, 0x99, 0x62, 0xf8, 0x59, 0xa8, + 0x11, 0x89, 0x02, 0x9c, 0x21, 0x01, 0xc9, 0x30, 0xb1, 0x1a, 0x08, 0x03, 0x80, 0x9d, 0x54, 0xe9, + 0x39, 0x92, 0x09, 0x88, 0x01, 0x18, 0xca, 0x71, 0x81, 0xab, 0x98, 0x64, 0xcb, 0x41, 0x98, 0xa8, + 0x51, 0xb0, 0x09, 0x01, 0x88, 0x81, 0xbc, 0x65, 0xa8, 0x28, 0xb8, 0x20, 0xc8, 0x31, 0xa0, 0xa8, + 0x7a, 0xa5, 0x9a, 0x30, 0x19, 0xd1, 0x30, 0x98, 0x98, 0x39, 0xc0, 0x12, 0x0c, 0x09, 0x27, 0x9e, + 0x42, 0xb8, 0x08, 0x2a, 0x93, 0xba, 0x71, 0xa1, 0x18, 0xa0, 0xab, 0x75, 0xc8, 0x28, 0x88, 0x09, + 0x82, 0x91, 0x38, 0xae, 0x22, 0x18, 0xf9, 0x58, 0x90, 0x80, 0xaa, 0x32, 0x00, 0x09, 0xd3, 0x69, + 0xa9, 0x11, 0xb1, 0x0c, 0x08, 0x37, 0xca, 0x19, 0x02, 0x08, 0xb2, 0x2f, 0x91, 0x80, 0x28, 0x03, + 0xcf, 0x22, 0x02, 0x9c, 0x91, 0x50, 0xa8, 0x18, 0x91, 0xba, 0x52, 0x99, 0xa1, 0x38, 0x18, 0xc4, + 0x3b, 0x08, 0xc7, 0x3e, 0x94, 0x8a, 0x18, 0x82, 0x98, 0x09, 0x22, 0xc9, 0x81, 0x61, 0xc9, 0x80, + 0x12, 0x2a, 0xf0, 0x29, 0x91, 0x93, 0x2b, 0x00, 0xf4, 0x3b, 0x12, 0xd1, 0x1d, 0x14, 0xaa, 0x21, + 0xbb, 0x43, 0xa8, 0x00, 0x11, 0xa9, 0x18, 0x38, 0x92, 0x87, 0xaf, 0x33, 0x8b, 0x85, 0x0d, 0x92, + 0x3a, 0xb0, 0x29, 0x84, 0x0a, 0x18, 0xc3, 0x18, 0x2c, 0x96, 0xab, 0x18, 0x34, 0xb8, 0x81, 0xbc, + 0x70, 0xb9, 0x24, 0x08, 0xc9, 0x30, 0x90, 0x9d, 0x05, 0x8a, 0x52, 0xd1, 0x8a, 0x42, 0xd0, 0x3a, + 0x95, 0x8b, 0x31, 0xe8, 0x58, 0xa0, 0x19, 0x18, 0x92, 0x9b, 0x32, 0x99, 0x88, 0xc8, 0x51, 0x19, + 0xc1, 0x1a, 0x63, 0xf8, 0x39, 0x92, 0xaa, 0x51, 0xa8, 0x02, 0x98, 0x1a, 0x91, 0x0a, 0x11, 0x27, + 0xbe, 0x63, 0xb8, 0x09, 0x00, 0x82, 0x0b, 0x04, 0xb9, 0x01, 0x40, 0xa0, 0xba, 0x78, 0xb0, 0x50, + 0xc0, 0x29, 0x91, 0x1b, 0x96, 0x1a, 0x88, 0x83, 0x48, 0xfb, 0x20, 0x10, 0xc0, 0x49, 0xa0, 0x00, + 0x10, 0x99, 0xc3, 0x4c, 0x92, 0xb8, 0x78, 0xb2, 0x1d, 0x94, 0x1a, 0xa8, 0x23, 0xab, 0x15, 0xba, + 0x88, 0x13, 0x0b, 0x86, 0x3a, 0xf1, 0x3a, 0x11, 0xc2, 0x0c, 0x21, 0xf8, 0x50, 0xa8, 0x08, 0x22, + 0xbb, 0x01, 0x00, 0x98, 0x2c, 0x07, 0x8c, 0x11, 0x90, 0x81, 0x8e, 0x14, 0x99, 0x20, 0xb0, 0x8a, + 0x40, 0x11, 0xc2, 0x0b, 0x38, 0x05, 0xb9, 0x49, 0xcc, 0x25, 0xb8, 0x3a, 0x86, 0x0d, 0x12, 0xb8, + 0x8b, 0x24, 0xb1, 0x2a, 0xa3, 0x89, 0x39, 0x80, 0x94, 0xbc, 0x49, 0x31, 0xf3, 0x0d, 0x42, 0xe0, + 0x28, 0x90, 0x81, 0x1a, 0x02, 0xc8, 0x0a, 0x02, 0x58, 0xd1, 0x39, 0x92, 0x0e, 0x03, 0xa9, 0x8b, + 0x25, 0xb0, 0x1c, 0x06, 0x0c, 0x01, 0x91, 0x2b, 0xa0, 0x1a, 0x03, 0x82, 0x0e, 0x82, 0x9b, 0x12, + 0x19, 0x13, 0x60, 0xf4, 0x2e, 0x92, 0xa8, 0x49, 0x94, 0x0d, 0x03, 0x0b, 0x01, 0xa0, 0x08, 0x20, + 0xc9, 0x00, 0x33, 0xaf, 0x16, 0x9a, 0x08, 0x11, 0x88, 0x1a, 0xa6, 0x0e, 0x23, 0xc8, 0x19, 0x00, + 0x90, 0x20, 0xa1, 0x0d, 0x85, 0xaa, 0x20, 0x05, 0xac, 0x33, 0xc9, 0x88, 0x42, 0xc9, 0x83, 0x39, + 0xea, 0x33, 0xbd, 0x42, 0x92, 0x0b, 0x01, 0xc2, 0x2d, 0x11, 0xb0, 0x29, 0xa1, 0x1c, 0x84, 0x00, + 0x8b, 0x20, 0xb5, 0x3d, 0xc3, 0x0c, 0x31, 0xe2, 0x2b, 0x93, 0x8b, 0x72, 0xd1, 0x28, 0xb0, 0x28, + 0x80, 0x81, 0x19, 0xa8, 0x23, 0x9a, 0xa9, 0x10, 0x74, 0xd8, 0x02, 0x08, 0xaf, 0x14, 0xb8, 0x4c, + 0x83, 0x09, 0xa9, 0x31, 0xa8, 0x99, 0x03, 0x1e, 0x86, 0x99, 0x38, 0xb3, 0x8c, 0x43, 0xfa, 0x21, + 0x99, 0x12, 0xb1, 0x1d, 0x05, 0xab, 0x12, 0x3a, 0xd0, 0x31, 0xc8, 0x39, 0xa1, 0xa1, 0x8f, 0x05, + 0x19, 0xa8, 0x93, 0x2e, 0xb3, 0x29, 0x81, 0x8d, 0x07, 0x1a, 0xb0, 0xa8, 0x58, 0xa2, 0x19, 0x08, + 0xa2, 0x9b, 0x73, 0xc1, 0x1b, 0x14, 0xda, 0x40, 0x90, 0x88, 0x05, 0x8d, 0x03, 0x8a, 0x11, 0x80, + 0x8b, 0x84, 0x0c, 0xc2, 0x79, 0xc3, 0x19, 0x02, 0xcb, 0x31, 0xa1, 0x0b, 0x18, 0xf3, 0x4a, 0xc2, + 0x38, 0x88, 0xc0, 0x39, 0x81, 0x8b, 0x13, 0x30, 0xad, 0x87, 0x1c, 0x93, 0x98, 0x8a, 0x21, 0xc0, + 0x38, 0x81, 0x9c, 0x36, 0xad, 0x22, 0xe3, 0x3a, 0xa1, 0x91, 0x1c, 0x80, 0x61, 0xc0, 0x18, 0x00, + 0x92, 0x89, 0xa0, 0x3c, 0xa7, 0x4a, 0xc1, 0x18, 0x91, 0x28, 0x83, 0xaf, 0x24, 0xa8, 0x20, 0xa8, + 0x08, 0x1a, 0xa5, 0x4a, 0xa4, 0x8d, 0x33, 0xc9, 0x18, 0x82, 0x0b, 0x92, 0x8c, 0x13, 0x0b, 0x89, + 0x25, 0xf8, 0x1f, 0x05, 0xa8, 0x0b, 0x13, 0xca, 0x28, 0x07, 0x8c, 0x02, 0x98, 0x00, 0xc9, 0x50, + 0x80, 0x90, 0x2b, 0x86, 0x8c, 0x12, 0x09, 0xca, 0x31, 0x81, 0x91, 0x8d, 0x22, 0x12, 0xaf, 0x16, + 0x9b, 0x20, 0x81, 0x89, 0x89, 0x41, 0x98, 0xb0, 0x69, 0xa0, 0x51, 0xb8, 0x08, 0x98, 0x31, 0x18, + 0xf0, 0x2b, 0x32, 0xdc, 0x13, 0xab, 0x55, 0xb8, 0x81, 0x8b, 0x89, 0x24, 0x90, 0x9b, 0x02, 0x9c, + 0x36, 0xba, 0x80, 0x00, 0x18, 0x91, 0xac, 0x01, 0x75, 0xd0, 0x29, 0xa1, 0x40, 0xd8, 0x20, 0xab, + 0x32, 0x81, 0x0a, 0xb4, 0x2b, 0x46, 0xf8, 0x29, 0x98, 0x28, 0x22, 0xb9, 0x1b, 0x93, 0x12, 0x82, + 0x1e, 0xd8, 0x38, 0x24, 0xbc, 0x38, 0x80, 0x57, 0xbe, 0x23, 0x08, 0xa0, 0x18, 0xa9, 0x93, 0x3c, + 0x07, 0xab, 0x29, 0x92, 0x31, 0xcd, 0x20, 0x83, 0x8c, 0x22, 0xdb, 0x00, 0x20, 0xb0, 0x0a, 0xba, + 0x77, 0xb0, 0x19, 0x08, 0x90, 0x88, 0x36, 0xfb, 0x28, 0x92, 0x88, 0x89, 0x10, 0x89, 0x24, 0xac, + 0x92, 0x8b, 0x27, 0xa9, 0x09, 0x29, 0x07, 0x9b, 0x21, 0xcc, 0x43, 0x82, 0x9b, 0x00, 0x88, 0x50, + 0x04, 0xae, 0x12, 0x08, 0x00, 0x30, 0xfa, 0x39, 0x85, 0x9b, 0x28, 0x22, 0xc0, 0x59, 0xd9, 0x20, + 0x80, 0x02, 0xca, 0x0a, 0x14, 0x19, 0xa0, 0x88, 0x80, 0x90, 0x4d, 0xc1, 0x8a, 0x42, 0x91, 0x1c, + 0xfb, 0x44, 0xba, 0x10, 0xb1, 0x29, 0x10, 0x80, 0x93, 0xcf, 0x44, 0xa8, 0x9c, 0x42, 0xa0, 0x80, + 0x11, 0xbc, 0x32, 0x98, 0x60, 0xb2, 0x9e, 0x31, 0x92, 0xbc, 0x42, 0x91, 0x89, 0x41, 0xc9, 0x00, + 0x13, 0x0d, 0x80, 0x9c, 0x55, 0xa0, 0x9b, 0x42, 0xc8, 0x59, 0x90, 0x89, 0x20, 0xa3, 0x8c, 0x10, + 0xd9, 0x42, 0x98, 0x9a, 0x51, 0xb3, 0x3b, 0x94, 0xcc, 0x42, 0x91, 0x0c, 0x93, 0x2b, 0x90, 0x20, + 0x99, 0x31, 0xb3, 0x8f, 0x13, 0xae, 0x34, 0xa8, 0x0d, 0x13, 0xbb, 0x27, 0x9b, 0xb0, 0x53, 0xaa, + 0x13, 0x9c, 0x42, 0xa8, 0x01, 0x90, 0x9f, 0x82, 0x22, 0x00, 0xaf, 0x14, 0x98, 0x00, 0x08, 0xb1, + 0x1b, 0x0a, 0x17, 0xab, 0x30, 0x14, 0xdd, 0x38, 0x03, 0xdb, 0x43, 0xbb, 0x01, 0x39, 0x04, 0xc8, + 0x9a, 0x70, 0xb0, 0x18, 0x01, 0x8d, 0x13, 0x01, 0xa8, 0x0f, 0x85, 0x09, 0x99, 0xa3, 0x7a, 0xb1, + 0x21, 0xba, 0xb1, 0x70, 0xa2, 0x8a, 0x00, 0x61, 0xd9, 0x11, 0x89, 0xc2, 0x51, 0xa9, 0x92, 0x0b, + 0x44, 0xb0, 0x8c, 0x32, 0x98, 0x0a, 0x88, 0x22, 0xba, 0x30, 0x91, 0xcd, 0x43, 0x42, 0xcb, 0xa8, + 0x50, 0xc9, 0x22, 0xb9, 0xaa, 0x37, 0x9b, 0x94, 0xa0, 0x0e, 0x13, 0x0c, 0x01, 0x00, 0x0c, 0x13, + 0xd8, 0x1c, 0x06, 0x9a, 0x28, 0xb2, 0x29, 0x03, 0x0e, 0x86, 0x8c, 0x10, 0x83, 0x9a, 0x30, 0xf8, + 0x20, 0x08, 0x82, 0x1c, 0x92, 0x28, 0x9f, 0x93, 0x4a, 0x13, 0xea, 0x38, 0xb3, 0x0f, 0x03, 0x88, + 0x0b, 0x11, 0x93, 0x0e, 0x11, 0x90, 0x91, 0x8b, 0x86, 0x8a, 0x00, 0x25, 0xcc, 0x30, 0xa2, 0x8b, + 0x00, 0x68, 0xb0, 0x0b, 0x33, 0x8b, 0xf2, 0x49, 0x93, 0x0e, 0x02, 0x89, 0x99, 0x40, 0x81, 0xb0, + 0x4b, 0xb1, 0x20, 0xb0, 0x50, 0x88, 0x9a, 0x27, 0x9f, 0x93, 0x29, 0x12, 0xba, 0x92, 0x3c, 0xd0, + 0x11, 0x08, 0x88, 0x27, 0xcb, 0x09, 0x31, 0x93, 0x3b, 0xf8, 0x31, 0x8f, 0x84, 0x19, 0x89, 0x01, + 0x59, 0xf8, 0x20, 0x88, 0x80, 0x29, 0xb5, 0x1e, 0x82, 0x91, 0x28, 0xda, 0x32, 0xa9, 0x29, 0xa3, + 0x20, 0x9f, 0x85, 0x0a, 0x0a, 0x83, 0x02, 0x1e, 0xb2, 0x29, 0x20, 0xdb, 0x15, 0x8d, 0x83, 0x80, + 0x09, 0x98, 0x44, 0x9a, 0xd1, 0x48, 0xb9, 0x42, 0xb0, 0x30, 0xcb, 0x28, 0x16, 0xab, 0x10, 0x30, + 0xea, 0x13, 0x0c, 0x98, 0x07, 0x89, 0x89, 0x91, 0x29, 0x23, 0xcc, 0x08, 0x83, 0x51, 0xda, 0x13, + 0x1a, 0xb9, 0x94, 0x4a, 0xb2, 0x2c, 0x97, 0x0b, 0x08, 0x83, 0x2b, 0x81, 0xc2, 0x0a, 0x88, 0x64, + 0xe8, 0x18, 0x88, 0x95, 0x2b, 0x80, 0xa0, 0x48, 0x02, 0x90, 0xbb, 0x79, 0x95, 0x8d, 0x90, 0x12, + 0x09, 0x83, 0x89, 0x1d, 0x95, 0x0b, 0x13, 0x8f, 0x82, 0x21, 0x9d, 0x11, 0x38, 0xc1, 0x1a, 0x00, + 0xb0, 0x70, 0xd2, 0x3a, 0xb8, 0x43, 0x81, 0xbc, 0x42, 0xc0, 0x18, 0x82, 0x9d, 0x20, 0x85, 0x29, + 0xda, 0x20, 0x80, 0x02, 0x8c, 0x18, 0xe0, 0x48, 0x88, 0xa2, 0x4b, 0x13, 0xe8, 0x3b, 0xa3, 0x4a, + 0xe1, 0x30, 0xbb, 0x22, 0x11, 0x29, 0xf0, 0x5a, 0xa0, 0x30, 0xb9, 0x33, 0xbf, 0x06, 0x09, 0xc8, + 0x30, 0x92, 0x00, 0x0a, 0xb1, 0x01, 0x59, 0xc2, 0x8d, 0xa3, 0x70, 0xa9, 0x80, 0x10, 0xa0, 0x48, + 0xa9, 0x80, 0x69, 0x94, 0x8b, 0xb0, 0x38, 0x52, 0x9a, 0xc0, 0x38, 0x13, 0xae, 0xa3, 0x1c, 0x24, + 0xa1, 0x9c, 0x02, 0x0a, 0x84, 0x40, 0xfb, 0x89, 0x52, 0x8b, 0x95, 0x2b, 0x92, 0x00, 0x8b, 0x02, + 0xaa, 0x55, 0xa9, 0xa0, 0x4b, 0x11, 0xa4, 0x8f, 0x04, 0x09, 0x80, 0x18, 0xc0, 0x09, 0x33, 0xbc, + 0x01, 0x18, 0x02, 0xc3, 0x1f, 0x86, 0x9b, 0x12, 0x20, 0x9e, 0x01, 0x32, 0xae, 0x30, 0xb2, 0x10, + 0x1a, 0xa3, 0x8e, 0xa2, 0x70, 0xc1, 0x09, 0x02, 0x08, 0xb0, 0x89, 0x63, 0xc9, 0x20, 0x91, 0x99, + 0x29, 0x15, 0xd9, 0x1a, 0x52, 0xd0, 0x89, 0x12, 0xa8, 0x43, 0xcb, 0x82, 0x1a, 0x94, 0x1b, 0x11, + 0x94, 0x9f, 0x14, 0x8d, 0x83, 0x28, 0x82, 0xfb, 0x38, 0x82, 0xa0, 0x4a, 0xb0, 0x18, 0xa9, 0x36, + 0xab, 0x88, 0x23, 0x8e, 0x93, 0x4b, 0x94, 0xea, 0x50, 0xa8, 0x10, 0x82, 0x8e, 0x03, 0x1b, 0x02, + 0xaa, 0x00, 0x38, 0x9a, 0x97, 0x2c, 0xc1, 0x31, 0x90, 0xb9, 0x28, 0x84, 0x9c, 0x11, 0x9d, 0x26, + 0xc0, 0x59, 0xa0, 0xa9, 0x33, 0x1a, 0xc0, 0x38, 0xa3, 0x8c, 0x18, 0xb2, 0x15, 0x9e, 0x32, 0xd1, + 0x1b, 0x27, 0xbd, 0x21, 0x91, 0x10, 0xa1, 0x1e, 0x82, 0x8a, 0x41, 0x99, 0x98, 0x51, 0x0a, 0xe1, + 0x48, 0x90, 0x0a, 0xa3, 0x38, 0x90, 0x0c, 0x12, 0xb8, 0x21, 0x78, 0xe0, 0x8a, 0x42, 0x91, 0x9a, + 0x71, 0xc9, 0x10, 0x81, 0x10, 0xb8, 0x2b, 0x07, 0x0f, 0x01, 0x82, 0x8c, 0x81, 0x00, 0x08, 0x00, + 0x83, 0xaf, 0x23, 0xb9, 0x40, 0xaa, 0x42, 0xa1, 0xbd, 0x52, 0xa0, 0x39, 0x92, 0xa9, 0x10, 0x20, + 0x97, 0x1d, 0x81, 0xba, 0x44, 0xcb, 0x24, 0xa9, 0x80, 0x84, 0x8f, 0x02, 0x93, 0x2b, 0xb9, 0x11, + 0x12, 0x8e, 0x14, 0xbb, 0x62, 0xa8, 0x90, 0x2a, 0xa2, 0x35, 0xad, 0x21, 0xa1, 0x98, 0x19, 0x28, + 0xd1, 0x29, 0x17, 0xae, 0x21, 0x83, 0x0d, 0xb2, 0x3a, 0x12, 0x98, 0x82, 0x9f, 0x82, 0x10, 0xb0, + 0x3d, 0x86, 0xa9, 0x29, 0x84, 0x0e, 0x03, 0xa9, 0x8b, 0x15, 0x8c, 0x23, 0xc0, 0x29, 0x18, 0xd0, + 0x4a, 0x92, 0xbb, 0x55, 0xc9, 0x28, 0x81, 0x09, 0x28, 0xa4, 0x19, 0x8b, 0x80, 0x96, 0xaa, 0x3d, + 0x07, 0x8a, 0x18, 0x94, 0x8e, 0x12, 0x00, 0x9a, 0x83, 0x0b, 0x23, 0xbd, 0x31, 0x03, 0x9b, 0x11, + 0x82, 0xdf, 0x41, 0xa2, 0x0b, 0x03, 0xb0, 0x7a, 0xe1, 0x29, 0x02, 0xba, 0x22, 0xb8, 0x89, 0x35, + 0x19, 0xb8, 0xb9, 0x6b, 0xb3, 0x0b, 0x63, 0x90, 0xd0, 0x49, 0xa8, 0x00, 0x30, 0x91, 0x9f, 0xa1, + 0x52, 0x00, 0xf9, 0x30, 0xaa, 0x03, 0x18, 0x9c, 0x02, 0x43, 0xe0, 0x2c, 0xa1, 0x10, 0x89, 0x25, + 0x8d, 0xa3, 0x3b, 0xa3, 0x0a, 0x88, 0x07, 0x8e, 0x01, 0x10, 0xa8, 0x10, 0x19, 0xe2, 0x30, 0x99, + 0x23, 0xea, 0x41, 0x09, 0xb8, 0x15, 0x09, 0xcb, 0x52, 0x99, 0x85, 0x8b, 0x30, 0xd3, 0x2b, 0x84, + 0x8b, 0x94, 0x2a, 0xf3, 0x29, 0x99, 0x24, 0xaa, 0xa1, 0x60, 0xa9, 0x08, 0x92, 0x0d, 0x12, 0x91, + 0xdb, 0x68, 0xa1, 0x29, 0x84, 0x8e, 0x92, 0x39, 0xa0, 0x90, 0x1b, 0x37, 0xd9, 0x2a, 0x85, 0x1a, + 0x88, 0xa1, 0x98, 0x4c, 0xb4, 0x39, 0xa1, 0x0b, 0x04, 0xb9, 0x5a, 0x85, 0x8c, 0x12, 0xb0, 0x4c, + 0xa3, 0x89, 0x00, 0x9a, 0x34, 0x99, 0x68, 0xa4, 0x0c, 0x89, 0x84, 0x3b, 0xc1, 0x34, 0xca, 0x10, + 0x80, 0x98, 0x29, 0xda, 0x63, 0xa9, 0xa8, 0x44, 0xba, 0x81, 0xb1, 0x71, 0xba, 0x32, 0xeb, 0x10, + 0x50, 0xc1, 0x8a, 0x31, 0xc1, 0x18, 0x18, 0xf0, 0x10, 0x29, 0x92, 0x8a, 0x80, 0x54, 0xea, 0x20, + 0x08, 0x91, 0x0c, 0x84, 0xaa, 0x31, 0x80, 0xa8, 0xc9, 0x70, 0x95, 0x9c, 0x32, 0xa8, 0x18, 0x0a, + 0xd0, 0x51, 0x09, 0xa3, 0x0e, 0x84, 0x19, 0xa8, 0x11, 0x99, 0x23, 0x2a, 0xf2, 0x1b, 0x15, 0xaa, + 0x09, 0x05, 0x19, 0x08, 0xe1, 0x20, 0xc9, 0x42, 0x98, 0xaa, 0x28, 0x07, 0x99, 0x9c, 0x07, 0x99, + 0x08, 0x13, 0xbb, 0x21, 0x92, 0x1c, 0xb9, 0x16, 0x9a, 0x2b, 0x95, 0x89, 0x03, 0x9a, 0x88, 0x91, + 0x32, 0x5a, 0xf8, 0x8a, 0x43, 0x29, 0xf1, 0x5a, 0xb8, 0x28, 0x31, 0xd1, 0x0b, 0x33, 0xdb, 0x00, + 0x41, 0x98, 0x28, 0x82, 0xfb, 0x69, 0xa8, 0x11, 0x80, 0x98, 0x40, 0xb0, 0x1d, 0x05, 0xa8, 0x4a, + 0x93, 0xac, 0x11, 0x90, 0x20, 0xe2, 0x18, 0x9a, 0x62, 0xd1, 0x19, 0x80, 0x38, 0xd1, 0x18, 0x09, + 0x83, 0x59, 0xc8, 0x89, 0x42, 0xfa, 0x40, 0xa9, 0x08, 0x11, 0x82, 0xbb, 0x40, 0xa1, 0x2c, 0x87, + 0x9c, 0x40, 0x90, 0xa8, 0x11, 0xa9, 0x62, 0x90, 0x80, 0x8b, 0x42, 0x81, 0xca, 0x1a, 0x81, 0x70, + 0x95, 0x09, 0xa9, 0x51, 0xc9, 0x22, 0xaa, 0x19, 0x35, 0xf9, 0x49, 0x81, 0x99, 0x30, 0xe8, 0x2a, + 0x03, 0x91, 0xac, 0x10, 0x48, 0xa4, 0x0a, 0xa9, 0x38, 0x03, 0x39, 0xdf, 0x11, 0x18, 0x88, 0x94, + 0x9f, 0x43, 0xc0, 0x09, 0x09, 0x84, 0x2a, 0x01, 0xe9, 0x28, 0x12, 0xd8, 0x39, 0xa1, 0x18, 0x32, + 0xf8, 0x0c, 0x31, 0xa2, 0x8a, 0x28, 0xd1, 0x38, 0x83, 0xda, 0x09, 0x38, 0x27, 0xad, 0x31, 0x8a, + 0x96, 0x1b, 0x10, 0xa8, 0x41, 0x11, 0xe8, 0x28, 0x8a, 0x05, 0x9a, 0x1a, 0x07, 0x9a, 0x21, 0x98, + 0x2a, 0x90, 0xa3, 0x8f, 0x01, 0x82, 0x21, 0x0a, 0xb0, 0x3b, 0xc5, 0x8d, 0x03, 0x2a, 0xab, 0x27, + 0x0f, 0x82, 0x18, 0xb1, 0x8a, 0x39, 0xe2, 0x49, 0xb8, 0x08, 0x23, 0x29, 0xca, 0x07, 0x1a, 0xd9, + 0x24, 0x89, 0xaa, 0x71, 0xc2, 0x1b, 0x31, 0xc1, 0x19, 0x02, 0xac, 0x32, 0xc8, 0x12, 0x4a, 0xf9, + 0x60, 0xa9, 0x91, 0x39, 0xa1, 0x00, 0x88, 0x88, 0x10, 0xf2, 0x69, 0x88, 0xa8, 0x40, 0xb2, 0x9d, + 0x22, 0x20, 0xdb, 0x01, 0x28, 0x8a, 0x87, 0x2b, 0xb2, 0x1b, 0x30, 0xa7, 0x1e, 0x93, 0x1a, 0x92, + 0x18, 0x19, 0xc3, 0x39, 0xe9, 0x41, 0xa9, 0x23, 0x99, 0xbd, 0x60, 0xa3, 0x19, 0x09, 0xb0, 0x69, + 0xb2, 0x49, 0xc8, 0x39, 0xb0, 0x83, 0x4b, 0xb2, 0xa8, 0x72, 0x99, 0xca, 0x60, 0xa3, 0x1a, 0xb9, + 0x81, 0x80, 0x5c, 0xc2, 0x09, 0x22, 0x19, 0xa4, 0xbf, 0x33, 0xb2, 0x0e, 0x22, 0xd9, 0x50, 0x90, + 0x08, 0xa8, 0x30, 0xa8, 0x42, 0xdb, 0x23, 0x80, 0x0d, 0xa5, 0x4b, 0x91, 0x92, 0x1b, 0x01, 0x9a, + 0x03, 0x5c, 0xe8, 0x21, 0x19, 0xb4, 0x1b, 0x92, 0x19, 0x88, 0x09, 0x99, 0x67, 0x8d, 0x03, 0x8c, + 0x88, 0x33, 0xab, 0xb1, 0x50, 0x80, 0x9c, 0x84, 0x00, 0x89, 0x80, 0xa0, 0x10, 0x2c, 0x94, 0x2b, + 0x9d, 0xd2, 0x70, 0xb8, 0x03, 0x3c, 0xd2, 0x18, 0x8a, 0x85, 0x98, 0x3c, 0xc5, 0x28, 0x98, 0x80, + 0x30, 0xb0, 0x49, 0xa2, 0x8a, 0x38, 0x87, 0x8b, 0x49, 0xf4, 0x49, 0x91, 0x99, 0x42, 0xca, 0x38, + 0x92, 0x0b, 0x84, 0x18, 0x9b, 0xc2, 0x59, 0x00, 0xb1, 0x8c, 0x46, 0xeb, 0x10, 0x21, 0xca, 0x20, + 0x01, 0xdb, 0x32, 0x88, 0xb1, 0x3a, 0xd2, 0x4a, 0xa0, 0x51, 0x91, 0xba, 0x60, 0xb8, 0x29, 0x01, + 0x04, 0x9e, 0x82, 0x38, 0xb9, 0x32, 0x81, 0xaf, 0x13, 0x08, 0x9b, 0x15, 0x98, 0xa0, 0x3b, 0x85, + 0xa2, 0x2d, 0x84, 0x9c, 0x01, 0x92, 0x0a, 0x40, 0x91, 0xa1, 0x8e, 0x8a, 0x47, 0xb0, 0x99, 0x41, + 0xeb, 0x32, 0x88, 0xa9, 0x03, 0xab, 0x68, 0xa3, 0x8d, 0x32, 0xca, 0x98, 0x52, 0x9a, 0x22, 0xc8, + 0x1a, 0x11, 0x9a, 0x07, 0x1b, 0xca, 0x26, 0x0a, 0xba, 0x34, 0x9a, 0x80, 0x13, 0x0f, 0x10, 0x93, + 0x1a, 0xb8, 0x9d, 0x07, 0x29, 0xc9, 0x42, 0xa9, 0x1b, 0x16, 0x9c, 0x01, 0x12, 0x0c, 0xe2, 0x49, + 0x01, 0xb0, 0x29, 0x98, 0x03, 0x99, 0x53, 0xac, 0x91, 0x43, 0x8c, 0xa1, 0x50, 0x08, 0xe0, 0x39, + 0x98, 0x11, 0x90, 0x00, 0xaf, 0x21, 0x94, 0x1a, 0x09, 0xa3, 0x00, 0x9e, 0x12, 0xab, 0x12, 0x32, + 0xbc, 0xfb, 0x71, 0x90, 0x08, 0x1a, 0xb2, 0x1c, 0x22, 0xa1, 0xbc, 0x25, 0x00, 0xba, 0x90, 0x34, + 0x2b, 0x90, 0xc1, 0x0f, 0x15, 0x19, 0xa0, 0xc0, 0x3a, 0x33, 0xea, 0x22, 0x1c, 0x04, 0x0b, 0xb1, + 0x9a, 0x71, 0x87, 0x9a, 0x80, 0x28, 0x18, 0x92, 0x09, 0xdb, 0x55, 0xb8, 0x0a, 0x02, 0x31, 0x9e, + 0x80, 0x01, 0x0a, 0x33, 0xb2, 0xff, 0x20, 0x28, 0xc2, 0x8b, 0x33, 0xaa, 0x09, 0x95, 0x1d, 0x98, + 0x22, 0x83, 0xbf, 0x48, 0x04, 0xaa, 0x38, 0xc2, 0x1a, 0x61, 0xc0, 0x2a, 0x81, 0x99, 0x41, 0xe0, + 0x3a, 0x84, 0xa8, 0x3b, 0xa4, 0x1c, 0x04, 0xaa, 0x81, 0x30, 0xdb, 0x45, 0xc9, 0x39, 0x03, 0x9d, + 0x02, 0x18, 0x8a, 0x85, 0x0a, 0x09, 0xa2, 0x1c, 0x16, 0xab, 0x00, 0x44, 0xeb, 0x30, 0xb2, 0x0a, + 0x22, 0xc0, 0x2a, 0xc1, 0x30, 0x99, 0xe8, 0x58, 0x81, 0x99, 0x28, 0xb2, 0x0d, 0x10, 0xa4, 0x2b, + 0xb8, 0x71, 0x90, 0xb9, 0x78, 0xc1, 0x29, 0x10, 0xb0, 0x50, 0xa8, 0x11, 0xc9, 0x49, 0x02, 0xb9, + 0xbb, 0x46, 0x00, 0xbc, 0x05, 0x18, 0x9a, 0x23, 0x98, 0x89, 0x89, 0x43, 0xd0, 0x1c, 0x07, 0x89, + 0x2a, 0xc4, 0x3a, 0xa9, 0x15, 0x8c, 0x91, 0x38, 0xa4, 0x0c, 0x00, 0x98, 0x80, 0x42, 0xcb, 0x00, + 0x51, 0xd8, 0x08, 0x00, 0x89, 0x03, 0x8b, 0xb3, 0x5a, 0x10, 0x97, 0xab, 0x18, 0x33, 0xf3, 0x3a, + 0xb0, 0x32, 0x8d, 0xa5, 0x29, 0xa8, 0x2a, 0x37, 0xbc, 0x40, 0x90, 0x98, 0xa1, 0x49, 0x22, 0xd9, + 0x19, 0x11, 0x0c, 0x13, 0xe1, 0x58, 0xba, 0x14, 0x28, 0xfa, 0x20, 0x2a, 0xd3, 0x18, 0x28, 0xe1, + 0x38, 0xd0, 0x18, 0x82, 0xac, 0x34, 0xa8, 0x8c, 0x24, 0xd8, 0x29, 0x11, 0xc8, 0x48, 0xa8, 0x20, + 0x80, 0xc9, 0x52, 0xb8, 0x19, 0x84, 0x1c, 0x80, 0x22, 0xbd, 0x53, 0x98, 0xa9, 0x73, 0xb9, 0x20, + 0x10, 0xac, 0x16, 0x9c, 0x12, 0x90, 0x0c, 0x04, 0x99, 0x09, 0x85, 0x9a, 0x38, 0xa3, 0x2b, 0x90, + 0xc0, 0x79, 0xd1, 0x29, 0x23, 0xe9, 0x39, 0x91, 0xa8, 0x2a, 0x82, 0x11, 0xcb, 0x11, 0x68, 0xe0, + 0x38, 0x81, 0xc9, 0x29, 0x83, 0x0a, 0x99, 0x33, 0xa9, 0x91, 0xaf, 0x36, 0xd9, 0x19, 0x84, 0x0b, + 0xa9, 0x15, 0x10, 0xbc, 0x42, 0xa0, 0x3d, 0xb1, 0x12, 0x18, 0xba, 0x33, 0x62, 0xe9, 0x18, 0x04, + 0x9c, 0x08, 0x35, 0xcc, 0x32, 0xa8, 0x1a, 0xa3, 0x2d, 0x83, 0xb9, 0x49, 0x13, 0xfb, 0x59, 0x91, + 0x9a, 0x01, 0x29, 0xa2, 0x2a, 0x30, 0xb6, 0x9f, 0x51, 0x90, 0xaa, 0x43, 0xa9, 0x88, 0x13, 0x9d, + 0x02, 0x82, 0x1c, 0xd3, 0x18, 0x29, 0xc4, 0x1b, 0x22, 0xa2, 0x9c, 0x40, 0xd2, 0x2a, 0xa3, 0x2b, + 0x83, 0xbe, 0x46, 0xb8, 0x0a, 0x12, 0xa8, 0x29, 0xb3, 0x39, 0x16, 0xbf, 0x14, 0x8a, 0x88, 0x23, + 0x99, 0x9d, 0x14, 0x98, 0x19, 0x92, 0xaa, 0x32, 0x8c, 0x86, 0x10, 0xcb, 0x33, 0xca, 0x82, 0x62, + 0xad, 0x84, 0x0a, 0x02, 0x90, 0x58, 0xc1, 0x9b, 0x13, 0x23, 0x9f, 0x12, 0x08, 0x0e, 0x84, 0x80, + 0x39, 0xe8, 0x52, 0xaa, 0xa0, 0x41, 0x99, 0x91, 0x39, 0x90, 0x80, 0x00, 0x80, 0x9f, 0x86, 0x1a, + 0xb2, 0xaa, 0x70, 0xc2, 0x29, 0x09, 0xa4, 0x1e, 0x03, 0x9a, 0x01, 0xa8, 0x79, 0xc1, 0x28, 0x88, + 0x91, 0x38, 0x88, 0xa0, 0x5c, 0x91, 0x90, 0x1c, 0x81, 0x31, 0x92, 0xaf, 0x83, 0x1c, 0x86, 0x09, + 0x19, 0xc2, 0x31, 0x9c, 0x95, 0x0d, 0x13, 0x00, 0xca, 0x31, 0xa9, 0x30, 0xc0, 0x0c, 0x84, 0x49, + 0xb1, 0x1a, 0x8a, 0x16, 0x1b, 0xe8, 0x39, 0xa2, 0x42, 0x9a, 0xd9, 0x71, 0x98, 0x00, 0xc9, 0x42, + 0xa9, 0x98, 0x21, 0xc9, 0x31, 0x19, 0xd2, 0x0a, 0x28, 0x17, 0xab, 0x19, 0x84, 0x0b, 0x00, 0x84, + 0x09, 0x39, 0xf2, 0x38, 0x9a, 0x94, 0x72, 0xf0, 0x29, 0x82, 0xb8, 0x48, 0x82, 0xbb, 0x51, 0xa8, + 0x10, 0x00, 0x88, 0x2a, 0x98, 0xa5, 0x7a, 0x89, 0xc2, 0x38, 0xbc, 0x04, 0x38, 0xac, 0x15, 0x8a, + 0xa1, 0x58, 0xba, 0x94, 0x1c, 0x81, 0x92, 0x1e, 0x85, 0x8a, 0x98, 0x42, 0xd9, 0x40, 0x90, 0x99, + 0x20, 0x98, 0x89, 0x20, 0xd0, 0x62, 0xb9, 0x20, 0x91, 0xad, 0x63, 0xc0, 0x18, 0x19, 0xb2, 0x3a, + 0x92, 0x91, 0x19, 0xa9, 0x70, 0x97, 0x0b, 0x12, 0xd0, 0x3a, 0x00, 0x94, 0x3b, 0xd9, 0x23, 0xaa, + 0x13, 0x1f, 0x82, 0x82, 0x9d, 0x32, 0xba, 0x06, 0x0b, 0xc2, 0x28, 0x0c, 0x94, 0x38, 0xc9, 0x21, + 0x30, 0xfa, 0x48, 0x98, 0xb8, 0x60, 0xc1, 0x19, 0x80, 0x08, 0x00, 0x08, 0x91, 0x7b, 0xf8, 0x20, + 0x90, 0x39, 0xd2, 0x2a, 0x12, 0xb9, 0x19, 0x30, 0x93, 0x9f, 0x34, 0xb9, 0x80, 0x88, 0x59, 0xa2, + 0x9c, 0x63, 0xb0, 0x1d, 0x84, 0x01, 0x9d, 0x12, 0x08, 0x90, 0x28, 0xdb, 0x35, 0xab, 0x31, 0xb2, + 0x0d, 0x12, 0x89, 0xab, 0x26, 0x0a, 0xd9, 0x51, 0xd0, 0x39, 0x98, 0x01, 0x09, 0xa0, 0x68, 0xe0, + 0x28, 0x01, 0xca, 0x62, 0xc8, 0x28, 0x00, 0xa8, 0x28, 0x90, 0x82, 0x2b, 0xf2, 0x49, 0x80, 0xa8, + 0x50, 0xa2, 0x0e, 0x82, 0x00, 0x89, 0x13, 0xbc, 0x20, 0x87, 0x0a, 0x08, 0xa3, 0x48, 0xca, 0x28, + 0x23, 0xcd, 0x21, 0x83, 0x8f, 0x22, 0xb8, 0x3c, 0xa5, 0x2b, 0x90, 0x01, 0x98, 0x00, 0x90, 0x8b, + 0x44, 0xcd, 0x32, 0x80, 0x9c, 0x07, 0x9b, 0x21, 0xb0, 0x68, 0x98, 0x90, 0x19, 0x08, 0xc1, 0x70, + 0xb9, 0x32, 0x10, 0x9e, 0x04, 0x88, 0x0b, 0x93, 0x89, 0x32, 0xba, 0x43, 0xae, 0x11, 0x93, 0x2f, + 0xa2, 0x01, 0x89, 0x48, 0xd9, 0x02, 0x8a, 0x44, 0xb9, 0x1a, 0x01, 0x42, 0xdb, 0x41, 0xc8, 0x09, + 0x38, 0x95, 0x81, 0x9f, 0x24, 0xc9, 0x18, 0x22, 0xc8, 0x1b, 0x82, 0xb1, 0x7b, 0xb2, 0x28, 0x80, + 0xbb, 0x04, 0x89, 0x2e, 0x86, 0xaa, 0x50, 0xc0, 0x18, 0x30, 0xc0, 0x88, 0x2a, 0xa2, 0x91, 0x6a, + 0xb3, 0x99, 0x49, 0x04, 0xab, 0x1c, 0x16, 0xdb, 0x11, 0x21, 0xea, 0x31, 0x98, 0x89, 0x01, 0x4b, + 0xc3, 0x00, 0x0c, 0x12, 0xcb, 0x53, 0xc8, 0x28, 0x82, 0x0d, 0x82, 0x21, 0x1c, 0xe2, 0x10, 0x89, + 0x32, 0xa8, 0xa8, 0x12, 0x9f, 0x26, 0xcb, 0x22, 0x89, 0x8a, 0x07, 0x8c, 0x20, 0xa1, 0x09, 0x10, + 0xb0, 0x41, 0x98, 0xbb, 0x73, 0xe8, 0x29, 0x03, 0x99, 0x19, 0x94, 0x0b, 0x91, 0x10, 0xaa, 0x17, + 0x0e, 0xb3, 0x1a, 0x24, 0xa9, 0xa9, 0x68, 0xa2, 0x1c, 0x04, 0xab, 0x13, 0x88, 0x8c, 0x02, 0x9e, + 0x15, 0x08, 0xb8, 0x19, 0x92, 0x40, 0x40, 0xf0, 0x3b, 0x08, 0x91, 0x89, 0x42, 0x08, 0xb6, 0x2f, + 0xa1, 0x01, 0x2a, 0x90, 0xb4, 0x1f, 0x03, 0x90, 0x1b, 0x92, 0x31, 0xf0, 0x8a, 0x12, 0x92, 0x3b, + 0xa5, 0x8f, 0x21, 0x81, 0x8a, 0x18, 0xaa, 0x94, 0x70, 0xaa, 0x82, 0x38, 0xda, 0x32, 0x99, 0xd1, + 0x51, 0x8b, 0xc2, 0x7a, 0xa0, 0x20, 0x9a, 0x82, 0x3a, 0xa3, 0x9a, 0x8b, 0x33, 0xa8, 0xbd, 0x62, + 0xa0, 0x02, 0x1f, 0xa2, 0x30, 0xd0, 0x49, 0x90, 0x88, 0x40, 0xdb, 0x21, 0x18, 0x02, 0x88, 0x90, + 0x1e, 0x12, 0xa0, 0x2a, 0x47, 0xc9, 0x1b, 0x95, 0x2d, 0x91, 0x82, 0x39, 0xe0, 0x18, 0x20, 0xe8, + 0x41, 0x89, 0xb9, 0x43, 0xa0, 0x0c, 0x03, 0xb0, 0x1c, 0x03, 0x88, 0x9a, 0x16, 0x8b, 0xa8, 0x08, + 0x58, 0xd3, 0x0b, 0x05, 0x8c, 0x11, 0xa4, 0x2c, 0x90, 0x11, 0x09, 0xdb, 0x24, 0xa9, 0x90, 0x69, + 0xd8, 0x23, 0x0c, 0x94, 0x8a, 0x21, 0xa1, 0x0e, 0x12, 0x88, 0xba, 0x74, 0xc0, 0x10, 0x39, 0xd3, + 0x2a, 0xb0, 0x50, 0x88, 0xa8, 0x12, 0xeb, 0x51, 0xb0, 0x00, 0x28, 0xc8, 0x21, 0x8a, 0x82, 0x10, + 0x8c, 0x93, 0x0e, 0xa4, 0x78, 0xb8, 0x91, 0x6b, 0xd1, 0x38, 0x88, 0xa1, 0x30, 0xc9, 0x41, 0xc9, + 0x22, 0xba, 0x21, 0x9a, 0x06, 0x1a, 0x9a, 0x85, 0x3a, 0xe9, 0x42, 0x90, 0xda, 0x21, 0xb8, 0x20, + 0x00, 0xa4, 0x29, 0xca, 0x32, 0xc9, 0x04, 0x3a, 0xec, 0x13, 0x3a, 0xd0, 0x09, 0x04, 0x0b, 0x89, + 0x86, 0x2c, 0xc3, 0x19, 0x11, 0xfa, 0x31, 0x80, 0xa9, 0x38, 0xb2, 0x50, 0x9a, 0x91, 0x19, 0x0a, + 0x17, 0x9a, 0xa3, 0x1e, 0x04, 0x99, 0x00, 0x98, 0x7b, 0xd3, 0x48, 0xa8, 0x10, 0xa9, 0x90, 0x52, + 0xaa, 0x15, 0x1a, 0xcb, 0x11, 0x21, 0x91, 0x0e, 0x22, 0xe2, 0x1b, 0x83, 0x0a, 0x91, 0x21, 0xa9, + 0xb3, 0x7a, 0xf1, 0x50, 0xba, 0x23, 0x0a, 0xa1, 0x10, 0x0a, 0xb5, 0x2f, 0x94, 0x8c, 0x03, 0xa8, + 0x28, 0xa1, 0x8c, 0x38, 0x90, 0x03, 0x89, 0x4c, 0xc1, 0x91, 0x98, 0x3f, 0xa4, 0x08, 0x32, 0xbf, + 0x15, 0x98, 0x09, 0x83, 0x0e, 0x03, 0x00, 0x0c, 0x84, 0x9b, 0x12, 0x88, 0x19, 0x01, 0x88, 0xc9, + 0x16, 0x0d, 0xb4, 0x4b, 0xa9, 0x07, 0x9b, 0x22, 0x93, 0x8f, 0x01, 0x90, 0x08, 0x10, 0xc9, 0x22, + 0x3c, 0x94, 0x99, 0x0e, 0x23, 0x90, 0xbb, 0x72, 0xd0, 0x48, 0xb8, 0x20, 0x00, 0x98, 0x22, 0xda, + 0x39, 0x93, 0x9c, 0x11, 0x19, 0xb2, 0x49, 0xd3, 0x9d, 0x51, 0xa0, 0x40, 0x98, 0x99, 0x00, 0x93, + 0x2d, 0x83, 0xd2, 0x2f, 0x84, 0x0a, 0x18, 0xb1, 0x59, 0x90, 0x89, 0x94, 0x09, 0x28, 0xd1, 0x29, + 0x88, 0x10, 0xf3, 0x3a, 0x11, 0xe2, 0x4b, 0xb8, 0x15, 0x9c, 0x38, 0x94, 0x8b, 0x10, 0xb4, 0x0d, + 0x21, 0x00, 0xa0, 0x3a, 0xe2, 0x39, 0x08, 0xc2, 0x18, 0x2c, 0x82, 0xb0, 0x20, 0x30, 0xf9, 0x39, + 0x89, 0x91, 0x42, 0x0a, 0xf5, 0x2c, 0x91, 0x32, 0x89, 0xb1, 0x39, 0xa8, 0x63, 0x98, 0xd9, 0x79, + 0xb1, 0x58, 0xb0, 0x28, 0x91, 0x3a, 0x8a, 0xa4, 0x53, 0x8e, 0xa2, 0x20, 0x0b, 0x02, 0xca, 0x88, + 0x2a, 0x24, 0x8b, 0x80, 0xd1, 0x70, 0xb9, 0x18, 0x92, 0x29, 0x9a, 0x08, 0xd2, 0x2e, 0x83, 0xc3, + 0x5d, 0xc1, 0x20, 0x98, 0x10, 0xc8, 0x2b, 0x17, 0x9b, 0x31, 0xdb, 0x31, 0x81, 0x09, 0x20, 0xdb, + 0x04, 0x9b, 0x20, 0xd9, 0x23, 0x30, 0x9e, 0xa2, 0x23, 0x19, 0xea, 0x33, 0xe9, 0x69, 0xb0, 0x08, + 0x48, 0xa1, 0x29, 0xbb, 0x17, 0x1b, 0x92, 0x9a, 0x29, 0x85, 0x0c, 0x85, 0x9a, 0x39, 0x96, 0x8b, + 0x80, 0x82, 0x0d, 0x23, 0xba, 0xa3, 0x6b, 0x94, 0x8c, 0x00, 0x82, 0x09, 0x11, 0xa2, 0x2c, 0xe2, + 0x39, 0x25, 0xdd, 0x21, 0x92, 0x8a, 0x08, 0x95, 0x1b, 0x01, 0x23, 0xaf, 0x81, 0x60, 0xc0, 0x18, + 0x18, 0xd3, 0x2b, 0x92, 0x10, 0xab, 0x26, 0xa9, 0x88, 0x31, 0x9a, 0xd9, 0x22, 0x21, 0xbb, 0x99, + 0x07, 0x9d, 0x41, 0x83, 0xbc, 0x32, 0x3b, 0xf0, 0x40, 0xb8, 0x98, 0x49, 0x92, 0xa1, 0x1a, 0x19, + 0xb0, 0x10, 0x0c, 0x07, 0x0e, 0x84, 0x9a, 0x88, 0x24, 0x98, 0x19, 0x8a, 0x01, 0x01, 0x8d, 0x35, + 0xbc, 0x61, 0xa8, 0xa3, 0x2e, 0xa2, 0x11, 0xab, 0x22, 0xb8, 0x30, 0x20, 0xb8, 0x14, 0x8e, 0x17, + 0xbc, 0x21, 0x91, 0x8a, 0x54, 0xeb, 0x41, 0xa9, 0x02, 0x20, 0xda, 0x40, 0x80, 0x80, 0x99, 0x83, + 0x8e, 0x01, 0x21, 0x0b, 0x23, 0xd9, 0x1a, 0x88, 0x00, 0x86, 0x19, 0xdc, 0x10, 0x32, 0xac, 0x12, + 0x9b, 0x17, 0x8c, 0x02, 0x09, 0x1a, 0xc6, 0x3a, 0xb8, 0x12, 0x40, 0xc2, 0x1e, 0x83, 0x19, 0x9c, + 0x16, 0xab, 0x81, 0x60, 0xd1, 0x18, 0x80, 0xa9, 0x40, 0xa0, 0x38, 0x03, 0xad, 0x31, 0xc2, 0x8c, + 0x23, 0x90, 0x8b, 0x17, 0x9a, 0x09, 0xb2, 0x70, 0xa8, 0x80, 0x81, 0x20, 0x2a, 0xf3, 0x11, 0x2b, + 0xa3, 0xcb, 0x51, 0xa0, 0x0c, 0x06, 0x9b, 0x10, 0x12, 0x8a, 0xd9, 0x21, 0x10, 0xbb, 0xc3, 0x58, + 0xb3, 0x2c, 0x06, 0xdb, 0x12, 0x08, 0x98, 0xe1, 0x3a, 0xa2, 0x42, 0xb9, 0x88, 0x19, 0x83, 0xa8, + 0x5a, 0x94, 0x29, 0xa0, 0x1b, 0xa9, 0xa5, 0x08, 0x5c, 0xc2, 0x31, 0xb5, 0x8f, 0x03, 0x98, 0x2c, + 0xa3, 0x31, 0xea, 0x50, 0x90, 0x91, 0x8a, 0x39, 0x86, 0x1c, 0xa3, 0x0d, 0x10, 0x03, 0xbb, 0x60, + 0xa0, 0x89, 0x12, 0x9b, 0x41, 0x21, 0xf9, 0x18, 0x19, 0x40, 0xe3, 0x8a, 0x38, 0xe0, 0x22, 0x89, + 0xda, 0x30, 0x84, 0xa9, 0x70, 0xa0, 0x98, 0x80, 0x8a, 0x83, 0x4a, 0x81, 0x80, 0xc0, 0x3e, 0x87, + 0x8a, 0x28, 0xa0, 0x9a, 0x32, 0x11, 0x8b, 0x99, 0x07, 0x8c, 0x9b, 0x46, 0xa0, 0x28, 0xd9, 0x22, + 0x9b, 0x21, 0x82, 0xbf, 0x06, 0x19, 0xa0, 0x09, 0x03, 0x20, 0xeb, 0x01, 0x09, 0x1b, 0x27, 0xd8, + 0x29, 0x02, 0xf9, 0x29, 0x81, 0x80, 0x10, 0x80, 0xab, 0x31, 0x28, 0xb8, 0xa9, 0xc9, 0x79, 0xf2, + 0x40, 0x80, 0xa8, 0x81, 0x11, 0xbb, 0x49, 0xb6, 0x1c, 0x92, 0x3b, 0xa6, 0x2a, 0x05, 0xb9, 0x3a, + 0x93, 0x39, 0xca, 0x34, 0xbd, 0x03, 0x11, 0x8c, 0x04, 0xb8, 0x59, 0xa8, 0x09, 0x43, 0xb2, 0x8f, + 0x20, 0xb1, 0x69, 0xb8, 0x88, 0x11, 0x98, 0x21, 0xc8, 0x19, 0x05, 0x2c, 0xf1, 0x3b, 0x02, 0x10, + 0xd1, 0x1a, 0x41, 0x9b, 0x06, 0x08, 0x9b, 0x10, 0x20, 0x94, 0x09, 0x3b, 0x27, 0xad, 0x89, 0x35, + 0xcb, 0x30, 0xa2, 0x8b, 0x51, 0x84, 0xac, 0x88, 0x03, 0x0a, 0xab, 0x07, 0x1a, 0x23, 0xcb, 0x82, + 0x8e, 0x52, 0xb0, 0x0d, 0x02, 0x88, 0x09, 0x83, 0xb8, 0x1c, 0x83, 0x13, 0xcd, 0x53, 0x09, 0xf1, + 0x1a, 0x03, 0x9a, 0x10, 0x33, 0xce, 0x30, 0x02, 0xbb, 0x31, 0xa0, 0x09, 0x29, 0xe1, 0x58, 0xab, + 0x43, 0x82, 0xeb, 0x50, 0x00, 0xb0, 0x71, 0xa9, 0x08, 0x12, 0x99, 0x09, 0x80, 0x34, 0x00, 0xd8, + 0x39, 0xc2, 0x12, 0x2e, 0xc1, 0x29, 0x01, 0xc8, 0x2b, 0x07, 0x1a, 0xb0, 0x21, 0x8e, 0x94, 0x0b, + 0x12, 0xb8, 0x0c, 0x16, 0xca, 0x39, 0x14, 0xeb, 0x10, 0x11, 0xaa, 0x43, 0x8c, 0xa1, 0x20, 0x18, + 0xa3, 0x8c, 0xb0, 0x55, 0xcc, 0x41, 0x90, 0x99, 0x50, 0xc0, 0x18, 0x11, 0xca, 0x31, 0xca, 0x21, + 0x11, 0x9b, 0x28, 0xc1, 0x49, 0x32, 0xf8, 0x4a, 0xc0, 0x08, 0x31, 0xa2, 0x8b, 0x33, 0xeb, 0x19, + 0x27, 0x9a, 0x10, 0xc2, 0x1c, 0x84, 0x0a, 0x18, 0xaa, 0x01, 0x24, 0xdc, 0x49, 0x92, 0x29, 0xe0, + 0x39, 0xb2, 0x3a, 0x82, 0xa9, 0x09, 0x01, 0x83, 0xdf, 0x32, 0x83, 0xcb, 0x20, 0x20, 0x43, 0xe1, + 0x0b, 0x2a, 0x01, 0x04, 0x90, 0xbf, 0x34, 0xa2, 0x1b, 0x09, 0xb6, 0x1d, 0x05, 0x0a, 0x90, 0x12, + 0x09, 0xb9, 0x8c, 0x91, 0x57, 0xaa, 0x01, 0x0a, 0xc0, 0x71, 0xa8, 0x19, 0x20, 0xa1, 0x9d, 0x01, + 0x13, 0xbb, 0x51, 0xe8, 0x89, 0x32, 0xa8, 0x00, 0x2b, 0x05, 0x00, 0x9a, 0x88, 0xd1, 0x2c, 0xa2, + 0xcb, 0x44, 0x40, 0xe1, 0x0a, 0x01, 0xb1, 0x58, 0xaa, 0x85, 0x8b, 0x24, 0x98, 0x8a, 0x05, 0x9a, + 0x12, 0x29, 0xf2, 0x6a, 0x98, 0x98, 0x30, 0xb1, 0x7a, 0x92, 0xa9, 0x29, 0xa0, 0x58, 0xb0, 0x01, + 0x4a, 0x94, 0xa9, 0x9b, 0x24, 0x29, 0xc9, 0x25, 0xab, 0x1b, 0x64, 0xe2, 0x2c, 0x82, 0x90, 0x19, + 0xa1, 0x18, 0xba, 0x14, 0x30, 0xba, 0x20, 0x63, 0xf1, 0x1c, 0x12, 0x90, 0x88, 0x11, 0xcc, 0x21, + 0x11, 0xe0, 0x0c, 0x23, 0x91, 0x0a, 0x9a, 0x91, 0x25, 0xbc, 0x34, 0xaf, 0x13, 0x11, 0xbb, 0x09, + 0x31, 0xc1, 0x18, 0x99, 0x19, 0x1a, 0x57, 0x9b, 0x80, 0x49, 0x98, 0xd0, 0x1e, 0x13, 0x81, 0x11, + 0x9e, 0x10, 0x10, 0xa2, 0x2d, 0x83, 0x9a, 0x15, 0xf9, 0x3c, 0x84, 0xa9, 0x30, 0xb9, 0x38, 0x33, + 0x89, 0xa0, 0x1c, 0x83, 0xc8, 0x38, 0x09, 0x15, 0xb0, 0x2d, 0xa9, 0x08, 0x77, 0xa8, 0x90, 0x0a, + 0x42, 0xb1, 0x39, 0x9a, 0xa4, 0x78, 0x82, 0xcc, 0x38, 0xa1, 0x28, 0x01, 0x09, 0x9c, 0x07, 0x8d, + 0x99, 0x22, 0x80, 0x0a, 0x92, 0x8b, 0x37, 0xac, 0x18, 0x81, 0x90, 0x62, 0xfa, 0x10, 0x80, 0x89, + 0x00, 0x9a, 0x12, 0x31, 0xa6, 0x1d, 0xc0, 0x50, 0xc1, 0x1a, 0x92, 0x88, 0x00, 0x00, 0x0a, 0xc1, + 0x30, 0x84, 0x0d, 0x10, 0xd0, 0x38, 0x20, 0xd1, 0x8a, 0x42, 0x02, 0xf8, 0x1c, 0x05, 0x20, 0xba, + 0x90, 0x3b, 0x17, 0x1a, 0xb1, 0xba, 0x69, 0x02, 0xa9, 0x12, 0x2c, 0x84, 0xbb, 0x20, 0x28, 0x13, + 0xad, 0x94, 0x4e, 0xb1, 0x38, 0xcc, 0x32, 0x00, 0x01, 0xa9, 0x90, 0x2e, 0x92, 0x0a, 0xb8, 0x66, + 0xa9, 0x90, 0x18, 0xa8, 0x12, 0x6a, 0xc3, 0x19, 0x9e, 0x22, 0x99, 0x81, 0x32, 0xce, 0x21, 0x98, + 0x00, 0x32, 0xba, 0x88, 0x88, 0x80, 0x3a, 0x02, 0x77, 0xc0, 0x8a, 0x30, 0xe0, 0x39, 0x92, 0x10, + 0xcc, 0x20, 0x04, 0x00, 0x8b, 0x86, 0xc9, 0x3c, 0xa3, 0x06, 0x8c, 0x82, 0xaa, 0x40, 0x31, 0xc1, + 0x8c, 0x92, 0x28, 0x19, 0xa3, 0x32, 0xcf, 0x40, 0xa2, 0x1d, 0x81, 0x08, 0x18, 0xd3, 0x3b, 0x01, + 0x8e, 0x04, 0x00, 0xab, 0x11, 0x02, 0x0d, 0x93, 0x08, 0xad, 0x33, 0xab, 0x51, 0xa8, 0x82, 0x0e, + 0x82, 0x20, 0x99, 0xa4, 0x49, 0x8f, 0x35, 0xb9, 0x0b, 0x13, 0x00, 0x0d, 0xa3, 0x5b, 0x04, 0xba, + 0x40, 0xe9, 0x51, 0x90, 0x81, 0xba, 0x32, 0x99, 0x90, 0x18, 0x28, 0x04, 0xbb, 0x19, 0xbb, 0x04, + 0x04, 0xdf, 0x83, 0x40, 0x93, 0x8b, 0x8c, 0x03, 0x08, 0x15, 0xac, 0xa8, 0x50, 0xc2, 0x1c, 0x02, + 0xd0, 0x53, 0x9d, 0x11, 0x18, 0xaa, 0x12, 0x9b, 0x38, 0x16, 0xc9, 0x39, 0x9a, 0x42, 0xb0, 0x19, + 0x98, 0x00, 0x10, 0xbb, 0x67, 0xda, 0x00, 0x08, 0x3a, 0xa6, 0x2a, 0x93, 0x8f, 0x04, 0x19, 0xa9, + 0x61, 0xa9, 0x03, 0x19, 0x99, 0x90, 0x34, 0x98, 0x2a, 0xe8, 0x49, 0xe2, 0x28, 0x88, 0x22, 0xa9, + 0x09, 0x12, 0xcf, 0x04, 0x39, 0xd1, 0x29, 0xa8, 0x23, 0x98, 0x89, 0xb1, 0x9c, 0x09, 0x12, 0x1a, + 0xa6, 0x5a, 0xe0, 0x19, 0x21, 0xb1, 0x09, 0x19, 0xfb, 0x73, 0x90, 0x89, 0xa1, 0x3a, 0x03, 0xc0, + 0x38, 0xc8, 0x42, 0xdb, 0x11, 0x2a, 0x94, 0x31, 0xac, 0x52, 0xa1, 0x3b, 0xf3, 0x1a, 0x84, 0x9c, + 0x23, 0xaa, 0x12, 0xa4, 0x0f, 0x82, 0x20, 0x00, 0xa4, 0x8e, 0x82, 0x00, 0x9e, 0x13, 0x8b, 0x14, + 0x18, 0xcb, 0x09, 0xa0, 0x22, 0x09, 0xaf, 0x14, 0x08, 0x22, 0xe0, 0x8a, 0x93, 0x1f, 0x92, 0x21, + 0xa9, 0x3a, 0x84, 0xb9, 0x59, 0xc2, 0x4a, 0xc2, 0x29, 0x15, 0xbc, 0x38, 0x83, 0xb9, 0x4b, 0x86, + 0x8a, 0x03, 0x0c, 0x91, 0x00, 0x72, 0x83, 0xbf, 0x01, 0x09, 0x11, 0x02, 0x00, 0x88, 0x09, 0xe3, + 0x3e, 0x95, 0x0b, 0x00, 0xa1, 0x38, 0xa2, 0x09, 0x8e, 0x94, 0x39, 0xb0, 0xca, 0x70, 0xa1, 0x88, + 0x38, 0xc9, 0x81, 0x1c, 0x81, 0x21, 0xac, 0x12, 0x99, 0x9f, 0x22, 0x10, 0x39, 0x94, 0x8d, 0x08, + 0xb1, 0x8c, 0x43, 0xa8, 0x28, 0x07, 0x1c, 0xb2, 0x0a, 0x90, 0x6b, 0x13, 0xf9, 0x49, 0x81, 0x10, + 0xa0, 0x38, 0xb2, 0x9f, 0x34, 0x98, 0xaa, 0x61, 0x90, 0xca, 0x60, 0x80, 0x08, 0x11, 0x8a, 0x09, + 0xa0, 0x71, 0xb0, 0x2a, 0x33, 0xf8, 0x1a, 0x32, 0xf0, 0x2b, 0x03, 0xbc, 0x52, 0xa0, 0x09, 0x21, + 0xe8, 0x2a, 0xa3, 0x20, 0xab, 0x95, 0x1b, 0xb0, 0x30, 0x17, 0xb8, 0x40, 0xb2, 0xaf, 0x00, 0x33, + 0x9d, 0x14, 0x9a, 0xa9, 0x25, 0x89, 0x82, 0xac, 0x28, 0x87, 0x8d, 0x22, 0x98, 0x8a, 0x12, 0xc9, + 0x08, 0x21, 0x81, 0x2b, 0xeb, 0x34, 0x09, 0xb9, 0x39, 0x95, 0x1d, 0x05, 0x99, 0x9b, 0x26, 0x9a, + 0x90, 0x28, 0x30, 0xb4, 0x0b, 0x72, 0xe0, 0x28, 0x90, 0x00, 0x89, 0x90, 0x43, 0xab, 0xb3, 0x59, + 0x80, 0xc9, 0x60, 0x81, 0x09, 0xa3, 0xb8, 0x9f, 0x21, 0x22, 0xba, 0x67, 0xbb, 0x11, 0x08, 0x21, + 0xca, 0x19, 0xc0, 0x29, 0x27, 0x89, 0xba, 0x21, 0xba, 0x20, 0x80, 0x34, 0x8a, 0x06, 0xdf, 0x10, + 0x08, 0x24, 0x9a, 0x00, 0x01, 0xcb, 0x11, 0x29, 0xc0, 0x10, 0x13, 0xcc, 0x50, 0xa1, 0x9a, 0x22, + 0x1c, 0x14, 0xbb, 0x40, 0xd8, 0x38, 0xb8, 0xa9, 0x53, 0x88, 0x05, 0x99, 0xaf, 0x21, 0x21, 0x90, + 0x88, 0xad, 0x31, 0x24, 0xfb, 0x30, 0x90, 0xbb, 0x51, 0x10, 0x94, 0x0b, 0x12, 0xfb, 0x69, 0x91, + 0x00, 0x99, 0x19, 0x82, 0x8c, 0x31, 0xb1, 0x9a, 0x12, 0x35, 0xf8, 0x2d, 0x84, 0x9a, 0x28, 0x94, + 0x0c, 0x80, 0x20, 0xd2, 0x0c, 0x33, 0xb8, 0x4a, 0x93, 0x0a, 0x9b, 0x27, 0xbc, 0x12, 0x49, 0x95, + 0x09, 0xaa, 0x11, 0x31, 0xeb, 0x43, 0xd9, 0x28, 0xa8, 0x01, 0x1a, 0x06, 0x9b, 0xb1, 0x08, 0x71, + 0xa1, 0x9c, 0x82, 0x1a, 0x39, 0xe1, 0x18, 0x12, 0xaa, 0x15, 0xae, 0x11, 0x14, 0xa8, 0x39, 0xd0, + 0xa0, 0x6a, 0x90, 0x80, 0x8b, 0x34, 0xba, 0x10, 0x35, 0xdc, 0x22, 0x8a, 0x01, 0x22, 0xba, 0xa9, + 0x19, 0xc4, 0x73, 0xba, 0x34, 0xb8, 0x19, 0xbc, 0x16, 0x1a, 0x01, 0xb0, 0x0f, 0x14, 0x9a, 0x18, + 0xb2, 0x4c, 0x93, 0x1b, 0x83, 0x8e, 0x13, 0xc8, 0x1c, 0x12, 0xb2, 0x5c, 0x90, 0x92, 0x1d, 0x92, + 0x41, 0x9a, 0xb9, 0x53, 0xb8, 0x4c, 0x94, 0x19, 0x29, 0xe2, 0x2b, 0x14, 0x81, 0xbb, 0x09, 0x23, + 0x4b, 0x97, 0xac, 0x30, 0x01, 0x9a, 0x09, 0xc1, 0x79, 0xa8, 0x82, 0x2a, 0x88, 0x85, 0xaa, 0xbd, + 0x48, 0x05, 0x09, 0xb8, 0x20, 0x88, 0x00, 0x07, 0x9f, 0x12, 0x20, 0xb8, 0xab, 0x32, 0x10, 0x00, + 0x03, 0xdd, 0x70, 0x90, 0x91, 0x99, 0x99, 0x54, 0xa9, 0x8a, 0x24, 0x89, 0x13, 0xca, 0x0a, 0x51, + 0x83, 0xdc, 0x10, 0x88, 0x14, 0x00, 0xa9, 0x2b, 0x97, 0x39, 0xeb, 0x00, 0x43, 0x88, 0xb9, 0x8b, + 0x82, 0x61, 0x80, 0x8b, 0x85, 0x19, 0x89, 0xca, 0x80, 0x55, 0xb9, 0x3a, 0xd2, 0x1c, 0x84, 0x2a, + 0xc0, 0x10, 0x01, 0x9c, 0x34, 0xa9, 0x4a, 0xb3, 0x1d, 0x92, 0x08, 0x32, 0xb0, 0xaa, 0x3c, 0x27, + 0x9a, 0xa3, 0x8e, 0x98, 0x25, 0x09, 0xd2, 0x0c, 0x14, 0x98, 0x1a, 0xa0, 0x1a, 0x13, 0xcb, 0x16, + 0x1e, 0x03, 0xa8, 0x2c, 0xa0, 0x42, 0x98, 0xb3, 0x1f, 0xa3, 0x38, 0xb8, 0xba, 0x31, 0x84, 0xab, + 0x3d, 0x07, 0x0d, 0x02, 0x88, 0x9b, 0x33, 0xa9, 0x92, 0x8d, 0x20, 0xf3, 0x3b, 0x04, 0x89, 0x00, + 0xa2, 0x9f, 0x82, 0x39, 0x84, 0x09, 0x8c, 0x25, 0x98, 0x98, 0x31, 0xbd, 0x40, 0x93, 0x9e, 0x43, + 0x80, 0x88, 0x88, 0x99, 0xa8, 0x7a, 0x94, 0x2b, 0xb8, 0x40, 0xa3, 0x08, 0x2b, 0xb6, 0x8c, 0x42, + 0xe0, 0x28, 0x91, 0x01, 0x0d, 0x83, 0x83, 0x9f, 0x00, 0x91, 0x8a, 0x28, 0x92, 0x0b, 0xb0, 0x45, + 0xfa, 0x29, 0x81, 0x80, 0x0c, 0x01, 0x88, 0x22, 0xdc, 0x12, 0x8c, 0x04, 0x40, 0xd9, 0x13, 0xaa, + 0x01, 0x33, 0xd0, 0x29, 0x21, 0xb8, 0x29, 0x17, 0xcc, 0x40, 0xa0, 0x88, 0x4a, 0x95, 0x10, 0x98, + 0xaa, 0x12, 0xac, 0x71, 0x01, 0xba, 0x31, 0x11, 0x9d, 0x98, 0x27, 0xac, 0x21, 0x90, 0x89, 0x32, + 0x9a, 0xa2, 0x1e, 0x02, 0x02, 0x9f, 0x82, 0x08, 0x8f, 0x03, 0x00, 0x10, 0xe0, 0x1c, 0x93, 0x1a, + 0x14, 0xca, 0x1a, 0xb2, 0x78, 0x81, 0x08, 0xb8, 0x2d, 0x87, 0x9b, 0x22, 0x00, 0xb9, 0x48, 0x98, + 0x30, 0x83, 0x89, 0xef, 0x13, 0x38, 0x91, 0xca, 0x3b, 0xb4, 0x29, 0x05, 0xba, 0x25, 0x99, 0x90, + 0xbb, 0x3a, 0x37, 0xd8, 0x39, 0x81, 0xa0, 0x89, 0x20, 0xca, 0x24, 0x01, 0xcb, 0x42, 0x9a, 0x94, + 0x8c, 0x80, 0x8a, 0x32, 0x65, 0xe8, 0x89, 0x4a, 0x95, 0x8d, 0x12, 0x18, 0x88, 0x09, 0xd1, 0x19, + 0x14, 0x80, 0xca, 0x2a, 0x14, 0x89, 0x9b, 0x15, 0x9b, 0x41, 0x95, 0x8d, 0x11, 0xb1, 0x4a, 0x90, + 0x80, 0x33, 0xcd, 0x10, 0x03, 0x09, 0x11, 0x8e, 0xc0, 0x6a, 0x92, 0x09, 0x02, 0xbb, 0x60, 0x83, + 0x8c, 0x02, 0xdb, 0x51, 0xa9, 0x21, 0x00, 0xa1, 0x19, 0x80, 0xfc, 0x41, 0xa1, 0x1c, 0x81, 0x81, + 0x80, 0x0c, 0x09, 0x85, 0xaa, 0x68, 0xd1, 0xab, 0x73, 0xa1, 0x8a, 0x12, 0x00, 0xda, 0x11, 0x9a, + 0x84, 0x00, 0x31, 0xe0, 0x8c, 0x25, 0xb8, 0x8b, 0x35, 0xd0, 0x19, 0x01, 0x91, 0xa9, 0x30, 0x90, + 0x8a, 0x20, 0x45, 0xf2, 0x1c, 0x03, 0xb8, 0x18, 0x41, 0xe8, 0x39, 0xa1, 0x2b, 0x81, 0x00, 0x43, + 0xc8, 0x19, 0x81, 0xdb, 0x62, 0xc0, 0x18, 0x11, 0xb8, 0x1a, 0x10, 0x25, 0xac, 0x11, 0x90, 0x9f, + 0x14, 0x89, 0x88, 0xa8, 0x62, 0xc8, 0x3b, 0xb3, 0x2d, 0x94, 0x28, 0x99, 0x08, 0x24, 0xf9, 0x19, + 0x11, 0x90, 0x58, 0xaa, 0x81, 0x1b, 0x31, 0xd2, 0x59, 0x81, 0x10, 0xfb, 0x3b, 0x12, 0x9a, 0x06, + 0xbb, 0x01, 0x43, 0xaa, 0x88, 0x8b, 0x07, 0x99, 0x29, 0xd3, 0x9c, 0x32, 0x13, 0xb9, 0x0b, 0x13, + 0x3a, 0x55, 0xf9, 0x9a, 0x12, 0x99, 0xa8, 0x39, 0x47, 0xa1, 0xb8, 0x2b, 0x93, 0xcb, 0x27, 0xac, + 0x21, 0x23, 0xb9, 0xac, 0x81, 0x73, 0xb8, 0x31, 0x08, 0xeb, 0x18, 0x22, 0x11, 0x19, 0x05, 0xdb, + 0x30, 0x09, 0x05, 0x00, 0x9b, 0x89, 0x08, 0x73, 0x82, 0xcc, 0x12, 0x0b, 0x90, 0x90, 0x25, 0xaf, + 0x14, 0xaa, 0x80, 0x39, 0x98, 0x27, 0xbb, 0x43, 0xbc, 0x08, 0x03, 0x9b, 0x02, 0x3b, 0xa6, 0x09, + 0x10, 0x24, 0xcd, 0x19, 0x13, 0xba, 0x0a, 0x36, 0xdb, 0x38, 0xb8, 0x8a, 0x70, 0x95, 0x8b, 0x02, + 0x9b, 0x30, 0x23, 0xc0, 0x01, 0x1a, 0xf3, 0x1c, 0x5a, 0x93, 0x99, 0x0c, 0x35, 0x91, 0xab, 0x15, + 0xc9, 0x18, 0x11, 0x80, 0x99, 0x50, 0xc2, 0x1b, 0x40, 0xc3, 0x2a, 0xb1, 0x5d, 0xb2, 0x8c, 0x41, + 0xc8, 0x1a, 0x04, 0xaa, 0x4a, 0x84, 0x88, 0x1b, 0x88, 0x00, 0xa2, 0x0c, 0x09, 0x17, 0xad, 0x12, + 0x88, 0x30, 0xd4, 0x0a, 0x11, 0xb0, 0x0c, 0x82, 0x9a, 0x72, 0x80, 0xa3, 0x19, 0x19, 0x96, 0x9c, + 0x39, 0x92, 0x51, 0x34, 0xe0, 0x9d, 0x32, 0xb1, 0x29, 0x88, 0x32, 0x13, 0xbd, 0x42, 0xd9, 0x38, + 0x14, 0xb9, 0x9f, 0x11, 0x99, 0x28, 0x02, 0x02, 0xaf, 0x01, 0x20, 0xbb, 0x31, 0x07, 0xbd, 0x29, + 0x13, 0xbb, 0x21, 0xb8, 0x2b, 0x05, 0x59, 0xa6, 0x8e, 0x22, 0xa8, 0xaa, 0x31, 0x93, 0x4a, 0x92, + 0x8a, 0x88, 0x32, 0x61, 0xb0, 0xab, 0x39, 0x97, 0x8f, 0x32, 0xa9, 0x10, 0x23, 0xcc, 0x38, 0xa2, + 0x12, 0x8e, 0x88, 0x34, 0xb0, 0x1e, 0x80, 0x02, 0x49, 0x93, 0xce, 0x68, 0x91, 0x08, 0xba, 0x28, + 0x13, 0x88, 0x1b, 0x17, 0xe9, 0x39, 0x91, 0x2b, 0x84, 0x20, 0xcc, 0x88, 0x08, 0x42, 0xb1, 0x0c, + 0x98, 0x10, 0x2a, 0x83, 0xca, 0x0c, 0x26, 0x80, 0xca, 0x38, 0x83, 0x9b, 0xad, 0xb3, 0x7b, 0x92, + 0x88, 0x73, 0xb0, 0x08, 0x99, 0xc0, 0x4a, 0x16, 0xb9, 0x09, 0x21, 0xb0, 0x43, 0xa1, 0x9e, 0x33, + 0x99, 0x22, 0xbf, 0x02, 0x22, 0xba, 0x01, 0x2b, 0xc2, 0x27, 0x8a, 0xda, 0x38, 0x25, 0x19, 0xba, + 0x22, 0xaa, 0x13, 0x9c, 0xd1, 0x73, 0x91, 0xbb, 0x81, 0x21, 0x61, 0xfa, 0x28, 0x80, 0x32, 0xca, + 0x39, 0xf1, 0x39, 0x81, 0x98, 0x8b, 0x14, 0x10, 0x90, 0xf8, 0x4a, 0xb2, 0x39, 0xd4, 0x2c, 0x04, + 0x98, 0x09, 0xc9, 0x30, 0x81, 0xb8, 0x38, 0x52, 0xd8, 0x19, 0xa0, 0x3a, 0x00, 0x37, 0xac, 0xa8, + 0x10, 0x12, 0xa9, 0x9b, 0x37, 0x00, 0xd8, 0x20, 0xc9, 0x00, 0x71, 0xa1, 0x8e, 0x30, 0x83, 0xad, + 0x32, 0xc0, 0x18, 0x12, 0xcb, 0x31, 0x81, 0x18, 0x80, 0xec, 0x51, 0x98, 0x1a, 0x11, 0x11, 0x8b, + 0x87, 0xad, 0x21, 0x12, 0x98, 0x80, 0x9e, 0x12, 0x0a, 0x82, 0x32, 0xaf, 0x30, 0x84, 0xbd, 0x38, + 0x83, 0x0b, 0x05, 0x9c, 0x21, 0x11, 0xa2, 0x2a, 0xfc, 0x50, 0x98, 0x90, 0x28, 0xa0, 0x19, 0xb0, + 0x18, 0xa0, 0x03, 0x3e, 0x96, 0x0a, 0xb0, 0x6b, 0x82, 0x92, 0x1c, 0x00, 0xc0, 0x2a, 0x87, 0x98, + 0x50, 0xd0, 0x88, 0x11, 0x10, 0xc8, 0x89, 0x8b, 0x16, 0x08, 0x13, 0xac, 0x82, 0x9d, 0x11, 0x00, + 0x4a, 0x05, 0xa0, 0xad, 0x71, 0x90, 0xa9, 0x29, 0x80, 0x03, 0x89, 0xb8, 0x4a, 0xc0, 0x74, 0xc8, + 0x1a, 0x88, 0x93, 0x0d, 0x23, 0x10, 0x89, 0x83, 0xdc, 0x4a, 0xd3, 0x38, 0xc0, 0x18, 0x12, 0xa8, + 0x2c, 0x24, 0xac, 0x13, 0x99, 0xea, 0x30, 0x23, 0xb1, 0x1c, 0xb8, 0x30, 0x98, 0x25, 0x81, 0xcf, + 0x28, 0x06, 0x9a, 0x21, 0x98, 0x09, 0xd8, 0x69, 0x83, 0x8a, 0x82, 0xab, 0x89, 0x31, 0x07, 0x0b, + 0x99, 0x33, 0xc8, 0x09, 0xfb, 0x50, 0x83, 0x88, 0xd9, 0x2a, 0x11, 0x88, 0x21, 0x9e, 0x41, 0xc1, + 0x01, 0x9e, 0x32, 0x92, 0x0c, 0x81, 0xf0, 0x30, 0x98, 0x80, 0xa0, 0x58, 0x82, 0xdb, 0x39, 0x02, + 0x0a, 0x24, 0xdb, 0x81, 0x18, 0x93, 0xba, 0x73, 0xa9, 0xa2, 0x2b, 0xda, 0x43, 0x8b, 0x21, 0xc1, + 0x0f, 0x11, 0x81, 0x1c, 0x81, 0x21, 0xd2, 0x8d, 0x22, 0xe8, 0x58, 0xa3, 0x99, 0xa8, 0x31, 0x88, + 0x98, 0x52, 0x11, 0xfc, 0x40, 0xa1, 0x28, 0xa0, 0x09, 0x99, 0x43, 0x88, 0x49, 0x94, 0x8a, 0x08, + 0x91, 0x14, 0x8b, 0xca, 0x23, 0xa3, 0x3e, 0xe1, 0x22, 0x38, 0xd1, 0xcb, 0x89, 0x42, 0x30, 0xa3, + 0xcc, 0x61, 0xbb, 0x28, 0x05, 0x8c, 0x43, 0x98, 0xa2, 0x8c, 0x98, 0x21, 0xcb, 0x21, 0x9c, 0xa8, + 0x72, 0xb3, 0xdb, 0x73, 0xb8, 0x88, 0x08, 0x92, 0x5b, 0xc3, 0x29, 0xb1, 0x49, 0xa8, 0x84, 0x8c, + 0x38, 0x03, 0x88, 0xfb, 0x10, 0x32, 0x9d, 0x21, 0xd1, 0x49, 0x81, 0xa8, 0xa9, 0x20, 0x73, 0xd3, + 0x89, 0x20, 0x98, 0x80, 0xab, 0x65, 0x90, 0x81, 0xa9, 0x2b, 0x15, 0x88, 0x22, 0xdd, 0x32, 0x19, + 0xa1, 0x9f, 0x12, 0x48, 0xb0, 0x20, 0xaa, 0x19, 0x11, 0xd8, 0x30, 0x1b, 0xa5, 0x0c, 0x10, 0xc9, + 0x43, 0x9d, 0x43, 0xb9, 0x60, 0xc8, 0x09, 0x80, 0x00, 0x08, 0xa4, 0x1a, 0x91, 0x1c, 0x94, 0x9e, + 0x32, 0xa9, 0x82, 0x9c, 0x42, 0x10, 0xfa, 0x20, 0xb0, 0x2a, 0x88, 0xd1, 0x69, 0x91, 0x08, 0x12, + 0xad, 0x42, 0xda, 0x28, 0x13, 0x91, 0x19, 0x88, 0x12, 0x9a, 0x44, 0xa0, 0x8c, 0x07, 0x8b, 0x91, + 0x39, 0xa1, 0x23, 0x0f, 0x94, 0x0b, 0x09, 0x82, 0x00, 0xb9, 0x8f, 0x86, 0x0b, 0xa3, 0x98, 0x0c, + 0x06, 0x08, 0x08, 0x04, 0x9c, 0x09, 0xe1, 0x68, 0x98, 0x01, 0x00, 0x0a, 0x08, 0x98, 0x32, 0xa9, + 0x71, 0x9a, 0xa4, 0x3d, 0xd9, 0x44, 0x09, 0xc8, 0x48, 0xb0, 0x18, 0x19, 0x04, 0x9a, 0x21, 0x8d, + 0xa0, 0x64, 0xb0, 0x19, 0xb2, 0x1b, 0xd8, 0x19, 0x03, 0x14, 0x0f, 0x13, 0x8b, 0xc1, 0x58, 0xb0, + 0xa8, 0x39, 0x84, 0x00, 0xbd, 0x04, 0x89, 0x18, 0x18, 0x94, 0xdb, 0x4b, 0x92, 0x31, 0x9a, 0xcc, + 0x43, 0xbc, 0x25, 0x88, 0x09, 0xa8, 0x11, 0x59, 0x83, 0x02, 0xaf, 0x98, 0x3a, 0x20, 0x07, 0x0b, + 0x91, 0x88, 0x20, 0x92, 0x2d, 0x12, 0xb2, 0xaf, 0x84, 0x0a, 0x51, 0x93, 0x29, 0x80, 0x81, 0xfd, + 0x21, 0x99, 0x42, 0xa9, 0x88, 0x00, 0x09, 0x17, 0xba, 0xa1, 0x70, 0xb9, 0x31, 0x90, 0xc0, 0x49, + 0xa3, 0x08, 0x2d, 0xb5, 0x0b, 0x98, 0x20, 0x80, 0x11, 0x73, 0xfa, 0x19, 0x30, 0xc0, 0x99, 0x38, + 0xb0, 0x31, 0xa3, 0x10, 0x8f, 0x03, 0xd1, 0x8f, 0x24, 0xb0, 0x00, 0x9b, 0x23, 0x99, 0x12, 0x04, + 0x9a, 0xaf, 0x33, 0xbc, 0x26, 0x9a, 0xa3, 0x38, 0xaa, 0x22, 0x0a, 0x06, 0x1c, 0x93, 0x0f, 0x02, + 0x99, 0x38, 0x82, 0x9a, 0x42, 0xd3, 0x2a, 0xa8, 0x94, 0x60, 0xa8, 0x91, 0x91, 0x0f, 0x02, 0x81, + 0x18, 0xba, 0xab, 0x26, 0x08, 0x09, 0xfa, 0x7b, 0xa2, 0x09, 0x88, 0x80, 0x01, 0x10, 0x19, 0xa3, + 0x9e, 0x09, 0x8f, 0x07, 0x38, 0xa8, 0xb8, 0x8d, 0x02, 0x18, 0x05, 0xab, 0x12, 0x18, 0x88, 0xa8, + 0x40, 0x00, 0xf3, 0x3b, 0x09, 0xd0, 0x73, 0xa1, 0x9b, 0x00, 0x29, 0x94, 0x38, 0x0a, 0x83, 0xcf, + 0x04, 0x0c, 0x91, 0x01, 0x98, 0x0b, 0x05, 0x30, 0x92, 0x8e, 0x98, 0x03, 0xbb, 0x48, 0x53, 0xb3, + 0xc8, 0xae, 0x39, 0x84, 0x20, 0x94, 0xbe, 0x28, 0x05, 0x88, 0x98, 0x12, 0xc9, 0x28, 0xd1, 0x38, + 0x92, 0x3b, 0x94, 0x8e, 0x20, 0x06, 0xab, 0x01, 0x81, 0x28, 0xf8, 0x30, 0x88, 0x98, 0x2c, 0x94, + 0x0a, 0x40, 0xa4, 0xaf, 0x21, 0x80, 0x22, 0xa1, 0x1b, 0xb2, 0xcb, 0x7b, 0xa3, 0x99, 0x51, 0xa2, + 0xa9, 0x2a, 0x04, 0x92, 0x9b, 0xd4, 0x1e, 0x93, 0x09, 0x11, 0xa8, 0x58, 0x80, 0x28, 0xaf, 0x95, + 0x0b, 0x91, 0x21, 0x8b, 0x84, 0x89, 0x1b, 0xb9, 0x42, 0xa8, 0x73, 0xf0, 0x00, 0x89, 0xa2, 0x5b, + 0xb3, 0x3a, 0xc2, 0x2b, 0x00, 0x83, 0x37, 0x0d, 0xb0, 0x48, 0x89, 0x12, 0x18, 0x29, 0x84, 0x8d, + 0xd8, 0x19, 0x02, 0x4b, 0x87, 0x8a, 0x01, 0xaa, 0x48, 0x83, 0x0b, 0xfa, 0x28, 0x20, 0x32, 0xf3, + 0x2d, 0x93, 0x0a, 0x82, 0x88, 0x8a, 0x21, 0x19, 0xc3, 0x08, 0x79, 0x97, 0x8b, 0x92, 0x0a, 0xa0, + 0x40, 0xb0, 0x9b, 0x67, 0xb8, 0x80, 0x89, 0x00, 0x21, 0xb2, 0x2e, 0x03, 0x0c, 0x11, 0xea, 0x41, + 0x00, 0xc8, 0x2b, 0x01, 0x90, 0x49, 0xd0, 0x28, 0xb2, 0x3a, 0xd0, 0x1c, 0x43, 0x01, 0xcc, 0x19, + 0x52, 0xc9, 0x10, 0x8a, 0x22, 0x91, 0x4b, 0xe8, 0x2b, 0x24, 0x92, 0xbe, 0x40, 0x92, 0x0a, 0x10, + 0x19, 0xb9, 0x63, 0x8a, 0x93, 0x9b, 0x68, 0x90, 0x80, 0x41, 0x10, 0x09, 0x0b, 0xf0, 0x0a, 0x70, + 0xb9, 0x32, 0x1c, 0x83, 0xb2, 0x2b, 0x0c, 0xa4, 0x89, 0xcb, 0x31, 0x73, 0xc1, 0x4a, 0x00, 0x09, + 0x12, 0x03, 0xdb, 0x8f, 0x13, 0x30, 0xa2, 0x3b, 0xc6, 0x0c, 0x01, 0x10, 0x98, 0x8c, 0x15, 0x8a, + 0xaa, 0x00, 0x23, 0x8f, 0x12, 0xc0, 0x1a, 0x02, 0x92, 0x9b, 0x13, 0xd1, 0x1a, 0xaa, 0x97, 0x4c, + 0x04, 0x89, 0xcb, 0x32, 0xa9, 0x89, 0x35, 0xe9, 0x18, 0x11, 0x9b, 0x94, 0x1e, 0x81, 0x1a, 0x13, + 0xac, 0x88, 0xa0, 0x72, 0x99, 0x02, 0x13, 0x99, 0xce, 0x18, 0x33, 0xc8, 0x09, 0x04, 0x8d, 0x33, + 0x83, 0x0d, 0x98, 0x00, 0xcc, 0x43, 0xc8, 0x39, 0x92, 0x81, 0x01, 0xbb, 0x7b, 0xa7, 0x0b, 0x18, + 0x84, 0x8b, 0x12, 0xb0, 0x08, 0x09, 0x33, 0x8c, 0xc0, 0x61, 0x90, 0xc3, 0x3b, 0x88, 0xb4, 0x70, + 0xa1, 0x09, 0xa9, 0xa8, 0x1a, 0x94, 0x79, 0xb6, 0x09, 0x9a, 0x13, 0x39, 0x84, 0xcd, 0x28, 0xd0, + 0x29, 0x23, 0xf9, 0x18, 0x21, 0xd8, 0x19, 0x02, 0xaa, 0x10, 0x01, 0x1c, 0x95, 0x1b, 0xa3, 0x9e, + 0x30, 0x96, 0x0b, 0x01, 0xa2, 0x8a, 0xaa, 0x83, 0x3c, 0x23, 0xb1, 0x9c, 0x10, 0x73, 0xf3, 0x0e, + 0x02, 0x09, 0x82, 0x11, 0x8c, 0x92, 0x28, 0xc9, 0x43, 0x8a, 0xb0, 0x29, 0x1f, 0x06, 0x8b, 0x88, + 0xa2, 0x2b, 0x17, 0xca, 0x21, 0xa9, 0x32, 0xc0, 0x9b, 0x48, 0xa2, 0x8d, 0x43, 0xb0, 0x0c, 0x23, + 0x89, 0x8c, 0x42, 0x82, 0x9d, 0x80, 0x43, 0x09, 0x9a, 0x94, 0x9f, 0x11, 0x33, 0xb8, 0x09, 0xb9, + 0x9a, 0x54, 0xb1, 0x3a, 0xb3, 0x28, 0xfb, 0x08, 0x14, 0xcc, 0x88, 0x51, 0xa8, 0x98, 0x59, 0xa2, + 0xa9, 0x40, 0xa1, 0x0d, 0x93, 0x3c, 0xe0, 0x50, 0x90, 0xab, 0x22, 0xc0, 0x31, 0xd0, 0x29, 0x91, + 0x18, 0x88, 0x39, 0xb1, 0x61, 0xea, 0x29, 0x99, 0xa2, 0x1e, 0x16, 0xa9, 0x80, 0x99, 0x19, 0x04, + 0x1c, 0x82, 0x81, 0x28, 0xeb, 0x29, 0x80, 0x88, 0x64, 0x8a, 0xb1, 0x00, 0x38, 0xaa, 0x6a, 0x93, + 0x90, 0x1b, 0xdf, 0x30, 0x98, 0x02, 0xc2, 0x78, 0xc9, 0x18, 0x08, 0xa0, 0x29, 0x81, 0x10, 0x0b, + 0xb5, 0x11, 0xbc, 0x09, 0x43, 0xd9, 0x31, 0xcc, 0x21, 0x31, 0xc1, 0xbb, 0x13, 0x31, 0x90, 0xc4, + 0x1c, 0xe1, 0x39, 0x03, 0xaa, 0x21, 0x9d, 0x03, 0x9f, 0x05, 0xaa, 0x49, 0xd1, 0x28, 0x29, 0x92, + 0x1b, 0xc1, 0x19, 0xb0, 0x70, 0xc8, 0x88, 0x39, 0xd3, 0x28, 0x9b, 0x07, 0xaa, 0x3a, 0xa4, 0x80, + 0x1b, 0xa3, 0x0d, 0x98, 0x24, 0xd0, 0x0a, 0x28, 0xa1, 0x8d, 0x08, 0x03, 0xaf, 0x62, 0xa0, 0x8b, + 0x22, 0xb8, 0x39, 0xb1, 0x02, 0x8c, 0x85, 0x90, 0x19, 0xc9, 0x92, 0x4a, 0xcb, 0x21, 0x30, 0x91, + 0xad, 0x21, 0x61, 0xba, 0x29, 0xa1, 0x44, 0xba, 0x9b, 0xa9, 0x0b, 0x43, 0x93, 0xad, 0x81, 0x30, + 0xf0, 0x29, 0x10, 0x91, 0x9c, 0xb1, 0x5a, 0xa1, 0x29, 0xb0, 0x9b, 0x0b, 0x05, 0x9b, 0x18, 0x93, + 0xcb, 0x1c, 0xa3, 0x39, 0xb1, 0x20, 0xba, 0xbb, 0x30, 0xa1, 0x99, 0x11, 0xb9, 0x9a, 0x21, 0xa0, + 0x99, 0x1a, 0xb1, 0x00, 0x0b, 0x03, 0x0a, 0x99, 0x99, 0x0b, 0x91, 0x10, 0x01, 0xa9, 0x19, 0x99, + 0x99, 0x09, 0x90, 0x0a, 0x90, 0x99, 0x09, 0x79, 0x02, 0x01, 0x0f, 0x7d, 0x0b, 0x02, 0xcd, 0x06, + 0x47, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0x08, 0x88, 0x08, + 0x08, 0x88, 0x80, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0x00, 0x08, 0x01, 0x01, 0x01, 0x10, 0x22, + 0x11, 0x29, 0x77, 0x24, 0x98, 0xaa, 0xac, 0x40, 0x37, 0x03, 0x00, 0x90, 0xdc, 0x9b, 0x10, 0x08, + 0x51, 0x44, 0x12, 0x90, 0xba, 0x9a, 0xfa, 0xad, 0x9a, 0x9a, 0x20, 0x47, 0x43, 0x11, 0x80, 0xb8, + 0xac, 0xaa, 0xb9, 0xbf, 0x9b, 0x51, 0x34, 0x33, 0x36, 0x33, 0x22, 0x12, 0xb0, 0xbe, 0xab, 0x09, + 0x20, 0x02, 0xfb, 0xab, 0xa9, 0xbb, 0x51, 0x24, 0x01, 0x63, 0x33, 0xb8, 0xbe, 0xcd, 0x9b, 0x18, + 0x52, 0x33, 0x81, 0xcb, 0x89, 0x21, 0x11, 0x31, 0x24, 0x31, 0x53, 0x13, 0xca, 0xcb, 0xeb, 0xbb, + 0xac, 0x18, 0x32, 0x44, 0x34, 0x24, 0xa0, 0xce, 0x9b, 0x30, 0x44, 0x12, 0xa8, 0xcc, 0xba, 0x89, + 0x80, 0x98, 0x99, 0x88, 0x73, 0x37, 0x22, 0x80, 0x98, 0x08, 0x33, 0x13, 0x01, 0xeb, 0xab, 0x89, + 0xaa, 0x48, 0x47, 0x23, 0x81, 0xb9, 0xcd, 0xac, 0x99, 0x00, 0x22, 0x82, 0xba, 0x9c, 0x10, 0x44, + 0x44, 0x12, 0xa8, 0xaa, 0x0a, 0x00, 0xfa, 0xcd, 0x9a, 0x38, 0x37, 0x24, 0x80, 0xb9, 0xbb, 0xbb, + 0x8a, 0x08, 0x01, 0x88, 0x42, 0x81, 0x9a, 0x00, 0xea, 0x8a, 0x75, 0x44, 0x12, 0x00, 0x11, 0x21, + 0xa0, 0xde, 0xbc, 0xbb, 0x99, 0x08, 0x00, 0x32, 0x65, 0x34, 0x35, 0x22, 0x81, 0xa9, 0xab, 0x99, + 0xba, 0xbd, 0xac, 0x9b, 0x89, 0x00, 0x64, 0x34, 0x23, 0x32, 0x22, 0x81, 0xdb, 0xbc, 0xab, 0xbb, + 0xbd, 0xbd, 0xaa, 0x88, 0x11, 0x22, 0x23, 0x01, 0x10, 0x65, 0x44, 0x22, 0x81, 0xca, 0xbc, 0xab, + 0x9a, 0xdb, 0xbc, 0xac, 0x18, 0x22, 0x12, 0x00, 0x00, 0x20, 0x67, 0x43, 0x12, 0x98, 0x99, 0x98, + 0xa8, 0xfb, 0xbc, 0xaa, 0x89, 0x00, 0x11, 0x41, 0x46, 0x43, 0x34, 0x23, 0x02, 0x99, 0xab, 0xbb, + 0xeb, 0xcc, 0xab, 0x18, 0x64, 0x33, 0x12, 0x80, 0x89, 0x08, 0x31, 0x12, 0x90, 0xca, 0x9a, 0x00, + 0xd9, 0xef, 0xcc, 0xba, 0x09, 0x10, 0x33, 0x23, 0x43, 0x44, 0x44, 0x22, 0x80, 0xba, 0xbe, 0xbc, + 0xba, 0xaa, 0x9a, 0x08, 0x31, 0x34, 0x23, 0x23, 0x02, 0x88, 0x41, 0x45, 0x13, 0x80, 0x08, 0x11, + 0x82, 0xba, 0xac, 0x89, 0x98, 0xfd, 0xcc, 0xbb, 0x08, 0x63, 0x54, 0x34, 0x33, 0x12, 0x01, 0x98, + 0xba, 0xbf, 0xbc, 0xab, 0x9a, 0x89, 0x00, 0x43, 0x45, 0x43, 0x32, 0x22, 0x02, 0x98, 0xcc, 0xcc, + 0xbb, 0xcc, 0xbb, 0xbb, 0x99, 0x80, 0x08, 0x42, 0x54, 0x44, 0x33, 0x32, 0x01, 0xa8, 0xcc, 0xac, + 0xaa, 0x99, 0xaa, 0x9a, 0x99, 0x99, 0xdb, 0x8a, 0x54, 0x34, 0x33, 0x43, 0x32, 0x33, 0x22, 0x98, + 0x99, 0x88, 0xd9, 0xcd, 0xcc, 0xca, 0xaa, 0x8a, 0x31, 0x55, 0x43, 0x33, 0x22, 0x22, 0x00, 0x98, + 0xcb, 0xcb, 0xcb, 0xaa, 0x09, 0x21, 0x11, 0x10, 0x51, 0x45, 0x35, 0x24, 0x01, 0x90, 0xb9, 0xbb, + 0xcd, 0xbc, 0xbe, 0xcb, 0xab, 0x9a, 0x10, 0x33, 0x35, 0x35, 0x43, 0x23, 0x11, 0x80, 0xb9, 0xbd, + 0xbc, 0xab, 0xcb, 0xcb, 0xbb, 0xaa, 0x8a, 0x31, 0x46, 0x24, 0x22, 0x12, 0x00, 0x21, 0x33, 0x24, + 0x12, 0x90, 0x99, 0x08, 0x88, 0xea, 0xde, 0xac, 0x9a, 0x30, 0x55, 0x43, 0x22, 0x80, 0x88, 0x98, + 0xaa, 0xbc, 0xbd, 0xaa, 0x09, 0x21, 0x12, 0x01, 0x41, 0x65, 0x44, 0x33, 0x33, 0x03, 0xa9, 0xce, + 0xcc, 0xcb, 0xba, 0xaa, 0xaa, 0x99, 0x09, 0x40, 0x45, 0x34, 0x24, 0x12, 0x10, 0x80, 0x90, 0xb9, + 0xbb, 0xab, 0xba, 0xdc, 0xcb, 0xbb, 0xbc, 0xab, 0x89, 0x41, 0x44, 0x43, 0x32, 0x33, 0x36, 0x34, + 0x12, 0x98, 0xcb, 0xcb, 0xaa, 0x98, 0xa9, 0xbb, 0xba, 0x38, 0x77, 0x34, 0x23, 0x11, 0x88, 0x98, + 0x98, 0xcb, 0xdc, 0xcb, 0xaa, 0x9a, 0x08, 0x20, 0x32, 0x55, 0x53, 0x43, 0x23, 0x02, 0x98, 0xba, + 0xcc, 0xdc, 0xbc, 0xac, 0xab, 0x8a, 0x00, 0x20, 0x43, 0x43, 0x34, 0x43, 0x32, 0x12, 0x00, 0xa8, + 0xa9, 0xaa, 0x99, 0xda, 0xdd, 0xbc, 0xbc, 0xab, 0x99, 0x09, 0x10, 0x53, 0x54, 0x43, 0x23, 0x23, + 0x12, 0x01, 0xa8, 0xcb, 0xbc, 0xab, 0xbb, 0xcb, 0x0a, 0x52, 0x54, 0x33, 0x33, 0x11, 0x80, 0xa9, + 0xa9, 0xba, 0xcb, 0xaa, 0x9b, 0x99, 0xca, 0xaa, 0x09, 0x72, 0x55, 0x54, 0x33, 0x23, 0x81, 0xb9, + 0xdb, 0xcc, 0xcc, 0xcc, 0xba, 0x9a, 0x89, 0x08, 0x42, 0x34, 0x35, 0x32, 0x22, 0x11, 0x01, 0x98, + 0x98, 0xaa, 0xda, 0xcc, 0xbb, 0xbc, 0xac, 0xbb, 0xbc, 0xbb, 0x89, 0x72, 0x53, 0x33, 0x43, 0x23, + 0x23, 0x02, 0x98, 0xcb, 0xab, 0x9a, 0x89, 0xba, 0xbc, 0x0a, 0x53, 0x56, 0x43, 0x13, 0x02, 0x88, + 0x8a, 0x08, 0x21, 0x80, 0xfb, 0xcc, 0xab, 0x9b, 0x08, 0x31, 0x44, 0x34, 0x44, 0x32, 0x23, 0x12, + 0xa8, 0xec, 0xcd, 0xcc, 0xbb, 0xbb, 0xbb, 0x9a, 0x18, 0x55, 0x44, 0x32, 0x22, 0x11, 0x00, 0x88, + 0x99, 0xaa, 0xaa, 0xa9, 0xaa, 0xdd, 0xcd, 0xcb, 0xbb, 0xbb, 0x99, 0x20, 0x44, 0x34, 0x44, 0x33, + 0x24, 0x33, 0x23, 0x81, 0xa9, 0xbd, 0xcb, 0xbb, 0xba, 0xbb, 0x09, 0x41, 0x54, 0x23, 0x13, 0x01, + 0x00, 0x11, 0x33, 0x22, 0xb8, 0xcf, 0xbc, 0xab, 0x9a, 0x89, 0x89, 0x00, 0x21, 0x43, 0x33, 0x03, + 0xb9, 0xde, 0xdd, 0xcd, 0xcb, 0xcb, 0xaa, 0x9a, 0x09, 0x41, 0x44, 0x24, 0x23, 0x22, 0x01, 0x01, + 0x11, 0x01, 0x01, 0x88, 0xba, 0xce, 0xce, 0xbc, 0xbc, 0xbb, 0x9a, 0x10, 0x63, 0x43, 0x33, 0x34, + 0x34, 0x33, 0x23, 0x12, 0x90, 0xbc, 0xbd, 0xbb, 0xbb, 0xab, 0x8a, 0x31, 0x46, 0x32, 0x22, 0x12, + 0x22, 0x23, 0x13, 0x80, 0x9a, 0xbb, 0xbd, 0xcd, 0xdb, 0xbb, 0xbc, 0xaa, 0xa9, 0x18, 0x32, 0x24, + 0x11, 0x23, 0x13, 0xfa, 0xff, 0xbc, 0xbc, 0xbb, 0xbb, 0x88, 0x43, 0x45, 0x43, 0x23, 0x33, 0x22, + 0x12, 0x01, 0x01, 0x98, 0xca, 0xec, 0xcc, 0xbc, 0xcb, 0xaa, 0x89, 0x18, 0x21, 0x42, 0x53, 0x53, + 0x33, 0x34, 0x43, 0x22, 0x01, 0xa8, 0xca, 0xac, 0xac, 0xba, 0xaa, 0x9a, 0x09, 0x21, 0x43, 0x33, + 0x34, 0x34, 0x22, 0x11, 0x08, 0xa8, 0xcc, 0xcc, 0xcb, 0xbc, 0xbc, 0xaa, 0x08, 0x11, 0x12, 0x90, + 0x99, 0x30, 0x36, 0x24, 0xb8, 0xef, 0xcb, 0xbc, 0xab, 0xaa, 0x08, 0x51, 0x44, 0x34, 0x33, 0x32, + 0x12, 0x11, 0x22, 0x12, 0xa8, 0xfb, 0xdc, 0xbb, 0xac, 0xbb, 0x99, 0x10, 0x21, 0x32, 0x53, 0x63, + 0x43, 0x34, 0x34, 0x24, 0x22, 0x02, 0x98, 0xbc, 0xbd, 0xba, 0xab, 0xa9, 0x99, 0x08, 0x18, 0x32, + 0x36, 0x34, 0x23, 0x22, 0x02, 0xa8, 0xcd, 0xcc, 0xbb, 0xbd, 0xac, 0x9a, 0x19, 0x10, 0x81, 0x98, + 0x9a, 0x28, 0x66, 0x43, 0x12, 0xc9, 0xcd, 0xcc, 0xba, 0xbb, 0xa9, 0x08, 0x32, 0x37, 0x34, 0x34, + 0x12, 0x12, 0x21, 0x21, 0x81, 0xc9, 0xcd, 0xcc, 0xab, 0xbb, 0x99, 0x18, 0x10, 0x22, 0x32, 0x45, + 0x34, 0x35, 0x43, 0x34, 0x23, 0x23, 0x81, 0xb9, 0xcc, 0xac, 0xbb, 0xaa, 0xab, 0x9a, 0x99, 0x10, + 0x52, 0x44, 0x34, 0x23, 0x23, 0x81, 0xc9, 0xcc, 0xdb, 0xcb, 0xab, 0xab, 0x09, 0x18, 0x00, 0x88, + 0x99, 0x28, 0x55, 0x45, 0x43, 0x01, 0xba, 0xce, 0xcc, 0xbb, 0xaa, 0x8a, 0x20, 0x44, 0x34, 0x34, + 0x23, 0x22, 0x21, 0x01, 0x01, 0xa8, 0xeb, 0xbd, 0xbc, 0xbb, 0xab, 0x89, 0x11, 0x23, 0x12, 0x00, + 0x41, 0x56, 0x45, 0x34, 0x24, 0x23, 0x12, 0x98, 0xca, 0xcb, 0xbb, 0xba, 0xba, 0xbb, 0xbc, 0xab, + 0x08, 0x44, 0x44, 0x23, 0x33, 0x14, 0x02, 0xb9, 0xdc, 0xbc, 0xac, 0xab, 0x99, 0x88, 0x98, 0xa9, + 0xaa, 0x9b, 0x20, 0x56, 0x44, 0x22, 0x90, 0xeb, 0xbd, 0xbc, 0xab, 0x9a, 0x18, 0x42, 0x44, 0x43, + 0x23, 0x23, 0x12, 0x12, 0x12, 0x11, 0xb9, 0xcf, 0xbc, 0xcb, 0x9a, 0x89, 0x10, 0x21, 0x10, 0x08, + 0x20, 0x65, 0x54, 0x34, 0x44, 0x22, 0x22, 0x00, 0xa8, 0xca, 0xcb, 0xba, 0xba, 0xba, 0xbb, 0x9a, + 0x08, 0x43, 0x45, 0x33, 0x43, 0x22, 0x02, 0x90, 0xcc, 0xcc, 0xbb, 0xac, 0x99, 0x99, 0x99, 0xcb, + 0xbc, 0xcb, 0x8a, 0x42, 0x36, 0x34, 0x13, 0xa0, 0xdc, 0xbc, 0xcb, 0x9a, 0x89, 0x00, 0x21, 0x42, + 0x42, 0x33, 0x43, 0x33, 0x34, 0x33, 0x12, 0xda, 0xbd, 0xbd, 0xaa, 0x9a, 0x88, 0x01, 0x01, 0x88, + 0x00, 0x63, 0x64, 0x44, 0x43, 0x24, 0x32, 0x11, 0x00, 0xa9, 0xca, 0xbb, 0xac, 0xbb, 0xca, 0xca, + 0xaa, 0x88, 0x21, 0x35, 0x35, 0x32, 0x22, 0x01, 0xb8, 0xcc, 0xcc, 0xbb, 0xab, 0xa9, 0xca, 0xcb, + 0xac, 0xbb, 0x9b, 0x40, 0x45, 0x34, 0x33, 0x81, 0xc9, 0xbd, 0xad, 0xab, 0x99, 0x89, 0x88, 0x10, + 0x31, 0x35, 0x43, 0x33, 0x44, 0x34, 0x43, 0x01, 0x98, 0xcb, 0xac, 0x9b, 0x99, 0x89, 0xa9, 0xbb, + 0xbb, 0x0a, 0x75, 0x55, 0x53, 0x43, 0x33, 0x32, 0x11, 0x81, 0xa8, 0xdb, 0xdb, 0xba, 0xab, 0xab, + 0xaa, 0x9a, 0x18, 0x41, 0x44, 0x24, 0x22, 0x81, 0x98, 0xba, 0xcc, 0xbd, 0xbb, 0x9b, 0x9a, 0xcb, + 0xcd, 0xcb, 0xab, 0x0a, 0x31, 0x35, 0x34, 0x22, 0x81, 0xca, 0xcc, 0xbb, 0xac, 0x99, 0xaa, 0xba, + 0xab, 0x20, 0x46, 0x44, 0x34, 0x43, 0x43, 0x12, 0x01, 0xb9, 0xcc, 0xab, 0xaa, 0x99, 0xa8, 0xa9, + 0x9a, 0x28, 0x55, 0x45, 0x44, 0x34, 0x43, 0x33, 0x22, 0x01, 0x90, 0xba, 0xbe, 0xbc, 0xab, 0xab, + 0xaa, 0xaa, 0x99, 0x20, 0x45, 0x44, 0x33, 0x22, 0x02, 0x80, 0xb9, 0xdc, 0xbc, 0xbc, 0xbb, 0xcb, + 0xcb, 0xcb, 0xbb, 0x9a, 0x20, 0x45, 0x34, 0x23, 0x12, 0x90, 0xca, 0xbc, 0xac, 0xbb, 0xcb, 0xcb, + 0xbb, 0x89, 0x31, 0x55, 0x33, 0x35, 0x43, 0x33, 0x22, 0x80, 0xca, 0xcb, 0xba, 0xaa, 0xaa, 0xaa, + 0x9b, 0x08, 0x52, 0x54, 0x45, 0x44, 0x34, 0x33, 0x33, 0x12, 0x81, 0xa9, 0xeb, 0xbc, 0xbb, 0xac, + 0xa9, 0xab, 0xbb, 0x89, 0x31, 0x47, 0x43, 0x33, 0x11, 0x80, 0x98, 0xca, 0xbc, 0xcc, 0xbb, 0xcb, + 0xba, 0xdb, 0xcb, 0xab, 0x0a, 0x30, 0x45, 0x33, 0x24, 0x12, 0x80, 0xba, 0xbc, 0xbc, 0xac, 0xcb, + 0xbc, 0xab, 0x8a, 0x31, 0x55, 0x43, 0x34, 0x24, 0x23, 0x01, 0x90, 0xaa, 0xac, 0xaa, 0xba, 0xaa, + 0xab, 0x99, 0x21, 0x64, 0x44, 0x45, 0x43, 0x34, 0x23, 0x23, 0x11, 0x80, 0xa8, 0xbc, 0xcc, 0xba, + 0xba, 0xbc, 0xcc, 0xba, 0x89, 0x31, 0x44, 0x43, 0x22, 0x11, 0x12, 0x01, 0xb9, 0xdd, 0xcc, 0xbb, + 0xba, 0xbc, 0xcb, 0xcb, 0xaa, 0x08, 0x32, 0x35, 0x34, 0x33, 0x12, 0x81, 0xba, 0xbd, 0xbd, 0xcb, + 0xbc, 0xad, 0x9b, 0x89, 0x32, 0x54, 0x34, 0x34, 0x32, 0x22, 0x01, 0xa8, 0xca, 0xba, 0xab, 0x9a, + 0x9a, 0x88, 0x08, 0x41, 0x64, 0x44, 0x35, 0x34, 0x24, 0x23, 0x23, 0x11, 0x01, 0xa9, 0xbc, 0xbd, + 0xcb, 0xbb, 0xdb, 0xbb, 0xab, 0x09, 0x42, 0x44, 0x23, 0x33, 0x23, 0x12, 0x90, 0xea, 0xcc, 0xcc, + 0xbb, 0xbc, 0xcb, 0xbb, 0xaa, 0x88, 0x21, 0x43, 0x34, 0x43, 0x33, 0x13, 0x81, 0xcb, 0xbd, 0xcc, + 0xdb, 0xcb, 0xab, 0xaa, 0x20, 0x53, 0x35, 0x43, 0x33, 0x32, 0x23, 0x01, 0xa9, 0xbc, 0xbb, 0xbb, + 0xaa, 0x9a, 0x18, 0x52, 0x44, 0x53, 0x34, 0x35, 0x43, 0x43, 0x32, 0x33, 0x12, 0x01, 0xa8, 0xcc, + 0xbc, 0xcc, 0xba, 0xac, 0xaa, 0x8a, 0x10, 0x33, 0x43, 0x32, 0x43, 0x33, 0x43, 0x12, 0xca, 0xde, + 0xcc, 0xac, 0xbb, 0xba, 0xaa, 0xaa, 0x88, 0x10, 0x44, 0x43, 0x33, 0x32, 0x12, 0x01, 0xb9, 0xce, + 0xcd, 0xcc, 0xbb, 0xab, 0x89, 0x42, 0x35, 0x43, 0x32, 0x33, 0x33, 0x14, 0x01, 0x99, 0xab, 0xcb, + 0xaa, 0xaa, 0x99, 0x21, 0x64, 0x53, 0x43, 0x32, 0x43, 0x33, 0x33, 0x35, 0x34, 0x33, 0x12, 0xa8, + 0xdd, 0xcb, 0xbb, 0xaa, 0x9b, 0xaa, 0x89, 0x08, 0x21, 0x32, 0x53, 0x42, 0x32, 0x25, 0x81, 0xeb, + 0xdd, 0xbc, 0xbc, 0xba, 0xa9, 0x9a, 0xa9, 0x99, 0x18, 0x32, 0x35, 0x34, 0x34, 0x23, 0x91, 0xeb, + 0xdd, 0xdb, 0xbb, 0x9c, 0x8a, 0x21, 0x34, 0x34, 0x33, 0x34, 0x33, 0x23, 0x01, 0x90, 0xaa, 0xbb, + 0xcb, 0xbb, 0xaa, 0x31, 0x47, 0x34, 0x33, 0x02, 0x00, 0x30, 0x55, 0x35, 0x25, 0x43, 0x33, 0x13, + 0x81, 0xca, 0xbd, 0xcb, 0xaa, 0xaa, 0xab, 0xab, 0xaa, 0x8a, 0x10, 0x43, 0x44, 0x42, 0x22, 0x12, + 0xa8, 0xde, 0xcc, 0xbb, 0xbb, 0xaa, 0xa9, 0xaa, 0xcb, 0x9a, 0x09, 0x52, 0x45, 0x23, 0x02, 0xd9, + 0xcc, 0xcc, 0xba, 0xaa, 0x8a, 0x20, 0x53, 0x34, 0x53, 0x32, 0x33, 0x12, 0x11, 0x20, 0x01, 0xb8, + 0xcd, 0xcc, 0x9a, 0x18, 0x52, 0x34, 0x24, 0x01, 0x89, 0x99, 0x08, 0x53, 0x44, 0x34, 0x53, 0x33, + 0x13, 0x80, 0xcb, 0xbc, 0xbb, 0xbb, 0xcb, 0xbb, 0xad, 0xbb, 0x99, 0x18, 0x32, 0x53, 0x32, 0x13, + 0x82, 0xc9, 0xcd, 0xcc, 0xba, 0xab, 0x9a, 0xbb, 0xdc, 0xcb, 0xaa, 0x19, 0x54, 0x53, 0x12, 0xa8, + 0xdc, 0xbb, 0xbc, 0xaa, 0x99, 0x18, 0x42, 0x34, 0x35, 0x33, 0x24, 0x32, 0x22, 0x33, 0x43, 0x01, + 0xc9, 0xcd, 0xac, 0x9a, 0x20, 0x34, 0x34, 0x22, 0x90, 0xaa, 0x9a, 0x30, 0x55, 0x44, 0x53, 0x33, + 0x24, 0x02, 0x98, 0xca, 0xab, 0xbb, 0xaa, 0xcc, 0xdb, 0xbb, 0xbb, 0x88, 0x22, 0x43, 0x22, 0x11, + 0x88, 0x89, 0xa9, 0xeb, 0xbc, 0xac, 0x9a, 0x99, 0xdb, 0xce, 0xcb, 0xaa, 0x10, 0x44, 0x33, 0x81, + 0xdc, 0xcc, 0xbb, 0xaa, 0x9a, 0x00, 0x31, 0x53, 0x34, 0x33, 0x43, 0x43, 0x32, 0x43, 0x32, 0x22, + 0x98, 0xcd, 0xbd, 0xaa, 0x08, 0x33, 0x36, 0x22, 0x81, 0xba, 0xbb, 0x09, 0x64, 0x53, 0x33, 0x35, + 0x43, 0x32, 0x11, 0xa8, 0xba, 0xbc, 0xba, 0xbc, 0xbe, 0xbd, 0xab, 0x99, 0x11, 0x33, 0x33, 0x01, + 0x98, 0xbb, 0x99, 0x00, 0x11, 0x98, 0x99, 0xba, 0xff, 0xcd, 0xcc, 0xab, 0x89, 0x31, 0x35, 0x12, + 0xb9, 0xcf, 0xcb, 0xaa, 0x99, 0x89, 0x10, 0x21, 0x34, 0x43, 0x24, 0x34, 0x34, 0x33, 0x24, 0x22, + 0x81, 0xca, 0xcd, 0x9b, 0x89, 0x21, 0x34, 0x24, 0x01, 0xb9, 0xcb, 0x8a, 0x41, 0x35, 0x44, 0x33, + 0x33, 0x25, 0x23, 0x12, 0x88, 0xba, 0xcc, 0xcb, 0xcc, 0xbc, 0xbc, 0x9a, 0x08, 0x32, 0x24, 0x01, + 0xa9, 0xcc, 0xaa, 0x88, 0x21, 0x32, 0x02, 0x90, 0xdb, 0xdc, 0xcb, 0xcb, 0x9a, 0x09, 0x43, 0x24, + 0x81, 0xec, 0xcc, 0xba, 0xaa, 0x99, 0x98, 0x08, 0x20, 0x34, 0x35, 0x45, 0x43, 0x32, 0x33, 0x22, + 0x11, 0xa8, 0xda, 0xac, 0x8a, 0x10, 0x43, 0x24, 0x12, 0x98, 0xbb, 0xac, 0x18, 0x45, 0x44, 0x33, + 0x24, 0x33, 0x53, 0x43, 0x22, 0x01, 0xa9, 0xcc, 0xcc, 0xdb, 0xab, 0xab, 0x88, 0x10, 0x33, 0x23, + 0xa8, 0xcd, 0xbc, 0x9a, 0x28, 0x42, 0x33, 0x02, 0xa8, 0xbd, 0xbd, 0xbb, 0xbb, 0x99, 0x20, 0x63, + 0x23, 0xc0, 0xde, 0xbc, 0xab, 0xab, 0xaa, 0xac, 0x9b, 0x18, 0x63, 0x44, 0x44, 0x42, 0x32, 0x12, + 0x01, 0x80, 0xa8, 0xaa, 0xab, 0x08, 0x30, 0x33, 0x01, 0xa9, 0xcc, 0xac, 0x19, 0x55, 0x45, 0x32, + 0x22, 0x12, 0x43, 0x44, 0x44, 0x12, 0x80, 0xb9, 0xbd, 0xbc, 0xbc, 0xba, 0x9a, 0x88, 0x31, 0x33, + 0x82, 0xfa, 0xcc, 0xaa, 0x89, 0x21, 0x43, 0x12, 0x80, 0xba, 0xcb, 0xab, 0x9a, 0xba, 0xab, 0x88, + 0x32, 0x83, 0xff, 0xcc, 0xbd, 0xbb, 0xbb, 0xbc, 0xad, 0x9b, 0x28, 0x64, 0x53, 0x33, 0x24, 0x23, + 0x11, 0x00, 0x98, 0x99, 0x99, 0x08, 0x00, 0x01, 0x90, 0xba, 0xcb, 0x9a, 0x30, 0x66, 0x44, 0x43, + 0x12, 0x11, 0x21, 0x54, 0x34, 0x25, 0x11, 0xa8, 0xbb, 0xcd, 0xbb, 0xbb, 0xab, 0x9a, 0x08, 0x21, + 0x12, 0xc9, 0xce, 0xac, 0x9b, 0x10, 0x23, 0x13, 0x80, 0xba, 0xbb, 0x9a, 0x89, 0xb9, 0xdd, 0xcb, + 0xab, 0x99, 0xa9, 0xec, 0xcd, 0xcc, 0xca, 0xca, 0xbb, 0xbd, 0x9b, 0x30, 0x46, 0x34, 0x33, 0x33, + 0x13, 0x02, 0x80, 0x88, 0x88, 0x80, 0x00, 0x80, 0xa8, 0xdb, 0xbb, 0x89, 0x31, 0x56, 0x44, 0x33, + 0x24, 0x11, 0x10, 0x42, 0x46, 0x34, 0x23, 0x81, 0xca, 0xbc, 0xbb, 0xab, 0xba, 0xba, 0xbb, 0x99, + 0x08, 0xb8, 0xde, 0xcc, 0xab, 0x89, 0x10, 0x11, 0x08, 0x99, 0x9a, 0x08, 0x21, 0x33, 0xb8, 0xff, + 0xbc, 0xba, 0xaa, 0x99, 0xba, 0xce, 0xcd, 0xcb, 0xbb, 0xbe, 0xac, 0x8a, 0x31, 0x46, 0x24, 0x23, + 0x22, 0x12, 0x11, 0x00, 0x80, 0x88, 0x08, 0x88, 0x98, 0xc9, 0xba, 0x89, 0x52, 0x45, 0x33, 0x24, + 0x23, 0x21, 0x20, 0x41, 0x64, 0x44, 0x33, 0x13, 0x90, 0xdb, 0xbb, 0xbb, 0xba, 0xca, 0xbb, 0xcb, + 0xa9, 0xa9, 0xca, 0xcd, 0xcb, 0xaa, 0x88, 0x80, 0x88, 0xaa, 0x8b, 0x32, 0x35, 0x34, 0x02, 0xfa, + 0xdc, 0xab, 0x9b, 0x8a, 0x90, 0xb9, 0xce, 0xbd, 0xbc, 0xcb, 0xbb, 0xbc, 0x8a, 0x72, 0x44, 0x33, + 0x33, 0x22, 0x11, 0x12, 0x01, 0x81, 0x88, 0x89, 0x89, 0x99, 0xaa, 0x8a, 0x61, 0x45, 0x34, 0x32, + 0x21, 0x33, 0x34, 0x33, 0x34, 0x36, 0x35, 0x24, 0x02, 0xb8, 0xcc, 0xbb, 0x9a, 0x9a, 0xab, 0xbc, + 0xad, 0xaa, 0xaa, 0xcb, 0xdb, 0xcb, 0xba, 0xab, 0xca, 0xba, 0x8b, 0x62, 0x34, 0x24, 0x12, 0x98, + 0xcc, 0xdb, 0xba, 0xaa, 0x9a, 0xaa, 0xcc, 0xcc, 0xcb, 0xbb, 0xad, 0xac, 0x9b, 0x18, 0x55, 0x53, + 0x33, 0x32, 0x21, 0x22, 0x12, 0x02, 0x98, 0xaa, 0xbb, 0x8a, 0x08, 0x32, 0x54, 0x44, 0x34, 0x24, + 0x23, 0x22, 0x23, 0x23, 0x33, 0x44, 0x44, 0x34, 0x33, 0x90, 0xdc, 0xcb, 0x9a, 0x98, 0x80, 0xa9, + 0xdb, 0xab, 0xab, 0xaa, 0xeb, 0xcc, 0xdb, 0xba, 0xab, 0xbb, 0xbb, 0x09, 0x63, 0x44, 0x23, 0x01, + 0x98, 0xcb, 0xbc, 0xba, 0xbb, 0xbc, 0xcb, 0xcd, 0xcb, 0xcb, 0xbb, 0xbb, 0xbb, 0x89, 0x53, 0x46, + 0x44, 0x32, 0x22, 0x22, 0x22, 0x13, 0x01, 0xa8, 0xbc, 0xac, 0x89, 0x31, 0x44, 0x34, 0x34, 0x33, + 0x33, 0x23, 0x24, 0x32, 0x32, 0x43, 0x43, 0x34, 0x33, 0x80, 0xdc, 0xbd, 0xba, 0x89, 0x10, 0x01, + 0xaa, 0xbc, 0xbb, 0xcc, 0xdb, 0xdc, 0xdb, 0xbb, 0xbb, 0xac, 0x9b, 0x09, 0x32, 0x36, 0x23, 0x13, + 0x98, 0xca, 0xac, 0xab, 0xba, 0xba, 0xcc, 0xbd, 0xcd, 0xbb, 0xbc, 0xbb, 0xba, 0x99, 0x31, 0x56, + 0x44, 0x33, 0x33, 0x32, 0x43, 0x22, 0x01, 0xa9, 0xbd, 0xac, 0x8a, 0x20, 0x44, 0x34, 0x34, 0x23, + 0x33, 0x22, 0x12, 0x21, 0x32, 0x43, 0x34, 0x33, 0x23, 0xa0, 0xdd, 0xcc, 0xbb, 0x99, 0x00, 0x01, + 0x90, 0x99, 0xba, 0xaa, 0xdc, 0xdd, 0xcc, 0xcc, 0xbb, 0xac, 0xaa, 0x99, 0x00, 0x42, 0x43, 0x23, + 0x02, 0x90, 0xa9, 0xbb, 0xbc, 0xbd, 0xcc, 0xcb, 0xcc, 0xbb, 0xcb, 0xbb, 0xab, 0x8a, 0x10, 0x54, + 0x54, 0x33, 0x25, 0x33, 0x32, 0x22, 0x01, 0xb9, 0xcd, 0xbb, 0xaa, 0x18, 0x42, 0x44, 0x34, 0x34, + 0x32, 0x33, 0x23, 0x32, 0x32, 0x23, 0x13, 0x22, 0x01, 0xd9, 0xdc, 0xbc, 0xbc, 0xbb, 0x99, 0x10, + 0x22, 0x33, 0x22, 0x11, 0xb8, 0xee, 0xdc, 0xdc, 0xbb, 0xbc, 0xab, 0xa9, 0x89, 0x00, 0x31, 0x35, + 0x33, 0x23, 0x11, 0x80, 0xba, 0xcf, 0xdb, 0xbc, 0xbc, 0xbb, 0xcb, 0xba, 0xac, 0xab, 0x8a, 0x40, + 0x64, 0x53, 0x33, 0x43, 0x23, 0x22, 0x02, 0x98, 0xdb, 0xbb, 0xbb, 0xaa, 0x18, 0x63, 0x44, 0x43, + 0x24, 0x24, 0x32, 0x22, 0x22, 0x11, 0x80, 0x80, 0x08, 0xb8, 0xcc, 0xdb, 0xbc, 0xad, 0x9a, 0x09, + 0x20, 0x23, 0x22, 0x01, 0x00, 0xa8, 0xfb, 0xed, 0xdb, 0xbb, 0xba, 0xbb, 0xba, 0xaa, 0x09, 0x62, + 0x44, 0x33, 0x23, 0x01, 0xa9, 0xcb, 0xcc, 0xbc, 0xbc, 0xcb, 0xbb, 0xbc, 0xcb, 0xbb, 0x9a, 0x08, + 0x63, 0x44, 0x34, 0x34, 0x33, 0x23, 0x22, 0x81, 0x99, 0xcb, 0xcb, 0xab, 0x9b, 0x19, 0x52, 0x44, + 0x54, 0x33, 0x34, 0x33, 0x32, 0x21, 0x12, 0x11, 0x80, 0xb9, 0xcb, 0xbc, 0xcc, 0xcc, 0xab, 0xaa, + 0x88, 0x21, 0x11, 0x00, 0x98, 0x89, 0x90, 0xfb, 0xdd, 0xbd, 0xbc, 0xac, 0xab, 0xaa, 0x89, 0x31, + 0x45, 0x34, 0x33, 0x13, 0x90, 0xb9, 0xcc, 0xbc, 0xcc, 0xcb, 0xbb, 0xcb, 0xcb, 0xcb, 0xaa, 0x89, + 0x31, 0x45, 0x35, 0x43, 0x23, 0x23, 0x21, 0x11, 0x00, 0xa9, 0xcb, 0xcb, 0xbb, 0xbb, 0x9a, 0x20, + 0x56, 0x54, 0x43, 0x33, 0x32, 0x22, 0x21, 0x21, 0x01, 0x88, 0xaa, 0xcb, 0xbc, 0xcd, 0xcb, 0xbb, + 0x8a, 0x08, 0x00, 0x00, 0x99, 0x89, 0x01, 0x98, 0xfb, 0xcf, 0xbc, 0xbc, 0xbb, 0xab, 0x89, 0x20, + 0x54, 0x34, 0x25, 0x12, 0x81, 0xa9, 0xaa, 0xba, 0xcc, 0xcc, 0xcb, 0xdb, 0xcb, 0xbb, 0xac, 0x9a, + 0x18, 0x53, 0x34, 0x35, 0x33, 0x23, 0x33, 0x32, 0x12, 0x90, 0xba, 0xcc, 0xba, 0xac, 0xbb, 0xab, + 0x19, 0x65, 0x44, 0x33, 0x43, 0x22, 0x22, 0x23, 0x33, 0x12, 0x90, 0xba, 0xbd, 0xdb, 0xdb, 0xba, + 0xcb, 0xaa, 0x9a, 0x89, 0x88, 0x00, 0x11, 0x88, 0xb9, 0xff, 0xcc, 0xbb, 0xac, 0x9a, 0x08, 0x10, + 0x52, 0x34, 0x35, 0x22, 0x82, 0x98, 0xa9, 0xa9, 0xca, 0xdb, 0xcd, 0xcc, 0xbb, 0xbc, 0xcb, 0xab, + 0x9a, 0x10, 0x44, 0x35, 0x34, 0x33, 0x33, 0x24, 0x22, 0x02, 0x98, 0xaa, 0xac, 0xbb, 0xca, 0xca, + 0x9a, 0x18, 0x43, 0x45, 0x33, 0x24, 0x22, 0x43, 0x33, 0x34, 0x23, 0x01, 0x99, 0xaa, 0xbc, 0xdb, + 0xcc, 0xbc, 0xba, 0xab, 0x99, 0x10, 0x00, 0xa9, 0xcb, 0xdd, 0xcc, 0xcb, 0xaa, 0x9a, 0x08, 0x11, + 0x53, 0x44, 0x34, 0x24, 0x11, 0x88, 0x89, 0x88, 0x89, 0xb9, 0xed, 0xdc, 0xcb, 0xbb, 0xcb, 0xbb, + 0xbb, 0x9a, 0x20, 0x45, 0x44, 0x43, 0x33, 0x24, 0x33, 0x22, 0x01, 0x98, 0xba, 0xbb, 0xac, 0xab, + 0xbb, 0x9a, 0x8a, 0x20, 0x73, 0x34, 0x43, 0x44, 0x33, 0x34, 0x34, 0x22, 0x21, 0x00, 0x88, 0xba, + 0xcd, 0xcc, 0xcb, 0xcb, 0x9a, 0x08, 0x88, 0x98, 0xba, 0xcc, 0xcc, 0xcb, 0xab, 0x8a, 0x10, 0x32, + 0x53, 0x34, 0x35, 0x34, 0x13, 0x01, 0x98, 0x98, 0x80, 0x98, 0xdc, 0xde, 0xcb, 0xcb, 0xab, 0xbb, + 0xac, 0xab, 0x8a, 0x30, 0x55, 0x43, 0x34, 0x33, 0x34, 0x23, 0x23, 0x01, 0x98, 0xaa, 0xaa, 0xcb, + 0xab, 0xac, 0xbb, 0xac, 0x8a, 0x10, 0x31, 0x44, 0x35, 0x44, 0x34, 0x24, 0x33, 0x34, 0x12, 0x00, + 0xa9, 0xcc, 0xcc, 0xcb, 0xaa, 0x8a, 0x99, 0xa9, 0xbc, 0xbc, 0xcc, 0xba, 0xab, 0x09, 0x21, 0x43, + 0x43, 0x53, 0x53, 0x33, 0x33, 0x12, 0x01, 0x88, 0x80, 0x98, 0xd9, 0xde, 0xbc, 0xcc, 0xcb, 0xbb, + 0xcb, 0xcb, 0x9b, 0x0a, 0x21, 0x45, 0x43, 0x24, 0x43, 0x32, 0x33, 0x32, 0x11, 0x88, 0x98, 0xb9, + 0xcb, 0xcb, 0xcb, 0xab, 0x9b, 0x89, 0x88, 0x00, 0x21, 0x44, 0x46, 0x44, 0x43, 0x34, 0x32, 0x11, + 0x91, 0xc9, 0xdb, 0xbb, 0xac, 0x9a, 0xa9, 0xb9, 0xdb, 0xcb, 0xca, 0xba, 0xba, 0x9a, 0x10, 0x22, + 0x33, 0x54, 0x43, 0x44, 0x33, 0x34, 0x33, 0x11, 0x00, 0x80, 0x90, 0xca, 0xde, 0xbc, 0xbe, 0xbc, + 0xcb, 0xbb, 0xac, 0xa9, 0x08, 0x32, 0x44, 0x43, 0x43, 0x34, 0x43, 0x23, 0x23, 0x12, 0x11, 0x88, + 0xb9, 0xbd, 0xbc, 0xaa, 0xaa, 0x89, 0x89, 0xa9, 0xab, 0x9a, 0x50, 0x56, 0x54, 0x43, 0x32, 0x12, + 0x01, 0x98, 0xba, 0xdb, 0xcb, 0x9a, 0x9a, 0xc9, 0xcb, 0xcb, 0xba, 0xbb, 0xbc, 0xcb, 0x09, 0x21, + 0x22, 0x31, 0x43, 0x35, 0x44, 0x42, 0x22, 0x22, 0x11, 0x21, 0x22, 0x33, 0x81, 0xfd, 0xdd, 0xcc, + 0xcb, 0xba, 0xab, 0xab, 0xaa, 0x08, 0x21, 0x53, 0x53, 0x44, 0x43, 0x24, 0x33, 0x23, 0x22, 0x02, + 0x90, 0xc9, 0xca, 0xaa, 0xab, 0xab, 0xaa, 0xba, 0xcc, 0xab, 0x8a, 0x63, 0x45, 0x35, 0x32, 0x13, + 0x01, 0x80, 0x88, 0xb9, 0xbd, 0xbc, 0xab, 0xaa, 0xca, 0xab, 0xab, 0xbc, 0xbd, 0xbd, 0xaa, 0x89, + 0x08, 0x98, 0x18, 0x62, 0x34, 0x34, 0x42, 0x33, 0x43, 0x33, 0x34, 0x43, 0x33, 0x81, 0xec, 0xdd, + 0xbc, 0xac, 0xbb, 0xba, 0xab, 0x9b, 0x99, 0x20, 0x42, 0x45, 0x44, 0x34, 0x43, 0x33, 0x32, 0x23, + 0x11, 0x90, 0xa9, 0xcb, 0xbc, 0xac, 0xaa, 0xaa, 0xaa, 0xcb, 0xab, 0x19, 0x74, 0x34, 0x34, 0x22, + 0x10, 0x08, 0x08, 0x08, 0x99, 0xbd, 0xbc, 0xac, 0xaa, 0x99, 0x88, 0xb9, 0xce, 0xcb, 0xab, 0x8a, + 0x98, 0x99, 0xbb, 0x8a, 0x31, 0x46, 0x34, 0x42, 0x43, 0x33, 0x44, 0x43, 0x43, 0x22, 0x80, 0xfb, + 0xcc, 0xbc, 0xac, 0xbb, 0xba, 0xac, 0xaa, 0x99, 0x00, 0x41, 0x45, 0x44, 0x33, 0x34, 0x33, 0x43, + 0x12, 0x01, 0x80, 0xa8, 0xcb, 0xdb, 0xaa, 0xab, 0x9a, 0xaa, 0xab, 0x0a, 0x73, 0x34, 0x25, 0x23, + 0x11, 0x88, 0x98, 0x80, 0x98, 0xda, 0xcc, 0xcb, 0xba, 0x09, 0x10, 0x01, 0xb9, 0xbe, 0xaa, 0x89, + 0x99, 0xeb, 0xbc, 0xac, 0x99, 0x99, 0x00, 0x42, 0x43, 0x34, 0x45, 0x53, 0x43, 0x33, 0x12, 0x90, + 0xcc, 0xcd, 0xbb, 0xbc, 0xcb, 0xbb, 0xcb, 0xaa, 0x9a, 0x08, 0x52, 0x44, 0x34, 0x34, 0x34, 0x24, + 0x13, 0x12, 0x01, 0x81, 0x98, 0xbc, 0xbc, 0xac, 0xaa, 0xaa, 0xaa, 0x89, 0x31, 0x35, 0x35, 0x34, + 0x12, 0x11, 0x88, 0x99, 0x89, 0xa9, 0xfb, 0xbc, 0xbd, 0xaa, 0x09, 0x10, 0x80, 0xaa, 0x8a, 0x10, + 0x13, 0xe8, 0xcd, 0xac, 0xab, 0xbc, 0xba, 0x9a, 0x18, 0x22, 0x55, 0x54, 0x44, 0x33, 0x23, 0x12, + 0x90, 0xdb, 0xcc, 0xcb, 0xac, 0xbc, 0xcb, 0xba, 0xaa, 0x8a, 0x18, 0x53, 0x44, 0x43, 0x44, 0x33, + 0x24, 0x22, 0x12, 0x11, 0x81, 0xb8, 0xcc, 0xbc, 0xac, 0xa9, 0x99, 0x08, 0x00, 0x22, 0x43, 0x34, + 0x33, 0x23, 0x01, 0xb9, 0xbb, 0xbb, 0xcc, 0xcd, 0xbd, 0xcb, 0x99, 0x08, 0x00, 0x00, 0x11, 0x32, + 0x24, 0x81, 0xca, 0xcc, 0xdb, 0xcc, 0xcb, 0xab, 0xaa, 0x98, 0x20, 0x54, 0x35, 0x44, 0x23, 0x32, + 0x11, 0x80, 0xba, 0xcc, 0xbd, 0xdb, 0xcb, 0xbc, 0xbb, 0xba, 0x99, 0x10, 0x43, 0x45, 0x34, 0x35, + 0x33, 0x34, 0x22, 0x22, 0x12, 0x90, 0xba, 0xce, 0xbb, 0xac, 0x9a, 0x88, 0x08, 0x11, 0x31, 0x43, + 0x34, 0x33, 0x13, 0x90, 0xaa, 0xbb, 0xcb, 0xcd, 0xdb, 0xbc, 0xac, 0xab, 0x89, 0x11, 0x32, 0x44, + 0x33, 0x22, 0x21, 0x02, 0xea, 0xdd, 0xdb, 0xcb, 0xaa, 0xaa, 0x89, 0x21, 0x53, 0x44, 0x24, 0x24, + 0x22, 0x02, 0x90, 0xb9, 0xcb, 0xbc, 0xbc, 0xbd, 0xbd, 0xcb, 0x9a, 0x99, 0x20, 0x42, 0x44, 0x34, + 0x43, 0x34, 0x32, 0x33, 0x23, 0x02, 0xa8, 0xdb, 0xbd, 0xcb, 0xab, 0xaa, 0x89, 0x09, 0x31, 0x43, + 0x34, 0x43, 0x32, 0x11, 0x01, 0x98, 0xba, 0xdc, 0xcc, 0xdb, 0xba, 0xba, 0x99, 0x08, 0x20, 0x43, + 0x34, 0x23, 0x32, 0x33, 0x02, 0xea, 0xde, 0xdb, 0xbb, 0xbb, 0xab, 0x09, 0x31, 0x54, 0x34, 0x44, + 0x33, 0x23, 0x11, 0x90, 0xba, 0xbc, 0xdb, 0xdb, 0xcc, 0xdb, 0xba, 0x9a, 0x89, 0x21, 0x53, 0x34, + 0x34, 0x44, 0x32, 0x34, 0x22, 0x22, 0x80, 0xa9, 0xbc, 0xbd, 0xac, 0xab, 0xaa, 0x9a, 0x08, 0x31, + 0x35, 0x34, 0x32, 0x12, 0x22, 0x21, 0x12, 0xa9, 0xde, 0xcc, 0xac, 0xbb, 0xaa, 0x99, 0x88, 0x20, + 0x22, 0x44, 0x43, 0x24, 0x12, 0x91, 0xdb, 0xbd, 0xcc, 0xcb, 0xab, 0xaa, 0x88, 0x21, 0x63, 0x44, + 0x24, 0x23, 0x22, 0x10, 0x98, 0xa9, 0xbb, 0xcd, 0xcc, 0xbc, 0xbc, 0xba, 0x99, 0x08, 0x32, 0x36, + 0x35, 0x34, 0x34, 0x43, 0x33, 0x22, 0x12, 0x80, 0xba, 0xcd, 0xbc, 0xbb, 0xbb, 0xab, 0xaa, 0x18, + 0x43, 0x35, 0x33, 0x24, 0x21, 0x33, 0x12, 0x80, 0xda, 0xdc, 0xbc, 0xcb, 0xab, 0xbb, 0xa9, 0x88, + 0x11, 0x53, 0x33, 0x34, 0x22, 0x02, 0xc9, 0xcc, 0xcc, 0xbc, 0xbc, 0xbb, 0xaa, 0x08, 0x31, 0x37, + 0x45, 0x32, 0x32, 0x12, 0x01, 0x88, 0xb8, 0xdb, 0xcc, 0xbc, 0xbd, 0xcb, 0xaa, 0x8a, 0x08, 0x42, + 0x45, 0x34, 0x43, 0x43, 0x32, 0x23, 0x13, 0x02, 0x98, 0xda, 0xbc, 0xcc, 0xba, 0xaa, 0xab, 0x99, + 0x00, 0x33, 0x35, 0x33, 0x23, 0x33, 0x24, 0x13, 0x00, 0xca, 0xcd, 0xcc, 0xbb, 0xac, 0xab, 0x9a, + 0x08, 0x21, 0x32, 0x43, 0x33, 0x21, 0x90, 0xeb, 0xbc, 0xcd, 0xbc, 0xad, 0xab, 0x9a, 0x08, 0x52, + 0x45, 0x43, 0x33, 0x22, 0x02, 0x01, 0x88, 0xba, 0xdc, 0xdb, 0xbc, 0xbc, 0xac, 0xaa, 0x99, 0x20, + 0x63, 0x44, 0x53, 0x32, 0x33, 0x24, 0x22, 0x22, 0x00, 0x98, 0xdb, 0xcc, 0xbb, 0xbc, 0xaa, 0xab, + 0x99, 0x08, 0x22, 0x34, 0x24, 0x33, 0x43, 0x32, 0x33, 0x01, 0xba, 0xcf, 0xcb, 0xcb, 0xab, 0xaa, + 0x89, 0x18, 0x20, 0x11, 0x01, 0x88, 0x99, 0xba, 0xdc, 0xcc, 0xdc, 0xdb, 0xbb, 0xaa, 0x8a, 0x32, + 0x46, 0x44, 0x33, 0x33, 0x23, 0x21, 0x00, 0x98, 0xca, 0xdc, 0xeb, 0xcb, 0xbb, 0xac, 0xaa, 0x88, + 0x31, 0x45, 0x35, 0x34, 0x24, 0x23, 0x33, 0x33, 0x23, 0x81, 0xb9, 0xdd, 0xdb, 0xbb, 0xba, 0xbb, + 0x9a, 0x9a, 0x08, 0x21, 0x32, 0x33, 0x45, 0x53, 0x33, 0x23, 0x01, 0xb9, 0xec, 0xcb, 0xba, 0xba, + 0x99, 0x09, 0x10, 0x00, 0xa9, 0xcb, 0xbb, 0xaa, 0xa9, 0xdc, 0xcd, 0xbd, 0xad, 0xbb, 0x8a, 0x30, + 0x54, 0x43, 0x34, 0x24, 0x22, 0x22, 0x21, 0x01, 0x98, 0xba, 0xcf, 0xcc, 0xdb, 0xab, 0xab, 0x99, + 0x20, 0x52, 0x34, 0x45, 0x42, 0x32, 0x32, 0x24, 0x33, 0x12, 0x00, 0xba, 0xdd, 0xbb, 0xbc, 0xab, + 0xab, 0xab, 0xa9, 0x88, 0x18, 0x10, 0x33, 0x46, 0x34, 0x34, 0x12, 0x80, 0xa9, 0xbc, 0xac, 0xab, + 0x9a, 0x9a, 0x89, 0x99, 0xca, 0xbd, 0xbc, 0xab, 0x8a, 0xa8, 0xeb, 0xcd, 0xbd, 0xbb, 0xaa, 0x18, + 0x54, 0x43, 0x43, 0x42, 0x32, 0x32, 0x22, 0x12, 0x11, 0x98, 0xdb, 0xdd, 0xcc, 0xbc, 0xab, 0x9b, + 0x09, 0x21, 0x44, 0x44, 0x53, 0x32, 0x24, 0x43, 0x32, 0x23, 0x12, 0x98, 0xcb, 0xcc, 0xbb, 0xac, + 0xbb, 0xbb, 0xbb, 0xba, 0x9a, 0x99, 0x00, 0x52, 0x55, 0x33, 0x24, 0x12, 0x90, 0xaa, 0xbb, 0xaa, + 0x99, 0xa8, 0xaa, 0xbc, 0xcd, 0xac, 0xac, 0xbb, 0xbb, 0x9a, 0xbb, 0xdc, 0xcc, 0xbc, 0xac, 0x89, + 0x41, 0x53, 0x33, 0x34, 0x24, 0x23, 0x23, 0x21, 0x12, 0x01, 0xa9, 0xcd, 0xdd, 0xcb, 0xac, 0xbb, + 0x99, 0x18, 0x31, 0x35, 0x45, 0x43, 0x43, 0x43, 0x43, 0x23, 0x13, 0x01, 0x98, 0xca, 0xcb, 0xbc, + 0xcb, 0xab, 0xac, 0xaa, 0xab, 0xba, 0xaa, 0x08, 0x63, 0x53, 0x24, 0x23, 0x12, 0x98, 0xb9, 0x9a, + 0x89, 0x88, 0x98, 0xb9, 0xdd, 0xcb, 0xcb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbc, 0xdc, 0xcc, 0xcb, 0x9a, + 0x09, 0x32, 0x45, 0x34, 0x42, 0x22, 0x32, 0x32, 0x24, 0x23, 0x01, 0xa8, 0xdc, 0xcd, 0xbc, 0xbb, + 0xab, 0x8a, 0x10, 0x31, 0x35, 0x36, 0x35, 0x35, 0x34, 0x43, 0x23, 0x22, 0x01, 0x98, 0xcb, 0xbc, + 0xbc, 0xbb, 0xcb, 0xbb, 0xbc, 0xbc, 0xba, 0x9a, 0x10, 0x43, 0x44, 0x24, 0x23, 0x11, 0x00, 0x88, + 0x99, 0x88, 0x80, 0xa9, 0xdd, 0xdb, 0xbb, 0xac, 0x99, 0xa9, 0x99, 0xba, 0xcc, 0xcc, 0xdb, 0xba, + 0x9a, 0x18, 0x52, 0x43, 0x33, 0x33, 0x34, 0x44, 0x33, 0x33, 0x32, 0x13, 0x90, 0xed, 0xcc, 0xbb, + 0xaa, 0xaa, 0x88, 0x08, 0x10, 0x53, 0x55, 0x44, 0x34, 0x34, 0x24, 0x33, 0x22, 0x01, 0x98, 0xbc, + 0xbd, 0xbb, 0xac, 0xbb, 0xbd, 0xcb, 0xba, 0xaa, 0x08, 0x21, 0x34, 0x44, 0x32, 0x23, 0x12, 0x00, + 0x98, 0x89, 0x08, 0x98, 0xfb, 0xdc, 0xbb, 0xbb, 0x99, 0x89, 0xa9, 0xbb, 0xdc, 0xcb, 0xcb, 0xab, + 0xbb, 0x9a, 0x10, 0x34, 0x34, 0x34, 0x35, 0x34, 0x34, 0x43, 0x43, 0x43, 0x12, 0x90, 0xcc, 0xbc, + 0xab, 0xab, 0xaa, 0x9a, 0x9a, 0x09, 0x72, 0x46, 0x54, 0x43, 0x33, 0x33, 0x24, 0x22, 0x81, 0xb8, + 0xeb, 0xbb, 0xbc, 0xbb, 0xdb, 0xcb, 0xbb, 0xba, 0x99, 0x20, 0x42, 0x34, 0x24, 0x33, 0x24, 0x12, + 0x00, 0x98, 0x99, 0xba, 0xcc, 0xbd, 0xbc, 0xac, 0x9a, 0x88, 0x80, 0x08, 0x88, 0xaa, 0xbb, 0xcd, + 0xbc, 0xab, 0xab, 0x89, 0x88, 0x10, 0x53, 0x45, 0x44, 0x43, 0x34, 0x34, 0x24, 0x02, 0x98, 0xca, + 0xba, 0xbb, 0xca, 0xba, 0xba, 0xbc, 0x8b, 0x73, 0x47, 0x53, 0x43, 0x32, 0x33, 0x33, 0x23, 0x81, + 0xca, 0xcc, 0xbc, 0xbb, 0xcb, 0xbc, 0xdb, 0xaa, 0x9a, 0x08, 0x21, 0x24, 0x24, 0x33, 0x43, 0x32, + 0x12, 0x80, 0xaa, 0xca, 0xcb, 0xbc, 0xbd, 0xbb, 0xbb, 0x9a, 0x88, 0x00, 0x10, 0x80, 0x99, 0xca, + 0xcb, 0xbc, 0xbb, 0xbc, 0xbc, 0xbd, 0xaa, 0x08, 0x63, 0x54, 0x43, 0x34, 0x24, 0x33, 0x02, 0x80, + 0xa9, 0xab, 0xbc, 0xca, 0xcb, 0xcb, 0xab, 0x28, 0x65, 0x45, 0x43, 0x43, 0x33, 0x33, 0x24, 0x12, + 0x90, 0xda, 0xcb, 0xac, 0xbb, 0xdb, 0xbb, 0xbc, 0xab, 0x8a, 0x20, 0x33, 0x35, 0x34, 0x33, 0x24, + 0x23, 0x00, 0xa8, 0xbb, 0xbd, 0xbc, 0xcc, 0xbb, 0xac, 0x9a, 0x88, 0x10, 0x11, 0x11, 0x01, 0x01, + 0x88, 0xba, 0xcd, 0xcc, 0xcb, 0xbc, 0xbc, 0xab, 0x89, 0x42, 0x45, 0x34, 0x33, 0x44, 0x23, 0x13, + 0x02, 0x80, 0xaa, 0xbb, 0xbd, 0xbc, 0xaa, 0x99, 0x48, 0x65, 0x44, 0x53, 0x33, 0x43, 0x32, 0x23, + 0x11, 0x98, 0xdb, 0xdb, 0xbb, 0xcc, 0xcb, 0xbb, 0xac, 0x9a, 0x08, 0x20, 0x42, 0x43, 0x43, 0x33, + 0x23, 0x02, 0xa0, 0xba, 0xbc, 0xbc, 0xbc, 0xbd, 0xbc, 0xab, 0x99, 0x10, 0x21, 0x21, 0x21, 0x21, + 0x11, 0x90, 0xca, 0xdd, 0xcc, 0xcb, 0xbc, 0xbb, 0xab, 0x88, 0x52, 0x44, 0x43, 0x34, 0x43, 0x32, + 0x22, 0x11, 0x08, 0x98, 0xaa, 0xbb, 0xcb, 0xbc, 0x9b, 0x40, 0x47, 0x45, 0x43, 0x23, 0x43, 0x32, + 0x22, 0x81, 0xa8, 0xdb, 0xcb, 0xcc, 0xcb, 0xcb, 0xbb, 0xbb, 0x9a, 0x18, 0x31, 0x45, 0x33, 0x34, + 0x22, 0x12, 0x88, 0x98, 0xa9, 0xba, 0xce, 0xcc, 0xcb, 0xab, 0x9a, 0x00, 0x20, 0x21, 0x11, 0x00, + 0x11, 0x01, 0x00, 0xc9, 0xce, 0xbd, 0xbd, 0xac, 0xab, 0xaa, 0x08, 0x42, 0x54, 0x34, 0x34, 0x32, + 0x22, 0x12, 0x22, 0x23, 0x12, 0xa8, 0xcc, 0xcb, 0xcb, 0x8a, 0x30, 0x57, 0x43, 0x24, 0x33, 0x43, + 0x22, 0x12, 0x90, 0xb9, 0xdb, 0xbc, 0xcd, 0xca, 0xbb, 0xcb, 0xaa, 0x09, 0x20, 0x34, 0x34, 0x43, + 0x22, 0x11, 0x80, 0x80, 0x90, 0xa9, 0xdc, 0xcd, 0xcb, 0xbb, 0xab, 0x88, 0x21, 0x32, 0x12, 0x01, + 0x11, 0x32, 0x34, 0x82, 0xfa, 0xcd, 0xcc, 0xcb, 0xab, 0xab, 0x9a, 0x18, 0x62, 0x34, 0x34, 0x33, + 0x43, 0x22, 0x33, 0x34, 0x24, 0x01, 0x98, 0xca, 0xbb, 0xad, 0x9b, 0x20, 0x54, 0x34, 0x34, 0x34, + 0x43, 0x32, 0x11, 0x00, 0xa8, 0xda, 0xcc, 0xbc, 0xdb, 0xab, 0xbb, 0xaa, 0x08, 0x32, 0x53, 0x33, + 0x33, 0x22, 0x22, 0x43, 0x33, 0x02, 0xfa, 0xcd, 0xbc, 0xbc, 0xab, 0x99, 0x18, 0x20, 0x02, 0x80, + 0x08, 0x41, 0x34, 0x33, 0xa0, 0xdd, 0xcd, 0xbc, 0xcb, 0xaa, 0x9a, 0x09, 0x30, 0x45, 0x33, 0x34, + 0x23, 0x43, 0x33, 0x36, 0x33, 0x23, 0x81, 0xba, 0xcb, 0xcc, 0xaa, 0x8a, 0x28, 0x43, 0x45, 0x53, + 0x43, 0x33, 0x22, 0x11, 0x10, 0xa9, 0xcd, 0xbc, 0xbc, 0xbc, 0xac, 0x9b, 0x99, 0x10, 0x21, 0x42, + 0x22, 0x22, 0x32, 0x44, 0x44, 0x22, 0x91, 0xda, 0xcc, 0xbc, 0xbb, 0xaa, 0x99, 0x08, 0x81, 0x98, + 0x89, 0x28, 0x55, 0x24, 0x02, 0xa8, 0xec, 0xbc, 0xac, 0xab, 0xaa, 0x9a, 0x19, 0x42, 0x34, 0x53, + 0x33, 0x43, 0x34, 0x44, 0x34, 0x32, 0x11, 0x80, 0xa9, 0xcb, 0xcb, 0xba, 0x99, 0x18, 0x32, 0x56, + 0x34, 0x34, 0x33, 0x22, 0x12, 0x01, 0xca, 0xdc, 0xcb, 0xbc, 0xbb, 0xbb, 0x9a, 0x89, 0x11, 0x42, + 0x22, 0x11, 0x20, 0x45, 0x45, 0x34, 0x02, 0x98, 0xdb, 0xdb, 0xbb, 0xba, 0x9a, 0x9a, 0x98, 0xa9, + 0xbb, 0x8b, 0x52, 0x36, 0x24, 0x81, 0xc9, 0xcd, 0xcb, 0xba, 0xba, 0xba, 0x9b, 0x28, 0x34, 0x44, + 0x33, 0x34, 0x53, 0x44, 0x34, 0x33, 0x14, 0x11, 0x98, 0xba, 0xcb, 0xab, 0xab, 0xa9, 0x88, 0x41, + 0x46, 0x44, 0x33, 0x42, 0x22, 0x12, 0x81, 0xba, 0xcd, 0xdb, 0xbb, 0xbc, 0xaa, 0x99, 0x09, 0x00, + 0x11, 0x80, 0x08, 0x73, 0x45, 0x44, 0x22, 0x01, 0xa8, 0xcb, 0xbc, 0xbb, 0xab, 0xab, 0xa9, 0xca, + 0xcb, 0xaa, 0x18, 0x44, 0x24, 0x12, 0xa8, 0xcd, 0xbc, 0xcb, 0xba, 0xbb, 0xab, 0x8a, 0x21, 0x34, + 0x35, 0x43, 0x43, 0x54, 0x53, 0x43, 0x23, 0x13, 0x01, 0xb8, 0xcb, 0xcb, 0xaa, 0xa9, 0xa9, 0x99, + 0x31, 0x56, 0x34, 0x25, 0x33, 0x23, 0x12, 0x80, 0xb9, 0xcd, 0xcc, 0xcb, 0xaa, 0xaa, 0x89, 0x08, + 0x00, 0x88, 0x99, 0x28, 0x57, 0x54, 0x23, 0x13, 0x80, 0xb9, 0xbc, 0xac, 0xab, 0xab, 0xb9, 0xca, + 0xac, 0xab, 0x8a, 0x30, 0x44, 0x22, 0x02, 0xca, 0xbe, 0xbc, 0xac, 0xbb, 0xbb, 0x9a, 0x08, 0x33, + 0x43, 0x13, 0x32, 0x57, 0x45, 0x34, 0x34, 0x22, 0x12, 0x90, 0xaa, 0xac, 0xab, 0xab, 0xba, 0xba, + 0x9b, 0x41, 0x57, 0x34, 0x35, 0x22, 0x22, 0x11, 0x90, 0xca, 0xcc, 0xbc, 0xac, 0x9a, 0x99, 0x80, + 0x88, 0x98, 0x9a, 0x18, 0x73, 0x45, 0x34, 0x24, 0x02, 0x90, 0xaa, 0xbc, 0xbb, 0xbb, 0xcb, 0xba, + 0xbc, 0xbb, 0xab, 0x19, 0x41, 0x22, 0x23, 0x80, 0xea, 0xcd, 0xbc, 0xcb, 0xba, 0x9a, 0x89, 0x10, + 0x21, 0x02, 0x00, 0x73, 0x55, 0x35, 0x35, 0x43, 0x12, 0x01, 0x98, 0xaa, 0xbb, 0xcb, 0xba, 0xbb, + 0xab, 0x09, 0x73, 0x45, 0x35, 0x43, 0x32, 0x21, 0x00, 0xa9, 0xdb, 0xbc, 0xbc, 0xac, 0xa9, 0x98, + 0x08, 0x88, 0x98, 0x08, 0x31, 0x56, 0x45, 0x33, 0x23, 0x01, 0xaa, 0xbc, 0xbb, 0xbc, 0xca, 0xba, + 0xcb, 0xbb, 0xbb, 0x99, 0x10, 0x12, 0x12, 0x12, 0x81, 0xed, 0xcd, 0xcb, 0xaa, 0x9a, 0x89, 0x89, + 0x88, 0x98, 0x98, 0x31, 0x67, 0x45, 0x34, 0x34, 0x33, 0x12, 0x01, 0xa9, 0xcb, 0xbb, 0xbc, 0xcb, + 0xaa, 0x8a, 0x28, 0x54, 0x36, 0x35, 0x33, 0x23, 0x11, 0x90, 0xba, 0xcd, 0xdb, 0xba, 0xba, 0x9a, + 0x89, 0x88, 0x88, 0x88, 0x28, 0x74, 0x44, 0x34, 0x24, 0x02, 0x90, 0xa9, 0xbb, 0xcb, 0xba, 0xbc, + 0xbc, 0xcb, 0xba, 0x9a, 0x08, 0x08, 0x98, 0x89, 0x80, 0xc9, 0xce, 0xbc, 0xac, 0x9a, 0x98, 0x98, + 0x99, 0x99, 0x88, 0x10, 0x64, 0x65, 0x53, 0x34, 0x33, 0x33, 0x22, 0x00, 0xaa, 0xbc, 0xbd, 0xbb, + 0xbb, 0xab, 0x9a, 0x52, 0x46, 0x44, 0x24, 0x33, 0x12, 0x01, 0x98, 0xba, 0xcc, 0xbc, 0xbc, 0xba, + 0x9a, 0x88, 0x98, 0x88, 0x00, 0x63, 0x45, 0x35, 0x33, 0x23, 0x01, 0xb9, 0xba, 0xac, 0xbc, 0xdb, + 0xcb, 0xbb, 0xac, 0xaa, 0x89, 0x80, 0xa8, 0xaa, 0x99, 0x98, 0xcb, 0xcd, 0xbc, 0x9a, 0x98, 0x98, + 0xbb, 0xdb, 0xbb, 0x9a, 0x41, 0x56, 0x45, 0x43, 0x34, 0x33, 0x33, 0x12, 0x81, 0xb9, 0xbd, 0xad, + 0xab, 0xab, 0x9c, 0x89, 0x52, 0x45, 0x34, 0x24, 0x23, 0x12, 0x00, 0xa8, 0xaa, 0xbd, 0xcc, 0xbb, + 0xbb, 0xaa, 0x98, 0x89, 0x08, 0x53, 0x55, 0x53, 0x33, 0x33, 0x01, 0x98, 0xab, 0xbb, 0xcb, 0xcc, + 0xcb, 0xcb, 0xcb, 0xaa, 0x99, 0x88, 0x90, 0xbb, 0xac, 0xab, 0xab, 0xbc, 0xbb, 0x8a, 0x08, 0xb8, + 0xbe, 0xcc, 0xcb, 0xbb, 0x89, 0x62, 0x55, 0x34, 0x44, 0x33, 0x33, 0x13, 0x22, 0x80, 0xda, 0xbc, + 0xac, 0xba, 0xbb, 0xab, 0x28, 0x65, 0x44, 0x33, 0x24, 0x22, 0x11, 0x08, 0x89, 0xaa, 0xbc, 0xcd, + 0xbc, 0xaa, 0x9a, 0x89, 0x88, 0x31, 0x45, 0x35, 0x34, 0x24, 0x01, 0x88, 0xa9, 0x9a, 0x9a, 0xca, + 0xbc, 0xbd, 0xcb, 0xbb, 0xaa, 0x8a, 0x88, 0xca, 0xcb, 0xbb, 0x9b, 0x09, 0x88, 0xa9, 0x9a, 0xcb, + 0xcc, 0xbc, 0xbd, 0xbb, 0xab, 0x20, 0x57, 0x44, 0x34, 0x34, 0x32, 0x23, 0x22, 0x22, 0x90, 0xeb, + 0xbc, 0xbc, 0xbb, 0xba, 0x8a, 0x51, 0x45, 0x34, 0x43, 0x22, 0x22, 0x01, 0x81, 0x90, 0xa8, 0xdc, + 0xbd, 0xbc, 0xab, 0x9a, 0x88, 0x21, 0x34, 0x36, 0x25, 0x24, 0x11, 0x80, 0x99, 0xaa, 0x99, 0xaa, + 0xbc, 0xbd, 0xdb, 0xba, 0xbb, 0xaa, 0x89, 0xa9, 0xbc, 0xbd, 0xac, 0x89, 0x10, 0x21, 0x11, 0xb8, + 0xdc, 0xcb, 0xcc, 0xba, 0x9a, 0x08, 0x43, 0x46, 0x53, 0x43, 0x33, 0x33, 0x32, 0x33, 0x13, 0xc8, + 0xbe, 0xbd, 0xac, 0xaa, 0x99, 0x00, 0x44, 0x44, 0x33, 0x33, 0x33, 0x32, 0x11, 0x00, 0x88, 0xd9, + 0xdd, 0xbc, 0xac, 0xaa, 0x88, 0x10, 0x32, 0x35, 0x35, 0x34, 0x22, 0x01, 0xa8, 0xba, 0xba, 0xba, + 0xeb, 0xdb, 0xbb, 0xbb, 0xac, 0xaa, 0x9a, 0xaa, 0xcb, 0xcc, 0xcb, 0x99, 0x21, 0x43, 0x13, 0xa0, + 0xcc, 0xbc, 0xbc, 0xac, 0x9b, 0x09, 0x31, 0x54, 0x44, 0x34, 0x34, 0x23, 0x43, 0x22, 0x22, 0x91, + 0xeb, 0xcc, 0xcb, 0xaa, 0x99, 0x88, 0x21, 0x54, 0x43, 0x33, 0x24, 0x22, 0x12, 0x02, 0x01, 0x88, + 0xeb, 0xbd, 0xad, 0xbb, 0x99, 0x00, 0x22, 0x34, 0x35, 0x34, 0x33, 0x23, 0x80, 0xa9, 0xca, 0xcb, + 0xbc, 0xcc, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xbb, 0xbc, 0xbc, 0xbe, 0x9a, 0x10, 0x44, 0x33, 0x81, + 0xea, 0xbc, 0xbc, 0xbb, 0x9a, 0x08, 0x20, 0x34, 0x44, 0x44, 0x44, 0x32, 0x43, 0x32, 0x23, 0x01, + 0xa8, 0xec, 0xbc, 0xbc, 0x9a, 0x8a, 0x00, 0x31, 0x44, 0x44, 0x32, 0x43, 0x32, 0x23, 0x02, 0x90, + 0xca, 0xcd, 0xcb, 0xba, 0x9a, 0x08, 0x12, 0x43, 0x43, 0x34, 0x34, 0x33, 0x22, 0x88, 0xaa, 0xcc, + 0xdb, 0xdb, 0xbb, 0xbb, 0xaa, 0x98, 0xa8, 0xca, 0xdb, 0xbc, 0xba, 0x99, 0x30, 0x44, 0x25, 0x02, + 0xa8, 0xbe, 0xac, 0xbb, 0x9a, 0x89, 0x00, 0x11, 0x32, 0x55, 0x54, 0x43, 0x43, 0x23, 0x33, 0x11, + 0x90, 0xc9, 0xcd, 0xbc, 0xba, 0x9a, 0x08, 0x10, 0x11, 0x63, 0x53, 0x34, 0x34, 0x24, 0x02, 0x80, + 0xa9, 0xbc, 0xac, 0xbb, 0x9b, 0x0a, 0x10, 0x43, 0x42, 0x43, 0x44, 0x33, 0x34, 0x11, 0x90, 0xc9, + 0xdb, 0xcc, 0xcb, 0xaa, 0x9a, 0x80, 0x80, 0xa9, 0xcc, 0xbc, 0xaa, 0x88, 0x32, 0x34, 0x33, 0x12, + 0xc8, 0xdd, 0xcb, 0xaa, 0x99, 0x88, 0x00, 0x00, 0x90, 0x10, 0x56, 0x45, 0x34, 0x24, 0x23, 0x11, + 0x00, 0xa9, 0xcb, 0xdb, 0xcb, 0xaa, 0x9a, 0x89, 0x89, 0x09, 0x73, 0x45, 0x44, 0x32, 0x22, 0x81, + 0xa8, 0xcb, 0xbb, 0xaa, 0xa9, 0x98, 0x08, 0x10, 0x33, 0x44, 0x35, 0x36, 0x43, 0x23, 0x81, 0xa8, + 0xbc, 0xcd, 0xbc, 0xac, 0x99, 0x08, 0x00, 0x99, 0xbc, 0xcd, 0x9a, 0x09, 0x11, 0x33, 0x13, 0x80, + 0xb9, 0xdc, 0xcb, 0x9a, 0x89, 0x00, 0x00, 0x99, 0xcc, 0xaa, 0x28, 0x67, 0x44, 0x43, 0x32, 0x12, + 0x00, 0x80, 0x99, 0x99, 0xca, 0xdb, 0xcb, 0xbc, 0xba, 0xab, 0x19, 0x65, 0x44, 0x24, 0x23, 0x01, + 0x98, 0xba, 0xba, 0x8a, 0x08, 0x81, 0xa8, 0xaa, 0x08, 0x54, 0x35, 0x53, 0x33, 0x43, 0x12, 0x80, + 0xca, 0xcd, 0xdb, 0xba, 0xaa, 0x88, 0x80, 0xa9, 0xcd, 0xbc, 0xbb, 0x09, 0x22, 0x34, 0x02, 0xa9, + 0xad, 0xbb, 0x99, 0x18, 0x21, 0x23, 0x11, 0xa9, 0xcc, 0xbb, 0x9c, 0x73, 0x47, 0x43, 0x33, 0x22, + 0x10, 0x00, 0x10, 0x31, 0x12, 0x01, 0xfc, 0xce, 0xbb, 0xac, 0x89, 0x30, 0x44, 0x44, 0x23, 0x12, + 0x98, 0xa9, 0x9b, 0x89, 0x11, 0x12, 0x81, 0xca, 0x9a, 0x40, 0x46, 0x34, 0x23, 0x22, 0x12, 0x81, + 0xb9, 0xfc, 0xbc, 0xbc, 0x9a, 0x89, 0x98, 0xb9, 0xce, 0xbc, 0xbb, 0x88, 0x32, 0x43, 0x81, 0xc9, + 0xdb, 0xab, 0x09, 0x31, 0x34, 0x23, 0x01, 0x01, 0x00, 0x99, 0xcb, 0x8b, 0x50, 0x56, 0x34, 0x33, + 0x12, 0x11, 0x31, 0x55, 0x43, 0x23, 0x91, 0xec, 0xcc, 0xbb, 0xab, 0x08, 0x32, 0x44, 0x23, 0x23, + 0x01, 0x98, 0x89, 0x30, 0x32, 0x22, 0x11, 0x81, 0x9a, 0x61, 0x56, 0x34, 0x33, 0x12, 0x10, 0x01, + 0x80, 0xfb, 0xbd, 0xac, 0x9b, 0x88, 0x98, 0xeb, 0xcd, 0xcb, 0xab, 0x89, 0x21, 0x33, 0x02, 0xca, + 0xcd, 0xba, 0x09, 0x20, 0x34, 0x24, 0x22, 0x22, 0x33, 0x13, 0xb0, 0xcd, 0xbb, 0x8a, 0x20, 0x43, + 0x32, 0x34, 0x44, 0x45, 0x35, 0x44, 0x11, 0xa0, 0xdb, 0xcc, 0xab, 0x9b, 0x00, 0x11, 0x01, 0x10, + 0x20, 0x21, 0x43, 0x34, 0x43, 0x12, 0x00, 0x11, 0x54, 0x33, 0x24, 0x22, 0x43, 0x32, 0x35, 0x02, + 0xb9, 0xdd, 0xac, 0x9b, 0x08, 0x12, 0x91, 0xed, 0xcc, 0xbb, 0xab, 0x8a, 0x00, 0x12, 0x02, 0xb8, + 0xcc, 0xac, 0x9b, 0x08, 0x31, 0x36, 0x46, 0x43, 0x32, 0x11, 0xa0, 0xca, 0xcb, 0x9a, 0x09, 0x00, + 0x08, 0x08, 0x20, 0x55, 0x45, 0x53, 0x32, 0x01, 0xa9, 0xcc, 0xbc, 0xba, 0xab, 0xaa, 0x99, 0x89, + 0x08, 0x32, 0x44, 0x33, 0x44, 0x33, 0x24, 0x24, 0x33, 0x35, 0x22, 0x00, 0x00, 0x52, 0x44, 0x03, + 0xc8, 0xcc, 0xcb, 0x89, 0x20, 0x33, 0x03, 0xea, 0xcd, 0xcb, 0xaa, 0x99, 0x88, 0x88, 0x80, 0x88, + 0x88, 0x99, 0xcb, 0xbc, 0x0a, 0x64, 0x55, 0x53, 0x22, 0x12, 0xa8, 0xaa, 0xbb, 0x99, 0x08, 0x80, + 0xc9, 0xcb, 0xaa, 0x20, 0x46, 0x44, 0x43, 0x12, 0x81, 0xaa, 0xcc, 0xcb, 0xcb, 0xac, 0x9b, 0x89, + 0x00, 0x00, 0x00, 0x08, 0x42, 0x54, 0x44, 0x24, 0x23, 0x11, 0x01, 0x08, 0x10, 0x42, 0x43, 0x12, + 0xb9, 0xbf, 0xad, 0x8a, 0x21, 0x43, 0x23, 0xa0, 0xdc, 0xbc, 0xac, 0x9a, 0x89, 0x98, 0x98, 0x09, + 0x00, 0xa0, 0xeb, 0xcb, 0x8a, 0x72, 0x45, 0x34, 0x33, 0x01, 0xa8, 0xbb, 0x9a, 0x88, 0x21, 0x00, + 0xfb, 0xcc, 0xab, 0x8a, 0x21, 0x53, 0x34, 0x32, 0x02, 0x98, 0xbc, 0xbd, 0xcc, 0xcb, 0xab, 0x9a, + 0x88, 0x88, 0xaa, 0xba, 0x18, 0x66, 0x44, 0x34, 0x23, 0x12, 0x08, 0x08, 0x21, 0x43, 0x34, 0x82, + 0xba, 0xcd, 0xac, 0x8a, 0x31, 0x34, 0x33, 0x91, 0xfb, 0xcb, 0xbb, 0xab, 0x89, 0x99, 0x99, 0x99, + 0x88, 0x80, 0xca, 0xcc, 0x9b, 0x72, 0x47, 0x34, 0x32, 0x81, 0xa8, 0x9a, 0x8a, 0x21, 0x32, 0x82, + 0xdd, 0xbd, 0xac, 0x99, 0x00, 0x12, 0x11, 0x11, 0x00, 0x80, 0xa8, 0xec, 0xcc, 0xbc, 0xbc, 0xaa, + 0x99, 0x98, 0xa9, 0xbb, 0x09, 0x75, 0x44, 0x43, 0x23, 0x12, 0x00, 0x10, 0x31, 0x35, 0x34, 0x81, + 0xba, 0xbe, 0xab, 0x18, 0x43, 0x24, 0x12, 0xb8, 0xdc, 0xab, 0xab, 0xba, 0xaa, 0xa9, 0x99, 0x00, + 0x80, 0x80, 0xca, 0xbf, 0x8c, 0x72, 0x36, 0x35, 0x12, 0x81, 0xaa, 0x9a, 0x08, 0x32, 0x24, 0x90, + 0xdc, 0xac, 0x9b, 0x89, 0x01, 0x80, 0xca, 0xcb, 0x9c, 0x08, 0x12, 0xc8, 0xdd, 0xbc, 0xac, 0xa9, + 0x88, 0x89, 0x98, 0x99, 0x18, 0x55, 0x44, 0x24, 0x23, 0x12, 0x22, 0x42, 0x34, 0x34, 0x12, 0x90, + 0xdb, 0xbb, 0x9c, 0x21, 0x35, 0x23, 0x81, 0xda, 0xcb, 0xab, 0x9a, 0xbb, 0xbb, 0xac, 0x08, 0x33, + 0x33, 0x24, 0x90, 0xdb, 0xab, 0x72, 0x57, 0x43, 0x12, 0x80, 0xa9, 0xa9, 0x88, 0x21, 0x32, 0x92, + 0xfb, 0xbb, 0xaa, 0x89, 0x88, 0xda, 0xbd, 0xbd, 0xaa, 0x08, 0x12, 0xb8, 0xdf, 0xbc, 0xbb, 0x9a, + 0x89, 0x98, 0x99, 0x9b, 0x28, 0x47, 0x44, 0x33, 0x32, 0x22, 0x33, 0x44, 0x34, 0x25, 0x11, 0x99, + 0xba, 0xba, 0x89, 0x43, 0x35, 0x22, 0x90, 0xdb, 0xbc, 0xab, 0xbb, 0xbd, 0xac, 0x9a, 0x20, 0x34, + 0x25, 0x22, 0x81, 0xaa, 0x9a, 0x50, 0x56, 0x34, 0x23, 0x81, 0x98, 0xba, 0x9a, 0x09, 0x21, 0x12, + 0x88, 0xba, 0xbe, 0xbd, 0xcb, 0xcc, 0xbb, 0xcb, 0x9a, 0x00, 0x01, 0xfb, 0xcd, 0xcc, 0xab, 0x8a, + 0x09, 0x88, 0x99, 0xaa, 0x19, 0x73, 0x43, 0x34, 0x33, 0x33, 0x33, 0x44, 0x34, 0x25, 0x11, 0x88, + 0xaa, 0x89, 0x18, 0x21, 0x43, 0x22, 0x80, 0xdb, 0xbd, 0xbb, 0xdc, 0xbc, 0xbc, 0x99, 0x18, 0x43, + 0x34, 0x33, 0x13, 0x98, 0x89, 0x40, 0x47, 0x35, 0x33, 0x02, 0xa0, 0xba, 0xbc, 0xab, 0x09, 0x08, + 0x10, 0x01, 0xb8, 0xdd, 0xbc, 0xbd, 0xaa, 0x89, 0x00, 0x22, 0xa1, 0xef, 0xcc, 0xcb, 0xbb, 0x99, + 0x88, 0x90, 0xa9, 0xcb, 0x9a, 0x20, 0x44, 0x35, 0x34, 0x43, 0x33, 0x42, 0x43, 0x23, 0x13, 0x81, + 0x98, 0x88, 0x00, 0x10, 0x12, 0x22, 0x12, 0x98, 0xcb, 0xdc, 0xee, 0xcc, 0xac, 0x9b, 0x89, 0x31, + 0x53, 0x43, 0x23, 0x01, 0x98, 0x20, 0x54, 0x45, 0x33, 0x12, 0x90, 0xb9, 0xbc, 0xab, 0x89, 0x00, + 0x08, 0x99, 0xeb, 0xcc, 0xbb, 0xcb, 0x8a, 0x20, 0x43, 0x43, 0x81, 0xec, 0xcc, 0xbc, 0xbb, 0x8a, + 0x09, 0x98, 0xca, 0xbc, 0x9c, 0x09, 0x21, 0x44, 0x34, 0x24, 0x33, 0x32, 0x34, 0x34, 0x22, 0x12, + 0x10, 0x10, 0x08, 0x10, 0x00, 0x01, 0x00, 0x00, 0x01, 0xd0, 0xff, 0xcd, 0xcb, 0xbb, 0x9a, 0x08, + 0x33, 0x35, 0x34, 0x22, 0x01, 0x31, 0x54, 0x35, 0x34, 0x22, 0x00, 0xa9, 0xba, 0xbb, 0xa9, 0x99, + 0xb9, 0xdd, 0xdb, 0xbc, 0xbb, 0x9a, 0x08, 0x52, 0x34, 0x43, 0x02, 0xba, 0xbf, 0xbd, 0xbb, 0x9a, + 0x88, 0x99, 0xdb, 0xbc, 0xac, 0x99, 0x08, 0x31, 0x45, 0x34, 0x32, 0x32, 0x53, 0x43, 0x22, 0x12, + 0x10, 0x11, 0x00, 0x01, 0x00, 0x00, 0x21, 0x11, 0x12, 0xa0, 0xfd, 0xde, 0xbc, 0xbd, 0xab, 0x99, + 0x10, 0x33, 0x35, 0x23, 0x21, 0x42, 0x54, 0x53, 0x33, 0x23, 0x02, 0x80, 0xa9, 0x99, 0x99, 0xba, + 0xbd, 0xbe, 0xcc, 0xbc, 0xbb, 0xab, 0x09, 0x41, 0x44, 0x34, 0x22, 0x90, 0xca, 0xbd, 0xac, 0x9a, + 0x89, 0xa9, 0xdb, 0xbd, 0xbb, 0xab, 0x99, 0x18, 0x53, 0x44, 0x32, 0x33, 0x44, 0x43, 0x23, 0x13, + 0x12, 0x12, 0x00, 0x80, 0x89, 0x89, 0x21, 0x43, 0x34, 0x03, 0xc8, 0xde, 0xcd, 0xdb, 0xbb, 0xaa, + 0x88, 0x11, 0x23, 0x33, 0x33, 0x44, 0x54, 0x53, 0x34, 0x23, 0x23, 0x11, 0x01, 0x80, 0x89, 0xba, + 0xcc, 0xbd, 0xcc, 0xbc, 0xcb, 0xab, 0x9a, 0x19, 0x43, 0x34, 0x34, 0x12, 0x88, 0xba, 0xbc, 0xab, + 0xaa, 0xeb, 0xdc, 0xbb, 0xbc, 0xbb, 0xab, 0x9b, 0x09, 0x42, 0x34, 0x35, 0x34, 0x44, 0x32, 0x33, + 0x23, 0x22, 0x02, 0x81, 0x80, 0x99, 0x08, 0x63, 0x34, 0x23, 0xa0, 0xdc, 0xcd, 0xcc, 0xbb, 0xac, + 0x9a, 0x88, 0x10, 0x21, 0x32, 0x43, 0x53, 0x54, 0x34, 0x34, 0x43, 0x22, 0x12, 0x01, 0x88, 0x99, + 0xca, 0xdb, 0xcb, 0xbc, 0xbc, 0xac, 0xbb, 0xa9, 0x00, 0x43, 0x44, 0x23, 0x12, 0x80, 0x98, 0x98, + 0xa9, 0xdc, 0xcc, 0xcb, 0xbb, 0xbc, 0xbb, 0xac, 0xaa, 0x89, 0x10, 0x63, 0x53, 0x43, 0x32, 0x23, + 0x43, 0x32, 0x22, 0x12, 0x00, 0x80, 0x00, 0x73, 0x34, 0x14, 0x01, 0xa9, 0xcc, 0xbc, 0xcd, 0xcb, + 0xaa, 0x9b, 0x99, 0x00, 0x21, 0x12, 0x33, 0x55, 0x45, 0x34, 0x34, 0x42, 0x22, 0x12, 0x00, 0x89, + 0xaa, 0xcb, 0xbc, 0xbc, 0xdb, 0xbb, 0xcb, 0xbb, 0x9b, 0x18, 0x62, 0x33, 0x24, 0x22, 0x11, 0x11, + 0x90, 0xda, 0xdc, 0xbb, 0xcb, 0xca, 0xbb, 0xcb, 0xbb, 0xab, 0x89, 0x30, 0x54, 0x34, 0x23, 0x23, + 0x43, 0x43, 0x32, 0x23, 0x11, 0x11, 0x22, 0x44, 0x36, 0x34, 0x22, 0x00, 0xa9, 0xdb, 0xcd, 0xbd, + 0xcb, 0xab, 0xaa, 0x8a, 0x10, 0x11, 0x01, 0x31, 0x47, 0x45, 0x34, 0x43, 0x23, 0x23, 0x11, 0x90, + 0xa8, 0xcb, 0xbb, 0xcc, 0xcb, 0xbb, 0xbc, 0xbc, 0xab, 0x8a, 0x10, 0x44, 0x43, 0x32, 0x32, 0x32, + 0x02, 0xb8, 0xcd, 0xcc, 0xab, 0xcb, 0xbb, 0xbc, 0xac, 0xab, 0x99, 0x08, 0x42, 0x43, 0x23, 0x22, + 0x22, 0x34, 0x34, 0x33, 0x22, 0x32, 0x53, 0x45, 0x44, 0x24, 0x23, 0x12, 0x01, 0x98, 0xdb, 0xdc, + 0xbc, 0xad, 0xbb, 0xaa, 0x89, 0x08, 0x98, 0x80, 0x42, 0x56, 0x35, 0x34, 0x43, 0x22, 0x12, 0x01, + 0x80, 0x99, 0xbb, 0xbd, 0xbd, 0xcb, 0xca, 0xaa, 0xab, 0x99, 0x08, 0x31, 0x44, 0x33, 0x34, 0x32, + 0x22, 0x81, 0xb9, 0xcd, 0xbc, 0xad, 0xac, 0xcb, 0xaa, 0xaa, 0x9a, 0x88, 0x31, 0x33, 0x23, 0x02, + 0x11, 0x44, 0x35, 0x22, 0x88, 0x89, 0x31, 0x57, 0x45, 0x34, 0x33, 0x32, 0x22, 0x11, 0x88, 0xca, + 0xcd, 0xcd, 0xcb, 0xab, 0xaa, 0xa9, 0x99, 0xa9, 0x08, 0x73, 0x45, 0x34, 0x24, 0x33, 0x22, 0x21, + 0x11, 0x00, 0x98, 0xcc, 0xcc, 0xbc, 0xbb, 0xab, 0xaa, 0x99, 0x99, 0x00, 0x43, 0x44, 0x43, 0x23, + 0x23, 0x11, 0x80, 0xbb, 0xcc, 0xbd, 0xbd, 0xbc, 0xac, 0xaa, 0x89, 0x08, 0x00, 0x21, 0x11, 0x12, + 0x31, 0x42, 0x12, 0x90, 0xbc, 0xbd, 0x09, 0x54, 0x46, 0x44, 0x33, 0x24, 0x23, 0x22, 0x01, 0x98, + 0xba, 0xdd, 0xdb, 0xbc, 0xbb, 0xac, 0xab, 0x9a, 0x8a, 0x31, 0x56, 0x34, 0x34, 0x24, 0x23, 0x32, + 0x21, 0x12, 0x81, 0xb9, 0xce, 0xbc, 0xbc, 0xbb, 0xaa, 0x89, 0x89, 0x08, 0x21, 0x53, 0x34, 0x43, + 0x32, 0x12, 0x02, 0xa8, 0xca, 0xcc, 0xbd, 0xbd, 0xcb, 0xaa, 0x9a, 0x08, 0x00, 0x11, 0x00, 0x21, + 0x42, 0x33, 0x13, 0xda, 0xbe, 0xba, 0x99, 0x20, 0x55, 0x44, 0x43, 0x34, 0x33, 0x43, 0x22, 0x81, + 0x98, 0xca, 0xbc, 0xcd, 0xcb, 0xbb, 0xcb, 0xbb, 0x9a, 0x08, 0x53, 0x45, 0x43, 0x43, 0x23, 0x33, + 0x23, 0x23, 0x12, 0xa8, 0xbd, 0xbe, 0xcb, 0xbb, 0xbb, 0xba, 0x9a, 0x99, 0x11, 0x53, 0x34, 0x34, + 0x24, 0x21, 0x11, 0x80, 0x99, 0xda, 0xcc, 0xbd, 0xbc, 0xbb, 0x9a, 0x89, 0x08, 0x80, 0x00, 0x20, + 0x43, 0x25, 0x12, 0xca, 0xbd, 0xac, 0x88, 0x10, 0x11, 0x44, 0x54, 0x53, 0x43, 0x43, 0x22, 0x12, + 0x80, 0x99, 0xaa, 0xcc, 0xdb, 0xbc, 0xbc, 0xbc, 0xaa, 0x89, 0x30, 0x63, 0x34, 0x34, 0x24, 0x43, + 0x22, 0x23, 0x11, 0x88, 0xca, 0xcb, 0xcb, 0xbb, 0xcb, 0xcb, 0xaa, 0x9b, 0x08, 0x22, 0x34, 0x34, + 0x24, 0x23, 0x22, 0x11, 0x90, 0xdb, 0xdc, 0xcc, 0xbb, 0xbb, 0xaa, 0xa9, 0xa8, 0x99, 0x89, 0x31, + 0x54, 0x24, 0x02, 0xd9, 0xcc, 0xab, 0x0a, 0x10, 0x01, 0x11, 0x53, 0x46, 0x44, 0x34, 0x23, 0x13, + 0x01, 0x90, 0x88, 0x99, 0xcc, 0xcd, 0xcc, 0xba, 0xab, 0x99, 0x18, 0x32, 0x44, 0x35, 0x53, 0x33, + 0x34, 0x23, 0x12, 0x80, 0xaa, 0xbc, 0xbb, 0xbc, 0xdb, 0xcb, 0xac, 0xab, 0x89, 0x20, 0x42, 0x32, + 0x33, 0x34, 0x34, 0x33, 0x81, 0xda, 0xdc, 0xcb, 0xab, 0xbb, 0x9a, 0x9a, 0xba, 0xbb, 0xab, 0x19, + 0x54, 0x34, 0x12, 0xb9, 0xcf, 0xbb, 0x9a, 0x10, 0x12, 0x10, 0x20, 0x64, 0x46, 0x34, 0x24, 0x13, + 0x11, 0x80, 0x01, 0x01, 0xb8, 0xdd, 0xcd, 0xbb, 0xaa, 0x8a, 0x88, 0x21, 0x32, 0x35, 0x45, 0x34, + 0x34, 0x24, 0x22, 0x80, 0x99, 0xba, 0xbb, 0xab, 0xbc, 0xcc, 0xbc, 0xbb, 0xaa, 0x18, 0x21, 0x23, + 0x32, 0x54, 0x44, 0x34, 0x02, 0xa8, 0xcd, 0xcb, 0xaa, 0xaa, 0x99, 0xa9, 0xaa, 0xbc, 0xaa, 0x19, + 0x42, 0x43, 0x02, 0xc8, 0xdc, 0xbb, 0xbb, 0x88, 0x00, 0x88, 0x08, 0x72, 0x56, 0x34, 0x34, 0x32, + 0x12, 0x12, 0x22, 0x21, 0x90, 0xdd, 0xcd, 0xcb, 0xaa, 0x89, 0x08, 0x10, 0x01, 0x31, 0x45, 0x35, + 0x35, 0x33, 0x23, 0x11, 0x98, 0xa9, 0xbb, 0xdb, 0xcb, 0xcb, 0xcb, 0xbb, 0xaa, 0x99, 0x00, 0x11, + 0x10, 0x62, 0x54, 0x44, 0x12, 0x91, 0xcb, 0xbc, 0xba, 0x9a, 0x9a, 0xba, 0xdb, 0xaa, 0x99, 0x08, + 0x32, 0x23, 0xa1, 0xdb, 0xcc, 0xbb, 0xbc, 0xaa, 0xba, 0xcc, 0x89, 0x41, 0x56, 0x53, 0x43, 0x32, + 0x33, 0x32, 0x33, 0x24, 0x01, 0xca, 0xce, 0xbc, 0xbb, 0xa9, 0x88, 0x80, 0x00, 0x20, 0x55, 0x44, + 0x43, 0x24, 0x22, 0x12, 0x01, 0x88, 0x98, 0xcb, 0xdb, 0xcb, 0xca, 0xaa, 0xaa, 0x99, 0x8a, 0x89, + 0x00, 0x32, 0x37, 0x45, 0x23, 0x02, 0xa9, 0xcd, 0xba, 0xba, 0xaa, 0xbb, 0xbc, 0xbb, 0x89, 0x21, + 0x32, 0x13, 0xd9, 0xbe, 0xab, 0x9a, 0x99, 0xcb, 0xcc, 0xbc, 0x9a, 0x20, 0x73, 0x53, 0x34, 0x34, + 0x24, 0x43, 0x32, 0x32, 0x02, 0xa0, 0xdc, 0xdb, 0xba, 0xab, 0xaa, 0x9a, 0x8a, 0x28, 0x64, 0x44, + 0x34, 0x43, 0x22, 0x22, 0x12, 0x12, 0x00, 0xa9, 0xbd, 0xbd, 0xbc, 0xbb, 0xbb, 0xbb, 0xbc, 0xaa, + 0x89, 0x31, 0x45, 0x34, 0x25, 0x23, 0x80, 0xb9, 0xdb, 0xbb, 0xbc, 0xcc, 0xbb, 0xab, 0x88, 0x11, + 0x23, 0x80, 0xeb, 0xbc, 0xac, 0x09, 0x11, 0x80, 0xda, 0xbc, 0xcb, 0x99, 0x21, 0x63, 0x53, 0x53, + 0x43, 0x53, 0x23, 0x33, 0x12, 0x00, 0xa8, 0xca, 0xcc, 0xcb, 0xcb, 0xab, 0xab, 0x89, 0x31, 0x47, + 0x43, 0x33, 0x33, 0x32, 0x43, 0x33, 0x24, 0x01, 0xa8, 0xcc, 0xcc, 0xbb, 0xbb, 0xcb, 0xdb, 0xab, + 0x9b, 0x09, 0x42, 0x33, 0x34, 0x33, 0x14, 0x12, 0x80, 0xb9, 0xed, 0xdb, 0xcb, 0xaa, 0x88, 0x00, + 0x11, 0x81, 0xba, 0xcd, 0xaa, 0x89, 0x21, 0x01, 0x98, 0xcc, 0xbc, 0xab, 0x89, 0x21, 0x44, 0x44, + 0x54, 0x44, 0x43, 0x23, 0x21, 0x10, 0x10, 0x00, 0xa8, 0xfb, 0xdb, 0xcb, 0xab, 0x9a, 0x10, 0x43, + 0x44, 0x33, 0x32, 0x33, 0x44, 0x43, 0x43, 0x12, 0x01, 0x99, 0xdb, 0xcb, 0xcb, 0xbb, 0xcc, 0xbb, + 0xbb, 0x9a, 0x00, 0x21, 0x43, 0x34, 0x34, 0x34, 0x23, 0x82, 0xda, 0xbd, 0xad, 0x9b, 0x8a, 0x88, + 0x80, 0x98, 0xca, 0xcb, 0xab, 0x8a, 0x10, 0x11, 0x01, 0xb9, 0xbc, 0xcc, 0xaa, 0x8a, 0x31, 0x43, + 0x57, 0x54, 0x34, 0x24, 0x23, 0x12, 0x32, 0x32, 0x12, 0xc9, 0xdd, 0xbc, 0xac, 0x9b, 0x08, 0x21, + 0x32, 0x23, 0x32, 0x45, 0x45, 0x53, 0x33, 0x22, 0x02, 0x80, 0xa9, 0xcb, 0xcc, 0xcb, 0xcb, 0xcb, + 0xbb, 0xba, 0xa9, 0x98, 0x10, 0x42, 0x45, 0x43, 0x33, 0x13, 0x98, 0xca, 0xbc, 0xbb, 0xba, 0xaa, + 0xcb, 0xab, 0xcb, 0xbb, 0xac, 0xab, 0x88, 0x11, 0x22, 0x01, 0xd9, 0xbc, 0xbb, 0x08, 0x63, 0x24, + 0x33, 0x55, 0x63, 0x53, 0x33, 0x34, 0x33, 0x43, 0x12, 0x98, 0xda, 0xcc, 0xcb, 0xaa, 0x89, 0x00, + 0x00, 0x90, 0x88, 0x51, 0x46, 0x44, 0x43, 0x23, 0x22, 0x01, 0x90, 0x98, 0xcb, 0xcc, 0xbc, 0xcb, + 0xbb, 0xac, 0xbb, 0xab, 0x99, 0x10, 0x44, 0x44, 0x43, 0x22, 0x01, 0x80, 0x99, 0x9a, 0xaa, 0xbc, + 0xbd, 0xbc, 0xac, 0xba, 0xaa, 0xaa, 0x9a, 0x88, 0x20, 0x23, 0x01, 0xca, 0xab, 0x30, 0x57, 0x34, + 0x22, 0x00, 0x21, 0x64, 0x45, 0x53, 0x33, 0x24, 0x22, 0x81, 0xa8, 0xdb, 0xdb, 0xaa, 0x9a, 0x89, + 0x88, 0xa9, 0xbb, 0x9b, 0x73, 0x47, 0x34, 0x34, 0x32, 0x21, 0x01, 0x90, 0xa9, 0xbc, 0xbd, 0xbc, + 0xbc, 0xcb, 0xbb, 0xcc, 0x9a, 0x89, 0x20, 0x52, 0x33, 0x34, 0x22, 0x12, 0x12, 0x01, 0x80, 0xdb, + 0xbd, 0xcc, 0xbb, 0xbb, 0xbb, 0xbb, 0xab, 0x99, 0x10, 0x53, 0x12, 0x81, 0xaa, 0x29, 0x66, 0x34, + 0x33, 0x81, 0x98, 0x19, 0x73, 0x54, 0x34, 0x24, 0x22, 0x12, 0x00, 0xa9, 0xbc, 0xbc, 0xba, 0xaa, + 0x9a, 0xaa, 0xec, 0xbb, 0x8a, 0x73, 0x45, 0x34, 0x43, 0x22, 0x12, 0x00, 0xa8, 0xb9, 0xdb, 0xbb, + 0xbd, 0xcb, 0xbc, 0xbc, 0xbc, 0x9a, 0x89, 0x21, 0x53, 0x33, 0x34, 0x33, 0x24, 0x23, 0x02, 0xa0, + 0xdb, 0xcc, 0xbc, 0xbb, 0xac, 0xbb, 0xbb, 0x99, 0x18, 0x32, 0x33, 0x12, 0x80, 0x20, 0x66, 0x44, + 0x23, 0x12, 0x98, 0x9a, 0x09, 0x62, 0x45, 0x43, 0x24, 0x22, 0x12, 0x00, 0xaa, 0xca, 0xab, 0xbb, + 0xab, 0xbb, 0xdd, 0xcc, 0xbb, 0x0a, 0x63, 0x45, 0x24, 0x24, 0x22, 0x11, 0x88, 0x99, 0xa9, 0xaa, + 0xdb, 0xcc, 0xcb, 0xcc, 0xbb, 0xac, 0x8a, 0x88, 0x21, 0x33, 0x44, 0x34, 0x24, 0x33, 0x22, 0x01, + 0xa8, 0xdb, 0xbc, 0xbd, 0xbb, 0xdb, 0xba, 0x9a, 0x88, 0x11, 0x22, 0x11, 0x00, 0x31, 0x55, 0x35, + 0x34, 0x12, 0x90, 0xa9, 0xaa, 0x88, 0x42, 0x55, 0x53, 0x32, 0x33, 0x21, 0x88, 0xa9, 0xba, 0xba, + 0xac, 0xab, 0xfb, 0xdc, 0xdb, 0xaa, 0x08, 0x53, 0x44, 0x43, 0x33, 0x22, 0x10, 0x98, 0x88, 0x99, + 0xa9, 0xcd, 0xdc, 0xcb, 0xbc, 0xbc, 0x9a, 0x8a, 0x00, 0x11, 0x43, 0x44, 0x43, 0x33, 0x33, 0x13, + 0x01, 0xa9, 0xcc, 0xbd, 0xbc, 0xcb, 0xbb, 0xab, 0x8a, 0x10, 0x11, 0x01, 0x01, 0x31, 0x46, 0x45, + 0x33, 0x23, 0x81, 0xa9, 0xbb, 0xaa, 0x08, 0x63, 0x45, 0x43, 0x33, 0x23, 0x11, 0x90, 0x99, 0x99, + 0x9a, 0x99, 0xdb, 0xcf, 0xbd, 0xad, 0x9a, 0x10, 0x53, 0x34, 0x34, 0x33, 0x22, 0x01, 0x00, 0x10, + 0x80, 0xc9, 0xbf, 0xbe, 0xbc, 0xbc, 0xab, 0x9b, 0x8a, 0x08, 0x21, 0x45, 0x53, 0x24, 0x23, 0x23, + 0x21, 0x80, 0xb9, 0xbd, 0xbd, 0xdb, 0xbb, 0xbb, 0x9b, 0x88, 0x00, 0x01, 0x10, 0x41, 0x45, 0x44, + 0x43, 0x12, 0x81, 0x98, 0xaa, 0xaa, 0x99, 0x20, 0x73, 0x43, 0x34, 0x34, 0x22, 0x01, 0x00, 0x08, + 0x88, 0x80, 0xa8, 0xdf, 0xdc, 0xcb, 0xab, 0x89, 0x31, 0x63, 0x43, 0x33, 0x23, 0x12, 0x12, 0x22, + 0x22, 0xa1, 0xed, 0xcc, 0xbc, 0xbc, 0xcb, 0xaa, 0x9b, 0x89, 0x18, 0x42, 0x44, 0x34, 0x24, 0x32, + 0x22, 0x01, 0x88, 0xca, 0xbc, 0xcc, 0xcb, 0xbb, 0xab, 0x99, 0x09, 0x08, 0x00, 0x42, 0x44, 0x35, + 0x34, 0x22, 0x81, 0x98, 0xba, 0xab, 0x9a, 0x18, 0x53, 0x45, 0x53, 0x43, 0x32, 0x12, 0x02, 0x01, + 0x10, 0x10, 0x80, 0xfc, 0xcd, 0xbc, 0xbb, 0xaa, 0x08, 0x42, 0x34, 0x44, 0x22, 0x23, 0x32, 0x33, + 0x33, 0x82, 0xd9, 0xbe, 0xcd, 0xcb, 0xbb, 0xac, 0xbb, 0xaa, 0x09, 0x30, 0x54, 0x43, 0x24, 0x33, + 0x23, 0x12, 0x81, 0xa9, 0xda, 0xdb, 0xbc, 0xbc, 0xba, 0xba, 0x99, 0x99, 0x08, 0x42, 0x44, 0x44, + 0x43, 0x12, 0x81, 0x98, 0xaa, 0xaa, 0x99, 0x10, 0x42, 0x34, 0x45, 0x34, 0x33, 0x24, 0x22, 0x21, + 0x21, 0x11, 0x01, 0xfa, 0xdd, 0xbc, 0xcb, 0x9a, 0x89, 0x10, 0x42, 0x43, 0x33, 0x43, 0x33, 0x34, + 0x24, 0x11, 0x98, 0xdb, 0xcc, 0xbc, 0xbc, 0xbc, 0xbb, 0xac, 0x9a, 0x18, 0x32, 0x45, 0x43, 0x33, + 0x33, 0x22, 0x12, 0x80, 0xa8, 0xdc, 0xcc, 0xbb, 0xac, 0xbb, 0xaa, 0xaa, 0x8a, 0x30, 0x54, 0x35, + 0x34, 0x22, 0x01, 0x98, 0xaa, 0x9a, 0x8a, 0x10, 0x31, 0x53, 0x54, 0x34, 0x34, 0x43, 0x32, 0x23, + 0x32, 0x33, 0x22, 0xb0, 0xff, 0xbc, 0xcb, 0xba, 0x99, 0x09, 0x20, 0x42, 0x33, 0x34, 0x44, 0x43, + 0x33, 0x22, 0x80, 0xa8, 0xcc, 0xbd, 0xbd, 0xbc, 0xbc, 0xac, 0xaa, 0x89, 0x11, 0x42, 0x43, 0x24, + 0x33, 0x24, 0x22, 0x12, 0x81, 0xb9, 0xce, 0xcb, 0xbb, 0xbb, 0xbb, 0xbb, 0xab, 0x18, 0x73, 0x34, + 0x25, 0x23, 0x01, 0x80, 0x98, 0x89, 0x99, 0x88, 0x88, 0x21, 0x65, 0x44, 0x43, 0x33, 0x33, 0x43, + 0x32, 0x34, 0x43, 0x02, 0xea, 0xcc, 0xbc, 0xab, 0xaa, 0x9a, 0x88, 0x10, 0x33, 0x53, 0x35, 0x44, + 0x23, 0x23, 0x11, 0x00, 0x98, 0xdc, 0xcc, 0xbd, 0xbc, 0xbb, 0xab, 0x9a, 0x08, 0x20, 0x42, 0x34, + 0x35, 0x34, 0x33, 0x24, 0x01, 0xa8, 0xdb, 0xbc, 0xbb, 0xac, 0xbb, 0xba, 0xab, 0x89, 0x31, 0x45, + 0x44, 0x32, 0x22, 0x11, 0x00, 0x88, 0xa9, 0xca, 0xaa, 0x19, 0x65, 0x44, 0x24, 0x23, 0x23, 0x22, + 0x34, 0x34, 0x35, 0x13, 0xa0, 0xdd, 0xcb, 0xbb, 0xab, 0xaa, 0xa9, 0x88, 0x10, 0x42, 0x35, 0x44, + 0x33, 0x32, 0x33, 0x33, 0x13, 0xd9, 0xdd, 0xbd, 0xbc, 0xac, 0x9b, 0x9a, 0x99, 0x98, 0x00, 0x31, + 0x36, 0x45, 0x33, 0x33, 0x13, 0x98, 0xca, 0xbc, 0xbc, 0xab, 0xbb, 0xbb, 0xcb, 0x9a, 0x09, 0x31, + 0x35, 0x45, 0x33, 0x33, 0x23, 0x82, 0xa9, 0xbd, 0xbc, 0x19, 0x72, 0x53, 0x33, 0x32, 0x22, 0x22, + 0x44, 0x44, 0x34, 0x33, 0x81, 0xcb, 0xcd, 0xba, 0xbb, 0xaa, 0xaa, 0xaa, 0x89, 0x28, 0x53, 0x34, + 0x34, 0x43, 0x34, 0x24, 0x22, 0x80, 0xeb, 0xdc, 0xbb, 0xbc, 0xaa, 0xab, 0xaa, 0xbb, 0xaa, 0x19, + 0x54, 0x45, 0x34, 0x33, 0x12, 0x81, 0xaa, 0xca, 0xbb, 0xac, 0xab, 0xbb, 0xcc, 0xba, 0x9a, 0x8a, + 0x20, 0x54, 0x44, 0x24, 0x23, 0x02, 0x90, 0xba, 0xac, 0x0a, 0x42, 0x36, 0x43, 0x22, 0x22, 0x21, + 0x44, 0x35, 0x35, 0x23, 0x02, 0xb8, 0xeb, 0xbb, 0xbc, 0xba, 0xba, 0xbb, 0xbb, 0x89, 0x21, 0x34, + 0x44, 0x43, 0x44, 0x43, 0x23, 0x02, 0xa8, 0xcd, 0xcc, 0xcb, 0xba, 0xbb, 0xbb, 0xbd, 0xba, 0x89, + 0x31, 0x37, 0x35, 0x23, 0x13, 0x01, 0x98, 0xa8, 0x99, 0xbb, 0xcc, 0xdb, 0xbb, 0xbc, 0xba, 0x9a, + 0x89, 0x41, 0x54, 0x34, 0x43, 0x12, 0x81, 0x99, 0xaa, 0x88, 0x32, 0x45, 0x24, 0x23, 0x22, 0x33, + 0x55, 0x44, 0x43, 0x23, 0x02, 0x80, 0xaa, 0xbc, 0xbc, 0xcb, 0xcb, 0xbb, 0xac, 0x9a, 0x09, 0x10, + 0x10, 0x22, 0x45, 0x35, 0x35, 0x32, 0x01, 0xc9, 0xeb, 0xbb, 0xbc, 0xcb, 0xdb, 0xbb, 0xcb, 0x99, + 0x18, 0x43, 0x44, 0x32, 0x32, 0x12, 0x12, 0x02, 0x81, 0xb8, 0xdc, 0xcb, 0xac, 0xbb, 0xba, 0xbb, + 0xbb, 0x8b, 0x42, 0x47, 0x43, 0x23, 0x02, 0x80, 0x98, 0x08, 0x21, 0x33, 0x35, 0x43, 0x43, 0x43, + 0x35, 0x45, 0x33, 0x33, 0x12, 0x10, 0x08, 0xa9, 0xdc, 0xdb, 0xcb, 0xbb, 0xac, 0x9b, 0x9a, 0x98, + 0x99, 0x99, 0x42, 0x46, 0x35, 0x33, 0x22, 0x90, 0xcb, 0xdb, 0xbb, 0xbd, 0xcc, 0xbc, 0xbb, 0xaa, + 0x89, 0x20, 0x53, 0x43, 0x43, 0x33, 0x33, 0x23, 0x12, 0x90, 0xcb, 0xbc, 0xbc, 0xbb, 0xdb, 0xdb, + 0xbb, 0xbb, 0x89, 0x43, 0x36, 0x24, 0x13, 0x11, 0x08, 0x08, 0x20, 0x31, 0x34, 0x34, 0x53, 0x33, + 0x45, 0x43, 0x34, 0x32, 0x32, 0x32, 0x22, 0x81, 0xda, 0xdc, 0xcb, 0xbb, 0xac, 0xab, 0xbb, 0xca, + 0xcb, 0xba, 0x19, 0x63, 0x45, 0x23, 0x23, 0x00, 0x88, 0xa9, 0xcb, 0xbd, 0xcd, 0xcb, 0xcb, 0xba, + 0xaa, 0x89, 0x18, 0x42, 0x34, 0x35, 0x43, 0x22, 0x02, 0x81, 0x80, 0x89, 0xa9, 0xba, 0xdc, 0xdc, + 0xcb, 0xab, 0x9b, 0x08, 0x43, 0x34, 0x23, 0x13, 0x11, 0x11, 0x21, 0x44, 0x43, 0x43, 0x33, 0x24, + 0x33, 0x34, 0x34, 0x35, 0x43, 0x42, 0x22, 0x01, 0xa8, 0xdb, 0xbb, 0xac, 0xac, 0xcb, 0xbc, 0xbc, + 0xbc, 0xbb, 0x9a, 0x20, 0x46, 0x43, 0x32, 0x11, 0x00, 0x10, 0x98, 0xcb, 0xbd, 0xbe, 0xbc, 0xbc, + 0xcb, 0xab, 0x8a, 0x18, 0x52, 0x43, 0x34, 0x23, 0x22, 0x21, 0x11, 0x21, 0x12, 0x80, 0xeb, 0xcd, + 0xcc, 0xbb, 0xbb, 0x8a, 0x10, 0x42, 0x33, 0x33, 0x23, 0x22, 0x43, 0x44, 0x43, 0x34, 0x43, 0x23, + 0x13, 0x22, 0x31, 0x63, 0x53, 0x33, 0x24, 0x12, 0x98, 0xaa, 0xbb, 0xba, 0xcb, 0xec, 0xcc, 0xcc, + 0xbb, 0xbb, 0x9c, 0x89, 0x20, 0x44, 0x33, 0x23, 0x33, 0x32, 0x13, 0x90, 0xcc, 0xcd, 0xeb, 0xcb, + 0xdb, 0xba, 0xab, 0x89, 0x10, 0x43, 0x44, 0x32, 0x32, 0x22, 0x33, 0x43, 0x33, 0x13, 0xa8, 0xdd, + 0xcc, 0xbc, 0xbb, 0xab, 0x8a, 0x18, 0x32, 0x33, 0x34, 0x33, 0x43, 0x34, 0x36, 0x34, 0x43, 0x22, + 0x22, 0x01, 0x10, 0x10, 0x43, 0x35, 0x43, 0x12, 0x00, 0x99, 0x08, 0x11, 0x81, 0xfb, 0xde, 0xdb, + 0xcb, 0xbb, 0xbb, 0x9b, 0x0a, 0x31, 0x34, 0x35, 0x43, 0x33, 0x33, 0x12, 0x88, 0xca, 0xcc, 0xcd, + 0xbc, 0xbd, 0xbb, 0xab, 0x89, 0x20, 0x34, 0x34, 0x33, 0x43, 0x34, 0x34, 0x43, 0x22, 0x81, 0xb8, + 0xdc, 0xbc, 0xcc, 0xaa, 0xaa, 0x89, 0x08, 0x21, 0x21, 0x33, 0x43, 0x34, 0x45, 0x43, 0x24, 0x32, + 0x21, 0x10, 0x08, 0x00, 0x20, 0x32, 0x34, 0x23, 0x01, 0x88, 0x31, 0x55, 0x23, 0x91, 0xfb, 0xbf, + 0xcc, 0xcb, 0xbb, 0xab, 0xaa, 0x08, 0x21, 0x53, 0x53, 0x42, 0x22, 0x23, 0x12, 0x80, 0x99, 0xdc, + 0xcd, 0xdb, 0xcb, 0xaa, 0x9a, 0x09, 0x20, 0x22, 0x43, 0x43, 0x34, 0x34, 0x25, 0x23, 0x11, 0x80, + 0xba, 0xcd, 0xbc, 0xbc, 0xbb, 0xaa, 0x99, 0x00, 0x20, 0x22, 0x34, 0x44, 0x44, 0x53, 0x32, 0x33, + 0x23, 0x11, 0x10, 0x80, 0x01, 0x10, 0x10, 0x12, 0x21, 0x10, 0x63, 0x45, 0x24, 0x13, 0xa0, 0xce, + 0xcd, 0xbc, 0xcb, 0xab, 0xab, 0x8a, 0x09, 0x21, 0x43, 0x44, 0x43, 0x33, 0x14, 0x12, 0x80, 0xb9, + 0xcc, 0xcd, 0xbc, 0xbc, 0xab, 0x9a, 0x09, 0x10, 0x31, 0x53, 0x44, 0x43, 0x34, 0x33, 0x23, 0x02, + 0x98, 0xcc, 0xcc, 0xcb, 0xbb, 0xab, 0xab, 0xa9, 0x88, 0x11, 0x52, 0x53, 0x53, 0x43, 0x43, 0x32, + 0x33, 0x22, 0x12, 0x00, 0x01, 0x88, 0x99, 0x99, 0x99, 0x80, 0x32, 0x67, 0x43, 0x33, 0x02, 0xc9, + 0xdd, 0xbc, 0xbc, 0xac, 0xbb, 0xba, 0x99, 0x89, 0x10, 0x43, 0x45, 0x34, 0x33, 0x23, 0x02, 0x80, + 0xba, 0xdd, 0xcc, 0xcb, 0xcb, 0xaa, 0xaa, 0x99, 0x80, 0x31, 0x63, 0x44, 0x24, 0x24, 0x22, 0x12, + 0x01, 0xa9, 0xcc, 0xcb, 0xcb, 0xbb, 0xbb, 0xba, 0x9b, 0x89, 0x21, 0x54, 0x34, 0x35, 0x43, 0x33, + 0x34, 0x33, 0x23, 0x11, 0x01, 0x90, 0x99, 0xbb, 0xab, 0x9a, 0x08, 0x54, 0x46, 0x43, 0x22, 0x90, + 0xeb, 0xdb, 0xcb, 0xbb, 0xac, 0xbb, 0xcb, 0xaa, 0x89, 0x18, 0x44, 0x44, 0x33, 0x24, 0x12, 0x00, + 0x90, 0xa9, 0xeb, 0xdb, 0xbc, 0xbc, 0xbb, 0xba, 0xaa, 0x08, 0x31, 0x56, 0x53, 0x33, 0x33, 0x33, + 0x12, 0x90, 0xca, 0xcc, 0xcb, 0xcb, 0xbb, 0xbb, 0xbc, 0x9a, 0x08, 0x31, 0x35, 0x35, 0x34, 0x43, + 0x43, 0x24, 0x33, 0x22, 0x12, 0x80, 0xa8, 0xaa, 0xbb, 0xaa, 0x8a, 0x20, 0x46, 0x35, 0x24, 0x01, + 0xc9, 0xdb, 0xbc, 0xbb, 0xbc, 0xcb, 0xdb, 0xbb, 0xba, 0x8a, 0x30, 0x45, 0x53, 0x32, 0x32, 0x11, + 0x01, 0x80, 0xa8, 0xda, 0xdc, 0xdb, 0xcb, 0xbb, 0xbb, 0xaa, 0x08, 0x42, 0x45, 0x43, 0x24, 0x23, + 0x22, 0x01, 0x80, 0xb9, 0xbd, 0xcc, 0xcb, 0xbb, 0xac, 0xab, 0x99, 0x00, 0x32, 0x44, 0x34, 0x53, + 0x33, 0x35, 0x34, 0x24, 0x12, 0x01, 0x90, 0xa9, 0xaa, 0x9a, 0x8a, 0x09, 0x31, 0x54, 0x43, 0x13, + 0x90, 0xeb, 0xbc, 0xcb, 0xbb, 0xcb, 0xcc, 0xdb, 0xbb, 0xba, 0x09, 0x31, 0x54, 0x33, 0x23, 0x33, + 0x32, 0x22, 0x02, 0xa0, 0xdc, 0xcd, 0xcc, 0xbc, 0xba, 0xbb, 0x99, 0x18, 0x43, 0x54, 0x33, 0x34, + 0x23, 0x13, 0x12, 0x80, 0xb9, 0xcd, 0xbd, 0xbc, 0xcb, 0xab, 0x9a, 0x88, 0x18, 0x21, 0x34, 0x35, + 0x44, 0x34, 0x35, 0x24, 0x23, 0x22, 0x00, 0x99, 0xa9, 0xaa, 0x9a, 0x99, 0x10, 0x41, 0x33, 0x33, + 0x81, 0xeb, 0xcd, 0xbb, 0xac, 0xba, 0xdc, 0xbc, 0xbd, 0xbc, 0x9a, 0x08, 0x31, 0x43, 0x23, 0x33, + 0x43, 0x44, 0x22, 0x12, 0x98, 0xdb, 0xcd, 0xcb, 0xbc, 0xba, 0xba, 0x99, 0x00, 0x43, 0x35, 0x34, + 0x24, 0x23, 0x22, 0x12, 0x00, 0xb9, 0xdd, 0xbc, 0xad, 0xab, 0x9b, 0x8a, 0x89, 0x00, 0x00, 0x42, + 0x54, 0x44, 0x44, 0x33, 0x34, 0x23, 0x12, 0x80, 0x99, 0x99, 0x99, 0x89, 0x08, 0x00, 0x80, 0x01, + 0x88, 0xb9, 0xde, 0xbc, 0xac, 0xab, 0xcb, 0xec, 0xdb, 0xcb, 0xaa, 0x9a, 0x00, 0x21, 0x22, 0x21, + 0x53, 0x44, 0x34, 0x33, 0x01, 0xb8, 0xcc, 0xbd, 0xdb, 0xba, 0xbb, 0xbb, 0x99, 0x18, 0x43, 0x35, + 0x44, 0x32, 0x33, 0x23, 0x22, 0x82, 0xc9, 0xce, 0xdb, 0xab, 0xab, 0x9a, 0x99, 0x98, 0x99, 0x8a, + 0x41, 0x56, 0x44, 0x34, 0x34, 0x33, 0x32, 0x11, 0x00, 0x98, 0x89, 0x88, 0x08, 0x01, 0x88, 0xba, + 0xac, 0xcb, 0xba, 0xbd, 0xbd, 0xbb, 0xba, 0xfb, 0xcc, 0xdb, 0xbb, 0xbb, 0x99, 0x08, 0x88, 0x80, + 0x31, 0x57, 0x34, 0x34, 0x22, 0x80, 0xb9, 0xcc, 0xbb, 0xad, 0xcb, 0xbb, 0xba, 0x9a, 0x18, 0x41, + 0x53, 0x43, 0x43, 0x32, 0x33, 0x22, 0x82, 0xea, 0xcc, 0xcb, 0xba, 0xaa, 0x99, 0x98, 0x99, 0xcb, + 0x9b, 0x41, 0x47, 0x44, 0x43, 0x43, 0x32, 0x12, 0x12, 0x00, 0x08, 0x08, 0x20, 0x21, 0x02, 0xa9, + 0xdc, 0xbb, 0xbb, 0xac, 0xcb, 0xbb, 0xbb, 0xdb, 0xcc, 0xbc, 0xad, 0xab, 0xaa, 0x99, 0x99, 0xba, + 0x9b, 0x51, 0x47, 0x34, 0x24, 0x12, 0x98, 0xab, 0xbc, 0xbb, 0xbc, 0xbc, 0xcb, 0xbb, 0xab, 0x88, + 0x32, 0x44, 0x53, 0x33, 0x24, 0x23, 0x12, 0x90, 0xdb, 0xbd, 0xbc, 0xab, 0x99, 0x89, 0x90, 0xeb, + 0xac, 0x0a, 0x42, 0x46, 0x53, 0x43, 0x32, 0x32, 0x22, 0x22, 0x22, 0x11, 0x31, 0x43, 0x24, 0x01, + 0xb9, 0xcd, 0xbb, 0xac, 0xab, 0xbb, 0xab, 0xdb, 0xcc, 0xbb, 0xbd, 0xaa, 0xaa, 0x89, 0xa9, 0xdb, + 0xbb, 0x8a, 0x62, 0x55, 0x43, 0x23, 0x81, 0xa9, 0xab, 0xcb, 0xba, 0xcb, 0xbc, 0xac, 0xcb, 0xba, + 0x89, 0x10, 0x33, 0x36, 0x24, 0x23, 0x22, 0x00, 0x99, 0xcb, 0xdc, 0xac, 0x9a, 0x89, 0x88, 0xb9, + 0xbe, 0x9b, 0x31, 0x55, 0x54, 0x33, 0x34, 0x23, 0x33, 0x33, 0x25, 0x43, 0x22, 0x32, 0x23, 0x23, + 0x00, 0xc9, 0xdc, 0xcb, 0xab, 0xbb, 0xab, 0xba, 0xce, 0xcb, 0xbb, 0xac, 0x88, 0x08, 0x88, 0xb9, + 0xcc, 0xab, 0x19, 0x64, 0x35, 0x33, 0x12, 0xa9, 0xbb, 0xac, 0x9a, 0xaa, 0xcc, 0xbc, 0xbc, 0xbb, + 0x9c, 0x09, 0x10, 0x33, 0x35, 0x23, 0x02, 0x80, 0x89, 0x89, 0xfb, 0xbd, 0xbb, 0x9a, 0x88, 0x90, + 0xca, 0x9a, 0x51, 0x55, 0x63, 0x43, 0x33, 0x33, 0x32, 0x53, 0x34, 0x25, 0x33, 0x33, 0x32, 0x22, + 0x12, 0x81, 0xc9, 0xcc, 0xac, 0xba, 0xbb, 0xbb, 0xdd, 0xcc, 0xbb, 0xbb, 0x89, 0x08, 0x80, 0xa8, + 0xdc, 0xbb, 0x09, 0x52, 0x45, 0x24, 0x02, 0xa0, 0xaa, 0x9b, 0x99, 0x98, 0xcb, 0xcc, 0xcc, 0xbb, + 0xac, 0x9a, 0x00, 0x10, 0x42, 0x23, 0x01, 0x89, 0x89, 0x00, 0x91, 0xde, 0xbc, 0xab, 0x9a, 0x99, + 0x8a, 0x51, 0x45, 0x34, 0x35, 0x34, 0x33, 0x33, 0x12, 0x53, 0x44, 0x43, 0x24, 0x33, 0x22, 0x22, + 0x22, 0x12, 0x90, 0xcb, 0xaa, 0xab, 0xba, 0xbc, 0xef, 0xbc, 0xbc, 0xbb, 0x99, 0x88, 0x98, 0xb8, + 0xdc, 0xbb, 0x8a, 0x31, 0x56, 0x43, 0x02, 0x80, 0xaa, 0x8a, 0x08, 0x81, 0xb8, 0xbe, 0xcd, 0xcb, + 0xac, 0x9b, 0x99, 0x08, 0x20, 0x23, 0x12, 0x99, 0x8a, 0x40, 0x24, 0xa8, 0xbd, 0xcb, 0xbb, 0xbc, + 0x9b, 0x38, 0x57, 0x43, 0x43, 0x43, 0x24, 0x12, 0x11, 0x21, 0x35, 0x34, 0x34, 0x24, 0x22, 0x12, + 0x22, 0x12, 0x90, 0xab, 0x8a, 0x98, 0x99, 0xca, 0xdf, 0xcd, 0xcb, 0xab, 0x89, 0x08, 0x98, 0xb9, + 0xdd, 0xbb, 0x9a, 0x28, 0x45, 0x43, 0x12, 0x88, 0x99, 0x99, 0x10, 0x11, 0x80, 0xdb, 0xdd, 0xcc, + 0xac, 0xab, 0x9a, 0x99, 0x80, 0x21, 0x02, 0x98, 0x89, 0x51, 0x34, 0x12, 0x90, 0x98, 0xda, 0xbc, + 0xbd, 0x8a, 0x31, 0x35, 0x45, 0x34, 0x24, 0x23, 0x12, 0x32, 0x45, 0x44, 0x33, 0x24, 0x12, 0x01, + 0x00, 0x00, 0x98, 0x9a, 0x89, 0x80, 0x88, 0xcb, 0xdd, 0xcd, 0xcb, 0xaa, 0x89, 0x00, 0x00, 0xa8, + 0xce, 0xbd, 0xba, 0x08, 0x52, 0x24, 0x12, 0x90, 0xaa, 0x99, 0x20, 0x23, 0x33, 0x91, 0xed, 0xce, + 0xcb, 0xab, 0xaa, 0xaa, 0x89, 0x08, 0x80, 0x98, 0x09, 0x52, 0x34, 0x33, 0x33, 0x25, 0x02, 0xb9, + 0xde, 0xab, 0x89, 0x28, 0x42, 0x44, 0x33, 0x22, 0x22, 0x63, 0x36, 0x45, 0x43, 0x23, 0x22, 0x00, + 0x80, 0x80, 0x99, 0xaa, 0x9a, 0x89, 0xa9, 0xdb, 0xbe, 0xcd, 0xbb, 0xaa, 0x10, 0x32, 0x24, 0x81, + 0xec, 0xbc, 0xab, 0x0a, 0x32, 0x35, 0x12, 0xa8, 0xbb, 0x9b, 0x28, 0x43, 0x45, 0x22, 0xa0, 0xce, + 0xcc, 0xcb, 0xba, 0xba, 0xaa, 0x8a, 0x89, 0xaa, 0x8a, 0x30, 0x45, 0x53, 0x43, 0x43, 0x23, 0x02, + 0xa9, 0xbc, 0xab, 0x99, 0x19, 0x21, 0x22, 0x01, 0x08, 0x74, 0x67, 0x34, 0x35, 0x33, 0x32, 0x21, + 0x10, 0x00, 0x98, 0xaa, 0xab, 0xaa, 0xaa, 0xdc, 0xbe, 0xbd, 0xbc, 0x9a, 0x19, 0x32, 0x34, 0x22, + 0xa8, 0xbe, 0xac, 0x89, 0x21, 0x24, 0x03, 0xa9, 0xcc, 0xaa, 0x99, 0x00, 0x33, 0x34, 0x23, 0xb0, + 0xcf, 0xbd, 0xbd, 0xac, 0xab, 0xaa, 0x9a, 0xaa, 0xaa, 0x9a, 0x20, 0x54, 0x44, 0x34, 0x34, 0x33, + 0x12, 0x98, 0xa9, 0x9a, 0x88, 0x99, 0xb9, 0xdd, 0xcb, 0x8a, 0x62, 0x55, 0x53, 0x33, 0x34, 0x32, + 0x23, 0x11, 0x80, 0x98, 0x89, 0x99, 0x99, 0xdb, 0xdd, 0xcc, 0xcb, 0xab, 0x8a, 0x10, 0x32, 0x14, + 0x81, 0xb9, 0xbb, 0x0a, 0x52, 0x43, 0x13, 0x98, 0xdb, 0xbb, 0xbb, 0x9b, 0x20, 0x53, 0x43, 0x23, + 0xa1, 0xed, 0xcd, 0xcb, 0xbb, 0xab, 0xab, 0xaa, 0xbb, 0xbb, 0x9a, 0x30, 0x56, 0x54, 0x43, 0x33, + 0x32, 0x21, 0x00, 0x80, 0x88, 0x99, 0xba, 0xbe, 0xcd, 0xbb, 0x8a, 0x20, 0x56, 0x34, 0x35, 0x43, + 0x32, 0x12, 0x11, 0x01, 0x00, 0x00, 0x80, 0xa9, 0xdd, 0xdc, 0xdb, 0xab, 0xab, 0x89, 0x11, 0x21, + 0x01, 0x99, 0xaa, 0x28, 0x44, 0x35, 0x23, 0x01, 0xa9, 0xbc, 0xad, 0xab, 0x9a, 0x00, 0x42, 0x25, + 0x13, 0xa8, 0xcf, 0xbc, 0xbc, 0xaa, 0xa9, 0xba, 0xbc, 0xbc, 0xaa, 0x89, 0x31, 0x46, 0x44, 0x43, + 0x32, 0x23, 0x12, 0x11, 0x10, 0x00, 0x80, 0xba, 0xee, 0xdb, 0xbb, 0xaa, 0x18, 0x44, 0x35, 0x35, + 0x32, 0x33, 0x22, 0x23, 0x22, 0x33, 0x33, 0x02, 0xda, 0xde, 0xcc, 0xcb, 0xab, 0x9a, 0x89, 0x08, + 0x80, 0x98, 0x98, 0x10, 0x54, 0x34, 0x43, 0x12, 0x80, 0xaa, 0xbb, 0xbc, 0xbb, 0x8a, 0x21, 0x35, + 0x24, 0xa0, 0xdc, 0xbd, 0xac, 0x9b, 0xa9, 0xa9, 0xbc, 0xbd, 0xac, 0x9a, 0x00, 0x33, 0x45, 0x44, + 0x33, 0x33, 0x23, 0x32, 0x32, 0x34, 0x24, 0x81, 0xc9, 0xce, 0xcc, 0xab, 0x9b, 0x10, 0x53, 0x34, + 0x33, 0x25, 0x32, 0x33, 0x43, 0x33, 0x43, 0x22, 0x90, 0xea, 0xcc, 0xcb, 0xac, 0xab, 0x9a, 0x99, + 0x99, 0xaa, 0x9a, 0x09, 0x53, 0x44, 0x34, 0x22, 0x11, 0x98, 0xb9, 0xca, 0xaa, 0x9a, 0x30, 0x53, + 0x23, 0xa0, 0xcd, 0xbd, 0xac, 0x99, 0x88, 0x99, 0xcc, 0xbd, 0xbc, 0xaa, 0x89, 0x28, 0x52, 0x53, + 0x34, 0x23, 0x33, 0x42, 0x53, 0x33, 0x43, 0x11, 0x90, 0xda, 0xcd, 0xcb, 0xaa, 0x8a, 0x10, 0x32, + 0x34, 0x34, 0x44, 0x42, 0x32, 0x43, 0x33, 0x33, 0x12, 0x90, 0xcc, 0xcd, 0xcb, 0xab, 0xba, 0xaa, + 0xbb, 0xbc, 0xba, 0xab, 0x19, 0x52, 0x44, 0x24, 0x12, 0x01, 0x98, 0xa9, 0xa9, 0x08, 0x31, 0x45, + 0x23, 0x91, 0xdb, 0xbd, 0xab, 0xaa, 0x88, 0x98, 0xeb, 0xcd, 0xcb, 0xab, 0x9b, 0x89, 0x10, 0x34, + 0x35, 0x35, 0x42, 0x33, 0x34, 0x34, 0x24, 0x23, 0x01, 0xa8, 0xcd, 0xcc, 0xba, 0x9b, 0x99, 0x00, + 0x20, 0x43, 0x44, 0x43, 0x43, 0x34, 0x34, 0x24, 0x13, 0x02, 0x98, 0xdb, 0xcb, 0xac, 0xbb, 0xba, + 0xbc, 0xbc, 0xbb, 0xac, 0x99, 0x08, 0x31, 0x34, 0x24, 0x12, 0x01, 0x98, 0xa9, 0x09, 0x63, 0x44, + 0x24, 0x12, 0x90, 0xb9, 0xbb, 0x9c, 0x88, 0xa8, 0xdc, 0xcd, 0xcb, 0xbb, 0xcb, 0xaa, 0x9a, 0x00, + 0x52, 0x44, 0x53, 0x32, 0x43, 0x33, 0x34, 0x33, 0x12, 0x80, 0xeb, 0xbc, 0xbc, 0xbb, 0xab, 0x99, + 0x09, 0x21, 0x52, 0x53, 0x44, 0x53, 0x43, 0x33, 0x24, 0x12, 0x01, 0xa8, 0xcb, 0xbc, 0xcb, 0xbb, + 0xdb, 0xbb, 0xcb, 0xbb, 0xab, 0xab, 0x89, 0x11, 0x22, 0x32, 0x02, 0xb8, 0xcb, 0x18, 0x66, 0x44, + 0x34, 0x33, 0x23, 0x00, 0x89, 0x09, 0x08, 0xa8, 0xec, 0xcc, 0xcb, 0xcb, 0xcb, 0xcb, 0xaa, 0x8a, + 0x20, 0x53, 0x44, 0x32, 0x43, 0x33, 0x34, 0x33, 0x23, 0x81, 0xca, 0xbd, 0xbc, 0xcb, 0xba, 0xaa, + 0x98, 0x00, 0x22, 0x44, 0x63, 0x53, 0x43, 0x33, 0x43, 0x33, 0x12, 0x90, 0xba, 0xbd, 0xcb, 0xbb, + 0xbc, 0xbb, 0xcc, 0xba, 0xac, 0xbb, 0xaa, 0x99, 0x89, 0x89, 0xba, 0xbe, 0xbc, 0x8a, 0x41, 0x54, + 0x44, 0x24, 0x23, 0x13, 0x21, 0x21, 0x21, 0x81, 0xb9, 0xce, 0xbc, 0xbc, 0xbd, 0xbc, 0xbb, 0x9a, + 0x09, 0x32, 0x35, 0x35, 0x43, 0x43, 0x33, 0x33, 0x23, 0x02, 0xb8, 0xdc, 0xbc, 0xcb, 0xab, 0xaa, + 0x89, 0x08, 0x11, 0x43, 0x44, 0x35, 0x34, 0x34, 0x43, 0x33, 0x22, 0x00, 0xa9, 0xbc, 0xcc, 0xbb, + 0xbb, 0xaa, 0xba, 0xcb, 0xbd, 0xbc, 0xbb, 0x9a, 0xa8, 0xda, 0xcc, 0xcc, 0xbb, 0xaa, 0x08, 0x41, + 0x44, 0x44, 0x32, 0x24, 0x23, 0x33, 0x33, 0x02, 0x90, 0xbb, 0xdd, 0xdb, 0xdb, 0xbb, 0xac, 0xab, + 0x89, 0x00, 0x32, 0x44, 0x43, 0x43, 0x34, 0x42, 0x22, 0x11, 0x80, 0xbb, 0xbd, 0xbc, 0xbb, 0xbb, + 0xaa, 0x99, 0x28, 0x53, 0x44, 0x53, 0x43, 0x43, 0x33, 0x33, 0x13, 0x11, 0x99, 0xcc, 0xdb, 0xca, + 0x9a, 0x8a, 0x89, 0x98, 0xba, 0xbc, 0xbc, 0x9a, 0x89, 0xdb, 0xed, 0xdb, 0xbb, 0xab, 0x9a, 0x08, + 0x32, 0x54, 0x53, 0x43, 0x33, 0x34, 0x24, 0x22, 0x11, 0x88, 0xb9, 0xcc, 0xcc, 0xcb, 0xcb, 0xba, + 0xa9, 0x88, 0x11, 0x33, 0x53, 0x43, 0x44, 0x33, 0x24, 0x22, 0x80, 0xaa, 0xbc, 0xbc, 0xcb, 0xbb, + 0xba, 0xaa, 0x09, 0x31, 0x36, 0x45, 0x43, 0x33, 0x43, 0x23, 0x22, 0x11, 0x88, 0xca, 0xdb, 0xac, + 0xac, 0x99, 0x89, 0x80, 0x99, 0xaa, 0xab, 0x89, 0x88, 0xfb, 0xec, 0xcc, 0xbc, 0xbb, 0xab, 0x9b, + 0x88, 0x21, 0x44, 0x35, 0x35, 0x44, 0x33, 0x23, 0x23, 0x11, 0x88, 0xca, 0xcc, 0xbc, 0xbc, 0xac, + 0xab, 0x99, 0x00, 0x20, 0x42, 0x43, 0x44, 0x43, 0x43, 0x12, 0x01, 0x98, 0xba, 0xdb, 0xbb, 0xbc, + 0xcb, 0xba, 0x9a, 0x18, 0x43, 0x35, 0x35, 0x43, 0x43, 0x33, 0x32, 0x02, 0x80, 0xb9, 0xdb, 0xcc, + 0xbb, 0xba, 0xaa, 0x99, 0x98, 0x98, 0x08, 0x10, 0x22, 0x03, 0xfc, 0xbf, 0xcd, 0xbb, 0xcb, 0xab, + 0xab, 0x99, 0x08, 0x53, 0x36, 0x44, 0x33, 0x34, 0x33, 0x32, 0x02, 0x80, 0xcb, 0xbd, 0xcc, 0xcb, + 0xba, 0x9a, 0x8a, 0x18, 0x21, 0x44, 0x43, 0x34, 0x43, 0x23, 0x22, 0x00, 0x99, 0xdb, 0xcb, 0xdb, + 0xbb, 0xbb, 0xac, 0x99, 0x10, 0x53, 0x34, 0x35, 0x43, 0x43, 0x32, 0x22, 0x01, 0x98, 0xba, 0xcd, + 0xcb, 0xbb, 0xab, 0xaa, 0x89, 0x80, 0x11, 0x22, 0x33, 0x14, 0xb8, 0xdf, 0xdb, 0xcb, 0xcb, 0xcb, + 0xbb, 0xbb, 0xab, 0x28, 0x54, 0x35, 0x34, 0x34, 0x33, 0x43, 0x23, 0x12, 0x88, 0xcb, 0xbd, 0xcc, + 0xba, 0xab, 0xaa, 0x89, 0x18, 0x43, 0x35, 0x44, 0x32, 0x33, 0x32, 0x12, 0x81, 0xa9, 0xcc, 0xdc, + 0xcb, 0xcb, 0xaa, 0x9a, 0x08, 0x20, 0x34, 0x53, 0x34, 0x34, 0x34, 0x24, 0x11, 0x00, 0x99, 0xca, + 0xcb, 0xcb, 0xbb, 0xac, 0x99, 0x08, 0x21, 0x32, 0x22, 0x01, 0x98, 0xcb, 0xdc, 0xdb, 0xcc, 0xcb, + 0xdb, 0xab, 0xab, 0x99, 0x21, 0x44, 0x34, 0x44, 0x33, 0x43, 0x43, 0x22, 0x02, 0xa8, 0xcb, 0xbc, + 0xbc, 0xbc, 0xba, 0xba, 0x09, 0x31, 0x45, 0x34, 0x33, 0x43, 0x22, 0x22, 0x11, 0x81, 0xa9, 0xce, + 0xcc, 0xac, 0xab, 0x9a, 0x99, 0x18, 0x20, 0x43, 0x35, 0x35, 0x44, 0x33, 0x23, 0x11, 0x81, 0xa9, + 0xcb, 0xcc, 0xdb, 0xba, 0xab, 0x88, 0x20, 0x32, 0x12, 0x80, 0x80, 0xa0, 0xda, 0xdc, 0xdb, 0xbc, + 0xad, 0xbc, 0xba, 0x9a, 0x89, 0x21, 0x45, 0x34, 0x34, 0x43, 0x33, 0x43, 0x23, 0x11, 0xa8, 0xdb, + 0xbc, 0xbd, 0xbb, 0xbb, 0xaa, 0x10, 0x63, 0x43, 0x33, 0x34, 0x43, 0x12, 0x12, 0x10, 0x98, 0xca, + 0xdc, 0xdb, 0xcb, 0xaa, 0x99, 0x09, 0x10, 0x21, 0x43, 0x44, 0x44, 0x24, 0x24, 0x12, 0x01, 0x88, + 0x9a, 0xcb, 0xbb, 0xcc, 0xbb, 0xab, 0x09, 0x22, 0x33, 0x02, 0x98, 0x98, 0xb9, 0xdc, 0xdc, 0xcc, + 0xcc, 0xbb, 0xcb, 0xaa, 0x89, 0x00, 0x32, 0x53, 0x44, 0x34, 0x34, 0x33, 0x33, 0x13, 0x01, 0x98, + 0xeb, 0xdc, 0xbb, 0xbc, 0x9a, 0x89, 0x21, 0x44, 0x43, 0x32, 0x32, 0x34, 0x33, 0x12, 0x91, 0xb9, + 0xbd, 0xcd, 0xbc, 0xba, 0xbb, 0xab, 0x99, 0x20, 0x63, 0x53, 0x43, 0x53, 0x33, 0x24, 0x23, 0x01, + 0x99, 0xba, 0xbd, 0xca, 0xbb, 0xbb, 0x8b, 0x08, 0x11, 0x10, 0x20, 0x02, 0xd9, 0xdc, 0xdb, 0xbb, + 0xbe, 0xcd, 0xcb, 0xab, 0x99, 0x08, 0x20, 0x31, 0x44, 0x44, 0x33, 0x34, 0x24, 0x22, 0x12, 0x00, + 0xa9, 0xdc, 0xcb, 0xcb, 0xbb, 0x9b, 0x18, 0x52, 0x33, 0x43, 0x32, 0x44, 0x43, 0x22, 0x11, 0x80, + 0xa9, 0xdc, 0xcb, 0xab, 0xbb, 0xac, 0xab, 0x89, 0x30, 0x53, 0x44, 0x53, 0x33, 0x35, 0x23, 0x13, + 0x98, 0xca, 0xba, 0x9a, 0xba, 0xbb, 0xcb, 0x9a, 0xaa, 0x09, 0x30, 0x33, 0xc0, 0xde, 0xbc, 0xba, + 0xdb, 0xdd, 0xbc, 0xac, 0xaa, 0x89, 0x10, 0x20, 0x32, 0x44, 0x43, 0x44, 0x33, 0x33, 0x33, 0x11, + 0xa9, 0xdb, 0xbc, 0xbc, 0xbb, 0xbc, 0xaa, 0x10, 0x34, 0x34, 0x32, 0x54, 0x43, 0x34, 0x32, 0x11, + 0x80, 0xca, 0xbc, 0xac, 0xab, 0xcb, 0xba, 0xaa, 0x99, 0x08, 0x52, 0x45, 0x53, 0x34, 0x24, 0x13, + 0x01, 0xa8, 0xaa, 0x9a, 0x99, 0x98, 0xba, 0xeb, 0xbb, 0xab, 0x09, 0x12, 0x90, 0xde, 0xac, 0xaa, + 0xa9, 0xdc, 0xdd, 0xcb, 0xba, 0xa9, 0x89, 0x10, 0x11, 0x22, 0x42, 0x45, 0x44, 0x33, 0x24, 0x02, + 0x80, 0xa9, 0xba, 0xbb, 0xbc, 0xbc, 0xab, 0xab, 0x89, 0x10, 0x44, 0x45, 0x34, 0x34, 0x34, 0x33, + 0x13, 0x90, 0xca, 0xac, 0xa9, 0xbb, 0xcb, 0xcb, 0xaa, 0xac, 0xab, 0x20, 0x56, 0x44, 0x43, 0x33, + 0x11, 0x88, 0xaa, 0x99, 0x18, 0x31, 0x12, 0xc8, 0xcd, 0xbc, 0x99, 0x10, 0xa0, 0xcc, 0xcb, 0x9a, + 0x88, 0xda, 0xcd, 0xbc, 0xbb, 0xac, 0x9a, 0x08, 0x00, 0x90, 0x08, 0x51, 0x47, 0x53, 0x23, 0x12, + 0x00, 0x98, 0x9a, 0xa9, 0x9a, 0xaa, 0xcb, 0xbb, 0xcc, 0xac, 0x89, 0x31, 0x46, 0x43, 0x53, 0x43, + 0x22, 0x00, 0x98, 0x98, 0x08, 0x98, 0x98, 0xdb, 0xbc, 0xcc, 0xdb, 0x9a, 0x08, 0x53, 0x35, 0x34, + 0x13, 0x81, 0xa8, 0x8a, 0x18, 0x42, 0x24, 0x03, 0xc9, 0xcc, 0xbb, 0x88, 0x98, 0xda, 0xcb, 0x9b, + 0x89, 0x99, 0xcd, 0xdb, 0xba, 0xbb, 0xac, 0xab, 0x99, 0xaa, 0xcb, 0x0a, 0x65, 0x54, 0x33, 0x33, + 0x01, 0x88, 0x99, 0x89, 0x08, 0x98, 0x99, 0xc9, 0xdc, 0xcd, 0xba, 0x09, 0x31, 0x34, 0x44, 0x44, + 0x32, 0x22, 0x01, 0x00, 0x21, 0x23, 0x12, 0xb8, 0xec, 0xbc, 0xcd, 0xbb, 0xaa, 0x20, 0x54, 0x43, + 0x33, 0x12, 0x90, 0x98, 0x88, 0x22, 0x35, 0x24, 0x91, 0xdb, 0xbc, 0xaa, 0x98, 0xca, 0xcc, 0xba, + 0x99, 0x09, 0x99, 0xab, 0xaa, 0xea, 0xcd, 0xbc, 0xbb, 0xcb, 0xcb, 0xaa, 0x20, 0x45, 0x35, 0x23, + 0x22, 0x00, 0x00, 0x18, 0x10, 0x11, 0x80, 0x98, 0xec, 0xcd, 0xbc, 0x9b, 0x09, 0x21, 0x42, 0x35, + 0x25, 0x33, 0x32, 0x33, 0x44, 0x33, 0x33, 0x82, 0xb9, 0xce, 0xdb, 0xcb, 0xab, 0x8a, 0x20, 0x53, + 0x53, 0x22, 0x11, 0x80, 0x09, 0x10, 0x32, 0x34, 0x13, 0xa8, 0xce, 0xac, 0x9a, 0xaa, 0xcc, 0xac, + 0xab, 0x89, 0x11, 0x22, 0x22, 0xa1, 0xef, 0xbc, 0xbb, 0xbc, 0xbb, 0xbb, 0x8a, 0x31, 0x46, 0x33, + 0x43, 0x32, 0x32, 0x13, 0x22, 0x31, 0x22, 0x00, 0xda, 0xcf, 0xdb, 0xbb, 0x9b, 0x88, 0x08, 0x42, + 0x44, 0x43, 0x34, 0x35, 0x43, 0x24, 0x12, 0x02, 0x80, 0xba, 0xbc, 0xcd, 0xbb, 0xbb, 0x99, 0x10, + 0x54, 0x33, 0x23, 0x02, 0x08, 0x08, 0x31, 0x44, 0x33, 0x81, 0xd9, 0xdb, 0xba, 0xca, 0xdc, 0xbb, + 0xac, 0x89, 0x20, 0x43, 0x33, 0x02, 0xda, 0xbd, 0xbc, 0xac, 0xbb, 0xcb, 0xab, 0x8a, 0x20, 0x31, + 0x45, 0x43, 0x43, 0x32, 0x23, 0x23, 0x22, 0x12, 0x88, 0xda, 0xdd, 0xbc, 0xbb, 0xba, 0x9a, 0x19, + 0x53, 0x44, 0x53, 0x34, 0x44, 0x42, 0x22, 0x21, 0x00, 0x90, 0xaa, 0xcc, 0xcc, 0xbb, 0xab, 0x8a, + 0x32, 0x35, 0x32, 0x12, 0x80, 0x00, 0x32, 0x36, 0x24, 0x01, 0x99, 0xbb, 0xbd, 0xdc, 0xbc, 0xbc, + 0xaa, 0x89, 0x30, 0x44, 0x32, 0x23, 0xa8, 0xdc, 0xca, 0xba, 0xcb, 0xbc, 0xcb, 0x9b, 0x9a, 0x00, + 0x32, 0x34, 0x44, 0x43, 0x32, 0x43, 0x32, 0x22, 0x12, 0x80, 0xea, 0xcd, 0xbb, 0xac, 0xaa, 0x09, + 0x21, 0x43, 0x44, 0x44, 0x53, 0x33, 0x33, 0x33, 0x23, 0x80, 0xa9, 0xdc, 0xbd, 0xbc, 0xac, 0x99, + 0x20, 0x32, 0x22, 0x12, 0x11, 0x10, 0x42, 0x35, 0x34, 0x12, 0x98, 0xba, 0xcd, 0xeb, 0xcb, 0xbb, + 0x9b, 0x89, 0x32, 0x44, 0x33, 0x13, 0x90, 0xcb, 0xcb, 0xcc, 0xbc, 0xbc, 0xcc, 0xaa, 0xaa, 0x88, + 0x10, 0x32, 0x43, 0x35, 0x43, 0x43, 0x32, 0x33, 0x22, 0x02, 0xb9, 0xcf, 0xcb, 0xcb, 0xaa, 0x09, + 0x20, 0x22, 0x35, 0x35, 0x44, 0x33, 0x34, 0x34, 0x22, 0x00, 0x98, 0xda, 0xdb, 0xac, 0xab, 0x9a, + 0x18, 0x21, 0x12, 0x02, 0x01, 0x21, 0x44, 0x45, 0x33, 0x23, 0x80, 0xba, 0xdc, 0xcc, 0xbc, 0xba, + 0xaa, 0x08, 0x32, 0x34, 0x33, 0x22, 0x90, 0xba, 0xeb, 0xdb, 0xcc, 0xdb, 0xbc, 0xbb, 0xbb, 0x9a, + 0x08, 0x22, 0x43, 0x44, 0x34, 0x43, 0x24, 0x33, 0x32, 0x12, 0xa9, 0xcd, 0xcb, 0xbc, 0xab, 0x89, + 0x20, 0x42, 0x34, 0x43, 0x53, 0x34, 0x44, 0x33, 0x32, 0x01, 0x98, 0xda, 0xdb, 0xcb, 0xba, 0x9a, + 0x08, 0x11, 0x11, 0x11, 0x00, 0x20, 0x73, 0x44, 0x43, 0x22, 0x00, 0x98, 0xdb, 0xbd, 0xbc, 0xbb, + 0x9a, 0x08, 0x31, 0x23, 0x33, 0x22, 0x11, 0x00, 0x98, 0xfa, 0xce, 0xcd, 0xcb, 0xcb, 0xaa, 0x9a, + 0x89, 0x08, 0x31, 0x53, 0x34, 0x43, 0x34, 0x43, 0x32, 0x22, 0x88, 0xbb, 0xcd, 0xcb, 0xaa, 0x89, + 0x10, 0x22, 0x43, 0x32, 0x45, 0x44, 0x34, 0x25, 0x23, 0x01, 0x88, 0xba, 0xdb, 0xcb, 0xcb, 0x9a, + 0x88, 0x08, 0x80, 0x80, 0x88, 0x10, 0x54, 0x54, 0x43, 0x23, 0x02, 0x90, 0xdb, 0xdb, 0xbb, 0xac, + 0xaa, 0x09, 0x00, 0x21, 0x01, 0x08, 0x18, 0x32, 0x53, 0x02, 0xfa, 0xdd, 0xbc, 0xbc, 0xbb, 0xbb, + 0xaa, 0x99, 0x20, 0x52, 0x43, 0x44, 0x42, 0x32, 0x34, 0x33, 0x11, 0x98, 0xca, 0xbc, 0xab, 0x8a, + 0x11, 0x21, 0x11, 0x21, 0x46, 0x55, 0x34, 0x34, 0x33, 0x11, 0x80, 0xa9, 0xbb, 0xcd, 0xbb, 0xab, + 0x9a, 0x99, 0xaa, 0xba, 0xbb, 0x09, 0x73, 0x56, 0x43, 0x43, 0x12, 0x01, 0xb9, 0xbb, 0xcc, 0xba, + 0xab, 0xbb, 0xab, 0xa9, 0xba, 0xcb, 0x8a, 0x40, 0x44, 0x33, 0x90, 0xde, 0xbd, 0xbd, 0xbb, 0xbb, + 0xab, 0x8a, 0x88, 0x20, 0x42, 0x35, 0x35, 0x43, 0x43, 0x24, 0x33, 0x12, 0x88, 0xca, 0xab, 0x0a, + 0x21, 0x02, 0x88, 0x0a, 0x61, 0x46, 0x45, 0x32, 0x33, 0x22, 0x81, 0x90, 0xa9, 0xca, 0xbc, 0xac, + 0xbb, 0xbc, 0xbb, 0xbc, 0xbb, 0xaa, 0x09, 0x65, 0x35, 0x44, 0x22, 0x12, 0x01, 0x98, 0xaa, 0xcb, + 0xcb, 0xbc, 0xbb, 0xbb, 0xbc, 0xbc, 0xbb, 0x0a, 0x42, 0x44, 0x02, 0xb8, 0xdd, 0xbc, 0xac, 0xba, + 0xa9, 0x89, 0x98, 0x89, 0x09, 0x20, 0x43, 0x35, 0x36, 0x35, 0x44, 0x22, 0x12, 0x00, 0x98, 0x88, + 0x10, 0x10, 0x88, 0x80, 0x31, 0x55, 0x53, 0x43, 0x33, 0x24, 0x22, 0x22, 0x12, 0x91, 0xdb, 0xcc, + 0xcb, 0xab, 0xba, 0xbc, 0xbd, 0xac, 0x9a, 0x20, 0x44, 0x45, 0x33, 0x43, 0x21, 0x00, 0x90, 0xa9, + 0xba, 0xbd, 0xcc, 0xbb, 0xbc, 0xcb, 0xcb, 0x9a, 0x08, 0x31, 0x33, 0x81, 0xfb, 0xcd, 0xbb, 0xab, + 0x89, 0x08, 0x88, 0xb9, 0xcd, 0xba, 0x9a, 0x18, 0x55, 0x44, 0x53, 0x33, 0x33, 0x22, 0x00, 0x80, + 0x08, 0x10, 0x00, 0x80, 0x89, 0x88, 0x21, 0x44, 0x45, 0x44, 0x43, 0x32, 0x23, 0x01, 0xa9, 0xcb, + 0xbb, 0xbb, 0xeb, 0xcc, 0xcc, 0xcb, 0xab, 0x89, 0x21, 0x54, 0x34, 0x24, 0x23, 0x12, 0x11, 0x11, + 0x80, 0xa8, 0xdd, 0xcc, 0xcb, 0xbb, 0xcb, 0xab, 0x89, 0x18, 0x22, 0x22, 0xa8, 0xdd, 0xbb, 0x9b, + 0x09, 0x08, 0xb8, 0xcf, 0xcc, 0xbc, 0xab, 0x09, 0x41, 0x44, 0x34, 0x43, 0x33, 0x32, 0x11, 0x11, + 0x00, 0x10, 0x21, 0x00, 0xb8, 0xeb, 0xcb, 0x89, 0x31, 0x36, 0x34, 0x23, 0x12, 0x81, 0x98, 0x89, + 0x32, 0x22, 0xc8, 0xdf, 0xdc, 0xbc, 0xbb, 0x9b, 0x19, 0x42, 0x45, 0x33, 0x24, 0x23, 0x21, 0x21, + 0x22, 0x13, 0xa8, 0xed, 0xbd, 0xbc, 0xbc, 0xaa, 0x9a, 0x08, 0x21, 0x12, 0x01, 0xa9, 0xbb, 0x9b, + 0x08, 0x02, 0xea, 0xef, 0xcc, 0xcb, 0xba, 0x8a, 0x28, 0x43, 0x35, 0x34, 0x33, 0x23, 0x22, 0x12, + 0x32, 0x32, 0x23, 0x82, 0xb9, 0xde, 0xcb, 0xaa, 0x18, 0x32, 0x44, 0x23, 0x02, 0x88, 0x89, 0x40, + 0x45, 0x43, 0x02, 0xa8, 0xce, 0xdb, 0xcb, 0xab, 0x99, 0x10, 0x43, 0x35, 0x33, 0x24, 0x22, 0x22, + 0x33, 0x34, 0x12, 0xa0, 0xce, 0xcd, 0xbb, 0xbc, 0xaa, 0x99, 0x00, 0x11, 0x10, 0x08, 0x88, 0x01, + 0x12, 0x81, 0xda, 0xde, 0xdc, 0xdb, 0xab, 0xab, 0x89, 0x21, 0x45, 0x53, 0x32, 0x22, 0x12, 0x11, + 0x21, 0x32, 0x33, 0x33, 0x80, 0xfa, 0xdb, 0xbb, 0x99, 0x20, 0x32, 0x24, 0x12, 0x98, 0x89, 0x52, + 0x56, 0x43, 0x32, 0x81, 0xc9, 0xcc, 0xbc, 0xbc, 0xab, 0x89, 0x20, 0x63, 0x43, 0x32, 0x32, 0x23, + 0x33, 0x35, 0x43, 0x11, 0xb0, 0xed, 0xdb, 0xab, 0xbb, 0x9a, 0x89, 0x08, 0x01, 0x01, 0x00, 0x11, + 0x21, 0x01, 0xa8, 0xfb, 0xce, 0xdc, 0xcb, 0xbb, 0x9a, 0x18, 0x43, 0x35, 0x34, 0x32, 0x21, 0x10, + 0x21, 0x42, 0x33, 0x24, 0x22, 0x98, 0xcc, 0xbc, 0xab, 0x89, 0x11, 0x33, 0x33, 0x80, 0xcb, 0x8a, + 0x73, 0x47, 0x33, 0x23, 0x91, 0xda, 0xcc, 0xbc, 0xbb, 0xaa, 0x08, 0x42, 0x35, 0x33, 0x24, 0x22, + 0x21, 0x43, 0x34, 0x33, 0x02, 0xeb, 0xcd, 0xcb, 0xbb, 0xaa, 0x89, 0x88, 0x00, 0x00, 0x88, 0x00, + 0x01, 0x90, 0xaa, 0xcb, 0xec, 0xcd, 0xbd, 0xad, 0xab, 0x88, 0x31, 0x44, 0x34, 0x33, 0x22, 0x10, + 0x00, 0x21, 0x53, 0x43, 0x23, 0x12, 0xa9, 0xcc, 0xcb, 0xaa, 0x09, 0x21, 0x23, 0x02, 0xca, 0xbb, + 0x2a, 0x57, 0x35, 0x34, 0x12, 0x90, 0xcc, 0xdb, 0xbb, 0xba, 0x8a, 0x20, 0x44, 0x53, 0x32, 0x22, + 0x12, 0x32, 0x36, 0x34, 0x13, 0xa0, 0xec, 0xdb, 0xba, 0xab, 0x99, 0x88, 0x00, 0x98, 0x99, 0x8a, + 0x88, 0x90, 0xa9, 0xcb, 0xba, 0xde, 0xdd, 0xcb, 0xac, 0x9a, 0x10, 0x52, 0x43, 0x43, 0x11, 0x01, + 0x08, 0x11, 0x32, 0x44, 0x33, 0x23, 0x81, 0xba, 0xcc, 0xbb, 0xaa, 0x08, 0x32, 0x13, 0xda, 0xdc, + 0x8a, 0x31, 0x47, 0x34, 0x23, 0x02, 0xb9, 0xcd, 0xbb, 0xac, 0x9a, 0x09, 0x21, 0x35, 0x34, 0x33, + 0x22, 0x53, 0x44, 0x43, 0x33, 0x81, 0xca, 0xbe, 0xbc, 0xbb, 0xaa, 0x98, 0x80, 0x90, 0xa9, 0x9a, + 0x89, 0x08, 0xa0, 0xcb, 0xbb, 0xcd, 0xce, 0xcc, 0xac, 0x9b, 0x09, 0x31, 0x45, 0x33, 0x33, 0x01, + 0x00, 0x11, 0x44, 0x34, 0x34, 0x22, 0x01, 0xa8, 0xba, 0xbb, 0xbc, 0xaa, 0x10, 0x11, 0xd8, 0xdc, + 0xbb, 0x28, 0x65, 0x44, 0x33, 0x02, 0x90, 0xcb, 0xbc, 0xab, 0xab, 0x99, 0x08, 0x42, 0x44, 0x43, + 0x23, 0x34, 0x54, 0x43, 0x33, 0x12, 0xa9, 0xdd, 0xcb, 0xab, 0xab, 0x99, 0x89, 0x89, 0xa9, 0xba, + 0x99, 0x18, 0x13, 0x90, 0xcc, 0xcc, 0xbc, 0xbd, 0xbd, 0xac, 0x9a, 0x18, 0x43, 0x35, 0x23, 0x12, + 0x01, 0x21, 0x64, 0x53, 0x32, 0x22, 0x01, 0xa9, 0xaa, 0x8a, 0x99, 0xba, 0xaa, 0xab, 0xcb, 0xce, + 0xac, 0x0a, 0x54, 0x54, 0x33, 0x32, 0x80, 0xb9, 0xbc, 0xac, 0x99, 0x99, 0xaa, 0x89, 0x18, 0x44, + 0x35, 0x45, 0x34, 0x44, 0x32, 0x13, 0x91, 0xdb, 0xcc, 0xbb, 0xba, 0xa9, 0x9a, 0xa9, 0xaa, 0xbc, + 0xaa, 0x18, 0x42, 0x13, 0x80, 0xcc, 0xcc, 0xac, 0xcb, 0xba, 0x9a, 0x89, 0x21, 0x44, 0x43, 0x12, + 0x21, 0x41, 0x55, 0x53, 0x43, 0x12, 0x11, 0xa8, 0xa9, 0x98, 0x80, 0xa0, 0xcb, 0xcc, 0xbb, 0xbb, + 0xcb, 0x0a, 0x63, 0x55, 0x33, 0x33, 0x02, 0x98, 0xcb, 0xac, 0x89, 0x98, 0xa9, 0xcb, 0xab, 0x09, + 0x73, 0x45, 0x34, 0x44, 0x32, 0x33, 0x01, 0xb9, 0xcd, 0xac, 0xbb, 0xaa, 0xaa, 0xba, 0xbb, 0xbc, + 0xab, 0x09, 0x42, 0x24, 0x12, 0xa9, 0xcd, 0xcb, 0xaa, 0xaa, 0xa9, 0xa9, 0x9a, 0x09, 0x31, 0x42, + 0x43, 0x54, 0x46, 0x44, 0x34, 0x23, 0x12, 0x80, 0xa9, 0x9a, 0x00, 0x80, 0xda, 0xcd, 0xcb, 0xaa, + 0x9a, 0x89, 0x20, 0x45, 0x45, 0x23, 0x13, 0x80, 0xa9, 0xab, 0x9a, 0x80, 0xa8, 0xcd, 0xbc, 0xaa, + 0x30, 0x65, 0x34, 0x35, 0x33, 0x24, 0x11, 0x80, 0xbb, 0xcd, 0xca, 0xaa, 0xbb, 0xbb, 0xbc, 0xbb, + 0xaa, 0x09, 0x21, 0x53, 0x23, 0x81, 0xca, 0xcc, 0x9a, 0x9a, 0x88, 0x98, 0xdb, 0xbc, 0xbb, 0x8a, + 0x31, 0x45, 0x54, 0x44, 0x43, 0x43, 0x22, 0x02, 0x80, 0x98, 0x80, 0x00, 0xa9, 0xde, 0xdb, 0xab, + 0x9a, 0x89, 0x18, 0x41, 0x63, 0x43, 0x32, 0x12, 0x01, 0x98, 0x9a, 0x99, 0xba, 0xcd, 0xbc, 0x9c, + 0x19, 0x62, 0x44, 0x43, 0x24, 0x23, 0x22, 0x11, 0xa8, 0xcb, 0xcc, 0xbb, 0xbc, 0xbc, 0xbc, 0xbb, + 0xaa, 0x8a, 0x00, 0x31, 0x23, 0x13, 0x80, 0xaa, 0xab, 0x89, 0x00, 0xc9, 0xee, 0xcc, 0xcb, 0x9a, + 0x09, 0x31, 0x44, 0x44, 0x43, 0x53, 0x33, 0x23, 0x22, 0x00, 0x00, 0x88, 0xa8, 0xcd, 0xbe, 0xbc, + 0xab, 0x8a, 0x10, 0x11, 0x32, 0x53, 0x45, 0x33, 0x23, 0x02, 0x90, 0xba, 0xbc, 0xbd, 0xbc, 0xab, + 0x8a, 0x42, 0x46, 0x44, 0x33, 0x24, 0x22, 0x13, 0x01, 0x98, 0xdb, 0xbc, 0xbd, 0xbc, 0xbc, 0xac, + 0xaa, 0x89, 0x09, 0x08, 0x01, 0x21, 0x21, 0x33, 0x32, 0x11, 0x99, 0xdb, 0xbd, 0xbe, 0xbc, 0xbb, + 0x89, 0x31, 0x45, 0x33, 0x33, 0x45, 0x34, 0x35, 0x33, 0x23, 0x11, 0x90, 0xa8, 0xcb, 0xcd, 0xbc, + 0xcb, 0xaa, 0x88, 0x18, 0x00, 0x00, 0x53, 0x36, 0x35, 0x22, 0x01, 0x99, 0xca, 0xbb, 0xac, 0x9a, + 0x09, 0x30, 0x54, 0x35, 0x35, 0x43, 0x32, 0x32, 0x32, 0x01, 0xa9, 0xdc, 0xcc, 0xbc, 0xbc, 0xac, + 0xab, 0x99, 0x99, 0x98, 0x98, 0x00, 0x31, 0x45, 0x32, 0x12, 0x80, 0xb9, 0xbc, 0xcc, 0xcb, 0xaa, + 0x8a, 0x20, 0x63, 0x23, 0x22, 0x22, 0x44, 0x46, 0x34, 0x33, 0x22, 0x01, 0x98, 0xa9, 0xbb, 0xcc, + 0xcc, 0xcb, 0xba, 0x9a, 0x9a, 0x98, 0x10, 0x65, 0x34, 0x34, 0x12, 0x80, 0xca, 0xbb, 0xbb, 0x89, + 0x11, 0x43, 0x33, 0x45, 0x44, 0x34, 0x34, 0x32, 0x32, 0x12, 0x00, 0xca, 0xdc, 0xcc, 0xcb, 0xbb, + 0xbb, 0xac, 0xa9, 0xaa, 0x9b, 0x8a, 0x20, 0x54, 0x34, 0x23, 0x81, 0xa9, 0xcb, 0xbb, 0xab, 0x9a, + 0x88, 0x21, 0x73, 0x43, 0x32, 0x22, 0x21, 0x56, 0x44, 0x43, 0x22, 0x11, 0x08, 0x88, 0x08, 0x80, + 0xc9, 0xeb, 0xcc, 0xcb, 0xba, 0x99, 0x88, 0x31, 0x54, 0x43, 0x23, 0x81, 0xca, 0xbb, 0xac, 0x09, + 0x31, 0x34, 0x24, 0x33, 0x53, 0x35, 0x35, 0x43, 0x12, 0x11, 0x00, 0xa8, 0xca, 0xdc, 0xbc, 0xbc, + 0xcb, 0xba, 0xbb, 0xbb, 0xcb, 0xaa, 0x09, 0x53, 0x44, 0x32, 0x11, 0x98, 0xaa, 0xbb, 0x9a, 0x00, + 0x11, 0x22, 0x43, 0x45, 0x43, 0x32, 0x11, 0x21, 0x63, 0x35, 0x34, 0x33, 0x12, 0x11, 0x21, 0x34, + 0x13, 0xb0, 0xef, 0xbc, 0xad, 0xab, 0x99, 0x08, 0x21, 0x32, 0x32, 0x13, 0xb0, 0xcd, 0xac, 0x08, + 0x31, 0x44, 0x35, 0x33, 0x33, 0x35, 0x35, 0x24, 0x23, 0x12, 0x01, 0x90, 0xa9, 0xcd, 0xbd, 0xbd, + 0xca, 0xba, 0xac, 0xac, 0xbb, 0x9c, 0x8a, 0x20, 0x43, 0x34, 0x22, 0x81, 0xa9, 0xba, 0x99, 0x20, + 0x42, 0x23, 0x34, 0x35, 0x44, 0x23, 0x02, 0x88, 0x99, 0x08, 0x31, 0x45, 0x42, 0x33, 0x35, 0x34, + 0x34, 0x33, 0xb8, 0xcf, 0xbc, 0xbc, 0xab, 0x9a, 0x88, 0x90, 0xa8, 0x99, 0x18, 0x88, 0x98, 0x30, + 0x46, 0x44, 0x44, 0x43, 0x34, 0x43, 0x32, 0x32, 0x43, 0x22, 0x23, 0x81, 0xca, 0xcc, 0xbc, 0xbc, + 0xba, 0xcb, 0xeb, 0xcb, 0xcb, 0xba, 0x9a, 0x08, 0x21, 0x33, 0x24, 0x13, 0x80, 0x99, 0x99, 0x08, + 0x63, 0x63, 0x34, 0x44, 0x32, 0x11, 0x80, 0xa9, 0xba, 0xaa, 0x08, 0x01, 0x01, 0x31, 0x45, 0x55, + 0x43, 0x24, 0x13, 0xa0, 0xdc, 0xbc, 0xbc, 0xba, 0xaa, 0xbb, 0xbb, 0xac, 0x8a, 0x08, 0x01, 0x21, + 0x45, 0x45, 0x53, 0x33, 0x34, 0x43, 0x23, 0x32, 0x32, 0x43, 0x33, 0x01, 0xeb, 0xcc, 0xbb, 0xaa, + 0x88, 0x88, 0xdb, 0xce, 0xcb, 0xbb, 0x9b, 0x8a, 0x00, 0x10, 0x21, 0x22, 0x11, 0x11, 0x80, 0x09, + 0x73, 0x46, 0x44, 0x53, 0x22, 0x02, 0x88, 0xaa, 0xa9, 0x88, 0x00, 0x88, 0xdb, 0xcb, 0x8a, 0x21, + 0x54, 0x34, 0x34, 0x11, 0xa8, 0xcb, 0xcd, 0xcb, 0xcb, 0xcb, 0xab, 0x9a, 0x99, 0x88, 0x89, 0x08, + 0x42, 0x46, 0x44, 0x24, 0x32, 0x22, 0x23, 0x33, 0x43, 0x33, 0x23, 0x90, 0xeb, 0xcd, 0xab, 0x9a, + 0x00, 0x12, 0x88, 0xdc, 0xbd, 0xbc, 0xab, 0x8a, 0x88, 0x00, 0x08, 0x00, 0x10, 0x80, 0x89, 0x08, + 0x73, 0x56, 0x44, 0x34, 0x32, 0x01, 0x98, 0x99, 0x88, 0x10, 0x10, 0xa8, 0xed, 0xbc, 0xbb, 0x8a, + 0x10, 0x33, 0x35, 0x22, 0x02, 0xa8, 0xeb, 0xdb, 0xcc, 0xbc, 0xcb, 0x9a, 0x99, 0x9a, 0xa9, 0xaa, + 0x18, 0x64, 0x45, 0x43, 0x33, 0x23, 0x22, 0x42, 0x33, 0x34, 0x13, 0xa0, 0xdb, 0xcc, 0xba, 0x99, + 0x10, 0x11, 0x81, 0xda, 0xcd, 0xbb, 0xac, 0x99, 0x88, 0x00, 0x98, 0x98, 0x88, 0x80, 0x00, 0x01, + 0x51, 0x67, 0x44, 0x43, 0x22, 0x02, 0x88, 0x08, 0x10, 0x32, 0x22, 0xc0, 0xde, 0xdb, 0xba, 0x99, + 0x08, 0x00, 0x80, 0x00, 0x80, 0x11, 0x81, 0xda, 0xdd, 0xcc, 0xcb, 0x9a, 0x9a, 0xa9, 0xb9, 0xba, + 0x8b, 0x61, 0x45, 0x35, 0x33, 0x24, 0x22, 0x33, 0x44, 0x23, 0x23, 0x98, 0xdb, 0xcb, 0xaa, 0x09, + 0x21, 0x00, 0xb8, 0xec, 0xcb, 0xbb, 0x9a, 0x9a, 0x89, 0x00, 0x08, 0x00, 0x08, 0x08, 0x80, 0xcb, + 0x40, 0x77, 0x35, 0x34, 0x22, 0x00, 0x89, 0x18, 0x43, 0x34, 0x22, 0xa8, 0xce, 0xac, 0xab, 0x9a, + 0x98, 0xb8, 0xcb, 0xcb, 0xab, 0x10, 0x23, 0xb8, 0xcf, 0xcc, 0xab, 0x9a, 0x99, 0x99, 0xba, 0xbc, + 0x9a, 0x40, 0x45, 0x35, 0x34, 0x43, 0x43, 0x43, 0x24, 0x23, 0x12, 0x98, 0xbb, 0xbc, 0xaa, 0x20, + 0x23, 0x91, 0xeb, 0xcd, 0xcb, 0x9a, 0x99, 0x99, 0x99, 0x08, 0x20, 0x43, 0x32, 0x14, 0x82, 0xa8, + 0x09, 0x73, 0x47, 0x24, 0x12, 0x80, 0x99, 0x00, 0x32, 0x35, 0x24, 0x80, 0xdb, 0xbb, 0xbc, 0x9a, + 0xaa, 0xcc, 0xbc, 0xdb, 0x9a, 0x09, 0x00, 0xb8, 0xcd, 0xbd, 0xbb, 0x88, 0x08, 0x98, 0xba, 0xbc, + 0x9b, 0x42, 0x54, 0x34, 0x34, 0x34, 0x43, 0x44, 0x43, 0x23, 0x11, 0x98, 0xaa, 0xa9, 0x09, 0x31, + 0x23, 0xa8, 0xce, 0xcd, 0xbb, 0xba, 0xaa, 0xcb, 0x99, 0x08, 0x52, 0x53, 0x23, 0x22, 0x01, 0x98, + 0x08, 0x51, 0x45, 0x34, 0x23, 0x90, 0x99, 0x99, 0x10, 0x52, 0x34, 0x22, 0x88, 0xca, 0xcc, 0xcb, + 0xbb, 0xbd, 0xbc, 0xba, 0xab, 0x99, 0xa9, 0xec, 0xdc, 0xcb, 0x9b, 0x09, 0x00, 0x80, 0xa8, 0xcb, + 0x9a, 0x10, 0x44, 0x35, 0x34, 0x24, 0x43, 0x43, 0x44, 0x32, 0x12, 0x88, 0x99, 0x88, 0x00, 0x12, + 0x12, 0xa8, 0xdc, 0xdc, 0xbb, 0xbb, 0xcc, 0xac, 0xab, 0x08, 0x31, 0x44, 0x34, 0x32, 0x12, 0x00, + 0x08, 0x32, 0x47, 0x44, 0x22, 0x80, 0x98, 0xba, 0xba, 0x99, 0x21, 0x22, 0x32, 0x01, 0xfa, 0xcc, + 0xcb, 0xbc, 0xaa, 0x98, 0x98, 0x88, 0xea, 0xce, 0xbc, 0xbc, 0xab, 0x0a, 0x00, 0x80, 0xa9, 0xbc, + 0x9c, 0x09, 0x42, 0x45, 0x43, 0x33, 0x33, 0x44, 0x43, 0x24, 0x12, 0x01, 0x08, 0x08, 0x00, 0x11, + 0x00, 0x98, 0xa9, 0xcc, 0xbd, 0xdb, 0xbd, 0xcd, 0xba, 0x9a, 0x18, 0x42, 0x43, 0x34, 0x22, 0x11, + 0x00, 0x21, 0x45, 0x35, 0x33, 0x02, 0x98, 0xcb, 0xcb, 0xa9, 0x18, 0x10, 0x01, 0xa8, 0xcc, 0xbd, + 0xcb, 0xba, 0x09, 0x21, 0x33, 0x22, 0xf9, 0xce, 0xcc, 0xcb, 0xaa, 0x89, 0x88, 0x90, 0xc9, 0xcb, + 0xaa, 0x89, 0x21, 0x45, 0x34, 0x33, 0x24, 0x33, 0x44, 0x33, 0x23, 0x13, 0x12, 0x01, 0x00, 0x01, + 0x01, 0x88, 0x99, 0xbb, 0xeb, 0xec, 0xec, 0xdb, 0xcb, 0xaa, 0x8a, 0x10, 0x32, 0x35, 0x24, 0x22, + 0x21, 0x32, 0x45, 0x44, 0x32, 0x12, 0x90, 0xa9, 0xbb, 0x9b, 0x9a, 0x89, 0xba, 0xdd, 0xcc, 0xac, + 0xab, 0x8a, 0x20, 0x53, 0x34, 0x22, 0x80, 0xdc, 0xcc, 0xcb, 0xbb, 0x99, 0x89, 0x99, 0xbc, 0xbd, + 0xab, 0x9a, 0x00, 0x42, 0x45, 0x24, 0x23, 0x32, 0x53, 0x43, 0x23, 0x12, 0x12, 0x11, 0x00, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x99, 0xec, 0xdc, 0xcd, 0xcc, 0xcb, 0x9a, 0x99, 0x11, 0x32, 0x53, 0x32, + 0x22, 0x53, 0x34, 0x35, 0x43, 0x22, 0x81, 0x90, 0x99, 0x98, 0x99, 0xba, 0xcc, 0xcc, 0xcc, 0xcb, + 0xba, 0x9a, 0x18, 0x43, 0x44, 0x23, 0x12, 0x98, 0xeb, 0xbc, 0xbb, 0x9b, 0x9a, 0xba, 0xdd, 0xcb, + 0xab, 0xab, 0x89, 0x28, 0x53, 0x44, 0x32, 0x33, 0x53, 0x34, 0x33, 0x23, 0x22, 0x12, 0x01, 0x88, + 0x89, 0x08, 0x21, 0x43, 0x14, 0x91, 0xec, 0xdc, 0xcc, 0xbc, 0xac, 0x9a, 0x09, 0x11, 0x22, 0x32, + 0x34, 0x53, 0x44, 0x53, 0x33, 0x24, 0x12, 0x11, 0x00, 0x90, 0x98, 0xaa, 0xcc, 0xcc, 0xdb, 0xcb, + 0xbb, 0xbb, 0x99, 0x20, 0x44, 0x43, 0x33, 0x11, 0x98, 0xbb, 0xbd, 0xab, 0xab, 0xcd, 0xcc, 0xcb, + 0xbb, 0xbb, 0xbb, 0xaa, 0x18, 0x53, 0x34, 0x34, 0x44, 0x33, 0x25, 0x33, 0x22, 0x22, 0x02, 0x00, + 0x88, 0x88, 0x18, 0x53, 0x44, 0x01, 0xa8, 0xcd, 0xcc, 0xbd, 0xcb, 0xab, 0x99, 0x89, 0x10, 0x31, + 0x33, 0x34, 0x45, 0x44, 0x34, 0x34, 0x33, 0x33, 0x22, 0x00, 0x88, 0xaa, 0xdb, 0xcc, 0xcb, 0xbc, + 0xbc, 0xac, 0xab, 0x89, 0x28, 0x43, 0x44, 0x22, 0x02, 0x80, 0x98, 0x98, 0xaa, 0xdd, 0xdb, 0xbb, + 0xbc, 0xbb, 0xbc, 0xbb, 0x9b, 0x89, 0x21, 0x45, 0x44, 0x33, 0x43, 0x33, 0x33, 0x43, 0x22, 0x12, + 0x00, 0x80, 0x20, 0x73, 0x34, 0x23, 0x80, 0xc9, 0xbd, 0xbd, 0xcd, 0xba, 0xbb, 0x9b, 0x8a, 0x00, + 0x22, 0x32, 0x53, 0x54, 0x45, 0x43, 0x24, 0x23, 0x33, 0x12, 0x80, 0x99, 0xab, 0xcc, 0xcb, 0xcb, + 0xac, 0xcb, 0xbb, 0xbb, 0xaa, 0x10, 0x44, 0x34, 0x33, 0x22, 0x21, 0x11, 0xa0, 0xdc, 0xcc, 0xcb, + 0xba, 0xcb, 0xcb, 0xbb, 0xbb, 0xab, 0x89, 0x32, 0x55, 0x43, 0x22, 0x23, 0x33, 0x34, 0x24, 0x22, + 0x10, 0x21, 0x31, 0x44, 0x45, 0x23, 0x13, 0x00, 0xb9, 0xdc, 0xdc, 0xdb, 0xab, 0xbb, 0xaa, 0x0a, + 0x10, 0x11, 0x01, 0x42, 0x56, 0x54, 0x33, 0x34, 0x23, 0x23, 0x11, 0x88, 0xb9, 0xcb, 0xcb, 0xbc, + 0xcb, 0xcb, 0xcb, 0xbb, 0xbb, 0x89, 0x30, 0x44, 0x34, 0x32, 0x33, 0x32, 0x11, 0xc9, 0xdc, 0xcb, + 0xca, 0xba, 0xcb, 0x7b, 0x02, 0x01, 0x02, 0x7d, 0x0b, 0x02, 0xf4, 0x01, 0xae, 0x0b, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0xf7, 0xff, 0xa1, 0x8f, 0xa1, 0x74, 0x62, 0xa3, 0xbd, 0x8a, 0x15, + 0x9a, 0x80, 0x18, 0x00, 0x98, 0x9b, 0xb8, 0xbf, 0xad, 0x51, 0x34, 0x80, 0x81, 0xca, 0x18, 0x0a, + 0x24, 0x12, 0x10, 0xfa, 0x8f, 0x00, 0x01, 0x31, 0x15, 0x53, 0x11, 0xa0, 0xac, 0xdb, 0x1a, 0x23, + 0x14, 0xb9, 0x19, 0x41, 0x26, 0x01, 0xa9, 0xba, 0x3b, 0x27, 0x44, 0x23, 0x91, 0xbb, 0xaa, 0xc9, + 0xbf, 0x09, 0x30, 0x45, 0x81, 0xfb, 0xbb, 0x89, 0x20, 0x23, 0xc8, 0xdc, 0xbb, 0x89, 0x11, 0x12, + 0x10, 0x42, 0x33, 0x92, 0xdd, 0xbc, 0x9b, 0x20, 0x33, 0x90, 0x89, 0x40, 0x56, 0x33, 0x82, 0xca, + 0x9b, 0x40, 0x45, 0x33, 0x11, 0x98, 0xaa, 0xca, 0xbc, 0xbd, 0x8a, 0x31, 0x34, 0x82, 0xda, 0xac, + 0x08, 0x53, 0x23, 0x98, 0xcc, 0x9a, 0x10, 0x44, 0x43, 0x32, 0x42, 0x12, 0x90, 0xdb, 0xbc, 0x9a, + 0x10, 0x11, 0xa8, 0xbb, 0x1a, 0x56, 0x23, 0x81, 0xba, 0x89, 0x73, 0x35, 0x33, 0x02, 0x98, 0xa9, + 0xcb, 0xbc, 0xac, 0x19, 0x63, 0x22, 0xa8, 0xcd, 0xbb, 0x8a, 0x10, 0x90, 0xdd, 0xbc, 0xaa, 0x88, + 0x21, 0x21, 0x32, 0x34, 0x13, 0xc8, 0xce, 0xab, 0x09, 0x31, 0x22, 0x80, 0x89, 0x72, 0x35, 0x23, + 0x90, 0xba, 0x89, 0x64, 0x24, 0x13, 0x80, 0xb9, 0xbc, 0xbd, 0xbc, 0x9b, 0x28, 0x44, 0x23, 0xa8, + 0xcc, 0x8a, 0x31, 0x44, 0x01, 0xb8, 0xcb, 0x09, 0x42, 0x44, 0x33, 0x34, 0x24, 0x11, 0xc9, 0xbc, + 0xac, 0x88, 0x11, 0x80, 0xb9, 0x99, 0x52, 0x35, 0x12, 0xa9, 0xbb, 0x48, 0x46, 0x34, 0x22, 0x81, + 0x98, 0xca, 0xdb, 0xbb, 0x8a, 0x31, 0x35, 0x82, 0xeb, 0xbc, 0x9b, 0x08, 0x81, 0xda, 0xcd, 0xab, + 0x9a, 0x18, 0x20, 0x33, 0x34, 0x24, 0x90, 0xfb, 0xbb, 0x9b, 0x10, 0x32, 0x81, 0x88, 0x51, 0x55, + 0x33, 0x02, 0xa8, 0x9a, 0x41, 0x55, 0x32, 0x11, 0x88, 0xbb, 0xcd, 0xcc, 0xaa, 0x09, 0x31, 0x43, + 0x81, 0xca, 0xaa, 0x18, 0x44, 0x22, 0xa0, 0xcb, 0x9a, 0x30, 0x46, 0x43, 0x34, 0x24, 0x13, 0xa0, + 0xdb, 0xbb, 0x9a, 0x08, 0x90, 0xa9, 0x9a, 0x41, 0x46, 0x22, 0x90, 0xaa, 0x18, 0x55, 0x35, 0x23, + 0x13, 0x81, 0xb9, 0xcd, 0xcb, 0x9b, 0x18, 0x43, 0x12, 0xc9, 0xbd, 0xbb, 0x8a, 0x88, 0xca, 0xce, + 0xcb, 0xaa, 0x89, 0x08, 0x31, 0x53, 0x33, 0x02, 0xd9, 0xcc, 0x9a, 0x09, 0x10, 0x00, 0x08, 0x51, + 0x44, 0x24, 0x12, 0x98, 0x89, 0x31, 0x46, 0x33, 0x22, 0x01, 0xa9, 0xce, 0xcc, 0xab, 0x8a, 0x20, + 0x33, 0x82, 0xba, 0x9d, 0x18, 0x43, 0x23, 0x91, 0xcb, 0x9a, 0x30, 0x45, 0x54, 0x63, 0x33, 0x14, + 0x81, 0xb9, 0xac, 0x9b, 0x88, 0x98, 0xbb, 0x9a, 0x51, 0x44, 0x22, 0x80, 0x9b, 0x28, 0x65, 0x43, + 0x33, 0x22, 0x22, 0x90, 0xeb, 0xcc, 0xab, 0x19, 0x32, 0x03, 0xd9, 0xcc, 0xaa, 0x89, 0x98, 0xdb, + 0xcd, 0xbb, 0xaa, 0x9a, 0x99, 0x18, 0x63, 0x34, 0x12, 0xa9, 0xcd, 0xaa, 0x08, 0x10, 0x98, 0x9a, + 0x40, 0x46, 0x24, 0x12, 0x98, 0x88, 0x41, 0x34, 0x24, 0x02, 0x01, 0x81, 0xc9, 0xce, 0xbc, 0x9b, + 0x28, 0x32, 0x01, 0xcb, 0xab, 0x38, 0x35, 0x14, 0xa8, 0xbc, 0x09, 0x41, 0x43, 0x32, 0x54, 0x45, + 0x33, 0x11, 0xa9, 0xbc, 0x8a, 0x08, 0x98, 0xcc, 0xab, 0x28, 0x36, 0x23, 0x91, 0xcb, 0x19, 0x54, + 0x34, 0x23, 0x12, 0x21, 0x12, 0xa8, 0xcf, 0xcb, 0x89, 0x31, 0x23, 0xc9, 0xcd, 0x9a, 0x08, 0x00, + 0xca, 0xdd, 0xab, 0x9b, 0x88, 0x98, 0x9a, 0x10, 0x45, 0x23, 0xa1, 0xcc, 0xbb, 0x19, 0x21, 0x90, + 0xcc, 0x0a, 0x64, 0x34, 0x12, 0x90, 0x9a, 0x38, 0x46, 0x33, 0x11, 0x88, 0x08, 0x90, 0xeb, 0xcd, + 0xab, 0x19, 0x32, 0x02, 0xda, 0xac, 0x19, 0x53, 0x23, 0x90, 0xbc, 0x9b, 0x40, 0x34, 0x23, 0x21, + 0x55, 0x34, 0x13, 0x90, 0xcb, 0x9b, 0x28, 0x01, 0xe9, 0xbc, 0x0b, 0x52, 0x24, 0x81, 0xb9, 0x9b, + 0x51, 0x36, 0x23, 0x81, 0x80, 0x11, 0x02, 0xd9, 0xcc, 0x9b, 0x21, 0x24, 0xa1, 0xce, 0xbb, 0x08, + 0x22, 0x90, 0xed, 0xbc, 0xaa, 0x08, 0x00, 0x98, 0x89, 0x30, 0x44, 0x01, 0xda, 0xac, 0x0a, 0x31, + 0x12, 0xda, 0xbb, 0x38, 0x57, 0x23, 0x81, 0xaa, 0x0a, 0x73, 0x43, 0x11, 0x88, 0x99, 0x80, 0x90, + 0xcc, 0xbc, 0x8b, 0x32, 0x24, 0xc8, 0xcc, 0x8b, 0x41, 0x34, 0x01, 0xca, 0xbb, 0x19, 0x63, 0x33, + 0x11, 0x21, 0x44, 0x24, 0x82, 0xc9, 0xab, 0x18, 0x42, 0x90, 0xec, 0xab, 0x10, 0x44, 0x13, 0xb8, + 0xcb, 0x18, 0x54, 0x24, 0x02, 0x88, 0x09, 0x00, 0x91, 0xda, 0xbb, 0x18, 0x35, 0x03, 0xfb, 0xbd, + 0x8a, 0x20, 0x13, 0xd8, 0xcd, 0xab, 0x89, 0x10, 0x81, 0x98, 0x09, 0x31, 0x23, 0xd8, 0xcd, 0x8b, + 0x30, 0x43, 0xa1, 0xcc, 0x8a, 0x61, 0x34, 0x02, 0xa8, 0xab, 0x40, 0x55, 0x22, 0x81, 0xa9, 0x99, + 0x88, 0xb8, 0xcc, 0xab, 0x30, 0x44, 0x91, 0xdc, 0xac, 0x18, 0x53, 0x23, 0xa8, 0xdb, 0x9a, 0x30, + 0x44, 0x22, 0x01, 0x31, 0x43, 0x13, 0xb9, 0xbd, 0x0a, 0x43, 0x14, 0xc9, 0xbd, 0x8a, 0x41, 0x34, + 0x81, 0xcb, 0x8b, 0x41, 0x36, 0x23, 0x91, 0x99, 0x89, 0x00, 0xa8, 0xbc, 0x8a, 0x54, 0x14, 0xb0, + 0xcf, 0x9b, 0x19, 0x32, 0x01, 0xec, 0xbc, 0x9a, 0x18, 0x11, 0x00, 0x99, 0x18, 0x21, 0xa0, 0xdd, + 0xac, 0x18, 0x53, 0x02, 0xb8, 0xad, 0x29, 0x44, 0x24, 0x91, 0xba, 0x0a, 0x54, 0x34, 0x12, 0x98, + 0xba, 0x99, 0x99, 0xca, 0xbb, 0x2a, 0x55, 0x03, 0xc9, 0xbe, 0x9b, 0x32, 0x36, 0x02, 0xca, 0xbb, + 0x09, 0x63, 0x33, 0x21, 0x01, 0x22, 0x33, 0x90, 0xcd, 0x9b, 0x40, 0x34, 0x81, 0xcc, 0xac, 0x18, + 0x53, 0x22, 0xa9, 0xad, 0x08, 0x54, 0x24, 0x02, 0xa8, 0x99, 0x09, 0x88, 0xa9, 0x9a, 0x52, 0x35, + 0x81, 0xec, 0xbc, 0x8a, 0x20, 0x23, 0xb0, 0xcf, 0xac, 0x89, 0x10, 0x02, 0x00, 0x88, 0x08, 0x80, + 0xdb, 0xbd, 0x89, 0x41, 0x24, 0x81, 0xca, 0x9a, 0x41, 0x35, 0x12, 0xb9, 0xbb, 0x51, 0x46, 0x23, + 0x81, 0xaa, 0xba, 0x9a, 0xa9, 0xba, 0x1a, 0x64, 0x33, 0xb1, 0xcf, 0xbb, 0x18, 0x63, 0x23, 0xa0, + 0xdb, 0xaa, 0x20, 0x44, 0x23, 0x22, 0x21, 0x11, 0x80, 0xdb, 0xac, 0x29, 0x63, 0x22, 0xa8, 0xcc, + 0x8a, 0x21, 0x25, 0x91, 0xca, 0x9b, 0x52, 0x45, 0x22, 0x00, 0x9a, 0xaa, 0x89, 0x99, 0x99, 0x31, + 0x47, 0x12, 0xc9, 0xbe, 0xac, 0x18, 0x31, 0x01, 0xeb, 0xcc, 0x9a, 0x08, 0x11, 0x02, 0x81, 0x80, + 0x98, 0xcb, 0xbe, 0x9b, 0x38, 0x44, 0x13, 0xb8, 0xbb, 0x19, 0x46, 0x33, 0x90, 0xca, 0x1a, 0x64, + 0x34, 0x12, 0x90, 0xba, 0xbb, 0xbb, 0xba, 0x89, 0x73, 0x25, 0x02, 0xea, 0xcb, 0x8b, 0x30, 0x35, + 0x02, 0xb9, 0xad, 0x0a, 0x42, 0x34, 0x33, 0x22, 0x12, 0x90, 0xca, 0xcc, 0x89, 0x41, 0x24, 0x82, + 0xc9, 0xab, 0x19, 0x44, 0x02, 0xb9, 0xbc, 0x28, 0x56, 0x34, 0x02, 0x90, 0xaa, 0xbb, 0xaa, 0x99, + 0x41, 0x45, 0x24, 0x90, 0xcd, 0xbc, 0x99, 0x20, 0x22, 0xa8, 0xce, 0xbb, 0x9b, 0x10, 0x32, 0x22, + 0x01, 0x98, 0xdc, 0xcc, 0xbb, 0x09, 0x42, 0x24, 0x01, 0xa9, 0x8a, 0x41, 0x34, 0x02, 0xc9, 0x9a, + 0x72, 0x54, 0x22, 0x82, 0xa8, 0xbb, 0xad, 0xaa, 0x89, 0x32, 0x46, 0x12, 0xb8, 0xcd, 0xab, 0x18, + 0x42, 0x33, 0x90, 0xdb, 0x9b, 0x28, 0x44, 0x34, 0x24, 0x22, 0x80, 0xb9, 0xbd, 0x9b, 0x20, 0x45, + 0x12, 0x98, 0xaa, 0x09, 0x31, 0x33, 0xb0, 0xbe, 0x8a, 0x55, 0x45, 0x22, 0x00, 0x98, 0xbb, 0xbc, + 0xab, 0x28, 0x55, 0x33, 0x03, 0xeb, 0xbc, 0x9c, 0x08, 0x20, 0x80, 0xdb, 0xbc, 0xab, 0x89, 0x11, + 0x33, 0x33, 0x82, 0xfb, 0xcd, 0xbb, 0x8a, 0x21, 0x34, 0x12, 0x98, 0x89, 0x21, 0x35, 0x12, 0xb8, + 0xbb, 0x51, 0x47, 0x34, 0x22, 0x00, 0xaa, 0xcd, 0xbb, 0x9b, 0x20, 0x55, 0x23, 0x81, 0xbc, 0xad, + 0x8a, 0x21, 0x32, 0x01, 0xc9, 0xab, 0x0a, 0x52, 0x54, 0x53, 0x32, 0x11, 0xa9, 0xcc, 0xab, 0x18, + 0x42, 0x23, 0x01, 0x99, 0x08, 0x31, 0x23, 0xb8, 0xbf, 0x8a, 0x62, 0x45, 0x33, 0x12, 0x01, 0xc9, + 0xcc, 0xbb, 0x8a, 0x52, 0x35, 0x23, 0xb8, 0xcd, 0xbb, 0x89, 0x00, 0x00, 0xca, 0xcc, 0xab, 0x9b, + 0x09, 0x30, 0x44, 0x14, 0xa1, 0xdc, 0xbd, 0x9a, 0x18, 0x22, 0x13, 0x81, 0x08, 0x32, 0x34, 0x82, + 0xca, 0x9c, 0x38, 0x47, 0x43, 0x22, 0x11, 0x98, 0xda, 0xcc, 0xbb, 0x09, 0x53, 0x25, 0x02, 0xc8, + 0xbb, 0x9b, 0x28, 0x32, 0x02, 0xb9, 0xbb, 0x8a, 0x41, 0x45, 0x45, 0x35, 0x23, 0x91, 0xdb, 0xbc, + 0x8a, 0x31, 0x43, 0x11, 0x98, 0x00, 0x32, 0x14, 0xa8, 0xcd, 0x8a, 0x31, 0x46, 0x32, 0x12, 0x11, + 0x90, 0xea, 0xcc, 0xab, 0x28, 0x54, 0x14, 0x81, 0xca, 0xbb, 0x9a, 0x00, 0x80, 0xca, 0xcc, 0xaa, + 0xa9, 0x98, 0x09, 0x42, 0x35, 0x13, 0xf9, 0xcc, 0xab, 0x0a, 0x31, 0x32, 0x00, 0x88, 0x41, 0x34, + 0x12, 0xb9, 0xae, 0x09, 0x44, 0x34, 0x22, 0x01, 0x10, 0x98, 0xec, 0xcc, 0x9a, 0x38, 0x54, 0x22, + 0x90, 0xcb, 0x9b, 0x08, 0x22, 0x81, 0xb9, 0x9c, 0x18, 0x32, 0x33, 0x54, 0x55, 0x34, 0x12, 0xb9, + 0xcd, 0x9b, 0x18, 0x33, 0x12, 0x90, 0x08, 0x53, 0x24, 0x92, 0xeb, 0xab, 0x28, 0x54, 0x23, 0x12, + 0x00, 0x10, 0xa0, 0xec, 0xbc, 0x9a, 0x42, 0x36, 0x12, 0xb9, 0xbc, 0xab, 0x08, 0x80, 0xc9, 0xbd, + 0xab, 0x89, 0x88, 0xa9, 0x09, 0x54, 0x25, 0x92, 0xec, 0xac, 0x9b, 0x10, 0x22, 0x01, 0x88, 0x20, + 0x45, 0x23, 0x90, 0xbd, 0x9b, 0x41, 0x45, 0x12, 0x01, 0x08, 0x88, 0xa8, 0xdd, 0xcb, 0x09, 0x52, + 0x24, 0x02, 0xc9, 0xba, 0x89, 0x31, 0x11, 0xc9, 0xbb, 0x09, 0x43, 0x24, 0x11, 0x52, 0x45, 0x24, + 0x81, 0xdb, 0xcb, 0x89, 0x30, 0x22, 0x81, 0x88, 0x41, 0x35, 0x13, 0xc9, 0xbd, 0x0a, 0x42, 0x25, + 0x12, 0x80, 0x08, 0x00, 0xb8, 0xce, 0xbb, 0x29, 0x55, 0x23, 0x91, 0xdb, 0xab, 0x09, 0x01, 0xa8, + 0xdd, 0xab, 0x89, 0x10, 0x80, 0x99, 0x18, 0x54, 0x23, 0xd8, 0xce, 0xab, 0x89, 0x22, 0x02, 0x80, + 0x09, 0x63, 0x34, 0x02, 0xca, 0xac, 0x19, 0x63, 0x33, 0x01, 0x98, 0x88, 0x80, 0xc9, 0xce, 0xaa, + 0x20, 0x45, 0x23, 0xa0, 0xcb, 0x9a, 0x20, 0x23, 0xb0, 0xbe, 0x9b, 0x40, 0x43, 0x13, 0x10, 0x52, + 0x44, 0x13, 0xb8, 0xdd, 0xaa, 0x18, 0x32, 0x11, 0x89, 0x28, 0x55, 0x33, 0x91, 0xeb, 0xab, 0x28, + 0x54, 0x13, 0x81, 0x98, 0x08, 0x88, 0xd9, 0xbc, 0x9b, 0x51, 0x35, 0x03, 0xb9, 0xbd, 0x8a, 0x10, + 0x80, 0xfb, 0xbc, 0x9a, 0x18, 0x12, 0x90, 0x99, 0x30, 0x35, 0x02, 0xed, 0xad, 0x9b, 0x18, 0x12, + 0x81, 0x89, 0x31, 0x47, 0x13, 0x90, 0xcc, 0x9a, 0x30, 0x35, 0x23, 0x90, 0x99, 0x89, 0x98, 0xeb, + 0xbc, 0x0a, 0x73, 0x43, 0x01, 0xb9, 0xbb, 0x18, 0x43, 0x82, 0xeb, 0xac, 0x19, 0x42, 0x24, 0x10, + 0x00, 0x43, 0x43, 0x82, 0xeb, 0xac, 0x8a, 0x11, 0x13, 0x80, 0x09, 0x63, 0x35, 0x13, 0xc8, 0xbc, + 0x8a, 0x42, 0x35, 0x02, 0x98, 0x99, 0x89, 0x90, 0xeb, 0xbb, 0x18, 0x55, 0x23, 0x90, 0xcc, 0xaa, + 0x00, 0x02, 0xc8, 0xce, 0xab, 0x89, 0x22, 0x12, 0x98, 0x09, 0x31, 0x24, 0xd9, 0xde, 0xba, 0x89, + 0x11, 0x11, 0x99, 0x18, 0x55, 0x34, 0x01, 0xc9, 0xcb, 0x19, 0x52, 0x33, 0x82, 0xa9, 0x9a, 0x89, + 0xa9, 0xcc, 0x9b, 0x50, 0x45, 0x12, 0xa0, 0xcb, 0x09, 0x32, 0x24, 0xb9, 0xbf, 0xab, 0x21, 0x45, + 0x22, 0x10, 0x20, 0x32, 0x14, 0xc8, 0xcc, 0xab, 0x18, 0x21, 0x82, 0x89, 0x40, 0x47, 0x24, 0x81, + 0xbb, 0xac, 0x18, 0x54, 0x22, 0x81, 0xa9, 0x99, 0x99, 0xa9, 0xdb, 0x8a, 0x53, 0x44, 0x01, 0xca, + 0xbb, 0x0a, 0x22, 0x91, 0xdf, 0xbc, 0xaa, 0x10, 0x22, 0x12, 0x88, 0x18, 0x11, 0xa0, 0xdf, 0xbc, + 0xaa, 0x00, 0x01, 0x98, 0x09, 0x72, 0x35, 0x33, 0x90, 0xbd, 0x9b, 0x30, 0x36, 0x23, 0x90, 0xba, + 0xaa, 0x9a, 0xcb, 0xab, 0x38, 0x47, 0x24, 0x81, 0xab, 0x9b, 0x41, 0x25, 0x81, 0xdc, 0xac, 0x09, + 0x32, 0x35, 0x22, 0x11, 0x21, 0x12, 0xa0, 0xdc, 0xac, 0x8a, 0x11, 0x81, 0x98, 0x39, 0x57, 0x34, + 0x13, 0xa8, 0xbc, 0x8b, 0x52, 0x34, 0x12, 0x90, 0xab, 0xab, 0xbb, 0xcb, 0x8a, 0x52, 0x35, 0x03, + 0xc9, 0xbd, 0x8a, 0x21, 0x12, 0xfa, 0xce, 0xba, 0x09, 0x20, 0x22, 0x11, 0x81, 0x00, 0xa8, 0xdc, + 0xbd, 0xab, 0x89, 0x00, 0xa0, 0x9a, 0x41, 0x57, 0x33, 0x02, 0xb9, 0xbc, 0x09, 0x44, 0x43, 0x01, + 0xa8, 0xbb, 0xbb, 0xbb, 0x9b, 0x48, 0x46, 0x33, 0x82, 0xca, 0x9b, 0x30, 0x37, 0x03, 0xd9, 0xcc, + 0x9a, 0x28, 0x53, 0x33, 0x23, 0x22, 0x01, 0xa0, 0xcc, 0xbb, 0x8b, 0x10, 0x80, 0xbb, 0x0b, 0x67, + 0x35, 0x24, 0x81, 0xaa, 0x9b, 0x38, 0x45, 0x23, 0x01, 0xb9, 0xcb, 0xac, 0xbb, 0x89, 0x42, 0x35, + 0x12, 0xc9, 0xcc, 0x8a, 0x10, 0x23, 0xc0, 0xcf, 0xcb, 0xaa, 0x18, 0x21, 0x23, 0x13, 0x01, 0xa9, + 0xcd, 0xad, 0x9b, 0x09, 0x08, 0xa9, 0xcb, 0x19, 0x55, 0x35, 0x22, 0x98, 0xba, 0x8a, 0x41, 0x44, + 0x12, 0x90, 0xb9, 0xbd, 0xcb, 0xaa, 0x28, 0x45, 0x33, 0x02, 0xca, 0xab, 0x30, 0x55, 0x13, 0xa0, + 0xcd, 0xab, 0x89, 0x42, 0x43, 0x34, 0x32, 0x02, 0xa8, 0xdb, 0xbb, 0x89, 0x21, 0x01, 0xdb, 0xab, + 0x40, 0x47, 0x24, 0x02, 0x98, 0x99, 0x18, 0x42, 0x24, 0x11, 0x90, 0xba, 0xbe, 0xbc, 0x9b, 0x40, + 0x44, 0x22, 0xb8, 0xbd, 0xab, 0x20, 0x33, 0x92, 0xde, 0xbd, 0xba, 0x89, 0x10, 0x32, 0x34, 0x23, + 0x90, 0xdc, 0xcc, 0x9a, 0x09, 0x11, 0x98, 0xbc, 0x9b, 0x52, 0x35, 0x24, 0x81, 0xa9, 0x89, 0x30, + 0x43, 0x13, 0x81, 0xa8, 0xcd, 0xbd, 0xbc, 0x09, 0x53, 0x35, 0x02, 0xa9, 0xac, 0x09, 0x63, 0x23, + 0x82, 0xcb, 0xbc, 0x9a, 0x10, 0x43, 0x44, 0x34, 0x22, 0x91, 0xcb, 0xbc, 0x8a, 0x21, 0x12, 0xb8, + 0xbe, 0x09, 0x73, 0x24, 0x13, 0x80, 0x99, 0x10, 0x43, 0x32, 0x01, 0x80, 0xa8, 0xec, 0xcc, 0xbb, + 0x18, 0x73, 0x23, 0x90, 0xdb, 0xbb, 0x08, 0x43, 0x12, 0xd9, 0xcc, 0xbb, 0x9a, 0x08, 0x20, 0x43, + 0x44, 0x02, 0xb8, 0xce, 0xba, 0x09, 0x21, 0x81, 0xc9, 0xac, 0x19, 0x63, 0x33, 0x02, 0xa8, 0x89, + 0x31, 0x35, 0x11, 0x98, 0x8a, 0xba, 0xde, 0xcc, 0x9a, 0x30, 0x45, 0x23, 0x90, 0xbc, 0x8b, 0x42, + 0x35, 0x12, 0xb8, 0xcc, 0x9a, 0x08, 0x21, 0x43, 0x54, 0x33, 0x03, 0xb9, 0xbf, 0x9a, 0x28, 0x22, + 0x82, 0xdb, 0xab, 0x30, 0x46, 0x23, 0x01, 0x89, 0x28, 0x53, 0x23, 0x81, 0x98, 0x89, 0xa9, 0xcf, + 0xcc, 0x8a, 0x31, 0x45, 0x02, 0xc9, 0xac, 0x8a, 0x30, 0x33, 0x90, 0xdd, 0xbb, 0x9b, 0x89, 0x00, + 0x20, 0x45, 0x24, 0x81, 0xeb, 0xbc, 0x8a, 0x28, 0x22, 0x90, 0xbd, 0x8b, 0x40, 0x44, 0x12, 0x98, + 0x99, 0x21, 0x44, 0x12, 0xa8, 0xaa, 0x99, 0xb9, 0xcf, 0xbc, 0x09, 0x63, 0x34, 0x02, 0xba, 0xad, + 0x18, 0x53, 0x33, 0x80, 0xcb, 0xab, 0x09, 0x11, 0x22, 0x63, 0x45, 0x23, 0x91, 0xeb, 0xbb, 0x8a, + 0x32, 0x14, 0xb0, 0xbc, 0x0a, 0x63, 0x24, 0x02, 0x98, 0x08, 0x53, 0x43, 0x02, 0xa8, 0x99, 0x89, + 0xc9, 0xcd, 0xac, 0x19, 0x44, 0x24, 0xa0, 0xeb, 0xaa, 0x18, 0x32, 0x03, 0xd9, 0xbc, 0xab, 0x89, + 0x80, 0x08, 0x41, 0x45, 0x13, 0xa8, 0xbf, 0xac, 0x88, 0x22, 0x12, 0xc9, 0xbb, 0x19, 0x63, 0x23, + 0x80, 0x9a, 0x29, 0x64, 0x23, 0x91, 0xba, 0xab, 0xa9, 0xca, 0xce, 0x9b, 0x30, 0x37, 0x14, 0xa0, + 0xcb, 0x8a, 0x41, 0x34, 0x12, 0xa9, 0xac, 0x8a, 0x10, 0x12, 0x21, 0x45, 0x35, 0x13, 0xc8, 0xcd, + 0x9a, 0x18, 0x23, 0x02, 0xba, 0x9d, 0x28, 0x35, 0x23, 0x80, 0x89, 0x51, 0x45, 0x22, 0x90, 0xaa, + 0x9a, 0x98, 0xda, 0xcc, 0x8b, 0x50, 0x34, 0x02, 0xd9, 0xbc, 0x8a, 0x21, 0x24, 0x90, 0xcc, 0xab, + 0x8a, 0x08, 0x08, 0x08, 0x63, 0x34, 0x02, 0xeb, 0xbd, 0x9a, 0x20, 0x22, 0x81, 0xbc, 0x9b, 0x40, + 0x34, 0x02, 0xa9, 0x8a, 0x72, 0x44, 0x11, 0x99, 0xbb, 0xaa, 0x99, 0xdb, 0xad, 0x0a, 0x54, 0x43, + 0x02, 0xba, 0xbc, 0x18, 0x44, 0x14, 0x91, 0xb9, 0x9a, 0x18, 0x21, 0x11, 0x41, 0x55, 0x33, 0x82, + 0xdc, 0xbc, 0x89, 0x21, 0x23, 0x90, 0xbc, 0x0a, 0x62, 0x33, 0x02, 0xa9, 0x38, 0x56, 0x24, 0x02, + 0xa8, 0xba, 0x99, 0xa9, 0xdc, 0xbb, 0x19, 0x55, 0x23, 0xa0, 0xdc, 0xab, 0x18, 0x32, 0x03, 0xd9, + 0xbc, 0xaa, 0x08, 0x80, 0x88, 0x21, 0x55, 0x33, 0xb0, 0xcf, 0xbb, 0x09, 0x22, 0x13, 0xb8, 0xbc, + 0x19, 0x53, 0x13, 0xa0, 0xbb, 0x58, 0x46, 0x33, 0x81, 0xcb, 0xbb, 0xaa, 0xaa, 0xcc, 0x9b, 0x50, + 0x45, 0x13, 0xa0, 0xdb, 0x99, 0x41, 0x43, 0x12, 0xa9, 0xba, 0x09, 0x31, 0x22, 0x21, 0x54, 0x35, + 0x23, 0xc8, 0xce, 0xaa, 0x08, 0x32, 0x02, 0xb8, 0xaa, 0x30, 0x36, 0x23, 0xa8, 0x0a, 0x74, 0x35, + 0x33, 0x90, 0xba, 0xbb, 0xaa, 0xcb, 0xbc, 0x9b, 0x62, 0x25, 0x02, 0xca, 0xbd, 0x99, 0x21, 0x22, + 0xa1, 0xcd, 0xab, 0x89, 0x00, 0x00, 0x08, 0x52, 0x34, 0x03, 0xfb, 0xbd, 0x9b, 0x10, 0x32, 0x81, + 0xba, 0x9b, 0x41, 0x34, 0x91, 0xcb, 0x0a, 0x65, 0x44, 0x02, 0x98, 0xcb, 0xba, 0xa9, 0xba, 0xbb, + 0x18, 0x56, 0x24, 0x01, 0xb9, 0x9c, 0x29, 0x44, 0x23, 0x80, 0xba, 0x8b, 0x21, 0x34, 0x22, 0x41, + 0x44, 0x24, 0x92, 0xdc, 0xbc, 0x9a, 0x11, 0x23, 0x80, 0x9a, 0x19, 0x54, 0x23, 0x80, 0xaa, 0x61, + 0x47, 0x33, 0x03, 0x98, 0xcb, 0xba, 0xba, 0xcb, 0xaa, 0x30, 0x55, 0x22, 0xb8, 0xdc, 0xab, 0x08, + 0x22, 0x82, 0xda, 0xbc, 0x9a, 0x00, 0x01, 0x08, 0x31, 0x44, 0x14, 0xb0, 0xcf, 0xbb, 0x8a, 0x21, + 0x11, 0x98, 0x99, 0x21, 0x44, 0x91, 0xeb, 0x9b, 0x51, 0x46, 0x23, 0x01, 0xba, 0xbc, 0xbc, 0xba, + 0xaa, 0x09, 0x62, 0x44, 0x02, 0x98, 0xab, 0x0a, 0x53, 0x34, 0x11, 0x99, 0x9b, 0x28, 0x43, 0x33, + 0x42, 0x53, 0x43, 0x02, 0xda, 0xcd, 0xaa, 0x88, 0x21, 0x00, 0x88, 0x20, 0x53, 0x24, 0x90, 0xba, + 0x28, 0x77, 0x34, 0x23, 0x00, 0xa9, 0xcb, 0xbb, 0xcb, 0x9a, 0x18, 0x34, 0x24, 0x90, 0xdc, 0xab, + 0x89, 0x20, 0x01, 0xca, 0xcc, 0x9b, 0x09, 0x01, 0x11, 0x21, 0x53, 0x23, 0xb8, 0xdf, 0xbb, 0xab, + 0x00, 0x01, 0x88, 0x09, 0x42, 0x34, 0x82, 0xec, 0xac, 0x28, 0x64, 0x34, 0x12, 0x98, 0xca, 0xdb, + 0xba, 0xba, 0x09, 0x31, 0x36, 0x22, 0x90, 0xba, 0x0a, 0x52, 0x44, 0x11, 0x98, 0x9a, 0x18, 0x53, + 0x33, 0x42, 0x33, 0x24, 0x02, 0xda, 0xcd, 0xaa, 0x89, 0x08, 0x88, 0x89, 0x31, 0x37, 0x24, 0x91, + 0xbb, 0x0c, 0x73, 0x45, 0x33, 0x12, 0x80, 0xba, 0xcc, 0xbb, 0x9c, 0x09, 0x42, 0x23, 0x81, 0xcc, + 0xbb, 0x8a, 0x10, 0x01, 0xda, 0xbd, 0xaa, 0x09, 0x20, 0x11, 0x21, 0x35, 0x23, 0xb0, 0xdf, 0xbb, + 0x9a, 0x08, 0x80, 0xaa, 0x8b, 0x54, 0x35, 0x12, 0xda, 0xbd, 0x89, 0x42, 0x45, 0x22, 0x01, 0x99, + 0xdb, 0xbc, 0xcb, 0x8a, 0x10, 0x34, 0x14, 0x91, 0xaa, 0x8a, 0x42, 0x34, 0x12, 0xa8, 0xaa, 0x28, + 0x44, 0x34, 0x32, 0x43, 0x24, 0x02, 0xd9, 0xcc, 0x9b, 0x89, 0x01, 0xa8, 0xbb, 0x2a, 0x57, 0x33, + 0x02, 0xca, 0xac, 0x20, 0x46, 0x34, 0x23, 0x01, 0x98, 0xca, 0xcc, 0xbb, 0x8a, 0x31, 0x34, 0x83, + 0xda, 0xbc, 0x8a, 0x20, 0x02, 0xc9, 0xcd, 0xaa, 0x08, 0x11, 0x12, 0x11, 0x33, 0x25, 0x90, 0xdd, + 0xac, 0x8a, 0x10, 0x01, 0xc8, 0xbb, 0x28, 0x47, 0x13, 0xa0, 0xdc, 0xaa, 0x20, 0x44, 0x33, 0x12, + 0x80, 0xba, 0xdd, 0xbc, 0xbb, 0x09, 0x53, 0x33, 0x82, 0xc9, 0xaa, 0x40, 0x34, 0x23, 0xa8, 0xcb, + 0x09, 0x43, 0x44, 0x12, 0x22, 0x43, 0x12, 0xb8, 0xde, 0xba, 0x08, 0x21, 0x91, 0xcb, 0x9c, 0x40, + 0x35, 0x14, 0x98, 0xac, 0x8a, 0x53, 0x35, 0x33, 0x11, 0x00, 0xa8, 0xcc, 0xbd, 0xab, 0x18, 0x53, + 0x22, 0xb8, 0xbd, 0xab, 0x10, 0x33, 0xa0, 0xce, 0xac, 0x89, 0x21, 0x21, 0x11, 0x31, 0x53, 0x82, + 0xea, 0xbd, 0xaa, 0x20, 0x23, 0xa1, 0xcc, 0x9b, 0x52, 0x35, 0x02, 0xca, 0xad, 0x0a, 0x32, 0x35, + 0x12, 0x81, 0x98, 0xba, 0xcf, 0xcb, 0x9a, 0x20, 0x44, 0x12, 0xa9, 0xab, 0x09, 0x54, 0x23, 0x81, + 0xca, 0x9a, 0x30, 0x35, 0x33, 0x22, 0x42, 0x33, 0x91, 0xed, 0xac, 0x8a, 0x20, 0x13, 0xb8, 0xbd, + 0x0a, 0x73, 0x43, 0x81, 0xb9, 0x9c, 0x28, 0x54, 0x33, 0x22, 0x01, 0x80, 0xa9, 0xce, 0xcb, 0x9a, + 0x41, 0x33, 0x91, 0xeb, 0xbb, 0x09, 0x32, 0x13, 0xfa, 0xdb, 0x8a, 0x18, 0x22, 0x02, 0x11, 0x32, + 0x14, 0xb0, 0xcf, 0xac, 0x08, 0x31, 0x13, 0xc9, 0xcb, 0x08, 0x54, 0x32, 0xa0, 0xcc, 0xaa, 0x28, + 0x34, 0x14, 0x01, 0x88, 0x99, 0xda, 0xdc, 0xbb, 0x09, 0x43, 0x34, 0x80, 0xcb, 0x9a, 0x31, 0x36, + 0x13, 0xb9, 0xbc, 0x09, 0x53, 0x24, 0x22, 0x21, 0x23, 0x13, 0xea, 0xcd, 0x9b, 0x19, 0x33, 0x82, + 0xda, 0x9c, 0x28, 0x54, 0x13, 0xa0, 0xcb, 0x8a, 0x52, 0x34, 0x23, 0x10, 0x00, 0x80, 0xca, 0xce, + 0xaa, 0x19, 0x43, 0x23, 0xc9, 0xbd, 0x9a, 0x20, 0x33, 0xa1, 0xde, 0xab, 0x89, 0x31, 0x23, 0x12, + 0x32, 0x43, 0x82, 0xec, 0xbd, 0x9a, 0x30, 0x43, 0x81, 0xda, 0x9a, 0x30, 0x36, 0x02, 0xc9, 0xac, + 0x8a, 0x32, 0x25, 0x02, 0x88, 0x98, 0xa9, 0xec, 0xbc, 0x9b, 0x20, 0x45, 0x02, 0xb8, 0xac, 0x19, + 0x44, 0x33, 0x91, 0xcb, 0xab, 0x30, 0x45, 0x23, 0x22, 0x23, 0x23, 0xa0, 0xcf, 0xbc, 0x8a, 0x21, + 0x14, 0x90, 0xbc, 0x8b, 0x62, 0x43, 0x02, 0xaa, 0xac, 0x28, 0x54, 0x23, 0x02, 0x00, 0x01, 0xa8, + 0xfb, 0xbc, 0x8a, 0x31, 0x34, 0x91, 0xdc, 0xac, 0x08, 0x31, 0x12, 0xca, 0xbe, 0x9b, 0x10, 0x32, + 0x33, 0x22, 0x43, 0x12, 0xc8, 0xcf, 0xab, 0x09, 0x42, 0x23, 0xa8, 0xbc, 0x09, 0x73, 0x23, 0x80, + 0xbc, 0xac, 0x10, 0x43, 0x13, 0x80, 0x98, 0x99, 0xda, 0xcd, 0xac, 0x89, 0x42, 0x24, 0x80, 0xdb, + 0x9a, 0x31, 0x45, 0x02, 0xa8, 0xbb, 0x0a, 0x52, 0x34, 0x23, 0x32, 0x33, 0x82, 0xfa, 0xbd, 0x9c, + 0x19, 0x22, 0x12, 0xba, 0xbc, 0x28, 0x55, 0x13, 0x90, 0xba, 0x0b, 0x63, 0x34, 0x23, 0x81, 0x00, + 0x80, 0xc9, 0xcd, 0xbb, 0x18, 0x63, 0x02, 0xc9, 0xcc, 0x9a, 0x20, 0x23, 0x91, 0xdd, 0xbb, 0x8a, + 0x31, 0x33, 0x24, 0x33, 0x33, 0x91, 0xde, 0xcc, 0x9a, 0x20, 0x23, 0x02, 0xc9, 0xaa, 0x31, 0x45, + 0x12, 0xb9, 0xbd, 0x89, 0x42, 0x23, 0x82, 0xa8, 0x9a, 0xca, 0xdc, 0xcc, 0x9a, 0x20, 0x25, 0x02, + 0xc9, 0xbb, 0x29, 0x55, 0x23, 0x81, 0xca, 0xab, 0x20, 0x44, 0x34, 0x32, 0x33, 0x22, 0xb8, 0xdf, + 0xbb, 0x8a, 0x30, 0x32, 0x90, 0xdb, 0x8a, 0x42, 0x35, 0x02, 0xa9, 0xaa, 0x30, 0x37, 0x24, 0x01, + 0x00, 0x00, 0x98, 0xeb, 0xac, 0x9a, 0x32, 0x24, 0xa0, 0xcf, 0xab, 0x19, 0x22, 0x03, 0xda, 0xcd, + 0x9a, 0x19, 0x22, 0x43, 0x32, 0x33, 0x03, 0xda, 0xce, 0xab, 0x09, 0x32, 0x23, 0xa0, 0xbb, 0x19, + 0x55, 0x23, 0x91, 0xdb, 0x9b, 0x20, 0x53, 0x11, 0x88, 0xaa, 0xaa, 0xdc, 0xcc, 0xbb, 0x19, 0x53, + 0x23, 0xb8, 0xcd, 0x8a, 0x51, 0x34, 0x12, 0xa8, 0xcb, 0x89, 0x42, 0x44, 0x33, 0x43, 0x23, 0x81, + 0xeb, 0xcc, 0xaa, 0x08, 0x11, 0x02, 0x99, 0xaa, 0x20, 0x45, 0x23, 0x90, 0x9a, 0x28, 0x65, 0x33, + 0x13, 0x01, 0x80, 0x90, 0xca, 0xbd, 0x9c, 0x30, 0x43, 0x91, 0xce, 0xad, 0x8a, 0x10, 0x22, 0xb0, + 0xcd, 0xac, 0x8a, 0x10, 0x42, 0x43, 0x43, 0x12, 0x90, 0xdc, 0xbc, 0x99, 0x28, 0x22, 0x02, 0x98, + 0x08, 0x41, 0x43, 0x81, 0xba, 0xac, 0x20, 0x54, 0x02, 0xa0, 0xba, 0xbc, 0xdb, 0xeb, 0xba, 0x09, + 0x42, 0x23, 0xb0, 0xce, 0x9a, 0x20, 0x45, 0x33, 0x80, 0xba, 0xaa, 0x30, 0x45, 0x35, 0x44, 0x32, + 0x02, 0xb9, 0xcd, 0xac, 0x89, 0x00, 0x11, 0x90, 0x98, 0x18, 0x42, 0x33, 0x80, 0x99, 0x40, 0x55, + 0x34, 0x02, 0x01, 0x00, 0x08, 0xa9, 0xbd, 0x9c, 0x30, 0x34, 0x92, 0xde, 0xad, 0x9b, 0x00, 0x12, + 0x90, 0xcc, 0xbc, 0xaa, 0x09, 0x22, 0x44, 0x35, 0x24, 0x81, 0xca, 0xcc, 0x9b, 0x08, 0x11, 0x02, + 0x80, 0x18, 0x42, 0x43, 0x01, 0xba, 0xac, 0x20, 0x35, 0x12, 0xb9, 0xbc, 0xcb, 0xcb, 0xcc, 0xac, + 0x0a, 0x41, 0x33, 0x90, 0xce, 0x9b, 0x18, 0x44, 0x33, 0x82, 0xa9, 0x89, 0x30, 0x54, 0x43, 0x45, + 0x43, 0x13, 0x91, 0xeb, 0xbb, 0xab, 0x08, 0x00, 0x90, 0x89, 0x21, 0x35, 0x23, 0xa0, 0xbb, 0x48, + 0x57, 0x33, 0x22, 0x08, 0x08, 0x80, 0x99, 0xcc, 0xab, 0x40, 0x36, 0x02, 0xfa, 0xbc, 0xab, 0x08, + 0x21, 0x90, 0xea, 0xbb, 0xab, 0x89, 0x00, 0x41, 0x55, 0x34, 0x23, 0xa8, 0xcd, 0xac, 0x88, 0x00, + 0x01, 0x88, 0x10, 0x53, 0x33, 0x91, 0xda, 0xab, 0x38, 0x45, 0x22, 0x98, 0xbc, 0xba, 0xbb, 0xcc, + 0xac, 0x8a, 0x51, 0x34, 0x81, 0xcc, 0xac, 0x09, 0x33, 0x25, 0x82, 0xa8, 0x89, 0x20, 0x43, 0x33, + 0x45, 0x45, 0x24, 0x02, 0xb9, 0xbd, 0xab, 0x89, 0x00, 0x98, 0x9a, 0x20, 0x45, 0x33, 0xa0, 0xbc, + 0x0a, 0x64, 0x34, 0x13, 0x80, 0x99, 0x08, 0x88, 0xca, 0xbb, 0x38, 0x57, 0x13, 0xc0, 0xbd, 0xac, + 0x09, 0x20, 0x81, 0xda, 0xcb, 0x9a, 0x08, 0x00, 0x00, 0x41, 0x46, 0x33, 0x82, 0xeb, 0xbb, 0x9a, + 0x10, 0x11, 0xa9, 0x89, 0x73, 0x34, 0x13, 0xb9, 0xbd, 0x0a, 0x62, 0x23, 0x81, 0xbb, 0xbc, 0xaa, + 0xca, 0xbc, 0xab, 0x30, 0x47, 0x12, 0xb9, 0xbe, 0x8a, 0x31, 0x34, 0x02, 0xa9, 0xab, 0x38, 0x45, + 0x23, 0x21, 0x54, 0x44, 0x22, 0x90, 0xdb, 0xbb, 0x8a, 0x00, 0x98, 0xbc, 0x89, 0x63, 0x34, 0x02, + 0xca, 0xbb, 0x30, 0x47, 0x23, 0x81, 0xa8, 0x89, 0x08, 0xa8, 0xbb, 0x0b, 0x56, 0x44, 0x81, 0xda, + 0xbc, 0x9a, 0x11, 0x12, 0xa9, 0xbe, 0xab, 0x09, 0x21, 0x00, 0x08, 0x73, 0x34, 0x14, 0xa8, 0xcc, + 0x9b, 0x08, 0x11, 0x90, 0xbb, 0x38, 0x57, 0x33, 0x90, 0xdb, 0xab, 0x30, 0x35, 0x14, 0xa8, 0xcb, + 0xab, 0x9a, 0xbb, 0xad, 0x19, 0x54, 0x33, 0x91, 0xcd, 0xbb, 0x29, 0x53, 0x23, 0x98, 0xba, 0x8a, + 0x53, 0x34, 0x12, 0x21, 0x45, 0x34, 0x02, 0xc9, 0xcc, 0x8a, 0x08, 0x80, 0xb9, 0x9c, 0x28, 0x55, + 0x22, 0xa0, 0xbc, 0x0a, 0x62, 0x34, 0x12, 0x88, 0x9a, 0x8a, 0x98, 0xb9, 0xaa, 0x62, 0x46, 0x22, + 0xb8, 0xce, 0xaa, 0x08, 0x12, 0x81, 0xdb, 0xac, 0x8a, 0x20, 0x21, 0x80, 0x10, 0x54, 0x33, 0x82, + 0xcc, 0xbc, 0x09, 0x21, 0x01, 0xcb, 0x9b, 0x63, 0x36, 0x12, 0xa9, 0xbd, 0x09, 0x42, 0x24, 0x81, + 0xba, 0xbc, 0xaa, 0xba, 0xdb, 0x9a, 0x51, 0x44, 0x12, 0xb9, 0xbe, 0x9a, 0x31, 0x34, 0x82, 0xc9, + 0x9b, 0x20, 0x35, 0x24, 0x11, 0x31, 0x44, 0x23, 0x90, 0xcd, 0xab, 0x08, 0x10, 0xa8, 0xbe, 0x8a, + 0x52, 0x34, 0x03, 0xda, 0xab, 0x28, 0x45, 0x24, 0x81, 0xa8, 0x99, 0x99, 0x98, 0xab, 0x29, 0x56, + 0x34, 0x82, 0xeb, 0xac, 0x8a, 0x10, 0x12, 0xb8, 0xbe, 0xab, 0x08, 0x22, 0x12, 0x80, 0x41, 0x44, + 0x13, 0xb8, 0xcd, 0x8b, 0x10, 0x22, 0xa8, 0xbd, 0x29, 0x56, 0x33, 0x81, 0xcc, 0xaa, 0x28, 0x35, + 0x23, 0x98, 0xcc, 0xab, 0xab, 0xbb, 0xbb, 0x28, 0x47, 0x24, 0x91, 0xeb, 0xba, 0x18, 0x42, 0x22, + 0xa0, 0xcb, 0x89, 0x52, 0x43, 0x12, 0x21, 0x32, 0x34, 0x02, 0xda, 0xbc, 0x9a, 0x11, 0x91, 0xeb, + 0xac, 0x18, 0x54, 0x23, 0xa0, 0xdb, 0x8a, 0x41, 0x35, 0x13, 0x80, 0xaa, 0xab, 0xa9, 0xba, 0x8a, + 0x73, 0x37, 0x12, 0xb0, 0xcd, 0xab, 0x08, 0x21, 0x81, 0xfb, 0xbb, 0x89, 0x20, 0x22, 0x02, 0x11, + 0x42, 0x33, 0xa1, 0xdd, 0xab, 0x18, 0x33, 0x82, 0xcd, 0x9b, 0x51, 0x36, 0x13, 0xa8, 0xbd, 0x89, + 0x42, 0x34, 0x01, 0xb9, 0xbd, 0xac, 0xba, 0xab, 0x8a, 0x62, 0x44, 0x02, 0xb8, 0xbd, 0x9a, 0x21, + 0x34, 0x82, 0xca, 0xab, 0x20, 0x36, 0x34, 0x22, 0x21, 0x23, 0x13, 0xb8, 0xce, 0x9a, 0x18, 0x11, + 0xc9, 0xcd, 0x8a, 0x40, 0x34, 0x03, 0xc9, 0xbb, 0x28, 0x46, 0x24, 0x11, 0xa8, 0xb9, 0xba, 0xba, + 0x9a, 0x30, 0x67, 0x33, 0x81, 0xdb, 0xbc, 0x8a, 0x10, 0x11, 0xc9, 0xdc, 0xaa, 0x08, 0x21, 0x23, + 0x11, 0x12, 0x23, 0x81, 0xfb, 0xbb, 0x0a, 0x52, 0x12, 0xc8, 0xcb, 0x29, 0x64, 0x33, 0x82, 0xcb, + 0xbb, 0x20, 0x46, 0x22, 0x90, 0xda, 0xcb, 0xbb, 0xbb, 0x9b, 0x31, 0x46, 0x14, 0x80, 0xcb, 0xbb, + 0x18, 0x42, 0x13, 0xb0, 0xdb, 0x89, 0x52, 0x34, 0x24, 0x32, 0x21, 0x12, 0xa8, 0xdb, 0xab, 0x19, + 0x22, 0xa0, 0xcf, 0xbb, 0x18, 0x44, 0x24, 0x90, 0xbb, 0x8b, 0x63, 0x35, 0x14, 0x81, 0x99, 0xbb, + 0xbc, 0xba, 0x19, 0x55, 0x34, 0x13, 0xb9, 0xbd, 0xac, 0x88, 0x11, 0xa8, 0xdc, 0xcb, 0x99, 0x20, + 0x22, 0x32, 0x32, 0x12, 0x91, 0xeb, 0xbc, 0x89, 0x41, 0x24, 0x90, 0xcb, 0x9a, 0x62, 0x34, 0x23, + 0xa8, 0xbc, 0x0a, 0x53, 0x34, 0x02, 0xa9, 0xcd, 0xcc, 0xbb, 0xab, 0x18, 0x53, 0x34, 0x02, 0xc9, + 0xcb, 0x89, 0x21, 0x23, 0x91, 0xdb, 0xaa, 0x20, 0x46, 0x43, 0x33, 0x24, 0x11, 0x90, 0xcb, 0xbb, + 0x08, 0x32, 0x02, 0xfb, 0xbc, 0x89, 0x31, 0x44, 0x01, 0xaa, 0x9a, 0x40, 0x46, 0x33, 0x12, 0x80, + 0xba, 0xbe, 0xad, 0x8a, 0x41, 0x44, 0x23, 0x91, 0xdb, 0xab, 0x8a, 0x18, 0x98, 0xfb, 0xcb, 0xaa, + 0x09, 0x11, 0x33, 0x44, 0x32, 0x00, 0xda, 0xcb, 0x9a, 0x31, 0x34, 0x02, 0xb9, 0xac, 0x30, 0x36, + 0x14, 0x91, 0xaa, 0x0a, 0x52, 0x34, 0x13, 0x88, 0xeb, 0xdc, 0xbc, 0xcb, 0x99, 0x31, 0x44, 0x12, + 0x98, 0xbb, 0x9b, 0x20, 0x24, 0x81, 0xca, 0xbb, 0x08, 0x64, 0x53, 0x43, 0x43, 0x22, 0x90, 0xca, + 0xbb, 0x89, 0x32, 0x24, 0xb8, 0xcd, 0x9a, 0x28, 0x33, 0x12, 0xb9, 0xaa, 0x51, 0x46, 0x33, 0x23, + 0x21, 0x90, 0xec, 0xcc, 0xab, 0x19, 0x54, 0x33, 0x02, 0xb9, 0xbc, 0x9a, 0x88, 0xa0, 0xec, 0xcb, + 0x9b, 0x8a, 0x00, 0x31, 0x63, 0x43, 0x12, 0xa9, 0xcd, 0x9b, 0x28, 0x53, 0x12, 0xa0, 0xaa, 0x29, + 0x53, 0x24, 0x80, 0xa9, 0x09, 0x42, 0x25, 0x02, 0x80, 0x99, 0xdc, 0xdd, 0xbc, 0xab, 0x19, 0x44, + 0x23, 0x80, 0xbb, 0x9b, 0x20, 0x33, 0x81, 0xcc, 0xac, 0x08, 0x42, 0x34, 0x35, 0x35, 0x25, 0x02, + 0xa9, 0xcc, 0x8a, 0x10, 0x23, 0x82, 0xcb, 0xbb, 0x18, 0x33, 0x03, 0xda, 0xab, 0x51, 0x45, 0x33, + 0x11, 0x11, 0x11, 0xb0, 0xcf, 0xbd, 0x9a, 0x51, 0x53, 0x12, 0xa8, 0xba, 0x9a, 0x18, 0x80, 0xfa, + 0xbc, 0xab, 0x9a, 0x80, 0x10, 0x31, 0x37, 0x34, 0x91, 0xeb, 0xcb, 0x09, 0x31, 0x24, 0x01, 0x9a, + 0x0a, 0x42, 0x24, 0x91, 0xba, 0x8a, 0x73, 0x43, 0x02, 0x98, 0x9a, 0xa9, 0xdc, 0xdd, 0xbb, 0x8b, + 0x41, 0x24, 0x02, 0xaa, 0xab, 0x18, 0x34, 0x03, 0xda, 0xbc, 0x89, 0x41, 0x33, 0x43, 0x44, 0x35, + 0x23, 0x91, 0xbd, 0xbc, 0x08, 0x33, 0x23, 0xb8, 0xad, 0x8a, 0x32, 0x13, 0xc9, 0xbc, 0x29, 0x46, + 0x24, 0x02, 0x88, 0x18, 0x01, 0xb8, 0xdf, 0xab, 0x19, 0x54, 0x23, 0x80, 0xca, 0x9a, 0x00, 0x12, + 0xc9, 0xce, 0xbb, 0x99, 0x00, 0x00, 0x10, 0x42, 0x45, 0x12, 0xb8, 0xce, 0x9a, 0x28, 0x43, 0x12, + 0xa0, 0x99, 0x30, 0x44, 0x02, 0xb9, 0x9c, 0x38, 0x46, 0x22, 0x98, 0xb9, 0x9a, 0xa8, 0xdd, 0xbd, + 0xac, 0x18, 0x43, 0x13, 0xa8, 0xcb, 0x09, 0x43, 0x23, 0xb0, 0xbe, 0xab, 0x20, 0x44, 0x22, 0x31, + 0x55, 0x33, 0x03, 0xc9, 0xbd, 0x9a, 0x30, 0x43, 0x81, 0xba, 0xaa, 0x31, 0x34, 0xa0, 0xce, 0x9a, + 0x42, 0x36, 0x12, 0x90, 0x99, 0x00, 0x80, 0xd9, 0xbd, 0x9b, 0x42, 0x26, 0x02, 0xb9, 0xbb, 0x19, + 0x43, 0x82, 0xdd, 0xbd, 0x9a, 0x09, 0x01, 0x00, 0x10, 0x63, 0x33, 0x82, 0xec, 0xcb, 0x09, 0x31, + 0x43, 0x81, 0x99, 0x00, 0x43, 0x23, 0xb0, 0xbe, 0x09, 0x73, 0x33, 0x02, 0xba, 0xbb, 0x9b, 0xaa, + 0xde, 0xbc, 0x89, 0x31, 0x24, 0x91, 0xcb, 0x9b, 0x51, 0x34, 0x82, 0xda, 0xac, 0x0a, 0x31, 0x24, + 0x22, 0x43, 0x44, 0x33, 0x90, 0xdc, 0xbb, 0x19, 0x42, 0x13, 0xa0, 0xaa, 0x19, 0x43, 0x03, 0xfb, + 0xac, 0x18, 0x54, 0x33, 0x81, 0xa9, 0x99, 0x08, 0x90, 0xfb, 0xab, 0x18, 0x54, 0x23, 0xa8, 0xbc, + 0x8a, 0x42, 0x23, 0xd8, 0xce, 0xbb, 0x89, 0x10, 0x11, 0x80, 0x31, 0x54, 0x12, 0xc8, 0xdc, 0x9a, + 0x18, 0x43, 0x12, 0x90, 0x09, 0x42, 0x24, 0x82, 0xda, 0xab, 0x48, 0x35, 0x24, 0x98, 0xba, 0xbb, + 0xa9, 0xca, 0xcd, 0xab, 0x28, 0x43, 0x03, 0xca, 0xbc, 0x28, 0x45, 0x13, 0xb0, 0xcd, 0x9a, 0x28, + 0x43, 0x22, 0x21, 0x53, 0x24, 0x03, 0xc8, 0xcc, 0x9a, 0x20, 0x33, 0x01, 0xaa, 0x09, 0x52, 0x14, + 0xb0, 0xce, 0x8a, 0x41, 0x44, 0x22, 0x98, 0x9a, 0x8a, 0x88, 0xa9, 0xcb, 0x0b, 0x63, 0x34, 0x91, + 0xdb, 0xab, 0x38, 0x44, 0x82, 0xfb, 0xbc, 0xab, 0x08, 0x21, 0x10, 0x10, 0x42, 0x43, 0x81, 0xdc, + 0xbc, 0x0a, 0x31, 0x24, 0x02, 0x88, 0x31, 0x36, 0x12, 0xb9, 0xbe, 0x0a, 0x54, 0x43, 0x02, 0xb9, + 0xcb, 0xaa, 0xa9, 0xba, 0xbc, 0x09, 0x42, 0x13, 0xd8, 0xcc, 0x89, 0x52, 0x24, 0x02, 0xda, 0xbb, + 0x8a, 0x32, 0x34, 0x33, 0x34, 0x34, 0x33, 0xa0, 0xdd, 0xab, 0x09, 0x32, 0x22, 0x90, 0x99, 0x42, + 0x35, 0x91, 0xec, 0xbb, 0x29, 0x55, 0x33, 0x02, 0xaa, 0xba, 0xaa, 0xa8, 0xa9, 0x9a, 0x62, 0x35, + 0x01, 0xdb, 0xbc, 0x19, 0x53, 0x23, 0xc8, 0xce, 0xab, 0x8a, 0x10, 0x11, 0x11, 0x21, 0x43, 0x11, + 0xda, 0xbd, 0xab, 0x28, 0x34, 0x22, 0x00, 0x30, 0x56, 0x23, 0x80, 0xbc, 0xac, 0x30, 0x46, 0x22, + 0x80, 0xba, 0xbc, 0xbb, 0xba, 0xbb, 0x8a, 0x32, 0x25, 0xb0, 0xcf, 0xaa, 0x21, 0x36, 0x23, 0xa8, + 0xcd, 0x9a, 0x18, 0x42, 0x33, 0x33, 0x24, 0x24, 0x81, 0xc9, 0xbc, 0x8a, 0x10, 0x23, 0x80, 0x88, + 0x51, 0x45, 0x12, 0xc9, 0xbd, 0x8b, 0x51, 0x44, 0x22, 0x80, 0xaa, 0xbb, 0xaa, 0xaa, 0x89, 0x52, + 0x44, 0x02, 0xc9, 0xbd, 0x9a, 0x41, 0x24, 0x82, 0xeb, 0xcc, 0x9a, 0x09, 0x10, 0x11, 0x21, 0x22, + 0x12, 0xc8, 0xdc, 0xab, 0x09, 0x31, 0x23, 0x11, 0x52, 0x45, 0x24, 0x02, 0xba, 0xbd, 0x09, 0x44, + 0x25, 0x02, 0x98, 0xdb, 0xab, 0xbb, 0xab, 0x09, 0x32, 0x34, 0xb0, 0xde, 0xab, 0x19, 0x63, 0x33, + 0x82, 0xca, 0xac, 0x8a, 0x20, 0x34, 0x34, 0x34, 0x23, 0x02, 0xba, 0xbd, 0x9b, 0x18, 0x22, 0x80, + 0x89, 0x62, 0x45, 0x23, 0xa0, 0xcd, 0xab, 0x29, 0x45, 0x24, 0x11, 0x98, 0xba, 0xbc, 0xbb, 0x99, + 0x42, 0x45, 0x12, 0xa9, 0xcd, 0x9a, 0x18, 0x34, 0x12, 0xc8, 0xbd, 0xbc, 0x8a, 0x08, 0x21, 0x32, + 0x33, 0x13, 0xc9, 0xdd, 0x9b, 0x09, 0x21, 0x12, 0x88, 0x30, 0x57, 0x34, 0x13, 0xa0, 0xbc, 0x8b, + 0x31, 0x46, 0x22, 0x81, 0xb9, 0xcd, 0xbb, 0xbc, 0x99, 0x31, 0x24, 0x82, 0xeb, 0xbc, 0x8a, 0x32, + 0x45, 0x11, 0xa8, 0xbb, 0x9b, 0x18, 0x43, 0x44, 0x34, 0x24, 0x11, 0xa9, 0xcb, 0x9a, 0x10, 0x12, + 0xa0, 0xbb, 0x48, 0x47, 0x34, 0x81, 0xca, 0xac, 0x09, 0x32, 0x36, 0x12, 0x01, 0xa9, 0xeb, 0xcb, + 0x9b, 0x18, 0x54, 0x23, 0x91, 0xcc, 0xac, 0x08, 0x31, 0x33, 0x90, 0xdc, 0xbb, 0xbb, 0x99, 0x00, + 0x31, 0x36, 0x23, 0x90, 0xdd, 0xab, 0x89, 0x22, 0x12, 0x98, 0x8a, 0x74, 0x35, 0x14, 0x81, 0xba, + 0x9b, 0x28, 0x35, 0x24, 0x02, 0x88, 0xdb, 0xdc, 0xbb, 0xab, 0x28, 0x44, 0x13, 0xb9, 0xce, 0x9a, + 0x18, 0x43, 0x23, 0x90, 0xba, 0xaa, 0x09, 0x11, 0x53, 0x45, 0x25, 0x13, 0x98, 0xcb, 0x9b, 0x18, + 0x33, 0x81, 0xbc, 0x8c, 0x63, 0x44, 0x12, 0xa8, 0xbc, 0x8a, 0x31, 0x34, 0x24, 0x10, 0x80, 0xc9, + 0xcd, 0xcb, 0x8a, 0x42, 0x35, 0x02, 0xc9, 0xbc, 0x8b, 0x20, 0x43, 0x01, 0xca, 0xcb, 0xaa, 0x99, + 0x98, 0x18, 0x63, 0x43, 0x01, 0xea, 0xbb, 0x9b, 0x41, 0x23, 0x80, 0xbb, 0x3a, 0x57, 0x34, 0x02, + 0xa8, 0xba, 0x19, 0x43, 0x24, 0x01, 0x80, 0xa8, 0xfb, 0xcd, 0xab, 0x8a, 0x42, 0x43, 0x81, 0xcc, + 0xcb, 0x09, 0x31, 0x24, 0x81, 0xa9, 0x9a, 0x08, 0x11, 0x11, 0x63, 0x45, 0x33, 0x82, 0xda, 0xac, + 0x09, 0x32, 0x23, 0xb9, 0xbd, 0x18, 0x46, 0x33, 0x81, 0xca, 0xab, 0x28, 0x34, 0x14, 0x01, 0x80, + 0x80, 0xeb, 0xcd, 0xab, 0x18, 0x45, 0x33, 0xa0, 0xcc, 0xac, 0x08, 0x32, 0x12, 0xa8, 0xbc, 0xab, + 0x99, 0x98, 0xa9, 0x30, 0x47, 0x23, 0xb0, 0xbf, 0x9c, 0x08, 0x33, 0x03, 0xb9, 0xab, 0x72, 0x45, + 0x22, 0x80, 0xaa, 0x8a, 0x31, 0x35, 0x02, 0x98, 0x98, 0xb9, 0xde, 0xbd, 0xab, 0x28, 0x35, 0x23, + 0xc9, 0xbd, 0x9b, 0x28, 0x34, 0x12, 0xa8, 0xaa, 0x09, 0x32, 0x12, 0x21, 0x75, 0x34, 0x13, 0xb8, + 0xcd, 0x8b, 0x20, 0x24, 0x92, 0xda, 0x8a, 0x41, 0x35, 0x22, 0xa9, 0xac, 0x09, 0x42, 0x33, 0x00, + 0x89, 0x08, 0xa0, 0xee, 0xbc, 0x9a, 0x51, 0x34, 0x03, 0xc9, 0xbd, 0x99, 0x20, 0x23, 0x91, 0xdb, + 0xaa, 0x09, 0x00, 0x99, 0x8a, 0x61, 0x34, 0x02, 0xec, 0xac, 0x8a, 0x31, 0x24, 0x91, 0xba, 0x1a, + 0x74, 0x43, 0x02, 0x99, 0x9a, 0x10, 0x34, 0x22, 0xa8, 0xa9, 0x89, 0xda, 0xed, 0xcb, 0x89, 0x31, + 0x35, 0x91, 0xdb, 0xac, 0x09, 0x31, 0x23, 0x90, 0xab, 0x8a, 0x42, 0x24, 0x00, 0x21, 0x55, 0x24, + 0x81, 0xdb, 0xac, 0x09, 0x33, 0x14, 0xb0, 0xcb, 0x19, 0x54, 0x24, 0x80, 0xb9, 0x8a, 0x40, 0x43, + 0x02, 0xa9, 0x99, 0x80, 0xb9, 0xdf, 0xbb, 0x29, 0x64, 0x23, 0x90, 0xcc, 0xab, 0x08, 0x32, 0x02, + 0xca, 0xcb, 0x99, 0x11, 0x01, 0xa9, 0x19, 0x54, 0x14, 0xb8, 0xcf, 0x9b, 0x18, 0x43, 0x12, 0xa8, + 0xab, 0x51, 0x35, 0x24, 0x91, 0x9a, 0x19, 0x53, 0x33, 0x91, 0xca, 0xaa, 0x99, 0xea, 0xdc, 0x9b, + 0x18, 0x44, 0x12, 0xb8, 0xcd, 0x9a, 0x10, 0x32, 0x82, 0xb9, 0x9c, 0x30, 0x44, 0x12, 0x01, 0x41, + 0x34, 0x23, 0xe9, 0xcc, 0x9a, 0x21, 0x43, 0x01, 0xca, 0x9a, 0x41, 0x44, 0x22, 0xa8, 0x9b, 0x18, + 0x54, 0x22, 0x98, 0xaa, 0x8a, 0x98, 0xfa, 0xbc, 0x9b, 0x52, 0x44, 0x02, 0xb9, 0xae, 0x9a, 0x11, + 0x12, 0xa8, 0xcc, 0x9a, 0x10, 0x23, 0x81, 0x99, 0x20, 0x35, 0xa2, 0xdf, 0xbc, 0x89, 0x31, 0x34, + 0x81, 0xba, 0x09, 0x55, 0x24, 0x12, 0xa8, 0x89, 0x41, 0x34, 0x12, 0xb9, 0xbc, 0x9a, 0xaa, 0xec, + 0xbc, 0x89, 0x51, 0x33, 0x91, 0xcc, 0xac, 0x89, 0x22, 0x13, 0xa9, 0xad, 0x19, 0x63, 0x23, 0x12, + 0x10, 0x42, 0x33, 0xa1, 0xde, 0xbb, 0x09, 0x53, 0x22, 0x98, 0xab, 0x19, 0x46, 0x23, 0x81, 0xaa, + 0x19, 0x54, 0x24, 0x81, 0xb9, 0xbb, 0x9a, 0xa9, 0xcd, 0xac, 0x29, 0x45, 0x23, 0xa0, 0xcd, 0xab, + 0x08, 0x22, 0x80, 0xcc, 0xac, 0x88, 0x32, 0x22, 0x81, 0x00, 0x32, 0x03, 0xfd, 0xcd, 0xaa, 0x10, + 0x42, 0x12, 0x98, 0x89, 0x41, 0x54, 0x22, 0x80, 0x89, 0x40, 0x44, 0x13, 0x90, 0xcb, 0xbb, 0xba, + 0xba, 0xbe, 0xab, 0x30, 0x45, 0x02, 0xca, 0xcc, 0x8a, 0x20, 0x22, 0xa0, 0xbc, 0x8c, 0x31, 0x27, + 0x23, 0x12, 0x22, 0x22, 0x91, 0xdd, 0xbc, 0x9a, 0x31, 0x34, 0x01, 0xaa, 0x8a, 0x62, 0x34, 0x03, + 0x98, 0x09, 0x72, 0x34, 0x12, 0xa8, 0xbc, 0xab, 0xaa, 0xbb, 0xbd, 0x0a, 0x54, 0x24, 0x81, 0xeb, + 0xab, 0x89, 0x20, 0x80, 0xeb, 0xbc, 0x8a, 0x21, 0x34, 0x13, 0x11, 0x11, 0x80, 0xfb, 0xcd, 0xac, + 0x88, 0x22, 0x23, 0x81, 0x89, 0x30, 0x46, 0x24, 0x01, 0x88, 0x28, 0x45, 0x24, 0x82, 0xb9, 0xdb, + 0xba, 0xba, 0xcb, 0x9b, 0x29, 0x44, 0x13, 0xc8, 0xbd, 0xab, 0x10, 0x23, 0x90, 0xbe, 0xac, 0x28, + 0x54, 0x24, 0x22, 0x22, 0x11, 0x81, 0xdb, 0xbd, 0xab, 0x28, 0x42, 0x12, 0x88, 0x09, 0x52, 0x44, + 0x02, 0xa0, 0x09, 0x52, 0x46, 0x22, 0x80, 0xaa, 0xbc, 0xab, 0xbb, 0xbb, 0x0a, 0x54, 0x43, 0x82, + 0xeb, 0xbb, 0x8a, 0x11, 0x01, 0xfb, 0xbc, 0xab, 0x18, 0x53, 0x32, 0x32, 0x22, 0x81, 0xda, 0xce, + 0xbb, 0x8b, 0x20, 0x33, 0x02, 0x00, 0x42, 0x36, 0x24, 0x81, 0x98, 0x20, 0x56, 0x34, 0x12, 0x98, + 0xcb, 0xbc, 0xab, 0xac, 0x9a, 0x10, 0x53, 0x12, 0xb8, 0xbe, 0x9b, 0x28, 0x32, 0x92, 0xdd, 0xbb, + 0x8a, 0x53, 0x44, 0x23, 0x43, 0x22, 0x80, 0xca, 0xbd, 0xbb, 0x08, 0x32, 0x13, 0x90, 0x08, 0x73, + 0x43, 0x12, 0x98, 0x9a, 0x62, 0x45, 0x33, 0x82, 0xb8, 0xcb, 0xbc, 0xbb, 0xac, 0x0a, 0x42, 0x25, + 0x01, 0xcb, 0xad, 0x89, 0x11, 0x02, 0xd9, 0xcd, 0xaa, 0x09, 0x22, 0x24, 0x23, 0x24, 0x02, 0xb8, + 0xce, 0xbc, 0x9a, 0x10, 0x22, 0x01, 0x98, 0x30, 0x47, 0x23, 0x01, 0xa9, 0x09, 0x73, 0x35, 0x22, + 0x91, 0xb9, 0xcb, 0xbc, 0xbc, 0xab, 0x19, 0x44, 0x23, 0xa0, 0xcd, 0xab, 0x28, 0x42, 0x01, 0xca, + 0xbd, 0x9a, 0x21, 0x44, 0x33, 0x34, 0x43, 0x02, 0xb8, 0xdd, 0xba, 0x09, 0x21, 0x11, 0x90, 0x8a, + 0x52, 0x45, 0x12, 0x98, 0xab, 0x29, 0x46, 0x34, 0x13, 0x98, 0xb9, 0xbb, 0xbe, 0xcb, 0x9a, 0x30, + 0x45, 0x12, 0xb9, 0xae, 0x8b, 0x10, 0x23, 0xa0, 0xdd, 0xbb, 0x8a, 0x10, 0x33, 0x34, 0x53, 0x33, + 0x81, 0xfb, 0xbc, 0xab, 0x19, 0x22, 0x01, 0xa8, 0x18, 0x65, 0x43, 0x01, 0xb8, 0xaa, 0x40, 0x46, + 0x23, 0x01, 0x98, 0xbb, 0xcb, 0xcc, 0xbb, 0x89, 0x42, 0x25, 0x82, 0xcb, 0xad, 0x09, 0x31, 0x14, + 0xa0, 0xcc, 0xab, 0x08, 0x42, 0x33, 0x53, 0x43, 0x23, 0x80, 0xdc, 0xcb, 0x9a, 0x11, 0x22, 0x90, + 0xa9, 0x28, 0x55, 0x33, 0x81, 0xcb, 0x9a, 0x62, 0x35, 0x23, 0x00, 0xa9, 0xab, 0xdb, 0xbc, 0xac, + 0x18, 0x53, 0x14, 0xa1, 0xeb, 0xaa, 0x08, 0x32, 0x02, 0xda, 0xbd, 0x9b, 0x08, 0x22, 0x33, 0x34, + 0x44, 0x12, 0xb0, 0xde, 0xba, 0x09, 0x21, 0x11, 0xa0, 0x9a, 0x50, 0x45, 0x22, 0x90, 0xba, 0x0a, + 0x73, 0x34, 0x22, 0x88, 0xaa, 0xba, 0xcc, 0xbc, 0x9c, 0x28, 0x44, 0x13, 0xb8, 0xbd, 0x8c, 0x28, + 0x24, 0x82, 0xca, 0xbc, 0x8a, 0x21, 0x24, 0x33, 0x53, 0x24, 0x03, 0xc8, 0xdc, 0xaa, 0x08, 0x22, + 0x01, 0xaa, 0x8b, 0x62, 0x35, 0x12, 0xa8, 0xbc, 0x18, 0x45, 0x24, 0x12, 0x98, 0x99, 0xba, 0xcc, + 0xbc, 0x9a, 0x41, 0x44, 0x02, 0xc9, 0xbc, 0x8b, 0x21, 0x24, 0x90, 0xcd, 0xab, 0x0a, 0x20, 0x22, + 0x32, 0x35, 0x34, 0x02, 0xfa, 0xbc, 0x9a, 0x18, 0x32, 0x81, 0xba, 0x09, 0x55, 0x34, 0x02, 0xba, + 0xac, 0x30, 0x46, 0x23, 0x82, 0xa8, 0xaa, 0xcb, 0xbc, 0xad, 0x0a, 0x42, 0x25, 0x81, 0xda, 0xbb, + 0x09, 0x52, 0x22, 0xa0, 0xcc, 0xaa, 0x19, 0x22, 0x43, 0x42, 0x53, 0x32, 0x91, 0xfb, 0xbb, 0x9a, + 0x11, 0x23, 0x90, 0xbb, 0x29, 0x47, 0x24, 0x91, 0xba, 0x9b, 0x52, 0x45, 0x22, 0x80, 0x98, 0xaa, + 0xba, 0xcd, 0xab, 0x19, 0x73, 0x22, 0xa1, 0xcc, 0xbb, 0x08, 0x43, 0x02, 0xd9, 0xbc, 0x9b, 0x18, + 0x22, 0x32, 0x43, 0x35, 0x23, 0xb0, 0xde, 0xab, 0x0a, 0x31, 0x12, 0xa8, 0xab, 0x40, 0x37, 0x24, + 0xa0, 0xba, 0x8a, 0x63, 0x34, 0x13, 0x90, 0xa9, 0xab, 0xcc, 0xcc, 0xaa, 0x28, 0x35, 0x14, 0xa0, + 0xbd, 0x9b, 0x20, 0x44, 0x01, 0xca, 0xcb, 0x89, 0x20, 0x32, 0x33, 0x44, 0x34, 0x12, 0xc8, 0xcd, + 0xab, 0x08, 0x22, 0x82, 0xb9, 0x8b, 0x61, 0x35, 0x13, 0xa8, 0xac, 0x19, 0x64, 0x33, 0x12, 0x98, + 0x99, 0xbb, 0xcc, 0xcc, 0x8a, 0x30, 0x35, 0x03, 0xca, 0xae, 0x9a, 0x20, 0x23, 0x91, 0xcd, 0xbb, + 0x8a, 0x20, 0x32, 0x33, 0x45, 0x34, 0x01, 0xca, 0xbe, 0xaa, 0x10, 0x22, 0x81, 0xb9, 0x1a, 0x64, + 0x34, 0x11, 0xba, 0x9c, 0x38, 0x55, 0x23, 0x01, 0x99, 0xaa, 0xcb, 0xdb, 0xac, 0x89, 0x52, 0x43, + 0x81, 0xca, 0xac, 0x09, 0x41, 0x13, 0x90, 0xcc, 0xab, 0x08, 0x31, 0x43, 0x43, 0x53, 0x23, 0x91, + 0xfb, 0xbb, 0x9b, 0x20, 0x22, 0xa0, 0xba, 0x29, 0x47, 0x24, 0x81, 0xb9, 0x9b, 0x52, 0x45, 0x22, + 0x81, 0x98, 0xaa, 0xca, 0xcc, 0xab, 0x08, 0x44, 0x23, 0xa1, 0xcd, 0xac, 0x08, 0x22, 0x02, 0xc9, + 0xbd, 0xaa, 0x08, 0x21, 0x33, 0x63, 0x43, 0x13, 0xa0, 0xcd, 0xac, 0x89, 0x21, 0x11, 0x98, 0x9a, + 0x40, 0x55, 0x22, 0x80, 0xab, 0x8a, 0x63, 0x34, 0x23, 0x80, 0xaa, 0xbb, 0xcd, 0xbc, 0xab, 0x20, + 0x36, 0x23, 0xb8, 0xcd, 0x9a, 0x28, 0x34, 0x01, 0xca, 0xbc, 0x9a, 0x20, 0x33, 0x44, 0x34, 0x24, + 0x03, 0xb9, 0xbf, 0xbb, 0x88, 0x12, 0x01, 0xaa, 0x8a, 0x72, 0x44, 0x12, 0xa0, 0x9a, 0x18, 0x55, + 0x43, 0x11, 0x80, 0xa8, 0xba, 0xbd, 0xad, 0x8a, 0x30, 0x35, 0x82, 0xda, 0xbc, 0x9a, 0x10, 0x23, + 0xa0, 0xcd, 0xbc, 0x8a, 0x00, 0x32, 0x53, 0x34, 0x24, 0x82, 0xca, 0xbd, 0x9a, 0x08, 0x12, 0x91, + 0x99, 0x18, 0x55, 0x34, 0x01, 0xb8, 0x9a, 0x40, 0x36, 0x24, 0x02, 0x98, 0xaa, 0xcc, 0xbc, 0xac, + 0x08, 0x52, 0x23, 0x81, 0xdb, 0xbb, 0x09, 0x42, 0x23, 0xa8, 0xdc, 0xab, 0x09, 0x21, 0x53, 0x44, + 0x43, 0x22, 0x90, 0xcc, 0xac, 0x8a, 0x08, 0x01, 0x99, 0x99, 0x31, 0x47, 0x32, 0x00, 0xa9, 0x19, + 0x72, 0x43, 0x23, 0x02, 0x90, 0xc9, 0xcc, 0xdb, 0x9a, 0x18, 0x43, 0x12, 0xb8, 0xcd, 0xab, 0x09, + 0x21, 0x80, 0xeb, 0xcb, 0xaa, 0x09, 0x20, 0x52, 0x44, 0x24, 0x12, 0xa8, 0xcc, 0xaa, 0x89, 0x10, + 0x80, 0x99, 0x08, 0x54, 0x35, 0x12, 0x90, 0x9a, 0x20, 0x64, 0x33, 0x12, 0x01, 0xa8, 0xcc, 0xcd, + 0xbb, 0x8b, 0x32, 0x35, 0x12, 0xca, 0xac, 0x8a, 0x31, 0x23, 0x90, 0xcd, 0xab, 0x9a, 0x18, 0x42, + 0x55, 0x34, 0x33, 0x82, 0xda, 0xbc, 0x9b, 0x09, 0x80, 0xa9, 0x9b, 0x31, 0x47, 0x33, 0x02, 0x98, + 0x10, 0x54, 0x34, 0x24, 0x12, 0x10, 0xa8, 0xeb, 0xbd, 0xbb, 0x09, 0x42, 0x13, 0xb0, 0xdd, 0xaa, + 0x89, 0x00, 0x80, 0xdb, 0xbc, 0xaa, 0x9a, 0x09, 0x30, 0x47, 0x25, 0x23, 0x80, 0xcb, 0xbb, 0x89, + 0x00, 0x90, 0xba, 0x1a, 0x74, 0x43, 0x22, 0x88, 0x8a, 0x30, 0x46, 0x23, 0x12, 0x10, 0x80, 0xca, + 0xdd, 0xbc, 0xaa, 0x20, 0x44, 0x11, 0xa9, 0xcb, 0x89, 0x21, 0x23, 0xa0, 0xdc, 0xaa, 0x89, 0x00, + 0x00, 0x62, 0x46, 0x24, 0x12, 0xa9, 0xcc, 0x9a, 0x88, 0x80, 0xba, 0xbc, 0x18, 0x45, 0x43, 0x11, + 0x89, 0x08, 0x63, 0x53, 0x12, 0x01, 0x11, 0x10, 0xa9, 0xbf, 0xbd, 0x99, 0x31, 0x32, 0xa0, 0xdd, + 0xaa, 0x89, 0x10, 0xa0, 0xcc, 0xbc, 0x9a, 0x08, 0x08, 0x09, 0x51, 0x46, 0x33, 0x02, 0xba, 0xad, + 0x89, 0x11, 0x90, 0xdb, 0x9b, 0x41, 0x45, 0x13, 0x91, 0x9a, 0x18, 0x55, 0x23, 0x01, 0x80, 0x08, + 0x00, 0xea, 0xcd, 0xab, 0x19, 0x43, 0x23, 0xb8, 0xbd, 0x8a, 0x41, 0x33, 0xa1, 0xdc, 0xab, 0x08, + 0x12, 0x01, 0x08, 0x64, 0x35, 0x33, 0x98, 0xbd, 0xac, 0x08, 0x01, 0xb9, 0xbe, 0x8a, 0x42, 0x35, + 0x02, 0xa8, 0x89, 0x52, 0x45, 0x22, 0x01, 0x88, 0x00, 0x81, 0xca, 0xbe, 0xab, 0x38, 0x34, 0x81, + 0xdd, 0xbb, 0x0a, 0x21, 0x02, 0xeb, 0xcc, 0x9a, 0x08, 0x01, 0x80, 0x08, 0x62, 0x44, 0x12, 0xa8, + 0xbb, 0x8a, 0x31, 0x04, 0xd9, 0xbc, 0x08, 0x54, 0x33, 0x91, 0xba, 0x0a, 0x73, 0x34, 0x03, 0x98, + 0x99, 0x09, 0x90, 0xdc, 0xcc, 0x89, 0x32, 0x34, 0x90, 0xbd, 0x9c, 0x30, 0x34, 0x02, 0xda, 0xcb, + 0x89, 0x21, 0x23, 0x80, 0x18, 0x45, 0x34, 0x81, 0xdb, 0xac, 0x09, 0x22, 0x80, 0xec, 0xab, 0x18, + 0x44, 0x13, 0x91, 0xab, 0x28, 0x56, 0x33, 0x02, 0x98, 0x89, 0x10, 0x90, 0xfb, 0xbb, 0x1a, 0x43, + 0x23, 0xfb, 0xbc, 0x9b, 0x20, 0x33, 0xb8, 0xdf, 0xaa, 0x09, 0x20, 0x02, 0x88, 0x10, 0x63, 0x33, + 0x91, 0xdb, 0x9b, 0x31, 0x35, 0x90, 0xdc, 0x9b, 0x31, 0x45, 0x12, 0xa9, 0xab, 0x20, 0x37, 0x24, + 0x80, 0xaa, 0x89, 0x88, 0xa8, 0xdc, 0x9b, 0x30, 0x35, 0x03, 0xfa, 0xbb, 0x19, 0x53, 0x33, 0xa8, + 0xbd, 0x9c, 0x28, 0x32, 0x03, 0x80, 0x20, 0x54, 0x12, 0xc8, 0xcc, 0x8a, 0x20, 0x23, 0xc9, 0xbe, + 0x8b, 0x41, 0x34, 0x02, 0xba, 0x8b, 0x72, 0x44, 0x13, 0x91, 0x99, 0x88, 0x08, 0xa8, 0xcc, 0x8a, + 0x41, 0x24, 0xa0, 0xde, 0xab, 0x09, 0x42, 0x01, 0xc9, 0xbd, 0x9b, 0x10, 0x22, 0x01, 0x08, 0x21, + 0x35, 0x13, 0xca, 0xad, 0x19, 0x44, 0x22, 0xb9, 0xbd, 0x0a, 0x44, 0x24, 0x90, 0xca, 0x0a, 0x52, + 0x35, 0x11, 0xa8, 0xaa, 0x9a, 0x88, 0xb9, 0xbc, 0x29, 0x46, 0x23, 0xb8, 0xbf, 0x9b, 0x31, 0x36, + 0x02, 0xca, 0xac, 0x8a, 0x31, 0x43, 0x01, 0x00, 0x21, 0x12, 0xa0, 0xcf, 0xab, 0x28, 0x43, 0x82, + 0xcc, 0xad, 0x08, 0x43, 0x23, 0x98, 0xbb, 0x29, 0x57, 0x33, 0x02, 0x98, 0xaa, 0x88, 0x88, 0xc9, + 0xaa, 0x30, 0x36, 0x83, 0xfc, 0xbc, 0x9a, 0x21, 0x33, 0xa0, 0xcf, 0xab, 0x89, 0x21, 0x23, 0x01, + 0x10, 0x31, 0x13, 0xc8, 0xcd, 0x8a, 0x53, 0x34, 0x81, 0xdb, 0x9b, 0x20, 0x45, 0x02, 0xb8, 0xbb, + 0x38, 0x56, 0x23, 0x81, 0xb9, 0xab, 0x9a, 0x99, 0xcb, 0x89, 0x73, 0x34, 0x81, 0xeb, 0xac, 0x09, + 0x53, 0x23, 0xa0, 0xeb, 0xaa, 0x18, 0x33, 0x33, 0x01, 0x10, 0x21, 0x90, 0xfc, 0xac, 0x0a, 0x32, + 0x33, 0xc8, 0xcd, 0x9a, 0x21, 0x35, 0x01, 0xba, 0x9b, 0x72, 0x44, 0x23, 0x81, 0xa9, 0xa9, 0x99, + 0x99, 0x9a, 0x29, 0x56, 0x13, 0xc8, 0xdd, 0xab, 0x09, 0x32, 0x03, 0xd9, 0xbd, 0xab, 0x08, 0x23, + 0x23, 0x12, 0x21, 0x12, 0xa0, 0xce, 0xbb, 0x30, 0x37, 0x14, 0x98, 0xbb, 0x0a, 0x63, 0x23, 0x91, + 0xcc, 0x89, 0x52, 0x35, 0x12, 0x90, 0xcb, 0xaa, 0xaa, 0x99, 0x09, 0x52, 0x35, 0x13, 0xd9, 0xcc, + 0x8b, 0x30, 0x35, 0x12, 0xb9, 0xae, 0x9a, 0x20, 0x24, 0x23, 0x12, 0x01, 0x90, 0xcc, 0xbd, 0xab, + 0x20, 0x25, 0x02, 0xca, 0xac, 0x1a, 0x42, 0x23, 0xa8, 0xac, 0x28, 0x57, 0x33, 0x13, 0x98, 0xaa, + 0xab, 0xaa, 0x99, 0x18, 0x46, 0x34, 0x90, 0xdd, 0xbc, 0x9a, 0x20, 0x32, 0xa0, 0xdd, 0xbb, 0x9a, + 0x11, 0x43, 0x32, 0x12, 0x11, 0xa8, 0xdc, 0xbb, 0x19, 0x54, 0x34, 0x01, 0xb9, 0xaa, 0x30, 0x35, + 0x03, 0xc9, 0xac, 0x30, 0x46, 0x33, 0x01, 0xb8, 0xbc, 0xbc, 0xaa, 0x8a, 0x41, 0x45, 0x33, 0xa0, + 0xdc, 0xbb, 0x08, 0x53, 0x14, 0x91, 0xca, 0xab, 0x09, 0x42, 0x43, 0x23, 0x12, 0x80, 0xdb, 0xbd, + 0xac, 0x08, 0x32, 0x23, 0xa8, 0xbd, 0x9a, 0x30, 0x34, 0x81, 0xcb, 0x8a, 0x74, 0x35, 0x33, 0x11, + 0x99, 0xbb, 0xbc, 0xab, 0x19, 0x73, 0x34, 0x12, 0xea, 0xbc, 0x9c, 0x09, 0x11, 0x02, 0xca, 0xcc, + 0xab, 0x88, 0x21, 0x43, 0x24, 0x12, 0x90, 0xda, 0xcb, 0x8a, 0x41, 0x53, 0x22, 0x88, 0x89, 0x18, + 0x32, 0x12, 0xc8, 0xbc, 0x19, 0x56, 0x43, 0x13, 0x80, 0xca, 0xbc, 0xac, 0x9b, 0x20, 0x45, 0x33, + 0x02, 0xdb, 0xbc, 0x99, 0x31, 0x34, 0x03, 0xb8, 0xbd, 0x9b, 0x10, 0x44, 0x34, 0x24, 0x02, 0xb9, + 0xce, 0xbb, 0x8a, 0x21, 0x33, 0x81, 0xb9, 0x9b, 0x18, 0x33, 0x91, 0xcd, 0x8a, 0x72, 0x46, 0x23, + 0x13, 0x81, 0xa9, 0xcc, 0xbb, 0x9a, 0x52, 0x35, 0x23, 0xa8, 0xbf, 0xac, 0x99, 0x10, 0x01, 0xa8, + 0xbd, 0xcb, 0x9a, 0x18, 0x32, 0x45, 0x33, 0x01, 0xd9, 0xbc, 0xab, 0x20, 0x44, 0x33, 0x01, 0x88, + 0x10, 0x32, 0x12, 0xb9, 0xbe, 0x09, 0x73, 0x34, 0x22, 0x02, 0x98, 0xeb, 0xbd, 0xac, 0x0a, 0x52, + 0x34, 0x13, 0xb8, 0xbc, 0x9c, 0x10, 0x32, 0x13, 0xa0, 0xcb, 0xaa, 0x09, 0x42, 0x45, 0x35, 0x33, + 0x90, 0xdd, 0xcb, 0xaa, 0x10, 0x22, 0x01, 0x98, 0x8a, 0x20, 0x22, 0xa0, 0xcd, 0x9b, 0x52, 0x45, + 0x24, 0x22, 0x11, 0x81, 0xc9, 0xcc, 0xbb, 0x19, 0x45, 0x34, 0x81, 0xda, 0xac, 0xaa, 0x08, 0x00, + 0x98, 0xcb, 0xac, 0xaa, 0x99, 0x18, 0x63, 0x35, 0x23, 0xa1, 0xcd, 0xbb, 0x0a, 0x42, 0x24, 0x12, + 0x08, 0x20, 0x43, 0x12, 0xb9, 0xbd, 0x0b, 0x52, 0x35, 0x22, 0x01, 0x88, 0xb8, 0xdd, 0xcc, 0x9b, + 0x38, 0x45, 0x23, 0x81, 0xcb, 0xab, 0x19, 0x32, 0x22, 0x90, 0xba, 0x8a, 0x88, 0x01, 0x62, 0x47, + 0x35, 0x12, 0xc9, 0xcd, 0xba, 0x09, 0x11, 0x12, 0x88, 0x99, 0x21, 0x33, 0x82, 0xdd, 0x9c, 0x29, + 0x44, 0x34, 0x12, 0x11, 0x11, 0x90, 0xfa, 0xdb, 0x8a, 0x40, 0x44, 0x12, 0xa9, 0xbc, 0xac, 0x88, + 0x00, 0x98, 0xbc, 0xab, 0x9a, 0x89, 0x99, 0x28, 0x47, 0x35, 0x12, 0xd9, 0xbc, 0xaa, 0x20, 0x34, + 0x22, 0x00, 0x10, 0x44, 0x23, 0x91, 0xcc, 0xab, 0x20, 0x45, 0x22, 0x00, 0x88, 0x88, 0xb8, 0xde, + 0xbc, 0x8a, 0x52, 0x44, 0x11, 0xa8, 0xbb, 0x8a, 0x31, 0x23, 0x90, 0xbc, 0x8a, 0x32, 0x23, 0x00, + 0x72, 0x55, 0x24, 0x81, 0xcc, 0xad, 0x8b, 0x18, 0x12, 0x80, 0x99, 0x28, 0x53, 0x22, 0xb9, 0xaf, + 0x8a, 0x41, 0x35, 0x12, 0x01, 0x18, 0x10, 0x90, 0xcd, 0xad, 0x19, 0x53, 0x34, 0x91, 0xda, 0xbb, + 0x99, 0x10, 0x98, 0xeb, 0xbb, 0x8a, 0x08, 0x80, 0x99, 0x40, 0x46, 0x24, 0x91, 0xeb, 0xbb, 0x89, + 0x42, 0x23, 0x01, 0x00, 0x43, 0x35, 0x03, 0xc9, 0xad, 0x89, 0x43, 0x43, 0x01, 0x98, 0x99, 0x88, + 0xca, 0xce, 0xab, 0x20, 0x45, 0x33, 0x80, 0xcb, 0x9b, 0x20, 0x33, 0x82, 0xbc, 0xac, 0x20, 0x34, + 0x12, 0x08, 0x62, 0x45, 0x22, 0xc8, 0xcd, 0xab, 0x0a, 0x11, 0x01, 0x99, 0x09, 0x52, 0x34, 0x81, + 0xeb, 0xbb, 0x18, 0x45, 0x33, 0x01, 0x88, 0x00, 0x10, 0xc9, 0xcd, 0xaa, 0x41, 0x35, 0x23, 0xb9, + 0xbe, 0x9a, 0x08, 0x00, 0xda, 0xbc, 0xab, 0x08, 0x12, 0x90, 0x89, 0x52, 0x36, 0x23, 0xc9, 0xbe, + 0x9b, 0x20, 0x33, 0x13, 0x80, 0x41, 0x46, 0x33, 0x91, 0xcc, 0x9b, 0x38, 0x44, 0x12, 0x90, 0x9a, + 0x99, 0x88, 0xfb, 0xbc, 0x8a, 0x52, 0x25, 0x12, 0xa9, 0xbb, 0x08, 0x53, 0x12, 0xc9, 0xac, 0x0a, + 0x33, 0x25, 0x01, 0x08, 0x43, 0x35, 0x01, 0xec, 0xbc, 0x9a, 0x00, 0x11, 0x98, 0x99, 0x48, 0x44, + 0x23, 0xc8, 0xbc, 0x9b, 0x52, 0x34, 0x13, 0x90, 0x98, 0x00, 0x81, 0xda, 0xbc, 0x1a, 0x45, 0x25, + 0x80, 0xcb, 0xab, 0x89, 0x11, 0xa8, 0xcf, 0xbb, 0x8a, 0x11, 0x12, 0x90, 0x08, 0x63, 0x34, 0x91, + 0xfb, 0xbb, 0x89, 0x32, 0x33, 0x81, 0x20, 0x56, 0x34, 0x12, 0xb9, 0xbd, 0x0a, 0x52, 0x33, 0x82, + 0xb9, 0xab, 0x9a, 0xa9, 0xce, 0xab, 0x38, 0x55, 0x33, 0x90, 0xbb, 0x8b, 0x43, 0x25, 0x90, 0xcc, + 0xab, 0x20, 0x35, 0x23, 0x00, 0x20, 0x53, 0x22, 0xc9, 0xbf, 0xbc, 0x89, 0x01, 0x80, 0xaa, 0x08, + 0x54, 0x34, 0x01, 0xdb, 0xbb, 0x29, 0x54, 0x33, 0x01, 0x99, 0x98, 0x00, 0xa8, 0xeb, 0x9a, 0x51, + 0x44, 0x12, 0xb9, 0xbd, 0x8a, 0x10, 0x80, 0xdd, 0xcc, 0x9a, 0x18, 0x21, 0x01, 0x80, 0x10, 0x43, + 0x12, 0xd9, 0xcc, 0x9b, 0x10, 0x33, 0x02, 0x18, 0x73, 0x36, 0x24, 0x91, 0xba, 0xac, 0x28, 0x34, + 0x14, 0xa0, 0xaa, 0xab, 0xa9, 0xcb, 0xbc, 0x09, 0x73, 0x24, 0x02, 0xb9, 0xaa, 0x40, 0x44, 0x82, + 0xd9, 0xcb, 0x89, 0x42, 0x43, 0x12, 0x00, 0x11, 0x22, 0x90, 0xde, 0xcb, 0xaa, 0x08, 0x80, 0xaa, + 0x8a, 0x61, 0x44, 0x13, 0xb0, 0xcc, 0x8a, 0x31, 0x36, 0x12, 0x80, 0xa9, 0x89, 0x98, 0xa9, 0xaa, + 0x41, 0x37, 0x14, 0xa0, 0xbd, 0x9b, 0x18, 0x12, 0xea, 0xce, 0xbb, 0x8a, 0x20, 0x32, 0x11, 0x00, + 0x21, 0x13, 0xc0, 0xcd, 0xac, 0x88, 0x22, 0x02, 0x00, 0x52, 0x47, 0x43, 0x12, 0xa8, 0xcb, 0x89, + 0x42, 0x33, 0x02, 0xba, 0xbd, 0xab, 0xba, 0xbb, 0x89, 0x73, 0x34, 0x03, 0xb8, 0xbb, 0x30, 0x57, + 0x22, 0xa8, 0xdc, 0xaa, 0x28, 0x53, 0x33, 0x22, 0x11, 0x01, 0x98, 0xdc, 0xbc, 0xbb, 0x99, 0x98, + 0xda, 0xaa, 0x28, 0x46, 0x34, 0x81, 0xc9, 0xab, 0x18, 0x44, 0x33, 0x02, 0x98, 0xaa, 0xaa, 0xab, + 0x9b, 0x61, 0x45, 0x23, 0xa0, 0xcc, 0xab, 0x19, 0x32, 0xc0, 0xef, 0xbb, 0xab, 0x19, 0x31, 0x32, + 0x22, 0x11, 0x00, 0xb9, 0xbf, 0xab, 0x19, 0x31, 0x01, 0xb9, 0x48, 0x77, 0x44, 0x22, 0x00, 0xaa, + 0x9a, 0x10, 0x53, 0x12, 0x88, 0xcb, 0xcb, 0xcb, 0xaa, 0x0a, 0x42, 0x44, 0x02, 0x98, 0x9c, 0x19, + 0x54, 0x33, 0x81, 0xeb, 0xbb, 0x8a, 0x42, 0x44, 0x32, 0x23, 0x01, 0xa0, 0xdb, 0xbc, 0xbb, 0x89, + 0x99, 0xeb, 0xcb, 0x09, 0x52, 0x34, 0x13, 0xa8, 0xbb, 0x8a, 0x53, 0x35, 0x12, 0x81, 0xa9, 0xdb, + 0xba, 0x9a, 0x40, 0x46, 0x32, 0x90, 0xeb, 0xaa, 0x09, 0x22, 0x02, 0xec, 0xcc, 0xbb, 0x9a, 0x18, + 0x22, 0x43, 0x23, 0x01, 0xc9, 0xdb, 0xab, 0x08, 0x22, 0x02, 0xc9, 0x8a, 0x74, 0x44, 0x24, 0x02, + 0x98, 0x99, 0x18, 0x32, 0x23, 0x81, 0xca, 0xcd, 0xbc, 0xcb, 0x8a, 0x41, 0x34, 0x22, 0xb8, 0xbc, + 0x0a, 0x73, 0x43, 0x02, 0xb8, 0xbc, 0x9b, 0x18, 0x53, 0x44, 0x33, 0x23, 0x91, 0xdb, 0xcc, 0x9a, + 0x09, 0x81, 0xb9, 0xcd, 0x9a, 0x20, 0x44, 0x23, 0x80, 0xa9, 0x89, 0x31, 0x35, 0x22, 0x01, 0x80, + 0xcb, 0xbe, 0xbc, 0x18, 0x45, 0x25, 0x81, 0xc9, 0xac, 0x09, 0x21, 0x13, 0xc8, 0xce, 0xbb, 0xab, + 0x88, 0x20, 0x42, 0x43, 0x13, 0x98, 0xcd, 0xbb, 0x09, 0x32, 0x24, 0xa8, 0xac, 0x19, 0x56, 0x34, + 0x12, 0x81, 0x89, 0x18, 0x22, 0x12, 0x88, 0xa9, 0xdb, 0xcd, 0xcc, 0xab, 0x18, 0x54, 0x23, 0x91, + 0xcb, 0xab, 0x40, 0x35, 0x23, 0xa0, 0xcb, 0xbb, 0x88, 0x32, 0x44, 0x35, 0x34, 0x12, 0xb8, 0xdd, + 0xaa, 0x89, 0x11, 0x80, 0xcc, 0xac, 0x09, 0x33, 0x25, 0x01, 0x99, 0x89, 0x41, 0x33, 0x12, 0x80, + 0x08, 0xa0, 0xdd, 0xbd, 0x9b, 0x61, 0x35, 0x13, 0xb8, 0xbd, 0xab, 0x20, 0x34, 0x81, 0xdc, 0xbc, + 0xba, 0x99, 0x88, 0x11, 0x53, 0x34, 0x02, 0xd9, 0xcc, 0x8a, 0x10, 0x33, 0x01, 0xca, 0x9a, 0x52, + 0x45, 0x22, 0x81, 0x88, 0x28, 0x42, 0x13, 0x90, 0xaa, 0xbb, 0xdb, 0xdd, 0xcb, 0x89, 0x41, 0x35, + 0x11, 0xc9, 0xbb, 0x09, 0x63, 0x24, 0x01, 0xb9, 0xba, 0x99, 0x11, 0x32, 0x44, 0x36, 0x24, 0x81, + 0xdb, 0xbc, 0x9a, 0x20, 0x12, 0xc8, 0xbc, 0xab, 0x30, 0x44, 0x12, 0x98, 0x8a, 0x41, 0x34, 0x13, + 0x98, 0xaa, 0x08, 0xb8, 0xde, 0xbc, 0x18, 0x55, 0x43, 0x91, 0xca, 0xac, 0x08, 0x31, 0x13, 0xc8, + 0xcd, 0xba, 0x99, 0x88, 0x80, 0x21, 0x35, 0x24, 0x90, 0xdd, 0xab, 0x19, 0x32, 0x24, 0x98, 0xbb, + 0x1a, 0x55, 0x24, 0x12, 0x88, 0x08, 0x43, 0x33, 0x81, 0xca, 0xab, 0x9a, 0xdb, 0xbe, 0xac, 0x18, + 0x54, 0x33, 0x90, 0xcc, 0x9a, 0x30, 0x44, 0x13, 0x98, 0xbb, 0x9a, 0x10, 0x22, 0x32, 0x46, 0x35, + 0x23, 0xb8, 0xce, 0xbb, 0x08, 0x31, 0x81, 0xdb, 0xbc, 0x09, 0x42, 0x23, 0x90, 0xaa, 0x20, 0x46, + 0x33, 0x80, 0xaa, 0x9a, 0x88, 0xd9, 0xcd, 0x9a, 0x51, 0x35, 0x23, 0xc8, 0xbc, 0x9b, 0x20, 0x24, + 0x81, 0xeb, 0xcb, 0x9a, 0x88, 0x98, 0x08, 0x42, 0x44, 0x12, 0xc9, 0xcd, 0x9a, 0x20, 0x33, 0x02, + 0xb9, 0x9b, 0x51, 0x35, 0x14, 0x80, 0x09, 0x41, 0x35, 0x13, 0xa8, 0xcb, 0xab, 0xa9, 0xeb, 0xbc, + 0x8a, 0x62, 0x43, 0x02, 0xb9, 0xad, 0x1a, 0x52, 0x33, 0x82, 0xb9, 0xab, 0x09, 0x32, 0x12, 0x53, + 0x46, 0x24, 0x82, 0xea, 0xcb, 0x9a, 0x10, 0x22, 0xa0, 0xcc, 0x9a, 0x28, 0x42, 0x01, 0xaa, 0x09, + 0x54, 0x25, 0x03, 0xa8, 0xab, 0x9a, 0x98, 0xdb, 0xbc, 0x29, 0x56, 0x33, 0x81, 0xcc, 0xbb, 0x09, + 0x33, 0x14, 0xb9, 0xbe, 0xbb, 0x89, 0x88, 0x88, 0x28, 0x64, 0x23, 0x91, 0xdd, 0xbb, 0x0a, 0x42, + 0x33, 0x80, 0xbb, 0x19, 0x45, 0x34, 0x01, 0x98, 0x20, 0x46, 0x33, 0x82, 0xca, 0xbb, 0xab, 0xba, + 0xdc, 0x9c, 0x18, 0x54, 0x23, 0x90, 0xdb, 0x9b, 0x30, 0x35, 0x13, 0xa0, 0xbb, 0x89, 0x41, 0x22, + 0x12, 0x63, 0x35, 0x14, 0xa0, 0xcd, 0xac, 0x88, 0x21, 0x01, 0xc9, 0xbb, 0x89, 0x32, 0x14, 0xa9, + 0xab, 0x61, 0x36, 0x24, 0x81, 0xba, 0xba, 0x99, 0xaa, 0xcc, 0x9a, 0x62, 0x35, 0x23, 0xb9, 0xcd, + 0x9a, 0x10, 0x23, 0x81, 0xdc, 0xbb, 0x9a, 0x09, 0x88, 0x89, 0x41, 0x45, 0x12, 0xc9, 0xbe, 0x9b, + 0x28, 0x43, 0x12, 0x98, 0x8a, 0x41, 0x44, 0x12, 0x98, 0x08, 0x64, 0x44, 0x12, 0x90, 0xbb, 0xac, + 0xaa, 0xba, 0xbc, 0x89, 0x63, 0x34, 0x02, 0xc9, 0xac, 0x09, 0x43, 0x34, 0x81, 0xa9, 0x9a, 0x10, + 0x24, 0x22, 0x32, 0x55, 0x43, 0x82, 0xea, 0xbc, 0xaa, 0x10, 0x11, 0x90, 0xcb, 0x9b, 0x10, 0x23, + 0xa8, 0xbd, 0x2a, 0x67, 0x43, 0x12, 0xa8, 0xba, 0xab, 0xaa, 0xbb, 0xab, 0x58, 0x46, 0x24, 0x80, + 0xcb, 0xbb, 0x89, 0x42, 0x02, 0xd9, 0xdb, 0x9a, 0x09, 0x08, 0x98, 0x00, 0x43, 0x24, 0xa1, 0xde, + 0xbb, 0x89, 0x31, 0x24, 0x81, 0x88, 0x30, 0x54, 0x13, 0x80, 0x99, 0x62, 0x46, 0x33, 0x01, 0xb9, + 0xbc, 0xcb, 0xaa, 0xbb, 0x9a, 0x40, 0x45, 0x22, 0xa0, 0xbc, 0x9a, 0x41, 0x34, 0x13, 0xa8, 0xaa, + 0x18, 0x44, 0x33, 0x32, 0x53, 0x44, 0x12, 0xb8, 0xce, 0xbb, 0x8a, 0x11, 0x80, 0xb9, 0xbb, 0x18, + 0x32, 0xb0, 0xdf, 0x8a, 0x62, 0x45, 0x23, 0x81, 0xa9, 0xac, 0xab, 0xab, 0xab, 0x18, 0x45, 0x35, + 0x01, 0xb9, 0xbd, 0x99, 0x20, 0x12, 0xb8, 0xce, 0xab, 0x8a, 0x08, 0x90, 0x80, 0x22, 0x35, 0x81, + 0xec, 0xcc, 0x9a, 0x18, 0x31, 0x02, 0x11, 0x42, 0x34, 0x24, 0x90, 0xaa, 0x48, 0x67, 0x43, 0x12, + 0x80, 0xba, 0xbc, 0xac, 0xba, 0x9a, 0x20, 0x63, 0x32, 0x80, 0xcb, 0x9a, 0x28, 0x44, 0x23, 0x80, + 0x9a, 0x19, 0x53, 0x34, 0x23, 0x34, 0x34, 0x23, 0xa0, 0xde, 0xbb, 0xaa, 0x08, 0x88, 0xba, 0x8a, + 0x20, 0x33, 0xd1, 0xcf, 0xab, 0x30, 0x47, 0x34, 0x02, 0x90, 0xb9, 0xbc, 0xac, 0xab, 0x09, 0x43, + 0x35, 0x12, 0xa9, 0xcc, 0x99, 0x18, 0x11, 0xb8, 0xcd, 0xbb, 0x8a, 0x08, 0x00, 0x09, 0x31, 0x24, + 0x81, 0xde, 0xcc, 0xaa, 0x08, 0x21, 0x00, 0x00, 0x63, 0x35, 0x24, 0x80, 0xba, 0x0a, 0x64, 0x45, + 0x22, 0x02, 0x99, 0xca, 0xdb, 0xba, 0xab, 0x18, 0x52, 0x23, 0x81, 0xba, 0x9c, 0x28, 0x34, 0x14, + 0x90, 0xa9, 0x08, 0x44, 0x34, 0x33, 0x43, 0x34, 0x22, 0xa0, 0xdc, 0xac, 0x9a, 0x88, 0xa8, 0xcb, + 0x9b, 0x31, 0x26, 0x92, 0xfb, 0xac, 0x09, 0x53, 0x44, 0x22, 0x01, 0x99, 0xca, 0xcb, 0xac, 0x8a, + 0x30, 0x35, 0x22, 0xa8, 0xbc, 0x9b, 0x20, 0x22, 0xb8, 0xcf, 0xab, 0x8a, 0x08, 0x01, 0x80, 0x21, + 0x24, 0x92, 0xfc, 0xbc, 0x9b, 0x08, 0x12, 0x90, 0xaa, 0x51, 0x47, 0x33, 0x01, 0xca, 0x9b, 0x31, + 0x57, 0x23, 0x13, 0x80, 0xb9, 0xdb, 0xcc, 0xba, 0x89, 0x41, 0x33, 0x01, 0xc9, 0xab, 0x29, 0x44, + 0x23, 0x90, 0xca, 0x09, 0x41, 0x25, 0x23, 0x33, 0x34, 0x24, 0x80, 0xcc, 0xbc, 0x8a, 0x10, 0x90, + 0xdb, 0xac, 0x19, 0x44, 0x12, 0xb8, 0xce, 0x9a, 0x30, 0x35, 0x24, 0x02, 0x80, 0xa8, 0xdb, 0xcc, + 0x9b, 0x19, 0x53, 0x23, 0x91, 0xcb, 0xab, 0x18, 0x33, 0x81, 0xce, 0xbc, 0x8a, 0x10, 0x11, 0x00, + 0x00, 0x42, 0x02, 0xfa, 0xdc, 0x9a, 0x19, 0x22, 0x81, 0xca, 0x8a, 0x63, 0x45, 0x12, 0x98, 0xbb, + 0x09, 0x73, 0x43, 0x22, 0x01, 0x88, 0xb9, 0xdc, 0xbc, 0x9b, 0x28, 0x53, 0x13, 0xa8, 0xbc, 0x0a, + 0x42, 0x25, 0x81, 0xb9, 0xab, 0x30, 0x45, 0x33, 0x22, 0x33, 0x35, 0x02, 0xda, 0xbd, 0x9b, 0x10, + 0x22, 0xb9, 0xbf, 0x9a, 0x41, 0x34, 0x81, 0xeb, 0xbb, 0x19, 0x53, 0x34, 0x12, 0x81, 0x90, 0xb9, + 0xdd, 0xcb, 0x8a, 0x40, 0x43, 0x02, 0xba, 0xad, 0x09, 0x31, 0x23, 0xc9, 0xcd, 0x9b, 0x19, 0x11, + 0x11, 0x00, 0x31, 0x33, 0xb0, 0xff, 0xac, 0x09, 0x20, 0x13, 0xa8, 0xbb, 0x39, 0x47, 0x24, 0x01, + 0xca, 0x9a, 0x30, 0x45, 0x33, 0x11, 0x08, 0x99, 0xca, 0xcd, 0xcb, 0x89, 0x32, 0x34, 0x91, 0xcb, + 0x9c, 0x38, 0x44, 0x12, 0xa8, 0xbb, 0x8a, 0x53, 0x34, 0x23, 0x33, 0x53, 0x22, 0xa8, 0xce, 0xac, + 0x08, 0x22, 0x01, 0xea, 0xab, 0x19, 0x53, 0x23, 0xb8, 0xcd, 0x9a, 0x30, 0x44, 0x22, 0x01, 0x08, + 0x88, 0xca, 0xbe, 0xac, 0x19, 0x43, 0x24, 0x98, 0xcc, 0x9a, 0x20, 0x43, 0x91, 0xeb, 0xbb, 0x8a, + 0x21, 0x22, 0x11, 0x20, 0x32, 0x82, 0xfd, 0xbd, 0xaa, 0x20, 0x33, 0x83, 0xdb, 0x9b, 0x51, 0x45, + 0x22, 0x98, 0xbb, 0x0a, 0x63, 0x24, 0x22, 0x00, 0x08, 0x99, 0xeb, 0xcc, 0xab, 0x10, 0x34, 0x04, + 0xb8, 0xbc, 0x0a, 0x53, 0x24, 0x81, 0xca, 0xaa, 0x10, 0x44, 0x33, 0x12, 0x33, 0x24, 0x82, 0xfb, + 0xbc, 0x9a, 0x21, 0x23, 0xa0, 0xbe, 0x9b, 0x40, 0x34, 0x02, 0xdb, 0xac, 0x09, 0x43, 0x24, 0x11, + 0x08, 0x08, 0x99, 0xdc, 0xbc, 0x9b, 0x41, 0x34, 0x02, 0xdb, 0xac, 0x09, 0x32, 0x14, 0xb8, 0xbe, + 0xbb, 0x18, 0x31, 0x22, 0x21, 0x32, 0x14, 0xd0, 0xce, 0xac, 0x0a, 0x31, 0x23, 0xa0, 0xcb, 0x1a, + 0x45, 0x25, 0x01, 0xaa, 0x9b, 0x30, 0x46, 0x22, 0x01, 0x88, 0x88, 0xb9, 0xec, 0xcb, 0x89, 0x32, + 0x34, 0xa1, 0xeb, 0x9b, 0x20, 0x35, 0x23, 0xb8, 0xbc, 0x8b, 0x42, 0x35, 0x33, 0x42, 0x32, 0x12, + 0xb9, 0xcf, 0x9c, 0x19, 0x31, 0x11, 0xc9, 0xac, 0x09, 0x42, 0x14, 0x90, 0xbc, 0x9b, 0x30, 0x45, + 0x12, 0x80, 0x08, 0x88, 0xb9, 0xce, 0xac, 0x19, 0x43, 0x23, 0xc8, 0xcc, 0x9a, 0x20, 0x24, 0x92, + 0xfb, 0xbb, 0x99, 0x21, 0x32, 0x22, 0x22, 0x33, 0xa1, 0xdf, 0xbd, 0xaa, 0x10, 0x24, 0x02, 0xb9, + 0xab, 0x41, 0x46, 0x22, 0x98, 0xaa, 0x09, 0x53, 0x34, 0x12, 0x80, 0x08, 0x98, 0xeb, 0xcc, 0xab, + 0x10, 0x44, 0x02, 0xb9, 0xae, 0x89, 0x43, 0x24, 0x82, 0xbb, 0xac, 0x18, 0x44, 0x24, 0x23, 0x23, + 0x14, 0x91, 0xfb, 0xbb, 0x9b, 0x21, 0x33, 0xa1, 0xcc, 0xab, 0x31, 0x35, 0x02, 0xda, 0xac, 0x08, + 0x43, 0x33, 0x02, 0x88, 0x88, 0xa9, 0xed, 0xcb, 0x8b, 0x31, 0x35, 0x91, 0xdc, 0xbb, 0x09, 0x43, + 0x13, 0xb8, 0xbf, 0x9c, 0x09, 0x21, 0x22, 0x33, 0x33, 0x13, 0xea, 0xce, 0xac, 0x09, 0x20, 0x23, + 0x80, 0xaa, 0x19, 0x54, 0x43, 0x01, 0xa9, 0x8a, 0x41, 0x45, 0x22, 0x00, 0x89, 0x98, 0xa9, 0xcd, + 0xcb, 0x09, 0x43, 0x23, 0xb8, 0xce, 0x9a, 0x30, 0x35, 0x23, 0xa8, 0xad, 0x9a, 0x41, 0x53, 0x43, + 0x33, 0x33, 0x01, 0xe9, 0xbc, 0x9c, 0x09, 0x22, 0x02, 0xa9, 0xbb, 0x0a, 0x63, 0x22, 0xa8, 0xbc, + 0x9a, 0x52, 0x34, 0x02, 0x80, 0x89, 0x99, 0xeb, 0xcc, 0xab, 0x10, 0x44, 0x01, 0xeb, 0xbc, 0x8a, + 0x30, 0x24, 0x91, 0xcd, 0xcb, 0x99, 0x10, 0x32, 0x43, 0x24, 0x13, 0xa8, 0xed, 0xbb, 0x9b, 0x18, + 0x33, 0x12, 0x99, 0x8a, 0x52, 0x45, 0x12, 0x90, 0x89, 0x20, 0x45, 0x23, 0x11, 0x88, 0x88, 0xa9, + 0xdc, 0xcc, 0x89, 0x31, 0x43, 0xa1, 0xcd, 0xbb, 0x18, 0x54, 0x23, 0x91, 0xba, 0x9c, 0x18, 0x44, + 0x44, 0x43, 0x33, 0x13, 0xa8, 0xcd, 0xac, 0x8a, 0x10, 0x12, 0x90, 0xa9, 0x0a, 0x31, 0x24, 0x90, + 0xbd, 0x99, 0x42, 0x44, 0x12, 0x80, 0x99, 0xa9, 0xdb, 0xdc, 0xab, 0x28, 0x53, 0x12, 0xeb, 0xcc, + 0xaa, 0x18, 0x32, 0x02, 0xda, 0xcc, 0xaa, 0x89, 0x11, 0x43, 0x35, 0x24, 0x82, 0xda, 0xcc, 0xab, + 0x09, 0x20, 0x11, 0x00, 0x18, 0x31, 0x35, 0x13, 0x90, 0x89, 0x62, 0x35, 0x24, 0x01, 0x88, 0x98, + 0xa9, 0xdb, 0xbc, 0x8a, 0x53, 0x24, 0x91, 0xcd, 0xac, 0x09, 0x32, 0x35, 0x01, 0xa9, 0xaa, 0x89, + 0x42, 0x45, 0x44, 0x34, 0x14, 0x81, 0xba, 0xbd, 0x9b, 0x08, 0x01, 0x81, 0x99, 0x08, 0x22, 0x33, + 0xc8, 0xbd, 0x0a, 0x63, 0x34, 0x02, 0xa8, 0xaa, 0x99, 0xcb, 0xcd, 0xab, 0x28, 0x45, 0x12, 0xda, + 0xcd, 0xaa, 0x08, 0x21, 0x02, 0xc9, 0xbc, 0x9c, 0x99, 0x80, 0x31, 0x55, 0x34, 0x13, 0xb8, 0xce, + 0xab, 0x8a, 0x18, 0x11, 0x80, 0x08, 0x42, 0x44, 0x02, 0x90, 0x9a, 0x41, 0x36, 0x24, 0x81, 0x89, + 0x99, 0x88, 0xba, 0xbd, 0x9b, 0x62, 0x25, 0x02, 0xdb, 0xad, 0x8a, 0x31, 0x24, 0x02, 0xa9, 0xaa, + 0x18, 0x42, 0x43, 0x44, 0x45, 0x34, 0x02, 0xa8, 0xcc, 0xab, 0x09, 0x10, 0x88, 0xa9, 0x08, 0x34, + 0x24, 0x90, 0xbd, 0xab, 0x42, 0x36, 0x12, 0x98, 0xab, 0x99, 0xaa, 0xcc, 0xbc, 0x09, 0x54, 0x14, + 0x90, 0xbe, 0xbc, 0x09, 0x11, 0x12, 0xb8, 0xbd, 0xab, 0x88, 0x08, 0x08, 0x61, 0x45, 0x24, 0x82, + 0xda, 0xbc, 0x9a, 0x08, 0x10, 0x98, 0x89, 0x42, 0x45, 0x12, 0x98, 0xbb, 0x29, 0x55, 0x34, 0x02, + 0xa8, 0xa9, 0x89, 0xa9, 0xdb, 0x9b, 0x50, 0x45, 0x12, 0xb8, 0xcd, 0x9b, 0x20, 0x43, 0x02, 0x98, + 0xab, 0x19, 0x42, 0x23, 0x33, 0x56, 0x35, 0x24, 0x80, 0xca, 0xac, 0x99, 0x10, 0x80, 0xaa, 0x8a, + 0x52, 0x34, 0x82, 0xda, 0xac, 0x18, 0x63, 0x23, 0x80, 0xaa, 0xab, 0x9a, 0xba, 0xbd, 0x9b, 0x73, + 0x34, 0x82, 0xeb, 0xad, 0x9a, 0x10, 0x22, 0x90, 0xbc, 0xac, 0x09, 0x01, 0x81, 0x18, 0x73, 0x44, + 0x22, 0xb8, 0xcd, 0x9b, 0x09, 0x10, 0x90, 0xaa, 0x19, 0x46, 0x24, 0x01, 0xba, 0x9c, 0x41, 0x44, + 0x23, 0x90, 0xaa, 0x9a, 0x99, 0xc9, 0xbb, 0x29, 0x47, 0x34, 0x81, 0xcc, 0xac, 0x19, 0x41, 0x22, + 0x88, 0xbb, 0x8a, 0x41, 0x24, 0x12, 0x22, 0x55, 0x34, 0x12, 0xb9, 0xcc, 0x9b, 0x00, 0x01, 0xb9, + 0xbc, 0x28, 0x46, 0x13, 0xa0, 0xbd, 0x8b, 0x51, 0x53, 0x02, 0xa8, 0xba, 0x9a, 0x9a, 0xcb, 0xbb, + 0x48, 0x55, 0x23, 0xb8, 0xce, 0xab, 0x08, 0x31, 0x82, 0xd9, 0xcb, 0x99, 0x20, 0x11, 0x80, 0x20, + 0x64, 0x43, 0x81, 0xda, 0xac, 0x8a, 0x10, 0x81, 0xb9, 0x9b, 0x61, 0x35, 0x14, 0xb8, 0xbb, 0x1a, + 0x64, 0x24, 0x01, 0xa8, 0xaa, 0xa9, 0x99, 0xba, 0x8b, 0x73, 0x36, 0x13, 0xb9, 0xbe, 0x9b, 0x21, + 0x34, 0x02, 0xba, 0xac, 0x18, 0x34, 0x24, 0x11, 0x32, 0x46, 0x23, 0x91, 0xeb, 0xaa, 0x09, 0x10, + 0x90, 0xbc, 0x8c, 0x51, 0x34, 0x02, 0xca, 0xbc, 0x18, 0x63, 0x23, 0x81, 0xba, 0xbb, 0xab, 0xcb, + 0xcb, 0x89, 0x54, 0x25, 0x82, 0xea, 0xcb, 0x99, 0x10, 0x22, 0x98, 0xbd, 0xab, 0x18, 0x32, 0x12, + 0x08, 0x42, 0x45, 0x22, 0xc8, 0xcc, 0xaa, 0x00, 0x11, 0xa8, 0xbd, 0x19, 0x64, 0x43, 0x81, 0xba, + 0xab, 0x40, 0x45, 0x22, 0x91, 0xb9, 0xab, 0xaa, 0xba, 0xbb, 0x40, 0x67, 0x32, 0x91, 0xda, 0xbb, + 0x09, 0x43, 0x22, 0xa0, 0xbc, 0x9a, 0x42, 0x34, 0x23, 0x21, 0x52, 0x34, 0x02, 0xc9, 0xbc, 0x8a, + 0x20, 0x01, 0xeb, 0xbb, 0x29, 0x55, 0x33, 0xa0, 0xcc, 0x9a, 0x31, 0x36, 0x12, 0xa0, 0xcb, 0xba, + 0xba, 0xbb, 0x9c, 0x50, 0x54, 0x13, 0xa8, 0xbe, 0x9c, 0x09, 0x21, 0x01, 0xca, 0xbc, 0x8a, 0x20, + 0x33, 0x02, 0x11, 0x53, 0x43, 0x91, 0xdc, 0xbb, 0x09, 0x21, 0x81, 0xdc, 0x9b, 0x41, 0x45, 0x13, + 0xa0, 0xbc, 0x0a, 0x63, 0x34, 0x02, 0x98, 0xbb, 0xcb, 0xaa, 0xaa, 0x09, 0x55, 0x35, 0x12, 0xb8, + 0xbd, 0x9b, 0x30, 0x34, 0x82, 0xca, 0xac, 0x18, 0x53, 0x33, 0x22, 0x22, 0x34, 0x22, 0xa0, 0xbe, + 0xab, 0x28, 0x22, 0xd8, 0xbd, 0x9b, 0x52, 0x35, 0x12, 0xba, 0xad, 0x09, 0x63, 0x33, 0x01, 0xb9, + 0xbc, 0xac, 0xcb, 0xaa, 0x18, 0x54, 0x43, 0x81, 0xda, 0xbc, 0x8a, 0x28, 0x11, 0xa8, 0xcd, 0x9b, + 0x19, 0x32, 0x23, 0x22, 0x22, 0x43, 0x82, 0xeb, 0xbc, 0x8b, 0x31, 0x12, 0xfa, 0xcb, 0x09, 0x54, + 0x33, 0x02, 0xca, 0xab, 0x30, 0x46, 0x23, 0x81, 0xa9, 0xbc, 0xbb, 0xbc, 0x8a, 0x41, 0x37, 0x24, + 0x81, 0xcb, 0xab, 0x09, 0x42, 0x13, 0xa8, 0xbd, 0x8a, 0x41, 0x34, 0x24, 0x22, 0x32, 0x12, 0x91, + 0xcc, 0xbb, 0x19, 0x33, 0x91, 0xde, 0xbb, 0x28, 0x54, 0x14, 0x91, 0xbb, 0x9b, 0x51, 0x44, 0x22, + 0x88, 0xca, 0xcb, 0xcb, 0xab, 0x0a, 0x51, 0x34, 0x23, 0xb9, 0xbf, 0xab, 0x09, 0x11, 0x91, 0xeb, + 0xcb, 0x8a, 0x20, 0x32, 0x43, 0x32, 0x22, 0x81, 0xda, 0xbc, 0x9b, 0x20, 0x24, 0xa0, 0xcd, 0x9b, + 0x41, 0x54, 0x12, 0x90, 0xbb, 0x09, 0x54, 0x34, 0x13, 0x90, 0xcb, 0xcc, 0xba, 0xab, 0x38, 0x55, + 0x24, 0x12, 0xa9, 0xac, 0x8a, 0x20, 0x33, 0x91, 0xeb, 0xab, 0x18, 0x63, 0x24, 0x24, 0x32, 0x11, + 0x90, 0xcb, 0xbb, 0x09, 0x43, 0x12, 0xda, 0xbd, 0x89, 0x41, 0x34, 0x12, 0xb9, 0xbb, 0x29, 0x56, + 0x23, 0x02, 0x98, 0xdc, 0xdb, 0xcb, 0x9a, 0x10, 0x34, 0x24, 0x91, 0xdb, 0xbb, 0x9a, 0x18, 0x90, + 0xea, 0xcb, 0xab, 0x18, 0x41, 0x42, 0x33, 0x33, 0x01, 0xda, 0xbc, 0x9b, 0x20, 0x34, 0x82, 0xcc, + 0xac, 0x18, 0x63, 0x23, 0x82, 0xaa, 0x8a, 0x51, 0x44, 0x22, 0x02, 0xa0, 0xcc, 0xcd, 0xab, 0x8a, + 0x52, 0x44, 0x22, 0x80, 0xba, 0x9b, 0x10, 0x32, 0x81, 0xdb, 0xac, 0x89, 0x42, 0x44, 0x34, 0x34, + 0x22, 0x81, 0xcb, 0xac, 0x8a, 0x32, 0x23, 0xa0, 0xce, 0x9a, 0x20, 0x53, 0x12, 0xa0, 0x9a, 0x18, + 0x54, 0x33, 0x23, 0x00, 0xca, 0xcf, 0xbc, 0xbc, 0x09, 0x42, 0x24, 0x02, 0xba, 0xad, 0x9b, 0x08, + 0x90, 0xd9, 0xcb, 0xbb, 0x99, 0x10, 0x43, 0x54, 0x33, 0x23, 0xb8, 0xcd, 0xab, 0x19, 0x43, 0x12, + 0xa8, 0xbc, 0x0a, 0x52, 0x33, 0x01, 0xaa, 0x09, 0x73, 0x53, 0x22, 0x01, 0x00, 0xc9, 0xdd, 0xbc, + 0xab, 0x30, 0x55, 0x23, 0x81, 0xa9, 0x9a, 0x10, 0x22, 0x82, 0xda, 0xac, 0x8a, 0x20, 0x34, 0x45, + 0x44, 0x33, 0x12, 0xc9, 0xbc, 0x9b, 0x20, 0x34, 0x82, 0xca, 0xbb, 0x19, 0x34, 0x23, 0x98, 0x9b, + 0x30, 0x47, 0x23, 0x02, 0x80, 0x80, 0xea, 0xde, 0xbc, 0xaa, 0x20, 0x44, 0x12, 0xa8, 0xac, 0x9b, + 0x08, 0x90, 0xda, 0xbd, 0xbb, 0x89, 0x00, 0x21, 0x63, 0x34, 0x25, 0x81, 0xcb, 0xbc, 0x0a, 0x41, + 0x23, 0x81, 0xcb, 0x9a, 0x21, 0x34, 0x02, 0xb9, 0x8a, 0x73, 0x43, 0x22, 0x08, 0x08, 0x00, 0xe9, + 0xce, 0xbc, 0x89, 0x52, 0x24, 0x03, 0x98, 0x9a, 0x18, 0x33, 0x12, 0xdb, 0xad, 0x8a, 0x20, 0x32, + 0x43, 0x54, 0x44, 0x23, 0x90, 0xeb, 0xab, 0x08, 0x32, 0x23, 0xa8, 0xbc, 0x0a, 0x42, 0x14, 0x90, + 0xbb, 0x29, 0x46, 0x24, 0x02, 0x99, 0x88, 0x90, 0xfb, 0xcd, 0xac, 0x09, 0x32, 0x24, 0x80, 0xdb, + 0xaa, 0x08, 0x11, 0xb9, 0xce, 0xac, 0x89, 0x08, 0x10, 0x10, 0x53, 0x35, 0x23, 0xb8, 0xbe, 0xab, + 0x28, 0x53, 0x12, 0x99, 0x9b, 0x28, 0x43, 0x03, 0xda, 0x9b, 0x30, 0x47, 0x23, 0x90, 0x99, 0x89, + 0x80, 0xeb, 0xcd, 0xab, 0x20, 0x36, 0x23, 0x80, 0xab, 0x19, 0x53, 0x14, 0xa0, 0xcc, 0xaa, 0x18, + 0x32, 0x22, 0x43, 0x55, 0x43, 0x02, 0xc9, 0xbc, 0x9a, 0x20, 0x34, 0x01, 0xba, 0x9a, 0x30, 0x34, + 0x92, 0xcc, 0x9a, 0x63, 0x35, 0x12, 0xa8, 0x9a, 0x89, 0x90, 0xfc, 0xbc, 0x9b, 0x20, 0x34, 0x02, + 0xcb, 0xbc, 0x09, 0x22, 0x92, 0xed, 0xbc, 0xaa, 0x18, 0x11, 0x00, 0x31, 0x64, 0x23, 0x82, 0xdb, + 0xad, 0x89, 0x31, 0x24, 0x81, 0xaa, 0x89, 0x42, 0x23, 0xb0, 0xbd, 0x0a, 0x64, 0x43, 0x01, 0xa9, + 0x9a, 0x08, 0x88, 0xec, 0xcb, 0x0a, 0x52, 0x43, 0x01, 0xa9, 0x89, 0x41, 0x25, 0x82, 0xda, 0xbb, + 0x0a, 0x31, 0x24, 0x21, 0x42, 0x45, 0x23, 0x91, 0xdc, 0xbb, 0x09, 0x33, 0x14, 0xa0, 0xaa, 0x18, + 0x44, 0x12, 0xca, 0xac, 0x39, 0x55, 0x33, 0x81, 0xba, 0x9a, 0x89, 0xb8, 0xcf, 0xac, 0x09, 0x32, + 0x23, 0xc8, 0xbd, 0x9a, 0x30, 0x23, 0xd8, 0xce, 0x9c, 0x89, 0x00, 0x11, 0x00, 0x31, 0x45, 0x22, + 0xb0, 0xcd, 0xaa, 0x18, 0x24, 0x03, 0xa0, 0x89, 0x31, 0x34, 0x92, 0xcd, 0x9c, 0x20, 0x36, 0x14, + 0x80, 0xba, 0x9a, 0x88, 0xa9, 0xdc, 0x9b, 0x30, 0x45, 0x13, 0x98, 0xbb, 0x30, 0x47, 0x23, 0xa8, + 0xcc, 0x9b, 0x18, 0x32, 0x23, 0x32, 0x54, 0x34, 0x12, 0xca, 0xcd, 0x8a, 0x28, 0x23, 0x82, 0x99, + 0x0a, 0x52, 0x33, 0xa0, 0xce, 0x8a, 0x51, 0x35, 0x12, 0x98, 0xab, 0xaa, 0x98, 0xca, 0xcc, 0x9b, + 0x20, 0x24, 0x90, 0xdd, 0xaa, 0x18, 0x33, 0x83, 0xed, 0xbc, 0x9b, 0x08, 0x21, 0x11, 0x20, 0x53, + 0x34, 0x81, 0xea, 0xcb, 0x89, 0x31, 0x24, 0x81, 0x89, 0x18, 0x34, 0x14, 0xc9, 0xcc, 0x09, 0x52, + 0x24, 0x02, 0xa9, 0xbb, 0x9a, 0x98, 0xca, 0xbb, 0x1a, 0x46, 0x24, 0x80, 0xbb, 0x09, 0x55, 0x25, + 0x01, 0xba, 0xad, 0x8a, 0x31, 0x23, 0x23, 0x32, 0x45, 0x23, 0x90, 0xcd, 0xac, 0x09, 0x21, 0x13, + 0x90, 0x89, 0x41, 0x35, 0x02, 0xeb, 0xbb, 0x18, 0x56, 0x23, 0x01, 0xa9, 0xbb, 0xaa, 0xaa, 0xdb, + 0xab, 0x19, 0x43, 0x92, 0xfc, 0xbb, 0x8a, 0x42, 0x23, 0xc8, 0xce, 0xac, 0x89, 0x10, 0x11, 0x11, + 0x21, 0x53, 0x12, 0xa8, 0xcd, 0xaa, 0x18, 0x43, 0x12, 0x80, 0x28, 0x63, 0x23, 0xa1, 0xdd, 0x9b, + 0x38, 0x45, 0x33, 0x80, 0xbb, 0xbc, 0xaa, 0xa9, 0xa9, 0x09, 0x44, 0x25, 0x82, 0xca, 0x9b, 0x61, + 0x35, 0x14, 0x90, 0xcb, 0xab, 0x19, 0x42, 0x32, 0x23, 0x43, 0x24, 0x01, 0xcb, 0xbd, 0x9b, 0x28, + 0x32, 0x81, 0x88, 0x41, 0x36, 0x14, 0xa8, 0xcd, 0x8a, 0x51, 0x34, 0x14, 0x90, 0xb9, 0xbb, 0xab, + 0xab, 0xab, 0x18, 0x42, 0x02, 0xfd, 0xbc, 0x9a, 0x20, 0x43, 0x82, 0xdc, 0xbd, 0xaa, 0x08, 0x20, + 0x21, 0x32, 0x33, 0x24, 0x90, 0xbd, 0xad, 0x09, 0x31, 0x23, 0x01, 0x20, 0x55, 0x34, 0x01, 0xda, + 0xac, 0x8a, 0x53, 0x34, 0x12, 0xa8, 0xdb, 0xba, 0xab, 0x9a, 0x18, 0x62, 0x33, 0x02, 0xda, 0xbb, + 0x38, 0x57, 0x33, 0x01, 0xc9, 0xbb, 0x9a, 0x30, 0x53, 0x33, 0x33, 0x24, 0x02, 0xc9, 0xbd, 0xab, + 0x08, 0x11, 0x81, 0x88, 0x51, 0x46, 0x33, 0x91, 0xcc, 0xab, 0x28, 0x55, 0x24, 0x01, 0xa0, 0xca, + 0xba, 0xac, 0xa9, 0x00, 0x32, 0x03, 0xea, 0xbe, 0xac, 0x08, 0x32, 0x22, 0xb9, 0xcf, 0xbb, 0x9a, + 0x18, 0x21, 0x42, 0x23, 0x23, 0x81, 0xdb, 0xac, 0x0a, 0x20, 0x23, 0x00, 0x20, 0x57, 0x53, 0x12, + 0xa8, 0xcc, 0x9a, 0x20, 0x44, 0x14, 0x81, 0xb8, 0xbc, 0xbc, 0xab, 0x09, 0x43, 0x35, 0x02, 0xb9, + 0xcc, 0x09, 0x52, 0x35, 0x22, 0x90, 0xbb, 0xbb, 0x09, 0x32, 0x45, 0x34, 0x33, 0x11, 0xb9, 0xbe, + 0x9b, 0x09, 0x01, 0x90, 0xba, 0x40, 0x47, 0x24, 0x12, 0xc9, 0xbb, 0x09, 0x52, 0x35, 0x23, 0x00, + 0xa9, 0xcd, 0xcb, 0xab, 0x08, 0x42, 0x23, 0xb8, 0xde, 0xbb, 0x8a, 0x21, 0x23, 0x91, 0xcd, 0xbc, + 0xba, 0x89, 0x18, 0x32, 0x45, 0x22, 0x81, 0xba, 0xad, 0x0a, 0x31, 0x13, 0x98, 0x9a, 0x74, 0x35, + 0x24, 0x81, 0xcb, 0xab, 0x19, 0x42, 0x34, 0x02, 0x80, 0xda, 0xdc, 0xbb, 0x9a, 0x30, 0x45, 0x23, + 0xa0, 0xbc, 0x9c, 0x21, 0x45, 0x23, 0x81, 0xa9, 0x9a, 0x99, 0x10, 0x41, 0x54, 0x43, 0x12, 0xa0, + 0xbc, 0xac, 0x08, 0x21, 0x90, 0xda, 0x8a, 0x63, 0x44, 0x22, 0x98, 0xbb, 0x9a, 0x41, 0x44, 0x32, + 0x02, 0x81, 0xda, 0xdc, 0xbb, 0x9b, 0x31, 0x35, 0x02, 0xdc, 0xbc, 0x9b, 0x18, 0x22, 0x02, 0xca, + 0xcc, 0xaa, 0xaa, 0x98, 0x10, 0x73, 0x33, 0x12, 0xc9, 0xbc, 0x8a, 0x31, 0x24, 0x91, 0xba, 0x29, + 0x57, 0x34, 0x11, 0xb9, 0xbb, 0x8a, 0x42, 0x33, 0x13, 0x81, 0xa8, 0xde, 0xbd, 0xbc, 0x09, 0x53, + 0x34, 0x01, 0xca, 0xbb, 0x19, 0x63, 0x33, 0x03, 0x90, 0x9a, 0x09, 0x08, 0x00, 0x63, 0x45, 0x33, + 0x81, 0xeb, 0xbb, 0x8a, 0x32, 0x12, 0xca, 0xbc, 0x28, 0x56, 0x23, 0x82, 0xb9, 0xab, 0x28, 0x35, + 0x24, 0x01, 0x11, 0x80, 0xdc, 0xcd, 0xbb, 0x08, 0x53, 0x23, 0xb0, 0xce, 0xbb, 0x89, 0x21, 0x02, + 0xa8, 0xcc, 0xaa, 0x99, 0x99, 0x9a, 0x31, 0x47, 0x23, 0x90, 0xcc, 0xab, 0x28, 0x53, 0x12, 0xb9, + 0xab, 0x71, 0x44, 0x23, 0x90, 0xba, 0x9b, 0x20, 0x33, 0x03, 0x80, 0x88, 0xc8, 0xdf, 0xbd, 0xab, + 0x30, 0x36, 0x14, 0x90, 0xbc, 0x9a, 0x30, 0x35, 0x23, 0x80, 0x99, 0x08, 0x21, 0x00, 0x18, 0x64, + 0x35, 0x23, 0xc9, 0xdc, 0x9a, 0x10, 0x32, 0x80, 0xbc, 0x9b, 0x52, 0x36, 0x12, 0xa0, 0xba, 0x08, + 0x52, 0x33, 0x01, 0x00, 0x10, 0xa8, 0xee, 0xbd, 0x9a, 0x30, 0x35, 0x02, 0xeb, 0xbc, 0x9a, 0x18, + 0x12, 0x80, 0xcb, 0xbb, 0x99, 0x90, 0xb9, 0x8a, 0x73, 0x35, 0x12, 0xca, 0xbd, 0x0a, 0x41, 0x33, + 0x81, 0xcb, 0x09, 0x45, 0x34, 0x02, 0xb8, 0xab, 0x29, 0x53, 0x12, 0xa8, 0x9a, 0x89, 0xc9, 0xdf, + 0xcb, 0x09, 0x42, 0x25, 0x82, 0xc9, 0xab, 0x09, 0x53, 0x33, 0x01, 0x99, 0x08, 0x31, 0x23, 0x80, + 0x30, 0x57, 0x33, 0x92, 0xcd, 0xad, 0x09, 0x22, 0x12, 0xb8, 0xad, 0x19, 0x73, 0x23, 0x82, 0xa9, + 0x8a, 0x40, 0x24, 0x03, 0x98, 0x09, 0x01, 0xc8, 0xcf, 0xbc, 0x09, 0x43, 0x24, 0xa8, 0xcd, 0xbb, + 0x89, 0x21, 0x81, 0xca, 0xbb, 0x9a, 0x10, 0x91, 0xba, 0x19, 0x56, 0x33, 0xb1, 0xde, 0xaa, 0x20, + 0x53, 0x12, 0xa9, 0x9b, 0x40, 0x55, 0x22, 0x80, 0xaa, 0x89, 0x31, 0x33, 0xa0, 0xcb, 0x8b, 0x98, + 0xfa, 0xce, 0xaa, 0x28, 0x45, 0x13, 0x90, 0xbc, 0x9a, 0x30, 0x35, 0x12, 0x98, 0x89, 0x41, 0x43, + 0x12, 0x88, 0x21, 0x46, 0x12, 0xc9, 0xcd, 0x9a, 0x10, 0x23, 0x82, 0xdb, 0xaa, 0x41, 0x35, 0x23, + 0x98, 0x9b, 0x28, 0x36, 0x23, 0x91, 0xaa, 0x89, 0x81, 0xfb, 0xbe, 0x9c, 0x20, 0x44, 0x01, 0xda, + 0xbc, 0xaa, 0x00, 0x11, 0xa8, 0xcc, 0x9a, 0x08, 0x11, 0x90, 0x9a, 0x30, 0x46, 0x02, 0xea, 0xbc, + 0x89, 0x32, 0x35, 0x81, 0xa9, 0x1a, 0x73, 0x43, 0x02, 0x99, 0x9a, 0x30, 0x35, 0x01, 0xc9, 0xac, + 0x99, 0x89, 0xeb, 0xbc, 0x0a, 0x62, 0x43, 0x01, 0xc9, 0xba, 0x08, 0x53, 0x23, 0x91, 0x99, 0x28, + 0x54, 0x23, 0x02, 0x10, 0x32, 0x25, 0xa1, 0xde, 0xac, 0x09, 0x31, 0x22, 0xa8, 0xbc, 0x19, 0x73, + 0x33, 0x01, 0x99, 0x09, 0x44, 0x34, 0x82, 0xb9, 0xaa, 0x09, 0x98, 0xce, 0xad, 0x09, 0x42, 0x23, + 0xb8, 0xcf, 0xbb, 0x89, 0x00, 0xa0, 0xeb, 0xab, 0x09, 0x21, 0x12, 0x90, 0x09, 0x31, 0x15, 0xd8, + 0xbe, 0x9c, 0x28, 0x44, 0x12, 0x88, 0x9a, 0x31, 0x46, 0x23, 0x80, 0xa9, 0x18, 0x44, 0x22, 0xa8, + 0xbd, 0xbb, 0x99, 0xba, 0xce, 0xaa, 0x20, 0x36, 0x14, 0xa0, 0xbb, 0x8b, 0x42, 0x34, 0x02, 0xb9, + 0x09, 0x55, 0x34, 0x23, 0x01, 0x11, 0x22, 0x82, 0xfc, 0xbc, 0x9b, 0x10, 0x33, 0x81, 0xca, 0x9a, + 0x52, 0x35, 0x13, 0x88, 0x89, 0x63, 0x44, 0x22, 0x98, 0xba, 0xab, 0x99, 0xba, 0xbe, 0xab, 0x42, + 0x25, 0x91, 0xdd, 0xac, 0x9b, 0x08, 0x88, 0xcb, 0xbd, 0x9a, 0x20, 0x22, 0x02, 0x00, 0x10, 0x21, + 0xc8, 0xcf, 0xbc, 0x09, 0x42, 0x43, 0x01, 0x08, 0x28, 0x44, 0x24, 0x01, 0x98, 0x18, 0x54, 0x43, + 0x81, 0xca, 0xbc, 0xab, 0xaa, 0xba, 0xab, 0x29, 0x55, 0x24, 0x80, 0xca, 0x8a, 0x20, 0x44, 0x12, + 0xa8, 0x9a, 0x50, 0x36, 0x25, 0x22, 0x11, 0x11, 0x80, 0xda, 0xcc, 0xab, 0x89, 0x22, 0x12, 0xa8, + 0x9a, 0x21, 0x46, 0x33, 0x00, 0x19, 0x72, 0x54, 0x22, 0x81, 0xa9, 0xbb, 0xbb, 0xba, 0xbb, 0x9b, + 0x40, 0x35, 0xa2, 0xde, 0xbc, 0xab, 0x99, 0xa8, 0xdc, 0xcc, 0xaa, 0x08, 0x31, 0x32, 0x21, 0x11, + 0x80, 0xca, 0xce, 0xac, 0x8a, 0x31, 0x43, 0x03, 0x00, 0x31, 0x54, 0x24, 0x12, 0x88, 0x18, 0x73, + 0x43, 0x02, 0xa9, 0xcc, 0xcb, 0xaa, 0xab, 0x9a, 0x18, 0x34, 0x25, 0x80, 0xba, 0x9b, 0x42, 0x35, + 0x13, 0xc9, 0xab, 0x28, 0x57, 0x43, 0x33, 0x22, 0x22, 0x80, 0xda, 0xcc, 0xab, 0x89, 0x10, 0x01, + 0x98, 0x0a, 0x41, 0x35, 0x23, 0x90, 0x8a, 0x73, 0x46, 0x33, 0x11, 0x98, 0xbb, 0xbc, 0xcb, 0xaa, + 0x0a, 0x41, 0x43, 0x81, 0xec, 0xcb, 0xaa, 0x88, 0x88, 0xdb, 0xcd, 0xaa, 0x8a, 0x10, 0x32, 0x32, + 0x23, 0x13, 0xb9, 0xdf, 0xcb, 0x8a, 0x10, 0x22, 0x12, 0x01, 0x42, 0x36, 0x24, 0x01, 0x99, 0x89, + 0x44, 0x45, 0x22, 0x90, 0xba, 0xbd, 0xbc, 0xbb, 0xaa, 0x28, 0x44, 0x23, 0x91, 0xdb, 0x9b, 0x31, + 0x45, 0x12, 0xa0, 0xac, 0x0a, 0x42, 0x36, 0x34, 0x33, 0x24, 0x02, 0xb9, 0xcd, 0xbb, 0x9a, 0x11, + 0x10, 0xa9, 0x9a, 0x41, 0x36, 0x13, 0xa0, 0xab, 0x48, 0x57, 0x33, 0x13, 0x91, 0xb9, 0xca, 0xbc, + 0xcb, 0x8a, 0x31, 0x35, 0x83, 0xea, 0xcc, 0x9a, 0x08, 0x01, 0xb9, 0xce, 0xac, 0x9a, 0x00, 0x21, + 0x21, 0x43, 0x32, 0x80, 0xdc, 0xcc, 0x9a, 0x18, 0x22, 0x02, 0x80, 0x18, 0x55, 0x43, 0x12, 0x99, + 0x9a, 0x40, 0x45, 0x33, 0x81, 0xb9, 0xcb, 0xbc, 0xcc, 0xab, 0x0a, 0x51, 0x33, 0x02, 0xca, 0xad, + 0x18, 0x53, 0x23, 0x80, 0xdb, 0x9a, 0x10, 0x44, 0x24, 0x33, 0x34, 0x23, 0x91, 0xdc, 0xbc, 0x8a, + 0x18, 0x11, 0x98, 0xab, 0x19, 0x64, 0x33, 0x81, 0xbb, 0x8c, 0x63, 0x35, 0x14, 0x01, 0x98, 0x9a, + 0xca, 0xcb, 0xab, 0x19, 0x45, 0x23, 0xa0, 0xbe, 0xac, 0x89, 0x21, 0x80, 0xfb, 0xdb, 0x9a, 0x88, + 0x10, 0x11, 0x31, 0x43, 0x13, 0xb8, 0xcf, 0xbb, 0x09, 0x31, 0x22, 0x90, 0x89, 0x62, 0x45, 0x22, + 0x90, 0xba, 0x09, 0x73, 0x34, 0x02, 0x90, 0xba, 0xcb, 0xdb, 0xcb, 0x9b, 0x20, 0x54, 0x12, 0xa0, + 0xbc, 0x8b, 0x41, 0x34, 0x03, 0xb9, 0xad, 0x89, 0x42, 0x34, 0x42, 0x43, 0x33, 0x13, 0xc9, 0xcd, + 0xab, 0x09, 0x21, 0x81, 0xba, 0x9b, 0x51, 0x45, 0x02, 0xa8, 0xac, 0x28, 0x64, 0x33, 0x02, 0x90, + 0xa8, 0xb9, 0xdb, 0xbc, 0x9b, 0x42, 0x26, 0x02, 0xca, 0xbd, 0x9a, 0x20, 0x12, 0xb8, 0xde, 0xab, + 0x8a, 0x18, 0x11, 0x11, 0x43, 0x24, 0x82, 0xeb, 0xcc, 0x9a, 0x10, 0x32, 0x01, 0xa9, 0x19, 0x55, + 0x24, 0x12, 0xb9, 0xab, 0x40, 0x45, 0x23, 0x00, 0xa9, 0xbb, 0xdb, 0xbc, 0xbc, 0x0a, 0x52, 0x24, + 0x02, 0xcb, 0xac, 0x19, 0x53, 0x33, 0x90, 0xcb, 0x9b, 0x28, 0x44, 0x33, 0x43, 0x44, 0x22, 0x81, + 0xeb, 0xcb, 0x8a, 0x10, 0x02, 0xa0, 0xbb, 0x1a, 0x45, 0x34, 0x91, 0xca, 0x8b, 0x51, 0x35, 0x23, + 0x81, 0x98, 0xa9, 0xca, 0xbc, 0xad, 0x08, 0x44, 0x33, 0xa0, 0xdd, 0xab, 0x88, 0x22, 0x01, 0xdb, + 0xcd, 0x9a, 0x09, 0x10, 0x01, 0x31, 0x43, 0x33, 0xb8, 0xcf, 0xbb, 0x89, 0x32, 0x13, 0xa0, 0x9a, + 0x61, 0x45, 0x23, 0x90, 0xbb, 0x0a, 0x73, 0x24, 0x03, 0x90, 0xaa, 0xbb, 0xcc, 0xcc, 0x9a, 0x28, + 0x63, 0x13, 0xa0, 0xcc, 0x9a, 0x31, 0x44, 0x02, 0xb8, 0xbb, 0x8a, 0x42, 0x34, 0x24, 0x34, 0x34, + 0x22, 0xb9, 0xce, 0xab, 0x88, 0x22, 0x81, 0xba, 0x9c, 0x40, 0x44, 0x13, 0xb8, 0xac, 0x19, 0x64, + 0x33, 0x12, 0x90, 0xa8, 0xa9, 0xcc, 0xbc, 0x9a, 0x41, 0x35, 0x03, 0xda, 0xcc, 0x8a, 0x18, 0x22, + 0xa8, 0xcd, 0xac, 0x8a, 0x08, 0x01, 0x21, 0x42, 0x43, 0x82, 0xda, 0xbd, 0xab, 0x10, 0x33, 0x01, + 0xaa, 0x19, 0x56, 0x34, 0x02, 0xb8, 0xab, 0x38, 0x56, 0x22, 0x01, 0x99, 0xba, 0xcb, 0xcc, 0xcb, + 0x89, 0x42, 0x24, 0x02, 0xca, 0xbc, 0x08, 0x43, 0x24, 0x81, 0xbb, 0xbb, 0x10, 0x54, 0x32, 0x34, + 0x34, 0x24, 0x81, 0xda, 0xbc, 0x9a, 0x18, 0x12, 0x98, 0xbc, 0x19, 0x73, 0x33, 0x81, 0xbb, 0x8c, + 0x41, 0x45, 0x23, 0x01, 0x98, 0x99, 0xbb, 0xcd, 0xbb, 0x19, 0x45, 0x33, 0xa0, 0xdd, 0xab, 0x89, + 0x22, 0x01, 0xea, 0xbc, 0x9c, 0x89, 0x00, 0x01, 0x22, 0x44, 0x22, 0xa8, 0xcd, 0xac, 0x8a, 0x21, + 0x22, 0x90, 0x8a, 0x51, 0x45, 0x23, 0x80, 0xba, 0x89, 0x63, 0x25, 0x13, 0x90, 0xaa, 0xbb, 0xcd, + 0xcb, 0xaa, 0x28, 0x44, 0x23, 0xa8, 0xcc, 0x9b, 0x21, 0x45, 0x02, 0x98, 0xbb, 0x8a, 0x31, 0x45, + 0x43, 0x43, 0x43, 0x12, 0xa8, 0xbd, 0xac, 0x89, 0x11, 0x80, 0xb9, 0x9b, 0x41, 0x36, 0x13, 0xa8, + 0xbb, 0x29, 0x56, 0x34, 0x12, 0x81, 0xa8, 0xb9, 0xcc, 0xbc, 0x8a, 0x31, 0x36, 0x12, 0xda, 0xcc, + 0x9a, 0x18, 0x01, 0xb0, 0xdc, 0xac, 0x9a, 0x09, 0x00, 0x31, 0x43, 0x24, 0x82, 0xea, 0xdb, 0x9a, + 0x08, 0x12, 0x81, 0x98, 0x20, 0x55, 0x34, 0x02, 0x98, 0x9a, 0x20, 0x46, 0x23, 0x02, 0xa0, 0xca, + 0xdb, 0xcc, 0xba, 0x09, 0x41, 0x24, 0x01, 0xca, 0xbb, 0x08, 0x53, 0x14, 0x81, 0xb9, 0xaa, 0x28, + 0x53, 0x44, 0x53, 0x43, 0x23, 0x80, 0xca, 0xbc, 0xaa, 0x08, 0x81, 0xa8, 0xab, 0x28, 0x46, 0x24, + 0x80, 0xa9, 0x0a, 0x62, 0x35, 0x23, 0x12, 0x80, 0xb9, 0xcc, 0xcc, 0xaa, 0x28, 0x53, 0x13, 0xb0, + 0xcd, 0xac, 0x09, 0x00, 0x90, 0xdb, 0xcc, 0xba, 0x99, 0x88, 0x11, 0x53, 0x33, 0x23, 0xc8, 0xcd, + 0xbb, 0x89, 0x10, 0x01, 0x80, 0x28, 0x64, 0x34, 0x23, 0x81, 0x99, 0x20, 0x55, 0x43, 0x21, 0x80, + 0xa9, 0xcc, 0xbc, 0xbd, 0x99, 0x20, 0x43, 0x12, 0xb9, 0xbc, 0x8a, 0x41, 0x34, 0x12, 0x99, 0xbb, + 0x09, 0x52, 0x44, 0x45, 0x44, 0x22, 0x02, 0xa8, 0xbc, 0xab, 0x89, 0x88, 0xa9, 0x9c, 0x19, 0x63, + 0x43, 0x01, 0xa8, 0x09, 0x42, 0x36, 0x34, 0x22, 0x11, 0x90, 0xdb, 0xcc, 0xac, 0x09, 0x32, 0x24, + 0x90, 0xeb, 0xbb, 0x9a, 0x88, 0xa8, 0xcd, 0xbc, 0xac, 0xaa, 0x99, 0x09, 0x41, 0x35, 0x23, 0x90, + 0xdc, 0xab, 0x9a, 0x08, 0x80, 0xa9, 0x29, 0x55, 0x35, 0x33, 0x01, 0x89, 0x20, 0x54, 0x33, 0x23, + 0x11, 0x81, 0xda, 0xce, 0xbc, 0xab, 0x19, 0x43, 0x12, 0xb0, 0xcb, 0x8a, 0x31, 0x34, 0x02, 0xa9, + 0x9a, 0x20, 0x44, 0x24, 0x55, 0x54, 0x43, 0x12, 0x90, 0xba, 0xab, 0x99, 0x98, 0xda, 0xbb, 0x09, + 0x44, 0x24, 0x02, 0xa9, 0x89, 0x63, 0x44, 0x23, 0x12, 0x11, 0x12, 0xb8, 0xde, 0xcb, 0x99, 0x31, + 0x24, 0x91, 0xdb, 0xac, 0x8a, 0x08, 0xa8, 0xdc, 0xbc, 0xab, 0xaa, 0xaa, 0xaa, 0x29, 0x55, 0x24, + 0x01, 0xca, 0xcb, 0x8a, 0x08, 0x80, 0xba, 0x9b, 0x73, 0x45, 0x22, 0x00, 0x89, 0x28, 0x54, 0x33, + 0x12, 0x80, 0x08, 0x98, 0xfb, 0xcc, 0xac, 0x88, 0x22, 0x13, 0xa8, 0xbd, 0x8a, 0x41, 0x33, 0x02, + 0xca, 0xaa, 0x30, 0x44, 0x22, 0x32, 0x56, 0x35, 0x14, 0x81, 0xb9, 0xaa, 0x09, 0x81, 0xc9, 0xbd, + 0x9b, 0x41, 0x34, 0x03, 0xa9, 0x9b, 0x51, 0x45, 0x33, 0x11, 0x08, 0x11, 0x12, 0xda, 0xbe, 0xab, + 0x38, 0x44, 0x01, 0xdb, 0xbc, 0x89, 0x10, 0x91, 0xfb, 0xbc, 0xbb, 0x89, 0x90, 0xa9, 0x9a, 0x30, + 0x37, 0x03, 0xc8, 0xcc, 0x8a, 0x10, 0x11, 0xba, 0xbe, 0x18, 0x64, 0x33, 0x01, 0x98, 0x89, 0x53, + 0x35, 0x12, 0x80, 0x89, 0x08, 0x90, 0xdd, 0xbc, 0x9b, 0x30, 0x34, 0x90, 0xdc, 0xaa, 0x20, 0x25, + 0x03, 0xb9, 0xac, 0x09, 0x53, 0x33, 0x02, 0x31, 0x46, 0x34, 0x03, 0xb8, 0xbb, 0x89, 0x32, 0xa1, + 0xdf, 0xab, 0x19, 0x34, 0x24, 0xa0, 0xbb, 0x19, 0x55, 0x34, 0x02, 0x90, 0x08, 0x10, 0x80, 0xeb, + 0xbc, 0x08, 0x43, 0x14, 0xc8, 0xbd, 0x9b, 0x10, 0x22, 0xc0, 0xdd, 0xbb, 0x9a, 0x00, 0x80, 0xaa, + 0x09, 0x42, 0x34, 0x90, 0xdd, 0xaa, 0x18, 0x32, 0xa1, 0xdc, 0x9b, 0x51, 0x44, 0x12, 0x98, 0x9a, + 0x20, 0x46, 0x33, 0x81, 0x99, 0x9a, 0x08, 0xb9, 0xce, 0xab, 0x28, 0x53, 0x02, 0xea, 0xcb, 0x09, + 0x43, 0x33, 0x90, 0xdb, 0x9b, 0x30, 0x44, 0x22, 0x10, 0x41, 0x34, 0x24, 0x98, 0xbb, 0x9b, 0x41, + 0x14, 0xb8, 0xbf, 0x9b, 0x31, 0x35, 0x82, 0xc9, 0x9b, 0x41, 0x45, 0x23, 0x91, 0x99, 0x88, 0x01, + 0x98, 0xcd, 0x8a, 0x41, 0x34, 0xa1, 0xdd, 0xbb, 0x09, 0x32, 0x03, 0xec, 0xbc, 0xab, 0x08, 0x01, + 0x91, 0xa9, 0x18, 0x33, 0x02, 0xed, 0xac, 0x0a, 0x42, 0x13, 0xb9, 0xbe, 0x09, 0x63, 0x24, 0x81, + 0xa9, 0x89, 0x53, 0x35, 0x12, 0x98, 0x9a, 0x8a, 0x88, 0xca, 0xbd, 0x89, 0x43, 0x24, 0xb8, 0xce, + 0x9b, 0x21, 0x35, 0x12, 0xc9, 0xcb, 0x09, 0x42, 0x33, 0x13, 0x11, 0x42, 0x34, 0x01, 0xda, 0x9b, + 0x28, 0x44, 0x01, 0xeb, 0xbb, 0x1a, 0x53, 0x33, 0xa8, 0xbc, 0x1a, 0x64, 0x43, 0x02, 0x98, 0x99, + 0x88, 0x80, 0xb9, 0xac, 0x30, 0x46, 0x12, 0xda, 0xcd, 0x8a, 0x10, 0x23, 0xa0, 0xdd, 0xbb, 0x8a, + 0x10, 0x11, 0x98, 0x98, 0x11, 0x02, 0xd9, 0xbe, 0x8c, 0x20, 0x24, 0x82, 0xdb, 0xab, 0x40, 0x44, + 0x13, 0xa8, 0xab, 0x48, 0x55, 0x23, 0x01, 0xa9, 0xab, 0x99, 0x99, 0xdb, 0x9a, 0x41, 0x35, 0x81, + 0xdc, 0xac, 0x1a, 0x42, 0x24, 0x91, 0xda, 0x9a, 0x18, 0x53, 0x32, 0x11, 0x21, 0x32, 0x12, 0xc8, + 0xbd, 0x89, 0x53, 0x33, 0xb0, 0xdd, 0x9a, 0x20, 0x34, 0x82, 0xca, 0x9b, 0x40, 0x46, 0x22, 0x81, + 0xa9, 0x99, 0x89, 0x98, 0xaa, 0x29, 0x65, 0x23, 0xb0, 0xde, 0xab, 0x09, 0x32, 0x12, 0xea, 0xbd, + 0xab, 0x09, 0x21, 0x11, 0x08, 0x88, 0x00, 0xc9, 0xdd, 0xab, 0x19, 0x53, 0x23, 0xa8, 0xcc, 0x89, + 0x43, 0x25, 0x01, 0xaa, 0x8a, 0x73, 0x34, 0x13, 0x90, 0xba, 0xab, 0xaa, 0xba, 0xab, 0x40, 0x46, + 0x13, 0xc9, 0xbe, 0x9c, 0x20, 0x34, 0x13, 0xb9, 0xbd, 0x8a, 0x32, 0x36, 0x32, 0x21, 0x22, 0x11, + 0xb8, 0xdc, 0xaa, 0x31, 0x36, 0x02, 0xca, 0xcb, 0x09, 0x42, 0x23, 0xa8, 0xbd, 0x19, 0x54, 0x25, + 0x12, 0x88, 0xaa, 0x9a, 0xa9, 0x99, 0x19, 0x73, 0x34, 0x02, 0xdc, 0xbc, 0x9b, 0x10, 0x33, 0xa1, + 0xed, 0xcb, 0x8a, 0x18, 0x11, 0x11, 0x00, 0x08, 0xa9, 0xcd, 0xbc, 0x9a, 0x41, 0x43, 0x82, 0xb9, + 0xab, 0x30, 0x46, 0x12, 0xa8, 0xaa, 0x48, 0x47, 0x23, 0x02, 0xa8, 0xbb, 0xac, 0xba, 0x9a, 0x20, + 0x55, 0x33, 0x90, 0xdd, 0xbb, 0x0a, 0x43, 0x24, 0x92, 0xca, 0xbb, 0x18, 0x63, 0x43, 0x32, 0x22, + 0x02, 0x98, 0xcc, 0xab, 0x19, 0x44, 0x14, 0x80, 0xbb, 0x9b, 0x30, 0x34, 0x82, 0xcc, 0x9b, 0x61, + 0x45, 0x23, 0x01, 0xa8, 0xbb, 0xbb, 0xab, 0x09, 0x73, 0x35, 0x13, 0xc8, 0xbe, 0xbb, 0x09, 0x31, + 0x02, 0xe9, 0xcc, 0xbb, 0x89, 0x20, 0x31, 0x22, 0x01, 0xb8, 0xde, 0xbc, 0x9a, 0x18, 0x53, 0x12, + 0x90, 0xa9, 0x19, 0x52, 0x33, 0x90, 0xba, 0x19, 0x57, 0x35, 0x12, 0x81, 0xb9, 0xdb, 0xbb, 0xaa, + 0x19, 0x54, 0x24, 0x02, 0xda, 0xbc, 0x9a, 0x20, 0x34, 0x03, 0xb8, 0xbc, 0x8b, 0x31, 0x46, 0x34, + 0x33, 0x22, 0x90, 0xeb, 0xbb, 0x8a, 0x42, 0x34, 0x11, 0xa9, 0xaa, 0x18, 0x32, 0x03, 0xeb, 0xbb, + 0x40, 0x56, 0x24, 0x12, 0x81, 0xa9, 0xbc, 0xbc, 0x9a, 0x31, 0x37, 0x24, 0x90, 0xdb, 0xbc, 0x8a, + 0x18, 0x12, 0xa8, 0xdc, 0xac, 0x9b, 0x88, 0x11, 0x33, 0x24, 0x91, 0xeb, 0xcd, 0xaa, 0x09, 0x21, + 0x14, 0x01, 0x98, 0x08, 0x22, 0x14, 0x81, 0xbb, 0x09, 0x65, 0x35, 0x24, 0x11, 0x88, 0xca, 0xdb, + 0xbb, 0x8a, 0x51, 0x34, 0x14, 0xa8, 0xbc, 0xac, 0x08, 0x31, 0x23, 0x91, 0xcb, 0xaa, 0x19, 0x63, + 0x44, 0x35, 0x23, 0x02, 0xca, 0xbc, 0xab, 0x20, 0x34, 0x23, 0x90, 0x99, 0x20, 0x32, 0x82, 0xfb, + 0xbb, 0x28, 0x65, 0x34, 0x22, 0x11, 0x80, 0xda, 0xcc, 0xba, 0x19, 0x73, 0x33, 0x02, 0xc9, 0xbd, + 0xaa, 0x08, 0x10, 0x98, 0xcb, 0xad, 0xbb, 0x9a, 0x88, 0x32, 0x36, 0x14, 0xb0, 0xce, 0xbc, 0x8a, + 0x20, 0x22, 0x12, 0x88, 0x18, 0x43, 0x23, 0x90, 0xbc, 0x9b, 0x73, 0x35, 0x24, 0x12, 0x00, 0x98, + 0xeb, 0xcc, 0x9b, 0x18, 0x54, 0x23, 0x81, 0xda, 0xab, 0x8a, 0x21, 0x13, 0x91, 0xb9, 0x9b, 0x08, + 0x42, 0x54, 0x55, 0x43, 0x13, 0x90, 0xcc, 0xbb, 0x09, 0x32, 0x24, 0x81, 0x88, 0x20, 0x33, 0x13, + 0xfb, 0xac, 0x09, 0x53, 0x34, 0x23, 0x11, 0x10, 0x98, 0xec, 0xbc, 0x9c, 0x21, 0x36, 0x23, 0xa0, + 0xcc, 0xbb, 0x89, 0x01, 0x90, 0xdb, 0xcb, 0xaa, 0x99, 0x9a, 0x08, 0x63, 0x44, 0x01, 0xda, 0xbd, + 0x9c, 0x08, 0x21, 0x12, 0x08, 0x08, 0x32, 0x35, 0x81, 0xcb, 0x9c, 0x28, 0x55, 0x32, 0x11, 0x80, + 0x00, 0xa8, 0xdd, 0xbc, 0x8a, 0x41, 0x35, 0x13, 0xb8, 0xcc, 0x8a, 0x10, 0x12, 0x80, 0xba, 0x9a, + 0x20, 0x33, 0x33, 0x65, 0x55, 0x33, 0x03, 0xda, 0xbc, 0x8b, 0x20, 0x33, 0x02, 0x98, 0x28, 0x45, + 0x23, 0xa8, 0xcd, 0x9b, 0x31, 0x45, 0x13, 0x01, 0x00, 0x00, 0xa8, 0xce, 0xbc, 0x09, 0x63, 0x24, + 0x82, 0xc9, 0xbb, 0x9a, 0x00, 0x80, 0xea, 0xcb, 0x9a, 0x08, 0x98, 0x99, 0x29, 0x64, 0x33, 0xa0, + 0xcf, 0xcb, 0x99, 0x11, 0x12, 0x00, 0x09, 0x31, 0x45, 0x12, 0xb8, 0xcc, 0x89, 0x52, 0x43, 0x12, + 0x08, 0x08, 0x88, 0xb9, 0xcf, 0xab, 0x29, 0x54, 0x24, 0x80, 0xba, 0xbb, 0x08, 0x23, 0x82, 0xda, + 0xbb, 0x28, 0x34, 0x23, 0x21, 0x64, 0x45, 0x23, 0x90, 0xdc, 0xab, 0x09, 0x22, 0x13, 0x80, 0x19, + 0x62, 0x34, 0x82, 0xda, 0xac, 0x19, 0x53, 0x33, 0x11, 0x98, 0x08, 0x80, 0xc9, 0xce, 0x9b, 0x38, + 0x46, 0x22, 0xa8, 0xdb, 0x9a, 0x08, 0x01, 0xc8, 0xcc, 0xaa, 0x09, 0x01, 0x88, 0x8a, 0x30, 0x36, + 0x04, 0xe9, 0xcc, 0xab, 0x08, 0x21, 0x02, 0x88, 0x18, 0x45, 0x43, 0x91, 0xcb, 0xab, 0x38, 0x55, + 0x22, 0x81, 0x89, 0x88, 0x88, 0xda, 0xcc, 0x9a, 0x51, 0x34, 0x12, 0xb8, 0xbc, 0x0a, 0x31, 0x13, + 0xd8, 0xbc, 0x8a, 0x41, 0x24, 0x12, 0x10, 0x44, 0x35, 0x02, 0xc9, 0xbd, 0x9b, 0x20, 0x23, 0x82, + 0x89, 0x40, 0x46, 0x22, 0xa0, 0xcc, 0x9a, 0x30, 0x45, 0x12, 0x90, 0x98, 0x80, 0x88, 0xea, 0xcb, + 0x89, 0x53, 0x34, 0x82, 0xda, 0xab, 0x89, 0x11, 0x90, 0xdd, 0xcb, 0x89, 0x10, 0x01, 0x90, 0x89, + 0x41, 0x43, 0x90, 0xde, 0xcb, 0x8a, 0x10, 0x11, 0x90, 0x88, 0x52, 0x35, 0x23, 0xb9, 0xbd, 0x8b, + 0x52, 0x34, 0x12, 0x98, 0x99, 0x88, 0x99, 0xcd, 0xac, 0x18, 0x54, 0x14, 0x81, 0xba, 0x9b, 0x20, + 0x33, 0xa2, 0xde, 0xaa, 0x18, 0x34, 0x33, 0x01, 0x21, 0x45, 0x33, 0x91, 0xdd, 0xbb, 0x09, 0x21, + 0x03, 0x88, 0x29, 0x65, 0x34, 0x01, 0xc9, 0xac, 0x09, 0x53, 0x33, 0x01, 0x99, 0x9a, 0x88, 0xb8, + 0xdc, 0xab, 0x30, 0x47, 0x12, 0xa8, 0xbc, 0x9b, 0x20, 0x02, 0xfa, 0xcc, 0x9b, 0x09, 0x22, 0x01, + 0x88, 0x08, 0x42, 0x12, 0xfb, 0xbd, 0xac, 0x88, 0x11, 0x81, 0x98, 0x30, 0x46, 0x24, 0x81, 0xca, + 0x9c, 0x18, 0x34, 0x24, 0x80, 0xa9, 0x99, 0x89, 0xb9, 0xcc, 0x0a, 0x52, 0x35, 0x03, 0xb9, 0xbc, + 0x18, 0x53, 0x12, 0xca, 0xbe, 0x99, 0x31, 0x35, 0x22, 0x10, 0x22, 0x43, 0x02, 0xd9, 0xbd, 0x9b, + 0x10, 0x12, 0x91, 0x89, 0x72, 0x45, 0x23, 0x90, 0xdb, 0xaa, 0x30, 0x35, 0x23, 0x90, 0xb9, 0x9a, + 0x99, 0xca, 0xac, 0x1a, 0x45, 0x24, 0x81, 0xbc, 0xac, 0x08, 0x22, 0xc0, 0xed, 0xbb, 0x9a, 0x20, + 0x23, 0x01, 0x80, 0x18, 0x12, 0xc9, 0xdf, 0xbb, 0x8a, 0x18, 0x00, 0x99, 0x19, 0x74, 0x34, 0x23, + 0xa8, 0xbd, 0x8a, 0x41, 0x34, 0x13, 0x98, 0xab, 0x9b, 0xba, 0xdb, 0x9a, 0x50, 0x35, 0x24, 0x98, + 0xca, 0x89, 0x52, 0x23, 0xb0, 0xdd, 0xab, 0x19, 0x53, 0x33, 0x23, 0x21, 0x22, 0x12, 0xc8, 0xcd, + 0xab, 0x09, 0x11, 0x80, 0x9a, 0x50, 0x47, 0x34, 0x02, 0xb9, 0xac, 0x09, 0x52, 0x24, 0x02, 0x99, + 0xaa, 0xaa, 0xab, 0xac, 0x09, 0x63, 0x34, 0x01, 0xdb, 0xbb, 0x0a, 0x32, 0x02, 0xee, 0xcc, 0xab, + 0x88, 0x21, 0x23, 0x11, 0x00, 0x00, 0xb9, 0xde, 0xbb, 0x9c, 0x09, 0x80, 0xa8, 0x8a, 0x62, 0x55, + 0x32, 0x81, 0xba, 0x9c, 0x18, 0x44, 0x23, 0x81, 0xa9, 0xbc, 0xba, 0xbb, 0x8a, 0x51, 0x45, 0x23, + 0x90, 0xbb, 0x8b, 0x62, 0x34, 0x83, 0xeb, 0xbc, 0x9b, 0x31, 0x44, 0x43, 0x22, 0x21, 0x00, 0xa8, + 0xcc, 0xaa, 0x89, 0x10, 0xa0, 0xba, 0x19, 0x67, 0x44, 0x22, 0x80, 0xba, 0x9a, 0x31, 0x36, 0x13, + 0x81, 0xb9, 0xcc, 0xab, 0xbb, 0x19, 0x53, 0x25, 0x02, 0xda, 0xbb, 0x8a, 0x31, 0x14, 0xd9, 0xbf, + 0xbc, 0x9a, 0x00, 0x32, 0x32, 0x13, 0x81, 0xb9, 0xcf, 0xbb, 0xaa, 0x08, 0x80, 0xca, 0xbb, 0x39, + 0x67, 0x33, 0x12, 0xa8, 0xba, 0x0a, 0x52, 0x34, 0x11, 0x90, 0xca, 0xcc, 0xba, 0x9b, 0x30, 0x46, + 0x23, 0x81, 0xbb, 0xab, 0x51, 0x35, 0x23, 0xb9, 0xbf, 0xab, 0x09, 0x43, 0x34, 0x34, 0x33, 0x01, + 0xb8, 0xcc, 0xab, 0x09, 0x12, 0x91, 0xeb, 0x9b, 0x52, 0x45, 0x24, 0x01, 0x98, 0x8a, 0x28, 0x43, + 0x33, 0x11, 0x98, 0xcc, 0xcc, 0xbb, 0x8b, 0x51, 0x44, 0x02, 0xb9, 0xcc, 0x8a, 0x20, 0x32, 0xa0, + 0xed, 0xbc, 0xaa, 0x89, 0x20, 0x32, 0x34, 0x13, 0xa0, 0xcd, 0xbd, 0x9a, 0x18, 0x01, 0xb8, 0xbc, + 0x8b, 0x63, 0x35, 0x23, 0x80, 0xaa, 0x09, 0x41, 0x43, 0x02, 0x00, 0xb9, 0xdc, 0xbd, 0xbb, 0x19, + 0x45, 0x25, 0x01, 0xb9, 0xbb, 0x28, 0x45, 0x23, 0x91, 0xeb, 0xab, 0x8a, 0x11, 0x53, 0x53, 0x43, + 0x12, 0x90, 0xdb, 0xab, 0x0a, 0x31, 0x12, 0xca, 0xbc, 0x19, 0x55, 0x24, 0x12, 0x90, 0x89, 0x20, + 0x43, 0x13, 0x01, 0x80, 0xa9, 0xce, 0xbd, 0xab, 0x28, 0x45, 0x14, 0xa0, 0xdb, 0x9b, 0x18, 0x33, + 0x12, 0xeb, 0xbd, 0xbb, 0x9a, 0x18, 0x20, 0x44, 0x43, 0x02, 0xca, 0xcd, 0xaa, 0x19, 0x11, 0x81, + 0xda, 0xab, 0x28, 0x45, 0x23, 0x82, 0x99, 0x09, 0x32, 0x25, 0x82, 0x98, 0x99, 0xca, 0xdd, 0xbc, + 0x9a, 0x41, 0x36, 0x13, 0xa8, 0xbc, 0x0a, 0x52, 0x34, 0x02, 0xc9, 0xbb, 0x9b, 0x00, 0x32, 0x44, + 0x45, 0x33, 0x02, 0xca, 0xbd, 0x9a, 0x10, 0xa3, 0x02, 0x01, 0x0d, 0x7d, 0x0b, 0x02, 0xe3, 0x00, + 0xe1, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x4f, 0x77, 0x0b, 0x13, 0xa8, 0x51, + 0x82, 0x8b, 0x26, 0xb8, 0x38, 0x47, 0xc9, 0x11, 0xa0, 0x1a, 0x03, 0xbb, 0x61, 0xf8, 0x18, 0x18, + 0x06, 0xbd, 0x41, 0x13, 0xfb, 0x0a, 0x22, 0xa0, 0xad, 0xab, 0x55, 0xc9, 0x28, 0x04, 0xaa, 0x28, + 0x92, 0x28, 0x88, 0xbb, 0x76, 0xb0, 0x1b, 0x24, 0xa8, 0x9b, 0x21, 0x23, 0xbc, 0x40, 0xa2, 0xbf, + 0xbb, 0x41, 0x91, 0x18, 0x45, 0x04, 0xcb, 0x50, 0x23, 0x90, 0x08, 0xa9, 0xca, 0xce, 0x9a, 0x88, + 0xa9, 0x29, 0x54, 0x81, 0x89, 0x31, 0x12, 0x32, 0x33, 0xc8, 0xcf, 0x8a, 0x42, 0x14, 0x80, 0x20, + 0x02, 0xcb, 0x89, 0x80, 0x9a, 0x18, 0x43, 0x84, 0xcd, 0x8a, 0x21, 0x22, 0x47, 0x13, 0xb9, 0x9a, + 0x52, 0x35, 0x90, 0xaa, 0xa9, 0xfc, 0xab, 0xaa, 0x9a, 0x09, 0x20, 0x43, 0x90, 0x8b, 0x33, 0x02, + 0x73, 0x16, 0xc9, 0xbb, 0x19, 0x45, 0x12, 0x08, 0x31, 0x92, 0xaa, 0x98, 0x88, 0x20, 0x22, 0x45, + 0xa1, 0xbf, 0x18, 0x01, 0x51, 0x36, 0x82, 0xab, 0x8a, 0x64, 0x13, 0xb9, 0x8a, 0xd9, 0xbd, 0xcb, + 0xaa, 0x89, 0x08, 0x30, 0x13, 0xb8, 0x28, 0x13, 0x30, 0x77, 0x81, 0xca, 0x9b, 0x48, 0x34, 0x82, + 0x10, 0x24, 0x98, 0x99, 0xa9, 0x18, 0x23, 0x21, 0x36, 0xe9, 0x8b, 0x00, 0x19, 0x76, 0x12, 0x90, + 0xa9, 0x28, 0x45, 0x91, 0x9a, 0xa8, 0xec, 0xbb, 0xcb, 0xaa, 0x88, 0x80, 0x32, 0x83, 0x8a, 0x33, + 0xa0, 0x72, 0x27, 0xa8, 0xab, 0x9b, 0x73, 0x13, 0x80, 0x52, 0x81, 0x89, 0x80, 0xaa, 0x30, 0x83, + 0x40, 0x05, 0xbc, 0x19, 0xa1, 0x5b, 0x57, 0x81, 0x89, 0x90, 0x30, 0x34, 0xb9, 0x09, 0xd8, 0xbf, + 0x9a, 0xcb, 0x8b, 0x80, 0x18, 0x42, 0xa0, 0x18, 0x04, 0x8a, 0x74, 0x82, 0xaa, 0x99, 0x0a, 0x45, + 0x01, 0x18, 0x26, 0xa8, 0x19, 0x91, 0x8b, 0x22, 0x80, 0x61, 0xb2, 0x9d, 0x21, 0xc9, 0x78, 0x24, + 0x98, 0x08, 0x80, 0x42, 0x83, 0xbb, 0x30, 0xfa, 0xbf, 0x98, 0xbb, 0x0a, 0x90, 0x10, 0x14, 0xa9, + 0x51, 0x91, 0x1a, 0x37, 0xb1, 0xab, 0x80, 0x28, 0x26, 0x90, 0x61, 0x04, 0xaa, 0x20, 0xa1, 0x0b, + 0x13, 0x09, 0x34, 0xf8, 0x1b, 0x12, 0xac, 0x73, 0x85, 0x98, 0x18, 0x10, 0x32, 0xc1, 0x8b, 0x14, + 0xed, 0x9b, 0x98, 0xbb, 0x09, 0x80, 0x30, 0x83, 0x9b, 0x46, 0xb0, 0x49, 0x26, 0xb9, 0x8b, 0x10, + 0x40, 0x02, 0x8a, 0x75, 0x81, 0x9a, 0x11, 0xa0, 0x19, 0x01, 0x18, 0x04, 0xcc, 0x39, 0xa3, 0x8d, + 0x56, 0x91, 0x8a, 0x11, 0x21, 0x13, 0xea, 0x29, 0x93, 0xdf, 0x89, 0xa8, 0x9a, 0x08, 0x88, 0x31, + 0xa0, 0x2a, 0x17, 0xb8, 0x61, 0x03, 0xdb, 0x09, 0x11, 0x32, 0xa0, 0x2b, 0x67, 0xa0, 0x89, 0x11, + 0x98, 0x18, 0x80, 0x20, 0xa2, 0x9f, 0x30, 0xa0, 0x3b, 0x57, 0xa0, 0x0a, 0x31, 0x23, 0x92, 0xae, + 0x30, 0xc2, 0xcf, 0x88, 0xa8, 0x8a, 0x88, 0x18, 0x21, 0xb9, 0x50, 0x03, 0x9a, 0x55, 0x92, 0xad, + 0x18, 0x22, 0x13, 0xbb, 0x79, 0x25, 0xa9, 0x1a, 0x02, 0x98, 0x18, 0x08, 0x22, 0xf8, 0x0b, 0x23, + 0xb9, 0x78, 0x16, 0xa9, 0x09, 0x43, 0x23, 0xc9, 0x9b, 0x42, 0xe8, 0xad, 0x88, 0xa9, 0x99, 0x08, + 0x10, 0x81, 0x9a, 0x73, 0x81, 0x19, 0x45, 0xb8, 0xac, 0x30, 0x53, 0x91, 0xab, 0x72, 0x03, 0xaa, + 0x29, 0x02, 0x89, 0x80, 0x20, 0x83, 0xdd, 0x29, 0x03, 0x9a, 0x75, 0x82, 0xba, 0x28, 0x45, 0x02, + 0xda, 0x09, 0x12, 0xeb, 0x9c, 0x88, 0xa9, 0x89, 0x09, 0x21, 0xa8, 0x1a, 0x45, 0x90, 0x40, 0x14, + 0xea, 0x9a, 0x32, 0x25, 0xb0, 0x8b, 0x45, 0x92, 0x9a, 0x28, 0x01, 0x80, 0x98, 0x32, 0xc1, 0xae, + 0x21, 0x92, 0x39, 0x57, 0x90, 0xab, 0x40, 0x45, 0x91, 0xcb, 0x28, 0x81, 0xbd, 0xab, 0x99, 0x99, + 0xaa, 0x29, 0x03, 0xdb, 0x40, 0x04, 0x08, 0x44, 0x92, 0xbd, 0x8a, 0x54, 0x14, 0xba, 0x19, 0x25, + 0xa1, 0x99, 0x10, 0x11, 0x91, 0x89, 0x24, 0xf9, 0x8a, 0x13, 0x88, 0x71, 0x13, 0xaa, 0x9b, 0x71, + 0x26, 0xb0, 0xab, 0x21, 0xb8, 0xbd, 0xab, 0x9a, 0x90, 0xbb, 0x30, 0xa2, 0x9f, 0x52, 0x81, 0x20, + 0x25, 0xb9, 0xbc, 0x19, 0x47, 0x83, 0xbb, 0x48, 0x13, 0x98, 0x98, 0x00, 0x42, 0xa0, 0x2a, 0x04, + 0xcd, 0x29, 0x02, 0x19, 0x46, 0x91, 0xaa, 0x89, 0x74, 0x14, 0xc8, 0x8a, 0x01, 0xc9, 0xaa, 0xba, + 0x0a, 0x90, 0x9c, 0x31, 0xd8, 0x0a, 0x15, 0x80, 0x52, 0x83, 0xdb, 0x9a, 0x20, 0x47, 0x91, 0x9b, + 0x32, 0x82, 0x09, 0x88, 0x19, 0x25, 0xa8, 0x28, 0xc3, 0xaf, 0x21, 0x91, 0x58, 0x25, 0xa9, 0x9a, + 0x18, 0x56, 0x03, 0xcb, 0x1a, 0x90, 0xbb, 0xba, 0xbd, 0x18, 0xa0, 0x8c, 0x12, 0xdb, 0x28, 0x14, + 0x09, 0x46, 0xa0, 0xbb, 0x98, 0x61, 0x26, 0xa8, 0x0a, 0x22, 0x90, 0x28, 0x98, 0x3a, 0x26, 0xa9, + 0x30, 0xe8, 0x8c, 0x22, 0x98, 0x72, 0x03, 0xca, 0x88, 0x20, 0x46, 0x92, 0xac, 0x18, 0xa9, 0x9c, + 0xa8, 0xac, 0x28, 0xa8, 0x1a, 0x91, 0xae, 0x41, 0x81, 0x49, 0x26, 0xb9, 0x9c, 0x00, 0x62, 0x23, + 0xba, 0x28, 0x83, 0x99, 0x32, 0xc9, 0x58, 0x14, 0x99, 0x01, 0xfb, 0x19, 0x02, 0x1a, 0x56, 0x91, + 0xab, 0x18, 0x41, 0x35, 0xb0, 0x9c, 0x80, 0xdb, 0x0a, 0xb9, 0x9c, 0x20, 0xa8, 0x19, 0xc8, 0x8d, + 0x23, 0x90, 0x71, 0x05, 0xca, 0x89, 0x10, 0x63, 0x82, 0xa9, 0x21, 0x90, 0x0a, 0x14, 0xa9, 0x50, + 0x03, 0x09, 0xa0, 0xaf, 0x38, 0x91, 0x48, 0x37, 0xc0, 0x9a, 0x10, 0x43, 0x14, 0xb9, 0x8a, 0xb8, + 0xbf, 0x08, 0xb9, 0x8c, 0x11, 0x98, 0x80, 0xeb, 0x19, 0x13, 0x0a, 0x66, 0x91, 0xcb, 0x19, 0x31, + 0x34, 0x91, 0x0a, 0x13, 0xcb, 0x49, 0x13, 0x9b, 0x62, 0x02, 0x08, 0xda, 0x9b, 0x22, 0xa0, 0x72, + 0x27, 0xba, 0x8a, 0x22, 0x44, 0x81, 0xaa, 0x08, 0xfb, 0xab, 0x00, 0xba, 0x0b, 0x11, 0x00, 0xc9, + 0xae, 0x20, 0x92, 0x49, 0x37, 0xc0, 0x9c, 0x18, 0x33, 0x14, 0x98, 0x30, 0x91, 0x9e, 0x30, 0x83, + 0x8a, 0x42, 0x13, 0xb1, 0xce, 0x19, 0x01, 0x09, 0x57, 0x82, 0xbb, 0x0a, 0x53, 0x23, 0xa8, 0x89, + 0xa0, 0xef, 0x89, 0x80, 0x99, 0x09, 0x10, 0x81, 0xda, 0x8b, 0x12, 0x98, 0x71, 0x15, 0xc9, 0x9b, + 0x30, 0x25, 0x01, 0x09, 0x33, 0xd9, 0x9b, 0x33, 0x82, 0x09, 0x42, 0x24, 0xd8, 0xad, 0x20, 0x80, + 0x49, 0x27, 0xa1, 0xbb, 0x18, 0x45, 0x82, 0xa9, 0x10, 0xd8, 0xae, 0x09, 0x88, 0x99, 0x88, 0x31, + 0x91, 0xbf, 0x08, 0x82, 0x89, 0x55, 0x82, 0xbc, 0x9a, 0x62, 0x13, 0xa0, 0x30, 0x04, 0xdb, 0x09, + 0x22, 0x81, 0x80, 0x31, 0x25, 0xfa, 0x0b, 0x11, 0x99, 0x72, 0x13, 0xb8, 0xbb, 0x40, 0x26, 0xa1, + 0x8a, 0x12, 0xfb, 0xac, 0x08, 0x90, 0x88, 0x89, 0x42, 0xb0, 0xae, 0x20, 0x98, 0x39, 0x36, 0xb0, + 0xbc, 0x0a, 0x55, 0x02, 0x99, 0x42, 0x92, 0xad, 0x18, 0x11, 0x11, 0x88, 0x40, 0x04, 0xdc, 0x19, + 0x81, 0x09, 0x45, 0x82, 0xaa, 0x9a, 0x61, 0x14, 0xb8, 0x2a, 0x83, 0xde, 0x9a, 0x80, 0x08, 0x90, + 0x09, 0x33, 0xf8, 0x9b, 0x11, 0xb8, 0x61, 0x13, 0xba, 0xac, 0x29, 0x47, 0x91, 0x0a, 0x34, 0xb0, + 0xac, 0x10, 0x11, 0x12, 0x98, 0x71, 0xa2, 0xbc, 0x38, 0x90, 0x39, 0x47, 0x90, 0x9a, 0x89, 0x63, + 0x03, 0xcb, 0x20, 0xa2, 0xcf, 0x89, 0x08, 0x00, 0x88, 0x19, 0x14, 0xdb, 0x0a, 0x01, 0x8b, 0x73, + 0x92, 0xba, 0x9a, 0x40, 0x27, 0xa0, 0x29, 0x15, 0xc8, 0x8a, 0x10, 0x20, 0x02, 0x99, 0x44, 0xb0, + 0x9e, 0x11, 0x98, 0x60, 0x14, 0xa9, 0x89, 0x08, 0x54, 0x91, 0x9c, 0x31, 0xc8, 0xae, 0x88, 0x88, + 0x11, 0x98, 0x28, 0x84, 0xcc, 0x19, 0xa1, 0x1a, 0x36, 0xb8, 0xab, 0x89, 0x72, 0x15, 0xa9, 0x40, + 0x03, 0xca, 0x0a, 0x00, 0x31, 0x82, 0x09, 0x35, 0xe9, 0x0b, 0x11, 0x8a, 0x55, 0x83, 0xaa, 0x89, + 0x30, 0x36, 0xc8, 0x8b, 0x24, 0xfa, 0x9b, 0x89, 0x08, 0x12, 0x99, 0x31, 0xb2, 0xaf, 0x00, 0xb8, + 0x58, 0x14, 0xca, 0x8a, 0x18, 0x73, 0x02, 0x9a, 0x62, 0x92, 0xab, 0x09, 0x08, 0x43, 0x92, 0x19, + 0x05, 0xda, 0x19, 0x81, 0x3a, 0x47, 0x90, 0x9a, 0x00, 0x41, 0x23, 0xcc, 0x2a, 0x83, 0xdd, 0x9b, + 0x98, 0x28, 0x02, 0x98, 0x32, 0xd8, 0x9c, 0x81, 0xab, 0x72, 0x93, 0xbc, 0x89, 0x31, 0x36, 0x91, + 0x1b, 0x37, 0xa0, 0xab, 0x88, 0x18, 0x44, 0x80, 0x28, 0x81, 0xad, 0x10, 0xa8, 0x71, 0x16, 0xa8, + 0x89, 0x10, 0x43, 0x91, 0xbc, 0x30, 0xc1, 0xbe, 0x9b, 0x9a, 0x31, 0x03, 0x88, 0x13, 0xcc, 0x0b, + 0xc8, 0x0b, 0x37, 0xc0, 0xac, 0x00, 0x43, 0x23, 0xb8, 0x50, 0x15, 0xa8, 0x9b, 0x99, 0x30, 0x26, + 0x00, 0x00, 0xb0, 0x8a, 0x91, 0x0b, 0x77, 0x84, 0xa9, 0x19, 0x31, 0x33, 0xd9, 0x9b, 0x12, 0xf9, + 0xac, 0xaa, 0x89, 0x32, 0x12, 0x18, 0xa0, 0xac, 0x90, 0xcd, 0x38, 0x07, 0xc9, 0x9b, 0x21, 0x35, + 0x01, 0x8a, 0x63, 0x82, 0xa9, 0x99, 0x9b, 0x61, 0x23, 0x00, 0x90, 0xaa, 0x20, 0xd8, 0x59, 0x37, + 0xa1, 0xaa, 0x28, 0x44, 0x82, 0xcb, 0x09, 0x91, 0xdc, 0xab, 0xcb, 0x19, 0x32, 0x13, 0x81, 0xcb, + 0x19, 0xd8, 0x9d, 0x52, 0x91, 0xcc, 0x89, 0x42, 0x24, 0x98, 0x29, 0x25, 0x90, 0x89, 0xb9, 0x8b, + 0x63, 0x22, 0x02, 0xc9, 0x1a, 0x03, 0xbc, 0x72, 0x17, 0x99, 0x99, 0x21, 0x24, 0xa0, 0xac, 0x01, + 0xc8, 0xac, 0xb9, 0xbc, 0x10, 0x33, 0x33, 0xc1, 0x9c, 0x21, 0xfa, 0x1b, 0x43, 0xd8, 0xab, 0x19, + 0x54, 0x02, 0x99, 0x41, 0x03, 0x99, 0x00, 0xdb, 0x09, 0x33, 0x34, 0x82, 0xae, 0x38, 0x92, 0x8c, + 0x65, 0x82, 0xaa, 0x88, 0x42, 0x15, 0xc9, 0x0a, 0x81, 0xcb, 0x9a, 0xc9, 0xab, 0x21, 0x42, 0x24, + 0xd9, 0x0a, 0x03, 0xcc, 0x28, 0x84, 0xda, 0x9a, 0x20, 0x45, 0x91, 0x8a, 0x34, 0xa1, 0x09, 0x81, + 0xdb, 0x18, 0x23, 0x53, 0xa1, 0x9e, 0x41, 0xa0, 0x2a, 0x36, 0xa0, 0x9a, 0x18, 0x73, 0x83, 0xbc, + 0x29, 0xb1, 0xbd, 0x08, 0xca, 0x0b, 0x11, 0x52, 0x13, 0xeb, 0x18, 0x82, 0xad, 0x31, 0xa1, 0xbd, + 0x8a, 0x51, 0x25, 0xa8, 0x29, 0x24, 0xb8, 0x18, 0x92, 0xac, 0x10, 0x22, 0x27, 0xc0, 0x0c, 0x23, + 0xc8, 0x48, 0x15, 0xa9, 0x89, 0x20, 0x54, 0xa1, 0x9d, 0x10, 0xb8, 0x9d, 0x00, 0xba, 0x09, 0x11, + 0x63, 0x82, 0xbc, 0x31, 0xb1, 0x8e, 0x32, 0xd9, 0xab, 0x09, 0x63, 0x14, 0xaa, 0x40, 0x03, 0xab, + 0x30, 0xa1, 0x9c, 0x01, 0x42, 0x25, 0xea, 0x19, 0x13, 0xa9, 0x72, 0x02, 0xab, 0x88, 0x32, 0x27, + 0xc8, 0x8b, 0x11, 0xeb, 0x8a, 0x80, 0xaa, 0x08, 0x20, 0x45, 0xa1, 0x9c, 0x32, 0xd8, 0x1a, 0x03, + 0xfb, 0x8b, 0x28, 0x63, 0x82, 0xaa, 0x43, 0x92, 0x9b, 0x32, 0xc0, 0x8a, 0x10, 0x62, 0x84, 0xcb, + 0x38, 0x84, 0x0a, 0x45, 0xa1, 0xab, 0x10, 0x53, 0x14, 0xdb, 0x1a, 0x91, 0xbd, 0x1a, 0x90, 0x9b, + 0x08, 0x41, 0x26, 0xb0, 0x0c, 0x22, 0xca, 0x28, 0xa2, 0xcf, 0x89, 0x21, 0x34, 0x91, 0x0b, 0x35, + 0xb0, 0x0b, 0x14, 0xa8, 0x8a, 0x08, 0x45, 0x92, 0x9e, 0x31, 0x81, 0x39, 0x27, 0xb8, 0x8b, 0x30, + 0x54, 0x92, 0xbc, 0x19, 0xc0, 0xbd, 0x18, 0x90, 0x9a, 0x80, 0x62, 0x14, 0xb9, 0x2a, 0x82, 0xab, + 0x42, 0xf8, 0xad, 0x09, 0x42, 0x23, 0xa8, 0x39, 0x25, 0xba, 0x29, 0x13, 0xa9, 0xaa, 0x28, 0x47, + 0xb0, 0x8c, 0x33, 0x00, 0x72, 0x03, 0xda, 0x89, 0x42, 0x43, 0xa8, 0x9d, 0x00, 0xda, 0x9c, 0x00, + 0x90, 0x98, 0x18, 0x53, 0x03, 0xbb, 0x20, 0xa1, 0x1b, 0x05, 0xee, 0x9b, 0x18, 0x34, 0x03, 0x99, + 0x51, 0x82, 0xab, 0x20, 0x13, 0x99, 0xcb, 0x40, 0x25, 0xc9, 0x1a, 0x13, 0x41, 0x36, 0xa1, 0xbc, + 0x08, 0x45, 0x13, 0xda, 0x0a, 0xa0, 0xdc, 0x8a, 0x08, 0x00, 0x99, 0x28, 0x45, 0x91, 0x89, 0x00, + 0x99, 0x32, 0xe0, 0xbf, 0x9b, 0x31, 0x35, 0x91, 0x19, 0x43, 0xa0, 0x8b, 0x11, 0x23, 0xa0, 0xae, + 0x41, 0x83, 0xab, 0x21, 0x10, 0x67, 0x23, 0xc9, 0x9a, 0x28, 0x37, 0x91, 0xbb, 0x08, 0xda, 0xad, + 0x8a, 0x08, 0x01, 0xa8, 0x48, 0x25, 0x90, 0x18, 0xa8, 0x29, 0x16, 0xfb, 0xac, 0x89, 0x41, 0x14, + 0x98, 0x20, 0x03, 0xa9, 0x09, 0x00, 0x34, 0xb0, 0x9e, 0x23, 0xa1, 0x19, 0x92, 0x6a, 0x57, 0x81, + 0xaa, 0x89, 0x40, 0x25, 0xb0, 0x9b, 0x80, 0xec, 0x9a, 0x99, 0x18, 0x02, 0x9a, 0x51, 0x03, 0x18, + 0x02, 0xcc, 0x51, 0x93, 0xce, 0xaa, 0x09, 0x63, 0x82, 0x89, 0x32, 0x91, 0x9a, 0x81, 0x18, 0x44, + 0xb8, 0x0c, 0x13, 0xaa, 0x52, 0xb8, 0x78, 0x27, 0xa0, 0x9a, 0x08, 0x51, 0x13, 0xca, 0x09, 0xb0, + 0xbe, 0x8a, 0xaa, 0x30, 0x03, 0x9b, 0x44, 0x81, 0x30, 0xa4, 0x9e, 0x63, 0xa0, 0xbd, 0x8a, 0x18, + 0x25, 0x91, 0x19, 0x15, 0xa8, 0x09, 0x91, 0x18, 0x16, 0xb8, 0x19, 0xa1, 0x1a, 0x16, 0xc9, 0x71, + 0x05, 0xa8, 0x8a, 0x10, 0x42, 0x92, 0xbb, 0x10, 0xf9, 0xac, 0x88, 0x9a, 0x31, 0x82, 0x0a, 0x33, + 0x89, 0x55, 0xc0, 0x1b, 0x26, 0xd8, 0x9c, 0x89, 0x20, 0x14, 0x98, 0x48, 0x03, 0xba, 0x20, 0xa8, + 0x58, 0x14, 0xaa, 0x08, 0xb9, 0x58, 0x85, 0x9b, 0x75, 0x82, 0xaa, 0x88, 0x11, 0x43, 0xb0, 0x8c, + 0x11, 0xdd, 0x9a, 0x90, 0x9a, 0x33, 0x92, 0x19, 0x82, 0x29, 0x47, 0xc9, 0x39, 0x15, 0xeb, 0x8b, + 0x88, 0x41, 0x02, 0x8a, 0x52, 0x91, 0x9b, 0x12, 0xa8, 0x50, 0x04, 0xaa, 0x90, 0xba, 0x72, 0x92, + 0x0b, 0x57, 0x91, 0x9b, 0x18, 0x21, 0x14, 0xc9, 0x1a, 0x91, 0xbf, 0x8a, 0x98, 0x0a, 0x24, 0x80, + 0x10, 0x98, 0x58, 0x15, 0xbb, 0x60, 0x93, 0xcd, 0x8a, 0x00, 0x32, 0x91, 0x09, 0x36, 0xa8, 0x0b, + 0x02, 0x99, 0x62, 0x02, 0x9a, 0xc9, 0x8b, 0x45, 0xa0, 0x49, 0x27, 0xb0, 0x9a, 0x20, 0x42, 0x82, + 0xbc, 0x28, 0xd0, 0xae, 0x09, 0xa9, 0x18, 0x23, 0x01, 0x81, 0x9b, 0x73, 0x84, 0x9b, 0x53, 0xb1, + 0xaf, 0x8a, 0x21, 0x22, 0xa8, 0x38, 0x17, 0xb9, 0x19, 0x82, 0x89, 0x53, 0x82, 0xa8, 0xcc, 0x2a, + 0x25, 0xa8, 0x61, 0x15, 0xb9, 0x8a, 0x31, 0x24, 0xa0, 0x9d, 0x11, 0xfa, 0xab, 0x88, 0x99, 0x28, + 0x33, 0x12, 0xb8, 0x0b, 0x57, 0x91, 0x0a, 0x24, 0xe8, 0xac, 0x09, 0x22, 0x02, 0x9a, 0x62, 0x02, + 0xab, 0x18, 0x81, 0x08, 0x34, 0x13, 0xea, 0xbd, 0x30, 0x14, 0x09, 0x73, 0x83, 0xba, 0x0a, 0x63, + 0x12, 0xba, 0x1b, 0x91, 0xdf, 0x9a, 0x88, 0x89, 0x10, 0x43, 0x02, 0xca, 0x39, 0x35, 0x98, 0x38, + 0x03, 0xed, 0x9c, 0x29, 0x32, 0xa0, 0x1a, 0x35, 0xa1, 0x9b, 0x10, 0x81, 0x20, 0x53, 0x24, 0xfb, + 0x9d, 0x31, 0x01, 0x28, 0x25, 0x81, 0xbb, 0x19, 0x37, 0x92, 0xac, 0x18, 0xc0, 0xcd, 0x99, 0x89, + 0x08, 0x10, 0x44, 0x92, 0xbb, 0x50, 0x13, 0x08, 0x22, 0xb0, 0xcf, 0xab, 0x40, 0x13, 0xba, 0x40, + 0x15, 0x99, 0x0a, 0x08, 0x01, 0x01, 0x61, 0x04, 0xec, 0x0a, 0x12, 0x01, 0x32, 0x14, 0xa8, 0xaa, + 0x48, 0x27, 0xb0, 0x9b, 0x02, 0xfb, 0xbb, 0xa9, 0x89, 0x00, 0x20, 0x47, 0xa1, 0x8c, 0x31, 0x01, + 0x21, 0x03, 0xcc, 0xcb, 0x8c, 0x51, 0x81, 0xaa, 0x53, 0x81, 0x99, 0x88, 0x08, 0x21, 0x80, 0x72, + 0x95, 0xbd, 0x19, 0x12, 0x30, 0x25, 0x91, 0x89, 0x99, 0x61, 0x15, 0xca, 0x09, 0x92, 0xbd, 0x9b, + 0xba, 0x19, 0x81, 0x50, 0x36, 0xb8, 0x0b, 0x33, 0x10, 0x54, 0xa0, 0xbc, 0xaa, 0x0b, 0x54, 0xa0, + 0x0b, 0x26, 0xa0, 0x09, 0x90, 0x09, 0x23, 0x98, 0x75, 0xa1, 0xae, 0x10, 0x00, 0x51, 0x03, 0xa8, + 0x08, 0x88, 0x72, 0x82, 0xac, 0x28, 0xb8, 0xae, 0xa9, 0xaa, 0x28, 0x80, 0x61, 0x15, 0xb9, 0x29, + 0x02, 0x30, 0x27, 0xc8, 0x9b, 0x99, 0x19, 0x24, 0xd9, 0x28, 0x15, 0x9a, 0x18, 0xa8, 0x29, 0x14, + 0x89, 0x36, 0xd0, 0x9d, 0x01, 0x00, 0x54, 0x81, 0xa9, 0x10, 0x00, 0x43, 0xb1, 0x9e, 0x11, 0xda, + 0xab, 0xa8, 0x9c, 0x20, 0x80, 0x72, 0x03, 0xba, 0x20, 0x81, 0x72, 0x14, 0xcb, 0x9a, 0x88, 0x20, + 0x83, 0xbc, 0x61, 0x82, 0xaa, 0x11, 0xb8, 0x48, 0x83, 0x29, 0x27, 0xda, 0x8b, 0x00, 0x48, 0x37, + 0xa1, 0x8b, 0x11, 0x21, 0x23, 0xfa, 0x8a, 0x82, 0xcd, 0x8a, 0xa9, 0x8b, 0x12, 0x00, 0x74, 0x81, + 0x8a, 0x10, 0x08, 0x55, 0x93, 0xcc, 0x09, 0x08, 0x11, 0x90, 0x8c, 0x43, 0xb1, 0x8a, 0x03, 0xbb, + 0x52, 0x82, 0x38, 0x06, 0xeb, 0x89, 0x88, 0x71, 0x15, 0xa8, 0x89, 0x21, 0x21, 0x82, 0xcc, 0x19, + 0xb1, 0xaf, 0x89, 0xb9, 0x0a, 0x12, 0x20, 0x45, 0x91, 0x0a, 0x80, 0x38, 0x77, 0xa1, 0xbb, 0x08, + 0x01, 0x11, 0xba, 0x2a, 0x16, 0xb8, 0x19, 0x82, 0x8c, 0x42, 0x81, 0x40, 0x91, 0xbc, 0x9a, 0x8b, + 0x77, 0x05, 0xa9, 0x19, 0x21, 0x12, 0xa8, 0x9c, 0x10, 0xea, 0x9c, 0x98, 0xaa, 0x19, 0x12, 0x21, + 0x25, 0x91, 0x00, 0xb9, 0x71, 0x47, 0xb8, 0x9c, 0x18, 0x11, 0x91, 0xab, 0x40, 0x02, 0xbb, 0x30, + 0xa1, 0x0a, 0x34, 0x11, 0x22, 0xc8, 0xac, 0xeb, 0x3b, 0x77, 0x83, 0xaa, 0x29, 0x43, 0x01, 0xca, + 0x89, 0x91, 0xdc, 0x9a, 0x99, 0xaa, 0x10, 0x22, 0x33, 0x23, 0x31, 0xa2, 0xaf, 0x75, 0x04, 0xc9, + 0x9b, 0x21, 0x12, 0xb9, 0x8b, 0x43, 0xa0, 0x8c, 0x21, 0x98, 0x18, 0x32, 0x23, 0xb0, 0x8b, 0xa1, + 0xff, 0x5a, 0x27, 0x91, 0x9b, 0x38, 0x25, 0xa1, 0xab, 0x19, 0xc0, 0xbd, 0x9a, 0xa8, 0x9a, 0x10, + 0x43, 0x13, 0x10, 0x35, 0xc0, 0x1c, 0x56, 0x92, 0xda, 0x99, 0x32, 0x02, 0xbc, 0x29, 0x03, 0xb9, + 0x1a, 0x11, 0x08, 0x00, 0x61, 0x13, 0xdb, 0x38, 0xb2, 0xcf, 0x71, 0x13, 0xa0, 0x9b, 0x51, 0x24, + 0xb8, 0x8c, 0x00, 0xc9, 0x9c, 0x89, 0x99, 0x98, 0x18, 0x34, 0x92, 0x39, 0x27, 0xb9, 0x39, 0x37, + 0xa1, 0xbc, 0x0b, 0x44, 0xa2, 0xac, 0x30, 0x91, 0x9b, 0x10, 0x08, 0x11, 0x88, 0x71, 0x93, 0xbc, + 0x42, 0xc1, 0x8d, 0x54, 0x02, 0x99, 0x9a, 0x63, 0x04, 0xc9, 0x09, 0x91, 0xcb, 0x9a, 0xa8, 0x89, + 0x90, 0x28, 0x26, 0xa0, 0x58, 0x14, 0xba, 0x60, 0x13, 0xa9, 0xbc, 0x29, 0x45, 0xb0, 0x9c, 0x22, + 0xb0, 0x8a, 0x01, 0x08, 0x12, 0x99, 0x73, 0xc2, 0x8c, 0x33, 0xd8, 0x2b, 0x27, 0x81, 0x99, 0x09, + 0x64, 0x82, 0xcb, 0x18, 0xa0, 0xad, 0x89, 0x99, 0x08, 0x90, 0x38, 0x16, 0xa9, 0x61, 0x83, 0x9b, + 0x53, 0x82, 0xba, 0xbb, 0x58, 0x17, 0xb9, 0x0a, 0x13, 0xca, 0x19, 0x80, 0x28, 0x03, 0x8b, 0x36, + 0xe8, 0x1b, 0x24, 0xc9, 0x38, 0x25, 0x98, 0x98, 0x18, 0x57, 0x90, 0xab, 0x10, 0xd8, 0xab, 0x98, + 0x99, 0x10, 0x99, 0x61, 0x83, 0xab, 0x55, 0xa2, 0x09, 0x43, 0xa0, 0x9b, 0x9b, 0x71, 0x14, 0xdb, + 0x18, 0x82, 0xab, 0x18, 0x80, 0x20, 0x83, 0x2b, 0x26, 0xdc, 0x39, 0x04, 0xaa, 0x61, 0x02, 0x99, + 0x80, 0x40, 0x27, 0xc0, 0x9a, 0x01, 0xdb, 0x9a, 0x98, 0x8a, 0x11, 0x89, 0x62, 0x91, 0x1b, 0x46, + 0xa0, 0x28, 0x13, 0xba, 0x9a, 0x89, 0x65, 0x82, 0xad, 0x30, 0xb0, 0x9c, 0x01, 0x88, 0x32, 0x91, + 0x39, 0x85, 0xaf, 0x30, 0x83, 0x8a, 0x36, 0xa0, 0x09, 0x11, 0x73, 0x24, 0xda, 0x89, 0xa1, 0xbd, + 0x9a, 0xa8, 0x09, 0x02, 0x88, 0x35, 0xb8, 0x5a, 0x26, 0x88, 0x30, 0xa2, 0xac, 0x08, 0x10, 0x36, + 0xb1, 0x9d, 0x22, 0xea, 0x0a, 0x00, 0x08, 0x32, 0x90, 0x30, 0xd2, 0x9e, 0x32, 0x82, 0x38, 0x15, + 0xba, 0x39, 0x34, 0x45, 0x83, 0xbc, 0x09, 0xfa, 0xbc, 0x89, 0x99, 0x18, 0x01, 0x28, 0x13, 0xc9, + 0x71, 0x23, 0x10, 0x14, 0xc9, 0x8c, 0x20, 0x31, 0x15, 0xb9, 0x1a, 0x92, 0xcf, 0x09, 0x81, 0x18, + 0x23, 0x80, 0x11, 0xfa, 0x8a, 0x24, 0x11, 0x53, 0xa1, 0xad, 0x31, 0x44, 0x22, 0xb0, 0xab, 0xa8, + 0xef, 0x9b, 0x89, 0x89, 0x10, 0x01, 0x11, 0x81, 0x0a, 0x55, 0x22, 0x52, 0x92, 0xcc, 0x0a, 0x42, + 0x22, 0x91, 0x9a, 0x12, 0xf9, 0xac, 0x08, 0x80, 0x21, 0x22, 0x10, 0xb0, 0xae, 0x18, 0x23, 0x55, + 0x14, 0xd9, 0x8a, 0x51, 0x33, 0x81, 0xaa, 0x08, 0xfa, 0xbd, 0x9a, 0x99, 0x09, 0x11, 0x21, 0x02, + 0x9a, 0x50, 0x23, 0x54, 0x35, 0xb8, 0xbd, 0x28, 0x53, 0x12, 0x9a, 0x28, 0x92, 0xbe, 0x8b, 0x98, + 0x18, 0x22, 0x33, 0x12, 0xed, 0x0a, 0x11, 0x28, 0x67, 0x81, 0xbb, 0x09, 0x63, 0x23, 0xb8, 0x0a, + 0x01, 0xde, 0xaa, 0xa9, 0x99, 0x10, 0x10, 0x33, 0xa0, 0x0c, 0x34, 0x81, 0x75, 0x13, 0xca, 0xab, + 0x31, 0x35, 0x92, 0x9b, 0x42, 0xc1, 0xad, 0x88, 0x98, 0x10, 0x02, 0x22, 0xa3, 0xbf, 0x20, 0xa1, + 0x58, 0x37, 0xa0, 0xac, 0x18, 0x63, 0x12, 0xba, 0x29, 0xa2, 0xcf, 0x8a, 0x99, 0x09, 0x00, 0x11, + 0x23, 0xc9, 0x29, 0x15, 0x09, 0x66, 0x92, 0xca, 0x89, 0x21, 0x25, 0xb0, 0x0a, 0x24, 0xc9, 0x9b, + 0x90, 0x89, 0x21, 0x10, 0x52, 0xc0, 0x9d, 0x31, 0xa8, 0x70, 0x15, 0xb8, 0xab, 0x20, 0x45, 0x92, + 0xab, 0x30, 0xd1, 0xbd, 0x89, 0x99, 0x19, 0x01, 0x30, 0x14, 0xcb, 0x58, 0x82, 0x19, 0x47, 0xa1, + 0xac, 0x09, 0x42, 0x23, 0xc9, 0x29, 0x14, 0xdb, 0x89, 0x90, 0x09, 0x11, 0x00, 0x43, 0xe9, 0x0b, + 0x13, 0xaa, 0x73, 0x07, 0xaa, 0x89, 0x20, 0x34, 0xb1, 0x9c, 0x32, 0xe9, 0xab, 0x98, 0xa9, 0x10, + 0x01, 0x51, 0x92, 0x9c, 0x51, 0xa1, 0x38, 0x47, 0xb8, 0xab, 0x18, 0x63, 0x02, 0xba, 0x40, 0x93, + 0xbc, 0x09, 0xa8, 0x19, 0x02, 0x30, 0x15, 0xec, 0x19, 0x02, 0x8a, 0x56, 0x92, 0xbb, 0x89, 0x42, + 0x25, 0xb9, 0x0b, 0x23, 0xec, 0x8b, 0x98, 0x99, 0x11, 0x00, 0x43, 0xb1, 0x8c, 0x34, 0xa8, 0x70, + 0x15, 0xc9, 0x9a, 0x10, 0x44, 0x91, 0x9a, 0x32, 0xb2, 0xae, 0x08, 0x99, 0x10, 0x00, 0x31, 0x93, + 0xcf, 0x20, 0x91, 0x29, 0x47, 0xa1, 0xbb, 0x09, 0x44, 0x13, 0xda, 0x19, 0x82, 0xcd, 0x99, 0x98, + 0x88, 0x01, 0x11, 0x24, 0xb9, 0x2b, 0x15, 0x89, 0x74, 0x03, 0xbc, 0x9a, 0x41, 0x34, 0xa0, 0x0b, + 0x34, 0xc9, 0xab, 0x88, 0x99, 0x20, 0x10, 0x42, 0xd1, 0x9d, 0x30, 0x90, 0x78, 0x25, 0xb8, 0xbb, + 0x20, 0x45, 0x81, 0xbb, 0x20, 0xb0, 0xbf, 0x8a, 0x99, 0x19, 0x11, 0x41, 0x03, 0xbb, 0x49, 0x04, + 0x29, 0x57, 0x91, 0xcb, 0x0a, 0x52, 0x23, 0xa9, 0x29, 0x13, 0xea, 0x9a, 0x99, 0x88, 0x10, 0x20, + 0x23, 0xfa, 0x8c, 0x12, 0x08, 0x64, 0x04, 0xb9, 0xab, 0x41, 0x25, 0xa1, 0x9c, 0x10, 0xc9, 0xbc, + 0xa9, 0x89, 0x18, 0x21, 0x53, 0x92, 0xab, 0x32, 0x82, 0x72, 0x27, 0xa8, 0xac, 0x19, 0x63, 0x12, + 0x9a, 0x20, 0x82, 0xdb, 0x9a, 0x99, 0x08, 0x00, 0x32, 0x83, 0xce, 0x09, 0x01, 0x41, 0x37, 0x83, + 0xcb, 0x9b, 0x62, 0x14, 0xa9, 0x8a, 0x80, 0xeb, 0xab, 0x9b, 0x09, 0x00, 0x32, 0x26, 0x98, 0x0a, + 0x02, 0x20, 0x57, 0x02, 0xb9, 0xbc, 0x38, 0x37, 0x81, 0x09, 0x11, 0xa0, 0xbb, 0xad, 0x8a, 0x80, + 0x08, 0x34, 0xc0, 0xac, 0x10, 0x08, 0x75, 0x23, 0x91, 0xca, 0x8a, 0x54, 0x02, 0xaa, 0x88, 0xca, + 0xcb, 0xcb, 0xab, 0x00, 0x10, 0x62, 0x03, 0xa9, 0x11, 0x90, 0x70, 0x25, 0x91, 0xaa, 0xac, 0x61, + 0x33, 0x88, 0x20, 0x91, 0xaa, 0xba, 0xbf, 0x09, 0x80, 0x29, 0x15, 0xca, 0x1a, 0x90, 0x4a, 0x57, + 0x01, 0x88, 0xa9, 0x19, 0x35, 0xa0, 0x89, 0xa0, 0xbf, 0xa9, 0xda, 0x9a, 0x01, 0x10, 0x53, 0x91, + 0x09, 0x12, 0x9b, 0x75, 0x03, 0x99, 0xa9, 0x8a, 0x64, 0x02, 0x18, 0x22, 0xc8, 0x8a, 0xc0, 0xad, + 0x00, 0x98, 0x30, 0x93, 0xae, 0x11, 0xb8, 0x78, 0x26, 0x90, 0x88, 0x98, 0x20, 0x15, 0xaa, 0x10, + 0xe8, 0xac, 0x89, 0xdb, 0x09, 0x00, 0x20, 0x24, 0xa8, 0x38, 0xa3, 0x0d, 0x47, 0x91, 0x9a, 0x90, + 0x18, 0x35, 0x91, 0x40, 0x04, 0xcb, 0x08, 0xc0, 0xab, 0x00, 0x98, 0x32, 0xe1, 0x8b, 0x23, 0xbc, + 0x73, 0x17, 0x99, 0x80, 0x80, 0x21, 0x91, 0x8b, 0x23, 0xfc, 0x8d, 0x90, 0xaa, 0x08, 0x81, 0x31, + 0x04, 0x9a, 0x52, 0xb0, 0x3b, 0x47, 0xb0, 0x8a, 0x81, 0x21, 0x15, 0x89, 0x72, 0x92, 0xbb, 0x10, + 0xc8, 0x9b, 0x80, 0x88, 0x13, 0xfb, 0x29, 0x83, 0x9c, 0x66, 0x82, 0x9a, 0x10, 0x00, 0x12, 0xc9, + 0x2a, 0x04, 0xde, 0x0a, 0x90, 0xaa, 0x18, 0x10, 0x41, 0x92, 0x1b, 0x34, 0xd9, 0x58, 0x15, 0xaa, + 0x0a, 0x11, 0x32, 0x82, 0x1b, 0x67, 0xa0, 0x9b, 0x11, 0xc9, 0x0a, 0x88, 0x18, 0x81, 0xbd, 0x50, + 0xa1, 0x1a, 0x57, 0x91, 0x8a, 0x10, 0x12, 0x81, 0xcc, 0x30, 0xb2, 0xcf, 0x09, 0x90, 0x9a, 0x10, + 0x10, 0x33, 0xb8, 0x49, 0x15, 0xbb, 0x73, 0x84, 0xbb, 0x18, 0x32, 0x23, 0xc8, 0x48, 0x27, 0xc8, + 0x8a, 0x01, 0xb9, 0x89, 0x88, 0x10, 0xc8, 0x8d, 0x32, 0xc0, 0x68, 0x25, 0xa8, 0x8a, 0x32, 0x23, + 0xc8, 0x9e, 0x31, 0xc0, 0xae, 0x08, 0x98, 0x99, 0x10, 0x21, 0x13, 0xaa, 0x71, 0x82, 0x8b, 0x55, + 0xa1, 0xac, 0x10, 0x34, 0x01, 0xab, 0x71, 0x13, 0xca, 0x0a, 0x01, 0xba, 0x99, 0x08, 0x01, 0xdc, + 0x1a, 0x14, 0x99, 0x72, 0x15, 0xaa, 0x09, 0x53, 0x02, 0xda, 0x0a, 0x22, 0xea, 0x9c, 0x80, 0x90, + 0x89, 0x10, 0x32, 0x91, 0x0a, 0x45, 0xa0, 0x29, 0x27, 0xc8, 0xab, 0x41, 0x34, 0xa0, 0x8b, 0x54, + 0x82, 0xbb, 0x19, 0x81, 0xba, 0x9b, 0x10, 0xc0, 0xbe, 0x30, 0x83, 0x1a, 0x67, 0x01, 0xab, 0x28, + 0x45, 0x91, 0xdb, 0x19, 0x02, 0xdb, 0x9b, 0x08, 0x88, 0x89, 0x30, 0x24, 0xb8, 0x38, 0x16, 0x98, + 0x51, 0x03, 0xfb, 0x8b, 0x62, 0x23, 0xb9, 0x1a, 0x36, 0x90, 0xab, 0x08, 0x81, 0xb9, 0x8c, 0x10, + 0xe9, 0x9b, 0x32, 0x80, 0x60, 0x25, 0x90, 0x9c, 0x48, 0x35, 0xb0, 0xad, 0x20, 0x90, 0xcc, 0x9a, + 0x00, 0x08, 0x89, 0x41, 0x83, 0xaa, 0x62, 0x82, 0x08, 0x34, 0xb1, 0xce, 0x0a, 0x45, 0x03, 0xba, + 0x48, 0x14, 0x98, 0x9a, 0x88, 0x01, 0xca, 0x8a, 0x01, 0xce, 0x09, 0x12, 0x08, 0x54, 0x03, 0xa9, + 0x9b, 0x72, 0x26, 0xb9, 0x9c, 0x11, 0xb8, 0xbb, 0xab, 0x18, 0x82, 0x0a, 0x64, 0xa1, 0x0a, 0x34, + 0x90, 0x50, 0x03, 0xda, 0xbb, 0x3a, 0x77, 0x81, 0x9a, 0x21, 0x02, 0x98, 0xa9, 0x09, 0x11, 0xdb, + 0x09, 0xb1, 0xaf, 0x28, 0x81, 0x30, 0x27, 0x91, 0xa9, 0x09, 0x74, 0x13, 0xeb, 0x89, 0x81, 0xa9, + 0xaa, 0x9b, 0x20, 0x92, 0x19, 0x35, 0xc8, 0x39, 0x14, 0x88, 0x54, 0x91, 0xad, 0x9a, 0x40, 0x37, + 0xa0, 0x8a, 0x33, 0x91, 0x88, 0xb9, 0x0a, 0x04, 0xcc, 0x08, 0xd8, 0xac, 0x22, 0x88, 0x72, 0x23, + 0xa9, 0x8a, 0x18, 0x57, 0x92, 0xcb, 0x09, 0xa0, 0xaa, 0xb9, 0x9c, 0x31, 0x92, 0x39, 0x15, 0xca, + 0x41, 0x82, 0x29, 0x27, 0xc8, 0xab, 0x89, 0x72, 0x24, 0xa8, 0x19, 0x13, 0x98, 0x01, 0xca, 0x2a, + 0x83, 0xbd, 0x08, 0xfb, 0x8b, 0x12, 0x88, 0x56, 0x82, 0xaa, 0x80, 0x31, 0x46, 0xb1, 0xac, 0x08, + 0xba, 0x8b, 0xb9, 0x8e, 0x22, 0x81, 0x38, 0x93, 0x9c, 0x63, 0x90, 0x50, 0x14, 0xeb, 0x8a, 0x00, + 0x52, 0x04, 0x99, 0x20, 0x81, 0x09, 0x02, 0xcb, 0x28, 0x92, 0xad, 0x98, 0xce, 0x08, 0x82, 0x39, + 0x47, 0x90, 0x9a, 0x10, 0x41, 0x24, 0xc8, 0xab, 0xa0, 0xcc, 0x08, 0xb9, 0x8b, 0x34, 0x00, 0x30, + 0xb0, 0x2b, 0x26, 0x99, 0x65, 0x92, 0xbd, 0x09, 0x20, 0x44, 0x02, 0x8a, 0x22, 0xa8, 0x38, 0x83, + 0xbe, 0x30, 0x91, 0xac, 0xda, 0xad, 0x20, 0x88, 0x70, 0x15, 0xb8, 0x89, 0x21, 0x42, 0x03, 0xcb, + 0x9a, 0xe9, 0xab, 0x18, 0xca, 0x1a, 0x24, 0x10, 0x00, 0xa9, 0x58, 0x02, 0x2a, 0x67, 0xb0, 0xac, + 0x18, 0x31, 0x43, 0x80, 0x28, 0x82, 0xba, 0x61, 0x81, 0x9c, 0x20, 0x90, 0xba, 0xce, 0x8b, 0x01, + 0x89, 0x75, 0x03, 0xba, 0x1a, 0x42, 0x23, 0x91, 0xac, 0xa8, 0xde, 0x8a, 0x00, 0xaa, 0x18, 0x33, + 0x12, 0xa0, 0x8b, 0x44, 0x90, 0x70, 0x16, 0xc9, 0xab, 0x20, 0x43, 0x12, 0x80, 0x32, 0xa0, 0x9d, + 0x43, 0xa1, 0x9b, 0x30, 0x91, 0xfc, 0xac, 0x09, 0x80, 0x29, 0x57, 0x91, 0xaa, 0x18, 0x43, 0x03, + 0xa9, 0x89, 0xe9, 0xbd, 0x0a, 0x80, 0xa9, 0x28, 0x34, 0x03, 0xbb, 0x29, 0x15, 0x89, 0x65, 0x03, + 0xdc, 0x9a, 0x31, 0x24, 0x80, 0x20, 0x14, 0xba, 0x1b, 0x24, 0x90, 0x9b, 0x30, 0x92, 0xff, 0x9a, + 0x18, 0x89, 0x50, 0x34, 0xa8, 0xab, 0x48, 0x35, 0x91, 0x9a, 0x00, 0xfb, 0xad, 0x08, 0x80, 0x99, + 0x10, 0x34, 0x81, 0x9c, 0x30, 0x81, 0x29, 0x47, 0xa1, 0xcc, 0x0a, 0x42, 0x13, 0x89, 0x52, 0x82, + 0xbb, 0x29, 0x23, 0x90, 0xab, 0x41, 0xb3, 0xff, 0x8a, 0x80, 0x89, 0x63, 0x03, 0xb8, 0xaa, 0x52, + 0x15, 0xa8, 0x09, 0x92, 0xed, 0x9a, 0x08, 0x80, 0x88, 0x10, 0x35, 0xb0, 0x8b, 0x33, 0xa8, 0x60, + 0x25, 0xb9, 0xad, 0x1a, 0x44, 0x82, 0x89, 0x44, 0xa1, 0xab, 0x20, 0x12, 0x80, 0xba, 0x61, 0xb1, + 0xcf, 0x09, 0x80, 0x09, 0x45, 0x81, 0x9a, 0x8a, 0x63, 0x13, 0xca, 0x28, 0xa1, 0xcf, 0x89, 0x08, + 0x00, 0x88, 0x38, 0x34, 0xc9, 0x09, 0x13, 0x99, 0x73, 0x83, 0xcb, 0xab, 0x38, 0x37, 0xa0, 0x29, + 0x26, 0xb8, 0x9a, 0x21, 0x11, 0x91, 0x9b, 0x52, 0xf0, 0xac, 0x00, 0xa8, 0x30, 0x26, 0xa0, 0x99, + 0x19, 0x64, 0x82, 0x9c, 0x20, 0xc0, 0xbd, 0x89, 0x08, 0x10, 0x88, 0x50, 0x04, 0xb9, 0x39, 0x82, + 0x0a, 0x37, 0xb1, 0xcb, 0x9a, 0x50, 0x25, 0xa9, 0x40, 0x14, 0xba, 0x0a, 0x11, 0x21, 0xa2, 0x9b, + 0x34, 0xfb, 0x8f, 0x80, 0x98, 0x41, 0x03, 0xa9, 0x89, 0x38, 0x37, 0xa0, 0x9c, 0x23, 0xfa, 0xab, + 0x89, 0x08, 0x11, 0x98, 0x62, 0x83, 0xab, 0x30, 0xa1, 0x48, 0x27, 0xb9, 0xab, 0x8a, 0x73, 0x04, + 0x9a, 0x51, 0x83, 0xba, 0x09, 0x01, 0x33, 0xb1, 0x0c, 0x04, 0xdd, 0x0b, 0x90, 0x89, 0x45, 0x92, + 0x9a, 0x08, 0x41, 0x26, 0xc9, 0x1a, 0x02, 0xdc, 0xab, 0x98, 0x10, 0x12, 0x89, 0x73, 0x91, 0x8a, + 0x21, 0x99, 0x71, 0x03, 0xdb, 0x99, 0x18, 0x63, 0x81, 0x8a, 0x44, 0xa2, 0xaa, 0x08, 0x28, 0x43, + 0xb0, 0x1a, 0xa3, 0xdf, 0x89, 0x98, 0x28, 0x26, 0xa0, 0x8a, 0x10, 0x63, 0x03, 0xdb, 0x29, 0xa2, + 0xce, 0x9a, 0x89, 0x20, 0x02, 0x08, 0x34, 0xa0, 0x1a, 0x82, 0x0a, 0x67, 0xa1, 0xbb, 0x89, 0x31, + 0x26, 0xa0, 0x29, 0x37, 0x98, 0x9a, 0x88, 0x38, 0x24, 0xa8, 0x19, 0xd8, 0xbd, 0x98, 0xa9, 0x71, + 0x04, 0xa9, 0x09, 0x31, 0x44, 0xa1, 0xac, 0x11, 0xd0, 0xbd, 0xaa, 0x99, 0x32, 0x03, 0x10, 0x24, + 0x98, 0x10, 0xa8, 0x78, 0x26, 0xc8, 0xab, 0x18, 0x42, 0x13, 0xa9, 0x71, 0x23, 0xa9, 0xa9, 0x89, + 0x51, 0x14, 0x98, 0x99, 0xca, 0x9c, 0xaa, 0x0b, 0x56, 0x82, 0xbb, 0x28, 0x44, 0x13, 0xc9, 0x8a, + 0x01, 0xdc, 0xbc, 0xba, 0x0a, 0x43, 0x12, 0x20, 0x01, 0x10, 0x81, 0xab, 0x75, 0x04, 0xda, 0x9a, + 0x21, 0x43, 0x80, 0x1a, 0x44, 0x82, 0x98, 0xa9, 0x8b, 0x54, 0x12, 0x90, 0xca, 0xab, 0xa9, 0xbe, + 0x49, 0x26, 0xa8, 0x9a, 0x30, 0x36, 0x91, 0xba, 0x18, 0xb8, 0xbf, 0xbb, 0xad, 0x19, 0x33, 0x23, + 0x01, 0x09, 0x34, 0xc0, 0x1b, 0x57, 0x90, 0xcb, 0x89, 0x42, 0x13, 0xa9, 0x40, 0x24, 0x88, 0x00, + 0xba, 0x1b, 0x45, 0x22, 0xa0, 0xbe, 0x09, 0xb8, 0xae, 0x51, 0x03, 0xb9, 0x8a, 0x62, 0x24, 0xb8, + 0x8a, 0x01, 0xeb, 0x9b, 0xcb, 0xac, 0x10, 0x42, 0x22, 0xa0, 0x39, 0x25, 0xc9, 0x49, 0x15, 0xb9, + 0xbb, 0x29, 0x55, 0x91, 0x8a, 0x43, 0x82, 0x09, 0x02, 0xcb, 0x29, 0x43, 0x33, 0xd0, 0xae, 0x28, + 0xc8, 0x8c, 0x53, 0x91, 0xaa, 0x19, 0x73, 0x12, 0xca, 0x08, 0x91, 0xbc, 0x99, 0xda, 0x9b, 0x20, + 0x52, 0x13, 0xb9, 0x58, 0x13, 0xac, 0x51, 0x83, 0xcb, 0x9b, 0x40, 0x25, 0xb0, 0x1a, 0x35, 0x98, + 0x29, 0x82, 0xbb, 0x38, 0x53, 0x34, 0xf9, 0x9b, 0x11, 0xd9, 0x1a, 0x25, 0xb8, 0x9a, 0x20, 0x46, + 0x81, 0xac, 0x20, 0xc0, 0xac, 0x80, 0xca, 0x8a, 0x20, 0x43, 0x04, 0xab, 0x51, 0x93, 0x9b, 0x54, + 0x90, 0xac, 0x89, 0x51, 0x23, 0xca, 0x38, 0x15, 0x9a, 0x20, 0x92, 0xab, 0x11, 0x52, 0x24, 0xfb, + 0x8a, 0x02, 0xca, 0x38, 0x05, 0xba, 0x89, 0x31, 0x37, 0xb0, 0x9c, 0x12, 0xe9, 0x8b, 0x80, 0xcb, + 0x09, 0x20, 0x63, 0x92, 0x9b, 0x53, 0xa1, 0x1a, 0x25, 0xc8, 0xab, 0x18, 0x63, 0x83, 0xbb, 0x61, + 0x82, 0x9a, 0x32, 0xa1, 0x8b, 0x10, 0x63, 0x04, 0xcd, 0x19, 0x82, 0x9c, 0x41, 0x91, 0xbb, 0x19, + 0x63, 0x24, 0xd9, 0x0a, 0x02, 0xcc, 0x0a, 0x90, 0xab, 0x09, 0x30, 0x37, 0xa0, 0x1b, 0x34, 0xb0, + 0x48, 0x04, 0xdb, 0x8b, 0x20, 0x35, 0xa2, 0x9c, 0x63, 0xa1, 0x0a, 0x22, 0xa0, 0x09, 0x18, 0x73, + 0x92, 0xae, 0x18, 0x91, 0x0b, 0x53, 0xb8, 0x9d, 0x10, 0x44, 0x02, 0xdb, 0x29, 0xa1, 0xbd, 0x09, + 0x98, 0xab, 0x88, 0x52, 0x25, 0xb8, 0x29, 0x15, 0x98, 0x41, 0xa2, 0xcd, 0x09, 0x31, 0x25, 0xb8, + 0x1a, 0x35, 0xb8, 0x1a, 0x24, 0x98, 0x89, 0x28, 0x45, 0xc1, 0x9d, 0x10, 0xa0, 0x28, 0x13, 0xfb, + 0x8b, 0x31, 0x45, 0xa1, 0xac, 0x20, 0xc8, 0xad, 0x08, 0x98, 0x99, 0x09, 0x62, 0x13, 0xb9, 0x40, + 0x03, 0x18, 0x43, 0xe8, 0xac, 0x19, 0x53, 0x13, 0xba, 0x38, 0x15, 0xba, 0x38, 0x33, 0x88, 0xaa, + 0x68, 0x25, 0xd9, 0x8b, 0x10, 0x88, 0x41, 0xa1, 0xbe, 0x8a, 0x63, 0x24, 0xb9, 0x8b, 0x00, 0xfb, + 0xab, 0x80, 0x88, 0xa9, 0x09, 0x46, 0x82, 0x99, 0x31, 0x11, 0x42, 0x03, 0xde, 0xaa, 0x30, 0x44, + 0x92, 0x9a, 0x42, 0x81, 0x9b, 0x30, 0x33, 0x91, 0xbb, 0x72, 0x85, 0xba, 0x0b, 0x88, 0x40, 0x24, + 0xea, 0xac, 0x18, 0x54, 0x02, 0xba, 0x0a, 0xa0, 0xce, 0x8a, 0x09, 0x80, 0xa9, 0x28, 0x36, 0x80, + 0x08, 0x12, 0x41, 0x35, 0xc0, 0xbd, 0x8a, 0x51, 0x24, 0x98, 0x19, 0x22, 0xa8, 0x0a, 0x30, 0x44, + 0x91, 0x9b, 0x63, 0xa1, 0xab, 0xa8, 0x0b, 0x66, 0x92, 0xbc, 0xab, 0x30, 0x47, 0x90, 0xaa, 0x00, + 0xca, 0xac, 0x9a, 0x09, 0x01, 0xba, 0x60, 0x23, 0x08, 0x12, 0x88, 0x73, 0x17, 0xba, 0xab, 0x09, + 0x54, 0x03, 0x9a, 0x30, 0x82, 0xaa, 0x00, 0x20, 0x36, 0xa1, 0x0b, 0x24, 0xb9, 0x09, 0xf9, 0x2a, + 0x47, 0xa8, 0xac, 0x99, 0x51, 0x23, 0xc8, 0x0a, 0x90, 0xbd, 0xaa, 0xaa, 0x29, 0x83, 0xab, 0x63, + 0x02, 0x48, 0x03, 0x8b, 0x67, 0x82, 0xac, 0x9a, 0x18, 0x35, 0x92, 0x8a, 0x33, 0xc0, 0x0a, 0x82, + 0x28, 0x36, 0xa0, 0x1a, 0x82, 0x9c, 0x22, 0xfc, 0x48, 0x15, 0xc9, 0xaa, 0x08, 0x52, 0x02, 0xbb, + 0x10, 0xd8, 0xad, 0x98, 0xa9, 0x20, 0x82, 0x8a, 0x33, 0x98, 0x74, 0xa2, 0x1a, 0x47, 0xb1, 0xbb, + 0x8a, 0x31, 0x27, 0xa8, 0x28, 0x13, 0xbb, 0x39, 0x91, 0x49, 0x17, 0x98, 0x18, 0xb8, 0x19, 0x05, + 0xad, 0x71, 0x83, 0xcb, 0x8a, 0x18, 0x53, 0xa1, 0xab, 0x12, 0xfb, 0x9b, 0x98, 0x9a, 0x40, 0x81, + 0x19, 0x81, 0x19, 0x37, 0xb0, 0x5a, 0x27, 0xb9, 0xab, 0x08, 0x42, 0x04, 0x99, 0x40, 0x93, 0xac, + 0x21, 0x98, 0x30, 0x16, 0x98, 0x80, 0xca, 0x40, 0xa3, 0x9e, 0x54, 0x91, 0xac, 0x89, 0x11, 0x14, + 0xb8, 0x0b, 0x83, 0xcf, 0x0a, 0x98, 0x99, 0x32, 0x81, 0x18, 0xa8, 0x5a, 0x17, 0xa8, 0x68, 0x13, + 0xda, 0x9a, 0x10, 0x42, 0x81, 0x8a, 0x34, 0xb0, 0x9c, 0x22, 0x98, 0x60, 0x12, 0x88, 0xa8, 0x9d, + 0x52, 0xa0, 0x1b, 0x37, 0xb0, 0xad, 0x09, 0x32, 0x02, 0xdb, 0x18, 0xb2, 0xcf, 0x88, 0x90, 0x0a, + 0x22, 0x01, 0x80, 0xba, 0x70, 0x14, 0x9a, 0x72, 0x82, 0xdb, 0x89, 0x21, 0x32, 0xa8, 0x29, 0x26, + 0xc9, 0x0a, 0x12, 0x89, 0x32, 0x14, 0x80, 0xeb, 0x0a, 0x34, 0xb9, 0x59, 0x25, 0xd9, 0x9b, 0x18, + 0x33, 0xa1, 0xad, 0x21, 0xe9, 0xac, 0x88, 0x98, 0x19, 0x32, 0x12, 0xb8, 0x9d, 0x73, 0x82, 0x09, + 0x54, 0x90, 0xad, 0x09, 0x32, 0x13, 0xaa, 0x51, 0x03, 0xdb, 0x19, 0x02, 0x09, 0x43, 0x23, 0xa0, + 0xbf, 0x29, 0x15, 0xa9, 0x51, 0x13, 0xcc, 0x9b, 0x30, 0x14, 0xc9, 0x8a, 0x12, 0xec, 0x9b, 0x88, + 0x98, 0x18, 0x33, 0x14, 0xda, 0x0a, 0x44, 0x91, 0x28, 0x25, 0xc8, 0xac, 0x29, 0x34, 0x92, 0x8a, + 0x63, 0x91, 0xbb, 0x10, 0x01, 0x18, 0x53, 0x24, 0xd0, 0xac, 0x30, 0x83, 0x88, 0x45, 0x91, 0xbd, + 0x8b, 0x43, 0x82, 0xbc, 0x29, 0xa1, 0xcf, 0x8a, 0x88, 0x09, 0x18, 0x53, 0x82, 0xcb, 0x29, 0x25, + 0x08, 0x31, 0x04, 0xdb, 0x9c, 0x30, 0x25, 0xa8, 0x18, 0x25, 0xa8, 0x9b, 0x00, 0x11, 0x10, 0x72, + 0x14, 0xe9, 0x8a, 0x21, 0x81, 0x21, 0x14, 0xb8, 0xbe, 0x09, 0x34, 0xc1, 0x9c, 0x10, 0xc8, 0xad, + 0x8a, 0x89, 0x00, 0x10, 0x45, 0x91, 0xac, 0x30, 0x12, 0x21, 0x34, 0xa0, 0xcd, 0x9a, 0x72, 0x12, + 0xaa, 0x41, 0x03, 0xba, 0x99, 0x00, 0x21, 0x01, 0x73, 0x06, 0xda, 0x1a, 0x11, 0x10, 0x33, 0x92, + 0xcb, 0xbc, 0x39, 0x17, 0xc9, 0x0b, 0x01, 0xeb, 0xab, 0xa9, 0x08, 0x01, 0x38, 0x47, 0xb0, 0x9b, + 0x22, 0x02, 0x63, 0x02, 0xba, 0xbb, 0x0a, 0x57, 0x81, 0x8b, 0x53, 0x80, 0x9a, 0x88, 0x09, 0x32, + 0x08, 0x74, 0x82, 0xbd, 0x18, 0x01, 0x41, 0x14, 0xa8, 0x9b, 0xab, 0x60, 0x83, 0xcd, 0x19, 0xa1, + 0xcc, 0x99, 0xaa, 0x28, 0x81, 0x50, 0x25, 0xb9, 0x0b, 0x22, 0x20, 0x47, 0xa0, 0xaa, 0x98, 0x39, + 0x36, 0xb0, 0x2a, 0x26, 0xa8, 0x89, 0x98, 0x19, 0x24, 0x09, 0x46, 0xb1, 0xad, 0x10, 0x00, 0x54, + 0x02, 0xba, 0x8a, 0x89, 0x52, 0xb1, 0xaf, 0x10, 0xc8, 0x9c, 0x99, 0x9a, 0x20, 0x81, 0x61, 0x14, + 0xca, 0x08, 0x01, 0x40, 0x16, 0xb8, 0x8b, 0x80, 0x40, 0x14, 0xb9, 0x58, 0x13, 0xab, 0x18, 0xb9, + 0x38, 0x06, 0x18, 0x35, 0xd8, 0x9b, 0x01, 0x28, 0x57, 0x91, 0x9b, 0x88, 0x00, 0x32, 0xfa, 0x9b, + 0x01, 0xea, 0x9a, 0x99, 0x8b, 0x31, 0x00, 0x73, 0x83, 0xab, 0x18, 0x90, 0x74, 0x04, 0xca, 0x09, + 0x00, 0x32, 0x82, 0xab, 0x73, 0x92, 0x8b, 0x01, 0xba, 0x40, 0x03, 0x38, 0x17, 0xca, 0x89, 0x80, + 0x68, 0x36, 0xb8, 0x9b, 0x10, 0x11, 0x82, 0xce, 0x0a, 0x91, 0xbd, 0x8a, 0xa9, 0x0b, 0x23, 0x11, + 0x36, 0xa2, 0x9a, 0x80, 0x1a, 0x77, 0x93, 0xcb, 0x19, 0x21, 0x23, 0xa8, 0x2b, 0x36, 0xb8, 0x0a, + 0x82, 0xbb, 0x62, 0x01, 0x31, 0x83, 0xbd, 0x08, 0xba, 0x75, 0x17, 0xa9, 0x8a, 0x11, 0x11, 0xb0, + 0xae, 0x18, 0xc8, 0xac, 0x88, 0xb9, 0x19, 0x23, 0x21, 0x25, 0xa0, 0x08, 0xc8, 0x49, 0x67, 0xa0, + 0xab, 0x10, 0x32, 0x02, 0xaa, 0x58, 0x04, 0xb9, 0x28, 0x90, 0x8b, 0x42, 0x12, 0x31, 0xb0, 0x9b, + 0xd0, 0x8d, 0x77, 0x03, 0xbb, 0x09, 0x31, 0x02, 0xeb, 0x9b, 0x00, 0xcc, 0x9c, 0x90, 0xa9, 0x28, + 0x22, 0x23, 0x03, 0x18, 0x81, 0xce, 0x71, 0x15, 0xc8, 0x9a, 0x30, 0x33, 0xa0, 0x9a, 0x63, 0x91, + 0x9a, 0x20, 0x98, 0x0a, 0x32, 0x24, 0x91, 0xaa, 0x32, 0xfc, 0x4b, 0x67, 0x80, 0xaa, 0x08, 0x23, + 0x91, 0xcd, 0x09, 0x90, 0xad, 0x8a, 0x98, 0x99, 0x10, 0x33, 0x14, 0x88, 0x32, 0xc2, 0x9e, 0x73, + 0x03, 0xda, 0x8a, 0x32, 0x15, 0xa9, 0x19, 0x24, 0xa8, 0x0a, 0x01, 0x98, 0x09, 0x31, 0x25, 0xc9, + 0x19, 0x05, 0xbc, 0x70, 0x25, 0xa0, 0xab, 0x38, 0x25, 0xb8, 0xae, 0x00, 0xb9, 0xad, 0x88, 0x89, + 0x89, 0x10, 0x34, 0x02, 0x0a, 0x44, 0xc8, 0x0b, 0x37, 0x91, 0xcb, 0x0a, 0x54, 0x02, 0xba, 0x30, + 0x03, 0xba, 0x28, 0x00, 0x89, 0x88, 0x71, 0x03, 0xdb, 0x30, 0x94, 0x9d, 0x73, 0x13, 0xa9, 0xab, + 0x41, 0x15, 0xe9, 0x8a, 0x80, 0xca, 0x9a, 0x98, 0x98, 0x80, 0x20, 0x35, 0xb1, 0x29, 0x17, 0xb9, + 0x3a, 0x17, 0xa0, 0xab, 0x19, 0x37, 0x92, 0x8c, 0x31, 0x91, 0x8b, 0x10, 0x80, 0x80, 0x99, 0x73, + 0x92, 0xad, 0x52, 0xa1, 0x0b, 0x55, 0x01, 0xa9, 0x9a, 0x62, 0x83, 0xcc, 0x0a, 0xa0, 0xbc, 0x8a, + 0x89, 0x09, 0x80, 0x40, 0x25, 0xb8, 0x58, 0x13, 0xac, 0x40, 0x13, 0xca, 0xba, 0x58, 0x27, 0xa0, + 0x0a, 0x32, 0xb8, 0x0a, 0x02, 0x09, 0x82, 0x9a, 0x55, 0xc0, 0x0c, 0x43, 0xa8, 0x4a, 0x25, 0x80, + 0x9a, 0x0a, 0x55, 0xa1, 0xbd, 0x08, 0xc8, 0xac, 0x88, 0x89, 0x00, 0x80, 0x50, 0x13, 0xab, 0x72, + 0x92, 0x9a, 0x42, 0x91, 0xab, 0xaa, 0x72, 0x17, 0x99, 0x19, 0x03, 0xb9, 0x18, 0x81, 0x18, 0x92, + 0x0b, 0x36, 0xea, 0x2a, 0x24, 0xa9, 0x60, 0x13, 0x99, 0x89, 0x29, 0x37, 0xd0, 0xac, 0x80, 0xda, + 0x9a, 0x98, 0x89, 0x11, 0x88, 0x62, 0x82, 0x8b, 0x44, 0xa1, 0x1a, 0x14, 0xb9, 0x9a, 0x89, 0x76, + 0x02, 0xa9, 0x30, 0x92, 0xab, 0x20, 0x88, 0x30, 0xb1, 0x2a, 0x27, 0xdd, 0x38, 0x04, 0x89, 0x53, + 0x81, 0x8a, 0x80, 0x41, 0x25, 0xfb, 0x9a, 0x90, 0xcc, 0x8a, 0x98, 0x09, 0x02, 0x08, 0x44, 0x90, + 0x1a, 0x25, 0xa0, 0x30, 0x92, 0xbd, 0x09, 0x30, 0x57, 0x81, 0x8a, 0x32, 0xc0, 0x8a, 0x11, 0x09, + 0x22, 0xa8, 0x49, 0xb3, 0xcf, 0x41, 0x02, 0x38, 0x25, 0xb8, 0x09, 0x21, 0x63, 0x93, 0xce, 0x8a, + 0xc9, 0xbc, 0x8a, 0x99, 0x28, 0x01, 0x20, 0x25, 0xa8, 0x48, 0x24, 0x88, 0x33, 0xf8, 0xab, 0x10, + 0x52, 0x34, 0xa0, 0x29, 0x14, 0xca, 0x09, 0x01, 0x19, 0x23, 0xa9, 0x31, 0xf9, 0x8e, 0x32, 0x12, + 0x73, 0x82, 0xba, 0x20, 0x42, 0x33, 0xe0, 0xbc, 0xa9, 0xec, 0xab, 0x89, 0x99, 0x11, 0x11, 0x31, + 0x03, 0x99, 0x63, 0x13, 0x41, 0x03, 0xde, 0x0b, 0x21, 0x53, 0x02, 0x88, 0x31, 0x92, 0xad, 0x18, + 0x80, 0x30, 0x03, 0x88, 0xa1, 0xdf, 0x18, 0x22, 0x63, 0x25, 0xa0, 0x8c, 0x30, 0x34, 0x82, 0xeb, + 0x9a, 0xca, 0xbe, 0xaa, 0xa8, 0x88, 0x21, 0x21, 0x32, 0x90, 0x38, 0x25, 0x21, 0x37, 0xb1, 0xcf, + 0x08, 0x31, 0x33, 0x90, 0x38, 0x24, 0xc9, 0x8a, 0x00, 0x08, 0x32, 0x11, 0x00, 0xfb, 0x9d, 0x21, + 0x10, 0x66, 0x13, 0xba, 0x0b, 0x52, 0x24, 0xa0, 0x9d, 0x98, 0xfa, 0xbb, 0x99, 0x99, 0x18, 0x11, + 0x22, 0x03, 0x9a, 0x44, 0x81, 0x60, 0x25, 0xd9, 0xbb, 0x10, 0x44, 0x02, 0x99, 0x42, 0x82, 0xbb, + 0x18, 0x90, 0x28, 0x13, 0x21, 0xa3, 0xff, 0x19, 0x01, 0x29, 0x57, 0x81, 0xaa, 0x09, 0x43, 0x14, + 0xc9, 0x8a, 0x90, 0xce, 0xaa, 0x98, 0x8a, 0x10, 0x20, 0x42, 0xa0, 0x19, 0x34, 0x99, 0x72, 0x06, + 0xca, 0x9a, 0x20, 0x34, 0x91, 0x0a, 0x44, 0xa0, 0x8b, 0x00, 0x88, 0x20, 0x82, 0x41, 0xd1, 0xbd, + 0x21, 0xa1, 0x68, 0x27, 0x90, 0xab, 0x10, 0x44, 0x02, 0xbc, 0x19, 0xb0, 0xcf, 0x89, 0x99, 0x09, + 0x00, 0x21, 0x22, 0xb9, 0x48, 0x14, 0x8b, 0x56, 0x92, 0xad, 0x8a, 0x31, 0x25, 0x98, 0x2a, 0x25, + 0xa9, 0x8a, 0x01, 0x89, 0x21, 0x00, 0x33, 0xf9, 0x9e, 0x22, 0x99, 0x70, 0x24, 0xa9, 0x8b, 0x20, + 0x45, 0xa1, 0xac, 0x10, 0xd8, 0xac, 0x99, 0x99, 0x08, 0x10, 0x31, 0x04, 0xbb, 0x52, 0x93, 0x1a, + 0x57, 0xb0, 0xbb, 0x0a, 0x63, 0x13, 0xb9, 0x48, 0x14, 0xba, 0x19, 0x91, 0x08, 0x12, 0x18, 0x14, + 0xfc, 0x0a, 0x03, 0x99, 0x74, 0x03, 0xba, 0x0a, 0x41, 0x34, 0xd0, 0x9b, 0x11, 0xfa, 0x9b, 0x89, + 0x8a, 0x18, 0x00, 0x42, 0x92, 0x8c, 0x43, 0x90, 0x49, 0x17, 0xc8, 0x9b, 0x08, 0x34, 0x03, 0xab, + 0x62, 0x82, 0xba, 0x10, 0x88, 0x18, 0x02, 0x20, 0x84, 0xdf, 0x18, 0x82, 0x1a, 0x56, 0x81, 0xba, + 0x88, 0x43, 0x14, 0xd9, 0x0a, 0x81, 0xcc, 0x9b, 0x99, 0x99, 0x10, 0x20, 0x34, 0xb8, 0x1b, 0x36, + 0x99, 0x71, 0x13, 0xeb, 0x9a, 0x28, 0x44, 0x91, 0x8a, 0x43, 0x91, 0xab, 0x01, 0x88, 0x10, 0x01, + 0x42, 0xc1, 0xbf, 0x20, 0x81, 0x49, 0x37, 0x90, 0xab, 0x29, 0x54, 0x83, 0xdb, 0x19, 0xa0, 0xcd, + 0x99, 0x99, 0x09, 0x00, 0x21, 0x14, 0xb9, 0x38, 0x14, 0x89, 0x65, 0x92, 0xbc, 0x8b, 0x41, 0x25, + 0x98, 0x19, 0x24, 0xb0, 0x9a, 0x81, 0x08, 0x11, 0x20, 0x43, 0xfa, 0x9d, 0x21, 0x88, 0x71, 0x23, + 0xa8, 0xab, 0x48, 0x45, 0xa1, 0xbb, 0x18, 0xd9, 0xbd, 0x9a, 0x99, 0x88, 0x01, 0x42, 0x83, 0xaa, + 0x41, 0x83, 0x38, 0x57, 0xa0, 0xbc, 0x8a, 0x63, 0x03, 0xa8, 0x30, 0x14, 0xb9, 0x89, 0x08, 0x00, + 0x01, 0x32, 0x04, 0xcf, 0x8a, 0x02, 0x18, 0x56, 0x12, 0xa9, 0x9b, 0x62, 0x24, 0xb8, 0x9b, 0x88, + 0xec, 0xab, 0x9b, 0x8a, 0x88, 0x21, 0x34, 0xa1, 0x89, 0x43, 0x00, 0x54, 0x14, 0xc9, 0xbc, 0x19, + 0x45, 0x01, 0x89, 0x32, 0x82, 0x9a, 0x99, 0x09, 0x11, 0x10, 0x54, 0xb1, 0xbf, 0x08, 0x80, 0x61, + 0x35, 0x81, 0xaa, 0x0a, 0x64, 0x03, 0xba, 0x89, 0xba, 0xbf, 0xbb, 0xac, 0x09, 0x08, 0x40, 0x13, + 0xa8, 0x20, 0x02, 0x40, 0x37, 0x81, 0xdb, 0xbb, 0x30, 0x37, 0x80, 0x18, 0x23, 0x88, 0x89, 0xb9, + 0x29, 0x13, 0x28, 0x37, 0xea, 0x9b, 0x80, 0x09, 0x57, 0x13, 0x98, 0xa8, 0x18, 0x37, 0x91, 0xaa, + 0x98, 0xcd, 0xac, 0xca, 0xaa, 0x08, 0x08, 0x42, 0x82, 0x89, 0x22, 0x90, 0x72, 0x16, 0x99, 0xaa, + 0xaa, 0x62, 0x13, 0x88, 0x42, 0x92, 0x09, 0x81, 0xbb, 0x40, 0x81, 0x40, 0x85, 0xcc, 0x19, 0xa8, + 0x39, 0x77, 0x00, 0x09, 0x88, 0x20, 0x24, 0xa9, 0x89, 0xc0, 0xaf, 0x9a, 0xcb, 0x9a, 0x00, 0x19, + 0x43, 0x90, 0x29, 0x04, 0x8a, 0x65, 0x82, 0xab, 0x99, 0x09, 0x44, 0x92, 0x28, 0x26, 0xa8, 0x18, + 0x92, 0x9c, 0x31, 0x90, 0x51, 0xa1, 0x9f, 0x01, 0xb9, 0x70, 0x24, 0x98, 0x08, 0x00, 0x42, 0x83, + 0xbb, 0x20, 0xfa, 0xaf, 0x89, 0xbb, 0x8a, 0x00, 0x28, 0x14, 0xa9, 0x51, 0x91, 0x2a, 0x47, 0xa0, + 0xaa, 0x80, 0x28, 0x24, 0xa8, 0x71, 0x03, 0xaa, 0x30, 0xa1, 0x8c, 0x13, 0x88, 0x53, 0xd9, 0x0b, + 0x02, 0xbc, 0x74, 0x13, 0xaa, 0x10, 0x12, 0x43, 0xb0, 0x8c, 0x13, 0xfe, 0x9a, 0x98, 0xba, 0x09, + 0x80, 0x30, 0x83, 0x8b, 0x54, 0xb0, 0x48, 0x27, 0xb9, 0x8a, 0x00, 0x31, 0x83, 0x9b, 0x66, 0x92, + 0x9a, 0x31, 0xa8, 0x1a, 0x02, 0x18, 0x14, 0xdd, 0x18, 0xa2, 0x0c, 0x56, 0x91, 0x8a, 0x11, 0x22, + 0x03, 0xda, 0x2a, 0x93, 0xef, 0x89, 0xa8, 0x9a, 0x09, 0x80, 0x22, 0x90, 0x2a, 0x26, 0xb9, 0x71, + 0x04, 0xbb, 0x09, 0x21, 0x22, 0xb0, 0x2b, 0x77, 0x90, 0x0a, 0x11, 0x98, 0x08, 0x81, 0x20, 0xa1, + 0xae, 0x21, 0xc1, 0x3a, 0x57, 0x98, 0x0a, 0x21, 0x33, 0x91, 0xbd, 0x40, 0xc1, 0xbe, 0x89, 0xa8, + 0x9b, 0x88, 0x10, 0x22, 0xb9, 0x60, 0x04, 0x9a, 0x64, 0xa2, 0xbb, 0x29, 0x42, 0x12, 0xda, 0x48, + 0x25, 0xa9, 0x1a, 0x12, 0xa8, 0x00, 0x00, 0x22, 0xe9, 0x8c, 0x23, 0xca, 0x70, 0x14, 0xa9, 0x1a, + 0x43, 0x14, 0xb8, 0x9c, 0x32, 0xf9, 0xac, 0x88, 0xa9, 0x9a, 0x08, 0x20, 0x82, 0x9b, 0x54, 0x92, + 0x2a, 0x37, 0xc0, 0xab, 0x38, 0x25, 0x91, 0xbb, 0x72, 0x04, 0xaa, 0x28, 0x01, 0x88, 0x08, 0x10, + 0x82, 0xdc, 0x19, 0x03, 0x9b, 0x75, 0x02, 0xab, 0x29, 0x36, 0x03, 0xdb, 0x1a, 0x12, 0xfb, 0xab, + 0x88, 0x9a, 0x9a, 0x08, 0x22, 0xb8, 0x2a, 0x27, 0x90, 0x50, 0x14, 0xd9, 0x9b, 0x51, 0x23, 0xb8, + 0x8b, 0x55, 0x81, 0x9a, 0x28, 0x01, 0x90, 0x88, 0x22, 0xc1, 0xae, 0x21, 0x91, 0x29, 0x47, 0x91, + 0xbb, 0x50, 0x35, 0xa2, 0xbc, 0x28, 0x92, 0xbe, 0xab, 0x89, 0x9a, 0xaa, 0x28, 0x13, 0xbc, 0x50, + 0x14, 0x09, 0x73, 0x81, 0xcb, 0x0b, 0x73, 0x03, 0xc9, 0x19, 0x24, 0x90, 0x99, 0x10, 0x12, 0x90, + 0x1a, 0x33, 0xfa, 0x8c, 0x22, 0x98, 0x61, 0x23, 0xb9, 0x9c, 0x72, 0x25, 0xb0, 0xab, 0x30, 0xb8, + 0xbe, 0x9b, 0x8a, 0xa8, 0xaa, 0x40, 0x91, 0x9c, 0x62, 0x81, 0x20, 0x25, 0xb8, 0xbc, 0x1a, 0x47, + 0x82, 0xbb, 0x40, 0x13, 0x98, 0x89, 0x18, 0x33, 0xb8, 0x39, 0x05, 0xce, 0x18, 0x82, 0x19, 0x45, + 0x92, 0xaa, 0x8a, 0x75, 0x14, 0xc9, 0x0a, 0x01, 0xb9, 0xbb, 0xbb, 0x0a, 0xa8, 0x9c, 0x32, 0xe0, + 0x0a, 0x25, 0x88, 0x52, 0x83, 0xda, 0x9a, 0x38, 0x47, 0xa1, 0x9b, 0x32, 0x02, 0x89, 0x98, 0x28, + 0x25, 0xa9, 0x38, 0xc3, 0xaf, 0x21, 0x90, 0x40, 0x25, 0xa8, 0xaa, 0x18, 0x67, 0x02, 0xbb, 0x1a, + 0x91, 0xcb, 0xba, 0xac, 0x08, 0xb0, 0x0b, 0x23, 0xdc, 0x38, 0x13, 0x19, 0x47, 0xa1, 0xac, 0x89, + 0x51, 0x35, 0xb8, 0x0b, 0x33, 0x90, 0x18, 0xa8, 0x48, 0x15, 0xa9, 0x21, 0xe8, 0x8c, 0x22, 0x99, + 0x73, 0x03, 0xba, 0x89, 0x30, 0x77, 0x91, 0xaa, 0x08, 0xa8, 0xaa, 0xba, 0x9d, 0x10, 0xb8, 0x19, + 0x92, 0xae, 0x41, 0x81, 0x48, 0x16, 0xc8, 0x8a, 0x88, 0x53, 0x15, 0xaa, 0x29, 0x02, 0x89, 0x12, + 0xb9, 0x60, 0x03, 0x8a, 0x11, 0xec, 0x19, 0x02, 0x0a, 0x47, 0xa1, 0xaa, 0x00, 0x41, 0x26, 0xb0, + 0x9b, 0x80, 0xdb, 0x99, 0xc9, 0x9b, 0x11, 0xa9, 0x18, 0xd0, 0x8c, 0x33, 0xa0, 0x73, 0x06, 0xbb, + 0x89, 0x10, 0x45, 0x82, 0xaa, 0x21, 0x91, 0x1a, 0x04, 0xaa, 0x62, 0x82, 0x88, 0x91, 0xaf, 0x20, + 0x91, 0x49, 0x27, 0xa8, 0x9b, 0x11, 0x63, 0x23, 0xca, 0x8a, 0xa0, 0xae, 0x88, 0xc9, 0x0b, 0x11, + 0x99, 0x80, 0xda, 0x2a, 0x04, 0x09, 0x56, 0xa2, 0xbc, 0x08, 0x31, 0x35, 0x91, 0x0b, 0x22, 0xba, + 0x48, 0x84, 0x8b, 0x63, 0x81, 0x08, 0xd8, 0x9b, 0x22, 0x98, 0x72, 0x17, 0xaa, 0x0a, 0x21, 0x53, + 0x82, 0xab, 0x09, 0xfa, 0x9b, 0x80, 0xcb, 0x09, 0x02, 0x89, 0xb0, 0xad, 0x30, 0x92, 0x59, 0x37, + 0xc0, 0x9c, 0x18, 0x42, 0x13, 0x98, 0x28, 0x81, 0x9d, 0x41, 0x81, 0x0a, 0x43, 0x01, 0x90, 0xcd, + 0x1a, 0x02, 0x09, 0x57, 0x82, 0xcb, 0x19, 0x42, 0x23, 0xa0, 0x8b, 0xa8, 0xcf, 0x8a, 0x80, 0xbb, + 0x19, 0x11, 0x80, 0xfb, 0x9a, 0x22, 0x98, 0x71, 0x06, 0xb9, 0x9b, 0x31, 0x34, 0x83, 0x09, 0x32, + 0xe8, 0x8b, 0x43, 0x91, 0x09, 0x24, 0x12, 0xd8, 0xad, 0x20, 0x80, 0x49, 0x37, 0xb1, 0xac, 0x28, + 0x34, 0x03, 0xaa, 0x18, 0xf9, 0xad, 0x09, 0x90, 0xaa, 0x00, 0x21, 0xa0, 0xcd, 0x19, 0x01, 0x89, + 0x56, 0x82, 0xbc, 0x0b, 0x52, 0x23, 0x90, 0x38, 0x04, 0xeb, 0x19, 0x22, 0x90, 0x00, 0x42, 0x12, + 0xfb, 0x8b, 0x12, 0x98, 0x71, 0x15, 0xa9, 0x9b, 0x40, 0x43, 0x90, 0x8a, 0x11, 0xec, 0x9c, 0x08, + 0x90, 0x99, 0x18, 0x22, 0xd8, 0xac, 0x20, 0x90, 0x39, 0x37, 0xa0, 0xbd, 0x19, 0x44, 0x03, 0x8a, + 0x30, 0x05, 0xcb, 0x39, 0x02, 0x01, 0x09, 0x7d, 0x0b, 0x02, 0xcd, 0x08, 0x98, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x70, 0x77, 0x97, 0xbc, 0xaa, 0xab, 0x22, 0x90, 0xbb, 0xdc, 0xce, 0xcb, + 0xbc, 0x0a, 0x82, 0x09, 0x43, 0x12, 0x63, 0x12, 0x20, 0x46, 0x22, 0x45, 0x82, 0xdc, 0x9c, 0x73, + 0x24, 0x80, 0x99, 0xa9, 0x88, 0xeb, 0xcd, 0xab, 0x28, 0x65, 0x44, 0x23, 0xb8, 0xbd, 0x8b, 0x00, + 0x01, 0xa8, 0xa9, 0xb9, 0xaa, 0x99, 0x18, 0x81, 0xda, 0xcc, 0x99, 0x41, 0x23, 0x00, 0x10, 0x65, + 0x47, 0x23, 0x01, 0x99, 0x08, 0x42, 0x33, 0x01, 0x98, 0x08, 0x12, 0xc9, 0xec, 0xcd, 0xab, 0xa9, + 0xaa, 0x48, 0x47, 0x23, 0x98, 0xba, 0x89, 0x08, 0x80, 0xb9, 0x8a, 0x11, 0x01, 0x21, 0x24, 0xa0, + 0xfd, 0xcb, 0xaa, 0x89, 0x18, 0x91, 0xdb, 0x0a, 0x54, 0x25, 0x01, 0x88, 0x09, 0x52, 0x23, 0x98, + 0x9a, 0x10, 0x34, 0x03, 0xfd, 0xac, 0xaa, 0xca, 0xbd, 0x19, 0x46, 0x33, 0x81, 0xa9, 0xaa, 0xa9, + 0xa9, 0xba, 0x9a, 0x08, 0x02, 0x00, 0x81, 0xfb, 0xac, 0x99, 0x08, 0x40, 0x36, 0x03, 0xcb, 0x38, + 0x47, 0x34, 0x03, 0x80, 0x88, 0x42, 0x43, 0x02, 0xaa, 0x09, 0x43, 0x13, 0xb9, 0xcd, 0xda, 0xcd, + 0xbc, 0x89, 0x43, 0x24, 0x02, 0x00, 0x80, 0x98, 0xaa, 0xdb, 0xab, 0x09, 0x10, 0x01, 0x88, 0xdb, + 0xac, 0xbb, 0xad, 0x0a, 0x43, 0x14, 0xb9, 0x0b, 0x47, 0x34, 0x23, 0x02, 0x00, 0x31, 0x25, 0xa0, + 0xbd, 0x0a, 0x22, 0x11, 0x11, 0x82, 0xfa, 0xff, 0xbb, 0x9a, 0x11, 0x32, 0x21, 0x21, 0x23, 0x11, + 0xa8, 0xdb, 0xab, 0x19, 0x54, 0x33, 0x13, 0x01, 0xca, 0xcc, 0xab, 0x1a, 0x53, 0x82, 0xcb, 0x0a, + 0x55, 0x35, 0x33, 0x12, 0x11, 0x43, 0x13, 0xd9, 0xbd, 0x9a, 0x00, 0x88, 0x89, 0x10, 0xc8, 0xef, + 0xbc, 0xaa, 0x88, 0x20, 0x10, 0x21, 0x33, 0x22, 0x01, 0xb8, 0xbd, 0x8b, 0x51, 0x53, 0x22, 0x32, + 0x82, 0xdc, 0xac, 0x09, 0x00, 0x88, 0xcb, 0xbc, 0x48, 0x46, 0x33, 0x11, 0x31, 0x44, 0x13, 0xb0, + 0xcd, 0x9a, 0x88, 0x88, 0x28, 0x53, 0x91, 0xfb, 0xcc, 0xab, 0x9a, 0x08, 0x11, 0x22, 0x53, 0x23, + 0x02, 0x98, 0xcb, 0x9a, 0x20, 0x23, 0x54, 0x36, 0x03, 0xb9, 0xad, 0x99, 0x08, 0x01, 0xc9, 0xbd, + 0x19, 0x45, 0x23, 0x02, 0x52, 0x34, 0x24, 0x90, 0xba, 0x9a, 0xba, 0xbb, 0x29, 0x55, 0x03, 0xea, + 0xdc, 0xbb, 0xab, 0x8a, 0x88, 0x10, 0x21, 0x42, 0x12, 0xa0, 0xad, 0xab, 0xaa, 0x19, 0x65, 0x44, + 0x22, 0x90, 0xba, 0x9a, 0x10, 0x11, 0xb8, 0xbf, 0x09, 0x45, 0x23, 0x01, 0x62, 0x35, 0x32, 0x11, + 0x88, 0x98, 0xaa, 0xbc, 0x18, 0x54, 0x33, 0xa0, 0xce, 0xbc, 0xbb, 0xab, 0x89, 0x88, 0x10, 0x54, + 0x12, 0x90, 0x98, 0xba, 0xbd, 0x8b, 0x41, 0x46, 0x24, 0x01, 0x99, 0x8a, 0x21, 0x13, 0xb0, 0xcd, + 0x19, 0x44, 0x22, 0x10, 0x52, 0x45, 0x32, 0x11, 0x01, 0x90, 0xbb, 0xbd, 0x9b, 0x30, 0x25, 0x91, + 0xcd, 0xbd, 0xbd, 0xba, 0xa9, 0x9a, 0x08, 0x32, 0x22, 0x22, 0x01, 0xc9, 0xbf, 0x9c, 0x08, 0x53, + 0x44, 0x11, 0xa8, 0x8a, 0x21, 0x13, 0xc9, 0xab, 0x19, 0x44, 0x13, 0x11, 0x73, 0x35, 0x33, 0x33, + 0x33, 0x02, 0xda, 0xcc, 0x9a, 0x19, 0x43, 0x12, 0xca, 0xce, 0xcb, 0xca, 0xaa, 0x9a, 0x89, 0x21, + 0x32, 0x43, 0x32, 0x90, 0xdc, 0xbc, 0x89, 0x31, 0x46, 0x12, 0x99, 0x0a, 0x21, 0x03, 0xc9, 0xac, + 0x18, 0x22, 0x12, 0x21, 0x45, 0x36, 0x34, 0x42, 0x43, 0x02, 0xa0, 0xba, 0xac, 0x8a, 0x42, 0x23, + 0xb9, 0xbf, 0xbd, 0xbc, 0xad, 0xaa, 0x99, 0x08, 0x21, 0x43, 0x43, 0x01, 0xb8, 0xcd, 0xab, 0x28, + 0x35, 0x13, 0x98, 0x9a, 0x42, 0x03, 0xd9, 0xaa, 0x88, 0x01, 0x81, 0x20, 0x45, 0x45, 0x43, 0x43, + 0x44, 0x22, 0x81, 0x98, 0xba, 0x89, 0x41, 0x33, 0x90, 0xdb, 0xcc, 0xbd, 0xbd, 0xab, 0xaa, 0x99, + 0x20, 0x43, 0x53, 0x23, 0x90, 0xec, 0xaa, 0x19, 0x42, 0x02, 0x90, 0x08, 0x32, 0x13, 0xb9, 0xad, + 0x18, 0x00, 0xba, 0x18, 0x63, 0x53, 0x44, 0x44, 0x53, 0x33, 0x22, 0x98, 0xab, 0x8a, 0x20, 0x43, + 0x02, 0xa9, 0xdc, 0xdd, 0xbc, 0xac, 0xab, 0xaa, 0x08, 0x21, 0x44, 0x34, 0x02, 0xda, 0xac, 0x09, + 0x12, 0x02, 0x80, 0x00, 0x32, 0x04, 0xa9, 0x9b, 0x11, 0x80, 0xaa, 0x09, 0x11, 0x73, 0x46, 0x44, + 0x53, 0x35, 0x22, 0x80, 0xa9, 0x9a, 0x88, 0x10, 0x22, 0x82, 0xea, 0xcd, 0xcd, 0xcb, 0xab, 0xab, + 0x99, 0x09, 0x52, 0x35, 0x23, 0xb9, 0xbc, 0x89, 0x21, 0x01, 0x00, 0x31, 0x34, 0x22, 0x90, 0x88, + 0x00, 0x80, 0x9a, 0xba, 0x8b, 0x54, 0x53, 0x46, 0x55, 0x44, 0x23, 0x01, 0x98, 0x98, 0x99, 0x18, + 0x21, 0x12, 0x80, 0xdc, 0xed, 0xbc, 0xbb, 0xbb, 0xbc, 0x9a, 0x41, 0x45, 0x23, 0x90, 0xbb, 0x8a, + 0x01, 0x88, 0x88, 0x42, 0x33, 0x13, 0x21, 0x98, 0x09, 0x01, 0xca, 0xbc, 0x9a, 0x98, 0x00, 0x62, + 0x77, 0x37, 0x32, 0x12, 0x80, 0x99, 0x99, 0x9a, 0x11, 0x12, 0x12, 0x90, 0xff, 0xbd, 0xba, 0xcb, + 0xbc, 0xab, 0x29, 0x54, 0x23, 0x81, 0xa9, 0x99, 0x90, 0x99, 0x09, 0x31, 0x53, 0x23, 0x12, 0x11, + 0x00, 0x11, 0x92, 0xdb, 0x19, 0x92, 0xcf, 0x0a, 0x73, 0x46, 0x43, 0x22, 0x11, 0x98, 0xa8, 0x89, + 0x89, 0x20, 0x43, 0x82, 0xdd, 0xbd, 0xbb, 0xcc, 0xdc, 0xab, 0x09, 0x42, 0x23, 0x02, 0x00, 0x89, + 0x89, 0x9a, 0xaa, 0x30, 0x34, 0x33, 0x34, 0x12, 0x42, 0x33, 0x80, 0x09, 0x32, 0x83, 0xdf, 0xab, + 0x61, 0x45, 0x35, 0x24, 0x03, 0x00, 0x08, 0xa9, 0x9a, 0x18, 0x34, 0x02, 0xfb, 0xcb, 0xaa, 0xeb, + 0xcd, 0xbc, 0x89, 0x10, 0x32, 0x22, 0x01, 0x80, 0x98, 0xaa, 0xaa, 0x8a, 0x52, 0x32, 0x11, 0x43, + 0x24, 0x22, 0x80, 0x08, 0x44, 0x83, 0xfb, 0xac, 0x08, 0x52, 0x56, 0x33, 0x22, 0x12, 0x10, 0xa9, + 0xbb, 0x19, 0x34, 0x03, 0xcc, 0xac, 0x89, 0xfb, 0xce, 0xbc, 0xaa, 0x18, 0x11, 0x22, 0x22, 0x02, + 0x08, 0x98, 0xba, 0x9a, 0x32, 0x23, 0x32, 0x65, 0x43, 0x02, 0x88, 0x31, 0x34, 0x23, 0xb1, 0xcf, + 0x9b, 0x20, 0x47, 0x34, 0x42, 0x22, 0x11, 0x98, 0xbb, 0x0a, 0x53, 0x81, 0xbc, 0x8a, 0x80, 0xd9, + 0xff, 0xbb, 0x9c, 0x8a, 0x00, 0x21, 0x12, 0x12, 0x11, 0x88, 0x99, 0x9a, 0x28, 0x01, 0x18, 0x65, + 0x23, 0x11, 0x10, 0x20, 0x53, 0x34, 0x02, 0xdc, 0xac, 0x28, 0x53, 0x63, 0x33, 0x34, 0x23, 0x90, + 0xbb, 0x19, 0x33, 0x92, 0xcd, 0x8b, 0x22, 0xb0, 0xff, 0xbd, 0xbc, 0xa9, 0x88, 0x10, 0x11, 0x23, + 0x12, 0x81, 0x99, 0x09, 0x88, 0x88, 0x20, 0x54, 0x34, 0x12, 0x10, 0x10, 0x42, 0x46, 0x02, 0xb9, + 0xbd, 0x89, 0x32, 0x35, 0x46, 0x35, 0x13, 0x80, 0x99, 0x09, 0x32, 0x90, 0xcc, 0x89, 0x21, 0x82, + 0xfc, 0xce, 0xcb, 0xaa, 0x8a, 0x88, 0x10, 0x32, 0x23, 0x01, 0x08, 0x80, 0x88, 0x88, 0x21, 0x45, + 0x34, 0x33, 0x01, 0x09, 0x42, 0x45, 0x23, 0xc0, 0xbc, 0x8a, 0x88, 0x30, 0x77, 0x34, 0x14, 0x81, + 0x88, 0x08, 0x11, 0x90, 0xbb, 0x9c, 0x30, 0x13, 0xd9, 0xef, 0xcb, 0xbb, 0xab, 0xa9, 0x00, 0x32, + 0x33, 0x12, 0x21, 0x11, 0x88, 0x08, 0x22, 0x64, 0x35, 0x33, 0x12, 0x88, 0x30, 0x37, 0x12, 0xa0, + 0xca, 0xaa, 0xca, 0xac, 0x71, 0x46, 0x23, 0x01, 0x88, 0x10, 0x11, 0x91, 0xca, 0xab, 0x20, 0x35, + 0x91, 0xde, 0xcc, 0xac, 0xbb, 0xab, 0x09, 0x21, 0x22, 0x32, 0x21, 0x22, 0x01, 0x88, 0x01, 0x31, + 0x57, 0x34, 0x01, 0x88, 0x11, 0x34, 0x23, 0x80, 0x88, 0xa0, 0xef, 0xbb, 0x28, 0x57, 0x23, 0x02, + 0x00, 0x11, 0x23, 0x02, 0xc9, 0xac, 0x29, 0x53, 0x02, 0xca, 0xce, 0xcc, 0xcb, 0x9b, 0x9a, 0x08, + 0x11, 0x11, 0x22, 0x22, 0x21, 0x01, 0x90, 0x20, 0x65, 0x33, 0x03, 0x88, 0x30, 0x36, 0x01, 0x21, + 0x33, 0x91, 0xdf, 0xad, 0x0a, 0x53, 0x24, 0x22, 0x00, 0x21, 0x43, 0x12, 0xa8, 0xbc, 0x1a, 0x43, + 0x12, 0x91, 0xed, 0xcd, 0xcc, 0xba, 0x9a, 0x99, 0x08, 0x01, 0x21, 0x11, 0x23, 0x82, 0x99, 0x88, + 0x73, 0x34, 0x01, 0x00, 0x31, 0x24, 0x01, 0x31, 0x47, 0x02, 0xea, 0xbc, 0x9a, 0x31, 0x35, 0x23, + 0x12, 0x32, 0x46, 0x12, 0x98, 0x9a, 0x8a, 0x30, 0x34, 0x22, 0xb1, 0xef, 0xbd, 0xac, 0xbb, 0xaa, + 0x89, 0x00, 0x11, 0x31, 0x43, 0x03, 0x99, 0x19, 0x44, 0x24, 0x12, 0x11, 0x53, 0x23, 0x80, 0x40, + 0x46, 0x23, 0xc8, 0xbd, 0xab, 0x18, 0x53, 0x23, 0x11, 0x52, 0x34, 0x13, 0x81, 0xaa, 0xa9, 0x09, + 0x52, 0x34, 0x02, 0xea, 0xdd, 0xbc, 0xac, 0xba, 0xa9, 0x88, 0x08, 0x21, 0x24, 0x02, 0x88, 0x19, + 0x42, 0x33, 0x11, 0x63, 0x43, 0x13, 0x80, 0x30, 0x57, 0x23, 0x90, 0xdc, 0xab, 0x08, 0x21, 0x13, + 0x12, 0x44, 0x35, 0x14, 0x11, 0x88, 0xa9, 0x8a, 0x21, 0x35, 0x14, 0x91, 0xec, 0xdc, 0xbb, 0xac, + 0x9a, 0x9a, 0x89, 0x10, 0x32, 0x02, 0xa8, 0x18, 0x33, 0x03, 0x10, 0x64, 0x35, 0x12, 0x88, 0x18, + 0x74, 0x34, 0x82, 0xdb, 0xbb, 0x8a, 0x20, 0x11, 0x10, 0x54, 0x44, 0x33, 0x23, 0x81, 0xa8, 0xab, + 0x29, 0x35, 0x34, 0x22, 0xc0, 0xef, 0xbb, 0xac, 0xab, 0xbb, 0x9b, 0x18, 0x21, 0x02, 0x88, 0x10, + 0x34, 0x00, 0x18, 0x55, 0x34, 0x13, 0x88, 0x09, 0x74, 0x25, 0x12, 0xb9, 0xac, 0x8a, 0x88, 0x08, + 0x10, 0x52, 0x54, 0x43, 0x33, 0x12, 0x98, 0xaa, 0x88, 0x41, 0x44, 0x33, 0x01, 0xec, 0xbd, 0xbb, + 0xbd, 0xcb, 0xaa, 0x88, 0x01, 0x80, 0x00, 0x20, 0x22, 0x01, 0x08, 0x72, 0x35, 0x12, 0x90, 0x89, + 0x71, 0x35, 0x13, 0x98, 0xbb, 0xbb, 0x9a, 0xaa, 0x89, 0x42, 0x64, 0x54, 0x33, 0x22, 0x00, 0xa9, + 0x9b, 0x18, 0x73, 0x34, 0x02, 0xb8, 0xbe, 0xbc, 0xcc, 0xbc, 0xbb, 0x89, 0x88, 0x88, 0x00, 0x11, + 0x22, 0x91, 0x89, 0x62, 0x36, 0x14, 0x98, 0x9a, 0x41, 0x36, 0x33, 0x80, 0xaa, 0xba, 0xbb, 0xac, + 0x9a, 0x8a, 0x72, 0x54, 0x34, 0x33, 0x12, 0x90, 0xbb, 0x8a, 0x63, 0x44, 0x12, 0x90, 0xa9, 0xdb, + 0xdd, 0xcb, 0xab, 0x9a, 0x99, 0x99, 0x08, 0x11, 0x22, 0x00, 0x9a, 0x68, 0x36, 0x14, 0x90, 0x99, + 0x30, 0x36, 0x24, 0x12, 0x98, 0xaa, 0xb9, 0xbb, 0xbc, 0xac, 0x18, 0x46, 0x35, 0x34, 0x22, 0x01, + 0xaa, 0xab, 0x30, 0x37, 0x13, 0x12, 0x00, 0xb9, 0xef, 0xdb, 0xab, 0xaa, 0xaa, 0xa9, 0x89, 0x28, + 0x21, 0x90, 0xaa, 0x28, 0x67, 0x13, 0x91, 0x9a, 0x10, 0x44, 0x34, 0x22, 0x01, 0x99, 0x99, 0xba, + 0xdc, 0xab, 0x0a, 0x51, 0x45, 0x34, 0x34, 0x12, 0xa9, 0xaa, 0x18, 0x44, 0x32, 0x22, 0x24, 0x82, + 0xfb, 0xdc, 0xbb, 0xac, 0xaa, 0xaa, 0x9a, 0x10, 0x21, 0x90, 0xac, 0x19, 0x55, 0x33, 0x81, 0x99, + 0x09, 0x53, 0x44, 0x33, 0x12, 0x08, 0x08, 0xa9, 0xbd, 0xbd, 0x9b, 0x18, 0x52, 0x46, 0x34, 0x12, + 0x90, 0x9a, 0x19, 0x22, 0x23, 0x44, 0x53, 0x22, 0xa8, 0xce, 0xcc, 0xba, 0xcb, 0xba, 0xab, 0x18, + 0x11, 0x90, 0xbb, 0x09, 0x54, 0x34, 0x12, 0x98, 0x99, 0x31, 0x46, 0x33, 0x23, 0x02, 0x01, 0xa1, + 0xec, 0xab, 0xbb, 0xbb, 0x29, 0x57, 0x35, 0x23, 0x80, 0x98, 0x09, 0x18, 0x12, 0x32, 0x47, 0x24, + 0x81, 0xca, 0xcc, 0xbb, 0xcc, 0xcb, 0xaa, 0x88, 0x11, 0x90, 0xaa, 0x8a, 0x31, 0x45, 0x13, 0x80, + 0x9a, 0x10, 0x54, 0x34, 0x32, 0x32, 0x23, 0x80, 0xb9, 0xbd, 0xbc, 0xcd, 0x8b, 0x61, 0x44, 0x23, + 0x01, 0x80, 0x00, 0x08, 0x10, 0x31, 0x56, 0x43, 0x12, 0xa8, 0xcb, 0xdb, 0xcc, 0xdb, 0x9b, 0x89, + 0x80, 0x80, 0xa9, 0xaa, 0x10, 0x42, 0x24, 0x81, 0xaa, 0x19, 0x53, 0x43, 0x53, 0x23, 0x23, 0x01, + 0x98, 0x88, 0xdc, 0xcd, 0xaa, 0x28, 0x36, 0x34, 0x12, 0x02, 0x01, 0x00, 0x08, 0x28, 0x74, 0x44, + 0x12, 0x80, 0x99, 0xb9, 0xde, 0xbc, 0xcb, 0x99, 0x88, 0x90, 0xa9, 0x9a, 0x89, 0x31, 0x24, 0x01, + 0x99, 0x89, 0x52, 0x43, 0x53, 0x35, 0x22, 0x11, 0x11, 0x01, 0xb8, 0xdf, 0xbb, 0x0a, 0x52, 0x24, + 0x23, 0x22, 0x12, 0x00, 0x99, 0x0a, 0x73, 0x46, 0x12, 0x01, 0x01, 0x98, 0xdc, 0xcd, 0xbb, 0x9b, + 0x99, 0x88, 0xb9, 0xcb, 0x8a, 0x21, 0x33, 0x03, 0xa9, 0x08, 0x30, 0x63, 0x45, 0x44, 0x22, 0x02, + 0x22, 0x33, 0x92, 0xdd, 0xbc, 0x9b, 0x31, 0x44, 0x24, 0x33, 0x33, 0x03, 0xb8, 0x8a, 0x72, 0x44, + 0x23, 0x32, 0x32, 0x02, 0xfa, 0xcd, 0xac, 0xbb, 0x99, 0x98, 0xb9, 0xbc, 0x9b, 0x18, 0x21, 0x00, + 0x80, 0x98, 0x8a, 0x30, 0x66, 0x34, 0x14, 0x11, 0x22, 0x34, 0x02, 0xda, 0xbd, 0xbb, 0x0a, 0x42, + 0x32, 0x54, 0x24, 0x12, 0x98, 0x9a, 0x20, 0x44, 0x33, 0x44, 0x33, 0x24, 0x90, 0xdd, 0xbc, 0xbc, + 0xa9, 0x98, 0xa9, 0xcc, 0x9a, 0x89, 0x00, 0x00, 0x01, 0x80, 0x99, 0x19, 0x54, 0x44, 0x23, 0x21, + 0x42, 0x44, 0x22, 0xa0, 0xeb, 0xba, 0x89, 0x08, 0x31, 0x45, 0x45, 0x12, 0x80, 0x89, 0x08, 0x22, + 0x42, 0x43, 0x35, 0x34, 0x02, 0xb9, 0xcf, 0xac, 0x9a, 0x99, 0xaa, 0xbb, 0xbc, 0x8a, 0x89, 0x08, + 0x11, 0x81, 0xba, 0x8b, 0x73, 0x34, 0x24, 0x12, 0x42, 0x44, 0x34, 0x80, 0xaa, 0xbc, 0xab, 0xaa, + 0x89, 0x64, 0x35, 0x14, 0x01, 0x89, 0x00, 0x01, 0x12, 0x63, 0x53, 0x34, 0x24, 0x91, 0xdb, 0xbc, + 0xbb, 0x9a, 0xab, 0xcc, 0xba, 0xab, 0xa9, 0x88, 0x11, 0x81, 0xcb, 0x9b, 0x31, 0x46, 0x23, 0x22, + 0x52, 0x45, 0x24, 0x02, 0x98, 0xa9, 0xca, 0xcb, 0x8a, 0x30, 0x37, 0x34, 0x01, 0x00, 0x80, 0x11, + 0x11, 0x21, 0x64, 0x55, 0x33, 0x02, 0xc9, 0xcb, 0xbb, 0xab, 0xbb, 0xbc, 0xbc, 0xcb, 0xaa, 0x89, + 0x18, 0x80, 0xaa, 0xac, 0x29, 0x34, 0x24, 0x11, 0x52, 0x46, 0x34, 0x12, 0x80, 0x88, 0xba, 0xcd, + 0xab, 0x18, 0x44, 0x43, 0x12, 0x01, 0x10, 0x11, 0x11, 0x08, 0x61, 0x56, 0x34, 0x13, 0x90, 0xcb, + 0xcb, 0xba, 0xac, 0xba, 0xcb, 0xbc, 0xba, 0x9a, 0x08, 0x80, 0xb9, 0xbb, 0x1a, 0x54, 0x12, 0x80, + 0x41, 0x46, 0x35, 0x22, 0x11, 0x11, 0xa8, 0xdd, 0xab, 0x89, 0x31, 0x53, 0x23, 0x12, 0x11, 0x22, + 0x81, 0xb9, 0x39, 0x77, 0x27, 0x13, 0x01, 0x99, 0xba, 0xac, 0xbb, 0xcb, 0xca, 0xbc, 0xac, 0x9a, + 0x89, 0x88, 0xa8, 0xbb, 0x1a, 0x43, 0x12, 0x99, 0x30, 0x67, 0x43, 0x32, 0x43, 0x22, 0x81, 0xda, + 0xbc, 0x9a, 0x18, 0x42, 0x32, 0x23, 0x42, 0x33, 0x02, 0xda, 0x8b, 0x73, 0x37, 0x33, 0x22, 0x88, + 0xba, 0xcb, 0xac, 0xbb, 0xdb, 0xbc, 0xbc, 0xbb, 0x89, 0x88, 0xaa, 0xac, 0x89, 0x33, 0x81, 0xba, + 0x28, 0x47, 0x34, 0x34, 0x34, 0x34, 0x12, 0xb0, 0xcd, 0xbb, 0x89, 0x11, 0x23, 0x33, 0x35, 0x35, + 0x03, 0xb9, 0xbb, 0x60, 0x55, 0x43, 0x22, 0x02, 0x98, 0xba, 0xcb, 0xba, 0xcb, 0xbd, 0xae, 0xab, + 0x99, 0x99, 0xb9, 0xac, 0x89, 0x11, 0x91, 0xa9, 0x19, 0x53, 0x44, 0x43, 0x44, 0x34, 0x23, 0x91, + 0xda, 0xbb, 0x9a, 0x10, 0x11, 0x22, 0x55, 0x34, 0x23, 0x98, 0xab, 0x29, 0x55, 0x44, 0x34, 0x12, + 0x01, 0x99, 0xab, 0xbb, 0xca, 0xdc, 0xcc, 0xbb, 0xa9, 0xa8, 0xbb, 0xbc, 0x99, 0x10, 0x88, 0x9a, + 0x89, 0x32, 0x35, 0x53, 0x45, 0x44, 0x33, 0x12, 0xa9, 0xbc, 0x9b, 0x88, 0x80, 0x19, 0x73, 0x45, + 0x22, 0x80, 0xa9, 0x9a, 0x41, 0x45, 0x44, 0x33, 0x11, 0x80, 0xa9, 0x9a, 0xa9, 0xdc, 0xbe, 0xbb, + 0xaa, 0xa9, 0xbc, 0xbb, 0x9a, 0x88, 0x88, 0xaa, 0x8a, 0x21, 0x22, 0x42, 0x57, 0x54, 0x43, 0x12, + 0x90, 0xaa, 0x9b, 0x88, 0xb9, 0x9b, 0x50, 0x55, 0x23, 0x02, 0xa9, 0xab, 0x19, 0x55, 0x45, 0x24, + 0x23, 0x81, 0x88, 0x88, 0x98, 0xea, 0xcc, 0xbb, 0xab, 0xaa, 0xdb, 0xab, 0x9b, 0x99, 0x99, 0x9a, + 0x8a, 0x08, 0x11, 0x08, 0x72, 0x47, 0x44, 0x23, 0x00, 0x99, 0x98, 0x88, 0xa9, 0xac, 0x19, 0x54, + 0x34, 0x22, 0xa0, 0xbb, 0x9b, 0x41, 0x47, 0x35, 0x24, 0x02, 0x00, 0x00, 0x81, 0xb9, 0xbf, 0xac, + 0xab, 0xaa, 0xdb, 0xba, 0xaa, 0xa9, 0xaa, 0xa9, 0x9a, 0x88, 0x01, 0xb8, 0x8b, 0x77, 0x45, 0x23, + 0x11, 0x88, 0x88, 0x90, 0xa9, 0xbc, 0x8a, 0x52, 0x35, 0x24, 0x81, 0xa9, 0xbb, 0x0a, 0x73, 0x37, + 0x24, 0x12, 0x01, 0x21, 0x12, 0xa8, 0xcd, 0xcb, 0xab, 0xbb, 0xbc, 0xcb, 0xaa, 0xba, 0xba, 0xba, + 0xaa, 0x09, 0x01, 0xc9, 0xad, 0x61, 0x46, 0x33, 0x12, 0x11, 0x00, 0x80, 0xb9, 0xdc, 0xaa, 0x20, + 0x44, 0x33, 0x13, 0x90, 0xbd, 0xac, 0x20, 0x47, 0x24, 0x13, 0x12, 0x32, 0x24, 0x80, 0xba, 0xbd, + 0xcb, 0xcb, 0xcb, 0xbb, 0xbb, 0xab, 0xcb, 0xac, 0xaa, 0x88, 0x01, 0xb8, 0xbd, 0x29, 0x47, 0x34, + 0x23, 0x22, 0x12, 0x02, 0xa8, 0xcc, 0xbb, 0x08, 0x52, 0x53, 0x24, 0x02, 0xc9, 0xcb, 0x09, 0x62, + 0x34, 0x22, 0x22, 0x34, 0x24, 0x01, 0xa8, 0xca, 0xdb, 0xbb, 0xcc, 0xbb, 0xac, 0xaa, 0xba, 0xbc, + 0xaa, 0x09, 0x11, 0xb8, 0xbe, 0x89, 0x62, 0x34, 0x24, 0x23, 0x23, 0x22, 0x81, 0xca, 0xbb, 0xaa, + 0x18, 0x55, 0x44, 0x13, 0xb8, 0xbd, 0x9b, 0x31, 0x45, 0x32, 0x42, 0x43, 0x34, 0x22, 0x00, 0xa9, + 0xca, 0xdb, 0xdb, 0xbb, 0xac, 0xaa, 0xba, 0xbd, 0x9b, 0x09, 0x01, 0xa8, 0xcc, 0xaa, 0x28, 0x44, + 0x34, 0x34, 0x43, 0x23, 0x11, 0x98, 0xb9, 0xbb, 0xab, 0x60, 0x46, 0x23, 0x91, 0xcc, 0xaa, 0x10, + 0x33, 0x43, 0x34, 0x44, 0x34, 0x33, 0x11, 0x80, 0xa9, 0xdb, 0xcc, 0xbc, 0xbb, 0xab, 0xdb, 0xbc, + 0xab, 0x88, 0x00, 0xa0, 0xca, 0xac, 0x09, 0x31, 0x34, 0x35, 0x45, 0x32, 0x21, 0x00, 0x90, 0xca, + 0xbb, 0x09, 0x65, 0x43, 0x81, 0xb9, 0x9c, 0x09, 0x11, 0x22, 0x44, 0x44, 0x53, 0x33, 0x12, 0x01, + 0x00, 0xa8, 0xdc, 0xbc, 0xbb, 0xbb, 0xeb, 0xbc, 0xac, 0x99, 0x80, 0x88, 0xb9, 0xbb, 0x9a, 0x18, + 0x31, 0x55, 0x35, 0x24, 0x23, 0x23, 0x11, 0xb9, 0xcc, 0x8a, 0x72, 0x34, 0x02, 0xa8, 0xaa, 0x89, + 0x00, 0x20, 0x52, 0x45, 0x44, 0x33, 0x23, 0x12, 0x12, 0x81, 0xdb, 0xbd, 0xac, 0xbb, 0xdb, 0xbc, + 0xbc, 0xaa, 0x88, 0x98, 0xa9, 0xbb, 0xab, 0xaa, 0x18, 0x73, 0x44, 0x43, 0x33, 0x43, 0x33, 0xa0, + 0xdc, 0x9a, 0x21, 0x35, 0x23, 0x90, 0xba, 0x9a, 0x89, 0x89, 0x28, 0x57, 0x35, 0x25, 0x22, 0x22, + 0x22, 0x02, 0xb8, 0xcd, 0xba, 0xbb, 0xcc, 0xdc, 0xbb, 0xab, 0x99, 0x98, 0xaa, 0xaa, 0xbb, 0xac, + 0x8a, 0x38, 0x45, 0x34, 0x34, 0x45, 0x23, 0x82, 0xca, 0x9b, 0x18, 0x34, 0x24, 0x01, 0x99, 0x89, + 0x98, 0xa8, 0x8a, 0x73, 0x47, 0x33, 0x23, 0x34, 0x33, 0x23, 0x90, 0xda, 0xab, 0xab, 0xcc, 0xdd, + 0xbb, 0xac, 0x99, 0x98, 0x99, 0xa9, 0xb9, 0xdb, 0xaa, 0x08, 0x31, 0x42, 0x63, 0x54, 0x24, 0x02, + 0xa8, 0xbb, 0x0a, 0x41, 0x33, 0x02, 0x80, 0x89, 0x88, 0xcb, 0xac, 0x40, 0x46, 0x43, 0x43, 0x43, + 0x43, 0x33, 0x01, 0xb8, 0xaa, 0xa9, 0xeb, 0xcd, 0xbc, 0xac, 0x9a, 0x99, 0x99, 0x98, 0xa9, 0xcb, + 0xac, 0x09, 0x00, 0x08, 0x40, 0x47, 0x44, 0x12, 0x98, 0xaa, 0x8a, 0x21, 0x33, 0x14, 0x11, 0x11, + 0x01, 0xb9, 0xad, 0x19, 0x45, 0x43, 0x53, 0x53, 0x53, 0x43, 0x11, 0x88, 0x89, 0x89, 0xb9, 0xcd, + 0xbd, 0xbb, 0xbb, 0xab, 0x9a, 0x99, 0xa9, 0xcc, 0xac, 0x99, 0x88, 0xaa, 0x19, 0x57, 0x44, 0x23, + 0x01, 0xaa, 0x9b, 0x10, 0x22, 0x32, 0x32, 0x24, 0x02, 0xb9, 0xbe, 0x9b, 0x31, 0x34, 0x44, 0x45, + 0x36, 0x34, 0x22, 0x00, 0x89, 0x80, 0xa8, 0xdc, 0xcc, 0xbb, 0xcb, 0xba, 0x99, 0x89, 0x98, 0xcb, + 0xab, 0x9a, 0xa8, 0xcc, 0x9a, 0x62, 0x46, 0x33, 0x02, 0xa8, 0x9a, 0x18, 0x11, 0x21, 0x53, 0x33, + 0x23, 0x81, 0xcc, 0xab, 0x00, 0x11, 0x21, 0x66, 0x55, 0x43, 0x23, 0x11, 0x00, 0x00, 0xa8, 0xda, + 0xbc, 0xbc, 0xbd, 0xcb, 0x8a, 0x89, 0x88, 0xaa, 0xab, 0x89, 0xa9, 0xcd, 0xac, 0x09, 0x45, 0x25, + 0x13, 0x88, 0x99, 0x88, 0x08, 0x10, 0x32, 0x45, 0x22, 0x80, 0xb9, 0xab, 0x89, 0x90, 0xac, 0x69, + 0x57, 0x44, 0x32, 0x12, 0x11, 0x11, 0x80, 0xba, 0xdb, 0xcc, 0xbc, 0xbc, 0xaa, 0x88, 0x99, 0xab, + 0x9b, 0x89, 0x90, 0xfb, 0xbd, 0x8b, 0x51, 0x44, 0x22, 0x11, 0x88, 0x88, 0x80, 0x88, 0x30, 0x54, + 0x43, 0x01, 0x90, 0x8a, 0x08, 0xa8, 0xcc, 0x0b, 0x75, 0x34, 0x34, 0x32, 0x22, 0x22, 0x00, 0x98, + 0xbb, 0xdd, 0xdc, 0xbb, 0xaa, 0x9a, 0xa9, 0xbb, 0xab, 0x0a, 0x10, 0xfa, 0xcd, 0x9b, 0x28, 0x34, + 0x24, 0x22, 0x00, 0x00, 0x98, 0x99, 0x19, 0x73, 0x34, 0x13, 0x08, 0x88, 0x11, 0xa1, 0xdd, 0xab, + 0x51, 0x45, 0x34, 0x33, 0x43, 0x22, 0x11, 0x00, 0x88, 0xda, 0xdd, 0xcb, 0xba, 0x9a, 0x9a, 0xbb, + 0xac, 0x08, 0x10, 0xb0, 0xed, 0xab, 0x09, 0x32, 0x25, 0x33, 0x23, 0x21, 0x00, 0xa8, 0x8b, 0x73, + 0x34, 0x23, 0x80, 0x18, 0x32, 0x91, 0xdd, 0xbc, 0x28, 0x54, 0x34, 0x35, 0x43, 0x22, 0x11, 0x12, + 0x12, 0xa8, 0xec, 0xcc, 0xba, 0xaa, 0xaa, 0xcb, 0xab, 0x8a, 0x11, 0x90, 0xdc, 0xbc, 0x9b, 0x18, + 0x22, 0x34, 0x34, 0x33, 0x01, 0xa8, 0x9b, 0x51, 0x45, 0x12, 0x00, 0x20, 0x43, 0x82, 0xeb, 0xac, + 0x8a, 0x31, 0x45, 0x45, 0x33, 0x24, 0x21, 0x22, 0x33, 0x02, 0xd9, 0xcd, 0xac, 0xaa, 0xaa, 0xbc, + 0xac, 0x99, 0x01, 0x00, 0xba, 0xdc, 0xaa, 0x99, 0x00, 0x22, 0x44, 0x43, 0x12, 0x98, 0x89, 0x38, + 0x44, 0x12, 0x98, 0x31, 0x35, 0x03, 0xda, 0xbc, 0xab, 0x89, 0x72, 0x54, 0x53, 0x32, 0x22, 0x32, + 0x53, 0x12, 0x90, 0xdb, 0xbc, 0xaa, 0xcb, 0xcc, 0xab, 0x9a, 0x08, 0x81, 0xb8, 0xeb, 0xbb, 0x9a, + 0x88, 0x28, 0x63, 0x34, 0x23, 0x91, 0x89, 0x30, 0x34, 0x12, 0x89, 0x50, 0x35, 0x13, 0x90, 0xba, + 0xcd, 0xaa, 0x29, 0x55, 0x45, 0x33, 0x32, 0x33, 0x35, 0x34, 0x01, 0xba, 0xbc, 0xac, 0xcb, 0xcc, + 0xcb, 0x9a, 0x89, 0x80, 0x98, 0xbb, 0xbc, 0xaa, 0x9a, 0x89, 0x72, 0x44, 0x13, 0x81, 0x88, 0x20, + 0x32, 0x81, 0x88, 0x40, 0x45, 0x22, 0x01, 0xa8, 0xdc, 0xbc, 0x8a, 0x41, 0x64, 0x33, 0x23, 0x33, + 0x45, 0x34, 0x11, 0x98, 0xba, 0xaa, 0xcc, 0xbc, 0xae, 0xab, 0x8a, 0x88, 0x88, 0xba, 0xac, 0xba, + 0xba, 0x9c, 0x38, 0x46, 0x33, 0x81, 0x88, 0x31, 0x22, 0x81, 0x88, 0x30, 0x45, 0x24, 0x12, 0x91, + 0xdc, 0xcc, 0xbb, 0x18, 0x45, 0x34, 0x33, 0x33, 0x36, 0x35, 0x22, 0x00, 0x98, 0x99, 0xc9, 0xcc, + 0xcd, 0xba, 0x8a, 0x09, 0x89, 0xa9, 0xaa, 0xba, 0xdc, 0xab, 0x19, 0x63, 0x23, 0x02, 0x00, 0x21, + 0x22, 0x21, 0x20, 0x21, 0x52, 0x54, 0x33, 0x22, 0xa1, 0xcf, 0xbc, 0x89, 0x32, 0x35, 0x32, 0x42, + 0x36, 0x35, 0x22, 0x02, 0x80, 0x80, 0xa8, 0xdc, 0xbe, 0xac, 0x9b, 0x99, 0x89, 0x99, 0x89, 0xa9, + 0xdc, 0xab, 0x0a, 0x32, 0x25, 0x22, 0x21, 0x12, 0x22, 0x11, 0x11, 0x20, 0x53, 0x44, 0x54, 0x23, + 0x12, 0xda, 0xbd, 0x9a, 0x20, 0x23, 0x11, 0x52, 0x46, 0x44, 0x32, 0x11, 0x10, 0x00, 0x00, 0xda, + 0xbe, 0xbd, 0xaa, 0x9a, 0x9a, 0x99, 0x00, 0x80, 0xeb, 0xcb, 0x99, 0x20, 0x32, 0x43, 0x22, 0x23, + 0x23, 0x01, 0x11, 0x10, 0x22, 0x45, 0x45, 0x44, 0x23, 0xb8, 0xcd, 0x9b, 0x18, 0x11, 0x08, 0x18, + 0x65, 0x45, 0x32, 0x22, 0x11, 0x11, 0x21, 0xa8, 0xcf, 0xbc, 0xbb, 0xbb, 0xbb, 0x9b, 0x18, 0x81, + 0xeb, 0xcc, 0x9a, 0x09, 0x10, 0x22, 0x32, 0x32, 0x24, 0x12, 0x01, 0x11, 0x02, 0x08, 0x75, 0x47, + 0x23, 0x81, 0xca, 0xaa, 0x08, 0x12, 0x80, 0x8a, 0x73, 0x45, 0x24, 0x23, 0x12, 0x21, 0x14, 0x81, + 0xeb, 0xbc, 0xbc, 0xbc, 0xbb, 0x9b, 0x88, 0x81, 0xb9, 0xbd, 0xac, 0x99, 0x00, 0x11, 0x32, 0x34, + 0x34, 0x12, 0x22, 0x34, 0x81, 0xaa, 0x70, 0x47, 0x24, 0x11, 0x99, 0xaa, 0x08, 0x01, 0x90, 0x9a, + 0x38, 0x77, 0x43, 0x22, 0x12, 0x23, 0x34, 0x02, 0xb8, 0xcc, 0xcc, 0xdb, 0xab, 0xab, 0x89, 0x80, + 0xa8, 0xcb, 0xbc, 0x9a, 0x8a, 0x89, 0x10, 0x33, 0x33, 0x22, 0x54, 0x43, 0x90, 0xcc, 0x09, 0x56, + 0x34, 0x22, 0x90, 0x99, 0x88, 0x10, 0x90, 0xbc, 0x0b, 0x74, 0x34, 0x33, 0x32, 0x44, 0x24, 0x13, + 0x80, 0xa9, 0xeb, 0xdc, 0xbb, 0xbb, 0x8a, 0x89, 0x98, 0xca, 0xac, 0x9a, 0x9a, 0x99, 0x18, 0x22, + 0x01, 0x10, 0x55, 0x43, 0x90, 0xcc, 0x8b, 0x62, 0x35, 0x33, 0x02, 0x88, 0x08, 0x11, 0xa0, 0xdc, + 0x8b, 0x51, 0x44, 0x23, 0x42, 0x53, 0x33, 0x24, 0x21, 0x00, 0xa9, 0xce, 0xbc, 0xbc, 0xa9, 0x89, + 0x98, 0xaa, 0xbb, 0xba, 0xbb, 0x9b, 0x18, 0x01, 0xba, 0x9c, 0x73, 0x26, 0x81, 0xcb, 0xbb, 0x30, + 0x47, 0x24, 0x11, 0x00, 0x18, 0x11, 0x90, 0xeb, 0xab, 0x20, 0x44, 0x32, 0x34, 0x45, 0x43, 0x32, + 0x33, 0x22, 0x81, 0xea, 0xcc, 0xac, 0x9b, 0x9a, 0x99, 0xa9, 0xa9, 0xba, 0xbc, 0xbb, 0x89, 0x90, + 0xeb, 0x9b, 0x20, 0x35, 0x12, 0xea, 0xbc, 0x09, 0x62, 0x24, 0x12, 0x00, 0x20, 0x33, 0x91, 0xfb, + 0xba, 0x08, 0x32, 0x42, 0x44, 0x35, 0x25, 0x33, 0x34, 0x32, 0x22, 0xa0, 0xec, 0xbc, 0xaa, 0xab, + 0xaa, 0x99, 0xa9, 0xba, 0xbd, 0x9c, 0x88, 0x98, 0xca, 0xbb, 0x28, 0x45, 0x23, 0xa0, 0xcd, 0x9b, + 0x31, 0x26, 0x12, 0x01, 0x32, 0x25, 0x02, 0xb9, 0xac, 0x9a, 0x08, 0x11, 0x64, 0x44, 0x34, 0x34, + 0x34, 0x43, 0x33, 0x01, 0xc9, 0xbc, 0xbc, 0xab, 0xac, 0x99, 0x89, 0xaa, 0xbd, 0xaa, 0x99, 0x98, + 0xbc, 0xad, 0x0a, 0x52, 0x24, 0x91, 0xda, 0xaa, 0x28, 0x33, 0x12, 0x18, 0x54, 0x34, 0x12, 0x98, + 0xba, 0xbb, 0xbb, 0x99, 0x41, 0x67, 0x53, 0x32, 0x43, 0x44, 0x33, 0x13, 0x98, 0xcb, 0xbc, 0xcb, + 0xbb, 0x9a, 0x89, 0xb9, 0xbd, 0xbb, 0x9a, 0xb9, 0xcc, 0xcc, 0x9a, 0x31, 0x35, 0x01, 0xc9, 0xab, + 0x19, 0x32, 0x02, 0x20, 0x74, 0x43, 0x22, 0x81, 0x98, 0xba, 0xaa, 0xac, 0x0a, 0x73, 0x35, 0x34, + 0x34, 0x45, 0x43, 0x22, 0x01, 0x98, 0xca, 0xbc, 0xcb, 0xa9, 0x88, 0xa9, 0xcb, 0xbb, 0x9a, 0x99, + 0xdb, 0xdc, 0xaa, 0x10, 0x44, 0x02, 0x98, 0xab, 0x89, 0x11, 0x00, 0x11, 0x62, 0x35, 0x34, 0x01, + 0x80, 0xa8, 0xdb, 0xcb, 0x8a, 0x30, 0x36, 0x23, 0x44, 0x55, 0x43, 0x23, 0x22, 0x81, 0xb8, 0xdc, + 0xba, 0xaa, 0x99, 0x9a, 0xbc, 0xcb, 0x99, 0x89, 0xc9, 0xcd, 0xbb, 0x09, 0x43, 0x12, 0xa0, 0xaa, + 0x99, 0x00, 0x80, 0x08, 0x73, 0x44, 0x24, 0x12, 0x01, 0x81, 0xd9, 0xbc, 0xab, 0x20, 0x24, 0x23, + 0x63, 0x46, 0x34, 0x24, 0x33, 0x23, 0x90, 0xda, 0xcb, 0xaa, 0x9a, 0xaa, 0xdb, 0xcb, 0x99, 0x08, + 0xa9, 0xcd, 0xbc, 0x89, 0x21, 0x23, 0x80, 0x99, 0x09, 0x00, 0x80, 0x18, 0x51, 0x55, 0x33, 0x33, + 0x43, 0x33, 0xc9, 0xcd, 0x9a, 0x18, 0x01, 0x01, 0x31, 0x47, 0x54, 0x43, 0x34, 0x33, 0x12, 0xa9, + 0xbc, 0xcb, 0xaa, 0xb9, 0xdb, 0xbc, 0xaa, 0x00, 0xa8, 0xdc, 0xbc, 0x9a, 0x10, 0x22, 0x00, 0x88, + 0x18, 0x00, 0x00, 0x18, 0x51, 0x35, 0x43, 0x42, 0x44, 0x24, 0x81, 0xbb, 0xab, 0x98, 0x98, 0x99, + 0x19, 0x51, 0x56, 0x45, 0x44, 0x24, 0x22, 0x80, 0xa9, 0xbb, 0xaa, 0xba, 0xcd, 0xcc, 0x8a, 0x08, + 0x80, 0xca, 0xcc, 0x9a, 0x88, 0x01, 0x81, 0x88, 0x10, 0x10, 0x80, 0x08, 0x32, 0x26, 0x22, 0x63, + 0x45, 0x24, 0x01, 0x98, 0x98, 0x88, 0xa8, 0x99, 0x88, 0x09, 0x51, 0x57, 0x55, 0x43, 0x33, 0x02, + 0x98, 0xaa, 0x9a, 0xaa, 0xcd, 0xcc, 0x9a, 0x09, 0x00, 0xc9, 0xbc, 0xbb, 0x99, 0x08, 0x88, 0x88, + 0x00, 0x11, 0x99, 0x29, 0x64, 0x12, 0x88, 0x41, 0x47, 0x34, 0x11, 0x81, 0x88, 0x08, 0x98, 0x9a, + 0xaa, 0xdb, 0x9a, 0x71, 0x65, 0x44, 0x33, 0x23, 0x80, 0xa9, 0x89, 0x99, 0xec, 0xcb, 0xab, 0x89, + 0x80, 0xb8, 0xcd, 0xab, 0xaa, 0x89, 0x99, 0x09, 0x10, 0x01, 0xa8, 0x29, 0x54, 0x13, 0x99, 0x41, + 0x57, 0x43, 0x22, 0x11, 0x01, 0x80, 0x80, 0x90, 0xa9, 0xdb, 0xbc, 0x9a, 0x73, 0x57, 0x43, 0x23, + 0x01, 0x88, 0x08, 0x80, 0xda, 0xcc, 0xbb, 0x99, 0x08, 0xa9, 0xdb, 0xbb, 0xab, 0xab, 0xab, 0x09, + 0x00, 0x80, 0xbb, 0x19, 0x44, 0x02, 0xa9, 0x39, 0x77, 0x26, 0x22, 0x13, 0x11, 0x10, 0x10, 0x80, + 0x98, 0xba, 0xcf, 0xac, 0x19, 0x55, 0x45, 0x23, 0x12, 0x00, 0x10, 0x01, 0xc8, 0xcc, 0xbc, 0x9a, + 0x88, 0x99, 0xcb, 0xab, 0xbb, 0xcb, 0xbb, 0x09, 0x08, 0x98, 0x99, 0x09, 0x42, 0x91, 0xcb, 0x0a, + 0x65, 0x44, 0x34, 0x33, 0x22, 0x11, 0x11, 0x10, 0x11, 0x82, 0xfc, 0xcd, 0x9a, 0x50, 0x45, 0x24, + 0x22, 0x10, 0x21, 0x12, 0x90, 0xeb, 0xbc, 0xaa, 0x99, 0xa9, 0xcb, 0xbb, 0xcb, 0xcb, 0xab, 0x8a, + 0x99, 0xb9, 0xaa, 0x08, 0x22, 0x90, 0xba, 0xbc, 0x51, 0x47, 0x53, 0x33, 0x24, 0x12, 0x00, 0x10, + 0x31, 0x43, 0xa1, 0xee, 0xbb, 0x29, 0x65, 0x24, 0x23, 0x22, 0x22, 0x33, 0x02, 0xda, 0xbd, 0xba, + 0xaa, 0xbb, 0xbb, 0xcb, 0xbc, 0xcc, 0xba, 0x99, 0x98, 0xba, 0xab, 0x89, 0x11, 0x23, 0x81, 0xab, + 0x19, 0x65, 0x45, 0x35, 0x43, 0x12, 0x00, 0x00, 0x30, 0x35, 0x03, 0xfb, 0xbd, 0x89, 0x42, 0x35, + 0x43, 0x22, 0x32, 0x25, 0x12, 0xa8, 0xcb, 0xbb, 0xcb, 0xba, 0xaa, 0xab, 0xcc, 0xcc, 0xba, 0x99, + 0x9a, 0xbb, 0xbc, 0x8a, 0x18, 0x01, 0x88, 0xb9, 0xab, 0x28, 0x65, 0x45, 0x34, 0x33, 0x02, 0x88, + 0x30, 0x46, 0x22, 0xc9, 0xcd, 0x9a, 0x20, 0x35, 0x34, 0x32, 0x53, 0x34, 0x22, 0x80, 0xb9, 0xcb, + 0xcb, 0xbb, 0xaa, 0xa9, 0xdb, 0xbc, 0xcb, 0xaa, 0xa9, 0xba, 0xbc, 0xaa, 0x08, 0x80, 0x00, 0xa8, + 0xdb, 0x9a, 0x18, 0x74, 0x54, 0x33, 0x02, 0x90, 0x20, 0x45, 0x24, 0xa0, 0xcc, 0x9c, 0x18, 0x33, + 0x25, 0x33, 0x54, 0x43, 0x23, 0x12, 0x88, 0xb9, 0xcc, 0xab, 0xaa, 0xa9, 0xba, 0xcd, 0xba, 0xbb, + 0xba, 0xbc, 0xbc, 0xbb, 0x9a, 0x98, 0x08, 0x88, 0xa9, 0xcb, 0xab, 0x40, 0x77, 0x24, 0x12, 0x80, + 0x18, 0x44, 0x34, 0x01, 0xdb, 0xac, 0x09, 0x21, 0x33, 0x43, 0x45, 0x34, 0x24, 0x23, 0x02, 0x98, + 0xca, 0xbc, 0xaa, 0x99, 0xa9, 0xbc, 0xbc, 0xba, 0xac, 0xbb, 0xbc, 0xac, 0x9a, 0x89, 0x89, 0x88, + 0x98, 0xca, 0xbd, 0x8b, 0x73, 0x35, 0x13, 0x90, 0x08, 0x64, 0x34, 0x13, 0xc9, 0xcb, 0x8a, 0x00, + 0x21, 0x32, 0x46, 0x44, 0x33, 0x24, 0x23, 0x00, 0xb9, 0xcc, 0xaa, 0x9a, 0xba, 0xcb, 0xbc, 0xba, + 0xcb, 0xba, 0xbc, 0xbc, 0xaa, 0x89, 0x99, 0x00, 0x11, 0xc8, 0xcd, 0xaa, 0x30, 0x47, 0x13, 0x80, + 0x89, 0x73, 0x34, 0x14, 0x98, 0xba, 0xaa, 0x89, 0x08, 0x10, 0x54, 0x54, 0x43, 0x34, 0x33, 0x22, + 0x98, 0xba, 0xac, 0xaa, 0xbb, 0xcc, 0xbb, 0xcb, 0xba, 0xbb, 0xbd, 0xac, 0xab, 0xab, 0x9a, 0x09, + 0x22, 0xa1, 0xde, 0xcb, 0x08, 0x63, 0x22, 0x80, 0x8a, 0x72, 0x44, 0x33, 0x00, 0xa9, 0xaa, 0xab, + 0x99, 0x09, 0x52, 0x45, 0x44, 0x44, 0x33, 0x23, 0x00, 0x99, 0xaa, 0xba, 0xba, 0xcc, 0xcb, 0xba, + 0xba, 0xcb, 0xdb, 0xbb, 0xcb, 0xba, 0xbb, 0x99, 0x21, 0x91, 0xfb, 0xae, 0x89, 0x32, 0x24, 0x90, + 0xaa, 0x61, 0x45, 0x43, 0x11, 0x88, 0x99, 0xaa, 0xaa, 0x8a, 0x10, 0x53, 0x55, 0x44, 0x34, 0x33, + 0x12, 0x88, 0xa8, 0xa9, 0xb9, 0xdb, 0xcb, 0xab, 0xab, 0xbc, 0xbc, 0xcc, 0xba, 0xbb, 0xac, 0x9a, + 0x10, 0x12, 0xd9, 0xbd, 0x9a, 0x32, 0x25, 0x90, 0xbb, 0x28, 0x57, 0x43, 0x22, 0x01, 0x98, 0xaa, + 0xab, 0xab, 0x9a, 0x18, 0x73, 0x47, 0x44, 0x33, 0x22, 0x01, 0x88, 0x88, 0x98, 0xb9, 0xbc, 0xac, + 0xab, 0xcb, 0xbc, 0xbb, 0xcc, 0xdb, 0xba, 0x9b, 0x18, 0x23, 0xb8, 0xce, 0x9a, 0x21, 0x33, 0x90, + 0xbc, 0x0a, 0x55, 0x35, 0x33, 0x23, 0x02, 0xa9, 0xcb, 0xaa, 0xbb, 0xbc, 0x18, 0x75, 0x54, 0x33, + 0x24, 0x11, 0x00, 0x08, 0x98, 0xaa, 0xcb, 0xab, 0xbb, 0xdb, 0xcb, 0xbb, 0xbb, 0xbe, 0xbd, 0x9b, + 0x19, 0x21, 0x90, 0xcd, 0xaa, 0x20, 0x33, 0x81, 0xca, 0x9b, 0x52, 0x46, 0x43, 0x23, 0x12, 0x90, + 0xa9, 0xb9, 0xcb, 0xbc, 0xab, 0x51, 0x65, 0x34, 0x24, 0x12, 0x02, 0x01, 0x88, 0x99, 0xbb, 0xcb, + 0xab, 0xcb, 0xbc, 0xbb, 0xba, 0xdd, 0xbd, 0xab, 0x09, 0x11, 0x90, 0xcc, 0xab, 0x08, 0x33, 0x02, + 0xb9, 0xab, 0x28, 0x67, 0x34, 0x34, 0x22, 0x01, 0x89, 0xa9, 0xba, 0xcd, 0xbb, 0x09, 0x64, 0x45, + 0x33, 0x33, 0x32, 0x21, 0x00, 0x88, 0xbb, 0xcb, 0xbb, 0xcc, 0xac, 0xab, 0xa9, 0xfb, 0xdc, 0xaa, + 0x89, 0x00, 0x80, 0xcb, 0xbb, 0x0a, 0x11, 0x02, 0x90, 0xcb, 0x8a, 0x61, 0x55, 0x43, 0x22, 0x11, + 0x00, 0x80, 0x98, 0xdb, 0xbc, 0xab, 0x41, 0x56, 0x43, 0x33, 0x33, 0x23, 0x22, 0x80, 0xa8, 0xba, + 0xcb, 0xcc, 0xbc, 0x9a, 0x99, 0xda, 0xbe, 0xbc, 0x8a, 0x18, 0x80, 0xba, 0xad, 0x9a, 0x10, 0x12, + 0x01, 0xa9, 0xcb, 0x29, 0x56, 0x35, 0x23, 0x13, 0x12, 0x10, 0x88, 0xda, 0xcd, 0xbb, 0x09, 0x62, + 0x34, 0x35, 0x42, 0x22, 0x13, 0x02, 0x88, 0x88, 0xaa, 0xcd, 0xcb, 0x9a, 0x88, 0xa9, 0xde, 0xcb, + 0x99, 0x08, 0x80, 0xa8, 0xbb, 0x9c, 0x09, 0x10, 0x02, 0xa0, 0xcc, 0x8a, 0x62, 0x44, 0x43, 0x22, + 0x21, 0x21, 0x12, 0xb8, 0xdd, 0xbc, 0x9a, 0x20, 0x54, 0x53, 0x33, 0x34, 0x33, 0x12, 0x01, 0x01, + 0x98, 0xcc, 0xbd, 0xab, 0x08, 0xa8, 0xdd, 0xbc, 0xab, 0x89, 0x88, 0xa8, 0xcb, 0xbb, 0x9b, 0x08, + 0x22, 0x98, 0xcc, 0xbb, 0x28, 0x47, 0x34, 0x33, 0x33, 0x43, 0x33, 0x82, 0xea, 0xcc, 0xab, 0x09, + 0x42, 0x44, 0x44, 0x34, 0x32, 0x22, 0x11, 0x12, 0x01, 0xea, 0xdb, 0x9a, 0x09, 0x88, 0xdb, 0xbd, + 0xbb, 0x9a, 0x98, 0x99, 0xba, 0xbd, 0x9b, 0x19, 0x11, 0x81, 0xc9, 0xbc, 0x0a, 0x73, 0x25, 0x33, + 0x32, 0x24, 0x24, 0x13, 0xa0, 0xce, 0xab, 0x9a, 0x18, 0x52, 0x54, 0x34, 0x33, 0x33, 0x22, 0x43, + 0x12, 0xb0, 0xcd, 0xab, 0x09, 0x88, 0xda, 0xbd, 0xbc, 0xaa, 0x99, 0x88, 0xba, 0xdb, 0xbb, 0x89, + 0x00, 0x01, 0xb8, 0xcd, 0x9a, 0x30, 0x46, 0x42, 0x22, 0x33, 0x35, 0x33, 0x82, 0xdb, 0xbc, 0xbb, + 0x9a, 0x18, 0x55, 0x35, 0x34, 0x33, 0x32, 0x53, 0x22, 0x90, 0xdb, 0xab, 0x89, 0x90, 0xb9, 0xce, + 0xac, 0xab, 0x9a, 0x88, 0xaa, 0xdb, 0xcb, 0x99, 0x09, 0x01, 0x98, 0xbc, 0xbb, 0x29, 0x64, 0x43, + 0x32, 0x34, 0x35, 0x34, 0x02, 0x98, 0xcb, 0xac, 0xcb, 0x9a, 0x31, 0x46, 0x34, 0x33, 0x43, 0x43, + 0x24, 0x81, 0xa9, 0xba, 0x99, 0x09, 0xa9, 0xec, 0xbc, 0xcb, 0x9a, 0x99, 0x99, 0xcb, 0xcb, 0xab, + 0x8a, 0x80, 0x98, 0xbc, 0xad, 0x8a, 0x22, 0x44, 0x22, 0x34, 0x46, 0x33, 0x23, 0x81, 0xa8, 0xdb, + 0xbc, 0xac, 0x19, 0x53, 0x44, 0x22, 0x43, 0x34, 0x34, 0x12, 0x98, 0xaa, 0x9b, 0x88, 0x98, 0xda, + 0xcd, 0xbc, 0xaa, 0x9a, 0xa9, 0xca, 0xbc, 0xbb, 0x9b, 0x08, 0x80, 0xca, 0xbc, 0x9b, 0x10, 0x43, + 0x32, 0x54, 0x54, 0x34, 0x33, 0x13, 0x01, 0xa9, 0xdc, 0xbc, 0x89, 0x31, 0x35, 0x33, 0x54, 0x53, + 0x24, 0x13, 0x81, 0x99, 0x9a, 0x88, 0x80, 0xb8, 0xcd, 0xcc, 0xab, 0xaa, 0x9a, 0xbb, 0xcd, 0xbb, + 0xab, 0x09, 0x88, 0xb9, 0xbc, 0xab, 0x19, 0x21, 0x10, 0x62, 0x46, 0x35, 0x33, 0x24, 0x21, 0x01, + 0xea, 0xdb, 0x99, 0x18, 0x22, 0x22, 0x53, 0x45, 0x44, 0x22, 0x02, 0x90, 0x99, 0x98, 0x00, 0x80, + 0xda, 0xdc, 0xba, 0xaa, 0xaa, 0xaa, 0xdc, 0xcb, 0xaa, 0x89, 0x88, 0x99, 0xbb, 0xaa, 0x08, 0x01, + 0x88, 0x18, 0x67, 0x44, 0x22, 0x33, 0x35, 0x12, 0xb8, 0xbe, 0xab, 0x09, 0x11, 0x21, 0x43, 0x56, + 0x44, 0x33, 0x23, 0x01, 0x89, 0x09, 0x10, 0x11, 0xb8, 0xdd, 0xcb, 0xbb, 0xa9, 0xb9, 0xcc, 0xcc, + 0xbb, 0x99, 0x89, 0xb9, 0xcb, 0xaa, 0x88, 0x00, 0xa9, 0x09, 0x74, 0x34, 0x43, 0x43, 0x35, 0x33, + 0x90, 0xca, 0xcb, 0x99, 0x00, 0x80, 0x10, 0x64, 0x45, 0x43, 0x33, 0x11, 0x80, 0x09, 0x08, 0x10, + 0x90, 0xeb, 0xcc, 0xbb, 0xaa, 0xba, 0xdb, 0xcc, 0xbb, 0x9a, 0x89, 0xa9, 0xbc, 0xaa, 0x09, 0x98, + 0xaa, 0x8a, 0x72, 0x43, 0x32, 0x55, 0x44, 0x24, 0x01, 0xa8, 0xaa, 0x9a, 0x88, 0x89, 0x8a, 0x40, + 0x66, 0x34, 0x34, 0x22, 0x01, 0x80, 0x00, 0x11, 0x01, 0xc9, 0xdc, 0xcb, 0xaa, 0xa9, 0xca, 0xbc, + 0xbc, 0xab, 0x98, 0xa9, 0xbc, 0xab, 0x89, 0xb9, 0xbc, 0x8a, 0x22, 0x24, 0x43, 0x55, 0x46, 0x33, + 0x23, 0x90, 0xaa, 0x9a, 0xaa, 0xa9, 0xbc, 0x8b, 0x73, 0x46, 0x34, 0x23, 0x12, 0x01, 0x00, 0x21, + 0x21, 0x98, 0xcd, 0xcc, 0xaa, 0x99, 0xba, 0xcd, 0xcb, 0x9a, 0x99, 0xa9, 0xcb, 0x9a, 0x98, 0xba, + 0xac, 0x89, 0x21, 0x11, 0x10, 0x73, 0x57, 0x34, 0x23, 0x01, 0x98, 0x99, 0x89, 0xb9, 0xdb, 0xaa, + 0x18, 0x56, 0x35, 0x43, 0x12, 0x01, 0x10, 0x21, 0x22, 0x01, 0xca, 0xcd, 0xba, 0x99, 0xba, 0xdd, + 0xcb, 0xaa, 0xa9, 0xaa, 0xac, 0x9a, 0x99, 0xbb, 0xac, 0x9a, 0x10, 0x81, 0x99, 0x51, 0x57, 0x35, + 0x24, 0x12, 0x81, 0x80, 0x80, 0x98, 0xca, 0xcb, 0x8a, 0x51, 0x45, 0x34, 0x32, 0x12, 0x01, 0x22, + 0x33, 0x13, 0xa8, 0xce, 0xbb, 0x9a, 0xc9, 0xdc, 0xcb, 0xaa, 0xb9, 0xca, 0xaa, 0xaa, 0xa9, 0xcb, + 0xcb, 0x8a, 0x00, 0x88, 0xba, 0x8a, 0x74, 0x37, 0x34, 0x13, 0x02, 0x00, 0x00, 0x88, 0xba, 0xcd, + 0xbb, 0x08, 0x64, 0x53, 0x33, 0x23, 0x12, 0x32, 0x43, 0x33, 0x91, 0xdb, 0xab, 0x9a, 0xb9, 0xde, + 0xbb, 0xcb, 0xba, 0xbc, 0xba, 0xab, 0xb9, 0xdb, 0xbc, 0x9a, 0x00, 0x90, 0xca, 0xbb, 0x30, 0x77, + 0x43, 0x23, 0x12, 0x11, 0x11, 0x00, 0xa8, 0xcc, 0xcc, 0x8a, 0x20, 0x54, 0x43, 0x23, 0x12, 0x22, + 0x34, 0x34, 0x01, 0xb9, 0xaa, 0x89, 0xb9, 0xec, 0xac, 0xbb, 0xbc, 0xbc, 0xac, 0x9a, 0xaa, 0xbb, + 0xbd, 0xaa, 0x09, 0x80, 0xda, 0xcb, 0x0a, 0x62, 0x45, 0x33, 0x23, 0x13, 0x22, 0x22, 0x80, 0xeb, + 0xcc, 0xab, 0x0a, 0x42, 0x45, 0x23, 0x22, 0x22, 0x35, 0x24, 0x12, 0x98, 0x99, 0x89, 0xa9, 0xdb, + 0xbc, 0xbb, 0xcd, 0xcb, 0xbb, 0xaa, 0xa9, 0xcb, 0xbc, 0xbb, 0x09, 0x80, 0xc9, 0xcd, 0x9a, 0x28, + 0x55, 0x43, 0x23, 0x23, 0x32, 0x32, 0x03, 0xb8, 0xcf, 0xcb, 0x9a, 0x18, 0x53, 0x33, 0x23, 0x43, + 0x44, 0x34, 0x12, 0x80, 0x88, 0x88, 0x98, 0xbb, 0xdb, 0xcb, 0xdb, 0xcc, 0xbb, 0xaa, 0xaa, 0xcb, + 0xcc, 0xaa, 0x99, 0x80, 0xb8, 0xdc, 0xab, 0x09, 0x52, 0x44, 0x33, 0x33, 0x43, 0x43, 0x22, 0x00, + 0xca, 0xcd, 0xab, 0x89, 0x32, 0x34, 0x23, 0x43, 0x45, 0x34, 0x22, 0x00, 0x00, 0x00, 0x88, 0xa9, + 0x9a, 0xba, 0xcd, 0xcd, 0xac, 0xab, 0xa9, 0xca, 0xcb, 0xbb, 0x9a, 0x09, 0xa8, 0xcd, 0xbc, 0x9a, + 0x28, 0x54, 0x43, 0x23, 0x24, 0x24, 0x33, 0x22, 0xa0, 0xec, 0xbb, 0x9b, 0x20, 0x23, 0x23, 0x44, + 0x45, 0x43, 0x23, 0x02, 0x11, 0x00, 0x98, 0x99, 0x98, 0x89, 0xea, 0xdc, 0xcb, 0xab, 0x9a, 0xcb, + 0xcc, 0xab, 0xaa, 0x89, 0x88, 0xdb, 0xcc, 0xab, 0x89, 0x32, 0x35, 0x34, 0x34, 0x34, 0x43, 0x33, + 0x02, 0xda, 0xcc, 0xaa, 0x08, 0x10, 0x10, 0x31, 0x55, 0x43, 0x33, 0x23, 0x21, 0x11, 0x80, 0x98, + 0x89, 0x80, 0xb8, 0xdf, 0xcb, 0xbb, 0xaa, 0xcb, 0xdc, 0xbb, 0xab, 0x8a, 0x88, 0xb9, 0xce, 0xbb, + 0x9a, 0x10, 0x53, 0x44, 0x23, 0x34, 0x34, 0x35, 0x22, 0xa8, 0xcc, 0xaa, 0x8a, 0x88, 0x88, 0x10, + 0x63, 0x44, 0x33, 0x33, 0x23, 0x22, 0x00, 0x99, 0x89, 0x10, 0x90, 0xde, 0xbc, 0xac, 0xaa, 0xca, + 0xcc, 0xbc, 0xac, 0x8a, 0x88, 0x99, 0xbc, 0xcc, 0xaa, 0x89, 0x10, 0x34, 0x33, 0x53, 0x54, 0x44, + 0x22, 0x81, 0xb9, 0xab, 0x9b, 0x99, 0xa9, 0x0a, 0x52, 0x45, 0x34, 0x43, 0x33, 0x23, 0x12, 0x80, + 0x08, 0x20, 0x01, 0xda, 0xbd, 0xbc, 0xba, 0xca, 0xcc, 0xcd, 0xab, 0xaa, 0x88, 0x99, 0xca, 0xcc, + 0xba, 0x9b, 0x18, 0x32, 0x23, 0x32, 0x67, 0x44, 0x33, 0x12, 0x98, 0xaa, 0xaa, 0xa9, 0xbb, 0x9b, + 0x30, 0x55, 0x44, 0x43, 0x43, 0x32, 0x12, 0x81, 0x00, 0x11, 0x81, 0xa9, 0xdc, 0xbb, 0x9c, 0xa9, + 0xfb, 0xcc, 0xcb, 0x9a, 0x99, 0x88, 0xa9, 0xbc, 0xbd, 0xab, 0x89, 0x21, 0x01, 0x10, 0x73, 0x57, + 0x32, 0x13, 0x81, 0x98, 0x99, 0xa9, 0xcb, 0xaa, 0x89, 0x31, 0x63, 0x34, 0x35, 0x34, 0x22, 0x01, + 0x01, 0x11, 0x12, 0x80, 0xcb, 0xcc, 0x9a, 0x89, 0xdb, 0xce, 0xbb, 0xac, 0x99, 0x89, 0x88, 0xca, + 0xcd, 0xbb, 0x8a, 0x08, 0x80, 0x89, 0x40, 0x67, 0x43, 0x23, 0x12, 0x00, 0x98, 0xa8, 0xba, 0xac, + 0x99, 0x18, 0x21, 0x45, 0x45, 0x33, 0x33, 0x12, 0x11, 0x21, 0x32, 0x81, 0xda, 0xbc, 0xab, 0xa9, + 0xfa, 0xcc, 0xbc, 0xac, 0xab, 0x99, 0x88, 0xc9, 0xcd, 0xcb, 0x9a, 0x88, 0x88, 0x9a, 0x1a, 0x64, + 0x45, 0x23, 0x22, 0x02, 0x81, 0x90, 0xb9, 0xab, 0x9b, 0x89, 0x20, 0x64, 0x54, 0x43, 0x32, 0x12, + 0x11, 0x12, 0x23, 0x03, 0xb8, 0xad, 0xaa, 0x89, 0xca, 0xdd, 0xcc, 0xac, 0xbb, 0x9a, 0x88, 0xb9, + 0xed, 0xbb, 0xab, 0x99, 0x99, 0xbb, 0x9b, 0x72, 0x45, 0x43, 0x23, 0x23, 0x12, 0x80, 0x99, 0xba, + 0xaa, 0x9a, 0x09, 0x41, 0x56, 0x44, 0x32, 0x22, 0x12, 0x21, 0x33, 0x14, 0x90, 0xba, 0xaa, 0x9a, + 0xba, 0xec, 0xcd, 0xbd, 0xbc, 0x9a, 0x88, 0xa8, 0xdc, 0xcc, 0xaa, 0x89, 0x99, 0xaa, 0xbb, 0x18, + 0x55, 0x34, 0x34, 0x32, 0x33, 0x11, 0x88, 0x99, 0xaa, 0xaa, 0x9a, 0x18, 0x65, 0x45, 0x33, 0x33, + 0x22, 0x32, 0x34, 0x24, 0x00, 0x99, 0x98, 0x88, 0x09, 0xa9, 0xfd, 0xdc, 0xcb, 0x9a, 0x09, 0x98, + 0xdb, 0xbd, 0xbb, 0x9a, 0xa9, 0xdb, 0xbb, 0x9a, 0x31, 0x55, 0x43, 0x43, 0x23, 0x13, 0x01, 0x88, + 0x99, 0xaa, 0xbb, 0xab, 0x40, 0x47, 0x25, 0x23, 0x22, 0x22, 0x34, 0x23, 0x13, 0x80, 0x88, 0x99, + 0x18, 0x22, 0xc8, 0xff, 0xbd, 0xaa, 0x88, 0x90, 0xd9, 0xcc, 0xab, 0xaa, 0xa9, 0xbc, 0xcb, 0x9b, + 0x09, 0x41, 0x44, 0x34, 0x43, 0x23, 0x12, 0x11, 0x08, 0xa9, 0xbb, 0xbc, 0x0b, 0x73, 0x35, 0x23, + 0x23, 0x43, 0x33, 0x24, 0x23, 0x00, 0x80, 0x89, 0x08, 0x44, 0x12, 0xfc, 0xbd, 0xbb, 0x8a, 0x80, + 0xb9, 0xbf, 0xbc, 0xaa, 0xb9, 0xcb, 0xcc, 0xaa, 0x9a, 0x08, 0x42, 0x44, 0x34, 0x33, 0x33, 0x22, + 0x11, 0x80, 0xda, 0xbc, 0xab, 0x20, 0x45, 0x43, 0x32, 0x32, 0x34, 0x33, 0x24, 0x11, 0x81, 0xa9, + 0x18, 0x54, 0x24, 0xa8, 0xcf, 0xbb, 0x9a, 0x80, 0xb8, 0xcc, 0xbc, 0xab, 0xba, 0xbc, 0xcd, 0xba, + 0xab, 0x8a, 0x30, 0x63, 0x44, 0x33, 0x33, 0x32, 0x22, 0x12, 0xc8, 0xcc, 0xab, 0x89, 0x42, 0x43, + 0x33, 0x34, 0x34, 0x33, 0x43, 0x32, 0x80, 0x99, 0x09, 0x54, 0x35, 0x81, 0xdc, 0xbc, 0x99, 0x89, + 0xa8, 0xcb, 0xcc, 0xaa, 0xab, 0xbc, 0xcc, 0xbb, 0xbc, 0xaa, 0x88, 0x41, 0x53, 0x34, 0x24, 0x32, + 0x33, 0x32, 0x01, 0xca, 0xac, 0x9a, 0x10, 0x43, 0x53, 0x33, 0x34, 0x32, 0x44, 0x33, 0x02, 0x98, + 0x89, 0x63, 0x35, 0x03, 0xc9, 0xbd, 0xaa, 0x99, 0xa8, 0xcb, 0xbc, 0xbc, 0xba, 0xdb, 0xdb, 0xcb, + 0xac, 0xab, 0x9b, 0x08, 0x42, 0x44, 0x33, 0x24, 0x24, 0x33, 0x12, 0xa8, 0xcb, 0xba, 0x8a, 0x20, + 0x34, 0x35, 0x33, 0x43, 0x63, 0x33, 0x14, 0x88, 0x8a, 0x40, 0x35, 0x23, 0xa0, 0xbd, 0x9c, 0x9a, + 0x98, 0xbb, 0xbd, 0xbc, 0xbb, 0xdb, 0xdb, 0xcb, 0xbc, 0xbc, 0xab, 0x8a, 0x10, 0x43, 0x34, 0x43, + 0x34, 0x35, 0x12, 0x01, 0x99, 0xaa, 0xaa, 0x08, 0x32, 0x36, 0x22, 0x33, 0x55, 0x34, 0x23, 0x91, + 0x99, 0x30, 0x46, 0x23, 0x81, 0xca, 0xba, 0xaa, 0xaa, 0xcb, 0xbd, 0xdb, 0xaa, 0xcb, 0xbb, 0xbd, + 0xbd, 0xcc, 0xbb, 0xaa, 0x08, 0x11, 0x33, 0x44, 0x44, 0x34, 0x23, 0x22, 0x80, 0xa8, 0xba, 0x9a, + 0x20, 0x34, 0x23, 0x32, 0x56, 0x45, 0x23, 0x01, 0x89, 0x18, 0x44, 0x43, 0x11, 0x99, 0xaa, 0xab, + 0xb9, 0xda, 0xbc, 0xcb, 0xbb, 0xbc, 0xcb, 0xcc, 0xbc, 0xbd, 0xcc, 0xaa, 0x89, 0x88, 0x10, 0x31, + 0x63, 0x34, 0x43, 0x23, 0x01, 0x80, 0xaa, 0xaa, 0x08, 0x21, 0x12, 0x10, 0x75, 0x35, 0x25, 0x02, + 0x80, 0x00, 0x42, 0x24, 0x22, 0x81, 0x99, 0x9a, 0xa9, 0xcb, 0xbc, 0xbd, 0xbb, 0xbc, 0xdb, 0xbb, + 0xdc, 0xcc, 0xdb, 0xba, 0x9a, 0x99, 0x88, 0x00, 0x32, 0x36, 0x34, 0x24, 0x22, 0x81, 0xa8, 0xaa, + 0x89, 0x11, 0x01, 0x09, 0x73, 0x56, 0x33, 0x23, 0x01, 0x10, 0x42, 0x35, 0x24, 0x11, 0x00, 0x80, + 0x80, 0xa8, 0xca, 0xbc, 0xbc, 0xbc, 0xbb, 0xcb, 0xdb, 0xdc, 0xcc, 0xbb, 0xba, 0x9a, 0x9a, 0x89, + 0x21, 0x53, 0x44, 0x43, 0x23, 0x12, 0xa8, 0xaa, 0x89, 0x00, 0x80, 0xbb, 0x38, 0x77, 0x25, 0x13, + 0x11, 0x08, 0x32, 0x35, 0x34, 0x23, 0x12, 0x11, 0x00, 0x90, 0xca, 0xdb, 0xcb, 0xbc, 0xac, 0x9a, + 0xba, 0xec, 0xcc, 0xac, 0xbb, 0xab, 0xaa, 0x9a, 0x09, 0x31, 0x63, 0x44, 0x33, 0x13, 0x90, 0xaa, + 0x99, 0x01, 0x90, 0xcc, 0x8a, 0x72, 0x44, 0x33, 0x11, 0x00, 0x22, 0x55, 0x33, 0x34, 0x22, 0x22, + 0x11, 0x01, 0x88, 0xa9, 0xcc, 0xbd, 0xbb, 0x9b, 0xa9, 0xec, 0xdc, 0xcb, 0xbb, 0xac, 0xaa, 0x9a, + 0x89, 0x00, 0x42, 0x54, 0x43, 0x23, 0x80, 0x98, 0x88, 0x10, 0x98, 0xeb, 0xaa, 0x38, 0x45, 0x24, + 0x22, 0x10, 0x20, 0x63, 0x34, 0x24, 0x23, 0x23, 0x12, 0x00, 0x00, 0x99, 0xdb, 0xcc, 0xac, 0x9a, + 0x99, 0xca, 0xdd, 0xdb, 0xbb, 0xbc, 0xba, 0xaa, 0x9a, 0x88, 0x28, 0x54, 0x35, 0x24, 0x11, 0x88, + 0x08, 0x00, 0x90, 0xcc, 0xcb, 0x09, 0x41, 0x43, 0x22, 0x12, 0x20, 0x53, 0x44, 0x43, 0x33, 0x33, + 0x22, 0x12, 0x11, 0x11, 0xa9, 0xdc, 0xad, 0x9b, 0x99, 0xba, 0xce, 0xcc, 0xbc, 0xbc, 0xbb, 0xab, + 0xaa, 0xaa, 0x89, 0x52, 0x55, 0x33, 0x12, 0x00, 0x00, 0x11, 0x80, 0xdb, 0xcc, 0x9a, 0x18, 0x53, + 0x23, 0x22, 0x21, 0x32, 0x45, 0x34, 0x44, 0x32, 0x22, 0x12, 0x21, 0x12, 0x91, 0xea, 0xcb, 0xba, + 0xa9, 0xb9, 0xdd, 0xdb, 0xdb, 0xcb, 0xbb, 0xab, 0xba, 0xbb, 0xab, 0x28, 0x56, 0x34, 0x22, 0x11, + 0x21, 0x22, 0x11, 0xa8, 0xce, 0xab, 0x09, 0x31, 0x43, 0x23, 0x22, 0x32, 0x44, 0x44, 0x53, 0x43, + 0x22, 0x22, 0x32, 0x32, 0x02, 0xa9, 0xcd, 0xab, 0xaa, 0xbb, 0xbd, 0xcd, 0xeb, 0xdb, 0xba, 0xab, + 0xba, 0xbb, 0xbc, 0x89, 0x52, 0x44, 0x23, 0x12, 0x22, 0x32, 0x33, 0x92, 0xcc, 0xad, 0x9a, 0x28, + 0x32, 0x43, 0x23, 0x32, 0x42, 0x63, 0x34, 0x35, 0x32, 0x23, 0x32, 0x43, 0x12, 0xa0, 0xcb, 0xcb, + 0xbb, 0xac, 0xba, 0xbd, 0xdd, 0xdb, 0xcb, 0xaa, 0xba, 0xcb, 0xcb, 0x9a, 0x10, 0x53, 0x33, 0x22, + 0x33, 0x34, 0x25, 0x02, 0x98, 0xbc, 0xab, 0x09, 0x21, 0x43, 0x24, 0x23, 0x21, 0x44, 0x45, 0x53, + 0x23, 0x32, 0x42, 0x32, 0x23, 0x00, 0xa9, 0xcb, 0xcb, 0xcb, 0xaa, 0xca, 0xcc, 0xcd, 0xbc, 0xba, + 0xba, 0xbc, 0xbd, 0xab, 0x89, 0x22, 0x34, 0x32, 0x32, 0x54, 0x43, 0x22, 0x80, 0xb9, 0xab, 0x9b, + 0x08, 0x42, 0x34, 0x32, 0x12, 0x43, 0x46, 0x35, 0x33, 0x33, 0x43, 0x34, 0x23, 0x11, 0x88, 0xb9, + 0xdb, 0xcb, 0x9a, 0xa9, 0xfb, 0xcc, 0xcc, 0xaa, 0xba, 0xcb, 0xcc, 0xab, 0x9a, 0x10, 0x22, 0x32, + 0x32, 0x35, 0x36, 0x33, 0x12, 0x98, 0xaa, 0xab, 0x0a, 0x20, 0x35, 0x24, 0x02, 0x31, 0x55, 0x44, + 0x33, 0x33, 0x34, 0x34, 0x33, 0x23, 0x01, 0x88, 0xcb, 0xbc, 0x9b, 0x99, 0xeb, 0xce, 0xbc, 0xbb, + 0xcb, 0xcb, 0xbd, 0xbc, 0xaa, 0x89, 0x10, 0x11, 0x11, 0x43, 0x35, 0x34, 0x23, 0x81, 0xa8, 0xba, + 0xaa, 0x18, 0x53, 0x33, 0x22, 0x32, 0x47, 0x53, 0x33, 0x43, 0x43, 0x33, 0x34, 0x23, 0x23, 0x01, + 0xa8, 0xbd, 0x9a, 0x08, 0xc9, 0xdd, 0xcc, 0xbb, 0xba, 0xdb, 0xcc, 0xbc, 0xbb, 0x9a, 0x88, 0x00, + 0x01, 0x32, 0x36, 0x35, 0x32, 0x12, 0x80, 0xb9, 0xba, 0x89, 0x42, 0x32, 0x22, 0x32, 0x55, 0x35, + 0x34, 0x33, 0x35, 0x34, 0x33, 0x34, 0x33, 0x33, 0x90, 0xbb, 0x9c, 0x09, 0xa0, 0xed, 0xcc, 0xab, + 0xbb, 0xbc, 0xcd, 0xbd, 0xbb, 0xab, 0x99, 0x89, 0x88, 0x10, 0x63, 0x34, 0x43, 0x22, 0x11, 0x98, + 0xab, 0x89, 0x11, 0x23, 0x22, 0x31, 0x55, 0x44, 0x43, 0x42, 0x43, 0x33, 0x43, 0x34, 0x34, 0x23, + 0x02, 0xa8, 0x9a, 0x09, 0x80, 0xea, 0xcd, 0xcb, 0xaa, 0xba, 0xec, 0xdb, 0xcb, 0xaa, 0x9a, 0x99, + 0x99, 0x08, 0x31, 0x44, 0x34, 0x34, 0x12, 0x90, 0xa9, 0x99, 0x00, 0x11, 0x11, 0x10, 0x52, 0x44, + 0x33, 0x54, 0x33, 0x44, 0x32, 0x44, 0x53, 0x23, 0x12, 0x00, 0x89, 0x08, 0x10, 0xb8, 0xcd, 0xbc, + 0xab, 0xba, 0xdc, 0xcd, 0xbc, 0xac, 0xaa, 0x9a, 0xaa, 0x99, 0x08, 0x32, 0x36, 0x25, 0x23, 0x01, + 0x98, 0x99, 0x08, 0x00, 0x08, 0x08, 0x21, 0x53, 0x53, 0x53, 0x53, 0x33, 0x43, 0x63, 0x53, 0x33, + 0x33, 0x01, 0x80, 0x00, 0x11, 0x90, 0xdc, 0xcb, 0xaa, 0x9a, 0xdb, 0xdd, 0xbc, 0xcb, 0xbb, 0xba, + 0xac, 0x9a, 0x9a, 0x00, 0x53, 0x34, 0x34, 0x12, 0x80, 0x89, 0x09, 0x88, 0x88, 0x08, 0x28, 0x21, + 0x42, 0x55, 0x44, 0x32, 0x23, 0x44, 0x54, 0x34, 0x23, 0x12, 0x10, 0x00, 0x11, 0x81, 0xca, 0xcc, + 0xab, 0x98, 0xb9, 0xed, 0xcc, 0xcb, 0xbb, 0xcb, 0xba, 0xba, 0xaa, 0x99, 0x31, 0x55, 0x43, 0x22, + 0x01, 0x00, 0x08, 0x08, 0x89, 0x08, 0x10, 0x08, 0x11, 0x55, 0x53, 0x33, 0x22, 0x43, 0x46, 0x35, + 0x24, 0x22, 0x11, 0x10, 0x12, 0x13, 0xa8, 0xbd, 0xab, 0x89, 0x99, 0xdc, 0xdd, 0xcb, 0xbc, 0xbb, + 0xcb, 0xba, 0xbb, 0xab, 0x09, 0x63, 0x53, 0x22, 0x22, 0x10, 0x10, 0x88, 0x88, 0x88, 0x80, 0x98, + 0x08, 0x62, 0x44, 0x43, 0x11, 0x31, 0x55, 0x35, 0x35, 0x22, 0x11, 0x12, 0x32, 0x33, 0x91, 0xcb, + 0xbb, 0x9a, 0x98, 0xca, 0xde, 0xcc, 0xbc, 0xbc, 0xbb, 0xbc, 0xbb, 0xbc, 0x99, 0x20, 0x53, 0x43, + 0x32, 0x12, 0x02, 0x00, 0x88, 0x88, 0x88, 0xa9, 0x99, 0x30, 0x47, 0x33, 0x11, 0x11, 0x73, 0x47, + 0x43, 0x23, 0x21, 0x11, 0x32, 0x24, 0x01, 0xa8, 0xbb, 0xaa, 0x98, 0x99, 0xdd, 0xdc, 0xbd, 0xbc, + 0xcb, 0xbb, 0xbc, 0xbc, 0xaa, 0x88, 0x22, 0x34, 0x43, 0x33, 0x12, 0x11, 0x80, 0x88, 0x88, 0xa9, + 0xbb, 0x28, 0x56, 0x33, 0x02, 0x88, 0x41, 0x67, 0x44, 0x32, 0x21, 0x21, 0x32, 0x43, 0x12, 0x80, + 0xa9, 0x9a, 0x8a, 0x98, 0xc9, 0xce, 0xdd, 0xcb, 0xba, 0xbc, 0xcb, 0xbc, 0xab, 0x9a, 0x10, 0x31, + 0x44, 0x32, 0x33, 0x21, 0x10, 0x00, 0x81, 0xa8, 0xbb, 0x1a, 0x64, 0x43, 0x12, 0x98, 0x0a, 0x74, + 0x46, 0x32, 0x23, 0x21, 0x33, 0x34, 0x33, 0x02, 0x99, 0xaa, 0xab, 0x88, 0x99, 0xfc, 0xcd, 0xbc, + 0xbc, 0xcb, 0xbc, 0xbc, 0xbc, 0x9a, 0x89, 0x10, 0x33, 0x44, 0x32, 0x12, 0x12, 0x11, 0x02, 0x80, + 0xa9, 0x9b, 0x50, 0x36, 0x12, 0xa8, 0xaa, 0x62, 0x56, 0x33, 0x24, 0x22, 0x33, 0x34, 0x24, 0x11, + 0x80, 0x99, 0xaa, 0x88, 0x08, 0xc8, 0xde, 0xbc, 0xcb, 0xcb, 0xbc, 0xcc, 0xcb, 0xaa, 0x9a, 0x08, + 0x20, 0x43, 0x33, 0x23, 0x32, 0x22, 0x23, 0x02, 0xb9, 0xbb, 0x50, 0x55, 0x12, 0x98, 0xbb, 0x38, + 0x66, 0x34, 0x43, 0x32, 0x42, 0x33, 0x34, 0x22, 0x01, 0x98, 0xaa, 0x09, 0x10, 0x90, 0xdd, 0xbd, + 0xad, 0xcb, 0xdb, 0xbc, 0xbc, 0xac, 0xab, 0x99, 0x18, 0x31, 0x43, 0x23, 0x22, 0x32, 0x33, 0x13, + 0xa8, 0xcb, 0x19, 0x45, 0x14, 0xa0, 0xbb, 0x8b, 0x72, 0x35, 0x35, 0x32, 0x43, 0x43, 0x33, 0x33, + 0x13, 0x90, 0xaa, 0x89, 0x20, 0x02, 0xda, 0xce, 0xcb, 0xcb, 0xcc, 0xcc, 0xbb, 0xad, 0xbb, 0xab, + 0x89, 0x20, 0x33, 0x34, 0x32, 0x33, 0x34, 0x23, 0x90, 0xba, 0x8a, 0x73, 0x24, 0x81, 0xaa, 0xab, + 0x30, 0x57, 0x34, 0x33, 0x44, 0x32, 0x34, 0x24, 0x13, 0x01, 0x98, 0x88, 0x11, 0x12, 0xa1, 0xdc, + 0xcb, 0xdb, 0xbc, 0xbd, 0xbd, 0xcc, 0xba, 0xbb, 0x9b, 0x08, 0x21, 0x32, 0x33, 0x33, 0x36, 0x22, + 0x81, 0xaa, 0x9a, 0x41, 0x35, 0x12, 0xb8, 0xbb, 0x19, 0x64, 0x35, 0x44, 0x32, 0x43, 0x53, 0x33, + 0x33, 0x11, 0x90, 0x09, 0x20, 0x23, 0x01, 0xba, 0xcd, 0xbc, 0xcd, 0xcc, 0xdb, 0xbc, 0xbc, 0xbb, + 0xbb, 0x8a, 0x10, 0x21, 0x33, 0x43, 0x44, 0x32, 0x01, 0xa8, 0x99, 0x38, 0x45, 0x22, 0x90, 0xaa, + 0x99, 0x31, 0x56, 0x34, 0x34, 0x43, 0x34, 0x35, 0x33, 0x12, 0x00, 0x09, 0x00, 0x21, 0x11, 0x80, + 0xba, 0xcd, 0xbc, 0xbe, 0xcd, 0xdb, 0xdb, 0xbb, 0xbb, 0x9b, 0x09, 0x00, 0x11, 0x22, 0x35, 0x34, + 0x12, 0x88, 0x99, 0x08, 0x53, 0x32, 0x00, 0xba, 0xac, 0x1a, 0x73, 0x34, 0x34, 0x43, 0x44, 0x44, + 0x33, 0x22, 0x01, 0x08, 0x00, 0x11, 0x21, 0x01, 0x80, 0xaa, 0xcc, 0xbd, 0xcd, 0xdc, 0xdb, 0xbc, + 0xcb, 0xaa, 0x89, 0x88, 0x00, 0x10, 0x42, 0x43, 0x22, 0x00, 0x98, 0x08, 0x22, 0x43, 0x12, 0xb8, + 0xcb, 0x9a, 0x41, 0x55, 0x33, 0x24, 0x44, 0x45, 0x33, 0x33, 0x12, 0x00, 0x00, 0x11, 0x21, 0x11, + 0x02, 0xa8, 0xca, 0xbd, 0xcd, 0xeb, 0xdc, 0xdb, 0xcb, 0xba, 0xa9, 0x98, 0x88, 0x08, 0x21, 0x53, + 0x32, 0x01, 0x88, 0x89, 0x20, 0x43, 0x13, 0x80, 0xdb, 0xab, 0x19, 0x53, 0x34, 0x24, 0x54, 0x54, + 0x43, 0x33, 0x22, 0x11, 0x01, 0x21, 0x22, 0x22, 0x12, 0x01, 0xa9, 0xcb, 0xbb, 0xde, 0xdd, 0xdc, + 0xcb, 0xbb, 0xab, 0xa9, 0xa9, 0x89, 0x20, 0x53, 0x33, 0x13, 0x81, 0x08, 0x10, 0x53, 0x43, 0x02, + 0xa8, 0xbb, 0x89, 0x43, 0x24, 0x23, 0x54, 0x46, 0x35, 0x24, 0x23, 0x22, 0x11, 0x11, 0x21, 0x22, + 0x22, 0x12, 0x99, 0xcb, 0xaa, 0xcb, 0xee, 0xcd, 0xbd, 0xbc, 0xba, 0xaa, 0xab, 0xaa, 0x09, 0x30, + 0x44, 0x12, 0x01, 0x80, 0x00, 0x22, 0x35, 0x23, 0x90, 0xca, 0x8a, 0x18, 0x21, 0x00, 0x41, 0x77, + 0x34, 0x35, 0x43, 0x22, 0x21, 0x11, 0x12, 0x32, 0x32, 0x23, 0x80, 0xa9, 0x09, 0x10, 0xe8, 0xff, + 0xcc, 0xcb, 0xab, 0xbb, 0xbb, 0xbb, 0x9a, 0x18, 0x43, 0x33, 0x12, 0x81, 0x88, 0x30, 0x55, 0x23, + 0x82, 0xb9, 0x8a, 0x08, 0x01, 0x90, 0x0a, 0x74, 0x67, 0x33, 0x25, 0x33, 0x32, 0x21, 0x22, 0x22, + 0x33, 0x33, 0x02, 0xa9, 0x8b, 0x42, 0x82, 0xfe, 0xce, 0xbc, 0xcb, 0xbb, 0xcb, 0xba, 0xaa, 0x89, + 0x11, 0x23, 0x33, 0x01, 0x98, 0x10, 0x45, 0x34, 0x11, 0x90, 0x88, 0x08, 0x01, 0x98, 0x9b, 0x68, + 0x66, 0x44, 0x43, 0x24, 0x32, 0x12, 0x12, 0x22, 0x33, 0x24, 0x02, 0x98, 0x88, 0x32, 0x25, 0xa0, + 0xef, 0xcc, 0xbb, 0xbc, 0xac, 0xcb, 0xaa, 0x99, 0x08, 0x21, 0x22, 0x01, 0x88, 0x18, 0x42, 0x44, + 0x22, 0x80, 0x88, 0x00, 0x08, 0xb8, 0xdb, 0x8a, 0x72, 0x45, 0x35, 0x34, 0x43, 0x22, 0x12, 0x21, + 0x43, 0x32, 0x22, 0x88, 0x89, 0x21, 0x45, 0x02, 0xda, 0xdd, 0xcb, 0xbc, 0xcb, 0xac, 0xbb, 0xba, + 0x89, 0x18, 0x22, 0x01, 0x88, 0x08, 0x41, 0x34, 0x24, 0x01, 0x00, 0x08, 0x81, 0xa9, 0xcc, 0xbb, + 0x28, 0x57, 0x35, 0x35, 0x34, 0x23, 0x13, 0x22, 0x43, 0x33, 0x23, 0x01, 0x99, 0x20, 0x54, 0x33, + 0xa0, 0xec, 0xcc, 0xbc, 0xcc, 0xbb, 0xbc, 0xac, 0x99, 0x09, 0x11, 0x01, 0x80, 0x08, 0x11, 0x34, + 0x24, 0x11, 0x01, 0x80, 0x08, 0x98, 0xdb, 0xac, 0x8a, 0x51, 0x55, 0x44, 0x43, 0x33, 0x22, 0x22, + 0x42, 0x43, 0x23, 0x11, 0x08, 0x18, 0x34, 0x25, 0x02, 0xb8, 0xce, 0xbc, 0xbd, 0xbd, 0xdb, 0xab, + 0xab, 0x89, 0x00, 0x01, 0x80, 0x88, 0x10, 0x33, 0x34, 0x23, 0x00, 0x10, 0x20, 0x01, 0xeb, 0xac, + 0xbb, 0x09, 0x73, 0x37, 0x35, 0x24, 0x23, 0x21, 0x32, 0x44, 0x33, 0x22, 0x10, 0x20, 0x43, 0x25, + 0x23, 0x81, 0xca, 0xdc, 0xbc, 0xbd, 0xbd, 0xad, 0xab, 0x9a, 0x08, 0x00, 0x00, 0x88, 0x00, 0x22, + 0x33, 0x24, 0x11, 0x00, 0x21, 0x80, 0xaa, 0xcd, 0xcb, 0xbb, 0x1a, 0x56, 0x45, 0x43, 0x22, 0x22, + 0x31, 0x44, 0x24, 0x12, 0x11, 0x10, 0x32, 0x35, 0x33, 0x22, 0x98, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xba, 0x9b, 0x99, 0x08, 0x80, 0x88, 0x88, 0x20, 0x32, 0x33, 0x22, 0x23, 0x33, 0x22, 0x81, 0xb9, + 0xcf, 0xbd, 0x9b, 0x31, 0x57, 0x34, 0x33, 0x23, 0x32, 0x45, 0x43, 0x22, 0x12, 0x01, 0x22, 0x53, + 0x34, 0x22, 0x01, 0x99, 0xcb, 0xdc, 0xcd, 0xcc, 0xbc, 0xba, 0x9a, 0x88, 0x88, 0x88, 0x09, 0x10, + 0x22, 0x32, 0x33, 0x33, 0x33, 0x22, 0x13, 0x88, 0xfc, 0xcc, 0xbb, 0x0a, 0x73, 0x35, 0x34, 0x22, + 0x22, 0x34, 0x35, 0x23, 0x23, 0x11, 0x22, 0x43, 0x35, 0x33, 0x13, 0x80, 0x98, 0xda, 0xed, 0xcd, + 0xbc, 0xac, 0xaa, 0x99, 0x89, 0x89, 0x89, 0x08, 0x11, 0x21, 0x32, 0x33, 0x24, 0x32, 0x23, 0x12, + 0xa8, 0xfd, 0xdb, 0x9a, 0x28, 0x54, 0x33, 0x33, 0x43, 0x53, 0x43, 0x33, 0x23, 0x22, 0x21, 0x42, + 0x44, 0x33, 0x23, 0x01, 0x00, 0x90, 0xfb, 0xcf, 0xcc, 0xbc, 0xba, 0xa9, 0x99, 0x89, 0x89, 0x88, + 0x10, 0x21, 0x23, 0x33, 0x34, 0x33, 0x53, 0x12, 0x11, 0xca, 0xcf, 0xab, 0x0a, 0x32, 0x45, 0x32, + 0x32, 0x34, 0x45, 0x33, 0x33, 0x33, 0x21, 0x33, 0x46, 0x32, 0x13, 0x12, 0x11, 0x22, 0x80, 0xee, + 0xce, 0xdb, 0xba, 0xaa, 0xaa, 0x9a, 0xa9, 0x98, 0x08, 0x00, 0x21, 0x32, 0x42, 0x23, 0x33, 0x44, + 0x13, 0xa0, 0xde, 0xac, 0x8b, 0x18, 0x43, 0x33, 0x34, 0x43, 0x44, 0x43, 0x24, 0x23, 0x21, 0x31, + 0x53, 0x24, 0x23, 0x21, 0x11, 0x32, 0x23, 0xd0, 0xdf, 0xcc, 0xbb, 0xcb, 0xaa, 0xaa, 0xaa, 0x99, + 0x09, 0x08, 0x10, 0x22, 0x33, 0x33, 0x42, 0x44, 0x33, 0x02, 0xdc, 0xbd, 0x9c, 0x89, 0x21, 0x32, + 0x34, 0x42, 0x53, 0x44, 0x43, 0x22, 0x22, 0x22, 0x43, 0x44, 0x22, 0x12, 0x11, 0x32, 0x43, 0x82, + 0xfa, 0xcd, 0xbc, 0xcb, 0xab, 0xab, 0xab, 0xaa, 0x9a, 0x89, 0x88, 0x21, 0x22, 0x13, 0x32, 0x36, + 0x36, 0x12, 0xb0, 0xdc, 0xbb, 0x9b, 0x18, 0x31, 0x25, 0x21, 0x44, 0x45, 0x43, 0x33, 0x22, 0x23, + 0x43, 0x44, 0x33, 0x12, 0x11, 0x32, 0x44, 0x22, 0xb0, 0xed, 0xcc, 0xbb, 0xbc, 0xbb, 0xbb, 0xab, + 0xab, 0x9a, 0x89, 0x10, 0x21, 0x12, 0x11, 0x45, 0x45, 0x32, 0x81, 0xca, 0xcc, 0xaa, 0x8a, 0x01, + 0x12, 0x12, 0x53, 0x55, 0x53, 0x33, 0x32, 0x32, 0x43, 0x44, 0x33, 0x22, 0x11, 0x22, 0x44, 0x33, + 0x02, 0xd9, 0xdd, 0xcb, 0xcb, 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0x99, 0x08, 0x10, 0x00, 0x00, 0x61, + 0x45, 0x33, 0x22, 0x98, 0xcd, 0xbb, 0x9b, 0x08, 0x00, 0x01, 0x22, 0x56, 0x54, 0x33, 0x33, 0x22, + 0x42, 0x34, 0x25, 0x22, 0x12, 0x21, 0x53, 0x43, 0x22, 0x91, 0xeb, 0xcc, 0xdb, 0xbb, 0xac, 0xab, + 0xab, 0xab, 0x9a, 0x09, 0x08, 0x80, 0x98, 0x20, 0x55, 0x34, 0x33, 0x81, 0xda, 0xbc, 0xab, 0x99, + 0x00, 0x00, 0x20, 0x73, 0x45, 0x34, 0x33, 0x32, 0x32, 0x35, 0x25, 0x33, 0x12, 0x21, 0x42, 0x44, + 0x23, 0x12, 0xa9, 0xdc, 0xbd, 0xcc, 0xbb, 0xbb, 0xcb, 0xab, 0x9b, 0x8a, 0x80, 0x88, 0x98, 0x88, + 0x52, 0x54, 0x33, 0x13, 0xa0, 0xcc, 0xab, 0x9b, 0x89, 0x98, 0x89, 0x40, 0x66, 0x53, 0x22, 0x22, + 0x23, 0x53, 0x53, 0x22, 0x22, 0x11, 0x31, 0x44, 0x43, 0x22, 0x01, 0xb9, 0xce, 0xbc, 0xad, 0xbb, + 0xbc, 0xbb, 0xba, 0x9a, 0x98, 0x88, 0x99, 0x99, 0x29, 0x55, 0x34, 0x33, 0x01, 0xba, 0xcc, 0xaa, + 0x99, 0xa9, 0xba, 0x09, 0x65, 0x44, 0x33, 0x24, 0x22, 0x43, 0x44, 0x23, 0x13, 0x12, 0x21, 0x44, + 0x43, 0x24, 0x22, 0x80, 0xca, 0xcd, 0xbc, 0xcb, 0xbb, 0xbc, 0xbb, 0xaa, 0x99, 0x99, 0x99, 0xaa, + 0x0a, 0x61, 0x44, 0x33, 0x12, 0xa0, 0xcb, 0xbb, 0xb9, 0xca, 0xdb, 0x9a, 0x21, 0x46, 0x53, 0x22, + 0x22, 0x43, 0x34, 0x25, 0x23, 0x11, 0x21, 0x33, 0x54, 0x33, 0x24, 0x22, 0xa8, 0xcc, 0xcc, 0xcb, + 0xcb, 0xcb, 0xab, 0xab, 0x9a, 0x98, 0xa8, 0xaa, 0x9b, 0x18, 0x64, 0x43, 0x23, 0x01, 0xa9, 0xab, + 0xa9, 0xcb, 0xdb, 0xab, 0x19, 0x73, 0x34, 0x33, 0x23, 0x44, 0x44, 0x34, 0x32, 0x12, 0x12, 0x22, + 0x34, 0x44, 0x34, 0x32, 0x00, 0xb9, 0xdc, 0xbc, 0xbd, 0xdb, 0xba, 0xbb, 0xaa, 0x9a, 0x99, 0xab, + 0xbb, 0x9b, 0x41, 0x55, 0x23, 0x12, 0x90, 0x98, 0x99, 0xaa, 0xcd, 0xcb, 0x99, 0x21, 0x45, 0x32, + 0x32, 0x52, 0x44, 0x53, 0x23, 0x23, 0x22, 0x12, 0x33, 0x45, 0x53, 0x32, 0x12, 0x80, 0xb9, 0xcd, + 0xbc, 0xbd, 0xbc, 0xcb, 0x9a, 0x9a, 0x99, 0xa9, 0xbb, 0xab, 0x19, 0x44, 0x34, 0x22, 0x01, 0x98, + 0x88, 0xb9, 0xdc, 0xcc, 0x9a, 0x08, 0x42, 0x33, 0x22, 0x43, 0x55, 0x53, 0x33, 0x24, 0x22, 0x12, + 0x22, 0x43, 0x35, 0x24, 0x33, 0x12, 0x88, 0xcb, 0xdc, 0xbc, 0xbd, 0xac, 0xab, 0xaa, 0x9a, 0xa9, + 0xbb, 0xac, 0x8a, 0x31, 0x44, 0x32, 0x11, 0x01, 0x01, 0x00, 0xda, 0xcd, 0xab, 0x89, 0x31, 0x24, + 0x23, 0x42, 0x45, 0x44, 0x43, 0x24, 0x23, 0x11, 0x12, 0x32, 0x44, 0x53, 0x23, 0x23, 0x01, 0x90, + 0xdb, 0xcd, 0xbc, 0xbd, 0xba, 0xbb, 0x9a, 0xaa, 0xbb, 0xbc, 0xab, 0x18, 0x43, 0x24, 0x13, 0x11, + 0x12, 0x02, 0xc8, 0xdd, 0xbb, 0x9b, 0x18, 0x21, 0x22, 0x33, 0x46, 0x45, 0x34, 0x25, 0x33, 0x22, + 0x12, 0x32, 0x53, 0x34, 0x44, 0x22, 0x12, 0x02, 0xa0, 0xeb, 0xcc, 0xdb, 0xbb, 0xbb, 0xab, 0xba, + 0xca, 0xcb, 0xab, 0x89, 0x20, 0x32, 0x33, 0x22, 0x33, 0x34, 0x91, 0xdd, 0xbc, 0xbb, 0x88, 0x00, + 0x12, 0x22, 0x53, 0x55, 0x54, 0x43, 0x33, 0x23, 0x23, 0x32, 0x43, 0x44, 0x24, 0x43, 0x22, 0x22, + 0x81, 0xa8, 0xcd, 0xcd, 0xcb, 0xab, 0xab, 0xba, 0xba, 0xbc, 0xbc, 0x9a, 0x09, 0x11, 0x12, 0x21, + 0x32, 0x43, 0x82, 0xea, 0xbd, 0xbb, 0x9a, 0x09, 0x00, 0x80, 0x00, 0x73, 0x45, 0x35, 0x34, 0x43, + 0x22, 0x22, 0x42, 0x33, 0x35, 0x43, 0x43, 0x22, 0x12, 0x01, 0xa9, 0xce, 0xcc, 0xbb, 0xbb, 0xba, + 0xca, 0xbb, 0xbd, 0xaa, 0x99, 0x00, 0x10, 0x20, 0x32, 0x53, 0x12, 0xa9, 0xce, 0xbb, 0xab, 0x99, + 0x88, 0x98, 0x99, 0x10, 0x55, 0x55, 0x34, 0x34, 0x32, 0x32, 0x33, 0x34, 0x44, 0x43, 0x24, 0x23, + 0x23, 0x23, 0x80, 0xea, 0xcc, 0xbc, 0xbb, 0xab, 0xbb, 0xcc, 0xcb, 0xab, 0xaa, 0x88, 0x08, 0x18, + 0x31, 0x44, 0x22, 0x81, 0xca, 0xcc, 0xab, 0x99, 0x89, 0x98, 0xa9, 0x9a, 0x30, 0x57, 0x45, 0x43, + 0x33, 0x32, 0x33, 0x34, 0x34, 0x44, 0x33, 0x34, 0x33, 0x43, 0x12, 0xa0, 0xeb, 0xcc, 0xba, 0xbb, + 0xba, 0xbc, 0xcc, 0xbb, 0xaa, 0x9a, 0x89, 0x89, 0x21, 0x43, 0x24, 0x03, 0xb8, 0xcd, 0xac, 0xaa, + 0x99, 0x9a, 0xa9, 0xab, 0xab, 0x52, 0x37, 0x36, 0x43, 0x33, 0x33, 0x33, 0x44, 0x43, 0x43, 0x43, + 0x42, 0x32, 0x23, 0x02, 0xb9, 0xdd, 0xbb, 0xac, 0xba, 0xcb, 0xbc, 0xbc, 0xab, 0xaa, 0xaa, 0x99, + 0x00, 0x32, 0x36, 0x22, 0x81, 0xca, 0xbc, 0xbb, 0xab, 0xaa, 0xca, 0xcb, 0xac, 0x08, 0x52, 0x45, + 0x53, 0x33, 0x33, 0x34, 0x42, 0x33, 0x34, 0x34, 0x34, 0x34, 0x24, 0x23, 0x80, 0xba, 0xcd, 0xab, + 0xba, 0xbc, 0xbd, 0xbc, 0xca, 0xaa, 0xa9, 0xaa, 0x89, 0x20, 0x43, 0x33, 0x12, 0xa9, 0xcc, 0xcb, + 0xaa, 0x9a, 0xb9, 0xdb, 0xbb, 0x9b, 0x28, 0x46, 0x45, 0x43, 0x33, 0x32, 0x24, 0x43, 0x33, 0x43, + 0x34, 0x44, 0x43, 0x33, 0x12, 0xa8, 0xcb, 0xac, 0xcb, 0xca, 0xcb, 0xac, 0xac, 0xaa, 0xab, 0xab, + 0x9b, 0x09, 0x42, 0x43, 0x12, 0x81, 0xb9, 0xbc, 0xbb, 0xaa, 0xaa, 0xdc, 0xcb, 0xba, 0x89, 0x41, + 0x46, 0x34, 0x43, 0x33, 0x24, 0x33, 0x24, 0x33, 0x53, 0x34, 0x35, 0x34, 0x22, 0x81, 0xa9, 0xbb, + 0xbc, 0xbc, 0xbd, 0xbc, 0xbc, 0xbb, 0xcb, 0xbb, 0xab, 0x9a, 0x20, 0x42, 0x24, 0x02, 0x98, 0xbb, + 0xbb, 0xab, 0xbb, 0xbc, 0xbe, 0xbc, 0xab, 0x18, 0x64, 0x44, 0x43, 0x33, 0x43, 0x23, 0x43, 0x23, + 0x33, 0x44, 0x45, 0x43, 0x33, 0x11, 0x80, 0xb9, 0xbb, 0xbc, 0xbd, 0xbd, 0xbc, 0xba, 0xac, 0xac, + 0xbb, 0xaa, 0x88, 0x31, 0x33, 0x14, 0x80, 0xba, 0xcb, 0xba, 0xaa, 0xcb, 0xdb, 0xbc, 0xcb, 0x99, + 0x21, 0x36, 0x35, 0x34, 0x43, 0x33, 0x43, 0x32, 0x32, 0x53, 0x54, 0x34, 0x24, 0x13, 0x02, 0x98, + 0x99, 0xba, 0xcc, 0xcc, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xab, 0x9a, 0x10, 0x32, 0x33, 0x02, 0xa8, + 0xbc, 0xbb, 0xbb, 0xbb, 0xcc, 0xcc, 0xbc, 0xaa, 0x08, 0x62, 0x53, 0x34, 0x43, 0x33, 0x34, 0x33, + 0x32, 0x42, 0x54, 0x44, 0x24, 0x33, 0x12, 0x00, 0x88, 0x9a, 0xdb, 0xcc, 0xbb, 0xcb, 0xcb, 0xbb, + 0xbd, 0xbb, 0xab, 0x88, 0x21, 0x32, 0x13, 0x90, 0xba, 0xcb, 0xbb, 0xaa, 0xcb, 0xdc, 0xcb, 0xab, + 0x9b, 0x20, 0x54, 0x34, 0x35, 0x53, 0x43, 0x22, 0x22, 0x21, 0x63, 0x44, 0x53, 0x23, 0x23, 0x11, + 0x00, 0x90, 0xb9, 0xbd, 0xcc, 0xca, 0xba, 0xcb, 0xbc, 0xbc, 0xbb, 0x9a, 0x18, 0x11, 0x12, 0x01, + 0xa9, 0xba, 0xac, 0xab, 0xbb, 0xcc, 0xcc, 0xca, 0xaa, 0x09, 0x31, 0x44, 0x44, 0x44, 0x43, 0x23, + 0x23, 0x12, 0x42, 0x54, 0x34, 0x25, 0x23, 0x22, 0x11, 0x01, 0xa8, 0xca, 0xbc, 0xbc, 0xcb, 0xbb, + 0xcd, 0xac, 0xaa, 0xbb, 0x98, 0x08, 0x10, 0x00, 0xa0, 0xaa, 0xcb, 0xba, 0xba, 0xcb, 0xcc, 0xbc, + 0xbc, 0x9a, 0x08, 0x21, 0x63, 0x54, 0x53, 0x33, 0x23, 0x22, 0x21, 0x63, 0x45, 0x24, 0x43, 0x22, + 0x12, 0x12, 0x00, 0x99, 0xbc, 0xcb, 0xbb, 0xbc, 0xbd, 0xcd, 0xbb, 0xbb, 0x9a, 0x89, 0x01, 0x11, + 0x81, 0x98, 0xaa, 0xba, 0xbb, 0xca, 0xcc, 0xcc, 0xac, 0xaa, 0x8a, 0x88, 0x21, 0x54, 0x45, 0x34, + 0x24, 0x11, 0x01, 0x31, 0x55, 0x53, 0x33, 0x43, 0x32, 0x22, 0x11, 0x80, 0xba, 0xbc, 0xbb, 0xcc, + 0xdb, 0xbc, 0xbd, 0xac, 0xab, 0x99, 0x80, 0x01, 0x01, 0x81, 0x89, 0xa9, 0x9a, 0x99, 0xcb, 0xbe, + 0xbc, 0xac, 0xa9, 0x89, 0x88, 0x31, 0x57, 0x44, 0x33, 0x13, 0x11, 0x21, 0x44, 0x45, 0x43, 0x33, + 0x24, 0x23, 0x23, 0x01, 0x98, 0xba, 0xbb, 0xcc, 0xcb, 0xcd, 0xdb, 0xcb, 0xab, 0x9b, 0x99, 0x08, + 0x11, 0x00, 0x80, 0x99, 0x89, 0x88, 0xb9, 0xdd, 0xdb, 0xab, 0xab, 0x9a, 0xaa, 0x8a, 0x64, 0x55, + 0x33, 0x33, 0x11, 0x01, 0x32, 0x55, 0x44, 0x33, 0x34, 0x33, 0x43, 0x12, 0x00, 0x99, 0xab, 0xbb, + 0xdb, 0xdc, 0xdb, 0xbc, 0xbc, 0xab, 0x9a, 0x89, 0x00, 0x00, 0x00, 0x88, 0x08, 0x00, 0x88, 0xdb, + 0xcd, 0xcb, 0x9a, 0x9a, 0xbb, 0xaa, 0x39, 0x77, 0x33, 0x24, 0x12, 0x01, 0x11, 0x43, 0x45, 0x43, + 0x43, 0x33, 0x43, 0x23, 0x12, 0x88, 0x99, 0xaa, 0xba, 0xdc, 0xdc, 0xdb, 0xcb, 0xbb, 0xab, 0x9a, + 0x08, 0x08, 0x80, 0x88, 0x80, 0x18, 0x11, 0xb8, 0xce, 0xbc, 0xba, 0xba, 0xdb, 0xcb, 0x8a, 0x51, + 0x45, 0x33, 0x14, 0x02, 0x11, 0x32, 0x54, 0x34, 0x34, 0x34, 0x43, 0x33, 0x13, 0x01, 0x88, 0x9a, + 0xa9, 0xcb, 0xcc, 0xcd, 0xcc, 0xbb, 0xac, 0x9a, 0x99, 0x88, 0x80, 0x88, 0x88, 0x18, 0x11, 0x80, + 0xda, 0xbc, 0xaa, 0xbb, 0xfb, 0xcb, 0xaa, 0x19, 0x64, 0x43, 0x33, 0x22, 0x11, 0x42, 0x53, 0x53, + 0x33, 0x35, 0x53, 0x32, 0x23, 0x12, 0x00, 0x98, 0x98, 0xa8, 0xda, 0xcc, 0xcd, 0xbc, 0xcb, 0xab, + 0x9a, 0x89, 0x88, 0x88, 0x89, 0x18, 0x21, 0x01, 0xa8, 0xcc, 0xaa, 0xaa, 0xcc, 0xcd, 0xac, 0x9a, + 0x30, 0x45, 0x33, 0x23, 0x22, 0x32, 0x44, 0x44, 0x43, 0x53, 0x33, 0x35, 0x32, 0x23, 0x01, 0x00, + 0x89, 0x88, 0xaa, 0xeb, 0xcd, 0xbd, 0xbc, 0xac, 0xab, 0x99, 0x88, 0x99, 0x98, 0x88, 0x10, 0x01, + 0x98, 0xbb, 0xac, 0xaa, 0xea, 0xdc, 0xdb, 0xaa, 0x09, 0x42, 0x34, 0x33, 0x32, 0x33, 0x44, 0x53, + 0x33, 0x35, 0x35, 0x34, 0x34, 0x32, 0x22, 0x01, 0x00, 0x80, 0x80, 0xa9, 0xec, 0xdc, 0xdb, 0xbb, + 0xac, 0xa9, 0x89, 0x99, 0x9a, 0x88, 0x18, 0x10, 0x88, 0xb9, 0xbb, 0x99, 0xba, 0xee, 0xbd, 0xbc, + 0x9a, 0x10, 0x53, 0x33, 0x33, 0x43, 0x33, 0x35, 0x34, 0x34, 0x35, 0x35, 0x34, 0x24, 0x22, 0x12, + 0x01, 0x00, 0x00, 0x00, 0xa9, 0xde, 0xcc, 0xbc, 0xbb, 0xbb, 0xaa, 0xa9, 0xaa, 0x8a, 0x08, 0x01, + 0x80, 0xba, 0xdb, 0x8a, 0x98, 0xfb, 0xcd, 0xbc, 0xab, 0x89, 0x21, 0x34, 0x33, 0x43, 0x43, 0x33, + 0x34, 0x44, 0x53, 0x34, 0x35, 0x34, 0x32, 0x23, 0x11, 0x11, 0x11, 0x21, 0x01, 0xda, 0xce, 0xbd, + 0xbc, 0xba, 0xaa, 0xaa, 0xab, 0x9a, 0x88, 0x00, 0x81, 0xa9, 0xac, 0x9a, 0x08, 0xb8, 0xef, 0xbc, + 0xbc, 0x9a, 0x19, 0x21, 0x33, 0x43, 0x43, 0x43, 0x33, 0x34, 0x44, 0x44, 0x53, 0x34, 0x33, 0x24, + 0x12, 0x11, 0x11, 0x21, 0x32, 0x81, 0xfb, 0xbd, 0xbd, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0x9a, 0x00, + 0x00, 0xa9, 0xdb, 0x9b, 0x08, 0x90, 0xfc, 0xdc, 0xcb, 0xab, 0x99, 0x18, 0x11, 0x22, 0x34, 0x43, + 0x24, 0x33, 0x34, 0x44, 0x54, 0x43, 0x34, 0x33, 0x23, 0x22, 0x21, 0x22, 0x43, 0x23, 0xb0, 0xde, + 0xbc, 0xbc, 0xbb, 0xcb, 0xab, 0xbb, 0x9b, 0x88, 0x80, 0x90, 0xaa, 0xab, 0x09, 0x22, 0xc8, 0xef, + 0xbc, 0xac, 0x9a, 0x89, 0x10, 0x21, 0x43, 0x34, 0x43, 0x32, 0x33, 0x53, 0x54, 0x63, 0x43, 0x42, + 0x12, 0x12, 0x11, 0x21, 0x32, 0x33, 0x02, 0xda, 0xbe, 0xcc, 0xab, 0xcb, 0xba, 0xac, 0xaa, 0x89, + 0x88, 0x80, 0xa9, 0xaa, 0x89, 0x22, 0x01, 0xfb, 0xbe, 0xad, 0xbb, 0x99, 0x88, 0x10, 0x31, 0x44, + 0x43, 0x33, 0x32, 0x32, 0x54, 0x45, 0x53, 0x43, 0x33, 0x23, 0x12, 0x21, 0x42, 0x43, 0x13, 0x91, + 0xdb, 0xbd, 0xcb, 0xcb, 0xbb, 0xbc, 0xbb, 0x9a, 0x88, 0x88, 0xa9, 0xaa, 0x9a, 0x21, 0x23, 0xc0, + 0xdf, 0xbc, 0xbc, 0xab, 0x9a, 0x89, 0x10, 0x32, 0x54, 0x33, 0x23, 0x23, 0x34, 0x55, 0x44, 0x34, + 0x34, 0x33, 0x12, 0x21, 0x32, 0x44, 0x33, 0x02, 0xa9, 0xcd, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0x9a, + 0x89, 0x88, 0x99, 0x9a, 0x9a, 0x18, 0x32, 0x02, 0xea, 0xbd, 0xbd, 0xcb, 0x9a, 0x99, 0x08, 0x21, + 0x34, 0x35, 0x23, 0x23, 0x22, 0x44, 0x54, 0x35, 0x35, 0x23, 0x23, 0x11, 0x31, 0x53, 0x33, 0x23, + 0x80, 0xcb, 0xbc, 0xbd, 0xbc, 0xbd, 0xbc, 0xab, 0xa9, 0x88, 0x99, 0xa9, 0xaa, 0x09, 0x31, 0x23, + 0xa0, 0xce, 0xbe, 0xbc, 0xba, 0xaa, 0x89, 0x28, 0x53, 0x34, 0x24, 0x23, 0x22, 0x21, 0x54, 0x45, + 0x44, 0x43, 0x22, 0x11, 0x11, 0x32, 0x25, 0x23, 0x01, 0xa8, 0xcb, 0xcb, 0xdb, 0xcc, 0xcb, 0xbb, + 0xaa, 0x99, 0x98, 0xa9, 0x9b, 0x8a, 0x11, 0x43, 0x02, 0xc9, 0xcd, 0xcc, 0xbb, 0xba, 0xaa, 0x89, + 0x31, 0x63, 0x34, 0x32, 0x22, 0x01, 0x52, 0x64, 0x44, 0x43, 0x33, 0x12, 0x21, 0x33, 0x44, 0x43, + 0x11, 0x81, 0x99, 0xb9, 0xdb, 0xdc, 0xbc, 0xbc, 0xba, 0xa9, 0x99, 0xa9, 0xab, 0x9b, 0x08, 0x31, + 0x23, 0x98, 0xed, 0xbc, 0xad, 0xbb, 0xbb, 0xa9, 0x08, 0x32, 0x45, 0x43, 0x22, 0x11, 0x10, 0x53, + 0x56, 0x34, 0x33, 0x23, 0x22, 0x22, 0x54, 0x33, 0x33, 0x02, 0x00, 0x98, 0xcb, 0xcd, 0xcd, 0xcb, + 0xab, 0x9b, 0x9a, 0xaa, 0xaa, 0xab, 0x9a, 0x20, 0x33, 0x13, 0xb8, 0xcf, 0xdb, 0xcb, 0xab, 0x9b, + 0x8a, 0x18, 0x53, 0x34, 0x34, 0x12, 0x00, 0x31, 0x57, 0x34, 0x25, 0x23, 0x12, 0x21, 0x42, 0x34, + 0x33, 0x22, 0x11, 0x00, 0x99, 0xfb, 0xcd, 0xbc, 0xcb, 0xaa, 0xaa, 0xaa, 0xba, 0xbb, 0xba, 0x89, + 0x11, 0x23, 0x01, 0xca, 0xcd, 0xbc, 0xcc, 0xba, 0x9a, 0x99, 0x21, 0x54, 0x43, 0x13, 0x11, 0x20, + 0x54, 0x45, 0x34, 0x33, 0x22, 0x22, 0x33, 0x26, 0x24, 0x22, 0x22, 0x11, 0x01, 0xb8, 0xed, 0xbc, + 0xcc, 0xaa, 0xaa, 0xaa, 0xba, 0xbb, 0xbb, 0x9b, 0x09, 0x22, 0x22, 0x81, 0xba, 0xdf, 0xcb, 0xbb, + 0xac, 0x9b, 0x09, 0x42, 0x35, 0x24, 0x11, 0x01, 0x41, 0x55, 0x44, 0x33, 0x23, 0x22, 0x33, 0x44, + 0x43, 0x23, 0x32, 0x32, 0x32, 0x82, 0xea, 0xcd, 0xbc, 0xbc, 0xba, 0xaa, 0xbb, 0xbc, 0xbb, 0xac, + 0x99, 0x00, 0x00, 0x01, 0x98, 0xbc, 0xbe, 0xcb, 0xac, 0xbb, 0x9a, 0x28, 0x53, 0x34, 0x22, 0x01, + 0x21, 0x65, 0x54, 0x33, 0x33, 0x23, 0x33, 0x44, 0x43, 0x32, 0x33, 0x43, 0x23, 0x23, 0x90, 0xdc, + 0xcd, 0xcb, 0xba, 0xab, 0xbb, 0xcb, 0xbb, 0xac, 0x9a, 0x89, 0x00, 0x12, 0x01, 0xba, 0xbd, 0xbd, + 0xcc, 0xbb, 0xab, 0x8a, 0x31, 0x45, 0x22, 0x01, 0x09, 0x51, 0x46, 0x34, 0x43, 0x22, 0x23, 0x43, + 0x34, 0x33, 0x34, 0x33, 0x34, 0x24, 0x02, 0xa8, 0xcd, 0xbc, 0xbc, 0xbb, 0xbb, 0xac, 0xcb, 0xab, + 0xab, 0xaa, 0x08, 0x10, 0x00, 0x98, 0xca, 0xdc, 0xcb, 0xdb, 0xba, 0xab, 0x18, 0x43, 0x24, 0x02, + 0x98, 0x10, 0x55, 0x35, 0x44, 0x22, 0x32, 0x42, 0x33, 0x34, 0x43, 0x33, 0x34, 0x34, 0x22, 0x01, + 0xca, 0xcd, 0xbb, 0xbc, 0xbb, 0xbc, 0xca, 0xba, 0xbb, 0xba, 0x99, 0x80, 0x00, 0x80, 0xa9, 0xcc, + 0xbc, 0xcc, 0xcc, 0xaa, 0x89, 0x30, 0x43, 0x12, 0x90, 0x08, 0x52, 0x46, 0x34, 0x33, 0x34, 0x33, + 0x44, 0x32, 0x24, 0x33, 0x44, 0x33, 0x34, 0x21, 0x88, 0xcb, 0xbd, 0xbc, 0xcb, 0xba, 0xbb, 0xcb, + 0xac, 0xab, 0x9a, 0x89, 0x00, 0x10, 0x80, 0xa9, 0xba, 0xce, 0xdc, 0xbb, 0xaa, 0x18, 0x42, 0x12, + 0x81, 0x99, 0x20, 0x56, 0x44, 0x33, 0x34, 0x43, 0x33, 0x34, 0x42, 0x32, 0x34, 0x34, 0x44, 0x22, + 0x01, 0x99, 0xcb, 0xcc, 0xbb, 0xac, 0xbb, 0xcb, 0xcb, 0xba, 0xab, 0x9a, 0x08, 0x08, 0x08, 0x80, + 0x98, 0xca, 0xcf, 0xbc, 0xbb, 0x8a, 0x20, 0x12, 0x81, 0xba, 0x9a, 0x62, 0x55, 0x43, 0x34, 0x33, + 0x25, 0x33, 0x43, 0x33, 0x53, 0x43, 0x34, 0x24, 0x12, 0x81, 0xa8, 0xcc, 0xcb, 0xbb, 0xcb, 0xbb, + 0xbc, 0xcb, 0xbb, 0xaa, 0x99, 0x98, 0x08, 0x08, 0x11, 0x90, 0xfb, 0xce, 0xbb, 0x9a, 0x08, 0x20, + 0x00, 0xa9, 0xa9, 0x10, 0x45, 0x36, 0x44, 0x43, 0x33, 0x34, 0x33, 0x43, 0x33, 0x44, 0x34, 0x34, + 0x23, 0x12, 0x91, 0xca, 0xcc, 0xbb, 0xbc, 0xcb, 0xbb, 0xbc, 0xac, 0xab, 0xaa, 0x99, 0x89, 0x08, + 0x20, 0x22, 0xa8, 0xdf, 0xdb, 0xaa, 0x8a, 0x00, 0x01, 0x99, 0xaa, 0x99, 0x31, 0x46, 0x45, 0x43, + 0x34, 0x33, 0x34, 0x23, 0x43, 0x53, 0x43, 0x43, 0x33, 0x33, 0x11, 0x98, 0xdb, 0xbc, 0xbc, 0xbb, + 0xbc, 0xbc, 0xbc, 0xbb, 0xab, 0xaa, 0xa9, 0x99, 0x20, 0x32, 0x13, 0xfb, 0xbe, 0xbc, 0xaa, 0x88, + 0x80, 0x98, 0xaa, 0xaa, 0x0a, 0x63, 0x45, 0x34, 0x44, 0x43, 0x23, 0x33, 0x33, 0x34, 0x44, 0x34, + 0x34, 0x33, 0x23, 0x01, 0xb9, 0xcc, 0xbc, 0xcb, 0xbb, 0xcc, 0xbb, 0xbc, 0xba, 0xaa, 0x9a, 0x9a, + 0x00, 0x33, 0x25, 0x91, 0xeb, 0xad, 0xab, 0x9a, 0x88, 0x99, 0xc9, 0xba, 0xaa, 0x18, 0x44, 0x54, + 0x44, 0x43, 0x43, 0x23, 0x23, 0x33, 0x44, 0x53, 0x43, 0x33, 0x24, 0x22, 0x80, 0xaa, 0xbc, 0xac, + 0xbc, 0xcb, 0xbc, 0xbc, 0xba, 0xab, 0xbb, 0xba, 0x89, 0x31, 0x44, 0x02, 0xc8, 0xdb, 0xac, 0xaa, + 0x89, 0x89, 0xaa, 0xbb, 0xac, 0x99, 0x30, 0x64, 0x54, 0x43, 0x43, 0x33, 0x33, 0x32, 0x34, 0x44, + 0x43, 0x44, 0x33, 0x33, 0x11, 0xa0, 0xca, 0xbb, 0xbd, 0xbc, 0xcc, 0xbb, 0xac, 0xab, 0xbb, 0xbb, + 0xaa, 0x28, 0x43, 0x33, 0x91, 0xda, 0xcc, 0xba, 0x99, 0x99, 0xa9, 0xcb, 0xcb, 0x9a, 0x89, 0x42, + 0x46, 0x44, 0x43, 0x33, 0x43, 0x22, 0x33, 0x33, 0x55, 0x43, 0x53, 0x32, 0x13, 0x01, 0xa9, 0xba, + 0xdb, 0xcb, 0xbc, 0xbc, 0xbc, 0xba, 0xbb, 0xbc, 0xbb, 0x89, 0x31, 0x43, 0x12, 0xa0, 0xcc, 0xbb, + 0xab, 0xa9, 0xaa, 0xbc, 0xbc, 0xbc, 0x9a, 0x18, 0x73, 0x54, 0x43, 0x43, 0x32, 0x33, 0x33, 0x33, + 0x44, 0x44, 0x44, 0x33, 0x24, 0x12, 0x80, 0x99, 0xab, 0xbc, 0xcd, 0xcb, 0xab, 0xcb, 0xca, 0xba, + 0xbb, 0x9b, 0x08, 0x32, 0x24, 0x81, 0xb9, 0xcc, 0xaa, 0xab, 0xaa, 0xbb, 0xcc, 0xac, 0xbb, 0x99, + 0x30, 0x37, 0x45, 0x43, 0x43, 0x32, 0x32, 0x23, 0x33, 0x45, 0x44, 0x44, 0x32, 0x22, 0x02, 0x88, + 0xa8, 0xba, 0xcd, 0xdb, 0xba, 0xbb, 0xcb, 0xbc, 0xac, 0xab, 0x89, 0x20, 0x32, 0x13, 0x90, 0xba, + 0xbd, 0xba, 0xab, 0xba, 0xdb, 0xdb, 0xbb, 0xaa, 0x09, 0x53, 0x55, 0x43, 0x34, 0x42, 0x32, 0x23, + 0x22, 0x43, 0x54, 0x44, 0x24, 0x23, 0x12, 0x81, 0x90, 0x99, 0xbc, 0xcd, 0xba, 0xac, 0xbb, 0xcc, + 0xbb, 0xac, 0xaa, 0x08, 0x21, 0x22, 0x11, 0x99, 0xbb, 0xcb, 0xab, 0xab, 0xca, 0xbc, 0xbd, 0xbb, + 0xaa, 0x20, 0x64, 0x34, 0x35, 0x53, 0x33, 0x33, 0x32, 0x32, 0x64, 0x44, 0x53, 0x32, 0x22, 0x12, + 0x00, 0x88, 0xb9, 0xcd, 0xbb, 0xbc, 0xcb, 0xcb, 0xbc, 0xbc, 0xab, 0x8a, 0x18, 0x11, 0x12, 0x80, + 0xa9, 0xbb, 0xbc, 0xba, 0xbb, 0xcc, 0xbc, 0xbc, 0xab, 0x0a, 0x41, 0x44, 0x54, 0x43, 0x34, 0x33, + 0x22, 0x22, 0x33, 0x47, 0x44, 0x33, 0x23, 0x23, 0x12, 0x01, 0xa8, 0xdb, 0xbc, 0xbc, 0xbb, 0xbd, + 0xcc, 0xbb, 0xbb, 0x6c, 0x02, 0x01, 0x39, 0x7d, 0x0a, 0x02, 0xd3, 0x06, 0x19, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x9f, 0x80, 0x88, 0x88, 0x8b, 0x32, 0x92, 0x70, 0x24, + 0x34, 0x14, 0x88, 0x89, 0x09, 0x80, 0xcc, 0xcc, 0xbc, 0xcb, 0x89, 0x31, 0xa0, 0x40, 0xda, 0x41, + 0x24, 0xf8, 0x5a, 0x04, 0x08, 0x22, 0x91, 0x10, 0x90, 0xa9, 0x50, 0xf0, 0x9d, 0x18, 0xa9, 0x18, + 0x02, 0x09, 0x32, 0x32, 0xfa, 0x49, 0x15, 0x08, 0x21, 0x31, 0x26, 0xa0, 0xaa, 0x50, 0x04, 0xdc, + 0x8a, 0xb8, 0x18, 0xa0, 0x9a, 0x31, 0x46, 0x91, 0x9b, 0x00, 0x42, 0x15, 0x98, 0x30, 0x35, 0x82, + 0xbd, 0x50, 0x91, 0x98, 0xee, 0x8a, 0x00, 0xa0, 0xaa, 0x30, 0x15, 0x90, 0x98, 0x88, 0x22, 0x02, + 0x98, 0x62, 0x36, 0xb8, 0x9a, 0x10, 0x54, 0xd8, 0xbd, 0x9a, 0x88, 0xa9, 0x9c, 0x32, 0x23, 0x01, + 0x99, 0x20, 0x34, 0x92, 0x8c, 0x76, 0x12, 0x08, 0xa9, 0x29, 0x27, 0xa0, 0xdc, 0x9a, 0x88, 0xb9, + 0x89, 0x10, 0x35, 0x22, 0x80, 0x19, 0x45, 0xa0, 0x39, 0x36, 0x21, 0x01, 0xab, 0x41, 0x55, 0xa1, + 0xbd, 0x8a, 0xb9, 0xcb, 0x9a, 0x20, 0x34, 0x24, 0xa8, 0x50, 0x04, 0x99, 0x10, 0x52, 0x33, 0x90, + 0xbb, 0x5a, 0x27, 0xa0, 0xbb, 0xbb, 0xbc, 0xcc, 0xab, 0x19, 0x53, 0x83, 0x18, 0x32, 0x02, 0x98, + 0x39, 0x36, 0x54, 0x91, 0xbc, 0x40, 0x33, 0x90, 0xbc, 0xbb, 0xce, 0xab, 0xcc, 0x19, 0x31, 0x01, + 0x22, 0x43, 0x82, 0x88, 0x00, 0x51, 0x36, 0xa1, 0x9a, 0x62, 0x34, 0x81, 0xa8, 0xca, 0xab, 0xec, + 0xcb, 0x99, 0x00, 0x88, 0x09, 0x23, 0x11, 0x12, 0x10, 0x67, 0x34, 0x12, 0x21, 0x73, 0x23, 0x01, + 0xa8, 0xbb, 0xdb, 0xdc, 0xbb, 0xab, 0x88, 0x9a, 0x18, 0x31, 0x24, 0x03, 0x30, 0x57, 0x24, 0x02, + 0x11, 0x43, 0x33, 0x02, 0xca, 0xdb, 0xdb, 0xcc, 0xcb, 0x9a, 0x88, 0x09, 0x18, 0x21, 0x24, 0x02, + 0x11, 0x55, 0x24, 0x11, 0x11, 0x32, 0x34, 0x02, 0xb9, 0xbc, 0xdc, 0xdc, 0xbb, 0xab, 0x9a, 0x98, + 0x08, 0x32, 0x44, 0x82, 0x10, 0x54, 0x43, 0x12, 0x11, 0x32, 0x34, 0x13, 0xa8, 0xaa, 0xfb, 0xce, + 0xbb, 0xbb, 0xaa, 0xaa, 0x99, 0x31, 0x26, 0x11, 0x32, 0x45, 0x24, 0x12, 0x00, 0x21, 0x44, 0x02, + 0x88, 0x80, 0xc9, 0xdd, 0xbc, 0xcb, 0xa9, 0xa9, 0x9a, 0x10, 0x23, 0x11, 0x51, 0x45, 0x34, 0x22, + 0x02, 0x31, 0x34, 0x12, 0x00, 0x81, 0xea, 0xdd, 0xbc, 0xbb, 0xaa, 0xbb, 0x9b, 0x10, 0x33, 0x22, + 0x63, 0x54, 0x34, 0x23, 0x11, 0x32, 0x43, 0x11, 0x00, 0x81, 0xb9, 0xee, 0xcc, 0xbb, 0xba, 0xac, + 0x9a, 0x18, 0x21, 0x21, 0x32, 0x65, 0x34, 0x22, 0x22, 0x32, 0x33, 0x21, 0x11, 0x00, 0x98, 0xef, + 0xcc, 0xba, 0xbb, 0xdb, 0x9a, 0x08, 0x12, 0x13, 0x22, 0x64, 0x34, 0x22, 0x21, 0x22, 0x23, 0x21, + 0x90, 0x00, 0x90, 0xfd, 0xcc, 0xba, 0xba, 0xbc, 0xab, 0x89, 0x11, 0x02, 0x18, 0x55, 0x35, 0x23, + 0x32, 0x32, 0x33, 0x12, 0x10, 0x20, 0x13, 0xfd, 0xbc, 0xcb, 0xbc, 0xcb, 0xac, 0x09, 0x00, 0x81, + 0x08, 0x63, 0x43, 0x33, 0x22, 0x32, 0x43, 0x12, 0x00, 0x41, 0x12, 0xc9, 0xcc, 0xbc, 0xcc, 0xcb, + 0xac, 0x9a, 0x80, 0x98, 0x09, 0x41, 0x44, 0x33, 0x23, 0x24, 0x34, 0x12, 0x10, 0x32, 0x23, 0xa8, + 0xdd, 0xcb, 0xdb, 0xdb, 0xbb, 0x9a, 0x08, 0x99, 0x99, 0x31, 0x46, 0x33, 0x33, 0x53, 0x34, 0x22, + 0x21, 0x33, 0x23, 0x90, 0xcd, 0xbc, 0xbc, 0xdd, 0xbb, 0xaa, 0x99, 0xa9, 0x99, 0x20, 0x45, 0x24, + 0x32, 0x44, 0x32, 0x12, 0x12, 0x32, 0x22, 0x90, 0xdc, 0xbb, 0xeb, 0xdc, 0xbb, 0xaa, 0x99, 0x99, + 0x99, 0x20, 0x45, 0x24, 0x32, 0x34, 0x24, 0x12, 0x22, 0x22, 0x33, 0x91, 0xcc, 0xab, 0xdc, 0xdc, + 0xcb, 0x9a, 0x8a, 0x99, 0x9a, 0x18, 0x43, 0x43, 0x42, 0x34, 0x33, 0x32, 0x12, 0x52, 0x23, 0x82, + 0xba, 0x9a, 0xea, 0xce, 0xcb, 0xab, 0x99, 0xa9, 0xab, 0x89, 0x33, 0x34, 0x45, 0x34, 0x43, 0x22, + 0x11, 0x32, 0x34, 0x81, 0xa9, 0x99, 0xea, 0xdc, 0xcc, 0xab, 0x99, 0xa9, 0xba, 0x09, 0x20, 0x42, + 0x35, 0x44, 0x24, 0x23, 0x21, 0x42, 0x24, 0x00, 0x88, 0x99, 0xa9, 0xdd, 0xcc, 0xab, 0xa9, 0xb9, + 0xab, 0x9a, 0x18, 0x43, 0x54, 0x43, 0x34, 0x13, 0x21, 0x42, 0x33, 0x12, 0x80, 0x08, 0xa9, 0xdf, + 0xbd, 0xac, 0xa9, 0xaa, 0xaa, 0x9a, 0x08, 0x31, 0x44, 0x54, 0x43, 0x13, 0x12, 0x43, 0x32, 0x12, + 0x80, 0x09, 0x00, 0xfb, 0xbf, 0xba, 0xbb, 0xbb, 0xcb, 0xaa, 0x88, 0x11, 0x42, 0x45, 0x34, 0x23, + 0x21, 0x33, 0x43, 0x22, 0x88, 0x20, 0x23, 0xfa, 0xbe, 0xbc, 0xbb, 0xbb, 0xcb, 0xab, 0x8a, 0x08, + 0x38, 0x56, 0x34, 0x23, 0x32, 0x43, 0x34, 0x12, 0x80, 0x20, 0x01, 0xd9, 0xbe, 0xcc, 0xba, 0xba, + 0xcb, 0xaa, 0x98, 0x08, 0x10, 0x46, 0x43, 0x23, 0x22, 0x42, 0x43, 0x12, 0x00, 0x21, 0x12, 0xb0, + 0xed, 0xbc, 0xcb, 0xba, 0xcc, 0x9a, 0xa9, 0x99, 0x08, 0x42, 0x54, 0x32, 0x21, 0x53, 0x33, 0x13, + 0x10, 0x22, 0x12, 0x91, 0xec, 0xcc, 0xab, 0xbc, 0xbc, 0xab, 0xaa, 0xab, 0x89, 0x40, 0x36, 0x33, + 0x23, 0x45, 0x43, 0x12, 0x12, 0x22, 0x22, 0x82, 0xfa, 0xcb, 0xcb, 0xcb, 0xac, 0xaa, 0xab, 0xaa, + 0x9a, 0x30, 0x46, 0x23, 0x32, 0x54, 0x23, 0x23, 0x12, 0x22, 0x33, 0x13, 0xda, 0xbd, 0xdb, 0xbc, + 0xbc, 0xab, 0xbb, 0xbb, 0xbb, 0x28, 0x46, 0x23, 0x33, 0x45, 0x33, 0x23, 0x13, 0x22, 0x34, 0x13, + 0xb8, 0xbd, 0xcc, 0xcc, 0xbb, 0xac, 0xab, 0xbb, 0xad, 0x19, 0x22, 0x33, 0x43, 0x44, 0x34, 0x33, + 0x22, 0x32, 0x36, 0x13, 0x81, 0xa8, 0xda, 0xbc, 0xbd, 0xbc, 0xaa, 0xdb, 0xbb, 0x09, 0x21, 0x22, + 0x33, 0x45, 0x34, 0x24, 0x11, 0x22, 0x44, 0x22, 0x01, 0x98, 0xba, 0xdc, 0xbc, 0xac, 0xaa, 0xcc, + 0xbb, 0x99, 0x10, 0x12, 0x33, 0x44, 0x36, 0x23, 0x12, 0x32, 0x35, 0x23, 0x12, 0x80, 0xb9, 0xec, + 0xcc, 0xaa, 0xba, 0xcc, 0xbb, 0x9a, 0x00, 0x21, 0x21, 0x63, 0x35, 0x23, 0x23, 0x42, 0x43, 0x33, + 0x12, 0x00, 0x98, 0xfb, 0xbd, 0xab, 0xba, 0xcd, 0xbb, 0x9b, 0x09, 0x11, 0x20, 0x53, 0x36, 0x33, + 0x22, 0x23, 0x35, 0x24, 0x12, 0x00, 0x91, 0xfb, 0xbc, 0xba, 0xcb, 0xcb, 0xbc, 0xab, 0x89, 0x00, + 0x10, 0x63, 0x34, 0x24, 0x22, 0x32, 0x53, 0x23, 0x22, 0x31, 0x01, 0xeb, 0xcc, 0xba, 0xbb, 0xcc, + 0xcc, 0xaa, 0x88, 0x88, 0x08, 0x31, 0x35, 0x25, 0x13, 0x32, 0x34, 0x24, 0x21, 0x33, 0x03, 0xc9, + 0xcc, 0xbb, 0xbc, 0xeb, 0xbc, 0xbb, 0x9a, 0x98, 0x88, 0x31, 0x55, 0x43, 0x22, 0x31, 0x34, 0x32, + 0x32, 0x34, 0x22, 0xa8, 0xcc, 0xac, 0xbb, 0xdc, 0xcc, 0xab, 0x9a, 0x99, 0x89, 0x00, 0x44, 0x34, + 0x22, 0x42, 0x33, 0x33, 0x34, 0x34, 0x23, 0x80, 0xda, 0xac, 0xba, 0xdc, 0xcc, 0xba, 0xaa, 0xa9, + 0x99, 0x08, 0x52, 0x34, 0x22, 0x43, 0x43, 0x22, 0x43, 0x43, 0x32, 0x01, 0xba, 0xbb, 0xbc, 0xdd, + 0xbc, 0xad, 0xab, 0xa9, 0x9a, 0x0a, 0x32, 0x35, 0x43, 0x43, 0x43, 0x22, 0x33, 0x44, 0x33, 0x02, + 0xa8, 0xaa, 0xcb, 0xdc, 0xbc, 0xbd, 0xab, 0xba, 0xba, 0x9a, 0x21, 0x24, 0x34, 0x34, 0x34, 0x33, + 0x34, 0x54, 0x23, 0x12, 0x90, 0x99, 0xa9, 0xdb, 0xcd, 0xbc, 0xab, 0xbb, 0xac, 0x9a, 0x00, 0x22, + 0x34, 0x44, 0x43, 0x22, 0x33, 0x45, 0x43, 0x12, 0x81, 0x98, 0x88, 0xb9, 0xde, 0xbb, 0xac, 0xbb, + 0xbc, 0x9a, 0x88, 0x21, 0x32, 0x35, 0x35, 0x22, 0x32, 0x45, 0x34, 0x23, 0x01, 0x88, 0x08, 0xb8, + 0xce, 0xbc, 0xcb, 0xcb, 0xbb, 0xab, 0x8a, 0x18, 0x22, 0x44, 0x25, 0x13, 0x32, 0x54, 0x43, 0x33, + 0x11, 0x80, 0x10, 0x98, 0xcd, 0xac, 0xcb, 0xcb, 0xac, 0xab, 0x9a, 0x88, 0x10, 0x52, 0x43, 0x22, + 0x31, 0x44, 0x35, 0x24, 0x02, 0x00, 0x01, 0x90, 0xdb, 0xbc, 0xcb, 0xbc, 0xbc, 0xbb, 0xaa, 0x89, + 0x08, 0x53, 0x34, 0x32, 0x22, 0x63, 0x35, 0x34, 0x12, 0x10, 0x11, 0x80, 0xca, 0xbc, 0xcc, 0xcb, + 0xbc, 0xbb, 0xaa, 0x9a, 0x09, 0x41, 0x34, 0x33, 0x22, 0x53, 0x46, 0x33, 0x12, 0x12, 0x21, 0x80, + 0xb9, 0xcd, 0xcb, 0xdb, 0xbc, 0xab, 0xbb, 0xaa, 0x8a, 0x31, 0x44, 0x24, 0x11, 0x32, 0x47, 0x33, + 0x22, 0x22, 0x22, 0x11, 0xa9, 0xbd, 0xbc, 0xcd, 0xbc, 0xbb, 0xcb, 0xba, 0x99, 0x18, 0x42, 0x24, + 0x11, 0x42, 0x35, 0x35, 0x22, 0x22, 0x22, 0x12, 0xa8, 0xbb, 0xcd, 0xcc, 0xbc, 0xbc, 0xca, 0xaa, + 0x9a, 0x09, 0x32, 0x34, 0x11, 0x42, 0x45, 0x43, 0x23, 0x22, 0x33, 0x22, 0x80, 0xaa, 0xcc, 0xdc, + 0xcb, 0xac, 0xbb, 0xac, 0xaa, 0x0a, 0x31, 0x33, 0x22, 0x53, 0x45, 0x34, 0x32, 0x43, 0x22, 0x13, + 0x00, 0x89, 0xca, 0xcc, 0xbd, 0xbc, 0xbb, 0xbc, 0xcb, 0x99, 0x21, 0x22, 0x12, 0x31, 0x46, 0x43, + 0x24, 0x32, 0x43, 0x12, 0x01, 0x80, 0x98, 0xcc, 0xcc, 0xcb, 0xcb, 0xca, 0xba, 0x9a, 0x10, 0x22, + 0x22, 0x31, 0x54, 0x44, 0x32, 0x43, 0x33, 0x23, 0x12, 0x01, 0x98, 0xda, 0xcd, 0xbc, 0xbb, 0xcc, + 0xac, 0x9b, 0x00, 0x11, 0x01, 0x21, 0x52, 0x44, 0x32, 0x34, 0x24, 0x23, 0x12, 0x11, 0x88, 0xb8, + 0xce, 0xcb, 0xbb, 0xbd, 0xbd, 0xaa, 0x08, 0x10, 0x10, 0x20, 0x52, 0x43, 0x43, 0x34, 0x43, 0x23, + 0x22, 0x11, 0x01, 0xa9, 0xdd, 0xcb, 0xbb, 0xcd, 0xcb, 0x9b, 0x89, 0x18, 0x00, 0x10, 0x33, 0x35, + 0x53, 0x34, 0x24, 0x33, 0x23, 0x12, 0x12, 0x90, 0xcd, 0xcb, 0xcb, 0xcc, 0xdb, 0xba, 0x89, 0x88, + 0x00, 0x00, 0x22, 0x43, 0x34, 0x35, 0x34, 0x34, 0x22, 0x12, 0x22, 0x81, 0xcb, 0xbc, 0xbc, 0xdc, + 0xcc, 0xba, 0x9a, 0x88, 0x88, 0x10, 0x11, 0x33, 0x35, 0x35, 0x44, 0x33, 0x33, 0x33, 0x24, 0x01, + 0xa9, 0xcb, 0xcb, 0xdc, 0xcc, 0xac, 0x9a, 0x99, 0x88, 0x80, 0x11, 0x21, 0x43, 0x34, 0x45, 0x33, + 0x23, 0x43, 0x32, 0x02, 0x98, 0xca, 0xba, 0xdc, 0xbe, 0xbc, 0xba, 0xa9, 0x98, 0x88, 0x18, 0x22, + 0x33, 0x55, 0x34, 0x34, 0x33, 0x43, 0x33, 0x22, 0x90, 0xba, 0xb9, 0xde, 0xdc, 0xcb, 0xaa, 0x9a, + 0x99, 0x88, 0x08, 0x12, 0x22, 0x63, 0x34, 0x34, 0x43, 0x33, 0x43, 0x13, 0x91, 0x98, 0x98, 0xea, + 0xcd, 0xbc, 0xac, 0xaa, 0xa9, 0x89, 0x08, 0x01, 0x12, 0x53, 0x44, 0x43, 0x33, 0x34, 0x24, 0x23, + 0x00, 0x88, 0x88, 0xc9, 0xdd, 0xcc, 0xab, 0xab, 0xaa, 0x99, 0x88, 0x01, 0x11, 0x42, 0x54, 0x43, + 0x33, 0x44, 0x24, 0x23, 0x01, 0x00, 0x00, 0x98, 0xcd, 0xcd, 0xbb, 0xcb, 0xaa, 0xa9, 0x88, 0x88, + 0x00, 0x31, 0x54, 0x24, 0x43, 0x53, 0x43, 0x22, 0x11, 0x01, 0x01, 0x80, 0xeb, 0xcc, 0xbc, 0xbb, + 0xac, 0x9a, 0x89, 0x88, 0x80, 0x20, 0x44, 0x43, 0x33, 0x54, 0x34, 0x23, 0x22, 0x10, 0x11, 0x81, + 0xd9, 0xcd, 0xbc, 0xac, 0xbb, 0xab, 0x99, 0x98, 0x88, 0x20, 0x63, 0x33, 0x34, 0x54, 0x53, 0x22, + 0x12, 0x11, 0x10, 0x11, 0xb9, 0xcd, 0xbd, 0xcc, 0xba, 0xaa, 0x99, 0x98, 0x88, 0x08, 0x43, 0x43, + 0x42, 0x53, 0x44, 0x33, 0x22, 0x11, 0x12, 0x12, 0xa0, 0xdc, 0xcc, 0xdb, 0xbb, 0xba, 0x9a, 0x89, + 0x9a, 0x08, 0x42, 0x33, 0x53, 0x44, 0x44, 0x43, 0x12, 0x12, 0x11, 0x12, 0x80, 0xbb, 0xbf, 0xbd, + 0xbc, 0xac, 0x99, 0x99, 0x99, 0x09, 0x30, 0x22, 0x43, 0x63, 0x44, 0x34, 0x32, 0x21, 0x22, 0x13, + 0x01, 0xb8, 0xce, 0xcc, 0xbc, 0xbb, 0xaa, 0xa9, 0xab, 0x8a, 0x20, 0x32, 0x23, 0x55, 0x45, 0x34, + 0x32, 0x22, 0x32, 0x22, 0x12, 0xa8, 0xeb, 0xdc, 0xbc, 0xac, 0x9b, 0xaa, 0xaa, 0x99, 0x00, 0x22, + 0x21, 0x53, 0x55, 0x34, 0x32, 0x33, 0x32, 0x33, 0x12, 0x91, 0xda, 0xcd, 0xcd, 0xab, 0xab, 0xba, + 0xba, 0x9a, 0x18, 0x11, 0x12, 0x43, 0x47, 0x53, 0x23, 0x33, 0x32, 0x33, 0x22, 0x11, 0xa8, 0xed, + 0xbd, 0xbc, 0xab, 0xab, 0xbb, 0xaa, 0x09, 0x10, 0x11, 0x32, 0x47, 0x35, 0x34, 0x32, 0x33, 0x24, + 0x22, 0x21, 0x81, 0xea, 0xcd, 0xcb, 0xaa, 0xab, 0xab, 0xab, 0x89, 0x00, 0x01, 0x20, 0x64, 0x44, + 0x34, 0x32, 0x43, 0x32, 0x22, 0x12, 0x12, 0xc8, 0xce, 0xbc, 0xcb, 0xaa, 0xbb, 0xba, 0x8a, 0x08, + 0x80, 0x18, 0x63, 0x45, 0x43, 0x33, 0x43, 0x23, 0x23, 0x23, 0x23, 0xa8, 0xde, 0xbc, 0xac, 0xab, + 0xcb, 0xaa, 0x9a, 0x08, 0x08, 0x88, 0x41, 0x36, 0x34, 0x34, 0x34, 0x32, 0x32, 0x32, 0x14, 0x81, + 0xfa, 0xcb, 0xcb, 0xba, 0xcb, 0xab, 0x9a, 0x89, 0x90, 0x88, 0x31, 0x46, 0x24, 0x34, 0x34, 0x33, + 0x32, 0x32, 0x24, 0x82, 0xd9, 0xdc, 0xab, 0xac, 0xcb, 0xba, 0x9a, 0x89, 0x98, 0x88, 0x10, 0x44, + 0x43, 0x35, 0x34, 0x24, 0x13, 0x33, 0x33, 0x23, 0xb8, 0xbf, 0xcc, 0xbb, 0xdb, 0xbb, 0xaa, 0x99, + 0x99, 0x99, 0x10, 0x53, 0x53, 0x53, 0x34, 0x33, 0x33, 0x43, 0x43, 0x12, 0x80, 0xdb, 0xcb, 0xbc, + 0xbc, 0xbc, 0xaa, 0x99, 0xa9, 0x99, 0x18, 0x31, 0x63, 0x63, 0x43, 0x33, 0x33, 0x43, 0x34, 0x23, + 0x00, 0xba, 0xbd, 0xbd, 0xcc, 0xcb, 0x9a, 0x9a, 0x99, 0x9a, 0x88, 0x01, 0x32, 0x46, 0x34, 0x34, + 0x32, 0x43, 0x43, 0x23, 0x02, 0x99, 0xdb, 0xcb, 0xbd, 0xbc, 0xbb, 0xaa, 0xaa, 0xaa, 0x98, 0x08, + 0x21, 0x55, 0x34, 0x25, 0x33, 0x43, 0x53, 0x23, 0x02, 0x90, 0xa9, 0xcc, 0xcc, 0xcb, 0xbb, 0xaa, + 0xab, 0x9a, 0x9a, 0x89, 0x20, 0x53, 0x55, 0x33, 0x43, 0x42, 0x43, 0x43, 0x12, 0x80, 0x98, 0xba, + 0xcd, 0xcc, 0xaa, 0xab, 0xab, 0xaa, 0xa9, 0x89, 0x08, 0x41, 0x45, 0x34, 0x33, 0x53, 0x34, 0x34, + 0x22, 0x01, 0x90, 0xb8, 0xdc, 0xbc, 0xbc, 0xbb, 0xba, 0xab, 0xba, 0x9a, 0x99, 0x30, 0x37, 0x35, + 0x33, 0x34, 0x45, 0x33, 0x24, 0x11, 0x00, 0x98, 0xcb, 0xbd, 0xbc, 0xac, 0xab, 0xbb, 0xaa, 0xaa, + 0x9b, 0x18, 0x54, 0x43, 0x43, 0x33, 0x45, 0x34, 0x23, 0x22, 0x02, 0x81, 0xca, 0xcc, 0xbc, 0xac, + 0xbb, 0xab, 0xab, 0xbb, 0xbb, 0x09, 0x52, 0x34, 0x34, 0x43, 0x45, 0x34, 0x23, 0x23, 0x23, 0x00, + 0xa9, 0xcd, 0xcc, 0xba, 0xac, 0xab, 0xaa, 0xb9, 0xab, 0x8a, 0x31, 0x35, 0x24, 0x43, 0x54, 0x34, + 0x33, 0x24, 0x22, 0x02, 0xa0, 0xda, 0xdb, 0xcb, 0xbb, 0xbb, 0xba, 0xca, 0xab, 0x9b, 0x18, 0x34, + 0x23, 0x43, 0x46, 0x34, 0x34, 0x24, 0x22, 0x12, 0x80, 0xa9, 0xbd, 0xcc, 0xcb, 0xba, 0xaa, 0xba, + 0xbb, 0xbb, 0x08, 0x53, 0x22, 0x41, 0x54, 0x53, 0x24, 0x33, 0x43, 0x12, 0x11, 0x99, 0xca, 0xcc, + 0xbc, 0xba, 0xbb, 0xca, 0xbb, 0xbc, 0x09, 0x12, 0x11, 0x32, 0x54, 0x35, 0x35, 0x43, 0x32, 0x33, + 0x11, 0x80, 0xc9, 0xcc, 0xbc, 0xbb, 0xac, 0xba, 0xdb, 0xab, 0x0a, 0x10, 0x10, 0x21, 0x44, 0x44, + 0x44, 0x42, 0x42, 0x12, 0x12, 0x81, 0x98, 0xbc, 0xbd, 0xcb, 0xab, 0xaa, 0xcc, 0xab, 0x9a, 0x00, + 0x10, 0x11, 0x42, 0x54, 0x34, 0x34, 0x34, 0x24, 0x21, 0x01, 0x90, 0xca, 0xcc, 0xac, 0xab, 0xaa, + 0xdb, 0xab, 0x9a, 0x88, 0x01, 0x01, 0x32, 0x55, 0x43, 0x44, 0x33, 0x24, 0x23, 0x21, 0x80, 0xb9, + 0xdd, 0xcb, 0xaa, 0xb9, 0xcb, 0xcb, 0x9a, 0x89, 0x81, 0x10, 0x21, 0x43, 0x35, 0x36, 0x25, 0x33, + 0x33, 0x22, 0x11, 0xa8, 0xdd, 0xcb, 0xaa, 0xab, 0xbc, 0xbc, 0xab, 0x89, 0x88, 0x08, 0x20, 0x32, + 0x45, 0x45, 0x34, 0x34, 0x33, 0x32, 0x12, 0x81, 0xeb, 0xbc, 0xba, 0xbb, 0xbc, 0xbd, 0xbb, 0x9a, + 0x88, 0x09, 0x11, 0x21, 0x54, 0x44, 0x35, 0x53, 0x23, 0x32, 0x22, 0x82, 0xc9, 0xbc, 0xac, 0xbb, + 0xdb, 0xdb, 0xaa, 0x9a, 0x9a, 0x88, 0x10, 0x20, 0x42, 0x45, 0x63, 0x43, 0x32, 0x23, 0x24, 0x11, + 0xa8, 0xbc, 0xcb, 0xbb, 0xdb, 0xbc, 0xba, 0xab, 0xaa, 0x89, 0x08, 0x10, 0x42, 0x44, 0x45, 0x25, + 0x33, 0x43, 0x32, 0x13, 0x88, 0xdb, 0xbb, 0xcb, 0xcb, 0xbc, 0xac, 0xab, 0x9b, 0x99, 0x88, 0x10, + 0x22, 0x52, 0x55, 0x34, 0x24, 0x43, 0x32, 0x13, 0x81, 0xc9, 0xab, 0xac, 0xbc, 0xbc, 0xac, 0xbb, + 0xbb, 0xa9, 0x09, 0x00, 0x10, 0x31, 0x57, 0x44, 0x32, 0x34, 0x24, 0x33, 0x01, 0x99, 0xbb, 0xdb, + 0xcb, 0xcb, 0xcb, 0xcb, 0xaa, 0x9a, 0x89, 0x88, 0x80, 0x28, 0x64, 0x34, 0x34, 0x34, 0x44, 0x32, + 0x11, 0x88, 0x9a, 0xbb, 0xbc, 0xbd, 0xcb, 0xac, 0xbb, 0xbb, 0x8a, 0x98, 0x99, 0x18, 0x73, 0x53, + 0x34, 0x34, 0x44, 0x33, 0x12, 0x00, 0xa8, 0xba, 0xcb, 0xcc, 0xcb, 0xbb, 0xbc, 0xbb, 0x9a, 0x99, + 0x99, 0x09, 0x51, 0x44, 0x34, 0x44, 0x34, 0x34, 0x12, 0x11, 0x98, 0xa9, 0xcb, 0xcb, 0xdb, 0xbb, + 0xbc, 0xbb, 0xaa, 0xa9, 0xa9, 0x89, 0x32, 0x55, 0x34, 0x44, 0x44, 0x33, 0x33, 0x21, 0x90, 0x99, + 0xbb, 0xbd, 0xbd, 0xcb, 0xbc, 0xab, 0xaa, 0x9a, 0x9a, 0x8a, 0x28, 0x35, 0x34, 0x55, 0x53, 0x43, + 0x32, 0x12, 0x00, 0x88, 0xaa, 0xcb, 0xbc, 0xbc, 0xbd, 0xbb, 0xab, 0xaa, 0xba, 0x9b, 0x28, 0x42, + 0x43, 0x55, 0x44, 0x34, 0x33, 0x23, 0x11, 0x80, 0xa9, 0xbb, 0xbd, 0xcd, 0xbb, 0xbc, 0xab, 0xba, + 0xba, 0xab, 0x08, 0x21, 0x42, 0x55, 0x44, 0x44, 0x33, 0x33, 0x12, 0x81, 0x98, 0xb9, 0xdb, 0xbc, + 0xbd, 0xac, 0xbb, 0xaa, 0xbb, 0xbb, 0x09, 0x10, 0x22, 0x45, 0x64, 0x44, 0x33, 0x33, 0x23, 0x02, + 0x90, 0xa9, 0xcb, 0xcc, 0xbc, 0xcc, 0xaa, 0x9a, 0xbb, 0xab, 0x89, 0x08, 0x21, 0x41, 0x64, 0x35, + 0x35, 0x33, 0x33, 0x11, 0x81, 0x98, 0xaa, 0xcc, 0xcc, 0xbc, 0xab, 0xba, 0xac, 0xab, 0x9a, 0x89, + 0x00, 0x10, 0x73, 0x36, 0x35, 0x24, 0x33, 0x21, 0x01, 0x08, 0x99, 0xca, 0xcc, 0xbc, 0xbb, 0xbb, + 0xbc, 0xac, 0x9a, 0x89, 0x88, 0x88, 0x52, 0x55, 0x34, 0x34, 0x24, 0x12, 0x02, 0x00, 0x88, 0xb8, + 0xdc, 0xbb, 0xac, 0xac, 0xbb, 0xbb, 0xab, 0x9a, 0x99, 0xa9, 0x30, 0x57, 0x35, 0x35, 0x33, 0x23, + 0x13, 0x10, 0x00, 0xa8, 0xcd, 0xcb, 0xcb, 0xbb, 0xcb, 0xbb, 0xab, 0x9a, 0x9a, 0xaa, 0x19, 0x64, + 0x45, 0x34, 0x34, 0x33, 0x22, 0x01, 0x11, 0x98, 0xbc, 0xbd, 0xbc, 0xac, 0xbb, 0xad, 0x9b, 0x9a, + 0xa9, 0x9a, 0x8a, 0x40, 0x55, 0x44, 0x53, 0x32, 0x12, 0x11, 0x12, 0x90, 0xb9, 0xbc, 0xbd, 0xca, + 0xcb, 0xbb, 0xbb, 0xaa, 0xab, 0xbb, 0xaa, 0x28, 0x65, 0x35, 0x36, 0x33, 0x23, 0x32, 0x13, 0x01, + 0xa8, 0xcc, 0xac, 0xcb, 0xbc, 0xcb, 0xba, 0xaa, 0xaa, 0xba, 0xbb, 0x89, 0x52, 0x65, 0x44, 0x33, + 0x32, 0x33, 0x22, 0x12, 0x98, 0xca, 0xbc, 0xdb, 0xbc, 0xbc, 0xba, 0xbb, 0xaa, 0xbb, 0xab, 0x9a, + 0x18, 0x66, 0x45, 0x33, 0x24, 0x32, 0x22, 0x12, 0x91, 0xb9, 0xcb, 0xdb, 0xbc, 0xbc, 0xcb, 0xaa, + 0xa9, 0xbb, 0xaa, 0xba, 0x8a, 0x72, 0x46, 0x43, 0x33, 0x33, 0x33, 0x23, 0x01, 0xa9, 0xbb, 0xbe, + 0xbd, 0xbc, 0xcb, 0xaa, 0xba, 0xba, 0xa9, 0xcb, 0x9a, 0x40, 0x46, 0x44, 0x33, 0x43, 0x32, 0x22, + 0x11, 0x88, 0xa9, 0xbc, 0xcc, 0xbc, 0xac, 0xba, 0xba, 0xab, 0xab, 0xbc, 0xab, 0x18, 0x55, 0x45, + 0x33, 0x34, 0x33, 0x33, 0x22, 0x00, 0xb9, 0xca, 0xdc, 0xcb, 0xbb, 0xcb, 0xba, 0xab, 0xbb, 0xbc, + 0xab, 0x8a, 0x62, 0x45, 0x34, 0x43, 0x33, 0x33, 0x23, 0x01, 0x98, 0xaa, 0xcd, 0xbd, 0xbb, 0xcb, + 0xbb, 0xab, 0xab, 0xbc, 0xcb, 0x9a, 0x31, 0x56, 0x43, 0x43, 0x24, 0x23, 0x23, 0x01, 0x00, 0x99, + 0xea, 0xcb, 0xbb, 0xbc, 0xac, 0xaa, 0xab, 0xba, 0xbc, 0xaa, 0x38, 0x45, 0x44, 0x44, 0x33, 0x33, + 0x33, 0x21, 0x00, 0xa0, 0xdb, 0xbc, 0xbc, 0xbc, 0xac, 0xab, 0xaa, 0xaa, 0xcc, 0x9a, 0x08, 0x41, + 0x54, 0x34, 0x34, 0x43, 0x32, 0x21, 0x10, 0x80, 0xba, 0xcc, 0xcb, 0xbc, 0xbb, 0xbb, 0xbb, 0xcb, + 0xbc, 0xbb, 0x99, 0x31, 0x56, 0x53, 0x43, 0x43, 0x22, 0x22, 0x11, 0x00, 0xa9, 0xcb, 0xbc, 0xcc, + 0xbb, 0xbb, 0xab, 0xbb, 0xbd, 0xcb, 0x9a, 0x10, 0x53, 0x44, 0x44, 0x43, 0x32, 0x22, 0x12, 0x01, + 0x98, 0xba, 0xcd, 0xcb, 0xcb, 0xab, 0xab, 0xba, 0xcb, 0xcb, 0xaa, 0x19, 0x32, 0x46, 0x44, 0x34, + 0x33, 0x33, 0x22, 0x11, 0x80, 0xba, 0xcc, 0xbc, 0xbd, 0xac, 0x9a, 0xaa, 0xbb, 0xad, 0xab, 0x89, + 0x11, 0x73, 0x44, 0x43, 0x43, 0x22, 0x13, 0x12, 0x00, 0x99, 0xba, 0xdc, 0xbc, 0xbb, 0xbb, 0xbb, + 0xbc, 0xcc, 0xaa, 0x9a, 0x08, 0x42, 0x55, 0x43, 0x34, 0x32, 0x33, 0x22, 0x01, 0x88, 0xb9, 0xcd, + 0xbc, 0xbc, 0xba, 0xab, 0xcb, 0xbc, 0xab, 0xaa, 0x99, 0x31, 0x56, 0x34, 0x44, 0x32, 0x33, 0x23, + 0x02, 0x81, 0xa8, 0xcc, 0xbc, 0xbc, 0xac, 0xaa, 0xbb, 0xbc, 0xac, 0xaa, 0x99, 0x18, 0x44, 0x45, + 0x24, 0x24, 0x33, 0x23, 0x22, 0x01, 0x98, 0xca, 0xcc, 0xbc, 0xbb, 0xba, 0xcb, 0xac, 0xbb, 0xbb, + 0xba, 0x09, 0x62, 0x45, 0x43, 0x34, 0x33, 0x24, 0x22, 0x01, 0x80, 0xb8, 0xeb, 0xbc, 0xba, 0xbb, + 0xcb, 0xcb, 0xab, 0xcb, 0xaa, 0x9a, 0x30, 0x45, 0x44, 0x34, 0x34, 0x23, 0x33, 0x21, 0x10, 0x98, + 0xeb, 0xdb, 0xba, 0xab, 0xcb, 0xbb, 0xcb, 0xbb, 0xbc, 0x9a, 0x19, 0x43, 0x45, 0x35, 0x43, 0x33, + 0x33, 0x23, 0x11, 0x80, 0xcb, 0xcc, 0xcb, 0xbb, 0xbb, 0xcc, 0xba, 0xac, 0xbb, 0xab, 0x89, 0x30, + 0x55, 0x44, 0x34, 0x43, 0x32, 0x22, 0x22, 0x01, 0xa9, 0xcc, 0xcb, 0xbb, 0xac, 0xac, 0xbb, 0xbc, + 0xbb, 0xac, 0x89, 0x18, 0x53, 0x35, 0x35, 0x34, 0x33, 0x33, 0x23, 0x12, 0xa8, 0xdb, 0xcc, 0xba, + 0xcb, 0xbb, 0xbb, 0xcc, 0xbb, 0xba, 0xab, 0x09, 0x42, 0x55, 0x53, 0x43, 0x33, 0x33, 0x33, 0x22, + 0x80, 0xba, 0xbe, 0xbc, 0xcb, 0xbb, 0xbb, 0xad, 0xcb, 0xba, 0xab, 0x9a, 0x20, 0x54, 0x44, 0x34, + 0x43, 0x33, 0x24, 0x22, 0x10, 0xa8, 0xca, 0xcb, 0xbb, 0xbc, 0xcb, 0xcb, 0xca, 0xba, 0xbb, 0xaa, + 0x88, 0x42, 0x45, 0x44, 0x43, 0x33, 0x33, 0x33, 0x22, 0x90, 0xbb, 0xcd, 0xcb, 0xca, 0xba, 0xcb, + 0xbb, 0xbc, 0xbb, 0xab, 0x99, 0x20, 0x46, 0x44, 0x34, 0x33, 0x34, 0x24, 0x12, 0x80, 0xa8, 0xca, + 0xbb, 0xcb, 0xbc, 0xbb, 0xbc, 0xbc, 0xac, 0xba, 0xa9, 0x08, 0x53, 0x44, 0x44, 0x42, 0x42, 0x22, + 0x22, 0x01, 0x98, 0xb9, 0xcb, 0xbc, 0xbb, 0xbc, 0xbc, 0xcb, 0xcb, 0xaa, 0xaa, 0x89, 0x21, 0x36, + 0x45, 0x43, 0x33, 0x25, 0x22, 0x11, 0x80, 0xa9, 0xbb, 0xbd, 0xcb, 0xbb, 0xbc, 0xbc, 0xbb, 0xcb, + 0xab, 0xaa, 0x10, 0x44, 0x35, 0x44, 0x34, 0x33, 0x24, 0x12, 0x81, 0x98, 0xba, 0xcc, 0xbb, 0xcb, + 0xcb, 0xac, 0xbb, 0xbb, 0xbc, 0xaa, 0x09, 0x42, 0x44, 0x44, 0x34, 0x34, 0x33, 0x23, 0x02, 0x80, + 0xaa, 0xcc, 0xbb, 0xbc, 0xbc, 0xdb, 0xba, 0xcb, 0xba, 0xbb, 0x89, 0x20, 0x54, 0x34, 0x35, 0x44, + 0x32, 0x23, 0x22, 0x00, 0x99, 0xbb, 0xcc, 0xcb, 0xcb, 0xbb, 0xbc, 0xbb, 0xbc, 0xab, 0x9a, 0x19, + 0x43, 0x36, 0x35, 0x35, 0x43, 0x32, 0x22, 0x01, 0x90, 0xba, 0xdb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbb, + 0xbc, 0xbb, 0xab, 0x89, 0x31, 0x46, 0x44, 0x43, 0x34, 0x33, 0x33, 0x02, 0x80, 0xa9, 0xbc, 0xbc, + 0xcc, 0xca, 0xba, 0xcb, 0xca, 0xaa, 0xaa, 0x8a, 0x10, 0x43, 0x54, 0x34, 0x35, 0x33, 0x24, 0x22, + 0x00, 0x98, 0xaa, 0xbc, 0xcc, 0xbb, 0xcb, 0xac, 0xbb, 0xac, 0xba, 0x9a, 0x19, 0x41, 0x44, 0x44, + 0x34, 0x34, 0x33, 0x22, 0x11, 0x88, 0xba, 0xbc, 0xcc, 0xbb, 0xbc, 0xcb, 0xbb, 0xbc, 0xbb, 0xaa, + 0x89, 0x21, 0x54, 0x44, 0x44, 0x33, 0x34, 0x33, 0x12, 0x80, 0xa9, 0xca, 0xcb, 0xac, 0xbc, 0xbb, + 0xac, 0xcb, 0xbb, 0xab, 0x9a, 0x00, 0x52, 0x44, 0x35, 0x44, 0x33, 0x33, 0x23, 0x00, 0x98, 0xba, + 0xbc, 0xbd, 0xbc, 0xcb, 0xab, 0xbc, 0xcb, 0xab, 0x9a, 0x88, 0x31, 0x54, 0x35, 0x44, 0x43, 0x33, + 0x22, 0x02, 0x80, 0xa9, 0xcb, 0xbc, 0xbc, 0xac, 0xcb, 0xba, 0xac, 0xbb, 0xaa, 0x89, 0x20, 0x44, + 0x45, 0x43, 0x34, 0x34, 0x32, 0x11, 0x00, 0x98, 0xba, 0xcc, 0xcb, 0xcb, 0xba, 0xcb, 0xbb, 0xac, + 0xab, 0x8a, 0x08, 0x41, 0x35, 0x45, 0x34, 0x43, 0x33, 0x22, 0x01, 0x88, 0xaa, 0xdb, 0xbc, 0xbc, + 0xba, 0xbc, 0xcb, 0xbb, 0xab, 0x9b, 0x89, 0x21, 0x55, 0x63, 0x43, 0x34, 0x33, 0x22, 0x12, 0x80, + 0x99, 0xcb, 0xcc, 0xbb, 0xbb, 0xbd, 0xcb, 0xbb, 0xab, 0xbb, 0x99, 0x18, 0x52, 0x45, 0x44, 0x34, + 0x24, 0x23, 0x12, 0x00, 0x98, 0xb9, 0xcc, 0xbb, 0xbc, 0xcb, 0xcb, 0xbb, 0xbb, 0xbb, 0x9b, 0x89, + 0x30, 0x65, 0x44, 0x34, 0x34, 0x33, 0x23, 0x11, 0x00, 0xaa, 0xbc, 0xbd, 0xcb, 0xbb, 0xbc, 0xbc, + 0xcb, 0xba, 0xa9, 0x99, 0x18, 0x52, 0x35, 0x36, 0x34, 0x43, 0x22, 0x11, 0x01, 0x98, 0xca, 0xbb, + 0xbc, 0xbc, 0xdb, 0xba, 0xac, 0xab, 0xab, 0x99, 0x09, 0x41, 0x54, 0x44, 0x34, 0x34, 0x22, 0x22, + 0x01, 0x90, 0xb9, 0xbc, 0xbc, 0xbc, 0xbb, 0xbd, 0xcb, 0xab, 0xaa, 0x9b, 0x89, 0x20, 0x54, 0x54, + 0x34, 0x34, 0x33, 0x32, 0x11, 0x91, 0xa9, 0xbc, 0xad, 0xac, 0xbb, 0xbc, 0xcb, 0xbb, 0xbb, 0xba, + 0x9a, 0x00, 0x53, 0x46, 0x44, 0x24, 0x33, 0x23, 0x22, 0x00, 0x98, 0xcb, 0xcb, 0xac, 0xbb, 0xbc, + 0xad, 0xab, 0xbb, 0xba, 0xaa, 0x89, 0x10, 0x56, 0x54, 0x33, 0x34, 0x33, 0x23, 0x12, 0x88, 0xca, + 0xbb, 0xbd, 0xca, 0xcb, 0xbb, 0xbc, 0xbb, 0xbb, 0xaa, 0x9a, 0x09, 0x54, 0x46, 0x43, 0x34, 0x42, + 0x22, 0x11, 0x81, 0x99, 0xbb, 0xbc, 0xcb, 0xbc, 0xcb, 0xbb, 0xcb, 0xbb, 0xaa, 0xaa, 0x99, 0x42, + 0x56, 0x43, 0x34, 0x24, 0x33, 0x22, 0x01, 0x98, 0xca, 0xbb, 0xdb, 0xcb, 0xcb, 0xba, 0xac, 0xbb, + 0xaa, 0xba, 0x99, 0x20, 0x46, 0x45, 0x43, 0x33, 0x34, 0x22, 0x02, 0x80, 0xaa, 0xcb, 0xcb, 0xbc, + 0xbb, 0xcc, 0xba, 0xbb, 0xbb, 0xbb, 0xab, 0x18, 0x73, 0x45, 0x34, 0x34, 0x43, 0x22, 0x12, 0x81, + 0x99, 0xba, 0xbc, 0xbc, 0xbc, 0xdb, 0xba, 0xbb, 0xbb, 0xac, 0xab, 0x89, 0x31, 0x46, 0x45, 0x43, + 0x33, 0x43, 0x22, 0x81, 0x90, 0xa9, 0xcb, 0xbc, 0xbb, 0xbd, 0xcb, 0xba, 0xbb, 0xbb, 0xac, 0x9a, + 0x19, 0x44, 0x36, 0x35, 0x34, 0x43, 0x22, 0x01, 0x00, 0xa9, 0xba, 0xbc, 0xdb, 0xbb, 0xbc, 0xbc, + 0xab, 0xac, 0xba, 0xaa, 0x89, 0x52, 0x54, 0x53, 0x43, 0x43, 0x22, 0x12, 0x00, 0x98, 0xb9, 0xcb, + 0xcb, 0xcb, 0xcb, 0xbb, 0xbb, 0xcb, 0xbb, 0xbb, 0x9a, 0x30, 0x56, 0x53, 0x34, 0x34, 0x24, 0x12, + 0x01, 0x80, 0x99, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc, 0xba, 0xcb, 0xba, 0xcb, 0x9a, 0x18, 0x52, 0x44, + 0x44, 0x34, 0x33, 0x23, 0x22, 0x00, 0x99, 0xcb, 0xcb, 0xcb, 0xbc, 0xbb, 0xbc, 0xbb, 0xbb, 0xad, + 0xab, 0x09, 0x31, 0x54, 0x45, 0x34, 0x24, 0x23, 0x22, 0x01, 0x98, 0xaa, 0xcb, 0xcb, 0xbc, 0xac, + 0xbb, 0xac, 0xca, 0xba, 0xbb, 0x89, 0x18, 0x62, 0x54, 0x34, 0x34, 0x33, 0x33, 0x12, 0x80, 0xa9, + 0xcb, 0xdb, 0xcb, 0xcb, 0xab, 0xbb, 0xcb, 0xdb, 0xaa, 0x89, 0x88, 0x30, 0x55, 0x44, 0x24, 0x33, + 0x33, 0x23, 0x00, 0x89, 0xba, 0xcc, 0xdb, 0xbb, 0xcb, 0xba, 0xcb, 0xcb, 0xba, 0x9a, 0x99, 0x18, + 0x54, 0x45, 0x34, 0x43, 0x33, 0x22, 0x01, 0x80, 0xaa, 0xcb, 0xdb, 0xcb, 0xbb, 0xab, 0xbc, 0xcb, + 0xbb, 0xaa, 0x9a, 0x89, 0x63, 0x45, 0x44, 0x43, 0x32, 0x23, 0x11, 0x81, 0x99, 0xba, 0xcc, 0xbc, + 0xbb, 0xbb, 0xbc, 0xbc, 0xcb, 0xaa, 0xaa, 0x9a, 0x21, 0x56, 0x34, 0x35, 0x43, 0x23, 0x12, 0x01, + 0x98, 0xa9, 0xcb, 0xcc, 0xbb, 0xab, 0xcb, 0xcb, 0xbb, 0xbb, 0xcb, 0xaa, 0x08, 0x73, 0x63, 0x43, + 0x24, 0x33, 0x22, 0x02, 0x80, 0x98, 0xca, 0xcc, 0xba, 0xba, 0xca, 0xcb, 0xbb, 0xcb, 0xbb, 0xac, + 0x89, 0x30, 0x64, 0x44, 0x43, 0x33, 0x23, 0x22, 0x00, 0x80, 0xba, 0xbd, 0xbc, 0xbb, 0xcb, 0xcb, + 0xcb, 0xca, 0xba, 0xbb, 0xaa, 0x08, 0x44, 0x36, 0x35, 0x34, 0x33, 0x23, 0x11, 0x80, 0xa8, 0xbc, + 0xbc, 0xcb, 0xba, 0xbc, 0xac, 0xcb, 0xbb, 0xac, 0xab, 0x89, 0x31, 0x46, 0x35, 0x35, 0x33, 0x22, + 0x12, 0x01, 0x98, 0xdb, 0xbb, 0xbb, 0xcb, 0xbc, 0xcb, 0xca, 0xbb, 0xcb, 0xab, 0x9a, 0x28, 0x54, + 0x54, 0x34, 0x43, 0x22, 0x22, 0x11, 0x88, 0xba, 0xcb, 0xbb, 0xcb, 0xac, 0xcb, 0xba, 0xbc, 0xdb, + 0xba, 0x9a, 0x88, 0x41, 0x45, 0x35, 0x34, 0x32, 0x23, 0x22, 0x80, 0xa9, 0xac, 0xcb, 0xbb, 0xbc, + 0xcb, 0xba, 0xbc, 0xbc, 0xac, 0xab, 0x9a, 0x28, 0x64, 0x54, 0x33, 0x33, 0x43, 0x22, 0x01, 0xa8, + 0xaa, 0xbb, 0xbd, 0xbb, 0xbc, 0xcb, 0xbb, 0xcd, 0xab, 0xbb, 0xab, 0x0a, 0x52, 0x46, 0x34, 0x33, + 0x34, 0x32, 0x02, 0x90, 0xa9, 0xba, 0xbd, 0xbb, 0xbc, 0xca, 0xca, 0xcb, 0xac, 0xbb, 0xbb, 0xaa, + 0x20, 0x47, 0x34, 0x34, 0x34, 0x33, 0x12, 0x01, 0x99, 0xba, 0xcb, 0xac, 0xbb, 0xbb, 0xcc, 0xdb, + 0xbb, 0xcb, 0xbb, 0xab, 0x19, 0x64, 0x34, 0x44, 0x33, 0x24, 0x13, 0x11, 0x88, 0xa9, 0xba, 0xbc, + 0xcb, 0xba, 0xcb, 0xbc, 0xbc, 0xcb, 0xcb, 0xab, 0x0a, 0x41, 0x45, 0x43, 0x34, 0x24, 0x23, 0x11, + 0x80, 0x98, 0xba, 0xbc, 0xcb, 0xaa, 0xbb, 0xcc, 0xcb, 0xbb, 0xbc, 0xbc, 0x9a, 0x20, 0x44, 0x44, + 0x34, 0x25, 0x23, 0x12, 0x81, 0x80, 0xa9, 0xcb, 0xbb, 0xac, 0xba, 0xcc, 0xbb, 0xcb, 0xcb, 0xbc, + 0xaa, 0x08, 0x32, 0x46, 0x44, 0x43, 0x32, 0x22, 0x02, 0x80, 0xa8, 0xcb, 0xbb, 0xbb, 0xbc, 0xdb, + 0xbb, 0xac, 0xbc, 0xcc, 0xaa, 0x89, 0x20, 0x63, 0x34, 0x45, 0x32, 0x22, 0x12, 0x01, 0x88, 0xba, + 0xbc, 0xbb, 0xca, 0xdb, 0xba, 0xab, 0xcc, 0xbc, 0xac, 0x99, 0x08, 0x42, 0x44, 0x35, 0x34, 0x32, + 0x22, 0x11, 0x88, 0xb9, 0xcb, 0xbb, 0xbb, 0xbd, 0xac, 0xab, 0xcc, 0xdb, 0xab, 0xab, 0x09, 0x30, + 0x64, 0x44, 0x43, 0x23, 0x23, 0x12, 0x81, 0xa8, 0xbb, 0xac, 0xcb, 0xcb, 0xbb, 0xbb, 0xcc, 0xbc, + 0xbc, 0xbb, 0x99, 0x18, 0x63, 0x45, 0x43, 0x43, 0x22, 0x12, 0x11, 0x98, 0xba, 0xba, 0xdb, 0xbb, + 0xac, 0xab, 0xcb, 0xcc, 0xcb, 0xba, 0x9a, 0x89, 0x41, 0x36, 0x45, 0x33, 0x32, 0x33, 0x22, 0x88, + 0xaa, 0xbb, 0xcc, 0xcb, 0xbb, 0xba, 0xcb, 0xcc, 0xcb, 0xbb, 0xab, 0x9a, 0x38, 0x65, 0x34, 0x25, + 0x33, 0x33, 0x22, 0x81, 0x99, 0xba, 0xcb, 0xbc, 0xac, 0xab, 0xba, 0xdc, 0xcb, 0xbb, 0xac, 0xaa, + 0x09, 0x53, 0x45, 0x24, 0x24, 0x33, 0x23, 0x01, 0x88, 0xa9, 0xba, 0xbd, 0xac, 0xaa, 0xab, 0xcc, + 0xbc, 0xcb, 0xab, 0xbb, 0x9a, 0x52, 0x54, 0x43, 0x34, 0x43, 0x32, 0x11, 0x08, 0x89, 0xaa, 0xcc, + 0xba, 0xab, 0xba, 0xdb, 0xbc, 0xcb, 0xbb, 0xbc, 0x9b, 0x20, 0x45, 0x44, 0x43, 0x34, 0x32, 0x12, + 0x00, 0x90, 0xa9, 0xbc, 0xbc, 0xab, 0xaa, 0xbc, 0xcc, 0xbb, 0xdb, 0xbb, 0xab, 0x18, 0x62, 0x53, + 0x34, 0x35, 0x32, 0x22, 0x11, 0x80, 0x99, 0xbc, 0xbc, 0xba, 0xaa, 0xbb, 0xbe, 0xbb, 0xcc, 0xcb, + 0xbb, 0x89, 0x21, 0x45, 0x63, 0x43, 0x33, 0x32, 0x21, 0x10, 0x98, 0xca, 0xcb, 0xab, 0xaa, 0xca, + 0xcb, 0xcb, 0xcb, 0xbc, 0xac, 0x9a, 0x18, 0x32, 0x46, 0x44, 0x33, 0x23, 0x23, 0x12, 0x80, 0xb9, + 0xcc, 0xaa, 0xaa, 0xbb, 0xcc, 0xcb, 0xcb, 0xbc, 0xbc, 0x9b, 0x09, 0x20, 0x45, 0x54, 0x33, 0x33, + 0x33, 0x22, 0x02, 0xa9, 0xcc, 0xba, 0xaa, 0xca, 0xbb, 0xcb, 0xbc, 0xcd, 0xcb, 0xaa, 0x98, 0x00, + 0x52, 0x54, 0x33, 0x34, 0x32, 0x32, 0x11, 0x90, 0xca, 0xbb, 0xba, 0xcb, 0xac, 0xba, 0xdb, 0xcc, + 0xac, 0xab, 0x9a, 0x89, 0x41, 0x45, 0x34, 0x34, 0x32, 0x33, 0x22, 0x80, 0xba, 0xac, 0xbb, 0xbb, + 0xad, 0xba, 0xdb, 0xcc, 0xbc, 0xac, 0x9a, 0x9a, 0x28, 0x44, 0x35, 0x34, 0x43, 0x32, 0x23, 0x01, + 0xa9, 0xaa, 0xbb, 0xdb, 0xba, 0xba, 0xcb, 0xcd, 0xcc, 0xba, 0xab, 0xab, 0x09, 0x52, 0x54, 0x33, + 0x34, 0x34, 0x32, 0x02, 0x88, 0xa9, 0xaa, 0xbb, 0xbc, 0xaa, 0xda, 0xcc, 0xcc, 0xbb, 0xbb, 0xac, + 0x8a, 0x30, 0x45, 0x34, 0x34, 0x34, 0x24, 0x02, 0x81, 0x98, 0x99, 0xaa, 0xbb, 0xaa, 0xba, 0xce, + 0xcc, 0xcb, 0xbb, 0xbb, 0xab, 0x18, 0x54, 0x34, 0x34, 0x44, 0x33, 0x22, 0x01, 0x88, 0xa8, 0xb9, + 0xac, 0x9a, 0xb9, 0xdc, 0xbc, 0xbc, 0xbc, 0xac, 0xbb, 0x09, 0x41, 0x34, 0x44, 0x53, 0x33, 0x33, + 0x12, 0x00, 0x98, 0xb9, 0xac, 0x9a, 0xaa, 0xcc, 0xcc, 0xbc, 0xcb, 0xbc, 0xbb, 0x8a, 0x10, 0x53, + 0x53, 0x34, 0x35, 0x32, 0x12, 0x01, 0x80, 0xa9, 0xba, 0xaa, 0xa9, 0xcc, 0xcc, 0xbc, 0xdb, 0xcb, + 0xbb, 0xaa, 0x00, 0x31, 0x54, 0x44, 0x43, 0x33, 0x32, 0x21, 0x00, 0x99, 0xbb, 0xaa, 0xa9, 0xdb, + 0xcc, 0xbc, 0xcb, 0xcc, 0xcb, 0x9a, 0x09, 0x10, 0x41, 0x44, 0x44, 0x23, 0x23, 0x23, 0x01, 0x90, + 0xaa, 0xaa, 0x99, 0xbb, 0xce, 0xbb, 0xbd, 0xbd, 0xad, 0xab, 0x99, 0x08, 0x31, 0x54, 0x44, 0x33, + 0x24, 0x22, 0x12, 0x80, 0x99, 0x9a, 0x98, 0xba, 0xcc, 0xcb, 0xcb, 0xcd, 0xcb, 0xab, 0x9a, 0x89, + 0x18, 0x44, 0x44, 0x34, 0x33, 0x43, 0x12, 0x81, 0x98, 0x99, 0x98, 0xaa, 0xcc, 0xba, 0xcc, 0xcc, + 0xdb, 0xba, 0xaa, 0x99, 0x09, 0x42, 0x35, 0x35, 0x34, 0x33, 0x32, 0x01, 0x90, 0x99, 0x98, 0xba, + 0xbc, 0xbc, 0xdb, 0xcc, 0xcc, 0xbb, 0xab, 0xba, 0x89, 0x31, 0x55, 0x34, 0x44, 0x32, 0x23, 0x12, + 0x80, 0x98, 0x98, 0xa9, 0xcb, 0xbb, 0xdb, 0xcc, 0xcc, 0xac, 0xba, 0xaa, 0x9a, 0x10, 0x44, 0x44, + 0x43, 0x34, 0x32, 0x12, 0x00, 0x88, 0x98, 0xa9, 0xbb, 0xac, 0xbb, 0xdd, 0xbc, 0xcc, 0xba, 0xba, + 0xaa, 0x09, 0x52, 0x34, 0x45, 0x33, 0x34, 0x22, 0x10, 0x88, 0x90, 0x99, 0xbb, 0xbb, 0xba, 0xdd, + 0xcc, 0xcb, 0xcb, 0xba, 0xba, 0x89, 0x30, 0x54, 0x34, 0x35, 0x34, 0x22, 0x01, 0x81, 0x80, 0x99, + 0xba, 0xab, 0xaa, 0xcc, 0xcd, 0xcb, 0xac, 0xbb, 0xac, 0x9a, 0x10, 0x42, 0x54, 0x43, 0x34, 0x23, + 0x12, 0x00, 0x00, 0x99, 0xaa, 0xbb, 0xaa, 0xdb, 0xcd, 0xcb, 0xbc, 0xcb, 0xbb, 0x9b, 0x09, 0x31, + 0x55, 0x34, 0x35, 0x33, 0x12, 0x02, 0x01, 0x98, 0xaa, 0xab, 0xab, 0xda, 0xcc, 0xbc, 0xbc, 0xcc, + 0xbb, 0xab, 0x89, 0x10, 0x53, 0x45, 0x44, 0x32, 0x12, 0x12, 0x01, 0x80, 0xaa, 0x9a, 0xaa, 0xb9, + 0xcd, 0xbc, 0xbc, 0xcc, 0xcb, 0xba, 0x99, 0x88, 0x31, 0x46, 0x44, 0x23, 0x33, 0x22, 0x11, 0x81, + 0xa8, 0xba, 0x99, 0xba, 0xcd, 0xbc, 0xcc, 0xcb, 0xbc, 0xbb, 0xaa, 0x89, 0x28, 0x64, 0x44, 0x33, + 0x24, 0x22, 0x12, 0x01, 0x98, 0x9a, 0x9a, 0xb9, 0xdb, 0xdb, 0xbb, 0xcd, 0xbc, 0xbb, 0xbb, 0x9a, + 0x09, 0x62, 0x45, 0x43, 0x23, 0x33, 0x23, 0x02, 0x90, 0xa9, 0x99, 0xb9, 0xdb, 0xcb, 0xbc, 0xbd, + 0xbd, 0xbc, 0xba, 0xaa, 0x8a, 0x31, 0x56, 0x43, 0x33, 0x43, 0x23, 0x12, 0x80, 0x89, 0x99, 0xa9, + 0xbb, 0xbc, 0xcc, 0xcc, 0xcc, 0xbb, 0xbb, 0xbb, 0xab, 0x28, 0x55, 0x44, 0x33, 0x34, 0x42, 0x21, + 0x00, 0x88, 0x89, 0x99, 0xaa, 0xbb, 0xbc, 0xcd, 0xcc, 0xbb, 0xcb, 0xbb, 0xab, 0x09, 0x53, 0x35, + 0x35, 0x33, 0x34, 0x23, 0x11, 0x08, 0x98, 0x99, 0xaa, 0xbb, 0xdb, 0xdc, 0xbc, 0xad, 0xbb, 0xcb, + 0xbb, 0x99, 0x31, 0x45, 0x34, 0x34, 0x34, 0x23, 0x02, 0x01, 0x88, 0x99, 0xaa, 0xaa, 0xba, 0xcd, + 0xcd, 0xcb, 0xbb, 0xbc, 0xcb, 0x9a, 0x18, 0x42, 0x35, 0x34, 0x35, 0x32, 0x12, 0x11, 0x08, 0x98, + 0x9a, 0x9a, 0xa9, 0xcc, 0xcd, 0xac, 0xcb, 0xbb, 0xcc, 0x9a, 0x09, 0x21, 0x34, 0x45, 0x24, 0x33, + 0x23, 0x21, 0x00, 0x98, 0x99, 0x9a, 0xa8, 0xda, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbb, 0x8a, 0x10, + 0x53, 0x44, 0x44, 0x32, 0x23, 0x22, 0x01, 0x80, 0x99, 0x99, 0x98, 0xc9, 0xdc, 0xcb, 0xcb, 0xcb, + 0xbc, 0xac, 0x9a, 0x88, 0x31, 0x44, 0x35, 0x34, 0x23, 0x23, 0x12, 0x00, 0x99, 0x89, 0x98, 0xb9, + 0xcd, 0xbc, 0xbd, 0xdb, 0xcb, 0xac, 0x9a, 0x89, 0x28, 0x52, 0x44, 0x43, 0x23, 0x33, 0x12, 0x01, + 0x98, 0x98, 0x88, 0xa8, 0xdb, 0xcc, 0xbb, 0xcd, 0xdb, 0xbb, 0xab, 0x9a, 0x19, 0x41, 0x45, 0x34, + 0x34, 0x32, 0x13, 0x02, 0x80, 0x98, 0x88, 0x98, 0xcb, 0xbc, 0xcc, 0xcb, 0xbd, 0xbc, 0xcb, 0xa9, + 0x89, 0x21, 0x63, 0x34, 0x34, 0x24, 0x23, 0x11, 0x80, 0x88, 0x88, 0x98, 0xaa, 0xbc, 0xbc, 0xcc, + 0xbd, 0xcc, 0xba, 0xab, 0xa9, 0x18, 0x52, 0x44, 0x34, 0x43, 0x23, 0x22, 0x00, 0x88, 0x08, 0x98, + 0xb9, 0xcb, 0xbb, 0xcd, 0xcc, 0xcc, 0xba, 0xab, 0xab, 0x89, 0x32, 0x46, 0x53, 0x33, 0x24, 0x13, + 0x01, 0x80, 0x08, 0x98, 0xa9, 0xbb, 0xbb, 0xdc, 0xcc, 0xcc, 0xbb, 0xbc, 0xba, 0x8a, 0x28, 0x63, + 0x34, 0x35, 0x43, 0x22, 0x01, 0x00, 0x00, 0x88, 0x99, 0xaa, 0xab, 0xcb, 0xce, 0xdb, 0xcb, 0xbb, + 0xac, 0x9a, 0x09, 0x32, 0x45, 0x44, 0x43, 0x22, 0x12, 0x00, 0x80, 0x80, 0x99, 0xaa, 0xa9, 0xb9, + 0xdd, 0xbc, 0xbd, 0xcb, 0xac, 0x9b, 0x8a, 0x10, 0x44, 0x44, 0x43, 0x33, 0x22, 0x11, 0x00, 0x00, + 0x99, 0x9a, 0xaa, 0xb9, 0xdd, 0xdb, 0xdb, 0xbb, 0xbc, 0xac, 0x9a, 0x18, 0x41, 0x44, 0x44, 0x32, + 0x22, 0x12, 0x10, 0x80, 0x88, 0x9a, 0x9a, 0xa9, 0xdb, 0xbd, 0xcc, 0xbc, 0xcc, 0xba, 0xaa, 0x88, + 0x20, 0x54, 0x44, 0x33, 0x33, 0x22, 0x12, 0x10, 0x98, 0x9a, 0x99, 0xa9, 0xcb, 0xdc, 0xbc, 0xcd, + 0xbb, 0xbc, 0xbb, 0x9a, 0x00, 0x63, 0x54, 0x33, 0x43, 0x21, 0x21, 0x10, 0x80, 0x89, 0x89, 0x89, + 0x9a, 0xdb, 0xdc, 0xcb, 0xcc, 0xbb, 0xcb, 0x9a, 0x89, 0x31, 0x45, 0x35, 0x33, 0x23, 0x23, 0x12, + 0x00, 0x88, 0x99, 0x98, 0x99, 0xdb, 0xcc, 0xcc, 0xcc, 0xcb, 0xbb, 0xab, 0x9b, 0x28, 0x73, 0x44, + 0x32, 0x33, 0x32, 0x22, 0x01, 0x08, 0x98, 0x88, 0x99, 0xbb, 0xcd, 0xcc, 0xdc, 0xcb, 0xbb, 0xbb, + 0xbb, 0x09, 0x62, 0x44, 0x43, 0x33, 0x32, 0x22, 0x02, 0x00, 0x88, 0x89, 0x98, 0xab, 0xbc, 0xdd, + 0xcc, 0xbc, 0xac, 0xcb, 0xaa, 0x99, 0x21, 0x45, 0x43, 0x33, 0x34, 0x22, 0x11, 0x00, 0x88, 0x90, + 0x98, 0x9a, 0xba, 0xdc, 0xdc, 0xbc, 0xbc, 0xcb, 0xab, 0x9b, 0x18, 0x44, 0x34, 0x25, 0x33, 0x33, + 0x22, 0x01, 0x08, 0x88, 0x98, 0xaa, 0xa9, 0xcc, 0xdd, 0xbc, 0xcc, 0xca, 0xba, 0xab, 0x09, 0x32, + 0x45, 0x53, 0x32, 0x33, 0x23, 0x11, 0x00, 0x00, 0x98, 0x99, 0x9a, 0xca, 0xce, 0xbc, 0xbd, 0xdb, + 0xbb, 0xac, 0x89, 0x20, 0x43, 0x44, 0x43, 0x33, 0x23, 0x21, 0x11, 0x80, 0x88, 0x99, 0x9a, 0xa9, + 0xdd, 0xcc, 0xbc, 0xbc, 0xcc, 0xab, 0x9a, 0x18, 0x42, 0x53, 0x53, 0x32, 0x23, 0x22, 0x11, 0x01, + 0x88, 0x98, 0x89, 0x90, 0xcc, 0xcd, 0xcb, 0xbc, 0xbd, 0xac, 0x9b, 0x09, 0x21, 0x53, 0x34, 0x44, + 0x22, 0x22, 0x12, 0x01, 0x00, 0x88, 0x08, 0x88, 0xca, 0xbd, 0xcc, 0xbc, 0xcd, 0xbb, 0xab, 0x9a, + 0x10, 0x43, 0x45, 0x33, 0x34, 0x23, 0x22, 0x12, 0x81, 0x88, 0x08, 0x88, 0xc9, 0xcc, 0xdb, 0xdb, + 0xcc, 0xcb, 0xba, 0x9a, 0x08, 0x32, 0x54, 0x43, 0x43, 0x22, 0x22, 0x12, 0x81, 0x88, 0x80, 0x80, + 0xa9, 0xcb, 0xcc, 0xcc, 0xcc, 0xbc, 0xcb, 0x9a, 0x89, 0x20, 0x53, 0x53, 0x43, 0x32, 0x22, 0x23, + 0x01, 0x88, 0x00, 0x80, 0xa8, 0xba, 0xbd, 0xcd, 0xbd, 0xcd, 0xba, 0xbb, 0x9a, 0x08, 0x43, 0x44, + 0x34, 0x33, 0x24, 0x23, 0x01, 0x00, 0x80, 0x00, 0x98, 0xb9, 0xcb, 0xdc, 0xdc, 0xdb, 0xcb, 0xba, + 0xaa, 0x88, 0x20, 0x44, 0x34, 0x43, 0x33, 0x24, 0x11, 0x01, 0x00, 0x00, 0x88, 0xa8, 0xaa, 0xcc, + 0xcd, 0xcc, 0xbc, 0xac, 0xab, 0x99, 0x18, 0x33, 0x45, 0x43, 0x33, 0x24, 0x12, 0x11, 0x00, 0x10, + 0x08, 0x99, 0xa9, 0xca, 0xcd, 0xcd, 0xcc, 0xba, 0xbb, 0x9b, 0x09, 0x32, 0x35, 0x35, 0x44, 0x32, + 0x22, 0x01, 0x01, 0x01, 0x08, 0x89, 0x89, 0xaa, 0xdc, 0xcd, 0xbd, 0xbc, 0xbb, 0xab, 0x8a, 0x21, + 0x34, 0x45, 0x43, 0x43, 0x12, 0x11, 0x01, 0x00, 0x80, 0x88, 0x88, 0x98, 0xb9, 0xcf, 0xcd, 0xbb, + 0xbd, 0xba, 0x99, 0x18, 0x31, 0x54, 0x43, 0x24, 0x23, 0x12, 0x12, 0x10, 0x80, 0x88, 0x88, 0x88, + 0xa8, 0xed, 0xcc, 0xcc, 0xcb, 0xab, 0xaa, 0x88, 0x11, 0x43, 0x54, 0x33, 0x24, 0x22, 0x12, 0x11, + 0x01, 0x81, 0x80, 0x00, 0x90, 0xdc, 0xcd, 0xcc, 0xdb, 0xab, 0xab, 0x89, 0x00, 0x41, 0x53, 0x34, + 0x24, 0x32, 0x21, 0x11, 0x11, 0x80, 0x88, 0x08, 0x98, 0xda, 0xdc, 0xcc, 0xcc, 0xbb, 0xbb, 0x9a, + 0x89, 0x21, 0x45, 0x34, 0x34, 0x33, 0x22, 0x12, 0x12, 0x80, 0x88, 0x08, 0x98, 0xb9, 0xce, 0xdd, + 0xdb, 0xcb, 0xab, 0x9a, 0x8a, 0x18, 0x43, 0x45, 0x33, 0x43, 0x22, 0x12, 0x12, 0x81, 0x80, 0x80, + 0x80, 0x98, 0xdb, 0xdd, 0xcc, 0xbc, 0xac, 0xaa, 0x9a, 0x09, 0x31, 0x45, 0x43, 0x24, 0x22, 0x32, + 0x21, 0x00, 0x00, 0x08, 0x88, 0x90, 0xa8, 0xdd, 0xcd, 0xbd, 0xcb, 0xaa, 0xab, 0x89, 0x20, 0x63, + 0x34, 0x24, 0x33, 0x32, 0x23, 0x11, 0x00, 0x00, 0x80, 0x98, 0xa8, 0xfb, 0xce, 0xcc, 0xbb, 0xac, + 0xab, 0x9a, 0x08, 0x43, 0x44, 0x34, 0x42, 0x32, 0x22, 0x11, 0x01, 0x80, 0x80, 0x88, 0x88, 0xc9, + 0xde, 0xcc, 0xbb, 0xbc, 0xbb, 0xab, 0x89, 0x41, 0x44, 0x34, 0x43, 0x33, 0x32, 0x12, 0x11, 0x80, + 0x90, 0x98, 0x88, 0xb9, 0xdf, 0xcc, 0xbc, 0xac, 0xbb, 0xbb, 0x99, 0x20, 0x35, 0x35, 0x34, 0x43, + 0x23, 0x12, 0x11, 0x00, 0x90, 0x88, 0x08, 0x90, 0xdc, 0xcd, 0xbc, 0xbc, 0xac, 0xcb, 0x99, 0x08, + 0x31, 0x44, 0x43, 0x43, 0x23, 0x13, 0x12, 0x11, 0x88, 0x88, 0x00, 0x81, 0xc9, 0xce, 0xbd, 0xbd, + 0xbb, 0xad, 0x9b, 0x89, 0x20, 0x53, 0x43, 0x34, 0x43, 0x22, 0x21, 0x11, 0x80, 0x88, 0x08, 0x01, + 0x98, 0xec, 0xcc, 0xbc, 0xbc, 0xad, 0xab, 0x99, 0x00, 0x42, 0x43, 0x44, 0x23, 0x23, 0x23, 0x12, + 0x00, 0x88, 0x80, 0x10, 0x90, 0xfb, 0xbd, 0xbd, 0xcc, 0xbb, 0xbc, 0xa9, 0x08, 0x31, 0x63, 0x53, + 0x32, 0x23, 0x33, 0x22, 0x01, 0x90, 0x88, 0x10, 0x01, 0xd9, 0xcd, 0xbc, 0xcd, 0xcb, 0xac, 0xaa, + 0x89, 0x10, 0x43, 0x34, 0x34, 0x43, 0x23, 0x22, 0x02, 0x80, 0x08, 0x00, 0x01, 0xb9, 0xcd, 0xcd, + 0xdb, 0xcb, 0xbc, 0xaa, 0x9a, 0x18, 0x41, 0x34, 0x34, 0x34, 0x33, 0x23, 0x13, 0x80, 0x08, 0x00, + 0x01, 0xa0, 0xcc, 0xcd, 0xbc, 0xbe, 0xbc, 0xbb, 0xab, 0x89, 0x31, 0x54, 0x43, 0x43, 0x33, 0x33, + 0x22, 0x80, 0x80, 0x08, 0x00, 0x80, 0xcb, 0xcc, 0xdc, 0xbd, 0xbc, 0xac, 0xab, 0x8a, 0x10, 0x43, + 0x34, 0x35, 0x43, 0x23, 0x13, 0x11, 0x08, 0x08, 0x00, 0x90, 0xb9, 0xcb, 0xdd, 0xcd, 0xcb, 0xbb, + 0xac, 0x9a, 0x08, 0x32, 0x44, 0x34, 0x43, 0x24, 0x22, 0x11, 0x80, 0x80, 0x00, 0x90, 0x99, 0xa9, + 0xdc, 0xcd, 0xbc, 0xbc, 0xac, 0x9b, 0x09, 0x21, 0x43, 0x44, 0x43, 0x24, 0x23, 0x11, 0x80, 0x00, + 0x00, 0x98, 0x98, 0x98, 0xfb, 0xdb, 0xbc, 0xbd, 0xbc, 0xab, 0x99, 0x10, 0x42, 0x53, 0x43, 0x34, + 0x23, 0x22, 0x00, 0x00, 0x00, 0x98, 0x88, 0x98, 0xda, 0xdc, 0xeb, 0xdb, 0xbb, 0xac, 0x9a, 0x08, + 0x21, 0x34, 0x44, 0x43, 0x24, 0x12, 0x01, 0x10, 0x00, 0x88, 0x88, 0x98, 0xaa, 0xcd, 0xcc, 0xcc, + 0xcb, 0xbb, 0xab, 0x09, 0x20, 0x43, 0x44, 0x44, 0x33, 0x23, 0x11, 0x01, 0x00, 0x88, 0x08, 0x88, + 0x99, 0xdb, 0xcd, 0xcc, 0xbd, 0xcb, 0xab, 0x89, 0x18, 0x21, 0x34, 0x36, 0x34, 0x33, 0x12, 0x12, + 0x00, 0x88, 0x88, 0x80, 0x99, 0xba, 0xdd, 0xdc, 0xcc, 0xac, 0xbb, 0x9a, 0x88, 0x11, 0x42, 0x45, + 0x43, 0x23, 0x23, 0x12, 0x00, 0x80, 0x88, 0x88, 0x88, 0x99, 0xca, 0xed, 0xcc, 0xcc, 0xab, 0x9b, + 0x99, 0x08, 0x21, 0x45, 0x34, 0x33, 0x24, 0x12, 0x01, 0x00, 0x88, 0x88, 0x08, 0x98, 0x98, 0xec, + 0xcd, 0xcc, 0xbc, 0xaa, 0x99, 0x89, 0x10, 0x53, 0x34, 0x34, 0x33, 0x23, 0x12, 0x11, 0x00, 0x18, + 0x08, 0x00, 0x81, 0xda, 0xde, 0xcd, 0xbc, 0xab, 0xaa, 0xaa, 0x08, 0x42, 0x35, 0x34, 0x34, 0x32, + 0x12, 0x11, 0x10, 0x00, 0x10, 0x10, 0x10, 0xa8, 0xfd, 0xcd, 0xbc, 0xbb, 0xbb, 0xab, 0x99, 0x41, + 0x44, 0x53, 0x33, 0x43, 0x22, 0x01, 0x01, 0x01, 0x08, 0x01, 0x11, 0x11, 0xe9, 0xde, 0xbc, 0xcb, + 0xba, 0xab, 0x9a, 0x10, 0x43, 0x35, 0x35, 0x33, 0x33, 0x21, 0x11, 0x00, 0x00, 0x08, 0x18, 0x22, + 0xc0, 0xef, 0xcc, 0xbb, 0xcb, 0xba, 0x9a, 0x09, 0x31, 0x44, 0x44, 0x33, 0x24, 0x21, 0x11, 0x01, + 0x80, 0x88, 0x18, 0x22, 0x02, 0xed, 0xbd, 0xbd, 0xcb, 0xbb, 0xba, 0x89, 0x10, 0x43, 0x45, 0x33, + 0x24, 0x22, 0x11, 0x11, 0x00, 0x88, 0x08, 0x53, 0x12, 0xc9, 0xdd, 0xdb, 0xcb, 0xbb, 0xbb, 0x9a, + 0x88, 0x22, 0x55, 0x43, 0x32, 0x32, 0x22, 0x12, 0x02, 0x80, 0x20, 0x63, 0x32, 0x90, 0xdc, 0xcc, + 0xcc, 0xbb, 0xbc, 0xaa, 0x99, 0x18, 0x43, 0x35, 0x24, 0x33, 0x22, 0x32, 0x11, 0x80, 0x10, 0x44, + 0x33, 0x01, 0xea, 0xdb, 0xcc, 0xbc, 0xbb, 0xbb, 0xab, 0x0a, 0x41, 0x44, 0x34, 0x33, 0x33, 0x24, + 0x12, 0x00, 0x00, 0x42, 0x34, 0x12, 0xa9, 0xcd, 0xcd, 0xcb, 0xac, 0xab, 0xab, 0x8a, 0x20, 0x53, + 0x34, 0x43, 0x32, 0x33, 0x22, 0x80, 0x08, 0x42, 0x44, 0x12, 0x81, 0xca, 0xcd, 0xbd, 0xcb, 0xbb, + 0xbb, 0xab, 0x08, 0x52, 0x53, 0x32, 0x24, 0x33, 0x23, 0x01, 0x80, 0x31, 0x44, 0x33, 0x11, 0xb8, + 0xce, 0xbd, 0xcc, 0xbb, 0xac, 0xab, 0x89, 0x20, 0x34, 0x34, 0x43, 0x34, 0x32, 0x01, 0x00, 0x21, + 0x34, 0x34, 0x23, 0x81, 0xeb, 0xcc, 0xcc, 0xbb, 0xbc, 0xbb, 0x9a, 0x18, 0x43, 0x43, 0x43, 0x34, + 0x23, 0x12, 0x00, 0x30, 0x43, 0x43, 0x33, 0x12, 0xb9, 0xce, 0xbd, 0xcc, 0xcb, 0xbb, 0x9b, 0x89, + 0x21, 0x42, 0x43, 0x44, 0x23, 0x02, 0x01, 0x11, 0x42, 0x43, 0x33, 0x13, 0x90, 0xfb, 0xbc, 0xcc, + 0xbc, 0xcb, 0xab, 0x89, 0x18, 0x21, 0x43, 0x44, 0x33, 0x13, 0x11, 0x11, 0x32, 0x44, 0x34, 0x32, + 0x01, 0xb9, 0xce, 0xdb, 0xcc, 0xbb, 0xbb, 0xab, 0x88, 0x10, 0x42, 0x35, 0x25, 0x22, 0x11, 0x11, + 0x32, 0x53, 0x43, 0x33, 0x22, 0x98, 0xcc, 0xcc, 0xcc, 0xcb, 0xbb, 0xaa, 0x99, 0x88, 0x21, 0x44, + 0x34, 0x32, 0x22, 0x21, 0x32, 0x44, 0x53, 0x33, 0x22, 0x91, 0xc9, 0xcc, 0xdc, 0xcb, 0xac, 0xaa, + 0x99, 0x89, 0x18, 0x42, 0x53, 0x32, 0x22, 0x22, 0x32, 0x53, 0x34, 0x34, 0x32, 0x11, 0x98, 0xcb, + 0xdd, 0xcc, 0xbb, 0xac, 0xa9, 0xa9, 0x08, 0x31, 0x34, 0x34, 0x33, 0x33, 0x33, 0x44, 0x53, 0x33, + 0x33, 0x22, 0x80, 0xca, 0xcd, 0xcd, 0xcb, 0xab, 0xab, 0xaa, 0x89, 0x20, 0x34, 0x25, 0x33, 0x23, + 0x43, 0x33, 0x44, 0x34, 0x32, 0x12, 0x01, 0x99, 0xfb, 0xcc, 0xbc, 0xac, 0xab, 0xab, 0x9a, 0x00, + 0x42, 0x43, 0x33, 0x24, 0x33, 0x43, 0x53, 0x33, 0x34, 0x13, 0x02, 0x80, 0xca, 0xce, 0xcc, 0xbb, + 0xbb, 0xbb, 0xab, 0x89, 0x31, 0x44, 0x43, 0x23, 0x33, 0x33, 0x45, 0x33, 0x35, 0x22, 0x12, 0x12, + 0xb8, 0xed, 0xdb, 0xbb, 0xbc, 0xbb, 0xba, 0x99, 0x10, 0x32, 0x35, 0x43, 0x32, 0x24, 0x43, 0x34, + 0x24, 0x23, 0x23, 0x22, 0x91, 0xfb, 0xcc, 0xcb, 0xcb, 0xbb, 0xab, 0xaa, 0x88, 0x21, 0x43, 0x43, + 0x33, 0x34, 0x34, 0x44, 0x43, 0x32, 0x22, 0x13, 0x82, 0xc9, 0xcd, 0xcc, 0xbb, 0xbc, 0xbb, 0xab, + 0x8a, 0x00, 0x42, 0x33, 0x35, 0x32, 0x34, 0x44, 0x24, 0x23, 0x32, 0x23, 0x02, 0xb8, 0xdd, 0xcc, + 0xcb, 0xbb, 0xbc, 0xaa, 0x8a, 0x08, 0x21, 0x43, 0x24, 0x33, 0x43, 0x44, 0x43, 0x32, 0x32, 0x23, + 0x13, 0x90, 0xdc, 0xcc, 0xdb, 0xbb, 0xbc, 0xba, 0x9a, 0x88, 0x10, 0x33, 0x35, 0x32, 0x43, 0x34, + 0x35, 0x32, 0x33, 0x34, 0x23, 0x81, 0xc9, 0xdc, 0xdb, 0xcb, 0xcb, 0xba, 0xaa, 0x8a, 0x08, 0x31, + 0x34, 0x32, 0x53, 0x53, 0x33, 0x34, 0x33, 0x34, 0x33, 0x02, 0x99, 0xcc, 0xcd, 0xcb, 0xcb, 0xbb, + 0xbb, 0xaa, 0x89, 0x21, 0x43, 0x32, 0x34, 0x35, 0x34, 0x34, 0x33, 0x34, 0x24, 0x12, 0x80, 0xc9, + 0xeb, 0xcb, 0xbc, 0xbb, 0xac, 0xab, 0x8a, 0x18, 0x22, 0x33, 0x44, 0x53, 0x43, 0x33, 0x34, 0x43, + 0x23, 0x13, 0x01, 0xa8, 0xbd, 0xcd, 0xbc, 0xbc, 0xba, 0xac, 0x99, 0x08, 0x11, 0x32, 0x33, 0x45, + 0x34, 0x33, 0x43, 0x34, 0x33, 0x33, 0x02, 0xa0, 0xdb, 0xcd, 0xdb, 0xbb, 0xbc, 0xbb, 0xaa, 0x89, + 0x11, 0x22, 0x43, 0x44, 0x43, 0x33, 0x34, 0x34, 0x33, 0x24, 0x12, 0x00, 0xa9, 0xdc, 0xcc, 0xcb, + 0xbb, 0xbc, 0xbb, 0x99, 0x08, 0x11, 0x22, 0x54, 0x43, 0x33, 0x34, 0x34, 0x34, 0x23, 0x23, 0x11, + 0x98, 0xeb, 0xcc, 0xcb, 0xcb, 0xac, 0xab, 0x9b, 0x89, 0x00, 0x20, 0x43, 0x34, 0x34, 0x34, 0x34, + 0x34, 0x43, 0x22, 0x21, 0x80, 0xb9, 0xdc, 0xbc, 0xbc, 0xbd, 0xbb, 0xba, 0x99, 0x88, 0x18, 0x33, + 0x45, 0x43, 0x43, 0x43, 0x43, 0x32, 0x23, 0x22, 0x02, 0xa9, 0xdc, 0xdb, 0xcb, 0xbc, 0xac, 0xab, + 0x9a, 0x89, 0x08, 0x21, 0x43, 0x34, 0x34, 0x44, 0x43, 0x33, 0x32, 0x33, 0x12, 0x90, 0xcb, 0xcd, + 0xdb, 0xdb, 0xbb, 0xbb, 0xab, 0x9a, 0x89, 0x20, 0x42, 0x44, 0x43, 0x53, 0x33, 0x34, 0x32, 0x33, + 0x13, 0x81, 0xc9, 0xdb, 0xdb, 0xcc, 0xcb, 0xab, 0xab, 0xaa, 0x89, 0x08, 0x22, 0x34, 0x44, 0x34, + 0x34, 0x34, 0x42, 0x22, 0x22, 0x02, 0xa8, 0xb9, 0xdc, 0xcc, 0xbc, 0xbb, 0xac, 0xab, 0xa9, 0x88, + 0x10, 0x32, 0x44, 0x44, 0x24, 0x24, 0x24, 0x32, 0x32, 0x11, 0x80, 0x98, 0xdb, 0xcc, 0xcc, 0xbb, + 0xac, 0xab, 0xaa, 0x8a, 0x08, 0x21, 0x53, 0x44, 0x43, 0x34, 0x33, 0x34, 0x33, 0x12, 0x01, 0x90, + 0xca, 0xdc, 0xdb, 0xac, 0xbb, 0xcb, 0xaa, 0x99, 0x89, 0x00, 0x32, 0x45, 0x53, 0x43, 0x33, 0x34, + 0x33, 0x13, 0x12, 0x80, 0xa9, 0xdc, 0xcc, 0xbc, 0xcb, 0xba, 0xbb, 0x9b, 0x9a, 0x08, 0x21, 0x44, + 0x35, 0x25, 0x24, 0x24, 0x33, 0x22, 0x12, 0x10, 0x98, 0xca, 0xcd, 0xcb, 0xbc, 0xcb, 0xab, 0xaa, + 0xaa, 0x98, 0x10, 0x42, 0x54, 0x33, 0x44, 0x43, 0x33, 0x32, 0x12, 0x02, 0x00, 0xb9, 0xce, 0xcb, + 0xbc, 0xad, 0xab, 0xab, 0xaa, 0x99, 0x09, 0x31, 0x54, 0x43, 0x34, 0x44, 0x23, 0x33, 0x12, 0x12, + 0x01, 0xa8, 0xeb, 0xdb, 0xdb, 0xbb, 0xbc, 0xbb, 0xaa, 0x9b, 0x8a, 0x28, 0x53, 0x34, 0x45, 0x33, + 0x35, 0x32, 0x23, 0x12, 0x02, 0x90, 0xba, 0xdd, 0xdb, 0xbb, 0xeb, 0xab, 0xaa, 0xaa, 0x99, 0x08, + 0x31, 0x44, 0x34, 0x35, 0x44, 0x32, 0x22, 0x22, 0x11, 0x81, 0xa9, 0xdb, 0xcc, 0xbc, 0xcc, 0xaa, + 0xab, 0xba, 0x9a, 0x89, 0x21, 0x43, 0x35, 0x35, 0x35, 0x33, 0x33, 0x33, 0x22, 0x11, 0x98, 0xbc, + 0xbe, 0xbd, 0xad, 0xbb, 0xbb, 0xac, 0xaa, 0x89, 0x18, 0x33, 0x35, 0x45, 0x34, 0x24, 0x23, 0x23, + 0x23, 0x11, 0x91, 0xb9, 0xdc, 0xcc, 0xdb, 0xba, 0xbb, 0xcb, 0xaa, 0x9a, 0x08, 0x11, 0x43, 0x45, + 0x34, 0x34, 0x33, 0x33, 0x33, 0x23, 0x00, 0x98, 0xdb, 0xdd, 0xcb, 0xbb, 0xbc, 0xbb, 0xbb, 0xab, + 0x89, 0x10, 0x42, 0x45, 0x44, 0x43, 0x33, 0x33, 0x33, 0x23, 0x11, 0x80, 0xba, 0xcf, 0xbc, 0xbc, + 0xcb, 0xab, 0xac, 0xaa, 0x99, 0x08, 0x20, 0x53, 0x35, 0x44, 0x33, 0x33, 0x24, 0x23, 0x11, 0x01, + 0x98, 0xcc, 0xcc, 0xcb, 0xcb, 0xbb, 0xcb, 0xaa, 0x9a, 0x89, 0x18, 0x43, 0x45, 0x53, 0x33, 0x43, + 0x33, 0x32, 0x22, 0x11, 0x80, 0xda, 0xcc, 0xdb, 0xbb, 0xdb, 0xba, 0xab, 0xaa, 0x99, 0x88, 0x22, + 0x46, 0x53, 0x33, 0x34, 0x24, 0x23, 0x22, 0x21, 0x81, 0xb8, 0xdc, 0xbc, 0xbc, 0xbc, 0xbc, 0xaa, + 0xab, 0x99, 0x89, 0x28, 0x54, 0x34, 0x34, 0x44, 0x32, 0x32, 0x22, 0x22, 0x01, 0x98, 0xcc, 0xcc, + 0xcb, 0xdb, 0xba, 0xab, 0xab, 0xaa, 0x9a, 0x08, 0x53, 0x44, 0x34, 0x34, 0x43, 0x32, 0x23, 0x32, + 0x12, 0x91, 0xcb, 0xbd, 0xbd, 0xcc, 0xbb, 0xcb, 0xaa, 0x9a, 0xaa, 0x88, 0x32, 0x54, 0x53, 0x43, + 0x43, 0x32, 0x32, 0x32, 0x22, 0x82, 0xb9, 0xeb, 0xcc, 0xcb, 0xbc, 0xbb, 0xab, 0xbb, 0xbb, 0x99, + 0x11, 0x44, 0x35, 0x35, 0x34, 0x43, 0x32, 0x32, 0x33, 0x12, 0x88, 0xda, 0xdb, 0xcc, 0xcb, 0xbb, + 0xba, 0xcb, 0xaa, 0x9a, 0x08, 0x31, 0x35, 0x36, 0x53, 0x23, 0x33, 0x34, 0x32, 0x12, 0x81, 0xa9, + 0xcc, 0xcc, 0xcc, 0xab, 0xbb, 0xcb, 0xaa, 0xaa, 0x89, 0x11, 0x53, 0x44, 0x53, 0x33, 0x42, 0x23, + 0x24, 0x12, 0x01, 0x98, 0xba, 0xcd, 0xbd, 0xcb, 0xab, 0xac, 0xba, 0xaa, 0x99, 0x00, 0x41, 0x63, + 0x34, 0x33, 0x34, 0x24, 0x43, 0x22, 0x01, 0x80, 0xa8, 0xeb, 0xbc, 0xbc, 0xbc, 0xba, 0xcb, 0xaa, + 0x9a, 0x88, 0x21, 0x44, 0x35, 0x34, 0x33, 0x25, 0x33, 0x33, 0x22, 0x01, 0x98, 0xeb, 0xcc, 0xcb, + 0xbb, 0xbc, 0xbb, 0xbb, 0xab, 0x99, 0x18, 0x63, 0x44, 0x43, 0x33, 0x34, 0x34, 0x33, 0x13, 0x12, + 0x81, 0xca, 0xdc, 0xdb, 0xbb, 0xcb, 0xbb, 0xac, 0x9a, 0xa9, 0x08, 0x32, 0x45, 0x34, 0x43, 0x43, + 0x33, 0x24, 0x22, 0x12, 0x81, 0xb8, 0xcc, 0xbd, 0xbc, 0xcb, 0xcb, 0xaa, 0xab, 0xaa, 0x89, 0x20, + 0x44, 0x34, 0x34, 0x34, 0x44, 0x32, 0x22, 0x22, 0x02, 0x90, 0xcb, 0xcd, 0xcb, 0xbb, 0xad, 0xab, + 0xaa, 0xab, 0x99, 0x10, 0x44, 0x34, 0x53, 0x33, 0x35, 0x33, 0x33, 0x33, 0x22, 0x81, 0xda, 0xcc, + 0xdb, 0xbb, 0xbc, 0xbb, 0xcb, 0xaa, 0xaa, 0x08, 0x32, 0x45, 0x33, 0x45, 0x33, 0x34, 0x33, 0x33, + 0x23, 0x01, 0xb8, 0xcd, 0xbc, 0xbd, 0xbc, 0xbb, 0xbb, 0xac, 0xaa, 0x0a, 0x21, 0x34, 0x44, 0x34, + 0x34, 0x34, 0x33, 0x24, 0x22, 0x12, 0x98, 0xca, 0xcc, 0xcc, 0xbb, 0xcb, 0xab, 0xcb, 0xaa, 0x9a, + 0x00, 0x22, 0x44, 0x53, 0x43, 0x24, 0x24, 0x22, 0x23, 0x22, 0x00, 0xa9, 0xcc, 0xcc, 0xcb, 0xac, + 0xbb, 0xbb, 0xcb, 0x9a, 0x08, 0x20, 0x53, 0x43, 0x44, 0x33, 0x34, 0x43, 0x23, 0x23, 0x11, 0x90, + 0xda, 0xdb, 0xdb, 0xbb, 0xbb, 0xbc, 0xac, 0x9b, 0x89, 0x18, 0x32, 0x44, 0x34, 0x35, 0x43, 0x33, + 0x24, 0x23, 0x12, 0x81, 0xb9, 0xdc, 0xbc, 0xbc, 0xac, 0xcb, 0xab, 0xab, 0x9a, 0x18, 0x11, 0x43, + 0x45, 0x43, 0x33, 0x35, 0x32, 0x24, 0x22, 0x01, 0x88, 0xcb, 0xbd, 0xbc, 0xbc, 0xbc, 0xbb, 0xcb, + 0x9a, 0x88, 0x08, 0x31, 0x44, 0x34, 0x35, 0x33, 0x25, 0x33, 0x23, 0x22, 0x00, 0xba, 0xce, 0xbb, + 0xbd, 0xcb, 0xbb, 0xac, 0x9b, 0x99, 0x09, 0x20, 0x53, 0x34, 0x35, 0x43, 0x43, 0x43, 0x22, 0x22, + 0x11, 0xa8, 0xcb, 0xcc, 0xcb, 0xac, 0xac, 0xbb, 0xaa, 0xaa, 0x89, 0x10, 0x32, 0x46, 0x43, 0x43, + 0x43, 0x33, 0x24, 0x23, 0x13, 0x80, 0xba, 0xbd, 0xbd, 0xbc, 0xcc, 0xba, 0xba, 0xaa, 0x99, 0x88, + 0x21, 0x35, 0x35, 0x34, 0x34, 0x24, 0x24, 0x23, 0x23, 0x00, 0xa8, 0xdb, 0xbc, 0xcc, 0xcb, 0xbb, + 0xbb, 0xbb, 0xaa, 0x89, 0x20, 0x63, 0x34, 0x34, 0x35, 0x33, 0x34, 0x24, 0x23, 0x11, 0x98, 0xba, + 0xbd, 0xcd, 0xcb, 0xbb, 0xcb, 0xaa, 0xaa, 0x99, 0x18, 0x32, 0x44, 0x44, 0x33, 0x34, 0x34, 0x43, + 0x23, 0x13, 0x00, 0xa9, 0xbc, 0xcd, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0xab, 0x08, 0x21, 0x44, 0x35, + 0x25, 0x24, 0x43, 0x42, 0x22, 0x22, 0x01, 0x88, 0xba, 0xcd, 0xdb, 0xbb, 0xad, 0xba, 0xab, 0xaa, + 0x99, 0x00, 0x42, 0x34, 0x35, 0x34, 0x53, 0x42, 0x32, 0x23, 0x11, 0x80, 0xa9, 0xcc, 0xcc, 0xac, + 0xac, 0xab, 0xbb, 0xaa, 0x9a, 0x88, 0x31, 0x54, 0x43, 0x43, 0x43, 0x43, 0x24, 0x22, 0x22, 0x10, + 0xa8, 0xba, 0xdd, 0xcb, 0xac, 0xbb, 0xac, 0xab, 0x9a, 0x89, 0x10, 0x42, 0x44, 0x43, 0x33, 0x44, + 0x24, 0x23, 0x23, 0x02, 0x80, 0xa9, 0xcd, 0xbc, 0xbc, 0xbc, 0xbb, 0xac, 0xaa, 0x99, 0x08, 0x32, + 0x44, 0x34, 0x43, 0x34, 0x34, 0x43, 0x22, 0x12, 0x01, 0x98, 0xdb, 0xbc, 0xbd, 0xdb, 0xba, 0xbb, + 0xbb, 0xaa, 0x99, 0x21, 0x35, 0x34, 0x44, 0x43, 0x43, 0x24, 0x23, 0x22, 0x11, 0x90, 0xba, 0xcd, + 0xbc, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0x9a, 0x10, 0x43, 0x34, 0x35, 0x44, 0x33, 0x35, 0x33, 0x32, + 0x23, 0x81, 0xa8, 0xcc, 0xcc, 0xbc, 0xbc, 0xcb, 0xba, 0xba, 0x9a, 0x08, 0x21, 0x34, 0x35, 0x34, + 0x35, 0x43, 0x33, 0x33, 0x33, 0x11, 0x98, 0xdb, 0xcc, 0xbc, 0xbc, 0xbc, 0xba, 0xbb, 0xbb, 0x88, + 0x20, 0x43, 0x44, 0x43, 0x44, 0x33, 0x34, 0x33, 0x33, 0x12, 0x81, 0xaa, 0xcd, 0xcc, 0xcb, 0xbb, + 0xbc, 0xbb, 0xbb, 0x99, 0x08, 0x22, 0x34, 0x45, 0x53, 0x33, 0x34, 0x43, 0x23, 0x22, 0x11, 0x98, + 0xc9, 0xcc, 0xbc, 0xbc, 0xbc, 0xcb, 0xab, 0xaa, 0x88, 0x00, 0x22, 0x44, 0x34, 0x35, 0x43, 0x34, + 0x23, 0x33, 0x21, 0x00, 0xa9, 0xdc, 0xbc, 0xdb, 0xbb, 0xbc, 0xac, 0xaa, 0x8a, 0x88, 0x11, 0x42, + 0x44, 0x43, 0x43, 0x43, 0x33, 0x24, 0x21, 0x01, 0x80, 0xca, 0xbc, 0xcc, 0xcb, 0xcb, 0xbb, 0xac, + 0x99, 0x89, 0x00, 0x22, 0x44, 0x53, 0x33, 0x35, 0x33, 0x24, 0x22, 0x12, 0x00, 0xaa, 0xbd, 0xbd, + 0xdb, 0xcb, 0xcb, 0xaa, 0xaa, 0x99, 0x09, 0x20, 0x53, 0x43, 0x34, 0x44, 0x33, 0x43, 0x22, 0x22, + 0x01, 0xa8, 0xca, 0xcc, 0xdb, 0xcb, 0xcb, 0xba, 0xba, 0x9a, 0x99, 0x10, 0x32, 0x35, 0x35, 0x35, + 0x34, 0x43, 0x22, 0x23, 0x11, 0x80, 0xb9, 0xbd, 0xcc, 0xdb, 0xcb, 0xbb, 0xba, 0xab, 0x8a, 0x09, + 0x21, 0x44, 0x53, 0x34, 0x34, 0x34, 0x32, 0x33, 0x23, 0x01, 0xa9, 0xcb, 0xcc, 0xdc, 0xbb, 0xbc, + 0xbb, 0xac, 0xa9, 0x89, 0x10, 0x31, 0x63, 0x44, 0x33, 0x44, 0x32, 0x33, 0x22, 0x12, 0x88, 0xaa, + 0xdb, 0xcd, 0xcb, 0xbc, 0xbb, 0xbb, 0xbb, 0xaa, 0x08, 0x21, 0x44, 0x45, 0x43, 0x43, 0x43, 0x32, + 0x23, 0x12, 0x00, 0x88, 0xcb, 0xcc, 0xcc, 0xcb, 0xca, 0xaa, 0xab, 0x99, 0x89, 0x08, 0x32, 0x45, + 0x44, 0x33, 0x34, 0x34, 0x32, 0x22, 0x01, 0x80, 0xaa, 0xdc, 0xdb, 0xbc, 0xbb, 0xbc, 0xbb, 0xaa, + 0x9a, 0x09, 0x21, 0x45, 0x34, 0x35, 0x43, 0x24, 0x33, 0x22, 0x11, 0x01, 0xa8, 0xca, 0xcd, 0xdb, + 0xca, 0xab, 0xbb, 0xab, 0xaa, 0x89, 0x00, 0x53, 0x44, 0x34, 0x53, 0x33, 0x24, 0x32, 0x21, 0x01, + 0x80, 0xba, 0xcd, 0xbc, 0xcc, 0xcb, 0xba, 0xba, 0xaa, 0x99, 0x08, 0x31, 0x54, 0x34, 0x53, 0x34, + 0x33, 0x23, 0x23, 0x21, 0x00, 0xb8, 0xcc, 0xbd, 0xcc, 0xbc, 0xbb, 0xbb, 0xab, 0xba, 0x99, 0x11, + 0x44, 0x44, 0x53, 0x43, 0x33, 0x24, 0x22, 0x12, 0x02, 0x88, 0xba, 0xcd, 0xcc, 0xbb, 0xdb, 0x6c, + 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, 0xd0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, + 0xf8, 0x71, 0xff, 0x4f, 0x31, 0x17, 0xb3, 0x7a, 0x06, 0xa9, 0x08, 0xcb, 0x09, 0x14, 0x32, 0xfa, + 0x1a, 0xb0, 0x2a, 0x04, 0xb0, 0xbf, 0x08, 0x08, 0x00, 0x08, 0x00, 0x10, 0x89, 0x52, 0x05, 0x49, + 0x36, 0x13, 0xb9, 0x9a, 0x29, 0x13, 0x17, 0xac, 0x31, 0xc1, 0x2a, 0xa4, 0xbd, 0xae, 0x78, 0x91, + 0x9b, 0x10, 0xa1, 0x21, 0x03, 0x19, 0x82, 0x10, 0x73, 0x83, 0x8b, 0xa8, 0x3a, 0x25, 0x00, 0x98, + 0x99, 0x89, 0xcb, 0x80, 0xff, 0x39, 0x14, 0xea, 0xab, 0x18, 0x42, 0xa2, 0x8f, 0x11, 0x9a, 0x00, + 0x88, 0x30, 0x02, 0xab, 0x31, 0x83, 0x72, 0xa7, 0x8c, 0x80, 0x28, 0x13, 0xcb, 0x39, 0x84, 0x8a, + 0x33, 0xa8, 0xba, 0x88, 0x8a, 0x47, 0x82, 0xbc, 0x31, 0xb0, 0x0a, 0x52, 0x12, 0x99, 0x21, 0x52, + 0x03, 0xed, 0x29, 0x83, 0x0b, 0x25, 0x99, 0x21, 0xa2, 0xdb, 0x0e, 0x35, 0x11, 0x8a, 0xb0, 0x0c, + 0x41, 0xb8, 0x0b, 0x33, 0xfb, 0x8c, 0x11, 0x99, 0x99, 0x10, 0x31, 0x91, 0x89, 0x58, 0x15, 0xa8, + 0x0a, 0x26, 0x80, 0xa8, 0xed, 0xcb, 0x39, 0x33, 0x92, 0xac, 0xca, 0x9b, 0x18, 0x22, 0x04, 0xad, + 0x19, 0xa1, 0x8b, 0x22, 0x42, 0x47, 0xb9, 0x39, 0x25, 0x81, 0xb9, 0x58, 0x02, 0x91, 0x8d, 0x42, + 0xc1, 0x0a, 0x30, 0x04, 0xaf, 0x41, 0x03, 0xdb, 0x18, 0x20, 0x03, 0x88, 0xb8, 0x29, 0x46, 0x08, + 0x14, 0xa9, 0x18, 0x00, 0xa9, 0xfb, 0x9a, 0x71, 0xa2, 0xbb, 0x19, 0xb8, 0x8b, 0x21, 0x20, 0x06, + 0xbc, 0x0a, 0x88, 0x52, 0x90, 0x90, 0x0c, 0x43, 0x26, 0xb8, 0x8a, 0x91, 0x10, 0x9a, 0x03, 0x9d, + 0x91, 0xba, 0xff, 0x19, 0x90, 0x08, 0xaa, 0xcb, 0x2a, 0x24, 0x00, 0x98, 0x20, 0x44, 0xa8, 0x78, + 0x04, 0x8a, 0x33, 0x33, 0x67, 0xa8, 0x09, 0x80, 0x80, 0x90, 0xac, 0xb9, 0x9a, 0x29, 0x25, 0x25, + 0xe8, 0x8a, 0x01, 0x30, 0x43, 0x02, 0x9b, 0x23, 0x58, 0x85, 0xbb, 0x2a, 0x25, 0x42, 0x90, 0x9a, + 0xac, 0x42, 0x02, 0x28, 0xf8, 0x0d, 0x08, 0xdb, 0x00, 0x1a, 0x23, 0xb8, 0x9c, 0x98, 0xaf, 0x01, + 0x10, 0xb1, 0x9c, 0x18, 0x23, 0xeb, 0x0a, 0x08, 0x24, 0x11, 0x31, 0xa1, 0x99, 0x58, 0x57, 0xb8, + 0x28, 0xb8, 0x19, 0x33, 0x31, 0x83, 0xed, 0x9c, 0x34, 0xeb, 0x1a, 0x32, 0x91, 0x0a, 0x82, 0x0b, + 0x01, 0x64, 0x01, 0x20, 0x33, 0x11, 0xb8, 0x11, 0xfa, 0x2d, 0x27, 0xb8, 0x99, 0x89, 0x98, 0x0b, + 0x04, 0xbd, 0x43, 0xa0, 0xad, 0x02, 0x2b, 0x37, 0xb9, 0x09, 0x99, 0x22, 0x52, 0x12, 0x11, 0xfb, + 0x58, 0x02, 0xb9, 0xba, 0x9d, 0x11, 0x32, 0xd8, 0xbc, 0x9a, 0x31, 0x24, 0x93, 0xad, 0xaa, 0x41, + 0x83, 0xbd, 0x41, 0xb0, 0x3a, 0x16, 0x11, 0xa8, 0x89, 0x31, 0x05, 0xbc, 0x8a, 0x31, 0xc0, 0x8a, + 0x09, 0x36, 0x82, 0x8a, 0xbc, 0x24, 0x90, 0x3a, 0x07, 0xb9, 0x0d, 0x04, 0x8a, 0x18, 0x54, 0x14, + 0xca, 0x18, 0x11, 0x01, 0xdb, 0x61, 0x11, 0xea, 0x18, 0x00, 0x92, 0x18, 0x88, 0x9a, 0xb9, 0x0d, + 0xb8, 0x08, 0x8b, 0xa1, 0x40, 0x40, 0x02, 0x08, 0xe8, 0x71, 0x96, 0x18, 0x90, 0x00, 0x88, 0x00, + 0xcb, 0xb9, 0x72, 0x86, 0xaa, 0x89, 0x21, 0xb1, 0x9e, 0x80, 0x42, 0xc8, 0x29, 0x82, 0xca, 0x18, + 0xa1, 0x48, 0xc1, 0xab, 0x8d, 0x13, 0x42, 0xb0, 0x19, 0x8a, 0x73, 0x84, 0x8b, 0x82, 0x38, 0x55, + 0x82, 0xaa, 0x21, 0xad, 0x41, 0xa4, 0x0d, 0xa0, 0x0b, 0x40, 0x13, 0x89, 0x90, 0x99, 0x19, 0x93, + 0x8d, 0x53, 0xc3, 0x2b, 0x37, 0x90, 0x20, 0x88, 0x13, 0xfd, 0x39, 0x14, 0x00, 0x89, 0x90, 0xbc, + 0xa9, 0xae, 0x98, 0x48, 0x82, 0xa9, 0x00, 0xea, 0x09, 0xbc, 0x53, 0xa9, 0x89, 0x02, 0x19, 0x17, + 0x98, 0x11, 0x34, 0x33, 0xc0, 0x0d, 0x02, 0xbd, 0x18, 0x80, 0x20, 0x22, 0x0d, 0x87, 0x8b, 0x02, + 0x42, 0xa8, 0xa9, 0x0b, 0x00, 0x51, 0x91, 0x31, 0xeb, 0xb9, 0x60, 0x02, 0xd0, 0x9d, 0x08, 0x31, + 0x14, 0xa8, 0x8c, 0x03, 0x08, 0x16, 0x89, 0x01, 0xc0, 0x78, 0x03, 0xb9, 0x2a, 0xea, 0x10, 0x88, + 0x80, 0x01, 0xb0, 0x4c, 0x84, 0xa1, 0x0e, 0x80, 0x22, 0x11, 0xfa, 0x1b, 0x02, 0x80, 0x09, 0xd1, + 0x2a, 0x02, 0x90, 0x0d, 0x93, 0x8d, 0x13, 0xc8, 0xac, 0x10, 0x15, 0x38, 0x15, 0x00, 0xfb, 0x19, + 0x98, 0x23, 0xb9, 0x19, 0xf8, 0x2a, 0x83, 0x0a, 0xec, 0x49, 0x93, 0x9d, 0x52, 0x13, 0x08, 0xd9, + 0x29, 0x80, 0x32, 0x02, 0xca, 0xc9, 0x9c, 0x42, 0x93, 0x8a, 0x12, 0xda, 0x39, 0x17, 0x9a, 0xa1, + 0x10, 0x2b, 0x17, 0x89, 0x20, 0xc0, 0x28, 0x90, 0x88, 0xb0, 0x9f, 0x32, 0x26, 0xc9, 0x00, 0x0a, + 0xb9, 0x41, 0x89, 0xa1, 0x3a, 0xdb, 0x12, 0x0b, 0x23, 0xdf, 0x33, 0x89, 0x11, 0xd9, 0x49, 0xc1, + 0x29, 0xa3, 0x8a, 0x10, 0x34, 0x82, 0xd8, 0x2a, 0xba, 0xc2, 0xac, 0x19, 0xf8, 0x1c, 0x13, 0xcb, + 0x39, 0xb2, 0x3a, 0x05, 0x9c, 0x02, 0x52, 0x00, 0x81, 0x21, 0x88, 0x74, 0x87, 0x89, 0x91, 0x28, + 0xa1, 0x19, 0xb2, 0xaf, 0xaa, 0x32, 0x90, 0x8a, 0x45, 0x12, 0x98, 0x9a, 0x30, 0x47, 0xb8, 0x91, + 0xae, 0x29, 0x14, 0x80, 0x28, 0xe8, 0x49, 0x34, 0xb0, 0xbd, 0x88, 0x8a, 0x51, 0x83, 0xaa, 0x08, + 0x90, 0xe1, 0x0e, 0x83, 0xab, 0x10, 0x21, 0x83, 0xcd, 0x19, 0x11, 0x50, 0x06, 0x08, 0x90, 0x19, + 0xc0, 0x18, 0x9c, 0x13, 0xaa, 0x39, 0x83, 0x89, 0x34, 0xca, 0xca, 0x0a, 0x67, 0x91, 0x09, 0xca, + 0xab, 0x42, 0x21, 0x15, 0xfa, 0x19, 0x90, 0x22, 0x12, 0x88, 0x82, 0xbc, 0x58, 0x14, 0x20, 0x82, + 0xab, 0x12, 0xa9, 0xe9, 0x68, 0xd1, 0x9a, 0x90, 0xab, 0x11, 0x04, 0x8c, 0x91, 0x38, 0x91, 0x62, + 0xb8, 0x1a, 0x23, 0x54, 0x91, 0xbd, 0x08, 0x1a, 0x05, 0x58, 0xd8, 0x18, 0x20, 0x91, 0xbf, 0x20, + 0x88, 0x88, 0x9a, 0x08, 0x52, 0x91, 0xac, 0x18, 0x24, 0x30, 0xa1, 0x24, 0xae, 0x14, 0x88, 0x20, + 0x02, 0x43, 0xc8, 0x2b, 0x35, 0xa8, 0xad, 0x08, 0xe1, 0x0c, 0xb0, 0x20, 0x19, 0xa8, 0x57, 0x00, + 0x09, 0xc1, 0x9d, 0x09, 0x20, 0x85, 0x8b, 0x10, 0x83, 0x1b, 0x24, 0x32, 0xa8, 0xa8, 0x0b, 0xc8, + 0x75, 0xa3, 0x0b, 0xf8, 0x39, 0xa1, 0x98, 0x0a, 0xfa, 0x51, 0xa1, 0x29, 0x02, 0xab, 0x20, 0x90, + 0x29, 0xe9, 0x51, 0x32, 0xa0, 0x80, 0x18, 0xb9, 0x48, 0x53, 0x94, 0x9a, 0xde, 0x89, 0x21, 0x99, + 0xf0, 0x3a, 0x82, 0x02, 0x0b, 0xb0, 0xad, 0x99, 0x62, 0x90, 0x43, 0xca, 0x18, 0x20, 0x82, 0x88, + 0x53, 0x91, 0x39, 0x77, 0x81, 0xaa, 0x29, 0xc2, 0x8a, 0x80, 0xa9, 0x8b, 0x83, 0x09, 0x64, 0xb1, + 0xaa, 0x41, 0xa1, 0x88, 0x1b, 0xa5, 0x38, 0x38, 0x77, 0x90, 0x9a, 0x11, 0x89, 0x12, 0x98, 0x54, + 0xd1, 0x8b, 0xb2, 0x2b, 0xf9, 0x09, 0x8a, 0x22, 0x88, 0xdb, 0x50, 0xb0, 0x8a, 0x52, 0x83, 0x32, + 0xfa, 0xa9, 0x8e, 0x23, 0x88, 0x20, 0x25, 0x08, 0xa3, 0x0c, 0x01, 0x10, 0x21, 0xb0, 0x0d, 0x04, + 0xb9, 0xbb, 0x2a, 0xf8, 0x3b, 0xda, 0x49, 0x13, 0x99, 0x18, 0x11, 0x8b, 0xd3, 0x8e, 0x63, 0x02, + 0x11, 0xec, 0x18, 0x01, 0x98, 0x99, 0x11, 0x18, 0x02, 0xaa, 0x46, 0x0a, 0x17, 0x99, 0xab, 0x91, + 0x2b, 0x27, 0x01, 0x19, 0xe8, 0x9a, 0x01, 0x18, 0xa8, 0x2a, 0x13, 0x22, 0xff, 0x89, 0x23, 0x98, + 0xa9, 0x89, 0x52, 0xc8, 0x89, 0x9c, 0x13, 0x12, 0x3a, 0x27, 0x30, 0x91, 0x89, 0x42, 0x11, 0x2a, + 0x97, 0xbe, 0x99, 0x20, 0x18, 0xa2, 0x81, 0xcf, 0x0a, 0xa0, 0x20, 0x62, 0x13, 0xdb, 0x30, 0x20, + 0x82, 0x80, 0x11, 0xbd, 0x43, 0x53, 0x82, 0xad, 0x33, 0xa9, 0x09, 0x81, 0x91, 0xcd, 0x9d, 0xc9, + 0x29, 0x32, 0x84, 0xa8, 0xdc, 0x9b, 0x33, 0x98, 0x20, 0x0a, 0x94, 0x7a, 0xb3, 0x60, 0xd0, 0x29, + 0x12, 0x02, 0x32, 0xcd, 0x21, 0x99, 0xa8, 0x2b, 0x94, 0x8a, 0x44, 0x01, 0xf9, 0x9d, 0x08, 0x02, + 0x28, 0xa1, 0x19, 0x10, 0x02, 0x3a, 0x67, 0xa9, 0x09, 0xa9, 0x34, 0x89, 0x32, 0xd9, 0x8b, 0x20, + 0x85, 0x09, 0x82, 0x22, 0xdd, 0x11, 0xda, 0x8c, 0x82, 0x9c, 0xa0, 0x0b, 0x22, 0xa0, 0x63, 0x19, + 0x37, 0x19, 0x82, 0xac, 0x40, 0x14, 0x42, 0xb0, 0x0a, 0x1a, 0x35, 0x90, 0xba, 0x19, 0xf8, 0x8c, + 0x88, 0xa8, 0xbc, 0x9a, 0x20, 0x32, 0x90, 0x32, 0x98, 0x0a, 0x44, 0x57, 0xd9, 0x29, 0x24, 0x90, + 0x8a, 0x20, 0x14, 0x88, 0x9b, 0x28, 0xa6, 0xaf, 0x88, 0x00, 0x01, 0xdb, 0x28, 0x80, 0x13, 0x89, + 0xa0, 0x9b, 0x23, 0x72, 0xa0, 0xfa, 0x39, 0xa8, 0x74, 0x22, 0x90, 0x09, 0x90, 0x63, 0xb8, 0x9a, + 0x49, 0x03, 0xa0, 0xab, 0x9b, 0xb1, 0x9e, 0x82, 0x9f, 0x00, 0xa9, 0x19, 0xa0, 0x1a, 0x37, 0xca, + 0x58, 0x82, 0x4a, 0x16, 0x20, 0x81, 0xb9, 0x2a, 0x24, 0xc1, 0x8c, 0x89, 0xb0, 0x5b, 0x81, 0x90, + 0xcb, 0x8b, 0x00, 0xd1, 0x1b, 0x34, 0xf9, 0x09, 0x90, 0x89, 0x11, 0xda, 0x3a, 0x13, 0x76, 0x23, + 0xc9, 0x0b, 0x22, 0x18, 0x90, 0xa8, 0x9e, 0x00, 0x80, 0x64, 0x91, 0x2b, 0xf9, 0x09, 0x10, 0x11, + 0x12, 0xaa, 0x88, 0x8a, 0xad, 0x33, 0x82, 0x2d, 0x47, 0x08, 0x91, 0xba, 0x38, 0x82, 0x0a, 0xd8, + 0x8b, 0x70, 0xb3, 0x9c, 0x9a, 0x01, 0x29, 0x17, 0xa9, 0x99, 0xca, 0x48, 0x82, 0xae, 0x88, 0x41, + 0x24, 0x80, 0xb8, 0x0a, 0x00, 0x88, 0x73, 0x03, 0xaa, 0x41, 0x98, 0x08, 0x17, 0x88, 0xeb, 0x08, + 0x02, 0xba, 0x89, 0x12, 0x1e, 0x27, 0x9a, 0xbb, 0x18, 0x22, 0x02, 0x28, 0xf0, 0x3a, 0x22, 0x26, + 0xba, 0x09, 0x90, 0x22, 0xcb, 0x33, 0xce, 0x38, 0x04, 0xbe, 0x00, 0x22, 0xb9, 0x30, 0xc2, 0x8c, + 0x90, 0x58, 0xc1, 0x51, 0x12, 0x81, 0x89, 0x98, 0x09, 0x24, 0x80, 0x08, 0x01, 0xdc, 0x99, 0x1c, + 0x24, 0xa0, 0x8f, 0xb8, 0x42, 0xc8, 0x38, 0xa3, 0x2c, 0x85, 0x9a, 0x09, 0xc8, 0x9a, 0x8b, 0x85, + 0x9d, 0x12, 0x0a, 0x82, 0xd9, 0xad, 0x88, 0x72, 0x82, 0x8c, 0x33, 0x21, 0x24, 0x32, 0xd1, 0x4b, + 0xa4, 0x39, 0x01, 0x01, 0xbb, 0x30, 0x03, 0x88, 0xc0, 0xff, 0x99, 0x80, 0x21, 0x13, 0xee, 0x99, + 0x18, 0x12, 0x01, 0x81, 0xad, 0x48, 0x24, 0x00, 0x98, 0xc9, 0x19, 0x13, 0x00, 0x25, 0x98, 0xbf, + 0x42, 0x80, 0x99, 0x9c, 0xb8, 0x8b, 0x91, 0x53, 0x08, 0xe2, 0x3b, 0xb1, 0x28, 0x12, 0xca, 0x72, + 0x07, 0x18, 0xa8, 0x20, 0x99, 0x80, 0x80, 0xc9, 0x29, 0x17, 0x99, 0x89, 0x53, 0xc0, 0xab, 0x28, + 0x06, 0xa9, 0x09, 0x00, 0x81, 0xcd, 0xa9, 0x10, 0x82, 0x90, 0x28, 0xf9, 0x29, 0x73, 0x04, 0xaa, + 0x31, 0x32, 0x03, 0x81, 0xaf, 0x10, 0x90, 0x73, 0xb0, 0x10, 0x21, 0xc9, 0x08, 0xcc, 0x98, 0xda, + 0x8a, 0x88, 0x40, 0x84, 0xbb, 0x8a, 0x22, 0x53, 0x92, 0xbc, 0x22, 0x71, 0xa3, 0x0c, 0x10, 0xb8, + 0x61, 0x32, 0x03, 0xca, 0x0c, 0x23, 0xba, 0x28, 0xbf, 0xb0, 0x19, 0x88, 0xd0, 0x2b, 0x24, 0x9a, + 0x05, 0x1b, 0x55, 0xa1, 0x8b, 0x03, 0x88, 0x11, 0x00, 0x36, 0x92, 0x0a, 0x11, 0xa9, 0xb8, 0x4b, + 0x97, 0x9e, 0xa9, 0x9b, 0xca, 0x0c, 0x14, 0x11, 0xfa, 0x10, 0xba, 0x41, 0x14, 0x98, 0x30, 0x90, + 0x64, 0x01, 0x00, 0x08, 0x41, 0xf8, 0x19, 0xba, 0x10, 0x81, 0xca, 0x19, 0x98, 0x72, 0x22, 0x98, + 0x00, 0xac, 0x33, 0xac, 0xa8, 0x8c, 0xd8, 0x40, 0x83, 0x9c, 0xa0, 0x3a, 0x35, 0x93, 0xad, 0x98, + 0xd9, 0x0b, 0x04, 0x51, 0x32, 0xa2, 0x8a, 0x28, 0xa2, 0x29, 0x98, 0xb9, 0x2c, 0xe8, 0x11, 0x0c, + 0x67, 0x91, 0x8a, 0xa8, 0x0b, 0x00, 0x37, 0x88, 0xa9, 0x27, 0xa9, 0x88, 0x98, 0xbc, 0x19, 0x82, + 0x48, 0xc3, 0x8c, 0x81, 0x2b, 0xc3, 0x18, 0x90, 0x79, 0x95, 0x19, 0x98, 0x21, 0x89, 0x80, 0xad, + 0x45, 0xb8, 0x48, 0x05, 0xba, 0x18, 0x03, 0x8e, 0x88, 0x82, 0xcb, 0x40, 0x99, 0x14, 0x29, 0xb0, + 0x28, 0xa1, 0x0b, 0x20, 0x94, 0xaa, 0x2b, 0xc6, 0x8f, 0x91, 0x50, 0x03, 0x31, 0xc8, 0x99, 0x8b, + 0x30, 0x37, 0xf9, 0x0b, 0x80, 0x08, 0x14, 0xaa, 0xa0, 0x1c, 0xa1, 0x2b, 0x07, 0x08, 0x90, 0x10, + 0xaa, 0x18, 0xb3, 0x79, 0x77, 0x81, 0x8a, 0x10, 0x90, 0x41, 0x80, 0xc0, 0x1a, 0xb8, 0x9b, 0xc8, + 0x8d, 0x82, 0x89, 0x11, 0x98, 0xac, 0x36, 0x99, 0xb0, 0x9e, 0x99, 0x42, 0x12, 0x89, 0x10, 0x98, + 0xba, 0x70, 0x37, 0x98, 0x90, 0x08, 0x14, 0x00, 0x00, 0xa0, 0x60, 0xc8, 0x9b, 0x11, 0xcb, 0xb9, + 0x1b, 0xc1, 0x48, 0xe2, 0x8d, 0x01, 0x35, 0x11, 0xb0, 0x0d, 0x23, 0x1a, 0x05, 0x2a, 0x12, 0x34, + 0xea, 0x99, 0x9b, 0x32, 0x01, 0x18, 0xa2, 0x19, 0xff, 0x9b, 0x28, 0x80, 0x90, 0x29, 0x12, 0xf9, + 0x0e, 0x12, 0xa9, 0x20, 0x91, 0x51, 0xc0, 0x08, 0x41, 0x03, 0x63, 0x22, 0x81, 0x8c, 0x43, 0xb9, + 0x18, 0xbd, 0x08, 0x9a, 0xa1, 0xdc, 0x0b, 0xc0, 0xaa, 0xab, 0xc8, 0x4a, 0x04, 0x18, 0x01, 0xb9, + 0x68, 0x37, 0x12, 0x88, 0xa9, 0x59, 0x05, 0x9a, 0x11, 0x33, 0x99, 0x11, 0xeb, 0xaa, 0x8d, 0x44, + 0xa8, 0xaa, 0x18, 0xa8, 0x19, 0x23, 0xce, 0xa9, 0x0c, 0x15, 0x28, 0x24, 0x08, 0x82, 0x8d, 0x12, + 0x08, 0x45, 0xb0, 0x8c, 0x33, 0xc1, 0x1a, 0xc9, 0xb9, 0x9e, 0x08, 0x41, 0xb1, 0x8b, 0x23, 0x23, + 0xd8, 0x89, 0xbe, 0x61, 0x01, 0x99, 0x28, 0x93, 0xaa, 0xa9, 0x3b, 0x57, 0x8a, 0x13, 0x09, 0x04, + 0x9a, 0x18, 0x75, 0x92, 0xbd, 0x08, 0x80, 0x21, 0x01, 0x88, 0xa0, 0x72, 0x01, 0xe9, 0x8a, 0x01, + 0xaa, 0xa8, 0xac, 0x28, 0x27, 0x89, 0x01, 0xca, 0x8b, 0x44, 0x21, 0x04, 0x99, 0x9a, 0x62, 0xa1, + 0x9b, 0x81, 0x8a, 0xb9, 0x73, 0x94, 0xba, 0xac, 0x09, 0x91, 0x31, 0x57, 0x83, 0x89, 0xfb, 0x1a, + 0x33, 0x98, 0x01, 0xa9, 0x72, 0xb2, 0x39, 0xb1, 0xbd, 0x28, 0x84, 0x31, 0x13, 0xfa, 0x09, 0x80, + 0x9b, 0xa9, 0x81, 0x2c, 0x84, 0xbb, 0x40, 0x93, 0x0c, 0x93, 0x39, 0x47, 0x01, 0x99, 0x91, 0x0d, + 0x12, 0x81, 0x0a, 0xb1, 0x41, 0xee, 0xab, 0x30, 0x14, 0xa0, 0xcb, 0x09, 0xa0, 0x8b, 0x0c, 0x07, + 0x40, 0x81, 0x98, 0x89, 0x60, 0x84, 0x29, 0x15, 0x08, 0x92, 0x8d, 0xb0, 0x19, 0xd9, 0xaa, 0x3a, + 0x05, 0x40, 0x81, 0x21, 0xbd, 0xcb, 0x41, 0x34, 0x90, 0x10, 0x89, 0x9b, 0x27, 0x89, 0xb9, 0x1a, + 0x15, 0xae, 0x80, 0x99, 0x08, 0x82, 0xbd, 0x10, 0x72, 0x85, 0x18, 0x88, 0x12, 0x08, 0x02, 0xaa, + 0x89, 0xfa, 0x99, 0x3b, 0xa5, 0xae, 0x98, 0x39, 0x07, 0x9a, 0x09, 0xb0, 0x1b, 0x54, 0x14, 0x9a, + 0xaa, 0x88, 0x39, 0x16, 0x81, 0x38, 0x02, 0x20, 0x24, 0xb9, 0x10, 0x29, 0x87, 0x0b, 0xc9, 0xa8, + 0xaf, 0x9a, 0x10, 0xb8, 0xab, 0xbd, 0x35, 0xbb, 0x61, 0x25, 0x99, 0xa8, 0x00, 0x09, 0x33, 0x04, + 0x99, 0x42, 0x15, 0x99, 0x11, 0xca, 0x51, 0xe8, 0x8c, 0x11, 0x00, 0x80, 0x09, 0x80, 0x21, 0xa0, + 0xae, 0xa8, 0x50, 0x23, 0x02, 0xfa, 0x8b, 0x42, 0xd0, 0x28, 0x00, 0x20, 0x37, 0x08, 0x81, 0x89, + 0xfb, 0x29, 0x91, 0x91, 0xcf, 0x19, 0x92, 0x9a, 0x08, 0x80, 0x88, 0x46, 0x90, 0xb9, 0x19, 0x90, + 0x60, 0x13, 0x88, 0x31, 0xca, 0x12, 0x30, 0xb8, 0x52, 0x74, 0x02, 0xb9, 0xbf, 0x20, 0x22, 0xa8, + 0xe8, 0x1c, 0x03, 0x9a, 0x08, 0x89, 0x73, 0x03, 0xa8, 0xcc, 0x18, 0x02, 0x11, 0x89, 0x93, 0x1c, + 0x46, 0xa1, 0x09, 0x89, 0x43, 0x02, 0xbb, 0xd9, 0x9f, 0x82, 0xa9, 0x9b, 0x18, 0x12, 0x98, 0x4a, + 0x17, 0x8a, 0x21, 0x27, 0x99, 0x88, 0x30, 0xe2, 0x39, 0x81, 0x08, 0xa9, 0x9c, 0xb9, 0x63, 0xc8, + 0xba, 0x9a, 0x18, 0xf2, 0x1d, 0x03, 0x00, 0x89, 0x11, 0x10, 0x33, 0x45, 0x91, 0x9e, 0x31, 0x23, + 0x00, 0x08, 0x81, 0xda, 0x5a, 0x04, 0x80, 0x38, 0xdb, 0x43, 0x99, 0xb9, 0xbf, 0x99, 0xaa, 0xa9, + 0x30, 0x00, 0x80, 0x47, 0xa8, 0xb0, 0x0f, 0x34, 0x89, 0x15, 0x20, 0xa0, 0x8a, 0x09, 0x23, 0x28, + 0x85, 0xab, 0xac, 0x91, 0x7a, 0x83, 0x9a, 0xda, 0x8c, 0x81, 0x88, 0x1b, 0xd1, 0x9c, 0x19, 0x46, + 0xa8, 0x9b, 0x31, 0x11, 0x22, 0x14, 0xcb, 0x60, 0x13, 0x12, 0x00, 0xd8, 0x1b, 0x95, 0x3c, 0xe2, + 0x8b, 0x23, 0x80, 0xc9, 0x0a, 0xc8, 0x8a, 0x35, 0x91, 0x9a, 0x00, 0xcd, 0x11, 0x9b, 0x13, 0x08, + 0x61, 0xa3, 0x9c, 0x08, 0x47, 0x81, 0xc0, 0x1a, 0x31, 0x16, 0x00, 0xaa, 0x09, 0x45, 0xa0, 0x8a, + 0xca, 0xac, 0x30, 0x01, 0x32, 0xd0, 0x0b, 0xc1, 0x09, 0x89, 0x18, 0x17, 0x8b, 0xa2, 0xaf, 0x32, + 0x81, 0xbc, 0x30, 0xa1, 0x28, 0x44, 0x99, 0x20, 0x65, 0x14, 0xa9, 0xb9, 0x9f, 0x02, 0x08, 0xb8, + 0x8e, 0x82, 0x19, 0x22, 0xb8, 0xbb, 0x50, 0x47, 0x91, 0x99, 0x80, 0x21, 0x90, 0x09, 0x26, 0xb9, + 0x29, 0x23, 0xea, 0xac, 0x10, 0xa9, 0x32, 0x93, 0x80, 0x20, 0xfa, 0x9c, 0xb9, 0x20, 0x11, 0x61, + 0x05, 0x58, 0x92, 0xae, 0x08, 0xa0, 0x39, 0x15, 0x9a, 0xa0, 0x28, 0x81, 0x64, 0x80, 0xdb, 0x0a, + 0x12, 0x22, 0x33, 0xf9, 0x8c, 0x98, 0x28, 0x02, 0xab, 0xa9, 0x0b, 0x90, 0x73, 0x07, 0x98, 0x29, + 0x92, 0x30, 0xa0, 0xa8, 0x70, 0xc2, 0xaa, 0x50, 0x82, 0xb9, 0x19, 0x93, 0x9c, 0x02, 0xbe, 0x98, + 0x60, 0x98, 0x25, 0x9a, 0xa9, 0x28, 0x75, 0x13, 0x98, 0x09, 0xb8, 0xac, 0x20, 0x12, 0xfb, 0x89, + 0x00, 0xb8, 0x1c, 0x16, 0x09, 0x22, 0x08, 0xb2, 0x0d, 0x25, 0x9a, 0x12, 0xab, 0xac, 0x81, 0x4a, + 0x94, 0x9c, 0xcb, 0x30, 0x33, 0x92, 0xbe, 0x40, 0x33, 0x82, 0x92, 0xbf, 0x41, 0x92, 0xca, 0x0b, + 0x81, 0x20, 0xc0, 0xfc, 0x29, 0x15, 0x88, 0x80, 0x10, 0xeb, 0x11, 0x0a, 0x24, 0xa0, 0xbb, 0x89, + 0x65, 0x02, 0x89, 0x18, 0x02, 0x61, 0x80, 0x01, 0xbe, 0x18, 0x43, 0x81, 0x00, 0xcc, 0xb9, 0x8a, + 0x89, 0x81, 0xaa, 0x52, 0x51, 0xe0, 0x89, 0x09, 0x82, 0x9c, 0x33, 0x41, 0x02, 0xb8, 0x1e, 0x03, + 0x73, 0x10, 0x92, 0xcb, 0x9a, 0x99, 0x82, 0x9d, 0x82, 0x18, 0xa3, 0xff, 0x28, 0xb0, 0x38, 0x91, + 0x99, 0x62, 0x01, 0xb0, 0x28, 0x01, 0x19, 0x47, 0x99, 0x32, 0xdb, 0x20, 0x81, 0xb8, 0x49, 0xd8, + 0x29, 0xc0, 0x10, 0x88, 0x22, 0xec, 0x88, 0x38, 0x34, 0xa2, 0x1a, 0x05, 0xab, 0x60, 0xa3, 0x9b, + 0x9a, 0x80, 0x88, 0x54, 0x01, 0xa1, 0xae, 0x21, 0x62, 0x82, 0xbb, 0x39, 0xf9, 0x89, 0x28, 0xa1, + 0xb1, 0x9f, 0x13, 0x00, 0x08, 0x32, 0xd2, 0xcc, 0x8c, 0x54, 0x02, 0x09, 0xa0, 0x0a, 0xcd, 0x28, + 0x00, 0x81, 0x51, 0xd8, 0x89, 0x19, 0x14, 0x88, 0xa9, 0xac, 0x42, 0xa0, 0x33, 0x00, 0x02, 0x72, + 0x03, 0x99, 0xaa, 0x71, 0x95, 0x8a, 0xfb, 0xab, 0x21, 0x21, 0x91, 0x51, 0x90, 0x31, 0x35, 0xda, + 0x00, 0x09, 0x80, 0x82, 0x8a, 0x1a, 0xa5, 0x7a, 0xd0, 0x09, 0x18, 0xa2, 0x39, 0xf9, 0x0b, 0x41, + 0x93, 0x28, 0xd9, 0x9b, 0x42, 0x00, 0x12, 0xb9, 0x71, 0xa2, 0x01, 0x19, 0x88, 0x13, 0xbb, 0xef, + 0xaa, 0x19, 0x01, 0x02, 0xb8, 0xbc, 0xbb, 0x73, 0x22, 0xe8, 0x0c, 0x21, 0x35, 0x12, 0x80, 0x98, + 0x80, 0x8d, 0x04, 0x09, 0x08, 0x8a, 0x92, 0x3a, 0xfd, 0xa9, 0x28, 0x33, 0x82, 0xad, 0x32, 0xdb, + 0x20, 0x81, 0x0a, 0x67, 0xa0, 0x09, 0x42, 0x02, 0x99, 0xba, 0x0a, 0x91, 0xcd, 0x51, 0xc8, 0x19, + 0xa0, 0xdb, 0x18, 0x00, 0x08, 0x08, 0x92, 0xac, 0x41, 0x14, 0x0a, 0x56, 0x13, 0xa9, 0x10, 0x98, + 0xba, 0x40, 0x13, 0x45, 0xb8, 0x9a, 0x8a, 0xcc, 0x62, 0xb8, 0x9b, 0xa8, 0xbb, 0x62, 0xb1, 0x0c, + 0x20, 0x24, 0x33, 0xba, 0x26, 0xb9, 0x71, 0xa0, 0x8c, 0x32, 0x02, 0x00, 0xa9, 0x9c, 0x09, 0x44, + 0x12, 0xa8, 0xcb, 0x9a, 0x8a, 0xf9, 0x2d, 0xa1, 0x19, 0x9a, 0x53, 0xb0, 0x0e, 0x42, 0x83, 0x8a, + 0x33, 0xb1, 0x8b, 0xb1, 0x9d, 0x76, 0x90, 0x99, 0x0a, 0xb9, 0x63, 0x21, 0x01, 0xa2, 0xac, 0x9b, + 0x91, 0xbc, 0x38, 0x07, 0xdb, 0x8b, 0x12, 0xcc, 0x41, 0x00, 0x00, 0x01, 0x91, 0x60, 0x01, 0xa1, + 0xaf, 0x21, 0x81, 0x21, 0x35, 0x81, 0x10, 0x00, 0xe9, 0x0b, 0x89, 0x01, 0x09, 0x98, 0xff, 0x0a, + 0x90, 0x10, 0xb9, 0x68, 0x25, 0xa8, 0x88, 0x99, 0x32, 0x32, 0x11, 0x00, 0x02, 0x11, 0x5a, 0x86, + 0x3b, 0xb0, 0xe9, 0x3b, 0x92, 0x2a, 0xc1, 0xbf, 0xbb, 0x2a, 0xc2, 0x9e, 0xc9, 0x9b, 0x42, 0x43, + 0xa0, 0x01, 0x40, 0x24, 0x23, 0x91, 0x9c, 0x64, 0x92, 0x1a, 0x81, 0x91, 0x9e, 0x99, 0x09, 0x53, + 0xc0, 0x9a, 0x08, 0xe8, 0x9d, 0x00, 0x42, 0xb0, 0xbb, 0x28, 0x13, 0x43, 0x90, 0x68, 0x14, 0x11, + 0x01, 0x01, 0xe9, 0x3a, 0x34, 0x92, 0xa9, 0xcd, 0x28, 0x32, 0x92, 0xaa, 0xee, 0x8a, 0x21, 0x11, + 0xb9, 0x99, 0x9a, 0x11, 0xa2, 0x79, 0x91, 0xfa, 0x8d, 0x22, 0x44, 0x82, 0x09, 0x41, 0xa9, 0x01, + 0xac, 0xa1, 0x0b, 0xa1, 0xa9, 0xca, 0x1f, 0x14, 0x31, 0xc8, 0xba, 0x10, 0x01, 0xc8, 0x89, 0xba, + 0x49, 0xa3, 0x9f, 0x43, 0x11, 0x33, 0x98, 0xd9, 0x08, 0x39, 0x47, 0x80, 0x31, 0xb3, 0x9f, 0x81, + 0xcb, 0x29, 0x13, 0x35, 0xd9, 0x08, 0x80, 0xa9, 0x99, 0xbd, 0x10, 0x10, 0x82, 0x6a, 0xc3, 0x49, + 0x00, 0x26, 0xa9, 0x99, 0x28, 0x37, 0x02, 0x82, 0xcc, 0x8a, 0x01, 0x00, 0x90, 0xaa, 0xab, 0x01, + 0x0c, 0x95, 0xdf, 0x09, 0x00, 0x00, 0xea, 0x28, 0x20, 0x33, 0x03, 0x0b, 0x15, 0x18, 0x23, 0x32, + 0x82, 0xdf, 0x08, 0x28, 0xc0, 0x0b, 0xc9, 0x10, 0xdb, 0xbb, 0x29, 0x14, 0x00, 0x33, 0xa8, 0x3a, + 0x47, 0x23, 0xa9, 0x18, 0x21, 0xf9, 0xac, 0x31, 0x02, 0x20, 0xd1, 0x8b, 0xa2, 0x6b, 0x24, 0x14, + 0xba, 0xaa, 0x8c, 0x13, 0x19, 0x05, 0xfa, 0x39, 0x15, 0xc9, 0x9a, 0x43, 0x01, 0xa0, 0xae, 0x28, + 0x14, 0x09, 0x88, 0x99, 0x82, 0x78, 0x91, 0xba, 0xaf, 0x11, 0x20, 0x02, 0xa1, 0x9c, 0xba, 0x62, + 0x21, 0xa1, 0x1a, 0x12, 0xb9, 0x71, 0x84, 0xdd, 0x28, 0xa1, 0x8a, 0x10, 0x80, 0x36, 0x80, 0xa8, + 0x88, 0x49, 0xa4, 0xcd, 0x29, 0x34, 0x32, 0xb8, 0xdc, 0x8c, 0x21, 0x42, 0xa8, 0x09, 0x98, 0x11, + 0xa0, 0x72, 0x03, 0xfa, 0x0c, 0x21, 0xa8, 0x89, 0xcb, 0x31, 0x80, 0x80, 0x18, 0x08, 0x25, 0xa9, + 0x80, 0x8d, 0x17, 0x53, 0x02, 0x00, 0x32, 0xb8, 0xcc, 0x89, 0xea, 0x8a, 0x32, 0x14, 0xfb, 0x8d, + 0x00, 0x08, 0x21, 0x23, 0x99, 0x01, 0x08, 0x17, 0x00, 0xc9, 0x09, 0x2a, 0x84, 0x61, 0x13, 0xc9, + 0x0a, 0xa8, 0x08, 0xeb, 0x08, 0x12, 0xcd, 0x0a, 0x11, 0x89, 0xc0, 0x9f, 0x12, 0x32, 0x80, 0x20, + 0x12, 0x1a, 0x84, 0x19, 0x15, 0x11, 0x90, 0xbe, 0x02, 0x9e, 0x01, 0xb9, 0x48, 0x90, 0x84, 0x4a, + 0xc2, 0x9d, 0x9a, 0x12, 0x10, 0x03, 0x80, 0x4c, 0x27, 0x8c, 0x11, 0xa0, 0x2b, 0x12, 0x00, 0x11, + 0xa9, 0xee, 0x0a, 0x80, 0x22, 0x20, 0x12, 0x23, 0xa0, 0xcf, 0x71, 0x13, 0x83, 0xae, 0x20, 0x00, + 0xd9, 0x0b, 0x92, 0x8a, 0x22, 0x02, 0xb8, 0x6a, 0x92, 0xba, 0x0c, 0x88, 0x27, 0x08, 0xb9, 0x81, + 0x8a, 0x54, 0xf8, 0x19, 0x88, 0x88, 0x61, 0x83, 0x9b, 0xb8, 0x58, 0xb2, 0x9e, 0x01, 0x89, 0xc0, + 0x1c, 0x22, 0x81, 0x08, 0x8b, 0xa1, 0x70, 0x25, 0xb1, 0x9d, 0x10, 0x05, 0x9a, 0x34, 0x91, 0x09, + 0x93, 0x8c, 0x81, 0xa9, 0x73, 0x00, 0xf0, 0x9b, 0x31, 0xa3, 0x89, 0xdb, 0x65, 0x01, 0x89, 0x88, + 0xba, 0x29, 0x24, 0xc8, 0x9a, 0x18, 0xa1, 0x1b, 0x36, 0xa2, 0x8e, 0x90, 0x38, 0x93, 0xac, 0x08, + 0x88, 0x00, 0x30, 0x10, 0x16, 0xc9, 0x0e, 0x25, 0x22, 0xa9, 0xb8, 0x89, 0x48, 0x35, 0x80, 0xbd, + 0x28, 0xea, 0x99, 0xbb, 0x54, 0xa8, 0xbb, 0x8a, 0x20, 0x81, 0x31, 0x33, 0x16, 0x1a, 0x26, 0x13, + 0x09, 0xb1, 0x39, 0x02, 0x08, 0x43, 0x34, 0xc9, 0xf0, 0xaf, 0xa9, 0x10, 0x73, 0xa1, 0x99, 0xa8, + 0x31, 0xca, 0x41, 0x12, 0xa8, 0x51, 0x91, 0x02, 0xae, 0x89, 0x34, 0x20, 0x84, 0x98, 0x32, 0xe0, + 0x8b, 0x09, 0x53, 0x82, 0x0a, 0xfa, 0xaa, 0xba, 0x19, 0xb8, 0x19, 0x31, 0x54, 0x93, 0x70, 0xc2, + 0x0a, 0x91, 0xbb, 0x52, 0x21, 0x43, 0x02, 0x20, 0xfb, 0xae, 0x89, 0x01, 0x98, 0x91, 0x4a, 0x84, + 0x09, 0xba, 0x08, 0xba, 0x74, 0xa8, 0x20, 0x43, 0x01, 0x8a, 0xc1, 0xae, 0x21, 0x82, 0xcc, 0x30, + 0x53, 0x14, 0x00, 0xaa, 0x08, 0x10, 0x21, 0xb3, 0xcf, 0x20, 0x81, 0x18, 0xda, 0xbb, 0x31, 0x08, + 0x15, 0xa8, 0xae, 0x91, 0x0b, 0x55, 0x82, 0x80, 0x08, 0x42, 0x03, 0x1a, 0x37, 0xe9, 0x0a, 0xb0, + 0x39, 0x04, 0x18, 0xa1, 0xbd, 0x0b, 0x80, 0x32, 0xfc, 0x8c, 0x99, 0x32, 0xa8, 0x09, 0x02, 0xbb, + 0x19, 0x03, 0x10, 0x73, 0x16, 0x28, 0x01, 0x04, 0x20, 0x40, 0x17, 0x90, 0xb9, 0x29, 0x82, 0x35, + 0xc9, 0xcd, 0xaa, 0x9a, 0xb8, 0x10, 0xaa, 0x08, 0x82, 0x62, 0x82, 0x8b, 0x77, 0x05, 0x89, 0x90, + 0x09, 0x11, 0x30, 0x92, 0x9a, 0x89, 0x83, 0x52, 0xde, 0x28, 0xa9, 0x0a, 0x11, 0x23, 0xc9, 0xbe, + 0x3a, 0x27, 0x99, 0x89, 0x20, 0x33, 0xf9, 0x0a, 0x90, 0x08, 0x55, 0x83, 0xba, 0x8b, 0x02, 0x08, + 0xb8, 0x32, 0x33, 0xfc, 0x41, 0x90, 0xa9, 0xaa, 0x09, 0x02, 0xc1, 0xcf, 0x40, 0x91, 0x0b, 0x83, + 0x0a, 0x34, 0x98, 0xb8, 0x9d, 0x41, 0x33, 0xb5, 0x9f, 0x23, 0xc0, 0x19, 0x01, 0x20, 0xc0, 0x8a, + 0x23, 0x09, 0x14, 0xea, 0x38, 0xa1, 0x48, 0x81, 0x99, 0xa9, 0x1d, 0x05, 0xaa, 0x60, 0x33, 0x17, + 0xaa, 0x80, 0x89, 0x90, 0x0d, 0x92, 0x1c, 0x12, 0x80, 0x28, 0xea, 0x18, 0x92, 0xbd, 0x42, 0x34, + 0xed, 0x09, 0x18, 0x23, 0xd9, 0x19, 0x90, 0x98, 0x88, 0x30, 0x82, 0xa0, 0x9c, 0x75, 0x91, 0x21, + 0x00, 0x01, 0x00, 0xb9, 0xb9, 0xbf, 0x12, 0x9b, 0xcb, 0x08, 0x35, 0xfa, 0x28, 0xb8, 0x0c, 0x17, + 0xaa, 0x32, 0x92, 0x0b, 0x01, 0x41, 0x04, 0xbc, 0x30, 0x12, 0x12, 0xac, 0xbc, 0x41, 0x04, 0x1a, + 0xb1, 0x2a, 0xea, 0x30, 0x90, 0x42, 0xaa, 0x16, 0xcf, 0x10, 0x80, 0x31, 0x04, 0x88, 0xdc, 0x28, + 0x03, 0x31, 0xb0, 0x9c, 0x31, 0x83, 0x2c, 0x95, 0xae, 0x30, 0xa8, 0x48, 0xb0, 0x9b, 0xac, 0x31, + 0x32, 0x92, 0xde, 0x0b, 0x82, 0x8a, 0x81, 0xd8, 0x48, 0xa8, 0x28, 0x16, 0x1a, 0x16, 0x88, 0x11, + 0x88, 0xb9, 0x1b, 0x65, 0x94, 0x0b, 0x81, 0x9c, 0x91, 0x0d, 0xb8, 0x89, 0x00, 0x33, 0xbc, 0x42, + 0x90, 0x71, 0x16, 0xb8, 0x29, 0xb8, 0x3a, 0x27, 0xa0, 0x99, 0x31, 0x91, 0xd9, 0x89, 0xba, 0x40, + 0x24, 0x62, 0x83, 0xda, 0x0a, 0xa8, 0x40, 0xa0, 0x08, 0xc9, 0x39, 0x53, 0xa2, 0x8c, 0xba, 0x52, + 0x91, 0x08, 0xc9, 0x0a, 0xe9, 0x30, 0x81, 0x22, 0x42, 0x88, 0xd2, 0x8e, 0x12, 0x31, 0x00, 0x80, + 0x99, 0xab, 0xdf, 0xa9, 0x1a, 0x98, 0x58, 0xb2, 0x1a, 0x38, 0x07, 0xad, 0x28, 0x11, 0x22, 0x43, + 0xe0, 0x9c, 0x18, 0x83, 0x0d, 0x16, 0x08, 0x01, 0x20, 0x03, 0xa8, 0xbe, 0xcb, 0x30, 0x13, 0x32, + 0xf9, 0x1b, 0x91, 0x1b, 0x12, 0xb1, 0x8e, 0x54, 0x01, 0xba, 0x09, 0x32, 0x22, 0xa8, 0x30, 0xe8, + 0x29, 0xa3, 0xaf, 0x08, 0x62, 0xa0, 0x30, 0xb8, 0x0b, 0x11, 0xd8, 0xad, 0xba, 0xaa, 0x19, 0x55, + 0x22, 0xc0, 0x8b, 0x40, 0x84, 0x48, 0x01, 0x00, 0x22, 0x49, 0xa5, 0x9e, 0xa9, 0xaa, 0x51, 0x05, + 0x20, 0x91, 0xdd, 0x09, 0x00, 0xa8, 0x09, 0x10, 0xd0, 0x9d, 0x32, 0x34, 0x22, 0xd9, 0x08, 0x99, + 0x10, 0x21, 0x92, 0x8c, 0xb8, 0x50, 0x02, 0x10, 0x05, 0xce, 0x29, 0x03, 0x92, 0xbe, 0x38, 0x00, + 0x20, 0x33, 0x9a, 0xfc, 0x3a, 0x14, 0x88, 0x19, 0x12, 0x21, 0x64, 0xa1, 0x29, 0xfb, 0x8b, 0x80, + 0x41, 0x01, 0x18, 0x02, 0x30, 0xb1, 0x2a, 0xa7, 0xbf, 0x90, 0x10, 0xea, 0x09, 0xa9, 0x38, 0x84, + 0xbc, 0x0b, 0x34, 0x02, 0x98, 0x42, 0x90, 0xbe, 0x42, 0x12, 0x18, 0x22, 0x47, 0x81, 0xa9, 0x21, + 0x11, 0xd8, 0x0a, 0x98, 0xef, 0x19, 0x80, 0x80, 0x9a, 0x80, 0x08, 0xa0, 0x9a, 0x49, 0x37, 0x91, + 0x29, 0x93, 0x9d, 0x42, 0x53, 0xa1, 0x19, 0x91, 0x01, 0xaf, 0x08, 0x18, 0x03, 0x39, 0x07, 0x9b, + 0xa9, 0x0b, 0x12, 0xfa, 0x4b, 0x83, 0x31, 0x82, 0xaf, 0x09, 0x61, 0x03, 0x18, 0xb0, 0x8c, 0x08, + 0x12, 0x91, 0x4a, 0xb2, 0x40, 0x00, 0x55, 0xe2, 0x8c, 0x81, 0xb9, 0x9f, 0x89, 0x30, 0x04, 0x90, + 0x18, 0x91, 0xab, 0x10, 0x08, 0xe0, 0x1a, 0x43, 0x03, 0xa9, 0x19, 0x34, 0xb2, 0xcf, 0x08, 0x00, + 0xb0, 0xac, 0x62, 0x92, 0x0c, 0x12, 0x80, 0x31, 0xb8, 0x50, 0x43, 0xb0, 0x78, 0x83, 0x11, 0xda, + 0x08, 0x8a, 0x13, 0x70, 0x85, 0xcb, 0x08, 0x01, 0x18, 0x12, 0x20, 0x22, 0xfe, 0x9a, 0x19, 0x01, + 0x10, 0x23, 0x41, 0xe8, 0xbb, 0x10, 0x88, 0x10, 0x41, 0x16, 0x08, 0x81, 0xce, 0x9a, 0x00, 0x23, + 0xc8, 0x0a, 0x43, 0x80, 0x22, 0x98, 0xdc, 0x8b, 0x10, 0x33, 0xf8, 0x9b, 0x01, 0x3b, 0x84, 0xed, + 0x19, 0x18, 0x33, 0x53, 0xb9, 0x88, 0x58, 0x92, 0x9b, 0x80, 0x8a, 0x03, 0xcd, 0x48, 0x02, 0x10, + 0xa3, 0x6b, 0x11, 0x87, 0x9b, 0x00, 0x88, 0xba, 0x73, 0x12, 0x08, 0x02, 0x10, 0xea, 0xac, 0x42, + 0x24, 0x12, 0x11, 0xba, 0x28, 0xca, 0x52, 0xea, 0xbb, 0x09, 0x8a, 0x81, 0x10, 0x01, 0xbc, 0xbc, + 0x12, 0x72, 0xe2, 0x0a, 0x31, 0x91, 0x1a, 0xb3, 0x4b, 0x82, 0xb9, 0x78, 0x34, 0xe8, 0x8b, 0x10, + 0x21, 0xb1, 0x9d, 0x41, 0x80, 0x92, 0xaf, 0x18, 0x98, 0x89, 0x10, 0x0a, 0xe0, 0x58, 0x33, 0xa8, + 0x88, 0x1a, 0x53, 0x14, 0x89, 0x99, 0xb1, 0xcf, 0x20, 0x53, 0x03, 0x21, 0xd8, 0x9c, 0x20, 0x02, + 0x11, 0xfc, 0x0b, 0x99, 0x11, 0x18, 0x90, 0x62, 0x21, 0xa0, 0x9a, 0x59, 0x37, 0x10, 0xa0, 0x1a, + 0xc8, 0x20, 0x21, 0x13, 0x28, 0xf3, 0x8f, 0x98, 0xa9, 0x39, 0x84, 0x98, 0x28, 0xa8, 0xcb, 0x0d, + 0x44, 0x82, 0xba, 0xba, 0x99, 0x28, 0xc1, 0x0c, 0x81, 0x03, 0x8d, 0x81, 0xa1, 0xbf, 0x10, 0x40, + 0x37, 0xa8, 0x8b, 0x22, 0x93, 0xbd, 0xac, 0x11, 0x10, 0x35, 0x11, 0x88, 0x88, 0xc9, 0x19, 0x34, + 0xe9, 0x38, 0x21, 0x06, 0x9a, 0x10, 0x81, 0x8c, 0x44, 0x90, 0x2a, 0x47, 0x81, 0x19, 0x11, 0xc8, + 0x4a, 0xc8, 0xb9, 0x8d, 0x12, 0x31, 0xc8, 0xba, 0x4b, 0x16, 0x01, 0xba, 0x9a, 0x32, 0xa0, 0x41, + 0x91, 0x82, 0xaf, 0x82, 0xaa, 0x8b, 0x80, 0x42, 0x90, 0x72, 0xf8, 0x8f, 0x01, 0x88, 0x88, 0x21, + 0x82, 0xca, 0x9b, 0x31, 0x13, 0x80, 0xb8, 0xbe, 0x01, 0x09, 0xf9, 0x2b, 0x25, 0x22, 0x81, 0x33, + 0xa9, 0xdc, 0x4a, 0x06, 0x90, 0xa8, 0xac, 0x51, 0x03, 0x10, 0x10, 0x81, 0x88, 0x33, 0x50, 0x85, + 0xab, 0xb9, 0x89, 0x73, 0x17, 0x98, 0x99, 0x28, 0xb0, 0x3a, 0x03, 0xdd, 0x89, 0x29, 0xd2, 0x9f, + 0x08, 0x28, 0x12, 0x88, 0x09, 0x90, 0x68, 0xb0, 0x89, 0x1a, 0x18, 0xf3, 0x3b, 0x81, 0x31, 0x16, + 0x0b, 0x94, 0x9c, 0x11, 0x80, 0x99, 0xba, 0xaf, 0x18, 0x03, 0x8c, 0xf9, 0x39, 0x91, 0xab, 0x34, + 0x41, 0x81, 0x48, 0x27, 0xa8, 0x00, 0x01, 0x38, 0x95, 0x1a, 0xa2, 0xaa, 0x9b, 0x52, 0xf8, 0x8e, + 0x12, 0xa1, 0xad, 0x08, 0x23, 0x98, 0x31, 0x80, 0x18, 0xb0, 0x0d, 0x02, 0x03, 0x79, 0x47, 0xb9, + 0x19, 0x83, 0x88, 0x00, 0x51, 0xc2, 0x8c, 0x88, 0x52, 0xc1, 0xad, 0x20, 0xa9, 0x1c, 0x43, 0x83, + 0xbd, 0x19, 0x03, 0x99, 0xa8, 0x1a, 0x34, 0xc2, 0x2b, 0xc9, 0x39, 0x35, 0x12, 0x12, 0xca, 0x08, + 0xbe, 0x98, 0x49, 0x82, 0x70, 0x35, 0xb8, 0xac, 0xba, 0x8a, 0x22, 0xb8, 0x3b, 0x82, 0x73, 0x05, + 0x00, 0xac, 0x41, 0x23, 0xb8, 0x31, 0x99, 0x34, 0xc2, 0xae, 0x89, 0xa0, 0x2b, 0x11, 0x12, 0x94, + 0x1a, 0x44, 0x81, 0x23, 0xcc, 0xac, 0x98, 0xbc, 0x32, 0x90, 0x9f, 0x81, 0xba, 0x63, 0x32, 0x22, + 0x37, 0xa9, 0x28, 0x02, 0xfa, 0x0a, 0x43, 0x01, 0xf9, 0x9b, 0x11, 0x88, 0x31, 0x33, 0xba, 0xfa, + 0xac, 0x09, 0xb1, 0x38, 0x15, 0xa8, 0x30, 0xc0, 0x28, 0xce, 0x41, 0x12, 0xa1, 0xeb, 0x2a, 0x14, + 0x00, 0x19, 0x14, 0xeb, 0x28, 0x13, 0x99, 0x30, 0xd9, 0x39, 0x24, 0xb9, 0xcd, 0x99, 0x20, 0x24, + 0xd8, 0x0a, 0x35, 0x12, 0x08, 0xd0, 0x0b, 0x90, 0xb9, 0x9b, 0x19, 0x27, 0x61, 0x92, 0x09, 0x9a, + 0x01, 0x30, 0x44, 0x22, 0xdb, 0xba, 0x18, 0xe9, 0x9a, 0xbd, 0x51, 0x02, 0x30, 0x92, 0x0a, 0x53, + 0xd9, 0xdb, 0x39, 0x91, 0x28, 0x03, 0x0b, 0xd2, 0x9e, 0x90, 0x00, 0x62, 0x02, 0x18, 0x81, 0x89, + 0x63, 0xb8, 0x8c, 0xaa, 0x11, 0x31, 0x14, 0xb0, 0x0a, 0x92, 0xdf, 0x09, 0xb8, 0x8b, 0x54, 0xa0, + 0x9a, 0xbb, 0x33, 0x20, 0x67, 0x81, 0x8a, 0x20, 0x90, 0x30, 0x11, 0xd0, 0x5a, 0x14, 0x88, 0x0a, + 0x43, 0xe9, 0x18, 0xca, 0x8a, 0x80, 0x20, 0x10, 0xc2, 0x8d, 0xb9, 0x10, 0x32, 0xf8, 0x5b, 0x14, + 0x10, 0x21, 0x91, 0x48, 0x83, 0x8b, 0xa0, 0x30, 0x08, 0xfa, 0x8f, 0x08, 0x81, 0xda, 0x9d, 0x10, + 0x11, 0xa8, 0x18, 0xba, 0x00, 0x63, 0x80, 0x13, 0x09, 0x99, 0x55, 0xd9, 0x31, 0x21, 0x03, 0x58, + 0x92, 0x19, 0xc8, 0xaf, 0xa9, 0x0b, 0x91, 0x0a, 0x81, 0x98, 0x3a, 0x37, 0x8a, 0x83, 0xf9, 0x2d, + 0x17, 0x98, 0x80, 0x9a, 0x30, 0x14, 0x91, 0xfb, 0x8a, 0x12, 0x18, 0x82, 0x73, 0x01, 0x18, 0x91, + 0xac, 0x28, 0xa1, 0x8b, 0x34, 0x05, 0xad, 0x31, 0x98, 0xa9, 0x9d, 0x29, 0xa3, 0x40, 0xf9, 0x9b, + 0x20, 0x14, 0x98, 0xbb, 0x60, 0x83, 0x18, 0xa9, 0x42, 0x34, 0x00, 0xd8, 0xac, 0x09, 0xa8, 0x70, + 0x14, 0xcc, 0x88, 0x98, 0x10, 0x81, 0x9b, 0xb9, 0xda, 0xaa, 0x9e, 0x62, 0x02, 0x32, 0x90, 0x01, + 0x89, 0xbc, 0x55, 0x31, 0x24, 0x02, 0xdb, 0x09, 0x88, 0x88, 0xcb, 0x99, 0x30, 0x90, 0x18, 0xbc, + 0x92, 0x74, 0xc3, 0x9a, 0x40, 0xa2, 0x21, 0xab, 0x35, 0x32, 0xf9, 0x0b, 0xda, 0x38, 0x13, 0x18, + 0x01, 0xb9, 0x0c, 0x27, 0xd8, 0xab, 0x51, 0x01, 0x00, 0x11, 0xba, 0x00, 0x99, 0x21, 0xb8, 0x6a, + 0x84, 0x1a, 0x32, 0xd0, 0xeb, 0x8d, 0x81, 0x8a, 0x91, 0x9a, 0x89, 0x41, 0x84, 0xad, 0x42, 0x84, + 0xbd, 0x20, 0xa8, 0x98, 0x20, 0x63, 0x83, 0x9c, 0x45, 0x81, 0xba, 0x9a, 0x01, 0x39, 0x15, 0xa0, + 0x88, 0x19, 0x26, 0xc8, 0x1b, 0x06, 0x0b, 0x33, 0x04, 0xca, 0x28, 0x98, 0x90, 0x99, 0x78, 0x16, + 0xba, 0x89, 0x00, 0x08, 0xc2, 0x9e, 0x00, 0x20, 0x01, 0x42, 0xb8, 0x0c, 0x84, 0x19, 0x08, 0xd8, + 0x40, 0xf0, 0x8c, 0x43, 0x90, 0x10, 0x23, 0xa9, 0x88, 0x0b, 0xb0, 0xcc, 0x18, 0xda, 0x12, 0x39, + 0xc3, 0xbe, 0x9b, 0x98, 0xbd, 0x0a, 0x43, 0xa8, 0x10, 0x21, 0x73, 0x57, 0x82, 0xaa, 0x10, 0x02, + 0x09, 0x81, 0x12, 0xcd, 0x20, 0x08, 0x90, 0xc9, 0x9c, 0xda, 0x1a, 0x34, 0xd9, 0x9c, 0x81, 0x52, + 0x00, 0x91, 0x18, 0xcb, 0x73, 0x02, 0x08, 0x32, 0x14, 0x18, 0x82, 0xab, 0x00, 0x42, 0xe8, 0x39, + 0x93, 0xbe, 0x30, 0x28, 0xd3, 0x9f, 0x89, 0x88, 0x98, 0xcc, 0xab, 0x51, 0x82, 0x98, 0x0a, 0x11, + 0x00, 0x88, 0x40, 0x06, 0xbc, 0x40, 0x03, 0xa8, 0x09, 0x31, 0x57, 0x82, 0x98, 0xba, 0x20, 0xa1, + 0x88, 0xeb, 0xaa, 0x19, 0x01, 0xa8, 0xbe, 0xbd, 0x39, 0x47, 0x23, 0x10, 0xfa, 0x8b, 0x01, 0x11, + 0x33, 0x83, 0xba, 0x1b, 0x44, 0x34, 0x90, 0xcb, 0x63, 0x00, 0x90, 0x9d, 0xaa, 0x20, 0x01, 0x00, + 0x99, 0xcf, 0x88, 0x89, 0x08, 0xb9, 0xbc, 0x71, 0x13, 0x80, 0x31, 0x33, 0xa1, 0x18, 0x24, 0x09, + 0x57, 0xa8, 0x88, 0xcb, 0x89, 0xb9, 0x88, 0xad, 0x19, 0x36, 0xc9, 0x9a, 0xbc, 0xbb, 0x50, 0x13, + 0x98, 0x32, 0xc9, 0x2a, 0x16, 0xaa, 0x30, 0x54, 0x25, 0xa0, 0xac, 0x20, 0x99, 0x01, 0x8b, 0x15, + 0x8d, 0x22, 0xa8, 0x1a, 0x47, 0xa0, 0x1a, 0xa1, 0x41, 0xc9, 0x00, 0xaa, 0x32, 0x80, 0x80, 0xbb, + 0x80, 0x9e, 0x35, 0x47, 0xd9, 0x99, 0x10, 0x88, 0x42, 0x82, 0x00, 0x98, 0xc8, 0x1b, 0xb1, 0x74, + 0x92, 0xcb, 0x9a, 0x89, 0x08, 0x82, 0x8d, 0x42, 0xb0, 0x0a, 0x23, 0x10, 0x50, 0x37, 0x80, 0x9a, + 0x91, 0x0d, 0xa1, 0x9c, 0x89, 0x80, 0x51, 0xea, 0x8a, 0x08, 0x72, 0x23, 0x00, 0xcc, 0xa9, 0x18, + 0xca, 0x18, 0x00, 0x31, 0x12, 0xe0, 0x3a, 0x93, 0x81, 0x98, 0x0b, 0x67, 0x10, 0x03, 0x9a, 0xbc, + 0x80, 0x72, 0x90, 0x12, 0xdb, 0x20, 0x32, 0xb2, 0xbe, 0x9a, 0x28, 0x45, 0xa1, 0x18, 0xda, 0x20, + 0x73, 0x12, 0x90, 0xab, 0x10, 0x42, 0x83, 0xcb, 0xaa, 0xaa, 0xad, 0x98, 0x51, 0xd9, 0x8a, 0xca, + 0x29, 0x04, 0x80, 0x18, 0xe2, 0x9e, 0x31, 0x25, 0x90, 0x9a, 0x00, 0x12, 0x40, 0x15, 0x11, 0xab, + 0x89, 0x74, 0xb0, 0xab, 0xab, 0x81, 0xae, 0x20, 0x12, 0x99, 0xea, 0x0a, 0x81, 0x88, 0x12, 0x58, + 0x16, 0x22, 0x98, 0x00, 0x01, 0x73, 0x07, 0x9a, 0x01, 0x11, 0xba, 0x9a, 0xdb, 0x0b, 0x92, 0x8c, + 0x28, 0xc3, 0x8f, 0x32, 0xa9, 0x23, 0x9d, 0x13, 0x22, 0xb9, 0x42, 0x08, 0x57, 0x01, 0xb9, 0x8a, + 0x01, 0xdb, 0x10, 0x99, 0x90, 0x10, 0xa0, 0x8a, 0x19, 0xa3, 0xbc, 0x0d, 0x27, 0xb8, 0x19, 0x81, + 0x88, 0x09, 0xf0, 0x0e, 0x12, 0x22, 0x13, 0xfc, 0x09, 0x44, 0xa1, 0x18, 0x91, 0x09, 0x01, 0x9b, + 0x67, 0x88, 0xc0, 0x8b, 0x00, 0x82, 0x21, 0x00, 0xd9, 0x9b, 0x89, 0xc8, 0x9e, 0x42, 0x81, 0x20, + 0x91, 0x49, 0xf2, 0x1a, 0x23, 0x91, 0x89, 0x41, 0x03, 0x32, 0xb0, 0x39, 0x07, 0xcd, 0x9a, 0x80, + 0x9a, 0x22, 0x8a, 0xd0, 0xec, 0x9c, 0x00, 0x81, 0x08, 0x32, 0x11, 0x90, 0x52, 0x88, 0x21, 0x50, + 0x57, 0x11, 0xb9, 0x19, 0x01, 0x73, 0x92, 0xa9, 0xaa, 0x88, 0x99, 0x00, 0xea, 0xbb, 0xbd, 0xaa, + 0x60, 0x14, 0xa9, 0x9a, 0x00, 0xb0, 0x8b, 0x56, 0x02, 0x21, 0x32, 0x83, 0x11, 0x30, 0x27, 0x80, + 0xa8, 0xcb, 0xdf, 0x19, 0x32, 0x80, 0xc9, 0x8c, 0x82, 0x19, 0x83, 0x18, 0x20, 0xb9, 0xd0, 0x9f, + 0x81, 0x60, 0x02, 0x28, 0xa1, 0xdb, 0x0b, 0x42, 0x82, 0x99, 0x80, 0xab, 0x15, 0xae, 0x63, 0x03, + 0xbc, 0xa8, 0x0a, 0x22, 0x21, 0x27, 0xb8, 0xdc, 0x1a, 0x01, 0x80, 0x89, 0x83, 0x8d, 0x91, 0x30, + 0xc0, 0x60, 0x22, 0x03, 0x10, 0xd9, 0x0a, 0x63, 0x03, 0xac, 0x20, 0x24, 0xa9, 0xab, 0xd8, 0x2a, + 0x02, 0xa8, 0xbb, 0xaf, 0x63, 0x81, 0x28, 0xe8, 0x09, 0x11, 0x10, 0x34, 0x91, 0xdc, 0x30, 0x10, + 0x43, 0xb0, 0xae, 0x18, 0x21, 0x8a, 0x64, 0x81, 0xcb, 0x9b, 0x88, 0x18, 0xf9, 0x8b, 0x22, 0xa1, + 0x8d, 0xa8, 0x52, 0x32, 0xb0, 0x8a, 0x43, 0x90, 0x32, 0x26, 0xaa, 0xdb, 0x38, 0x83, 0x42, 0x22, + 0xf0, 0x9d, 0x00, 0x99, 0x98, 0x8c, 0x42, 0x24, 0x01, 0x98, 0x8b, 0xc8, 0x51, 0xc9, 0x59, 0x14, + 0x11, 0xa8, 0xaa, 0x39, 0x26, 0x12, 0x9a, 0x9a, 0xc0, 0x9b, 0xaa, 0xd8, 0x8b, 0x80, 0xde, 0x28, + 0x43, 0x20, 0x94, 0x1b, 0x14, 0x08, 0xc8, 0x29, 0x82, 0xba, 0x4a, 0x37, 0x90, 0xb9, 0x9e, 0x99, + 0x20, 0x13, 0xe9, 0x09, 0xbc, 0xa9, 0x49, 0xa1, 0x20, 0xba, 0x08, 0x55, 0x33, 0xb1, 0x0b, 0x09, + 0x41, 0x06, 0x09, 0x25, 0x00, 0x99, 0xcb, 0x40, 0x81, 0x08, 0x56, 0x90, 0xaa, 0xbb, 0xcc, 0x0a, + 0x42, 0x34, 0x92, 0x8b, 0x01, 0x2a, 0x27, 0xba, 0x99, 0xc0, 0x1a, 0x12, 0x15, 0xbd, 0x30, 0x24, + 0x20, 0xa8, 0xa0, 0xbc, 0x1a, 0x37, 0x12, 0x10, 0xd1, 0xae, 0x99, 0x01, 0xab, 0xa9, 0x08, 0x70, + 0xd1, 0x0a, 0xa1, 0x28, 0x02, 0x28, 0x77, 0x84, 0x90, 0x9b, 0x98, 0x31, 0x22, 0x90, 0xaa, 0x55, + 0x81, 0xdd, 0x09, 0x10, 0x10, 0x90, 0xda, 0x8d, 0x11, 0x80, 0x0b, 0xa0, 0x2b, 0x27, 0x23, 0x90, + 0xbb, 0x01, 0x10, 0x30, 0x24, 0x13, 0x70, 0x04, 0x88, 0xbb, 0x18, 0x3a, 0xd3, 0x8c, 0xec, 0x09, + 0x21, 0xa0, 0xcc, 0x09, 0xb8, 0x18, 0x34, 0xfb, 0x0a, 0x40, 0x82, 0x20, 0x51, 0x27, 0x82, 0xb9, + 0x18, 0x43, 0x90, 0x0a, 0xd0, 0x8c, 0x20, 0xb0, 0x28, 0xb8, 0xac, 0xb9, 0x8d, 0x00, 0xc9, 0x9a, + 0x8a, 0x90, 0x41, 0x21, 0x34, 0x77, 0x98, 0x98, 0x29, 0x24, 0x23, 0x34, 0x90, 0xab, 0x90, 0x1b, + 0xf0, 0xaf, 0x00, 0x01, 0x31, 0x94, 0xbc, 0xac, 0x18, 0x23, 0x98, 0xca, 0x8a, 0x0a, 0x37, 0xc9, + 0x2a, 0x26, 0x02, 0x00, 0xba, 0x10, 0xb9, 0xa9, 0xd8, 0x8c, 0x21, 0x81, 0x2b, 0x67, 0x81, 0x18, + 0x98, 0x21, 0x00, 0xa9, 0xec, 0x29, 0xb2, 0xbf, 0x08, 0x42, 0x12, 0x90, 0x89, 0x63, 0x02, 0x43, + 0x80, 0xcb, 0x09, 0xc0, 0x1b, 0x91, 0x89, 0xbd, 0x28, 0x74, 0xa2, 0x9a, 0x9a, 0x34, 0x21, 0xb9, + 0x19, 0xcc, 0x63, 0xb0, 0x9f, 0x10, 0x80, 0x09, 0x11, 0x00, 0xba, 0x72, 0xa1, 0x18, 0x42, 0x91, + 0xb9, 0x9e, 0x13, 0x89, 0xa8, 0x58, 0x14, 0x90, 0xdf, 0x01, 0x00, 0x00, 0x91, 0xae, 0x08, 0x20, + 0x12, 0x00, 0x51, 0x14, 0xc8, 0x39, 0x24, 0xc9, 0xae, 0x99, 0x19, 0x11, 0x31, 0x02, 0x98, 0x79, + 0xa2, 0x09, 0xa9, 0x99, 0x08, 0x53, 0x73, 0x04, 0x98, 0xae, 0x31, 0x01, 0xc9, 0x40, 0x92, 0xa8, + 0x19, 0x90, 0x20, 0x22, 0x26, 0x88, 0xba, 0x8c, 0xe1, 0x0b, 0x54, 0xa2, 0x8d, 0x08, 0x81, 0x29, + 0x08, 0xf9, 0xbc, 0x18, 0x98, 0x73, 0x02, 0xba, 0xba, 0x20, 0x90, 0xba, 0x10, 0x41, 0x05, 0x63, + 0x91, 0x29, 0x24, 0x90, 0x8a, 0x34, 0xf8, 0x0b, 0x92, 0xba, 0x1a, 0x91, 0x12, 0x5b, 0xb4, 0x9d, + 0x8b, 0x13, 0x29, 0x16, 0x88, 0xeb, 0x29, 0x64, 0x02, 0x80, 0xaa, 0x98, 0x11, 0x72, 0x04, 0x99, + 0x08, 0x09, 0x01, 0xeb, 0x88, 0x0a, 0x04, 0xab, 0x89, 0xb8, 0x38, 0x03, 0xf9, 0x1c, 0x82, 0x73, + 0x12, 0xcb, 0xaa, 0x88, 0x51, 0xc1, 0x0a, 0x32, 0xb8, 0xa9, 0x0e, 0x36, 0x03, 0x10, 0x91, 0xa9, + 0x09, 0xfb, 0xcb, 0xab, 0x18, 0x88, 0x31, 0x22, 0x53, 0xfa, 0x9f, 0x10, 0x12, 0x81, 0x00, 0x20, + 0x35, 0x12, 0x80, 0xbb, 0x58, 0x83, 0x89, 0xad, 0x08, 0x91, 0xbf, 0x11, 0x11, 0xb8, 0xaa, 0x52, + 0x02, 0xd9, 0x9b, 0x53, 0xd8, 0x58, 0x15, 0x98, 0x89, 0x98, 0x29, 0x93, 0x0a, 0x32, 0xf9, 0x3b, + 0x17, 0xa1, 0x89, 0x11, 0xa0, 0xcf, 0x20, 0x43, 0x91, 0xea, 0x9b, 0x01, 0x11, 0x82, 0xb9, 0x9c, + 0x88, 0x41, 0xc0, 0x49, 0x02, 0x13, 0x73, 0x02, 0x00, 0xa8, 0x29, 0xfa, 0x0c, 0x30, 0x81, 0x90, + 0xce, 0x19, 0x01, 0x18, 0x98, 0xa8, 0xae, 0x09, 0x98, 0x30, 0x40, 0x15, 0x18, 0xa1, 0x50, 0x25, + 0x80, 0xa8, 0x72, 0xb0, 0xcb, 0x1a, 0x35, 0xa0, 0x42, 0xc9, 0x8a, 0x89, 0x51, 0x14, 0x80, 0xcc, + 0x88, 0x21, 0x00, 0xca, 0x28, 0x12, 0x23, 0x30, 0x37, 0xca, 0x9a, 0x20, 0xb0, 0x30, 0x90, 0xba, + 0xaa, 0xcf, 0xad, 0x80, 0x2b, 0x05, 0xca, 0x29, 0xd0, 0xab, 0x0a, 0x01, 0x19, 0x92, 0x73, 0x17, + 0x00, 0xab, 0x31, 0x42, 0x26, 0x90, 0x89, 0x00, 0x32, 0x00, 0xc8, 0xbb, 0x0a, 0x98, 0xf9, 0x8e, + 0x11, 0xa9, 0x89, 0x91, 0x09, 0xb8, 0xfb, 0x1b, 0x37, 0x23, 0xc8, 0x09, 0x41, 0x82, 0x80, 0x22, + 0x31, 0x15, 0x21, 0xd0, 0x9e, 0x01, 0xcb, 0x89, 0xaa, 0x52, 0x16, 0xc9, 0x9a, 0xcb, 0x19, 0x02, + 0x11, 0x24, 0x90, 0x29, 0xb0, 0x89, 0x72, 0x84, 0x22, 0x72, 0x82, 0xa9, 0xab, 0x9b, 0x01, 0xdb, + 0x08, 0x00, 0x24, 0xca, 0xad, 0xba, 0x51, 0xdb, 0x20, 0x11, 0x44, 0xc0, 0x19, 0x02, 0x31, 0x23, + 0xd0, 0x9d, 0x50, 0x13, 0xca, 0x18, 0xa8, 0x29, 0xa3, 0xad, 0x9a, 0x10, 0x20, 0x02, 0x37, 0xbb, + 0x22, 0xa8, 0x90, 0x9f, 0x00, 0x38, 0x77, 0x82, 0x9a, 0xa9, 0x30, 0x92, 0x9b, 0x13, 0xeb, 0xac, + 0x9a, 0x53, 0x80, 0x20, 0xc9, 0x8a, 0x31, 0x24, 0x42, 0x02, 0xb9, 0xaf, 0x80, 0x39, 0x13, 0xd9, + 0xbd, 0xbb, 0x99, 0x73, 0x15, 0x08, 0x00, 0x02, 0x98, 0x88, 0x0a, 0x27, 0xb8, 0x6a, 0x04, 0x09, + 0xa1, 0x0a, 0x33, 0xb1, 0xaf, 0xaa, 0xcb, 0x28, 0x03, 0xfa, 0xaa, 0xbb, 0x31, 0x32, 0x27, 0x00, + 0xa0, 0x9b, 0x70, 0x24, 0x02, 0x90, 0xbb, 0x11, 0x48, 0x83, 0x9a, 0x62, 0xd8, 0xbd, 0x8a, 0x14, + 0xb0, 0x9b, 0x22, 0x81, 0xb0, 0x20, 0xbd, 0x54, 0x10, 0x23, 0x32, 0x81, 0x53, 0x21, 0xda, 0x48, + 0x27, 0xa8, 0x89, 0xa8, 0xbe, 0x89, 0x18, 0xa1, 0xad, 0x42, 0x02, 0xa9, 0xb9, 0xac, 0xb8, 0x79, + 0x92, 0xb9, 0x48, 0x25, 0x20, 0xc0, 0x0b, 0x61, 0x15, 0x81, 0x08, 0x80, 0xaa, 0x8b, 0x11, 0x03, + 0xcf, 0x08, 0x81, 0xa8, 0xbc, 0x8a, 0xd8, 0x8a, 0xaa, 0x29, 0x47, 0x12, 0xb0, 0xac, 0x0b, 0x46, + 0x81, 0x18, 0x12, 0x31, 0xa0, 0x1a, 0x17, 0xca, 0x18, 0x41, 0x14, 0xbb, 0xac, 0x98, 0xaf, 0x12, + 0xba, 0x08, 0x42, 0x02, 0x00, 0xec, 0x29, 0x02, 0x08, 0x21, 0x33, 0x52, 0x13, 0x24, 0xcc, 0x89, + 0x51, 0x33, 0x91, 0x0b, 0x26, 0x90, 0xba, 0xbf, 0x00, 0x88, 0x89, 0x88, 0xbd, 0xac, 0xb9, 0x8c, + 0x93, 0x8c, 0x82, 0xbb, 0x61, 0x82, 0xbc, 0x1a, 0x66, 0x24, 0x00, 0x01, 0x99, 0x31, 0xa2, 0x0b, + 0x12, 0xb9, 0x88, 0xbd, 0x08, 0xb1, 0x0b, 0x81, 0xff, 0xaa, 0x99, 0x9b, 0xa8, 0xbc, 0x0b, 0x45, + 0x45, 0x12, 0x11, 0x10, 0x12, 0x12, 0x79, 0x34, 0x82, 0x8a, 0xea, 0xac, 0x08, 0x9a, 0x30, 0x82, + 0xa9, 0xab, 0xb8, 0xbf, 0x11, 0xe9, 0x89, 0x9a, 0x31, 0x36, 0x33, 0x32, 0x02, 0x80, 0x2a, 0x04, + 0x19, 0x23, 0xef, 0x89, 0x38, 0x23, 0x31, 0xfc, 0x1e, 0x12, 0x80, 0xa9, 0xca, 0x9b, 0x21, 0xb1, + 0x9e, 0x98, 0x41, 0x14, 0x99, 0xa9, 0x9b, 0x71, 0x17, 0xa8, 0x99, 0x90, 0x30, 0x04, 0x00, 0x19, + 0x04, 0x08, 0xa8, 0x88, 0x80, 0x51, 0xc8, 0x89, 0xdb, 0x2a, 0x17, 0xd9, 0x8b, 0x81, 0x18, 0x21, + 0x02, 0xa0, 0x8c, 0x03, 0x2a, 0x37, 0x00, 0x55, 0x33, 0x01, 0xca, 0x8a, 0x00, 0x12, 0xae, 0x88, + 0x19, 0x81, 0xf8, 0x0d, 0xa9, 0xba, 0x40, 0x02, 0xb8, 0x8d, 0x80, 0xa9, 0x28, 0x12, 0x45, 0x02, + 0xa9, 0x81, 0x1e, 0x47, 0x13, 0x18, 0x91, 0xba, 0xae, 0x8a, 0x21, 0xa8, 0xbe, 0xb9, 0x28, 0x04, + 0x99, 0x31, 0xb8, 0x0c, 0x35, 0x21, 0x14, 0x90, 0xac, 0x91, 0x0c, 0x61, 0x04, 0x8a, 0x12, 0xbc, + 0x20, 0x63, 0x13, 0xba, 0xab, 0x2b, 0x27, 0xab, 0x99, 0xc9, 0x20, 0x1a, 0x47, 0x42, 0xa0, 0x99, + 0x8a, 0x21, 0xa1, 0x1b, 0x04, 0x89, 0x35, 0xda, 0x09, 0x13, 0x0b, 0xf9, 0x2c, 0x13, 0x29, 0x02, + 0x00, 0x9b, 0xc8, 0x4b, 0xc2, 0x9b, 0x60, 0x93, 0xfa, 0x9f, 0x00, 0x31, 0x02, 0xbb, 0xcb, 0x9b, + 0x18, 0x33, 0xca, 0x00, 0x29, 0xf1, 0x3a, 0x15, 0xca, 0x0a, 0x80, 0x73, 0x85, 0x18, 0x22, 0x90, + 0x00, 0x10, 0x23, 0xcd, 0xa9, 0x9d, 0x41, 0x02, 0xe9, 0x8b, 0x11, 0x99, 0x80, 0x9a, 0x08, 0x64, + 0x23, 0xc9, 0x48, 0x33, 0x02, 0x32, 0x14, 0xab, 0x18, 0x27, 0xda, 0xac, 0xb0, 0x2a, 0x93, 0x28, + 0x14, 0x10, 0xb0, 0xcd, 0x99, 0xbb, 0x40, 0x13, 0x08, 0x01, 0x80, 0x30, 0xfb, 0xff, 0x09, 0x88, + 0x21, 0x43, 0x90, 0x20, 0x13, 0xd8, 0x2b, 0x83, 0xdc, 0x29, 0x12, 0x32, 0xa1, 0x8e, 0x90, 0x9b, + 0x01, 0xec, 0xbc, 0x89, 0x00, 0x21, 0xb9, 0x70, 0x25, 0x01, 0x80, 0x18, 0x43, 0x08, 0x82, 0x39, + 0x33, 0x25, 0x08, 0x00, 0xa8, 0xbb, 0x39, 0xa3, 0x9f, 0x93, 0xcf, 0xbb, 0x08, 0xbb, 0xa0, 0x3a, + 0xf2, 0x9a, 0x1a, 0x83, 0x70, 0x36, 0x10, 0x90, 0x89, 0x73, 0x12, 0xb1, 0x8b, 0xea, 0x08, 0x98, + 0x29, 0xb2, 0xed, 0x2a, 0x02, 0x41, 0x02, 0xa9, 0x99, 0xcf, 0x8a, 0x91, 0x20, 0x00, 0xc9, 0x38, + 0x32, 0x37, 0xa0, 0x59, 0x24, 0x91, 0x9a, 0x99, 0xbb, 0xac, 0xbd, 0x98, 0x98, 0x8b, 0x24, 0x15, + 0xbb, 0x11, 0x61, 0x23, 0x11, 0x10, 0x92, 0x4a, 0x22, 0x47, 0x18, 0x99, 0x45, 0x91, 0x40, 0x13, + 0xdb, 0xad, 0x9a, 0x40, 0x80, 0x88, 0x48, 0x02, 0x88, 0xc9, 0xac, 0x10, 0x98, 0x33, 0x74, 0x82, + 0xb9, 0x5a, 0x83, 0xb9, 0xad, 0xcc, 0x18, 0x12, 0x80, 0xcf, 0x89, 0x08, 0x11, 0x82, 0x0b, 0x34, + 0x91, 0xca, 0x9b, 0x35, 0x33, 0x81, 0x90, 0xbd, 0x19, 0x25, 0xa2, 0x0d, 0x24, 0x28, 0x93, 0xcd, + 0x1a, 0x10, 0x20, 0x46, 0x01, 0x32, 0x05, 0xbc, 0x99, 0x33, 0x11, 0xd0, 0xac, 0x8c, 0x24, 0xa0, + 0xbc, 0x19, 0xa0, 0x8c, 0x23, 0xa8, 0x1a, 0x47, 0x00, 0x42, 0xd0, 0x8b, 0x53, 0x10, 0x02, 0xb0, + 0x9d, 0x90, 0x18, 0x01, 0xea, 0xaa, 0x88, 0xc9, 0x8c, 0x43, 0xd8, 0x9a, 0x22, 0x81, 0x19, 0x36, + 0x00, 0x12, 0x82, 0x1a, 0xa1, 0x32, 0xfc, 0x8f, 0x01, 0x00, 0x08, 0x88, 0x82, 0x8b, 0x9a, 0x91, + 0xff, 0x1a, 0x83, 0x89, 0x30, 0x82, 0x61, 0x34, 0xa0, 0xbc, 0x70, 0x82, 0x08, 0x02, 0x09, 0x83, + 0x9d, 0x30, 0x92, 0x3a, 0x90, 0x9a, 0x32, 0xfb, 0x5b, 0x83, 0x9b, 0x62, 0xa1, 0x1b, 0x03, 0xcf, + 0x8b, 0x31, 0x11, 0x81, 0xcc, 0x2b, 0x95, 0x9b, 0x33, 0x23, 0x83, 0xaf, 0x00, 0xcd, 0x9b, 0x30, + 0x02, 0x81, 0x19, 0x22, 0xfc, 0x3a, 0x15, 0xa1, 0xab, 0xbb, 0x18, 0x00, 0x75, 0x82, 0x31, 0xa9, + 0x28, 0x27, 0xb8, 0xab, 0x89, 0x88, 0x80, 0x22, 0x99, 0x38, 0x37, 0xc8, 0x18, 0x14, 0x08, 0xff, + 0x19, 0x32, 0x90, 0x31, 0xa1, 0x0a, 0xfa, 0x9a, 0x11, 0x30, 0x27, 0x80, 0xb8, 0xae, 0x08, 0x22, + 0x99, 0x31, 0x13, 0x50, 0x13, 0x91, 0xb9, 0x9d, 0x25, 0xb8, 0x9d, 0xba, 0x38, 0x02, 0x22, 0x45, + 0xd1, 0xae, 0x9a, 0x08, 0x00, 0x42, 0x02, 0x10, 0xa0, 0x9d, 0x91, 0x18, 0x98, 0x21, 0xf8, 0xbc, + 0x1b, 0xb9, 0x11, 0xad, 0x99, 0x63, 0x81, 0x63, 0x81, 0x19, 0x16, 0x08, 0xb8, 0x61, 0x01, 0x01, + 0x11, 0x11, 0x02, 0xfa, 0xaa, 0xbb, 0x53, 0x81, 0x9a, 0xaa, 0x89, 0x9b, 0x30, 0x16, 0x51, 0x02, + 0x52, 0x22, 0x01, 0x24, 0xbb, 0x10, 0x40, 0x13, 0x38, 0xb2, 0xff, 0x39, 0xa3, 0xac, 0xeb, 0x09, + 0x02, 0xb9, 0xab, 0xc9, 0x0b, 0x14, 0xdf, 0x09, 0x80, 0x30, 0x82, 0x10, 0xb8, 0xac, 0x72, 0x37, + 0x02, 0x99, 0x00, 0x98, 0x20, 0xa1, 0xbd, 0xbb, 0x1a, 0x23, 0x01, 0xcf, 0xb9, 0x0b, 0xeb, 0x39, + 0x26, 0xb8, 0xbb, 0x09, 0x28, 0x35, 0x51, 0x13, 0x08, 0x31, 0x81, 0x22, 0x51, 0x02, 0xb8, 0x39, + 0xda, 0xa9, 0xac, 0x74, 0x81, 0x30, 0x81, 0x19, 0xf0, 0x1a, 0x18, 0x23, 0xb8, 0xdc, 0x2a, 0x23, + 0xb2, 0x4a, 0x01, 0x67, 0x80, 0xa9, 0x9b, 0x09, 0x24, 0x08, 0x91, 0xbe, 0x0a, 0x80, 0xaa, 0xb8, + 0xcf, 0x20, 0x01, 0xd9, 0xcb, 0x1a, 0x33, 0x20, 0xa2, 0xae, 0x8a, 0x44, 0x81, 0x89, 0xd9, 0x1a, + 0x33, 0x45, 0x00, 0x18, 0xc8, 0x18, 0x01, 0x02, 0xeb, 0xab, 0x39, 0x37, 0x21, 0xa1, 0x9c, 0xab, + 0x38, 0x92, 0x78, 0xa2, 0xaa, 0x0a, 0xe0, 0x0a, 0x21, 0x22, 0x43, 0x33, 0x15, 0x60, 0x14, 0x18, + 0x22, 0x12, 0x11, 0xcb, 0xbc, 0x39, 0x92, 0xdc, 0xaa, 0x9a, 0x02, 0xdc, 0x8c, 0x41, 0x01, 0x11, + 0x81, 0xac, 0xa9, 0x70, 0x22, 0x24, 0x01, 0xfb, 0x9b, 0xa8, 0x19, 0x42, 0xc0, 0xac, 0xaa, 0xac, + 0x08, 0x34, 0xb8, 0x2a, 0x33, 0xd1, 0xae, 0x11, 0x11, 0x01, 0x00, 0xfc, 0x9c, 0x10, 0xa9, 0x9a, + 0x63, 0x14, 0x88, 0x31, 0x93, 0x0c, 0x81, 0x41, 0x11, 0x82, 0x41, 0x28, 0x95, 0xac, 0xbb, 0x72, + 0x15, 0x88, 0x08, 0x12, 0xc8, 0x89, 0x39, 0x37, 0x00, 0x80, 0x81, 0x40, 0x02, 0x93, 0xcf, 0x88, + 0x98, 0x9a, 0x9b, 0x13, 0x8a, 0xf0, 0x9c, 0x99, 0x9a, 0x09, 0x44, 0x33, 0xc0, 0xbd, 0x28, 0x43, + 0x32, 0x26, 0x80, 0xda, 0xa9, 0x09, 0x23, 0xda, 0xbb, 0xbb, 0x2a, 0x37, 0x00, 0xb9, 0x1c, 0x03, + 0xd9, 0xad, 0x00, 0x21, 0x89, 0x13, 0x48, 0x15, 0x98, 0x09, 0x36, 0xb0, 0x19, 0x43, 0x08, 0x27, + 0x98, 0xdb, 0x09, 0x18, 0x02, 0xa9, 0x99, 0x60, 0xb2, 0x8d, 0x31, 0xa1, 0x30, 0x99, 0xb9, 0x73, + 0x26, 0x01, 0x20, 0xc1, 0xad, 0x21, 0x25, 0x12, 0x21, 0xa8, 0x8a, 0x08, 0xfa, 0x9d, 0x99, 0xab, + 0x80, 0x9b, 0xa1, 0xbf, 0x9b, 0x32, 0xdb, 0x38, 0x81, 0x22, 0x38, 0xa3, 0xad, 0x49, 0x47, 0x11, + 0xba, 0x73, 0x14, 0x00, 0x88, 0xbb, 0x81, 0xbc, 0x28, 0x82, 0xb9, 0x1b, 0x96, 0x98, 0xbe, 0x91, + 0xbc, 0x00, 0x11, 0x88, 0x91, 0x2b, 0x35, 0x27, 0xa9, 0x22, 0x25, 0x01, 0x22, 0x91, 0x00, 0x1a, + 0xd3, 0x0e, 0x42, 0xa1, 0x0c, 0xb2, 0xac, 0xac, 0xa9, 0x09, 0x03, 0xdd, 0x1a, 0x63, 0x83, 0xa9, + 0x0b, 0x24, 0x24, 0x10, 0x88, 0x19, 0x14, 0x29, 0x57, 0x12, 0xdd, 0x09, 0x31, 0x12, 0x08, 0xa8, + 0x9b, 0x33, 0xfb, 0x88, 0x88, 0xcb, 0x39, 0xd1, 0xbd, 0x8d, 0x11, 0x21, 0xca, 0x8c, 0x32, 0x23, + 0x20, 0x47, 0x81, 0xaa, 0x08, 0x20, 0x83, 0x1b, 0x34, 0xe9, 0xaa, 0xdb, 0x19, 0x10, 0xa3, 0xbf, + 0x9a, 0x53, 0x23, 0xa8, 0xca, 0x0b, 0x02, 0x20, 0x10, 0x27, 0xba, 0x48, 0x24, 0x90, 0xad, 0x10, + 0x41, 0x02, 0x54, 0x12, 0xb9, 0x19, 0xa8, 0xed, 0x9b, 0x30, 0x24, 0x00, 0x99, 0xc9, 0x99, 0x88, + 0x01, 0xdb, 0x30, 0x30, 0x47, 0x81, 0x41, 0x33, 0x02, 0x00, 0x81, 0xaa, 0xef, 0x0a, 0xa0, 0x8b, + 0x08, 0xc8, 0x8c, 0x99, 0xda, 0x4b, 0x24, 0xa0, 0x89, 0x11, 0x32, 0xc1, 0x9b, 0x89, 0x61, 0xa3, + 0xaf, 0x12, 0x10, 0x23, 0x44, 0xb8, 0xbc, 0x09, 0xb9, 0x64, 0x01, 0xa9, 0x58, 0xd0, 0x9a, 0x19, + 0x02, 0x31, 0x02, 0x90, 0x1b, 0x27, 0x23, 0x99, 0xa9, 0x4b, 0x47, 0x80, 0xaa, 0x29, 0x04, 0xcd, + 0x0b, 0x22, 0x10, 0xb9, 0x3a, 0x16, 0x02, 0x31, 0xd0, 0x8b, 0xb8, 0x89, 0xfb, 0x0a, 0x83, 0x8b, + 0xf8, 0x3a, 0x83, 0x70, 0x01, 0xa0, 0xad, 0x8a, 0x12, 0x8a, 0x47, 0x82, 0x89, 0x10, 0x53, 0x82, + 0xbd, 0x8a, 0x01, 0x18, 0x21, 0x02, 0xfa, 0x8f, 0x81, 0x99, 0xa9, 0x2a, 0x14, 0x88, 0x88, 0x9a, + 0x43, 0x91, 0x59, 0x16, 0xb9, 0x19, 0x53, 0x15, 0x99, 0x91, 0xcd, 0x38, 0x01, 0xa8, 0x30, 0x25, + 0x90, 0xba, 0xbb, 0x50, 0x02, 0xdc, 0x8c, 0x10, 0x01, 0xa9, 0x21, 0x23, 0x21, 0xa8, 0x73, 0x06, + 0x09, 0x13, 0x19, 0x25, 0x36, 0x01, 0xca, 0xaa, 0x09, 0x10, 0xeb, 0x08, 0xa8, 0xce, 0x8a, 0xaa, + 0x80, 0x28, 0x80, 0xb8, 0x8d, 0x13, 0x9b, 0x47, 0xa1, 0x09, 0x84, 0x1b, 0x26, 0x90, 0x18, 0x01, + 0x33, 0x82, 0x6b, 0x07, 0x99, 0x89, 0xb9, 0x8a, 0x20, 0xa0, 0xdf, 0x9c, 0x21, 0x03, 0x0a, 0xb1, + 0x8a, 0x09, 0x53, 0x04, 0x19, 0x24, 0x23, 0xfb, 0x19, 0x81, 0xa9, 0x72, 0x15, 0x01, 0xa0, 0xaa, + 0x39, 0x27, 0x90, 0xab, 0x08, 0x00, 0xdb, 0x08, 0x12, 0xa8, 0xea, 0x0a, 0x98, 0xa8, 0xce, 0xaa, + 0x20, 0x35, 0xa2, 0x19, 0x55, 0xb0, 0x48, 0x03, 0x10, 0x91, 0x9b, 0x54, 0x21, 0x06, 0xab, 0xbb, + 0x9c, 0x01, 0xac, 0x88, 0x99, 0x19, 0xe0, 0xae, 0x8a, 0x43, 0xa1, 0x18, 0x35, 0xc8, 0x9b, 0x10, + 0x10, 0x44, 0x32, 0x92, 0x19, 0xb0, 0x1b, 0x81, 0xcc, 0x21, 0xac, 0x74, 0x13, 0x9a, 0xb9, 0x4a, + 0x26, 0xa0, 0xab, 0x1a, 0x47, 0x80, 0xa8, 0xbc, 0xab, 0x30, 0x43, 0x81, 0xfb, 0x8a, 0x21, 0x11, + 0x02, 0xba, 0x0a, 0x33, 0x77, 0x04, 0x88, 0x80, 0x99, 0x8a, 0x02, 0x61, 0x13, 0xe9, 0x8a, 0x98, + 0x80, 0xa9, 0xbb, 0xa8, 0xbd, 0x0a, 0x75, 0x83, 0x89, 0x88, 0x82, 0xbc, 0xdc, 0x39, 0x34, 0x23, + 0x08, 0xb0, 0x1c, 0xd8, 0x28, 0x12, 0x91, 0x19, 0x51, 0x15, 0xa9, 0x19, 0xf9, 0x0b, 0x12, 0x91, + 0x9e, 0x10, 0xa0, 0xbe, 0x1a, 0x01, 0x11, 0x98, 0xc8, 0x48, 0x13, 0x73, 0x81, 0xca, 0x19, 0x33, + 0x10, 0x35, 0xb9, 0x38, 0x03, 0x10, 0x37, 0x92, 0xce, 0x09, 0x12, 0x88, 0x88, 0x99, 0x0b, 0x27, + 0x99, 0xd0, 0xad, 0x09, 0xb0, 0x18, 0x83, 0xcf, 0x28, 0x32, 0x12, 0x91, 0xab, 0x29, 0x77, 0x04, + 0xa8, 0x09, 0x11, 0x32, 0xa1, 0x1b, 0xc1, 0x9a, 0x8a, 0x14, 0xde, 0x99, 0xa8, 0xa9, 0x08, 0xd9, + 0x9c, 0x21, 0x82, 0x9a, 0x65, 0x12, 0x81, 0xba, 0x08, 0x11, 0x54, 0x24, 0x81, 0x80, 0x29, 0x37, + 0x98, 0xaa, 0x0a, 0x88, 0xfa, 0x9d, 0x99, 0x9b, 0x30, 0xb1, 0xbd, 0x09, 0x30, 0x26, 0x81, 0x89, + 0x20, 0x11, 0x55, 0x13, 0x10, 0xc8, 0x72, 0x84, 0x8a, 0xb9, 0x09, 0x31, 0x27, 0xba, 0x89, 0xba, + 0x89, 0x99, 0x90, 0xb9, 0xab, 0xbc, 0x76, 0x82, 0x99, 0x00, 0x89, 0x43, 0x01, 0x9a, 0x24, 0x38, + 0x36, 0x05, 0x9a, 0x02, 0xba, 0x99, 0x58, 0x14, 0x89, 0xea, 0xac, 0x28, 0x91, 0x08, 0x91, 0xae, + 0x8a, 0xbb, 0x0a, 0x91, 0xcf, 0xbc, 0x38, 0x24, 0x11, 0x01, 0x98, 0x30, 0x25, 0x53, 0x34, 0x90, + 0x11, 0xfc, 0x18, 0xb0, 0x9d, 0x18, 0x98, 0x11, 0x9b, 0x88, 0xaa, 0xdb, 0x0b, 0x37, 0x01, 0x28, + 0x33, 0x28, 0x33, 0x64, 0x03, 0x18, 0x43, 0x35, 0x03, 0xbe, 0x28, 0x45, 0xb1, 0x8a, 0x19, 0xc8, + 0x0b, 0x82, 0x9a, 0xf9, 0x9e, 0x01, 0xa8, 0x09, 0x11, 0x04, 0x89, 0x11, 0x41, 0x82, 0x48, 0x35, + 0x83, 0xad, 0xbb, 0x31, 0x02, 0x8b, 0x27, 0x01, 0x98, 0xb9, 0xdf, 0x9a, 0xaa, 0xcb, 0xdb, 0x89, + 0x30, 0x15, 0x98, 0x88, 0xa0, 0x68, 0x25, 0x81, 0x08, 0xa9, 0x51, 0x23, 0x12, 0xaa, 0xc9, 0x9c, + 0x41, 0x25, 0xc9, 0x0a, 0x23, 0xc9, 0x9b, 0x29, 0x82, 0xaa, 0x10, 0x09, 0x64, 0x16, 0xda, 0x18, + 0x24, 0x80, 0x08, 0x10, 0x42, 0x23, 0xa9, 0x00, 0xab, 0xa0, 0xdc, 0x8e, 0x24, 0x10, 0xb2, 0xbf, + 0x1a, 0x02, 0x08, 0xb9, 0x9d, 0x01, 0xb8, 0xae, 0x72, 0xa0, 0x0a, 0x01, 0x99, 0x08, 0x21, 0x41, + 0x93, 0xd9, 0x1b, 0x47, 0xb0, 0x9c, 0x11, 0x21, 0x23, 0xda, 0x88, 0xbd, 0x48, 0x14, 0x12, 0xda, + 0x9a, 0x99, 0x28, 0xa8, 0x33, 0xc9, 0x48, 0x92, 0x2b, 0x16, 0x53, 0x82, 0xda, 0x8a, 0x31, 0xa1, + 0x49, 0x15, 0x9a, 0x10, 0x13, 0x11, 0x09, 0xd1, 0x79, 0x14, 0x11, 0xc9, 0xbb, 0x9c, 0x64, 0x92, + 0xbb, 0x18, 0x01, 0xd9, 0x8b, 0x98, 0x29, 0x37, 0x32, 0x25, 0x99, 0xbc, 0x8a, 0x20, 0x16, 0xba, + 0x9a, 0xbc, 0x0b, 0x01, 0x18, 0xf0, 0xad, 0x89, 0x10, 0x12, 0x41, 0xd1, 0x9c, 0x31, 0x45, 0x12, + 0xba, 0xb9, 0x19, 0x11, 0x12, 0x91, 0x8d, 0xc9, 0x38, 0xb0, 0xcb, 0x60, 0x84, 0x0a, 0x80, 0x30, + 0x42, 0x12, 0x33, 0x92, 0x59, 0x27, 0x20, 0x12, 0x89, 0x00, 0x11, 0xa0, 0xed, 0x0a, 0x20, 0x65, + 0x12, 0xcb, 0xbb, 0x20, 0x21, 0x03, 0xcd, 0x89, 0x89, 0x89, 0x91, 0x9c, 0xc9, 0x38, 0x05, 0x0b, + 0x16, 0x90, 0x1b, 0x47, 0x02, 0xeb, 0x99, 0x99, 0x99, 0x09, 0x42, 0xd8, 0x9b, 0x98, 0x1a, 0x23, + 0x54, 0x92, 0x30, 0x13, 0xac, 0x11, 0xdb, 0xcb, 0x19, 0xaa, 0x18, 0x33, 0xb9, 0xfb, 0x1a, 0x02, + 0xbb, 0xac, 0x73, 0x15, 0x80, 0x22, 0x00, 0x31, 0x36, 0x01, 0x62, 0x02, 0x10, 0x90, 0xad, 0x10, + 0x61, 0x26, 0x88, 0x99, 0x08, 0x80, 0xb0, 0xbb, 0xde, 0x0a, 0x43, 0x02, 0x89, 0x90, 0x09, 0x02, + 0x01, 0xea, 0x09, 0x9a, 0x34, 0xf9, 0x9d, 0x00, 0x22, 0xb9, 0x39, 0x94, 0xad, 0x20, 0x12, 0xf8, + 0x9b, 0xbc, 0x9c, 0x18, 0x10, 0x11, 0x00, 0x99, 0x43, 0x82, 0x1a, 0x77, 0x03, 0x99, 0xa9, 0x38, + 0xa4, 0x2b, 0x26, 0x98, 0xaa, 0x89, 0x31, 0x02, 0xfd, 0x8a, 0x32, 0x23, 0x00, 0xc9, 0x29, 0x35, + 0xb2, 0x30, 0x15, 0xc9, 0x9b, 0x00, 0xbb, 0x30, 0x65, 0xc1, 0x9c, 0x89, 0x30, 0x45, 0x92, 0xaa, + 0xba, 0xbb, 0x74, 0x14, 0x11, 0x99, 0x19, 0x98, 0x01, 0x99, 0xc9, 0x28, 0xa3, 0xaf, 0x80, 0x9d, + 0x01, 0x9a, 0x89, 0xa9, 0x22, 0xf9, 0x0b, 0x23, 0x00, 0x3a, 0xb5, 0x0f, 0x45, 0x92, 0x9b, 0x28, + 0x35, 0xb8, 0x19, 0x90, 0xec, 0xaa, 0xaa, 0x08, 0x10, 0x31, 0x35, 0xb8, 0x0c, 0x10, 0x92, 0x8d, + 0x22, 0x98, 0x22, 0xbc, 0xb9, 0x72, 0x23, 0x34, 0x02, 0x51, 0x92, 0x40, 0xf8, 0xcb, 0x2a, 0x35, + 0xb8, 0xac, 0x08, 0x43, 0x43, 0x11, 0x02, 0x89, 0x01, 0x0a, 0x54, 0x83, 0xcf, 0xbb, 0x09, 0x28, + 0x05, 0x89, 0x12, 0xb9, 0x2a, 0x15, 0xba, 0x89, 0xba, 0x21, 0x64, 0x11, 0x22, 0x09, 0x44, 0x33, + 0x90, 0xc8, 0x9e, 0x09, 0x12, 0x98, 0xed, 0xbc, 0xaa, 0x9a, 0x10, 0x32, 0x80, 0x53, 0x12, 0x92, + 0x2b, 0x23, 0x77, 0xa2, 0x89, 0xaa, 0xd9, 0x38, 0xc8, 0x9a, 0x19, 0x62, 0x82, 0x89, 0xd9, 0x2a, + 0x82, 0x73, 0x82, 0xa9, 0x2b, 0x47, 0x81, 0x99, 0x09, 0xa8, 0x9b, 0x39, 0x26, 0x12, 0x90, 0xda, + 0x9a, 0x98, 0x61, 0x04, 0xa9, 0x10, 0xa8, 0x8b, 0x51, 0x35, 0x90, 0xcb, 0x30, 0x80, 0xc0, 0x0b, + 0xc9, 0x21, 0x92, 0xa9, 0x2a, 0xb5, 0xbf, 0x09, 0x98, 0x73, 0x04, 0x89, 0xa9, 0x8b, 0x90, 0x0b, + 0x65, 0x34, 0x02, 0x9a, 0x10, 0x32, 0xb8, 0xce, 0x09, 0x81, 0x11, 0xfa, 0xab, 0xbb, 0x29, 0x43, + 0xc9, 0x68, 0xa1, 0xbc, 0x1a, 0x53, 0x14, 0xca, 0x9a, 0x89, 0x20, 0x21, 0x36, 0x81, 0xb0, 0x9d, + 0x99, 0x88, 0x12, 0x54, 0x82, 0x9a, 0x99, 0x98, 0x9a, 0x66, 0x03, 0xca, 0x9b, 0x20, 0x12, 0x73, + 0x04, 0x10, 0x92, 0x8c, 0x53, 0x81, 0x89, 0xb0, 0x2a, 0x82, 0x98, 0x1a, 0x12, 0x94, 0xef, 0xab, + 0x99, 0x99, 0x00, 0x99, 0x51, 0xb0, 0x50, 0x13, 0x33, 0x81, 0x9a, 0xfb, 0x5a, 0x81, 0x00, 0x9a, + 0xfb, 0x8c, 0x10, 0x01, 0x19, 0x15, 0xab, 0x08, 0xca, 0x8b, 0x12, 0xcb, 0xbc, 0x29, 0x25, 0xbd, + 0x11, 0x89, 0x30, 0x04, 0x73, 0xa3, 0x9d, 0x52, 0x33, 0x03, 0x89, 0x21, 0xd8, 0x9b, 0x0a, 0x32, + 0x21, 0xa0, 0xfd, 0x9b, 0xa8, 0xbc, 0x40, 0x81, 0x10, 0x18, 0x44, 0x11, 0x21, 0xda, 0x8b, 0x72, + 0x24, 0x21, 0x01, 0x53, 0x02, 0x10, 0xa8, 0xbb, 0xcd, 0x28, 0x35, 0x81, 0xba, 0xbf, 0x89, 0xb9, + 0xab, 0x88, 0x10, 0xc9, 0x99, 0xbb, 0xcf, 0x0a, 0x19, 0x11, 0x32, 0x55, 0x12, 0xfb, 0x8b, 0x21, + 0x22, 0x14, 0x81, 0xc9, 0x28, 0x63, 0x82, 0x08, 0xba, 0xad, 0x88, 0x9a, 0x31, 0xc2, 0xbd, 0x8a, + 0x41, 0x33, 0x82, 0x0b, 0x44, 0x02, 0x53, 0x92, 0x0c, 0xa1, 0x8c, 0x21, 0x55, 0x23, 0x08, 0x81, + 0x9a, 0xc9, 0xbb, 0x20, 0xee, 0xaa, 0xba, 0xac, 0x80, 0x09, 0x34, 0x08, 0x01, 0x39, 0x57, 0x11, + 0x80, 0x18, 0x22, 0x22, 0x01, 0xbe, 0x51, 0x34, 0x12, 0xd8, 0x9c, 0x08, 0x12, 0x32, 0xc0, 0xcf, + 0x8a, 0x22, 0x90, 0x20, 0x10, 0x91, 0xab, 0xdb, 0x0b, 0xa1, 0x28, 0x40, 0x37, 0x11, 0xa9, 0x82, + 0xaf, 0x21, 0x32, 0x34, 0x91, 0xef, 0x89, 0x81, 0x88, 0x99, 0x89, 0x21, 0x92, 0xbb, 0xae, 0x09, + 0x31, 0xa8, 0x52, 0x32, 0x12, 0xd9, 0xbe, 0x31, 0xb1, 0x0b, 0x37, 0x32, 0x13, 0x33, 0x45, 0x14, + 0x01, 0xea, 0x9a, 0xab, 0x19, 0x21, 0x32, 0xf8, 0xac, 0x89, 0x10, 0x13, 0xcb, 0x28, 0x13, 0x31, + 0x02, 0x40, 0x14, 0x88, 0x35, 0xc9, 0x1a, 0xf8, 0x8a, 0x21, 0x99, 0x73, 0x03, 0xd9, 0x9a, 0x80, + 0x10, 0x32, 0x13, 0xed, 0xbb, 0x08, 0x11, 0xea, 0x19, 0x90, 0x89, 0xa0, 0xae, 0x31, 0x81, 0xaa, + 0x72, 0x05, 0x08, 0x81, 0x89, 0x10, 0x32, 0xb4, 0xbf, 0x09, 0x42, 0x83, 0xab, 0x88, 0xa9, 0x0b, + 0x73, 0x34, 0x93, 0x0a, 0x73, 0x12, 0x21, 0xc8, 0xcd, 0x08, 0x98, 0x09, 0x32, 0x90, 0xcc, 0x70, + 0x13, 0x80, 0x8a, 0x18, 0x14, 0x98, 0x81, 0xc9, 0x9c, 0x81, 0xb9, 0xbd, 0x72, 0x92, 0xab, 0xb9, + 0x09, 0x24, 0xaa, 0x11, 0xca, 0x1b, 0x36, 0xa9, 0x41, 0xc9, 0x50, 0x12, 0x01, 0xaa, 0xca, 0x0a, + 0x31, 0x02, 0xb9, 0x2d, 0x77, 0x01, 0x81, 0x0a, 0x22, 0x89, 0xab, 0xda, 0xbe, 0x0a, 0x14, 0x00, + 0xd8, 0xbd, 0x28, 0x33, 0xb1, 0x8b, 0x88, 0x02, 0x98, 0xcb, 0x40, 0x37, 0x00, 0x33, 0x04, 0xcb, + 0x19, 0x73, 0x23, 0xa8, 0xbb, 0x19, 0x90, 0xaa, 0x00, 0x41, 0xc9, 0x21, 0xdf, 0x29, 0x36, 0x02, + 0xba, 0x99, 0x00, 0x30, 0x03, 0x0b, 0x36, 0xa1, 0x9c, 0x01, 0xaa, 0xbd, 0x8b, 0x99, 0xb9, 0xbf, + 0x89, 0x22, 0xfb, 0x08, 0x18, 0x26, 0x91, 0xab, 0xf9, 0x8b, 0x38, 0x26, 0x11, 0x00, 0x10, 0xa9, + 0xbb, 0xab, 0x22, 0xcb, 0x75, 0x13, 0x89, 0x89, 0x08, 0xa9, 0xb0, 0xae, 0x11, 0x51, 0x27, 0x01, + 0xcb, 0xaa, 0x38, 0x33, 0xb0, 0x0b, 0x43, 0x12, 0x52, 0xa2, 0xcb, 0x08, 0x22, 0x37, 0x92, 0x98, + 0x81, 0xac, 0xb8, 0xad, 0xbb, 0xb9, 0x91, 0xcd, 0xbc, 0x18, 0x01, 0x8a, 0x99, 0x9b, 0x73, 0xa1, + 0x40, 0x25, 0xa8, 0x00, 0x21, 0x11, 0x55, 0x82, 0x99, 0x19, 0xa8, 0x19, 0xcc, 0xbb, 0x01, 0x0b, + 0x04, 0x9d, 0x90, 0xda, 0x9a, 0xa9, 0x00, 0x32, 0x1a, 0x24, 0x31, 0xba, 0x19, 0x45, 0x01, 0x99, + 0x2a, 0x17, 0x19, 0x11, 0x21, 0x34, 0xb8, 0x9b, 0xdb, 0x09, 0x11, 0x33, 0x13, 0xa9, 0xcb, 0xcc, + 0x0b, 0x14, 0x18, 0xc8, 0x0a, 0x00, 0xda, 0xad, 0x89, 0x31, 0x22, 0x53, 0x33, 0x23, 0x52, 0x13, + 0xa9, 0x09, 0xac, 0x20, 0xa1, 0xbb, 0xb1, 0xcb, 0xbc, 0x8a, 0xba, 0x0a, 0x01, 0x51, 0x02, 0x89, + 0x10, 0x99, 0xbb, 0x29, 0x24, 0x32, 0x03, 0x09, 0x11, 0x31, 0x33, 0x01, 0x99, 0xa9, 0x19, 0x90, + 0x9a, 0x00, 0xbb, 0x3a, 0x33, 0x11, 0xba, 0x9a, 0x19, 0x99, 0x20, 0x01, 0x99, 0xab, 0x99, 0x31, + 0x12, 0x31, 0x13, 0x90, 0xa9, 0x19, 0x21, 0x90, 0x00, 0x01, 0x90, 0xa0, 0x99, 0x00, 0x00, 0x19, + 0x90, 0x99, 0x00, 0x09, 0x10, 0x11, 0x11, 0x90, 0x09, 0x10, 0x00, 0x09, 0x90, 0x00, 0x00, 0x70, + 0x02, 0x01, 0x0b, 0x7d, 0x0b, 0x02, 0x88, 0x05, 0xc9, 0x02, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, + 0x77, 0xf8, 0x95, 0x2d, 0x80, 0xe4, 0x49, 0x48, 0xf2, 0x3b, 0x91, 0x43, 0xad, 0x91, 0x38, 0xb1, + 0x10, 0x93, 0x1e, 0x99, 0x87, 0x29, 0x9c, 0x04, 0x30, 0x9d, 0xb2, 0x29, 0x11, 0xc1, 0x5a, 0xa0, + 0x91, 0x3d, 0xa4, 0x11, 0x2b, 0xe8, 0x02, 0x0a, 0x0a, 0xa3, 0x33, 0x8f, 0xc3, 0x22, 0x2c, 0xb3, + 0x5a, 0x99, 0xc1, 0x5a, 0xc0, 0x11, 0x49, 0xbb, 0x86, 0x18, 0x8a, 0x97, 0x18, 0x89, 0xa9, 0x04, + 0x0a, 0xa8, 0x14, 0x0a, 0xb1, 0x59, 0x80, 0x93, 0x7a, 0x9a, 0xd3, 0x29, 0x1a, 0xb5, 0x39, 0x0a, + 0xb2, 0x21, 0x09, 0x68, 0xa2, 0x0a, 0x8a, 0x88, 0x8b, 0xe5, 0x68, 0x89, 0xc1, 0x51, 0x09, 0xb8, + 0x15, 0x5a, 0xd9, 0x00, 0x1a, 0x00, 0x00, 0x90, 0x2a, 0xa0, 0x52, 0x80, 0x80, 0x7a, 0xc1, 0x98, + 0x3a, 0xcc, 0x05, 0x39, 0x9b, 0x94, 0x10, 0x2b, 0x86, 0x19, 0x80, 0xc8, 0x1b, 0xb1, 0x18, 0x58, + 0xb9, 0x96, 0x58, 0x8b, 0x97, 0x20, 0x8a, 0xc2, 0x19, 0x8a, 0x90, 0x10, 0x11, 0xd8, 0x61, 0x99, + 0x04, 0x48, 0xba, 0xa6, 0x8a, 0x29, 0xe2, 0x20, 0x2b, 0xe2, 0x22, 0x8a, 0x11, 0x21, 0xa9, 0x81, + 0x9b, 0x8f, 0xc3, 0x48, 0x0b, 0xb6, 0x49, 0x19, 0xb2, 0x32, 0x3b, 0xd9, 0x93, 0x0f, 0x90, 0x11, + 0x8b, 0x94, 0x29, 0x19, 0xa6, 0x50, 0x19, 0xe0, 0x82, 0x1c, 0xb1, 0x81, 0x3b, 0xa2, 0xa0, 0x60, + 0x90, 0x14, 0x1a, 0xe3, 0x20, 0x9d, 0xb1, 0x22, 0x1d, 0xb0, 0x04, 0x5b, 0x98, 0x81, 0x51, 0x89, + 0x93, 0x2a, 0xfb, 0x8b, 0xa1, 0x70, 0x02, 0x2a, 0xc0, 0x89, 0x22, 0x3a, 0x87, 0x29, 0xdb, 0xaa, + 0x83, 0x7c, 0x91, 0x10, 0x09, 0xc9, 0x22, 0x3a, 0x85, 0x29, 0xb1, 0xcf, 0x91, 0x2d, 0x85, 0x11, + 0x11, 0xec, 0x82, 0x1c, 0x03, 0x10, 0x20, 0xdd, 0x01, 0x0c, 0x03, 0x20, 0x10, 0xf9, 0x10, 0x8c, + 0x13, 0x10, 0x10, 0xf9, 0x18, 0x8c, 0x12, 0x01, 0x30, 0xf8, 0x28, 0xab, 0x04, 0x11, 0x10, 0xf0, + 0x29, 0xbb, 0x14, 0x10, 0x20, 0xe1, 0x2a, 0xc9, 0x32, 0x00, 0x11, 0xe1, 0x1b, 0xe8, 0x30, 0x01, + 0x20, 0xb1, 0x1e, 0xc0, 0x20, 0x11, 0x20, 0xb2, 0x8f, 0xc0, 0x29, 0x03, 0x30, 0x83, 0x9f, 0xb1, + 0x4b, 0x83, 0x21, 0x82, 0xaf, 0xa1, 0x1c, 0x13, 0x30, 0x83, 0xbd, 0xa2, 0x0d, 0x05, 0x10, 0x02, + 0xcc, 0x81, 0x8d, 0x03, 0x28, 0x23, 0xea, 0x11, 0xad, 0x23, 0x1a, 0x14, 0xc9, 0x28, 0xbd, 0x32, + 0x1a, 0x24, 0xc0, 0x28, 0xfa, 0x30, 0x89, 0x23, 0xb8, 0x19, 0xfa, 0x59, 0x98, 0x22, 0xa1, 0x2a, + 0xf8, 0x49, 0x90, 0x21, 0xa0, 0x1a, 0xf1, 0x3b, 0xb2, 0x43, 0x80, 0x9b, 0xa4, 0x2f, 0xb2, 0x31, + 0x91, 0xaa, 0x91, 0x8f, 0x95, 0x28, 0x01, 0x99, 0x01, 0x8f, 0x83, 0x39, 0x82, 0xca, 0x21, 0xaf, + 0x84, 0x18, 0x02, 0xb8, 0x30, 0xbe, 0x05, 0x19, 0x01, 0xb0, 0x39, 0xfc, 0x12, 0x19, 0x02, 0xa0, + 0x49, 0xea, 0x21, 0x88, 0x21, 0xb0, 0x3c, 0xf8, 0x10, 0x08, 0x21, 0xa2, 0x3d, 0xf0, 0x10, 0x80, + 0x01, 0x81, 0x1d, 0xd1, 0x39, 0x90, 0x11, 0x12, 0x0e, 0xb2, 0x2b, 0x83, 0x28, 0x03, 0x9f, 0xc3, + 0x1c, 0x02, 0x18, 0x24, 0xad, 0x94, 0x1b, 0x01, 0x08, 0x43, 0xad, 0x93, 0x0f, 0x11, 0x88, 0x31, + 0xe8, 0x12, 0x9c, 0x02, 0x80, 0x32, 0xfa, 0x11, 0x9c, 0x11, 0x90, 0x61, 0xc0, 0x20, 0x9b, 0x11, + 0x90, 0x50, 0xf1, 0x20, 0xba, 0x20, 0x81, 0x59, 0xd2, 0x38, 0xb9, 0x28, 0x91, 0x69, 0xc2, 0x2a, + 0xb8, 0x29, 0x93, 0x5a, 0xa5, 0x3a, 0xd8, 0x08, 0x83, 0x2a, 0x96, 0x1c, 0xb1, 0x0a, 0x22, 0x2b, + 0x07, 0x1c, 0xb2, 0x0b, 0x13, 0x0b, 0x07, 0x0c, 0xa1, 0x8a, 0x22, 0x9a, 0x37, 0x8c, 0x92, 0x8b, + 0x31, 0xb9, 0x36, 0x9d, 0x93, 0x8c, 0x30, 0xc0, 0x53, 0xaa, 0x03, 0x8c, 0x39, 0xc1, 0x62, 0xaa, + 0x82, 0x8b, 0x39, 0xe3, 0x60, 0xa8, 0x01, 0x8a, 0x29, 0xc4, 0x68, 0xa8, 0x10, 0x8a, 0x0b, 0x96, + 0x49, 0xb1, 0x10, 0x0a, 0x89, 0xa4, 0x7b, 0xb2, 0x08, 0x89, 0x8b, 0x87, 0x2a, 0x92, 0x10, 0xa9, + 0xba, 0x17, 0x2b, 0x93, 0x0c, 0x91, 0xca, 0x23, 0x3b, 0x87, 0x09, 0xa0, 0xaa, 0x34, 0x8c, 0x15, + 0xaa, 0x91, 0xab, 0x51, 0x09, 0x15, 0x8a, 0x92, 0xac, 0x40, 0xb0, 0x44, 0xc9, 0x81, 0xab, 0x30, + 0x90, 0x74, 0xa8, 0x10, 0x9b, 0x29, 0xb3, 0x70, 0xb1, 0x08, 0x9d, 0x18, 0x93, 0x78, 0xb2, 0x28, + 0xba, 0x1a, 0x04, 0x49, 0xc3, 0x3b, 0xda, 0x09, 0x12, 0x48, 0x86, 0x0b, 0xb0, 0x09, 0x21, 0x09, + 0x27, 0x8d, 0xb0, 0x0b, 0x42, 0x91, 0x34, 0x8d, 0xb2, 0x0b, 0x10, 0x83, 0x55, 0xad, 0x92, 0x8a, + 0x18, 0x94, 0x71, 0xa9, 0xa2, 0x1b, 0x01, 0xa3, 0x79, 0xd0, 0x01, 0x0c, 0x88, 0x85, 0x38, 0xd0, + 0x01, 0x0b, 0x80, 0x03, 0x6c, 0xc1, 0x08, 0x0a, 0xa0, 0x14, 0x4a, 0xe3, 0x10, 0xaa, 0x81, 0x23, + 0x2d, 0xc4, 0x19, 0xa9, 0x91, 0x51, 0x1a, 0xa6, 0x2a, 0xb8, 0x81, 0x50, 0x8a, 0x96, 0x0a, 0xa8, + 0x00, 0x59, 0x98, 0x06, 0x8b, 0xa1, 0x08, 0x58, 0xa8, 0x14, 0x0d, 0xa0, 0x19, 0x49, 0xa1, 0x43, + 0x9d, 0xa3, 0x2a, 0x2a, 0xb4, 0x62, 0xcb, 0x82, 0x2c, 0x08, 0xa3, 0x70, 0xa9, 0x01, 0x1d, 0x80, + 0x94, 0x38, 0xd9, 0x11, 0x0d, 0x90, 0x04, 0x49, 0xc8, 0x20, 0x0c, 0x91, 0x02, 0x5a, 0xd1, 0x28, + 0x9b, 0x82, 0x21, 0x3a, 0xf3, 0x38, 0xbb, 0x83, 0x31, 0x2a, 0xd5, 0x3a, 0xca, 0x82, 0x20, 0x20, + 0xb5, 0x3d, 0xd8, 0x01, 0x20, 0x88, 0x94, 0x1d, 0xd0, 0x20, 0x08, 0x01, 0x93, 0x1e, 0xc1, 0x39, + 0x18, 0x01, 0x11, 0x8f, 0xb1, 0x3a, 0x81, 0x22, 0x13, 0xbf, 0xa4, 0x3b, 0x92, 0x21, 0x31, 0xbf, + 0xb3, 0x2e, 0x82, 0x20, 0x20, 0xeb, 0x83, 0x0e, 0x82, 0x30, 0x18, 0xea, 0x11, 0x0d, 0x82, 0x28, + 0x11, 0xe8, 0x10, 0x8c, 0x04, 0x19, 0x01, 0xd0, 0x28, 0x9d, 0x22, 0x29, 0x82, 0xd0, 0x38, 0xeb, + 0x22, 0x2a, 0x03, 0xd0, 0x3b, 0xea, 0x32, 0x0a, 0x13, 0xa0, 0x2d, 0xf8, 0x40, 0x98, 0x02, 0x88, + 0x1b, 0xf0, 0x48, 0x98, 0x13, 0x98, 0x1b, 0xe2, 0x49, 0xa0, 0x13, 0x88, 0x8c, 0xd2, 0x5a, 0xa1, + 0x21, 0x08, 0x9b, 0xb3, 0x3f, 0xa2, 0x50, 0x88, 0xaa, 0xb3, 0x2e, 0xa3, 0x40, 0x80, 0xb9, 0x82, + 0x0f, 0x94, 0x38, 0x91, 0xaa, 0x81, 0x0f, 0x84, 0x3a, 0x82, 0xb9, 0x10, 0x8f, 0x04, 0x3a, 0x91, + 0xa8, 0x18, 0xae, 0x33, 0x3b, 0x85, 0xa9, 0x29, 0xbc, 0x34, 0x1b, 0x07, 0xa9, 0x19, 0xcb, 0x52, + 0x98, 0x13, 0x99, 0x2a, 0xfb, 0x40, 0x80, 0x13, 0xba, 0x09, 0xf8, 0x48, 0x90, 0x32, 0xa8, 0x8b, + 0xc8, 0x69, 0x91, 0x41, 0xb0, 0x89, 0xca, 0x39, 0x04, 0x40, 0xb1, 0x9a, 0xc8, 0x3b, 0x15, 0x50, + 0xb2, 0xab, 0xa9, 0x1d, 0x14, 0x30, 0x94, 0xbb, 0x8a, 0x8c, 0x35, 0x20, 0x95, 0xab, 0x9b, 0xab, + 0x65, 0x80, 0x03, 0xaa, 0x8c, 0xa9, 0x72, 0x01, 0x02, 0xba, 0x8c, 0xb9, 0x60, 0x83, 0x23, 0xca, + 0x9c, 0x90, 0x69, 0x83, 0x21, 0xb8, 0xae, 0xa0, 0x59, 0x84, 0x20, 0x98, 0xac, 0x80, 0x2c, 0x07, + 0x10, 0x98, 0xbb, 0x81, 0x0b, 0x27, 0x29, 0x92, 0xbd, 0x00, 0x0a, 0x27, 0x09, 0x01, 0xdb, 0x18, + 0xab, 0x27, 0x88, 0x01, 0xca, 0x29, 0xb9, 0x45, 0x08, 0x01, 0xda, 0x2a, 0xc8, 0x53, 0x88, 0x11, + 0xc9, 0x2b, 0xc0, 0x71, 0x80, 0x00, 0xb8, 0x1b, 0xd1, 0x50, 0x81, 0x18, 0xb0, 0x0e, 0xb2, 0x68, + 0x81, 0x18, 0xa0, 0x8d, 0xb3, 0x5a, 0x82, 0x18, 0xa1, 0x9e, 0x93, 0x4a, 0x03, 0x09, 0x92, 0xaf, + 0x93, 0x3c, 0x13, 0x89, 0x02, 0xbf, 0x03, 0x1c, 0x14, 0x88, 0x11, 0xbe, 0x12, 0x0c, 0x23, 0x98, + 0x22, 0xdd, 0x11, 0x0b, 0x24, 0xa0, 0x21, 0xfb, 0x38, 0x8c, 0x32, 0x90, 0x30, 0xfb, 0x39, 0xa9, + 0x43, 0x91, 0x38, 0xf8, 0x2a, 0xa9, 0x42, 0x91, 0x28, 0xf1, 0x3b, 0xb0, 0x41, 0x82, 0x19, 0xf3, + 0x2c, 0xa0, 0x20, 0x83, 0x1a, 0xc4, 0x1d, 0xa1, 0x20, 0x13, 0x8a, 0xa5, 0x0f, 0xa1, 0x28, 0x12, + 0x99, 0x95, 0x0e, 0x91, 0x29, 0x22, 0xa8, 0x04, 0x9f, 0x92, 0x19, 0x22, 0xa8, 0x22, 0xaf, 0x82, + 0x1a, 0x33, 0xa0, 0x51, 0xbe, 0x82, 0x89, 0x42, 0x90, 0x40, 0xcc, 0x01, 0x89, 0x42, 0x91, 0x48, + 0xfa, 0x00, 0x89, 0x21, 0x82, 0x39, 0xf9, 0x19, 0x98, 0x41, 0x02, 0x2a, 0xf1, 0x1a, 0x98, 0x30, + 0x12, 0x1a, 0xf3, 0x1c, 0x90, 0x38, 0x14, 0x89, 0xc3, 0x0e, 0x90, 0x28, 0x23, 0x99, 0xa4, 0x8f, + 0x81, 0x19, 0x43, 0x98, 0x01, 0xaf, 0x81, 0x19, 0x33, 0xb0, 0x22, 0xcf, 0x11, 0x0a, 0x43, 0xa1, + 0x20, 0xcd, 0x18, 0x89, 0x43, 0x91, 0x39, 0xfb, 0x29, 0x98, 0x52, 0x92, 0x29, 0xf9, 0x19, 0x98, + 0x31, 0x83, 0x1a, 0xf2, 0x1c, 0x91, 0x30, 0x04, 0x0a, 0xd2, 0x1d, 0x90, 0x38, 0x13, 0x9a, 0xb3, + 0x9f, 0xa3, 0x48, 0x23, 0x9a, 0xa3, 0xbf, 0x93, 0x29, 0x24, 0xb8, 0x03, 0xcf, 0x83, 0x29, 0x32, + 0xc0, 0x21, 0xbf, 0x83, 0x1a, 0x23, 0xb1, 0x48, 0xdd, 0x12, 0x0a, 0x32, 0xa2, 0x4a, 0xfa, 0x28, + 0x8a, 0x32, 0xa1, 0x49, 0xf8, 0x39, 0x8a, 0x32, 0x93, 0x2c, 0xf2, 0x2a, 0x99, 0x22, 0x82, 0x2b, + 0xf4, 0x3a, 0xa8, 0x31, 0x12, 0x8b, 0xc5, 0x2d, 0xa8, 0x21, 0x02, 0x8a, 0xa5, 0x1f, 0xa1, 0x20, + 0x11, 0xa8, 0x83, 0x8f, 0xa1, 0x28, 0x12, 0xa8, 0x14, 0x9f, 0x92, 0x29, 0x22, 0xa0, 0x31, 0xcf, + 0x92, 0x2a, 0x13, 0xa0, 0x51, 0xbd, 0x02, 0x1a, 0x23, 0xa2, 0x58, 0xdc, 0x01, 0x0b, 0x13, 0x92, + 0x69, 0xe9, 0x10, 0x89, 0x12, 0x01, 0x39, 0xf8, 0x19, 0xaa, 0x33, 0x00, 0x39, 0xf4, 0x2a, 0xb8, + 0x32, 0x12, 0x19, 0xf2, 0x1b, 0xd8, 0x21, 0x11, 0x00, 0xb3, 0x8f, 0xa1, 0x48, 0x11, 0x80, 0x82, + 0x9f, 0xb0, 0x49, 0x11, 0x81, 0x21, 0xae, 0xa2, 0x3b, 0x23, 0x04, 0x39, 0xce, 0xa1, 0x2b, 0x02, + 0x33, 0x58, 0xf9, 0x08, 0x0a, 0x02, 0x33, 0x3a, 0xf1, 0x0b, 0x8d, 0x02, 0x32, 0x28, 0xf4, 0x09, + 0x99, 0x02, 0x42, 0x88, 0xd3, 0x0b, 0xbb, 0x13, 0x71, 0x80, 0xa4, 0x0c, 0xa8, 0x01, 0x70, 0x90, + 0x83, 0x8e, 0xa8, 0x10, 0x30, 0x91, 0x15, 0x9d, 0xa0, 0x18, 0x68, 0xa2, 0x21, 0xad, 0xb1, 0x09, + 0x40, 0x94, 0x42, 0xbc, 0x90, 0x08, 0x38, 0x96, 0x41, 0xda, 0x88, 0x0a, 0x38, 0x85, 0x48, 0xc8, + 0x88, 0x8a, 0x28, 0x07, 0x28, 0xc8, 0x89, 0x8a, 0x18, 0x06, 0x30, 0xd1, 0x0a, 0x9a, 0x28, 0x16, + 0x29, 0xb2, 0x8d, 0xaa, 0x18, 0x16, 0x20, 0xa2, 0x8e, 0x98, 0x09, 0x24, 0x20, 0xa3, 0x9f, 0xa8, + 0x09, 0x24, 0x30, 0x84, 0x9e, 0xa0, 0x0a, 0x43, 0x20, 0x02, 0xae, 0xb8, 0x8a, 0x44, 0x20, 0x13, + 0xcc, 0x98, 0x9b, 0x63, 0x20, 0x12, 0xbc, 0xa9, 0xac, 0x53, 0x21, 0x33, 0xfb, 0x89, 0x9a, 0x41, + 0x11, 0x33, 0xea, 0xa9, 0xbb, 0x62, 0x11, 0x23, 0xd8, 0x99, 0xca, 0x48, 0x12, 0x24, 0xc9, 0x9a, + 0xca, 0x30, 0x13, 0x35, 0xb0, 0x9c, 0xdb, 0x38, 0x04, 0x42, 0xb0, 0x9b, 0xeb, 0x29, 0x14, 0x42, + 0x90, 0x9c, 0xb9, 0x2a, 0x05, 0x52, 0x91, 0xbb, 0xd9, 0x2a, 0x04, 0x42, 0x92, 0xab, 0xd9, 0x0b, + 0x24, 0x51, 0x81, 0xab, 0xba, 0x0e, 0x23, 0x51, 0x02, 0xbb, 0xb9, 0x8e, 0x23, 0x50, 0x02, 0xba, + 0xba, 0x9e, 0x33, 0x50, 0x13, 0xca, 0xa9, 0xac, 0x33, 0x40, 0x05, 0xa9, 0xaa, 0xad, 0x32, 0x31, + 0x16, 0xb8, 0x9a, 0xcc, 0x31, 0x30, 0x25, 0xc8, 0xa9, 0xcb, 0x40, 0x11, 0x34, 0xa8, 0xba, 0xdc, + 0x38, 0x21, 0x25, 0xb0, 0xaa, 0xeb, 0x39, 0x21, 0x35, 0xb1, 0xab, 0xea, 0x29, 0x02, 0x44, 0x91, + 0x9b, 0xeb, 0x2a, 0x03, 0x34, 0x92, 0x9c, 0xd9, 0x1b, 0x12, 0x44, 0x92, 0xab, 0xd9, 0x0b, 0x13, + 0x44, 0x03, 0xbb, 0xda, 0x8c, 0x13, 0x43, 0x12, 0xbb, 0xca, 0x8f, 0x02, 0x33, 0x22, 0xca, 0xaa, + 0x9e, 0x02, 0x42, 0x23, 0xc9, 0xaa, 0xad, 0x22, 0x42, 0x32, 0xd0, 0x9a, 0xbc, 0x11, 0x43, 0x33, + 0xc0, 0xab, 0xcd, 0x11, 0x42, 0x22, 0xb2, 0xac, 0xeb, 0x18, 0x32, 0x33, 0xa2, 0x9e, 0xda, 0x08, + 0x32, 0x24, 0x82, 0xad, 0xba, 0x1a, 0x52, 0x32, 0x03, 0xbd, 0xd9, 0x0a, 0x42, 0x23, 0x02, 0xdb, + 0xb9, 0x8c, 0x31, 0x25, 0x22, 0xdb, 0xaa, 0x8b, 0x42, 0x33, 0x24, 0xd9, 0xab, 0x9d, 0x31, 0x24, + 0x21, 0xc8, 0xab, 0xac, 0x30, 0x26, 0x22, 0xb8, 0x9e, 0x9a, 0x28, 0x24, 0x32, 0xc2, 0x9d, 0xba, + 0x38, 0x25, 0x12, 0x92, 0xae, 0xaa, 0x1a, 0x35, 0x22, 0x92, 0xae, 0xa9, 0x0a, 0x35, 0x12, 0x03, + 0xbe, 0xa9, 0x0b, 0x44, 0x12, 0x12, 0xdc, 0x99, 0x8a, 0x53, 0x12, 0x11, 0xfa, 0x89, 0x9a, 0x42, + 0x12, 0x21, 0xe9, 0x8a, 0xaa, 0x61, 0x12, 0x20, 0xd8, 0x8b, 0xb9, 0x50, 0x22, 0x22, 0xe0, 0x8b, + 0xb9, 0x40, 0x14, 0x11, 0xb1, 0x9f, 0xa8, 0x49, 0x13, 0x11, 0xa2, 0x9f, 0xa0, 0x2a, 0x24, 0x21, + 0x91, 0xaf, 0xa0, 0x2a, 0x24, 0x11, 0x12, 0xaf, 0x98, 0x1b, 0x25, 0x01, 0x01, 0xcc, 0x88, 0x8c, + 0x24, 0x11, 0x21, 0xfb, 0x88, 0x8a, 0x33, 0x11, 0x22, 0xfa, 0x0b, 0xab, 0x44, 0x01, 0x21, 0xe8, + 0x0a, 0xb9, 0x52, 0x11, 0x11, 0xe0, 0x0b, 0xc8, 0x31, 0x12, 0x21, 0xd2, 0x8d, 0xc0, 0x30, 0x12, + 0x01, 0xb2, 0x9f, 0xb0, 0x49, 0x13, 0x11, 0x92, 0xaf, 0x90, 0x3a, 0x14, 0x10, 0x01, 0xaf, 0xa0, + 0x2a, 0x15, 0x01, 0x01, 0xcc, 0x80, 0x0b, 0x24, 0x12, 0x01, 0xdd, 0x08, 0x0b, 0x33, 0x12, 0x32, + 0xfb, 0x0b, 0x9b, 0x35, 0x01, 0x20, 0xf9, 0x0a, 0xaa, 0x43, 0x12, 0x21, 0xf8, 0x0a, 0xb8, 0x41, + 0x11, 0x21, 0xd0, 0x8d, 0xa8, 0x50, 0x11, 0x10, 0xa1, 0x8e, 0xb0, 0x38, 0x13, 0x02, 0xa1, 0xbf, + 0xa1, 0x3a, 0x15, 0x12, 0x82, 0xaf, 0x90, 0x3b, 0x23, 0x11, 0x01, 0xde, 0x80, 0x0b, 0x15, 0x11, + 0x11, 0xeb, 0x08, 0x8b, 0x14, 0x11, 0x10, 0xf9, 0x1a, 0x9a, 0x33, 0x22, 0x12, 0xf1, 0x1c, 0xc9, + 0x22, 0x20, 0x10, 0xd1, 0x0d, 0xb0, 0x31, 0x21, 0x12, 0xb3, 0x9f, 0xd0, 0x38, 0x11, 0x00, 0x01, + 0x9f, 0xb1, 0x3a, 0x33, 0x12, 0x12, 0xcf, 0xa2, 0x1b, 0x12, 0x02, 0x42, 0xce, 0x91, 0x1a, 0x23, + 0x11, 0x41, 0xfa, 0x00, 0x9c, 0x22, 0x01, 0x38, 0xf9, 0x18, 0x9b, 0x22, 0x32, 0x40, 0xf2, 0x1a, + 0xba, 0x21, 0x02, 0x20, 0xd5, 0x2b, 0xca, 0x21, 0x23, 0x10, 0xb5, 0x1d, 0xc8, 0x29, 0x21, 0x08, + 0x85, 0x0f, 0xa0, 0x18, 0x12, 0x00, 0x05, 0x9c, 0xb1, 0x0b, 0x32, 0x80, 0x25, 0x9e, 0x91, 0x0c, + 0x22, 0x01, 0x34, 0xbc, 0x90, 0x9d, 0x22, 0x91, 0x62, 0xc9, 0x80, 0x9b, 0x32, 0x03, 0x72, 0xc8, + 0x08, 0xbb, 0x20, 0x02, 0x71, 0xc1, 0x09, 0xaa, 0x48, 0x02, 0x60, 0xa1, 0x0a, 0xea, 0x19, 0x12, + 0x48, 0xb2, 0x0b, 0xd8, 0x2a, 0x23, 0x61, 0xa3, 0xab, 0xc8, 0x0c, 0x22, 0x38, 0x86, 0x9a, 0xa9, + 0x0d, 0x33, 0x30, 0x06, 0xaa, 0xa9, 0x9e, 0x21, 0x10, 0x06, 0x99, 0x99, 0xab, 0x52, 0x10, 0x16, + 0xa8, 0x8a, 0xcc, 0x20, 0x01, 0x24, 0x98, 0x8b, 0xeb, 0x38, 0x12, 0x26, 0x88, 0xab, 0xea, 0x29, + 0x01, 0x43, 0x00, 0xbb, 0xd9, 0x2a, 0x04, 0x34, 0x01, 0xdb, 0xb9, 0x0c, 0x11, 0x63, 0x10, 0xc9, + 0x98, 0x0c, 0x12, 0x62, 0x10, 0xd0, 0x99, 0xab, 0x12, 0x52, 0x11, 0xd1, 0x89, 0xab, 0x22, 0x72, + 0x11, 0xc1, 0x8b, 0xcb, 0x11, 0x40, 0x02, 0xa4, 0x0c, 0xca, 0x20, 0x41, 0x02, 0x94, 0x8d, 0xc9, + 0x09, 0x31, 0x03, 0x05, 0x8d, 0xa8, 0x1a, 0x31, 0x05, 0x13, 0x9e, 0xb8, 0x0c, 0x21, 0x03, 0x43, + 0xac, 0xa0, 0x8c, 0x21, 0x06, 0x41, 0xbb, 0x98, 0x9d, 0x20, 0x03, 0x72, 0xb8, 0x90, 0xab, 0x21, + 0x05, 0x61, 0xb8, 0x89, 0xac, 0x18, 0x23, 0x71, 0xa0, 0x89, 0xba, 0x18, 0x15, 0x60, 0xb1, 0x99, + 0xca, 0x09, 0x33, 0x68, 0x92, 0x99, 0xca, 0x89, 0x34, 0x48, 0x95, 0x8b, 0xba, 0x8c, 0x32, 0x40, + 0x86, 0x89, 0xb9, 0x9a, 0x42, 0x20, 0x07, 0x9a, 0xb8, 0xac, 0x31, 0x21, 0x17, 0x99, 0xa8, 0xab, + 0x50, 0x01, 0x16, 0xa9, 0xb8, 0xac, 0x38, 0x02, 0x37, 0x99, 0x98, 0xac, 0x28, 0x02, 0x55, 0xa8, + 0xa8, 0xcb, 0x29, 0x02, 0x73, 0x91, 0x98, 0xbb, 0x1a, 0x04, 0x72, 0xa1, 0x88, 0xac, 0x0b, 0x03, + 0x72, 0xa3, 0x08, 0xcb, 0x8a, 0x13, 0x70, 0xa3, 0x88, 0xdb, 0x8a, 0x12, 0x60, 0x83, 0x09, 0xd9, + 0x9a, 0x21, 0x58, 0x85, 0x89, 0xb9, 0xab, 0x30, 0x58, 0x07, 0x19, 0xb8, 0x9b, 0x10, 0x10, 0x27, + 0x89, 0xc0, 0xbb, 0x10, 0x11, 0x37, 0x09, 0xb0, 0x9d, 0x19, 0x01, 0x45, 0x89, 0xa0, 0xad, 0x08, + 0x01, 0x45, 0x88, 0x91, 0x9d, 0x09, 0x00, 0x73, 0x90, 0x80, 0xac, 0x09, 0x00, 0x73, 0x91, 0x81, + 0xcb, 0x89, 0x81, 0x72, 0x91, 0x00, 0xcb, 0x89, 0x08, 0x72, 0x82, 0x18, 0xda, 0x89, 0x80, 0x51, + 0x82, 0x18, 0xea, 0x8a, 0x00, 0x50, 0x03, 0x18, 0xf8, 0x8a, 0x80, 0x30, 0x05, 0x08, 0xc8, 0x8c, + 0x80, 0x30, 0x25, 0x09, 0xc1, 0x8d, 0x08, 0x28, 0x24, 0x88, 0xb1, 0x9f, 0x08, 0x28, 0x25, 0x88, + 0x91, 0xae, 0x80, 0x18, 0x34, 0x90, 0x81, 0xaf, 0x08, 0x18, 0x53, 0x80, 0x00, 0xbd, 0x08, 0x19, + 0x63, 0x91, 0x00, 0xfb, 0x08, 0x08, 0x42, 0x81, 0x18, 0xfa, 0x09, 0x08, 0x41, 0x82, 0x08, 0xf9, + 0x09, 0x88, 0x32, 0x04, 0x19, 0xe8, 0x0b, 0x90, 0x41, 0x13, 0x09, 0xe0, 0x0c, 0x90, 0x31, 0x14, + 0x88, 0xc1, 0x8e, 0x80, 0x38, 0x33, 0x98, 0xb1, 0xbf, 0x81, 0x38, 0x25, 0x90, 0x91, 0xaf, 0x80, + 0x28, 0x43, 0x80, 0x80, 0xbf, 0x81, 0x18, 0x34, 0x91, 0x18, 0xce, 0x80, 0x18, 0x42, 0x92, 0x18, + 0xec, 0x08, 0x08, 0x42, 0x82, 0x19, 0xfa, 0x09, 0x08, 0x41, 0x02, 0x09, 0xf8, 0x0a, 0x00, 0x40, + 0x12, 0x89, 0xd8, 0x0c, 0x80, 0x40, 0x13, 0x89, 0xd1, 0x8d, 0x81, 0x20, 0x24, 0x89, 0xb0, 0x9f, + 0x00, 0x10, 0x15, 0x90, 0x90, 0x9e, 0x00, 0x18, 0x34, 0x98, 0x88, 0xbe, 0x10, 0x18, 0x25, 0x91, + 0x08, 0xbe, 0x00, 0x00, 0x34, 0xa2, 0x09, 0xfc, 0x08, 0x80, 0x43, 0x81, 0x08, 0xeb, 0x09, 0x00, + 0x42, 0x83, 0x8a, 0xea, 0x0b, 0x01, 0x62, 0x02, 0x89, 0xd8, 0x8b, 0x82, 0x51, 0x03, 0x99, 0xc9, + 0x9d, 0x01, 0x41, 0x14, 0x98, 0xb8, 0xad, 0x11, 0x38, 0x26, 0x99, 0xa9, 0xbd, 0x21, 0x20, 0x26, + 0x90, 0x89, 0xbd, 0x28, 0x10, 0x35, 0xa0, 0x9a, 0xdc, 0x29, 0x11, 0x25, 0x92, 0x9a, 0xfa, 0x19, + 0x01, 0x42, 0x81, 0x9b, 0xea, 0x1a, 0x83, 0x53, 0x02, 0x9a, 0xe8, 0x0b, 0x02, 0x41, 0x03, 0xac, + 0xc0, 0x8c, 0x03, 0x51, 0x13, 0xaa, 0xa8, 0x9f, 0x02, 0x20, 0x23, 0xca, 0xa8, 0x9f, 0x22, 0x20, + 0x43, 0xb9, 0x88, 0xbe, 0x22, 0x18, 0x43, 0xd8, 0x09, 0xdb, 0x31, 0x10, 0x53, 0xb0, 0x19, 0xfb, + 0x38, 0x88, 0x32, 0xc1, 0x1b, 0xf9, 0x28, 0x01, 0x32, 0xb3, 0x1b, 0xf8, 0x2b, 0x81, 0x40, 0xb3, + 0x8c, 0xd1, 0x3b, 0x83, 0x51, 0x84, 0x8b, 0xb0, 0x1f, 0x01, 0x19, 0x84, 0x9b, 0xa1, 0x0e, 0x13, + 0x28, 0x15, 0x9b, 0x92, 0x9f, 0x02, 0x88, 0x23, 0xcb, 0x01, 0x9e, 0x23, 0x08, 0x44, 0xb9, 0x01, + 0xbd, 0x22, 0x99, 0x52, 0xc9, 0x10, 0xcb, 0x32, 0x81, 0x72, 0xb0, 0x28, 0xea, 0x10, 0x90, 0x48, + 0xb0, 0x3a, 0xf8, 0x20, 0x81, 0x40, 0xa2, 0x2a, 0xf8, 0x29, 0x90, 0x29, 0xb3, 0x2c, 0xd1, 0x29, + 0x12, 0x48, 0x85, 0x0b, 0xe2, 0x09, 0x80, 0x19, 0x84, 0x0d, 0xb2, 0x2a, 0x13, 0x18, 0x17, 0x8b, + 0xc3, 0x0c, 0x81, 0x99, 0x33, 0x9e, 0x93, 0x1c, 0x12, 0x10, 0x44, 0xba, 0x83, 0x9f, 0x81, 0x98, + 0x41, 0xd9, 0x11, 0x8b, 0x13, 0x01, 0x73, 0xc0, 0x11, 0x9d, 0x80, 0x90, 0x38, 0xe1, 0x20, 0x9b, + 0x22, 0x11, 0x61, 0xc2, 0x39, 0xcb, 0x80, 0x98, 0x29, 0xc5, 0x4a, 0xb8, 0x21, 0x21, 0x30, 0x97, + 0x3b, 0xe8, 0x88, 0x88, 0x88, 0x94, 0x2c, 0xc1, 0x20, 0x11, 0x02, 0x07, 0x0b, 0xd1, 0x09, 0x89, + 0xa0, 0x23, 0x0f, 0xa2, 0x29, 0x21, 0x83, 0x45, 0x8c, 0xb2, 0x8c, 0x98, 0xa1, 0x50, 0xab, 0x84, + 0x2a, 0x11, 0x05, 0x61, 0xb8, 0x92, 0x8e, 0x98, 0x80, 0x39, 0xc0, 0x12, 0x0c, 0x03, 0x24, 0x58, + 0xc1, 0x10, 0xad, 0xa0, 0x28, 0x2b, 0xe3, 0x28, 0x89, 0x13, 0x71, 0x18, 0xa4, 0x2a, 0xdb, 0x90, + 0x19, 0x9a, 0xa5, 0x39, 0xa8, 0x43, 0x68, 0x81, 0x94, 0x1a, 0xe9, 0x88, 0x0a, 0xa0, 0x83, 0x1c, + 0xb2, 0x62, 0x30, 0x93, 0x05, 0x8b, 0xf8, 0x19, 0x9a, 0xa1, 0x11, 0x0d, 0x82, 0x79, 0x01, 0x83, + 0x21, 0xac, 0xa0, 0x1d, 0xb8, 0x80, 0x2a, 0xab, 0x14, 0x7a, 0x85, 0x12, 0x18, 0xb9, 0xa0, 0x8e, + 0xb2, 0x09, 0x0a, 0xd9, 0x31, 0x29, 0x37, 0x31, 0x00, 0xe8, 0x09, 0xac, 0x83, 0x0b, 0x89, 0xda, + 0x38, 0x81, 0x67, 0x00, 0x81, 0xa8, 0x0a, 0xca, 0x21, 0xaa, 0xa0, 0xd9, 0x3a, 0x84, 0x65, 0x00, + 0x01, 0xa8, 0x8b, 0xd8, 0x38, 0xc8, 0x08, 0xa9, 0x0c, 0x04, 0x72, 0x83, 0x11, 0xa9, 0x9c, 0xa0, + 0x4b, 0xb1, 0x89, 0xca, 0x9b, 0x16, 0x61, 0x04, 0x28, 0xa8, 0xbb, 0x80, 0x1d, 0xa3, 0x8b, 0xa9, + 0xac, 0x63, 0x30, 0x27, 0x18, 0x98, 0xca, 0x08, 0xaa, 0x85, 0x0b, 0xa8, 0xbb, 0x70, 0x11, 0x27, + 0x08, 0x80, 0xba, 0x0a, 0xb9, 0x24, 0x9c, 0x98, 0xcb, 0x58, 0x02, 0x37, 0x08, 0x81, 0xca, 0x0a, + 0xb8, 0x41, 0xba, 0x90, 0xcb, 0x39, 0x06, 0x64, 0x00, 0x80, 0xb8, 0x8b, 0xb0, 0x59, 0xb8, 0x98, + 0xb9, 0x2b, 0x27, 0x71, 0x82, 0x81, 0xb8, 0x9c, 0x91, 0x2a, 0xb1, 0x9a, 0xd9, 0x0b, 0x26, 0x62, + 0x03, 0x00, 0xb8, 0xad, 0x00, 0x0b, 0x93, 0xac, 0xa8, 0x9c, 0x45, 0x31, 0x16, 0x08, 0x98, 0xcb, + 0x18, 0x9b, 0x83, 0xbb, 0x99, 0xbd, 0x73, 0x22, 0x17, 0x80, 0x88, 0xca, 0x19, 0xa9, 0x12, 0xba, + 0x8a, 0xdb, 0x70, 0x03, 0x25, 0x00, 0x09, 0xda, 0x1a, 0xb8, 0x11, 0xc8, 0x8a, 0xc8, 0x79, 0x02, + 0x43, 0x02, 0x0a, 0xd9, 0x0b, 0xb1, 0x19, 0xa0, 0x8e, 0xa0, 0x4a, 0x06, 0x42, 0x02, 0x89, 0xc0, + 0x8c, 0xa1, 0x1a, 0x80, 0xad, 0x81, 0x1c, 0x17, 0x30, 0x22, 0x99, 0x90, 0x9f, 0x91, 0x8a, 0x00, + 0xbb, 0x01, 0x8c, 0x37, 0x30, 0x43, 0xa8, 0x00, 0xbe, 0x00, 0x9b, 0x10, 0xdb, 0x28, 0xc9, 0x45, + 0x10, 0x33, 0xa1, 0x29, 0xfc, 0x18, 0xaa, 0x18, 0xc0, 0x29, 0xc0, 0x61, 0x11, 0x31, 0xa3, 0x19, + 0xf0, 0x1b, 0xb9, 0x09, 0xb1, 0x2c, 0xd3, 0x68, 0x82, 0x31, 0x84, 0x09, 0xd1, 0x0c, 0xb0, 0x8a, + 0x92, 0x1c, 0xa4, 0x4b, 0x05, 0x20, 0x14, 0x8a, 0xb3, 0x9f, 0x90, 0x8b, 0x02, 0x9b, 0x05, 0x1d, + 0x14, 0x18, 0x24, 0x99, 0x02, 0xaf, 0x80, 0xab, 0x22, 0xba, 0x34, 0x9d, 0x24, 0x08, 0x44, 0x98, + 0x11, 0xcd, 0x80, 0xaa, 0x30, 0xb8, 0x61, 0xba, 0x33, 0x80, 0x74, 0x91, 0x38, 0xfb, 0x08, 0xa9, + 0x28, 0xa1, 0x58, 0xb8, 0x30, 0x91, 0x72, 0x93, 0x39, 0xf9, 0x89, 0xb8, 0x28, 0xa2, 0x49, 0xd2, + 0x28, 0x81, 0x50, 0x04, 0x3a, 0xf1, 0x8a, 0xa8, 0x09, 0x03, 0x3b, 0xb5, 0x2a, 0x82, 0x58, 0x16, + 0x1a, 0xc2, 0x8c, 0xa8, 0x8a, 0x23, 0x0b, 0x97, 0x0a, 0x02, 0x28, 0x27, 0x89, 0x93, 0x9f, 0x88, + 0x9a, 0x22, 0x99, 0x05, 0x8b, 0x03, 0x18, 0x55, 0xa0, 0x03, 0xaf, 0x90, 0x8a, 0x30, 0xb0, 0x34, + 0x9c, 0x11, 0x18, 0x64, 0x90, 0x21, 0xbd, 0x89, 0xaa, 0x48, 0xa1, 0x52, 0xba, 0x22, 0x08, 0x72, + 0xa3, 0x30, 0xfb, 0x89, 0xaa, 0x28, 0xa3, 0x68, 0xb0, 0x20, 0x08, 0x52, 0x85, 0x29, 0xe8, 0x99, + 0xa9, 0x08, 0x83, 0x59, 0xb1, 0x28, 0x80, 0x52, 0x06, 0x29, 0xd0, 0x8b, 0xba, 0x88, 0x23, 0x4a, + 0xa4, 0x2a, 0x80, 0x51, 0x35, 0x09, 0xc2, 0x9e, 0xb9, 0x88, 0x22, 0x29, 0x95, 0x1a, 0x91, 0x31, + 0x37, 0x80, 0xa2, 0xaf, 0xb9, 0x0a, 0x30, 0x00, 0x06, 0x8a, 0x92, 0x48, 0x63, 0x81, 0x81, 0xbd, + 0xd9, 0x0a, 0x10, 0x01, 0x14, 0x9a, 0x92, 0x48, 0x43, 0x04, 0x11, 0xbe, 0xca, 0x8b, 0x10, 0x12, + 0x52, 0xa9, 0x81, 0x3a, 0x35, 0x25, 0x00, 0xfb, 0xb9, 0x8c, 0x00, 0x21, 0x41, 0xa0, 0x88, 0x1a, + 0x25, 0x34, 0x11, 0xf9, 0xab, 0x9d, 0x80, 0x31, 0x31, 0xa1, 0x09, 0x8b, 0x26, 0x63, 0x01, 0xc0, + 0xac, 0xac, 0x88, 0x41, 0x11, 0x83, 0x8a, 0xaa, 0x34, 0x73, 0x83, 0xa0, 0xae, 0xcb, 0x88, 0x30, + 0x04, 0x12, 0x9a, 0xa9, 0x32, 0x74, 0x03, 0x88, 0xbd, 0xdb, 0x09, 0x28, 0x14, 0x21, 0xa9, 0xa9, + 0x31, 0x73, 0x14, 0x08, 0xcc, 0xbb, 0x8a, 0x28, 0x16, 0x11, 0x98, 0xa9, 0x38, 0x53, 0x25, 0x80, + 0xea, 0xbb, 0x8b, 0x18, 0x44, 0x11, 0x90, 0xb9, 0x39, 0x53, 0x45, 0x08, 0xd9, 0xbb, 0x8c, 0x08, + 0x53, 0x01, 0x91, 0x99, 0x1a, 0x33, 0x56, 0x80, 0xb8, 0xbd, 0x8c, 0x08, 0x41, 0x12, 0x81, 0x9a, + 0x8a, 0x24, 0x54, 0x82, 0xa8, 0xbe, 0xac, 0x80, 0x41, 0x03, 0x01, 0xa9, 0x8a, 0x42, 0x72, 0x83, + 0x98, 0xdc, 0xab, 0x09, 0x30, 0x16, 0x10, 0xa8, 0x8a, 0x21, 0x52, 0x15, 0x89, 0xdb, 0xbc, 0x88, + 0x10, 0x25, 0x10, 0x90, 0x9b, 0x21, 0x42, 0x17, 0x88, 0xd9, 0xac, 0x89, 0x18, 0x34, 0x01, 0x91, + 0xba, 0x20, 0x32, 0x57, 0x90, 0xb9, 0xcd, 0x89, 0x08, 0x43, 0x02, 0x81, 0xba, 0x18, 0x22, 0x47, + 0x91, 0xa9, 0xbe, 0x9a, 0x08, 0x52, 0x12, 0x10, 0xaa, 0x1a, 0x12, 0x46, 0x02, 0xaa, 0xce, 0x9b, + 0x08, 0x32, 0x24, 0x10, 0xc8, 0x0a, 0x12, 0x63, 0x13, 0xaa, 0xdd, 0xab, 0x09, 0x41, 0x33, 0x01, + 0xc0, 0x9a, 0x21, 0x44, 0x24, 0xa9, 0xdc, 0xac, 0x89, 0x22, 0x53, 0x81, 0x90, 0xaa, 0x20, 0x34, + 0x72, 0xa0, 0xca, 0xbc, 0x8a, 0x31, 0x62, 0x82, 0x80, 0xaa, 0x19, 0x34, 0x61, 0xa2, 0xca, 0xad, + 0xaa, 0x22, 0x60, 0x83, 0x80, 0x9a, 0x8a, 0x44, 0x30, 0x84, 0xcb, 0xbc, 0xbb, 0x31, 0x51, 0x06, + 0x88, 0x98, 0x8a, 0x51, 0x20, 0x04, 0xba, 0xcc, 0xab, 0x38, 0x31, 0x27, 0x88, 0xa8, 0xa9, 0x50, + 0x02, 0x15, 0xb9, 0xcb, 0xbc, 0x39, 0x11, 0x27, 0x80, 0x98, 0xaa, 0x48, 0x03, 0x44, 0xa9, 0xcb, + 0xbc, 0x1a, 0x03, 0x55, 0x91, 0x88, 0xaa, 0x29, 0x05, 0x52, 0xa0, 0xbb, 0xcc, 0x89, 0x03, 0x73, + 0x81, 0x88, 0xa9, 0x1a, 0x14, 0x51, 0xa2, 0xbb, 0xbd, 0x8b, 0x22, 0x72, 0x03, 0x89, 0xb9, 0x8b, + 0x25, 0x41, 0x94, 0xab, 0xcc, 0x9b, 0x22, 0x51, 0x14, 0x89, 0xb9, 0x9a, 0x43, 0x41, 0x85, 0xaa, + 0xdb, 0xab, 0x21, 0x32, 0x27, 0x89, 0xb8, 0x9a, 0x31, 0x33, 0x27, 0xbb, 0xda, 0xac, 0x20, 0x21, + 0x26, 0x98, 0xa0, 0xab, 0x31, 0x33, 0x27, 0xc9, 0xb9, 0x9e, 0x08, 0x22, 0x63, 0x98, 0x90, 0xab, + 0x20, 0x32, 0x45, 0xb8, 0xba, 0xaf, 0x08, 0x21, 0x44, 0x90, 0x88, 0xac, 0x00, 0x32, 0x44, 0xc1, + 0x9a, 0xbd, 0x88, 0x22, 0x44, 0x92, 0x89, 0xbc, 0x18, 0x32, 0x44, 0xa2, 0x9c, 0xcd, 0x09, 0x20, + 0x43, 0x94, 0x09, 0xda, 0x08, 0x21, 0x33, 0x94, 0x9c, 0xdc, 0x09, 0x10, 0x33, 0x05, 0x0a, 0xda, + 0x09, 0x11, 0x43, 0x03, 0xac, 0xfa, 0x0a, 0x00, 0x33, 0x14, 0x8a, 0xd8, 0x0b, 0x11, 0x34, 0x13, + 0xcb, 0xea, 0x8c, 0x10, 0x32, 0x24, 0x99, 0xc8, 0x8c, 0x10, 0x43, 0x23, 0xc9, 0xda, 0x9c, 0x00, + 0x42, 0x33, 0xa8, 0xb8, 0x9f, 0x10, 0x32, 0x24, 0xb8, 0xbb, 0xbf, 0x00, 0x42, 0x42, 0x90, 0x99, + 0x9e, 0x00, 0x32, 0x33, 0xc1, 0xab, 0xbf, 0x00, 0x31, 0x34, 0x91, 0x9a, 0xae, 0x18, 0x41, 0x33, + 0xa1, 0xac, 0xbe, 0x08, 0x31, 0x34, 0x93, 0x9b, 0xec, 0x08, 0x31, 0x43, 0x92, 0xbb, 0xdd, 0x09, + 0x21, 0x33, 0x04, 0xaa, 0xeb, 0x09, 0x21, 0x34, 0x03, 0xac, 0xcc, 0x0b, 0x21, 0x34, 0x23, 0xca, + 0xca, 0x0c, 0x21, 0x34, 0x13, 0xda, 0xda, 0x8b, 0x21, 0x43, 0x23, 0xb9, 0xcb, 0x9d, 0x12, 0x34, + 0x23, 0xd9, 0xca, 0x9c, 0x11, 0x42, 0x23, 0xc0, 0xaa, 0xac, 0x21, 0x63, 0x22, 0xb8, 0xac, 0xad, + 0x10, 0x42, 0x33, 0xa0, 0xac, 0xdb, 0x20, 0x42, 0x23, 0xa1, 0xae, 0xda, 0x18, 0x32, 0x33, 0x91, + 0xad, 0xca, 0x29, 0x43, 0x33, 0x92, 0xaf, 0xc9, 0x19, 0x22, 0x43, 0x82, 0xbc, 0xc9, 0x1a, 0x43, + 0x43, 0x81, 0xdb, 0xc9, 0x0a, 0x32, 0x43, 0x02, 0xdb, 0xb9, 0x1c, 0x32, 0x34, 0x03, 0xfb, 0xa9, + 0x0c, 0x21, 0x33, 0x22, 0xea, 0xaa, 0x8b, 0x33, 0x35, 0x13, 0xea, 0xaa, 0x9c, 0x22, 0x43, 0x22, + 0xd9, 0xaa, 0x9c, 0x32, 0x53, 0x12, 0xc8, 0xab, 0xad, 0x31, 0x42, 0x22, 0xc0, 0x9c, 0xbb, 0x51, + 0x32, 0x23, 0xc0, 0x9d, 0xbb, 0x30, 0x43, 0x33, 0xc1, 0xad, 0xba, 0x30, 0x34, 0x34, 0xb1, 0xae, + 0xba, 0x28, 0x24, 0x33, 0xa2, 0xaf, 0xb9, 0x39, 0x24, 0x24, 0x81, 0xad, 0xba, 0x2b, 0x24, 0x24, + 0x82, 0xbd, 0xba, 0x2a, 0x34, 0x44, 0x01, 0xac, 0xbb, 0x0b, 0x34, 0x43, 0x02, 0xeb, 0xaa, 0x0b, + 0x43, 0x53, 0x02, 0xca, 0xba, 0x9b, 0x43, 0x43, 0x03, 0xea, 0xaa, 0x8b, 0x52, 0x32, 0x14, 0xba, + 0xac, 0xab, 0x41, 0x43, 0x13, 0xca, 0xac, 0x9b, 0x50, 0x33, 0x24, 0xc8, 0xbb, 0xba, 0x30, 0x26, + 0x23, 0xb9, 0xcd, 0x9a, 0x38, 0x25, 0x33, 0xa0, 0xbd, 0xaa, 0x2a, 0x26, 0x22, 0xb0, 0xcc, 0xaa, + 0x18, 0x35, 0x43, 0x90, 0xda, 0x9a, 0x0a, 0x34, 0x32, 0xa1, 0xdc, 0x9b, 0x1a, 0x44, 0x32, 0x82, + 0xda, 0xab, 0x9a, 0x44, 0x22, 0x92, 0xea, 0xab, 0x99, 0x44, 0x32, 0x03, 0xd9, 0x9c, 0x99, 0x41, + 0x22, 0x02, 0xda, 0x9d, 0x89, 0x41, 0x23, 0x13, 0xc8, 0x9d, 0x99, 0x48, 0x22, 0x12, 0xca, 0xad, + 0x99, 0x40, 0x24, 0x22, 0xb0, 0xad, 0xa9, 0x28, 0x15, 0x22, 0xc8, 0xbc, 0xaa, 0x48, 0x25, 0x32, + 0xa1, 0xbc, 0xaa, 0x1a, 0x26, 0x21, 0xa0, 0xbe, 0x9a, 0x19, 0x36, 0x31, 0x82, 0xbc, 0xaa, 0x8a, + 0x35, 0x21, 0xa2, 0xaf, 0xaa, 0x09, 0x35, 0x32, 0x04, 0xbb, 0xab, 0xab, 0x44, 0x12, 0x84, 0xae, + 0xaa, 0x89, 0x63, 0x22, 0x23, 0xbb, 0xbb, 0xbb, 0x71, 0x11, 0x22, 0xbd, 0xba, 0xab, 0x73, 0x22, + 0x43, 0xb8, 0xb9, 0xba, 0x49, 0x12, 0x52, 0xda, 0xa9, 0xbb, 0x60, 0x13, 0x53, 0x90, 0xa9, 0xbb, + 0x19, 0x13, 0x72, 0xc8, 0xa9, 0xbb, 0x38, 0x17, 0x42, 0x92, 0x99, 0xbb, 0x8a, 0x12, 0x70, 0xb1, + 0xaa, 0xcb, 0x2a, 0x34, 0x73, 0x02, 0x98, 0xba, 0x9b, 0x00, 0x50, 0xa3, 0x9b, 0xdc, 0x8a, 0x42, + 0x62, 0x13, 0x80, 0xca, 0x9b, 0x89, 0x30, 0x05, 0x8a, 0xfa, 0x8a, 0x20, 0x52, 0x24, 0x00, 0xc8, + 0x9b, 0x9a, 0x10, 0x15, 0x89, 0xe8, 0x8b, 0x08, 0x53, 0x25, 0x01, 0xa0, 0x9d, 0xa9, 0x09, 0x33, + 0x80, 0xc0, 0x8f, 0x89, 0x31, 0x45, 0x11, 0x91, 0x9d, 0xb9, 0x89, 0x32, 0x01, 0x91, 0xbf, 0x98, + 0x38, 0x46, 0x22, 0x81, 0xac, 0xc9, 0x8b, 0x31, 0x11, 0x01, 0xcd, 0xa8, 0x19, 0x46, 0x22, 0x12, + 0xcb, 0xba, 0x9d, 0x20, 0x21, 0x11, 0xda, 0x9a, 0x8b, 0x46, 0x32, 0x14, 0xb9, 0xbb, 0xae, 0x00, + 0x22, 0x11, 0xc8, 0x8b, 0xac, 0x44, 0x53, 0x12, 0xb1, 0x9c, 0xbd, 0x00, 0x20, 0x03, 0xa1, 0x8d, + 0xcb, 0x32, 0x54, 0x23, 0x91, 0xac, 0xcc, 0x09, 0x28, 0x14, 0x80, 0x9b, 0xdb, 0x20, 0x63, 0x24, + 0x00, 0xba, 0xcc, 0x8a, 0x10, 0x14, 0x01, 0xaa, 0xdb, 0x29, 0x53, 0x25, 0x11, 0xb9, 0xcc, 0x8b, + 0x08, 0x43, 0x01, 0xa8, 0xcb, 0x0b, 0x53, 0x36, 0x02, 0xa0, 0xbd, 0x9c, 0x08, 0x32, 0x12, 0x90, + 0xbd, 0x8b, 0x32, 0x57, 0x02, 0x80, 0xbc, 0xbb, 0x09, 0x42, 0x13, 0x00, 0xcc, 0xaa, 0x30, 0x65, + 0x12, 0x00, 0xda, 0xbb, 0x89, 0x31, 0x14, 0x01, 0xd9, 0xab, 0x28, 0x54, 0x24, 0x01, 0xca, 0xbc, + 0x9a, 0x30, 0x24, 0x01, 0xd0, 0xab, 0x19, 0x53, 0x26, 0x01, 0xb8, 0xae, 0x9a, 0x10, 0x33, 0x11, + 0xc1, 0xac, 0x99, 0x43, 0x45, 0x11, 0xb0, 0xad, 0xab, 0x19, 0x43, 0x12, 0x81, 0x9f, 0x99, 0x21, + 0x44, 0x03, 0x91, 0xbd, 0xcb, 0x09, 0x32, 0x04, 0x02, 0xad, 0xa9, 0x38, 0x54, 0x23, 0x00, 0xbd, + 0xcb, 0x0a, 0x31, 0x33, 0x11, 0xfb, 0xa9, 0x18, 0x63, 0x33, 0x01, 0xeb, 0xab, 0x9b, 0x21, 0x34, + 0x21, 0xd9, 0xaa, 0x1a, 0x53, 0x35, 0x02, 0xca, 0xbc, 0x9b, 0x28, 0x53, 0x12, 0xa8, 0xac, 0x8a, + 0x43, 0x45, 0x12, 0xa9, 0xbd, 0x9c, 0x08, 0x42, 0x12, 0x90, 0xca, 0x9a, 0x32, 0x55, 0x13, 0xa8, + 0xcc, 0xbb, 0x08, 0x41, 0x33, 0x90, 0xc9, 0x9c, 0x30, 0x63, 0x24, 0xa0, 0xca, 0xad, 0x09, 0x20, + 0x24, 0x91, 0x98, 0xad, 0x20, 0x42, 0x25, 0x91, 0xba, 0xbe, 0x89, 0x18, 0x44, 0x91, 0x80, 0xac, + 0x18, 0x22, 0x46, 0x91, 0x99, 0xbd, 0x8a, 0x08, 0x53, 0x82, 0x18, 0xdb, 0x19, 0x21, 0x54, 0x82, + 0x89, 0xec, 0x89, 0x88, 0x31, 0x04, 0x09, 0xc8, 0x0a, 0x21, 0x53, 0x05, 0x8a, 0xe9, 0x9a, 0x88, + 0x21, 0x24, 0x09, 0xb0, 0x0d, 0x01, 0x42, 0x25, 0x9a, 0xd0, 0x9c, 0x98, 0x10, 0x34, 0x88, 0x91, + 0x9d, 0x11, 0x21, 0x36, 0xa8, 0xb0, 0xbf, 0x88, 0x18, 0x52, 0x80, 0x00, 0xbb, 0x21, 0x21, 0x56, + 0x90, 0x89, 0xcd, 0x88, 0x88, 0x32, 0x93, 0x20, 0xea, 0x18, 0x11, 0x63, 0x92, 0x89, 0xfb, 0x8b, + 0x90, 0x31, 0x04, 0x18, 0xc1, 0x1b, 0x02, 0x72, 0x83, 0x99, 0xf8, 0x9b, 0x90, 0x20, 0x24, 0x08, + 0xa2, 0x8d, 0x02, 0x40, 0x15, 0x99, 0xa8, 0xbf, 0x80, 0x19, 0x33, 0x01, 0x11, 0xbc, 0x12, 0x48, + 0x35, 0xb1, 0x99, 0xef, 0x88, 0x08, 0x31, 0x01, 0x30, 0xda, 0x10, 0x00, 0x34, 0x92, 0x8b, 0xfb, + 0x8e, 0x88, 0x21, 0x13, 0x18, 0xd2, 0x19, 0x00, 0x41, 0x13, 0x9c, 0xf0, 0x8c, 0x88, 0x28, 0x33, + 0x18, 0x93, 0x8d, 0x01, 0x30, 0x25, 0xb9, 0xc0, 0xbf, 0x98, 0x00, 0x63, 0x00, 0x12, 0x9c, 0x00, + 0x10, 0x52, 0xb0, 0x08, 0xcf, 0x88, 0x88, 0x41, 0x02, 0x31, 0xca, 0x00, 0x08, 0x61, 0xa2, 0x09, + 0xfc, 0x89, 0x88, 0x30, 0x04, 0x30, 0xb0, 0x0a, 0x00, 0x58, 0x85, 0x0a, 0xf8, 0x9b, 0x88, 0x28, + 0x16, 0x20, 0x91, 0x8b, 0x00, 0x29, 0x17, 0x8a, 0xc0, 0xad, 0x09, 0x19, 0x35, 0x10, 0x83, 0xab, + 0x00, 0x0a, 0x36, 0x98, 0xb0, 0xdf, 0x89, 0x88, 0x53, 0x11, 0x12, 0xaa, 0x09, 0x99, 0x73, 0x91, + 0x88, 0xec, 0x8a, 0x88, 0x41, 0x13, 0x32, 0xc8, 0x0a, 0x98, 0x50, 0x83, 0x09, 0xec, 0x9c, 0x90, + 0x48, 0x14, 0x21, 0x90, 0x9b, 0xa1, 0x49, 0x14, 0x98, 0xd9, 0xae, 0x88, 0x29, 0x35, 0x21, 0x01, + 0xcb, 0x80, 0x1b, 0x25, 0x80, 0xb9, 0xcf, 0x09, 0x09, 0x34, 0x23, 0x02, 0xe8, 0x09, 0x8a, 0x33, + 0x02, 0xaa, 0xfd, 0x0b, 0x89, 0x43, 0x24, 0x11, 0xb8, 0x0b, 0xaa, 0x61, 0x12, 0xa9, 0xfa, 0x9c, + 0x88, 0x31, 0x35, 0x02, 0xa1, 0xab, 0xb9, 0x40, 0x24, 0x98, 0xea, 0xad, 0x89, 0x20, 0x36, 0x12, + 0x81, 0xac, 0xa8, 0x18, 0x43, 0x91, 0xc9, 0xbe, 0x9a, 0x38, 0x45, 0x23, 0x00, 0xba, 0xab, 0x1a, + 0x63, 0x82, 0xa9, 0xed, 0x9a, 0x18, 0x53, 0x33, 0x01, 0xb9, 0xbb, 0x8a, 0x42, 0x15, 0x98, 0xcd, + 0xbb, 0x09, 0x63, 0x34, 0x11, 0xa8, 0xcb, 0x99, 0x21, 0x24, 0x90, 0xcc, 0xbc, 0x0a, 0x42, 0x45, + 0x02, 0x88, 0xbb, 0x9a, 0x10, 0x53, 0x81, 0xda, 0xbc, 0x8b, 0x31, 0x46, 0x13, 0x80, 0xba, 0xac, + 0x00, 0x42, 0x03, 0xbb, 0xce, 0x9b, 0x30, 0x44, 0x15, 0x80, 0xb8, 0xab, 0x08, 0x41, 0x23, 0xca, + 0xeb, 0xab, 0x28, 0x44, 0x34, 0x81, 0xa9, 0xcb, 0x1a, 0x11, 0x34, 0xc8, 0xca, 0xad, 0x19, 0x43, + 0x44, 0x01, 0x98, 0xcb, 0x0a, 0x01, 0x43, 0xb1, 0xda, 0xcb, 0x0a, 0x43, 0x44, 0x12, 0x98, 0xcb, + 0x9a, 0x20, 0x41, 0x93, 0xbc, 0xcc, 0x8b, 0x52, 0x52, 0x22, 0x98, 0xc9, 0xaa, 0x10, 0x31, 0x13, + 0xeb, 0xcb, 0xab, 0x41, 0x44, 0x33, 0x90, 0xc9, 0xbb, 0x29, 0x22, 0x33, 0xf9, 0xcb, 0xab, 0x38, + 0x36, 0x34, 0x81, 0xaa, 0xbc, 0x0a, 0x23, 0x32, 0xd1, 0xbd, 0xbb, 0x29, 0x46, 0x42, 0x01, 0xa9, + 0xba, 0x9b, 0x32, 0x32, 0xa3, 0xcf, 0xbb, 0x0a, 0x45, 0x33, 0x14, 0xa9, 0xcb, 0xaa, 0x31, 0x12, + 0x13, 0xce, 0xbb, 0x9a, 0x73, 0x23, 0x24, 0xa8, 0xba, 0xbb, 0x49, 0x13, 0x31, 0xfb, 0xac, 0x99, + 0x40, 0x25, 0x32, 0xa0, 0xba, 0xcb, 0x19, 0x14, 0x21, 0xf0, 0xba, 0x9a, 0x38, 0x37, 0x31, 0x92, + 0xab, 0xcb, 0x8a, 0x24, 0x20, 0xc2, 0xae, 0x9a, 0x19, 0x36, 0x32, 0x84, 0xab, 0xb9, 0x9c, 0x33, + 0x01, 0x93, 0xcf, 0xa9, 0x09, 0x54, 0x12, 0x13, 0xba, 0xb9, 0xac, 0x41, 0x01, 0x02, 0xdd, 0xa9, + 0x89, 0x63, 0x22, 0x33, 0xc9, 0xa9, 0xcb, 0x30, 0x02, 0x21, 0xfb, 0x9b, 0x9b, 0x62, 0x24, 0x22, + 0xc1, 0x8a, 0xcb, 0x18, 0x13, 0x20, 0xf9, 0x8b, 0xba, 0x51, 0x34, 0x31, 0xa2, 0x9c, 0xca, 0x19, + 0x12, 0x01, 0xd1, 0x8e, 0xb9, 0x30, 0x44, 0x22, 0x84, 0xab, 0xc9, 0x0a, 0x11, 0x02, 0xa2, 0xbf, + 0xb8, 0x3a, 0x45, 0x23, 0x23, 0xbc, 0xb8, 0x8d, 0x11, 0x11, 0x80, 0xce, 0x90, 0x0b, 0x25, 0x33, + 0x33, 0xd9, 0x89, 0x9d, 0x00, 0x11, 0x18, 0xfb, 0x09, 0x9b, 0x34, 0x43, 0x23, 0xc1, 0x8a, 0xcc, + 0x10, 0x28, 0x00, 0xe9, 0x0a, 0xca, 0x52, 0x32, 0x22, 0xa2, 0x0c, 0xfa, 0x18, 0x08, 0x81, 0xa8, + 0x0d, 0xc8, 0x40, 0x22, 0x14, 0x82, 0x8b, 0xe8, 0x1a, 0x88, 0x01, 0x98, 0x9e, 0xa0, 0x5a, 0x23, + 0x24, 0x12, 0xba, 0xd0, 0x8c, 0x81, 0x18, 0x08, 0xcd, 0x80, 0x1b, 0x26, 0x23, 0x23, 0xb9, 0xa9, + 0xaf, 0x81, 0x08, 0x00, 0xeb, 0x08, 0x8b, 0x45, 0x22, 0x32, 0xb1, 0x8b, 0xcd, 0x18, 0x99, 0x01, + 0xe8, 0x0a, 0xb8, 0x72, 0x13, 0x33, 0x91, 0x8b, 0xfb, 0x1a, 0x98, 0x18, 0xa0, 0x8e, 0xa0, 0x58, + 0x24, 0x32, 0x83, 0xab, 0xf8, 0x8b, 0x91, 0x19, 0x91, 0xac, 0x90, 0x4b, 0x27, 0x41, 0x12, 0xb8, + 0xa8, 0x9f, 0x80, 0x1a, 0x01, 0xba, 0x08, 0x8b, 0x47, 0x31, 0x15, 0x98, 0x99, 0xcc, 0x19, 0x8a, + 0x12, 0xb8, 0x1a, 0xca, 0x72, 0x32, 0x25, 0x91, 0x99, 0xfb, 0x0a, 0x98, 0x11, 0x80, 0x8a, 0xc8, + 0x68, 0x12, 0x35, 0x01, 0xa9, 0xe9, 0x8c, 0x98, 0x11, 0x01, 0xa8, 0xa8, 0x3c, 0x24, 0x46, 0x11, + 0x98, 0xba, 0x9f, 0x98, 0x20, 0x10, 0xa0, 0x99, 0x0c, 0x15, 0x63, 0x12, 0x91, 0xbb, 0xae, 0x99, + 0x20, 0x01, 0x93, 0x9b, 0xac, 0x14, 0x74, 0x12, 0x82, 0xba, 0xcc, 0xa9, 0x18, 0x12, 0x03, 0x9c, + 0xb9, 0x20, 0x74, 0x24, 0x12, 0xbb, 0xeb, 0xaa, 0x29, 0x02, 0x32, 0xca, 0xa8, 0x09, 0x72, 0x16, + 0x22, 0xb9, 0xca, 0xbb, 0x1a, 0x03, 0x61, 0xc0, 0x88, 0x89, 0x40, 0x26, 0x31, 0xc0, 0xaa, 0xbc, + 0x0a, 0x22, 0x48, 0xc3, 0x8a, 0xa8, 0x38, 0x57, 0x20, 0xb3, 0x9c, 0xc9, 0x8b, 0x22, 0x29, 0x85, + 0x8c, 0x90, 0x19, 0x36, 0x11, 0x85, 0xbb, 0xb9, 0x9d, 0x30, 0x88, 0x16, 0x9b, 0x91, 0x8a, 0x64, + 0x01, 0x23, 0xcb, 0xa9, 0xad, 0x28, 0x91, 0x34, 0xc9, 0x00, 0x8b, 0x73, 0x82, 0x52, 0xb9, 0x99, + 0xbc, 0x18, 0x92, 0x70, 0xb0, 0x18, 0x99, 0x50, 0x03, 0x60, 0xc1, 0x89, 0xba, 0x0a, 0x82, 0x58, + 0xb3, 0x2a, 0xc8, 0x30, 0x16, 0x48, 0xa3, 0x0d, 0xca, 0x0a, 0x10, 0x29, 0x86, 0x0a, 0xb1, 0x29, + 0x34, 0x20, 0x07, 0x8c, 0xb8, 0x8c, 0x00, 0x08, 0x15, 0x9a, 0x92, 0x1a, 0x52, 0x01, 0x25, 0xbb, + 0xb0, 0xaf, 0x18, 0x90, 0x53, 0x99, 0x82, 0x9a, 0x41, 0x03, 0x73, 0xb8, 0x98, 0xbd, 0x09, 0x91, + 0x70, 0xa1, 0x01, 0x99, 0x28, 0x14, 0x60, 0xa1, 0x89, 0xdc, 0x89, 0x00, 0x49, 0x93, 0x10, 0xb8, + 0x88, 0x44, 0x38, 0x87, 0x0a, 0xda, 0x9a, 0x29, 0x19, 0x07, 0x08, 0x90, 0x89, 0x40, 0x10, 0x06, + 0x89, 0xc9, 0xbb, 0x2a, 0x80, 0x27, 0x08, 0xa1, 0x9a, 0x38, 0x84, 0x36, 0x98, 0xc9, 0xbc, 0x0b, + 0x81, 0x54, 0x01, 0x90, 0xaa, 0x19, 0x14, 0x73, 0x91, 0xa8, 0xbd, 0x9b, 0x01, 0x62, 0x02, 0x80, + 0xaa, 0x8b, 0x24, 0x73, 0x82, 0x99, 0xdc, 0xaa, 0x01, 0x31, 0x24, 0x00, 0xca, 0x9a, 0x31, 0x63, + 0x04, 0x98, 0xfb, 0xaa, 0x18, 0x20, 0x25, 0x00, 0xb9, 0x9b, 0x28, 0x44, 0x34, 0x88, 0xdc, 0xbb, + 0x09, 0x21, 0x35, 0x02, 0xc8, 0xab, 0x19, 0x53, 0x34, 0x81, 0xea, 0xac, 0x8a, 0x21, 0x43, 0x13, + 0xb8, 0xad, 0x0a, 0x52, 0x33, 0x03, 0xe9, 0xad, 0x9a, 0x20, 0x42, 0x23, 0xa0, 0xad, 0x99, 0x31, + 0x35, 0x23, 0xb9, 0xcf, 0x9a, 0x18, 0x32, 0x24, 0x91, 0xcb, 0xaa, 0x30, 0x35, 0x34, 0xa8, 0xbe, + 0xbb, 0x19, 0x43, 0x53, 0x81, 0xca, 0xa9, 0x29, 0x34, 0x34, 0x80, 0xcd, 0xba, 0x8a, 0x42, 0x43, + 0x02, 0xca, 0xaa, 0x89, 0x44, 0x43, 0x01, 0xeb, 0xba, 0x9a, 0x41, 0x42, 0x12, 0xb9, 0xbb, 0xaa, + 0x73, 0x43, 0x11, 0xd9, 0xab, 0xbb, 0x30, 0x35, 0x23, 0xc0, 0xab, 0xbb, 0x60, 0x24, 0x13, 0xc0, + 0xbc, 0xcb, 0x28, 0x33, 0x34, 0xa1, 0xbc, 0xba, 0x49, 0x35, 0x33, 0xa0, 0xbe, 0xac, 0x1a, 0x42, + 0x33, 0x82, 0xdb, 0xba, 0x2a, 0x45, 0x23, 0x81, 0xdc, 0xba, 0x8a, 0x42, 0x43, 0x02, 0xca, 0xba, + 0x0b, 0x54, 0x23, 0x02, 0xea, 0xbb, 0x9b, 0x32, 0x26, 0x12, 0xb9, 0xac, 0x9b, 0x62, 0x33, 0x13, + 0xd9, 0xbc, 0xab, 0x30, 0x35, 0x13, 0xb0, 0xbd, 0xaa, 0x40, 0x35, 0x13, 0xb8, 0xcd, 0xab, 0x10, + 0x34, 0x14, 0x90, 0xbc, 0xaa, 0x28, 0x46, 0x12, 0x90, 0xcc, 0xba, 0x08, 0x34, 0x14, 0x81, 0xdb, + 0xaa, 0x18, 0x63, 0x23, 0x90, 0xeb, 0xaa, 0x89, 0x43, 0x33, 0x81, 0xea, 0xab, 0x19, 0x62, 0x33, + 0x81, 0xea, 0xbb, 0x89, 0x41, 0x34, 0x01, 0xd9, 0xab, 0x89, 0x52, 0x34, 0x81, 0xd8, 0xbb, 0x9a, + 0x31, 0x36, 0x01, 0xb8, 0xae, 0x89, 0x31, 0x45, 0x81, 0xa8, 0xcc, 0x99, 0x20, 0x53, 0x02, 0x98, + 0xbd, 0x89, 0x20, 0x45, 0x82, 0x90, 0xbd, 0x9a, 0x18, 0x44, 0x12, 0x90, 0xcc, 0x8a, 0x18, 0x54, + 0x02, 0x80, 0xcc, 0x9a, 0x08, 0x43, 0x04, 0x80, 0xda, 0x9a, 0x00, 0x62, 0x13, 0x88, 0xda, 0x9b, + 0x09, 0x51, 0x14, 0x80, 0xc9, 0xab, 0x08, 0x62, 0x14, 0x80, 0xc9, 0xab, 0x89, 0x41, 0x25, 0x80, + 0xc8, 0xbb, 0x08, 0x51, 0x34, 0x00, 0xc9, 0xbc, 0x88, 0x20, 0x36, 0x80, 0xa8, 0xad, 0x09, 0x20, + 0x36, 0x01, 0xa9, 0xbd, 0x89, 0x18, 0x45, 0x01, 0xa8, 0xdb, 0x89, 0x11, 0x54, 0x01, 0x98, 0xdb, + 0x8a, 0x00, 0x63, 0x01, 0x88, 0xcb, 0x8a, 0x10, 0x73, 0x02, 0x88, 0xda, 0x8b, 0x08, 0x62, 0x02, + 0x88, 0xd9, 0x9a, 0x10, 0x52, 0x13, 0x90, 0xda, 0x9c, 0x08, 0x41, 0x14, 0x88, 0xb9, 0x9d, 0x18, + 0x41, 0x15, 0x90, 0xb8, 0xad, 0x08, 0x30, 0x25, 0x80, 0xb9, 0xad, 0x19, 0x41, 0x25, 0x80, 0xb8, + 0xbd, 0x09, 0x30, 0x35, 0x81, 0xa9, 0xcd, 0x09, 0x21, 0x35, 0x82, 0xa9, 0xbd, 0x8a, 0x20, 0x45, + 0x01, 0x99, 0xcc, 0x89, 0x11, 0x54, 0x01, 0x98, 0xcb, 0x9b, 0x10, 0x44, 0x03, 0x99, 0xea, 0x9a, + 0x20, 0x63, 0x12, 0x98, 0xcb, 0x9c, 0x00, 0x52, 0x13, 0x89, 0xda, 0xab, 0x20, 0x62, 0x23, 0x98, + 0xd9, 0xbb, 0x08, 0x52, 0x24, 0x98, 0xb9, 0xad, 0x18, 0x41, 0x25, 0x80, 0xb9, 0xbd, 0x08, 0x31, + 0x35, 0x88, 0xa9, 0xae, 0x09, 0x22, 0x36, 0x80, 0xb8, 0xcc, 0x89, 0x21, 0x44, 0x80, 0x98, 0xbd, + 0x89, 0x22, 0x45, 0x01, 0x99, 0xbc, 0x8b, 0x20, 0x54, 0x82, 0x98, 0xbc, 0x9b, 0x31, 0x45, 0x03, + 0x98, 0xcc, 0x9b, 0x10, 0x63, 0x03, 0x98, 0xdb, 0x9b, 0x20, 0x63, 0x13, 0x90, 0xdb, 0xab, 0x18, + 0x52, 0x14, 0x88, 0xca, 0xbb, 0x28, 0x63, 0x14, 0x80, 0xba, 0xad, 0x19, 0x31, 0x35, 0x80, 0xda, + 0xab, 0x09, 0x43, 0x35, 0x00, 0xc9, 0xbc, 0x89, 0x32, 0x44, 0x81, 0xb9, 0xbd, 0x89, 0x42, 0x44, + 0x81, 0xb8, 0xbc, 0x9a, 0x32, 0x54, 0x01, 0xb8, 0xcc, 0x99, 0x31, 0x54, 0x01, 0xa0, 0xbc, 0xaa, + 0x30, 0x44, 0x03, 0xa8, 0xbd, 0x9b, 0x30, 0x45, 0x13, 0x98, 0xdc, 0x9a, 0x28, 0x43, 0x13, 0x98, + 0xdc, 0xaa, 0x20, 0x53, 0x23, 0x90, 0xcc, 0xab, 0x29, 0x53, 0x23, 0x80, 0xdc, 0xaa, 0x29, 0x53, + 0x33, 0x80, 0xeb, 0xab, 0x09, 0x43, 0x24, 0x81, 0xdb, 0xab, 0x1a, 0x53, 0x24, 0x01, 0xca, 0xac, + 0x0a, 0x32, 0x25, 0x82, 0xca, 0xbc, 0x89, 0x52, 0x43, 0x01, 0xb9, 0xbd, 0x8a, 0x32, 0x35, 0x01, + 0xc8, 0xad, 0x8a, 0x41, 0x43, 0x02, 0xa9, 0xbd, 0x9a, 0x31, 0x44, 0x02, 0xa8, 0xae, 0x8b, 0x21, + 0x35, 0x12, 0xa8, 0xbd, 0xab, 0x30, 0x45, 0x12, 0x99, 0xcc, 0x9b, 0x30, 0x44, 0x22, 0x98, 0xcc, + 0x9b, 0x28, 0x34, 0x14, 0x98, 0xeb, 0xaa, 0x10, 0x53, 0x23, 0x90, 0xdb, 0xbb, 0x18, 0x63, 0x23, + 0x98, 0xcb, 0xad, 0x18, 0x43, 0x24, 0x80, 0xbb, 0xbd, 0x18, 0x42, 0x33, 0x91, 0xeb, 0xcb, 0x08, + 0x33, 0x35, 0x81, 0xca, 0xbc, 0x09, 0x42, 0x24, 0x81, 0xca, 0xcb, 0x0a, 0x33, 0x45, 0x01, 0xaa, + 0xcc, 0x89, 0x22, 0x34, 0x02, 0xcb, 0xdb, 0x8a, 0x32, 0x44, 0x83, 0xa9, 0xcc, 0x9a, 0x22, 0x44, + 0x02, 0xb9, 0xcc, 0x8b, 0x31, 0x44, 0x13, 0xa9, 0xcc, 0x9b, 0x31, 0x53, 0x13, 0xb9, 0xcc, 0xab, + 0x31, 0x44, 0x14, 0xa8, 0xbb, 0xad, 0x21, 0x42, 0x14, 0xb0, 0xcb, 0xac, 0x20, 0x43, 0x15, 0x90, + 0xab, 0xad, 0x28, 0x42, 0x33, 0xa8, 0xbc, 0xbd, 0x28, 0x43, 0x34, 0x90, 0xca, 0xbc, 0x18, 0x33, + 0x35, 0x91, 0xbc, 0xad, 0x19, 0x33, 0x35, 0x81, 0xcb, 0xcb, 0x1a, 0x33, 0x35, 0x92, 0xdb, 0xcb, + 0x1a, 0x32, 0x35, 0x02, 0xca, 0xcb, 0x8a, 0x33, 0x44, 0x02, 0xcb, 0xac, 0x8b, 0x33, 0x54, 0x02, + 0xa9, 0xbc, 0x9b, 0x43, 0x43, 0x03, 0xca, 0xbc, 0xab, 0x52, 0x42, 0x13, 0xb8, 0xad, 0x9b, 0x31, + 0x34, 0x15, 0xb9, 0xbc, 0xbb, 0x51, 0x42, 0x13, 0x98, 0xcc, 0xaa, 0x30, 0x43, 0x24, 0xa9, 0xbd, + 0xaa, 0x49, 0x33, 0x25, 0x90, 0xdb, 0xaa, 0x39, 0x24, 0x24, 0xa0, 0xcc, 0xab, 0x29, 0x34, 0x34, + 0x91, 0xdb, 0xab, 0x19, 0x25, 0x33, 0xa1, 0xfb, 0xab, 0x09, 0x34, 0x43, 0x81, 0xd9, 0xab, 0x89, + 0x34, 0x43, 0x91, 0xda, 0xac, 0x89, 0x43, 0x33, 0x83, 0xc9, 0xad, 0x8a, 0x42, 0x33, 0x83, 0xcb, + 0xaf, 0x89, 0x31, 0x43, 0x03, 0xa9, 0xbd, 0x8a, 0x41, 0x43, 0x02, 0xaa, 0xbf, 0x89, 0x30, 0x34, + 0x13, 0x99, 0xcd, 0x8a, 0x20, 0x34, 0x13, 0xaa, 0xce, 0x9a, 0x20, 0x34, 0x33, 0x99, 0xfb, 0x9a, + 0x10, 0x43, 0x23, 0xa9, 0xec, 0x9a, 0x00, 0x43, 0x24, 0x98, 0xc9, 0x8c, 0x08, 0x33, 0x34, 0xa9, + 0xea, 0x9c, 0x00, 0x32, 0x34, 0x80, 0xc9, 0x9d, 0x08, 0x41, 0x23, 0xa1, 0xda, 0xad, 0x08, 0x41, + 0x33, 0x92, 0xa9, 0xaf, 0x08, 0x30, 0x34, 0x91, 0xba, 0xbf, 0x08, 0x30, 0x44, 0x82, 0x99, 0xcc, + 0x09, 0x21, 0x34, 0x81, 0xaa, 0xce, 0x09, 0x10, 0x44, 0x01, 0x98, 0xda, 0x0a, 0x10, 0x34, 0x83, + 0xaa, 0xec, 0x8a, 0x10, 0x34, 0x13, 0x98, 0xfa, 0x8a, 0x10, 0x52, 0x02, 0x99, 0xdb, 0x8c, 0x10, + 0x42, 0x23, 0x98, 0xd9, 0x8c, 0x00, 0x42, 0x13, 0xb8, 0xda, 0x9d, 0x00, 0x42, 0x23, 0x90, 0xb9, + 0x9f, 0x00, 0x31, 0x24, 0xa8, 0xba, 0xaf, 0x00, 0x30, 0x26, 0x80, 0x99, 0xbc, 0x00, 0x21, 0x26, + 0x90, 0xaa, 0xcd, 0x18, 0x20, 0x34, 0x01, 0x9a, 0xcc, 0x19, 0x20, 0x35, 0x80, 0xab, 0xec, 0x19, + 0x10, 0x53, 0x01, 0x89, 0xda, 0x09, 0x00, 0x34, 0x82, 0xaa, 0xfb, 0x0b, 0x10, 0x63, 0x02, 0x98, + 0xc8, 0x0c, 0x00, 0x42, 0x12, 0xaa, 0xea, 0x8c, 0x01, 0x51, 0x22, 0x98, 0xb9, 0x9c, 0x01, 0x51, + 0x13, 0xb8, 0xda, 0x9d, 0x00, 0x41, 0x14, 0x91, 0x99, 0x9d, 0x00, 0x30, 0x24, 0xb0, 0xba, 0xbf, + 0x00, 0x40, 0x24, 0x92, 0x98, 0xbd, 0x18, 0x38, 0x25, 0xa1, 0xaa, 0xdd, 0x08, 0x20, 0x34, 0x83, + 0x99, 0xeb, 0x09, 0x18, 0x25, 0x92, 0x9a, 0xdc, 0x0a, 0x10, 0x44, 0x12, 0x89, 0xd9, 0x0b, 0x00, + 0x43, 0x03, 0xaa, 0xfb, 0x8c, 0x10, 0x42, 0x23, 0x98, 0xc8, 0x9d, 0x81, 0x32, 0x14, 0xa9, 0xd9, + 0x9d, 0x00, 0x42, 0x33, 0x88, 0xb8, 0xaf, 0x00, 0x21, 0x24, 0xa8, 0xb9, 0xaf, 0x18, 0x30, 0x35, + 0x80, 0x98, 0xbd, 0x08, 0x11, 0x44, 0x90, 0xa9, 0xcd, 0x19, 0x20, 0x44, 0x82, 0x88, 0xcc, 0x09, + 0x10, 0x43, 0x92, 0x9a, 0xcd, 0x0a, 0x20, 0x44, 0x83, 0x80, 0xdb, 0x0b, 0x00, 0x62, 0x82, 0x8a, + 0xea, 0x8b, 0x11, 0x53, 0x13, 0x88, 0xd9, 0x9b, 0x10, 0x41, 0x04, 0x99, 0xe9, 0xab, 0x11, 0x42, + 0x25, 0x88, 0xa8, 0xad, 0x00, 0x20, 0x15, 0x98, 0xb9, 0xae, 0x28, 0x21, 0x26, 0x00, 0x98, 0xbd, + 0x18, 0x10, 0x34, 0x98, 0xa9, 0xbf, 0x29, 0x11, 0x45, 0x81, 0x88, 0xdb, 0x09, 0x00, 0x43, 0x81, + 0x9a, 0xcd, 0x0a, 0x12, 0x54, 0x82, 0x88, 0xda, 0x8a, 0x01, 0x42, 0x02, 0x9a, 0xdc, 0x0b, 0x21, + 0x62, 0x13, 0x89, 0xd9, 0x9b, 0x01, 0x42, 0x03, 0x9a, 0xeb, 0x9c, 0x21, 0x42, 0x24, 0x98, 0xc8, + 0xac, 0x01, 0x21, 0x15, 0x99, 0xc9, 0x9d, 0x10, 0x32, 0x35, 0x90, 0xa9, 0xae, 0x18, 0x20, 0x43, + 0xa8, 0xb9, 0xbe, 0x28, 0x32, 0x36, 0x91, 0xa8, 0xbd, 0x19, 0x11, 0x63, 0xa0, 0x99, 0xcc, 0x19, + 0x32, 0x63, 0x82, 0x99, 0xdb, 0x0a, 0x11, 0x52, 0xa2, 0x9a, 0xeb, 0x0a, 0x23, 0x53, 0x03, 0xa9, + 0xea, 0x8b, 0x12, 0x41, 0x84, 0xaa, 0xda, 0x8b, 0x33, 0x43, 0x15, 0x99, 0xba, 0x9d, 0x30, 0x11, + 0x06, 0x9a, 0xba, 0xac, 0x42, 0x23, 0x35, 0xa9, 0xc9, 0xac, 0x30, 0x11, 0x34, 0xc9, 0xaa, 0xad, + 0x48, 0x13, 0x44, 0xa0, 0xa9, 0xbc, 0x28, 0x12, 0x63, 0xb0, 0xaa, 0xdb, 0x29, 0x15, 0x52, 0x91, + 0x9a, 0xca, 0x1a, 0x03, 0x61, 0x91, 0x9b, 0xcb, 0x1a, 0x25, 0x42, 0x93, 0xaa, 0xdb, 0x8b, 0x14, + 0x30, 0x85, 0xab, 0xba, 0x8c, 0x34, 0x42, 0x05, 0x9a, 0xba, 0x9c, 0x31, 0x21, 0x16, 0xab, 0xc9, + 0xaa, 0x52, 0x22, 0x25, 0xaa, 0xb9, 0xad, 0x30, 0x21, 0x34, 0xca, 0xa9, 0xad, 0x40, 0x23, 0x34, + 0xb9, 0xb9, 0xbe, 0x38, 0x12, 0x44, 0xb8, 0xa9, 0xad, 0x38, 0x24, 0x53, 0xa0, 0xaa, 0xcc, 0x29, + 0x22, 0x52, 0xb1, 0xaa, 0xcc, 0x28, 0x33, 0x44, 0xa2, 0xab, 0xcc, 0x0a, 0x33, 0x42, 0x93, 0x9d, + 0xda, 0x19, 0x42, 0x32, 0x83, 0x9d, 0xda, 0x0a, 0x31, 0x23, 0x84, 0xbb, 0xeb, 0x0a, 0x43, 0x33, + 0x13, 0xad, 0xdb, 0x8a, 0x31, 0x24, 0x22, 0xcb, 0xda, 0x0b, 0x42, 0x33, 0x23, 0xeb, 0xc9, 0x8b, + 0x21, 0x25, 0x21, 0xca, 0xc9, 0x8b, 0x32, 0x26, 0x21, 0xc9, 0xba, 0x9d, 0x21, 0x24, 0x12, 0xc8, + 0xba, 0x9d, 0x22, 0x34, 0x22, 0xc8, 0xbc, 0x9c, 0x11, 0x44, 0x11, 0xb0, 0xbb, 0xad, 0x31, 0x54, + 0x11, 0xa8, 0xac, 0xcb, 0x21, 0x52, 0x12, 0xa0, 0xac, 0xbb, 0x40, 0x63, 0x02, 0x90, 0xbc, 0xcb, + 0x20, 0x52, 0x13, 0x90, 0xcb, 0xcb, 0x38, 0x43, 0x14, 0x90, 0xbc, 0xbc, 0x28, 0x43, 0x15, 0x80, + 0xca, 0xba, 0x29, 0x53, 0x14, 0x80, 0xdb, 0xba, 0x1a, 0x34, 0x34, 0x80, 0xd9, 0xba, 0x1a, 0x43, + 0x25, 0x90, 0xc9, 0xac, 0x8a, 0x24, 0x34, 0x00, 0xb9, 0xbc, 0x8b, 0x34, 0x44, 0x80, 0xb9, 0xbd, + 0x8b, 0x43, 0x53, 0x82, 0xa0, 0xad, 0x9a, 0x32, 0x34, 0x82, 0xb9, 0xaf, 0xab, 0x32, 0x44, 0x03, + 0x90, 0xbc, 0xbb, 0x50, 0x42, 0x02, 0x99, 0xbe, 0xb9, 0x40, 0x33, 0x24, 0x88, 0xdb, 0xba, 0x38, + 0x24, 0x14, 0x89, 0xcd, 0xaa, 0x38, 0x24, 0x24, 0x00, 0xda, 0xaa, 0x2a, 0x33, 0x24, 0x98, 0xfb, + 0xab, 0x09, 0x35, 0x33, 0x01, 0xd9, 0xbb, 0x8a, 0x34, 0x33, 0x91, 0xfb, 0x9d, 0x89, 0x52, 0x32, + 0x01, 0xb8, 0xad, 0x8a, 0x41, 0x22, 0x82, 0xe9, 0xac, 0x99, 0x42, 0x24, 0x03, 0xa0, 0xad, 0xaa, + 0x40, 0x22, 0x83, 0xc8, 0xae, 0x9a, 0x40, 0x34, 0x22, 0x88, 0xad, 0xab, 0x39, 0x15, 0x12, 0xa8, + 0xbe, 0xaa, 0x38, 0x27, 0x13, 0x81, 0xdb, 0x9a, 0x0a, 0x34, 0x21, 0x98, 0xcd, 0x9b, 0x29, 0x45, + 0x22, 0x82, 0xda, 0xaa, 0x8a, 0x34, 0x12, 0x80, 0xec, 0x9a, 0x09, 0x63, 0x13, 0x02, 0xc9, 0xab, + 0xaa, 0x52, 0x12, 0x01, 0xeb, 0xab, 0x99, 0x73, 0x14, 0x11, 0xb8, 0xac, 0x99, 0x30, 0x14, 0x01, + 0xda, 0xac, 0x89, 0x61, 0x23, 0x22, 0xb8, 0xbd, 0x99, 0x28, 0x25, 0x00, 0xc8, 0xad, 0x89, 0x40, + 0x35, 0x11, 0xa0, 0xbc, 0x9a, 0x19, 0x35, 0x00, 0xb0, 0xaf, 0x89, 0x28, 0x36, 0x12, 0x91, 0xdb, + 0x9a, 0x09, 0x52, 0x81, 0x90, 0xcc, 0x8a, 0x10, 0x74, 0x11, 0x00, 0xba, 0xab, 0x98, 0x61, 0x82, + 0x80, 0xdb, 0x8b, 0x00, 0x72, 0x14, 0x00, 0xa9, 0xac, 0x88, 0x38, 0x04, 0x80, 0xd9, 0x9c, 0x00, + 0x51, 0x15, 0x00, 0xa0, 0xbc, 0x88, 0x29, 0x15, 0x88, 0xb8, 0xbd, 0x10, 0x40, 0x27, 0x00, 0x90, + 0xbc, 0x98, 0x08, 0x24, 0x88, 0x90, 0xbe, 0x18, 0x10, 0x37, 0x01, 0x00, 0xcc, 0x89, 0x89, 0x42, + 0x80, 0x80, 0xdc, 0x09, 0x01, 0x64, 0x01, 0x00, 0xd9, 0x8a, 0x98, 0x31, 0x82, 0x19, 0xfa, 0x8a, + 0x02, 0x62, 0x13, 0x18, 0xd8, 0x9c, 0x90, 0x38, 0x83, 0x19, 0xf0, 0x8b, 0x01, 0x51, 0x15, 0x08, + 0xb1, 0x9d, 0x98, 0x18, 0x23, 0x8a, 0xc2, 0x9f, 0x01, 0x21, 0x26, 0x80, 0x80, 0xae, 0x90, 0x08, + 0x32, 0xa9, 0x82, 0xaf, 0x10, 0x11, 0x45, 0x80, 0x00, 0xcc, 0x88, 0x89, 0x32, 0xa0, 0x20, 0xce, + 0x28, 0x10, 0x73, 0x92, 0x10, 0xdb, 0x89, 0x98, 0x30, 0xb3, 0x28, 0xfa, 0x2a, 0x10, 0x73, 0x02, + 0x19, 0xe8, 0x8a, 0x98, 0x20, 0x93, 0x1a, 0xf1, 0x1a, 0x11, 0x41, 0x15, 0x09, 0xd1, 0x8b, 0xa8, + 0x18, 0x13, 0x0c, 0xb3, 0x8e, 0x12, 0x30, 0x27, 0x88, 0xa1, 0xad, 0x98, 0x89, 0x33, 0x9a, 0x83, + 0x9f, 0x21, 0x20, 0x46, 0x88, 0x81, 0xbc, 0x99, 0x9a, 0x42, 0xb8, 0x32, 0xcc, 0x21, 0x01, 0x56, + 0x91, 0x10, 0xdb, 0x89, 0xaa, 0x30, 0xb1, 0x40, 0xd0, 0x28, 0x01, 0x72, 0x83, 0x28, 0xd9, 0x9b, + 0xb9, 0x19, 0x82, 0x49, 0xb3, 0x2c, 0x84, 0x61, 0x04, 0x08, 0xb1, 0x9e, 0xb8, 0x8a, 0x02, 0x08, + 0x05, 0x8a, 0x14, 0x28, 0x26, 0x80, 0x82, 0xaf, 0xa9, 0x9b, 0x11, 0x80, 0x25, 0x99, 0x13, 0x29, + 0x46, 0x81, 0x20, 0xec, 0x99, 0xab, 0x18, 0x01, 0x62, 0xa0, 0x21, 0x08, 0x42, 0x04, 0x38, 0xf8, + 0x9b, 0xbc, 0x08, 0x01, 0x50, 0x83, 0x29, 0x91, 0x30, 0x17, 0x00, 0xc2, 0xad, 0xca, 0x8a, 0x21, + 0x20, 0x07, 0x09, 0x81, 0x00, 0x43, 0x00, 0x83, 0xcf, 0xb9, 0xaa, 0x20, 0x12, 0x27, 0x88, 0x00, + 0x89, 0x42, 0x82, 0x23, 0xce, 0xba, 0x9d, 0x18, 0x02, 0x44, 0x91, 0x00, 0x99, 0x30, 0x15, 0x40, + 0xe9, 0xaa, 0xbc, 0x19, 0x22, 0x72, 0x92, 0x18, 0xa9, 0x28, 0x14, 0x21, 0xe2, 0xac, 0xda, 0x89, + 0x21, 0x42, 0x04, 0x09, 0x98, 0x1a, 0x32, 0x42, 0xa3, 0xcf, 0xba, 0x8c, 0x30, 0x42, 0x24, 0x98, + 0xa0, 0x8b, 0x42, 0x23, 0x13, 0xcf, 0xba, 0x9d, 0x10, 0x33, 0x44, 0x90, 0x89, 0x9b, 0x21, 0x34, + 0x32, 0xfb, 0xac, 0xac, 0x18, 0x33, 0x44, 0x81, 0x89, 0xbb, 0x20, 0x53, 0x32, 0xd8, 0xad, 0xbc, + 0x19, 0x42, 0x43, 0x02, 0x99, 0xca, 0x19, 0x43, 0x32, 0xb1, 0xbf, 0xbc, 0x8a, 0x52, 0x33, 0x13, + 0xa9, 0xd9, 0x0a, 0x42, 0x23, 0x82, 0xbf, 0xcb, 0x8b, 0x31, 0x26, 0x22, 0xa0, 0xaa, 0x8c, 0x31, + 0x34, 0x02, 0xfb, 0xac, 0x9b, 0x20, 0x35, 0x33, 0xa0, 0xaa, 0xad, 0x21, 0x34, 0x22, 0xfa, 0xbb, + 0xac, 0x10, 0x44, 0x23, 0x91, 0xaa, 0xbb, 0x28, 0x36, 0x22, 0xc8, 0xbe, 0xbb, 0x29, 0x63, 0x33, + 0x82, 0xaa, 0xcb, 0x19, 0x53, 0x23, 0xa0, 0xbf, 0xcb, 0x09, 0x42, 0x34, 0x02, 0xb9, 0xba, 0x0b, + 0x53, 0x24, 0x91, 0xdc, 0xcb, 0x89, 0x31, 0x35, 0x13, 0xa9, 0xca, 0x9a, 0x32, 0x35, 0x81, 0xeb, + 0xac, 0x9b, 0x31, 0x45, 0x22, 0x98, 0xba, 0xab, 0x31, 0x35, 0x12, 0xe9, 0xad, 0x9b, 0x20, 0x63, + 0x23, 0x80, 0xba, 0xbb, 0x28, 0x54, 0x12, 0xb9, 0xbe, 0xac, 0x10, 0x53, 0x33, 0x01, 0xbb, 0xcb, + 0x19, 0x53, 0x13, 0x98, 0xce, 0xbb, 0x29, 0x52, 0x34, 0x01, 0xa9, 0xcb, 0x09, 0x32, 0x24, 0x80, + 0xdd, 0xbb, 0x1a, 0x42, 0x44, 0x12, 0xa8, 0xcb, 0x0a, 0x21, 0x34, 0x91, 0xeb, 0xbc, 0x8a, 0x32, + 0x45, 0x22, 0x98, 0xbb, 0x8c, 0x20, 0x43, 0x02, 0xda, 0xbd, 0x9b, 0x31, 0x45, 0x22, 0x91, 0xbb, + 0x9c, 0x10, 0x52, 0x12, 0xc9, 0xcc, 0x9b, 0x38, 0x63, 0x23, 0x81, 0xba, 0xcb, 0x18, 0x32, 0x25, + 0xb8, 0xbe, 0xcb, 0x18, 0x34, 0x34, 0x82, 0xb9, 0xbc, 0x09, 0x42, 0x23, 0xa1, 0xce, 0xcb, 0x19, + 0x42, 0x34, 0x02, 0xa9, 0xcb, 0x8a, 0x22, 0x24, 0x93, 0xcd, 0xac, 0x8a, 0x42, 0x34, 0x23, 0xa8, + 0xbc, 0x9b, 0x30, 0x34, 0x03, 0xdc, 0xbc, 0x9b, 0x42, 0x44, 0x13, 0x90, 0xbb, 0xac, 0x20, 0x33, + 0x33, 0xfb, 0xbc, 0xab, 0x40, 0x44, 0x32, 0x90, 0xb9, 0xad, 0x18, 0x23, 0x32, 0xd8, 0xad, 0x9c, + 0x18, 0x34, 0x34, 0x92, 0xaa, 0xbc, 0x09, 0x42, 0x22, 0xb1, 0xaf, 0xac, 0x08, 0x53, 0x33, 0x03, + 0xaa, 0xcc, 0x8a, 0x32, 0x32, 0x92, 0xbf, 0xcb, 0x89, 0x53, 0x43, 0x12, 0x99, 0xcb, 0x9a, 0x31, + 0x22, 0x03, 0xed, 0xba, 0x8a, 0x51, 0x24, 0x14, 0x98, 0xaa, 0xbb, 0x20, 0x14, 0x13, 0xfa, 0xbb, + 0xaa, 0x41, 0x35, 0x43, 0xa0, 0xaa, 0xbb, 0x29, 0x33, 0x33, 0xf9, 0xad, 0xab, 0x30, 0x45, 0x42, + 0x91, 0x9a, 0xca, 0x09, 0x22, 0x21, 0xc1, 0xbd, 0xbb, 0x28, 0x45, 0x24, 0x03, 0x9b, 0xcb, 0x8b, + 0x22, 0x22, 0xa3, 0xcf, 0xb9, 0x1a, 0x63, 0x33, 0x23, 0xba, 0xda, 0x9b, 0x20, 0x23, 0x11, 0xce, + 0xba, 0x8b, 0x44, 0x34, 0x33, 0xb8, 0xca, 0xac, 0x00, 0x22, 0x21, 0xfa, 0x9b, 0x9c, 0x22, 0x45, + 0x32, 0xa1, 0xaa, 0xbc, 0x09, 0x31, 0x12, 0xe0, 0x9c, 0xcb, 0x21, 0x54, 0x22, 0x93, 0x9a, 0xcc, + 0x09, 0x20, 0x01, 0xa1, 0xae, 0xc9, 0x28, 0x53, 0x24, 0x12, 0xaa, 0xe9, 0x0a, 0x18, 0x01, 0x01, + 0xad, 0xc9, 0x1a, 0x53, 0x24, 0x23, 0xa9, 0xd9, 0x9b, 0x08, 0x11, 0x21, 0xfb, 0xa9, 0x0c, 0x42, + 0x43, 0x33, 0xb1, 0xba, 0x9f, 0x88, 0x10, 0x20, 0xd8, 0x8a, 0x9c, 0x32, 0x44, 0x43, 0x92, 0xaa, + 0xcc, 0x88, 0x08, 0x21, 0xb1, 0x9d, 0xca, 0x30, 0x44, 0x34, 0x83, 0xaa, 0xeb, 0x8a, 0x08, 0x11, + 0x82, 0x9e, 0xc8, 0x29, 0x43, 0x34, 0x14, 0xa9, 0xd9, 0x9b, 0x88, 0x11, 0x22, 0xbc, 0xb9, 0x0c, + 0x34, 0x55, 0x23, 0xa8, 0xb9, 0xae, 0x98, 0x10, 0x22, 0xc8, 0x99, 0xbb, 0x43, 0x55, 0x33, 0x91, + 0xaa, 0xce, 0x98, 0x00, 0x12, 0xa2, 0x8b, 0xbc, 0x30, 0x64, 0x24, 0x82, 0x99, 0xdc, 0x8a, 0x08, + 0x12, 0x02, 0xab, 0xe9, 0x29, 0x51, 0x34, 0x13, 0xaa, 0xfa, 0x9b, 0x88, 0x22, 0x22, 0xaa, 0xd9, + 0x0b, 0x42, 0x36, 0x33, 0xb8, 0xda, 0x9e, 0x88, 0x11, 0x21, 0xa0, 0xa9, 0x8d, 0x11, 0x36, 0x43, + 0x90, 0xba, 0xae, 0x8a, 0x11, 0x32, 0xa2, 0xaa, 0x9e, 0x00, 0x64, 0x22, 0x93, 0xaa, 0xbe, 0xa9, + 0x20, 0x31, 0x84, 0x9a, 0xcb, 0x88, 0x64, 0x23, 0x13, 0xbb, 0xdc, 0x9b, 0x18, 0x22, 0x14, 0xaa, + 0xc9, 0x8a, 0x72, 0x33, 0x14, 0xa9, 0xdb, 0xbb, 0x19, 0x13, 0x53, 0xb8, 0xa9, 0xab, 0x71, 0x24, + 0x43, 0xb8, 0xba, 0xbd, 0x0a, 0x13, 0x52, 0xb1, 0x99, 0xbb, 0x58, 0x26, 0x41, 0xa1, 0xaa, 0xcc, + 0x8a, 0x12, 0x40, 0x93, 0x8b, 0xbb, 0x3a, 0x47, 0x41, 0x92, 0xaa, 0xeb, 0x9a, 0x11, 0x30, 0x85, + 0x8a, 0xa9, 0x0b, 0x45, 0x22, 0x05, 0xaa, 0xca, 0xac, 0x20, 0x10, 0x15, 0x99, 0xa8, 0x8c, 0x53, + 0x12, 0x25, 0xba, 0xb9, 0xae, 0x18, 0x01, 0x43, 0xa8, 0x98, 0x9c, 0x51, 0x22, 0x63, 0xb8, 0x99, + 0xbd, 0x19, 0x01, 0x61, 0x90, 0x09, 0xba, 0x40, 0x23, 0x73, 0xa1, 0x9a, 0xcc, 0x89, 0x11, 0x40, + 0xa3, 0x1a, 0xca, 0x29, 0x25, 0x51, 0x93, 0x8c, 0xda, 0x8a, 0x00, 0x30, 0x05, 0x8a, 0xb0, 0x0a, + 0x34, 0x42, 0x05, 0x9b, 0xe9, 0x9b, 0x00, 0x01, 0x25, 0x8a, 0xa1, 0x8c, 0x32, 0x14, 0x35, 0xba, + 0xd8, 0xac, 0x88, 0x01, 0x34, 0xa0, 0x91, 0x9d, 0x21, 0x24, 0x62, 0xa0, 0xa9, 0xae, 0x89, 0x01, + 0x51, 0x91, 0x00, 0xbb, 0x10, 0x34, 0x72, 0xa2, 0x99, 0xdc, 0x99, 0x10, 0x30, 0x84, 0x00, 0xba, + 0x89, 0x63, 0x31, 0x86, 0x89, 0xeb, 0x9a, 0x18, 0x10, 0x06, 0x00, 0xa9, 0x8a, 0x40, 0x22, 0x16, + 0x89, 0xda, 0xab, 0x1a, 0x01, 0x26, 0x00, 0xa8, 0x9b, 0x28, 0x15, 0x26, 0x88, 0xc9, 0xbc, 0x8a, + 0x02, 0x44, 0x01, 0xa0, 0xbb, 0x19, 0x34, 0x45, 0x81, 0xb9, 0xbf, 0x99, 0x01, 0x52, 0x02, 0x80, + 0xac, 0x89, 0x32, 0x44, 0x03, 0xa9, 0xbf, 0xab, 0x10, 0x42, 0x14, 0x00, 0xcb, 0x8a, 0x30, 0x63, + 0x23, 0xa8, 0xec, 0x9b, 0x19, 0x31, 0x34, 0x81, 0xd9, 0xaa, 0x28, 0x34, 0x25, 0x90, 0xfa, 0xaa, + 0x0a, 0x22, 0x43, 0x02, 0xc9, 0xab, 0x19, 0x63, 0x33, 0x82, 0xfb, 0xbb, 0x8a, 0x21, 0x44, 0x12, + 0xb8, 0xac, 0x0a, 0x42, 0x34, 0x13, 0xe9, 0xbc, 0x9a, 0x20, 0x43, 0x33, 0xa8, 0xbd, 0x99, 0x40, + 0x25, 0x13, 0xb8, 0xaf, 0x9b, 0x18, 0x33, 0x34, 0x91, 0xad, 0xaa, 0x20, 0x26, 0x23, 0xa0, 0xcd, + 0xab, 0x1a, 0x33, 0x35, 0x01, 0xbc, 0xaa, 0x19, 0x36, 0x33, 0x81, 0xce, 0xaa, 0x8a, 0x32, 0x34, + 0x13, 0xdb, 0xaa, 0x8a, 0x54, 0x32, 0x02, 0xeb, 0xab, 0xab, 0x41, 0x43, 0x22, 0xc9, 0xaa, 0x9b, + 0x62, 0x33, 0x13, 0xe9, 0xbb, 0xac, 0x20, 0x34, 0x23, 0xb0, 0xbc, 0xbb, 0x60, 0x24, 0x23, 0xb8, + 0xbe, 0xca, 0x18, 0x33, 0x24, 0x91, 0xbc, 0xba, 0x49, 0x44, 0x23, 0xa1, 0xad, 0xac, 0x8b, 0x73, + 0x02, 0x01, 0x07, 0x7d, 0x0b, 0x02, 0x70, 0x02, 0x42, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x7f, 0x77, 0x92, 0x98, 0xb9, 0xce, 0x19, 0x62, 0x24, 0x81, 0xea, 0xac, 0x19, 0x24, 0x12, + 0xa9, 0xb8, 0xad, 0x9c, 0x20, 0x75, 0x23, 0x81, 0xeb, 0xaa, 0x18, 0x35, 0x01, 0x88, 0xc8, 0xbb, + 0x9b, 0x10, 0x74, 0x24, 0x80, 0xcd, 0x9a, 0x21, 0x12, 0x91, 0x98, 0xda, 0xbc, 0x09, 0x32, 0x57, + 0x23, 0xa1, 0xcc, 0x99, 0x31, 0x24, 0x88, 0x90, 0xcb, 0xbc, 0x19, 0x11, 0x55, 0x22, 0xc8, 0xbd, + 0x19, 0x42, 0x01, 0x89, 0xa9, 0xcc, 0x9a, 0x08, 0x52, 0x36, 0x23, 0xb8, 0x9f, 0x19, 0x22, 0x02, + 0x90, 0x98, 0xcc, 0xaa, 0x10, 0x21, 0x44, 0x14, 0xea, 0xab, 0x28, 0x24, 0x80, 0x98, 0xaa, 0xbd, + 0x99, 0x08, 0x64, 0x34, 0x02, 0xd9, 0x9a, 0x28, 0x24, 0x11, 0x80, 0xca, 0xbc, 0x8b, 0x80, 0x31, + 0x37, 0x82, 0xdc, 0x8a, 0x21, 0x04, 0x88, 0xa8, 0xa9, 0xbd, 0x89, 0x18, 0x55, 0x34, 0x81, 0xda, + 0x8a, 0x42, 0x02, 0x02, 0x98, 0xcb, 0xbc, 0x99, 0x18, 0x21, 0x36, 0x82, 0xbe, 0x19, 0x42, 0x81, + 0x80, 0xbb, 0xcb, 0x9d, 0xa9, 0x30, 0x47, 0x13, 0x80, 0xcb, 0x09, 0x44, 0x01, 0x11, 0x99, 0xdb, + 0x9b, 0x9a, 0x08, 0x40, 0x16, 0xa8, 0xab, 0x21, 0x35, 0x90, 0xa8, 0xac, 0xca, 0xad, 0x99, 0x51, + 0x54, 0x02, 0x98, 0xba, 0x38, 0x35, 0x01, 0x81, 0x9a, 0xfa, 0x9a, 0x9a, 0x81, 0x50, 0x03, 0xa8, + 0xab, 0x43, 0x26, 0xb8, 0xcb, 0x19, 0xd8, 0xbc, 0x0a, 0x35, 0x53, 0x01, 0xa0, 0x9b, 0x40, 0x44, + 0x00, 0x88, 0x88, 0xbd, 0xcb, 0x1b, 0x02, 0x43, 0x00, 0xc1, 0x0b, 0x45, 0x82, 0xaa, 0xaa, 0x80, + 0xed, 0xbb, 0x39, 0x26, 0x23, 0x82, 0xc8, 0x0a, 0x42, 0x13, 0x10, 0x00, 0xc0, 0xbf, 0xbb, 0x18, + 0x22, 0x24, 0x10, 0xc9, 0x19, 0x36, 0xc8, 0x9a, 0x08, 0xb0, 0xcf, 0x9a, 0x41, 0x33, 0x24, 0x00, + 0xca, 0x09, 0x32, 0x12, 0x32, 0x21, 0xf8, 0xaf, 0x9b, 0x11, 0x22, 0x02, 0x81, 0xbc, 0x28, 0x16, + 0xa9, 0x89, 0x08, 0xf8, 0xbe, 0x1a, 0x53, 0x22, 0x22, 0xa0, 0x9d, 0x18, 0x21, 0x31, 0x23, 0x02, + 0xee, 0xba, 0x0b, 0x32, 0x13, 0x11, 0xd0, 0x9c, 0x31, 0x02, 0x09, 0x98, 0x81, 0xff, 0xad, 0x28, + 0x33, 0x22, 0x24, 0xb9, 0x9c, 0x20, 0x22, 0x32, 0x22, 0x91, 0xff, 0x9b, 0x18, 0x12, 0x12, 0x02, + 0xda, 0x0a, 0x31, 0x90, 0x00, 0x98, 0xe1, 0xef, 0x8a, 0x31, 0x13, 0x22, 0x13, 0xdb, 0x09, 0x20, + 0x21, 0x43, 0x12, 0xd8, 0xbf, 0x0b, 0x21, 0x22, 0x20, 0x91, 0xdc, 0x19, 0x21, 0x80, 0x09, 0x08, + 0xf9, 0xcf, 0x19, 0x32, 0x12, 0x32, 0x93, 0xad, 0x09, 0x32, 0x03, 0x21, 0x00, 0xf0, 0xcf, 0x09, + 0x22, 0x01, 0x10, 0xa1, 0xac, 0x28, 0x14, 0x88, 0xb9, 0x28, 0xfb, 0xbf, 0x38, 0x14, 0x01, 0x22, + 0xa0, 0xab, 0x38, 0x15, 0x00, 0x81, 0x68, 0xf0, 0xac, 0x18, 0x22, 0x02, 0x00, 0xb9, 0x9b, 0x72, + 0x91, 0x89, 0x99, 0x20, 0xdf, 0x9b, 0x51, 0x12, 0x00, 0x22, 0xb9, 0x89, 0x42, 0x81, 0x08, 0x18, + 0x37, 0xec, 0x9b, 0x28, 0x23, 0x00, 0x81, 0xbb, 0x1a, 0x16, 0xa9, 0x99, 0x2a, 0x96, 0xcf, 0x89, + 0x42, 0x02, 0x00, 0x03, 0x99, 0x08, 0x03, 0xaa, 0x88, 0x70, 0x07, 0xbc, 0x9b, 0x41, 0x12, 0x00, + 0x81, 0xab, 0x19, 0x92, 0xae, 0x08, 0x60, 0xd0, 0xac, 0x1a, 0x35, 0x81, 0x20, 0x81, 0x08, 0x00, + 0xa9, 0xbb, 0x38, 0x77, 0xa3, 0xbd, 0x0b, 0x33, 0x02, 0x11, 0xb1, 0x9b, 0x09, 0xc9, 0x8c, 0x10, + 0x53, 0xfc, 0xba, 0x48, 0x24, 0x80, 0x21, 0x90, 0x10, 0xa9, 0xaa, 0x0c, 0x72, 0x26, 0xb8, 0xbd, + 0x19, 0x23, 0x02, 0x20, 0xb9, 0x9b, 0x99, 0xcc, 0x38, 0x11, 0x86, 0xbe, 0xaa, 0x61, 0x22, 0x01, + 0x01, 0x80, 0x00, 0xda, 0xbb, 0x48, 0x54, 0x04, 0xda, 0xac, 0x21, 0x22, 0x82, 0x80, 0xaa, 0x99, + 0x99, 0xab, 0x34, 0x50, 0xe1, 0xbd, 0x89, 0x34, 0x22, 0x11, 0x00, 0x89, 0xa0, 0xad, 0xaa, 0x63, + 0x45, 0x82, 0xdd, 0x8a, 0x32, 0x22, 0x80, 0x99, 0xbb, 0x89, 0x99, 0x2a, 0x15, 0x31, 0xfa, 0xad, + 0x09, 0x34, 0x22, 0x01, 0x81, 0x8a, 0xb8, 0xbd, 0x0a, 0x46, 0x35, 0xb0, 0xaf, 0x1a, 0x23, 0x22, + 0x88, 0xba, 0x8d, 0x91, 0x9a, 0x21, 0x31, 0x03, 0xcf, 0xaa, 0x39, 0x25, 0x22, 0x81, 0x91, 0x1a, + 0xe8, 0xac, 0x28, 0x55, 0x23, 0xf9, 0xab, 0x20, 0x13, 0x22, 0x98, 0xcc, 0x18, 0xa8, 0x00, 0x18, + 0x22, 0x82, 0xcf, 0xa9, 0x31, 0x12, 0x25, 0x08, 0xa8, 0x10, 0xcc, 0xac, 0x40, 0x46, 0x03, 0xbd, + 0x9b, 0x31, 0x32, 0x23, 0xea, 0xaa, 0x81, 0x89, 0x81, 0x08, 0x30, 0x85, 0xbb, 0xac, 0x40, 0x31, + 0x06, 0x08, 0x90, 0x80, 0xeb, 0x9c, 0x51, 0x44, 0x92, 0xbd, 0x8a, 0x32, 0x32, 0x83, 0xcd, 0x89, + 0x80, 0x28, 0xa8, 0x8a, 0x72, 0x83, 0xab, 0xbb, 0x21, 0x71, 0x02, 0x08, 0x08, 0xa2, 0xce, 0x8b, + 0x63, 0x35, 0xb0, 0xbc, 0x0a, 0x32, 0x43, 0xb2, 0xae, 0x08, 0x80, 0x81, 0xaa, 0x19, 0x56, 0x81, + 0x9a, 0xab, 0x18, 0x52, 0x91, 0x18, 0x20, 0xb0, 0xdf, 0x09, 0x62, 0x14, 0xb8, 0xab, 0x08, 0x23, + 0x25, 0xe8, 0x8a, 0x00, 0x00, 0xa8, 0xab, 0x50, 0x26, 0xa0, 0xa9, 0xab, 0x11, 0x53, 0x88, 0x10, + 0x02, 0xfb, 0xbb, 0x28, 0x57, 0x02, 0xba, 0xaa, 0x18, 0x34, 0x03, 0xbd, 0x09, 0x00, 0x80, 0xcb, + 0x8c, 0x73, 0x14, 0xa8, 0xca, 0x89, 0x21, 0x12, 0x08, 0x22, 0xb8, 0xce, 0x9b, 0x52, 0x35, 0x81, + 0xca, 0xab, 0x30, 0x34, 0xa1, 0xac, 0x10, 0x90, 0xb9, 0xbd, 0x39, 0x57, 0x03, 0xba, 0xbc, 0x19, + 0x33, 0x12, 0x19, 0x83, 0xcd, 0xac, 0x18, 0x44, 0x32, 0x92, 0xbd, 0x9b, 0x50, 0x33, 0xa8, 0x8b, + 0x02, 0xcb, 0xbc, 0x9a, 0x72, 0x44, 0x92, 0xbc, 0xab, 0x20, 0x34, 0x01, 0x20, 0xd1, 0xbc, 0x8a, + 0x30, 0x35, 0x33, 0xc1, 0xbd, 0x9a, 0x63, 0x02, 0x99, 0x10, 0xb8, 0xac, 0x9a, 0x09, 0x65, 0x33, + 0xb8, 0xae, 0x9b, 0x41, 0x23, 0x00, 0x02, 0xfb, 0xaa, 0x18, 0x31, 0x43, 0x23, 0xd9, 0xac, 0x0b, + 0x45, 0x00, 0x88, 0x00, 0xca, 0xab, 0x98, 0x30, 0x47, 0x12, 0xd9, 0xab, 0x8b, 0x63, 0x12, 0x00, + 0x91, 0xbd, 0x8a, 0x00, 0x31, 0x34, 0x13, 0xda, 0xbc, 0x2a, 0x26, 0x00, 0x00, 0x91, 0xbd, 0x9a, + 0x89, 0x72, 0x23, 0x01, 0xcc, 0xbb, 0x0a, 0x27, 0x11, 0x10, 0xc9, 0xab, 0x08, 0x00, 0x42, 0x23, + 0x83, 0xcc, 0xad, 0x38, 0x25, 0x00, 0x00, 0xc8, 0xac, 0x89, 0x18, 0x46, 0x01, 0x90, 0xad, 0xbb, + 0x40, 0x25, 0x01, 0x90, 0xda, 0x8a, 0x08, 0x10, 0x43, 0x11, 0x91, 0xeb, 0x9c, 0x40, 0x23, 0x11, + 0x80, 0xdc, 0x9a, 0x98, 0x30, 0x27, 0x10, 0xb8, 0xbc, 0x9c, 0x61, 0x13, 0x00, 0x98, 0xad, 0x08, + 0x98, 0x10, 0x32, 0x42, 0x93, 0xdd, 0x9a, 0x51, 0x23, 0x00, 0xb8, 0xad, 0x89, 0x98, 0x61, 0x03, + 0x80, 0xc9, 0xac, 0x8a, 0x55, 0x12, 0x88, 0xc9, 0x9a, 0x81, 0x98, 0x30, 0x33, 0x34, 0xc2, 0xbe, + 0x9a, 0x54, 0x03, 0x80, 0xda, 0x99, 0x88, 0x88, 0x53, 0x02, 0x88, 0xdb, 0xab, 0x38, 0x57, 0x00, + 0x98, 0xbb, 0x08, 0x81, 0x9b, 0x31, 0x53, 0x15, 0xb9, 0xbc, 0x19, 0x47, 0x00, 0xa0, 0x9b, 0x88, + 0xa8, 0x09, 0x25, 0x02, 0xc9, 0xac, 0x89, 0x51, 0x26, 0x88, 0xa8, 0xaa, 0x10, 0xe9, 0x0a, 0x21, + 0x44, 0x03, 0xba, 0xac, 0x2a, 0x47, 0x80, 0x98, 0x89, 0x99, 0xb9, 0x29, 0x33, 0x80, 0xb8, 0x9b, + 0xa1, 0x7a, 0x37, 0x8a, 0xa0, 0x99, 0x11, 0xdd, 0xab, 0x41, 0x45, 0x01, 0xa9, 0xaa, 0x39, 0x17, + 0x00, 0xa8, 0x99, 0x08, 0xca, 0x0a, 0x80, 0x38, 0x84, 0x38, 0xa5, 0x2c, 0x94, 0x40, 0xc9, 0x09, + 0x80, 0xcf, 0x9a, 0x62, 0x33, 0x91, 0x9a, 0xca, 0x59, 0x03, 0x12, 0xa9, 0x8a, 0xa1, 0xbf, 0x89, + 0x88, 0x62, 0x82, 0x32, 0xfa, 0x1a, 0x10, 0x13, 0x9a, 0x10, 0xe8, 0xbe, 0x19, 0x53, 0x23, 0x80, + 0x81, 0xdd, 0x20, 0x01, 0x02, 0x9a, 0x11, 0xe8, 0x9c, 0x89, 0x00, 0x34, 0x32, 0x93, 0xdf, 0x08, + 0x22, 0x92, 0x09, 0x90, 0xdc, 0xac, 0x21, 0x44, 0x03, 0x10, 0xd8, 0x9d, 0x21, 0x21, 0x80, 0x08, + 0xa1, 0xdc, 0x9b, 0x88, 0x32, 0x37, 0x12, 0xe8, 0xac, 0x20, 0x32, 0x98, 0x10, 0xa8, 0xce, 0x8a, + 0x21, 0x44, 0x12, 0x82, 0xdc, 0x8a, 0x21, 0x23, 0x88, 0x10, 0xc9, 0xbd, 0x9a, 0x10, 0x54, 0x34, + 0x90, 0xdc, 0x8b, 0x41, 0x03, 0x89, 0x91, 0xda, 0xab, 0x08, 0x63, 0x32, 0x14, 0xb8, 0xbe, 0x09, + 0x43, 0x02, 0x00, 0x90, 0xeb, 0xab, 0x8a, 0x42, 0x45, 0x03, 0xba, 0xdc, 0x1a, 0x33, 0x02, 0x08, + 0xa8, 0xbd, 0x9b, 0x28, 0x44, 0x44, 0x02, 0xcb, 0xcb, 0x18, 0x24, 0x02, 0x00, 0xc8, 0xac, 0x9b, + 0x09, 0x54, 0x25, 0x90, 0xba, 0xbc, 0x49, 0x24, 0x80, 0x88, 0xba, 0xaa, 0x99, 0x31, 0x46, 0x25, + 0xa0, 0xcb, 0x9c, 0x30, 0x34, 0x01, 0xa0, 0xbc, 0xac, 0x99, 0x31, 0x47, 0x03, 0xb9, 0xdb, 0x9b, + 0x52, 0x03, 0x80, 0xa8, 0xab, 0x9a, 0x88, 0x51, 0x64, 0x13, 0xb8, 0xcc, 0x9a, 0x51, 0x22, 0x01, + 0xc9, 0xba, 0x9a, 0x88, 0x52, 0x36, 0x82, 0xcb, 0xbb, 0x1b, 0x45, 0x01, 0x98, 0xaa, 0x89, 0x98, + 0x88, 0x42, 0x47, 0x02, 0xba, 0xcc, 0x09, 0x34, 0x13, 0xa0, 0xbc, 0xab, 0x89, 0x18, 0x74, 0x24, + 0xa0, 0xbb, 0xbc, 0x28, 0x26, 0x81, 0x9a, 0x9a, 0x08, 0x98, 0x89, 0x73, 0x36, 0x90, 0xba, 0xad, + 0x28, 0x35, 0x01, 0xa9, 0xac, 0x9a, 0x08, 0x20, 0x55, 0x23, 0xc9, 0xcb, 0x9a, 0x40, 0x15, 0x98, + 0x8a, 0x89, 0x80, 0x99, 0x18, 0x65, 0x33, 0xb8, 0xcc, 0x9b, 0x61, 0x23, 0x90, 0xca, 0xaa, 0x09, + 0x00, 0x41, 0x44, 0x02, 0xdb, 0xba, 0x8a, 0x73, 0x82, 0x99, 0x99, 0x08, 0x88, 0x88, 0x58, 0x45, + 0x03, 0xca, 0xdb, 0x1a, 0x63, 0x02, 0xa8, 0xba, 0x9a, 0x00, 0x10, 0x53, 0x43, 0xa2, 0xbd, 0xbb, + 0x2a, 0x36, 0x91, 0x99, 0x9a, 0x08, 0x90, 0x89, 0x55, 0x54, 0x92, 0xcb, 0xac, 0x39, 0x26, 0x81, + 0xa9, 0xab, 0x88, 0x00, 0x21, 0x43, 0x44, 0xb8, 0xbc, 0xcb, 0x38, 0x15, 0x90, 0x99, 0x89, 0x00, + 0xa8, 0x30, 0x46, 0x36, 0xa0, 0xbd, 0x9c, 0x51, 0x23, 0x98, 0xba, 0x9b, 0x08, 0x10, 0x23, 0x73, + 0x13, 0xca, 0xdb, 0x9c, 0x31, 0x13, 0x80, 0x98, 0x8b, 0x98, 0x1a, 0x21, 0x77, 0x24, 0xb9, 0xcc, + 0x0a, 0x52, 0x12, 0xa8, 0xb9, 0x8a, 0x00, 0x10, 0x18, 0x55, 0x12, 0xba, 0xcd, 0x8b, 0x22, 0x12, + 0x00, 0xb9, 0x08, 0x10, 0x00, 0x4a, 0x77, 0x03, 0xda, 0xbb, 0x39, 0x34, 0x03, 0xa9, 0xcc, 0x09, + 0x11, 0x81, 0x48, 0x34, 0x82, 0xcd, 0xbc, 0x19, 0x12, 0x33, 0x90, 0xab, 0x00, 0x00, 0xb8, 0x73, + 0x57, 0x81, 0xcb, 0xab, 0x30, 0x33, 0x03, 0xca, 0xbb, 0x28, 0x02, 0x9b, 0x44, 0x45, 0xa2, 0xbd, + 0x9d, 0x08, 0x20, 0x14, 0x99, 0x88, 0x21, 0x80, 0x9b, 0x64, 0x53, 0xb0, 0xbc, 0x9b, 0x32, 0x44, + 0x91, 0xca, 0x8a, 0x21, 0x91, 0x19, 0x34, 0x35, 0xd8, 0xbd, 0xab, 0x10, 0x53, 0x82, 0xa9, 0x18, + 0x12, 0x98, 0x38, 0x37, 0x25, 0xe9, 0xbb, 0x0a, 0x32, 0x25, 0xa0, 0xaa, 0x0a, 0x12, 0x89, 0x52, + 0x32, 0x17, 0xdb, 0xbc, 0x8b, 0x21, 0x44, 0x90, 0x88, 0x28, 0x90, 0x0a, 0x51, 0x34, 0x05, 0xda, + 0xac, 0x19, 0x31, 0x23, 0xb8, 0xaa, 0x28, 0xa0, 0x18, 0x33, 0x75, 0x84, 0xdb, 0xcc, 0x09, 0x11, + 0x33, 0x89, 0x10, 0x11, 0x9a, 0x00, 0x31, 0x66, 0x93, 0xcc, 0xac, 0x20, 0x21, 0x14, 0xa9, 0x9a, + 0x02, 0x08, 0x01, 0x11, 0x65, 0xa1, 0xce, 0xac, 0x01, 0x11, 0x13, 0x18, 0x11, 0x90, 0x0a, 0x22, + 0x73, 0x33, 0xf8, 0xcc, 0x0a, 0x22, 0x21, 0x03, 0xab, 0x19, 0xa8, 0x20, 0x14, 0x32, 0x26, 0xfa, + 0xbf, 0x09, 0x01, 0x30, 0x03, 0x00, 0x02, 0xba, 0x28, 0x21, 0x37, 0x14, 0xfb, 0xac, 0x18, 0x02, + 0x31, 0x93, 0x9a, 0x90, 0x9a, 0x31, 0x43, 0x53, 0x13, 0xff, 0xbb, 0x18, 0x00, 0x51, 0x02, 0x11, + 0x98, 0x9b, 0x08, 0x52, 0x34, 0x92, 0xcf, 0x9a, 0x11, 0x80, 0x53, 0x91, 0x08, 0x89, 0x9a, 0x10, + 0x42, 0x53, 0xa1, 0xef, 0x8a, 0x00, 0x09, 0x42, 0x11, 0x02, 0xa9, 0x9a, 0x28, 0x44, 0x33, 0xf8, + 0xbc, 0x19, 0x01, 0x20, 0x24, 0x90, 0x88, 0x98, 0x9b, 0x52, 0x33, 0x24, 0xfa, 0xbf, 0x89, 0x00, + 0x20, 0x24, 0x11, 0x90, 0x9a, 0x8b, 0x63, 0x33, 0x02, 0xed, 0xab, 0x28, 0x01, 0x41, 0x13, 0x98, + 0x89, 0xca, 0x09, 0x45, 0x22, 0x81, 0xdf, 0xab, 0x08, 0x08, 0x33, 0x25, 0x82, 0xa9, 0xba, 0x39, + 0x27, 0x12, 0x91, 0xcf, 0x9a, 0x11, 0x11, 0x32, 0x13, 0x99, 0xc9, 0xab, 0x48, 0x25, 0x22, 0xb1, + 0xff, 0x9a, 0x08, 0x20, 0x21, 0x24, 0x80, 0xba, 0xaa, 0x51, 0x24, 0x11, 0xc8, 0xbe, 0x0a, 0x21, + 0x12, 0x42, 0x82, 0x89, 0xba, 0x9b, 0x52, 0x43, 0x22, 0xf8, 0xbf, 0x99, 0x10, 0x21, 0x42, 0x12, + 0xa8, 0xbb, 0x1a, 0x54, 0x22, 0x81, 0xfa, 0xac, 0x18, 0x12, 0x12, 0x32, 0x91, 0xa9, 0xbb, 0x09, + 0x53, 0x22, 0x34, 0xfd, 0x9f, 0x88, 0x10, 0x01, 0x32, 0x03, 0xaa, 0xab, 0x30, 0x25, 0x02, 0xa0, + 0xdf, 0x8a, 0x21, 0x12, 0x21, 0x13, 0xa1, 0xaa, 0x89, 0xa9, 0x20, 0x45, 0x93, 0xff, 0x8d, 0x08, + 0x01, 0x11, 0x33, 0x91, 0xbb, 0x08, 0x21, 0x34, 0x81, 0xea, 0xbf, 0x29, 0x32, 0x21, 0x12, 0x31, + 0xb9, 0x19, 0x90, 0xbd, 0x18, 0x44, 0xf1, 0xbf, 0x88, 0x00, 0x12, 0x12, 0x25, 0xa9, 0x99, 0x10, + 0x20, 0x14, 0xa8, 0xfc, 0x8c, 0x20, 0x23, 0x22, 0x88, 0x02, 0x8b, 0x23, 0xda, 0x9b, 0x31, 0x23, + 0xff, 0x9d, 0x80, 0x00, 0x12, 0x21, 0x04, 0xaa, 0x00, 0x10, 0x40, 0x84, 0xcb, 0xbe, 0x1a, 0x24, + 0x33, 0x02, 0x0a, 0xa1, 0x59, 0x84, 0xcb, 0x8a, 0x21, 0xa1, 0xef, 0x89, 0x88, 0x21, 0x12, 0x31, + 0x92, 0x8c, 0x01, 0x88, 0x63, 0xb1, 0xcd, 0x9c, 0x20, 0x25, 0x32, 0x90, 0x0a, 0x81, 0x62, 0xb0, + 0xad, 0x19, 0x11, 0xc0, 0xad, 0x99, 0x89, 0x32, 0x25, 0x31, 0xc1, 0x19, 0x98, 0x19, 0x25, 0xea, + 0xad, 0x09, 0x62, 0x13, 0x02, 0xa9, 0x29, 0x13, 0x14, 0xdc, 0x9b, 0x08, 0x02, 0xaa, 0xdb, 0x89, + 0xaa, 0x72, 0x12, 0x42, 0xa8, 0x88, 0x9b, 0x42, 0x92, 0xdf, 0x89, 0x18, 0x36, 0x01, 0x81, 0xab, + 0x51, 0x22, 0xb1, 0xbd, 0x9a, 0x18, 0x00, 0x90, 0x9c, 0xb8, 0x8e, 0x43, 0x10, 0x33, 0xb9, 0x99, + 0x39, 0x16, 0xfb, 0xac, 0x08, 0x71, 0x23, 0x10, 0xa8, 0x8c, 0x43, 0x11, 0xba, 0xab, 0xab, 0x18, + 0x10, 0xc0, 0x1a, 0xfc, 0x2a, 0x23, 0x30, 0x83, 0xaf, 0x18, 0x23, 0x91, 0xdd, 0x9c, 0x10, 0x56, + 0x01, 0x80, 0xb9, 0x18, 0x24, 0x98, 0x9a, 0xca, 0x8a, 0x11, 0x20, 0x98, 0xa2, 0xff, 0x10, 0x11, + 0x10, 0xb0, 0x9c, 0x31, 0x02, 0xa9, 0xec, 0x8b, 0x62, 0x17, 0x00, 0x98, 0x99, 0x38, 0x03, 0xaa, + 0x99, 0xbd, 0x28, 0x81, 0x28, 0x41, 0xf1, 0x8c, 0x20, 0x12, 0x98, 0xdc, 0x19, 0x33, 0x90, 0xa0, + 0xcf, 0x08, 0x64, 0x12, 0x88, 0x98, 0x98, 0x40, 0xb0, 0x89, 0xa9, 0xab, 0x33, 0x9a, 0x53, 0x14, + 0xdd, 0x89, 0x42, 0x91, 0xba, 0xad, 0x31, 0x03, 0x28, 0xf0, 0xac, 0x40, 0x26, 0x81, 0x80, 0x98, + 0x89, 0x12, 0xc9, 0x99, 0xaa, 0x4a, 0x94, 0x09, 0x53, 0xb1, 0xbd, 0x28, 0x24, 0xb9, 0xcc, 0x8a, + 0x33, 0x81, 0x32, 0xfc, 0x8b, 0x54, 0x23, 0x80, 0x80, 0xa9, 0x18, 0x80, 0xdb, 0x9a, 0x9a, 0x52, + 0x98, 0x71, 0x12, 0xca, 0xab, 0x32, 0x82, 0xfb, 0xab, 0x19, 0x32, 0x11, 0xa2, 0xcf, 0x48, 0x44, + 0x02, 0x80, 0x98, 0x99, 0x08, 0x80, 0xbc, 0x99, 0x08, 0x00, 0x39, 0x77, 0x81, 0xca, 0x09, 0x21, + 0xa8, 0xce, 0x89, 0x20, 0x13, 0x80, 0xd9, 0x0a, 0x63, 0x34, 0x11, 0x80, 0xa9, 0x99, 0x99, 0xb0, + 0x9f, 0x01, 0x90, 0x08, 0x44, 0x23, 0xc0, 0x9e, 0x10, 0x01, 0xeb, 0xac, 0x08, 0x30, 0x04, 0xa9, + 0x99, 0x11, 0x74, 0x05, 0x10, 0x88, 0x99, 0x98, 0x89, 0xb8, 0x2b, 0x93, 0x9c, 0x42, 0x15, 0x33, + 0xea, 0x8a, 0x00, 0xb0, 0xcf, 0x9b, 0x08, 0x63, 0x91, 0x9a, 0x20, 0x11, 0x56, 0x01, 0x00, 0x88, + 0x99, 0xa9, 0x9b, 0xba, 0x62, 0xb0, 0x29, 0x25, 0x11, 0x83, 0xae, 0x88, 0x11, 0xfb, 0xcc, 0x9a, + 0x30, 0x15, 0xa9, 0x28, 0x11, 0x51, 0x16, 0x80, 0x90, 0x88, 0x00, 0xc9, 0x9c, 0x19, 0x02, 0x9a, + 0x73, 0x02, 0x30, 0xd1, 0x8b, 0x09, 0x90, 0xfb, 0xcc, 0x8a, 0x42, 0x82, 0x8b, 0x32, 0x02, 0x74, + 0x83, 0x88, 0x98, 0x18, 0x01, 0xfc, 0x89, 0x01, 0x80, 0x19, 0x24, 0x01, 0x32, 0xea, 0x89, 0x89, + 0xa0, 0xdd, 0xbd, 0x29, 0x24, 0xa8, 0x19, 0x23, 0x32, 0x47, 0x90, 0x88, 0x88, 0x20, 0x91, 0xdf, + 0x00, 0x01, 0x89, 0x11, 0x02, 0x30, 0x04, 0xac, 0x98, 0x19, 0xe8, 0xcd, 0x9d, 0x31, 0x82, 0x8a, + 0x11, 0x32, 0x72, 0x04, 0x99, 0x88, 0x10, 0x12, 0xf8, 0x8e, 0x11, 0x90, 0x10, 0x11, 0x08, 0x28, + 0xa3, 0x8e, 0x08, 0x11, 0xea, 0xce, 0x8a, 0x14, 0x90, 0x00, 0x11, 0x02, 0x62, 0x82, 0x9b, 0x10, + 0x22, 0x83, 0xdf, 0x0b, 0x03, 0x08, 0x32, 0x81, 0x98, 0x40, 0xd8, 0x1a, 0x20, 0x83, 0xdf, 0xcd, + 0x18, 0x12, 0x09, 0x11, 0x12, 0x00, 0x54, 0xb8, 0x09, 0x31, 0x33, 0xe1, 0xcd, 0x29, 0x01, 0x28, + 0x13, 0x90, 0x9a, 0x22, 0xbd, 0x21, 0x42, 0xd1, 0xcf, 0xbb, 0x41, 0x81, 0x10, 0x11, 0x11, 0x38, + 0x07, 0xba, 0x11, 0x22, 0x12, 0xfa, 0x9d, 0x10, 0x01, 0x22, 0x02, 0xc9, 0x09, 0xa2, 0x1c, 0x15, + 0x01, 0xfa, 0xbd, 0x8b, 0x23, 0x00, 0x21, 0x11, 0x91, 0x72, 0x94, 0x8a, 0x11, 0x21, 0x81, 0xcd, + 0x9c, 0x22, 0x21, 0x32, 0xa1, 0xbd, 0x28, 0xa8, 0x72, 0x83, 0xa8, 0xde, 0xcb, 0x09, 0x13, 0x01, + 0x22, 0x00, 0x09, 0x45, 0xa0, 0x28, 0x02, 0x20, 0xa2, 0xef, 0x89, 0x22, 0x21, 0x04, 0xb9, 0x9d, + 0x01, 0x18, 0x26, 0xa0, 0xba, 0xcd, 0xac, 0x18, 0x13, 0x20, 0x04, 0x98, 0x38, 0x16, 0x98, 0x12, + 0x99, 0x31, 0xb2, 0xdf, 0x19, 0x23, 0x42, 0xa2, 0xcc, 0x09, 0x00, 0x52, 0x03, 0xca, 0xac, 0xdb, + 0x8c, 0x20, 0x02, 0x32, 0x80, 0x98, 0x63, 0x02, 0x10, 0x98, 0x9a, 0x73, 0xc0, 0xac, 0x38, 0x25, + 0x12, 0xb8, 0xbd, 0x18, 0x30, 0x35, 0x91, 0xbd, 0xab, 0xbe, 0x0a, 0x21, 0x22, 0x13, 0x10, 0x18, + 0x34, 0x43, 0xa2, 0xba, 0x3b, 0x47, 0xda, 0xab, 0x50, 0x24, 0x00, 0xaa, 0xac, 0x10, 0x44, 0x02, + 0xb8, 0xae, 0xb9, 0xad, 0x88, 0x41, 0x11, 0x11, 0x00, 0x01, 0x42, 0x33, 0xc9, 0xaa, 0x61, 0x93, + 0xdb, 0x9c, 0x54, 0x01, 0x80, 0xaa, 0x9b, 0x41, 0x34, 0x01, 0xeb, 0xab, 0xcb, 0x9b, 0x19, 0x34, + 0x01, 0x12, 0x01, 0x30, 0x36, 0x14, 0xcb, 0x08, 0x22, 0xb8, 0xce, 0x29, 0x36, 0x01, 0x98, 0xdb, + 0x1a, 0x52, 0x13, 0x98, 0xda, 0xbc, 0xab, 0xaa, 0x31, 0x34, 0x11, 0x12, 0xb8, 0x73, 0x42, 0x91, + 0x8c, 0x11, 0x88, 0xa8, 0xad, 0x41, 0x37, 0x88, 0xa9, 0xbc, 0x20, 0x54, 0x81, 0x90, 0xdb, 0xac, + 0x9a, 0x88, 0x20, 0x34, 0x81, 0x80, 0x2b, 0x26, 0x43, 0xb8, 0x29, 0xa8, 0xa9, 0x88, 0x89, 0x71, + 0x57, 0x98, 0xb9, 0x8b, 0x42, 0x23, 0x08, 0xb1, 0xdf, 0x9b, 0x09, 0x80, 0x38, 0x16, 0x88, 0x99, + 0x40, 0x23, 0x01, 0x8a, 0x92, 0xac, 0x0a, 0x32, 0xb0, 0x74, 0x17, 0xaa, 0xaa, 0x28, 0x13, 0x13, + 0x11, 0xf9, 0xbf, 0x8a, 0x08, 0x80, 0x52, 0x02, 0xaa, 0x0a, 0x45, 0x01, 0x00, 0x09, 0xc8, 0x99, + 0x28, 0x15, 0x09, 0x65, 0xa1, 0xab, 0x8b, 0x32, 0x01, 0x24, 0x91, 0xcf, 0xac, 0x09, 0x80, 0x10, + 0x35, 0xb0, 0x9b, 0x58, 0x15, 0x08, 0x01, 0x98, 0xac, 0x88, 0x41, 0x02, 0x39, 0x37, 0xca, 0xaa, + 0x30, 0x92, 0x59, 0x13, 0xca, 0xce, 0x9a, 0x18, 0x80, 0x48, 0x05, 0xba, 0x09, 0x63, 0x81, 0x21, + 0x91, 0xcb, 0x8a, 0x28, 0x34, 0x82, 0x50, 0x93, 0xae, 0x0a, 0x31, 0xa8, 0x64, 0x91, 0xdb, 0xbb, + 0x8b, 0x11, 0x08, 0x44, 0xa2, 0xad, 0x20, 0x34, 0x11, 0x33, 0xe9, 0x9c, 0x08, 0x30, 0x24, 0x00, + 0x11, 0xc0, 0xad, 0x18, 0x12, 0x2a, 0x47, 0xb9, 0xbc, 0xbb, 0x18, 0x80, 0x28, 0x35, 0xd8, 0x8b, + 0x31, 0x36, 0x31, 0x93, 0xaf, 0x9a, 0x11, 0x33, 0x23, 0x90, 0x00, 0xe9, 0x9b, 0x29, 0x04, 0x70, + 0x93, 0xad, 0xcb, 0x0a, 0x80, 0x88, 0x30, 0x05, 0xba, 0x8a, 0x72, 0x24, 0x23, 0xd9, 0xab, 0x0a, + 0x43, 0x22, 0x12, 0x88, 0x89, 0xca, 0xbb, 0x71, 0x02, 0x42, 0xd9, 0xcb, 0xab, 0x88, 0x89, 0x88, + 0x35, 0x92, 0xdb, 0x09, 0x74, 0x23, 0x81, 0xdb, 0x9a, 0x20, 0x23, 0x22, 0x12, 0xb0, 0x9b, 0xea, + 0x8c, 0x44, 0x01, 0x81, 0xdb, 0xac, 0x8a, 0x9a, 0x89, 0x41, 0x23, 0xb8, 0xbe, 0x38, 0x67, 0x02, + 0x98, 0xba, 0x09, 0x22, 0x22, 0x33, 0x02, 0xfa, 0x0a, 0xca, 0x49, 0x24, 0x90, 0x98, 0xbc, 0xaa, + 0xcb, 0xaa, 0x31, 0x32, 0x92, 0xd9, 0x9e, 0x73, 0x24, 0x91, 0xa9, 0xaa, 0x20, 0x22, 0x63, 0x23, + 0xa9, 0xbd, 0x80, 0xab, 0x55, 0x82, 0xaa, 0x9a, 0x89, 0xda, 0xac, 0x10, 0x03, 0xb9, 0x0a, 0x92, + 0x2e, 0x77, 0x81, 0x98, 0x88, 0x08, 0x08, 0x42, 0x23, 0xa8, 0xca, 0x8c, 0x91, 0x3a, 0x47, 0xa8, + 0x9b, 0x01, 0xb9, 0xbc, 0x0a, 0x11, 0xc9, 0x9a, 0x40, 0x91, 0x71, 0x27, 0x98, 0x09, 0x80, 0x00, + 0x29, 0x36, 0x82, 0xbb, 0xbb, 0x0b, 0x91, 0x74, 0x86, 0xba, 0x19, 0x81, 0xba, 0x9c, 0x00, 0x90, + 0xbc, 0x89, 0x40, 0x22, 0x77, 0x91, 0x99, 0x10, 0x00, 0x90, 0x41, 0x24, 0xb8, 0x9c, 0xb8, 0x1a, + 0x31, 0x37, 0xc8, 0xab, 0x41, 0xa0, 0xcb, 0x0a, 0x88, 0xca, 0x8a, 0x88, 0x62, 0x53, 0x15, 0xb9, + 0x89, 0x32, 0x82, 0x18, 0x45, 0x01, 0xbd, 0x08, 0xba, 0x20, 0x73, 0x83, 0xcc, 0x0a, 0x13, 0xc8, + 0x9b, 0x80, 0xa9, 0xcb, 0x81, 0x0b, 0x56, 0x43, 0x92, 0xbc, 0x28, 0x24, 0x00, 0x30, 0x13, 0xd0, + 0x8d, 0x90, 0xab, 0x51, 0x24, 0xc1, 0xac, 0x28, 0x83, 0xbc, 0x89, 0xa8, 0x99, 0x0a, 0xd0, 0x2b, + 0x67, 0x22, 0xc8, 0x8a, 0x31, 0x22, 0x18, 0x21, 0x00, 0xcc, 0x20, 0xea, 0x8b, 0x63, 0x03, 0xdb, + 0x0a, 0x12, 0xa0, 0x9c, 0x99, 0x99, 0x09, 0x12, 0xde, 0x38, 0x37, 0x81, 0xbb, 0x18, 0x43, 0x12, + 0x00, 0x00, 0x98, 0x0c, 0x83, 0xcf, 0x2a, 0x35, 0xb0, 0x9d, 0x10, 0x10, 0xb9, 0x9a, 0xa9, 0x09, + 0x30, 0xf2, 0xaf, 0x62, 0x13, 0xa9, 0x8a, 0x11, 0x43, 0x01, 0x08, 0x90, 0x89, 0x21, 0xf9, 0xac, + 0x51, 0x13, 0xdb, 0x09, 0x00, 0x81, 0xac, 0x9a, 0x08, 0x11, 0x82, 0xfd, 0x1b, 0x55, 0x01, 0xaa, + 0x08, 0x20, 0x24, 0x00, 0x80, 0x88, 0x08, 0x90, 0xdd, 0x0a, 0x54, 0x91, 0x9c, 0x88, 0x01, 0xa9, + 0xac, 0x09, 0x13, 0x01, 0xd9, 0xaf, 0x48, 0x44, 0x91, 0x8a, 0x08, 0x31, 0x13, 0x88, 0x10, 0x90, + 0x08, 0xd9, 0xad, 0x18, 0x45, 0xc0, 0x8b, 0x00, 0xb8, 0xcb, 0xac, 0x52, 0x81, 0x90, 0xea, 0x9b, + 0x53, 0x35, 0x98, 0x0a, 0x00, 0x41, 0x02, 0x18, 0x81, 0x99, 0x89, 0xb9, 0x9d, 0x28, 0x47, 0xda, + 0x08, 0xa0, 0x9c, 0xba, 0x39, 0x25, 0x80, 0xbb, 0xdb, 0x1b, 0x65, 0x14, 0x99, 0x81, 0x99, 0x32, + 0x11, 0x22, 0xb8, 0x99, 0x09, 0xc1, 0xbc, 0x5a, 0x07, 0x8b, 0x81, 0xdc, 0x9b, 0x8a, 0x42, 0x13, + 0xb0, 0x8c, 0xda, 0x19, 0x55, 0x03, 0x80, 0xa8, 0x8a, 0x43, 0x23, 0x80, 0x8a, 0xab, 0x54, 0xc0, + 0xab, 0x49, 0x04, 0x88, 0xf9, 0xbc, 0x0a, 0x00, 0x43, 0x82, 0xba, 0x81, 0xae, 0x28, 0x55, 0x04, + 0x90, 0xba, 0x1a, 0x34, 0x02, 0x88, 0xa9, 0x4a, 0x06, 0xaa, 0xbb, 0x71, 0x02, 0xaa, 0xeb, 0xab, + 0x00, 0x30, 0x25, 0xa8, 0x1a, 0xa0, 0xac, 0x40, 0x57, 0x81, 0x99, 0xab, 0x48, 0x13, 0x80, 0x90, + 0x8a, 0x63, 0xa2, 0xdb, 0x09, 0x34, 0xa0, 0xbc, 0xbd, 0x09, 0x00, 0x53, 0x81, 0x99, 0x11, 0xe9, + 0x9a, 0x73, 0x24, 0xa0, 0xba, 0x9a, 0x53, 0x01, 0x81, 0x99, 0x48, 0x15, 0xc9, 0x9b, 0x31, 0x14, + 0xcb, 0xac, 0xbb, 0x09, 0x51, 0x13, 0x80, 0x18, 0xa2, 0xce, 0x28, 0x46, 0x02, 0xb9, 0xbb, 0x08, + 0x34, 0x12, 0xa9, 0x29, 0x46, 0xa2, 0xbc, 0x18, 0x22, 0xa0, 0xcf, 0x99, 0xab, 0x28, 0x25, 0x01, + 0x00, 0x11, 0xda, 0x8c, 0x52, 0x24, 0x80, 0xcb, 0x9a, 0x18, 0x44, 0x91, 0x89, 0x52, 0x23, 0xda, + 0x8a, 0x11, 0x00, 0xeb, 0x9b, 0xcb, 0x8c, 0x43, 0x02, 0x11, 0x11, 0xa0, 0xbe, 0x20, 0x34, 0x13, + 0xa8, 0xbd, 0xab, 0x61, 0x05, 0x99, 0x30, 0x25, 0x90, 0xab, 0x01, 0x89, 0xd9, 0xab, 0xda, 0xbd, + 0x28, 0x24, 0x10, 0x42, 0x81, 0xba, 0x0b, 0x22, 0x45, 0x80, 0x90, 0xbf, 0x0a, 0x73, 0x81, 0x0a, + 0x53, 0x82, 0x99, 0x08, 0xa8, 0xba, 0x9d, 0xa0, 0xbe, 0x9c, 0x42, 0x02, 0x30, 0x14, 0xa9, 0x98, + 0x80, 0x00, 0x03, 0x73, 0xe0, 0x9c, 0x28, 0x24, 0xa9, 0x50, 0x24, 0x88, 0x08, 0x90, 0xcc, 0x9a, + 0x18, 0xe9, 0xbb, 0x19, 0x24, 0x11, 0x53, 0x91, 0x0a, 0x81, 0x9a, 0x99, 0x61, 0x15, 0xeb, 0x8a, + 0x41, 0x82, 0x0a, 0x44, 0x02, 0x20, 0x90, 0xfa, 0x9c, 0x08, 0x80, 0xdb, 0x8a, 0x20, 0x22, 0x33, + 0x23, 0xa9, 0x63, 0xc8, 0xcb, 0x18, 0x34, 0xa2, 0xbf, 0x28, 0x13, 0x80, 0x40, 0x34, 0x22, 0x12, + 0xd9, 0xbf, 0x0a, 0x80, 0xa8, 0xbd, 0x18, 0x10, 0x44, 0x02, 0x00, 0x20, 0x03, 0xce, 0x9b, 0x42, + 0x12, 0xc8, 0x8d, 0x12, 0x10, 0x00, 0x32, 0x35, 0x24, 0x91, 0xed, 0x9b, 0x00, 0x88, 0xc9, 0x8b, + 0x00, 0x60, 0x23, 0x80, 0x10, 0x32, 0xe0, 0xbd, 0x28, 0x23, 0x91, 0xdb, 0x18, 0x11, 0x21, 0x21, + 0x44, 0x44, 0x13, 0xe8, 0xcc, 0x09, 0x00, 0xa9, 0xaa, 0x9a, 0x10, 0x65, 0x11, 0x80, 0x28, 0x02, + 0xdc, 0x9b, 0x41, 0x03, 0xb9, 0x89, 0x18, 0x22, 0x21, 0x52, 0x34, 0x36, 0x83, 0xfc, 0xab, 0x11, + 0xa8, 0xaa, 0xb9, 0x8a, 0x52, 0x36, 0x01, 0x9a, 0x32, 0xb1, 0xbf, 0x1a, 0x25, 0x98, 0x99, 0x80, + 0x29, 0x11, 0x34, 0x12, 0x72, 0x25, 0xa0, 0xbf, 0x19, 0x81, 0xba, 0x8a, 0xb9, 0x1a, 0x55, 0x15, + 0x98, 0x09, 0x13, 0xd9, 0x9c, 0x40, 0x01, 0xa9, 0x28, 0x98, 0x18, 0x42, 0x04, 0x18, 0x54, 0x23, + 0xfa, 0xab, 0x20, 0xb8, 0xac, 0x88, 0xba, 0x50, 0x45, 0x92, 0x99, 0x20, 0x02, 0xbe, 0x0a, 0x33, + 0xa0, 0x9b, 0x23, 0xaa, 0x62, 0x23, 0xb0, 0x61, 0x45, 0x93, 0xcd, 0x89, 0x82, 0xba, 0x8b, 0x98, + 0x0c, 0x54, 0x23, 0xa9, 0x09, 0x52, 0xc1, 0x9d, 0x28, 0x02, 0x99, 0x08, 0x81, 0x3a, 0x16, 0x90, + 0x8b, 0x56, 0x23, 0xb8, 0xae, 0x28, 0xa0, 0xac, 0x89, 0xa9, 0x60, 0x23, 0x81, 0x8b, 0x32, 0x23, + 0xfd, 0x8a, 0x31, 0x90, 0x88, 0x09, 0x11, 0x62, 0xa0, 0xab, 0x71, 0x26, 0x01, 0xca, 0x9a, 0x11, + 0xca, 0x9a, 0x9a, 0x20, 0x34, 0x91, 0x88, 0x51, 0x23, 0xb1, 0xcf, 0x09, 0x23, 0x89, 0xa9, 0x39, + 0x25, 0x02, 0xbf, 0x29, 0x46, 0x13, 0xa0, 0xac, 0x89, 0x01, 0xbc, 0xab, 0x28, 0x33, 0x92, 0x9e, + 0x43, 0x33, 0x81, 0xeb, 0xab, 0x20, 0x14, 0xa9, 0x8b, 0x54, 0x02, 0xea, 0x9c, 0x43, 0x44, 0x01, + 0xa9, 0xaa, 0x09, 0xa1, 0xae, 0x0a, 0x23, 0xa1, 0xda, 0x3a, 0x26, 0x13, 0xa9, 0x9c, 0x89, 0x30, + 0x93, 0xad, 0x31, 0x26, 0xc8, 0xcc, 0x39, 0x44, 0x23, 0x90, 0x99, 0xac, 0x18, 0xc9, 0x9b, 0x31, + 0x84, 0xbd, 0x9b, 0x73, 0x23, 0x91, 0xba, 0x89, 0x8a, 0x53, 0xb8, 0x8a, 0x54, 0x82, 0xbd, 0xbb, + 0x73, 0x33, 0x13, 0x89, 0xc9, 0x9c, 0x81, 0xab, 0x29, 0x33, 0xf8, 0x9e, 0x18, 0x53, 0x11, 0xa9, + 0x8a, 0x90, 0x28, 0x84, 0xaa, 0x39, 0x26, 0xd8, 0xba, 0x0b, 0x37, 0x23, 0x01, 0x80, 0xfb, 0x89, + 0x80, 0x99, 0x31, 0xa1, 0xcf, 0x89, 0x31, 0x26, 0x80, 0xaa, 0x09, 0x88, 0x40, 0x91, 0xab, 0x51, + 0x82, 0xcb, 0xcb, 0x59, 0x25, 0x22, 0x01, 0xa8, 0xbd, 0x88, 0x88, 0x08, 0x23, 0xfc, 0x9c, 0x18, + 0x53, 0x03, 0x99, 0xaa, 0x00, 0x88, 0x34, 0xc8, 0x8d, 0x42, 0x80, 0xbb, 0xab, 0x72, 0x24, 0x31, + 0x01, 0xca, 0x9d, 0x00, 0x98, 0x28, 0xa3, 0xcf, 0x0a, 0x21, 0x34, 0x91, 0xa9, 0x8a, 0x80, 0x51, + 0x84, 0xfb, 0x19, 0x23, 0xa8, 0xaa, 0x8b, 0x64, 0x22, 0x24, 0xa8, 0xcb, 0x09, 0x90, 0xa9, 0x61, + 0xd0, 0xac, 0x10, 0x32, 0x23, 0x98, 0xaa, 0xac, 0x31, 0x36, 0xd0, 0xad, 0x41, 0x81, 0x98, 0xa9, + 0x19, 0x44, 0x53, 0x02, 0xbb, 0x8b, 0x80, 0xba, 0x2c, 0x17, 0xcc, 0x89, 0x21, 0x22, 0x82, 0x88, + 0xca, 0x1b, 0x35, 0x82, 0xde, 0x09, 0x24, 0x98, 0x89, 0x99, 0x38, 0x45, 0x24, 0xb0, 0xab, 0x08, + 0xa9, 0xac, 0x72, 0xb1, 0xad, 0x28, 0x32, 0x10, 0x11, 0xb8, 0xad, 0x30, 0x24, 0xea, 0x9c, 0x31, + 0x04, 0x8a, 0x89, 0x9a, 0x71, 0x44, 0x01, 0xaa, 0x99, 0x98, 0xbb, 0x38, 0x26, 0xfb, 0x8a, 0x31, + 0x02, 0x20, 0x81, 0xdb, 0x09, 0x22, 0xb1, 0xbf, 0x18, 0x34, 0x90, 0x99, 0xa8, 0x8b, 0x77, 0x13, + 0x90, 0xb9, 0x8a, 0xb9, 0x09, 0x44, 0xa1, 0xbf, 0x19, 0x33, 0x11, 0x12, 0xc9, 0x9b, 0x01, 0x09, + 0xea, 0x8a, 0x40, 0x25, 0x99, 0x09, 0xba, 0x70, 0x27, 0x01, 0x98, 0xcb, 0x8a, 0x80, 0x31, 0x02, + 0xfb, 0x9d, 0x31, 0x22, 0x20, 0x80, 0xbb, 0x0a, 0xd9, 0x19, 0x99, 0x80, 0x50, 0x05, 0x89, 0x90, + 0x0a, 0x76, 0x23, 0x80, 0xca, 0xad, 0x10, 0x01, 0x12, 0xb9, 0xce, 0x09, 0x43, 0x13, 0x00, 0x99, + 0xab, 0x99, 0xaf, 0x22, 0x88, 0xa8, 0x51, 0x01, 0x00, 0x00, 0x38, 0x67, 0x12, 0xa8, 0xfb, 0x0c, + 0x12, 0x01, 0x90, 0xbb, 0x9c, 0x30, 0x35, 0x12, 0x98, 0xa9, 0xba, 0xcd, 0x2b, 0x04, 0x98, 0x99, + 0x63, 0x02, 0x11, 0x99, 0x42, 0x45, 0x81, 0xea, 0xac, 0x38, 0x13, 0x00, 0xdb, 0x9b, 0x09, 0x35, + 0x24, 0x90, 0x98, 0xba, 0xad, 0xcb, 0x50, 0x92, 0x99, 0x09, 0x35, 0x22, 0x91, 0x19, 0x33, 0x35, + 0xd8, 0xcd, 0x9a, 0x53, 0x01, 0xb8, 0xac, 0x88, 0x41, 0x43, 0x02, 0xa9, 0xa9, 0xdb, 0xbb, 0x9a, + 0x54, 0x98, 0xba, 0x71, 0x33, 0x02, 0x99, 0x11, 0x18, 0x83, 0xdd, 0xbb, 0x19, 0x37, 0x90, 0xcb, + 0x8a, 0x11, 0x34, 0x33, 0xa1, 0xad, 0xb9, 0xbb, 0xcc, 0x2a, 0x15, 0xba, 0x19, 0x56, 0x23, 0x88, + 0x08, 0x80, 0x09, 0x90, 0xbc, 0xad, 0x58, 0x14, 0xb9, 0xac, 0x20, 0x32, 0x44, 0x12, 0xe9, 0xab, + 0x88, 0xa9, 0xbc, 0x30, 0x92, 0xab, 0x71, 0x37, 0x02, 0x09, 0x80, 0xaa, 0x09, 0x81, 0xca, 0x9c, + 0x52, 0x02, 0xcc, 0x09, 0x22, 0x43, 0x24, 0x90, 0xce, 0x8a, 0x00, 0xb9, 0xab, 0x21, 0x90, 0x29, + 0x77, 0x23, 0x80, 0x08, 0xa9, 0xbb, 0x30, 0x82, 0xcc, 0x0a, 0x23, 0xa2, 0xae, 0x31, 0x32, 0x47, + 0x01, 0xea, 0xab, 0x18, 0xa0, 0xbb, 0x9b, 0x20, 0x12, 0x74, 0x35, 0x12, 0x00, 0xa9, 0xbc, 0x8b, + 0x33, 0x98, 0xdb, 0x1a, 0x32, 0xa2, 0x8a, 0x33, 0x76, 0x15, 0xb8, 0xbc, 0x8b, 0x01, 0xba, 0xdb, + 0x0b, 0x30, 0x25, 0x63, 0x24, 0x01, 0x80, 0xdb, 0x9a, 0x08, 0x13, 0xa8, 0xdb, 0x18, 0x42, 0x91, + 0x88, 0x31, 0x67, 0x91, 0xca, 0xaa, 0x0a, 0x80, 0xba, 0xad, 0x09, 0x73, 0x13, 0x42, 0x13, 0x01, + 0xda, 0xab, 0x99, 0x20, 0x14, 0xa8, 0x9e, 0x18, 0x34, 0x98, 0x19, 0x73, 0x12, 0xc9, 0xbb, 0xbb, + 0x09, 0xa0, 0xeb, 0xac, 0x38, 0x47, 0x10, 0x32, 0x21, 0xb8, 0xbc, 0xa9, 0x9a, 0x52, 0x12, 0xd9, + 0x9b, 0x42, 0x23, 0xb9, 0x41, 0x34, 0xa0, 0xca, 0xdc, 0xaa, 0x00, 0x99, 0xfb, 0x0a, 0x63, 0x13, + 0x20, 0x23, 0x82, 0xbd, 0x99, 0xaa, 0x0a, 0x45, 0x81, 0xeb, 0x28, 0x22, 0x82, 0x8c, 0x33, 0x03, + 0x9a, 0xf9, 0xbc, 0x9a, 0x00, 0xb8, 0xbf, 0x41, 0x43, 0x02, 0x22, 0x33, 0xc9, 0x9c, 0xa9, 0xab, + 0x38, 0x37, 0xc0, 0x8c, 0x32, 0x12, 0xb0, 0x2a, 0x14, 0x08, 0x00, 0xde, 0x9c, 0x89, 0x01, 0xdb, + 0x0b, 0x35, 0x23, 0x12, 0x32, 0x93, 0xcb, 0xcb, 0xba, 0xaa, 0x72, 0x07, 0xaa, 0x29, 0x13, 0x11, + 0xbb, 0x31, 0x10, 0x11, 0xe8, 0xbf, 0x9a, 0x39, 0xa1, 0xcd, 0x38, 0x25, 0x12, 0x11, 0x22, 0x91, + 0xcc, 0xab, 0xaa, 0x2a, 0x57, 0x81, 0xab, 0x31, 0x12, 0xa0, 0x8c, 0x12, 0x22, 0x80, 0xed, 0xbc, + 0x8a, 0x32, 0xd8, 0x9c, 0x43, 0x22, 0x11, 0x21, 0x25, 0xb8, 0xbd, 0x9a, 0xab, 0x72, 0x24, 0xb8, + 0x1a, 0x33, 0x91, 0xdb, 0x29, 0x23, 0x82, 0xa9, 0xee, 0xbb, 0x10, 0x03, 0xeb, 0x3a, 0x25, 0x00, + 0x18, 0x52, 0x03, 0xdb, 0xaa, 0xa9, 0x2a, 0x46, 0x02, 0xbb, 0x40, 0x13, 0xc9, 0x9b, 0x22, 0x03, + 0x88, 0xc0, 0xdf, 0x89, 0x21, 0xa0, 0xbb, 0x73, 0x82, 0x98, 0x31, 0x26, 0xb0, 0xbb, 0xa9, 0xab, + 0x73, 0x24, 0xb0, 0x8a, 0x25, 0x80, 0xbc, 0x28, 0x12, 0x90, 0x18, 0xf9, 0xbc, 0x28, 0x82, 0xd9, + 0x29, 0x25, 0x98, 0x0a, 0x37, 0x01, 0xca, 0x9a, 0xa9, 0x28, 0x27, 0x02, 0xba, 0x30, 0x04, 0xc9, + 0x8b, 0x22, 0x80, 0x88, 0x91, 0xcf, 0x8a, 0x21, 0xa8, 0x9c, 0x52, 0x93, 0xbb, 0x71, 0x17, 0x98, + 0x9a, 0x8a, 0x89, 0x52, 0x23, 0xa8, 0x0a, 0x43, 0xb0, 0xac, 0x28, 0x92, 0x88, 0x18, 0xe8, 0xac, + 0x08, 0xa1, 0xab, 0x38, 0x37, 0xdb, 0x19, 0x66, 0x81, 0xa9, 0xaa, 0x98, 0x30, 0x26, 0x82, 0x99, + 0x10, 0x03, 0xbc, 0x8a, 0x21, 0xaa, 0x10, 0x02, 0xbc, 0xdb, 0xaa, 0xbc, 0x28, 0x63, 0xc1, 0x9d, + 0x52, 0x26, 0xa0, 0xaa, 0x9b, 0x10, 0x43, 0x24, 0x80, 0x89, 0x31, 0xd1, 0x8b, 0x98, 0xa9, 0x0a, + 0x42, 0x03, 0xa0, 0xdf, 0xbb, 0x29, 0x12, 0x81, 0xcc, 0x3a, 0x47, 0x13, 0xba, 0xcb, 0x29, 0x23, + 0x43, 0x22, 0xa1, 0x99, 0x41, 0xca, 0x00, 0xdc, 0x9b, 0x32, 0x23, 0x24, 0xfa, 0xad, 0x89, 0x21, + 0x90, 0x9a, 0x99, 0x63, 0x24, 0x82, 0xda, 0x8b, 0x33, 0x12, 0x43, 0x15, 0xa8, 0x8c, 0x22, 0x89, + 0xd9, 0xbe, 0x20, 0x33, 0x33, 0xb1, 0xdf, 0xaa, 0x11, 0x80, 0x8a, 0x80, 0x00, 0x32, 0x53, 0x03, + 0xdb, 0x48, 0x02, 0x18, 0x55, 0x81, 0xcb, 0x38, 0x13, 0xa0, 0xef, 0x0b, 0x33, 0x42, 0x01, 0xda, + 0xbb, 0x0a, 0x12, 0xa8, 0x29, 0x81, 0x80, 0x99, 0x72, 0x05, 0x09, 0x22, 0x88, 0x32, 0x24, 0xfa, + 0x9a, 0x73, 0x01, 0xc9, 0xbd, 0x39, 0x25, 0x22, 0xa0, 0xbd, 0xaa, 0x18, 0x01, 0xa8, 0x32, 0x80, + 0xda, 0x09, 0x54, 0x02, 0x28, 0x81, 0x18, 0x20, 0xb2, 0xae, 0x2a, 0x67, 0x90, 0xeb, 0x9a, 0x42, + 0x14, 0x82, 0xaa, 0xbc, 0x9a, 0x20, 0x82, 0x1a, 0x05, 0xb8, 0xac, 0x21, 0x45, 0x01, 0x08, 0x01, + 0x98, 0x08, 0xab, 0xb8, 0x78, 0x47, 0xc9, 0xab, 0x09, 0x45, 0x22, 0x98, 0xca, 0xbc, 0x09, 0x32, + 0x90, 0x30, 0x93, 0xcd, 0x19, 0x11, 0x35, 0x90, 0x21, 0x90, 0xab, 0x89, 0x90, 0x9c, 0x77, 0x93, + 0xbc, 0x9a, 0x28, 0x47, 0x01, 0xa8, 0xcb, 0xab, 0x38, 0x12, 0x00, 0x33, 0xe9, 0x9b, 0x81, 0x31, + 0x16, 0x10, 0x82, 0xaa, 0xba, 0x00, 0xda, 0x70, 0x17, 0xa9, 0x9b, 0x98, 0x50, 0x25, 0x01, 0xda, + 0xbb, 0x89, 0x21, 0x11, 0x31, 0x92, 0xae, 0x19, 0x80, 0x50, 0x23, 0x21, 0xba, 0xaa, 0x8b, 0xa0, + 0x0d, 0x77, 0x81, 0xaa, 0x9a, 0x89, 0x64, 0x24, 0xa8, 0xcc, 0x9a, 0x00, 0x11, 0x11, 0x14, 0xaa, + 0x9a, 0x81, 0x8a, 0x73, 0x14, 0xa0, 0x9a, 0x90, 0x9a, 0x99, 0x71, 0x17, 0x98, 0xa9, 0x99, 0x1a, + 0x66, 0x02, 0xca, 0xaa, 0x89, 0x18, 0x21, 0x32, 0x92, 0xac, 0x18, 0xb9, 0x1a, 0x77, 0x81, 0x9a, + 0x18, 0x98, 0xaa, 0x28, 0x55, 0x02, 0xa9, 0xa9, 0xac, 0x60, 0x35, 0xa0, 0xad, 0x9a, 0x88, 0x10, + 0x22, 0x43, 0xa8, 0x0b, 0xa1, 0xac, 0x60, 0x25, 0xa9, 0x8a, 0x21, 0xba, 0x8c, 0x31, 0x37, 0x82, + 0x9a, 0xdb, 0x1b, 0x45, 0x04, 0xca, 0xab, 0x88, 0x89, 0x22, 0x32, 0x24, 0xa9, 0x09, 0xeb, 0x19, + 0x44, 0x82, 0xac, 0x28, 0x92, 0xbc, 0x19, 0x62, 0x26, 0x90, 0xb9, 0xbb, 0x61, 0x23, 0xa1, 0xaf, + 0x89, 0x99, 0x10, 0x12, 0x31, 0x04, 0x88, 0xaa, 0x9d, 0x31, 0x22, 0xc0, 0x8b, 0x33, 0xe9, 0xab, + 0x18, 0x76, 0x14, 0xa8, 0xaa, 0x0a, 0x24, 0x01, 0xca, 0x9d, 0x99, 0x88, 0x21, 0x12, 0x62, 0x03, + 0xa9, 0xbb, 0x19, 0x12, 0x8a, 0x98, 0x30, 0x80, 0xeb, 0xad, 0x30, 0x77, 0x07, 0xa9, 0x89, 0x18, + 0x02, 0x89, 0xba, 0xab, 0x8a, 0x20, 0x43, 0x00, 0x65, 0x01, 0xb9, 0x99, 0x08, 0xc0, 0x2b, 0x12, + 0x88, 0x08, 0xa9, 0xbb, 0x7b, 0x77, 0x85, 0x9a, 0x88, 0x10, 0x98, 0x89, 0xba, 0x9c, 0x00, 0x32, + 0x83, 0x39, 0x47, 0x00, 0xaa, 0x89, 0xa9, 0xdc, 0x30, 0x92, 0x00, 0x10, 0x90, 0xbc, 0x75, 0x27, + 0x98, 0x9a, 0x88, 0x80, 0x99, 0x88, 0xcc, 0x09, 0x21, 0x23, 0xa0, 0x40, 0x44, 0x93, 0xab, 0xc9, + 0xac, 0xab, 0x34, 0x00, 0x81, 0x23, 0xea, 0x09, 0x77, 0x22, 0xa8, 0x9b, 0x98, 0x99, 0x99, 0xb8, + 0xad, 0x10, 0x34, 0x22, 0xb9, 0x59, 0x36, 0xa1, 0xaa, 0xda, 0xaa, 0x0a, 0x33, 0x11, 0x41, 0xa1, + 0xaa, 0x3b, 0x77, 0x17, 0xa8, 0x99, 0x98, 0x89, 0x89, 0xb8, 0x8a, 0x42, 0x33, 0x82, 0xbd, 0x72, + 0x13, 0xa0, 0xab, 0xcb, 0xba, 0x2b, 0x16, 0x31, 0x83, 0x9a, 0xb9, 0x78, 0x57, 0x81, 0xaa, 0x99, + 0x98, 0xa9, 0x09, 0xb9, 0x39, 0x45, 0x12, 0xa9, 0x0b, 0x45, 0x02, 0xa8, 0xbb, 0xdc, 0xab, 0x30, + 0x43, 0x34, 0xb0, 0xaa, 0x1a, 0x67, 0x14, 0x98, 0xba, 0x98, 0xba, 0x9a, 0x08, 0x99, 0x62, 0x24, + 0x80, 0xb8, 0x29, 0x25, 0x11, 0xa8, 0xec, 0xbc, 0x0a, 0x31, 0x54, 0x03, 0xca, 0x89, 0x31, 0x45, + 0x02, 0x99, 0xbb, 0xba, 0xac, 0xa9, 0x08, 0x18, 0x47, 0x81, 0x01, 0x9a, 0x88, 0x33, 0x34, 0xc0, + 0xcf, 0x9b, 0x89, 0x52, 0x34, 0xa1, 0x9d, 0x01, 0x32, 0x23, 0x02, 0xda, 0xba, 0xcb, 0x9a, 0x1a, + 0x11, 0x20, 0x30, 0x57, 0xa2, 0xac, 0x19, 0x43, 0x12, 0xca, 0xbe, 0x8a, 0x20, 0x45, 0x03, 0xcb, + 0x18, 0x00, 0x31, 0x23, 0x13, 0xea, 0xbc, 0xba, 0x99, 0x00, 0x03, 0x89, 0x75, 0x14, 0xba, 0xab, + 0x58, 0x23, 0x81, 0xeb, 0xcb, 0x08, 0x41, 0x24, 0x90, 0x9b, 0x80, 0x38, 0x24, 0x42, 0x81, 0xda, + 0xbc, 0x8a, 0x99, 0x18, 0x01, 0x30, 0x77, 0x91, 0xab, 0x9b, 0x44, 0x11, 0x91, 0xbc, 0xbb, 0x18, + 0x54, 0x14, 0xa8, 0x8a, 0x9a, 0x41, 0x33, 0x03, 0x08, 0xfa, 0x9b, 0x9a, 0xaa, 0x1a, 0x04, 0x73, + 0x14, 0xc9, 0xab, 0x29, 0x25, 0x22, 0xb8, 0xae, 0x9a, 0x11, 0x54, 0x02, 0xa9, 0xbb, 0x0a, 0x64, + 0x02, 0x80, 0x00, 0xba, 0xab, 0xab, 0xcc, 0x38, 0x43, 0x25, 0xa9, 0xab, 0x10, 0x18, 0x46, 0x02, + 0xca, 0xad, 0x18, 0x01, 0x64, 0x81, 0xda, 0x9b, 0x40, 0x16, 0x98, 0x18, 0x08, 0xa8, 0x8a, 0xb8, + 0xbd, 0x41, 0x24, 0x90, 0x9a, 0x29, 0xb1, 0x49, 0x35, 0x81, 0xeb, 0x8a, 0x81, 0x19, 0x37, 0xa0, + 0xcd, 0x08, 0x53, 0x92, 0x8a, 0x11, 0x01, 0xc9, 0x89, 0xcc, 0x8b, 0x73, 0x01, 0x8a, 0x08, 0x11, + 0xba, 0x52, 0x22, 0xa0, 0xac, 0x18, 0xb8, 0x78, 0x23, 0xfa, 0x8b, 0x21, 0x34, 0xaa, 0x29, 0x24, + 0x81, 0xcb, 0xba, 0xce, 0x19, 0x25, 0xa0, 0x00, 0x01, 0xa0, 0x8c, 0x44, 0x02, 0xa9, 0x8b, 0x12, + 0xac, 0x50, 0x92, 0xaf, 0x10, 0x31, 0x93, 0x9c, 0x52, 0x13, 0xa1, 0xbc, 0xda, 0xbc, 0x59, 0x13, + 0x19, 0x81, 0x08, 0xd0, 0x3a, 0x26, 0x80, 0xa9, 0x19, 0xa2, 0xad, 0x31, 0xd8, 0x29, 0x02, 0x42, + 0xfa, 0x29, 0x24, 0x12, 0xa8, 0xac, 0xdc, 0x9b, 0x41, 0x22, 0x02, 0x99, 0x00, 0xcc, 0x62, 0x02, + 0xa0, 0x89, 0x21, 0xe9, 0x9a, 0x18, 0x20, 0x12, 0x18, 0xc1, 0x9f, 0x53, 0x22, 0x01, 0xba, 0xcc, + 0xbd, 0x8a, 0x61, 0x23, 0x91, 0x99, 0xb8, 0x2a, 0x27, 0x81, 0x8a, 0x18, 0x82, 0xdc, 0xba, 0x40, + 0x23, 0x00, 0x98, 0xcc, 0x39, 0x36, 0x11, 0x81, 0xcb, 0xdc, 0xab, 0x1b, 0x55, 0x03, 0x98, 0x99, + 0x9a, 0x41, 0x14, 0xa8, 0x08, 0x12, 0xc9, 0xbd, 0x8b, 0x55, 0x81, 0x80, 0x9a, 0x9a, 0x42, 0x14, + 0x11, 0x90, 0xfb, 0xac, 0xab, 0x48, 0x36, 0x01, 0xb9, 0x8a, 0x18, 0x32, 0x02, 0x8a, 0x31, 0x92, + 0xcf, 0xcb, 0x3a, 0x27, 0x00, 0xb9, 0x89, 0x18, 0x32, 0x23, 0x43, 0xe8, 0xbd, 0xbb, 0x9a, 0x72, + 0x16, 0x80, 0xaa, 0x08, 0x10, 0x11, 0x00, 0x18, 0x00, 0xb9, 0xbd, 0xad, 0x71, 0x13, 0xa8, 0xab, + 0x81, 0x00, 0x41, 0x24, 0x13, 0xed, 0xab, 0x8a, 0x19, 0x65, 0x03, 0xb9, 0x9a, 0x10, 0x10, 0x11, + 0x21, 0x80, 0xaa, 0xac, 0xda, 0x0c, 0x56, 0x91, 0xa9, 0x09, 0x80, 0x09, 0x63, 0x23, 0xc8, 0xbd, + 0x9a, 0x99, 0x50, 0x36, 0x80, 0xab, 0x09, 0x00, 0x11, 0x21, 0x03, 0xcb, 0x89, 0x90, 0xbe, 0x51, + 0x24, 0xb8, 0xac, 0x10, 0x98, 0x39, 0x67, 0x00, 0xca, 0x8b, 0x99, 0x19, 0x54, 0x22, 0xa8, 0x8c, + 0x88, 0x00, 0x21, 0x33, 0xc9, 0x8b, 0x20, 0xe9, 0x3a, 0x24, 0x01, 0xeb, 0x0b, 0x01, 0x88, 0x71, + 0x15, 0xa9, 0xbc, 0x99, 0x9a, 0x72, 0x13, 0x02, 0xca, 0x89, 0x08, 0x12, 0x31, 0xa3, 0xae, 0x28, + 0x82, 0x8d, 0x43, 0x90, 0xa0, 0xae, 0x18, 0x81, 0x08, 0x56, 0x91, 0xca, 0x9a, 0xba, 0x39, 0x37, + 0x02, 0x90, 0xaa, 0x88, 0x28, 0x13, 0x12, 0xfb, 0x0a, 0x43, 0xa0, 0x48, 0x02, 0xca, 0xca, 0x9d, + 0x32, 0x81, 0x28, 0x07, 0x9a, 0xba, 0xbb, 0x8e, 0x53, 0x34, 0xa1, 0x98, 0x9a, 0x08, 0x31, 0x91, + 0xda, 0x8b, 0x72, 0x03, 0x19, 0x12, 0xb2, 0xcf, 0xa9, 0x19, 0x15, 0x80, 0x98, 0x88, 0x80, 0xca, + 0xbf, 0x30, 0x54, 0x03, 0x9a, 0x81, 0x0a, 0x00, 0x01, 0xdd, 0x09, 0x18, 0x45, 0x00, 0x11, 0x00, + 0xfa, 0x9b, 0xa8, 0x41, 0x12, 0xb9, 0x9c, 0x21, 0x02, 0xfa, 0x0c, 0x33, 0x44, 0xb0, 0x2a, 0x90, + 0x19, 0x80, 0xf8, 0x8c, 0x10, 0x41, 0x14, 0x11, 0x01, 0xc9, 0xcc, 0x89, 0x9a, 0x44, 0x91, 0xbc, + 0x2a, 0x33, 0x91, 0xbd, 0x58, 0x33, 0x22, 0xda, 0x20, 0xb9, 0x01, 0xb8, 0xbf, 0x29, 0x04, 0x52, + 0x22, 0x32, 0xc0, 0xbb, 0xbe, 0xa9, 0x4a, 0x15, 0xb9, 0x9c, 0x50, 0x01, 0xa8, 0x89, 0x34, 0x22, + 0x03, 0x9e, 0x90, 0x1a, 0xb1, 0xad, 0x00, 0x42, 0x98, 0x63, 0x33, 0x05, 0x99, 0xdb, 0xbb, 0xac, + 0x52, 0x80, 0xaa, 0x18, 0x34, 0xa8, 0xab, 0x62, 0x33, 0x23, 0xb8, 0x9c, 0xb9, 0x9a, 0xcc, 0x38, + 0x32, 0xa3, 0x8f, 0x55, 0x33, 0x82, 0xca, 0xbc, 0xbc, 0x0a, 0x33, 0x88, 0x88, 0x30, 0xa4, 0xad, + 0x48, 0x35, 0x32, 0x81, 0xdb, 0xaa, 0x9a, 0x88, 0x2a, 0x27, 0x91, 0xeb, 0x2a, 0x47, 0x11, 0x90, + 0xb9, 0xdb, 0xab, 0x28, 0x13, 0x21, 0x88, 0x88, 0xdc, 0x29, 0x44, 0x33, 0x81, 0x91, 0xcc, 0xbb, + 0x1a, 0x00, 0x54, 0x02, 0xcb, 0xad, 0x71, 0x33, 0x02, 0xaa, 0xcb, 0xcc, 0x9a, 0x32, 0x33, 0x81, + 0xba, 0xbb, 0x9d, 0x54, 0x34, 0x81, 0x88, 0xa9, 0xea, 0x8b, 0x21, 0x31, 0x32, 0xd8, 0xbd, 0x0b, + 0x57, 0x12, 0x90, 0xa9, 0xca, 0xcb, 0x2a, 0x34, 0x12, 0xa8, 0xcb, 0x9a, 0x49, 0x36, 0x12, 0x98, + 0x98, 0xaa, 0xdc, 0x29, 0x13, 0x22, 0x80, 0xdc, 0xac, 0x61, 0x24, 0x02, 0xa9, 0xba, 0xbc, 0xac, + 0x51, 0x23, 0x81, 0xbb, 0xac, 0x0a, 0x55, 0x22, 0x81, 0x99, 0xa9, 0xb9, 0xad, 0x52, 0x02, 0x81, + 0xb8, 0xcd, 0x29, 0x45, 0x22, 0x91, 0xaa, 0xcb, 0xad, 0x0b, 0x36, 0x01, 0xa8, 0xba, 0x9c, 0x42, + 0x34, 0x12, 0xa8, 0x9a, 0xaa, 0xda, 0x2a, 0x26, 0x00, 0x99, 0xca, 0x8c, 0x53, 0x24, 0x12, 0xa9, + 0xbb, 0xdc, 0xab, 0x58, 0x24, 0x91, 0xaa, 0xac, 0x29, 0x44, 0x23, 0x81, 0xaa, 0x9a, 0xaa, 0xac, + 0x60, 0x13, 0x88, 0xba, 0xac, 0x49, 0x36, 0x14, 0x80, 0xaa, 0xc9, 0xae, 0x8a, 0x62, 0x02, 0x98, + 0xab, 0x8b, 0x51, 0x24, 0x13, 0xa8, 0x99, 0xaa, 0xbb, 0x8a, 0x55, 0x81, 0x99, 0xab, 0x8a, 0x73, + 0x26, 0x01, 0x89, 0x99, 0xdc, 0x9b, 0x19, 0x45, 0x91, 0xa9, 0xab, 0x19, 0x45, 0x23, 0x00, 0x99, + 0xa9, 0xbb, 0x9a, 0x1a, 0x36, 0x91, 0xab, 0xa9, 0x39, 0x77, 0x03, 0x88, 0x01, 0xda, 0xbd, 0x8a, + 0x20, 0x26, 0x98, 0xaa, 0x9a, 0x40, 0x44, 0x11, 0x00, 0x88, 0xbb, 0xab, 0xab, 0x48, 0x25, 0xa8, + 0x99, 0x89, 0x60, 0x36, 0x80, 0x21, 0xa1, 0xcf, 0xbb, 0x89, 0x52, 0x13, 0xa9, 0xbb, 0x09, 0x63, + 0x14, 0x22, 0x81, 0xb8, 0xbd, 0xaa, 0x99, 0x51, 0x04, 0x99, 0x89, 0x08, 0x62, 0x23, 0x21, 0x24, + 0xf9, 0xbd, 0x9b, 0x19, 0x54, 0x81, 0x9a, 0x9a, 0x18, 0x43, 0x43, 0x23, 0x98, 0xcb, 0xdb, 0x9a, + 0x09, 0x44, 0x91, 0x98, 0x08, 0x08, 0x72, 0x22, 0x32, 0x91, 0xee, 0xcb, 0x89, 0x31, 0x14, 0xa0, + 0xa9, 0x9a, 0x21, 0x35, 0x44, 0x02, 0xba, 0xba, 0xad, 0x99, 0x40, 0x13, 0x88, 0x98, 0x88, 0x19, + 0x56, 0x24, 0x02, 0xc0, 0xbf, 0xab, 0x08, 0x34, 0x01, 0xa8, 0xba, 0x19, 0x43, 0x45, 0x24, 0xb0, + 0x9b, 0xca, 0x9b, 0x09, 0x24, 0x11, 0x98, 0x99, 0x11, 0x3a, 0x77, 0x04, 0x08, 0xc9, 0xbd, 0x8a, + 0x20, 0x14, 0x00, 0xb9, 0x8a, 0x12, 0x61, 0x35, 0x82, 0xba, 0xa9, 0xbc, 0x89, 0x18, 0x03, 0x12, + 0xca, 0x30, 0xb2, 0x71, 0x57, 0x80, 0x08, 0xeb, 0xab, 0x08, 0x31, 0x82, 0x80, 0xba, 0x20, 0x81, + 0x67, 0x12, 0x90, 0x9a, 0xb9, 0x9c, 0x98, 0x30, 0x81, 0x80, 0x29, 0x84, 0x2a, 0x77, 0x82, 0x00, + 0xb1, 0xcf, 0x8a, 0x08, 0x32, 0x98, 0x80, 0x19, 0x01, 0x50, 0x26, 0x01, 0x90, 0x9a, 0xbc, 0x9b, + 0x89, 0x04, 0x8a, 0x12, 0x32, 0xa9, 0x75, 0x33, 0x08, 0x43, 0xfa, 0xaf, 0x88, 0x28, 0x82, 0x09, + 0x01, 0x00, 0x19, 0x34, 0x21, 0x23, 0xa0, 0xdb, 0xae, 0x9a, 0x18, 0xb1, 0x3a, 0x25, 0x01, 0x39, + 0x23, 0x36, 0x52, 0x84, 0xee, 0xaa, 0x08, 0x20, 0x91, 0x29, 0x13, 0x91, 0x18, 0x10, 0x55, 0x13, + 0xa8, 0xeb, 0xab, 0x99, 0x11, 0xaa, 0x71, 0x12, 0xa0, 0x00, 0x49, 0x25, 0x34, 0xd0, 0xbe, 0x9a, + 0x80, 0x22, 0xa8, 0x52, 0x12, 0x99, 0x89, 0x38, 0x47, 0x82, 0xba, 0xca, 0x8a, 0x09, 0x81, 0x8b, + 0x54, 0x02, 0xa9, 0x80, 0x72, 0x24, 0x02, 0xfb, 0xac, 0x89, 0x10, 0x82, 0x08, 0x43, 0x92, 0x9a, + 0xa9, 0x73, 0x26, 0xa8, 0x9a, 0xab, 0x08, 0x00, 0xa8, 0x28, 0x35, 0xb1, 0x9a, 0x38, 0x77, 0x12, + 0x98, 0xbd, 0x9c, 0x80, 0x10, 0x01, 0x10, 0x42, 0x90, 0xaa, 0x3a, 0x57, 0x02, 0xa9, 0xac, 0x19, + 0x98, 0x88, 0x88, 0x88, 0x35, 0xb8, 0x19, 0x73, 0x35, 0x10, 0xe9, 0xac, 0x09, 0x98, 0x11, 0x02, + 0x8b, 0x27, 0x88, 0x99, 0x38, 0x27, 0x80, 0xd9, 0x1a, 0x82, 0xab, 0x01, 0xba, 0x1d, 0x25, 0x09, + 0x11, 0x31, 0x14, 0x13, 0xef, 0x88, 0x90, 0x8a, 0x12, 0xb8, 0x4b, 0x26, 0x08, 0xa9, 0x38, 0x34, + 0xa1, 0xae, 0x42, 0xc8, 0x0a, 0xa0, 0xbc, 0x40, 0x14, 0x01, 0x99, 0x30, 0x24, 0xc0, 0x0c, 0x92, + 0xcc, 0x2a, 0x91, 0xbb, 0x71, 0x06, 0x90, 0x9a, 0x20, 0x23, 0xa0, 0x49, 0xa3, 0xbf, 0x18, 0xcb, + 0x8a, 0x73, 0x12, 0xa8, 0x89, 0x40, 0x02, 0x90, 0x10, 0xe9, 0xcb, 0x00, 0x98, 0x8a, 0x57, 0x01, + 0xaa, 0x9a, 0x31, 0x24, 0x01, 0x21, 0xfb, 0x9c, 0x98, 0x9a, 0x20, 0x46, 0x91, 0x9a, 0x89, 0x33, + 0x33, 0x10, 0xa1, 0xdf, 0x9a, 0x08, 0x88, 0x39, 0x47, 0x90, 0xaa, 0x9a, 0x52, 0x24, 0x81, 0xa0, + 0xcd, 0x89, 0x98, 0x89, 0x51, 0x15, 0xa9, 0x8a, 0x18, 0x35, 0x12, 0x90, 0xda, 0xbb, 0x0b, 0x02, + 0x90, 0x70, 0x14, 0xa9, 0xbb, 0x2b, 0x57, 0x22, 0x98, 0xca, 0xac, 0x00, 0x88, 0x80, 0x52, 0x92, + 0xab, 0x89, 0x72, 0x24, 0x01, 0xa9, 0xad, 0xaa, 0x30, 0x92, 0xa9, 0x51, 0x04, 0xba, 0xac, 0x51, + 0x36, 0x82, 0xba, 0xbc, 0x9a, 0x11, 0x91, 0x19, 0x23, 0xc0, 0x9b, 0x32, 0x77, 0x13, 0xa0, 0xbc, + 0x99, 0x89, 0x33, 0xc8, 0x9b, 0x63, 0x92, 0xb9, 0x9a, 0x73, 0x37, 0xa8, 0xab, 0xa9, 0x19, 0x11, + 0xa9, 0x09, 0x01, 0x98, 0x41, 0x63, 0x37, 0x02, 0xcc, 0x99, 0x90, 0x28, 0x92, 0xcc, 0x19, 0x43, + 0x82, 0xba, 0x1b, 0x77, 0x82, 0xaa, 0x8a, 0x89, 0x18, 0x80, 0xbb, 0x80, 0x30, 0x13, 0x43, 0x74, + 0x25, 0xc9, 0x9a, 0x00, 0x88, 0x10, 0xca, 0x9e, 0x20, 0x34, 0x98, 0xa9, 0x58, 0x17, 0xa8, 0x8a, + 0x88, 0x89, 0x88, 0xa8, 0x9c, 0x08, 0x52, 0x21, 0x34, 0x44, 0xa1, 0xad, 0x29, 0x81, 0x99, 0xa9, + 0xdd, 0x1a, 0x43, 0x14, 0x99, 0x8a, 0x53, 0x83, 0xaa, 0x88, 0xab, 0xbc, 0x88, 0xeb, 0x89, 0x30, + 0x25, 0x53, 0x33, 0x02, 0xfb, 0x09, 0x12, 0xa0, 0x9d, 0xba, 0x9d, 0x30, 0x35, 0x02, 0xa8, 0x09, + 0x42, 0x00, 0x11, 0xdc, 0xbb, 0x0c, 0x98, 0x9b, 0x10, 0x30, 0x57, 0x33, 0x03, 0xb9, 0x9c, 0x23, + 0x01, 0xde, 0x9a, 0xaa, 0x19, 0x35, 0x23, 0x03, 0xba, 0x8a, 0x33, 0x56, 0xb0, 0xbc, 0xad, 0x08, + 0x99, 0x10, 0x91, 0x50, 0x36, 0x23, 0x98, 0xaa, 0x30, 0x81, 0xf1, 0x9f, 0x98, 0x89, 0x21, 0x14, + 0x22, 0x82, 0xbc, 0x89, 0x64, 0x83, 0xca, 0xcb, 0x0b, 0x81, 0x09, 0x12, 0x99, 0x64, 0x34, 0x81, + 0x9a, 0x20, 0xa2, 0x89, 0xff, 0x09, 0x88, 0x00, 0x12, 0x22, 0x32, 0xc0, 0xac, 0x38, 0x47, 0xa8, + 0xbb, 0x9d, 0x10, 0x90, 0x10, 0x91, 0x18, 0x45, 0x24, 0x90, 0x1a, 0x13, 0xac, 0xfa, 0x8c, 0x01, + 0x09, 0x10, 0x22, 0x23, 0x22, 0xfa, 0x8a, 0x73, 0x93, 0xbb, 0xbd, 0x09, 0x02, 0x88, 0x11, 0x08, + 0x11, 0x47, 0x13, 0xa8, 0x42, 0xc8, 0xbb, 0xbe, 0x38, 0x81, 0x89, 0x31, 0x34, 0x10, 0x02, 0xaf, + 0x30, 0x27, 0xa9, 0xbd, 0x8b, 0x21, 0x90, 0x08, 0x22, 0x80, 0x48, 0x47, 0x01, 0x18, 0x92, 0xcc, + 0xac, 0x8a, 0x32, 0x98, 0x09, 0x53, 0x12, 0x20, 0xb1, 0x8d, 0x73, 0x92, 0xeb, 0x9c, 0x18, 0x01, + 0x88, 0x08, 0x13, 0x98, 0x72, 0x24, 0x10, 0x10, 0xd9, 0xbd, 0x99, 0x28, 0x12, 0xa8, 0x2a, 0x26, + 0x12, 0x10, 0xa8, 0x39, 0x14, 0xfb, 0xbe, 0x89, 0x11, 0x82, 0x99, 0x40, 0x83, 0x19, 0x56, 0x12, + 0x01, 0xb8, 0xcd, 0xab, 0x88, 0x30, 0x03, 0xca, 0x60, 0x13, 0x11, 0x08, 0x88, 0x81, 0xac, 0xdd, + 0xab, 0x09, 0x33, 0xa0, 0x8a, 0x64, 0x81, 0x21, 0x36, 0x23, 0xb0, 0xad, 0xcd, 0x09, 0x88, 0x31, + 0x91, 0x8c, 0x54, 0x12, 0x90, 0x08, 0x00, 0xdb, 0x99, 0xbc, 0xa9, 0x18, 0x16, 0x9a, 0x18, 0x35, + 0x01, 0x31, 0x36, 0x82, 0xcc, 0xba, 0x9c, 0x80, 0x09, 0x25, 0xba, 0x38, 0x47, 0x01, 0x98, 0x18, + 0xb9, 0x9c, 0xa8, 0x9b, 0xca, 0x48, 0x93, 0x0a, 0x42, 0x37, 0x80, 0x40, 0x23, 0xe9, 0x9a, 0xb9, + 0x8a, 0xa8, 0x4a, 0x84, 0x0a, 0x73, 0x26, 0x98, 0x89, 0x90, 0xac, 0x88, 0x89, 0xa0, 0xab, 0x40, + 0x91, 0x11, 0x72, 0x27, 0x99, 0x21, 0x92, 0x9c, 0xb9, 0x89, 0xa8, 0xeb, 0x48, 0x81, 0x20, 0x57, + 0x82, 0x9a, 0x88, 0xaa, 0x8a, 0x98, 0x00, 0xda, 0x9c, 0x21, 0x22, 0x32, 0x77, 0x90, 0x09, 0x01, + 0xb8, 0x99, 0x89, 0x92, 0xbc, 0x9e, 0x32, 0x11, 0x71, 0x25, 0x98, 0x99, 0xba, 0x9a, 0x88, 0x20, + 0x92, 0xde, 0x8b, 0x43, 0x12, 0x42, 0x14, 0xba, 0x18, 0x81, 0xdb, 0x09, 0x21, 0xd9, 0xeb, 0x0b, + 0x25, 0x11, 0x53, 0x12, 0xc9, 0x9a, 0xba, 0x89, 0x20, 0x22, 0xf9, 0xbd, 0x29, 0x26, 0x01, 0x12, + 0x80, 0x9c, 0x00, 0x98, 0x89, 0x32, 0xa0, 0xcf, 0xdb, 0x40, 0x23, 0x21, 0x23, 0x90, 0xad, 0xb9, + 0x9c, 0x18, 0x23, 0x91, 0xdf, 0x9b, 0x62, 0x13, 0x10, 0x80, 0xa8, 0x8a, 0xa8, 0x88, 0x51, 0x83, + 0xda, 0xcd, 0x8b, 0x54, 0x02, 0x21, 0x81, 0xa9, 0x9a, 0xeb, 0x09, 0x32, 0x81, 0xd9, 0xbd, 0x29, + 0x36, 0x02, 0x01, 0xa9, 0x9a, 0x98, 0x8a, 0x22, 0x27, 0xb8, 0xbd, 0xbc, 0x48, 0x35, 0x21, 0x01, + 0x99, 0xa9, 0xca, 0xab, 0x38, 0x27, 0xb9, 0xdb, 0x9b, 0x62, 0x24, 0x82, 0xa8, 0xaa, 0x80, 0x9a, + 0x20, 0x54, 0x82, 0xcd, 0x9a, 0x8a, 0x52, 0x34, 0x82, 0x90, 0x9a, 0xb9, 0xaa, 0x9b, 0x76, 0xa1, + 0xaa, 0xbb, 0x29, 0x55, 0x14, 0x88, 0xaa, 0x89, 0xa0, 0x08, 0x51, 0x33, 0xea, 0xac, 0x08, 0x08, + 0x52, 0x15, 0x80, 0xa8, 0x89, 0x99, 0xa9, 0x48, 0x17, 0xca, 0x9a, 0x09, 0x30, 0x55, 0x82, 0xa9, + 0xaa, 0x88, 0x00, 0x10, 0x54, 0x91, 0xcd, 0x0a, 0x81, 0x08, 0x64, 0x01, 0x88, 0x99, 0x99, 0x90, + 0x09, 0x55, 0xa0, 0xae, 0x88, 0x00, 0x51, 0x33, 0xb0, 0xba, 0xba, 0x28, 0x02, 0x61, 0x04, 0xe9, + 0xab, 0x20, 0x90, 0x30, 0x27, 0x80, 0x98, 0xb9, 0x18, 0xa8, 0x63, 0x13, 0xfb, 0x8d, 0x80, 0x18, + 0x44, 0x82, 0xa9, 0x9a, 0xaa, 0x41, 0x11, 0x33, 0xb8, 0xcf, 0x0a, 0x02, 0x09, 0x52, 0x22, 0x90, + 0xa9, 0xac, 0x02, 0x49, 0x06, 0x91, 0xbe, 0x0a, 0x80, 0x61, 0x14, 0x90, 0xb9, 0xb9, 0x8a, 0x35, + 0x31, 0x91, 0xdb, 0xad, 0x20, 0x91, 0x20, 0x22, 0x14, 0x88, 0xda, 0x0b, 0x13, 0x54, 0x80, 0xd0, + 0xae, 0x18, 0x08, 0x54, 0x01, 0xa8, 0xaa, 0xba, 0x38, 0x27, 0x82, 0xa9, 0xda, 0x0a, 0x21, 0x08, + 0x10, 0x40, 0x12, 0x98, 0xbe, 0x19, 0x45, 0x02, 0x08, 0xfa, 0x8c, 0x00, 0x38, 0x34, 0x90, 0xa9, + 0xdb, 0x9a, 0x71, 0x23, 0x98, 0xaa, 0xbc, 0x38, 0x01, 0x88, 0x00, 0x53, 0x13, 0xc9, 0xcc, 0x58, + 0x24, 0x98, 0x80, 0xbd, 0x08, 0x88, 0x61, 0x13, 0x99, 0xc9, 0xbb, 0x09, 0x67, 0x81, 0x99, 0xb9, + 0x1a, 0x21, 0x80, 0x99, 0x20, 0x53, 0x91, 0xba, 0x9d, 0x56, 0x81, 0x89, 0xa8, 0x89, 0x99, 0x8a, + 0x55, 0x82, 0x89, 0xcb, 0x9b, 0x78, 0x16, 0xa0, 0xaa, 0x99, 0x20, 0x02, 0xaa, 0x88, 0x40, 0x14, + 0x89, 0xba, 0x79, 0x25, 0xa8, 0x0a, 0x01, 0x98, 0xcc, 0x2a, 0x26, 0x88, 0xaa, 0xab, 0x09, 0x67, + 0x82, 0xba, 0x99, 0x08, 0x12, 0xb0, 0x8a, 0xa9, 0x73, 0x12, 0x98, 0x0b, 0x44, 0x13, 0xae, 0x31, + 0x82, 0xda, 0xac, 0x32, 0x83, 0xba, 0x88, 0xbb, 0x70, 0x37, 0xb0, 0xac, 0x08, 0x00, 0x02, 0xa8, + 0xc9, 0x8b, 0x73, 0x83, 0x99, 0x50, 0x01, 0xb0, 0x2d, 0x16, 0x98, 0xaa, 0x0a, 0x12, 0xb8, 0x0c, + 0x91, 0x1c, 0x57, 0x80, 0xb9, 0x0a, 0x80, 0x10, 0x02, 0xca, 0xbd, 0x2a, 0x37, 0xa1, 0x19, 0x05, + 0x8a, 0xb9, 0x72, 0x83, 0x99, 0xa9, 0x8a, 0x80, 0xba, 0x58, 0xb2, 0x71, 0x85, 0x9b, 0x99, 0x18, + 0x00, 0x42, 0xc1, 0xcc, 0x8b, 0x40, 0x24, 0x88, 0x53, 0xc8, 0x8a, 0x08, 0x27, 0x90, 0x88, 0xba, + 0x89, 0x88, 0xa9, 0x43, 0x31, 0x37, 0xeb, 0x89, 0x00, 0x81, 0x28, 0x84, 0xdb, 0xac, 0x08, 0x43, + 0x03, 0x51, 0x92, 0xaf, 0x18, 0x40, 0x03, 0x08, 0xb8, 0xbc, 0x89, 0x98, 0x29, 0x45, 0x53, 0xc0, + 0xac, 0x18, 0x21, 0x90, 0x32, 0xc0, 0xbe, 0x8a, 0x20, 0x43, 0x23, 0x15, 0xea, 0x8b, 0x28, 0x34, + 0x02, 0x80, 0xea, 0xab, 0x08, 0x80, 0x40, 0x35, 0x82, 0xcd, 0xaa, 0x31, 0x03, 0x18, 0x03, 0xed, + 0x9b, 0x08, 0x32, 0x43, 0x33, 0xb2, 0xcf, 0x89, 0x41, 0x23, 0x10, 0xb0, 0xcd, 0x8a, 0x80, 0x10, + 0x73, 0x12, 0xa9, 0xbd, 0x0a, 0x34, 0x80, 0x11, 0xc1, 0xbd, 0x89, 0x28, 0x33, 0x44, 0x03, 0xd9, + 0xbc, 0x18, 0x34, 0x23, 0x01, 0xfa, 0xab, 0x89, 0x10, 0x31, 0x36, 0x80, 0xda, 0xac, 0x38, 0x14, + 0x00, 0x81, 0xeb, 0x9b, 0x08, 0x31, 0x43, 0x43, 0x81, 0xdc, 0x9b, 0x30, 0x44, 0x13, 0xb0, 0xbd, + 0xaa, 0x18, 0x21, 0x62, 0x04, 0xa8, 0xcc, 0x9a, 0x52, 0x02, 0x00, 0xb8, 0xbc, 0x8a, 0x28, 0x33, + 0x63, 0x33, 0xb0, 0xbf, 0x9a, 0x52, 0x24, 0x82, 0xca, 0xab, 0x89, 0x10, 0x22, 0x54, 0x82, 0xdb, + 0xbb, 0x1a, 0x45, 0x11, 0xa8, 0xbb, 0xba, 0x88, 0x41, 0x33, 0x64, 0x03, 0xda, 0xbb, 0x09, 0x55, + 0x13, 0xb0, 0xbb, 0xab, 0x08, 0x12, 0x43, 0x36, 0xb0, 0xae, 0xaa, 0x20, 0x35, 0x92, 0xbb, 0xab, + 0x8b, 0x08, 0x52, 0x43, 0x45, 0xa1, 0xcb, 0xab, 0x39, 0x57, 0x81, 0x99, 0xaa, 0x99, 0x10, 0x20, + 0x52, 0x14, 0xda, 0xaa, 0x89, 0x30, 0x17, 0xa8, 0x9a, 0x99, 0x98, 0x00, 0x42, 0x53, 0x15, 0xb8, + 0xcb, 0x9b, 0x71, 0x15, 0x98, 0x99, 0x9a, 0x09, 0x01, 0x30, 0x53, 0xa3, 0xbd, 0xa9, 0x89, 0x72, + 0x93, 0xaa, 0xa9, 0x99, 0x08, 0x11, 0x45, 0x53, 0x93, 0xbb, 0xbd, 0x0a, 0x66, 0x01, 0x89, 0xaa, + 0x99, 0x10, 0x08, 0x33, 0x34, 0xe0, 0x9b, 0x9a, 0x1a, 0x36, 0xb0, 0xa9, 0x9a, 0x99, 0x00, 0x50, + 0x35, 0x44, 0xa0, 0xcb, 0xbb, 0x58, 0x26, 0x81, 0xb9, 0xaa, 0x08, 0x80, 0x30, 0x43, 0x14, 0xeb, + 0x99, 0xa9, 0x29, 0x15, 0xa8, 0xb9, 0x9a, 0x89, 0x10, 0x56, 0x33, 0x24, 0xca, 0xac, 0x9b, 0x72, + 0x14, 0x90, 0xba, 0x99, 0x00, 0x18, 0x22, 0x53, 0x92, 0xbc, 0xba, 0xae, 0x21, 0x04, 0x88, 0xb9, + 0xab, 0x89, 0x61, 0x24, 0x35, 0x02, 0xdb, 0xbb, 0x1b, 0x46, 0x13, 0xa9, 0xca, 0x89, 0x81, 0x00, + 0x31, 0x16, 0x90, 0xaa, 0xdc, 0x8b, 0x11, 0x12, 0x80, 0xdb, 0x0a, 0x28, 0x34, 0x54, 0x23, 0xa2, + 0xbe, 0xac, 0x30, 0x35, 0x03, 0xba, 0xbc, 0x18, 0x10, 0x88, 0x54, 0x02, 0xa0, 0xcc, 0xbc, 0x89, + 0x21, 0x24, 0xb0, 0xac, 0x08, 0x21, 0x43, 0x26, 0x23, 0xb1, 0xcf, 0x8a, 0x31, 0x53, 0x82, 0xba, + 0x9c, 0x11, 0x90, 0x29, 0x16, 0x11, 0xc0, 0xbc, 0xac, 0x89, 0x31, 0x06, 0xb9, 0x09, 0x12, 0x00, + 0x43, 0x25, 0x12, 0xf8, 0xac, 0x08, 0x31, 0x35, 0x90, 0xcb, 0x09, 0x02, 0xa9, 0x61, 0x12, 0x00, + 0xe9, 0xbb, 0xcb, 0x19, 0x53, 0x92, 0x9b, 0x20, 0x82, 0x39, 0x46, 0x02, 0x21, 0xec, 0x9b, 0x08, + 0x43, 0x34, 0xb9, 0xab, 0x28, 0xa1, 0x2a, 0x47, 0x80, 0x80, 0xcc, 0xca, 0xab, 0x20, 0x35, 0xa8, + 0x19, 0x22, 0xb9, 0x60, 0x43, 0x10, 0x93, 0xbe, 0x9c, 0x39, 0x34, 0x13, 0xba, 0x9b, 0x21, 0xba, + 0x71, 0x04, 0x88, 0x80, 0xbd, 0xbe, 0x0b, 0x21, 0x23, 0x99, 0x53, 0x81, 0x8c, 0x53, 0x02, 0x20, + 0xb2, 0xcf, 0x8b, 0x32, 0x14, 0x02, 0xba, 0x89, 0x02, 0x09, 0x45, 0x90, 0x09, 0xa0, 0xef, 0x9c, + 0x18, 0x18, 0x12, 0x20, 0x23, 0xc9, 0x2a, 0x26, 0x10, 0x12, 0xd9, 0xce, 0x19, 0x14, 0x01, 0x81, + 0xa9, 0x10, 0xa0, 0x30, 0x05, 0x99, 0x18, 0xe8, 0xcf, 0x89, 0x81, 0x39, 0x23, 0x22, 0x92, 0xbd, + 0x40, 0x12, 0x33, 0x11, 0xfd, 0x9c, 0x20, 0x03, 0x20, 0x92, 0x0b, 0x01, 0xa9, 0x41, 0x01, 0x88, + 0x31, 0xff, 0x9e, 0x08, 0x98, 0x40, 0x22, 0x22, 0xb9, 0x9c, 0x21, 0x33, 0x24, 0xb2, 0xff, 0x09, + 0x11, 0x81, 0x21, 0x90, 0x18, 0x91, 0xaa, 0x11, 0x11, 0x21, 0xc4, 0xff, 0x8a, 0x90, 0x89, 0x53, + 0x22, 0x82, 0xba, 0x9b, 0x42, 0x34, 0x12, 0xfa, 0xac, 0x18, 0x12, 0x10, 0x13, 0x88, 0x12, 0xc0, + 0x9c, 0x31, 0x02, 0x22, 0xfa, 0xdf, 0x89, 0xa0, 0x28, 0x25, 0x13, 0xa0, 0xbb, 0x1b, 0x45, 0x22, + 0x80, 0xcd, 0x9b, 0x30, 0x02, 0x31, 0x02, 0x10, 0x02, 0xdd, 0x0a, 0x33, 0x11, 0x82, 0xef, 0xbb, + 0x89, 0x88, 0x52, 0x44, 0x01, 0xa9, 0xac, 0x38, 0x25, 0x11, 0xa8, 0xcd, 0x8a, 0x31, 0x11, 0x12, + 0x12, 0x11, 0xd0, 0xac, 0x39, 0x23, 0x21, 0xc1, 0xff, 0x9a, 0x88, 0x01, 0x32, 0x35, 0x91, 0xdb, + 0x8a, 0x42, 0x13, 0x01, 0xd9, 0xbc, 0x1a, 0x33, 0x12, 0x20, 0x23, 0x11, 0xdc, 0x9b, 0x21, 0x23, + 0x22, 0xf8, 0xef, 0x89, 0x00, 0x01, 0x32, 0x14, 0xa8, 0xad, 0x18, 0x33, 0x13, 0x90, 0xfb, 0xac, + 0x20, 0x23, 0x01, 0x30, 0x12, 0xa0, 0xad, 0x8a, 0x31, 0x21, 0x23, 0xff, 0x9e, 0x08, 0x00, 0x01, + 0x43, 0x03, 0xda, 0x8a, 0x20, 0x33, 0x82, 0xa9, 0xcf, 0x8a, 0x42, 0x12, 0x18, 0x21, 0x01, 0xaa, + 0x99, 0xab, 0x21, 0x32, 0xb4, 0xff, 0x8f, 0x00, 0x00, 0x10, 0x33, 0x91, 0xbc, 0x08, 0x22, 0x33, + 0x90, 0xfa, 0xae, 0x28, 0x33, 0x01, 0x01, 0x41, 0x98, 0x08, 0xa9, 0x9c, 0x18, 0x22, 0xf8, 0xdf, + 0x08, 0x00, 0x10, 0x21, 0x24, 0xc8, 0x8a, 0x10, 0x11, 0x14, 0xa9, 0xdd, 0x8a, 0x41, 0x13, 0x11, + 0x08, 0x12, 0x89, 0x02, 0xdc, 0x8a, 0x01, 0x82, 0xef, 0x8a, 0x08, 0x00, 0x22, 0x41, 0x04, 0xab, + 0x09, 0x01, 0x52, 0x82, 0xcc, 0xbd, 0x18, 0x44, 0x12, 0x81, 0x19, 0x81, 0x38, 0xb3, 0xce, 0x09, + 0x08, 0xc1, 0xbd, 0x89, 0x80, 0x30, 0x25, 0x31, 0x92, 0x8d, 0x08, 0x08, 0x44, 0xb8, 0xce, 0x8a, + 0x31, 0x26, 0x21, 0x90, 0x09, 0x11, 0x42, 0xd9, 0xac, 0x88, 0x00, 0xb9, 0xbb, 0x9b, 0x98, 0x73, + 0x15, 0x21, 0xb0, 0x09, 0xa8, 0x48, 0x04, 0xfb, 0x9d, 0x00, 0x62, 0x12, 0x01, 0xb8, 0x28, 0x32, + 0x83, 0xde, 0x89, 0x89, 0x88, 0x89, 0xb8, 0x0a, 0xaa, 0x66, 0x81, 0x21, 0xa8, 0x98, 0x9b, 0x44, + 0xa1, 0xcf, 0x19, 0x10, 0x35, 0x11, 0x82, 0xac, 0x41, 0x23, 0xd8, 0xab, 0x99, 0x8a, 0x88, 0x12, + 0xbb, 0xc8, 0x1e, 0x16, 0x80, 0x12, 0x99, 0xaa, 0x49, 0x04, 0xfb, 0x9b, 0x10, 0x62, 0x15, 0x10, + 0xa8, 0x8b, 0x53, 0x81, 0xba, 0x9a, 0xba, 0x8a, 0x28, 0x93, 0x1b, 0xfc, 0x58, 0x82, 0x18, 0x82, + 0xbc, 0x09, 0x34, 0xa0, 0xbf, 0x0b, 0x21, 0x57, 0x02, 0x00, 0xab, 0x19, 0x16, 0xa8, 0x8a, 0xb8, + 0xab, 0x00, 0x31, 0x91, 0x90, 0xbf, 0x33, 0x11, 0x21, 0xf8, 0x9d, 0x21, 0x82, 0xa9, 0xeb, 0x0a, + 0x72, 0x35, 0x00, 0x98, 0xaa, 0x40, 0x93, 0xab, 0x98, 0xdc, 0x08, 0x80, 0x20, 0x21, 0xd1, 0x8a, + 0x30, 0x04, 0x99, 0xde, 0x19, 0x23, 0x98, 0x98, 0xbf, 0x18, 0x56, 0x03, 0x80, 0x99, 0x98, 0x31, + 0xc0, 0x8a, 0xa8, 0x9d, 0x01, 0x8a, 0x33, 0x15, 0xda, 0x8a, 0x34, 0x90, 0xdb, 0x9d, 0x31, 0x81, + 0x28, 0xe0, 0xac, 0x50, 0x35, 0x01, 0x98, 0x98, 0x89, 0x13, 0xcb, 0x99, 0xb9, 0x3a, 0xc3, 0x2b, + 0x27, 0x92, 0xcb, 0x39, 0x05, 0xb9, 0xbd, 0x0a, 0x33, 0x80, 0x32, 0xfd, 0x8a, 0x63, 0x24, 0x80, + 0x88, 0x99, 0x19, 0x91, 0xba, 0xaa, 0x99, 0x32, 0xdb, 0x72, 0x13, 0xb0, 0xad, 0x32, 0x91, 0xdc, + 0x9c, 0x08, 0x22, 0x10, 0xa2, 0xaf, 0x38, 0x56, 0x02, 0x08, 0xa8, 0x89, 0x88, 0x80, 0xca, 0x88, + 0x08, 0x98, 0x3a, 0x37, 0x13, 0xfa, 0x1a, 0x11, 0xb8, 0xbf, 0x89, 0x20, 0x13, 0x81, 0xca, 0x0b, + 0x72, 0x36, 0x01, 0x80, 0xa9, 0x99, 0x88, 0xb0, 0x9d, 0x11, 0x98, 0x09, 0x53, 0x32, 0x94, 0x9f, + 0x01, 0x01, 0xec, 0x9b, 0x98, 0x41, 0x12, 0xa9, 0x89, 0x80, 0x73, 0x27, 0x10, 0x98, 0x99, 0x89, + 0x89, 0xb8, 0x2a, 0x93, 0x9c, 0x32, 0x13, 0x46, 0xc0, 0x0a, 0x10, 0xd9, 0xbe, 0x9b, 0x09, 0x54, + 0xa1, 0x89, 0x11, 0x09, 0x57, 0x11, 0x00, 0x99, 0x99, 0x98, 0x9a, 0xaa, 0x42, 0xa8, 0x39, 0x15, + 0x18, 0x06, 0x9b, 0x08, 0x01, 0xed, 0xbc, 0x9b, 0x40, 0x14, 0xa9, 0x20, 0x92, 0x60, 0x16, 0x10, + 0x88, 0x99, 0x08, 0xb8, 0x9d, 0x19, 0x83, 0x8a, 0x44, 0x92, 0x40, 0xb1, 0x0b, 0x89, 0xa0, 0xef, + 0xdb, 0x0a, 0x42, 0x91, 0x89, 0x23, 0x88, 0x65, 0x02, 0x80, 0x98, 0x09, 0x01, 0xec, 0x89, 0x11, + 0x88, 0x28, 0x24, 0x88, 0x23, 0xca, 0x08, 0x9a, 0xd0, 0xce, 0xae, 0x29, 0x14, 0xa8, 0x10, 0x02, + 0x30, 0x37, 0x90, 0x80, 0x89, 0x20, 0xb2, 0xdf, 0x18, 0x81, 0x88, 0x22, 0x00, 0x30, 0x84, 0x9b, + 0xa0, 0x1a, 0xf9, 0xcf, 0x9c, 0x41, 0x81, 0x89, 0x11, 0x11, 0x51, 0x14, 0x99, 0x88, 0x28, 0x12, + 0xf9, 0x8f, 0x11, 0x88, 0x20, 0x01, 0x88, 0x18, 0x92, 0x8c, 0x00, 0x21, 0xfc, 0xcd, 0x0a, 0x23, + 0x90, 0x10, 0x02, 0x02, 0x73, 0x93, 0x8b, 0x10, 0x32, 0x82, 0xff, 0x1a, 0x01, 0x18, 0x12, 0x81, + 0x99, 0x20, 0xd0, 0x19, 0x21, 0x93, 0xff, 0xcb, 0x28, 0x02, 0x08, 0x21, 0x11, 0x80, 0x45, 0xb8, + 0x19, 0x21, 0x34, 0xe0, 0xad, 0x29, 0x01, 0x20, 0x13, 0xa0, 0x9b, 0x13, 0x9e, 0x21, 0x32, 0xf1, + 0xce, 0x9c, 0x31, 0x80, 0x20, 0x11, 0x01, 0x38, 0x07, 0xab, 0x21, 0x21, 0x03, 0xfb, 0x9d, 0x20, + 0x10, 0x22, 0x82, 0xba, 0x1a, 0xb2, 0x2c, 0x17, 0x81, 0xfa, 0xbd, 0x0a, 0x22, 0x00, 0x21, 0x01, + 0x80, 0x72, 0xa3, 0x8a, 0x22, 0x21, 0x91, 0xde, 0x9a, 0x22, 0x12, 0x43, 0xa0, 0xad, 0x10, 0xa8, + 0x73, 0x01, 0xa8, 0xce, 0xcb, 0x19, 0x22, 0x10, 0x12, 0x01, 0x89, 0x36, 0xa8, 0x38, 0x02, 0x21, + 0xb2, 0xff, 0x09, 0x21, 0x21, 0x13, 0xda, 0x9b, 0x01, 0x28, 0x27, 0x98, 0xca, 0xdb, 0x9d, 0x28, + 0x02, 0x20, 0x12, 0x98, 0x48, 0x14, 0x89, 0x03, 0xa8, 0x41, 0xc2, 0xbe, 0x19, 0x34, 0x42, 0xa1, + 0xcc, 0x09, 0x00, 0xc2, 0x02, 0x00, 0x00, 0x7d, 0x0b, 0x02, 0x01, 0x00, 0x28, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x00, 0x78, 0x77, 0x77, 0x37, 0xc9, 0x8b, 0xa4, 0x8e, 0x61, 0xc3, 0x8e, 0x20, + 0x98, 0x88, 0x43, 0x9a, 0xd1, 0x48, 0x80, 0x10, 0x11, 0x81, 0x89, 0xa0, 0x88, 0x8a, 0xa1, 0x62, + 0xfa, 0xab, 0x2a, 0xa1, 0x0e, 0x02, 0x62, 0x02, 0x12, 0x30, 0x01, 0x00, 0xc0, 0x0b, 0xc0, 0xbc, + 0xdb, 0x68, 0x84, 0xbc, 0x19, 0x00, 0x80, 0x30, 0xb2, 0x1b, 0x84, 0xaa, 0x18, 0x14, 0x71, 0xb1, + 0x2c, 0x16, 0xa9, 0x89, 0x00, 0x88, 0x9a, 0x88, 0xab, 0x0d, 0x34, 0xf9, 0x2a, 0x17, 0xcb, 0x18, + 0xb8, 0x40, 0x91, 0x49, 0x24, 0x90, 0x19, 0x03, 0xba, 0xcb, 0x30, 0x24, 0x98, 0x08, 0x81, 0x40, + 0xb3, 0xbe, 0xa9, 0x19, 0x80, 0x90, 0x51, 0xb9, 0xff, 0x0c, 0x23, 0x11, 0x18, 0x35, 0x03, 0xa9, + 0x08, 0x90, 0x20, 0xfb, 0xa9, 0x2b, 0x95, 0x3b, 0x15, 0xeb, 0x9a, 0x88, 0x80, 0x8a, 0x12, 0x50, + 0x93, 0x1d, 0x15, 0x88, 0x98, 0x28, 0x82, 0x30, 0x18, 0xf2, 0x9f, 0x20, 0x81, 0xbc, 0x1b, 0x12, + 0x00, 0x29, 0x77, 0xa1, 0xad, 0x19, 0x01, 0x00, 0x90, 0x1a, 0x37, 0x80, 0x20, 0x92, 0x9b, 0xea, + 0x9b, 0x41, 0x82, 0x00, 0x01, 0x18, 0x03, 0xee, 0x09, 0x01, 0x99, 0x52, 0x88, 0x21, 0x80, 0x99, + 0x90, 0xac, 0x29, 0x47, 0x90, 0x31, 0x34, 0xb8, 0xae, 0xba, 0x2a, 0xb1, 0x9d, 0x53, 0x01, 0x00, + 0xd9, 0x0a, 0x02, 0x01, 0x19, 0xb1, 0x1d, 0x17, 0x98, 0xba, 0x3a, 0x25, 0xb2, 0x9f, 0x32, 0xb8, + 0xcb, 0x29, 0x04, 0x8b, 0x21, 0x13, 0x40, 0x37, 0x01, 0xda, 0x9c, 0x21, 0xa0, 0xdb, 0xab, 0x28, + 0x13, 0x61, 0x26, 0x98, 0x88, 0x00, 0xb8, 0xaa, 0xac, 0x20, 0x81, 0x58, 0x27, 0xc9, 0x28, 0x93, + 0xbc, 0x18, 0x21, 0x01, 0x62, 0x83, 0x40, 0x82, 0xca, 0x0b, 0x13, 0xfb, 0x0a, 0x08, 0x91, 0xbf, + 0x10, 0x80, 0x91, 0x1a, 0x36, 0x81, 0x18, 0x22, 0x21, 0xa0, 0xed, 0xac, 0x22, 0xb1, 0x2a, 0x35, + 0xb8, 0xbd, 0xaa, 0x00, 0xaa, 0x02, 0x8b, 0x42, 0x67, 0x01, 0x90, 0x9a, 0x10, 0x46, 0x03, 0x10, + 0x98, 0xbb, 0xad, 0xa9, 0xae, 0x09, 0xa0, 0xac, 0x73, 0x93, 0x89, 0x32, 0x90, 0x89, 0x34, 0x91, + 0x89, 0x24, 0xfc, 0x0c, 0x32, 0x03, 0xb9, 0x20, 0x25, 0xa1, 0x10, 0xa0, 0xac, 0x9a, 0x9c, 0x28, + 0x22, 0x25, 0xb9, 0x99, 0xdc, 0xac, 0x51, 0xb0, 0x8c, 0x08, 0x71, 0x23, 0x82, 0x00, 0xc0, 0x8c, + 0x08, 0xb8, 0x1a, 0xa0, 0x61, 0x91, 0x09, 0x91, 0xdc, 0xab, 0x63, 0x02, 0xd9, 0x8a, 0x02, 0xab, + 0x38, 0x36, 0x81, 0x0a, 0x54, 0x01, 0x20, 0x94, 0x0a, 0x26, 0xfb, 0x8b, 0x98, 0x99, 0x21, 0x01, + 0x81, 0xda, 0xbc, 0x19, 0x34, 0x02, 0x11, 0x52, 0x13, 0x98, 0x51, 0x34, 0xe1, 0xae, 0x31, 0x82, + 0x0a, 0x43, 0xa9, 0x9a, 0x9a, 0x08, 0x10, 0xea, 0x9c, 0x8a, 0x44, 0x43, 0x23, 0xb9, 0x9d, 0x80, + 0x9a, 0x21, 0x90, 0xad, 0x18, 0x32, 0x15, 0x98, 0xaa, 0x41, 0xfb, 0x8c, 0x90, 0x89, 0x53, 0x33, + 0x81, 0xab, 0x12, 0xeb, 0xca, 0x1a, 0x12, 0x12, 0xea, 0x8a, 0x72, 0x92, 0x8a, 0x44, 0x22, 0x20, + 0xd8, 0xac, 0xbb, 0x9a, 0x73, 0x92, 0x18, 0x02, 0x81, 0xcb, 0xa9, 0xaa, 0x09, 0x51, 0x12, 0xb0, + 0x78, 0x06, 0x08, 0x00, 0x90, 0x18, 0x03, 0x42, 0x91, 0x60, 0x24, 0x81, 0xdc, 0x9b, 0x21, 0xc9, + 0x99, 0x88, 0xd9, 0x09, 0x11, 0x40, 0x15, 0xd9, 0xbb, 0x18, 0x81, 0x51, 0x03, 0xbc, 0x38, 0x23, + 0x01, 0xa2, 0xbf, 0x19, 0xa0, 0xbd, 0xac, 0x71, 0x13, 0x89, 0x31, 0x33, 0x33, 0x12, 0xf9, 0xbe, + 0xaa, 0xbb, 0x1b, 0x53, 0x53, 0x13, 0x91, 0xab, 0x22, 0xa9, 0x9a, 0x98, 0x78, 0x46, 0x01, 0x9a, + 0x8a, 0xcc, 0x8b, 0x09, 0x80, 0x89, 0x80, 0x90, 0x58, 0x16, 0x42, 0x83, 0x18, 0x45, 0x03, 0x98, + 0x20, 0x20, 0xc3, 0x9d, 0x11, 0x88, 0xcc, 0xca, 0x9a, 0xa8, 0xcc, 0xac, 0x99, 0x89, 0x10, 0x25, + 0x12, 0x62, 0x24, 0x90, 0x09, 0x22, 0xb8, 0xbd, 0x10, 0x11, 0x08, 0x91, 0x18, 0xc0, 0xcf, 0x09, + 0x20, 0x53, 0x13, 0x08, 0xd8, 0x9c, 0x88, 0x20, 0xfa, 0xbc, 0x8a, 0x90, 0x40, 0x45, 0x34, 0x88, + 0x08, 0x01, 0x00, 0x8a, 0xa8, 0xab, 0xfc, 0x8c, 0x31, 0x03, 0x09, 0xa1, 0xad, 0x88, 0x21, 0x11, + 0x03, 0x1a, 0x77, 0x22, 0x02, 0x89, 0x99, 0xa9, 0x08, 0x44, 0x12, 0xc9, 0x38, 0x31, 0xd1, 0xbe, + 0x8a, 0xda, 0x99, 0xb9, 0xaf, 0x8a, 0x21, 0x32, 0x35, 0xa1, 0x9c, 0x19, 0x91, 0x51, 0x36, 0x91, + 0xaa, 0x38, 0x36, 0xc8, 0xad, 0x38, 0x22, 0x23, 0xb8, 0xcc, 0x9c, 0x98, 0xab, 0x89, 0x20, 0x53, + 0x11, 0x81, 0x80, 0xba, 0x60, 0x13, 0xba, 0x2a, 0x77, 0x12, 0x88, 0xab, 0xca, 0x19, 0x22, 0x22, + 0xb8, 0xcc, 0x58, 0x14, 0x99, 0x0a, 0x90, 0x9a, 0x88, 0xac, 0x18, 0x36, 0x33, 0x44, 0x54, 0x34, + 0x01, 0xa9, 0xbc, 0xab, 0xe9, 0x8a, 0x22, 0x81, 0xab, 0xa0, 0xcc, 0x09, 0x90, 0x1a, 0x83, 0xef, + 0xab, 0x20, 0x15, 0x10, 0x21, 0x02, 0x11, 0x62, 0x14, 0xb9, 0x8c, 0x63, 0x02, 0xa8, 0x8a, 0x31, + 0xe9, 0xbb, 0xbb, 0xcd, 0x09, 0x52, 0x02, 0xa9, 0xa9, 0x28, 0x35, 0x01, 0xca, 0x8b, 0x45, 0x03, + 0xb9, 0x1a, 0x81, 0x32, 0x08, 0x66, 0x12, 0xb8, 0x8b, 0xb0, 0xad, 0x19, 0x01, 0xea, 0x08, 0x98, + 0x31, 0x21, 0x14, 0x43, 0x11, 0x84, 0x9c, 0x61, 0x37, 0x12, 0x91, 0xeb, 0xcc, 0x8a, 0x99, 0x88, + 0x52, 0x03, 0x11, 0x90, 0x09, 0x02, 0xfd, 0x9a, 0x08, 0x99, 0x28, 0x36, 0x02, 0x99, 0xaa, 0x28, + 0x27, 0x81, 0x08, 0x81, 0xba, 0x51, 0x84, 0x89, 0x01, 0xda, 0x9b, 0x08, 0xfa, 0x9a, 0x81, 0xac, + 0x40, 0x83, 0xdc, 0x89, 0x10, 0x11, 0x45, 0x12, 0x88, 0x80, 0x21, 0x36, 0x81, 0xab, 0x08, 0x00, + 0xa0, 0x00, 0xfb, 0xbf, 0x2a, 0x24, 0x81, 0x98, 0x9b, 0x30, 0x47, 0xa0, 0xaa, 0x9a, 0x00, 0x32, + 0x12, 0x55, 0x02, 0xca, 0x8a, 0xa0, 0xbd, 0x30, 0x05, 0xaa, 0x99, 0x08, 0x21, 0x04, 0xce, 0x8a, + 0xa9, 0x8b, 0x18, 0x34, 0x53, 0x25, 0x12, 0x00, 0x11, 0x24, 0xdb, 0x8a, 0x98, 0xa9, 0x19, 0xf8, + 0xad, 0x28, 0x53, 0x22, 0x98, 0x89, 0x99, 0xf8, 0xae, 0x98, 0x08, 0x81, 0x11, 0x28, 0x35, 0x98, + 0x00, 0x32, 0x83, 0x8b, 0x77, 0x14, 0x10, 0x10, 0x90, 0x9a, 0xc8, 0x8b, 0xb9, 0xca, 0x9b, 0x01, + 0x89, 0x80, 0xec, 0xbc, 0x09, 0x55, 0x22, 0x90, 0x58, 0x24, 0x08, 0xb8, 0xab, 0xaa, 0x31, 0xa9, + 0xfa, 0xad, 0x88, 0x30, 0x12, 0x00, 0x9b, 0x21, 0x55, 0x12, 0xa0, 0xcf, 0x89, 0x10, 0x81, 0x42, + 0x34, 0x82, 0x08, 0x02, 0xba, 0xee, 0xab, 0x08, 0x88, 0x73, 0x24, 0x02, 0x89, 0xba, 0x9c, 0xba, + 0x8c, 0x98, 0xcc, 0x0a, 0x10, 0x01, 0x53, 0x44, 0x12, 0x00, 0x90, 0x09, 0x36, 0x90, 0x30, 0x33, + 0x81, 0xcb, 0x30, 0xc9, 0x29, 0x25, 0xd1, 0x9d, 0x99, 0x89, 0xa8, 0xaa, 0xdc, 0xbc, 0x89, 0x00, + 0x41, 0x55, 0x92, 0x0a, 0x42, 0x33, 0x91, 0x9b, 0xab, 0x81, 0xb9, 0x8b, 0xf9, 0x9d, 0x41, 0x35, + 0xa0, 0xab, 0x88, 0xec, 0xac, 0x10, 0x22, 0xa0, 0x40, 0x45, 0x23, 0x00, 0x10, 0xc1, 0xbf, 0x8a, + 0x11, 0x81, 0x8a, 0x43, 0xb2, 0xdf, 0x89, 0x08, 0x11, 0x33, 0x25, 0x98, 0xa0, 0x8a, 0xb8, 0xbc, + 0x18, 0x33, 0x54, 0x24, 0x00, 0xca, 0x8b, 0x41, 0x25, 0x92, 0x39, 0x27, 0x80, 0x20, 0xc0, 0xbf, + 0x9b, 0x08, 0x98, 0x89, 0xaa, 0x3a, 0x37, 0x81, 0xb9, 0x0b, 0xa1, 0x2a, 0x43, 0x25, 0x32, 0x33, + 0x92, 0x19, 0x14, 0x00, 0xd8, 0xce, 0x9a, 0x10, 0x90, 0x0a, 0x37, 0xf8, 0x8a, 0x21, 0xa9, 0x8a, + 0x99, 0x33, 0xa9, 0x71, 0x25, 0x12, 0x90, 0xaa, 0x41, 0xa1, 0xbf, 0xa9, 0xab, 0x20, 0x34, 0xa8, + 0x60, 0x91, 0x99, 0xcd, 0x19, 0x12, 0x80, 0x99, 0x73, 0x27, 0xa8, 0x19, 0x33, 0x90, 0x9c, 0x88, + 0x12, 0xb9, 0x8a, 0x54, 0x33, 0x45, 0x82, 0xeb, 0xac, 0x8b, 0x12, 0x98, 0x88, 0x9a, 0x89, 0x00, + 0x20, 0x05, 0xbd, 0x9a, 0x98, 0x48, 0x57, 0x11, 0x99, 0x20, 0x53, 0x33, 0x03, 0xda, 0xcb, 0x89, + 0xca, 0x08, 0x90, 0xac, 0x08, 0x01, 0x12, 0xc9, 0x9c, 0x18, 0x08, 0x65, 0x25, 0x90, 0x09, 0x90, + 0xab, 0x40, 0x92, 0x8b, 0xfb, 0x9c, 0x89, 0x22, 0x42, 0x03, 0x89, 0xcb, 0x18, 0x08, 0x23, 0x12, + 0xa8, 0x75, 0x17, 0x00, 0x10, 0x98, 0xbb, 0xc9, 0x9b, 0x0a, 0x73, 0x12, 0x54, 0x81, 0xa9, 0x89, + 0x89, 0xa0, 0x9b, 0xd9, 0x1a, 0xb1, 0xbf, 0xaa, 0x19, 0x90, 0x09, 0x74, 0x82, 0x09, 0x10, 0x88, + 0x21, 0x73, 0x46, 0x12, 0x90, 0xab, 0x08, 0xb9, 0xad, 0xaa, 0x10, 0x08, 0x51, 0x14, 0xcb, 0x08, + 0xa8, 0x89, 0x42, 0xfc, 0x9c, 0x08, 0xa8, 0x09, 0x42, 0x23, 0x63, 0x34, 0x82, 0x9a, 0x90, 0x08, + 0xcb, 0xa0, 0xef, 0x88, 0x08, 0x98, 0x41, 0x25, 0x01, 0x98, 0x89, 0x20, 0x92, 0x3a, 0x33, 0x46, + 0x32, 0x81, 0xab, 0xd9, 0xbf, 0x0a, 0x83, 0xbb, 0x8a, 0x32, 0x82, 0xab, 0x18, 0x98, 0xbf, 0xbd, + 0x40, 0x25, 0x11, 0x11, 0x90, 0x8a, 0xb8, 0xde, 0x0a, 0x42, 0x84, 0xaa, 0x73, 0x23, 0x80, 0x28, + 0x90, 0x88, 0xfb, 0x9c, 0x18, 0x98, 0x49, 0x05, 0xba, 0x0a, 0xc9, 0x9a, 0x00, 0xda, 0xaa, 0x30, + 0xa1, 0x71, 0x37, 0x22, 0x80, 0x99, 0x88, 0xa0, 0x9b, 0xaa, 0xdb, 0xbe, 0x19, 0x53, 0x35, 0x23, + 0x00, 0xb9, 0x0a, 0x14, 0xeb, 0xaa, 0x10, 0xa0, 0x09, 0x53, 0x13, 0x30, 0x27, 0xc9, 0xac, 0x31, + 0x82, 0xeb, 0x89, 0x00, 0xb9, 0x9c, 0x08, 0x01, 0x99, 0x80, 0x0b, 0x56, 0x43, 0x91, 0x88, 0x21, + 0x12, 0xda, 0x2a, 0x33, 0xd0, 0x59, 0x24, 0xa9, 0xcb, 0x38, 0x82, 0xce, 0x89, 0x19, 0x81, 0xbc, + 0x58, 0x15, 0x99, 0x00, 0xb8, 0x9a, 0x9a, 0xde, 0xab, 0x10, 0x32, 0x22, 0x32, 0x37, 0x22, 0x42, + 0xa8, 0x3a, 0x25, 0xa8, 0xac, 0x38, 0x47, 0x91, 0x89, 0x89, 0x08, 0xfb, 0xbc, 0x18, 0x81, 0x18, + 0x14, 0x98, 0x51, 0x35, 0x14, 0x01, 0xd9, 0xaa, 0xba, 0xcd, 0x8a, 0x22, 0x01, 0x89, 0x81, 0x09, + 0x33, 0x92, 0x1c, 0x25, 0x92, 0x08, 0x80, 0x8b, 0x43, 0xa8, 0x29, 0x02, 0x66, 0x34, 0xc0, 0x9b, + 0x18, 0x82, 0x30, 0x05, 0xba, 0xbf, 0x63, 0x80, 0xcc, 0x8a, 0x00, 0x10, 0x12, 0xca, 0xbd, 0xbc, + 0x2a, 0x23, 0x02, 0x10, 0x43, 0x44, 0x44, 0x22, 0x32, 0xa3, 0xce, 0xba, 0x18, 0x00, 0x44, 0x80, + 0x00, 0x20, 0xa2, 0xac, 0xcb, 0xdb, 0x8a, 0xa8, 0x30, 0x36, 0x12, 0x42, 0xd0, 0xbe, 0x08, 0x20, + 0x81, 0xaa, 0x50, 0x81, 0x08, 0x52, 0x02, 0x9a, 0x10, 0xcc, 0x9b, 0xc8, 0x8c, 0x99, 0xc8, 0x48, + 0x24, 0x11, 0x54, 0x23, 0x01, 0x80, 0x31, 0x26, 0xc9, 0xbd, 0xab, 0x08, 0xa0, 0xbc, 0x50, 0x24, + 0xa0, 0xcb, 0xab, 0x28, 0x35, 0x81, 0x19, 0x13, 0x99, 0x29, 0x57, 0xfa, 0xbb, 0x18, 0x31, 0x43, + 0x04, 0xa8, 0x19, 0x22, 0x13, 0x01, 0x52, 0xb0, 0xae, 0x18, 0x23, 0x01, 0xd8, 0xcd, 0x9a, 0x00, + 0x00, 0xb8, 0xbd, 0x8a, 0x18, 0x57, 0x13, 0xa8, 0x8a, 0xa9, 0x18, 0x44, 0x23, 0x81, 0xca, 0xbc, + 0xab, 0x19, 0x34, 0xc8, 0xac, 0x51, 0x23, 0xa0, 0xac, 0x28, 0x45, 0x32, 0x81, 0x9a, 0x8a, 0x91, + 0xee, 0xab, 0x10, 0x11, 0x20, 0x46, 0x22, 0x00, 0xb9, 0xbf, 0xab, 0x29, 0x01, 0xda, 0xab, 0x28, + 0x55, 0x22, 0x88, 0x80, 0x88, 0x21, 0x31, 0x14, 0xc8, 0xaf, 0x28, 0x24, 0x32, 0x82, 0xeb, 0xaa, + 0x38, 0x25, 0x90, 0x9a, 0xbb, 0xcc, 0x28, 0x32, 0x16, 0xa8, 0xba, 0x09, 0xca, 0x09, 0xa9, 0x8c, + 0x64, 0x02, 0x99, 0x19, 0x34, 0x12, 0xfb, 0x1a, 0x43, 0x81, 0x00, 0xda, 0x8a, 0x08, 0x81, 0x9a, + 0x88, 0xcb, 0x1b, 0x67, 0x81, 0x00, 0x80, 0x21, 0x73, 0x81, 0xbb, 0x9d, 0x10, 0x01, 0x00, 0x98, + 0xcd, 0xbb, 0x89, 0xda, 0xac, 0x40, 0x02, 0x40, 0x44, 0x23, 0x40, 0x82, 0xcc, 0x19, 0x13, 0x81, + 0x90, 0xbf, 0xbb, 0x28, 0x22, 0x23, 0x00, 0x64, 0x24, 0x01, 0x80, 0x88, 0xe9, 0xbc, 0x9b, 0x10, + 0xa9, 0xbb, 0x88, 0x8b, 0x37, 0x08, 0x00, 0x43, 0xb9, 0x18, 0xab, 0x52, 0x44, 0xc0, 0xbd, 0x29, + 0x15, 0x08, 0x10, 0x21, 0x23, 0xb8, 0xae, 0x19, 0xb9, 0x9d, 0x44, 0x08, 0x31, 0x72, 0x13, 0x99, + 0xfa, 0x9a, 0x89, 0xa9, 0x89, 0x22, 0x92, 0xec, 0x9a, 0x62, 0x25, 0x82, 0x18, 0xa0, 0xab, 0xac, + 0x88, 0xaa, 0x0a, 0x41, 0x36, 0x23, 0xa9, 0x71, 0x81, 0x01, 0x01, 0xeb, 0x0b, 0x32, 0x25, 0x00, + 0x81, 0x20, 0xe8, 0xcd, 0xbb, 0x9a, 0x9a, 0x22, 0x45, 0x22, 0x11, 0x98, 0x11, 0x98, 0xa8, 0x39, + 0xfc, 0x9b, 0x99, 0x22, 0xa9, 0xf9, 0x8c, 0x08, 0x38, 0x27, 0x31, 0x12, 0x10, 0x34, 0x82, 0xaa, + 0xda, 0xed, 0x9b, 0x09, 0x21, 0x24, 0x91, 0x09, 0x01, 0xa9, 0x99, 0x08, 0xa0, 0xdb, 0xbd, 0x70, + 0x27, 0x01, 0x98, 0xaa, 0x28, 0xa3, 0xae, 0x9a, 0x20, 0x82, 0xca, 0x28, 0x45, 0x33, 0x13, 0x11, + 0x83, 0xeb, 0x0a, 0x12, 0xfa, 0xbc, 0x99, 0x10, 0x01, 0x28, 0x67, 0x81, 0x98, 0x99, 0x99, 0xaa, + 0x99, 0x01, 0x30, 0xc2, 0x9b, 0x41, 0x43, 0xb8, 0xcc, 0x8a, 0x28, 0x36, 0x10, 0x12, 0x31, 0x46, + 0x02, 0xcc, 0xbb, 0x89, 0x89, 0xc8, 0x0c, 0x13, 0x44, 0x00, 0x63, 0x82, 0x99, 0x89, 0xaa, 0x21, + 0xe9, 0x8c, 0x23, 0xb0, 0x9b, 0xd9, 0xbf, 0x19, 0x83, 0x08, 0x52, 0x35, 0x12, 0x80, 0x90, 0x10, + 0x20, 0xd8, 0xbb, 0xbe, 0x08, 0x81, 0x99, 0x50, 0x35, 0x01, 0x18, 0xa8, 0x0a, 0x55, 0xe0, 0x8b, + 0x00, 0x32, 0x11, 0x24, 0x01, 0xcf, 0xaa, 0xaa, 0xaa, 0x8a, 0x82, 0x99, 0x60, 0x24, 0x53, 0x35, + 0x01, 0x88, 0x08, 0xa9, 0xbd, 0xdc, 0x8b, 0x01, 0x18, 0x20, 0x14, 0x81, 0x0b, 0x26, 0x91, 0x88, + 0x22, 0x03, 0x20, 0x31, 0xb0, 0xf0, 0xbf, 0xeb, 0x89, 0x89, 0x10, 0x43, 0x23, 0x11, 0x33, 0x43, + 0x23, 0xed, 0x9b, 0x99, 0xdb, 0x30, 0x42, 0x23, 0xa8, 0x08, 0xa8, 0xec, 0x99, 0x1a, 0x33, 0x33, + 0x73, 0x35, 0x12, 0xa8, 0xbe, 0x8b, 0x10, 0xd8, 0x8a, 0x32, 0x02, 0xca, 0xaa, 0x52, 0x91, 0x10, + 0x01, 0xb8, 0xab, 0x09, 0x77, 0x83, 0xa8, 0x9a, 0xeb, 0xac, 0x19, 0x35, 0x12, 0x80, 0x88, 0x88, + 0x11, 0xa8, 0x8a, 0x48, 0x34, 0x44, 0xa8, 0xbc, 0xbe, 0xbd, 0xad, 0x20, 0x32, 0x32, 0x35, 0x34, + 0x11, 0x90, 0x99, 0xea, 0xad, 0x08, 0x32, 0x92, 0xda, 0x9b, 0x80, 0xb9, 0x1b, 0x36, 0xb8, 0x8d, + 0x54, 0x33, 0x02, 0x88, 0x88, 0x88, 0x11, 0xf9, 0xbe, 0xaa, 0x88, 0x20, 0x33, 0x45, 0x23, 0x01, + 0x12, 0xc9, 0xab, 0xd9, 0xbc, 0x9a, 0x00, 0x33, 0x24, 0x88, 0xf9, 0x0b, 0x43, 0x81, 0x8a, 0x20, + 0xd0, 0x19, 0x11, 0xb0, 0xad, 0x28, 0x63, 0x14, 0x88, 0x98, 0x0a, 0x34, 0xe1, 0xbe, 0x8a, 0x99, + 0x18, 0x34, 0x23, 0x21, 0x26, 0x21, 0xa2, 0xbb, 0x9b, 0x18, 0xdc, 0x20, 0x00, 0xf9, 0x0a, 0x90, + 0x50, 0x03, 0x41, 0x23, 0x91, 0xbd, 0xbc, 0x20, 0xc9, 0xbc, 0x8a, 0x08, 0x44, 0x81, 0x01, 0x48, + 0x24, 0x12, 0xa0, 0x0d, 0x24, 0x20, 0x57, 0x82, 0xa8, 0xdb, 0xac, 0x8a, 0x80, 0xba, 0x9b, 0x52, + 0x34, 0x22, 0x33, 0x33, 0x34, 0xb0, 0xcf, 0xaa, 0xb9, 0xac, 0x8a, 0x32, 0xb8, 0x3a, 0x62, 0x35, + 0x32, 0x33, 0xb1, 0xbd, 0x39, 0x05, 0x9a, 0xa8, 0xac, 0xaa, 0xeb, 0x19, 0x12, 0xa8, 0x0b, 0x33, + 0x22, 0x65, 0x14, 0x41, 0x82, 0x10, 0x80, 0x81, 0x9a, 0x30, 0x67, 0xc9, 0xbd, 0xba, 0x99, 0x01, + 0xa8, 0x8b, 0x31, 0x44, 0x55, 0x02, 0x00, 0x31, 0xa0, 0x89, 0x99, 0x98, 0xdd, 0xab, 0x20, 0x88, + 0x46, 0x31, 0x13, 0x81, 0xba, 0xdb, 0x1a, 0x83, 0xee, 0x9b, 0x08, 0x88, 0x08, 0x80, 0xa9, 0x9a, + 0x51, 0x27, 0x22, 0x32, 0x81, 0xa9, 0x29, 0x44, 0xb0, 0xad, 0x08, 0xfa, 0x8a, 0x81, 0xba, 0x8c, + 0x22, 0x80, 0x72, 0x26, 0x81, 0x21, 0xa8, 0xdc, 0x89, 0x32, 0x00, 0x88, 0x12, 0x98, 0xcc, 0x0a, + 0x32, 0x12, 0xa8, 0x28, 0xe2, 0xae, 0x30, 0x45, 0xa0, 0xaa, 0xa8, 0xbe, 0xa9, 0x9a, 0x10, 0x01, + 0xa8, 0x74, 0x17, 0x88, 0x11, 0x31, 0x33, 0x02, 0x20, 0x10, 0x91, 0xbe, 0x99, 0x9b, 0xf9, 0xcf, + 0xba, 0xa9, 0xa9, 0x09, 0x42, 0x34, 0x24, 0x42, 0x34, 0x80, 0x89, 0xb9, 0xbd, 0xa9, 0xa9, 0xac, + 0x08, 0x18, 0x13, 0x66, 0x23, 0x02, 0x99, 0x81, 0x89, 0x89, 0x33, 0xe9, 0xbb, 0xca, 0xab, 0xca, + 0xcb, 0xaa, 0x51, 0x47, 0x13, 0x02, 0x10, 0x81, 0xa9, 0x09, 0x91, 0xbc, 0xac, 0xea, 0xcb, 0xaa, + 0x88, 0x08, 0x53, 0x24, 0x43, 0x01, 0xa9, 0xba, 0xcc, 0x20, 0x34, 0x01, 0x21, 0x90, 0x49, 0x46, + 0x03, 0x00, 0xcd, 0x9a, 0x21, 0x03, 0x98, 0x09, 0xe9, 0xac, 0x89, 0x01, 0xda, 0xcd, 0x9a, 0x88, + 0x28, 0x54, 0x82, 0xab, 0x89, 0x10, 0x66, 0x13, 0x01, 0x18, 0x34, 0x00, 0xb0, 0x9c, 0xb9, 0xba, + 0xcf, 0xa9, 0xab, 0x39, 0x14, 0x80, 0x22, 0x32, 0x46, 0x33, 0x42, 0x03, 0xa9, 0xdb, 0xdb, 0xaa, + 0xaa, 0x21, 0x80, 0xcb, 0x89, 0xa8, 0x71, 0x17, 0x00, 0x20, 0x21, 0x04, 0xb8, 0xbb, 0xcc, 0xbc, + 0xaa, 0xaa, 0x09, 0x33, 0x52, 0x43, 0x46, 0x23, 0x11, 0x20, 0x12, 0x90, 0xcb, 0xbd, 0xcc, 0xbb, + 0x19, 0x00, 0xdb, 0x28, 0x84, 0x99, 0x9c, 0x03, 0xbb, 0xcb, 0x09, 0x73, 0x14, 0x08, 0x43, 0x44, + 0x82, 0xa8, 0x09, 0xb8, 0xac, 0xb9, 0x28, 0x35, 0x14, 0x30, 0xc1, 0x9b, 0xaa, 0x73, 0x43, 0xa1, + 0xcd, 0xbb, 0x09, 0xa9, 0x19, 0x82, 0x10, 0x71, 0x36, 0x53, 0x00, 0x88, 0x10, 0xc9, 0xaa, 0xab, + 0x88, 0xf9, 0x9c, 0x89, 0x80, 0x11, 0xa9, 0x70, 0x14, 0x88, 0x11, 0x12, 0x43, 0x12, 0xa0, 0x19, + 0xa8, 0xc9, 0xaf, 0xba, 0x99, 0xd9, 0x19, 0x73, 0x14, 0x90, 0x09, 0x33, 0x83, 0xcb, 0xbe, 0x9b, + 0xbb, 0xbc, 0xcb, 0xaa, 0x20, 0x73, 0x25, 0x12, 0x22, 0x33, 0x02, 0x89, 0x19, 0x03, 0x98, 0x99, + 0xb0, 0xff, 0x8a, 0x20, 0x92, 0xcb, 0xac, 0x20, 0x98, 0x08, 0x80, 0xda, 0x29, 0x46, 0x33, 0x23, + 0x12, 0x32, 0xb0, 0xbe, 0xdb, 0xad, 0x08, 0xa9, 0xad, 0xa8, 0x38, 0x34, 0x23, 0x10, 0x24, 0x21, + 0x54, 0x23, 0x90, 0xfa, 0xae, 0xaa, 0x8b, 0x32, 0x81, 0x41, 0x45, 0x11, 0x23, 0x22, 0x99, 0xf9, + 0x8b, 0x99, 0xeb, 0x8a, 0x21, 0xc9, 0xbb, 0x8a, 0x11, 0x91, 0x00, 0x54, 0x11, 0x41, 0x45, 0x02, + 0x32, 0xb9, 0xcd, 0x09, 0xc8, 0x29, 0x02, 0x21, 0x62, 0x33, 0x43, 0x02, 0x20, 0xa1, 0xdb, 0x9e, + 0x89, 0x00, 0xeb, 0xbb, 0xdb, 0xbb, 0x19, 0x01, 0x63, 0x34, 0x12, 0x10, 0x35, 0x91, 0xac, 0x18, + 0xa0, 0xcc, 0x38, 0x91, 0xaa, 0x69, 0xa1, 0x9a, 0x10, 0xaa, 0x0b, 0xd3, 0x8f, 0x32, 0x25, 0x31, + 0x03, 0x08, 0x22, 0x12, 0xd8, 0xce, 0x0a, 0xa0, 0xba, 0x9b, 0x28, 0x15, 0x19, 0x00, 0x44, 0x90, + 0x8a, 0x99, 0xb8, 0x9d, 0xcf, 0x98, 0xaa, 0xbc, 0x08, 0x18, 0x57, 0x22, 0x42, 0x35, 0x03, 0x80, + 0x00, 0xa8, 0x9b, 0x0a, 0x81, 0xce, 0xab, 0xca, 0xab, 0xba, 0xbc, 0x9b, 0x39, 0x47, 0x34, 0x12, + 0x90, 0xb8, 0x9d, 0x9a, 0x89, 0x10, 0x18, 0x21, 0x53, 0x24, 0x32, 0x25, 0xa0, 0x1c, 0x03, 0xfb, + 0x9a, 0xa9, 0x8b, 0x33, 0x33, 0xe0, 0x9c, 0x81, 0x98, 0x08, 0x30, 0x13, 0x62, 0x47, 0x04, 0xa8, + 0xab, 0x99, 0x89, 0x02, 0x18, 0x42, 0xe0, 0xbe, 0x99, 0xaa, 0x8a, 0x12, 0x98, 0x99, 0x73, 0x15, + 0x20, 0x33, 0x43, 0x33, 0x02, 0x60, 0x83, 0xda, 0x99, 0x9b, 0x99, 0x33, 0x91, 0xad, 0x99, 0x21, + 0x29, 0x67, 0x01, 0xac, 0x89, 0xcb, 0xbd, 0xad, 0x9b, 0x08, 0x00, 0x20, 0x18, 0x46, 0x33, 0x24, + 0x22, 0x22, 0x42, 0x32, 0x81, 0x99, 0xdc, 0xbd, 0xbb, 0xbc, 0x99, 0x00, 0x11, 0x64, 0x23, 0x01, + 0x00, 0x98, 0xa9, 0xaa, 0xdd, 0x9a, 0x09, 0xc8, 0x9b, 0x63, 0x03, 0x80, 0x20, 0x45, 0x01, 0x00, + 0xb8, 0x9c, 0xa8, 0xcc, 0x9b, 0x22, 0x00, 0x32, 0xfd, 0x9b, 0x30, 0x36, 0x34, 0x01, 0x10, 0x92, + 0xa9, 0x6a, 0x25, 0x81, 0x38, 0x04, 0x98, 0x0a, 0xd9, 0xbe, 0xbc, 0x9b, 0xdb, 0x9b, 0x10, 0x08, + 0x00, 0x38, 0x45, 0x12, 0x80, 0x38, 0xd8, 0x48, 0x55, 0x02, 0x08, 0xa8, 0x9b, 0x9a, 0x22, 0x64, + 0x01, 0x31, 0x23, 0xc8, 0xaa, 0x9b, 0xfb, 0xab, 0xba, 0x9a, 0xca, 0xac, 0xa9, 0xbc, 0x8a, 0x43, + 0x67, 0x23, 0x32, 0x13, 0x01, 0x99, 0xa0, 0xbe, 0xcb, 0xaa, 0x89, 0xa9, 0x8b, 0x21, 0x14, 0x09, + 0x44, 0x33, 0x34, 0x23, 0x21, 0x44, 0x90, 0x10, 0xb1, 0xcf, 0x30, 0x13, 0xb8, 0x28, 0xc0, 0x30, + 0x23, 0xfc, 0x9e, 0x98, 0xca, 0x9c, 0x01, 0xad, 0x19, 0x91, 0x89, 0x32, 0x03, 0x40, 0x03, 0x08, + 0x52, 0x24, 0x09, 0x45, 0x34, 0x03, 0x52, 0x24, 0x82, 0xa9, 0xeb, 0xcc, 0xaa, 0x9b, 0x80, 0x08, + 0x11, 0x9a, 0x22, 0xb1, 0xdf, 0x31, 0x23, 0x81, 0x11, 0x11, 0x12, 0xba, 0xcd, 0xcb, 0x8b, 0x62, + 0x12, 0x18, 0x44, 0x13, 0x32, 0x16, 0x00, 0xb9, 0xab, 0xcc, 0xab, 0x9c, 0xa8, 0x38, 0xd0, 0xac, + 0x22, 0x32, 0x55, 0x12, 0x73, 0x82, 0x99, 0x00, 0xc9, 0xac, 0x98, 0xaa, 0xbb, 0x09, 0x43, 0x92, + 0xab, 0xb9, 0xcf, 0x18, 0x90, 0x08, 0x42, 0x45, 0x03, 0x99, 0x08, 0x42, 0x22, 0x90, 0x79, 0x45, + 0x12, 0x12, 0xa0, 0xbc, 0x89, 0xa1, 0xad, 0xac, 0x08, 0xc9, 0xac, 0x09, 0x91, 0xbe, 0x9b, 0x22, + 0x89, 0x10, 0x23, 0x88, 0x76, 0x23, 0x43, 0x43, 0x23, 0x14, 0xa9, 0x89, 0x80, 0xbe, 0x08, 0xb8, + 0xbe, 0x9a, 0x0a, 0x91, 0xdb, 0x8d, 0x44, 0x02, 0x89, 0x31, 0x42, 0x83, 0x9c, 0x89, 0xb0, 0x8a, + 0xc9, 0xad, 0x63, 0x11, 0x33, 0x83, 0xa9, 0xb9, 0xcf, 0x89, 0xb9, 0xae, 0x89, 0x08, 0xa9, 0x19, + 0x72, 0x25, 0x01, 0x81, 0x31, 0x34, 0x34, 0x21, 0x21, 0x90, 0xca, 0xbb, 0xbf, 0x99, 0x10, 0xe8, + 0xbb, 0x9a, 0x99, 0xbc, 0x8a, 0x88, 0xa8, 0x61, 0x45, 0x04, 0x99, 0x01, 0x91, 0x9d, 0x40, 0x05, + 0x18, 0x36, 0x82, 0xa9, 0x28, 0xc9, 0xba, 0x2a, 0x01, 0x81, 0x9b, 0x73, 0xa4, 0x9c, 0x98, 0xdb, + 0xdb, 0x8a, 0x8a, 0x11, 0x53, 0x35, 0x33, 0x01, 0x12, 0x01, 0x90, 0xb9, 0x09, 0x90, 0xcf, 0x9a, + 0xc9, 0xdd, 0xab, 0x09, 0x12, 0x98, 0x51, 0x26, 0x81, 0x01, 0x11, 0x33, 0x81, 0x99, 0x89, 0xba, + 0x9a, 0xce, 0x80, 0x9a, 0x71, 0x25, 0x00, 0x18, 0x32, 0xc0, 0xcd, 0x9b, 0xb8, 0xbf, 0x9b, 0x81, + 0x09, 0xa9, 0x08, 0x35, 0x21, 0x64, 0x33, 0x22, 0x21, 0x24, 0x01, 0x89, 0x53, 0xa1, 0x29, 0xa0, + 0xdd, 0x99, 0xca, 0xbb, 0xca, 0xbb, 0xba, 0xab, 0x68, 0x34, 0x12, 0x80, 0x32, 0x83, 0x9c, 0x73, + 0x14, 0x88, 0x43, 0x80, 0x38, 0xa2, 0xbf, 0xcb, 0xcc, 0x19, 0x11, 0x22, 0x34, 0x90, 0xab, 0xa9, + 0xaa, 0x2a, 0xf0, 0x8b, 0x52, 0x12, 0x40, 0x26, 0x90, 0xca, 0x19, 0x22, 0x34, 0x33, 0x34, 0xb1, + 0xcf, 0x8a, 0xaa, 0xbc, 0xbb, 0x99, 0x18, 0x80, 0x61, 0x14, 0x02, 0x19, 0x25, 0xa8, 0x41, 0x12, + 0x90, 0x80, 0x00, 0x13, 0x30, 0x57, 0x12, 0x10, 0x18, 0x26, 0x12, 0xa8, 0xfb, 0xbd, 0xbb, 0xca, + 0x8a, 0xcb, 0x9a, 0x09, 0x00, 0x54, 0x02, 0x32, 0x34, 0x04, 0x00, 0x08, 0x34, 0x22, 0x22, 0x03, + 0xa9, 0x10, 0xfd, 0x9d, 0xa9, 0x9a, 0x99, 0xa9, 0x8c, 0xba, 0x10, 0x73, 0x92, 0x8b, 0x65, 0x82, + 0x30, 0x24, 0x02, 0xa9, 0x08, 0x80, 0xeb, 0xab, 0x8a, 0x20, 0x91, 0x89, 0x09, 0x14, 0x9d, 0xe8, + 0xaf, 0x09, 0x80, 0x0a, 0x10, 0x90, 0x28, 0x08, 0x16, 0xb9, 0x70, 0x37, 0x02, 0x20, 0x33, 0x33, + 0x34, 0x14, 0xc9, 0xcd, 0xac, 0x98, 0xa9, 0xaa, 0x08, 0xc9, 0x9a, 0x18, 0x22, 0xb8, 0x8a, 0x64, + 0x83, 0x1a, 0x64, 0x23, 0x12, 0x98, 0x11, 0x41, 0x34, 0x34, 0x00, 0x90, 0xcd, 0xbc, 0x98, 0xbc, + 0x8a, 0xb9, 0x9a, 0xdd, 0x9a, 0x33, 0x10, 0x33, 0x10, 0x80, 0x74, 0x43, 0x03, 0x52, 0x03, 0x01, + 0xa9, 0x09, 0x99, 0xfb, 0xbe, 0xaa, 0x8a, 0x41, 0xa1, 0x9b, 0x12, 0xd9, 0x29, 0xd0, 0xac, 0x39, + 0x17, 0x11, 0x11, 0x26, 0x81, 0x98, 0x18, 0x34, 0x90, 0x09, 0x42, 0xb9, 0xca, 0xbc, 0x9a, 0x09, + 0x81, 0xc8, 0xcd, 0xcb, 0xbb, 0xab, 0xa9, 0x0b, 0x02, 0x8b, 0x76, 0x35, 0x13, 0x32, 0x53, 0x82, + 0x80, 0x63, 0x02, 0xb9, 0x9c, 0xba, 0x88, 0xbc, 0xb9, 0xba, 0xdf, 0x09, 0x90, 0x10, 0x22, 0xb9, + 0x52, 0x01, 0x20, 0x32, 0xa0, 0x54, 0x91, 0x49, 0x37, 0x82, 0x9a, 0x0a, 0x80, 0xb9, 0xbd, 0x9a, + 0x88, 0x81, 0xbc, 0xa0, 0xdf, 0x9a, 0x28, 0x81, 0xa8, 0x68, 0x14, 0x01, 0x99, 0x52, 0x36, 0x80, + 0x31, 0x23, 0x80, 0x12, 0xca, 0x9c, 0x90, 0xaf, 0xa8, 0xa9, 0xac, 0xaa, 0xfb, 0xbc, 0x99, 0x9a, + 0x62, 0x33, 0x10, 0x35, 0x13, 0x11, 0x98, 0x10, 0x63, 0x13, 0x88, 0x32, 0xd8, 0xab, 0x80, 0xb9, + 0xdf, 0x9a, 0xa9, 0x0b, 0x82, 0xaa, 0x38, 0x83, 0xda, 0xbc, 0x29, 0x94, 0xdb, 0x3a, 0x67, 0x11, + 0x22, 0x11, 0x80, 0x01, 0xc9, 0x09, 0x32, 0xa0, 0xb9, 0x9f, 0xb9, 0xbd, 0xca, 0x9a, 0x19, 0x10, + 0x44, 0x10, 0x90, 0x50, 0x02, 0xa8, 0x9c, 0x53, 0x43, 0x43, 0x33, 0x01, 0x89, 0x88, 0xc8, 0xbf, + 0x09, 0xc1, 0xab, 0x09, 0xa8, 0x8c, 0x81, 0xd8, 0xbf, 0x99, 0x18, 0x41, 0x16, 0x80, 0x01, 0x28, + 0x03, 0x43, 0x52, 0xa3, 0x09, 0x40, 0x12, 0x61, 0x03, 0x99, 0xa8, 0xfb, 0xac, 0xca, 0xad, 0xaa, + 0x98, 0xaa, 0x98, 0x61, 0x23, 0x12, 0x23, 0x98, 0x28, 0x27, 0x11, 0x42, 0x14, 0x44, 0x43, 0xa1, + 0xba, 0xac, 0xb9, 0xce, 0x8a, 0x01, 0x08, 0x88, 0x90, 0x18, 0xd8, 0xac, 0x10, 0xaa, 0x31, 0x54, + 0x35, 0x23, 0x52, 0x23, 0x80, 0x29, 0x15, 0xc9, 0x9b, 0xa0, 0xea, 0x9d, 0x08, 0xb0, 0x9a, 0xb9, + 0x0b, 0x11, 0x99, 0x74, 0x95, 0xac, 0x10, 0x32, 0x00, 0x12, 0x74, 0x23, 0x00, 0x08, 0x88, 0x89, + 0xdb, 0x89, 0x00, 0xb8, 0x9c, 0x9a, 0xb8, 0xff, 0x9d, 0x18, 0x80, 0x88, 0x88, 0x21, 0x32, 0x11, + 0x46, 0x80, 0x18, 0x81, 0x28, 0x37, 0x82, 0x19, 0x32, 0xb0, 0x1a, 0xa1, 0xcb, 0xde, 0xac, 0xaa, + 0xba, 0xaa, 0x18, 0x21, 0x21, 0x38, 0x16, 0x60, 0x33, 0x11, 0x53, 0x25, 0x90, 0x09, 0x53, 0x92, + 0xac, 0x21, 0xc8, 0xca, 0xbc, 0xbb, 0x18, 0xb1, 0x0c, 0x22, 0x24, 0xa0, 0x9a, 0xb1, 0xaf, 0xdb, + 0x41, 0x33, 0x32, 0x25, 0x12, 0x73, 0x82, 0x18, 0x81, 0xcd, 0x89, 0x98, 0x9a, 0x99, 0xcd, 0x8a, + 0x00, 0x10, 0x90, 0x10, 0xfa, 0x9f, 0x18, 0x80, 0x18, 0x45, 0x22, 0x12, 0x88, 0x22, 0x11, 0x43, + 0x02, 0xc9, 0x9b, 0x19, 0x20, 0x27, 0xb9, 0xbf, 0x9b, 0xca, 0xad, 0x20, 0x80, 0x8a, 0x53, 0x13, + 0x80, 0x09, 0xa1, 0xce, 0x0a, 0x43, 0x21, 0x44, 0x33, 0x00, 0x81, 0x08, 0x43, 0xb0, 0xbf, 0xaa, + 0xbc, 0xbb, 0xac, 0x10, 0xc0, 0xaa, 0x89, 0x72, 0x25, 0x00, 0x51, 0x13, 0xa8, 0x19, 0x13, 0x02, + 0xaa, 0x98, 0xba, 0x8b, 0x54, 0xe8, 0xbc, 0xa9, 0x9b, 0x52, 0x33, 0xc8, 0x99, 0xca, 0xcd, 0x99, + 0x00, 0xca, 0x89, 0x62, 0x34, 0x23, 0x21, 0x10, 0x13, 0x10, 0x54, 0x53, 0x33, 0x90, 0xbb, 0xac, + 0x99, 0xde, 0x9b, 0xa8, 0xcc, 0x89, 0x9a, 0x88, 0x32, 0xba, 0x31, 0x25, 0x11, 0x37, 0x90, 0x52, + 0x12, 0x12, 0x42, 0x23, 0x24, 0x01, 0x8a, 0x90, 0xfb, 0xcd, 0xab, 0xab, 0x8a, 0x38, 0x25, 0xa8, + 0x00, 0x9a, 0xb8, 0x9d, 0x10, 0x90, 0x2a, 0x56, 0x15, 0x21, 0x34, 0x23, 0x12, 0x91, 0xbd, 0x98, + 0xb9, 0xcf, 0x9a, 0xa8, 0xdb, 0x99, 0xba, 0x08, 0x10, 0xa8, 0x61, 0x11, 0x31, 0x56, 0x33, 0x24, + 0x01, 0x31, 0x02, 0x88, 0x01, 0xbe, 0x11, 0xb8, 0xbc, 0x19, 0x90, 0xc1, 0xff, 0x9a, 0x99, 0xbb, + 0x08, 0x99, 0x99, 0x10, 0x11, 0x47, 0x01, 0x22, 0x33, 0x46, 0x35, 0x21, 0x10, 0x10, 0xa0, 0xba, + 0x09, 0xd8, 0xae, 0x9a, 0xca, 0xbd, 0xaa, 0x89, 0x21, 0xa0, 0x8a, 0x31, 0x32, 0x66, 0x25, 0x80, + 0x20, 0x22, 0x23, 0x03, 0x10, 0x08, 0xfb, 0xbf, 0x98, 0x89, 0x89, 0xb8, 0xae, 0x08, 0x11, 0x89, + 0x44, 0x91, 0x8a, 0x31, 0x03, 0xa8, 0x70, 0x22, 0x91, 0x49, 0x35, 0x32, 0x34, 0x14, 0xba, 0xdb, + 0x2a, 0x03, 0xf9, 0x9c, 0x90, 0xda, 0xac, 0x98, 0xab, 0xcb, 0x48, 0x12, 0x21, 0x42, 0x23, 0x64, + 0x12, 0x02, 0x11, 0x02, 0x88, 0x88, 0x82, 0x9a, 0xa9, 0x34, 0xdb, 0x9a, 0x00, 0xe3, 0xae, 0xbb, + 0xc9, 0x9b, 0x9a, 0xc0, 0xbc, 0x19, 0x10, 0x10, 0x22, 0x67, 0x23, 0x33, 0x12, 0x08, 0x24, 0xda, + 0x2a, 0x13, 0xdd, 0x19, 0xa0, 0x9a, 0xd9, 0xab, 0x88, 0xad, 0x01, 0x98, 0x40, 0x03, 0x40, 0x13, + 0xcc, 0x72, 0x35, 0x12, 0x22, 0xa0, 0xaa, 0xa9, 0xec, 0x89, 0x00, 0x91, 0xce, 0x19, 0x22, 0x88, + 0xa0, 0x9d, 0xa8, 0xaa, 0x38, 0x04, 0xaa, 0x01, 0x8b, 0x43, 0x37, 0x18, 0x33, 0x45, 0x31, 0x36, + 0x33, 0x12, 0x42, 0x93, 0x99, 0xc9, 0xcc, 0xad, 0xcc, 0xac, 0xaa, 0xab, 0x9a, 0x18, 0x63, 0x33, + 0x12, 0x33, 0x32, 0x24, 0xa2, 0x8e, 0x32, 0x91, 0x09, 0x61, 0x93, 0xcb, 0x0a, 0x32, 0x91, 0x9c, + 0xb9, 0xcc, 0xba, 0xce, 0xaa, 0x09, 0x10, 0x34, 0x11, 0x43, 0x23, 0x42, 0x33, 0x32, 0x34, 0x11, + 0x22, 0x12, 0xbc, 0x91, 0xdf, 0xcc, 0x9a, 0x99, 0xda, 0xad, 0x11, 0x01, 0xea, 0x09, 0x11, 0x98, + 0x41, 0x44, 0x33, 0x01, 0x00, 0x72, 0x23, 0x01, 0x11, 0xb8, 0x9a, 0xbb, 0x49, 0xc3, 0xbf, 0x98, + 0xc9, 0x9d, 0x88, 0x98, 0x99, 0x89, 0x11, 0x22, 0xbc, 0xa8, 0xad, 0xc9, 0x69, 0x14, 0x22, 0x41, + 0x25, 0x21, 0x41, 0x25, 0x01, 0x00, 0x89, 0xdb, 0xcb, 0xcd, 0xab, 0x9a, 0xab, 0x18, 0x31, 0x24, + 0x11, 0x33, 0x46, 0x13, 0x80, 0x28, 0x44, 0x02, 0x89, 0xca, 0xbc, 0xac, 0x89, 0x89, 0x01, 0x02, + 0xec, 0x0a, 0x01, 0x11, 0x34, 0x81, 0x32, 0x92, 0xbe, 0x32, 0xba, 0x81, 0x9c, 0x39, 0x14, 0x11, + 0x77, 0x04, 0x20, 0x13, 0x08, 0x00, 0x98, 0x21, 0xfb, 0xaf, 0x89, 0x89, 0xb9, 0xcb, 0x89, 0xea, + 0x9b, 0x21, 0xb8, 0x28, 0x46, 0x03, 0x22, 0x44, 0x33, 0x91, 0x88, 0x90, 0x9a, 0x08, 0xc9, 0x8b, + 0xc9, 0x9d, 0x98, 0x38, 0x26, 0xa8, 0x1a, 0x02, 0xdc, 0xcc, 0xbd, 0x8a, 0x00, 0x90, 0x40, 0x23, + 0x12, 0x55, 0x24, 0x32, 0x12, 0x11, 0x22, 0x03, 0xce, 0xba, 0xaa, 0xdc, 0xac, 0x99, 0x98, 0x89, + 0x89, 0x21, 0x04, 0x31, 0x65, 0x24, 0x22, 0x21, 0x01, 0x90, 0x88, 0xaa, 0x08, 0xb8, 0x0c, 0x80, + 0xfd, 0xab, 0x89, 0x99, 0x99, 0xe8, 0x9e, 0x00, 0xba, 0x8b, 0x12, 0xa8, 0x0b, 0x03, 0x01, 0x77, + 0x06, 0x90, 0x20, 0x23, 0x11, 0x01, 0x81, 0x48, 0x53, 0x12, 0x88, 0x91, 0xcf, 0xbb, 0xb9, 0xbd, + 0xdb, 0xab, 0x89, 0x11, 0x33, 0x03, 0x1a, 0x56, 0x24, 0x28, 0x34, 0x82, 0x88, 0x02, 0xba, 0x9d, + 0x10, 0xb9, 0xae, 0x18, 0x80, 0x00, 0x88, 0x88, 0x61, 0xc1, 0x09, 0x18, 0xf8, 0x9d, 0x99, 0x30, + 0x11, 0x44, 0x32, 0x43, 0x33, 0x23, 0x33, 0x83, 0xcd, 0x09, 0xb9, 0xdb, 0xce, 0xbd, 0x9a, 0xac, + 0x8a, 0x09, 0x11, 0x44, 0x33, 0x24, 0x11, 0xa8, 0x08, 0x99, 0x55, 0x33, 0xc8, 0x8a, 0x21, 0x33, + 0x80, 0x98, 0x9b, 0x10, 0xb8, 0x9c, 0x90, 0xcd, 0x19, 0x82, 0xbf, 0xbc, 0xdc, 0x9d, 0x00, 0xa9, + 0x00, 0x00, 0x21, 0x23, 0x57, 0x23, 0x23, 0x24, 0x99, 0x30, 0x34, 0x43, 0x92, 0xbd, 0xba, 0xcd, + 0xab, 0x90, 0xeb, 0xab, 0x18, 0x98, 0x00, 0x50, 0x36, 0x33, 0x23, 0x10, 0x33, 0x24, 0x9a, 0xe9, + 0xcc, 0xab, 0xb8, 0xaa, 0x10, 0x82, 0xab, 0x08, 0x71, 0x17, 0x80, 0x19, 0x90, 0xac, 0xb9, 0xad, + 0x09, 0x22, 0x91, 0x8b, 0x66, 0x23, 0x22, 0x33, 0x23, 0x21, 0x45, 0x81, 0xb9, 0xcd, 0xb9, 0xbb, + 0xbd, 0xba, 0x9d, 0x08, 0x09, 0x88, 0x32, 0x23, 0x00, 0x82, 0x69, 0x37, 0x13, 0x08, 0x52, 0x12, + 0x00, 0x22, 0xfa, 0x9b, 0x12, 0x89, 0x62, 0x13, 0xa0, 0xac, 0xa0, 0xbc, 0x8a, 0xdb, 0x8c, 0x13, + 0xa9, 0xbd, 0x10, 0x88, 0x09, 0x44, 0x11, 0x54, 0x12, 0x33, 0x37, 0x12, 0x90, 0x99, 0xc8, 0xaf, + 0xb9, 0x99, 0xa9, 0xdc, 0x9c, 0x99, 0x99, 0x32, 0x23, 0x64, 0x34, 0x33, 0x23, 0x13, 0x81, 0xea, + 0x8b, 0xc9, 0xbb, 0xaa, 0x98, 0xab, 0x21, 0x51, 0x02, 0x40, 0x43, 0x35, 0xb0, 0xaa, 0x9a, 0xfc, + 0x9c, 0xa9, 0xdb, 0x8a, 0x12, 0x80, 0x61, 0x34, 0x12, 0x21, 0x44, 0x24, 0x81, 0x98, 0x08, 0x10, + 0xea, 0xab, 0x88, 0x8a, 0xfb, 0xab, 0x08, 0x00, 0x88, 0xbc, 0xbc, 0x19, 0x45, 0x43, 0x01, 0x00, + 0x22, 0x22, 0x32, 0x93, 0xfb, 0xbf, 0x08, 0x10, 0x00, 0x33, 0xb0, 0x18, 0xcb, 0xac, 0x30, 0xd8, + 0xcb, 0x29, 0x23, 0x80, 0xb8, 0xdf, 0x18, 0x22, 0x21, 0x10, 0x72, 0x15, 0x88, 0x00, 0x22, 0xa8, + 0x2a, 0x26, 0xa0, 0xcd, 0xdb, 0xab, 0xbc, 0xab, 0x19, 0x23, 0x28, 0x37, 0x63, 0x22, 0x01, 0x10, + 0x00, 0xa9, 0x9c, 0x00, 0x00, 0xb8, 0x1a, 0x09, 0x47, 0x13, 0x00, 0x18, 0xa1, 0x0a, 0xa0, 0xbe, + 0xbd, 0xce, 0x9a, 0x89, 0xb8, 0xbc, 0xad, 0x30, 0x25, 0x22, 0x22, 0x35, 0x13, 0x42, 0x33, 0x24, + 0xc8, 0xbd, 0x9a, 0x0a, 0x90, 0xda, 0x9c, 0xa9, 0xba, 0x19, 0x22, 0x33, 0x43, 0x13, 0x74, 0x23, + 0x01, 0xfb, 0x0a, 0x00, 0x99, 0x89, 0x90, 0x30, 0x08, 0x47, 0xa0, 0x8a, 0x21, 0xa9, 0xba, 0x68, + 0x93, 0x9d, 0x30, 0x92, 0xae, 0x18, 0x13, 0xa9, 0xcc, 0xcb, 0x2a, 0x25, 0x42, 0x46, 0x22, 0x22, + 0x13, 0x00, 0xb9, 0xad, 0x88, 0xdc, 0xbc, 0xaa, 0xca, 0x8a, 0x08, 0x22, 0x44, 0x33, 0x14, 0xb9, + 0x00, 0xaa, 0xbb, 0xab, 0x9b, 0x42, 0x74, 0x25, 0x89, 0x09, 0x10, 0x92, 0x1a, 0x45, 0x25, 0x00, + 0xa8, 0x08, 0xf9, 0xbb, 0xce, 0xab, 0x00, 0x90, 0x89, 0x30, 0x23, 0x21, 0x54, 0x34, 0x13, 0x22, + 0x13, 0x33, 0x92, 0x9a, 0x39, 0x95, 0xff, 0xab, 0xa9, 0xba, 0xaa, 0x40, 0x24, 0x00, 0x02, 0x42, + 0x24, 0xba, 0x49, 0x26, 0xa8, 0x09, 0x01, 0xb8, 0x8b, 0x21, 0x00, 0x98, 0x24, 0x98, 0xc9, 0x79, + 0x23, 0x12, 0xc8, 0xaa, 0xce, 0x09, 0xfa, 0xbb, 0xb9, 0xae, 0x10, 0x32, 0x22, 0x33, 0x24, 0x32, + 0x35, 0x34, 0x35, 0x13, 0x80, 0xb8, 0xaf, 0xb9, 0xbc, 0xbc, 0xaa, 0x8a, 0x21, 0x12, 0xc9, 0x40, + 0x33, 0xa2, 0xae, 0x00, 0x34, 0x12, 0x03, 0x20, 0x93, 0xda, 0xaf, 0x13, 0x99, 0x8a, 0x67, 0x12, + 0x02, 0x09, 0x81, 0xb8, 0xcd, 0xaa, 0xaa, 0x9b, 0x81, 0xcd, 0x28, 0x26, 0x11, 0x98, 0x08, 0x31, + 0x54, 0x23, 0x12, 0x22, 0x01, 0x13, 0xca, 0xce, 0xbc, 0x9b, 0xb9, 0x0b, 0x04, 0x09, 0x10, 0x22, + 0x25, 0xb0, 0x8a, 0x9b, 0x22, 0x82, 0xbf, 0xab, 0xbc, 0xc9, 0x2b, 0x12, 0x57, 0x00, 0x18, 0x34, + 0x34, 0x25, 0x80, 0xa0, 0x19, 0xca, 0xc0, 0xbe, 0xce, 0xaa, 0x88, 0x9a, 0x08, 0x23, 0x31, 0x64, + 0x15, 0x21, 0x23, 0x81, 0x08, 0x01, 0x08, 0xc0, 0xac, 0xaa, 0x80, 0x48, 0x92, 0xbe, 0xab, 0xaa, + 0xac, 0x10, 0x52, 0x83, 0x8c, 0x73, 0x82, 0xaa, 0x09, 0x21, 0x04, 0x80, 0xaa, 0x89, 0x45, 0x03, + 0x51, 0x35, 0x02, 0x99, 0x10, 0xf8, 0xad, 0x99, 0x98, 0xa9, 0xb9, 0x3a, 0x06, 0xbe, 0x9b, 0x98, + 0x8a, 0x64, 0x12, 0x21, 0x53, 0x33, 0x02, 0x09, 0x02, 0xed, 0xab, 0xaa, 0x19, 0x34, 0x90, 0xba, + 0xa9, 0xbe, 0x28, 0x23, 0x82, 0x0a, 0x11, 0x08, 0x45, 0xb0, 0x9f, 0x09, 0x08, 0x9a, 0x46, 0x32, + 0x34, 0x33, 0x53, 0x82, 0x09, 0x22, 0xba, 0xcd, 0xcc, 0xbc, 0xba, 0xaa, 0x98, 0xba, 0x18, 0x47, + 0x32, 0x14, 0x21, 0x11, 0x22, 0x90, 0xa9, 0x69, 0x15, 0x08, 0x98, 0xd9, 0x8c, 0x90, 0xda, 0xab, + 0xaa, 0xac, 0x21, 0x53, 0x01, 0x01, 0x31, 0x23, 0x90, 0xfa, 0x9d, 0x9a, 0x80, 0x88, 0x18, 0x33, + 0x83, 0x59, 0x67, 0x12, 0x11, 0x12, 0xca, 0x19, 0x80, 0xdb, 0xaa, 0xac, 0x98, 0xba, 0xdb, 0xab, + 0xa9, 0x9a, 0x1a, 0x57, 0x45, 0x22, 0x01, 0x10, 0x33, 0x02, 0xda, 0x9c, 0x10, 0xa0, 0x0a, 0x02, + 0xdb, 0xac, 0x8b, 0x99, 0x88, 0xa9, 0x0a, 0x72, 0x37, 0x00, 0x21, 0xb1, 0xdf, 0x9a, 0x18, 0x21, + 0x22, 0x88, 0x36, 0x12, 0x22, 0x25, 0xb8, 0xcc, 0x99, 0xca, 0x8c, 0x80, 0xa0, 0xac, 0x20, 0x22, + 0x90, 0xba, 0xcc, 0x9a, 0x50, 0x35, 0x13, 0x89, 0x32, 0x23, 0x01, 0x81, 0x68, 0x25, 0xcb, 0x8a, + 0x42, 0xd0, 0xbb, 0x9c, 0x10, 0x08, 0x11, 0x62, 0x83, 0x99, 0x8b, 0xc1, 0x9e, 0x08, 0xeb, 0xaa, + 0x32, 0x22, 0x81, 0x73, 0x27, 0x20, 0x32, 0x13, 0x10, 0xa1, 0xad, 0xca, 0xab, 0xcc, 0xcc, 0xab, + 0x08, 0x98, 0x8a, 0x11, 0x81, 0x71, 0x36, 0x32, 0x01, 0x10, 0x99, 0x30, 0x32, 0x92, 0xac, 0x09, + 0xba, 0xde, 0x8b, 0xa1, 0xcd, 0x89, 0x33, 0x91, 0x89, 0x11, 0xba, 0xbe, 0xed, 0x8a, 0x21, 0x04, + 0x89, 0x18, 0x34, 0x54, 0x23, 0x13, 0x88, 0x08, 0x30, 0xc2, 0x9b, 0x00, 0xfc, 0xbc, 0x98, 0xaa, + 0x89, 0x80, 0x89, 0xba, 0x52, 0x23, 0x99, 0x61, 0x27, 0x98, 0x31, 0x25, 0x02, 0x20, 0x33, 0x25, + 0xd9, 0x09, 0xda, 0xbc, 0xa9, 0x8a, 0x38, 0x81, 0x38, 0x36, 0x81, 0xda, 0x9d, 0xa9, 0x99, 0x28, + 0x81, 0x31, 0x15, 0x10, 0x62, 0x23, 0x01, 0x21, 0x21, 0x37, 0x02, 0x00, 0x02, 0xfb, 0xcd, 0xcc, + 0xaa, 0x99, 0x9a, 0x9a, 0x21, 0x01, 0x18, 0x35, 0x43, 0x63, 0x23, 0x42, 0x03, 0x20, 0xa1, 0x8a, + 0xb8, 0xce, 0x0a, 0x91, 0xac, 0x73, 0x83, 0x99, 0x10, 0x01, 0x80, 0xb8, 0xcf, 0xcb, 0x8a, 0x00, + 0x22, 0x43, 0x34, 0x21, 0x21, 0x83, 0xab, 0xeb, 0x89, 0x51, 0x03, 0x20, 0x46, 0x91, 0xcb, 0xab, + 0x99, 0x9a, 0xec, 0x9a, 0x80, 0x00, 0x90, 0x80, 0x8b, 0xa0, 0x1a, 0x55, 0x46, 0x23, 0x02, 0x31, + 0x23, 0xa8, 0x18, 0xc0, 0xec, 0xbc, 0x8b, 0x89, 0x00, 0x01, 0xd9, 0x9c, 0xba, 0xbe, 0x9b, 0x00, + 0x00, 0x63, 0x00, 0x43, 0x63, 0x12, 0x23, 0x90, 0x29, 0x47, 0x13, 0x20, 0x02, 0xfb, 0x0a, 0x00, + 0xb8, 0xbc, 0xca, 0xcd, 0x9a, 0x00, 0x18, 0x34, 0x22, 0x10, 0x43, 0x24, 0x11, 0x01, 0xa9, 0xda, + 0xaf, 0x18, 0x22, 0xa0, 0x8a, 0x09, 0x44, 0x36, 0x82, 0xcb, 0xbb, 0x99, 0x9a, 0xba, 0xbc, 0x19, + 0x12, 0x29, 0x25, 0x12, 0xdc, 0x19, 0x54, 0x14, 0xb0, 0x8a, 0x32, 0x25, 0xa8, 0x29, 0x02, 0xca, + 0xcb, 0x9b, 0x00, 0x10, 0xfb, 0xdf, 0x88, 0xa9, 0xab, 0x20, 0x81, 0x40, 0x13, 0x73, 0x45, 0x13, + 0x18, 0x01, 0x11, 0x80, 0x08, 0x21, 0x00, 0x91, 0xcf, 0x88, 0xea, 0xbc, 0xa9, 0xba, 0x18, 0x01, + 0xdb, 0x19, 0x53, 0x33, 0x12, 0x08, 0x21, 0x32, 0x24, 0xa0, 0x9b, 0x40, 0x57, 0x22, 0x43, 0x23, + 0xf9, 0xac, 0xbb, 0x9a, 0xbb, 0x1a, 0x32, 0x90, 0x88, 0x20, 0x55, 0x34, 0xa1, 0x89, 0xa9, 0x0b, + 0xb8, 0x0a, 0x45, 0x12, 0x41, 0x14, 0x88, 0x61, 0x14, 0xa9, 0xb9, 0xaa, 0xed, 0xbb, 0xbc, 0xba, + 0x8a, 0x09, 0x65, 0x32, 0x34, 0x12, 0xb9, 0x38, 0x24, 0x22, 0x32, 0x43, 0x13, 0xd9, 0x1a, 0x63, + 0xa1, 0xbd, 0xbb, 0xaa, 0x9a, 0xca, 0x9b, 0xfd, 0xbb, 0x19, 0x02, 0x20, 0x35, 0x21, 0x00, 0x32, + 0x33, 0x54, 0x13, 0xd8, 0x0b, 0x21, 0x41, 0x34, 0x82, 0x99, 0xbd, 0xac, 0xea, 0xbc, 0x29, 0x12, + 0x19, 0x43, 0x03, 0x9a, 0xa8, 0xb9, 0xbf, 0x30, 0xb1, 0xab, 0xad, 0x41, 0x37, 0x81, 0x10, 0x52, + 0x22, 0x12, 0xca, 0xbd, 0xdb, 0xbb, 0x19, 0x33, 0x03, 0x10, 0x41, 0x02, 0x01, 0xba, 0xdf, 0x29, + 0x23, 0x88, 0x10, 0x54, 0x33, 0x84, 0x08, 0x21, 0x81, 0x41, 0x82, 0xca, 0xbf, 0x99, 0xba, 0xdc, + 0xab, 0xa9, 0x98, 0x9a, 0x09, 0x99, 0xda, 0x70, 0x25, 0x11, 0x32, 0x24, 0x34, 0x80, 0x08, 0x90, + 0x8b, 0x60, 0x25, 0x82, 0xaa, 0x38, 0xd2, 0xbe, 0xac, 0xca, 0xab, 0xab, 0x31, 0x04, 0xaa, 0x21, + 0xb2, 0x79, 0x25, 0x80, 0x09, 0x28, 0x64, 0x22, 0x12, 0x80, 0xcb, 0xbb, 0xba, 0x9b, 0xa9, 0x89, + 0x72, 0x34, 0x23, 0xd8, 0xbb, 0xca, 0xcc, 0x9b, 0x89, 0x41, 0x43, 0x34, 0x43, 0x22, 0x31, 0x23, + 0x31, 0x01, 0xd9, 0xbb, 0xa8, 0xdd, 0xbc, 0xbc, 0x9b, 0x89, 0x99, 0x98, 0x9b, 0x88, 0x9b, 0x73, + 0x27, 0x08, 0x32, 0x33, 0x43, 0x45, 0x22, 0x98, 0x18, 0x13, 0x88, 0x52, 0x92, 0xce, 0xab, 0xb9, + 0xbd, 0xbc, 0xba, 0xaa, 0x9a, 0x00, 0x18, 0x64, 0x13, 0x21, 0x22, 0x44, 0x12, 0x91, 0x39, 0x35, + 0x90, 0x38, 0x14, 0x18, 0x15, 0xb9, 0x1a, 0xe8, 0xbd, 0x9a, 0x89, 0xc8, 0x9d, 0x90, 0xba, 0x0b, + 0x43, 0x21, 0x45, 0x22, 0x22, 0x44, 0x34, 0x22, 0x00, 0xb9, 0x0a, 0x99, 0xf9, 0xdf, 0x98, 0x99, + 0x00, 0x30, 0x24, 0x80, 0xaa, 0xcc, 0xbc, 0xba, 0x8a, 0x53, 0x43, 0x43, 0x23, 0x23, 0x34, 0x33, + 0x11, 0x01, 0xca, 0x8b, 0xa0, 0xae, 0xbb, 0xbe, 0x9c, 0x88, 0xa0, 0xbc, 0x89, 0xc9, 0xac, 0x10, + 0x20, 0xd0, 0x2a, 0x12, 0xcb, 0x70, 0x27, 0x12, 0x01, 0x10, 0x00, 0x09, 0x20, 0x24, 0xb9, 0x1a, + 0xc1, 0x8c, 0x81, 0xd9, 0xbe, 0xba, 0x9d, 0x08, 0x20, 0x34, 0x13, 0x08, 0x53, 0x92, 0xac, 0x18, + 0xa9, 0x9a, 0x71, 0x02, 0x28, 0x36, 0x03, 0xcb, 0x09, 0x88, 0x51, 0x24, 0xea, 0xbc, 0xb9, 0xaa, + 0xac, 0x19, 0x82, 0x89, 0x75, 0x23, 0x21, 0x02, 0x98, 0x18, 0x33, 0x32, 0x00, 0x22, 0x02, 0xbb, + 0xd8, 0xaf, 0x88, 0xb8, 0xdf, 0xcb, 0xcc, 0x9a, 0x99, 0xba, 0x9a, 0x52, 0x34, 0x45, 0x32, 0x13, + 0x88, 0x88, 0x88, 0x10, 0xa8, 0x38, 0x27, 0x91, 0x18, 0x91, 0xdc, 0xad, 0x09, 0x18, 0x01, 0x08, + 0x98, 0xdd, 0xbc, 0xaa, 0x88, 0x08, 0x10, 0x45, 0x23, 0x12, 0x44, 0x54, 0x12, 0x80, 0x98, 0xa8, + 0xbb, 0x18, 0xb9, 0x1b, 0xf8, 0xdf, 0x88, 0x89, 0x08, 0x80, 0x08, 0x53, 0x12, 0x00, 0x28, 0x12, + 0xb0, 0xad, 0x52, 0x53, 0x33, 0x01, 0x08, 0x91, 0xcd, 0x88, 0x88, 0x11, 0xfa, 0x9f, 0x88, 0x9a, + 0xca, 0x9a, 0x8b, 0x32, 0x34, 0x32, 0x34, 0x13, 0x11, 0x31, 0x24, 0x42, 0x13, 0xba, 0x5a, 0x57, + 0x81, 0x00, 0x98, 0x99, 0xb9, 0xca, 0xba, 0xdf, 0xab, 0x9a, 0x99, 0x10, 0x81, 0x39, 0x32, 0x35, + 0x44, 0x35, 0x23, 0x00, 0x21, 0x81, 0x18, 0x90, 0xdf, 0x19, 0xa8, 0x09, 0x01, 0xca, 0x09, 0xca, + 0x0a, 0x41, 0x92, 0xac, 0xfa, 0x8a, 0x89, 0x00, 0x54, 0x12, 0x63, 0x33, 0x32, 0x80, 0xbb, 0x0b, + 0x12, 0xa8, 0xdc, 0x9d, 0x08, 0xcc, 0xbb, 0xcd, 0xba, 0x8a, 0x00, 0x41, 0x14, 0x01, 0x53, 0x12, + 0x92, 0x0a, 0x63, 0x03, 0x21, 0x23, 0x22, 0x02, 0x18, 0x36, 0xe9, 0x9b, 0x22, 0xfa, 0xaa, 0xa8, + 0xab, 0xc9, 0xbb, 0x8b, 0xaa, 0x88, 0x41, 0x77, 0x03, 0x99, 0x09, 0x91, 0x30, 0x03, 0x00, 0x54, + 0x91, 0x71, 0x17, 0x88, 0x08, 0xa0, 0xbc, 0x88, 0xa8, 0xc9, 0xbd, 0x8a, 0x80, 0x28, 0x03, 0x20, + 0x53, 0x23, 0x73, 0x13, 0x00, 0x88, 0x00, 0x08, 0xd8, 0x8b, 0x12, 0xc0, 0xae, 0x98, 0x9d, 0x00, + 0x91, 0xdc, 0xbb, 0x8a, 0x10, 0x11, 0x90, 0x28, 0x46, 0x23, 0x22, 0x11, 0x46, 0x43, 0x34, 0x12, + 0x80, 0x08, 0x80, 0x43, 0xc8, 0xbc, 0xab, 0xcd, 0xab, 0x99, 0xca, 0xbc, 0x9b, 0x09, 0x22, 0x21, + 0xfa, 0x8d, 0x32, 0x10, 0x45, 0x22, 0x33, 0x33, 0xa1, 0x2b, 0x47, 0x80, 0x99, 0x11, 0xc9, 0xcc, + 0x9c, 0xa8, 0x8b, 0xa0, 0xcb, 0x20, 0x34, 0x43, 0x82, 0x9a, 0x00, 0x98, 0x09, 0x01, 0xcb, 0x88, + 0x30, 0x75, 0x15, 0x20, 0x45, 0x92, 0x9a, 0xb8, 0xdf, 0xcb, 0x09, 0x02, 0xa9, 0x08, 0x20, 0x53, + 0x02, 0x21, 0x23, 0x00, 0x10, 0x24, 0x51, 0x25, 0x90, 0x28, 0xc0, 0x8c, 0x20, 0x80, 0x88, 0xba, + 0x19, 0xb2, 0xff, 0xad, 0x99, 0xba, 0x99, 0x08, 0x90, 0x29, 0x34, 0x33, 0x55, 0x25, 0x01, 0x10, + 0x11, 0x40, 0x05, 0x08, 0x10, 0x90, 0x20, 0xa1, 0xff, 0x8a, 0x98, 0xa9, 0x20, 0x82, 0xa9, 0xbd, + 0x29, 0x12, 0x20, 0x82, 0xbe, 0x19, 0x34, 0x12, 0x20, 0xa8, 0x31, 0x72, 0x27, 0x01, 0xa8, 0x8a, + 0xfc, 0x9b, 0x88, 0x80, 0x38, 0x26, 0x01, 0x08, 0x90, 0xcb, 0x18, 0x91, 0x8d, 0x11, 0xc9, 0xac, + 0x39, 0x77, 0x22, 0x10, 0x12, 0x00, 0x12, 0x81, 0xfd, 0xac, 0x8a, 0x98, 0x89, 0x09, 0x01, 0x21, + 0xa0, 0x9a, 0x9a, 0x52, 0x42, 0xb3, 0xae, 0x31, 0x26, 0x20, 0x34, 0x11, 0x08, 0x21, 0x34, 0x01, + 0x99, 0x0a, 0xa3, 0xcf, 0xcd, 0x89, 0x9a, 0x98, 0x8d, 0x11, 0x01, 0x89, 0xa9, 0xbc, 0xcb, 0x0a, + 0x64, 0x12, 0x34, 0x33, 0x12, 0x31, 0x16, 0xb9, 0xaf, 0x0a, 0x01, 0xa9, 0x40, 0x82, 0xb9, 0x8a, + 0xa0, 0xdb, 0xbd, 0x98, 0x8a, 0x40, 0x37, 0x23, 0x01, 0x98, 0x19, 0x26, 0x22, 0x91, 0xa9, 0x68, + 0x93, 0xdf, 0xaa, 0x9b, 0x00, 0x10, 0x52, 0x12, 0x90, 0xa9, 0xcb, 0xcd, 0xab, 0x18, 0x31, 0x27, + 0x12, 0x01, 0x30, 0x54, 0x33, 0x31, 0x23, 0x82, 0xcb, 0x88, 0xca, 0xcf, 0xac, 0x19, 0x91, 0x09, + 0x88, 0x00, 0xeb, 0x9a, 0x89, 0x09, 0x02, 0x88, 0x30, 0x57, 0x01, 0x32, 0x02, 0x20, 0x22, 0x80, + 0x73, 0x23, 0xcb, 0x9b, 0x9a, 0x80, 0xfb, 0x9b, 0xdb, 0x9b, 0x18, 0x11, 0x02, 0x80, 0x71, 0x13, + 0x20, 0x84, 0xbc, 0x70, 0x24, 0x12, 0x11, 0xa9, 0xcb, 0xcc, 0x89, 0xa9, 0xa9, 0x29, 0x92, 0x38, + 0x93, 0xdd, 0xbd, 0x9d, 0x01, 0x51, 0x23, 0x02, 0x00, 0x31, 0x73, 0x35, 0x12, 0x21, 0x81, 0x9b, + 0xca, 0xdb, 0xbd, 0x8a, 0x98, 0xbd, 0x19, 0x32, 0x12, 0x43, 0xd8, 0x9a, 0xeb, 0xac, 0x0a, 0x11, + 0x44, 0x12, 0x32, 0x33, 0x14, 0xa8, 0x9b, 0x89, 0x98, 0x20, 0x37, 0xa1, 0xbd, 0x18, 0x41, 0x92, + 0xac, 0x08, 0x02, 0xdc, 0x09, 0x12, 0xc9, 0xba, 0xad, 0x40, 0x84, 0x08, 0x44, 0x21, 0x01, 0x98, + 0xbc, 0xec, 0xac, 0x9a, 0x38, 0x36, 0x01, 0x80, 0x11, 0x22, 0xc1, 0xad, 0x8a, 0x90, 0x09, 0x31, + 0x12, 0x23, 0x12, 0x72, 0x16, 0x32, 0x82, 0xde, 0x89, 0x00, 0x01, 0x99, 0x01, 0x89, 0x52, 0x24, + 0x02, 0xeb, 0xcb, 0xba, 0x9a, 0xa0, 0xad, 0x9a, 0x31, 0x24, 0x64, 0x13, 0xa0, 0xcb, 0x09, 0x11, + 0x21, 0x20, 0x34, 0x55, 0x35, 0x02, 0x08, 0x11, 0xc8, 0xae, 0x08, 0xb8, 0xbc, 0xcb, 0xbb, 0x9c, + 0x18, 0x81, 0x19, 0x14, 0x51, 0x44, 0x23, 0x08, 0x81, 0x98, 0xac, 0x33, 0xb9, 0xbb, 0x58, 0x24, + 0x81, 0x89, 0xfb, 0xab, 0xba, 0x49, 0x25, 0xb0, 0x9e, 0x00, 0x00, 0x88, 0x61, 0x13, 0x02, 0x41, + 0x16, 0x12, 0x90, 0x9c, 0x00, 0xd9, 0xad, 0x80, 0x88, 0x10, 0x22, 0xb0, 0xff, 0xaa, 0x09, 0x22, + 0x21, 0x00, 0x24, 0xb8, 0xaa, 0x40, 0x13, 0x45, 0x12, 0x10, 0x45, 0x01, 0x89, 0x30, 0x34, 0xc8, + 0x9b, 0xe9, 0xbe, 0x9b, 0xaa, 0xbb, 0xab, 0xaa, 0x71, 0x25, 0x00, 0x22, 0x33, 0x90, 0xaa, 0x18, + 0x32, 0xb2, 0xbf, 0x58, 0x12, 0x00, 0x42, 0xb1, 0xae, 0x89, 0x18, 0x22, 0xc8, 0x8c, 0x30, 0x25, + 0x90, 0xaa, 0x53, 0x82, 0xac, 0x18, 0x56, 0x23, 0x88, 0x80, 0xda, 0xbb, 0xba, 0x18, 0x12, 0xfc, + 0xab, 0x28, 0x81, 0x88, 0x11, 0x83, 0xa9, 0x38, 0x27, 0x90, 0x30, 0x90, 0x49, 0x14, 0x42, 0x55, + 0x04, 0x08, 0xb8, 0xae, 0x08, 0xc8, 0xac, 0x21, 0x33, 0x12, 0x32, 0x83, 0xfe, 0x9c, 0x10, 0xaa, + 0x89, 0x42, 0x32, 0x13, 0xa9, 0xb9, 0x9a, 0xad, 0x09, 0x20, 0xa3, 0x79, 0x14, 0x22, 0x44, 0x14, + 0xa8, 0x98, 0x88, 0xbc, 0x0a, 0x25, 0xea, 0x8b, 0x53, 0x12, 0x88, 0x80, 0x52, 0x03, 0xca, 0xaa, + 0x21, 0xb1, 0xcf, 0x19, 0x91, 0xeb, 0x9c, 0x08, 0x32, 0x82, 0x8a, 0x13, 0x32, 0x11, 0x42, 0x67, + 0x80, 0x9a, 0x99, 0x01, 0x08, 0xc9, 0x98, 0x9b, 0xe9, 0x1b, 0x24, 0x92, 0xbf, 0x08, 0x22, 0x44, + 0x53, 0x82, 0xba, 0x10, 0x00, 0x01, 0xaa, 0x18, 0xfb, 0xbf, 0x18, 0xa1, 0xbc, 0x8a, 0x32, 0x33, + 0x13, 0x38, 0x43, 0xb8, 0xff, 0x28, 0x11, 0x31, 0x37, 0x81, 0x00, 0x98, 0xaa, 0x18, 0x80, 0xbc, + 0x40, 0x02, 0x18, 0x12, 0xb8, 0xcf, 0xaa, 0xcb, 0xbc, 0x9b, 0x18, 0x32, 0x43, 0x37, 0x03, 0x10, + 0x01, 0x08, 0xb9, 0xbd, 0xcd, 0xaa, 0x00, 0x20, 0x43, 0x23, 0x51, 0x15, 0x80, 0xa9, 0xdc, 0xbb, + 0x9b, 0xb8, 0x9b, 0x42, 0x02, 0x31, 0x55, 0x22, 0x20, 0x43, 0x34, 0x34, 0xd8, 0xab, 0x99, 0xdc, + 0x0a, 0x82, 0xcb, 0xbb, 0x99, 0x28, 0x06, 0x88, 0x08, 0x24, 0x32, 0x37, 0x24, 0x80, 0x31, 0x81, + 0x18, 0x24, 0xb9, 0xaa, 0x9a, 0xda, 0x9a, 0x9a, 0xab, 0xcf, 0xac, 0x9a, 0x89, 0x31, 0x24, 0x22, + 0x92, 0x20, 0xc9, 0x60, 0x34, 0x12, 0x33, 0x03, 0xfb, 0x8d, 0x98, 0xdc, 0xaa, 0xbc, 0x8c, 0x80, + 0x38, 0x46, 0x24, 0x12, 0x02, 0x80, 0xe9, 0x9b, 0x89, 0x00, 0x09, 0xba, 0x18, 0x31, 0x22, 0x31, + 0x92, 0x64, 0xfa, 0x8d, 0x20, 0xa0, 0x8c, 0x20, 0x13, 0xaa, 0x8a, 0x73, 0x34, 0x91, 0x19, 0x22, + 0x80, 0x10, 0xc8, 0xcc, 0x89, 0x91, 0xed, 0x89, 0x21, 0x44, 0x33, 0x23, 0xc8, 0xbc, 0x38, 0x02, + 0xa9, 0xd9, 0x8c, 0x00, 0x08, 0x88, 0x10, 0x91, 0xfc, 0x29, 0x37, 0xa1, 0xaa, 0xba, 0x9a, 0xca, + 0x9c, 0x31, 0x24, 0x34, 0xb8, 0x2a, 0x92, 0xdf, 0x09, 0x10, 0x62, 0x24, 0x00, 0x89, 0x22, 0x83, + 0xcd, 0xab, 0x98, 0x9a, 0xab, 0x41, 0x33, 0xc8, 0x9b, 0x48, 0x33, 0xeb, 0x8a, 0xd9, 0xcd, 0x28, + 0x35, 0x23, 0x12, 0x01, 0x89, 0x41, 0x24, 0x98, 0xda, 0xbd, 0x8a, 0x98, 0x9a, 0x0a, 0x43, 0x23, + 0x42, 0x36, 0x14, 0x80, 0x90, 0x19, 0xb1, 0xad, 0x9a, 0x99, 0x32, 0xf0, 0x1a, 0x25, 0xa1, 0x9a, + 0x89, 0xaa, 0x08, 0x10, 0xfb, 0xbb, 0xce, 0x9b, 0x89, 0x11, 0x29, 0x25, 0x08, 0x74, 0x15, 0x99, + 0x08, 0x80, 0x98, 0x8a, 0xca, 0x8c, 0x31, 0x35, 0x83, 0xbc, 0x09, 0x23, 0xc0, 0xbd, 0x09, 0x92, + 0xae, 0x30, 0x02, 0xaa, 0x9a, 0x18, 0x35, 0x44, 0x02, 0x09, 0x82, 0x72, 0x57, 0x02, 0x99, 0xba, + 0xdb, 0x9a, 0x01, 0x00, 0x01, 0x20, 0x12, 0x82, 0x61, 0x13, 0x90, 0xcb, 0x9a, 0x51, 0x35, 0x11, + 0x80, 0xb9, 0x10, 0x18, 0x57, 0x03, 0xdc, 0xac, 0xab, 0x9a, 0x08, 0x98, 0x32, 0x12, 0x21, 0x31, + 0x54, 0x02, 0xbc, 0x61, 0x22, 0x90, 0x0b, 0xb9, 0x09, 0xec, 0x89, 0x00, 0xd9, 0xbb, 0x30, 0x15, + 0x22, 0x41, 0x26, 0x11, 0x92, 0xdd, 0xbb, 0xbb, 0xab, 0x42, 0x24, 0x12, 0x18, 0x13, 0x20, 0x91, + 0xbf, 0x59, 0x45, 0x03, 0x8a, 0x98, 0xaa, 0xcb, 0x9a, 0x99, 0x38, 0x47, 0x12, 0x28, 0x43, 0x02, + 0xba, 0xbc, 0xcb, 0xab, 0x53, 0x82, 0xca, 0x28, 0x43, 0x02, 0x40, 0x45, 0xa1, 0xac, 0xb9, 0xac, + 0xab, 0x89, 0x31, 0x32, 0x73, 0x81, 0x89, 0x10, 0x02, 0x32, 0x90, 0xfe, 0xcc, 0x9a, 0x80, 0x81, + 0x08, 0x20, 0x04, 0x88, 0x72, 0x16, 0xa0, 0x0a, 0x10, 0x00, 0x10, 0x98, 0xaa, 0xcf, 0x89, 0x99, + 0x28, 0x14, 0x98, 0x19, 0x22, 0x20, 0x46, 0x82, 0xba, 0x9a, 0xa9, 0x8b, 0x56, 0x82, 0xab, 0x54, + 0x02, 0x31, 0x35, 0x23, 0x91, 0xac, 0x89, 0xf9, 0x9b, 0x08, 0x82, 0xeb, 0xbb, 0x18, 0x32, 0x54, + 0x81, 0xca, 0x29, 0x23, 0xa8, 0x18, 0x08, 0x02, 0x80, 0xa0, 0x0f, 0x34, 0x32, 0xb9, 0xde, 0x8b, + 0x90, 0xae, 0x9b, 0x89, 0x88, 0x99, 0x00, 0xaf, 0x62, 0x81, 0x18, 0x36, 0x02, 0x80, 0x53, 0x91, + 0xaa, 0xb9, 0xbe, 0x8b, 0x21, 0x01, 0x54, 0x83, 0xaa, 0x00, 0xd9, 0xac, 0x80, 0x30, 0x14, 0xcd, + 0x0a, 0x02, 0x40, 0x14, 0x21, 0x53, 0x33, 0x35, 0x12, 0xb8, 0xdc, 0xcb, 0xbb, 0xab, 0x09, 0x21, + 0x32, 0x55, 0x01, 0x20, 0x24, 0xa1, 0xb9, 0xbb, 0xcb, 0xdf, 0x8a, 0x21, 0x81, 0x00, 0x43, 0x35, + 0x82, 0x90, 0xba, 0xbc, 0xbc, 0x0a, 0x42, 0x93, 0x9a, 0x12, 0xc9, 0x19, 0xa9, 0xba, 0xee, 0x1b, + 0x34, 0x81, 0x10, 0xa8, 0x3a, 0x57, 0xa8, 0x88, 0x99, 0xbb, 0x71, 0x25, 0x81, 0x98, 0x00, 0x32, + 0x02, 0xa0, 0xbf, 0x89, 0xca, 0x29, 0x02, 0xcb, 0x9a, 0xaa, 0x9b, 0x61, 0x55, 0x23, 0x32, 0x32, + 0x91, 0xaa, 0xdb, 0xbb, 0x9b, 0xab, 0xaa, 0x70, 0x26, 0x31, 0x23, 0xc8, 0xbd, 0xba, 0xda, 0x9e, + 0x89, 0x00, 0x00, 0x31, 0x24, 0x53, 0x44, 0x22, 0x80, 0x99, 0xba, 0xad, 0xa9, 0xbc, 0xaa, 0xaa, + 0x39, 0x25, 0x43, 0x21, 0x25, 0x22, 0xb1, 0xcf, 0xbb, 0xbd, 0x9a, 0x20, 0x44, 0x12, 0x20, 0x23, + 0x02, 0x08, 0xa0, 0x89, 0x29, 0x73, 0x37, 0x11, 0xb9, 0xdb, 0xab, 0x08, 0xc9, 0x9a, 0x18, 0x01, + 0x41, 0x33, 0x23, 0xa0, 0xaa, 0xb9, 0xac, 0x55, 0x33, 0xe9, 0x09, 0x33, 0x84, 0xaa, 0x58, 0x36, + 0xa0, 0x19, 0xc8, 0xcd, 0x9a, 0x89, 0x12, 0x22, 0xb0, 0xaf, 0x00, 0x20, 0x41, 0x43, 0x12, 0x11, + 0x91, 0x9a, 0x02, 0xda, 0xde, 0x9b, 0x21, 0x90, 0x2a, 0x36, 0x12, 0x91, 0x18, 0x83, 0xff, 0xab, + 0xcb, 0xbb, 0x29, 0x33, 0x31, 0x45, 0x34, 0x82, 0x98, 0x10, 0x43, 0xa0, 0x9c, 0x10, 0x12, 0x40, + 0x03, 0xb9, 0x4a, 0x15, 0xba, 0x19, 0x91, 0xed, 0xab, 0x98, 0xab, 0xbb, 0x0a, 0x52, 0x03, 0xca, + 0xbb, 0x2b, 0x77, 0x22, 0x23, 0x23, 0x12, 0x11, 0x92, 0xca, 0xdd, 0xbd, 0xbc, 0x1a, 0x43, 0x03, + 0xa9, 0x08, 0x10, 0x22, 0x25, 0xb9, 0xda, 0x8b, 0x73, 0x03, 0x80, 0x99, 0x09, 0x11, 0x33, 0xcb, + 0x8a, 0x01, 0xfd, 0xab, 0xbb, 0x80, 0xcb, 0x99, 0x11, 0x22, 0x22, 0x34, 0xb1, 0xef, 0xba, 0x42, + 0x32, 0x32, 0x23, 0x44, 0x01, 0x31, 0x35, 0x11, 0x90, 0x48, 0x44, 0x83, 0x99, 0xca, 0xce, 0xbb, + 0xbc, 0x9c, 0x00, 0x10, 0x01, 0xca, 0x38, 0x33, 0x44, 0x23, 0x62, 0x33, 0x81, 0x10, 0xa1, 0x0b, + 0xd1, 0xcf, 0x9a, 0x00, 0x21, 0x01, 0xba, 0x89, 0x89, 0x30, 0x25, 0xfb, 0x89, 0x21, 0x33, 0x08, + 0x12, 0xfc, 0x9b, 0x43, 0xb1, 0x0c, 0x52, 0x34, 0x34, 0xc8, 0xad, 0x88, 0xba, 0xbc, 0x99, 0x90, + 0x8a, 0x30, 0x36, 0x02, 0x31, 0x04, 0x98, 0xab, 0x41, 0x45, 0x12, 0x42, 0x83, 0x10, 0x31, 0x45, + 0xa2, 0xcd, 0x0a, 0xa0, 0xab, 0x88, 0xda, 0xa9, 0xbb, 0x1a, 0x24, 0x33, 0x73, 0xc1, 0xab, 0x19, + 0x11, 0xeb, 0xab, 0x30, 0xb8, 0x73, 0x27, 0x21, 0x22, 0x01, 0x28, 0x13, 0xcd, 0xab, 0x99, 0x11, + 0xdd, 0xac, 0x88, 0x00, 0x11, 0x01, 0x18, 0x44, 0x33, 0x82, 0xbc, 0x0c, 0x21, 0x52, 0x84, 0xaa, + 0xa9, 0xeb, 0xbb, 0x99, 0xaa, 0x30, 0x24, 0x02, 0x42, 0xb0, 0xa9, 0xdb, 0xab, 0x20, 0x09, 0x57, + 0x24, 0x82, 0xab, 0x20, 0x20, 0x67, 0x43, 0x12, 0x80, 0x99, 0xb9, 0xbe, 0x99, 0x00, 0xc8, 0x0a, + 0x24, 0x13, 0xd9, 0xbe, 0x8a, 0xba, 0xac, 0x00, 0x51, 0x13, 0x21, 0x37, 0x01, 0xaa, 0x89, 0x08, + 0x73, 0x12, 0x11, 0x11, 0x90, 0xb9, 0xbe, 0x89, 0xaa, 0x8b, 0x53, 0x10, 0xc8, 0x9b, 0x01, 0x99, + 0x99, 0xdd, 0xab, 0x21, 0xb0, 0xaa, 0x0b, 0xec, 0x59, 0x34, 0x32, 0x44, 0x24, 0x01, 0xa9, 0xbc, + 0xcb, 0xcb, 0xcb, 0xab, 0x20, 0x53, 0x12, 0x31, 0x24, 0x22, 0x82, 0x38, 0x36, 0x13, 0x98, 0x19, + 0x36, 0x90, 0xab, 0xdb, 0x9a, 0xc9, 0x8b, 0x81, 0xfa, 0xbb, 0xb0, 0xbe, 0x09, 0x01, 0xcb, 0x39, + 0x52, 0x13, 0x19, 0x13, 0xa9, 0xa0, 0x58, 0x37, 0x46, 0x12, 0x00, 0x08, 0x11, 0x11, 0x99, 0x73, + 0x91, 0xea, 0xcb, 0xbb, 0x9b, 0xac, 0x89, 0x9a, 0x28, 0x47, 0x83, 0x08, 0x11, 0xa8, 0xac, 0x31, + 0x02, 0x99, 0x41, 0x24, 0x23, 0x33, 0xfc, 0x9a, 0x99, 0xa9, 0x09, 0xa8, 0x51, 0x63, 0x25, 0x10, + 0x00, 0xa9, 0x0a, 0xa1, 0xbf, 0x99, 0xa0, 0xab, 0x54, 0x42, 0x25, 0x00, 0x30, 0x16, 0xa0, 0x89, + 0xfb, 0xba, 0xba, 0xbc, 0x89, 0x00, 0x10, 0x32, 0x37, 0x80, 0x21, 0x02, 0xda, 0x1a, 0x52, 0x34, + 0x14, 0x81, 0x10, 0x81, 0x9b, 0xda, 0xae, 0x19, 0x90, 0x18, 0x14, 0xba, 0xab, 0x02, 0xcc, 0x89, + 0x88, 0xba, 0x1b, 0x52, 0x05, 0xcc, 0x9a, 0x89, 0x62, 0x32, 0x23, 0xca, 0x0a, 0x13, 0x19, 0x77, + 0x12, 0x80, 0x88, 0x10, 0x00, 0xba, 0xdc, 0xbb, 0xca, 0xab, 0x00, 0x00, 0x42, 0x45, 0x14, 0x00, + 0xa9, 0x38, 0x37, 0x92, 0x08, 0x01, 0xa0, 0xbd, 0xab, 0xb9, 0xcf, 0x99, 0x09, 0x41, 0x12, 0x31, + 0x02, 0xba, 0xbd, 0x11, 0xa8, 0xcd, 0x18, 0x10, 0x23, 0x73, 0x24, 0x22, 0x12, 0x23, 0x20, 0x33, + 0xa1, 0xce, 0xbb, 0xcc, 0xcd, 0x9b, 0x98, 0x00, 0xb9, 0x8b, 0x90, 0xdb, 0x50, 0x24, 0x21, 0x12, + 0x90, 0x3a, 0x37, 0x88, 0x11, 0x82, 0x99, 0xa9, 0x50, 0x57, 0x12, 0x81, 0x88, 0x98, 0xda, 0xab, + 0x00, 0xba, 0x8b, 0xda, 0x9b, 0x30, 0x13, 0x10, 0xa1, 0x53, 0x45, 0x01, 0x20, 0x12, 0x99, 0xcb, + 0xaa, 0x0a, 0x32, 0x45, 0x23, 0xa9, 0xdd, 0xdb, 0xcb, 0xaa, 0xaa, 0x9a, 0x52, 0x24, 0x11, 0x31, + 0x33, 0x52, 0x34, 0x12, 0x54, 0x23, 0x90, 0x19, 0xda, 0xdb, 0xcc, 0xba, 0x9a, 0x09, 0x00, 0x10, + 0x11, 0x90, 0x19, 0xb1, 0x9c, 0x12, 0x44, 0x55, 0x23, 0xa0, 0x99, 0x09, 0x44, 0x12, 0x00, 0x42, + 0x01, 0x20, 0x43, 0x92, 0x9c, 0xb8, 0xcf, 0xbb, 0x9a, 0x09, 0x19, 0x11, 0x32, 0x91, 0x1b, 0x30, + 0x17, 0xbb, 0x41, 0x23, 0x13, 0x90, 0xbb, 0xb9, 0x99, 0xdb, 0xeb, 0x8a, 0x32, 0x34, 0x81, 0xcb, + 0xba, 0xbe, 0x8b, 0x53, 0x82, 0x90, 0x09, 0x63, 0x11, 0xa0, 0x30, 0x25, 0x90, 0x0a, 0x56, 0x13, + 0x80, 0x88, 0xeb, 0xbc, 0x8a, 0x21, 0xa8, 0xba, 0xca, 0xdb, 0xab, 0xa8, 0x9b, 0x33, 0x26, 0x42, + 0x44, 0x25, 0x22, 0x11, 0x90, 0x99, 0x09, 0x91, 0xca, 0xcd, 0x9a, 0x89, 0x99, 0x3a, 0x37, 0x21, + 0x20, 0x22, 0xb9, 0x0b, 0xfb, 0xbc, 0x9c, 0x88, 0x18, 0x43, 0x81, 0x31, 0x02, 0x00, 0x12, 0x33, + 0x14, 0x10, 0x21, 0x33, 0x03, 0xcf, 0xaa, 0xaa, 0xab, 0x0a, 0x12, 0x41, 0x35, 0x90, 0xaa, 0xa1, + 0xbb, 0x31, 0x51, 0x13, 0x89, 0x55, 0x13, 0x80, 0x19, 0x22, 0xe9, 0xab, 0x88, 0xa8, 0xdc, 0xab, + 0xb9, 0x09, 0xa0, 0xcb, 0x28, 0x73, 0x02, 0x01, 0x11, 0x24, 0x99, 0x40, 0x25, 0x01, 0x00, 0x20, + 0x91, 0x99, 0x9a, 0x09, 0x42, 0x92, 0x10, 0x43, 0xb0, 0xbe, 0xb9, 0xbd, 0xdb, 0xab, 0x11, 0x00, + 0x28, 0x55, 0x22, 0x11, 0x10, 0x32, 0x34, 0x02, 0xcb, 0x9b, 0xb9, 0xaf, 0x9a, 0xa9, 0xcb, 0x09, + 0x23, 0x33, 0x13, 0x21, 0x23, 0x21, 0x11, 0xb0, 0x9b, 0x39, 0x13, 0xab, 0x00, 0x00, 0x20, 0x33, + 0x33, 0x21, 0x01, 0x99, 0x19, 0x93, 0xbd, 0xcb, 0x99, 0xcb, 0x89, 0x41, 0x24, 0x81, 0xa8, 0x9a, + 0x9a, 0x09, 0x30, 0x53, 0x01, 0x30, 0x35, 0x14, 0x10, 0x33, 0xa1, 0xbb, 0xbb, 0x9a, 0xb9, 0xab, + 0xbb, 0x0a, 0xbb, 0xac, 0x10, 0xba, 0xbb, 0xbb, 0x32, 0x43, 0x33, 0x33, 0x12, 0x12, 0x99, 0x9a, + 0x10, 0xd9, 0xab, 0x20, 0x12, 0x31, 0x01, 0x01, 0xb9, 0x9a, 0x09, 0x21, 0xb0, 0xae, 0x10, 0x90, + 0xa9, 0x20, 0x53, 0x13, 0x00, 0x19, 0x35, 0x83, 0x99, 0x0b, 0x21, 0xb9, 0xbc, 0xba, 0xdb, 0x89, + 0x09, 0x21, 0x33, 0x43, 0x00, 0x31, 0x13, 0xb0, 0xab, 0xb9, 0x99, 0x10, 0x23, 0xa0, 0x99, 0x32, + 0x31, 0x53, 0x02, 0x98, 0x00, 0x90, 0x9b, 0x00, 0xb9, 0xac, 0x08, 0x31, 0x92, 0xb9, 0x10, 0xc9, + 0x9b, 0x23, 0xb0, 0x9b, 0x21, 0x11, 0x22, 0x11, 0x21, 0x33, 0x03, 0xa9, 0x19, 0x21, 0x90, 0x9a, + 0xa9, 0x19, 0x99, 0xab, 0x99, 0xbb, 0x1a, 0x12, 0x12, 0x12, 0x01, 0x99, 0x10, 0x12, 0x11, 0x11, + 0x11, 0x91, 0x09, 0x10, 0x00, 0x9a, 0x29, 0x23, 0x91, 0x99, 0xa9, 0xab, 0xa9, 0x9a, 0x10, 0x01, + 0x09, 0x99, 0x11, 0x13, 0x11, 0x11, 0x22, 0x21, 0x12, 0x11, 0x01, 0xb9, 0x9b, 0xa9, 0x9a, 0x10, + 0x11, 0x21, 0x91, 0x19, 0x90, 0xa9, 0x99, 0x99, 0x99, 0x90, 0x99, 0x09, 0x00, 0x99, 0x10, 0x31, + 0x12, 0x01, 0x21, 0x22, 0x11, 0x10, 0x90, 0xb9, 0xab, 0x99, 0x9a, 0x11, 0x12, 0x90, 0x09, 0x90, + 0x99, 0x0a, 0x01, 0x00, 0x11, 0x11, 0x12, 0x11, 0x09, 0x00, 0x90, 0x19, 0x11, 0x11, 0x91, 0x90, + 0x90, 0xa9, 0x99, 0x0a, 0x99, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x01, 0x00, 0x01, + 0x99, 0x99, 0x99, 0x10, 0x00, 0x10, 0x19, 0x10, 0x01, 0x00, 0x00, 0x00, 0x99, 0x90, 0x09, 0x09, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, +}; + diff --git a/build/tests/yuv2rgb/yuv2rgb.rsf.template b/build/tests/yuv2rgb/yuv2rgb.rsf.template new file mode 100644 index 00000000..a67b1fa4 --- /dev/null +++ b/build/tests/yuv2rgb/yuv2rgb.rsf.template @@ -0,0 +1,222 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-TS.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + #TitleName "YourAppName" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + #MakerCode "00" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + # + # Permit TmpJump: for TWL "ApplicationJump" function + # + #PermitLandingTmpJump $(TWL_IPL_MAKEROM_PERMIT_TMP_JUMP) + + ### + ### Setting for TWL + ### + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD + # MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD] + # don't have to edit + # + WramMapping $(MAKEROM_WRAM_MAPPING) + WramMappingDirect $(TWL_IPL_RED_ROOT)/build/components/jackal.TWL/wram_regs/wram_regs.rbin + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + # + # SCFG: scfg lock [TRUE/FALSE] + # + LockSCFG FALSE + + # + # HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE] + # + HwAESSlotB TRUE + + # + # NANDAccess: nand access control [TRUE/FALSE] + # + NANDAccess TRUE + + # + # SDCardAccess: sd card access control [TRUE/FALSE] + # + SDCardAccess TRUE + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType System + AppType User + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media GameCard + + # + # Data only title : [TRUE/FALSE] + # don't have to edit + DataOnly FALSE + + # + # Secure title : [TRUE/FALSE] + # don't have to edit + Secure TRUE + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # use "4NAJ" for hyena + GameCode HNAJ + GameCode NTRJ + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 0K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 0K + + # + # Enable SubBannerFile + #SubBannerFile FALSE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/build/tools/Makefile b/build/tools/Makefile new file mode 100644 index 00000000..f8004c4a --- /dev/null +++ b/build/tools/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlIPL - firmware +# File: Makefile +# +# Copyright 2007 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 $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = \ + attach_dummyromheader \ + rombreaker \ + + +#---------------------------------------------------------------------------- + +include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tools/attach_dummyromheader/Makefile b/build/tools/attach_dummyromheader/Makefile new file mode 100644 index 00000000..6fc9d510 --- /dev/null +++ b/build/tools/attach_dummyromheader/Makefile @@ -0,0 +1,55 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: TwlSDK - dummyromheader - +# File: Makefile +# +# Copyright 2007 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: +#--------------------------------------------------------------------------- + + +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- + +TARGET_FIRM = SYSTEMMENU + +include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs + +#---------------------------------------------------------------------------- + +TARGETS = attach_dummyromheader.exe + + +SOURCES = attach_dummyromheader.c + +OBJECTS = $(SOURCES:.c=.o) + + +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(SYSMENU_TOOLSDIR)/bin + + +include $(TWLSDK_ROOT)/build/buildtools/twl/modulerules.x86 + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(OBJECTS) + $(CC_X86) $+ -o $@ + + + +#===== End of Makefile ===== diff --git a/build/tools/attach_dummyromheader/attach_dummyromheader.c b/build/tools/attach_dummyromheader/attach_dummyromheader.c new file mode 100644 index 00000000..382b2b69 --- /dev/null +++ b/build/tools/attach_dummyromheader/attach_dummyromheader.c @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tools - attach_dummyromheader + File: attach_dummyromheader.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 "misc.h" +#include + +/* + attach_dummyromheader.exe -s -l -i nwm_firm.bin -c WFW0 -o m.srl + maketad m.srl -s +*/ + +static ROM_Header rom_header; + +#define FILE_READ_BUFFER_LENGTH 0x1000 + +/* maketadのソースから引用 */ +#define TAD_BOOT_IDX 0 +#define TITLE_NAME_OFFSET 0x0 +#define PUBLISHER_CODE 0x3 + +#define CHANNEL_SYSTEM_BIT 0x1 +#define CHANNEL_SHOW_BIT 0x2 +#define CHANNEL_CARD_BIT 0x4 +#define CHANNEL_DATA_ONLY_BIT 0x8 + + +int main(int argc, char *argv[]) +{ + char *binFile = NULL; + char *srlFile = NULL; + char *g_code = NULL; + FILE *bin_fp; + FILE *srl_fp; + int n; + int read_size; + BOOL isSystem = FALSE; + BOOL isLaunch = FALSE; + unsigned char file_read_buffer[FILE_READ_BUFFER_LENGTH]; + + while ((n = getopt(argc, argv, "hiocsl")) != -1) { + switch (n) { + case 'h': + printf("Usage:\n" + " %s -s -l -c -i inputfile -o outputfile\n" + " -s (Systemfile) \n" + " -l (Not Launch) \n" + " -c XXXX ( GameCode )\n" + " -i XXXX ( input file )\n" + " -o XXXX ( output file )\n\n", + argv[0]); + return 0; + + case 'i': + binFile = strdup( argv[optind] ); + printf("input file = %s\n", binFile); + break; + case 'o': + srlFile = strdup( argv[optind] ); + printf("srl file = %s\n", srlFile); + break; + + case 'c': + g_code = strdup( argv[optind] ); + printf("game code = %s\n", g_code); + if( 4 != strlen(g_code) ) { + fprintf(stderr,"Error: invalid game code %s\n",g_code); + return -1; + } + + break; + case 's': + isSystem = TRUE; + printf("system file\n"); + break; + case 'l': + isLaunch = TRUE; + printf("Not Launch file\n"); + break; + default: + break; + } + + } + + if( binFile && srlFile ) { + if( NULL == (bin_fp = fopen(binFile, "rb")) ) { + fprintf(stderr,"Error:binFile open error %s\n",binFile); + return -1; + } + if( NULL == (srl_fp = fopen(srlFile, "wb+")) ) { + fprintf(stderr,"Error:srlFile open error %s\n",srlFile); + return -1; + } + } + else { + fprintf(stderr,"Error:not specify binFile or srlFile\n"); + return -1; + } + + /* ROM Header情報生成 */ + memset((void *)&rom_header, 0 , sizeof(ROM_Header)); + + // strncpy((void *)&rom_header.s.title_name, "WLANFIRMWARE", TITLE_NAME_MAX); + strncpy((void *)&rom_header.s.title_name, g_code, TITLE_NAME_MAX); + + // strncpy((void *)&rom_header.s.game_code,"WFW0",GAME_CODE_MAX); // Game code + strncpy((void *)&rom_header.s.game_code, g_code ,GAME_CODE_MAX); // Game code + + rom_header.s.maker_code[0] = 0; // Maker code + rom_header.s.maker_code[1] = 3; // Maker code + rom_header.s.platform_code = 0x03; /* Platform code bit0: not support NTR, bit1: support TWL + ( NTR_only=0x00, NTR/TWL=0x03, TWL_only=0x02 ) */ + + // rom_header.s.rom_type; + // rom_header.s.rom_size; /* Rom size (2のrom_size乗 Mbit: ex. 128Mbitのときrom_size = 7) */ + + // rom_header.s.enable_signature:1; // enable ROM Header signature + // rom_header.s.enable_aes:1; // enable AES encryption + // rom_header.s.developer_encrypt_old:1; // 開発用セキュリティがかかっている場合に"1"。製品版では"0" + + // u32 arm7_scfg_ext; // SCFG-EXT + // u8 arm7_scfg_clk; // SCFG-CLK + + + // 0x1BF - TWL expansion flags + // u8 codec_mode:1; // 0:NTR mode, 1:TWL mode // undeveloped + // u8 otherParentalControls:1; // 1: Enable OtherParentalControls + // u8 subBannerFile:1; // 1: Enable SubBannerFile + rom_header.s.exFlags.codec_mode = 1; // 0:NTR mode, 1:TWL mode // undeveloped + rom_header.s.exFlags.availableSubBannerFile = 0; // 1: Enable SubBannerFile + + + // u8 titleID_Lo[ 4 ]; + // u32 titleID_Hi; + + rom_header.s.titleID_Lo[ 3 ] = *(g_code); + rom_header.s.titleID_Lo[ 2 ] = *(g_code+1); + rom_header.s.titleID_Lo[ 1 ] = *(g_code+2); + rom_header.s.titleID_Lo[ 0 ] = *(g_code+3); + + /* + ビットフィールド: + [0]: AppType ( 0: User, 1: System ) + [1]: Launch ( 0: Launch, 1: Not launch ) + [2]: Media ( 0: GameCard, 1: NAND ) + [3-15]: rsv. + [16-31]: PublisherCode( 2:Broadon, 3:Nintendo) + */ + + rom_header.s.titleID_Hi = ( 3 /* Nintendo */ << 16) | + CHANNEL_CARD_BIT | + CHANNEL_DATA_ONLY_BIT | + (isLaunch? 2:0) | + (isSystem? 1:0); + + printf("titleID = 0x%08X%08x\n", (unsigned int)rom_header.s.titleID_Hi, (unsigned int)*((u32 *)&(rom_header.s.titleID_Lo[0]))); + + // 0x02f0 - 0x0300 Parental Controls Rating Info + // u8 ParentalControlsRatingInfo[ 0x10 ]; + + rom_header.s.parental_control_rating_info[ 0x0 ] = 0; + rom_header.s.parental_control_rating_info[ 0x1 ] = 1; + rom_header.s.parental_control_rating_info[ 0x2 ] = 2; + rom_header.s.parental_control_rating_info[ 0x3 ] = 3; + rom_header.s.parental_control_rating_info[ 0x4 ] = 4; + rom_header.s.parental_control_rating_info[ 0x5 ] = 5; + rom_header.s.parental_control_rating_info[ 0x6 ] = 6; + rom_header.s.parental_control_rating_info[ 0x7 ] = 7; + rom_header.s.parental_control_rating_info[ 0x8 ] = 8; + rom_header.s.parental_control_rating_info[ 0x9 ] = 9; + rom_header.s.parental_control_rating_info[ 0xa ] = 0xa; + rom_header.s.parental_control_rating_info[ 0xb ] = 0xb; + rom_header.s.parental_control_rating_info[ 0xc ] = 0xc; + rom_header.s.parental_control_rating_info[ 0xd ] = 0xd; + rom_header.s.parental_control_rating_info[ 0xe ] = 0xe; + rom_header.s.parental_control_rating_info[ 0xf ] = 0xf; + + /* ROMバージョンの設定 */ + { + /* FWファイルの先頭1バイト(version)を取得 */ + unsigned char version = fgetc(bin_fp); + + rom_header.s.rom_version = version; + + if (fseek(bin_fp, 0, SEEK_SET)) { + fprintf(stderr,"Error:file seek error(bin file)\n"); + return -1; + } + } + + /* SRLファイルの書き出し */ + if(1 != fwrite((void *)&rom_header, sizeof(ROM_Header), 1, srl_fp) ) { + fprintf(stderr,"Error:file write error(ROM_Header)\n"); + return -1; + } + + + while( 1 ) { + read_size = fread((void *)file_read_buffer, 1, FILE_READ_BUFFER_LENGTH, bin_fp); + if( read_size ) { + if( 1 != fwrite((void *)&file_read_buffer, read_size, 1, srl_fp) ) { + fprintf(stderr,"Error:file write error(bin file)\n"); + return -1; + } + } + else { + break; + } + } + /* SRLファイルは最低16バイトの倍数にしておく */ +#define PADDING_TARGET 16 + { + long fraction = ftell(srl_fp) % PADDING_TARGET; + if( fraction ) { + long zero[4] = { 0, 0, 0, 0 }; + if( 1 != fwrite((void*)zero, PADDING_TARGET - fraction, 1, srl_fp) ) { + fprintf(stderr,"Error:file write error(padding)\n"); + return -1; + } + } + } + + fclose(bin_fp); + fclose(srl_fp); + + printf("success!\n"); + return 0; +} diff --git a/build/tools/attach_dummyromheader/misc.h b/build/tools/attach_dummyromheader/misc.h new file mode 100644 index 00000000..26a1cbc6 --- /dev/null +++ b/build/tools/attach_dummyromheader/misc.h @@ -0,0 +1,23 @@ +#ifndef MISC_H_ +#define MISC_H_ +#include + +typedef enum +{ + FALSE = 0, + TRUE = 1 +} +BOOL; + +typedef unsigned char u8; +typedef unsigned short int u16; +typedef unsigned long int u32; +typedef unsigned long long u64; + +typedef signed char s8; +typedef signed short int s16; +typedef signed long int s32; +typedef signed long long s64; + +#endif //MISC_H_ + diff --git a/build/tools/iconMaker/TwlIcon.rb b/build/tools/iconMaker/TwlIcon.rb new file mode 100755 index 00000000..b20a234b --- /dev/null +++ b/build/tools/iconMaker/TwlIcon.rb @@ -0,0 +1,211 @@ +require 'bmp.rb' + +# フォントテーブルを用いて、文字列から32*32のアイコンbmpを出力するスクリプト +# 入力は文字列か、それを格納したテキストファイルから行う +# BLACK//WHITE//0A01//test//tools とかそんな感じになるかなー + +class TwlIcon < BitMap + + # ファイルサイズ + SIZE_X = 32 + SIZE_Y = 32 + + # フォント幅の定義 + FONT_HEIGHT = 9 + + FONT_KIND = 3 + + FONTWIDTH = [ + # FONTWIDTH_LOWERCASE + # a b c d e f g h i j k l m n + [ 4, 4, 4, 4, 4, 3, 4, 4, 1, 3, 3, 3, 5, 4, + # o p q r s t u v w x y z + 4, 4, 4, 3, 4, 3, 4, 5, 5, 5, 5, 4 ], + + # FONTWIDTH_UPPERCASE + # a b c d e f g h i j k l m n + [ 5, 4, 5, 5, 4, 4, 5, 4, 3, 5, 4, 4, 5, 5, + # o p q r s t u v w x y z + 5, 4, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5 ], + + # FONTWIDTH_NUMERIC + # 0 1 2 3 4 5 6 7 8 9 + [ 5, 3, 4, 4, 5, 4, 5, 5, 5, 5 ] + ] + + + def initialize( fg = 0x0, bg = 0xf ) + super( SIZE_X, SIZE_Y ) + clear( 0xF ) + @str = [ "", "", "" ] + @fgColor = fg + @bgColor = bg + end + + def setColor( fgColor, bgColor ) + @fgColor = fgColor + @bgColor = bgColor + end + + def setFg( clr ) + @fgColor = clr + end + + def setBg( clr ) + @bgColor = clr + end + + def setFilename( name ) + @filename = name + end + + attr_accessor :filename + + def setString( line, str ) + @str[line] = str + end + + def write( filename ) + + retFlag = true + + for i in 0..2 + putStr( self, @@fontbmp, @str[i], 1, ( FONT_HEIGHT + 1 ) * i + 2 ) + retFlag = false if getWidthS(@str[i]) >= SIZE_X + end + + self.changeColor( @bgColor, @fgColor ) + super( filename ) + + return retFlag + end + + + # 初期化作業 + # 基本的に呼ばれないと死ぬ + # フォントデータのインデクスを作ったりする + def TwlIcon.init + @@fontbmp = BitMap.read( "./font.bmp" ) + + sFontinfo = Struct.new(:width, :index) + sFont = Struct.new(:lowercase, :uppercase, :numeric) + + @@fonts = sFont.new + for fontidx in 0...FONT_KIND + # フォント幅を元に、ファイル内でのインデクスデータを作っていく + indexlist = [0] + sum = 0 + + for charidx in 0...FONTWIDTH[fontidx].size do + sum += FONTWIDTH[fontidx][charidx] + 1 + indexlist.push sum + end + + obj = sFontinfo.new( FONTWIDTH[fontidx], indexlist ) + @@fonts[fontidx] = obj + end + + end + + # 受け取った文字列strのピクセル幅を計算する + def getWidthS( str ) + width = 0 + + str.each_byte do |c| + # 文字間に1ピクセルスペースが入る + width += 1 + getWidthC(c) + end + + # 最後の一文字のあとのスペースは不要 + width -= 1 + end + + # 受け取った文字のピクセル幅をテーブルから呼んで返す + def getWidthC(char) + + case char + when ?a..?z + return @@fonts.lowercase.width[ char - ?a ] + when ?A..?Z + # 今は小文字で統一 + return @@fonts.uppercase.width[ char - ?A ] + when ?0..?9 + return @@fonts.numeric.width[ char - ?0 ] + end + end + + + # 受け取った文字のフォントbmpにおけるX座標インデクスデータを返す + def getIndexX(char) + case char + when ?a..?z + return @@fonts.lowercase.index[ char - ?a ] + when ?A..?Z + return @@fonts.uppercase.index[ char - ?A ] + when ?0..?9 + return @@fonts.numeric.index[ char - ?0 ] + end + end + + # 受け取った文字のフォントbmpにおけるX座標インデクスデータを返す + def getIndexY(char) + case char + when ?a..?z + return 0 + when ?A..?Z + return (FONT_HEIGHT + 1) * 2 + when ?0..?9 + return FONT_HEIGHT + 1 + end + + end + + # フォントbmpから抽出した文字列を今のバッファに埋め込む + # image:埋め込み対象 fontimage:フォント画像 str:文字列 x,y:座標 + def putStr( image, fontimage, str, x, y ) + + #p "inserting #{str}" + str.each_byte do |c| + putChar( image, fontimage, c, x, y ) + x += 1 + getWidthC(c) + end + + end + + # フォントbmpの対象文字を今のバッファに埋め込む + def putChar( image, fontimage, char, x, y ) + + #p "index of '#{char.chr}' : #{getIndexX(char)} #{getIndexY(char)} , x:#{x} y:#{y}" + + charimg = fontimage.clip( getIndexX(char), getIndexY(char), getIndexX(char) + getWidthC(char)-1, getIndexY(char) + FONT_HEIGHT-1 ) + image.paste( charimg, x, y ) + + end + + # バッファの中の白い部分を背景色、黒い部分を文字色で塗りつぶす + # 4bitColorBMP仕様になったので未使用 + def changeColor( bgColor, fgColor ) + + (0...@buf_size).each do |idx| + head = @buf[idx] >> 4 + foot = @buf[idx] & 0x0f + + if head == 0xf then + head = bgColor + elsif head == 0x0 + head = fgColor + end + + if foot == 0xf then + foot = bgColor + elsif foot == 0x0 + foot = fgColor + end + + @buf[idx] = (head << 4) | foot + end + end +end + + +TwlIcon.init diff --git a/build/tools/iconMaker/about.txt b/build/tools/iconMaker/about.txt new file mode 100644 index 00000000..a36923e3 --- /dev/null +++ b/build/tools/iconMaker/about.txt @@ -0,0 +1,113 @@ +テキストからちょっとしたアイコン用bmpを作るだけの簡単なスクリプトです。 + +========================================================= + +1. はじめに + + +rubyが必要になるのでcygwinを使うなり、windows版を入れるなりしてください。 + +あとはターミナルから + +% ruby iconMaker.rb Itest/Idesu/Iyooo + +などと入力することでアイコン用のbmpが生成されます。 +与える引数の詳細については以下を参照してください。 + + +========================================================= + +2. 入力方式とか仕様とか + +アイコンは32*32ピクセルで構成され、フォントが縦幅9ピクセルなので +3行までテキストを入力することができます。 +各行のテキストや色指定は全て'/'区切りにされた引数で行い、 +一つの出力ファイルに対して一続きの文字列が対応しています。 +引数がスペースで区切られた場合は、その数だけ出力ファイルを指定しているとみなします。 + + +・'I' (input text) アイコンに描画するテキストの文字列 + + このコマンドは3回まで繰り返すことができ、 + 1回目は1行目のテキスト、2回目は2行目のテキスト、3回目は3行目のテキストを指定することになります。 + "Iaaaa/I/Ibbbb"という入力を与えた場合、2行目は空行と見なされます。 + +・'F' (foreground color) 文字列の色指定 +・'B' (background color) 背景の色指定 + + それぞれの色を指定します。 + 以下の表における整数のidx値か、nameを指定してください。 + 該当しない値が渡された場合、入力は無視されます。 + + idx r g b name + 0 0 0 0 black + 1 80 0 0 maroon + 2 0 80 0 green + 3 80 80 0 olive + 4 0 0 80 navy + 5 80 0 80 purple + 6 0 80 80 teal + 7 80 80 80 gray + 8 c0 c0 c0 lightgray + 9 ff 0 0 red + 10 0 ff 0 lime + 11 ff ff 0 yellow + 12 0 0 ff blue + 13 ff 0 ff fuchsia + 14 0 ff ff aqua + 15 ff ff ff white + + 利用形態を考えた結果、一度色指定を行ってからは、次に他の色指定が行われるまで + 次以降のファイルに対しても同じ色指定を適用し続けます。 + "Fpurple/Ithis/Iis/Ipurple Ithis/Iis/Idefault"という入力を与えると、 + 二つのファイルは両方とも紫色の文字で出力されます。 + + +・'O' (output file) 出力ファイル名の指定 + + そのまんまです。 + 指定しなかった場合はtest**.txtという形で出力されます。 + + +出力ファイル数が大きくなる場合は、テキストファイルから引数を与えることもできます。 + +## input.txt ############# +/O0NRA.bmp/INand/IInit/IRed +/O0NPA.bmp/INand/IInit/IProd +/O0NIA.bmp/INand/IInitilize +/O0HWA.bmp/I0HWA/IHWInfo/Iwriter +########################## + +みたいなファイルを用意して + +% ruby iconMaker.rb input.txt + +とすれば良いですが、ファイルによる入力かどうかは引数の末尾が"*.txt"かどうかで判別しています。 +"Ifile/Iis/Ia.txt" みたいな入力を与えるとファイルからの入力扱いをされてハマります。 + + +横幅については文字ごとにまちまちなので、そのつど確認してください。 +仮に横幅をオーバーしたとしても、エラーを吐かずにはみ出た部分は切り捨てられますが、 +将来的には文字幅が溢れている場合、warning的なものを出す予定です。 +→ 出るようになりました + + +========================================================= + +TODO + +・記号への対応 + +# 08/08/18 +・アルファベット大文字に対応 +・横幅がオーバーしていたときに警告を出力 + +# 08/08/13 +・引数指定のフォーマットを変更 +・色指定に対応 +・数字入力に対応 +・ファイルからの入力に対応 + +# 08/08/07 + +・初版 diff --git a/build/tools/iconMaker/bmp.rb b/build/tools/iconMaker/bmp.rb new file mode 100755 index 00000000..490a8763 --- /dev/null +++ b/build/tools/iconMaker/bmp.rb @@ -0,0 +1,196 @@ +# ruby用bmp操作ライブラリ +# パレットはwindows標準の固定16色に決め打ち +# 出力するときはTwlIconクラスのfgColorとbgColorで該当パレットを置換する + +class BitMap + PALETTE_SIZE = 16*4 + + def initialize(width, height, dpi = 96) + @width = width + @height = height + @line_size = (width + (8 - width % 8 ) % 8) / 2 + @buf_size = @line_size * height + @buf = [ 0x00 ] * @buf_size + @bit_count = 4 + @compression = 0 # 圧縮無し + @size_image = 0 + @x_pix_per_meter = 0 + @y_pix_per_meter = 0 + @clr_used = 16 + @cir_important = 0 + @palette_size = (2**@bit_count) * 4 + @palette = "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x80\x00\x00\x00\x80\x80\x00" + + "\x80\x00\x00\x00\x80\x00\x80\x00\x80\x80\x00\x00\x80\x80\x80\x00" + + "\xC0\xC0\xC0\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\xFF\x00" + + "\xFF\x00\x00\x00\xFF\x00\xFF\x00\xFF\xFF\x00\x00\xFF\xFF\xFF\x00" + + #puts "Initialize..." + #p "width :#{@width} line_size :#{@line_size}" + end + + def clear( clrIdx = 15 ) + @buf = [ (clrIdx << 4) + clrIdx ] * @height * @line_size + end + + attr_writer :buf + attr_reader :width, :height + + # BMPファイルを出力する + def write(filename) + file_size = 14 + 40 + @palette_size + @buf_size + palette_offset = 14 + 40 + data_offset = palette_offset + @palette_size + + open(filename, "wb") do |f| + f.print 'BM' + f.print [file_size, 0, data_offset].pack("l*") + f.print [40, @width, @height].pack("l*") + f.print [1, @bit_count].pack("S*") + f.print [@compression, @size_image, + @x_pix_per_meter, @y_pix_per_meter, + @clr_used, @cir_important].pack("l*") + f.print @palette + f.print @buf.pack("c*") + + end + end + + + # BMPファイルを読み込む + def BitMap.read(filename) + buf = nil + open(filename, "rb") do |f| + buf = f.read + end + + if buf[0] != ?B or buf[1] != ?M + raise('[Error] read: Invalid Header') + end + real_buf_size = buf.size + buf_size = (buf[2, 4].unpack("l*"))[0] + if buf_size > real_buf_size + raise('[Error] read: Invalid Buffer Size') + end + data_offset = (buf[10, 4].unpack("l*"))[0] + if data_offset != 54 + PALETTE_SIZE + raise('[Error] read: Invalid Data Offset') + end + + width = (buf[18, 4].unpack("l*"))[0] + height = (buf[22, 4].unpack("l*"))[0] + + bit_count = (buf[28, 2].unpack("s*"))[0] + if bit_count != 4 + raise('[Error] read: Unsupported Color Depth') + end + + compression = (buf[30, 4].unpack("l*"))[0] + if compression != 0 + raise('[Error] read: Compression Not Supported') + end + + pix_per_meter = (buf[38, 4].unpack("l*"))[0] + dpi = pix_per_meter / 39.375 + + image_buf = buf[54 + PALETTE_SIZE, buf_size].unpack("C*") + image = BitMap.new(width, height, dpi) + image.buf = image_buf + return image + end + + + # (x1, y1) - (x2, y2)の部分画像を取り出す + def clip(x1, y1, x2, y2) + return if x1 > x2 + return if y1 > y2 + return if x2 < 0 + return if y2 < 0 + return if x1 >= @width + return if y1 >= @height + x1 = 0 if x1 < 0 + y1 = 0 if y1 < 0 + x2 = @width - 1 if x2 >= @width + y2 = @height - 1 if y2 >= @height + + clip_width = x2 - x1 + 1 + clip_height = y2 - y1 + 1 + + clip_image = BitMap.new(clip_width, clip_height, self.get_dpi) + + for y in 0 .. (clip_height - 1) + for x in 0 .. (clip_width - 1) + color = self.pget(x1 + x, y1 + y) + clip_image.pset(x, y, color) + end + end + + return clip_image + end + + + # x, y, r, g, b は整数であることを期待している + def pset(x, y, clr) + return if x < 0 or @width <= x + return if y < 0 or @height <= y + clr = 0 if clr < 0 + clr = 15 if clr > 15 + + nowClr = @buf[(@height - 1 - y) * @line_size + x / 2] + + if x%2 == 0 then + nowClr = (nowClr & 0x0F) + (clr << 4) + else + nowClr = (nowClr & 0xF0) + clr + end + + @buf[(@height - 1 - y) * @line_size + x / 2] = nowClr + + end + + # x, yは整数であることを期待している + # 戻り値はパレットのインデクス整数値 + def pget(x, y) + x = 0 if x < 0 + x = @width - 1 if x >= @width + y = 0 if y < 0 + y = @height - 1 if y >= @height + + addr = (@height - 1 - y) * @line_size + x / 2 + + if x%2 == 0 then + retValue = @buf[addr] >> 4 + else + retValue = @buf[addr] & 0x0F + end + + return retValue + + end + + def get_dpi() + return (@x_pix_per_meter / 39.375).round + end + + def set_dpi(dpi) + @x_pix_per_meter = (39.375 * dpi).round + @y_pix_per_meter = @x_pix_per_meter + end + + # x0, y0 は、貼り付ける始点(左上)の座標 + def paste(image, x0 = 0, y0 = 0) + return if image == nil + + image.height.times do |from_y| + y = y0 + from_y + next if y < 0 or @height <= y + + image.width.times do |from_x| + x = x0 + from_x + next if x < 0 or @width <= x + color = image.pget(from_x, from_y) + self.pset(x, y, color) + end + end + + end +end diff --git a/build/tools/iconMaker/font.bmp b/build/tools/iconMaker/font.bmp new file mode 100644 index 00000000..efb3ef2f Binary files /dev/null and b/build/tools/iconMaker/font.bmp differ diff --git a/build/tools/iconMaker/iconMaker.rb b/build/tools/iconMaker/iconMaker.rb new file mode 100755 index 00000000..771f0ea2 --- /dev/null +++ b/build/tools/iconMaker/iconMaker.rb @@ -0,0 +1,108 @@ +require './TwlIcon.rb' + +$fgColor = 0x0 +$bgColor = 0xf + +COLOR_TABLE = { + "black" => 0, "maroon" => 1, "green" => 2, "olive" => 3, + "navy" => 4, "purple" => 5, "teal" => 6, "gray" => 7, + "lightgray" => 8, "red" => 9, "lime" => 10, "yellow" => 11, + "blue" => 12, "fuchsia" => 13, "aqua" => 14, "white" => 15 +} +def readArg( str ) + + lineNum = 0 + argList = str.split( "/" ) + return nil if argList.size == 0 + + newicon = TwlIcon.new + + while( arg = argList.shift ) do + next if arg.size == 0 + + head = arg[0] + data = arg[1..arg.size] + + if head == ?O then + newicon.filename = data + elsif head == ?I then + newicon.setString( lineNum, data ) + lineNum += 1 + elsif head == ?F + if data =~ /\d{1,2}?/ && (0..15).include?( data.to_i ) then + $fgColor = data.to_i + elsif COLOR_TABLE[data] + $fgColor = COLOR_TABLE[data] + end + elsif head == ?B + if data =~ /\d{1,2}?/ && (0..15).include?( data.to_i ) then + $bgColor = data.to_i + elsif COLOR_TABLE[data] + $bgColor = COLOR_TABLE[data] + end + end + end + + newicon.setColor( $fgColor, $bgColor ) + + return newicon +end + +=begin +# 各項目を//で区切られた引数を文字列リストに分割して +# TwlIconオブジェクトを生成する +def readArg( str ) + argList = str.split( "/" ) + p argList + + return nil unless argList.size == 3 || argList.size == 5 + + newicon = TwlIcon.new + + if argList.size == 5 then + # fgcolorとbgcolorを割り当てる + argList.delete 0..1 + end + + # こっから表示文字列 + for i in 0..2 do + newicon.setString( i, argList[i] ) + newicon.setColor(0x3, 0xc) + end + + return newicon +end +=end + +TwlIcon::init + + +iconlist = Array.new 0 +argList = [] + +ARGV.each do |str| + if str =~ /(.+\.txt)/ then + fileArgList = open(str).read.split(/\s/) + fileArgList.each do |fileArg| + newicon = readArg fileArg + if newicon then + iconlist.push newicon + argList.push fileArg + end + end + else + newicon = readArg str + if newicon then + iconlist.push newicon + argList.push str + end + end +end + +idx = 0 +iconlist.each do |icon| + filename = icon.filename ? icon.filename : "test#{idx}.bmp" + puts "*** warning ***\n width overflow: #{argList[idx]}" unless icon.write( filename ) + #p filename + idx += 1 +end diff --git a/build/tools/iconMaker/input_sumple.txt b/build/tools/iconMaker/input_sumple.txt new file mode 100644 index 00000000..51a79e7a --- /dev/null +++ b/build/tools/iconMaker/input_sumple.txt @@ -0,0 +1,76 @@ +/O0NRA.bmp/INand/IInit/IRed/Fwhite/Bblue +/O0NPA.bmp/INand/IInit/IProd +/O0NIA.bmp/INand/IInit/IStd +/O0HWA.bmp/I0HWA/IHWInfo/Iwriter +/O0IJA.bmp/I0IJA/IImport/IJump +/O0SUA.bmp/ISystem/IUpdate + +/O000A.bmp/I000A/IWl/ICheck/Fwhite/Bblue +/O0A0A.bmp/I0A0A/IWl/ICheck + +/O010A.bmp/I010A/ILogo/ILtdok/Fblack/Bgreen +/O0G0A.bmp/I0G0A/ILogo/IHYBok +/O0G2A.bmp/I0G2A/ILogo/ILTDok +/O011A.bmp/I011A/ILogo/ILtdng/Fblack/Bred +/O0G1A.bmp/I0G1A/ILogo/IHYBng +/O0G3A.bmp/I0G3A/ILogo/ILTDng + +/O012A.bmp/I012A/IFatal/IMaker/Fwhite/Bblue +/O013A.bmp/I013A/IErLog/ITest +/O0G4A.bmp/I0G4A/IFatal/IMaker +/O0G5A.bmp/I0G5A/IErLog/ITest + +/O020A.bmp/I020A/IDisp/IInfo/Fwhite/Bblue +/O021A.bmp/I021A/IDisp/IInfo +/O022A.bmp/I022A/IDisp/IInfo +/O023A.bmp/I023A/IDisp/IInfo +/O024A.bmp/I024A/IDisp/IInfo +/O025A.bmp/I025A/IDisp/IInfo + +/O0B0A.bmp/I0B0A/IDisp/IInfo/Fwhite/Bblue/ +/O0B1A.bmp/I0B1A/IDisp/IInfo +/O0B2A.bmp/I0B2A/IDisp/IInfo +/O0B3A.bmp/I0B3A/IDisp/IInfo +/O0B4A.bmp/I0B4A/IDisp/IInfo +/O0B5A.bmp/I0B5A/IDisp/IInfo +/O0B6A.bmp/I0B6A/IDisp/IInfo +/O0B7A.bmp/I0B7A/IDisp/IInfo +/O0B8A.bmp/I0B8A/IDisp/IInfo +/O0B9A.bmp/I0B9A/IDisp/IInfo +/O0BAA.bmp/I0BAA/IDisp/IInfo +/O0BBA.bmp/I0BBA/IDisp/IInfo + +/O0F5A.bmp/I0F5A/IFATFS/IPerm/Fblack/Bgreen +/O0F6A.bmp/I0F6A/IFATFS/IPerm +/O0F7A.bmp/I0F7A/IFATFS/IPerm +/O0F8A.bmp/I0F8A/IFATFS/IPerm +/O0F9A.bmp/I0F9A/IFATFS/IPerm +/O0FAA.bmp/I0FAA/IFATFS/IPerm +/O0FBA.bmp/I0FBA/IFATFS/IPerm +/O0FCA.bmp/I0FCA/IFATFS/IPerm +/O0FDA.bmp/I0FDA/IFATFS/IPerm +/O0FEA.bmp/I0FEA/IFATFS/IPerm + +/O0D1A.bmp/I0D1A/IDigest/ICheck/Fblack/Bgreen +/O0D2A.bmp/I0D2A/IDigest/ICheck +/O0D4A.bmp/I0D4A/IDigest/ICheck + +/O0C0A.bmp/I0C0A/Ikassen/Iswoff/Fblack/Bwhite +/O0C1A.bmp/I0C1A/Ikassen/Inorm +/O0C2A.bmp/I0C2A/Ikassen/Igame +/O0C3A.bmp/I0C3A/Ikassen/Iswoff +/O0C4A.bmp/I0C4A/Ikassen/Inorm +/O0C5A.bmp/I0C5A/Ikassen/Igame + + +/O0F0A.bmp/I0F0A/IFATFS/IPerm/Fblack/Bgreen +/O0F1A.bmp/I0F1A/IFATFS/IPerm +/O0F2A.bmp/I0F2A/IFATFS/IPerm +/O0F3A.bmp/I0F3A/IFATFS/IPerm +/O0F4A.bmp/I0F4A/IFATFS/IPerm + +/O0D0A.bmp/I0D0A/IDigest/ICheck/Fblack/Bgreen +/O0D3A.bmp/I0D3A/IDigest/ICheck + +/O0CAA.bmp/I0CAA/ICard/Imode/Fblack/Bgreen +/O0CBA.bmp/I0CBA/ICard/Imode diff --git a/build/tools/patchtmpjump/Makefile b/build/tools/patchtmpjump/Makefile new file mode 100644 index 00000000..04a268f7 --- /dev/null +++ b/build/tools/patchtmpjump/Makefile @@ -0,0 +1,46 @@ +#! make -f +#--------------------------------------------------------------------------- +# Project: TwlSDK - tools - patchtmpjump +# File: Makefile +# +# Copyright 2009 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$ +#--------------------------------------------------------------------------- + +TWLSDK_PLATFORM = NITRO +TARGET_PLATFORM = NITRO + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +TARGETS = patchtmpjump.exe + +SOURCES = patchtmpjump.c +OBJECTS = patchtmpjump.o + +#INSTALL_DIR = $(TWL_INSTALL_TOOLSDIR)/bin +#INSTALL_TARGETS = $(TARGETS) + +LDIRT_CLEAN = $(OBJECTS) $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86 + + +#---------------------------------------------------------------------------- +# build +#---------------------------------------------------------------------------- +do-build: $(TARGETS) + +$(TARGETS): $(OBJECTS) + $(CC_X86) $+ -o $@ + +patchtmpjump.o: patchtmpjump.c +# diff --git a/build/tools/patchtmpjump/patchtmpjump.c b/build/tools/patchtmpjump/patchtmpjump.c new file mode 100644 index 00000000..da7acf76 --- /dev/null +++ b/build/tools/patchtmpjump/patchtmpjump.c @@ -0,0 +1,405 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - patchtmpjump + File: patchtmpjump.c + + Copyright 2009 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 // free() +#include +#include // stat() + +//#define ENABLE_DEBUG +#ifdef ENABLE_DEBUG +#define DEBUG_PRINT fprintf +#else +#define DEBUG_PRINT(...) +#endif +#define errorf(...) do { fprintf(stderr, "Error: "); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); } while(0) + +#define warningf(...) do { fprintf(stderr, "Warning: "); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); } while(0) + +#define SDK_NITROCODE_LE 0x2106c0de +#define SDK_NITROCODE_BE 0xdec00621 + +#define SURFFIX_TMPJUMP ".ntrtmpjump.srl" +#define NOP_CODE 0xE1A00000 + +typedef unsigned char u8; +typedef unsigned short int u16; +typedef unsigned long int u32; +typedef signed char s8; +typedef signed short int s16; +typedef signed long int s32; + +typedef struct ROM_Header +{ + // 0x000- + u8 header[32]; // システム予約 + + // 0x020- + // ARM9 + u32 main_rom_offset; // 転送元 ROM オフセット + u32 main_entry_address; // 実行開始アドレス(未実装) + u32 main_ram_address; // 転送先 RAM アドレス + u32 main_size; // 転送サイズ + + // ARM7 + u32 sub_rom_offset; // 転送元 ROM オフセット + u32 sub_entry_address; // 実行開始アドレス(未実装) + u32 sub_ram_address; // 転送先 RAM アドレス + u32 sub_size; // 転送サイズ + +} +ROM_Header; + +u32 SearchSdkVersion( void *filebuffer ); +s32 PatchForPMSleep( void *buffer, u32 version ); +int WriteFile(const char *filename, char *buffer, int size); +int ReadFile(const char *filename, void *filebuffer); + +// SDKバージョン検出用マジックコード +static const u32 sdk_ver_magic_code[] = { + SDK_NITROCODE_BE, + SDK_NITROCODE_LE, +}; + +// SDKバージョンリスト +static const u32 sdk_ver_list[] = { + 0x02004ee8, + 0x030028a0, + 0x03017530, + 0x03027531, + 0x04007530, + 0x04017531, + 0x04027530, +}; +static const u32 sdk_ver_mask = 0xFFFF0000; + +// 対象コード +static const u32 target_idx_400 = 3; +static const u32 target_code_400[] = { + // if (PMi_TriggerBL & PM_TRIGGER_CARD) + 0xE3100008, // TST Rx, #0x8 + 0x0A000001, // BEQ xxxx + // OS_EnableIrqMask(OS_IE_CARD_IREQ) + 0xE3A00601, // MOV Rx, #0x100000 + 0xEBFFD650, // BL EnableIrqMask <- target + // if (PMi_TriggerBL & PM_TRIGGER_CARTRIDGE) + 0xE59F00C8, // LDR Rx, [PC, #xxx] + 0xE1D000B0, // LDRH Rx, [Rx] + 0xE3100010, // TST R0, #0x10 + 0x0A000001, // BEQ xxxx + // OS_EnableIrqMask(OS_IE_CARTRIDGE) + 0xE3A00A02, // MOV Rx, #0x2000 + 0xEBFFD64A, // BL EnableIrqMask + // OS_RestoreInterrupts(prepIntrMode) + 0xE1A00004, // MOV Rx, Rx + 0xEBFFE377, // BL OS_RestoreInterrupts + // OS_EnableIrq() + 0, +}; +static const u32 target_mask_400[] = { + // if (PMi_TriggerBL & PM_TRIGGER_CARD) + 0xFEF0FFFF, // TST Rx, #0x8 + 0xFF000000, // BEQ xxxx + // OS_EnableIrqMask(OS_IE_CARD_IREQ) + 0xFFFF0FFF, // MOV Rx, #0x100000 + 0xFF000000, // BL EnableIrqMask <- target + // if (PMi_TriggerBL & PM_TRIGGER_CARTRIDGE) + 0xFFFF0000, // LDR Rx, [PC, #xxx] + 0xFFF00000, // LDRH Rx, [Rx] + 0xFEF0FFFF, // TST Rx, #0x10 + 0xFF000000, // BEQ xxxx + // OS_EnableIrqMask(OS_IE_CARTRIDGE) + 0xFFFF0FFF, // MOV Rx, #0x2000 + 0xFF000000, // BL EnableIrqMask + // OS_RestoreInterrupts(prepIntrMode) + 0xFFFF0000, // MOV Rx, Rx + 0xFF000000, // BL OS_RestoreInterrupts + 0, +}; + +// 対象コードリスト +static const u32 * const target_code_list[] = { + target_code_400, // 0x02004ee8 + target_code_400, // 0x030028a0 + target_code_400, // 0x03017530 + target_code_400, // 0x03027531 + target_code_400, // 0x04007530 + target_code_400, // 0x04017531 + target_code_400, // 0x04027530 +}; + +static const u32 * const target_mask_list[] = { + target_mask_400, // 0x02004ee8 + target_mask_400, // 0x030028a0 + target_mask_400, // 0x03017530 + target_mask_400, // 0x03027531 + target_mask_400, // 0x04007530 + target_mask_400, // 0x04017531 + target_mask_400, // 0x04027530 +}; + +static const u32 * const target_idx_list[] = { + &target_idx_400, // 0x02004ee8 + &target_idx_400, // 0x030028a0 + &target_idx_400, // 0x03017530 + &target_idx_400, // 0x03027531 + &target_idx_400, // 0x04007530 + &target_idx_400, // 0x04017531 + &target_idx_400, // 0x04027530 +}; + + + + +/*---------------------------------------------------------------------------* + Name: main + + Description: patch NitroSDK ROM for tmp jump + + Arguments: file name of binary + + Returns: 0 if success + *---------------------------------------------------------------------------*/ +int main(int argc, char *argv[]) +{ + int i; + int fsize; + char *buffer; + char *fname; + char outputname[FILENAME_MAX]; + u32 version; + + if (argc > 1) + { + for (i = 1; i < argc; i++) + { + // Read entire file image + fname = argv[i]; + + fsize = ReadFile(fname, &buffer); + if (fsize < 0) + { + return 1; + } + + // Search SDK version + version = SearchSdkVersion(buffer); + DEBUG_PRINT(stdout, "SDK version %08X\n", (int)version); + + // Patch ARM7 component + if ( PatchForPMSleep(buffer, version) ) + { + return 1; + } + + // Output patched binaries + sprintf(outputname, "%s%s", fname, SURFFIX_TMPJUMP); + if (fsize != WriteFile(outputname, buffer, fsize)) + { + return 1; + } + + free(buffer); + } + } + else + { + fprintf(stderr, + "Usage: patchtmpjump [ROM IMAGE...]\n\n" + "Patch NITRO ROM for tmp jump\n"); + } + return 0; +} + +/*---------------------------------------------------------------------------* + * search SDK version + *---------------------------------------------------------------------------*/ +u32 SearchSdkVersion( void *buffer ) +{ + ROM_Header* h = buffer; + const u32 *magic = sdk_ver_magic_code; + + int offset = h->main_entry_address - h->main_ram_address; + int size = h->main_size - offset; + u32 *cur = (void*)((u8*)buffer + h->main_rom_offset + offset); + u32 *end = (void*)((u8*)cur + size); + + while( cur < end ) + { + if( cur[0] == magic[0] && cur[1] == magic[1] ) + { + return cur[-1]; + } + cur++; + } + return 0; +} + +/*---------------------------------------------------------------------------* + * patch PMi_DoSleep + *---------------------------------------------------------------------------*/ +s32 PatchForPMSleep( void *buffer, u32 version ) +{ + ROM_Header* h = buffer; + int size = h->sub_size; + u32 *cur = (void*)((u8*)buffer + h->sub_rom_offset); + u32 *end = (void*)((u8*)cur + size); + u32 count = 0; + int i; + + for ( i=0; i + +typedef enum +{ + FALSE = 0, + TRUE = 1 +} +BOOL; + +typedef unsigned char u8; +typedef unsigned short int u16; +typedef unsigned long int u32; +typedef unsigned long long u64; + +typedef signed char s8; +typedef signed short int s16; +typedef signed long int s32; +typedef signed long long s64; + +#endif //MISC_H_ + diff --git a/build/tools/rombreaker/rombreaker.c b/build/tools/rombreaker/rombreaker.c new file mode 100644 index 00000000..05ba3810 --- /dev/null +++ b/build/tools/rombreaker/rombreaker.c @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - tools - rombreaker + File: rombreaker.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: + *---------------------------------------------------------------------------*/ + +/* + コマンドライン引数で指定されたROMファイルを読み込む。 + 破壊オプションで指定された領域をできるだけ安全に破壊する。 +*/ + +#include +#include +#include +#include +#include +#include "misc.h" +#include + +/* + rombreaker.exe -i input.srl -o output.srl -b HEADER +*/ + +static ROM_Header_Short *rom_header_short; + +#define MATH_ROUNDUP(x, base) (((x) + ((base)-1)) & ~((base)-1)) + +// 1MBぐらいずつ +#define FILE_READ_BUFFER_LENGTH ( 1 * 1024 * 1024 ) + +int main(int argc, char *argv[]) +{ + char *inFile = NULL; + char *outFile = NULL; + char *breakOpt = NULL; + FILE *in_fp; + FILE *out_fp; + int n; + int read_size; + unsigned char file_read_buffer[FILE_READ_BUFFER_LENGTH]; + u32 breakoffset; + u32 fcounter; + + while ((n = getopt(argc, argv, "hiob")) != -1) { + switch (n) { + case 'h': + printf("Usage:\n" + " %s -b breakopt -i inputfile -o outputfile\n" + " -b HEADER/ARM9FLX/ARM9LTD/ARM7FLX/ARM7LTD ( BreakOption )\n" + " -i XXXX ( input srl file )\n" + " -o XXXX ( output srl file )\n\n", + argv[0]); + return 0; + + case 'i': + inFile = strdup( argv[optind] ); + printf("input srl file = %s\n", inFile); + break; + case 'o': + outFile = strdup( argv[optind] ); + printf("output srl file = %s\n", outFile); + break; + case 'b': + breakOpt = strdup( argv[optind] ); + printf("break opt = %s\n", breakOpt); + break; + default: + break; + } + } + + if( inFile && outFile ) { + // 面倒なのでinとoutが同じ場合は対応しない(要望があれば対応) + if( strncmp( inFile, outFile, 256 ) == 0 ) + { + fprintf(stderr,"Error:output is input.\n"); + return -1; + } + if( NULL == (in_fp = fopen(inFile, "rb")) ) { + fprintf(stderr,"Error:input srl file open error %s\n",inFile); + return -1; + } + if( NULL == (out_fp = fopen(outFile, "wb+")) ) { + fprintf(stderr,"Error:output srl file open error %s\n",outFile); + return -1; + } + } + else { + fprintf(stderr,"Error:not specify input or output\n"); + return -1; + } + +/* + FLXとLTDはできるだけコードに影響を与えないよう後ろから1バイト破壊。 + HEADERは署名範囲内で誰も使っていない予約領域を1バイト破壊。 +*/ + + /* ROM Header情報取得 */ + rom_header_short = (ROM_Header_Short *)file_read_buffer; + read_size = fread( (void *)rom_header_short, 1, sizeof(ROM_Header_Short), in_fp ); + if( read_size != sizeof(ROM_Header_Short) ) + { + fprintf(stderr,"Error:rom_header_short read error\n"); + return -1; + } + + if( strncmp( "HEADER", breakOpt, 7 ) == 0 ) + { + breakoffset = 0x180 - 1; + }else if( strncmp( "ARM9FLX", breakOpt, 8 ) == 0 ) + { + breakoffset = rom_header_short->main_rom_offset + rom_header_short->main_size - 1; + }else if( strncmp( "ARM9LTD", breakOpt, 8 ) == 0 ) + { + breakoffset = rom_header_short->main_ltd_rom_offset + rom_header_short->main_ltd_size - 1; + }else if( strncmp( "ARM7FLX", breakOpt, 8 ) == 0 ) + { + breakoffset = rom_header_short->sub_rom_offset + rom_header_short->sub_size - 1; + }else if( strncmp( "ARM7LTD", breakOpt, 8 ) == 0 ) + { + breakoffset = rom_header_short->sub_ltd_rom_offset + rom_header_short->sub_ltd_size - 1; + }else + { + // 破壊オプション指定ミス + fprintf(stderr,"Error: invalid break opt %s\n",breakOpt); + return -1; + } + + // inputのファイルポインタを先頭に戻す(面倒なので) + fseek( in_fp, 0, SEEK_SET ); + + // 壊す場所を書き換えながらコピー + while( 1 ) { + read_size = fread((void *)file_read_buffer, 1, FILE_READ_BUFFER_LENGTH, in_fp); + if( read_size ) { + fcounter += read_size; + // 書き換え + if( fcounter > breakoffset ) + { + file_read_buffer[ breakoffset - ( fcounter - read_size ) ] += 1; // 1足すだけで壊れる + } + if( read_size != fwrite((void *)&file_read_buffer, 1, read_size, out_fp) ) { + fprintf(stderr,"Error:file write error\n"); + return -1; + } + } + else { + break; + } + } + + fclose(in_fp); + fclose(out_fp); + + printf("success!\n"); + return 0; +} diff --git a/debugsoft/AppJumpChecker/ReadMe_AppJumpChecker.txt b/debugsoft/AppJumpChecker/ReadMe_AppJumpChecker.txt new file mode 100644 index 00000000..5577ca42 --- /dev/null +++ b/debugsoft/AppJumpChecker/ReadMe_AppJumpChecker.txt @@ -0,0 +1,57 @@ +AppJumpChecker + +アプリジャンプ機能(ノーマルジャンプ)をテストするためのアプリセットです。 +======================================================== + +<概要> =============================================== +このテストでは、TWL本体にインポートされている全ての NAND アプリ、 +挿入されているカードアプリにアプリジャンプ(ノーマルジャンプ)を試すことが +できるテストアプリです。 + + +<使い方> ============================================= + +TwlNMenu を使って、appJumpChecker.tad をインポートします。 + +appJumpChecker を起動すると、下画面にランチャーを含むインポート済みの +NANDアプリのリスト(現在、36個までしか表示されません)、および +挿入されているカードアプリのイニシャルコード(英数字4文字)とタイトルID下位32ビットが表示されます。 + +(多少全ての表示までに時間がかかります) + +イニシャルコードは、製品用ROMヘッダを組み込んだ ROM でないと NTRJ が表示されます。 +タイトルID下位32ビットについて、NTRアプリは今後 TwlSDK で特別に作らない限りは何も表示されません。 +TWL アプリではイニシャルコードが逆順になった文字列が表示されます。 + +それぞれのイニシャルコードの右隣には、そのアプリがアプリジャンプされることを +許可しているかどうかのフラグが表示されています。 +○がつけられているアプリを選択し、Aボタンを押すことでアプリジャンプすることが可能です。 + +<操作方法> ============================================= +基本的に上画面に書いてあるとおりです。 + +Aボタン:選択中のNANDアプリにアプリジャンプを試みる。 + 失敗時には、上画面にエラーメッセージが表示されます。 + +Bボタン:選択中のNANDアプリにアプリジャンプを試みる。 + Aボタンとは異なり、通常外からは使われない内部関数を用います。 + 失敗時には、上画面にエラーメッセージが表示されます。 + +Yボタン:カードアプリに対して、アプリジャンプを試みる。 + 失敗時には、上画面にエラーメッセージが表示されます。 + +十字キー:NANDアプリの選択 + +<注意事項> ============================================= +アプリ起動中の、ゲームカードの挿抜には対応していません。 +あらかじめゲームカードを挿した状態で、本アプリを起動してください。 + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + + +<更新履歴>============================================ +2008/09/01 Bボタンに内部関数を使ってのアプリジャンプ(ノーマルジャンプ)を行う機能を追加 +2008/08/25 データタイトルへの判定の誤りを修正 +2008/08/23 新規追加 diff --git a/debugsoft/AppJumpChecker/appJumpChecker.nand.srl b/debugsoft/AppJumpChecker/appJumpChecker.nand.srl new file mode 100644 index 00000000..e215f64e Binary files /dev/null and b/debugsoft/AppJumpChecker/appJumpChecker.nand.srl differ diff --git a/debugsoft/AppJumpChecker/appJumpChecker.tad b/debugsoft/AppJumpChecker/appJumpChecker.tad new file mode 100644 index 00000000..5d53d88f Binary files /dev/null and b/debugsoft/AppJumpChecker/appJumpChecker.tad differ diff --git a/debugsoft/ApplicationJumpTest/ReadMe_AppJump.txt b/debugsoft/ApplicationJumpTest/ReadMe_AppJump.txt new file mode 100644 index 00000000..7980ed21 --- /dev/null +++ b/debugsoft/ApplicationJumpTest/ReadMe_AppJump.txt @@ -0,0 +1,77 @@ +appjumpTest + +アプリジャンプ機能をテストするためのアプリセットです。 +======================================================== + +<概要> =============================================== +2種類のNAND アプリと 3種類のカードアプリで構成されます。 +各アプリ間で、アプリジャンプの機能を一通り試すことができます。 +アプリ間でのパラメータの受け渡し、ジャンプ元へのリターンも可能です。 + + +3種類のカードアプリについて + +| ファイル名 | イニシャルコード | 被ノーマルジャンプ | +| appjumpTestForCard.srl | 430A |  許可 | +| appjumpTestForCard_Fail.srl | 460A | 不許可 | +| appjumpTestForCard_AID.srl | 461A |  許可 | +----------------------------------------------------------------------------- + +<使い方> ============================================= +2種類のNAND アプリを TWL にインポートした状態で、カードアプリを起動してください。 + +操作方法は、下画面下部に一覧表示されます。 +ABXY ボタンがそれぞれに対応したターゲットへのアプリジャンプを実行します。 + +L/R ボタンで、アプリ間パラメータ(文字列データ)を次のジャンプ先へ渡すかどうかを +切り替えることができます(デフォルトは ON になっています)。 + +START ボタンを押すと、現在起動中のアプリ自身へのアプリジャンプを自動で繰り返すモードに入ります。 +中断するには、起動後上画面にメッセージが出ている間(約2秒間)に START ボタンを押してください。 + +(2008/08/30 追記) +異常系チェックのために、カードアプリを2種追加しました。 + +・ひとつめ(460A)について + 被ノーマルジャンプを許可していない TWL カードアプリです。 + NAND アプリからこのアプリにジャンプしようとすると、必ずエラーが返るはずです。 + +・ふたつめ(461A)について + 被ノーマルジャンプは許可していますが、最初のカードアプリとは TitleID が別物の TWL カードアプリです。 + 最初に、もう一方のノーマルジャンプを許可しているカードアプリ[430A]をスロットに挿入した状態で + テストを開始します。そこから NAND アプリにジャンプした後、カードを[461A] に差し替えます。 + そして、NAND アプリからカードアプリへノーマルジャンプを実行した際に、ジャンプできるかどうかをチェックします。 + + +<画面の見方> ========================================== +・上画面について + 起動中のアプリが 3種類の内どれかを色と文字で表します。 + (黄:CARD、紫:NAND-1、水色:NAND-2) + + APP JUMP -> 今までのアプリジャンプ実行回数です。 + DELIVERED PARAM -> アプリ間パラメータ渡しをONにしている場合、ジャンプ元へのリターンも含めて +  これまでのジャンプ元の履歴が 6つまで表示されます。 + エラー表示 -> アプリジャンプに失敗した場合、赤字でエラーが表示されます。 +  エラー表示が出た場合、それ以上アプリの実行はできませんので再起動してください。 + +・下画面について + DELIVER ARG: (ON or OFF) -> アプリ間パラメータ渡しを有効にするかどうかのフラグの状態です。 +  L/R ボタンで ON/OFF を切り替えることができます。 + AUTO JUMP TEST: (ON or OFF) -> 自分自身へのアプリジャンプを中断するまで繰り返すテストモードかどうかを示す値です。 + 操作方法一覧 -> 各ボタンの説明を表示しています。アプリによって、ボタンに割り当てられた +  ジャンプ先が異なりますので注意してください。 +  ただし、ジャンプ元へのリターンは Bボタン、自分自身へのジャンプは Xボタン固定です。 + +<その他注意事項> +初回起動時(アプリジャンプを一度も実行していない状態)に、ジャンプ元へのリターンを行うと、 +必ずエラーになります。 + + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + + +<更新履歴>============================================ +2008/08/30 カードアプリ2種追加について加筆修正 +2008/07/31 新規追加 diff --git a/debugsoft/ApplicationJumpTest/appendix_AppJump.txt b/debugsoft/ApplicationJumpTest/appendix_AppJump.txt new file mode 100644 index 00000000..3c082938 --- /dev/null +++ b/debugsoft/ApplicationJumpTest/appendix_AppJump.txt @@ -0,0 +1,27 @@ +appjumpTest + +資料 +======================================================== + +この手順でデバッグを行ってもらうと良いかもしれません。 + +(1) カードアプリから起動(NAND-1, NAND-2 はインポート済み) +(2) NAND-1 へのジャンプ(チェックシート No.1 に該当) +(3) NAND-2 へのジャンプ(同上) +(4) CARD へのジャンプ(同上) + +(5) NAND-1 or NAND-2 へジャンプ(チェックシート No.2 に該当) +(6) ジャンプ元リターン(チェックシート No.3 に該当) +(7) START ボタンで自動ジャンプを行わせ、しばらく放置(チェックシート No.4 に該当) + +(8) アプリジャンプ時に受け渡されるテキストデータが乱れたりしていないかをチェック + (チェックシート No.5 に該当) +(9) アプリジャンプ時に受け渡されるバイナリデータが壊れていたりしないかをチェック + (チェックシート No.6 に該当) + +(10) 適当にジャンプ先やジャンプ方法を組み合わせて、しばらくチェック。 + (チェックシート No.7 に該当) + + +<更新履歴>============================================ +2008/08/01 新規追加 diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForCard.srl b/debugsoft/ApplicationJumpTest/appjumpTestForCard.srl new file mode 100644 index 00000000..917e4c11 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForCard.srl differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForCard_AID.srl b/debugsoft/ApplicationJumpTest/appjumpTestForCard_AID.srl new file mode 100644 index 00000000..230f54e5 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForCard_AID.srl differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForCard_Fail.srl b/debugsoft/ApplicationJumpTest/appjumpTestForCard_Fail.srl new file mode 100644 index 00000000..78e4c4ce Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForCard_Fail.srl differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForNand1.nand.srl b/debugsoft/ApplicationJumpTest/appjumpTestForNand1.nand.srl new file mode 100644 index 00000000..78f13327 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForNand1.nand.srl differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForNand1.tad b/debugsoft/ApplicationJumpTest/appjumpTestForNand1.tad new file mode 100644 index 00000000..a951b0d5 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForNand1.tad differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForNand2.nand.srl b/debugsoft/ApplicationJumpTest/appjumpTestForNand2.nand.srl new file mode 100644 index 00000000..90082c02 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForNand2.nand.srl differ diff --git a/debugsoft/ApplicationJumpTest/appjumpTestForNand2.tad b/debugsoft/ApplicationJumpTest/appjumpTestForNand2.tad new file mode 100644 index 00000000..757a0f3c Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjumpTestForNand2.tad differ diff --git a/debugsoft/ApplicationJumpTest/appjump_check_list_080801.xls b/debugsoft/ApplicationJumpTest/appjump_check_list_080801.xls new file mode 100644 index 00000000..aa89475f Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjump_check_list_080801.xls differ diff --git a/debugsoft/ApplicationJumpTest/appjump_check_list_080823.xls b/debugsoft/ApplicationJumpTest/appjump_check_list_080823.xls new file mode 100644 index 00000000..33e5ec27 Binary files /dev/null and b/debugsoft/ApplicationJumpTest/appjump_check_list_080823.xls differ diff --git a/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.srl b/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.srl new file mode 100644 index 00000000..58814b4e Binary files /dev/null and b/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.srl differ diff --git a/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.tad b/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.tad new file mode 100644 index 00000000..c33c658d Binary files /dev/null and b/debugsoft/CardRomHeaderChecker/CardRomHeaderChecker.tad differ diff --git a/debugsoft/NCFGCrusher/NCFGCrusher.srl b/debugsoft/NCFGCrusher/NCFGCrusher.srl new file mode 100644 index 00000000..5e69ef22 Binary files /dev/null and b/debugsoft/NCFGCrusher/NCFGCrusher.srl differ diff --git a/debugsoft/NotLaunch/NotLaunch_SYSTEM_ALL.tad b/debugsoft/NotLaunch/NotLaunch_SYSTEM_ALL.tad new file mode 100644 index 00000000..0387ca1a Binary files /dev/null and b/debugsoft/NotLaunch/NotLaunch_SYSTEM_ALL.tad differ diff --git a/debugsoft/NotLaunch/NotLaunch_SYSTEM_America.tad b/debugsoft/NotLaunch/NotLaunch_SYSTEM_America.tad new file mode 100644 index 00000000..a7f1a261 Binary files /dev/null and b/debugsoft/NotLaunch/NotLaunch_SYSTEM_America.tad differ diff --git a/debugsoft/NotLaunch/NotLaunch_SYSTEM_Australia.tad b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Australia.tad new file mode 100644 index 00000000..b4102d0a Binary files /dev/null and b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Australia.tad differ diff --git a/debugsoft/NotLaunch/NotLaunch_SYSTEM_Europe.tad b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Europe.tad new file mode 100644 index 00000000..3e5f04ba Binary files /dev/null and b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Europe.tad differ diff --git a/debugsoft/NotLaunch/NotLaunch_SYSTEM_Japan.tad b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Japan.tad new file mode 100644 index 00000000..ef311b51 Binary files /dev/null and b/debugsoft/NotLaunch/NotLaunch_SYSTEM_Japan.tad differ diff --git a/debugsoft/NotLaunch/ReadMe_NotLaunch.BAK b/debugsoft/NotLaunch/ReadMe_NotLaunch.BAK new file mode 100644 index 00000000..86cfe840 --- /dev/null +++ b/debugsoft/NotLaunch/ReadMe_NotLaunch.BAK @@ -0,0 +1,19 @@ +NotLaunch + +ランチャー上に表示されないシステムNANDアプリです。 +=================================================================== + +各リージョン版を用意しています。 + +NotLaunch_SYSTEM_ALL.tad 457A +NotLaunch_SYSTEM_Japan.tad 457J +NotLaunch_SYSTEM_America.tad 457E +NotLaunch_SYSTEM_Europe.tad 457P +NotLaunch_SYSTEM_Austraila.tad 457U + + + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + diff --git a/debugsoft/NotLaunch/ReadMe_NotLaunch.txt b/debugsoft/NotLaunch/ReadMe_NotLaunch.txt new file mode 100644 index 00000000..9c2c12b7 --- /dev/null +++ b/debugsoft/NotLaunch/ReadMe_NotLaunch.txt @@ -0,0 +1,22 @@ +NotLaunch + +ランチャー上に表示されないシステムNANDアプリです。 +=================================================================== + +各リージョン版を用意しています。 + +NotLaunch_SYSTEM_ALL.tad 457A +NotLaunch_SYSTEM_Japan.tad 457J +NotLaunch_SYSTEM_America.tad 457E +NotLaunch_SYSTEM_Europe.tad 457P +NotLaunch_SYSTEM_Austraila.tad 457U + + + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + +======================================================== +2008/08/25 新規追加 + diff --git a/debugsoft/SaveDataTest/SaveDataTest_SEQURE.tad b/debugsoft/SaveDataTest/SaveDataTest_SEQURE.tad new file mode 100644 index 00000000..c5501f64 Binary files /dev/null and b/debugsoft/SaveDataTest/SaveDataTest_SEQURE.tad differ diff --git a/debugsoft/SaveDataTest/SaveDataTest_TARGET.tad b/debugsoft/SaveDataTest/SaveDataTest_TARGET.tad new file mode 100644 index 00000000..bbc6ef08 Binary files /dev/null and b/debugsoft/SaveDataTest/SaveDataTest_TARGET.tad differ diff --git a/debugsoft/SaveDataTest/SaveDataTest_USER.tad b/debugsoft/SaveDataTest/SaveDataTest_USER.tad new file mode 100644 index 00000000..b584a6ce Binary files /dev/null and b/debugsoft/SaveDataTest/SaveDataTest_USER.tad differ diff --git a/debugsoft/TMPJumpTest/ReadMe_TMPJump.txt b/debugsoft/TMPJumpTest/ReadMe_TMPJump.txt new file mode 100644 index 00000000..f20823bf --- /dev/null +++ b/debugsoft/TMPJumpTest/ReadMe_TMPJump.txt @@ -0,0 +1,56 @@ +tmpjumpTest + +アプリジャンプ機能(TMPジャンプ)をテストするためのアプリセットです。 +======================================================== + +<概要> =============================================== +このテストでは、以下の 7つのアプリを使用します。 + +--------------------------------------------------------- +address | GameCode | Media | +--------------------------------+-----------+-----------+ +data/TestApp.srl | 433A | GameCard | +data/TestApp_HYBRID.srl | 434A | GameCard | +data/TestApp_LIMITED.srl | 435A | GameCard | tmp 格納用 ROM +data/TestApp_NTR_fail.srl | 458A | GameCard | +data/TestApp_TWL_fail.srl | 459A | GameCard | +--------------------------------------------------------- +bin/.../tmpjumpTest.srl | 436A | GameCard | 起動用 ROM +bin/.../tmpjumpTest.nand.tad | 437A | NAND | +--------------------------------------------------------- + +上の 5つのアプリは、下 2つのアプリに埋め込まれています。 + +<使い方> ============================================= + +まず、「フラッシュカードに書き込んだ 436A」または「インポートした 437A」を起動します。 + +436A, 437A では、選択したアプリを NAND の /tmp 以下へコピーし、TMPジャンプを実行します。 +TMP ジャンプ先のアプリからは、NITRO モードでビルドされている 433A を除く全てのアプリは +ジャンプ元のアプリへ戻ってくることができます。 + + + +(08/08/28 追加)アプリ2点追加、機能追加2点 +TMP ジャンプ先となるアプリとして、458A、459A の 2つを追加しました。 +これら 2つのアプリは「TMP ジャンプ不許可」のアプリなので、TMP ジャンプを実行すると +「必ず失敗」する仕様になっています。 + +TMP ジャンプ先のアプリから、さらに TMP ジャンプが実行できるようにしました。 +仕様では、「必ず失敗」するようになっています。 + +起動用 ROM で、リターンジャンプが可能になりました。 +一度 TMP ジャンプで飛んだあと、リターンジャンプによって起動用 ROM に戻り、 +再度リターンジャンプを実行すると、戻り先が設定されていないために +「必ず失敗」するはずです。 + + +======================================================== +なにか問題がありましたら、環境制作部 西本まで。 +nishimoto_takashi@nintendo.co.jp + +<更新履歴>============================================ +2008/09/02 量産機用ロムを追加 +2008/08/28 仕様追加に伴う加筆修正 +2008/08/12 新規追加 + diff --git a/debugsoft/TMPJumpTest/tmpjumpTest.srl b/debugsoft/TMPJumpTest/tmpjumpTest.srl new file mode 100644 index 00000000..79207218 Binary files /dev/null and b/debugsoft/TMPJumpTest/tmpjumpTest.srl differ diff --git a/debugsoft/TMPJumpTest/tmpjumpTest.tad b/debugsoft/TMPJumpTest/tmpjumpTest.tad new file mode 100644 index 00000000..058c1da8 Binary files /dev/null and b/debugsoft/TMPJumpTest/tmpjumpTest.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_A.tad b/debugsoft/TitleList/NORMAL/TitleList_A.tad new file mode 100644 index 00000000..d509dc6f Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_A.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_B.tad b/debugsoft/TitleList/NORMAL/TitleList_B.tad new file mode 100644 index 00000000..5f88abad Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_B.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_C.tad b/debugsoft/TitleList/NORMAL/TitleList_C.tad new file mode 100644 index 00000000..fee830d8 Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_C.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_D.tad b/debugsoft/TitleList/NORMAL/TitleList_D.tad new file mode 100644 index 00000000..b36172f6 Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_D.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_E.tad b/debugsoft/TitleList/NORMAL/TitleList_E.tad new file mode 100644 index 00000000..efb0b2e4 Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_E.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_F.tad b/debugsoft/TitleList/NORMAL/TitleList_F.tad new file mode 100644 index 00000000..45e7b605 Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_F.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_G.tad b/debugsoft/TitleList/NORMAL/TitleList_G.tad new file mode 100644 index 00000000..f153bbcf Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_G.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_H.tad b/debugsoft/TitleList/NORMAL/TitleList_H.tad new file mode 100644 index 00000000..06cf49fd Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_H.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_I.tad b/debugsoft/TitleList/NORMAL/TitleList_I.tad new file mode 100644 index 00000000..67732ff5 Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_I.tad differ diff --git a/debugsoft/TitleList/NORMAL/TitleList_J.tad b/debugsoft/TitleList/NORMAL/TitleList_J.tad new file mode 100644 index 00000000..5587c15a Binary files /dev/null and b/debugsoft/TitleList/NORMAL/TitleList_J.tad differ diff --git a/debugsoft/TitleList/ROMset.xls b/debugsoft/TitleList/ROMset.xls new file mode 100644 index 00000000..de182daf Binary files /dev/null and b/debugsoft/TitleList/ROMset.xls differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_A.tad b/debugsoft/TitleList/SPECIAL/TitleList_A.tad new file mode 100644 index 00000000..58c652d3 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_A.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_B.tad b/debugsoft/TitleList/SPECIAL/TitleList_B.tad new file mode 100644 index 00000000..a9fdff9f Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_B.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_C.tad b/debugsoft/TitleList/SPECIAL/TitleList_C.tad new file mode 100644 index 00000000..7a139fea Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_C.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_D.tad b/debugsoft/TitleList/SPECIAL/TitleList_D.tad new file mode 100644 index 00000000..7b60f54f Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_D.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_E.tad b/debugsoft/TitleList/SPECIAL/TitleList_E.tad new file mode 100644 index 00000000..c528e5f4 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_E.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_F.tad b/debugsoft/TitleList/SPECIAL/TitleList_F.tad new file mode 100644 index 00000000..bffdd916 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_F.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_G.tad b/debugsoft/TitleList/SPECIAL/TitleList_G.tad new file mode 100644 index 00000000..216d737d Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_G.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_H.tad b/debugsoft/TitleList/SPECIAL/TitleList_H.tad new file mode 100644 index 00000000..d85fd8c4 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_H.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_I.tad b/debugsoft/TitleList/SPECIAL/TitleList_I.tad new file mode 100644 index 00000000..b5fc96d2 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_I.tad differ diff --git a/debugsoft/TitleList/SPECIAL/TitleList_J.tad b/debugsoft/TitleList/SPECIAL/TitleList_J.tad new file mode 100644 index 00000000..b5ac03f4 Binary files /dev/null and b/debugsoft/TitleList/SPECIAL/TitleList_J.tad differ diff --git a/debugsoft/TitleList/readme.txt b/debugsoft/TitleList/readme.txt new file mode 100644 index 00000000..805952a0 --- /dev/null +++ b/debugsoft/TitleList/readme.txt @@ -0,0 +1,63 @@ +TitleList + +【概要】 + メーカーコードやアプリ種別、セーブデータ領域の有無などが異なるアプリ間で + セーブデータアクセスが正常に行われるかどうかを確認するアプリセットです。 + + +【ファイル】 + + NORMAL ディレクトリ以下 … 外部向けAPIを用いて作られたロムです + SPECIALディレクトリ以下 … 内部向けAPIを用いて作られたロムです + ROMset.xls … ロムの内容とテストケース + readme.txt … このファイル + +【操作方法】 + @/debugsoft/TitleList/(NORMAL or SPECIAL) 以下のTitleList_A.tad〜TitleList_J.tadを全てインポートします +  (以下これらのtadをまとめて、ロムセットと表記します) + A各ロムを起動して、 +   Aボタン − ロムセットへの書き込みテストと +   Bボタン − 自身のセーブデータの読み込みテスト + + を行うことができます。 + + +【アプリの仕様】 + 書き込みテスト: +  Aボタンを押すと、自分自身を除くロムセットのセーブデータに対して書き込みを試行します。 +  下画面に各ロムに対しての試行結果が表示されます。結果の表示の示す意味は下記の通りです。 + + PUB PRV はそれぞれセーブデータ領域の有無を示します。 + +  ○…正常に書き込みが行われた +  ×…書き込めなかった +  −…セーブデータ領域が存在しない(PUBもPRVも存在しない)、または自分自身である + +  書き込むデータは、"Written by [X]" で、Xには自身のロム名(A〜J)が入ります。 + + 読み込みテスト: +  Bボタンを押すと、自身のセーブデータの内容を表示することができます。 +  これによって、書き込みテストで実際に他のアプリからデータが書き込まれたかどうかを確認することができます。 + Noneが表示される場合は、セーブデータ領域自体が存在しません + File not foundが表示される場合は、セーブデータ領域は存在しますが、ファイルが存在しません(どのアプリからも書き込まれていない) + + セーブデータクリア: +  ROM Aのみ、Xボタンを押すと、ロムセットのセーブデータを全てクリアし、セーブデータを書き込むファイルを作成します。 + + +【テストの流れ】 + 通常のAPIを使用するテストと、内部APIを使用するでロムセットが異なります。 + それぞれ、NORMAL, SPECIAL以下のロムセットです。 + + @ NORMAL又はSPECIALのロムセットを全てインポートする + A ロムAを起動して、Xボタンを押し、全ロムのセーブデータのクリア、ファイル作成を行う + B ロムAから順番に書き込みテストを実行して、ROMset.xlsのデータと比較する + B 再度ロムAから起動して、読み込みテストを行い、ROMset.xlsのデータと比較する + + ※SPECIALからNORMALを切り替える際に、TwlNmenu等で4KAA, 4KBAを消さないと、正しく検証できません。 +  (読み込みテストで、Aロム、Bロムに対してFile Not Foundが出なくなる) +   + +【ロムセットの内容とチェックリスト】 +  ROMset.xlsを参照してください。 + diff --git a/debugsoft/WiFiIcon/main.tad b/debugsoft/WiFiIcon/main.tad new file mode 100644 index 00000000..6dfe18df Binary files /dev/null and b/debugsoft/WiFiIcon/main.tad differ diff --git a/debugsoft/sd2photo/sd2photo.srl b/debugsoft/sd2photo/sd2photo.srl new file mode 100644 index 00000000..c67df62b Binary files /dev/null and b/debugsoft/sd2photo/sd2photo.srl differ diff --git a/docs/AboutApplicationJump.doc b/docs/AboutApplicationJump.doc new file mode 100644 index 00000000..4ef9565c Binary files /dev/null and b/docs/AboutApplicationJump.doc differ diff --git a/docs/DS繝上ャ繧キ繝・繝繝シ繝悶Ν.vsd b/docs/DS繝上ャ繧キ繝・繝繝シ繝悶Ν.vsd new file mode 100644 index 00000000..4a2b7b1a Binary files /dev/null and b/docs/DS繝上ャ繧キ繝・繝繝シ繝悶Ν.vsd differ diff --git a/docs/IS繝繝舌ャ繧ャ/IS繝繝舌ャ繧ャ繧ソ繧ケ繧ッ.vsd b/docs/IS繝繝舌ャ繧ャ/IS繝繝舌ャ繧ャ繧ソ繧ケ繧ッ.vsd new file mode 100644 index 00000000..71e8aea1 Binary files /dev/null and b/docs/IS繝繝舌ャ繧ャ/IS繝繝舌ャ繧ャ繧ソ繧ケ繧ッ.vsd differ diff --git a/docs/IS繝繝舌ャ繧ャ/TWL_staticModule.xls b/docs/IS繝繝舌ャ繧ャ/TWL_staticModule.xls new file mode 100644 index 00000000..e91c4a20 Binary files /dev/null and b/docs/IS繝繝舌ャ繧ャ/TWL_staticModule.xls differ diff --git a/docs/IS繝繝舌ャ繧ャ/TWL繝繝舌ャ繧ャROM繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ隕∵アゆサ墓ァ.doc b/docs/IS繝繝舌ャ繧ャ/TWL繝繝舌ャ繧ャROM繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ隕∵アゆサ墓ァ.doc new file mode 100644 index 00000000..443c6a8e Binary files /dev/null and b/docs/IS繝繝舌ャ繧ャ/TWL繝繝舌ャ繧ャROM繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ隕∵アゆサ墓ァ.doc differ diff --git a/docs/IS繝繝舌ャ繧ャ/twl-i2c-regs_nin_20080315.pdf b/docs/IS繝繝舌ャ繧ャ/twl-i2c-regs_nin_20080315.pdf new file mode 100644 index 00000000..3287ac75 Binary files /dev/null and b/docs/IS繝繝舌ャ繧ャ/twl-i2c-regs_nin_20080315.pdf differ diff --git a/docs/IS繝繝舌ャ繧ャ/繧「繝励Μ繧ク繝」繝ウ繝優EBUG.txt b/docs/IS繝繝舌ャ繧ャ/繧「繝励Μ繧ク繝」繝ウ繝優EBUG.txt new file mode 100644 index 00000000..49bb1b74 --- /dev/null +++ b/docs/IS繝繝舌ャ繧ャ/繧「繝励Μ繧ク繝」繝ウ繝優EBUG.txt @@ -0,0 +1,8 @@ +TODO: + +・アプリジャンプ先でデバッガを有効にするかどうかのフラグをROMヘッダに追加 + +・外部に提供する開発版のアプリをビルドする際、上記フラグなどセキュリティに関するフラグをすべてチェックするチェッカを通す + - 外部提供版はMaketadで鍵を変更するパスを必ず通るので、そこにセットするのが良い? + +# デバッグとは関係ないが……製品版はマスタリングツールで同様のチェックを行う? diff --git a/docs/NAND繧「繧ッ繧サ繧ケ讓ゥ.mmap b/docs/NAND繧「繧ッ繧サ繧ケ讓ゥ.mmap new file mode 100644 index 00000000..680cce6c Binary files /dev/null and b/docs/NAND繧「繧ッ繧サ繧ケ讓ゥ.mmap differ diff --git a/docs/NAND繧キ繧ケ繝繝鬆伜沺.ppt b/docs/NAND繧キ繧ケ繝繝鬆伜沺.ppt new file mode 100644 index 00000000..75eaa917 Binary files /dev/null and b/docs/NAND繧キ繧ケ繝繝鬆伜沺.ppt differ diff --git a/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ蛹コ蛻縺ィ驕狗畑.vsd b/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ蛹コ蛻縺ィ驕狗畑.vsd new file mode 100644 index 00000000..4303a0fc Binary files /dev/null and b/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ蛹コ蛻縺ィ驕狗畑.vsd differ diff --git a/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ險育ョ玲婿豕.ppt b/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ險育ョ玲婿豕.ppt new file mode 100644 index 00000000..0352aea4 Binary files /dev/null and b/docs/NAND繧キ繧ケ繝繝鬆伜沺縺ィ繝ヲ繝シ繧カ鬆伜沺縺ョ險育ョ玲婿豕.ppt differ diff --git a/docs/NAND鬆伜沺讎らョ.txt b/docs/NAND鬆伜沺讎らョ.txt new file mode 100644 index 00000000..8bc61148 --- /dev/null +++ b/docs/NAND鬆伜沺讎らョ.txt @@ -0,0 +1,59 @@ +システム領域概算 + +NANDファーム領域 4096KB (= 4MB) +ユーザー領域 131072KB (=128MB) +システム領域 76800KB (= 75MB) +写真データ 32768KB (= 32MB) +NAND HW 予約領域 17408KB (= 17MB) +--------------------------- +計 262144KB (= 256MB) + + +システム領域デフォルト使用サイズ +--------------------------- + FAT管理情報 1024KB + システム情報 + HWID署名  16KB + 証明書リスト   16KB + デバイス秘密鍵 16KB + デバイス証明書 16KB +  ショップアカウント 16KB + セキュアHW情報  16KB + ノーマルHW情報  16KB + 共有フォント  1312KB (265KB+394KB+653KB) + 本体設定データ  32KB (16KB * 2) + eTicketデータ + eTicket 96KB (16KB * 6) + TMD 96KB (16KB * 6) + Titleデータ + ランチャー  3584KB + save 16KB + 本体設定   5120KB + save 0KB + ピクトチャット  512KB + save 0KB + DS downloadPlay 512KB + save 0KB + 写真帳 8192KB + save 512KB + NintendoSpot 1024KB + save ?KB +--------------------------- +計 22144KB (21.7MB) + +import / tmp確保必要サイズ +--------------------------- + content 32768KB + private.sav 4096KB + public.sav 4096KB + banner.dat 16KB + eTicket 16KB + TMD 16KB + directory entry 80KB (16KB * 5) +--------------------------- +計 41088KB (=40.2MB) + + +システム領域空きサイズ + + 76800KB - 22144KB - 41088KB = 13568KB (=13.25MB) diff --git a/docs/NandInitializer縺ョ蛻鬘槭↓縺、縺縺ヲ.txt b/docs/NandInitializer縺ョ蛻鬘槭↓縺、縺縺ヲ.txt new file mode 100644 index 00000000..65ea89d7 --- /dev/null +++ b/docs/NandInitializer縺ョ蛻鬘槭↓縺、縺縺ヲ.txt @@ -0,0 +1,77 @@ +/*---------------------------------------------------*/ +/* NandInitializer の分類について */ +/* */ +/* 2008/04/14 kamikawa */ +/*---------------------------------------------------*/ + +下記の3つのプログラムについて説明します。 + +・NandInitializerRed.srl +・NandInitializerProduct.srl +・NandInitializer.srl + +これらは全て NAND を初期化するためのプログラムですが、 +目的に応じて機能制限が加えられています。 + + +[機能制限一覧表] + ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| メニュー名称 | NandInitializerRed | NandInitializerProduct | NandInitializer | 機能概要 | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| FORMAT NAND | ○ | ○※ | △ | NANDのフォーマットを行います | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| WRITE HARDWARE INFO | ○ | ○※ | ○ | リージョン変更などを行います | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| WRITE ETICKET SIGN | ○ | ○※ | × | eTicket の署名を書き込みます | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| IMPORT TAD FROM SD | ○ | ○※ | × | SDカードからNANDアプリをインポートします | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| IMPORT NANDFIRM FROM SD | ○ | ○※ | × | SDカードからNANDファームを書き込みます | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ +| IMPORT NORFIRM FROM SD | ○ | × | × | SDカードからNORファームを書き込みます | ++-------------------------+--------------------+------------------------+-----------------+------------------------------------------+ + + ※ : 自動実行によりメニューの詳細な指定を行うことができません。 + △ : クリーンアップとチェックディスク以外は選択できません。 + + +〜〜〜 NandInitializerRed 〜〜〜 + +機能制限のないプログラムです。Redという名のついているとおり +開発技術部内でのみ使用してください。 + + +〜〜〜 NandInitializerProduct 〜〜〜 + +検査工程向けに処理を自動実行するようにしています。 +自動実行のためメニューの詳細は選択することができません。 +具体的な動作としては、下記の1〜5を実行して "OK" または "NG" を +表示したあと無限ループに入ります。 + +1. FORMAT NAND -> FORMAT +2. WRITE HARDWARE INFO -> REGION JAPAN +3. WRITE ETICKET SIGN -> WRITE E-TICKET +4. IMPORT TAD FROM SD -> OVERWRITE ALL +5. IMPORT NANDFIRM FROM SD -> 最初に見つけた*.nandファイル + +★ SDカードのルートにnandinitializer.iniというファイルを用意することで + 初期化する際の Region と ワイヤレス設定を指定することができます。 + nandinitializer.ini のフォーマットは以下のとおりです。 + +--- ここから ---- +REGION:0 //(0:JAPAN, 1:AMERICA, 2:EUROPE, 3:AUSTRALIA, 4:CHINA, 5:KOREA) +WIRELESS_FORCE_OFF:0 //(0:Wireless Enable, 1:Wireless Disable) +--- ここまで ---- + +〜〜〜 NandInitializer 〜〜〜 + +SDKで配布するために多くの機能を削除しています。 +実行可能なメニューは「FORMAT NAND」と「WRITE HARDWARE INFO」のみです。 +「FORMAT NAND」ではクリーンアップとチェックディスクのみ選択できます。 + +★ ARM9.TWL側のMakefileのコメント行を1行外すことにより + ワイヤレスの強制Disableフラグを設定可能な特別なNandInitializerを + 作成することができます。 + +以上 diff --git a/docs/TWL繧「繝励Μ髢灘ア譛峨ヵ繧。繧、繝ォ.ppt b/docs/TWL繧「繝励Μ髢灘ア譛峨ヵ繧。繧、繝ォ.ppt new file mode 100644 index 00000000..e37eabf3 Binary files /dev/null and b/docs/TWL繧「繝励Μ髢灘ア譛峨ヵ繧。繧、繝ォ.ppt differ diff --git a/docs/TWL繧ス繝輔ヨ蜷遞ョ繧ウ繝シ繝芽ィュ螳夊ヲ丞援080327.pdf b/docs/TWL繧ス繝輔ヨ蜷遞ョ繧ウ繝シ繝芽ィュ螳夊ヲ丞援080327.pdf new file mode 100644 index 00000000..a9e89247 Binary files /dev/null and b/docs/TWL繧ス繝輔ヨ蜷遞ョ繧ウ繝シ繝芽ィュ螳夊ヲ丞援080327.pdf differ diff --git a/docs/TWL繝槭せ繧ソ繝ェ繝ウ繧ー謇矩譖ク.doc b/docs/TWL繝槭せ繧ソ繝ェ繝ウ繧ー謇矩譖ク.doc new file mode 100644 index 00000000..ada41959 Binary files /dev/null and b/docs/TWL繝槭せ繧ソ繝ェ繝ウ繧ー謇矩譖ク.doc differ diff --git a/docs/TWL繝ゥ繝ウ繝√Ε繝シ.mmap b/docs/TWL繝ゥ繝ウ繝√Ε繝シ.mmap new file mode 100644 index 00000000..1c90fbf7 Binary files /dev/null and b/docs/TWL繝ゥ繝ウ繝√Ε繝シ.mmap differ diff --git a/docs/TWL髢「騾」繝繝シ繧ソ驟榊ク蛻カ髯.xls b/docs/TWL髢「騾」繝繝シ繧ソ驟榊ク蛻カ髯.xls new file mode 100644 index 00000000..be5ed2e1 Binary files /dev/null and b/docs/TWL髢「騾」繝繝シ繧ソ驟榊ク蛻カ髯.xls differ diff --git a/docs/TitleID繝ェ繧ケ繝.mmap b/docs/TitleID繝ェ繧ケ繝.mmap new file mode 100644 index 00000000..015c7684 Binary files /dev/null and b/docs/TitleID繝ェ繧ケ繝.mmap differ diff --git a/docs/_README.txt b/docs/_README.txt new file mode 100644 index 00000000..c6769a97 --- /dev/null +++ b/docs/_README.txt @@ -0,0 +1,4 @@ +mmapファイルは、「MindManager」を使用して作成しています。 +閲覧するには、下記サイトで無料のMindManagerViewerをダウンロードしてください。 + +http://www.mindjet.com/jp/products/mindmanager_viewers/index.php?s=3 diff --git a/docs/format_ROM_Header.xls b/docs/format_ROM_Header.xls new file mode 100644 index 00000000..52ef552c Binary files /dev/null and b/docs/format_ROM_Header.xls differ diff --git a/docs/format_ROM_Header_rev2109_fromIS.xls b/docs/format_ROM_Header_rev2109_fromIS.xls new file mode 100644 index 00000000..26c69f3d Binary files /dev/null and b/docs/format_ROM_Header_rev2109_fromIS.xls differ diff --git a/docs/format_TWLBanner.xls b/docs/format_TWLBanner.xls new file mode 100644 index 00000000..c0024923 Binary files /dev/null and b/docs/format_TWLBanner.xls differ diff --git a/docs/format_TitleID.xls b/docs/format_TitleID.xls new file mode 100644 index 00000000..668897ba Binary files /dev/null and b/docs/format_TitleID.xls differ diff --git a/docs/縺昴ョ莉/Nintendo繝ュ繧エ縺ョ蜿悶j謇ア縺.pdf b/docs/縺昴ョ莉/Nintendo繝ュ繧エ縺ョ蜿悶j謇ア縺.pdf new file mode 100644 index 00000000..c01b62de Binary files /dev/null and b/docs/縺昴ョ莉/Nintendo繝ュ繧エ縺ョ蜿悶j謇ア縺.pdf differ diff --git a/docs/縺昴ョ莉/nintendo繝ュ繧エ陦ィ遉コ.pdf b/docs/縺昴ョ莉/nintendo繝ュ繧エ陦ィ遉コ.pdf new file mode 100644 index 00000000..37150613 Binary files /dev/null and b/docs/縺昴ョ莉/nintendo繝ュ繧エ陦ィ遉コ.pdf differ diff --git a/docs/縺昴ョ莉/shared_font_LC.pdf b/docs/縺昴ョ莉/shared_font_LC.pdf new file mode 100644 index 00000000..d512b639 --- /dev/null +++ b/docs/縺昴ョ莉/shared_font_LC.pdf @@ -0,0 +1,67 @@ +%PDF-1.2 +1 0 obj +<> +endobj + +2 0 obj +<> +endobj + +3 0 obj +<> +endobj + +4 0 obj +<> +endobj + +5 0 obj +<>> /Descent -241 /ItalicAngle 0 /XHeight 450 /StemV 69 /Type /FontDescriptor /CapHeight 709 /FontBBox [-170 -331 1024 903] /FontName /Ryumin-Light>> +endobj + +6 0 obj +<>] /Type /Font /Encoding /EUC-H /BaseFont /Ryumin-Light-EUC-H /Subtype /Type0 /Name /F2>> +endobj + +7 0 obj +<> +endobj + +8 0 obj +<>> /Descent -271 /ItalicAngle 0 /XHeight 553 /StemV 99 /Type /FontDescriptor /CapHeight 737 /FontBBox [-174 -268 1001 944] /FontName /GothicBBB-Medium>> +endobj + +9 0 obj +<>] /Type /Font /Encoding /EUC-H /BaseFont /GothicBBB-Medium-EUC-H /Subtype /Type0 /Name /F4>> +endobj + +10 0 obj +<> stream + q q BT /F2 10.5 Tf 0 Ts 0 Tr 72 745.3125 Td [ ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 72 709.3125 Td [ ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 72 678.3125 Td [ ] TJ ET Q q 1 0 0 1 72 674.5 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 107.125 660.3125 Td [ ] TJ ET Q q 1 0 0 1 194.75 674.5 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 224.625 660.3125 Td [ ] TJ ET Q q 1 0 0 1 317.5 674.5 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 352.625 660.3125 Td [ ] TJ ET Q q 1 0 0 1 440.25 674.5 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 485.875 660.3125 Td [ ] TJ ET Q q 1 0 0 1 72 654 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 77 639.8125 Td [(TWL_LC_Font_t.NFTR) ] TJ ET Q q 1 0 0 1 194.75 654 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 199.75 639.8125 Td [ ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 262.75 639.8125 Td [( 8pt\(7) ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 287.5405 639.8125 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 300.6655 639.8125 Td [-250 (8\)) ] TJ ET Q q 1 0 0 1 317.5 654 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 322.5 639.8125 Td [(Wii\() ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 341.7465 639.8125 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 386.3715 639.8125 Td [-250 (\)) ] TJ ET Q q 1 0 0 1 440.25 654 cm 0 -20.5 m 0 -20.5 122.75 20.5 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 445.25 639.8125 Td [(99KB) ] TJ ET Q q 1 0 0 1 72 633.5 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 77 611.4375 Td [(TWL_LC_Font_s.NFTR) ] TJ ET Q q 1 0 0 1 194.75 633.5 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 199.75 619.3125 Td [ ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 262.75 619.3125 Td [( 10pt\(9) ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 292.7905 619.3125 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 199.75 603.5625 Td [(12\)) ] TJ ET Q q 1 0 0 1 317.5 633.5 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 322.5 611.4375 Td [(Wii\() ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 341.7465 611.4375 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 386.3715 611.4375 Td [-250 (\)) ] TJ ET Q q 1 0 0 1 440.25 633.5 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 445.25 611.4375 Td [(149KB) ] TJ ET Q q 1 0 0 1 72 597.25 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 77 575.1875 Td [(TWL_LC_Font_m.NFTR) ] TJ ET Q q 1 0 0 1 194.75 597.25 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 199.75 583.0625 Td [ ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 262.75 583.0625 Td [( 12pt\(11) ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 298.0405 583.0625 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 199.75 567.3125 Td [(15\)) ] TJ ET Q q 1 0 0 1 317.5 597.25 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 322.5 575.1875 Td [(Wii\() ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 341.7465 575.1875 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 386.3715 575.1875 Td [-250 (\)) ] TJ ET Q q 1 0 0 1 440.25 597.25 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 445.25 575.1875 Td [(200KB) ] TJ ET Q q 1 0 0 1 72 561 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 77 538.9375 Td [(TWL_LC_Font_l.NFTR) ] TJ ET Q q 1 0 0 1 194.75 561 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F2 10.5 Tf 0 Ts 0 Tr 199.75 546.8125 Td [ ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 262.75 546.8125 Td [( 16pt\(15) ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 298.0405 546.8125 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 199.75 531.0625 Td [(21\)) ] TJ ET Q q 1 0 0 1 317.5 561 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 322.5 538.9375 Td [(Wii\() ] TJ ET Q q BT /F2 10.5 Tf 0 Ts 0 Tr 341.7465 538.9375 Td [-250 ] TJ ET Q q BT /F1 10.5 Tf 0 Ts 0 Tr 386.3715 538.9375 Td [-250 (\)) ] TJ ET Q q 1 0 0 1 440.25 561 cm 0 -36.25 m 0 -36.25 122.75 36.25 re S Q q BT /F1 10.5 Tf 0 Ts 0 Tr 445.25 538.9375 Td [(336KB) ] TJ ET Q q BT /F3 9 Tf 0 Ts 0 Tr 294.998 36 Td [(1) ] TJ ET Q Q +endstream +endobj + +11 0 obj +<> /ProcSet [/PDF /Text]>> /Type /Page /MediaBox [0 0 595 842] /Parent 1 0 R>> +endobj + +xref +0 12 +0000000000 65535 f +0000000009 00000 n +0000000066 00000 n +0000000114 00000 n +0000000222 00000 n +0000000293 00000 n +0000000524 00000 n +0000000790 00000 n +0000000896 00000 n +0000001131 00000 n +0000001405 00000 n +0000006160 00000 n + +trailer +<> +startxref +6325 +%%EOF diff --git a/docs/繧「繝励Μ繧ク繝」繝ウ繝.mmap b/docs/繧「繝励Μ繧ク繝」繝ウ繝.mmap new file mode 100644 index 00000000..2234f55e Binary files /dev/null and b/docs/繧「繝励Μ繧ク繝」繝ウ繝.mmap differ diff --git a/docs/繧「繝励Μ遞ョ蛻・.mmap b/docs/繧「繝励Μ遞ョ蛻・.mmap new file mode 100644 index 00000000..3cb2f522 Binary files /dev/null and b/docs/繧「繝励Μ遞ョ蛻・.mmap differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/KeyTable.vsd b/docs/繧イ繝シ繝繧ォ繝シ繝/KeyTable.vsd new file mode 100644 index 00000000..3e36a68f Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/KeyTable.vsd differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/TWL繧ォ繝シ繝峨Γ繝「繝ェ螳ケ驥上↓繧医k莉墓ァ倬&縺.xls b/docs/繧イ繝シ繝繧ォ繝シ繝/TWL繧ォ繝シ繝峨Γ繝「繝ェ螳ケ驥上↓繧医k莉墓ァ倬&縺.xls new file mode 100644 index 00000000..559fdca8 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/TWL繧ォ繝シ繝峨Γ繝「繝ェ螳ケ驥上↓繧医k莉墓ァ倬&縺.xls differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/_PrivateNitroRomHeader.pdf b/docs/繧イ繝シ繝繧ォ繝シ繝/_PrivateNitroRomHeader.pdf new file mode 100644 index 00000000..5f8edcf4 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/_PrivateNitroRomHeader.pdf differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/繧ォ繝シ繝芽ェュ縺ソ霎シ縺ソ繧キ繝シ繧ア繝ウ繧ケ陦ィ.xls b/docs/繧イ繝シ繝繧ォ繝シ繝/繧ォ繝シ繝芽ェュ縺ソ霎シ縺ソ繧キ繝シ繧ア繝ウ繧ケ陦ィ.xls new file mode 100644 index 00000000..2a328165 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/繧ォ繝シ繝芽ェュ縺ソ霎シ縺ソ繧キ繝シ繧ア繝ウ繧ケ陦ィ.xls differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/繧イ繝シ繝繧ォ繝シ繝画諺謚懈、懷コ.xls b/docs/繧イ繝シ繝繧ォ繝シ繝/繧イ繝シ繝繧ォ繝シ繝画諺謚懈、懷コ.xls new file mode 100644 index 00000000..ef012fe4 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/繧イ繝シ繝繧ォ繝シ繝画諺謚懈、懷コ.xls differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚 譛ェ螳溯」驛ィ蛻.mmap b/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚 譛ェ螳溯」驛ィ蛻.mmap new file mode 100644 index 00000000..f656fc20 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚 譛ェ螳溯」驛ィ蛻.mmap differ diff --git a/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚懊ヵ繝ュ繝シ.vsd b/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚懊ヵ繝ュ繝シ.vsd new file mode 100644 index 00000000..0eec9418 Binary files /dev/null and b/docs/繧イ繝シ繝繧ォ繝シ繝/豢サ邱壽諺謚懊ヵ繝ュ繝シ.vsd differ diff --git a/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu.mpp b/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu.mpp new file mode 100644 index 00000000..0d88b8bb Binary files /dev/null and b/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu.mpp differ diff --git a/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu_080414.pdf b/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu_080414.pdf new file mode 100644 index 00000000..ac190f25 Binary files /dev/null and b/docs/繧ケ繧ア繧ク繝・繝シ繝ォ_TWLSystemMenu_080414.pdf differ diff --git a/docs/繝繝舌ャ繧ー/TWL繝繝舌ャ繧ー逕ィ繧ス繝輔ヨ.mmap b/docs/繝繝舌ャ繧ー/TWL繝繝舌ャ繧ー逕ィ繧ス繝輔ヨ.mmap new file mode 100644 index 00000000..8e987380 Binary files /dev/null and b/docs/繝繝舌ャ繧ー/TWL繝繝舌ャ繧ー逕ィ繧ス繝輔ヨ.mmap differ diff --git a/docs/繝繝舌ャ繧ー/繧キ繧ケ繝繝諠蝣ア遒コ隱.xls b/docs/繝繝舌ャ繧ー/繧キ繧ケ繝繝諠蝣ア遒コ隱.xls new file mode 100644 index 00000000..d818a87c Binary files /dev/null and b/docs/繝繝舌ャ繧ー/繧キ繧ケ繝繝諠蝣ア遒コ隱.xls differ diff --git a/docs/繝繝舌ャ繧ー/繝代シ繝溘ャ繧キ繝ァ繝ウ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝繝舌ャ繧ー/繝代シ繝溘ャ繧キ繝ァ繝ウ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..407f9c5f Binary files /dev/null and b/docs/繝繝舌ャ繧ー/繝代シ繝溘ャ繧キ繝ァ繝ウ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ豢励>蜃コ縺.mmap b/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ豢励>蜃コ縺.mmap new file mode 100644 index 00000000..c35610f8 Binary files /dev/null and b/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ豢励>蜃コ縺.mmap differ diff --git a/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ陦ィ.xls b/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ陦ィ.xls new file mode 100644 index 00000000..d9ba20a0 Binary files /dev/null and b/docs/繝繝舌ャ繧ー/豢サ邱壽諺謚/豢サ邱壽諺謚懊ョ繝舌ャ繧ー 繝繧ケ繝医こ繝シ繧ケ陦ィ.xls differ diff --git a/docs/繝輔か繝ォ繝繝繝ェ繝シ_NAND.vsd b/docs/繝輔か繝ォ繝繝繝ェ繝シ_NAND.vsd new file mode 100644 index 00000000..35431771 Binary files /dev/null and b/docs/繝輔か繝ォ繝繝繝ェ繝シ_NAND.vsd differ diff --git a/docs/繝輔か繝ォ繝繝繝ェ繝シ_SD繧ォ繝シ繝.mmap b/docs/繝輔か繝ォ繝繝繝ェ繝シ_SD繧ォ繝シ繝.mmap new file mode 100644 index 00000000..b60bd4f4 Binary files /dev/null and b/docs/繝輔か繝ォ繝繝繝ェ繝シ_SD繧ォ繝シ繝.mmap differ diff --git a/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NAND.vsd b/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NAND.vsd new file mode 100644 index 00000000..215f21a8 Binary files /dev/null and b/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NAND.vsd differ diff --git a/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NOR.xls b/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NOR.xls new file mode 100644 index 00000000..f8c21f75 Binary files /dev/null and b/docs/繝輔Λ繝繧キ繝・繝槭ャ繝誉NOR.xls differ diff --git a/docs/繝輔Ο繝シ_NAND繝輔ぃ繝シ繝.vsd b/docs/繝輔Ο繝シ_NAND繝輔ぃ繝シ繝.vsd new file mode 100644 index 00000000..7da5a0e5 Binary files /dev/null and b/docs/繝輔Ο繝シ_NAND繝輔ぃ繝シ繝.vsd differ diff --git a/docs/繝輔Ο繝シ_繧「繝励Μ髢狗匱.vsd b/docs/繝輔Ο繝シ_繧「繝励Μ髢狗匱.vsd new file mode 100644 index 00000000..4fa38fef Binary files /dev/null and b/docs/繝輔Ο繝シ_繧「繝励Μ髢狗匱.vsd differ diff --git a/docs/繝輔Ο繝シ_繝阪ャ繝医Ρ繝シ繧ッ繧「繝繝励ョ繝シ繝.vsd b/docs/繝輔Ο繝シ_繝阪ャ繝医Ρ繝シ繧ッ繧「繝繝励ョ繝シ繝.vsd new file mode 100644 index 00000000..53c6c733 Binary files /dev/null and b/docs/繝輔Ο繝シ_繝阪ャ繝医Ρ繝シ繧ッ繧「繝繝励ョ繝シ繝.vsd differ diff --git a/docs/繝輔Ο繝シ_繝ゥ繝ウ繝√Ε繝シ.vsd b/docs/繝輔Ο繝シ_繝ゥ繝ウ繝√Ε繝シ.vsd new file mode 100644 index 00000000..229d5540 Binary files /dev/null and b/docs/繝輔Ο繝シ_繝ゥ繝ウ繝√Ε繝シ.vsd differ diff --git a/docs/繝悶シ繝ROM/TWL_BootRomInfo.vsd b/docs/繝悶シ繝ROM/TWL_BootRomInfo.vsd new file mode 100644 index 00000000..8c88d5fe Binary files /dev/null and b/docs/繝悶シ繝ROM/TWL_BootRomInfo.vsd differ diff --git a/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_EULA_specification_20080508.pdf b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_EULA_specification_20080508.pdf new file mode 100644 index 00000000..c62e6e40 Binary files /dev/null and b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_EULA_specification_20080508.pdf differ diff --git a/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_20080516.pdf b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_20080516.pdf new file mode 100644 index 00000000..44e86034 Binary files /dev/null and b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_20080516.pdf differ diff --git a/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_byUIG.pdf b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_byUIG.pdf new file mode 100644 index 00000000..3d73f217 Binary files /dev/null and b/docs/繝壹い繝ャ繝ウ繧ソ繝ォ繧ウ繝ウ繝医Ο繝シ繝ォ_EULA/TWL_ParentalControl_specification_byUIG.pdf differ diff --git a/docs/繝懊ヤ/SystemMenu_RED繝ェ繝ェ繝シ繧ケ.txt b/docs/繝懊ヤ/SystemMenu_RED繝ェ繝ェ繝シ繧ケ.txt new file mode 100644 index 00000000..b11ea33c --- /dev/null +++ b/docs/繝懊ヤ/SystemMenu_RED繝ェ繝ェ繝シ繧ケ.txt @@ -0,0 +1,92 @@ +SystemMenu_RED + +・ランチャー + ・カードアプリ取得 △ (TWLバナーへの対応はまだ) + ・TWLカード起動 ○ + ・カード活線挿抜処理 × + ・NTRカード(NTRモード)起動 作業中 + ・NANDアプリリスト取得 ○ + ・NANDアプリ起動 ○ + ・アプリブート時の再配置処理 ○ + ・ISデバッガ対応 × (次タスク) + ・ファームウェアとして正規動作 △ (次タスク) + ・アプリ起動時のWRAM-MAP設定 ○ + ・アプリ起動時のSCFGレジスタロック △ +  ・アプリ起動時のSDカードアクセス可否 △ (とりあえず解放にしておき、セキュリティ面での検討を行う。) + ・署名・暗号処理 × + ・鍵管理 × + ・メモリマップFIX ○ +  ・起動時の無線ファーム流し込み × + ・NTRコンポーネントパッチ × +・本体設定 + ・設定データフォーマットFIX ○ + ・言語選択 ○ + ・TP補正 ○ + ・日付・時刻設定 ○ + ・ユーザー情報 ○ (欧州文字、絵文字など一部文字は入力できない仕様) + ・その他設定 × + ・NANDへの保存 ○ + ・NTR側(NVRAM)への保存 ○ + +・WiFi設定 × + ・設定データフォーマットFIX ○ + ・仕様FIX ○ + +・DSダウンロードプレイ + ・仕様FIX ○ (DSダウンロードプレイと同一仕様) + ・実装 × +・ネットワークアップデート + ・仕様FIX ○ + ・実装 × + +・アプリ管理 + ・SDにコピーする際のファイルフォーマット× + ・実装 × + +・TWLバナー対応 × + ・仕様FIX 作業中 + ・makebanner作成 × +・NANDfirm→ランチャー パラメータ引渡し × + ・仕様FIX ○ +・ランチャー→NANDアプリ パラメータ引渡し × + ・本体設定データなどの情報 × + ・DSダウンロードプレイの情報 × +・NANDアプリ→ランチャー パラメータ引渡し × + ・仕様FIX ○ +  ・動作バリエーションの検討 作業中 +  ・各種動作のデモ作成 作業中 +・NAND内オーバーレイ&FS ○ + ・仕様FIX ○ + ・NAND,SDマウント情報(アクセス制限) ○ +・共有リソースアクセス × + ・仕様FIX × +・タイトル外部リソースアクセス × + ・仕様FIX × + +・NANDアプリインストール ○ (TwlSDKのNMenuを使用) +・NANDフォーマット △ (TwlSDKのdemos.TWL/fatfs/formatterを使用) + ・仕様FIX ○ + ・NANDを固定値でベタ書き × + ※起動できないランチャーを書いて起動しなくなった時の復旧は、GCDファームのカード起動可能ファームを書き直して、 +  formatterに改変を加えたformatter+NANDファーム&システムメニューインストーラーで書き込み。 + +・makerom.TWL対応 + ・ファーム用ビルド(PKIを不使用、AES暗号範囲変更)に対応 × + ・TWLカードのノーマル領域をマニュアル設定できるように。 × + ・ROMヘッダ署名PKI仕様の削除 × + +・ISデバッガ対応 + ・NANDアプリデバッグ対応 × (現状カードアプリとしてデバッグ) + ・仕様FIX △ (TwlNmenuを使ったNTRのDSダウンロードプレイ子機プログラムデバッグと似た仕組み) + ・バナー確認機能 × + ・仕様FIX × + +・マスタリング処理 × + ・CLSサーバ構築?? × + ・ROMマスタリングツール × + +・生産工程を考慮した仕様 × + ・検査用カードの初期設定スキップ起動 × + ・ショートカットキーによる初期設定スキップ起動 × + ・生産工程で書き込まれるプリFIXデータ仕様 × + diff --git a/docs/繝懊ヤ/險隱槭さ繝シ繝牙ヲ逅.xls b/docs/繝懊ヤ/險隱槭さ繝シ繝牙ヲ逅.xls new file mode 100644 index 00000000..fe015443 Binary files /dev/null and b/docs/繝懊ヤ/險隱槭さ繝シ繝牙ヲ逅.xls differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/TWL繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ隗」隱ャ譖ク.doc b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/TWL繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ隗」隱ャ譖ク.doc new file mode 100644 index 00000000..d237d2b7 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/TWL繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ隗」隱ャ譖ク.doc differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls new file mode 100644 index 00000000..ca33e4c4 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繧ウ繝ウ繝壹い繝繝シ繝ォ.txt b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繧ウ繝ウ繝壹い繝繝シ繝ォ.txt new file mode 100644 index 00000000..ec362ec2 --- /dev/null +++ b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繧ウ繝ウ繝壹い繝繝シ繝ォ.txt @@ -0,0 +1,14 @@ +======================================================================= +TWL コンペアツール 変更履歴 +======================================================================= + +* ------------------------------------------------ +* 20081120版 [9297-2669-148] +* ------------------------------------------------ + +○既知の問題 + +・[BUG01] + マスタリングツールの[BUG03]と同様の問題です。 + 現在、原因調査中です。 + diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/螟夜Κ莉墓ァ.xls b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/螟夜Κ莉墓ァ.xls new file mode 100644 index 00000000..776a8ad1 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繧ウ繝ウ繝壹い繝繝シ繝ォ/螟夜Κ莉墓ァ.xls differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls new file mode 100644 index 00000000..b0d95260 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝繝舌ャ繧ー鬆逶ョ.xls differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝薙Ν繝画婿豕.txt b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝薙Ν繝画婿豕.txt new file mode 100644 index 00000000..ad5f86df --- /dev/null +++ b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝薙Ν繝画婿豕.txt @@ -0,0 +1,87 @@ +* --------------------------------------------------- +* +* TWL マスタリングツール 作成方法 +* +* --------------------------------------------------- + +* --------------------------------------------------- +* 手順 +* --------------------------------------------------- + +マスタリングツールは、TWLにおける暗号の秘密鍵を内部に持つツールです。 +そのため、このツールが流出するとTWLの暗号が破られてしまいます。 +(自作のゲームソフトや違法なゲームソフトを量産機で起動できてしまいます。) + +その対策として、マスタリングツールの実行バイナリ(.exe)自体に暗号をかけ、 +特殊なUSBキーをPCに挿さないと、復号できない仕組みを導入しています。 +この対策によって、マスタリングツールの実行バイナリが流出しても、 +秘密鍵が漏れることはないうえ、USBキーを持たないユーザは実行できません。 + +上記の対策を実現するために、マスタリングツールの作成方法は、 +以下の2ステップに分かれます。 + + (Step1.) マスタリングツールのコンパイル + (Step2.) 実行バイナリの暗号化 + +[用語の定義] +・エンベロープ: Step2.の実行バイナリの暗号化処理 +・ドングル: ツール実行のために必要な特殊なUSBキー + +* --------------------------------------------------- +* (Step1.) マスタリングツールのコンパイル +* --------------------------------------------------- + +このステップでは、マスタリングツールのソースをコンパイルします。 + +(注意!) +この作業だけでは、マスタリングツールの実行バイナリは暗号化されないため、 +ツールが流出すると、誰でもマスタリングが可能になってしまいます。 + +(1) 準備 + 以下のパッケージが必要です。 + + ○ TWLIPL_private + マスタリングツールのソースを含むパッケージ。 + 秘密鍵の生データを含むため、流出させない管理が必要です。 + そのため、USBメモリ内にリポジトリとツリーが置かれ、 + そのUSBメモリは指紋認証キャビネットで管理されています。 + したがって、このパッケージを入手するには、 + 指紋認証キャビネットへの指紋の登録が必要です。 + + ○ TwlSDK + いくつかのライブラリを使用しています。 + + ○ TwlIPL + いくつかのインクルードファイルを使用しています。 + + ビルド前に、以下の環境変数に各ツリーのルートを指定しておく必要があります。 + -- TWLSDK_ROOT + -- TWL_IPL_RED_ROOT + -- TWL_IPL_RED_PRIVATE_ROOT + +(2) 方法 + make してください。 + +(3) ビルドスイッチ + mastering.h には、各種のビルドスイッチが宣言されていますので、 + 適宜、変更してください。 + + +* --------------------------------------------------- +* (Step2.) 実行バイナリの暗号化(エンベロープ) +* --------------------------------------------------- + +(1) 準備 + 以下の機材が必要です。 + + ○ エンベロープ用USBキー + 実行用のUSBキーとは異なります。ソフトGの村上豊さんが所有しています。 + + ○ エンベロープソフト + PCソフトです。ソフトGが所有しています。 + +(2) 方法 + 現在、エンベロープが可能なのは、ソフトGの村上豊さんのみです。 + 村上豊さんにお問い合わせください。 + +以上 diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ.txt b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ.txt new file mode 100644 index 00000000..89ab1d69 --- /dev/null +++ b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/繝ェ繝ェ繝シ繧ケ繝弱シ繝_繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ.txt @@ -0,0 +1,80 @@ +======================================================================= +TWL マスタリングツール 変更履歴 +======================================================================= + +* ------------------------------------------------ +* 20081120版 [9297-2669-148] +* ------------------------------------------------ + +○ 問題の修正 + +・[BUG01]の修正 + USBキードライバの終了処理を追加しました。 + +・[BUG02]の修正 + USBキードライバの終了処理を追加しました。 + 上書き確認で"n"を選択しても、問題ありません。 + +・[BUG04]の修正 + ゲームコードが"NTRJ"であるNANDアプリの場合でも、 + -tオプションを指定できるようにしました。 + (通常は、"NTRJ"となるアプリはマスタリング対象ではありません。) + +・[BUG05]の修正 + ゲームコードが"NTRJ"であるカードアプリの場合には、 + -gオプションを指定できないようにしました。(エラーとなります。) + +○ 既知の問題 + +・[BUG03]が修正されていません。 + + +* ------------------------------------------------ +* 20081010版 [8666-2532-144] +* ------------------------------------------------ + +○既知の問題 + +・[BUG01] + 入力ファイルと出力ファイルに同じ名前を設定したときにエラーとなりますが、 + このとき、USBキードライバの終了処理をしません。 + USBキーのドライバの動作に影響を与える可能性があるため、 + 入力ファイルと出力ファイルに同じ名前を設定しないでください。 + この問題は、次回のリリースで修正されます。 + +・[BUG02] + 出力ファイルがすでに存在するときに上書き確認をし、"n"が入力されたときには、 + 上書きをせずに終了しますが、このとき、USBキードライバの終了処理をしません。 + USBキーのドライバの動作に影響を与える可能性があるため、 + 上書き確認で、"n"を入力せず、すでに存在するファイルの名前を変更して、"y"を押してください。 + この問題は、次回のリリースで修正されます。 + +・[BUG03] + 多数のSRLをシェルスクリプトで連続してマスタリングしたときに、 + ごくまれにOSがフリーズする現象が生じることが報告されています。 + USBキーのドライバが原因である可能性も含めて、現在、原因調査中です。 + マスタリングツールの使用前に、PC上の重要なデータを保存しておいてください。 + +・[BUG04] + TWL対応アプリのゲームコードが"NTRJ"であるSRLのマスタリングはできませんが、 + -tオプションをつけることによって、強制的にマスタリング可能です。 + このとき、カードアプリである場合には問題ありませんが、 + NANDアプリである場合には、データに矛盾が生じ、正常に動作しない可能性があります。 + NANDアプリでゲームコードが"NTRJ"である場合には、 + (-tオプションによる)マスタリングをしないでください。 + 通常、ゲームコードが"NTRJ"であるSRLはマスタリング対象ではありませんが、 + 一部の検証用プログラムやSDKデモプログラムには存在しますので、ご注意ください。 + この問題は、次回のリリースで修正されます。 + +・[BUG05] + TWL対応アプリのゲームコードが"NTRJ"であるSRLのマスタリングはできませんが、 + -gオプションをつけることによって、強制的にゲームコードとTitleIDを他の文字列に変更して、 + マスタリングをかけることが可能です。 + このとき、NANDアプリである場合には問題ありませんが、 + カードアプリである場合には、データに矛盾が生じ、正常にカード起動させることができません。 + NANDアプリでゲームコードが"NTRJ"である場合には、 + (-gオプションによる)マスタリングをしないでください。 + 通常、マスタリングするSRLにはゲームコードが"NTRJ"であるものは存在しませんが、 + 一部の検証用プログラムやSDKデモプログラムには存在しますので、ご注意ください。 + この問題は、次回のリリースで修正されます。 + diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/莉墓ァ俶ヲりヲ.ppt b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/莉墓ァ俶ヲりヲ.ppt new file mode 100644 index 00000000..2c496058 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/莉墓ァ俶ヲりヲ.ppt differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/蜀驛ィ莉墓ァ.vsd b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/蜀驛ィ莉墓ァ.vsd new file mode 100644 index 00000000..bab0a9df Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/蜀驛ィ莉墓ァ.vsd differ diff --git a/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/螟夜Κ莉墓ァ.xls b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/螟夜Κ莉墓ァ.xls new file mode 100644 index 00000000..fc170044 Binary files /dev/null and b/docs/繝槭せ繧ソ繝ェ繝ウ繧ー繝繝シ繝ォ/螟夜Κ莉墓ァ.xls differ diff --git a/docs/繝。繝「繝ェ繝槭ャ繝誉NAND繝輔ぃ繝シ繝.vsd b/docs/繝。繝「繝ェ繝槭ャ繝誉NAND繝輔ぃ繝シ繝.vsd new file mode 100644 index 00000000..16f17ef2 Binary files /dev/null and b/docs/繝。繝「繝ェ繝槭ャ繝誉NAND繝輔ぃ繝シ繝.vsd differ diff --git a/docs/繝。繝「繝ェ繝槭ャ繝誉mb_child.vsd b/docs/繝。繝「繝ェ繝槭ャ繝誉mb_child.vsd new file mode 100644 index 00000000..22863361 Binary files /dev/null and b/docs/繝。繝「繝ェ繝槭ャ繝誉mb_child.vsd differ diff --git a/docs/繝。繝「繝ェ繝槭ャ繝誉繝ゥ繝ウ繝√Ε繝シ.vsd b/docs/繝。繝「繝ェ繝槭ャ繝誉繝ゥ繝ウ繝√Ε繝シ.vsd new file mode 100644 index 00000000..9262cc4c Binary files /dev/null and b/docs/繝。繝「繝ェ繝槭ャ繝誉繝ゥ繝ウ繝√Ε繝シ.vsd differ diff --git a/docs/繝ゥ繝ウ繝√Ε繝シ縺ォ繧医k繝悶シ繝亥━蜈亥コヲ.xls b/docs/繝ゥ繝ウ繝√Ε繝シ縺ォ繧医k繝悶シ繝亥━蜈亥コヲ.xls new file mode 100644 index 00000000..9016a522 Binary files /dev/null and b/docs/繝ゥ繝ウ繝√Ε繝シ縺ォ繧医k繝悶シ繝亥━蜈亥コヲ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..286ff2af Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝ェ繝ェ繝シ繧ケ繧ソ繧ケ繧ッ.mmap b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝ェ繝ェ繝シ繧ケ繧ソ繧ケ繧ッ.mmap new file mode 100644 index 00000000..ec453cb4 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus2/SDK_5_0_FC_plus2_繝ゥ繝ウ繝√Ε繝シ繝ェ繝ェ繝シ繧ケ繧ソ繧ケ繧ッ.mmap differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..b8b07226 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus3/SDK_5_0_FC_plus3_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus5/TwlSDK 5.0 fc plus5 繧ソ繧ケ繧ッ.mmap b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus5/TwlSDK 5.0 fc plus5 繧ソ繧ケ繧ッ.mmap new file mode 100644 index 00000000..3f9b0b05 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_FC_plus5/TwlSDK 5.0 fc plus5 繧ソ繧ケ繧ッ.mmap differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/SDK_5_0_rc_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/SDK_5_0_rc_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..7ca9fab4 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/SDK_5_0_rc_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap new file mode 100644 index 00000000..c5a4fc58 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/繧「繝励Μ繧ク繝」繝ウ繝怜ョ滄ィ捺焔鬆.txt b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/繧「繝励Μ繧ク繝」繝ウ繝怜ョ滄ィ捺焔鬆.txt new file mode 100644 index 00000000..c3173233 --- /dev/null +++ b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_RC/繧「繝励Μ繧ク繝」繝ウ繝怜ョ滄ィ捺焔鬆.txt @@ -0,0 +1,40 @@ + +やたら項目が多いように見えますが、慣れれば1分かからないのでご安心を。 + + +1.AppliCooperation A B C をそれぞれインポートする + +2.A を起動 + +3.Set Parameter で適当に文字をセット + +4.Launch CooperationB で B へジャンプ +  ※ この時、*マークの位置と Set Parameter にセットされている文字を覚えておく + +5.Received Parameter に先ほどセットした文字が入っているのを確認 + +6.Launch Former App で A へリターン + +7.A に戻ったとき、4.の時点での状態で復帰しているのを確認(*の位置と Set Parameter にセットされている文字) + +8.Return app test で B へリターン + +9.Received Parameter に何も無いことを確認 + +10.Launch Former App で A へリターン + +11.A に戻ったとき、4.の時点での状態で復帰しているのを確認(*の位置と Set Parameter にセットされている文字) + +12.launch C test で C へジャンプ + +13.Return app test で A へリターン + +14.A が初期状態で起動している事を確認して、 Return app test で C へリターン + +15.C から launch C test で C へジャンプ + +16.C から Return app test で C へリターン + +17.A を使って行った3.〜11.の手順を C で行う(ただし、 A の*マークは C では$マークになっている) + +以上 \ No newline at end of file diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/SDK_5_0_ss4_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/SDK_5_0_ss4_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..7ca9fab4 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/SDK_5_0_ss4_繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap new file mode 100644 index 00000000..94237a23 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_SDK_5_0_ss4/TwlSDK 5.0 rc 繧ソ繧ケ繧ッ.mmap differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4_TS繝懊シ繝画政霈峨Λ繝ウ繝√Ε繝シ貅門y.mmap b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4_TS繝懊シ繝画政霈峨Λ繝ウ繝√Ε繝シ貅門y.mmap new file mode 100644 index 00000000..e5708858 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4_TS繝懊シ繝画政霈峨Λ繝ウ繝√Ε繝シ貅門y.mmap differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4繝懊シ繝臥畑繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4繝懊シ繝臥畑繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls new file mode 100644 index 00000000..7d491c23 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/X4繝懊シ繝臥畑繝ゥ繝ウ繝√Ε繝シ繝√ぉ繝繧ッ陦ィ.xls differ diff --git a/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/讖滓攝蛻・RED繝ゥ繝ウ繝√Ε繝シ讖溯ス.xls b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/讖滓攝蛻・RED繝ゥ繝ウ繝√Ε繝シ讖溯ス.xls new file mode 100644 index 00000000..7be4f952 Binary files /dev/null and b/docs/繝ェ繝ェ繝シ繧ケ_X4繝懊シ繝牙ッセ蠢/讖滓攝蛻・RED繝ゥ繝ウ繝√Ε繝シ讖溯ス.xls differ diff --git a/docs/蜷繧「繝励Μテ玲悽菴灘虚菴懷庄蜷ヲ.vsd b/docs/蜷繧「繝励Μテ玲悽菴灘虚菴懷庄蜷ヲ.vsd new file mode 100644 index 00000000..aca59001 Binary files /dev/null and b/docs/蜷繧「繝励Μテ玲悽菴灘虚菴懷庄蜷ヲ.vsd differ diff --git a/docs/譁ー驟堺ソ。繧キ繧ケ繝繝/TWL驟堺ソ。繧キ繧ケ繝繝髢狗匱繧ケ繧ア繧ク繝・繝シ繝ォ.pdf b/docs/譁ー驟堺ソ。繧キ繧ケ繝繝/TWL驟堺ソ。繧キ繧ケ繝繝髢狗匱繧ケ繧ア繧ク繝・繝シ繝ォ.pdf new file mode 100644 index 00000000..c9a2f1d2 Binary files /dev/null and b/docs/譁ー驟堺ソ。繧キ繧ケ繝繝/TWL驟堺ソ。繧キ繧ケ繝繝髢狗匱繧ケ繧ア繧ク繝・繝シ繝ォ.pdf differ diff --git a/docs/讌ュ蜍吶ヵ繝ュ繝シ.vsd b/docs/讌ュ蜍吶ヵ繝ュ繝シ.vsd new file mode 100644 index 00000000..47e71dd4 Binary files /dev/null and b/docs/讌ュ蜍吶ヵ繝ュ繝シ.vsd differ diff --git a/docs/辟。邱/TWL譛ャ菴灘菫晏ュ俶ュ蝣ア譯.xls b/docs/辟。邱/TWL譛ャ菴灘菫晏ュ俶ュ蝣ア譯.xls new file mode 100644 index 00000000..45d9ba2c Binary files /dev/null and b/docs/辟。邱/TWL譛ャ菴灘菫晏ュ俶ュ蝣ア譯.xls differ diff --git a/docs/辟。邱/WiFi繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ繧サ繧ュ繝・繝ェ繝繧」.mmap b/docs/辟。邱/WiFi繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ繧サ繧ュ繝・繝ェ繝繧」.mmap new file mode 100644 index 00000000..e0f4eea6 Binary files /dev/null and b/docs/辟。邱/WiFi繧ィ繝溘Η繝ャ繝シ繧キ繝ァ繝ウ繧サ繧ュ繝・繝ェ繝繧」.mmap differ diff --git a/docs/辟。邱/firm_format.pdf b/docs/辟。邱/firm_format.pdf new file mode 100644 index 00000000..62ecc631 Binary files /dev/null and b/docs/辟。邱/firm_format.pdf differ diff --git a/docs/辟。邱/繝輔Ο繝シ_辟。邱壼晄悄蛹.vsd b/docs/辟。邱/繝輔Ο繝シ_辟。邱壼晄悄蛹.vsd new file mode 100644 index 00000000..6bbc8841 Binary files /dev/null and b/docs/辟。邱/繝輔Ο繝シ_辟。邱壼晄悄蛹.vsd differ diff --git a/docs/邨ア蜷医い繝励Μ隱崎ィシ繧キ繝シ繧ア繝ウ繧ケ.vsd b/docs/邨ア蜷医い繝励Μ隱崎ィシ繧キ繝シ繧ア繝ウ繧ケ.vsd new file mode 100644 index 00000000..403c3758 Binary files /dev/null and b/docs/邨ア蜷医い繝励Μ隱崎ィシ繧キ繝シ繧ア繝ウ繧ケ.vsd differ diff --git a/docs/骰オ邂。逅.xls b/docs/骰オ邂。逅.xls new file mode 100644 index 00000000..e8f78f33 Binary files /dev/null and b/docs/骰オ邂。逅.xls differ diff --git a/docs/髢区橿繧ス繝輔ヨシァ縺顔寔莠亥ョ.xls b/docs/髢区橿繧ス繝輔ヨシァ縺顔寔莠亥ョ.xls new file mode 100644 index 00000000..201228f2 Binary files /dev/null and b/docs/髢区橿繧ス繝輔ヨシァ縺顔寔莠亥ョ.xls differ diff --git a/include/firm.h b/include/firm.h new file mode 100644 index 00000000..ee845021 --- /dev/null +++ b/include/firm.h @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm + File: firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_H_ +#define FIRM_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* FIRM_H_ */ +#endif diff --git a/include/firm/acsign.h b/include/firm/acsign.h new file mode 100644 index 00000000..f275754a --- /dev/null +++ b/include/firm/acsign.h @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - ACSIGN + File: acsign.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_ACSIGN_H_ +#define FIRM_ACSIGN_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_ACSIGN_H_ */ +#endif diff --git a/include/firm/aes.h b/include/firm/aes.h new file mode 100644 index 00000000..54e46dc5 --- /dev/null +++ b/include/firm/aes.h @@ -0,0 +1,31 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - AES + File: aes.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_AES_H_ +#define FIRM_AES_H_ + +#define PXI_FIFO_TAG_DATA PXI_FIFO_TAG_USER_0 + +#include + +#ifdef SDK_ARM7 +#include +#include +#include +#endif // !SDK_ARM7 + +/* FIRM_AES_H_ */ +#endif diff --git a/include/firm/aes/ARM7/aes_init.h b/include/firm/aes/ARM7/aes_init.h new file mode 100644 index 00000000..aee8344b --- /dev/null +++ b/include/firm/aes/ARM7/aes_init.h @@ -0,0 +1,190 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - AES - include + File: aes_init.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef TWL_AES_AES_INIT_H_ +#define TWL_AES_AES_INIT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------* + Name: AESi_PreInitKeys + + Description: reset IDs preset by bootrom. + you SHOULD NOT touch any ID registers after this call. + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_PreInitKeys( void ); + +/*---------------------------------------------------------------------------* + Name: AESi_InitKeysForApp + + Description: set IDs depending on the application. + you SHOULD NOT touch any ID registers after this call. + + Arguments: game_code game code + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitKeysForApp( u8 game_code[4] ); + +/*---------------------------------------------------------------------------* + Name: AESi_InitKeysForHard + + Description: set IDs depending on the system hardware. + you SHOULD NOT use this for standard applications. + + Arguments: fuse camouflaged fuse id + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitKeysForHard( u8 fuse[8] ); + +/*---------------------------------------------------------------------------* + Name: AESi_ResetAesKeyA + + Description: set SEED/ID/KEYs filler data for slot-C + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void AESi_ResetAesKeyA( void ) +{ + AES_Lock(); + AES_WaitKey(); + + MI_CpuCopy32( (u32*)AESi_ResetAesKeyA + 0, (u32*)REG_AES_KEY_A1_ADDR, 40 ); + + AES_Unlock(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_ResetAesKeyB + + Description: set SEED/ID/KEYs filler data for slot-C + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void AESi_ResetAesKeyB( void ) +{ + AES_Lock(); + AES_WaitKey(); + + MI_CpuCopy32( (u32*)AESi_ResetAesKeyB + 1, (u32*)REG_AES_KEY_B1_ADDR, 40 ); + + AES_Unlock(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_ResetAesKeyB + + Description: set SEED/ID/KEYs filler data for slot-C + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void AESi_ResetAesKeyC( void ) +{ + AES_Lock(); + AES_WaitKey(); + + MI_CpuCopy32( (u32*)AESi_ResetAesKeyC + 2, (u32*)REG_AES_KEY_C1_ADDR, 40 ); + + AES_Unlock(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_ResetAesKeyD + + Description: set SEED/ID/KEYs filler data for slot-D + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +#if 0 // rebootライブラリに移動. +static inline void AESi_ResetAesKeyD( void ) +{ + AES_Lock(); + AES_WaitKey(); + + MI_CpuCopy32( (u32*)AESi_ResetAesKeyD + 3, (u32*)REG_AES_KEY_D1_ADDR, 40 ); + + AES_Unlock(); +} +#endif +/*---------------------------------------------------------------------------* + Name: AESi_InitKeysFIRM + + Description: set IDs depending on the application. + you SHOULD NOT touch any ID registers after this call. + + Arguments: game_code game code + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void AESi_InitKeysFIRM( void ) +{ + AESi_InitKeysForApp( (u8*)((ROM_Header_Short*)HW_TWL_ROM_HEADER_BUF)->game_code ); +// AESi_ResetAesKeyC(); +// AESi_ResetAesKey(); +} + +/*---------------------------------------------------------------------------* + Name: AESi_InitSeedWithRomHeader + + Description: set SEED/KEY from ROM header + + Arguments: rom_header ROM header + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_InitSeedWithRomHeader( ROM_Header* rom_header ); + +/*---------------------------------------------------------------------------* + Name: AESi_InitSeedWithRomHeader + + Description: set SEED/KEY from ROM header in HW_TWL_ROM_HEADER_BUF + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void AESi_InitSeed( void ) +{ + AESi_InitSeedWithRomHeader( (ROM_Header*)HW_TWL_ROM_HEADER_BUF ); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_AES_AES_INIT_H_ */ +#endif diff --git a/include/firm/fatfs.h b/include/firm/fatfs.h new file mode 100644 index 00000000..8e6ecd9c --- /dev/null +++ b/include/firm/fatfs.h @@ -0,0 +1,30 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fatfs + File: fatfs.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FATFS_H_ +#define FIRM_FATFS_H_ + +#ifdef SDK_ARM7 +#include +#include +#else +#include +#endif // SDK_ARM7 + + +/* FIRM_FATFS_H_ */ +#endif diff --git a/include/firm/fatfs/ARM7/fatfs_firm.h b/include/firm/fatfs/ARM7/fatfs_firm.h new file mode 100644 index 00000000..375a5a7b --- /dev/null +++ b/include/firm/fatfs/ARM7/fatfs_firm.h @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fatfs + File: fatfs.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FATFS_FATFS_FIRM_H_ +#define FIRM_FATFS_FATFS_FIRM_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FATFS_EnableAES + + Description: enable AES data path + + Arguments: counter initial counter value + + Returns: None + *---------------------------------------------------------------------------*/ +void FATFS_EnableAES( const AESCounter* pCounter ); + +/*---------------------------------------------------------------------------* + Name: FATFS_DisableAES + + Description: bypass AES + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FATFS_DisableAES( void ); + +/*---------------------------------------------------------------------------* + Name: FATFS_InitFIRM + + Description: init file system + + Arguments: nandContext : nand context to omit initialization (if any) + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_InitFIRM( void* nandContext ); + +/*---------------------------------------------------------------------------* + Name: FATFS_MountDriveFIRM + + Description: mount nand partition + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_MountDriveFIRM( int driveno, FATFSMediaType media, int partition_no ); + +/*---------------------------------------------------------------------------* + Name: FATFS_UnmountDriveFIRM + + Description: unmount specified partition + + 特殊なドライバの終了処理をします。 + + Arguments: driveno drive number "A:" is 0 + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_UnmountDriveFIRM( int driveno ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FATFS_FATFS_FIRM_H_ */ +#endif diff --git a/include/firm/fatfs/ARM7/fatfs_loader.h b/include/firm/fatfs/ARM7/fatfs_loader.h new file mode 100644 index 00000000..0df8c70d --- /dev/null +++ b/include/firm/fatfs/ARM7/fatfs_loader.h @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fatfs + File: fatfs_loader.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FATFS_FATFS_LOADER_H_ +#define FIRM_FATFS_FATFS_LOADER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FATFS_OpenRecentMenu + + Description: open recent menu file + + Arguments: driveno drive number ('A' is 0) + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_OpenRecentMenu( int driveno ); + +/*---------------------------------------------------------------------------* + Name: FATFS_OpenSpecifiedSrl + + Description: open specified menu file + + Arguments: menufile target filename + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_OpenSpecifiedSrl( const char* menufile ); + +/*---------------------------------------------------------------------------* + Name: FATFS_SaveSrlFilename + + Description: store filename to HW_TWL_FS_BOOT_SRL_PATH_BUF + + ファイル名をHW_TWL_FS_BOOT_SRL_PATH_BUFに書き込みます。 + + Arguments: media media type + filename target filename + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_SaveSrlFilename( FATFSMediaType media, const char* filename ); + +/*---------------------------------------------------------------------------* + Name: FATFS_GetSrlDescriptor + + Description: open specified menu file + + 任意のファイルをオープンし、ファイルIDをmenu_fdにセットします。 + + Arguments: None + + Returns: int + *---------------------------------------------------------------------------*/ +int FATFS_GetSrlDescriptor( void ); + +/*---------------------------------------------------------------------------* + Name: FATFS_SetSrlDescriptor + + Description: set current file descriptor that was opened outside + + オープン済みのファイルIDをmenu_fdにセットします。 + + Arguments: None + + Returns: int + *---------------------------------------------------------------------------*/ +void FATFS_SetSrlDescriptor( int fd ); + +/*---------------------------------------------------------------------------* + Name: FATFS_LoadBuffer + + Description: load data and pass to ARM9 via WRAM[B] + + LoadBufferメカニズムで、FAT中のファイルの内容をARM9に転送します。 + + [LoadBufferメカニズム] + WRAM[B]を利用して、ARM7,ARM9間のデータ転送を行います。 + WRAM[B]の各スロットをバケツリレー方式で渡します。 + 1スロット分のデータまたは全データが格納できたとき、ARM9へ + FIRM_PXI_ID_LOAD_PIRIODを送信します。 + データ残がある場合は次のスロットの処理に移ります。 + 2回目以降の呼び出しでは、前回最後のスロットの続きから使用します。 + 使用したいスロットがARM9側に割り当てられているときは、ARM7側に + なるまでストールします。 + + [使用条件] + WRAM[B]をロックせず、初期状態としてARM7側に倒しておくこと。 + + [注意点] + offsetとsizeはARM9に通知されません。別の経路で同期を取ってください。 + SRLファイルを読み込む場合は、互いにROMヘッダを参照できれば十分です。 + (ROMヘッダ部分は元から知っているはず) + + 補足: + ここでは、あるライブラリ内でARM7/ARM9側で歩調を合わせられることを + 前提にしているが、汎用的にするには(独立ライブラリ化するなら)、 + 送受信でスロットを半分ずつとし、それぞれに受信側のPXIコールバック + &スレッドを用意し、送信側APIがデータをWRAMに格納した後、他方に + destとsizeを通知するという形でOKではないか? + (で完了したら返事を返す) + + 補足2: + 一度に複数スロットを使えそうな場合は、一気にpo_readした方が速い。 + ARM9からデータ内容を触る予定がないなら、本APIを使わず、普通に + 直接メインメモリに転送した方が速い。 + + Arguments: offset offset of the file to load (512 bytes alignment) + size size to load + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL FATFS_LoadBuffer(u32 offset, u32 size); + +/*---------------------------------------------------------------------------* + Name: FATFS_LoadHeader + + Description: load menu header + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FATFS_LoadHeader( void ); + +/*---------------------------------------------------------------------------* + Name: FATFS_LoadStatic + + Description: load static binary + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FATFS_LoadStatic( void ); + +/*---------------------------------------------------------------------------* + Name: FATFS_Boot + + Description: boot + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FATFS_Boot( void ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FATFS_FATFS_LOADER_H_ */ +#endif diff --git a/include/firm/fatfs/ARM9/fatfs_firm.h b/include/firm/fatfs/ARM9/fatfs_firm.h new file mode 100644 index 00000000..757b7a83 --- /dev/null +++ b/include/firm/fatfs/ARM9/fatfs_firm.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fatfs + File: fatfs_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FATFS_FATFS_FIRM_H_ +#define FIRM_FATFS_FATFS_FIRM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FATFS_InitFIRM + + Description: initialize fatfs for firm + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FATFS_InitFIRM( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FATFS_FATFS_FIRM_H_ */ +#endif diff --git a/include/firm/format/firm_common.h b/include/firm/format/firm_common.h new file mode 100644 index 00000000..404ec28b --- /dev/null +++ b/include/firm/format/firm_common.h @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - firm + File: firm_common.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_FIRM_COMMON_H_ +#define FIRM_FORMAT_FIRM_COMMON_H_ + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +// 常駐モジュール情報 +typedef struct +{ + u32 rom_offset; /* 転送元 ROM オフセット */ + u32 decomp_size; /* 展開サイズ */ + void *ram_address; /* 転送先 RAM オフセット */ + u32 size; /* 転送サイズ */ +} +FIRMHeader_ModuleInfo; + +// DS-IPL2ヘッダ +typedef struct +{ + u16 reserved_0h[4]; + u32 ds_key; + u16 ds_arm9_romAdr; + u16 ds_arm9_ramAdr; + u16 ds_arm7_romAdr; + u16 ds_arm7_ramAdr; + u16 ds_arm9_romOffsetUnit:3; + u16 ds_arm9_ramOffsetUnit:3; + u16 ds_arm7_romOffsetUnit:3; + u16 ds_arm7_ramOffsetUnit:3; + u16 :2; + u16 ds_header_ver:2; + u16 ds_data_romAdr; + u64 card_key; + u16 ncd_romAdr; + u16 reserved_24h[2]; + u16 ds_data_crc16; +} +NORHeaderDS; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // FIRM_FORMAT_FIRM_COMMON_H_ diff --git a/include/firm/format/from_brom.h b/include/firm/format/from_brom.h new file mode 100644 index 00000000..bc586310 --- /dev/null +++ b/include/firm/format/from_brom.h @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - from_brom + File: from_brom.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_FROM_BROM_H_ +#define FIRM_FORMAT_FROM_BROM_H_ + +#include +#include +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 +#define RSA_PUBKEY_NUM_FROM_BROM 8 +#define AESKEY_NUM_FROM_BROM 8 +#else // SDK_ARM7 +#define RSA_PUBKEY_NUM_FROM_BROM 4 +#define AESKEY_NUM_FROM_BROM 4 +#endif // SDK_ARM7 + + +// sizeof(SDPortContext) +typedef struct SDportContextData +{ + u32 data[17]; +} +SDPortContextData; + +/* + hash_table_hashは、ファームヘッダの署名の中に埋められた値(現状0x00で埋められている) + 未使用の場合(現状)、0x00で埋められていることを確認すべき +*/ +typedef struct +{ + union + { + NANDHeader nand; + NORHeader nor; + GCDHeader gcd; + u8 max[0x400]; + } + header; // 1KB + + u8 rsa_pubkey[RSA_PUBKEY_NUM_FROM_BROM][ACS_PUBKEY_LEN]; // 1KB + u8 aes_key[AESKEY_NUM_FROM_BROM][ACS_AES_LEN]; // 128B + u8 hash_table_hash[ACS_HASH_LEN]; // 20B + + BLOWFISH_CTX ds_blowfish; // 4KB + α + BLOWFISH_CTX twl_blowfish; // 4KB + α +} +OSFromBrom9Buf; + +typedef struct +{ + union + { + NANDHeader nand; + NORHeader nor; + GCDHeader gcd; + u8 max[0x400]; + } + header; // 1KB + + u8 rsa_pubkey[RSA_PUBKEY_NUM_FROM_BROM][ACS_PUBKEY_LEN]; // 512B + u8 aes_key[AESKEY_NUM_FROM_BROM][ACS_AES_LEN]; // 64B + u8 hash_table_hash[ACS_HASH_LEN]; // 20B + + BLOWFISH_CTX twl_blowfish[2]; // (4KB + α) * 2 + + SDPortContextData SDNandContext; +} +OSFromBrom7Buf; + +#ifdef SDK_ARM9 +typedef OSFromBrom9Buf OSFromBromBuf; +#else // SDK_ARM7 +typedef OSFromBrom7Buf OSFromBromBuf; +#endif // SDK_ARM7 + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // FIRM_FORMAT_FROM_BROM_H_ diff --git a/include/firm/format/from_firm.h b/include/firm/format/from_firm.h new file mode 100644 index 00000000..fdc6ce82 --- /dev/null +++ b/include/firm/format/from_firm.h @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - from_firm + File: from_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_FROM_FIRM_H_ +#define FIRM_FORMAT_FROM_FIRM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 +#define RSA_PUBKEY_NUM_FROM_FIRM 8 +#define AESKEY_NUM_FROM_FIRM 8 +#else // SDK_ARM7 +#define RSA_PUBKEY_NUM_FROM_FIRM 4 +#define AESKEY_NUM_FROM_FIRM 4 +#endif // SDK_ARM7 + +/* + reservedは、ファームヘッダの署名の中に埋められた値(現状0x00で埋められている) + 未使用の場合(現状)、0x00で埋められていることを確認すべき +*/ + +typedef struct +{ + u8 rsa_pubkey[RSA_PUBKEY_NUM_FROM_FIRM][ACS_PUBKEY_LEN]; // 1KB + u8 aes_key[AESKEY_NUM_FROM_FIRM][ACS_AES_LEN]; // 128B + u8 reserved[ACS_HASH_LEN]; // 20B + + BLOWFISH_CTX ds_blowfish; // 4KB + α + BLOWFISH_CTX twl_blowfish; // 4KB + α +} +OSFromFirm9Buf; + +typedef struct +{ + u8 rsa_pubkey[RSA_PUBKEY_NUM_FROM_FIRM][ACS_PUBKEY_LEN]; // 512B + u8 aes_key[AESKEY_NUM_FROM_FIRM][ACS_AES_LEN]; // 64B + u8 reserved[ACS_HASH_LEN]; // 20B + + BLOWFISH_CTX twl_blowfish[2]; // (4KB + α) * 2 +} +OSFromFirm7Buf; + +#ifdef SDK_ARM9 +typedef OSFromFirm9Buf OSFromFirmBuf; +#else // SDK_ARM7 +typedef OSFromFirm7Buf OSFromFirmBuf; +#endif // SDK_ARM7 + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // FIRM_FORMAT_FROM_FIRM_H_ diff --git a/include/firm/format/gcdfirm.h b/include/firm/format/gcdfirm.h new file mode 100644 index 00000000..fd3ebbb9 --- /dev/null +++ b/include/firm/format/gcdfirm.h @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - gcdfirm + File: gcdfirm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_GCDFIRM_H_ +#define FIRM_FORMAT_GCDFIRM_H_ + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*===========================================================================* + * NOR FORMAT + *===========================================================================*/ + +//--------------------------------------------------------------------------- +// Section A NOR HEADER +//--------------------------------------------------------------------------- + +// 常駐モジュール情報 +typedef FIRMHeader_ModuleInfo GCDHeader_ModuleInfo; + +// TWL-GCDファームヘッダ +typedef struct +{ + /* 0x000-0x020 [システム予約領域] */ + u8 reserved_0h[0x14]; + u8 rom_size; // Rom size (2のrom_size乗 Mbit: ex. 128Mbitのときrom_size = 7) + u8 reserved_16h[0xb]; + + /* 0x020-0x040 [常駐モジュール用パラメータ] */ + u32 main_rom_offset; /* ARM9 転送元 ROM オフセット */ + u32 main_decomp_size; /* ARM9 展開サイズ */ + void *main_ram_address; /* ARM9 転送先 RAM オフセット */ + u32 main_size; /* ARM9 転送サイズ */ + u32 sub_rom_offset; /* ARM7 転送元 ROM オフセット */ + u32 sub_decomp_size; /* ARM9 展開サイズ */ + void *sub_ram_address; /* ARM7 転送先 RAM オフセット */ + u32 sub_size; /* ARM7 転送サイズ */ + + /* 0x040-0x080 [システム予約領域] */ + u8 reserved_40h[0x40]; + + /* 0x080-0x090 [ファームバイナリ情報] */ + u32 nandfirm_offset; // address of rom_valid_size + u32 nandfirm_size; // address of rom_header_size + u32 norfirm_offset; // address of main_module_param + u32 norfirm_size; // address of sub_module_param + + /* 0x090-0x094 [TWL-ROMコントロール] */ + u16 normal_area_offset; + u16 twl_area_offset; + + /* 0x094-0x0b8 [システム予約領域] */ + u8 reserved_98h[0x24]; + + /* 0x0b8-0x0c0 [追加データ] */ + u32 append_offset; + u32 append_size; + + /* 0x0c0-0x100 [DSカードNINTENDOロゴ重複領域] */ + u8 reserved_C0h[0x3f]; + + u8 comp_arm9_boot_area:1; // Compress arm9 boot area + u8 comp_arm7_boot_area:1; // Compress arm7 boot area + u8 arm9_x2:1; + u8 :0; +} +GCDHeaderLow; + +typedef struct +{ + /* 0x180-0x1b0 [WRAMレジスタパラメータ] */ + MIHeader_WramRegs w; + + /* 0x1b0-0x200 [システム予約領域] */ + u8 reserved_footer[0x50]; +} +GCDHeaderHigh; + +// GCDヘッダ +typedef struct +{ + /* 0x000-0x100 */ + GCDHeaderLow l; + + /* 0x100-0x180 */ + FIRMPaddedSign sign; + + /* 0x180-0x200 */ + GCDHeaderHigh h; +} +GCDHeader; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif //FIRM_FORMAT_GCDFIRM_H_ diff --git a/include/firm/format/nandfirm.h b/include/firm/format/nandfirm.h new file mode 100644 index 00000000..68b9ad66 --- /dev/null +++ b/include/firm/format/nandfirm.h @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - nandfirm + File: nandfirm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_NAND_H_ +#define FIRM_FORMAT_NAND_H_ + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*===========================================================================* + * NAND FORMAT + *===========================================================================*/ + +//--------------------------------------------------------------------------- +// Section A NAND HEADER +//--------------------------------------------------------------------------- + +// 常駐モジュール情報 +typedef FIRMHeader_ModuleInfo NANDHeader_ModuleInfo; + +// TWL-NANDファームヘッダ +typedef struct +{ + /* 0x000-0x020 [システム予約領域] */ + u8 reserved_0h[0x20]; /* システム予約 A */ + + /* 0x020-0x040 [常駐モジュール用パラメータ] */ + u32 main_rom_offset; /* ARM9 転送元 ROM オフセット */ + u32 main_decomp_size; /* ARM9 展開サイズ */ + void *main_ram_address; /* ARM9 転送先 RAM オフセット */ + u32 main_size; /* ARM9 転送サイズ */ + u32 sub_rom_offset; /* ARM7 転送元 ROM オフセット */ + u32 sub_decomp_size; /* ARM9 展開サイズ */ + void *sub_ram_address; /* ARM7 転送先 RAM オフセット */ + u32 sub_size; /* ARM7 転送サイズ */ + + /* 0x040-0x0c0 [システム予約領域] */ + u8 reserved_40h[0x80]; + + /* 0x0c0-0x100 [DSカードNINTENDOロゴ重複領域] */ + u8 reserved_C0h[0x3f]; + + u8 comp_arm9_boot_area:1; // Compress arm9 boot area + u8 comp_arm7_boot_area:1; // Compress arm7 boot area + u8 arm9_x2:1; + u8 arm9_decomp:1; + u8 :0; +} +NANDHeaderLow; + +typedef struct +{ + /* 0x180-0x1b0 [WRAMレジスタパラメータ] */ + MIHeader_WramRegs w; + + /* 0x1b0-0x200 [システム予約領域] */ + u8 reserved_footer[0x50]; +} +NANDHeaderHigh; + +// NANDヘッダ +typedef struct +{ + /* 0x000-0x028 [DS-NORヘッダ] */ + NORHeaderDS d; + + /* 0x028-0x200 [システム予約領域(署名外)] */ + u8 reserved_mbr[512 - sizeof(NORHeaderDS)]; + + /* 0x200-0x300 */ + NANDHeaderLow l; + + /* 0x300-0x380 */ + FIRMPaddedSign sign; + + /* 0x380-0x400 */ + NANDHeaderHigh h; +} +NANDHeader; + +// 冗長化ヘッダ (冗長部分) +typedef struct +{ + /* 0x400-0x500 *//* 0x600-0x700 */ + NANDHeaderLow l; + + /* 0x500-0x580 *//* 0x700-0x780 */ + FIRMPaddedSign sign; + + /* 0x580-0x600 *//* 0x780-0x800 */ + NANDHeaderHigh h; +} +NANDHeaderCore; + +// 冗長化ヘッダ (全体) +typedef struct +{ + /* 0x000-0x400 [実際に使用されるヘッダ] */ + NANDHeader g; + /* 0x400-0x600 [デフォルト位置イメージに対するヘッダ] */ + NANDHeaderCore o; + /* 0x600-0x800 [一時待避位置イメージに対するヘッダ] */ + NANDHeaderCore m; +} +NANDHeaderEx; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif //FIRM_FORMAT_NAND_H_ diff --git a/include/firm/format/norfirm.h b/include/firm/format/norfirm.h new file mode 100644 index 00000000..27587fa8 --- /dev/null +++ b/include/firm/format/norfirm.h @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - norfirm + File: norfirm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_NOR_H_ +#define FIRM_FORMAT_NOR_H_ + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*===========================================================================* + * NOR FORMAT + *===========================================================================*/ + +//--------------------------------------------------------------------------- +// Section A NOR HEADER +//--------------------------------------------------------------------------- + +// 常駐モジュール情報 +typedef FIRMHeader_ModuleInfo NORHeader_ModuleInfo; + +// TWL-NORファームヘッダ +typedef struct +{ + /* 0x000-0x020 [システム予約領域] */ + u8 reserved_0h[0x20]; /* システム予約 A */ + + /* 0x020-0x040 [常駐モジュール用パラメータ] */ + u32 main_rom_offset; /* ARM9 転送元 ROM オフセット */ + u32 main_decomp_size; /* ARM9 展開サイズ */ + void *main_ram_address; /* ARM9 転送先 RAM オフセット */ + u32 main_size; /* ARM9 転送サイズ */ + u32 sub_rom_offset; /* ARM7 転送元 ROM オフセット */ + u32 sub_decomp_size; /* ARM9 展開サイズ */ + void *sub_ram_address; /* ARM7 転送先 RAM オフセット */ + u32 sub_size; /* ARM7 転送サイズ */ + + /* 0x040-0x0c0 [システム予約領域] */ + u8 reserved_40h[0x80]; + + /* 0x0c0-0x100 [DSカードNINTENDOロゴ重複領域] */ + u8 reserved_C0h[0x3f]; + + u8 comp_arm9_boot_area:1; // Compress arm9 boot area + u8 comp_arm7_boot_area:1; // Compress arm7 boot area + u8 arm9_x2:1; + u8 arm9_decomp:1; + u8 :2; + u8 baudrate:1; + u8 boot_nandfirm:1; +} +NORHeaderLow; + +typedef struct +{ + /* 0x180-0x1b0 [WRAMレジスタパラメータ] */ + MIHeader_WramRegs w; + + /* 0x1b0-0x200 [システム予約領域] */ + u8 reserved_footer[0x50]; +} +NORHeaderHigh; + +// NORヘッダ +typedef struct +{ + /* 0x000-0x028 */ + NORHeaderDS d; + + /* 0x028-0x200 */ + u8 wl_params[472]; + + /* 0x200-0x300 */ + NORHeaderLow l; + + /* 0x300-0x380 */ + FIRMPaddedSign sign; + + /* 0x380-0x400 */ + NORHeaderHigh h; +} +NORHeader; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif //FIRM_FORMAT_NOR_H_ diff --git a/include/firm/format/sign.h b/include/firm/format/sign.h new file mode 100644 index 00000000..07f2a358 --- /dev/null +++ b/include/firm/format/sign.h @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - format - sign + File: sign.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FORMAT_SIGN_H_ +#define FORMAT_SIGN_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + +// signed hash index +typedef enum +{ + FIRM_SIGNED_HASH_IDX_HEADER = 0, + FIRM_SIGNED_HASH_IDX_ARM9 = 1, + FIRM_SIGNED_HASH_IDX_ARM7 = 2, + FIRM_SIGNED_HASH_IDX_HASH_TABLE = 3, + FIRM_SIGNED_HASH_IDX_FINAL = 4, + + FIRM_SIGNED_HASH_NUM = 5 +} +FIRMSignedHashIndex; + + +#define ACS_BASE_BLOCK_SIZE 4096 // should be the multiple of 16 +#define ACS_META_BLOCK_SIZE 5120 // should be the multiple of 16 and the multiple of 20 + // would be the multiple of 512, then the mutilple of 2560 + +#define ACS_PUBKEY_LEN 128 +#define ACS_HASH_LEN 20 +#define ACS_AES_LEN 16 + +#define ACS_ENCRYPTED_HASH_LEN ACS_PUBKEY_LEN +#define ACS_DECRYPTED_HASH_LEN ACS_HASH_LEN + +#define ACS_RSA_EXP 0x00010001 +#define ACS_RSA_EXP_LEN 3 + +// DER format of RSA keys + +#define ACS_RSA_PRVMOD_OFFSET 0x0B +#define ACS_RSA_PRVEXP_OFFSET 0x93 +#define ACS_RSA_PRVMOD_LEN 128 +#define ACS_RSA_PRVEXP_LEN 128 + +#define ACS_RSA_PUBMOD_OFFSET 0x1D +#define ACS_RSA_PUBEXP_OFFSET 0x93 +#define ACS_RSA_PUBMOD_LEN 128 +//#define ACS_RSA_PUBEXP_LEN ACS_RSA_EXP_LEN + +#define FIRM_HEADER_2ND_HASH_AREA_LEN (sizeof(FIRMSignedContext) - ACS_HASH_LEN) + + +// 署名コンテキスト +typedef struct +{ + unsigned char aes_key[ACS_AES_LEN]; + unsigned char hash[FIRM_SIGNED_HASH_NUM][ACS_HASH_LEN]; +} +FIRMSignedContext; + +// 署名 +typedef union +{ + struct + { + unsigned char prePad[(ACS_ENCRYPTED_HASH_LEN - sizeof(FIRMSignedContext))-1]; + FIRMSignedContext c; + unsigned char postPad[1]; + } + e; + unsigned int raw[ACS_ENCRYPTED_HASH_LEN/4]; +} +FIRMPaddedSign; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif //FORMAT_SIGN_H_ diff --git a/include/firm/format/wram_regs.h b/include/firm/format/wram_regs.h new file mode 100644 index 00000000..08c8d19c --- /dev/null +++ b/include/firm/format/wram_regs.h @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - MI - include + File: wram_regs.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_FORMAT_WRAM_REGS_H_ +#define FIRM_FORMAT_WRAM_REGS_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef enum +{ + MI_WRAM_A_OFFSET_0KB = 0, + MI_WRAM_A_OFFSET_64KB = 1, + MI_WRAM_A_OFFSET_128KB = 2, + MI_WRAM_A_OFFSET_192KB = 3 +} MIWramAOffset; + +typedef enum +{ + MI_WRAM_BC_OFFSET_0KB = 0, + MI_WRAM_BC_OFFSET_32KB = 1, + MI_WRAM_BC_OFFSET_64KB = 2, + MI_WRAM_BC_OFFSET_96KB = 3, + MI_WRAM_BC_OFFSET_128KB = 4, + MI_WRAM_BC_OFFSET_160KB = 5, + MI_WRAM_BC_OFFSET_192KB = 6, + MI_WRAM_BC_OFFSET_224KB = 7 +} MIWramBCOffset; + + +#define MI_WRAM_MAP_NULL HW_WRAM_AREA + +#define REG_WRAM_MAP_CONV_ADDR( regno, abc, border, addr ) \ +( \ + ((((addr) - HW_WRAM_AREA) / MI_WRAM_##abc##_SLOT_SIZE) & \ + (REG_MI_MBK##regno##_W##abc##_##border##_MASK >> \ + REG_MI_MBK##regno##_W##abc##_##border##_SHIFT)) \ +) + + +// WRAMマッピングレジスタ +typedef struct +{ + u8 main_wrambnk_a[4]; // ARM9 SCFG_MBK1 + u8 main_wrambnk_b[8]; // ARM9 SCFG_MBK2-3 + u8 main_wrambnk_c[8]; // ARM9 SCFG_MBK4-5 + + u32 main_wrammap_a; // ARM9 SCFG_MBK6 + u32 main_wrammap_b; // ARM9 SCFG_MBK7 + u32 main_wrammap_c; // ARM9 SCFG_MBK8 + + u32 sub_wrammap_a; // ARM7 SCFG_MBK6 + u32 sub_wrammap_b; // ARM7 SCFG_MBK7 + u32 sub_wrammap_c; // ARM7 SCFG_MBK8 + + u8 sub_wramlock[3]; // ARM7 SCFG_MBK9 + + u8 main_wrambnk_01:2; // ARM9 RBKCNT1_H + u8 main_vrambnk_c:3; // ARM9 RBKCNT0_H + u8 main_vrambnk_d:3; // ARM9 RBKCNT0_H +} +MIHeader_WramRegs; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_FORMAT_WRAM_REGS_H_ */ +#endif diff --git a/include/firm/fs.h b/include/firm/fs.h new file mode 100644 index 00000000..38abac56 --- /dev/null +++ b/include/firm/fs.h @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_H_ +#define FIRM_FS_H_ + +#ifdef SDK_ARM7 +#include +#include +#include +#else +#include +#include +#endif // SDK_ARM7 + + +/* FIRM_FS_H_ */ +#endif diff --git a/include/firm/fs/ARM7/fs_firm.h b/include/firm/fs/ARM7/fs_firm.h new file mode 100644 index 00000000..f28ad873 --- /dev/null +++ b/include/firm/fs/ARM7/fs_firm.h @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_FIRM_H_ +#define FIRM_FS_FS_FIRM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_InitMountInfo + + Description: set mount info for firm + + Arguments: nand TRUE if set nand entry + sdmc TRUE if set sdmc entry + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_InitMountInfo( BOOL nand, BOOL sdmc ); + +/*---------------------------------------------------------------------------* + Name: FS_OpenSrl + + Description: open srl file named in HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: None + + Returns: file discriptor + *---------------------------------------------------------------------------*/ +int FS_OpenSrl( void ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_FIRM_H_ */ +#endif diff --git a/include/firm/fs/ARM7/fs_firm_ex.h b/include/firm/fs/ARM7/fs_firm_ex.h new file mode 100644 index 00000000..4b99e92f --- /dev/null +++ b/include/firm/fs/ARM7/fs_firm_ex.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs_firm_ex.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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_FIRM_EX_H_ +#define FIRM_FS_FS_FIRM_EX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_SetMountInfoForSrl + + Description: set mount info for srl file + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_SetMountInfoForSrl( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_FIRM_EX_H_ */ +#endif diff --git a/include/firm/fs/ARM7/fs_loader.h b/include/firm/fs/ARM7/fs_loader.h new file mode 100644 index 00000000..1ff82cc0 --- /dev/null +++ b/include/firm/fs/ARM7/fs_loader.h @@ -0,0 +1,85 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_LOADER_H_ +#define FIRM_FS_FS_LOADER_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: load data in file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + size total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( int fd, u32 offset, u32 size ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: load data in file and pass to ARM9 via WRAM-B in view of AES + settings in the ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + offset offset to start to read in bytes + size total length to read in bytes + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( int fd, u32 offset, u32 size ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: load ROM header in the head of file and pass to ARM9 via WRAM-B + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( int fd ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: load static regions in file and pass to ARM9 via WRAM-B + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: fd file discriptor to read + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( int fd ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_LOADER_H_ */ +#endif diff --git a/include/firm/fs/ARM9/fs_firm.h b/include/firm/fs/ARM9/fs_firm.h new file mode 100644 index 00000000..fc9dd5d6 --- /dev/null +++ b/include/firm/fs/ARM9/fs_firm.h @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_FIRM_H_ +#define FIRM_FS_FS_FIRM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_InitFIRM + + Description: initialize FS/FATFS for firm + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void FS_InitFIRM( void ); + +/*---------------------------------------------------------------------------* + Name: FS_GetTitleBootContentPathFast + + Description: NAND にインストールされているアプリの実行ファイルのパスを + 取得します。 + 取得する情報の正当性を検証しないため高速ですが、 + 情報が改竄されている可能性があることに注意しなければなりません。 + + Arguments: buf: パスを格納するバッファへのポインタ。 + FS_ENTRY_LONGNAME_MAX 以上のサイズが必要です。 + titleId: パスを取得するアプリの Title ID。 + + Returns: 正常に処理が行われたなら TRUE を返します。 + *---------------------------------------------------------------------------*/ +BOOL FS_GetTitleBootContentPathFast(char* buf, OSTitleId titleId); + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrl + + Description: resolve srl filename and store to HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: titleId title id for srl file + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_ResolveSrl( OSTitleId titleId ); + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrlList + + Description: resolve srl filename with list and store to + HW_TWL_FS_BOOT_SRL_PATH_BUF + + Arguments: titleIdList pointer to title id array for srl file + nums number of title id + + Returns: -1 if failed, otherwise succeeded titile id number + *---------------------------------------------------------------------------*/ +int FS_ResolveSrlList( const OSTitleId* titleIdList, u32 nums ); + +/*---------------------------------------------------------------------------* + Name: FS_ResolveSrlUnsecured + + Description: resolve srl filename and store to HW_TWL_FS_BOOT_SRL_PATH_BUF + without almost security check + + Arguments: titleId title id for srl file + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_ResolveSrlUnsecured( OSTitleId titleId ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_FIRM_H_ */ +#endif diff --git a/include/firm/fs/ARM9/fs_loader.h b/include/firm/fs/ARM9/fs_loader.h new file mode 100644 index 00000000..10f193a3 --- /dev/null +++ b/include/firm/fs/ARM9/fs_loader.h @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - fs + File: fs_loader.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_FS_FS_LOADER_H_ +#define FIRM_FS_FS_LOADER_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: FS_LoadBuffer + + Description: receive data from ARM7 via WRAM-B and store in destination address, + calculate SHA1 in parallel if ctx is specified + + Arguments: dest destination address to read + size total length to read in bytes + ctx pointer to SHA1 context or NULL + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadBuffer( u8* dest, u32 size, SVCSHA1Context *ctx ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadModule + + Description: receive data from ARM7 via WRAM-B and store in destination address + in view of AES settings in the ROM header at HW_TWL_ROM_HEADER_BUF, + then verify the digest + + Arguments: dest destination address to read + offset file offset to start to read in bytes + size total length to read in bytes + digest digest to verify + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadModule( u8* dest, u32 offset, u32 size, const u8 digest[SVC_SHA1_BLOCK_SIZE] ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadHeader + + Description: receive ROM header, store to HW_TWL_ROM_HEADER_BUF, + and verify signature + + Arguments: pool heap context to call SVC_DecryptSign + rsa_key_user public key to verify the signature for user application + rsa_key_sys public key to verify the signature for system application + rsa_key_secure public key to verify the signature for secure application + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadHeader( SVCSignHeapContext* pool, const void* rsa_key_user, const void* rsa_key_sys, const void* rsa_key_secure ); + +/*---------------------------------------------------------------------------* + Name: FS_LoadStatic + + Description: receive static regions from ARM6 via WRAM-B and store them + specified by ROM header at HW_TWL_ROM_HEADER_BUF + + Arguments: digestKey pointer to key for HMAC-SHA1 + if NULL, use default key + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL FS_LoadStatic( const u8* digestKey ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_FS_FS_LOADER_H_ */ +#endif diff --git a/include/firm/gcd/blowfish.h b/include/firm/gcd/blowfish.h new file mode 100644 index 00000000..bba522a4 --- /dev/null +++ b/include/firm/gcd/blowfish.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - GCD - include + File: blowfish.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_GCD_BLOWFISH_H +#define FIRM_GCD_BLOWFISH_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + u32 P[16 + 2]; + u32 S[4][256]; +} BLOWFISH_CTX; + + +void InitBlowfish(BLOWFISH_CTX *ctx, const unsigned char *key, int keyLen); +void EncryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr); +void DecryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // FIRM_GCD_BLOWFISH_H diff --git a/include/firm/hw/ARM7/mmap_firm.h b/include/firm/hw/ARM7/mmap_firm.h new file mode 100644 index 00000000..d37685e2 --- /dev/null +++ b/include/firm/hw/ARM7/mmap_firm.h @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - HW - include + File: mmap_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_HW_MMAP_FIRM_H_ +#define FIRM_HW_MMAP_FIRM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------- FIRM_SVC_STACK +#define HW_FIRM_SVC_STACK (HW_FIRM_SVC_STACK_END-HW_FIRM_SVC_STACK_SIZE) +#define HW_FIRM_SVC_STACK_END (HW_WRAM_AREA_END - HW_PRV_WRAM_SYSRV_SIZE) +#define HW_FIRM_SVC_STACK_SIZE HW_SVC_STACK_SIZE + +//------------------------------------- FIRM_IRQ_STACK +#define HW_FIRM_IRQ_STACK (HW_FIRM_IRQ_STACK_END-HW_FIRM_IRQ_STACK_SIZE) +#define HW_FIRM_IRQ_STACK_END HW_FIRM_SVC_STACK +#define HW_FIRM_IRQ_STACK_SIZE SDK_IRQ_STACKSIZE + +//------------------------------------- FIRM_FROM_BROM_BUF +#define HW_FIRM_FROM_BROM_BUF (HW_FIRM_FROM_BROM_BUF_END - HW_FIRM_FROM_BROM_BUF_SIZE) +#define HW_FIRM_FROM_BROM_BUF_END (HW_WRAM_AREA_END - 0x1000) // END - 4KB +#define HW_FIRM_FROM_BROM_BUF_SIZE 0x3000 // 12KB + +//------------------------------------- FIRM_FROM_FIRM_BUF +#define HW_FIRM_FROM_FIRM_BUF (HW_FIRM_FROM_FIRM_BUF_END - HW_FIRM_FROM_FIRM_BUF_SIZE) +#define HW_FIRM_FROM_FIRM_BUF_END (HW_WRAM_AREA_END - 0x1000) // END - 4KB +#define HW_FIRM_FROM_FIRM_BUF_SIZE 0x2C00 // 11KB + +//------------------------------------- FIRM_MOUNT_INFO_BUF +extern void SDK_MOUNT_INFO_TABLE(void); +#define HW_FIRM_MOUNT_INFO_BUF (u32)SDK_MOUNT_INFO_TABLE +#define HW_FIRM_MOUNT_INFO_BUF_END (HW_FIRM_MOUNT_INFO_BUF + HW_FIRM_MOUNT_INFO_BUF_SIZE) +#define HW_FIRM_MOUNT_INFO_BUF_SIZE 0x3C0 + +//------------------------------------- FIRM_BOOT_SRL_PATH_BUF +#define HW_FIRM_BOOT_SRL_PATH_BUF HW_FIRM_MOUNT_INFO_BUF_END +#define HW_FIRM_BOOT_SRL_PATH_BUF_END (HW_FIRM_BOOT_SRL_PATH_BUF + HW_FIRM_BOOT_SRL_PATH_BUF_SIZE) +#define HW_FIRM_BOOT_SRL_PATH_BUF_SIZE FS_ENTRY_LONGNAME_MAX + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_HW_MMAP_FIRM_H_ */ +#endif diff --git a/include/firm/hw/ARM9/mmap_firm.h b/include/firm/hw/ARM9/mmap_firm.h new file mode 100644 index 00000000..6ba729c2 --- /dev/null +++ b/include/firm/hw/ARM9/mmap_firm.h @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - HW - include + File: mmap_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_HW_MMAP_FIRM_H_ +#define FIRM_HW_MMAP_FIRM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------- FIRM_RESET_BUF +#define HW_FIRM_RESET_BUF HW_MAIN_MEM +#define HW_FIRM_RESET_BUF_END (HW_FIRM_RESET_BUF + HW_FIRM_RESET_BUF_SIZE) +//#define HW_FIRM_RESET_BUF_SIZE 0x400 // 12KB +#define HW_FIRM_RESET_BUF_SIZE 0x800000 // 8MB + +//------------------------------------- FIRM_RSA_BUF +#define HW_FIRM_RSA_BUF (HW_FIRM_RSA_BUF_END - HW_FIRM_RSA_BUF_SIZE) +#define HW_FIRM_RSA_BUF_END HW_FIRM_ES_BUF +#define HW_FIRM_RSA_BUF_SIZE 0x3000 // 12KB + +//------------------------------------- FIRM_ES_BUF +#define HW_FIRM_ES_BUF (HW_FIRM_ES_BUF_END - HW_FIRM_ES_BUF_SIZE) +#define HW_FIRM_ES_BUF_END HW_FIRM_FROM_BROM_BUF +#define HW_FIRM_ES_BUF_SIZE 0x1000 // 4KB + +//------------------------------------- FIRM_FROM_BROM_BUF +#define HW_FIRM_FROM_BROM_BUF (HW_FIRM_FROM_BROM_BUF_END - HW_FIRM_FROM_BROM_BUF_SIZE) +#define HW_FIRM_FROM_BROM_BUF_END (HW_ITCM_END - 0x1000) // END - 4KB +#define HW_FIRM_FROM_BROM_BUF_SIZE 0x3000 // 12KB + +//------------------------------------- FIRM_FROM_FIRM_BUF +#define HW_FIRM_FROM_FIRM_BUF (HW_FIRM_FROM_FIRM_BUF_END - HW_FIRM_FROM_FIRM_BUF_SIZE) +#define HW_FIRM_FROM_FIRM_BUF_END (HW_ITCM_END - 0x1000) // END - 4KB +#define HW_FIRM_FROM_FIRM_BUF_SIZE 0x2C00 // 11KB + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_HW_MMAP_FIRM_H_ */ +#endif diff --git a/include/firm/hw/common/mmap_firm.h b/include/firm/hw/common/mmap_firm.h new file mode 100644 index 00000000..a50868b5 --- /dev/null +++ b/include/firm/hw/common/mmap_firm.h @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - HW - include + File: mmap_firm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_HW_COMMON_MMAP_FIRM_H_ +#define FIRM_HW_COMMON_MMAP_FIRM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define HW_FIRM_ROUNDUP32(x) ( ((x) + 31) & -32 ) + +//------------------------------------- *_LoadBuffer +#define HW_FIRM_LOAD_BUFFER_BASE HW_WRAM_AREA +#define HW_FIRM_LOAD_BUFFER_UNIT_SIZE 0x8000 +#define HW_FIRM_LOAD_BUFFER_UNIT_NUMS 7 +#define HW_FIRM_LOAD_BUFFER_SIZE (HW_FIRM_LOAD_BUFFER_UNIT_SIZE * HW_FIRM_LOAD_BUFFER_UNIT_NUMS) +#define HW_FIRM_LOAD_BUFFER_END (HW_FIRM_LOAD_BUFFER_BASE + HW_FIRM_LOAD_BUFFER_SIZE) + +//------------------------------------- FS/FATFS +#define HW_FIRM_FS_MOUNT_INFO_BUF_SIZE (HW_TWL_FS_BOOT_SRL_PATH_BUF - HW_TWL_FS_MOUNT_INFO_BUF) +#define HW_FIRM_FS_BOOT_SRL_PATH_BUF_SIZE (HW_TWL_ROM_HEADER_BUF - HW_TWL_FS_BOOT_SRL_PATH_BUF) + +#define HW_FIRM_FATFS_ARCHNAME_LIST (HW_FIRM_FATFS_ARCHNAME_LIST_END - HW_FIRM_FATFS_ARCHNAME_LIST_SIZE) // 0x02fee120 +#define HW_FIRM_FATFS_ARCHNAME_LIST_SIZE MATH_ROUNDUP(OS_MOUNT_ARCHIVE_NAME_LEN * OS_MOUNT_INFO_MAX + 1, 32) // 0xc0 +#define HW_FIRM_FATFS_ARCHNAME_LIST_END HW_FIRM_FATFS_COMMAND_BUFFER // 0x2fee1e0 + +#define HW_FIRM_FATFS_COMMAND_BUFFER (HW_FIRM_FATFS_COMMAND_BUFFER_END - HW_FIRM_FATFS_COMMAND_BUFFER_SIZE) +#define HW_FIRM_FATFS_COMMAND_BUFFER_SIZE FATFS_COMMAND_BUFFER_MAX // 0x1000 +#define HW_FIRM_FATFS_COMMAND_BUFFER_END HW_FIRM_FS_FATFS_DRIVE // 0x2fef1e0 + +#define HW_FIRM_FS_FATFS_DRIVE (HW_FIRM_FS_FATFS_DRIVE_END - HW_FIRM_FS_FATFS_DRIVE_SIZE) +#define HW_FIRM_FS_FATFS_DRIVE_SIZE HW_FIRM_ROUNDUP32(sizeof(FSFATFSArchiveContext[FS_MOUNTDRIVE_MAX])) // 0x1cc0 +#define HW_FIRM_FS_FATFS_DRIVE_END HW_FIRM_FS_FATFS_ASYNC_REQUEST // 0x02ff0ea0 + +#define HW_FIRM_FS_FATFS_ASYNC_REQUEST (HW_FIRM_FS_FATFS_ASYNC_REQUEST_END - HW_FIRM_FS_FATFS_ASYNC_REQUEST_SIZE) +#define HW_FIRM_FS_FATFS_ASYNC_REQUEST_SIZE HW_FIRM_ROUNDUP32(sizeof(FATFSRequestBuffer[FS_MOUNTDRIVE_MAX])) // 0x5960 +#define HW_FIRM_FS_FATFS_ASYNC_REQUEST_END HW_FIRM_FS_TEMP_BUFFER // 0x02ff6800 + +#define HW_FIRM_FS_TEMP_BUFFER (HW_FIRM_FS_TEMP_BUFFER_END - HW_FIRM_FS_TEMP_BUFFER_SIZE) +#define HW_FIRM_FS_TEMP_BUFFER_SIZE FS_TEMPORARY_BUFFER_MAX // 0x5800 +#define HW_FIRM_FS_TEMP_BUFFER_END HW_TWL_MAIN_MEM_SHARED // 0x02ffc000 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_HW_COMMON_MMAP_FIRM_H_ */ +#endif diff --git a/include/firm/memorymap.h b/include/firm/memorymap.h new file mode 100644 index 00000000..fa95b481 --- /dev/null +++ b/include/firm/memorymap.h @@ -0,0 +1,30 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - HW + File: memorymap.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_MEMORYMAP_H_ +#define FIRM_MEMORYMAP_H_ + +#include +#include + +#ifdef SDK_ARM9 +#include +#else //SDK_ARM7 +#include +#endif + +/* FIRM_MEMORYMAP_H_ */ +#endif diff --git a/include/firm/mi.h b/include/firm/mi.h new file mode 100644 index 00000000..475c4c18 --- /dev/null +++ b/include/firm/mi.h @@ -0,0 +1,30 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - MI + File: mi.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_MI_H_ +#define FIRM_MI_H_ + +#include + +#include +#include +#ifdef SDK_ARM9 +#include +#endif + +/* FIRM_MI_H_ */ +#endif diff --git a/include/firm/mi/ARM9/mi_loader.h b/include/firm/mi/ARM9/mi_loader.h new file mode 100644 index 00000000..86350ba3 --- /dev/null +++ b/include/firm/mi/ARM9/mi_loader.h @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - mi + File: mi_loader.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_MI_LOADER_H_ +#define FIRM_MI_LOADER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: MIi_LoadBuffer + + Description: receive data from ARM7 and store(move) via WRAM[B] + + LoadBufferメカニズムで、ファイルの内容をARM7から受け取ります。 + 引数でSVCSHA1Contextを指定していた場合、コピーのついでにSHA1の + 計算も行います。 + + [LoadBufferメカニズム] + WRAM[B]を利用して、ARM7,ARM9間のデータ転送を行います。 + WRAM[B]の各スロットをバケツリレー方式で渡します。 + 1スロット分のデータまたは全データが格納されたとき、ARM7から + FIRM_PXI_ID_LOAD_PIRIODを受信します。 + ARM9は受信後にそのスロットの使用権をARM9に変更してデータを + 取り出し、完了後にメモリをクリアして(セキュリティ)、使用権を + ARM7に戻します。 + + [使用条件] + WRAM[B]をロックせず、初期状態としてARM7側に倒しておくこと。 + + [注意点] + offsetとsizeはARM7から通知されません。別の経路で同期を取ってください。 + SRLファイルを読み込む場合は、互いにROMヘッダを参照できれば十分です。 + (ROMヘッダ部分は元から知っているはず) + + 補足: + ここでは、あるライブラリ内でARM7/ARM9側で歩調を合わせられることを + 前提にしているが、汎用的にするには(独立ライブラリ化するなら)、 + 送受信でスロットを半分ずつとし、それぞれに受信側のPXIコールバック + &スレッドを用意し、送信側APIがデータをWRAMに格納した後、他方に + destとsizeを通知するという形でOKではないか? + (で完了したら返事を返す) + + Arguments: dest destination address for received data + size size to load + ctx context for SHA1 if execute SVC_SHA1Update + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL MI_LoadBuffer(u8* dest, u32 size, SVCSHA1Context *ctx); + +/*---------------------------------------------------------------------------* + Name: MI_LoadHeader + + Description: load header + + Arguments: pool pointer to the pool info for SVCSignHeapContext + rsa_key key address + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL MI_LoadHeader( SVCSignHeapContext* pool, const void* rsa_key ); + +/*---------------------------------------------------------------------------* + Name: MI_LoadStatic + + Description: load static binary + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL MI_LoadStatic( void ); + +/*---------------------------------------------------------------------------* + Name: MI_Boot + + Description: boot + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void MI_Boot( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/* FIRM_MI_LOADER_H_ */ +#endif diff --git a/include/firm/mi/exDma.h b/include/firm/mi/exDma.h new file mode 100644 index 00000000..38d8ec16 --- /dev/null +++ b/include/firm/mi/exDma.h @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - mi + File: exDma.h + + Copyright 2007 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 TWL_MI_EXDMA_H_ +#define TWL_MI_EXDMA_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------- + +//---- registers +typedef struct +{ + const void * src; + void * dest; + u32 totalCount; + u32 wordCount; + u32 blockInterval; + u32 fillData; + u32 ctrl; +} +t_MIExDmaChanRegs; + +typedef volatile t_MIExDmaChanRegs MIExDmaChanRegs; + + +//================================================================================ +// DMA control definition +//================================================================================ +//---- DMA channel No. +#define MI_EXDMA_CH_MIN 4 +#define MI_EXDMA_CH_MAX 7 + +#define MI_EXDMA_CH_NUM 4 + + +//================================================================================ +// DMA WAIT +//================================================================================ +/*---------------------------------------------------------------------------* + Name: MIi_IsExDmaBusy + + Description: check whether extended DMA is busy or not + + Arguments: dmaNo : DMA channel No. + + Returns: TRUE if extended DMA is busy, FALSE if not + *---------------------------------------------------------------------------*/ +BOOL MIi_IsExDmaBusy( u32 dmaNo ); + +/*---------------------------------------------------------------------------* + Name: MIi_WaitExDma + + Description: wait while extended DMA is busy + + Arguments: dmaNo : DMA channel No. + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_WaitExDma( u32 dmaNo ); + +/*---------------------------------------------------------------------------* + Name: MIi_StopExDma + + Description: stop extended DMA + + Arguments: dmaNo : DMA channel No. + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_StopExDma( u32 dmaNo ); + +/*---------------------------------------------------------------------------* + Name: MIi_StopDmaAsync + + Description: stop extended DMA + async version + + Arguments: dmaNo : DMA channel No. + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_StopExDmaAsync( u32 dmaNo ); + +//================================================================================ +// memory operation using DMA +//================================================================================ +/*---------------------------------------------------------------------------* + Name: MIi_ExDmaSendAsync + + Description: send data with DMA + sync version + + Arguments: dmaNo : DMA channel No. + dest : destination address + src : source address + size : size (byte) + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_ExDmaSendAsync( u32 dmaNo, const void *src, void *dest, u32 size ); + +/*---------------------------------------------------------------------------* + Name: MIi_ExDmaRecvAsync + + Description: receive data with DMA + sync version + + Arguments: dmaNo : DMA channel No. + dest : destination address + src : source address + size : size (byte) + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_ExDmaRecvAsync( u32 dmaNo, const void *src, void *dest, u32 size ); + +//----------------- internel functions ------------------- +/*---------------------------------------------------------------------------* + Name: MIi_ExDmaSendAsyncCore + + Description: send data with DMA + async version + + Arguments: dmaNo : DMA channel No. + dest : destination address + src : source address + size : size (byte) + blockSize : block size + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_ExDmaSendAsyncCore( u32 dmaNo, const void *src, void *dest, u32 size, u32 oneShotSize, + u32 blockSize, u32 interval, u32 prescale, + u32 continuous, u32 srcRld, u32 destRld, + u32 timing ); + +/*---------------------------------------------------------------------------* + Name: MIi_ExDmaRecvAsyncCore + + Description: receive data with DMA + async version + + Arguments: dmaNo : DMA channel No. + dest : destination address + src : source address + size : size (byte) + blockSize : block size + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_ExDmaRecvAsyncCore( u32 dmaNo, const void *src, void *dest, u32 size, u32 oneShotSize, + u32 blockSize, u32 interval, u32 prescale, + u32 continuous, u32 srcRld, u32 destRld, + u32 timing ); + +/*---------------------------------------------------------------------------* + Name: MIi_SetExDmaParams + + Description: set DMA + + Arguments: dmaNo : DMA channel No. + dest : destination address + src : source address + size : size (byte) + blockSize : block size + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_SetExDmaParams( u32 dmaNo, const void *src, void *dest, u32 size, u32 oneShotSize, + u32 blockSize, u32 interval, u32 prescale, + u32 continuous, u32 srcRld, u32 destRld, + u32 timing, + u32 fillData, u32 srcDir, u32 destDir); + + +#ifdef __cplusplus +} /* extern "C" */ + +#endif + +/* TWL_MI_EXDMA_H_ */ +#endif diff --git a/include/firm/mi/mainMemory.h b/include/firm/mi/mainMemory.h new file mode 100644 index 00000000..2726d9de --- /dev/null +++ b/include/firm/mi/mainMemory.h @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - MI + File: mainMemory.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_MI_MAINMEMORY_H_ +#define FIRM_MI_MAINMEMORY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + u16 cr0; + u16 cr1; + u16 cr2; +} +MIMmemCR; + +//---------------------------------------------------------------------- +// メインメモリ CRコマンド +//---------------------------------------------------------------------- + +// for DS-PSRAM + +// CR0 +#define MMEM_DCR0_PARTIAL_REFRESH_NONE 0x0003 // パーシャルリフレッシュ無し +#define MMEM_DCR0_BURST_CONTINUOUS 0x001c // 連続バースト(224バイト) +#define MMEM_DCR0_BURST_MODE 0x0000 // バーストモード +#define MMEM_DCR0_PAGE_MODE 0x0020 // ページモード +#define MMEM_DCR0_SB1 0xffc0 // 1固定 + +// CR1 +#define MMEM_DCR1_1ST_R4_W3 0x0002 // 1stR/W = 4/3 +#define MMEM_DCR1_BURST_WRITE 0x0000 // バーストライト +#define MMEM_DCR1_CLOCK_TRIGGER_UP 0x0100 // クロック立上り +#define MMEM_DCR1_BURST_LINER 0x0200 // バーストリニア・シーケンス +#define MMEM_DCR1_SB1 0xe430 // 1固定 + +// CR2 +#define MMEM_DCR2_SB1 0x004003fe // 1固定 +#define MMEM_DCR2_CLOCK_TRIGGER_UP 0x00000400 // クロック立上り +#define MMEM_DCR2_BURST_WRITE 0x00000000 // バーストライト +#define MMEM_DCR2_BURST_LINER 0x00001000 // バーストリニア・シーケンス +#define MMEM_DCR2_1ST_R4_W3 0x00004000 // 1stR/W = 4/3 +#define MMEM_DCR2_BURST_MODE 0x00000000 // バーストモード +#define MMEM_DCR2_PAGE_MODE 0x00010000 // ページモード +#define MMEM_DCR2_BURST_CONTINUOUS 0x000e0000 // 連続バースト(224バイト) +#define MMEM_DCR2_PARTIAL_REFRESH_NONE 0x00300000 // パーシャルリフレッシュ無し + +// for TWL-PSRAM + +// CR0 +#define MMEM_TCR0_SET 0x0001 // セット +#define MMEM_TCR0_VERIFY 0x0000 // ベリファイ +#define MMEM_TCR0_SB1 0xfffe // 1固定 + +#define MMEM_TCR0 (MMEM_TCR0_SET | \ + MMEM_TCR0_SB1) // 0xFFFF + +#define MMEM_TCR0_R (MMEM_TCR0_VERIFY | \ + MMEM_TCR0_SB1) // 0xFFFE + +// CR1 +#define MMEM_TCR1_PARTIAL_REFRESH_8MB 0x0002 // パーシャルリフレッシュ先頭8MB +#define MMEM_TCR1_PARTIAL_REFRESH_NONE 0x0003 // パーシャルリフレッシュなし(DSモード時) +#define MMEM_TCR1_BURST_CONTINUOUS 0x001c // 連続バースト(224バイト) +#define MMEM_TCR1_BURST_MODE 0x0000 // バーストモード +#define MMEM_TCR1_DRV_SZ_CENTER 0x00c0 // ドライバーサイズ=中心 +#define MMEM_TCR1_SB1 0xff00 // 1固定 + +#define MMEM_TCR1 (MMEM_TCR1_PARTIAL_REFRESH_8MB | \ + MMEM_TCR1_BURST_CONTINUOUS | \ + MMEM_TCR1_BURST_MODE | \ + MMEM_TCR1_DRV_SZ_CENTER | \ + MMEM_TCR1_SB1) // 0xFFDE + +#define MMEM_TCR1_DS (MMEM_TCR1 | MMEM_TCR1_PARTIAL_REFRESH_NONE) // 0xFFDF + +// CR2 +#define MMEM_TCR2_1ST_R4_W3 0x0002 // 1stR/W = 4/3 +#define MMEM_TCR2_REMAIN_PRV_MODE 0x0040 // 前モード保持 +#define MMEM_TCR2_WE_LEVEL 0x0080 // WEレベルコントロール +#define MMEM_TCR2_SB1 0xff28 // 1固定 + +#define MMEM_TCR2 (MMEM_TCR2_1ST_R4_W3 | \ + MMEM_TCR2_REMAIN_PRV_MODE | \ + MMEM_TCR2_WE_LEVEL | \ + MMEM_TCR2_SB1) // 0xFFEA + + +/*---------------------------------------------------------------------------* + Name: MIi_InitMainMemCR + + Description: change main memory into the burst mode + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_InitMainMemCR( BOOL setCR ); + +void MIi_GetMainMemCR( MIMmemCR* dest ); + +/*---------------------------------------------------------------------------* + Name: MIi_IsMainMemoryInitialized + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL MIi_IsMainMemoryInitialized( void ); + +/*---------------------------------------------------------------------------* + Name: MIi_WaitMainMemoryInitialize + + Description: + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void MIi_WaitMainMemoryInitialize( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_MI_MAINMEMORY_H_ */ +#endif diff --git a/include/firm/misc.h b/include/firm/misc.h new file mode 100644 index 00000000..36d3cfc4 --- /dev/null +++ b/include/firm/misc.h @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - + File: misc.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_MISC_H_ +#define FIRM_MISC_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define offsetof(t, memb) ((size_t)(&(((t *)0)->memb))) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_MISC_H_ */ +#endif diff --git a/include/firm/nvram.h b/include/firm/nvram.h new file mode 100644 index 00000000..ea9e4c89 --- /dev/null +++ b/include/firm/nvram.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - NVRAM + File: nvram.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_NVRAM_H_ +#define FIRM_NVRAM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 +#else // SDK_ARM7 + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ +void NVRAMi_Read(u32 address, void *buf, u32 size); +void NVRAMi_Write(u32 address, void *buf, u32 size); + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_NVRAM_H_ */ +#endif diff --git a/include/firm/os.h b/include/firm/os.h new file mode 100644 index 00000000..f91cfcf3 --- /dev/null +++ b/include/firm/os.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS + File: os.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_OS_H_ +#define FIRM_OS_H_ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_OS_H_ */ +#endif diff --git a/include/firm/os/ARM9/os_cache_tag.h b/include/firm/os/ARM9/os_cache_tag.h new file mode 100644 index 00000000..7116eaf6 --- /dev/null +++ b/include/firm/os/ARM9/os_cache_tag.h @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS - include + File: os_cache_tag.h + + Copyright 2007 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 TWL_OS_CACHE_TAG_H_ +#define TWL_OS_CACHE_TAG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +//=========================================================================== +// DATA CACHE (for specified range) +//=========================================================================== +/*---------------------------------------------------------------------------* + Name: DC_ClearTagAll + + Description: clear tag in data cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_ClearTagAll( void ); + +/*---------------------------------------------------------------------------* + Name: DC_ClearDataAll + + Description: clear data in data cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_ClearDataAll( void ); + +/*---------------------------------------------------------------------------* + Name: DC_FillTagAll + + Description: clear tag in data cache + + Arguments: data : fill data + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_FillTagAll( u32 data ); + +/*---------------------------------------------------------------------------* + Name: DC_FillDataAll + + Description: fill data in data cache + + Arguments: data : fill data + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_FillDataAll( u32 data ); + +/*---------------------------------------------------------------------------* + Name: DC_GetTagAndDataAll + + Description: get tag and data in data cache + + Arguments: tag tag address + data data address + + Returns: None. + *---------------------------------------------------------------------------*/ +void DC_GetTagAndDataAll( void* tag, void* data ); + +//=========================================================================== +// INSTRUCTION CACHE +//=========================================================================== +/*---------------------------------------------------------------------------* + Name: IC_ClearTagAll + + Description: clear tag in instruction cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void IC_ClearTagAll( void ); + +/*---------------------------------------------------------------------------* + Name: IC_ClearInstructionAll + + Description: clear instruction in instruction cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void IC_ClearInstructionAll( void ); + +/*---------------------------------------------------------------------------* + Name: IC_FillTagAll + + Description: fill tag in instruction cache + + Arguments: None + + Returns: None. + *---------------------------------------------------------------------------*/ +void IC_FillTagAll( u32 data ); + +/*---------------------------------------------------------------------------* + Name: IC_FillInstructionAll + + Description: fill instruction in instruction cache + + Arguments: data : fill data + + Returns: None. + *---------------------------------------------------------------------------*/ +void IC_FillInstructionAll( u32 data ); + +/*---------------------------------------------------------------------------* + Name: IC_GetTagAndInstructionAll + + Description: get tag and instruction in instruction cache + + Arguments: tag tag address + inst instruction address + + Returns: None. + *---------------------------------------------------------------------------*/ +void IC_GetTagAndInstructionAll( void* tag, void* inst ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_OS_CACHE_TAG_H_ */ +#endif diff --git a/include/firm/os/common/boot.h b/include/firm/os/common/boot.h new file mode 100644 index 00000000..5a3335ff --- /dev/null +++ b/include/firm/os/common/boot.h @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS - include + File: boot.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_OS_BOOT_H_ +#define FIRM_OS_BOOT_H_ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: OS_BootWithRomHeaderFromFIRM + + Description: boot with ROM header + + Arguments: rom_header : ROM header + + Returns: None + *---------------------------------------------------------------------------*/ +void OS_BootWithRomHeaderFromFIRM( ROM_Header* rom_header ); + +/*---------------------------------------------------------------------------* + Name: OS_BootFromFIRM + + Description: boot system menu using ROM_Header in HW_TWL_ROM_HEADER_BUF + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void OS_BootFromFIRM( void ) +{ + OS_BootWithRomHeaderFromFIRM( (ROM_Header*)HW_TWL_ROM_HEADER_BUF ); +} + +/*---------------------------------------------------------------------------* + Name: OSi_FromBromToMenu + + Description: convert OSFromBromBuf to OSFromFirmBuf + + Arguments: None + + Returns: FALSE if FromBrom is broken + *---------------------------------------------------------------------------*/ +BOOL OSi_FromBromToMenu( void ); + +/*---------------------------------------------------------------------------* + Name: OSi_GetFromBromAddr + + Description: data address from bootrom to firm + + Arguments: None + + Returns: address + *---------------------------------------------------------------------------*/ +static inline OSFromBromBuf* const OSi_GetFromBromAddr( void ) +{ + return (OSFromBromBuf*)HW_FIRM_FROM_BROM_BUF; +} + +/*---------------------------------------------------------------------------* + Name: OSi_GetFromFirmAddr + + Description: data address from firm to menu + + Arguments: None + + Returns: address + *---------------------------------------------------------------------------*/ +static inline OSFromFirmBuf* const OSi_GetFromFirmAddr( void ) +{ + return (OSFromFirmBuf*)HW_FIRM_FROM_FIRM_BUF; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_OS_BOOT_H_ */ +#endif diff --git a/include/firm/os/common/init.h b/include/firm/os/common/init.h new file mode 100644 index 00000000..45e596ca --- /dev/null +++ b/include/firm/os/common/init.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - OS - include + File: init.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_OS_INIT_H_ +#define FIRM_OS_INIT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: OS_InitFIRM + + Description: initialize sdk os for firm + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void OS_InitFIRM(void); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_OS_INIT_H_ */ +#endif diff --git a/include/firm/os/common/system.h b/include/firm/os/common/system.h new file mode 100644 index 00000000..2cdd5f8c --- /dev/null +++ b/include/firm/os/common/system.h @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - OS - include + File: system.h + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_FIRM_OS_SYSTEM_H_ +#define TWL_FIRM_OS_SYSTEM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------------- + +typedef u32 OSCpuCycle; + +#define OS_CPU_CLOCK HW_CPU_CLOCK + +//---- sec to cpu cycle +// 150nsec - 30sec +#define OS_SEC_TO_CPUCYC( sec ) ((OSCpuCycle)( ( OS_CPU_CLOCK * (u32)(sec)) )) +#define OS_MSEC_TO_CPUCYC( msec ) ((OSCpuCycle)( ((OS_CPU_CLOCK/1000) * (u32)(msec)) )) +#define OS_USEC_TO_CPUCYC( usec ) ((OSCpuCycle)( ((OS_CPU_CLOCK/1000) * (u32)(usec)) / 1000 )) +#define OS_NSEC_TO_CPUCYC( nsec ) ((OSCpuCycle)( ((OS_CPU_CLOCK/1000) * (u32)(nsec)) / (1000 * 1000) )) + +//---- cpu cycle to sec +// 150nsec - 30sec +#define OS_CPUCYC_TO_SEC( cyc ) ( ((u32)(cyc) ) / OS_CPU_CLOCK ) +#define OS_CPUCYC_TO_MSEC( cyc ) ( ((u32)(cyc) ) / (OS_CPU_CLOCK/1000) ) +#define OS_CPUCYC_TO_USEC( cyc ) ( ((u32)(cyc) * 1000) / (OS_CPU_CLOCK/1000) ) +#define OS_CPUCYC_TO_NSEC( cyc ) ( ((u32)(cyc) * 1000 * 1000) / (OS_CPU_CLOCK/1000) ) + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_FIRM_OS_SYSTEM_H_ */ +#endif diff --git a/include/firm/os/common/tick_brom.h b/include/firm/os/common/tick_brom.h new file mode 100644 index 00000000..c0471bfd --- /dev/null +++ b/include/firm/os/common/tick_brom.h @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------* + Project: TwlBromSDK - OS - include + File: tick_addin.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FRIM_OS_TICK_BROM_H_ +#define FRIM_OS_TICK_BROM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +//---- sec to tick +#define OS_MicroSecondsToTicksBROM( usec ) ((OSTick)( ((OS_SYSTEM_CLOCK/1000) * (u64)(usec)) / 1024 / 1000 )) +#define OS_MicroSecondsToTicksBROM32( usec ) ((OSTick)( ((OS_SYSTEM_CLOCK/1000) * (u32)(usec)) / 1024 / 1000 )) + +#define OS_MilliSecondsToTicksBROM( msec ) ((OSTick)( ((OS_SYSTEM_CLOCK/1000) * (u64)(msec)) / 1024 )) +#define OS_MilliSecondsToTicksBROM32( msec ) ((OSTick)( ((OS_SYSTEM_CLOCK/1000) * (u32)(msec)) / 1024 )) + +#define OS_SecondsToTicksBROM( sec ) ((OSTick)( (OS_SYSTEM_CLOCK * (u64)(sec)) / 1024 )) +#define OS_SecondsToTicksBROM32( sec ) ((OSTick)( (OS_SYSTEM_CLOCK * (u32)(sec)) / 1024 )) + +//---- tick to sec +#define OS_TicksToMicroSecondsBROM( tick ) ( ((u64)(tick) * 1024 * 1000) / (OS_SYSTEM_CLOCK/1000) ) +#define OS_TicksToMicroSecondsBROM32( tick ) ( ((u32)(tick) * 1024 * 1000) / (OS_SYSTEM_CLOCK/1000) ) + +#define OS_TicksToMilliSecondsBROM( tick ) ( ((u64)(tick) * 1024) / (OS_SYSTEM_CLOCK/1000) ) +#define OS_TicksToMilliSecondsBROM32( tick ) ( ((u32)(tick) * 1024) / (OS_SYSTEM_CLOCK/1000) ) + +#define OS_TicksToSecondsBROM( tick ) ( ((u64)(tick) * 1024) / OS_SYSTEM_CLOCK ) +#define OS_TicksToSecondsBROM32( tick ) ( ((u32)(tick) * 1024) / OS_SYSTEM_CLOCK ) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FRIM_OS_TICK_BROM_H_ */ +#endif diff --git a/include/firm/pm.h b/include/firm/pm.h new file mode 100644 index 00000000..dfb8919a --- /dev/null +++ b/include/firm/pm.h @@ -0,0 +1,27 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - pm + File: pm.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PM_H_ +#define FIRM_PM_H_ + +#ifdef SDK_ARM7 +#include +#include +#endif // SDK_ARM7 + +/* FIRM_PM_H_ */ +#endif diff --git a/include/firm/pm/ARM7/pm_init.h b/include/firm/pm/ARM7/pm_init.h new file mode 100644 index 00000000..765e5fc1 --- /dev/null +++ b/include/firm/pm/ARM7/pm_init.h @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - pm + File: pm_init.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PM_ARM7_PM_INIT_H_ +#define FIRM_PM_ARM7_PM_INIT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Name: PM_InitFIRM + + Description: power B/L on + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_InitFIRM( void ); + +/*---------------------------------------------------------------------------* + Name: PM_BackLightOn + + Description: power B/L on if not set yet + + Arguments: force TRUE: wait until valid condition + FALSE not set unless valid condition + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_BackLightOn( BOOL force ); + +/*---------------------------------------------------------------------------* + Name: PM_Shutdown + + Description: shutdown + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void PM_Shutdown( void ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_PM_ARM7_PM_INIT_H_ */ +#endif diff --git a/include/firm/pm/ARM7/pm_pmic_ex.h b/include/firm/pm/ARM7/pm_pmic_ex.h new file mode 100644 index 00000000..36515905 --- /dev/null +++ b/include/firm/pm/ARM7/pm_pmic_ex.h @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - pm + File: pm_pmic_ex.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef FIRM_PM_PMIC_EX_H_ +#define FIRM_PM_PMIC_EX_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//================================================================================ +// PMIC ACCESS +//================================================================================ +/*---------------------------------------------------------------------------* + Name: PMi_SetParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetParams( u8 reg, u8 setBits, u8 maskBits ); + +/*---------------------------------------------------------------------------* + Name: PMi_SetFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_SetFlags( u8 reg, u8 setBits ); + +/*---------------------------------------------------------------------------* + Name: PMi_ResetFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +void PMi_ResetFlags( u8 reg, u8 clrBits ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* FIRM_PM_PMIC_EX_H_ */ +#endif diff --git a/include/firm/pxi.h b/include/firm/pxi.h new file mode 100644 index 00000000..7290d329 --- /dev/null +++ b/include/firm/pxi.h @@ -0,0 +1,27 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - include - PXI + File: pxi.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PXI_H_ +#define FIRM_PXI_H_ + +#include + +#include +#include + +/* FIRM_PXI_H_ */ +#endif diff --git a/include/firm/pxi/common/misc.h b/include/firm/pxi/common/misc.h new file mode 100644 index 00000000..fa3cb6bf --- /dev/null +++ b/include/firm/pxi/common/misc.h @@ -0,0 +1,224 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - -include - PXI + File: misc.h + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PXI_COMMON_MISC_H_ +#define FIRM_PXI_COMMON_MISC_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// PXI sync ID for bootrom +typedef enum +{ + // from ARM7 + FIRM_PXI_ID_COLDBOOT = 1, // _start + FIRM_PXI_ID_WARMBOOT = 2, // _start + + FIRM_PXI_ID_INIT_ARM7 = 7, // PXI_InitFifoFIRM + + FIRM_PXI_ID_LOAD_HEADER = 6, // FATFS_LoadHeader + FIRM_PXI_ID_LOAD_STATIC = 5, // FATFS_LoadStatic + + FIRM_PXI_ID_LOAD_PIRIOD = 1, // *_LoadBuffer + + // from ARM9 + FIRM_PXI_ID_INIT_MMEM = 3, // _start + + FIRM_PXI_ID_INIT_ARM9 = 9, // PXI_InitFifoFIRM + + FIRM_PXI_ID_AUTH_HEADER = 10, // MI_LoadHeader + FIRM_PXI_ID_AUTH_STATIC = 11, // MI_LoadStatic + + FIRM_PXI_ID_SET_PATH = 4, // main (nandfirm) + FIRM_PXI_ID_DONE_HEADER = 5, // main (nandfirm) + FIRM_PXI_ID_DONE_STATIC = 6, // main (nandfirm) + + // from both of ARM9 and ARM7 + FIRM_PXI_ID_NULL = 0, + FIRM_PXI_ID_ERR = 0xF +} +FIRMPxiID; + + +/*---------------------------------------------------------------------------* + Name: PXI_InitFifoFIRM + + Description: initialize FIFO system for bootrom + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_InitFifoFIRM(void); + +/*---------------------------------------------------------------------------* + Name: PXI_NotifyID + + Description: send 4bit id to other processor + + Arguments: id notifying id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_NotifyID( u32 id ); + +/*---------------------------------------------------------------------------* + Name: PXI_WaitID + + Description: Wait 4bit id from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_WaitID( u32 id ); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvID + + Description: Receive 4bit id from the other processor + + Arguments: None + + Returns: id + *---------------------------------------------------------------------------*/ +u8 PXI_RecvID( void ); + +/*---------------------------------------------------------------------------* + Name: PXI_SendIDByIntf + + Description: send 4bit id to other processor + + Arguments: id notifying id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_SendIDByIntf( u32 id ); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvIDByIntf + + Description: receive 4bit id from the other processor + + Arguments: None + + Returns: received id + *---------------------------------------------------------------------------*/ +u32 PXI_RecvIDByIntf( void ); + +/*---------------------------------------------------------------------------* + Name: PXI_WaitIDByIntf + + Description: Wait 4bit id from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_WaitIDByIntf( u32 id ); + +/*---------------------------------------------------------------------------* + Name: PXI_SendIDByFifo + + Description: Send 32bit-word to another CPU via FIFO + + Arguments: + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_SendIDByFifo(PXIFifoTag tag, u32 id); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvIDByFifo + + Description: Recv 32bit-word from another CPU via FIFO + + Arguments: + + Returns: if error occured, returns minus value + *---------------------------------------------------------------------------*/ +PXIFifoStatus PXI_RecvIDByFifo(PXIFifoTag tag, void* buf); + +/*---------------------------------------------------------------------------* + Name: PXI_WaitIDByFifo + + Description: Wait 32bit-word from another CPU via FIFO + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_WaitIDByFifo(PXIFifoTag tag, u32 id); + +/*---------------------------------------------------------------------------* + Name: PXI_SendDataByFifo + + Description: Send 32bit-word to another CPU via FIFO + + Arguments: + + Returns: None + *---------------------------------------------------------------------------*/ +void PXI_SendDataByFifo(PXIFifoTag tag, void* buf, int size); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvDataByFifo + + Description: Recv 32bit-word to another CPU via FIFO + + Arguments: + + Returns: if error occured, returns minus value + *---------------------------------------------------------------------------*/ +PXIFifoStatus PXI_RecvDataByFifo(PXIFifoTag tag, void* buf, int max_size); + +/*---------------------------------------------------------------------------* + Name: PXI_IsSendFifoFull + + Description: Check if send fifo is full? + + Arguments: None. + + Returns: if send fifo is full + *---------------------------------------------------------------------------*/ +static inline BOOL PXI_IsSendFifoFull(void) +{ + return (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_SEND_FULL_MASK) >> REG_PXI_FIFO_CNT_SEND_FULL_SHIFT; +} + +/*---------------------------------------------------------------------------* + Name: PXI_IsRecvFifoEmpty + + Description: Check if receive fifo is empty? + + Arguments: None. + + Returns: if receive fifo is empty + *---------------------------------------------------------------------------*/ +static inline BOOL PXI_IsRecvFifoEmpty(void) +{ + return (reg_PXI_FIFO_CNT & REG_PXI_FIFO_CNT_RECV_EMP_MASK) >> REG_PXI_FIFO_CNT_RECV_EMP_SHIFT; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FIRM_PXI_COMMON_MISC_H_ */ diff --git a/include/firm/pxi/common/pxi_firm.h b/include/firm/pxi/common/pxi_firm.h new file mode 100644 index 00000000..2abcda25 --- /dev/null +++ b/include/firm/pxi/common/pxi_firm.h @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------* + Project: TwlFirm - -include - PXI + File: pxi_firm.h + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PXI_COMMON_FIRM_H_ +#define FIRM_PXI_COMMON_FIRM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// PXI sync ID for bootrom +typedef enum +{ + // from ARM7 + FIRM_PXI_ID_COLDBOOT = 1, // _start + FIRM_PXI_ID_WARMBOOT = 2, // _start + + FIRM_PXI_ID_INIT_ARM7 = 7, // PXI_InitFifoFIRM + + FIRM_PXI_ID_LOAD_HEADER = 6, // FATFS_LoadHeader + FIRM_PXI_ID_LOAD_STATIC = 5, // FATFS_LoadStatic + + FIRM_PXI_ID_LOAD_BUFFER_SEMAPHORE = 1, // *_LoadBuffer + + // from ARM9 + FIRM_PXI_ID_INIT_MMEM = 3, // _start + + FIRM_PXI_ID_INIT_ARM9 = 9, // PXI_InitFifoFIRM + + FIRM_PXI_ID_AUTH_HEADER = 10, // MI_LoadHeader + FIRM_PXI_ID_AUTH_STATIC = 11, // MI_LoadStatic + + FIRM_PXI_ID_SET_PATH = 4, // main (nandfirm) + FIRM_PXI_ID_DONE_HEADER = 5, // main (nandfirm) + FIRM_PXI_ID_DONE_STATIC = 6, // main (nandfirm) + + // from both of ARM9 and ARM7 + FIRM_PXI_ID_NULL = 0, + FIRM_PXI_ID_ERR = 0xF +} +FIRMPxiID; + + +/*---------------------------------------------------------------------------* + Name: PXI_InitFIRM + + Description: initialize PXI for firm + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_InitFIRM(void); + +/*---------------------------------------------------------------------------* + Name: PXI_SendStream + + Description: Send data stream + + Arguments: buf pointer to data buffer + size transfer size + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_SendStream( const void* buf, int size ); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvStream + + Description: Receive data stream + + Arguments: buf pointer to data buffer + size transfer size + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_RecvStream( void* buf, int size ); + +/*---------------------------------------------------------------------------* + Name: PXI_NotifyID + + Description: Send ID + + Arguments: id id to send + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_NotifyID( FIRMPxiID id ); + +/*---------------------------------------------------------------------------* + Name: PXI_RecvID + + Description: Receive ID + + Arguments: None + + Returns: Received ID + *---------------------------------------------------------------------------*/ +FIRMPxiID PXI_RecvID( void ); + +/*---------------------------------------------------------------------------* + Name: PXI_ReleaseLoadBufferSemaphore + + Description: Release semaphore for *_LoadBuffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_ReleaseLoadBufferSemaphore( void ); + +/*---------------------------------------------------------------------------* + Name: PXI_AcquireLoadBufferSemaphore + + Description: Acquire semaphore for *_LoadBuffer + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void PXI_AcquireLoadBufferSemaphore( void ); + +/*---------------------------------------------------------------------------* + Name: PXIi_SendIDByIntf + + Description: send 4bit id to other processor + + Arguments: id notifying id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXIi_SendIDByIntf( u32 id ); + +/*---------------------------------------------------------------------------* + Name: PXIi_RecvIDByIntf + + Description: receive 4bit id from the other processor + + Arguments: None + + Returns: received id + *---------------------------------------------------------------------------*/ +u32 PXIi_RecvIDByIntf( void ); + +/*---------------------------------------------------------------------------* + Name: PXIi_WaitIDByIntf + + Description: Wait 4bit id from the other processor + + Arguments: id waiting id + + Returns: None + *---------------------------------------------------------------------------*/ +void PXIi_WaitIDByIntf( u32 id ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* FIRM_PXI_COMMON_FIRM_H_ */ diff --git a/include/firm/pxi/common/regname_ex.h b/include/firm/pxi/common/regname_ex.h new file mode 100644 index 00000000..5883d6cf --- /dev/null +++ b/include/firm/pxi/common/regname_ex.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - include - PXI + File: regname.h + + Copyright 2007 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. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef FIRM_PXI_COMMON_REGNAME_EX_H_ +#define FIRM_PXI_COMMON_REGNAME_EX_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 + +#define REG_PXI_FIFO_CNT_SEND_FULL_SHIFT REG_PXI_SUBP_FIFO_CNT_SEND_FULL_SHIFT +#define REG_PXI_FIFO_CNT_RECV_EMP_SHIFT REG_PXI_SUBP_FIFO_CNT_RECV_EMP_SHIFT + +#else // SDK_ARM7 + +#define REG_PXI_FIFO_CNT_SEND_FULL_SHIFT REG_PXI_MAINP_FIFO_CNT_SEND_FULL_SHIFT +#define REG_PXI_FIFO_CNT_RECV_EMP_SHIFT REG_PXI_MAINP_FIFO_CNT_RECV_EMP_SHIFT + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif +/* FIRM_PXI_COMMON_REGNAME_EX_H_ */ +#endif diff --git a/include/firm/specfiles/ARM7-BB-FIRM.lcf.template b/include/firm/specfiles/ARM7-BB-FIRM.lcf.template new file mode 100644 index 00000000..a0176d4e --- /dev/null +++ b/include/firm/specfiles/ARM7-BB-FIRM.lcf.template @@ -0,0 +1,507 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM7-BB-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + check.WORKRAM (RWX) : ORIGIN = , LENGTH = 0x48000 > workram.check +} + +KEEP_SECTION +{ + .ctor +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(4); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + crt0_firm.o (.text) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.MAIN.START = 0x02380000; + SDK_AUTOLOAD.MAIN.END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.BSS_END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.SIZE = 0; + SDK_AUTOLOAD.MAIN.BSS_SIZE = 0; + SDK_AUTOLOAD.WRAM.START = 0x037f8000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_MAIN_START = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD_MAIN_END = SDK_AUTOLOAD.MAIN.END; + SDK_AUTOLOAD_MAIN_BSS_END = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_AUTOLOAD_MAIN_SIZE = SDK_AUTOLOAD.MAIN.SIZE; + SDK_AUTOLOAD_MAIN_BSS_SIZE = SDK_AUTOLOAD.MAIN.BSS_SIZE; + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(4); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_WRAM_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + + # work ram size checker + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.WORKRAM: + { + . = . + SDK_SECTION_ARENA_START - + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.WORKRAM +} diff --git a/include/firm/specfiles/ARM7-BB-FIRM.lsf b/include/firm/specfiles/ARM7-BB-FIRM.lsf new file mode 100644 index 00000000..42176502 --- /dev/null +++ b/include/firm/specfiles/ARM7-BB-FIRM.lsf @@ -0,0 +1,28 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM7-BB-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x037f8000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.wram) + StackSize 1024 512 +} diff --git a/include/firm/specfiles/ARM7-BB-GCDFIRM.lcf.template b/include/firm/specfiles/ARM7-BB-GCDFIRM.lcf.template new file mode 100644 index 00000000..ebabab94 --- /dev/null +++ b/include/firm/specfiles/ARM7-BB-GCDFIRM.lcf.template @@ -0,0 +1,507 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM7-BB-NORFIRM.lcf.template +# +# Copyright 2007 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:$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + check.WORKRAM (RWX) : ORIGIN = , LENGTH = 0x48000 > workram.check +} + +KEEP_SECTION +{ + .ctor +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(4); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + crt0.o (.text) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.MAIN.START = 0x02380000; + SDK_AUTOLOAD.MAIN.END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.BSS_END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.SIZE = 0; + SDK_AUTOLOAD.MAIN.BSS_SIZE = 0; + SDK_AUTOLOAD.WRAM.START = 0x037f8000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_MAIN_START = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD_MAIN_END = SDK_AUTOLOAD.MAIN.END; + SDK_AUTOLOAD_MAIN_BSS_END = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_AUTOLOAD_MAIN_SIZE = SDK_AUTOLOAD.MAIN.SIZE; + SDK_AUTOLOAD_MAIN_BSS_SIZE = SDK_AUTOLOAD.MAIN.BSS_SIZE; + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(4); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_WRAM_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + + # work ram size checker + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.WORKRAM: + { + . = . + SDK_SECTION_ARENA_START - + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.WORKRAM +} diff --git a/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf b/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf new file mode 100644 index 00000000..42176502 --- /dev/null +++ b/include/firm/specfiles/ARM7-BB-GCDFIRM.lsf @@ -0,0 +1,28 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM7-BB-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x037f8000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.wram) + StackSize 1024 512 +} diff --git a/include/firm/specfiles/ARM7-TS-FIRM.lcf.template b/include/firm/specfiles/ARM7-TS-FIRM.lcf.template new file mode 100644 index 00000000..263cba55 --- /dev/null +++ b/include/firm/specfiles/ARM7-TS-FIRM.lcf.template @@ -0,0 +1,419 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM7-TS-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + check.WORKRAM_SHARED (RWX) : ORIGIN = 0x037b8000, LENGTH = 0x48000 > workram.check + # reached OSFromBrom7Buf before OS_BOOT_CODE_BUF + check.WORKRAM (RWX) : ORIGIN = 0x037b8000, LENGTH = 0x54000 > workram.check + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.LTDMAIN (RWX) : ORIGIN = 0x02f88000, LENGTH = 0x74000 > ltdmain.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_STATIC_DATA_END =.; + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.WRAM.START = SDK_STATIC_BSS_END; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_MOUNT_INFO_TABLE = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(4); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ OTHERS ################################# + SDK_WRAM_ARENA_LO = SDK_AUTOLOAD_WRAM_BSS_END; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM_SHARED: + { + . = SDK_STATIC_END; + } > check.WORKRAM_SHARED + + .check.WORKRAM: + { + . = SDK_STATIC_BSS_END; + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = 0x02f88000; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02e80000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + .check.LTDMAIN: + { + . = SDK_SUBPRIV_ARENA_LO; + + } > check.LTDMAIN + +} diff --git a/include/firm/specfiles/ARM7-TS-FIRM.lsf b/include/firm/specfiles/ARM7-TS-FIRM.lsf new file mode 100644 index 00000000..df12edce --- /dev/null +++ b/include/firm/specfiles/ARM7-TS-FIRM.lsf @@ -0,0 +1,43 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM7-TS-FIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x037b8000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.etable) + Object * (.wram) + Object * (.rsvwram) + Object * (.ltdwram) + Object * (.ltdmain) + StackSize 1024 1024 +} + +#Autoload WRAM +#{ +# Address $(ADDRESS_LTDWRAM) +#} + +#Ltdautoload LTDMAIN +#{ +## Address 0x02f88000 +# Address 0x02380000 +#} diff --git a/include/firm/specfiles/ARM7-TS-GCDFIRM.lcf.template b/include/firm/specfiles/ARM7-TS-GCDFIRM.lcf.template new file mode 100644 index 00000000..c3244f8a --- /dev/null +++ b/include/firm/specfiles/ARM7-TS-GCDFIRM.lcf.template @@ -0,0 +1,507 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM7-TS-NORFIRM.lcf.template +# +# Copyright 2007 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:$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + check.WORKRAM (RWX) : ORIGIN = , LENGTH = 0x48000 > workram.check +} + +KEEP_SECTION +{ + .ctor +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(4); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + crt0.o (.text) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.MAIN.START = 0x02380000; + SDK_AUTOLOAD.MAIN.END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.BSS_END = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD.MAIN.SIZE = 0; + SDK_AUTOLOAD.MAIN.BSS_SIZE = 0; + SDK_AUTOLOAD.WRAM.START = 0x037f8000; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_MAIN_START = SDK_AUTOLOAD.MAIN.START; + SDK_AUTOLOAD_MAIN_END = SDK_AUTOLOAD.MAIN.END; + SDK_AUTOLOAD_MAIN_BSS_END = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_AUTOLOAD_MAIN_SIZE = SDK_AUTOLOAD.MAIN.SIZE; + SDK_AUTOLOAD_MAIN_BSS_SIZE = SDK_AUTOLOAD.MAIN.BSS_SIZE; + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(4); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(4); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(4); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(4); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(4); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_AUTOLOAD.MAIN.BSS_END; + SDK_WRAM_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + + # work ram size checker + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.WORKRAM: + { + . = . + SDK_SECTION_ARENA_START - + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.WORKRAM +} diff --git a/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf b/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf new file mode 100644 index 00000000..d4f5d88b --- /dev/null +++ b/include/firm/specfiles/ARM7-TS-GCDFIRM.lsf @@ -0,0 +1,28 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM7-TS-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x037f8000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.wram) + StackSize 1024 512 +} diff --git a/include/firm/specfiles/ARM7-TS-PARTNER.lcf.template b/include/firm/specfiles/ARM7-TS-PARTNER.lcf.template new file mode 100644 index 00000000..2d8d14ee --- /dev/null +++ b/include/firm/specfiles/ARM7-TS-PARTNER.lcf.template @@ -0,0 +1,407 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM7-TS-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 #> + + + (RWX) : ORIGIN = , LENGTH = 0x0 #>> + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + check.WORKRAM_SHARED (RWX) : ORIGIN = 0x037b8000, LENGTH = 0x48000 > workram.check + # reached OSFromBrom7Buf before OS_BOOT_CODE_BUF + check.WORKRAM (RWX) : ORIGIN = 0x037b8000, LENGTH = 0x54000 > workram.check +# binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 #>> + +# binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + check.LTDMAIN (RWX) : ORIGIN = 0x02f88000, LENGTH = 0x74000 > ltdmain.check +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(4); + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: data + SDK_STATIC_DATA_END =.; + . = ALIGN(4); + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(4); + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(4); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.WRAM.START = SDK_STATIC_BSS_END; + SDK_AUTOLOAD.WRAM.END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.BSS_END = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD.WRAM.SIZE = 0; + SDK_AUTOLOAD.WRAM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + SDK_AUTOLOAD_WRAM_START = SDK_AUTOLOAD.WRAM.START; + SDK_AUTOLOAD_WRAM_END = SDK_AUTOLOAD.WRAM.END; + SDK_MOUNT_INFO_TABLE = SDK_AUTOLOAD.WRAM.BSS_END; + SDK_AUTOLOAD_WRAM_BSS_END = SDK_MOUNT_INFO_TABLE + 0x400; + SDK_AUTOLOAD_WRAM_SIZE = SDK_AUTOLOAD.WRAM.SIZE; + SDK_AUTOLOAD_WRAM_BSS_SIZE = SDK_AUTOLOAD.WRAM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..SINIT_START; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + + } >> #> binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } >> #> binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(4); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ OTHERS ################################# + SDK_WRAM_ARENA_LO = SDK_AUTOLOAD_WRAM_BSS_END; + + SDK_IRQ_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE = ; # allocated in WRAM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.WORKRAM_SHARED: + { + . = SDK_STATIC_END; + } > check.WORKRAM_SHARED + + .check.WORKRAM: + { + . = SDK_STATIC_BSS_END; + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = 0x02f88000; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02e80000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } >> #> binary.LTDAUTOLOAD_TOP + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + WRITEW ADDR(.); + WRITEW SDK_LTDAUTOLOAD..SIZE; + WRITEW SDK_LTDAUTOLOAD..SINIT_START; + WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; + + + } >> #> binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ OTHERS ################################# + SDK_SUBPRIV_ARENA_LO = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + .check.LTDMAIN: + { + . = SDK_SUBPRIV_ARENA_LO; + + } > check.LTDMAIN + +} diff --git a/include/firm/specfiles/ARM9-BB-FIRM.lcf.template b/include/firm/specfiles/ARM9-BB-FIRM.lcf.template new file mode 100644 index 00000000..da10b754 --- /dev/null +++ b/include/firm/specfiles/ARM9-BB-FIRM.lcf.template @@ -0,0 +1,602 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM9-BB-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 # > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files + check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(32); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + crt0_firm.o (.text) + libsyscall.a (.text) + crt0_firm.o (.rodata) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY_DIGEST =.; + # NO DIGEST + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x027e0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + } >> # > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ MAIN EX ################################## + # MAIN EX Area + .dummy.MAIN_EX: + { + . = ALIGN(32); + } > dummy.MAIN_EX + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + .arena.MAIN_EX: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + } > arena.MAIN_EX + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + } > arena.DTCM + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + } > binary.MODULE_FILES + + # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + } > check.ITCM + + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + +} diff --git a/include/firm/specfiles/ARM9-BB-FIRM.lsf b/include/firm/specfiles/ARM9-BB-FIRM.lsf new file mode 100644 index 00000000..c7676d22 --- /dev/null +++ b/include/firm/specfiles/ARM9-BB-FIRM.lsf @@ -0,0 +1,42 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM9-BB-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x03800000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) +} + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) +} + +Autoload DTCM +{ + Address 0x027e0000 + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.bss) +} + diff --git a/include/firm/specfiles/ARM9-BB-GCDFIRM.lcf.template b/include/firm/specfiles/ARM9-BB-GCDFIRM.lcf.template new file mode 100644 index 00000000..4cace18e --- /dev/null +++ b/include/firm/specfiles/ARM9-BB-GCDFIRM.lcf.template @@ -0,0 +1,602 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM9-BB-NORFIRM.lcf.template +# +# Copyright 2007 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:$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 # > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files + check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(32); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + crt0.o (.text) + libsyscall.a (.text) + crt0.o (.rodata) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY_DIGEST =.; + # NO DIGEST + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x027e0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + } >> # > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ MAIN EX ################################## + # MAIN EX Area + .dummy.MAIN_EX: + { + . = ALIGN(32); + } > dummy.MAIN_EX + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + .arena.MAIN_EX: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + } > arena.MAIN_EX + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + } > arena.DTCM + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + } > binary.MODULE_FILES + + # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + } > check.ITCM + + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + +} diff --git a/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf b/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf new file mode 100644 index 00000000..c7676d22 --- /dev/null +++ b/include/firm/specfiles/ARM9-BB-GCDFIRM.lsf @@ -0,0 +1,42 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM9-BB-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x03800000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) +} + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) +} + +Autoload DTCM +{ + Address 0x027e0000 + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.bss) +} + diff --git a/include/firm/specfiles/ARM9-TS-FIRM.lcf.template b/include/firm/specfiles/ARM9-TS-FIRM.lcf.template new file mode 100644 index 00000000..10871507 --- /dev/null +++ b/include/firm/specfiles/ARM9-TS-FIRM.lcf.template @@ -0,0 +1,506 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 > + + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.NITRO (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN.NITRO (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX.NITRO (RW) : ORIGIN = AFTER(dummy.MAIN_EX.NITRO,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + + check.ITCM (RW) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check + check.WORKRAM (RWX) : ORIGIN = 0x037b8000, LENGTH = 0x48000 > workram.check + + binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 >> + + binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.TWL (RW) : ORIGIN = 0x0d000000, LENGTH = 0x0 + arena.WRAM.TWL (RW) : ORIGIN = AFTER(,,LTDMAIN,), LENGTH = 0x0 + arena.MAIN.TWL (RW) : ORIGIN = 0x02000400, LENGTH = 0x0 + arena.MAIN_EX.TWL (RW) : ORIGIN = AFTER(dummy.MAIN_EX.TWL,,,LTDMAIN,), LENGTH = 0x0 + + binary.MODULE_FILES (RW) : ORIGIN = 0, LENGTH = 0x0 > component.files +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + crt0_firm.o (.text) + crt0_firm.o (.rodata) + libsyscall.a (.text) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); # Fit to cache line + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY_DIGEST =.; + # NO DIGEST + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x02fe0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + + } > binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ ARENA ################################## + .dummy.MAIN_EX.NITRO: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.NITRO + + .arena.MAIN.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN.NITRO + + .arena.MAIN_EX.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + + } > arena.MAIN_EX.NITRO + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + + } > arena.DTCM + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + + } > check.ITCM + + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + . = . + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + + .check.WORKRAM: + { + . = SDK_STATIC_BSS_END; + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = SDK_STATIC_BSS_END; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02400000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } > binary.LTDAUTOLOAD_TOP + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { + + } > binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ ARENA ################################## + .dummy.MAIN_EX.TWL: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.TWL + + .arena.WRAM.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_ARENA_LO =.; + + } > arena.WRAM.TWL + + .arena.MAIN_EX.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_EX_ARENA_LO =.; + + } > arena.MAIN_EX.TWL + + ############################ OTHERS ################################# + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + + } > binary.MODULE_FILES + +} diff --git a/include/firm/specfiles/ARM9-TS-FIRM.lsf b/include/firm/specfiles/ARM9-TS-FIRM.lsf new file mode 100644 index 00000000..ace7c786 --- /dev/null +++ b/include/firm/specfiles/ARM9-TS-FIRM.lsf @@ -0,0 +1,57 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM9-TS-FIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ +# Address 0x037c0000 + Address 0x037b8000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) + Object $(OBJS_AUTOLOAD) (.rodata) + Object $(OBJS_AUTOLOAD) (.init) + Object $(OBJS_AUTOLOAD) (.ctor) + Object $(OBJS_AUTOLOAD) (.sinit) + Object * (.ltdmain) + Object $(OBJS_LTDAUTOLOAD) + Library $(LLIBS_EX) $(GLIBS_EX) + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.sdata) + Object $(OBJS_AUTOLOAD) (.bss) + Object $(OBJS_AUTOLOAD) (.sbss) +} + +Autoload ITCM +{ + Address 0x01ff8000 +} + +Autoload DTCM +{ + Address $(ADDRESS_DTCM) +} + +Ltdautoload LTDMAIN +{ + # NITRO/TWL 共有のオーバーレイが在る場合は、さらにその後ろに配置する必要があります。 + After $(TARGET_NAME) +} diff --git a/include/firm/specfiles/ARM9-TS-GCDFIRM.lcf.template b/include/firm/specfiles/ARM9-TS-GCDFIRM.lcf.template new file mode 100644 index 00000000..a5236b6f --- /dev/null +++ b/include/firm/specfiles/ARM9-TS-GCDFIRM.lcf.template @@ -0,0 +1,602 @@ +#--------------------------------------------------------------------------- +# Project: TwlFirm - tools - makelcf +# File: ARM9-TS-NORFIRM.lcf.template +# +# Copyright 2007 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:$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 # > + + (RWX) : ORIGIN = , LENGTH = 0x0 # > + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files + check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); . = ALIGN(32); # Fit to cache line + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + crt0.o (.text) + libsyscall.a (.text) + crt0.o (.rodata) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + . = ALIGN(4); + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + EXCEPTION + SDK_STATIC_ETABLE_END =.; + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY_DIGEST =.; + # NO DIGEST + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table + __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x027e0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_AUTOLOAD__ID =; + SDK_AUTOLOAD..ID =; + SDK_AUTOLOAD..START =.; + SDK_AUTOLOAD..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: text/rodata + SDK_AUTOLOAD..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE BLOCK + # + SDK_AUTOLOAD..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_AUTOLOAD..DATA_END =.; + SDK_AUTOLOAD..END =.; + + SDK_AUTOLOAD..TEXT_SIZE = SDK_AUTOLOAD..TEXT_END - SDK_AUTOLOAD..TEXT_START; + SDK_AUTOLOAD..DATA_SIZE = SDK_AUTOLOAD..DATA_END - SDK_AUTOLOAD..DATA_START; + SDK_AUTOLOAD..SIZE = SDK_AUTOLOAD..END - SDK_AUTOLOAD..START; + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD..SIZE; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_AUTOLOAD..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_AUTOLOAD..BSS_END = .; + + SDK_AUTOLOAD..BSS_SIZE = SDK_AUTOLOAD..BSS_END - SDK_AUTOLOAD..BSS_START; + + } >> + + + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { + SDK_AUTOLOAD_LIST = .; + + WRITEW ADDR(.); + WRITEW SDK_AUTOLOAD..SIZE; + WRITEW SDK_AUTOLOAD..BSS_SIZE; + + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO + +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + } >> # > binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + + .: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_OVERLAY__ID =; ### SEGMENT OVERLAY ID + SDK_OVERLAY..ID =; + SDK_OVERLAY..START =.; + SDK_OVERLAY..TEXT_START =.; + #:::::::::: text/rodata + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + SDK_OVERLAY..SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_OVERLAY..SINIT_END =.; + + #:::::::::: text/rodata + . = ALIGN(32); + SDK_OVERLAY..TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + SDK_OVERLAY..DATA_START =.; + #:::::::::: data + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: data + . = ALIGN(32); + SDK_OVERLAY..DATA_END =.; + SDK_OVERLAY..END =.; + + SDK_OVERLAY..TEXT_SIZE = SDK_OVERLAY..TEXT_END - SDK_OVERLAY..TEXT_START; + SDK_OVERLAY..DATA_SIZE = SDK_OVERLAY..DATA_END - SDK_OVERLAY..DATA_START; + SDK_OVERLAY..SIZE = SDK_OVERLAY..END - SDK_OVERLAY..START; + + } > + + ..bss: + { + ALIGNALL(4); . = ALIGN(32); + + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_OVERLAY..BSS_START = .; + #:::::::::: bss + + + + + + + . = ALIGN(4); + + + + + + + . = ALIGN(4); + #:::::::::: bss + . = ALIGN(32); + SDK_OVERLAY..BSS_END = .; + + SDK_OVERLAY..BSS_SIZE = SDK_OVERLAY..BSS_END - SDK_OVERLAY..BSS_START; + + } >> + + + + ############################ MAIN EX ################################## + # MAIN EX Area + .dummy.MAIN_EX: + { + . = ALIGN(32); + } > dummy.MAIN_EX + + ############################ ARENA ################################## + .arena.MAIN: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + } > arena.MAIN + + .arena.MAIN_EX: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + } > arena.MAIN_EX + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + } > arena.DTCM + + ############################ OVERLAYDEFS ############################ + .: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > + + + ############################ OVERLAYTABLE ########################### + .: + { + + # Overlay + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + + } > + + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + } > binary.MODULE_FILES + + # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + } > check.ITCM + + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + +} diff --git a/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf b/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf new file mode 100644 index 00000000..26780957 --- /dev/null +++ b/include/firm/specfiles/ARM9-TS-GCDFIRM.lsf @@ -0,0 +1,42 @@ +#---------------------------------------------------------------------------- +# Project: TwlFirm - include +# File: ARM9-TS-NORFIRM.lsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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:: 2007-09-06$ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- +# +# TwlFirm LCF SPEC FILE +# + +Static $(TARGET_NAME) +{ + Address 0x03800000 + Object $(OBJS_STATIC) + Library $(LLIBS) $(GLIBS) $(CW_LIBS) +} + +Autoload ITCM +{ + Address 0x01ff8000 + Object * (.itcm) + Object $(OBJS_AUTOLOAD) (.text) +} + +Autoload DTCM +{ + Address 0x027e0000 + Object * (.dtcm) + Object $(OBJS_AUTOLOAD) (.data) + Object $(OBJS_AUTOLOAD) (.bss) +} + diff --git a/include/firm/specfiles/ARM9-TS-PARTNER.lcf.template b/include/firm/specfiles/ARM9-TS-PARTNER.lcf.template new file mode 100644 index 00000000..0f640cae --- /dev/null +++ b/include/firm/specfiles/ARM9-TS-PARTNER.lcf.template @@ -0,0 +1,518 @@ +#--------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ARM9-TS-FIRM.lcf.template +# +# Copyright 2007 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$ +#--------------------------------------------------------------------------- +MEMORY +{ + (RWX) : ORIGIN = , LENGTH = 0x0 #> + + + (RWX) : ORIGIN = , LENGTH = 0x0 #>> + +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + F (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.NITRO (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 + arena.MAIN.NITRO (RW) : ORIGIN = AFTER(,), LENGTH = 0x0 + arena.MAIN_EX.NITRO (RW) : ORIGIN = AFTER(dummy.MAIN_EX.NITRO,), LENGTH = 0x0 + arena.ITCM (RW) : ORIGIN = AFTER(ITCM,), LENGTH = 0x0 + arena.DTCM (RW) : ORIGIN = AFTER(DTCM,), LENGTH = 0x0 + + check.ITCM (RW) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check + check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check + check.WORKRAM (RWX) : ORIGIN = 0x037c0000, LENGTH = 0x40000 > workram.check + +# binary.LTDAUTOLOAD_TOP (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWX) : ORIGIN = , LENGTH = 0x0 #>> + +# binary.LTDAUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> + + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + L (RW) : ORIGIN = 0, LENGTH = 0x0 > + + (RWXO): ORIGIN = , LENGTH = 0x0 > + + + dummy.MAIN_EX.TWL (RW) : ORIGIN = 0x0d000000, LENGTH = 0x0 + arena.WRAM.TWL (RW) : ORIGIN = AFTER(,,LTDMAIN,), LENGTH = 0x0 + arena.MAIN.TWL (RW) : ORIGIN = 0x02000400, LENGTH = 0x0 + arena.MAIN_EX.TWL (RW) : ORIGIN = AFTER(dummy.MAIN_EX.TWL,,,LTDMAIN,), LENGTH = 0x0 + + binary.MODULE_FILES (RW) : ORIGIN = 0, LENGTH = 0x0 > component.files +} + +FORCE_ACTIVE +{ + SVC_SoftReset +} + +KEEP_SECTION +{ + .sinit +} + +SECTIONS +{ + ############################ STATIC ################################# + .: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # TEXT BLOCK: READ ONLY + # + SDK_STATIC_START =.; + SDK_STATIC_TEXT_START =.; + #:::::::::: text/rodata + OBJECT(_start,*) + crt0_firm.o (.text) + crt0_firm.o (.rodata) + libsyscall.a (.text) + # + # .version セクションを追加しています。 + # このセクションに含まれる情報はロットチェックの際に + # 必要となりますので、必ずこの位置に残すようにして下さい。 + # + * (.version) + OBJECT(TwlMain,*) + + + + + + + * (.exception) + . = ALIGN(4); + SDK_STATIC_ETABLE_START =.; + __exception_table_start__ =.; + EXCEPTION + __exception_table_end__ =.; + SDK_STATIC_ETABLE_END =.; + + + + + + + + + + + + + . = ALIGN(4); + SDK_STATIC_SINIT_START =.; + #:::::::::: ctor + + + + + + + + + + + + + WRITEW 0; + #:::::::::: ctor + SDK_STATIC_SINIT_END =.; + #:::::::::: text/rodata + SDK_STATIC_TEXT_END =.; + + # + # DATA BLOCK: READ WRITE + # + . = ALIGN(32); # Fit to cache line + SDK_STATIC_DATA_START =.; + #:::::::::: data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . = ALIGN(4); + SDK_OVERLAY_DIGEST =.; + # NO DIGEST + SDK_OVERLAY_DIGEST_END =.; + #:::::::::: data + . = ALIGN(32); + SDK_STATIC_DATA_END =.; + SDK_STATIC_END =.; + + SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; + SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; + SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; + __sinit__ = SDK_STATIC_SINIT_START; # for static initializer + + } > + + ..bss: + { + ALIGNALL(4); + . = ALIGN(32); # Fit to cache line + + # + # Definition to refer overlay segment, when same name symbols exist in multiple overlays. + # + + SEARCH_SYMBOL ; + + + # + # BSS BLOCK + # + SDK_STATIC_BSS_START =.; + #:::::::::: bss + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #:::::::::: bss + . = ALIGN(32); + SDK_STATIC_BSS_END = .; + + SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; + + } >> + + + ############################ AUTOLOADS ############################## + SDK_AUTOLOAD.ITCM.START = 0x01ff8000; + SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD.ITCM.SIZE = 0; + SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; + SDK_AUTOLOAD.DTCM.START = 0x02fe0000; + SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD.DTCM.SIZE = 0; + SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; + SDK_AUTOLOAD_START = SDK_STATIC_END; + SDK_AUTOLOAD_SIZE = 0; + SDK_AUTOLOAD_NUMBER = ; + + SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; + SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; + SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; + SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; + SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; + SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; + SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; + SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; + SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; + SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; + + ############################ AUTOLOAD_INFO ########################## + .binary.AUTOLOAD_INFO: + { +# +# WRITEW ADDR(.); +# WRITEW SDK_AUTOLOAD..SIZE; +# WRITEW SDK_AUTOLOAD..SINIT_START; +# WRITEW SDK_AUTOLOAD..BSS_SIZE; +# + + } >> #> binary.AUTOLOAD_INFO + + SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; + SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); + + ############################ STATIC_FOOTER ########################## + .binary.STATIC_FOOTER: + { + WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE + WRITEW _start_ModuleParams - ADDR(.); + WRITEW 0; # NO DIGEST + WRITEW _start_LtdModuleParams - ADDR(.); + } >> #> binary.STATIC_FOOTER + + ############################ OVERLAYS ############################### + SDK_OVERLAY_NUMBER = ; + + ############################ OVERLAYDEFS ############################ + .F: + { + ### module information + WRITEW ADDR(.); # load address + WRITEW _start; # entry address + WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module + WRITEW _start_AutoloadDoneCallback; # callback autoload done + + ### overlay filename + + WRITES (""); # Overlay + + + } > F + + ############################ OVERLAYTABLE ########################### + .F: + { + + WRITEW ; # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_OVERLAY..SIZE; # size of module + WRITEW SDK_OVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_OVERLAY..SINIT_START; # start address of static init + WRITEW SDK_OVERLAY..SINIT_END; # end address of static init + WRITEW ; # ROM file ID + WRITEW 0; # Reserved + + + } > F + + ############################ ARENA ################################## + .dummy.MAIN_EX.NITRO: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.NITRO + + .arena.MAIN.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_START =.; + + } > arena.MAIN.NITRO + + .arena.MAIN_EX.NITRO: + { + . = ALIGN(32); + SDK_SECTION_ARENA_EX_START =.; + + } > arena.MAIN_EX.NITRO + + .arena.ITCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_ITCM_START =.; + + } > arena.ITCM + + .arena.DTCM: + { + . = ALIGN(32); + SDK_SECTION_ARENA_DTCM_START =.; + + } > arena.DTCM + + ############################ OTHERS ################################# + SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; + SDK_IRQ_STACKSIZE = ; # allocated in DTCM + SDK_SYS_STACKSIZE = ; # when 0 means all remains of DTCM + SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; + + .check.ITCM: + { + . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + + } > check.ITCM + + .check.DTCM: + { + . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; + + . = . + SDK_OVERLAY..SIZE + SDK_OVERLAY..BSS_SIZE; + + . = . + 0x080 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; + } > check.DTCM + + .check.WORKRAM: + { + . = SDK_STATIC_BSS_END; + } > check.WORKRAM + + ########################### LTDAUTOLOADS ############################ + SDK_LTDAUTOLOAD.LTDMAIN.START = SDK_STATIC_BSS_END; + SDK_LTDAUTOLOAD.LTDMAIN.END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD.LTDMAIN.SIZE = 0; + SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE = 0; + SDK_LTDAUTOLOAD_TOP_START = 0x02400000; + SDK_LTDAUTOLOAD_TOP_SIZE = 4; # STATIC 領域が無い代わりに 4 bytes のダミーがバイナリファイルの先頭に入る # + SDK_LTDAUTOLOAD_START = SDK_LTDAUTOLOAD_TOP_START + SDK_LTDAUTOLOAD_TOP_SIZE; + SDK_LTDAUTOLOAD_SIZE = 0; + SDK_LTDAUTOLOAD_NUMBER = ; + + .binary.LTDAUTOLOAD_TOP: + { + WRITEW 0; + + } >> #> binary.LTDAUTOLOAD_TOP + + SDK_LTDAUTOLOAD_LTDMAIN_START = SDK_LTDAUTOLOAD.LTDMAIN.START; + SDK_LTDAUTOLOAD_LTDMAIN_END = SDK_LTDAUTOLOAD.LTDMAIN.END; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_END = SDK_LTDAUTOLOAD.LTDMAIN.BSS_END; + SDK_LTDAUTOLOAD_LTDMAIN_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.SIZE; + SDK_LTDAUTOLOAD_LTDMAIN_BSS_SIZE = SDK_LTDAUTOLOAD.LTDMAIN.BSS_SIZE; + + ######################### LTDAUTOLOAD_INFO ########################## + .binary.LTDAUTOLOAD_INFO: + { +# +# WRITEW ADDR(.); +# WRITEW SDK_LTDAUTOLOAD..SIZE; +# WRITEW SDK_LTDAUTOLOAD..SINIT_START; +# WRITEW SDK_LTDAUTOLOAD..BSS_SIZE; +# + + } >> #> binary.LTDAUTOLOAD_INFO + + SDK_LTDAUTOLOAD_LIST = SDK_LTDAUTOLOAD_START + SDK_LTDAUTOLOAD_SIZE; + SDK_LTDAUTOLOAD_LIST_END = SDK_LTDAUTOLOAD_LIST + SIZEOF(.binary.LTDAUTOLOAD_INFO); + SDK_LTDAUTOLOAD_SIZE = SDK_LTDAUTOLOAD_SIZE + SIZEOF(.binary.LTDAUTOLOAD_INFO); + + ########################### LTDOVERLAYS ############################# + SDK_LTDOVERLAY_NUMBER = ; + + ########################## LTDOVERLAYDEFS ########################### + .L: + { + ### TWL limited extended static module information + WRITEW SDK_LTDAUTOLOAD_TOP_START; # load address + WRITEW 0; # padding + WRITEW SDK_LTDAUTOLOAD_SIZE + SDK_LTDAUTOLOAD_TOP_SIZE; # size of module + WRITEW 0; # padding + + ### TWL limited overlay filename + + WRITES (""); + + + } > L + + ######################### LTDOVERLAYTABLE ########################### + .L: + { + + WRITES # overlay ID + WRITEW ADDR(.); # load address + WRITEW SDK_LTDOVERLAY..SIZE; # size of module + WRITEW SDK_LTDOVERLAY..BSS_SIZE; # size of bss + WRITEW SDK_LTDOVERLAY..SINIT_START; # start address of static init + WRITEW SDK_LTDOVERLAY..SINIT_END; # end address of static init + WRITEW # ROM file ID + WRITEW 0; # Reserved + + + } > L + + ############################ ARENA ################################## + .dummy.MAIN_EX.TWL: + { + . = ALIGN(32); + + } > dummy.MAIN_EX.TWL + + .arena.WRAM.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_ARENA_LO =.; + + } > arena.WRAM.TWL + + .arena.MAIN_EX.TWL: + { + . = ALIGN(32); + SDK_LTDMAIN_EX_ARENA_LO =.; + + } > arena.MAIN_EX.TWL + + ############################ OTHERS ################################# + # Module filelist + .binary.MODULE_FILES: + { + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + WRITES (""); + + } > binary.MODULE_FILES + +} diff --git a/include/firm/specfiles/ROM-TS-FIRM.rsf b/include/firm/specfiles/ROM-TS-FIRM.rsf new file mode 100644 index 00000000..bc8af5b1 --- /dev/null +++ b/include/firm/specfiles/ROM-TS-FIRM.rsf @@ -0,0 +1,185 @@ +#---------------------------------------------------------------------------- +# Project: TwlSDK - include +# File: ROM-BB.rsf +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded insructions, 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$ +#---------------------------------------------------------------------------- +# +# TWL ROM SPEC FILE +# + +Arm9 +{ + Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)" + Elf "$(MAKEROM_ARM9:r).tef" +} + +Arm7 +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)" + Elf "$(MAKEROM_ARM7_BASE:r).tef" +} + +Arm9.Ltd +{ + Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)" + OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)" +} + +Arm7.Ltd +{ + Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)" + OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)" +} + +Property +{ + ### + ### Settings for FinalROM + ### + #### BEGIN + # + # TITLE NAME: Your product name within 12bytes + # + TitleName "FIRM" + + # + # MAKER CODE: Your company ID# in 2 ascii words + # issued by NINTENDO + # + MakerCode "01" + + # + # REMASTER VERSION: Mastering version + # + #RomVersion 0 + + # + # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] + # + RomSpeedType $(MAKEROM_ROMSPEED) + + # + # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] + # + #RomSize 128M + #RomSize 256M + + # + # ROM PADDING: TRUE if finalrom + # + #RomFootPadding TRUE + + # + # ROM HEADER TEMPLATE: Provided to every product by NINTENDO + # + #RomHeaderTemplate ./etc/rom_header.template.sbin + + # + # BANNER FILE: generated from Banner Spec File + # + #BannerFile ./etc/myGameBanner.bnr + BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr + + ### + ### Setting for TWL + ### + + # + # ROM HEADER Ltd: Provided to every product by NINTENDO + # + RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin + + # + # Digest parameters: + # + DigestParam 1024 32 + + # + # WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD] + # don't have to edit + # + #WramMapping $(MAKEROM_WRAM_MAPPING) + WramMappingDirect ../wram_regs/wram_regs.rbin + + # + # CardRegion: card region [Japan/America/Europe/Australia/China/Korea] + # + CardRegion Japan + + # + # Codec mode: + # don't have to edit + # + CodecMode $(MAKEROM_CODEC_MODE) + + ### + #### END +} + +AppendProperty +{ + # + # Publisher : "Nintendo" + # don't have to edit + Publisher Nintendo + + # + # Application type : [USER/SYSTEM] + # don't have to edit + AppType User + + # + # launch title on the launcher : [TRUE/FALSE] + # don't have to edit + Launch TRUE + + # + # Boot allowed Media: [GameCard/NAND] + # + Media NAND + + # + # GameCode for TitleID : Your GameCode in 4 ascii words + # + #GameCode $(TITLEID_LO) + + # + # Public save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PublicSaveDataSize 32K + + # + # Private save data size: [16K/32K/64K/128K/256K/512K/1M/2M/4M/8M] + # + #PrivateSaveDataSize 16K + + # + # Enable SubBannerFile + #SubBannerFile TRUE +} + +RomSpec +{ + Offset 0x00000000 + Segment ALL + HostRoot $(MAKEROM_ROMROOT) + Root / + File $(MAKEROM_ROMFILES) +} diff --git a/include/sysmenu.h b/include/sysmenu.h new file mode 100644 index 00000000..909e49df --- /dev/null +++ b/include/sysmenu.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: sysmenu.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef SYSMENU_H_ +#define SYSMENU_H_ + +// Compile switch---------------------- +//#define DEBUG_USED_CARD_SLOT_B_ // デバッグ用でカードスロットBを使用する場合に有効にする。 + +//------------------------------------- + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* SYSMENU_H_ */ +#endif diff --git a/include/sysmenu/WDS.h b/include/sysmenu/WDS.h new file mode 100644 index 00000000..d8de2433 --- /dev/null +++ b/include/sysmenu/WDS.h @@ -0,0 +1,255 @@ +//********************************************************************** +// +// @file WDS.h +// @brief 店頭親機がMP送信する接続先AP情報を受信 +// +// @author M.Okuno +// @date 2008/02/05 +// @version 01.00 +// +//*********************************************************************/ +#ifndef __WDS_H__ +#define __WDS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------- +// Include +//----------------------------------------------------- +#ifdef SDK_TWL +#include +#else +#include +#endif + +//----------------------------------------------------- +// Macros +//----------------------------------------------------- +/** + @brief デバッグ表示指定 +*/ +//#define WDS_DEBUGPRINT + +/** + @brief ホットスポット名エンコード情報 +*/ +#define WDS_HOTSPOT_ENCODE_UTF8 0x0000 ///< UTF-8 +#define WDS_HOTSPOT_ENCODE_UTF16 0x1000 ///< UTF-16 +#define WDS_HOTSPOT_ENCODE_MASK 0xF000 ///< マスク + +/** + @brief ホットスポット業者識別 +*/ +#define WDS_HOTSPOT_TYPE_MASK 0x0FFF ///< マスク + +/** + @brief ビーコン内容バッファサイズ +*/ +#define WDS_SSID_BUF_SIZE 32 ///< SSID +#define WDS_APNUM_BUF_SIZE 10 ///< AP番号 +#define WDS_HOTSPOTNAME_BUF_SIZE 24 ///< ホットスポット名 +#define WDS_HOTSPOTNAME_UTF16_BUF_SIZE WDS_HOTSPOTNAME_BUF_SIZE + 2 ///< 変換後のホットスポット名 +#define WDS_MACADDR_BUF_SIZE 6 ///< MACアドレス +#define WDS_WEPKEY_BUF_SIZE 32 ///< WEPキー(あるいはWPA Preshared Key) + +/** + @brief 親機AP情報保持最大数 +*/ +#define WDS_APINFO_MAX 4 + +/** + @brief 親機情報フラグ定義 +*/ +#define WDS_INFOFLAG_NOTIFY (0x01) ///< 通知フラグ +#define WDS_INFOFLAG_ALLOWAUTOCONNECT (0x01 << 1) ///< インターネットフルアクセス可能フラグ + +//----------------------------------------------------- +// Types +//----------------------------------------------------- +/** + @brief WDSライブラリが使用するコールバック関数型 +*/ +typedef void (*WDSCallbackFunc)(void *arg); + +//----------------------------------------------------- +// Structs +//----------------------------------------------------- +/** + @brief 親機から送られてくるAPビーコン +*/ +typedef struct WDSApInfo +{ + u8 ssid[ WDS_SSID_BUF_SIZE ]; ///< 親機が接続するAPのSSID + u8 apnum[ WDS_APNUM_BUF_SIZE ]; ///< Wi-FiステーションのAPのSSIDに埋め込まれているAP識別番号と同等の文字列 + u16 hotspotid; ///< ホットスポットの認証方式を示すフラグ+hotspotnameのエンコード情報 + u8 hotspotname[ WDS_HOTSPOTNAME_BUF_SIZE ]; ///< UTF-8あるいはUTF-16で記述されたホットスポットの名前 + u8 wepkey[ WDS_WEPKEY_BUF_SIZE ]; ///< 親機が接続するAPのWEP キー + u8 channel; ///< 親機が接続したAPが使っているチャンネル + u8 encryptflag; ///< AP接続時にNitroWiFiが使う暗号化方式 + u8 infoflag; ///< 親機の接続するネットの特性を記録するフラグ領域 + u8 reserve[ 5 ]; ///< 予約領域 + u16 mtu; ///< 使用可能なMTU + u16 crc; ///< CRC +} WDSApInfo; + +/** + @brief アプリケーションが参照するAPビーコン構造体 +*/ +typedef struct WDSBriefApInfo +{ + // WDSライブラリによって生成される値 + BOOL isvalid; ///< apinfoに有効な値が代入されていればTRUE + u16 rssi; ///< 電波強度 + + WDSApInfo apinfo; ///< 親機から送られてくるAPビーコン +} WDSBriefApInfo; + +//----------------------------------------------------- +// Prototypes +//----------------------------------------------------- +//-------------------------------------------------------------------------------- +/** WDSライブラリが使用するワークエリアのサイズを得ます + @return 0 以外 : ワークエリアのサイズ + @note + ライブラリ初期化時に使用します +*///------------------------------------------------------------------------------ +size_t WDS_GetWorkAreaSize( void ); + +//-------------------------------------------------------------------------------- +/** WDSを初期化します + @param <1> 呼び出し元によって確保されたバッファへのポインタを指定します + @param <2> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @param <3> WM_InitializeのdmaNoに準ずる引数 + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のサイズはWDS_SYSTEM_BUF_SIZEだけ必要であり、 + かつ 32バイトアラインされている必要があります。 + <2> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_Initialize()を実行する為、WMはREADYステートからIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_Initialize( void *wdsWork, WDSCallbackFunc callback, u16 dmaNo ); + +//-------------------------------------------------------------------------------- +/** WDSを初期化します(指定したスキャン結果を内部的に保持した状態での初期化) + @param <1> 呼び出し元によって確保されたバッファへのポインタを指定します + @param <2> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @param <3> WM_InitializeのdmaNoに準ずる引数 + @param <4> 事前にWDSを使用して取得したWDSBriefInfoの配列 + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のサイズはWDS_SYSTEM_BUF_SIZEだけ必要であり、 + かつ 32バイトアラインされている必要があります。 + <2> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_Initialize()を実行する為、WMはREADYステートからIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_InitializeEx( void *wdsWork, WDSCallbackFunc callback, u16 dmaNo, WDSBriefApInfo *apinfo ); + +//-------------------------------------------------------------------------------- +/** WDSを終了します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 +*///------------------------------------------------------------------------------ +int WDS_End( WDSCallbackFunc callback ); + +//-------------------------------------------------------------------------------- +/** DS配信システム親機ビーコンのスキャンを開始します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_StartScane()を実行する為、WMはIDLEステートの場合はSCANステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_StartScan( WDSCallbackFunc callback ); + +//-------------------------------------------------------------------------------- +/** DS配信システム親機ビーコンのスキャンを終了します + @param <1> 処理が完了した際に呼び出されるコールバック関数へのポインタ + @return 0 : 成功 ( コールバックを待つこと ) + 0 以外 : 失敗 + @note + <1> のコールバックは割り込みハンドラ内から呼び出されます。 + WDS 関連のコールバック関数内では呼び出せません。 + 関数内部でWM_EndScan()を実行する為、WMはIDLEステートに移行します。 +*///------------------------------------------------------------------------------ +int WDS_EndScan( WDSCallbackFunc callback ); + +//-------------------------------------------------------------------------------- +/** APビーコン情報の数を取得します + @return 0 以上 : 成功 + 0 未満 : 失敗 ( スキャン中 ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoNum( void ); + +//-------------------------------------------------------------------------------- +/** APビーコン情報をインデックスを指定して取得します + @param <1> 取得するAPビーコン情報のインデックス値(0〜15) + @param <2> 取得するAPビーコン情報を書き込む領域へのポインタ + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoByIndex( int index, WDSBriefApInfo *briefapinfo ); + +//-------------------------------------------------------------------------------- +/** APビーコン情報を全て取得します + @param <1> 取得するAPビーコン情報を書き込む配列の先頭へのポインタ(WDS_APINFO_MAX個の要素が必要) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApInfoAll( WDSBriefApInfo *briefapinfo ); + +#ifdef WDS_WITHDWC +//-------------------------------------------------------------------------------- +/** APビーコン情報をDWCの自動接続先として設定します + @param <1> 自動接続先として設定するAPビーコン情報のインデックス値(0〜15) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_SetConnectTargetByIndex( int index ); + +//-------------------------------------------------------------------------------- +/** APビーコン情報をDWCの自動接続先として設定します + @param <1> 自動接続先として設定するAPビーコン情報 + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_SetConnectTargetByBriefApInfo( WDSBriefApInfo *briefapinfo ); +#endif + +//-------------------------------------------------------------------------------- +/** APビーコン情報のAP説明文をUTF-16で得ます + @param <1> AP説明文を取得する対象のAPビーコン情報 + <2> AP説明文を書き込むバッファへのポインタ(WDS_HOTSPOTNAME_UTF16_BUF_SIZEバイト) + @return 0 : 成功 + 0 以外 : 失敗 ( スキャン中、又はインデックスの示す位置にデータがない ) + @note + スキャン中に実行した場合はエラー値を返します。 +*///------------------------------------------------------------------------------ +int WDS_GetApDescriptionUTF16( WDSBriefApInfo *briefapinfo, void *outbuf ); + +#ifdef __cplusplus +} +#endif + +#endif //EOF __WDS_H__ diff --git a/include/sysmenu/WDSWrapper.h b/include/sysmenu/WDSWrapper.h new file mode 100644 index 00000000..7d985a0d --- /dev/null +++ b/include/sysmenu/WDSWrapper.h @@ -0,0 +1,139 @@ +//********************************************************************** +// +// @file WDSWrapper.h +// @brief WDSライブラリのラッパー +// +// @author S.Nakata +// @date 2008/06/21 +// @version 0.0 +// +//*********************************************************************/ +#ifndef __WDSWRAPPER_H__ +#define __WDSWRAPPER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +//----------------------------------------------------- +// Include +//----------------------------------------------------- +#include + +//----------------------------------------------------- +// Macros +//----------------------------------------------------- +#define WDSWRAPPER_STACKSIZE 4096 ///< WDSラッパーが使用するスレッドスタックの推奨サイズ +#define WDSWRAPPER_SCANPERIOD 3000 ///< WDSラッパーがスキャンを継続する時間[msec] +#define WDSWRAPPER_WAITPERIOD 3000 ///< WDSラッパーがスキャンを中断する時間[msec] + +#define WDSWRAPPER_DEBUGPRINT ///< デバッグ表示フラグ + +//----------------------------------------------------- +// Types of WDS Wrapper Library +//----------------------------------------------------- + +/** + @brief 処理結果をあらわす列挙型 +*/ +typedef enum WDSWrapperErrCode +{ + WDSWRAPPER_ERRCODE_SUCCESS = 0, ///< 処理成功 + WDSWRAPPER_ERRCODE_FAILURE = 1, ///< 処理失敗 + WDSWRAPPER_ERRCODE_OPERATING = 2, ///< 処理実行中 + WDSWRAPPER_ERRCODE_INITIALIZED = 3, ///< WDSラッパーライブラリ初期化済み + WDSWRAPPER_ERRCODE_UNINITIALIZED= 4 ///< WDSラッパーライブラリ未初期化 +} WDSWrapperErrCode; + +/** + @brief コールバック発生要因をあらわす列挙型 +*/ +typedef enum WDSWrapperCallback +{ + WDSWRAPPER_CALLBACK_INITIALIZE = 0, //!< WDS_WrapperInitialize関数によるコールバック + WDSWRAPPER_CALLBACK_CLEANUP = 1, //!< WDS_WrapperCleanup関数によるコールバック + WDSWRAPPER_CALLBACK_STARTSCAN = 2, //!< WDS_WrapperStartScan関数によるコールバック + WDSWRAPPER_CALLBACK_STARTSCAN2 = 3, //!< WDS_WrapperStartScan関数によるコールバック(間欠スキャン1回終了) + WDSWRAPPER_CALLBACK_STOPSCAN = 4 //!< WDS_WrapperStopScan関数によるコールバック +} WDSWrapperCallback; + +/** + @brief WDSラッパーののステートをあらわす列挙型 +*/ +typedef enum WDSWrapperStateThreadState { + WDSWRAPPER_STATE_BEFOREINIT, //!< 初期化開始待ちステート + WDSWRAPPER_STATE_INIT, //!< 初期化開始ステート + WDSWRAPPER_STATE_WAITINIT, //!< 初期化完了待ちステート + WDSWRAPPER_STATE_SCAN, //!< スキャン開始ステート + WDSWRAPPER_STATE_WAITSCAN, //!< スキャン完了待ちステート + WDSWRAPPER_STATE_ENDSCAN, //!< スキャン中断ステート + WDSWRAPPER_STATE_WAITENDSCAN, //!< スキャン中断完了待ちステート + WDSWRAPPER_STATE_END, //!< WDS解放開始ステート + WDSWRAPPER_STATE_WAITEND, //!< WDS解放完了待ちステート + WDSWRAPPER_STATE_IDLE, //!< アイドルステート + WDSWRAPPER_STATE_TERMINATE //!< WDSラッパー解放ステート +} WDSWrapperStateThreadState; + +/** + @brief WDSWrapperライブラリが使用するコールバック関数型 + @note + ・引数argは必ずWDSWrapperCallback型変数へのポインタ +*/ +typedef void ( *WDSWrapperCallbackFunc )( void *arg ); + +/** + @brief WDSラッパー内部で使用するアロケーター型 +*/ +typedef void *( *WDSWrapperAlloc )( u32 size ); + +/** + @brief WDSラッパー内部で使用するアロケーター型 +*/ +typedef void ( *WDSWrapperFree )( void *ptr ); + +//----------------------------------------------------- +// Structs of WDS Wrapper Library +//----------------------------------------------------- + +/** + @brief WDS_WrapperInitialize関数に与える初期化パラメータ +*/ +typedef struct WDSWrapperInitializeParam +{ + u32 threadprio; ///< WDSコントロールスレッドの優先度 + u16 dmano; ///< WMライブラリが使用するDMA番号 + + WDSWrapperCallbackFunc callback; ///< WDSコントロールスレッドから呼び出されるコールバック関数へのポインタ + WDSWrapperAlloc alloc; ///< WDSラッパーが使用するアロケータ + WDSWrapperFree free; ///< WDSラッパーが使用するアロケータ +} WDSWrapperInitializeParam; + +/** + @brief WDSラッパーが呼び出すコールバック関数に与えられる引数用の構造体 +*/ +typedef struct WDSWrapperCallbackParam +{ + WDSWrapperCallback callback; ///< コールバック発生要因 + WDSWrapperErrCode errcode; ///< エラーコード +} WDSWrapperCallbackParam; + +//----------------------------------------------------- +// Prototypes of WDS Wrapper Library +//----------------------------------------------------- + +WDSWrapperErrCode WDS_WrapperInitialize( WDSWrapperInitializeParam param ); +WDSWrapperErrCode WDS_WrapperCleanup( void ); +WDSWrapperErrCode WDS_WrapperStartScan( void ); +WDSWrapperErrCode WDS_WrapperStopScan( void ); +WDSWrapperErrCode WDS_WrapperCheckValidBeacon( void ); +#ifdef SDK_TWL +WDSWrapperErrCode WDS_WrapperSetArgumentParam( void ); +#endif +WDSWrapperErrCode WDS_WrapperCheckThreadRunning( void ); +OSThread *WDS_WrapperGetOSThread( void ); + +#ifdef __cplusplus +} +#endif + +#endif //EOF __WDSWRAPPER_H__ diff --git a/include/sysmenu/acsign.h b/include/sysmenu/acsign.h new file mode 100644 index 00000000..9107b415 --- /dev/null +++ b/include/sysmenu/acsign.h @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - ACSIGN + File: acsign.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + + +#ifndef SYSM_ACSIGN_H_ +#define SYSM_ACSIGN_H_ + +#ifdef SDK_ARM9 +#include +//#include +#endif // SDK_ARM9 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_ACSIGN_H_ */ +#endif diff --git a/include/sysmenu/acsign/ARM9/acsign.h b/include/sysmenu/acsign/ARM9/acsign.h new file mode 100644 index 00000000..f17dc7e7 --- /dev/null +++ b/include/sysmenu/acsign/ARM9/acsign.h @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: acsign.h + + Copyright 2007 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 _ACSIGN_H_ +#define _ACSIGN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined( RSA_ENC_DEC ) +#define ACSIGN_BUFFER ((160/8)*4) // 出力バッファ量 +#else +#define ACSIGN_BUFFER ((160/8)*1) // 出力バッファ量 +#endif + +// +int ACSign_Decrypto( + void* buffer, // 出力領域 + void* sgn_ptr, // データへのポインタ + void* key_ptr // キーへのポインタ + ); + +// +BOOL ACSign_Encrypto( + void *sign, // 署名出力バッファへのポインタ + const void *key, // DERフォーマット秘密鍵へのポインタ + const void *data, // 署名対象データへのポインタ + int length, // 署名対象データ長 + BOOL isEncodeBER // 署名データをDERエンコードするか? + ); + +// +int ACSign_Digest( + void* buffer, // 出力領域 + void* romh_ptr, // データへのポインタ + void* mbin_ptr, // データへのポインタ + int mbin_len, // データの長さ + void* sbin_ptr, // データへのポインタ + int sbin_len, // データの長さ + u32 serial_num // シリアルナンバー + ); + +// +int ACSign_Compare( + void* dercypto, // ACSign_Decryptoの出力 + void* digest // ACSign_Digestの出力 + ); + +void ACSign_SetAllocFunc( void *(*pAlloc)( u32 ), void (*pFree)( void * ) ); + +#ifdef __cplusplus +} +#endif + +#endif //_ACSIGN_H_ diff --git a/include/sysmenu/acsign/ARM9/acsign_util.h b/include/sysmenu/acsign/ARM9/acsign_util.h new file mode 100644 index 00000000..dd09d6bf --- /dev/null +++ b/include/sysmenu/acsign/ARM9/acsign_util.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: acsign_util.h + + Copyright 2007 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 _ACSIGN_UTIL_H_ +#define _ACSIGN_UTIL_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define AUTH_BUFFER_LEN 20 + +extern int ACSignDecrpto(void *output_buffer, MBDownloadFileInfo *download_file_info_buf); +extern int ACSignDigest(void *input_buffer, MBDownloadFileInfo *download_file_info_buf); + + +#ifdef __cplusplus +} +#endif + +#endif //_ACSIGN_UTIL_H_ diff --git a/include/sysmenu/boot.h b/include/sysmenu/boot.h new file mode 100644 index 00000000..ced8a3b0 --- /dev/null +++ b/include/sysmenu/boot.h @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: boot.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef SYSM_BOOT_H_ +#define SYSM_BOOT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_MACHINE_SETTINGS_H_ */ +#endif diff --git a/include/sysmenu/boot/common/boot_api.h b/include/sysmenu/boot/common/boot_api.h new file mode 100644 index 00000000..e39773d1 --- /dev/null +++ b/include/sysmenu/boot/common/boot_api.h @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: boot_api.h + + Copyright 2007 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$ + *---------------------------------------------------------------------------*/ + +#if !defined(_SYSMENU_BOOT_H_) +#define _SYSMENU_BOOT_API_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*---------------------------------------------------------------------------* + Type definition + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + functions + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: BOOT_Core + + Description: ブートのコア関数 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Core( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_Init + + Description: ブートのための初期化 + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Init( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_WaitStart + + Description: スタート待ち(ARM7) + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +BOOL BOOT_WaitStart( void ); + +/*---------------------------------------------------------------------------* + Name: BOOT_WaitStart + + Description: ブート開始及びARM7への通知及び待機(ARM9) + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void BOOT_Ready( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYSMENU_BOOT_API_H_ */ diff --git a/include/sysmenu/dht/dht.h b/include/sysmenu/dht/dht.h new file mode 100644 index 00000000..9f14f7b9 --- /dev/null +++ b/include/sysmenu/dht/dht.h @@ -0,0 +1,344 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - DHT + File: dht.h + + Copyright 2008,2009 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 SYSMENU_DHT_H_ +#define SYSMENU_DHT_H_ + +/* + Phase、ホワイトリスト、マスタリング済みヘッダの対応関係 + + Phase1 DHTDatabase->hash[0] ROM_Header_Short->nitro_whitelist_phase1_digest + Phase2 DHTDatabase->hash[1] ROM_Header_Short->nitro_whitelist_phase2_digest + Phase3 DHTDatabaseEx->banner_hash ROM_Header_Short->banner_digest + Phase4 - - + + Phase4のハッシュ値はdht_phase4_list.cに含まれる +*/ + +#include +#include +#include + +#define nitro_whitelist_phase2_digest nitro_whitelist_phase2_diegst // for spell miss + +#define DHT_FAT_PAGE_SIZE 512 +#define DHT_FAT_CACHE_SIZE (DHT_FAT_PAGE_SIZE * 2) + +#define DHT_PHASE3_MAX DHT_OVERLAY_MAX + +/* + DHT_CheckHashPhase2で必要なワークメモリ +*/ +typedef struct DHTPhase2Work +{ + u8 fatCache[DHT_FAT_CACHE_SIZE]; // for fat cache only + u32 buffer[DHT_OVERLAY_MAX/sizeof(u32)]; // multiple usage +} +DHTPhase2Work; + +/* + DHT_CheckHashPhase4で必要なワークメモリ + (DHTPhase4Work <= DHTPhase2Workが必ず成り立つ) +*/ + +typedef struct DHTPhase4Work +{ + u32 buffer[DHT_PHASE3_MAX/sizeof(u32)]; +} +DHTPhase4Work; + +/* + DHT_CheckHashPhase2Exで必要なワークメモリ +*/ +typedef struct DHTPhase2ExWork +{ + u8 fatCache[DHT_FAT_CACHE_SIZE]; // for fat cache only +} +DHTPhase2ExWork; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + DHT_CheckHashPhase2/DHT_CheckHashPhase2Ex/DHT_CheckHashPhase4で使用するRead関数 + dest 転送先アドレス + offset 転送元ROMオフセット + length 転送サイズ + arg アプリケーションから渡された値 + + 回復不能な内部エラー発生時にはFALSEを返すこと +*/ +typedef BOOL (*DHTReadFunc)(void* dest, s32 offset, s32 length, void* arg); + +/* + DHT_CheckHashPhase2Ex/DHT_CheckHashPhase4Exで使用するRead関数 + 転送先アドレスは存在せず、代わりに独自バッファに読み込んだ後 + DHT_CheckHashPhase2ExUpdateを呼び出すこと(細分化可能) + ctx DHT_CheckHashPhase2ExUpdateに渡す引数 + offset 転送元ROMオフセット + length 転送サイズ + arg アプリケーションから渡された値 + + 回復不能な内部エラー発生時にはFALSEを返すこと +*/ +typedef BOOL (*DHTReadFuncEx)(SVCHMACSHA1Context* ctx, s32 offset, s32 length, void* arg); +/*---------------------------------------------------------------------------* + Name: DHT_GetDatabaseLength + + Description: 読み込み済みのデータベースのヘッダからサイズを返す + + Arguments: pDHT データベースヘッダの格納先 + + Returns: 正しそうなヘッダならサイズ、そうでないなら0 + *---------------------------------------------------------------------------*/ +u32 DHT_GetDatabaseLength(const DHTFile* pDHT); + +/*---------------------------------------------------------------------------* + Name: DHT_GetDatabaseExLength + + Description: 読み込み済みの拡張データベースのヘッダからサイズを返す + + Arguments: pDHT 拡張データベースヘッダの格納先 + + Returns: 正しそうなヘッダならサイズ、そうでないなら0 + *---------------------------------------------------------------------------*/ +u32 DHT_GetDatabaseExLength(const DHTFileEx* pDHT); + +/*---------------------------------------------------------------------------* + Name: DHT_GetDatabaseAdHocLength + + Description: 読み込み済みの個別対応データベースのヘッダからサイズを返す + + Arguments: pDHT 個別対応データベースヘッダの格納先 + + Returns: 正しそうなヘッダならサイズ、そうでないなら0 + *---------------------------------------------------------------------------*/ +u32 DHT_GetDatabaseAdHocLength(const DHTFileAdHoc* pDHT); + +/*---------------------------------------------------------------------------* + Name: DHT_PrepareDatabase + + Description: FS関数を利用してデータベースを読み込みと検証を行う + + Arguments: pDHT データベースの格納先 + fp ファイル構造体へのポインタ + DHTHeaderの先頭までシーク済みである必要がある + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_PrepareDatabase(DHTFile* pDHT, FSFile* fp); + +/*---------------------------------------------------------------------------* + Name: DHT_PrepareDatabaseEx + + Description: FS関数を利用して拡張データベースを読み込みと検証を行う + + Arguments: pDHT 拡張データベースの格納先 + fp ファイル構造体へのポインタ + DHTHeaderの先頭までシーク済みである必要がある + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_PrepareDatabaseEx(DHTFileEx* pDHT, FSFile* fp); + +/*---------------------------------------------------------------------------* + Name: DHT_PrepareDatabaseAdHoc + + Description: FS関数を利用して個別対応データベースを読み込みと検証を行う + + Arguments: pDHT 個別対応データベースの格納先 + fp ファイル構造体へのポインタ + DHTHeaderの先頭までシーク済みである必要がある + + Returns: 成功すればTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_PrepareDatabaseAdHoc(DHTFileAdHoc* pDHT, FSFile* fp); + +/*---------------------------------------------------------------------------* + Name: DHT_GetDatabase + + Description: ROMヘッダに対応するデータベースを検索する + + Arguments: pDHT データベースの格納先 + pROMHeader 対象となるROMヘッダ格納先 + + Returns: 対象エントリへのポインタ、見つからなければNULL + *---------------------------------------------------------------------------*/ +const DHTDatabase* DHT_GetDatabase(const DHTFile* pDHT, const ROM_Header_Short* pROMHeader); + +/*---------------------------------------------------------------------------* + Name: DHT_GetDatabaseEx + + Description: ROMヘッダに対応する拡張データベースを検索する + + Arguments: pDHT 拡張データベースの格納先 + pROMHeader 対象となるROMヘッダ格納先 + + Returns: 対象エントリへのポインタ、見つからなければNULL + *---------------------------------------------------------------------------*/ +const DHTDatabaseEx* DHT_GetDatabaseEx(const DHTFileEx* pDHT, const ROM_Header_Short* pROMHeader); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase1Init + + Description: ROMヘッダおよびARM9/ARM7スタティック領域の検証の準備 + + Arguments: ctx 検証用のSVCHMACSHA1コンテキスト + pROMHeader 対象となるROMヘッダ格納先 + + Returns: None + *---------------------------------------------------------------------------*/ +void DHT_CheckHashPhase1Init(SVCHMACSHA1Context* ctx, const ROM_Header_Short* pROMHeader); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase1Update + + Description: ROMヘッダおよびARM9/ARM7スタティック領域の検証のスタティック部分 + いくら分割しても良いが、ARM9スタティック、ARM7スタティックの順に + 呼び出すこと。 + + Arguments: ctx 検証用のSVCHMACSHA1コンテキスト + ptr 対象となるデータ領域 + length 対象となるデータサイズ + + Returns: None + *---------------------------------------------------------------------------*/ +void DHT_CheckHashPhase1Update(SVCHMACSHA1Context* ctx, const void* ptr, s32 length); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase1 + + Description: ROMヘッダおよびARM9/ARM7スタティック領域の検証の結果判定 + + Arguments: ctx 検証用のSVCHMACSHA1コンテキスト + hash 対応するハッシュ (db->hash[0]) + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase1Final(SVCHMACSHA1Context* ctx, const u8* hash); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase1 + + Description: ROMヘッダおよびARM9/ARM7スタティック領域の検証 + + Arguments: hash 対応するハッシュ (db->hash[0]) + pROMHeader 対象となるROMヘッダ格納先 + pARM9 対象となるARM9スタティック格納先 + pARM7 対象となるARM7スタティック格納先 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase1(const u8* hash, const ROM_Header_Short* pROMHeader, const void* pARM9, const void* pARM7); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase2 + + Description: オーバーレイ領域の検証 + + Arguments: hash 対応するハッシュ (db->hash[1]) + pROMHeader 対象となるROMヘッダ格納先 + work 本APIで使用するワーク (513KB) + func 対象デバイスに応じたRead関数 + arg Read関数に渡される引数 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase2(const u8* hash, const ROM_Header_Short* pROMHeader, DHTPhase2Work* work, DHTReadFunc func, void* arg); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase2Ex + + Description: オーバーレイ領域の検証 + + Arguments: hash 対応するハッシュ (db->hash[1]) + pROMHeader 対象となるROMヘッダ格納先 + work 本APIで使用するワーク (1KB) + func 対象デバイスに応じたRead関数 + funcEx 対象デバイスに応じて独自バッファにデータを読み込み + DHT_CheckHashPhase2ExUpdateを呼び出す必要がある + arg Read関数に渡される引数 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase2Ex(const u8* hash, const ROM_Header_Short* pROMHeader, DHTPhase2ExWork* work, DHTReadFunc func, DHTReadFuncEx funcEx, void* arg); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase2ExUpdate / DHT_CheckHashPhase4ExUpdate + + Description: オーバーレイ部分の検証および個別の検証 + DHTReadFuncExから呼び出すこと(さらなる細分化は自由) + 注意: Phase4でも流用している + + Arguments: ctx 検証用のSVCHMACSHA1コンテキスト + ptr 対象となるデータ領域 + length 対象となるデータサイズ + + Returns: None + *---------------------------------------------------------------------------*/ +void DHT_CheckHashPhase2ExUpdate(SVCHMACSHA1Context* ctx, const void* ptr, s32 length); +#define DHT_CheckHashPhase4ExUpdate DHT_CheckHashPhase2ExUpdate + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase3 + + Description: バナー領域の検証 + (メニュー表示に使用したデータを渡すべき) + + Arguments: hash 対応するハッシュ (dbex->banner_hash) + pBanner 対象となるバナー格納先 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase3(const u8* hash, const NTRBannerFile* pBanner); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase4 + + Description: 個別の検証 + + Arguments: pDHT 個別対応データベースの格納先 + pROMHeader 対象となるROMヘッダ格納先 + work 本APIで使用するワーク (512KB) + phase2の使い回しでOK + func 対象デバイスに応じたRead関数 + arg Read関数に渡される引数 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase4(const DHTFileAdHoc* pDHT, const ROM_Header_Short* pROMHeader, DHTPhase4Work* work, DHTReadFunc func, void* arg); + +/*---------------------------------------------------------------------------* + Name: DHT_CheckHashPhase4Ex + + Description: 個別の検証 + + Arguments: pDHT 個別対応データベースの格納先 + pROMHeader 対象となるROMヘッダ格納先 + funcEx 対象デバイスに応じて独自バッファにデータを読み込み + DHT_CheckHashPhase2ExUpdateを呼び出す必要がある + arg Read関数に渡される引数 + + Returns: 問題なければTRUE + *---------------------------------------------------------------------------*/ +BOOL DHT_CheckHashPhase4Ex(const DHTFileAdHoc* pDHT, const ROM_Header_Short* pROMHeader, DHTReadFuncEx funcEx, void* arg); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // SYSMENU_DHT_H_ diff --git a/include/sysmenu/dht/dht_format.h b/include/sysmenu/dht/dht_format.h new file mode 100644 index 00000000..655c843b --- /dev/null +++ b/include/sysmenu/dht/dht_format.h @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - DHT + File: dht_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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#ifndef SYSMENU_DHT_FORMAT_H_ +#define SYSMENU_DHT_FORMAT_H_ + +#define DHT_MAGIC_CODE (('N' << 0)|('D' << 8)|('H' << 16)|('T' << 24)) +#define DHT_DS_HEADER_SIZE 0x160 +#define DHT_OVERLAY_MAX (512*1024) + +#define DHT_MAGIC_CODE_EX (('N' << 0)|('D' << 8)|('H' << 16)|('X' << 24)) + +#define DHT_MAGIC_CODE_ADHOC (('N' << 0)|('D' << 8)|('H' << 16)|('I' << 24)) + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct DHTHeader +{ + u32 magic_code; // fixed + u8 sign[128]; // for nums member and whole DHTDatabase array + u32 nums; // number of subsequent DHTDatabase array +} +DHTHeader; + +#define DHTHeaderEx DHTHeader + +typedef struct DHTDatabase +{ + u8 game_code[4]; + u8 rom_version; + u8 reserved[3]; // for 4B alignment DHTDatabase array + u8 hash[2][20]; +} +DHTDatabase; + +typedef struct DHTDatabaseEx +{ + u8 game_code[4]; + u8 rom_version; + u8 reserved[3]; // for 4B alignment DHTDatabase array + u8 banner_hash[20]; +} +DHTDatabaseEx; + +/* + ad-hoc対処用 +*/ +#define DHT_INDIVIDUAL_ENTRY_MAX 8 +typedef struct DHTDatabaseAdHoc +{ + u8 game_code[4]; + u8 rom_version; + u8 reserved[3]; // for 4B alignment DHTDatabase array + struct + { + u32 offset; + u32 length; + } entry[DHT_INDIVIDUAL_ENTRY_MAX]; + u8 hash[20]; +} +DHTDatabaseAdHoc; + +typedef struct DHTFile +{ + DHTHeader header; + DHTDatabase database[]; +} +DHTFile; + +typedef struct DHTFileEx +{ + DHTHeader header; + DHTDatabaseEx database[]; +} +DHTFileEx; + +typedef struct DHTFileAdHoc +{ + DHTHeader header; + DHTDatabaseAdHoc database[]; +} +DHTFileAdHoc; + +#define DHT_HMAC_KEY { \ + 0x61, 0xbd, 0xdd, 0x72, 0x7e, 0x72, 0xbe, 0xde, 0xad, 0x3a, 0xdf, 0x7f, 0x3d, 0x2d, 0xf7, 0xa5, \ + 0x16, 0x7e, 0xb4, 0xc9, 0x7c, 0x6c, 0x00, 0x7c, 0x57, 0xbb, 0x94, 0x8a, 0x64, 0xcd, 0x4e, 0x1c, \ + 0x51, 0x6b, 0xbd, 0xdb, 0x1d, 0xeb, 0x54, 0xe9, 0x34, 0x27, 0xf9, 0x31, 0x51, 0x5e, 0x89, 0x4e, \ + 0x7f, 0xd9, 0x7c, 0xe9, 0x92, 0x44, 0x0f, 0xef, 0x6b, 0xb6, 0x12, 0x21, 0x68, 0x88, 0xd8, 0xee \ +} + +#define DHT_HMAC_KEY2 { \ + 0x85, 0x29, 0x48, 0xf3, 0xa1, 0xbb, 0x13, 0x30, 0x93, 0x5d, 0xb8, 0xc9, 0xa5, 0x9a, 0xe8, 0x30, \ + 0xc4, 0xd0, 0x4a, 0xdd, 0xa4, 0x92, 0x81, 0xfd, 0x4f, 0xa1, 0x32, 0xfa, 0x46, 0x05, 0xde, 0x68, \ + 0x7b, 0xa7, 0xd7, 0x5b, 0xc9, 0x3a, 0xc8, 0x8d, 0xcd, 0x25, 0x3a, 0x17, 0x3c, 0xc2, 0xd6, 0xe0, \ + 0xd2, 0xe5, 0xb9, 0xfb, 0x49, 0xf9, 0x4d, 0x05, 0x70, 0x10, 0x29, 0x51, 0x7a, 0xc5, 0x89, 0x49, \ +} + +/* + ユーティリティ + hp: メモリ上のデータベースの先頭アドレス +*/ +#define DHT_GET_SIGN_TARGET_ADDR(hp) (&((DHTHeader*)hp)->nums) +#define DHT_GET_SIGN_TARGET_SIZE(hp) (((DHTHeader*)hp)->nums * sizeof(DHTDatabase) + sizeof(u32)) +#define DHT_GET_SIGN_TARGET_OFFSET (int)DHT_GET_SIGN_TARGET_ADDR(0) + +#define DHT_GET_SIGN_TARGET_ADDR_EX(hp) DHT_GET_SIGN_TARGET_ADDR(hp) +#define DHT_GET_SIGN_TARGET_SIZE_EX(hp) (((DHTHeader*)hp)->nums * sizeof(DHTDatabaseEx) + sizeof(u32)) +#define DHT_GET_SIGN_TARGET_OFFSET_EX DHT_GET_SIGN_TARGET_OFFSET + +#define DHT_GET_SIGN_TARGET_ADDR_ADHOC(hp) DHT_GET_SIGN_TARGET_ADDR(hp) +#define DHT_GET_SIGN_TARGET_SIZE_ADHOC(hp) (((DHTHeader*)hp)->nums * sizeof(DHTDatabaseAdHoc) + sizeof(u32)) +#define DHT_GET_SIGN_TARGET_OFFSET_ADHOC DHT_GET_SIGN_TARGET_OFFSET + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif //SYSMENU_DHT_FORMAT_H_ diff --git a/include/sysmenu/ds.h b/include/sysmenu/ds.h new file mode 100644 index 00000000..907c5a13 --- /dev/null +++ b/include/sysmenu/ds.h @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - DS + File: ds.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 SYSM_DS_H_ +#define SYSM_DS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_DS_H_ */ +#endif diff --git a/include/sysmenu/ds/common/ds.h b/include/sysmenu/ds/common/ds.h new file mode 100644 index 00000000..cc08894c --- /dev/null +++ b/include/sysmenu/ds/common/ds.h @@ -0,0 +1,41 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: ds.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 SYSM_DS_COMMON_DS_H_ +#define SYSM_DS_COMMON_DS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DS_REDRSV_PATCH_FUNC_ADDR ( HW_RED_RESERVED + 0x1c ) +#define DS_WLPATCH_SIZE (5*4) +#define DS_WLPATCH_COPYCODE_SIZE (10*4) +#define DS_ANGVOL_GAIN_SP_SPECIAL 0x2C + +void DS_InsertWLPatch( void* romHeaderNTR ); +void DS_SetSpeakerVolume( void* romHeaderNTR ); + +#ifdef __cplusplus +} /* extern "C" */ + +#endif + +/* SYSM_DS_COMMON_DS_H_ */ +#endif diff --git a/include/sysmenu/errorLog.h b/include/sysmenu/errorLog.h new file mode 100644 index 00000000..52ec7437 --- /dev/null +++ b/include/sysmenu/errorLog.h @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - ErrorLog + File: errorLog.h + + Copyright **** 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 __SYSM_ERRORLOG__ + #define __SYSM_ERRORLOG__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 + +/*-- type definition ----------------------------*/ +// 日付データとかを除いた、自由フォーマットで書き込めるサイズ +// このサイズを超えた文字列は切り捨てられます +// ERRORLOG_STR_LENGTH = ERRORLOG_BUFSIZE - ERRORLOG_STR_OFFSET - 1 +#define ERRORLOG_STR_LENGTH 213 +#define ERRORLOG_SIZE ( 16 * 1024 ) // ファイルは16KBサイズ固定 +#define ERRORLOG_BUFSIZE 256 // 1エントリあたりのサイズ +#define ERRORLOG_NUM_ENTRY ( ERRORLOG_SIZE / ERRORLOG_BUFSIZE ) // ログに書き込まれるエントリの最大数 + +// 既に書き込まれたエラーログを表現するためのエントリ +typedef struct ErrorLogEntry{ + // ランチャからの呼び出しかどうか + BOOL isBroken; + BOOL isLauncherError; + + // エラーのタイムスタンプ + int year; + int month; + int day; + char week[4]; // 曜日の3文字表現 + int hour; + int minute; + int second; + + // u32だけど実態は4byteの文字列 + u32 titleId; + + // ---- isLauncherError = TRUEの時のデータ ---- + // エラーコード + int errorCode; + + // ---- isLauncherError = FALSEの時のデータ ---- + char *errorStr; +} ErrorLogEntry; + +typedef struct ErrorLogWork{ + // メモリ確保用関数 + void* (*Alloc) ( u32 ) ; + void (*Free) ( void* ) ; + + // エラーログエントリ保持用変数 + ErrorLogEntry *entry; + + // エラーログのエントリ数 + int numEntry; + + // エラーログのファイルポインタ + FSFile file; + + // 排他制御用Mutex + OSMutex mutex; + +} ErrorLogWork; + + +/*-- function prototype -------------------------*/ +extern BOOL ERRORLOG_Printf( const char *fmt, ... ); +extern BOOL ERRORLOG_Init( void* (*AllocFunc) (u32) , void (*FreeFunc) (void*) ); +extern void ERRORLOG_End( void ); +extern int ERRORLOG_GetNum() ; +extern const ErrorLogEntry* ERRORLOG_Read( int idx ); + + +// for RED Launcher +extern BOOL ERRORLOG_Write( u64 errorCode ); + +extern FSFile ERRORLOGi_getLogFilePt( void ); + +#endif // SDK_ARM9 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/include/sysmenu/hotsw.h b/include/sysmenu/hotsw.h new file mode 100644 index 00000000..52f51447 --- /dev/null +++ b/include/sysmenu/hotsw.h @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: hotsw.h + + Copyright 2007 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 SYSM_HOTSW_H_ +#define SYSM_HOTSW_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_HOTSW_H_ */ +#endif diff --git a/include/sysmenu/hotsw/common/hotsw.h b/include/sysmenu/hotsw/common/hotsw.h new file mode 100644 index 00000000..972f050a --- /dev/null +++ b/include/sysmenu/hotsw/common/hotsw.h @@ -0,0 +1,220 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: hotsw.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 __SYSMENU_HOTSW_COMMON_HOTSW_H__ +#define __SYSMENU_HOTSW_COMMON_HOTSW_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Define ------------------------------------------------------------------- +#define SYSM_HOTSW_ENABLE_ROMEMU +#define USE_WRAM_LOAD +#define INITIAL_KEYTABLE_PRELOAD +#define HOTSW_FINAL_VERSION +//#define USE_NEW_DMA +//#define HOTSW_NO_MESSAGE // Printf抑制スイッチ + +#ifndef SDK_FINALROM + #ifdef HOTSW_NO_MESSAGE + #define HOTSW_TPrintf( ... ) ((void)0) + #define HOTSW_PutString( ... ) ((void)0) + #else + #define HOTSW_TPrintf OS_TPrintf + #define HOTSW_PutString OS_PutString + #endif +#else + #define HOTSW_TPrintf( ... ) ((void)0) + #define HOTSW_PutString( ... ) ((void)0) +#endif + +// enum ------------------------------------------------------------------- +// スレッドに送るメッセージのステート +typedef enum HotSwMessageType{ + HOTSW_INSERT = 0, + HOTSW_PULLOUT, + HOTSW_CONTROL +} HotSwMessageType; + +typedef enum ModeType{ + HOTSW_MODE1 = 0, + HOTSW_MODE2 +} ModeType; + +typedef enum HotSwCardState{ + HOTSW_CARD_STATE_POWER_OFF = 0, + HOTSW_CARD_STATE_NORMAL_MODE, + HOTSW_CARD_STATE_GAME_MODE, + HOTSW_CARD_STATE_KEEP +} HotSwCardState; // 旧 HotSwApliType + +// union ------------------------------------------------------------------- +// PXI用メッセージ +typedef union HotSwPxiMessageForArm7{ + struct { + u32 value :1; + u32 ctrl :1; + u32 finalize :1; + u32 read :1; + u32 cardState:8; + u32 :20; + } msg; + u32 data; +} HotSwPxiMessageForArm7; + +typedef union HotSwPxiMessageForArm9{ + struct { + u32 mode :1; + u32 insert :1; + u32 pullout :1; + u32 read :1; + u32 result :8; + u32 :20; + } msg; + u32 data; +} HotSwPxiMessageForArm9; + +// struct ------------------------------------------------------------------- +// スレッド用メッセージ +typedef struct HotSwMessageForArm7{ + u32 value; + BOOL ctrl; + BOOL finalize; + BOOL read; + HotSwMessageType type; + HotSwCardState state; +} HotSwMessageForArm7; + +typedef struct HotSwMessageForArm9{ + BOOL isGameMode; + BOOL isInsert; + BOOL isPulledOut; + BOOL isReadComplete; + CardDataReadState result; +} HotSwMessageForArm9; + + +// Function prototype ------------------------------------------------------- +// --- ARM9 +#ifdef SDK_ARM9 +// PXI通信でARM7に活線挿抜有効/無効を通知。カード関連のフラグ処理も行う(非同期版) +void HOTSW_EnableHotSWAsync( BOOL enable ); + +// PXI通信でARM7に活線挿抜有効/無効を通知。カード関連のフラグ処理も行う(同期版) +void HOTSW_EnableHotSW( BOOL enable ); + +// PXI通信でARM7に活線挿抜無効を通知。(非同期版) +void HOTSW_InvalidHotSWAsync( void ); + +// PXI通信でARM7に活線挿抜無効を通知。(同期版) +void HOTSW_InvalidHotSW( void ); + +// PXI通信でARM7に活線挿抜Finalize処理を通知 +void HOTSW_FinalizeHotSWAsync( HotSwCardState cardState ); + +// 活線挿抜の許可/抑制の状態を返す +BOOL HOTSW_isEnableHotSW(void); + +// カードアプリのロードが完了しているかを返す +BOOL HOTSW_isCardLoadCompleted(void); + +// 終了処理が完了したかを返す +BOOL HOTSW_isFinalized(void); + +// 活線挿抜処理中かどうかを返す +BOOL HOTSW_isBusyHotSW(void); + +#ifdef USE_WRAM_LOAD +// 活栓挿抜処理の初期化 +void HOTSW_Init(); + +// カードデータを読み出す関数(同期版) +CardDataReadState HOTSW_ReadCardData(void* src, void* dest, u32 size); + +// カードデータを読み出す関数(非同期版) +CardDataReadState HOTSW_ReadCardDataAsync(void* src, void* dest, u32 size); + +// カードがGameモードになった時のコールバック関数を設定 +void HOTSW_SetGameModeCallBackFunction(OSIrqFunction function); + +// カードが刺さった時のコールバック関数を設定 +void HOTSW_SetCardInsertCallBackFunction(OSIrqFunction function); + +// カードが抜けた時のコールバック関数を設定 +void HOTSW_SetCardPullOutCallBackFunction(OSIrqFunction function); + +// カードがゲームモードになったかどうか +BOOL HOTSW_isGameMode(void); + +// Gameモードのデータ読み関数 +CardDataReadState HOTSW_ReadCardDataOnGameMode(const void* src, void* dest, u32 size); +#endif + +// --- ARM7 +#else +// 活栓挿抜処理の初期化 +void HOTSW_Init(u32 threadPrio); + +#ifdef INITIAL_KEYTABLE_PRELOAD +// DS互換BlowfishテーブルをWRAM経由でローカルにコピーする +void HOTSW_CopyInitialKeyTable(void); +#endif + +// カードの存在判定 +BOOL HOTSW_IsCardExist(void); + +// カードにアクセスできる状態か判定 +BOOL HOTSW_IsCardAccessible(void); + +// Boot Segment バッファの指定 +void HOTSW_SetBootSegmentBuffer(void* buf, u32 size); + +// Secure Segment バッファの指定 +void HOTSW_SetSecureSegmentBuffer(ModeType type ,void* buf, u32 size); +// 上記のバッファ非クリアバージョン +void HOTSWi_SetSecureSegmentBuffer(ModeType type ,void* buf, u32 size); + +// ROMをエミュレーションしているか? +BOOL HOTSWi_IsRomEmulation(void); + +// デバッガ通信用にカードスロットの電源をONにする。 +void HOTSWi_TurnCardPowerOn(u32 slot); + +// カードワーク取得 +void *HOTSWi_GetCardBootData(void); + +#ifdef USE_WRAM_LOAD +// NANDアプリ用KeyTableの生成 +void HOTSWi_MakeBlowfishTableDSForNAND(void); +// 引数で与えられたバッファから2KB分の領域をBlowfishで復号化する +BOOL HOTSW_DecryptObjectFile(void* dest); +#endif +#endif + +// Romエミュレーション情報を格納しているバッファのポインタを返す +SDK_INLINE void* HOTSW_GetRomEmulationBuffer(void) +{ + return (void*)&SYSMi_GetWork()->romEmuInfo; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // __SYSMENU_HOTSW_COMMON_HOTSW_H__ diff --git a/include/sysmenu/hw/common/mmap.h b/include/sysmenu/hw/common/mmap.h new file mode 100644 index 00000000..870ecfb9 --- /dev/null +++ b/include/sysmenu/hw/common/mmap.h @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: mmap.c + + Copyright 2007 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 _SYSMENU_MMAP_H_ +#define _SYSMENU_MMAP_H_ + +#ifndef SDK_ASM +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// define data ------------------------------------ + +// SystemMenu自身のマップ情報定義 +#define SYSM_OWN_ARM9_MMEM_ADDR SYSM_TWL_ARM9_LTD_LOAD_MMEM_END +#define SYSM_OWN_ARM9_MMEM_ADDR_END SYSM_TWL_ARM7_LTD_LOAD_MMEM +#define SYSM_OWN_ARM9_MMEM_CODE_ADDR (SYSM_OWN_ARM9_MMEM_ADDR + SYSM_DMA_BUFOVER_BARRIER_SIZE) +#define SYSM_OWN_ARM7_MMEM_ADDR 0x02280000 +#define SYSM_OWN_ARM7_MMEM_ADDR_END 0x02380000 +#define SYSM_OWN_ARM7_MMEM_CODE_ADDR (SYSM_OWN_ARM7_MMEM_ADDR + SYSM_DMA_BUFOVER_BARRIER_SIZE) +extern u32 SDK_AUTOLOAD_WRAM_START[]; +#ifndef SDK_ASM +#define SYSM_OWN_ARM7_WRAM_ADDR ((u32)SDK_AUTOLOAD_WRAM_START) +#else +#define SYSM_OWN_ARM7_WRAM_ADDR SDK_AUTOLOAD_WRAM_START +#endif +#define SYSM_OWN_ARM7_WRAM_ADDR_END 0x0380f000 + +#define SYSROM9_NINLOGO_ADR 0xffff0020 // ARM9システムROM内の任天堂ロゴ格納アドレス + +#define SYSM_DMA_BUFOVER_BARRIER_SIZE 0x0200 + +// カードアプリ格納バッファ(ROMヘッダバッファはNANDアプリでも使用) +#define SYSM_APP_ROM_HEADER_SIZE 0x1000 +#define SYSM_APP_ROM_HEADER_BUF ( 0x02fe6000 ) +#define SYSM_APP_ROM_HEADER_BUF_END ( SYSM_APP_ROM_HEADER_BUF + SYSM_APP_ROM_HEADER_SIZE ) +#define SYSM_CARD_ROM_HEADER_BAK ( SYSM_APP_ROM_HEADER_BUF_END ) +#define SYSM_CARD_ROM_HEADER_BAK_END ( SYSM_CARD_ROM_HEADER_BAK + SYSM_APP_ROM_HEADER_SIZE ) +#define SYSM_CARD_NTR_SECURE_BUF ( SYSM_CARD_ROM_HEADER_BAK_END ) +#define SYSM_CARD_NTR_SECURE_BUF_END ( SYSM_CARD_NTR_SECURE_BUF + SECURE_AREA_SIZE ) +#define SYSM_CARD_TWL_SECURE_BUF ( SYSM_CARD_NTR_SECURE_BUF_END ) +#define SYSM_CARD_TWL_SECURE_BUF_END ( SYSM_CARD_TWL_SECURE_BUF + SECURE_AREA_SIZE ) +#define SYSM_CARD_BANNER_BUF ( SYSM_CARD_TWL_SECURE_BUF_END ) +#define SYSM_CARD_BANNER_BUF_END ( SYSM_CARD_BANNER_BUF + 0x3000 ) + +#define SYSM_NTR_ROM_HEADER_BUF 0x023ffe00 +#define SYSM_DBG_NTR_ROM_HEADER_BUF 0x027ffe00 +#define SYSM_DBG_NTR_SYSTEM_BUF 0x027ff000 + +// ※アプリをWRAMに直接配置してブートしようとすると、SystemMenuのコードとぶつかっていろいろややこしい状態になるので、検討が必要 + +// アプリロード可能領域のマップ情報定義 +#define SYSM_NTR_ARM9_LOAD_MMEM 0x02000000 // ロード可能なARM9 static MMEM アドレス +#define SYSM_NTR_ARM9_LOAD_MMEM_END 0x02280000 // ロード可能なARM9 static MMEM 最終アドレス +#define SYSM_NTR_ARM7_LOAD_MMEM 0x02380000 // ロード可能なARM7 static MMEM アドレス +#define SYSM_NTR_ARM7_LOAD_MMEM_END 0x023c0000 // ロード可能なARM7 static MMEM 最終アドレス +#define SYSM_NTR_ARM7_LOAD_WRAM 0x037f8000 // ロード可能なARM7 static WRAM アドレス +#define SYSM_NTR_ARM7_LOAD_WRAM_END 0x0380f000 // ロード可能なARM7 static WRAM 最終アドレス + +#define SYSM_TWL_ARM9_LOAD_MMEM HW_MAIN_MEM_PARAMETER_BUF_END // ロード可能なARM9 static MMEM アドレス <- SDKでズレたので要修正 +#define SYSM_TWL_ARM9_LOAD_MMEM_END SYSM_NTR_ARM9_LOAD_MMEM_END // ロード可能なARM9 static MMEM 最終アドレス +#define SYSM_TWL_ARM7_LOAD_MMEM SYSM_NTR_ARM7_LOAD_MMEM // ロード可能なARM7 static MMEM アドレス +#define SYSM_TWL_ARM7_LOAD_MMEM_END SYSM_NTR_ARM7_LOAD_MMEM_END // ロード可能なARM7 static MMEM 最終アドレス +#define SYSM_TWL_ARM7_LOAD_WRAM SYSM_NTR_ARM7_LOAD_WRAM // ロード可能なARM7 static WRAM アドレス +#define SYSM_TWL_ARM7_LOAD_WRAM_END SYSM_NTR_ARM7_LOAD_WRAM_END // ロード可能なARM7 static WRAM 最終アドレス + +#define SYSM_TWL_ARM9_LTD_LOAD_MMEM 0x02400000 // ロード可能なARM9 LTD static MMEM アドレス +#define SYSM_TWL_ARM9_LTD_LOAD_MMEM_END 0x02680000 // ロード可能なARM9 LTD static MMEM 最終アドレス +#define SYSM_TWL_ARM7_LTD_LOAD_MMEM 0x02e80000 // ロード可能なARM7 LTD static MMEM アドレス +#define SYSM_TWL_ARM7_LTD_LOAD_MMEM_END 0x02f88000 // ロード可能なARM7 LTD static MMEM 最終アドレス +#define SYSM_TWL_ARM7_LTD_LOAD_WRAM 0x037c0000 // ロード可能なARM7 LTD static WRAM アドレス +#define SYSM_TWL_ARM7_LTD_LOAD_WRAM_END SYSM_NTR_ARM7_LOAD_WRAM_END // ロード可能なARM7 LTD static WRAM 最終アドレス +#define SYSM_TWL_ARM7_LTD_HYB_LOAD_WRAM 0x037f8000 // ロード可能なARM7 LTD static WRAM アドレス +#define SYSM_TWL_ARM7_LTD_HYB_LOAD_WRAM_END SYSM_NTR_ARM7_LOAD_WRAM_END // ロード可能なARM7 LTD static WRAM 最終アドレス + +// マウント情報一時バッファ +#define SYSM_TWL_MOUNT_INFO_TMP_BUFFER 0x02ff3400 // マウント情報の一時バッファ + +#ifdef __cplusplus +} +#endif + +#endif // _SYSMENU_MMAP_H_ + diff --git a/include/sysmenu/mcu.h b/include/sysmenu/mcu.h new file mode 100644 index 00000000..9a3427e1 --- /dev/null +++ b/include/sysmenu/mcu.h @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - MCU + File: 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:: 2007-09-06$ + $Rev: 651 $ + $Author: nakasima $ + *---------------------------------------------------------------------------*/ + +#ifndef SYSM_MCU_H_ +#define SYSM_MCU_H_ + +#include + +#include +#ifdef SDK_ARM9 +#include +#else // SDK_ARM7 +#include +#endif // SDK_ARM7 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_MCU_H_ */ +#endif diff --git a/include/sysmenu/mcu/ARM7/mcu.h b/include/sysmenu/mcu/ARM7/mcu.h new file mode 100644 index 00000000..01735e2b --- /dev/null +++ b/include/sysmenu/mcu/ARM7/mcu.h @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: 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:: 2008-01-23#$ + $Rev: 3784 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#ifndef SYSM_MCU_ARM7_H_ +#define SYSM_MCU_ARM7_H_ + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +void SYSM_InitMcuPxi( u32 prio ); +u8 SYSMi_GetMcuVersion( void ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SYSM_MCU_ARM7_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/include/sysmenu/mcu/ARM9/mcu.h b/include/sysmenu/mcu/ARM9/mcu.h new file mode 100644 index 00000000..a6e083cf --- /dev/null +++ b/include/sysmenu/mcu/ARM9/mcu.h @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: 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:: 2008-01-23#$ + $Rev: 3784 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#ifndef SYSM_MCU_ARM9_H_ +#define SYSM_MCU_ARM9_H_ + +#include +#include +#include "../common/fifo.h" + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum SYSMMcuResult +{ + MCU_RESULT_SUCCESS = 0, + MCU_RESULT_SUCCESS_TRUE = 0, + MCU_RESULT_SUCCESS_FALSE, + MCU_RESULT_BUSY, + MCU_RESULT_ILLEGAL_PARAMETER, + MCU_RESULT_SEND_ERROR, + MCU_RESULT_INVALID_COMMAND, + MCU_RESULT_ILLEGAL_STATUS, + MCU_RESULT_FATAL_ERROR, + MCU_RESULT_MAX +} +SYSMMcuResult; + +typedef void (*SYSMMcuCallback)(SYSMMcuResult result, void *arg); + +/*===========================================================================*/ + +void SYSM_InitMcuPxi( void ); +u8 SYSMi_GetMcuVersion( void ); + +SYSMMcuResult SYSM_ReadMcuRegisterAsync( u8 addr, u8* pValue, SYSMMcuCallback callback, void* arg ); +SYSMMcuResult SYSM_WriteMcuRegisterAsync( u8 addr, u8 value, SYSMMcuCallback callback, void* arg ); +void SYSM_SetMcuInterruptHandler( SYSMMcuCallback handler ); + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SYSM_MCU_ARM9_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/include/sysmenu/mcu/common/fifo.h b/include/sysmenu/mcu/common/fifo.h new file mode 100644 index 00000000..d0785542 --- /dev/null +++ b/include/sysmenu/mcu/common/fifo.h @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - mcu-test - include + File: fifo.h + + Copyright 2007 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:: 2008-01-25#$ + $Rev: 3844 $ + $Author: yutaka $ + *---------------------------------------------------------------------------*/ +#ifndef SYSM_MCU_COMMON_FIFO_H_ +#define SYSM_MCU_COMMON_FIFO_H_ + +#include +#include + +/*---------------------------------------------------------------------------* + 定数定義 + *---------------------------------------------------------------------------*/ +#define MCUTEST_PXI_CONTINUOUS_PACKET_MAX 2 + +#define MCUTEST_PXI_DATA_SIZE_MAX ((MCUTEST_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数 + +#define MCUTEST_PXI_START_BIT 0x02000000 // 先頭パケットを意味する +#define MCUTEST_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す + +#define MCUTEST_PXI_DATA_NUMS_SHIFT 16 // データ数位置 +#define MCUTEST_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域 +#define MCUTEST_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置 +#define MCUTEST_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク +#define MCUTEST_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置 +#define MCUTEST_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum McuTestCommand +{ + MCU_TEST_COMMAND_NULL = 0, + + MCU_TEST_COMMAND_READ_REGISTER, + MCU_TEST_COMMAND_WRITE_REGISTER, + + MCU_TEST_COMMAND_INTERRUPT, + + MCU_TEST_COMMAND_MAX +} +SYSMMcuCommand; + +// 応答定義 +typedef enum SYSMMcuPxiResult +{ + MCU_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり + MCU_PXI_RESULT_SUCCESS_TRUE = 0, // 処理成功 (BOOL型) + MCU_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型) + MCU_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド + MCU_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ + MCU_PXI_RESULT_ILLEGAL_STATUS, // MCUの状態により処理を実行不可 + MCU_PXI_RESULT_BUSY, // 他のリクエストを実行中 + MCU_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗 + MCU_PXI_RESULT_MAX +} +SYSMMcuPxiResult; + + +/*===========================================================================*/ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* SYSM_MCU_COMMON_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/include/sysmenu/memorymap.h b/include/sysmenu/memorymap.h new file mode 100644 index 00000000..cfa4bf0e --- /dev/null +++ b/include/sysmenu/memorymap.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - memorymap + File: memorymap.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef SYSM_MEMORYMAP_H_ +#define SYSM_MEMORYMAP_H_ + + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_MEMORYMAP_H_ */ +#endif diff --git a/include/sysmenu/namut.h b/include/sysmenu/namut.h new file mode 100644 index 00000000..01209525 --- /dev/null +++ b/include/sysmenu/namut.h @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - NAMUT + File: namut.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 NAM_UTILITY_H_ +#define NAM_UTILITY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SDK_ARM9 + +typedef void* (*NAMUTAlloc)(u32 size); +typedef void (*NAMUTFree)(void* ptr); + +/*---------------------------------------------------------------------------* + Name: NAMUT_Init + + Description: NAMUT ライブラリの初期化を行います。 + + Arguments: allocFunc: メモリ確保関数へのポインタ。(要:32byteアライメント) + freeFunc: メモリ解放関数へのポインタ。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void NAMUT_Init(NAMUTAlloc allocFunc, NAMUTFree freeFunc); + +/*---------------------------------------------------------------------------* + Name: NAMUT_Format + + Description: NANDの擬似フォーマット + (システム系の必要なファイルのみを残し他を消去します) + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_Format(void); + +/*---------------------------------------------------------------------------* + Name: NAMUT_FormatCore + + Description: 本体初期化(NAND初期化)を行います。 + (システム系の必要なファイルのみを残し他を消去します + ユーザーアプリを common, personalizedに関わらず全て消去するか、 +        personalizedのみ消去するかを引数で選択できます。 + + Arguments: isForceEraseCommonETicket: TRUE の時は、common, personalizedに関わらずユーザーアプリを全消去 + FALSEの時は、commonETicketを残す(アプリ自身は消去) + isDeleteWifiSettings: WiFi設定を削除するか?(TRUEで削除) + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_FormatCore( BOOL isForceEraseCommonETicket, BOOL isDeleteWiFiSettings ); + +/*---------------------------------------------------------------------------* + Name: NAMUT_GetSoftBoxCount + + Description: NANDの installedカウント、freeカウントを調べて + 指定された変数に格納します。 + + Arguments: installed : installedカウント格納変数 + free : freeカウント格納変数 + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_GetSoftBoxCount( u8* installed, u8* free ); + +/*---------------------------------------------------------------------------* + Name: NAMUT_UpdateSoftBoxCount + + Description: InstalledSoftBoxCount, FreeSoftBoxCount の値を + 現在のNANDの状態に合わせて更新します。 + + Arguments: None. + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_UpdateSoftBoxCount( void ); + +/*---------------------------------------------------------------------------* + Name: NAMUTi_ClearSavedataPublic + + Description: 指定したセーブデータファイルに対して + FFクリア&フォーマットを行います。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_ClearSavedataPublic(const char* path, u64 titleID); + +/*---------------------------------------------------------------------------* + Name: NAMUTi_ClearSavedataPrivate + + Description: 指定したセーブデータファイルに対して + FFクリア&フォーマットを行います。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_ClearSavedataPrivate(const char* path, u64 titleID); + +/*---------------------------------------------------------------------------* + Name: NAMUTi_DestroySubBanner + + Description: 指定したサブバナーのCRC破壊を試みます。 + 指定したサブバナーが存在しない可能性もありますが + その場合でもTRUEを返します。(コードはOS_DeleteSubBannerFileのパクリ) + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUTi_DestroySubBanner(const char* path); + +/*---------------------------------------------------------------------------* + Name: NAMUT_DeleteNandDirectory + + Description: 指定ディレクトリ以下を消去します。 + 指定ディレクトリ自体は残ります。 + + Arguments: path : 絶対パス(スラッシュを含めない) + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_DeleteNandDirectory(const char *path); + +/*---------------------------------------------------------------------------* + Name: NAMUT_DeleteNandTmpDirectory + + Description: "nand:/tmp" ディレクトリ以下を消去します。 + 例外として、"nand:/tmp/es" 以下を残します。 + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +BOOL NAMUT_DeleteNandTmpDirectory(void); + +/*---------------------------------------------------------------------------* + Name: NAMUT_ClearTWLSettings + + Description: TWL本体設定データのクリアを行います。 + + Arguments: TRUE : クリアした値をNANDにライトバックします。 + FALSE: NANDへのライトバックは行いません。 + + Returns: 成功ならTRUE + *---------------------------------------------------------------------------*/ +BOOL NAMUT_ClearTWLSettings( BOOL doWriteback ); + + +BOOL NAMUT_PrintInstalledTitleETicketType( void ); + +#endif // SDK_ARM9 + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif /* NAM_UTILITY_H_ */ diff --git a/include/sysmenu/reloc_info/common/reloc_info.h b/include/sysmenu/reloc_info/common/reloc_info.h new file mode 100644 index 00000000..ae4484b4 --- /dev/null +++ b/include/sysmenu/reloc_info/common/reloc_info.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: reloc_info.h + + Copyright 2007 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 __SYSMENU_RELOC_INFO_H__ +#define __SYSMENU_RELOC_INFO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------- +// データ型定義 +//---------------------------------------------------------------------- + +#define RELOCATE_INFO_NUM 4 // ROM再配置情報の数(今のところarm9,arm7それぞれltdとflxで最大4つ) +#define DEST_LIST_NUM (RELOCATE_INFO_NUM + 1) + +// 再配置情報データ構造体 +typedef struct Relocate_Info +{ + u32 src; + u32 dest; + u32 length; + u32 post_clear_addr; + u32 post_clear_length; + BOOL rev; +}Relocate_Info; + +// ROMセグメント名 +typedef enum RomSegmentName { + ARM9_STATIC = 0, + ARM7_STATIC = 1, + ARM9_LTD_STATIC = 2, + ARM7_LTD_STATIC = 3 +}RomSegmentName; + +//---------------------------------------------------------------------- +// 関数宣言 +//---------------------------------------------------------------------- + +// ロード領域のチェック及び再配置情報の生成 +BOOL SYSM_CheckLoadRegionAndSetRelocateInfo( RomSegmentName seg, u32 *dest, u32 length, Relocate_Info *info, BOOL isTwlApp ); + +#ifdef __cplusplus +} +#endif + +#endif // __SYSMENU_RELOC_INFO_H__ + diff --git a/include/sysmenu/sharedFont.h b/include/sysmenu/sharedFont.h new file mode 100644 index 00000000..d2f279ff --- /dev/null +++ b/include/sysmenu/sharedFont.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: sharedFont.h + + Copyright 2007 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 TWL_SHARED_FONT_H_ +#define TWL_SHARED_FONT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// 共有フォントインデックス +typedef enum SFONT_Index { + SHARED_FONT_WW_S = 0, + SHARED_FONT_WW_M = 1, + SHARED_FONT_WW_L = 2, + SHARED_FONT_MAX = 3 +}SFONT_Index; + + +// 共有フォント初期化 +BOOL SFONT_Init( void ); + +// 共有フォント テーブルサイズ取得 +int SFONT_GetInfoTableSize( void ); + +// 共有フォント テーブルロード +BOOL SFONT_LoadInfoTable( void *pBuffer ); + +// 共有フォント フォントサイズ取得 +int SFONT_GetFontSize( SFONT_Index index ); + +// 共有フォント フォントネーム取得 +const u8 *SFONT_GetFontName( SFONT_Index index ); + +// 共有フォント タイムスタンプ取得 +u32 SFONT_GetFontTimestamp( void ); + +// 共有フォント フォントロード +BOOL SFONT_LoadFont( SFONT_Index index, void *pBuffer ); + + +#ifdef __cplusplus +} +#endif + +#endif // TWL_SHARED_FONT_H_ diff --git a/include/sysmenu/sysmenu_lib.h b/include/sysmenu/sysmenu_lib.h new file mode 100644 index 00000000..29e08214 --- /dev/null +++ b/include/sysmenu/sysmenu_lib.h @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - SYSMENU_LIB + File: sysmenu_lib.h + + Copyright 2007 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:: 2007-09-06$ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#ifndef SYSM_SYSMENU_LIB_H_ +#define SYSM_SYSMENU_LIB_H_ + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* SYSM_SYSMENU_LIB_H_ */ +#endif diff --git a/include/sysmenu/sysmenu_lib/common/pxi.h b/include/sysmenu/sysmenu_lib/common/pxi.h new file mode 100644 index 00000000..0268674c --- /dev/null +++ b/include/sysmenu/sysmenu_lib/common/pxi.h @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: pxi.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 SYSM_COMMON_PXI_H_ +#define SYSM_COMMON_PXI_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------- +// PXIコマンド +//---------------------------------------------------------------------- + // (PXI_MAX_FIFO_TAG - 1) is used by SEA +#define PXI_FIFO_TAG_MCUTEST (PXI_MAX_FIFO_TAG - 2) +#define PXI_FIFO_TAG_HOTSW (PXI_MAX_FIFO_TAG - 3) +#define PXI_FIFO_TAG_DECRYPTAES (PXI_MAX_FIFO_TAG - 4) +#define SYSMENU_PXI_FIFO_TAG (PXI_MAX_FIFO_TAG - 5) + +typedef enum SYSMPXICommand { + SYSM_PXI_COMM_DUMMY = 0, +#ifdef DHT_TEST + SYSM_PXI_COMM_DS_HASH_TABLE, +#endif + + SYSM_PXI_COMM_NUM +}SYSMPXICommand; + +/*---------------------------------------------------------------------------* + 関数定義 + *---------------------------------------------------------------------------*/ + +// PXI初期化 +#ifdef SDK_ARM9 +void SYSM_InitPXI( void ); +#else // SDK_ARM7 +void SYSM_InitPXI( u32 mcu_prio ); +#endif // SDK_ARM7 + +#ifdef DHT_TEST +#ifdef SDK_ARM9 +void SYSMi_PrepareDatabase(void); +#endif +#endif + +// PXIコマンド送信 +BOOL SYSMi_TrySendPXICommand( SYSMPXICommand cmd, u16 data ); +BOOL SYSMi_SendPXICommand( SYSMPXICommand command, u16 data ); + +// PXIコマンド受信 +void SYSMi_PXIFifoRecvCallback( PXIFifoTag tag, u32 data, BOOL err ); + +#ifdef __cplusplus +} +#endif + +#endif // SYSM_COMMON_PXI_H_ diff --git a/include/sysmenu/sysmenu_lib/common/sysmenu_api.h b/include/sysmenu/sysmenu_lib/common/sysmenu_api.h new file mode 100644 index 00000000..5c408ac0 --- /dev/null +++ b/include/sysmenu/sysmenu_lib/common/sysmenu_api.h @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: SYSM_lib.h + + Copyright 2007 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 __SYSM_LIB_H__ +#define __SYSM_LIB_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data---------------------------------------------------------- + +#ifndef SDK_FINALROM +//#define SYSM_DEBUG_ // デバッグコード用ビルドスイッチ +//#define ENABLE_INITIAL_SETTINGS_ +#endif // SDK_FINALROM + +#define CARD_SLOT_NUM 1 // カードスロット数 +#define LAUNCHER_TITLE_LIST_NUM ( LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX + 1 ) // ランチャーのタイトルリスト数 + +#define SYSM_PAD_SHORTCUT_TP_CALIBRATION ( PAD_BUTTON_L | PAD_BUTTON_R | PAD_BUTTON_START ) +#define SYSM_PAD_SHORTCUT_MACHINE_SETTINGS ( PAD_BUTTON_SELECT ) +#define SYSM_PAD_PRODUCTION_SHORTCUT_CARD_BOOT ( PAD_BUTTON_A | PAD_BUTTON_B \ + | PAD_BUTTON_X | PAD_BUTTON_Y | PAD_BUTTON_R ) + // 量産工程で使用する初回起動設定をキャンセルしてカードブートするショートカットキー + +#define SYSM_MOUNT_INFO_SIZE (0x400 - OS_MOUNT_PATH_LEN) +#define SYSM_LAUNCHER_VER 1 // ランチャーバージョン(SDK側でランチャーに絡む処理の判定用) + // ver.1 : FSでのMountInfo有無の判定に使用 + + +#define SYSM_ALIGNMENT_LOAD_MODULE 32 // モジュールをsrlから読み込む際のアライメント(AESおよびAESで使うDMAの仕様による) + +// タイトルリスト作成用情報構造体 +typedef struct TitleListMakerInfo { + char makerCode[MAKER_CODE_MAX]; + u32 public_save_data_size; + u32 private_save_data_size; + BOOL permit_landing_normal_jump; + TitleInfoSub sub_info; +}TitleListMakerInfo; + + +// global variable------------------------------------------------------ +#ifdef SDK_ARM9 +extern const char *g_strIPLSvnRevision; +extern const char *g_strSDKSvnRevision; +extern void *SYSM_Alloc( u32 size ); +extern void SYSM_Free( void *ptr ); +//extern void *(*SYSM_Alloc)( u32 size ); // ライブラリ内部使用 +//extern void (*SYSM_Free)( void *ptr ); // 同上 +#endif + +// function------------------------------------------------------------- + +#ifdef SDK_ARM9 + +// 初期化 +extern void SYSM_Init( void *(*pAlloc)(u32), void (*pFree)(void*) ); // 初期化。 +extern void SYSM_InitPXI( void ); // PXI初期化 +extern void SYSM_SetArena( void ); // システムメニューのアリーナ初期化。OS_Initの後で呼んでください。 +extern void SYSM_SetAllocFunc( void *(*pAlloc)(u32), void (*pFree)(void*) ); // SYSM_initで設定した場合は必要なし。 +extern TitleProperty *SYSM_ReadParameters( void ); // 本体設定データ、ランチャーパラメータなどを取得 +extern void SYSM_DeleteTmpDirectory( TitleProperty *pBootTitle ); // "nand:/tmp"フォルダのクリーン + +// アプリ情報取得 +extern TitleProperty *SYSM_GetCardTitleList( BOOL *changed ); // カードアプリタイトルリストの取得 +extern void SYSM_InitTitleList( void ); // アプリタイトルリスト取得準備 +extern TitleProperty *SYSM_GetNandTitleList( void ); // NAND アプリタイトルリストの取得 +extern void SYSM_MakeNandTitleListMakerInfo( void ); // アプリ引き渡しタイトルリスト作成用情報の作成(ダイレクトブート用) +extern void SYSM_MakeNandTitleListAsync( void ); // 非同期版NANDアプリタイトルリストの作成 +extern void SYSM_MakeNandTitleListMakerInfoAsync( void ); // 非同期版アプリ引き渡しタイトルリスト作成用情報の作成 +extern BOOL SYSM_isNandTitleListReady( void ); // 非同期版が終了したかどうかの判定に使う +extern TitleProperty *SYSM_GetTitlePropertyList( void ); // SYSM_MakeNandTitleListAsyncで作成されたアプリリストのポインタを取得 +extern void SYSM_SetSystemMenuVersionControlData( void ); // SystemMenuVersionデータアクセスのための制御情報のセット + +// アプリ起動 +extern void SYSM_StartLoadTitle( TitleProperty *pBootTitle ); // 指定したTitlePropertyを別スレッドでロード開始 +extern BOOL SYSM_IsLoadTitleFinished( void ); // SYSM_StartLoadTitleで起動したスレッドが終了したかどうかを確認 +extern BOOL SYSM_IsLoadTitlePaused(void); // ローディングスレッドが一時停止しているか? +extern void SYSM_ResumeLoadingThread( BOOL force ); // ローディングスレッドが一時停止していたら再開 +extern void SYSM_StartAuthenticateTitle( TitleProperty *pBootTitle ); // 指定したTitlePropertyを別スレッドで検証開始 +extern BOOL SYSM_IsAuthenticateTitleFinished( void ); // SYSM_StartAuthenticateTitleで起動したスレッドが終了したかどうかを確認 +extern s32 SYSMi_getCheckTitleLaunchRightsResult( void ); // CheckTitleLaunchRightsの結果を返す(デバグ用) +extern void SYSM_TryToBootTitle( TitleProperty *pBootTitle ); // pBootTitleで指定したタイトルをブート。never return. + +// AES領域デクリプト +extern void SYSM_StartDecryptAESRegion( ROM_Header_Short *hs ); // 起動するROMのAES暗号化領域のデクリプト開始 +extern BOOL SYSM_InitDecryptAESRegion_W( ROM_Header_Short *hs ); // WRAM経由ファイル読み込みのコールバックで使うAESデクリプト処理の初期化 +extern void SYSM_StartDecryptAESRegion_W( const void *wram_addr, const void *orig_addr, u32 size ); + // WRAM経由ファイル読み込みのコールバックで使うAESデクリプト処理関数 +// Nintendoロゴ制御 +extern BOOL SYSM_CheckNintendoLogo( u16 *pLogoData ); // Nintendoロゴデータのチェック +extern void SYSM_LoadNintendoLogo2D( u16 *pLogoData, u16 *pDst, int paletteColorIndex ); // NintendoロゴデータをOBJ_2D形式でロード(pTempBufferには0x700bytes必要) +extern void SYSM_LoadNintendoLogo1D( u16 *pLogoData, u16 *pDst, int paletteColorIndex ); // NintendoロゴデータをOBJ_1D形式でロード(同上) + + + +#endif + +// 状態チェック +extern BOOL SYSM_IsExistCard( void ); // TWL/NTRカードが差さっているか?(アプリは未認証状態) +extern BOOL SYSM_IsInspectCard( void ); // 検査カードが差さっているか? +extern BOOL SYSM_IsHotStart( void ); // ホットスタートか? +extern BOOL SYSM_IsLogoDemoSkip( void ); // ロゴデモ飛ばし状態か? +extern void SYSM_SetLogoDemoSkip( BOOL skip ); // ロゴデモ飛ばし状態フラグを設定する。 +extern BOOL SYSM_IsValidTSD( void ); // TWL設定データは有効か? +extern void SYSM_SetValidTSD( BOOL valid ); // TWL設定データの有効/無効フラグを設定する。 +extern const LauncherParamBody *SYSM_GetLauncherParamBody( void ); // ランチャーパラメータの取得 +extern void SYSM_SetHeaderLoadCompleted( BOOL comp ); // ヘッダロード完了フラグ設定 +extern void SYSM_SetLoadFinished( BOOL finish ); // アプリロード完了フラグ設定 +extern void SYSM_SetLoadSucceeded( BOOL succeed ); // アプリロード成功フラグ設定 +extern void SYSM_SetCardBoot( BOOL card ); // カードブートフラグ設定 +extern void SYSM_SetHotStart( BOOL hot ); // ホットスタートフラグ設定 +extern void SYSM_SetValidLauncherParam( BOOL valid ); // ランチャーパラメータ有効フラグ設定 +extern void SYSM_SetResetRTC( BOOL reset ); // リセットRTCフラグ設定 +extern void SYSM_SetNANDFatalError( BOOL fatal ); // NANDFatalエラーフラグ設定 +extern void SYSM_SetARM9Start( BOOL start ); // ARM9開始可能フラグ設定 + +extern BOOL SYSM_IsLauncherHidden( void ); // ランチャーの画面を表示しないバージョンか? + +// AES領域デクリプト +extern void SYSM_InitDecryptAESPXICallback( void ); // AES領域デクリプト用のPXIコールバック設定 + +#ifdef __cplusplus +} +#endif + +#endif // __SYSM_LIB_H__ diff --git a/include/sysmenu/sysmenu_lib/common/sysmenu_work.h b/include/sysmenu/sysmenu_lib/common/sysmenu_work.h new file mode 100644 index 00000000..f0f4e01c --- /dev/null +++ b/include/sysmenu/sysmenu_lib/common/sysmenu_work.h @@ -0,0 +1,236 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: sysmenu_work.c + + Copyright 2007 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 __SYSMENU_WORK_H__ +#define __SYSMENU_WORK_H__ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// define data ------------------------------------ +typedef enum SYSMCloneBootMode { + SYSM_CLONE_BOOT_MODE = 1, + SYSM_OTHER_BOOT_MODE = 2 +} +SYSMCloneBootMode; + +typedef enum CardDataReadState { + CARD_READ_SUCCESS = 0, + CARD_READ_TIME_OUT, + CARD_READ_PULLED_OUT_ERROR, + CARD_READ_BUFFER_OVERRUN_ERROR, + CARD_READ_MODE_ERROR, + CARD_READ_BUSY, + CARD_READ_ID_CHECK_ERROR, + CARD_READ_BUS_LOCK_ERROR, + CARD_READ_UNEXPECTED_ERROR +} +CardDataReadState; + +// WRAM経由でカードデータを読み込む場合に使用 +typedef struct CardReadParam { + u32 src; + u32 dest; + u32 size; +}CardReadParam; + +//---------------------------------------------------------------------- +// ROMエミュレーション情報 +//---------------------------------------------------------------------- +#define SYSM_ROMEMU_INFO_SIZE 0x20 // ROMエミュレーションデータサイズ +#define SYSM_ROMEMU_INFO_MAGIC_CODE 0x444c5754 // "TWLD"の文字列 + +// ISデバッガROMエミュレーション情報 +typedef struct SYSMRomEmuInfo { + // マジックコード(SYSM_ROMEMU_INFO_MAGIC_CODEの固定値) + u32 magic_code; + // フラグ類 + u32 isEnableSlot1 : 1; + u32 isEnableSlot2 : 1; + u32 bootSlotNo : 2; + u32 isEnableExMainMemory : 1; + u32 isBootMachineSettings : 1; + u32 isBootSpecifiedNANDApp : 1; + u32 isTlfRom : 1; + + u32 isForceNTRMode : 1; + u32 isForceBannerViewMode : 1; + u32 :0; + // isBootSpecifiedNANDAppで起動するアプリのTitleID + u64 titleID; + // 予約 + u8 rsv[ 0x10 ]; +} +SYSMRomEmuInfo; + + +//---------------------------------------------------------------------- +// SYSMワーク +//---------------------------------------------------------------------- +// SYSM共有ワーク構造体 +typedef struct SYSM_work { + Relocate_Info romRelocateInfo[RELOCATE_INFO_NUM]; // ROM再配置情報(arm9,arm7それぞれltdとflxで最大4つ) + struct { + struct { + vu8 isHotStart :1; // Hot/Coldスタート判定 + vu8 isValidLauncherParam :1; // ランチャーパラメータ有効 + vu8 isResetRTC :1; // RTCリセット発生 + vu8 isNANDFatalError :1; // NANDFATALエラー発生 + vu8 isARM9Start :1; // ARM9スタートフラグ + vu8 :0; + }arm7; + + struct { + vu8 isValidTSD :1; // NITRO設定データ無効フラグ + vu8 isLogoSkip :1; // ロゴデモスキップ + vu8 isHeaderLoadCompleted :1; // アプリヘッダロード完了? + vu8 isLoadFinished :1; // アプリロード完了? + vu8 isLoadSucceeded :1; // アプリロード成功? + vu8 isCardBoot :1; // カードブートか? + vu8 :0; + }arm9; + + struct { + vu16 isExistCard :1; // 有効なNTR/TWLカードが存在するか? + vu16 isInspectCard :1; // 検査カードか? + vu16 isOnDebugger :1; // デバッガ動作か? + vu16 isEnableHotSW :1; // 活線挿抜有効? + vu16 isLoadRomEmuOnly :1; // ROMエミュレーション情報のみロード + vu16 isCardLoadCompleted :1; // カードからデータロード完了? + vu16 isValidCardBanner :1; // バナーデータ更新? + vu16 is1stCardChecked :1; // カードデータの1stチェック完了? + vu16 isCardGameMode :1; // カードがゲームモードに遷移したか? + vu16 isFinalized :1; // HOTSW終了処理完了 + vu16 :0; + vu8 isCardStateChanged; // カード状態更新フラグ + vu8 isBusyHotSW; // 活線挿抜処理中? + vu8 isKeyTableLoadReady; // Key Tableのロード準備完了? + }hotsw; + }flags; // 9B + + OSLockWord lockCardRsc ATTRIBUTE_ALIGN(8); // カードリソース排他制御用 + OSLockWord lockHotSW; // カードリソース排他制御用 + u32 appCardID; // カードID + OSBootType appBootType; // ブート種別 + u32 gameCommondParam; // NTRのゲームコマンドパラメータ(NTRのROMヘッダのゲームコマンドパラメータに上書きする) + u8 cloneBootMode; + + CardReadParam cardReadParam; // カードリードパラメータ + u32 romHeaderNTR[HW_CARD_ROM_HEADER_SIZE/sizeof(u32)]; // NTR-ROMヘッダ一時バッファ + + LauncherParam launcherParam; + SYSMRomEmuInfo romEmuInfo; + RTCRawData Rtc1stData; // RTC初回ロード値 8byte + + BOOL isDeveloperAESMode; // 開発用セキュリティか?(製品版でFALSE) + void *addr_AESregion[2]; // AES暗号化領域の格納アドレス + u32 size_AESregion[2]; // AES暗号化領域のサイズ + u8 keyAES[AES_KEY_SIZE]; // 開発版AES暗号化領域の復号に使用するKEY(に使うタイトルネーム) + u8 idAES[GAME_CODE_MAX]; // 製品版AES暗号化領域の復号に使用するID(に使うゲームコード) + u8 seedAES[AES_KEY_SIZE]; // 製品版AES暗号化領域の復号に使用するSEED + u8 counterAES[2][AES_BLOCK_SIZE]; // AES暗号化領域の復号に使用するカウンタ初期値 + + // NTR-IPL2のレガシー 最終的には消すと思う + BOOL enableCardNormalOnly; + u8 rtcStatus; +}SYSM_work; + +typedef struct SYSM_work2 { + SVCHMACSHA1Context hmac_sha1_context; + TitleProperty bootTitleProperty; + char bootContentPath[ FS_ENTRY_LONGNAME_MAX ]; +}SYSM_work2; + +// NTRにおける仕様を継承する必要のあるワーク +typedef struct SDKBootCheckInfo{ + u32 nCardID; // NORMALカードID // SDKではここだけ見ているっぽい ※最終的にはランチャーでここにカードIDをセットする + u32 sCardID; // SECUREカードID + u16 cardHeaderCrc16; // カードヘッダCRC16 + u16 cardSecureCrc16; // カードSECURE領域CRC16 + s16 cardHeaderError; // カードヘッダエラー + s16 disableEncryptedCardData; // カードSECURE領域暗号化データ無効 + + u16 sysromCrc16; // システムROMのCRC16 + s16 enableCardNormalOnly; // カードNORMALモードのみ有効 + s16 isOnDebugger; // デバッガ上で動作中か + s8 rtcError; // RTCエラー + u8 rtcStatus1; // RTCステータス1 + +}SDKBootCheckInfo; + + +// ARM9からARM7にWRAM経由で引き渡す鍵情報ワーク +typedef struct DeliverBROM9Key { + BLOWFISH_CTX ds_blowfish; +// u8 aes_key[ AES_KEY_SIZE ]; +}DeliverBROM9Key; + + +//---------------------------------------------------------------------- +// SYSM共有ワーク領域のアドレス獲得 +//---------------------------------------------------------------------- +// SYSMランチャーパラメータアドレスの取得(※ライブラリ向け。ARM9側はSYSM_GetLauncherParamを使用して下さい。) +#define SYSMi_GetLauncherParamAddr() ( (LauncherParam *)HW_PARAM_LAUNCH_PARAM ) + +// SYSM共有ワークの取得 +#define SYSMi_GetWork() ( (SYSM_work *)HW_TWL_SHARED_RESERVED ) +#define SYSMi_GetWork2() ( (SYSM_work2 *)HW_MAIN_MEM_SHARED ) + +// SDKブートチェック(アプリ起動時にカードIDをセットする必要がある。) +#define SYSMi_GetSDKBootCheckInfo() ( (SDKBootCheckInfo *)HW_BOOT_CHECK_INFO_BUF ) +#define SYSMi_GetSDKBootCheckInfoForNTR() ( (SDKBootCheckInfo *)0x027ffc00 ) + +// NANDファームがロードしてくれているマイコンフリーレジスタ値の取得 +#define SYSMi_GetMCUFreeRegisterValue() ( *(vu8 *)HW_RESET_PARAMETER_BUF ) + +// ROMヘッダワークの取得 +#define SYSM_GetAppRomHeader() ( (ROM_Header_Short *)SYSM_APP_ROM_HEADER_BUF ) +#define SYSM_GetCardRomHeader() SYSM_GetAppRomHeader() + +// ARM9から引き渡す鍵情報ワークの取得 +#ifdef SDK_ARM9 +#define GetDeliverBROM9KeyAddr() ( (DeliverBROM9Key *)HW_WRAM_0 ) +#else +#define GetDeliverBROM9KeyAddr() ( (DeliverBROM9Key *)HW_WRAM_0_LTD ) +#endif + +// ISデバッガ上で動作しているか? +static inline BOOL SYSM_IsRunOnDebugger( void ) +{ +#ifdef SYSM_BUILD_FOR_DEBUGGER + return SYSMi_GetWork()->flags.hotsw.isOnDebugger; +#else + return FALSE; +#endif +} + + + +#ifdef __cplusplus +} +#endif + +#endif // __SYSMENU_WORK_H__ + diff --git a/include/sysmenu/types.h b/include/sysmenu/types.h new file mode 100644 index 00000000..818c9144 --- /dev/null +++ b/include/sysmenu/types.h @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: types.h + + Copyright 2007 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 __SYSM_TYPES_H__ +#define __SYSM_TYPES_H__ + +#include +#include +#include <../build/libraries/os/common/include/application_jump_private.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// define data---------------------------------------------------------- + +// NAMTitleIDをHiLoに分割してアクセスする場合に使用 +typedef struct TitleID_HiLo { + u8 Lo[ 4 ]; + u32 Hi; +}TitleID_HiLo; + + +// タイトル情報サブ +typedef struct TitleInfoSub { + RomExpansionFlags exFlags; + char platform_code; + u8 parental_control_rating_info[ PARENTAL_CONTROL_INFO_SIZE ]; + u32 card_region_bitmap; + u8 agree_EULA_version; +}TitleInfoSub; + + +// タイトル情報 +typedef struct TitleProperty { // この情報は、ランチャー時には認証通ってないけど、起動時には認証通すので大丈夫だろう。 + NAMTitleId titleID; // タイトルID(TitleID_Hiで起動メディアは判定できる?) + LauncherBootFlags flags; // ブート時のランチャー動作フラグ + TWLBannerFile *pBanner; // バナーへのポインタ(固定長フォーマットなら偽造されても大丈夫だろう。) + TitleInfoSub sub_info; +}TitleProperty; + + +#ifdef __cplusplus +} +#endif + +#endif // __SYSM_TYPES_H__ diff --git a/include/sysmenu/util.h b/include/sysmenu/util.h new file mode 100644 index 00000000..a20a68c4 --- /dev/null +++ b/include/sysmenu/util.h @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util.h + + Copyright 2007 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 __SYSM_UTIL_H__ +#define __SYSM_UTIL_H__ + +#include +#include +#ifdef SYSM_BUILD_FOR_DEBUGGER +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// define data---------------------------------------------------------- +#define BACKLIGHT_BRIGHTNESS_MAX 4 + +typedef enum FatalErrorCode { + FATAL_ERROR_UNDEFINED = 0, + FATAL_ERROR_NAND = 1, // NANDデバイスのエラー + FATAL_ERROR_HWINFO_NORMAL = 2, // HWノーマル情報のリードエラー + FATAL_ERROR_HWINFO_SECURE = 3, // HWセキュア情報のリードエラー + FATAL_ERROR_TWLSETTINGS = 4, // 本体設定データのリードエラー + FATAL_ERROR_SHARED_FONT = 5, // 共有フォントのリードエラー + FATAL_ERROR_WLANFIRM_AUTH = 6, // 無線ファームの認証エラー + FATAL_ERROR_WLANFIRM_LOAD = 7, // 無線ファームのロードエラー + FATAL_ERROR_TITLE_LOAD_FAILED = 8, // アプリケーションのロードエラー + FATAL_ERROR_TITLE_POINTER_ERROR = 9, // ブート要求されたが、アプリが指定されていない + FATAL_ERROR_AUTHENTICATE_FAILED = 10, // アプリ認証失敗 + FATAL_ERROR_ENTRY_ADDRESS_ERROR = 11, // アプリの起動アドレスが不正 + FATAL_ERROR_TITLE_BOOTTYPE_ERROR = 12, // アプリブートタイプが不正(NANDブート、カードブート、MBブート以外の値) + FATAL_ERROR_SIGN_DECRYPTION_FAILED = 13, // アプリ署名デクリプト失敗 + FATAL_ERROR_SIGN_COMPARE_FAILED = 14, // アプリ署名検証失敗 + FATAL_ERROR_HEADER_HASH_CALC_FAILED = 15, // アプリハッシュ計算用メモリ確保失敗 + FATAL_ERROR_TITLEID_COMPARE_FAILED = 16, // ブート要求されたTWLアプリと実際にロードしたアプリのTitleIDが不一致 + FATAL_ERROR_VALID_SIGN_FLAG_OFF = 17, // アプリROMヘッダの署名有効フラグが立っていない + FATAL_ERROR_CHECK_TITLE_LAUNCH_RIGHTS_FAILED = 18, // アプリ起動認証失敗 + FATAL_ERROR_MODULE_HASH_CHECK_FAILED = 19, // アプリハッシュ不一致 + FATAL_ERROR_MODULE_HASH_CALC_FAILED = 20, // アプリハッシュ計算用メモリ確保失敗 + FATAL_ERROR_MEDIA_CHECK_FAILED = 21, // カードアプリをNAND起動 or NANDアプリをカード起動しようとした(デバッガ起動を除く) + FATAL_ERROR_DL_MAGICCODE_CHECK_FAILED = 22, // DSダウンロードプレイアプリ署名のマジックコードが不正(TEMPブートアプリブート時) + FATAL_ERROR_DL_SIGN_DECRYPTION_FAILED = 23, // DSダウンロードプレイアプリ署名のデクリプト失敗(TEMPブートアプリブート時) + FATAL_ERROR_DL_HASH_CALC_FAILED = 24, // DSダウンロードプレイアプリハッシュ計算用メモリ確保失敗(TEMPブートアプリブート時) + FATAL_ERROR_DL_SIGN_COMPARE_FAILED = 25, // DSダウンロードプレイアプリハッシュ不一致(TEMPブートアプリブート時) + FATAL_ERROR_WHITELIST_INITDB_FAILED = 26, // NTRホワイトリスト自身の認証失敗 + FATAL_ERROR_WHITELIST_NOTFOUND = 27, // 起動NTRアプリのイニシャルコードがNTRホワイトリストに見つからなかった + FATAL_ERROR_DHT_PHASE1_FAILED = 28, // アプリのNTRホワイトリスト認証失敗(フェーズ1) + FATAL_ERROR_DHT_PHASE2_FAILED = 29, // アプリのNTRホワイトリスト認証失敗(フェーズ2) + FATAL_ERROR_LANDING_TMP_JUMP_FLAG_OFF = 30, // TMPブートアプリのROMヘッダにTMPジャンプ許可ビットが立っていない + FATAL_ERROR_TWL_BOOTTYPE_UNKNOWN = 31, // TWLアプリブートタイプ不明 + FATAL_ERROR_NTR_BOOTTYPE_UNKNOWN = 32, // NTRアプリブートタイプ不明 + FATAL_ERROR_PLATFORM_UNKNOWN = 33, // ROMヘッダのプラットホームコード不明 + FATAL_ERROR_LOAD_UNFINISHED = 34, // アプリロードが完了していないのに、認証フェーズに進んだ + FATAL_ERROR_LOAD_OPENFILE_FAILED = 35, // NANDアプリのファイルオープン失敗 + FATAL_ERROR_LOAD_MEMALLOC_FAILED = 36, // アプリハッシュ計算用メモリ確保失敗 + FATAL_ERROR_LOAD_SEEKFILE_FAILED = 37, // NANDアプリのファイルシーク失敗 + FATAL_ERROR_LOAD_READHEADER_FAILED = 38, // アプリROMヘッダロード失敗 + FATAL_ERROR_LOAD_LOGOCRC_ERROR = 39, // アプリROMヘッダNintendoロゴCRC不正 + FATAL_ERROR_LOAD_READDLSIGN_FAILED = 40, // TMPブートアプリのDSダウンロードプレイ署名リード失敗 + FATAL_ERROR_LOAD_RELOCATEINFO_FAILED = 41, // アプリ再配置情報生成失敗 + FATAL_ERROR_LOAD_READMODULE_FAILED = 42, // アプリロード失敗 + FATAL_ERROR_NINTENDO_LOGO_CHECK_FAILED = 43, // アプリROMヘッダNintendoロゴデータ不正 + FATAL_ERROR_SYSMENU_VERSION = 44, // + FATAL_ERROR_DHT_PHASE1_CALC_FAILED = 45, // NTRアプリホワイトリストハッシュ計算用メモリ確保失敗 + FATAL_ERROR_LOAD_UNKNOWN_BOOTTYPE = 46, // アプリブートタイプが不正 + FATAL_ERROR_LOAD_AUTH_HEADER_FAILED = 47, // アプリROMヘッダ認証失敗 + FATAL_ERROR_LOAD_NEVER_STARTED = 48, // ロードが開始されていないのに、認証が開始された + FATAL_ERROR_EJECT_CARD_AFTER_LOAD_START = 49, // カードが抜かれているのに、カードアプリのロードが開始された + FATAL_ERROR_TITLEID_COMPARE_FAILED_NTR = 50, // ブート要求されたNTRアプリと実際にロードしたアプリのTitleIDが不一致 + FATAL_ERROR_DHT_PHASE3_FAILED = 51, // アプリのNTRホワイトリスト認証失敗(フェーズ3) + FATAL_ERROR_DHT_PHASE4_FAILED = 52, // アプリのNTRホワイトリスト認証失敗(フェーズ4) + + FATAL_ERROR_MAX = 53 +}FatalErrorCode; + + +// global variable------------------------------------------------------ +// function------------------------------------------------------------- + +#ifdef SDK_ARM9 + +// バックライト +extern u32 UTL_SetBacklightBrightness( u8 brightness ); // バックライト輝度セット +extern u32 UTL_GetBacklightBrightness( u8 *pBrightness ); // バックライト輝度ゲット + +// タッチパネル +extern void UTL_CaribrateTP( const LCFGTWLTPCalibData *pCalib ); // TPキャリブレーション +extern BOOL UTL_IsValidCalibration( u16 x, u16 y, u16 correct_x, u16 correct_y ); // TPキャリブレーション後にタッチしたポイントが正確か? + +// スリープ +extern void UTL_GoSleepMode( void ); + +// RTC関係 +extern BOOL UTL_CheckRTCDate( RTCDate *pDate ); // 日付が正常かチェック +extern BOOL UTL_CheckRTCTime( RTCTime *pTime ); // 時刻が正常かチェック +extern s64 UTL_CalcRTCOffset( RTCDate *pNewDate, RTCTime *pNewTime ); // RTCオフセット計算とRTCへの日付時刻チェックを行う +extern u32 UTL_GetDayNum( u32 year, u32 month ); // 指定された年・月の日数を取得する +extern BOOL UTL_IsLeapYear100( u32 year ); // 指定された年がうるう年か調べる + +// ペアレンタルコントロール問い合わせ +extern u32 UTL_CalcPCTLInquiryCode( void ); // 問い合わせコード(10進8桁)算出 +extern u32 UTL_CalcPCTLMasterKey( void ); // マスターキー  (10進5桁)算出(※内部でRTC_GetDateを使用します。) + +// アプリROMヘッダの要EULAフラグ取得 +extern BOOL UTL_IsROMHeaderEULARequired( void ); + +// アプリROMヘッダのnintendoロゴの正当性チェック +extern BOOL UTL_CheckNintendoLogoData( ROM_Header_Short *rh ); + +#endif + +// FATALエラー +extern BOOL UTL_IsFatalError( void ); // FATALエラーか? +extern void UTL_SetFatalError( FatalErrorCode error ); // FATALエラーのセット +extern u64 UTL_GetFatalError( void ); // FATALエラー状態の取得(FatalErrorCodeをビットに割り当てて格納しています。) + + +// リージョンチェック +static inline BOOL UTL_CheckAppRegion( u32 card_region_bitmap ) +{ +#ifdef SYSM_BUILD_FOR_DEBUGGER +#pragma unused(card_region_bitmap) + // デバッガ動作時のみ、リージョンチェックを無効にする。 + if( SYSM_IsRunOnDebugger() ) { + return TRUE; + } +#endif + return ( card_region_bitmap & ( 0x00000001 << OS_GetRegion() ) ) ? TRUE : FALSE; +} + +// CRCチェック +static inline BOOL UTL_CheckAppCRC16( ROM_Header_Short *pROMH ) +{ + u16 calc_crc = SVC_GetCRC16( 65535, pROMH, 0x015e ); + if( ( calc_crc != pROMH->header_crc16 ) || + ( 0xcf56 != pROMH->nintendo_logo_crc16 ) ){ + return FALSE; + } + return TRUE; +} + + +#ifdef __cplusplus +} +#endif + +#endif // __SYSM_UTIL_H__ diff --git a/include/sysmenu/util_menuAppManager.h b/include/sysmenu/util_menuAppManager.h new file mode 100644 index 00000000..42fa2bba --- /dev/null +++ b/include/sysmenu/util_menuAppManager.h @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util_menuAppManager.h + + Copyright 2007 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 MENU_APP_MANAGER_H_ +#define MENU_APP_MANAGER_H_ + +#include +#include +#include +#include +#include <../build/libraries/os/common/include/application_jump_private.h> + +#include +#include + +typedef struct AMNBannerCounter +{ + u32 control; + u8 count; + const TWLBannerFile *banner; +} +AMNBannerCounter; + +typedef struct AMNFrameAnimeData{ + const u8 *image; + const u8 *pltt; + BOOL vflip; + BOOL hflip; +} +AMNFrameAnimeData; + + +// アプリマネージャ + +void AMN_init( void *(*pAlloc)(u32), void (*pFree)(void*) ); +void AMN_restart(); +void AMN_restartWithReadNandTitle(); +void AMN_restartWithReadNandTitleHeaderShort(); +void AMN_destroy(); + +BOOL AMN_isNandTitleListReady(); +s32 AMN_getNandTitleListLengthForLauncher(); +s32 AMN_getCardTitleListLength(); +s32 AMN_getRomHeaderListLength(); + +// 本体設定の場合、アプリマネージャ用indexは飛び飛びになったり、 +// ForSetting()が返す値(個数)より大きくなるので +// getNandTitleListLengthForSetting()は用意しない。 +// isIndexValidForSetting()で、本体設定用としても有効かどうかを +// 判定してもらう予定。 +BOOL AMN_isIndexValidForSetting(s32 index); +s32 AMN_getIndexByTitleId(NAMTitleId titleId); +NAMTitleId AMN_getTitleIdByIndex(s32 index); + +void AMN_stepBannerAnimeAll(BOOL restart); +void AMN_stepBannerAnime(s32 index, BOOL restart); + +const TitleProperty* AMN_getTitleProperty(s32 index); +const ROM_Header_Short* AMN_getTitleRomHeaderShort(s32 index); + +const u8* AMN_getBannerImage(s32 index); +const u8* AMN_getBannerPltt(s32 index); +BOOL AMN_getBannerHFlip(s32 index); +BOOL AMN_getBannerVFlip(s32 index); +AMNFrameAnimeData AMN_getBannerAnime(s32 index); +const u16* AMN_getBannerText(s32 index); +const u16* AMN_getBannerText2(s32 index, OSLanguage language); + +BOOL AMN_isDSWirelessIcon(s32 index); +BOOL AMN_isWiFiConnectionIcon(s32 index); +BOOL AMN_isAgreeEULAFlag(s32 index); +// info size is cParentalControlRatingInfoSize +const u8* AMN_getParentalControlRatingInfo(s32 index); + +BOOL AMN_checkBannerFile(TWLBannerFile* pBanner); + +// 生データ(TitlePropertyのリスト、HeaderShortリスト)にアクセスできる抜け道関数 +TitleProperty* AMN_getTitlePropertyList( void ); +ROM_Header_Short* AMN_getRomHeaderList( void ); + +enum { + // アプリマネージャ用タイトルindexは、0から始まり非負です。 + // 0はCARD固定です。 + // 1から39がNANDになります。 + cAllTitleIndexStart = 0, + cCardTitleIndexStart = cAllTitleIndexStart, + cCardTitleArrayMax = 1, + cNandTitleIndexStart = cCardTitleIndexStart + cCardTitleArrayMax, + cNandTitleArrayMax = LCFG_TWL_FREE_SOFT_BOX_COUNT_MAX, + cAllTitleArrayMax = cCardTitleArrayMax + cNandTitleArrayMax +}; + +#endif diff --git a/include/sysmenu/util_recoveryFile.h b/include/sysmenu/util_recoveryFile.h new file mode 100644 index 00000000..82b250de --- /dev/null +++ b/include/sysmenu/util_recoveryFile.h @@ -0,0 +1,33 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL + File: util_recoveryFile.h + + Copyright **** 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 __UTIL_RECOVERY_FILE__ +#define __UTIL_RECOVERY_FILE__ + +#include + +typedef enum UTL_RecoveryStatus{ + UTL_RCV_OK = 0, + UTL_RCV_SIZE_CHANGED, + UTL_RCV_FILE_CREATED, + UTL_RCV_FAILED +} UTL_RecoveryStatus; + +/*-- function prototype -------------------------*/ +extern UTL_RecoveryStatus UTL_RecoveryFile( const char* path, const u32 filesize ); + +#endif \ No newline at end of file diff --git a/keys/dummy/rsa/private9_0.der b/keys/dummy/rsa/private9_0.der new file mode 100644 index 00000000..97d98781 Binary files /dev/null and b/keys/dummy/rsa/private9_0.der differ diff --git a/keys/dummy/rsa/private9_0.pem b/keys/dummy/rsa/private9_0.pem new file mode 100644 index 00000000..f6c6617b --- /dev/null +++ b/keys/dummy/rsa/private9_0.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC3BwxSGFBaRoOE1TQkMjRoDjhU9nmydzl6m3kubdy0ZzxMb/fd +NLMyRvtsMjxjmrEKYImhPfRBtXH6TE2RW5izpxtgQ5rYqE02omHZwhIafpg4lhNT +ZWROD0904XelD2nIcn9TpRzXncjsRCc8dpHbTziJj3K8VchQuSywNLKP0wIDAQAB +AoGBAJTgwc/hgTL9mqupNYGf6OsfbgkGeJWHz5SA9QCkUtvYAb93cJpZ7M2f2ZH4 +BxFKWmpDfpBPMellK3JbMNllNX7DIxjBgXElomcyysQUf5l/cVCRaKoBg/dFQ0U7 +9TyD4BdmlE14LGgXYjd+MjQVrIhrDK4rOyJ2URdDoV1PZawxAkEA73mByR0z+/gJ +og03JIL46tS2dsO5mjCYvCdvaneBXuWlUYRc3zrJJrwX9FOm8NmUWKFKYOwg7Ylx +lptHcY4BSwJBAMOoXLS7FsXajXnzeR0Y5EIAo9+ZYmn9ylLe0u9iaL/RXV8S9w8P +NdHrpZRoddLb+LCFhVeY9SwiSAkR9ZjnHpkCQC5oAXqTqis92cAJh5IPv2Tia6mA +LEtw92gezDx5hBx7rBmr6MNphOl4sburKkKqJ1E1kFBP8eGWLOjelm2u8xkCQQCf +jHFcp5ugZ+IqahJ/Wcb405DOS0Pnbp9ICJA1ySfmE5JybwKscxjOP7zcUnqSIfKf +76GWlxKGlMXtL4n4z68xAkBJJWrZvuGe0ha2wF0NVLURVWXctwFgEStNfWQqD+PM +DwVE6dHERFSO0ZPrfiZVUl/onk6H2ILEfdkSNzs75FSM +-----END RSA PRIVATE KEY----- diff --git a/keys/dummy/rsa/private_gcd.der b/keys/dummy/rsa/private_gcd.der new file mode 100644 index 00000000..91e7fe42 Binary files /dev/null and b/keys/dummy/rsa/private_gcd.der differ diff --git a/keys/dummy/rsa/private_nand.der b/keys/dummy/rsa/private_nand.der new file mode 100644 index 00000000..771e3bf3 Binary files /dev/null and b/keys/dummy/rsa/private_nand.der differ diff --git a/keys/dummy/rsa/private_nor.der b/keys/dummy/rsa/private_nor.der new file mode 100644 index 00000000..2f3aba7b Binary files /dev/null and b/keys/dummy/rsa/private_nor.der differ diff --git a/keys/dummy/rsa/pubkey9_0.der b/keys/dummy/rsa/pubkey9_0.der new file mode 100644 index 00000000..156e3a2f Binary files /dev/null and b/keys/dummy/rsa/pubkey9_0.der differ diff --git a/keys/dummy/rsa/pubkey9_0.pem b/keys/dummy/rsa/pubkey9_0.pem new file mode 100644 index 00000000..da0c94dc --- /dev/null +++ b/keys/dummy/rsa/pubkey9_0.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3BwxSGFBaRoOE1TQkMjRoDjhU +9nmydzl6m3kubdy0ZzxMb/fdNLMyRvtsMjxjmrEKYImhPfRBtXH6TE2RW5izpxtg +Q5rYqE02omHZwhIafpg4lhNTZWROD0904XelD2nIcn9TpRzXncjsRCc8dpHbTziJ +j3K8VchQuSywNLKP0wIDAQAB +-----END PUBLIC KEY----- diff --git a/keys/dummy/rsa/pubkey_gcd.der b/keys/dummy/rsa/pubkey_gcd.der new file mode 100644 index 00000000..b9cc07d1 Binary files /dev/null and b/keys/dummy/rsa/pubkey_gcd.der differ diff --git a/keys/dummy/rsa/pubkey_nand.der b/keys/dummy/rsa/pubkey_nand.der new file mode 100644 index 00000000..cbd2740d Binary files /dev/null and b/keys/dummy/rsa/pubkey_nand.der differ diff --git a/keys/dummy/rsa/pubkey_nor.der b/keys/dummy/rsa/pubkey_nor.der new file mode 100644 index 00000000..3c3999eb Binary files /dev/null and b/keys/dummy/rsa/pubkey_nor.der differ diff --git a/keys/makeHWInfo.pl b/keys/makeHWInfo.pl new file mode 100755 index 00000000..9b7337b6 --- /dev/null +++ b/keys/makeHWInfo.pl @@ -0,0 +1,105 @@ +#!/bin/perl + +use strict; + + +if( @ARGV != 8 ) { + die "usage: makeHWInfo.pl -r -s -k -o \n"; +} + +#引数チェック +my $cmd = &analyze_argv; + +if( !exists($cmd->{"-r"}) or + !exists($cmd->{"-s"}) or + !exists($cmd->{"-k"}) or + !exists($cmd->{"-o"}) ) { + die "parameter error.\n"; +} + + +#リージョン +my @regionNameList = qw/ JAPAN AMERICA EUROPE AUSTRALIA CHINA KOREA /; +my $i = 0; +my $region = 0xff; +foreach ( @regionNameList ) { + if( $cmd->{"-r"} eq $_ ) { + $region = $i; + last; + } + $i++; +} +if( $region == 0xff ) { + die "region error.\n", $cmd->{"-r"}; +} + + +#シリアルNo. +my $serialNo = $cmd->{"-s"}; +if( !( 11 == length($serialNo) or ( 12 == length($serialNo) ) ) ) { + die "serialNo length error. needs length \"11\" or \"12\"\n"; +} + + +#Bodyファイル +open(OUT, ">body.bin"); +binmode(OUT); +print OUT pack( "C", $region ); +print OUT pack( "A16", $serialNo ); +close(OUT); + + +#Headerファイル +my $version = 1; +my $length = 17; +open(OUT, ">header.bin"); +binmode(OUT); +print OUT pack( "C", $version ); +print OUT pack( "CCC", 0, 0, 0 ); +print OUT pack( "L", $length ); +close(OUT); + +#コンソール出力 +print "[Header]\n"; +printf " version : %d\n", $version; +printf " length : %d\n", $length; +print "[Body]\n"; +printf " region : %d (%s)\n", $region, $regionNameList[$region]; +printf " serialNo : %s (%d)\n", $serialNo, length($serialNo); + +#RSA署名 +my $key = $cmd->{"-k"}; +my $outName = $cmd->{"-o"}; +system "openssl dgst -sha1 -binary -out tgt.dgst body.bin"; +system "openssl rsautl -sign -in tgt.dgst -inkey $key -out tgt.sgn"; +system "cat tgt.sgn header.bin body.bin >$outName"; +system "rm header.bin body.bin tgt.dgst tgt.sgn"; + +exit; + + +sub analyze_argv +{ + my $opt; + my %cmd = (); + + foreach my $token ( @ARGV ) + { + if( substr($token, 0, 1) eq "-" ) + { + $opt = $token; + } + elsif( $opt ) + { + $cmd{$opt} = $token; + $opt = ""; + } + else + { + push @{$cmd{""}}, $token; + } + } + + return \%cmd; +} + diff --git a/man/WDS_Wrapper/html/_w_d_s_wrapper_8c.html b/man/WDS_Wrapper/html/_w_d_s_wrapper_8c.html new file mode 100644 index 00000000..3c49778e --- /dev/null +++ b/man/WDS_Wrapper/html/_w_d_s_wrapper_8c.html @@ -0,0 +1,282 @@ + + +WDSWrapper: src/WDSWrapper.c + + + + + +
    +

    src/WDSWrapper.c

    WDS繝ゥ繧、繝悶Λ繝ェ縺ョ繝ゥ繝繝代シ [隧ウ邏ー] +

    +#include "WDSWrapper.h"
    + + + + + + + + + + + + + + + + + + + + + + + +

    繝繝シ繧ソ讒矩

    struct  WDSWrapperWork
     WDS繝ゥ繝繝代シ縺ョ繝ッ繝シ繧ッ鬆伜沺 [隧ウ邏ー]

    髢「謨ー

    WDSWrapperErrCode WDS_WrapperInitialize (WDSWrapperInitializeParam param)
    WDSWrapperErrCode WDS_WrapperCleanup (void)
    WDSWrapperErrCode WDS_WrapperStartScan (void)
    WDSWrapperErrCode WDS_WrapperStopScan (void)
    WDSWrapperErrCode WDS_WrapperCheckValidBeacon (void)
    WDSWrapperErrCode WDS_WrapperSetArgumentParam (void)
    WDSWrapperErrCode WDS_WrapperCheckThreadRunning (void)
    OSThread * WDS_WrapperGetOSThread (void)
    +


    隱ャ譏

    +WDS繝ゥ繧、繝悶Λ繝ェ縺ョ繝ゥ繝繝代シ +

    +

    菴懆:
    S.Nakata
    +
    譌・莉:
    2008/06/24
    +
    繝舌シ繧ク繝ァ繝ウ:
    01.00
    +

    髢「謨ー

    + +
    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCheckThreadRunning (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′螳溯。御クュ縺狗「コ隱阪@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′螳溯。御クュ

    +WDSWRAPPER_ERRCODE_FAILURE: WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ッ蛛懈ュ「縺励※縺繧

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCheckValidBeacon (void   ) 
    +
    +
    + +

    +逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺溘°遒コ隱阪@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺

    +WDSWRAPPER_ERRCODE_FAILURE: 逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺ヲ縺縺ェ縺

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +
    隕壹∴譖ク縺:
    繝ゥ繧、繝悶Λ繝ェ蛻晄悄蛹匁凾縺ォ謖螳壹@縺溘さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ョ荳ュ縺ァ縺ョ縺ソ蜻シ縺ウ蜃コ縺励※荳九&縺
    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCleanup (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨r蛛懈ュ「縺励仝DS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ繧定ァ」謾セ縺励∪縺吶
    + 隗」謾セ蜃ヲ逅螳御コ縺ョ逶エ蜑阪↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺檎匱逕溘@縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ繧ィ繝ゥ繝シ縺碁夂衍縺輔l繧九%縺ィ縺ッ縺ゅj縺セ縺帙s縲

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS WDS繝ゥ繝繝代シ隗」謾セ繧帝幕蟋

    +WDSWRAPPER_ERRCODE_OPERATING WDS繝ゥ繝繝代シ隗」謾セ繧貞ョ溯。御クュ

    +WDSWRAPPER_ERRCODE_UNINITIALIZED WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    OSThread* WDS_WrapperGetOSThread (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′菴ソ逕ィ縺励※縺繧軌SThread縺ク縺ョ繝昴う繝ウ繧ソ繧貞セ励∪縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    NULL: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +NULL莉・螟: 螳溯。御クュ繝サ縺ゅk縺縺ッ蛛懈ュ「荳ュ縺ョOSThread縺ク縺ョ繝昴う繝ウ繧ソ

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperInitialize (WDSWrapperInitializeParam  param  ) 
    +
    +
    + +

    +WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ蛻晄悄蛹悶ョ髱槫酔譛溷ヲ逅繧帝幕蟋九@縺セ縺吶
    + 蛻晄悄蛹門ヲ逅螳御コ譎ゅ↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺檎匱逕溘@縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ァ繧ィ繝ゥ繝シ騾夂衍繧貞女縺大叙縺」縺溷エ蜷医ッ縲√Λ繧、繝悶Λ繝ェ縺瑚ェ蜍慕噪縺ォ隗」謾セ縺輔l繧九ョ繧貞セ縺」縺ヲ縺上□縺輔>縲

    蠑墓焚:
    + + +
    param WDS繝ゥ繝繝代シ蛻晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 蛻晄悄蛹門ヲ逅繧帝幕蟋

    +WDSWRAPPER_ERRCODE_INITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺ッ蛻晄悄蛹匁ク医∩

    +WDSWRAPPER_ERRCODE_FAILURE: 蛻晄悄蛹悶↓螟ア謨

    +
    隕壹∴譖ク縺:
    繝サWDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ッ逕滓千峩蠕後°繧蛾俣谺繧ケ繧ュ繝」繝ウ繧貞ョ溯。後@縺ヲ縺縺セ縺
    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperSetArgumentParam (void   ) 
    +
    +
    + +

    +逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ蜿励¢蜿悶▲縺溘ン繝シ繧ウ繝ウ諠蝣ア繧但rgument鬆伜沺縺ォ繧サ繝繝医@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 隕ェ讖溘ン繝シ繧ウ繝ウ諠蝣ア縺窟rgument鬆伜沺縺ォ繧サ繝繝医&繧後◆

    +WDSWRAPPER_ERRCODE_FAILURE: 隕ェ讖溘ン繝シ繧ウ繝ウ諠蝣ア繧但rgument鬆伜沺縺ォ繧サ繝繝医〒縺阪↑縺九▲縺

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperStartScan (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ繧ケ繝繝シ繝医r髢捺ャ蜿嶺ソ。迥カ諷九↓螟画峩縺励∪縺吶
    + 繧ケ繝繝シ繝医ョ螟画峩縺ォ謌仙粥縺吶k縺ィ縲∽サ・蠕御ク蝗槭ョ髢捺ャ蜿嶺ソ。縺悟ョ御コ縺吶k縺溘ウ縺ォ繧ウ繝シ繝ォ繝舌ャ繧ッ縺悟他縺ウ蜃コ縺輔l縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ァ繧ィ繝ゥ繝シ騾夂衍繧貞女縺大叙縺」縺溷エ蜷医ッ縲√Λ繧、繝悶Λ繝ェ縺瑚ェ蜍慕噪縺ォ隗」謾セ縺輔l繧九ョ繧貞セ縺」縺ヲ縺上□縺輔>縲

    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 繧ケ繝繝シ繝亥、画峩縺ォ謌仙粥(繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溘r蠕縺」縺ヲ縺上□縺輔>)

    +WDSWRAPPER_ERRCODE_FAILURE: 髢捺ャ蜿嶺ソ。縺ォ遘サ陦後〒縺阪k繧ケ繝繝シ繝医〒縺ェ縺(迴セ蝨ィ縺ョ繧ケ繝繝シ繝医′邯ュ謖√&繧後∪縺)

    +WDSWRAPPER_ERRCIDE_OPERATING: 縺吶〒縺ォ繧ケ繝繝シ繝医′髢捺ャ蜿嶺ソ。迥カ諷

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperStopScan (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ繧ケ繝繝シ繝医r髢捺ャ蜿嶺ソ。蛛懈ュ「迥カ諷九↓險ュ螳壹@縺セ縺吶
    + 髢捺ャ蜿嶺ソ。縺悟ョ滄圀縺ォ蛛懈ュ「縺励◆髫帙↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺悟他縺ウ蜃コ縺輔l縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ縺ァ繧ィ繝ゥ繝シ縺碁夂衍縺輔l繧九%縺ィ縺ッ縺ゅj縺セ縺帙s縲

    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 繧ケ繝繝シ繝亥、画峩縺ォ謌仙粥

    +WDSWRAPPER_ERRCIDE_OPERATING: 縺吶〒縺ォ繧ケ繝繝シ繝医′髢捺ャ蜿嶺ソ。蛛懈ュ「迥カ諷

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +
    隕壹∴譖ク縺:
    繧ケ繝繝シ繝亥、画峩縺瑚。後o繧後※縺九i髢捺ャ蜿嶺ソ。縺悟●豁「縺吶k縺セ縺ァ縺ォ縺ッ20ms遞句コヲ縺ョ譎る俣縺後°縺九j縺セ縺
    + +
    +

    +

    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/_w_d_s_wrapper_8h.html b/man/WDS_Wrapper/html/_w_d_s_wrapper_8h.html new file mode 100644 index 00000000..07e28641 --- /dev/null +++ b/man/WDS_Wrapper/html/_w_d_s_wrapper_8h.html @@ -0,0 +1,563 @@ + + +WDSWrapper: include/WDSWrapper.h + + + + + +
    +

    include/WDSWrapper.h

    #include "WDS.h"
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    繝繝シ繧ソ讒矩

    struct  WDSWrapperInitializeParam
     WDS_WrapperInitialize髢「謨ー縺ォ荳弱∴繧句晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ [隧ウ邏ー]
    struct  WDSWrapperCallbackParam
     WDS繝ゥ繝繝代シ縺悟他縺ウ蜃コ縺吶さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ荳弱∴繧峨l繧句シ墓焚逕ィ縺ョ讒矩菴 [隧ウ邏ー]

    繝槭け繝ュ螳夂セゥ

    #define WDSWRAPPER_STACKSIZE   4096
     WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繝ャ繝繝峨せ繧ソ繝繧ッ縺ョ謗ィ螂ィ繧オ繧、繧コ
    #define WDSWRAPPER_SCANPERIOD   3000
     WDS繝ゥ繝繝代シ縺後せ繧ュ繝」繝ウ繧堤カ咏カ壹☆繧区凾髢甜msec]
    #define WDSWRAPPER_WAITPERIOD   3000
     WDS繝ゥ繝繝代シ縺後せ繧ュ繝」繝ウ繧剃クュ譁ュ縺吶k譎る俣[msec]

    蝙句ョ夂セゥ

    typedef void(* WDSWrapperCallbackFunc )(void *arg)
     WDSWrapper繝ゥ繧、繝悶Λ繝ェ縺御スソ逕ィ縺吶k繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー蝙
    typedef void *(* WDSWrapperAlloc )(u32 size)
     WDS繝ゥ繝繝代シ蜀驛ィ縺ァ菴ソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ繝シ蝙
    typedef void(* WDSWrapperFree )(void *ptr)
     WDS繝ゥ繝繝代シ蜀驛ィ縺ァ菴ソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ繝シ蝙

    蛻玲嫌蝙

    enum  WDSWrapperErrCode {
    +  WDSWRAPPER_ERRCODE_SUCCESS = 0, +
    +  WDSWRAPPER_ERRCODE_FAILURE = 1, +
    +  WDSWRAPPER_ERRCODE_OPERATING = 2, +
    +  WDSWRAPPER_ERRCODE_INITIALIZED = 3, +
    +  WDSWRAPPER_ERRCODE_UNINITIALIZED = 4 +
    + }
     蜃ヲ逅邨先棡繧偵≠繧峨o縺吝玲嫌蝙 [隧ウ邏ー]
    enum  WDSWrapperCallback {
    +  WDSWRAPPER_CALLBACK_INITIALIZE = 0, +
    +  WDSWRAPPER_CALLBACK_CLEANUP = 1, +
    +  WDSWRAPPER_CALLBACK_STARTSCAN = 2, +
    +  WDSWRAPPER_CALLBACK_STARTSCAN2 = 3, +
    +  WDSWRAPPER_CALLBACK_STOPSCAN = 4 +
    + }
     繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溯ヲ∝屏繧偵≠繧峨o縺吝玲嫌蝙 [隧ウ邏ー]
    enum  WDSWrapperStateThreadState {
    +  WDSWRAPPER_STATE_BEFOREINIT, +
    +  WDSWRAPPER_STATE_INIT, +
    +  WDSWRAPPER_STATE_WAITINIT, +
    +  WDSWRAPPER_STATE_SCAN, +
    +  WDSWRAPPER_STATE_WAITSCAN, +
    +  WDSWRAPPER_STATE_ENDSCAN, +
    +  WDSWRAPPER_STATE_WAITENDSCAN, +
    +  WDSWRAPPER_STATE_END, +
    +  WDSWRAPPER_STATE_WAITEND, +
    +  WDSWRAPPER_STATE_IDLE, +
    +  WDSWRAPPER_STATE_TERMINATE +
    + }
     WDS繝ゥ繝繝代シ縺ョ縺ョ繧ケ繝繝シ繝医r縺ゅi繧上☆蛻玲嫌蝙 [隧ウ邏ー]

    髢「謨ー

    WDSWrapperErrCode WDS_WrapperInitialize (WDSWrapperInitializeParam param)
    WDSWrapperErrCode WDS_WrapperCleanup (void)
    WDSWrapperErrCode WDS_WrapperStartScan (void)
    WDSWrapperErrCode WDS_WrapperStopScan (void)
    WDSWrapperErrCode WDS_WrapperCheckValidBeacon (void)
    WDSWrapperErrCode WDS_WrapperSetArgumentParam (void)
    WDSWrapperErrCode WDS_WrapperCheckThreadRunning (void)
    OSThread * WDS_WrapperGetOSThread (void)
    +

    繝槭け繝ュ螳夂セゥ

    + +
    +
    + + + + +
    #define WDSWRAPPER_SCANPERIOD   3000
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺後せ繧ュ繝」繝ウ繧堤カ咏カ壹☆繧区凾髢甜msec] +

    + +

    +

    + +

    +
    + + + + +
    #define WDSWRAPPER_STACKSIZE   4096
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繝ャ繝繝峨せ繧ソ繝繧ッ縺ョ謗ィ螂ィ繧オ繧、繧コ +

    + +

    +

    + +

    +
    + + + + +
    #define WDSWRAPPER_WAITPERIOD   3000
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺後せ繧ュ繝」繝ウ繧剃クュ譁ュ縺吶k譎る俣[msec] +

    + +

    +

    +


    蝙句ョ夂セゥ

    + +
    +
    + + + + +
    typedef void*( * WDSWrapperAlloc)(u32 size)
    +
    +
    + +

    +WDS繝ゥ繝繝代シ蜀驛ィ縺ァ菴ソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ繝シ蝙 +

    + +

    +

    + +

    +
    + + + + +
    typedef void( * WDSWrapperCallbackFunc)(void *arg)
    +
    +
    + +

    +WDSWrapper繝ゥ繧、繝悶Λ繝ェ縺御スソ逕ィ縺吶k繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー蝙 +

    +

    隕壹∴譖ク縺:
    繝サ蠑墓焚arg縺ッ蠢縺啗DSWrapperCallback蝙句、画焚縺ク縺ョ繝昴う繝ウ繧ソ
    + +
    +

    + +

    +
    + + + + +
    typedef void( * WDSWrapperFree)(void *ptr)
    +
    +
    + +

    +WDS繝ゥ繝繝代シ蜀驛ィ縺ァ菴ソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ繝シ蝙 +

    + +

    +

    +


    蛻玲嫌蝙

    + +
    +
    + + + + +
    enum WDSWrapperCallback
    +
    +
    + +

    +繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溯ヲ∝屏繧偵≠繧峨o縺吝玲嫌蝙 +

    +

    蛻玲嫌蝙九ョ蛟、:
    + + + + + + +
    WDSWRAPPER_CALLBACK_INITIALIZE  +WDS_WrapperInitialize髢「謨ー縺ォ繧医k繧ウ繝シ繝ォ繝舌ャ繧ッ
    WDSWRAPPER_CALLBACK_CLEANUP  +WDS_WrapperCleanup髢「謨ー縺ォ繧医k繧ウ繝シ繝ォ繝舌ャ繧ッ
    WDSWRAPPER_CALLBACK_STARTSCAN  +WDS_WrapperStartScan髢「謨ー縺ォ繧医k繧ウ繝シ繝ォ繝舌ャ繧ッ
    WDSWRAPPER_CALLBACK_STARTSCAN2  +WDS_WrapperStartScan髢「謨ー縺ォ繧医k繧ウ繝シ繝ォ繝舌ャ繧ッ(髢捺ャ繧ケ繧ュ繝」繝ウ1蝗樒オゆコ)
    WDSWRAPPER_CALLBACK_STOPSCAN  +WDS_WrapperStopScan髢「謨ー縺ォ繧医k繧ウ繝シ繝ォ繝舌ャ繧ッ
    +
    + +
    +

    + +

    +
    + + + + +
    enum WDSWrapperErrCode
    +
    +
    + +

    +蜃ヲ逅邨先棡繧偵≠繧峨o縺吝玲嫌蝙 +

    +

    蛻玲嫌蝙九ョ蛟、:
    + + + + + + +
    WDSWRAPPER_ERRCODE_SUCCESS  +蜃ヲ逅謌仙粥
    WDSWRAPPER_ERRCODE_FAILURE  +蜃ヲ逅螟ア謨
    WDSWRAPPER_ERRCODE_OPERATING  +蜃ヲ逅螳溯。御クュ
    WDSWRAPPER_ERRCODE_INITIALIZED  +WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ蛻晄悄蛹匁ク医∩
    WDSWRAPPER_ERRCODE_UNINITIALIZED  +WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ譛ェ蛻晄悄蛹
    +
    + +
    +

    + +

    +
    + + + + +
    enum WDSWrapperStateThreadState
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺ョ縺ョ繧ケ繝繝シ繝医r縺ゅi繧上☆蛻玲嫌蝙 +

    +

    蛻玲嫌蝙九ョ蛟、:
    + + + + + + + + + + + + +
    WDSWRAPPER_STATE_BEFOREINIT  +蛻晄悄蛹夜幕蟋句セ縺。繧ケ繝繝シ繝
    WDSWRAPPER_STATE_INIT  +蛻晄悄蛹夜幕蟋九せ繝繝シ繝
    WDSWRAPPER_STATE_WAITINIT  +蛻晄悄蛹門ョ御コ蠕縺。繧ケ繝繝シ繝
    WDSWRAPPER_STATE_SCAN  +繧ケ繧ュ繝」繝ウ髢句ァ九せ繝繝シ繝
    WDSWRAPPER_STATE_WAITSCAN  +繧ケ繧ュ繝」繝ウ螳御コ蠕縺。繧ケ繝繝シ繝
    WDSWRAPPER_STATE_ENDSCAN  +繧ケ繧ュ繝」繝ウ荳ュ譁ュ繧ケ繝繝シ繝
    WDSWRAPPER_STATE_WAITENDSCAN  +繧ケ繧ュ繝」繝ウ荳ュ譁ュ螳御コ蠕縺。繧ケ繝繝シ繝
    WDSWRAPPER_STATE_END  +WDS隗」謾セ髢句ァ九せ繝繝シ繝
    WDSWRAPPER_STATE_WAITEND  +WDS隗」謾セ螳御コ蠕縺。繧ケ繝繝シ繝
    WDSWRAPPER_STATE_IDLE  +繧「繧、繝峨Ν繧ケ繝繝シ繝
    WDSWRAPPER_STATE_TERMINATE  +WDS繝ゥ繝繝代シ隗」謾セ繧ケ繝繝シ繝
    +
    + +
    +

    +


    髢「謨ー

    + +
    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCheckThreadRunning (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′螳溯。御クュ縺狗「コ隱阪@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′螳溯。御クュ

    +WDSWRAPPER_ERRCODE_FAILURE: WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ッ蛛懈ュ「縺励※縺繧

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCheckValidBeacon (void   ) 
    +
    +
    + +

    +逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺溘°遒コ隱阪@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺

    +WDSWRAPPER_ERRCODE_FAILURE: 逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ譛牙柑縺ェ隕ェ讖溘ン繝シ繧ウ繝ウ繧貞女縺大叙縺」縺ヲ縺縺ェ縺

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +
    隕壹∴譖ク縺:
    繝ゥ繧、繝悶Λ繝ェ蛻晄悄蛹匁凾縺ォ謖螳壹@縺溘さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ョ荳ュ縺ァ縺ョ縺ソ蜻シ縺ウ蜃コ縺励※荳九&縺
    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperCleanup (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨r蛛懈ュ「縺励仝DS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ繧定ァ」謾セ縺励∪縺吶
    + 隗」謾セ蜃ヲ逅螳御コ縺ョ逶エ蜑阪↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺檎匱逕溘@縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ繧ィ繝ゥ繝シ縺碁夂衍縺輔l繧九%縺ィ縺ッ縺ゅj縺セ縺帙s縲

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS WDS繝ゥ繝繝代シ隗」謾セ繧帝幕蟋

    +WDSWRAPPER_ERRCODE_OPERATING WDS繝ゥ繝繝代シ隗」謾セ繧貞ョ溯。御クュ

    +WDSWRAPPER_ERRCODE_UNINITIALIZED WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    OSThread* WDS_WrapperGetOSThread (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨′菴ソ逕ィ縺励※縺繧軌SThread縺ク縺ョ繝昴う繝ウ繧ソ繧貞セ励∪縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    NULL: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +NULL莉・螟: 螳溯。御クュ繝サ縺ゅk縺縺ッ蛛懈ュ「荳ュ縺ョOSThread縺ク縺ョ繝昴う繝ウ繧ソ

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperInitialize (WDSWrapperInitializeParam  param  ) 
    +
    +
    + +

    +WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ蛻晄悄蛹悶ョ髱槫酔譛溷ヲ逅繧帝幕蟋九@縺セ縺吶
    + 蛻晄悄蛹門ヲ逅螳御コ譎ゅ↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺檎匱逕溘@縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ァ繧ィ繝ゥ繝シ騾夂衍繧貞女縺大叙縺」縺溷エ蜷医ッ縲√Λ繧、繝悶Λ繝ェ縺瑚ェ蜍慕噪縺ォ隗」謾セ縺輔l繧九ョ繧貞セ縺」縺ヲ縺上□縺輔>縲

    蠑墓焚:
    + + +
    param WDS繝ゥ繝繝代シ蛻晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 蛻晄悄蛹門ヲ逅繧帝幕蟋

    +WDSWRAPPER_ERRCODE_INITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺ッ蛻晄悄蛹匁ク医∩

    +WDSWRAPPER_ERRCODE_FAILURE: 蛻晄悄蛹悶↓螟ア謨

    +
    隕壹∴譖ク縺:
    繝サWDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ッ逕滓千峩蠕後°繧蛾俣谺繧ケ繧ュ繝」繝ウ繧貞ョ溯。後@縺ヲ縺縺セ縺
    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperSetArgumentParam (void   ) 
    +
    +
    + +

    +逶エ蜑阪↓螳御コ縺励◆髢捺ャ蜿嶺ソ。縺ァ蜿励¢蜿悶▲縺溘ン繝シ繧ウ繝ウ諠蝣ア繧但rgument鬆伜沺縺ォ繧サ繝繝医@縺セ縺

    蠑墓焚:
    + + +
    縺ェ縺 
    +
    +
    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 隕ェ讖溘ン繝シ繧ウ繝ウ諠蝣ア縺窟rgument鬆伜沺縺ォ繧サ繝繝医&繧後◆

    +WDSWRAPPER_ERRCODE_FAILURE: 隕ェ讖溘ン繝シ繧ウ繝ウ諠蝣ア繧但rgument鬆伜沺縺ォ繧サ繝繝医〒縺阪↑縺九▲縺

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperStartScan (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ繧ケ繝繝シ繝医r髢捺ャ蜿嶺ソ。迥カ諷九↓螟画峩縺励∪縺吶
    + 繧ケ繝繝シ繝医ョ螟画峩縺ォ謌仙粥縺吶k縺ィ縲∽サ・蠕御ク蝗槭ョ髢捺ャ蜿嶺ソ。縺悟ョ御コ縺吶k縺溘ウ縺ォ繧ウ繝シ繝ォ繝舌ャ繧ッ縺悟他縺ウ蜃コ縺輔l縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ァ繧ィ繝ゥ繝シ騾夂衍繧貞女縺大叙縺」縺溷エ蜷医ッ縲√Λ繧、繝悶Λ繝ェ縺瑚ェ蜍慕噪縺ォ隗」謾セ縺輔l繧九ョ繧貞セ縺」縺ヲ縺上□縺輔>縲

    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 繧ケ繝繝シ繝亥、画峩縺ォ謌仙粥(繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溘r蠕縺」縺ヲ縺上□縺輔>)

    +WDSWRAPPER_ERRCODE_FAILURE: 髢捺ャ蜿嶺ソ。縺ォ遘サ陦後〒縺阪k繧ケ繝繝シ繝医〒縺ェ縺(迴セ蝨ィ縺ョ繧ケ繝繝シ繝医′邯ュ謖√&繧後∪縺)

    +WDSWRAPPER_ERRCIDE_OPERATING: 縺吶〒縺ォ繧ケ繝繝シ繝医′髢捺ャ蜿嶺ソ。迥カ諷

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    + +
    +

    + +

    +
    + + + + + + + + + +
    WDSWrapperErrCode WDS_WrapperStopScan (void   ) 
    +
    +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ繧ケ繝繝シ繝医r髢捺ャ蜿嶺ソ。蛛懈ュ「迥カ諷九↓險ュ螳壹@縺セ縺吶
    + 髢捺ャ蜿嶺ソ。縺悟ョ滄圀縺ォ蛛懈ュ「縺励◆髫帙↓繧ウ繝シ繝ォ繝舌ャ繧ッ縺悟他縺ウ蜃コ縺輔l縺セ縺吶
    + 繧ウ繝シ繝ォ繝舌ャ繧ッ縺ァ繧ィ繝ゥ繝シ縺碁夂衍縺輔l繧九%縺ィ縺ッ縺ゅj縺セ縺帙s縲

    謌サ繧雁、:
    WDSWRAPPER_ERRCODE_SUCCESS: 繧ケ繝繝シ繝亥、画峩縺ォ謌仙粥

    +WDSWRAPPER_ERRCIDE_OPERATING: 縺吶〒縺ォ繧ケ繝繝シ繝医′髢捺ャ蜿嶺ソ。蛛懈ュ「迥カ諷

    +WDSWRAPPER_ERRCODE_UNINITIALIZED: WDS繝ゥ繝繝代シ繝ゥ繧、繝悶Λ繝ェ縺悟晄悄蛹悶&繧後※縺縺ェ縺

    +
    隕壹∴譖ク縺:
    繧ケ繝繝シ繝亥、画峩縺瑚。後o繧後※縺九i髢捺ャ蜿嶺ソ。縺悟●豁「縺吶k縺セ縺ァ縺ォ縺ッ20ms遞句コヲ縺ョ譎る俣縺後°縺九j縺セ縺
    + +
    +

    +

    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/annotated.html b/man/WDS_Wrapper/html/annotated.html new file mode 100644 index 00000000..a1a2a331 --- /dev/null +++ b/man/WDS_Wrapper/html/annotated.html @@ -0,0 +1,35 @@ + + +WDSWrapper: 繝繝シ繧ソ讒矩 + + + + + +
    +

    繝繝シ繧ソ讒矩

    繝繝シ繧ソ讒矩縺ョ隱ャ譏弱〒縺吶 + + + +
    WDSWrapperCallbackParamWDS繝ゥ繝繝代シ縺悟他縺ウ蜃コ縺吶さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ荳弱∴繧峨l繧句シ墓焚逕ィ縺ョ讒矩菴
    WDSWrapperInitializeParamWDS_WrapperInitialize髢「謨ー縺ォ荳弱∴繧句晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ
    WDSWrapperWorkWDS繝ゥ繝繝代シ縺ョ繝ッ繝シ繧ッ鬆伜沺
    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/classes.html b/man/WDS_Wrapper/html/classes.html new file mode 100644 index 00000000..15908992 --- /dev/null +++ b/man/WDS_Wrapper/html/classes.html @@ -0,0 +1,34 @@ + + +WDSWrapper: 繧「繝ォ繝輔ぃ繝吶ャ繝磯荳隕ァ + + + + + +
    +

    繝繝シ繧ソ讒矩邏「蠑

    + +
      W  
    +
    WDSWrapperCallbackParam   WDSWrapperInitializeParam   WDSWrapperWork   

    +

    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/doxygen.css b/man/WDS_Wrapper/html/doxygen.css new file mode 100644 index 00000000..22c48430 --- /dev/null +++ b/man/WDS_Wrapper/html/doxygen.css @@ -0,0 +1,473 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { + font-weight: bold +} +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navpath { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; + color: #ffffff +} +A.el { + text-decoration: none; + font-weight: bold +} +A.elRef { + font-weight: bold +} +A.code:link { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.code:visited { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.codeRef:link { + font-weight: normal; + color: #0000FF +} +A.codeRef:visited { + font-weight: normal; + color: #0000FF +} +A:hover { + text-decoration: none; + background-color: #f2f2ff +} +DL.el { + margin-left: -1cm +} +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { + text-align: center; +} +IMG.formulaDsp { +} +IMG.formulaInl { + vertical-align: middle; +} +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +SPAN.vhdldigit { color: #ff00ff } +SPAN.vhdlchar { color: #000000 } +SPAN.vhdlkeyword { color: #700070 } +SPAN.vhdllogic { color: #ff0000 } + +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { + font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { + background: #e8eef2; + font-weight: bold; +} +HR { + height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +/* these are for tree view when used as main index */ +.directory { + font-size: 9pt; + font-weight: bold; +} +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* The following two styles can be used to replace the root node title */ +/* with an image of your choice. Simply uncomment the next two styles, */ +/* specify the name of your image and be sure to set 'height' to the */ +/* proper pixel height of your image. */ + +/* .directory h3.swap { */ +/* height: 61px; */ +/* background-repeat: no-repeat; */ +/* background-image: url("yourimage.gif"); */ +/* } */ +/* .directory h3.swap span { */ +/* display: none; */ +/* } */ + +.directory > h3 { + margin-top: 0; +} +.directory p { + margin: 0px; + white-space: nowrap; +} +.directory div { + display: none; + margin: 0px; +} +.directory img { + vertical-align: -30%; +} +/* these are for tree view when not used as main index */ +.directory-alt { + font-size: 100%; + font-weight: bold; +} +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} +.directory-alt > h3 { + margin-top: 0; +} +.directory-alt p { + margin: 0px; + white-space: nowrap; +} +.directory-alt div { + display: none; + margin: 0px; +} +.directory-alt img { + vertical-align: -30%; +} + diff --git a/man/WDS_Wrapper/html/doxygen.png b/man/WDS_Wrapper/html/doxygen.png new file mode 100644 index 00000000..f0a274bb Binary files /dev/null and b/man/WDS_Wrapper/html/doxygen.png differ diff --git a/man/WDS_Wrapper/html/files.html b/man/WDS_Wrapper/html/files.html new file mode 100644 index 00000000..90f3c9dc --- /dev/null +++ b/man/WDS_Wrapper/html/files.html @@ -0,0 +1,33 @@ + + +WDSWrapper: 繝輔ぃ繧、繝ォ邏「蠑 + + + + + +
    +

    繝輔ぃ繧、繝ォ荳隕ァ

    縺薙l縺ッ繝輔ぃ繧、繝ォ荳隕ァ縺ァ縺吶 + + +
    include/WDSWrapper.h
    src/WDSWrapper.cWDS繝ゥ繧、繝悶Λ繝ェ縺ョ繝ゥ繝繝代シ
    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/functions.html b/man/WDS_Wrapper/html/functions.html new file mode 100644 index 00000000..1cb49abb --- /dev/null +++ b/man/WDS_Wrapper/html/functions.html @@ -0,0 +1,79 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +縺薙l縺ッ繝輔ぅ繝シ繝ォ繝峨ョ荳隕ァ縺ァ縺昴l縺槭l縺悟ア槭@縺ヲ縺繧区ァ矩菴/蜈ア逕ィ菴薙ョ隱ャ譏弱∈繝ェ繝ウ繧ッ縺励※縺縺セ縺吶 +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/functions_vars.html b/man/WDS_Wrapper/html/functions_vars.html new file mode 100644 index 00000000..ec0ee8a1 --- /dev/null +++ b/man/WDS_Wrapper/html/functions_vars.html @@ -0,0 +1,79 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 - 螟画焚 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals.html b/man/WDS_Wrapper/html/globals.html new file mode 100644 index 00000000..5703bfc2 --- /dev/null +++ b/man/WDS_Wrapper/html/globals.html @@ -0,0 +1,132 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +縺薙l縺ッ髢「謨ー縲∝、画焚縲√槭け繝ュ縲・num縲ゝypedef 縺ョ荳隕ァ縺ァ縺吶ゅ◎繧後◇繧後′螻槭@縺ヲ縺繧九ヵ繧。繧、繝ォ縺ョ隱ャ譏弱∈繝ェ繝ウ繧ッ縺励※縺縺セ縺吶 +

    +

    - w -

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals_defs.html b/man/WDS_Wrapper/html/globals_defs.html new file mode 100644 index 00000000..2006cfd1 --- /dev/null +++ b/man/WDS_Wrapper/html/globals_defs.html @@ -0,0 +1,49 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals_enum.html b/man/WDS_Wrapper/html/globals_enum.html new file mode 100644 index 00000000..b1bc810e --- /dev/null +++ b/man/WDS_Wrapper/html/globals_enum.html @@ -0,0 +1,49 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals_eval.html b/man/WDS_Wrapper/html/globals_eval.html new file mode 100644 index 00000000..58c88eec --- /dev/null +++ b/man/WDS_Wrapper/html/globals_eval.html @@ -0,0 +1,85 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals_func.html b/man/WDS_Wrapper/html/globals_func.html new file mode 100644 index 00000000..3773aa77 --- /dev/null +++ b/man/WDS_Wrapper/html/globals_func.html @@ -0,0 +1,67 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/globals_type.html b/man/WDS_Wrapper/html/globals_type.html new file mode 100644 index 00000000..76f01ed7 --- /dev/null +++ b/man/WDS_Wrapper/html/globals_type.html @@ -0,0 +1,49 @@ + + +WDSWrapper: 繝繝シ繧ソ繝輔ぅ繝シ繝ォ繝 + + + + + +
    +  +

    +

    +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/index.html b/man/WDS_Wrapper/html/index.html new file mode 100644 index 00000000..335f3bf6 --- /dev/null +++ b/man/WDS_Wrapper/html/index.html @@ -0,0 +1,25 @@ + + +WDSWrapper: 繝。繧、繝ウ繝壹シ繧ク + + + + + +
    +

    WDSWrapper 繝峨く繝・繝。繝ウ繝

    +

    +

    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/struct_w_d_s_wrapper_callback_param.html b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_callback_param.html new file mode 100644 index 00000000..528f358c --- /dev/null +++ b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_callback_param.html @@ -0,0 +1,83 @@ + + +WDSWrapper: 讒矩菴 WDSWrapperCallbackParam + + + + + +
    +

    讒矩菴 WDSWrapperCallbackParam

    WDS繝ゥ繝繝代シ縺悟他縺ウ蜃コ縺吶さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ荳弱∴繧峨l繧句シ墓焚逕ィ縺ョ讒矩菴 +[隧ウ邏ー] +

    +#include <WDSWrapper.h> +

    + + + + + + + + + +

    螟画焚

    WDSWrapperCallback callback
     繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溯ヲ∝屏
    WDSWrapperErrCode errcode
     繧ィ繝ゥ繝シ繧ウ繝シ繝
    +


    隱ャ譏

    +WDS繝ゥ繝繝代シ縺悟他縺ウ蜃コ縺吶さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ォ荳弱∴繧峨l繧句シ墓焚逕ィ縺ョ讒矩菴

    讒矩菴

    + +
    + +
    + +

    +繧ウ繝シ繝ォ繝舌ャ繧ッ逋コ逕溯ヲ∝屏 +

    + +

    +

    + +

    + +
    + +

    +繧ィ繝ゥ繝シ繧ウ繝シ繝 +

    + +

    +

    +


    縺薙ョ讒矩菴薙ョ隱ャ譏弱ッ谺。縺ョ繝輔ぃ繧、繝ォ縺九i逕滓舌&繧後∪縺励◆: +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/struct_w_d_s_wrapper_initialize_param.html b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_initialize_param.html new file mode 100644 index 00000000..fb89ee4c --- /dev/null +++ b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_initialize_param.html @@ -0,0 +1,143 @@ + + +WDSWrapper: 讒矩菴 WDSWrapperInitializeParam + + + + + +
    +

    讒矩菴 WDSWrapperInitializeParam

    WDS_WrapperInitialize髢「謨ー縺ォ荳弱∴繧句晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ +[隧ウ邏ー] +

    +#include <WDSWrapper.h> +

    + + + + + + + + + + + + + + + + + + +

    螟画焚

    u32 threadprio
     WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ蜆ェ蜈亥コヲ
    u16 dmano
     WM繝ゥ繧、繝悶Λ繝ェ縺御スソ逕ィ縺吶kDMA逡ェ蜿キ
    WDSWrapperCallbackFunc callback
     WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨°繧牙他縺ウ蜃コ縺輔l繧九さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ク縺ョ繝昴う繝ウ繧ソ
    WDSWrapperAlloc alloc
     WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ
    WDSWrapperFree free
     WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ
    +


    隱ャ譏

    +WDS_WrapperInitialize髢「謨ー縺ォ荳弱∴繧句晄悄蛹悶ヱ繝ゥ繝。繝シ繧ソ

    讒矩菴

    + +
    + +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨ョ蜆ェ蜈亥コヲ +

    + +

    +

    + +

    + +
    + +

    +WM繝ゥ繧、繝悶Λ繝ェ縺御スソ逕ィ縺吶kDMA逡ェ蜿キ +

    + +

    +

    + +

    + +
    + +

    +WDS繧ウ繝ウ繝医Ο繝シ繝ォ繧ケ繝ャ繝繝峨°繧牙他縺ウ蜃コ縺輔l繧九さ繝シ繝ォ繝舌ャ繧ッ髢「謨ー縺ク縺ョ繝昴う繝ウ繧ソ +

    + +

    +

    + +

    + +
    + +

    +WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ +

    + +

    +

    + +

    + +
    + +

    +WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧「繝ュ繧ア繝シ繧ソ +

    + +

    +

    +


    縺薙ョ讒矩菴薙ョ隱ャ譏弱ッ谺。縺ョ繝輔ぃ繧、繝ォ縺九i逕滓舌&繧後∪縺励◆: +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/struct_w_d_s_wrapper_work.html b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_work.html new file mode 100644 index 00000000..36026951 --- /dev/null +++ b/man/WDS_Wrapper/html/struct_w_d_s_wrapper_work.html @@ -0,0 +1,301 @@ + + +WDSWrapper: 讒矩菴 WDSWrapperWork + + + + + +
    +

    讒矩菴 WDSWrapperWork

    WDS繝ゥ繝繝代シ縺ョ繝ッ繝シ繧ッ鬆伜沺 +[隧ウ邏ー] +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    螟画焚

    u8 * stack
     WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繧ソ繝繧ッ
    OSThread thread
     WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繝ャ繝繝画ァ矩菴
    u8 * wdswork
     WDS縺御スソ逕ィ縺吶k繝ッ繝シ繧ッ繧ィ繝ェ繧「
    WDSBriefApInfo briefapinfo [WDS_APINFO_MAX]
     WDS繝ゥ繝繝代シ縺係DS繧剃スソ逕ィ縺励◆邨先棡繧呈シ邏阪☆繧矩伜沺
    int briefapinfonum
     WDS繝ゥ繝繝代シ縺係DS繧剃スソ逕ィ縺励◆邨先棡繧呈シ邏阪☆繧矩伜沺
    WDSWrapperInitializeParam initparam
     蛻晄悄蛹匁凾繝代Λ繝。繝シ繧ソ縺ョ繧ウ繝斐シ
    WDSWrapperStateThreadState state
     WDS繝ゥ繝繝代シ縺ョ繧ケ繝繝シ繝
    OSTick tickstart
     蜷遞ョ譎る俣貂ャ螳夂畑
    BOOL terminate
     隗」謾セ髢句ァ九ヵ繝ゥ繧ー
    BOOL idle
     髢捺ャ繧ケ繧ュ繝」繝ウ荳ュ譁ュ繝輔Λ繧ー
    BOOL restart
     髢捺ャ繧ケ繧ュ繝」繝ウ蜀埼幕繝輔Λ繧ー
    OSDeliverArgInfo deliverinfo
     TWL逕ィ繧「繝励Μ髢灘シ墓焚繝ッ繝シ繧ッ繧ィ繝ェ繧「
    BOOL callingback
     繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー蜻シ縺ウ蜃コ縺嶺クュ縺ッTRUE
    +


    隱ャ譏

    +WDS繝ゥ繝繝代シ縺ョ繝ッ繝シ繧ッ鬆伜沺

    讒矩菴

    + +
    +
    + + + + +
    u8* WDSWrapperWork::stack
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繧ソ繝繧ッ +

    + +

    +

    + +

    +
    + + + + +
    OSThread WDSWrapperWork::thread
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺御スソ逕ィ縺吶k繧ケ繝ャ繝繝画ァ矩菴 +

    + +

    +

    + +

    +
    + + + + +
    u8* WDSWrapperWork::wdswork
    +
    +
    + +

    +WDS縺御スソ逕ィ縺吶k繝ッ繝シ繧ッ繧ィ繝ェ繧「 +

    + +

    +

    + +

    +
    + + + + +
    WDSBriefApInfo WDSWrapperWork::briefapinfo[WDS_APINFO_MAX]
    +
    +
    + +

    +WDS繝ゥ繝繝代シ縺係DS繧剃スソ逕ィ縺励◆邨先棡繧呈シ邏阪☆繧矩伜沺 +

    + +

    +

    + +

    + +
    + +

    +WDS繝ゥ繝繝代シ縺係DS繧剃スソ逕ィ縺励◆邨先棡繧呈シ邏阪☆繧矩伜沺 +

    + +

    +

    + +

    + +
    + +

    +蛻晄悄蛹匁凾繝代Λ繝。繝シ繧ソ縺ョ繧ウ繝斐シ +

    + +

    +

    + +

    + +
    + +

    +WDS繝ゥ繝繝代シ縺ョ繧ケ繝繝シ繝 +

    + +

    +

    + +

    +
    + + + + +
    OSTick WDSWrapperWork::tickstart
    +
    +
    + +

    +蜷遞ョ譎る俣貂ャ螳夂畑 +

    + +

    +

    + +

    +
    + + + + +
    BOOL WDSWrapperWork::terminate
    +
    +
    + +

    +隗」謾セ髢句ァ九ヵ繝ゥ繧ー +

    + +

    +

    + +

    +
    + + + + +
    BOOL WDSWrapperWork::idle
    +
    +
    + +

    +髢捺ャ繧ケ繧ュ繝」繝ウ荳ュ譁ュ繝輔Λ繧ー +

    + +

    +

    + +

    +
    + + + + +
    BOOL WDSWrapperWork::restart
    +
    +
    + +

    +髢捺ャ繧ケ繧ュ繝」繝ウ蜀埼幕繝輔Λ繧ー +

    + +

    +

    + +

    +
    + + + + +
    OSDeliverArgInfo WDSWrapperWork::deliverinfo
    +
    +
    + +

    +TWL逕ィ繧「繝励Μ髢灘シ墓焚繝ッ繝シ繧ッ繧ィ繝ェ繧「 +

    + +

    +

    + +

    +
    + + + + +
    BOOL WDSWrapperWork::callingback
    +
    +
    + +

    +繧ウ繝シ繝ォ繝舌ャ繧ッ髢「謨ー蜻シ縺ウ蜃コ縺嶺クュ縺ッTRUE +

    + +

    +

    +


    縺薙ョ讒矩菴薙ョ隱ャ譏弱ッ谺。縺ョ繝輔ぃ繧、繝ォ縺九i逕滓舌&繧後∪縺励◆: +
    +
    WDSWrapper縺ォ蟇セ縺励※Thu Jul 3 18:05:09 2008縺ォ逕滓舌&繧後∪縺励◆縲  + +doxygen 1.5.6
    + + diff --git a/man/WDS_Wrapper/html/tab_b.gif b/man/WDS_Wrapper/html/tab_b.gif new file mode 100644 index 00000000..0d623483 Binary files /dev/null and b/man/WDS_Wrapper/html/tab_b.gif differ diff --git a/man/WDS_Wrapper/html/tab_l.gif b/man/WDS_Wrapper/html/tab_l.gif new file mode 100644 index 00000000..9b1e6337 Binary files /dev/null and b/man/WDS_Wrapper/html/tab_l.gif differ diff --git a/man/WDS_Wrapper/html/tab_r.gif b/man/WDS_Wrapper/html/tab_r.gif new file mode 100644 index 00000000..ce9dd9f5 Binary files /dev/null and b/man/WDS_Wrapper/html/tab_r.gif differ diff --git a/man/WDS_Wrapper/html/tabs.css b/man/WDS_Wrapper/html/tabs.css new file mode 100644 index 00000000..95f00a91 --- /dev/null +++ b/man/WDS_Wrapper/html/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.navpath +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/readme.txt b/readme.txt new file mode 100644 index 00000000..8ed17688 --- /dev/null +++ b/readme.txt @@ -0,0 +1,18 @@ +1.ビルドに必要なもの + NORファーム、NANDファーム + ・(TwlIPL_private) + ・TwlSDK + システムメニュー +  ・(TwlIPL_private) +  ・TwlSDK +  ・NitroSystem 070314版(本ツリーのadd-ins内のTwlSDK対応パッチを当てたもの) + + TwlIPL_privateは一部の鍵を使用する場合にのみ必要 + + +2.環境変数の設定 + TWL_IPL_RED_ROOT + ex.) TWL_IPL_RED_ROOT=c:/TwlIPL + TWL_IPL_RED_PRIVATE_ROOT(TwlIPL_private を利用する場合のみ) + ex.) TWL_IPL_RED_PRIVATE_ROOT=c:/TwlIPL_private + diff --git a/setup b/setup new file mode 100644 index 00000000..579560c9 --- /dev/null +++ b/setup @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +#---------------------------------------------------------------- +# This script is not for execute directly. +# Please use 'source ./setup'. +#---------------------------------------------------------------- + +export TWL_IPL_RED_ROOT=`cygpath -m $PWD` diff --git a/tools/bin/AesDecrypter.exe b/tools/bin/AesDecrypter.exe new file mode 100644 index 00000000..33c1b413 Binary files /dev/null and b/tools/bin/AesDecrypter.exe differ diff --git a/tools/bin/FakeRomHeader.launcher.exe b/tools/bin/FakeRomHeader.launcher.exe new file mode 100755 index 00000000..3533c69d Binary files /dev/null and b/tools/bin/FakeRomHeader.launcher.exe differ diff --git a/tools/bin/FakeRomHeader.secure.exe b/tools/bin/FakeRomHeader.secure.exe new file mode 100755 index 00000000..4110c767 Binary files /dev/null and b/tools/bin/FakeRomHeader.secure.exe differ diff --git a/tools/bin/FakeRomHeader.sys.exe b/tools/bin/FakeRomHeader.sys.exe new file mode 100755 index 00000000..2dbfd86e Binary files /dev/null and b/tools/bin/FakeRomHeader.sys.exe differ diff --git a/tools/bin/FakeRomHeader.user.exe b/tools/bin/FakeRomHeader.user.exe new file mode 100755 index 00000000..97e4c1dd Binary files /dev/null and b/tools/bin/FakeRomHeader.user.exe differ diff --git a/tools/bin/TXLib.dll b/tools/bin/TXLib.dll new file mode 100644 index 00000000..7e1dc0bd Binary files /dev/null and b/tools/bin/TXLib.dll differ diff --git a/tools/bin/genFontTable.plx b/tools/bin/genFontTable.plx new file mode 100644 index 00000000..ff715208 --- /dev/null +++ b/tools/bin/genFontTable.plx @@ -0,0 +1,260 @@ +#!/usr/bin/perl + +###################################################################### +# genFontTable.pl +# +# generate Secure Shared Font Data Table +# +# [[ HEADER FORMAT ]] +# security code (128 bytes) : RSA signature of Header +# +# Header ( 32 bytes) +# TimeStamp ( 4 bytes) : date %y%m%d%H +# number ( 2 bytes) : number of font files +# region_code ( 1 bytes) : font region code +# padding ( 6 bytes) : +# padding ( 20 bytes) : SHA1 digest of Font info table +# +# Font info table ( 64 bytes * number) +# fileName ( 32 bytes) : font file name +# comp_length ( 4 bytes) : length of the compression file +# file offset ( 4 bytes) : file offset of Font data +# length ( 4 bytes) : length of file (bytes) +# digest ( 20 bytes) : SHA1 digest of Font data +# +# note: each section image is aligned to 32 bytes. +# +###################################################################### + +use POSIX 'strftime'; +use File::Basename; + +if ($#ARGV < 3) { + printf STDOUT ("Usage: %s [genFontTable] timestamp region_code [Target font files...]\n", $0); + exit(-1); +} + +my $outFile = "TWLFontTable.dat"; +my $infoFile = "info.bin"; +my $headerFile = "header.bin"; +my $digestFile = "sha1.bin"; +my $signFile = "sign.bin"; +my $tempFile = "temp.bin"; +my $compprog = "compBLZ.exe"; # 圧縮プログラム +my $compoption = "-e \"\""; +#my $compprog = "./ntrcomp/gcc/ntrcomp.exe"; +#my $compoption = "-h8 -A32 -s"; + +# 後始末 +sub deleteTemp { + system ("rm -f $infoFile"); + system ("rm -f $headerFile"); + system ("rm -f $digestFile"); + system ("rm -f $signFile"); + system ("rm -f $tempFile"); +} + +# 環境変数からSDKのルートをサーチして(ntrcompの場所特定に必要) +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWLSDK_ROOT/s) { + $SDKROOT = $ENV{$_}; + } +} +printf "TWLSDK_ROOT is ${SDKROOT}\n"; +$compprog = "${SDKROOT}/tools/bin/" . $compprog; + +my $signSize = 0x80; +my $headerSize = 0x20; +my @files; + +# 要素数算出 +my $num = 0; +foreach ( @ARGV ) { + next if( $_ eq $ARGV[0] ); + next if( $_ eq $ARGV[1] ); + $files[ $num ] = $_; + $num++; +} + +# 情報テーブルの出力 +{ + my $elementSize = 0x40; + my $fileNameMax = 0x20; + my $padLen = 0x04; + # offset length = 0x04; + # file length = 0x04; + my $sha1Len = 0x14; + + open INFO, ">$infoFile" or die; + binmode INFO; + + # オフセット算出 + my $offset = $signSize + $headerSize + $num * $elementSize; + if( ( $offset % 32 ) > 0 ) { $offset += 32 - ( $offset % 32 ); } + + printf "---------------------------------------------------------------\n"; + printf "filename\toffset \torig_size\tcompressed_size\n"; + foreach ( @files ) { + # NULL指定時は、NULL出力 + if( "NULL" eq basename( $_ ) ) { + syswrite( INFO, pack( "x$elementSize") ); + next; + } + + # ファイルネームの出力 + if( !( -e $_ ) ) { + close( INFO ); + deleteTemp(); + die "file not exist. : $_\n"; + } + my $name = basename( $_ ); + if( length $name >= $fileNameMax ) { + close( INFO ); + deleteTemp(); + die "file name length must be smaller than $fileNameMax. : $_\n"; + } + my $data = pack( "a$fileNameMax", $name ); + syswrite( INFO, $data, $fileNameMax ); + + # 圧縮 + my $compfile = "$_.comp"; + system ("${compprog} $compoption $_ -o $compfile"); + + # パディングの出力 + #syswrite( INFO, pack( "x$padLen") ); + + # 圧縮ファイル長を出力(もともとはpadding) + $data = pack( "L", -s $compfile ); + syswrite( INFO, $data, 4 ); + + # ファイルオフセットの出力 + $data = pack( "L", $offset ); + syswrite( INFO, $data, 4 ); + + # ファイル長の出力 + $data = pack( "L", -s $_ ); + syswrite( INFO, $data, 4 ); + + # ファイルのSHA1ハッシュの出力 + { + my $digest; + #system ("openssl dgst -sha1 -binary -out $digestFile $_"); + system ("openssl dgst -sha1 -binary -out $digestFile $compfile"); # 圧縮後のファイルにハッシュをつける + open DIGEST, $digestFile or die; + binmode DIGEST; + sysread( DIGEST, $digest, $sha1Len ); + close DIGEST; + syswrite( INFO, $digest, $sha1Len ); + } + + printf "%s\t0x%08x\t0x%08x\t0x%08x\n", $_, $offset, -s $_, -s $compfile; + + # オフセット加算 + #$offset += -s $_; + $offset += -s $compfile; + if( ( $offset % 32 ) > 0 ) { $offset += 32 - ( $offset % 32 ); } + } + close INFO; + printf "---------------------------------------------------------------\n"; +} + +# ヘッダの出力 +{ + # timestampLen = 0x08; + # elementNumLen = 0x02; + my $padLen = 0x05; + my $sha1Len = 0x14; + + open HEADER, ">$headerFile" or die; + binmode HEADER; + + # タイムスタンプの出力 +# my $timestamp = strftime "%y%m%d%H", localtime; + my $timestamp = $ARGV[ 0 ]; + my $region_code = $ARGV[ 1 ]; + printf "timestamp = %s\n", $timestamp; + syswrite( HEADER, pack( "N", unpack( "L", pack( "H8", $timestamp ) ) ) ); + + # 要素数の出力 + syswrite( HEADER, pack( "S", $num ) ); + + # リージョンコードの出力 + syswrite( HEADER, pack( "C", $region_code ) ); + + # パディングの出力 + syswrite( HEADER, pack( "x$padLen") ); + + # 情報テーブルのSHA1ハッシュの出力 + { + my $digest; + system ("openssl dgst -sha1 -binary -out $digestFile $infoFile"); + open DIGEST, $digestFile or die; + binmode DIGEST; + sysread( DIGEST, $digest, $sha1Len ); + close DIGEST; + syswrite( HEADER, $digest, $sha1Len ); + } + close HEADER; +} + +# 環境変数サーチ +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_PRIVATE_ROOT/s) { + $KEYROOT = $ENV{$_}; + } +} +if (!$KEYROOT) { + deleteTemp(); + die "No TWL_IPL_RED_PRIVATE_ROOT is found.\n"; +} + +# ヘッダへの署名付加 +{ + system ( "openssl dgst -sha1 -binary -out $digestFile $headerFile" ); + system ( "openssl rsautl -sign -in $digestFile -inkey $KEYROOT/keys/rsa/private_sharedFont.der -keyform DER -out $signFile" ); + system ( "cat $signFile $headerFile >$tempFile" ); + system ( "cat $tempFile $infoFile >$outFile" ); + deleteTemp(); +} + + +# フォントの出力 +{ + open FONTTABLE, ">>$outFile" or die; + binmode FONTTABLE; + + { + # パディング出力 + my $fileLen = -s $outFile; + my $padNum = ( $fileLen % 32 ) ? ( 32 - ( $fileLen % 32 ) ) : 0; + my $padding = pack( "x$padNum" ); + syswrite( FONTTABLE, $padding, $padNum ); + } + + foreach ( @files ) { + # NULL指定時はスキップ + if( "NULL" eq basename( $_ ) ) { + next; + } + + # フォント出力 + #my $fileLen = -s $_; + #open TEST, $_ or die; + my $compfile = "$_.comp"; # 圧縮ファイルを出力 + $fileLen = -s $compfile; + open TEST, $compfile or die; + binmode TEST; + sysread ( TEST, $buffer, $fileLen ); + close TEST; + syswrite( FONTTABLE, $buffer, $fileLen ); + + # パディング出力 + my $padNum = ( $fileLen % 32 ) ? ( 32 - ( $fileLen % 32 ) ) : 0; + my $padding = pack( "x$padNum" ); + syswrite( FONTTABLE, $padding, $padNum ); + + # 圧縮ファイルを削除 + system ("rm -rf $compfile"); + } + close FONTTABLE; +} diff --git a/tools/bin/genVersion.plx b/tools/bin/genVersion.plx new file mode 100644 index 00000000..30cf04e8 --- /dev/null +++ b/tools/bin/genVersion.plx @@ -0,0 +1,175 @@ +#!/usr/bin/perl + +###################################################################### +# genVersion.pl +# +# generate SystemMenu Version Data +# +# [[ FILE FORMAT ]] +# +# Security code (128 bytes) : RSA signature of Header +# Header + Data : NitroSystemArchive Format +# +###################################################################### + +use POSIX 'strftime'; +use File::Basename; + +if ($#ARGV < 8) { + printf STDOUT ("Usage: %s [genVersion] dir timestamp strVersion majorVersion minorVersion userAreaSize NUPHostName EULAURL outFile\n", $0); + exit(-1); +} + +# アーカイブにまとめるデータファイル +my $dataDir = $ARGV[0]; +my $versionFile = "$dataDir/version.bin"; +my $timeStampFile = "$dataDir/time_stamp.bin"; +my $userAreaSizeFile = "$dataDir/user_area_size.bin"; +my $nupHostFile = "$dataDir/nup_host.bin"; +my $urlEULAFile = "$dataDir/eula_url.bin"; + +# 証明書および鍵はIPL_privateで作成したものをそのまま使うのでここでは作成しない +#my $cert4SSLClientFile = "$dataDir/cert4ssl"; +#my $privKeyCert4SSLClientFile = "$dataDir/priv_key_cert4ssl"; +#my $rootCACert4SSLFile1 = "$dataDir/root_ca_cert4ssl1"; +#my $rootCACert4SSLFile2 = "$dataDir/root_ca_cert4ssl2"; +#my $rootCACert4SSLFile3 = "$dataDir/root_ca_cert4ssl3"; +#my $rootCACert4SSLFile4 = "$dataDir/root_ca_cert4ssl4"; +#my $rootCACert4SSLFile5 = "$dataDir/root_ca_cert4ssl5"; +#my $rootCACert4SSLFile6 = "$dataDir/root_ca_cert4ssl6"; + +# 出力ファイル +my $outFile = $ARGV[8]; + +# 中間ファイル +my $archiveFile = "archive.narc"; +my $digestFile = "digest.bin"; +my $signFile = "sign.bin"; + +# 後始末 +sub deleteTemp { + system ("rm -f $digestFile"); + system ("rm -f $signFile"); + system ("rm -f $archiveFile"); +} + +# 環境変数サーチ +foreach ( sort keys ( %ENV ) ){ + if ($_ =~ m/TWL_IPL_RED_PRIVATE_ROOT/s) { + $KEYROOT = $ENV{$_}; + } +} +if (!$KEYROOT) { + die "No TWL_IPL_RED_PRIVATE_ROOT is found.\n"; +} + +my $TWLIPLRED_ROOT; + +# 環境変数のキーにTWL_IPL_RED_ROOTがあるか +if (exists($ENV{"TWL_IPL_RED_ROOT"}) ){ + $TWLIPLRED_ROOT = $ENV{"TWL_IPL_RED_ROOT"}; +}else +{ + die "No TWL_IPL_RED_ROOT is found.\n"; +} + +# システムメニューバージョンの出力 +{ + my $length = 0x1c; + my $sysMenuVersion = $ARGV[2]; + if( length $sysMenuVersion >= $length ) { + printf "ERROR: SystemMenu version length less than %d.\n", $length; + die; + } + open VERSION, ">$versionFile" or die "File Open Error.\n"; + binmode VERSION; +# my $ver = ( ( $ARGV[ 3 ] & 0xffff ) << 16 ) | ($ARGV[ 4 ] & 0xffff); +# printf "version = %d.%d\n", ($ver >> 16), ($ver & 0xffff); +# syswrite( VERSION, pack( "L", $ver ) ); + printf "SysMenu version = %s\n", $sysMenuVersion; + $length /= 2; # to UTF16 length + syswrite( VERSION, pack( "SSS$length", $ARGV[ 3 ], $ARGV[ 4 ], unpack( "C*", $sysMenuVersion ) ) ); +# pack "S*", unpack( "C*", $ascii ), 0; + + close VERSION; +} + +# タイムスタンプの出力 +{ + open TIMESTAMP, ">$timeStampFile" or die "File Open Error.\n"; + binmode TIMESTAMP; +# my $timestamp = strftime "%y%m%d%H", localtime; + my $timestamp = $ARGV[ 1 ]; + printf "timestamp = %s\n", $timestamp; + syswrite( TIMESTAMP, pack( "N", unpack( "L", pack( "H8", $timestamp ) ) ) ); + close TIMESTAMP; +} + +# ユーザエリアサイズの出力 +{ + open USERAREA, ">$userAreaSizeFile" or die "File Open Error.\n"; + binmode USERAREA; + my $userAreaSize = $ARGV[ 5 ]; + printf "userAreaSize = $userAreaSize\n"; + syswrite( USERAREA, pack( "L", $userAreaSize ) ); + close USERAREA; +} + +# NUP_HOSTNAMEの出力 +{ + my $length = 0x40; + my $nupHostName = $ARGV[ 6 ]; + if( length $nupHostName >= $length ) { + printf "ERROR: NUP Host Name length less than %d.\n", $length; + die; + } + open NUPHOSTNAME, ">$nupHostFile" or die "File Open Error.\n"; + binmode NUPHOSTNAME; + printf "NUPHostName = $nupHostName\n"; + syswrite( NUPHOSTNAME, pack( "a$length", $nupHostName ) ); + close NUPHOSTNAME; +} + +# EULA_URLの出力 +{ + my $length = 0x80; + my $urlEULA = $ARGV[ 7 ]; + if( length $urlEULA >= $length ) { + printf "ERROR: EULA URL length less than %d.\n", $length; + die; + } + open EULAURL, ">$urlEULAFile" or die "File Open Error.\n"; + binmode EULAURL; + printf "EULAURL = $urlEULA\n"; + syswrite( EULAURL, pack( "a$length", $urlEULA ) ); + close EULAURL; +} + +my $TWLSYSTEM_ROOT; + +# 環境変数のキーにTWLSYSTEM_ROOTがあるか +if (exists($ENV{"TWLSYSTEM_ROOT"}) ){ + $TWLSYSTEM_ROOT = $ENV{"TWLSYSTEM_ROOT"}; +}else +{ + deleteTemp(); + die "No TWLSYSTEM_ROOT is found.\n"; +} + +# アーカイブ作成 +{ + system ( "$TWLSYSTEM_ROOT/tools/bin/nnsarc.exe -c $archiveFile -A 16 -a $dataDir -s -E .svn" ); +} + +# アーカイブのハッシュの出力 +{ + my $digest; + system ("openssl dgst -sha1 -binary -out $digestFile $archiveFile"); +} + +# 署名付加 +{ + system ( "openssl rsautl -sign -in $digestFile -inkey $KEYROOT/keys/rsa/private_sharedFont.der -keyform DER -out $signFile" ); + system ( "cat $signFile $archiveFile >$outFile" ); + deleteTemp(); +} diff --git a/tools/bin/makeTitleIdDir.plx b/tools/bin/makeTitleIdDir.plx new file mode 100644 index 00000000..acd35971 --- /dev/null +++ b/tools/bin/makeTitleIdDir.plx @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +###################################################################### +# genFontTable.pl +# +# generate Secure Shared Font Data Table +# +###################################################################### + +if ($#ARGV < 1) { + printf STDOUT ("Usage: %s SRL_file tgtDir\n", $0); + exit(-1); +} + +open SRL, "<$ARGV[0]" or die; +binmode SRL; + + +# TitleID_Lo取得 +sysseek SRL, 0x230, SEEK_SET; +my $data; +sysread( SRL, $data, 4 ); + +my @id = unpack( "cccc", $data); +my $titleID_Lo = pack( "cccc", $id[3], $id[2], $id[1], $id[0] ); +#printf "%s\n", $titleID_Lo; + + +# ROMバージョン取得 +sysseek SRL, 0x1e, SEEK_SET; +sysread( SRL, $data, 1 ); +my $version = sprintf "%d\n", unpack( "c", $data ); +#printf "%s\n", $version; + +system( "mkdir -p $ARGV[1]/$titleID_Lo" ); +system( "mkdir -p $ARGV[1]/$titleID_Lo/V$version" ); + +#TAD格納ディレクトリprint +printf "$ARGV[1]/$titleID_Lo/V$version"; + +close SRL + diff --git a/tools/bin/makerom.TWL.launcher.exe b/tools/bin/makerom.TWL.launcher.exe new file mode 100755 index 00000000..0e8ed921 Binary files /dev/null and b/tools/bin/makerom.TWL.launcher.exe differ diff --git a/tools/bin/nor_header.sbin b/tools/bin/nor_header.sbin new file mode 100644 index 00000000..2865df12 Binary files /dev/null and b/tools/bin/nor_header.sbin differ diff --git a/tools/bin/remaketad.pl b/tools/bin/remaketad.pl new file mode 100755 index 00000000..108b8313 --- /dev/null +++ b/tools/bin/remaketad.pl @@ -0,0 +1,196 @@ +#!/bin/perl + +use strict; +use Crypt::Rijndael; +use Digest::SHA1 qw(sha1); + +my $tad = $ARGV[0] or die "split_tad \n"; +my $outdir = "out"; + +my $buf; +my $common_key = pack("H*", "A1604A6A7123B529AE8BEC32C816FCAA"); # dev + +open(F, $tad) or die "cant open $tad\n"; +binmode(F); +read(F, $buf, -s $tad); +close(F); + +mkdir $outdir; + + +my $offset = 0; +my $size = 32; +my( $hdrSize, $tadType, $tadVersion, $certSize, + $crlSize, $ticketSize, $tmdSize, $contentSize, $metaSize) + = unpack("Na2nNNNNNN", substr($buf, $offset, $size)); +$offset += $size; + +print <<__REPORT__; +============================= + hdrSize $hdrSize + tadType $tadType + tadVersion $tadVersion + certSize $certSize + crlSize $crlSize + ticketSize $ticketSize + tmdSize $tmdSize + contentSize $contentSize + metaSize $metaSize +============================= +__REPORT__ + +my $certOffset = &round_up($hdrSize, 64); +my $crlOffset = &round_up($certOffset + $certSize, 64); +my $ticketOffset = &round_up($crlOffset + $crlSize, 64); +my $tmdOffset = &round_up($ticketOffset + $ticketSize, 64); +my $contentOffset = &round_up($tmdOffset + $tmdSize, 64); +my $metaOffset = &round_up($contentOffset + $contentSize, 64); +my $fileSize = &round_up($metaOffset + $metaSize, 64); + +die "file size is not expected size(=$fileSize)\n" if $fileSize != -s $tad; + +my $ticket = substr($buf, $ticketOffset, $ticketSize); +my $tmd = substr($buf, $tmdOffset, $tmdSize); +my $content = substr($buf, $contentOffset, $contentSize); + +&save_file("$outdir/cert.bin", substr($buf, $certOffset, $certSize)); +&save_file("$outdir/crl.bin", substr($buf, $crlOffset, $crlSize)); +&save_file("$outdir/ticket.bin", $ticket); +&save_file("$outdir/tmd.bin", $tmd); +#&save_file("$outdir/content.bin", substr($buf, $contentOffset, $contentSize)); +&save_file("$outdir/meta.bin", substr($buf, $metaOffset, $metaSize)); + + +my $title_key = &read_title_key($ticket); +my $rci = &read_content_info($tmd); + +print unpack("H*", $title_key), "\n"; + +my $offset = 0; +foreach my $i ( @$rci ) +{ + my $size = &round_up($i->[3], 16); + my $enc_content_x = substr($content, $offset, $size); + my $content_x_iv = pack("n", $i->[1]) . pack("x14"); + my $dec_content_x = &dec_cbc($title_key, $content_x_iv, $enc_content_x); + my $dec_content = substr($dec_content_x, 0, $i->[3]); + my $hash = &sha1($dec_content); + + print unpack("H*", $hash), " "; + print((($hash eq $i->[4]) ? "OK": "hash mismatch"), "\n"); + &save_file("$outdir/content_$i->[1].encrypted.bin", $enc_content_x); + &save_file("$outdir/content_$i->[1].bin", $dec_content); + + $offset += &round_up($size, 64); +} + +my $cfg = read_cfg($tmd); +save_cfg("$outdir/config.txt", $cfg); + +print <<__REPORT__; +============================= + dataflg $cfg->[0] + titleid $cfg->[1] + groupid $cfg->[2] + major_ver $cfg->[3] + minor_ver $cfg->[4] +============================= +__REPORT__ + +maketad($tad, $cfg); +system("/bin/rm -rf $outdir"); + + +sub round_up +{ my( $x, $align ) = @_; + + return int( ($x + $align - 1)/$align ) * $align; +} + +sub save_file +{ my( $name, $data ) = @_; + + open(OUT, ">$name") or die "cant open $name\n"; + binmode(OUT); + print OUT $data; + close(OUT); +} + +sub read_content_info +{ my( $tmd ) = @_; + my @ci = (); + + my $nContent = unpack("n", substr($tmd, 0x1DE, 2)); + + for( my $i = 0; $i < $nContent; ++$i ) + { + my( $cid, $idx, $type, $size, $hash ) + = unpack("Nnnx4Na20", substr($tmd, 0x1E4 + 36 * $i, 36)); + + push @ci, [$cid, $idx, $type, $size, $hash]; + } + + return \@ci; +} + +sub maketad +{ my( $tad, $cfg ) = @_; + + my $maketad = "$ENV{TWL_IPL_RED_PRIVATE_ROOT}/tools/bin/maketad.updater.exe"; + $tad =~ s/tad/updater.tad/; + + my $option = ""; + if( $cfg->[0] ) + { + $option = "-d $cfg->[1] $cfg->[2] $cfg->[3] $tad -v $cfg->[4]"; + } else { + $option = "-v $cfg->[4]"; + } + + my $cmd = "$maketad $outdir/content_0.bin $option -s -o $tad"; + system("/bin/echo $cmd"); + system("$cmd"); +} + +sub read_cfg +{ my( $tmd ) = @_; + + my( $titleid_h, $titleid_l ) = unpack("NN", substr($tmd, 0x18C, 8)); + my $groupid = sprintf("%04X", unpack("n", substr($tmd, 0x198, 2))); + my( $major_ver, $minor_ver ) = unpack("CC", substr($tmd, 0x1DC, 2)); + + my $titleid = sprintf("%08X%08X", $titleid_h, $titleid_l); + my $dataflg = ($titleid_h & 0x08) >> 3; + + return [ $dataflg, $titleid, $groupid, $major_ver, $minor_ver ] +} + +sub save_cfg +{ my( $name, $cfg ) = @_; + + open(OUT, ">$name") or die "cant open $name\n"; + print OUT sprintf("dataflg = $cfg->[0]\n"); + print OUT sprintf("titleid = $cfg->[1]\n"); + print OUT sprintf("groupid = $cfg->[2]\n"); + print OUT sprintf("major_ver = $cfg->[3]\n"); + print OUT sprintf("minor_ver = $cfg->[4]\n"); + close(OUT); +} + +sub read_title_key +{ my( $ticket ) = @_; + + my $enc_title_key = substr($ticket, 0x1BF, 16); + my $title_key_iv = substr($ticket, 0x1DC, 8) . pack("x8"); + + return &dec_cbc($common_key, $title_key_iv, $enc_title_key); +} + +sub dec_cbc +{ my( $key, $iv, $data ) = @_; + + my $cbc = Crypt::Rijndael->new($key, Crypt::Rijndael::MODE_CBC); + $cbc->set_iv($iv); + return $cbc->decrypt($data); +} + diff --git a/tools/bin/rom_header.template.sbin b/tools/bin/rom_header.template.sbin new file mode 100644 index 00000000..11b30bab Binary files /dev/null and b/tools/bin/rom_header.template.sbin differ