mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
0thNUP対応 セキュリティ対策版タグ
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@150 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
ed062ac949
commit
42f0ef5f95
BIN
tags/0thNUP_Secure/CardCup/CardCup.bsf
Normal file
BIN
tags/0thNUP_Secure/CardCup/CardCup.bsf
Normal file
Binary file not shown.
22
tags/0thNUP_Secure/CardCup/CardCup.rsf
Normal file
22
tags/0thNUP_Secure/CardCup/CardCup.rsf
Normal file
@ -0,0 +1,22 @@
|
||||
BasicInfo:
|
||||
Title : CupCardDemo
|
||||
BackupMemoryType : None
|
||||
Logo: Nintendo
|
||||
|
||||
TitleInfo:
|
||||
Use: Evaluation
|
||||
UniqueId: 0xf802a
|
||||
Version: 0
|
||||
|
||||
SystemControlInfo:
|
||||
AppType : System
|
||||
Dependency:
|
||||
- codec
|
||||
- hid
|
||||
- gsp
|
||||
- dsp
|
||||
|
||||
AccessControlInfo:
|
||||
Priority: 48
|
||||
FileSystemAccess:
|
||||
- CategorySystemApplication
|
||||
46
tags/0thNUP_Secure/CardCup/OMakefile
Normal file
46
tags/0thNUP_Secure/CardCup/OMakefile
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev$
|
||||
#----------------------------------------------------------------------------
|
||||
CTR_APPTYPE=BOTH
|
||||
CTR_MAKE_DEVELOPMENT_IMAGE = true
|
||||
|
||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
||||
|
||||
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
||||
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
||||
|
||||
SOURCES[] =
|
||||
main.cpp
|
||||
scrollBuffer.cpp
|
||||
|
||||
LIBS += lib_demo \
|
||||
libnn_am \
|
||||
libnn_cup \
|
||||
libnn_ns \
|
||||
libnn_ps
|
||||
|
||||
|
||||
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/HomeMenuTest.desc
|
||||
|
||||
TARGET_PROGRAM = CardCup
|
||||
|
||||
TITLE = CardCup
|
||||
ROM_SPEC_FILE = CardCup.rsf
|
||||
|
||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
||||
|
||||
include $(ROOT_OMAKE)/modulerules
|
||||
|
||||
build: $(DEFAULT_TARGETS)
|
||||
73
tags/0thNUP_Secure/CardCup/OMakeroot
Normal file
73
tags/0thNUP_Secure/CardCup/OMakeroot
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakeroot
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev:$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# ディレクトリレイアウトについての説明
|
||||
#
|
||||
# a) ソースコードがルートディレクトリ直下に配置される場合
|
||||
# 例:
|
||||
# /OMakeroot
|
||||
# /foo/bar/OMakefile
|
||||
#
|
||||
# 結果:
|
||||
# OMakefile と同じディレクトリ以下に objects や images が生成されます。
|
||||
#
|
||||
# /foo/bar/objects/...
|
||||
# /foo/bar/images/..
|
||||
#
|
||||
#
|
||||
# b) ソースコードが sources 以下に配置される場合
|
||||
# 例:
|
||||
# /OMakeroot
|
||||
# /sources/foo/bar/OMakefile
|
||||
#
|
||||
# 結果:
|
||||
# ルートディレクトリ以下に objects や images が生成されます。
|
||||
#
|
||||
# /objects/foo/bar/...
|
||||
# /images/foo/bar/...
|
||||
#
|
||||
#
|
||||
|
||||
# ルート環境変数の取得
|
||||
public.HORIZON_ROOT =
|
||||
if $(defined-env HORIZON_ROOT)
|
||||
HORIZON_ROOT = $(absname $(getenv HORIZON_ROOT))
|
||||
export
|
||||
|
||||
if $(defined-env CTRSDK_ROOT)
|
||||
CTRSDK_ROOT = $(absname $(getenv CTRSDK_ROOT))
|
||||
if $(and $(defined-env HORIZON_ROOT), $(not $(equal $(HORIZON_ROOT), $(CTRSDK_ROOT))))
|
||||
eprintln(HORIZON_ROOT と CTRSDK_ROOT が一致しません。同じパスを設定するか、どちらか一方だけを定義して下さい。)
|
||||
exit(1)
|
||||
HORIZON_ROOT = $(CTRSDK_ROOT)
|
||||
export
|
||||
|
||||
if $(not $(HORIZON_ROOT))
|
||||
eprintln($"$$CTRSDK_ROOT が定義されていません")
|
||||
exit(1)
|
||||
|
||||
include $(HORIZON_ROOT)/build/omake/commondefs
|
||||
|
||||
DefineCommandVars()
|
||||
|
||||
.PHONY: all build clean clobber
|
||||
.PHONY: run run-scripts run-emumem
|
||||
|
||||
#
|
||||
# OMakefile の読み込み
|
||||
#
|
||||
.SUBDIRS: .
|
||||
|
||||
BIN
tags/0thNUP_Secure/CardCup/banner/model.cbmd
Normal file
BIN
tags/0thNUP_Secure/CardCup/banner/model.cbmd
Normal file
Binary file not shown.
BIN
tags/0thNUP_Secure/CardCup/banner/sound.cbsd
Normal file
BIN
tags/0thNUP_Secure/CardCup/banner/sound.cbsd
Normal file
Binary file not shown.
1
tags/0thNUP_Secure/CardCup/banner/unknown24x24.ctpk
Normal file
1
tags/0thNUP_Secure/CardCup/banner/unknown24x24.ctpk
Normal file
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ф8ф8фШчГГГГГГВ╫В╫8фВ╫В╫В╫В╫В╫ГГГГшчфГШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГШчyнYнВ╫шчшчВ╫В╫фВ╫В╫шчyнШчВ╫yнГГГГyнШФГГГГГшчВ╫В╫В╫В╫YнГyнГВ╫В╫В╫В╫В╫yнфшчГШФГYнyнВ╫В╫В╫yнВ╫╨жВ╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнГYнГВ╫В╫В╫В╫В╫фВ╫В╫ГyнГ8фВ╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
1
tags/0thNUP_Secure/CardCup/banner/unknown48x48.ctpk
Normal file
1
tags/0thNUP_Secure/CardCup/banner/unknown48x48.ctpk
Normal file
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫8ф8фВ╫В╫В╫╨ж8ф╨жГГшчГГГГГГГГГГГГГГГГГГГГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8ф8фВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГШФГГГГГГГГГГ жфГГВ╫В╫ жВ╫ГГГГГ жГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫шчВ╫В╫В╫В╫В╫ГВ╫ШчВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫╨жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГГГГГГГГГГГГГГШФ8фШчшчВ╫В╫ жВ╫YнВ╫В╫В╫В╫В╫ГГYнyнГГyнфВ╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчшчГшчШФВ╫В╫ГГYнГВ╫В╫В╫В╫В╫шчВ╫шчГГГГГГГГГГГГГГГГВ╫В╫YнШч жГГГГГГГГГГГГГГГГГГГГГГГГшч╨жВ╫ жВ╫шчВ╫В╫В╫В╫В╫ШФВ╫ШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫yнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫ жГГГГВ╫шчВ╫шчГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫╨жшчВ╫В╫В╫В╫В╫YнфyнГГГГГГГГГ жГГГГ╨жВ╫YнВ╫ШФYнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шч жВ╫В╫В╫В╫В╫В╫yнВ╫ГШФВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ШФВ╫ГГГГГВ╫ШчВ╫YнГГШФГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГ жВ╫шчВ╫ГГГшч жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
269
tags/0thNUP_Secure/CardCup/main.cpp
Normal file
269
tags/0thNUP_Secure/CardCup/main.cpp
Normal file
@ -0,0 +1,269 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: main.cpp
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/hid.h>
|
||||
#include <nn/os.h>
|
||||
#include <nn/dbg.h>
|
||||
#include <nn/CTR.h>
|
||||
#include <nn/ns.h>
|
||||
#include <nn/ns/CTR/ns_ApiShell.h>
|
||||
#include <nn/ns/CTR/ns_Shell.h>
|
||||
#include <nn/fs/fs_FileSystemBase.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/applet/CTR/applet_APIForSystem.h>
|
||||
|
||||
#include <nn/cup.h>
|
||||
|
||||
#include "demo.h"
|
||||
#include "scrollBuffer.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int s_GxHeapSize=0x800000;
|
||||
nn::fnd::ExpHeap s_appHeap;
|
||||
uptr s_GxHeap;
|
||||
|
||||
demo::RenderSystemDrawing s_RenderSystem;
|
||||
ScrollBuffer s_scrollBufferInstance;
|
||||
ScrollBuffer *s_scrollBuffer;
|
||||
|
||||
char s_updaterBuffer[1<<20] NN_ATTRIBUTE_ALIGN(4096);
|
||||
|
||||
// デモの初期化
|
||||
void Initialize()
|
||||
{
|
||||
// os の初期化
|
||||
nn::os::Initialize();
|
||||
|
||||
// NuiShellの初期化 (CUPに必須)
|
||||
NN_UTIL_PANIC_IF_FAILED(nn::ns::CTR::InitializeForShell());
|
||||
|
||||
// fsの初期化 (カード確認用)
|
||||
nn::fs::Initialize();
|
||||
|
||||
// appletの初期化
|
||||
//nn::applet::InitializeForSystem( nn::applet::PHOME_MENU_APPLET_ID, nn::applet::TYPE_SYS );
|
||||
//nn::applet::Initialize( nn::applet::TEST2_APPLET_ID);
|
||||
//nn::applet::SetAppletMode();
|
||||
nn::applet::Enable();
|
||||
|
||||
// デバイスメモリの設定
|
||||
const int DEVICE_MEMORY_SIZE = 12*1024 * 1024;
|
||||
NN_UTIL_PANIC_IF_FAILED(nn::os::SetDeviceMemorySize(DEVICE_MEMORY_SIZE));
|
||||
|
||||
// ヒープの初期化
|
||||
s_appHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
|
||||
|
||||
// 描画インスタンスの初期化
|
||||
s_GxHeap = reinterpret_cast<uptr>(s_appHeap.Allocate(s_GxHeapSize));
|
||||
s_RenderSystem.Initialize(s_GxHeap, s_GxHeapSize);
|
||||
|
||||
// hidの初期化
|
||||
NN_UTIL_PANIC_IF_FAILED(nn::hid::Initialize());
|
||||
|
||||
// 描画インスタンスの初期化
|
||||
s_scrollBufferInstance.Initialize(&s_RenderSystem);
|
||||
s_scrollBuffer=&s_scrollBufferInstance;
|
||||
|
||||
// GPU利用宣言
|
||||
nn::applet::AssignGpuRight();
|
||||
}
|
||||
|
||||
// 消費時間取得用関数群
|
||||
s64 s_StartTick;
|
||||
void SetTick()
|
||||
{
|
||||
s_StartTick=nn::os::Tick::GetSystemCurrent();
|
||||
}
|
||||
s64 GetConsumedMillisec()
|
||||
{
|
||||
s64 endTick=nn::os::Tick::GetSystemCurrent();
|
||||
nn::os::Tick consumed(endTick-s_StartTick);
|
||||
return ((nn::fnd::TimeSpan)consumed).GetMilliSeconds();
|
||||
}
|
||||
|
||||
// 動いていることを知らせるための、くるくる画面表示取得用メソッド
|
||||
const char s_progress[]="-\\|/";
|
||||
int s_progressIndex=0;
|
||||
char GetProgressChar()
|
||||
{
|
||||
s_progressIndex=(s_progressIndex+1)%(sizeof(s_progress)-1);
|
||||
return s_progress[s_progressIndex];
|
||||
}
|
||||
|
||||
nn::Result UpdateCore()
|
||||
{
|
||||
nn::Result result;
|
||||
nn::cup::ProgressInfo info;
|
||||
|
||||
/********************** アップデート*******************/
|
||||
SetTick();
|
||||
s_scrollBuffer->AppendText("Start Card Update")->Render();
|
||||
NN_UTIL_RETURN_IF_FAILED(nn::cup::CTR::DoUpdate());
|
||||
|
||||
// ステータスがStartedになるまで、プログレスは取得できない
|
||||
s_scrollBuffer->AppendText("");
|
||||
do{
|
||||
s_scrollBuffer->ReplaceText(" %c Initializing", GetProgressChar())->Render();
|
||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
||||
}while(info.state==nn::cup::CTR::UPDATE_STATE_INITIALIZING);
|
||||
|
||||
// 抜けた際のstateがFAILEDかどうか確認
|
||||
if(info.state==nn::cup::CTR::UPDATE_STATE_FAILED){
|
||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
||||
}
|
||||
s_scrollBuffer->ReplaceText(" - Initialized (%lldmsec)", GetConsumedMillisec());
|
||||
|
||||
/********************* アップデート中 ******************/
|
||||
SetTick();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
do{
|
||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
s_scrollBuffer->ReplaceText(" %c Title %d/%d, size %lld/%lld",
|
||||
GetProgressChar(),
|
||||
info.numImportedTitles, info.numTotalTitles,
|
||||
info.importedSize, info.totalSize)->Render();
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
||||
|
||||
}while(info.state==nn::cup::CTR::UPDATE_STATE_STARTED);
|
||||
// 抜けた際のstateがFAILEDかどうか確認
|
||||
if(info.state==nn::cup::CTR::UPDATE_STATE_FAILED){
|
||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
||||
}
|
||||
s_scrollBuffer->AppendText(" - Imported (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
|
||||
/***************** アップデート終了中 ******************/
|
||||
SetTick();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
do{
|
||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
s_scrollBuffer->ReplaceText(" %c Update Finalizing", GetProgressChar())->Render();
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
||||
}while(info.state==nn::cup::CTR::UPDATE_STATE_FINALIZING);
|
||||
// 抜けた際のstateがFAILEDかどうか確認
|
||||
if(info.state==nn::cup::CTR::UPDATE_STATE_FAILED){
|
||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
||||
}
|
||||
|
||||
/******************* アップデート終了 *******************/
|
||||
s_scrollBuffer->AppendText(" - Finalized (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("");
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
nn::Result UpdateSequence(bool *isHandledError)
|
||||
{
|
||||
nn::Result result;
|
||||
nn::Result lastResult=nn::ResultSuccess();
|
||||
nn::hid::PadReader padReader;
|
||||
|
||||
/********************* CUPの初期化 *******************/
|
||||
s_scrollBuffer->AppendText("Initializing Cup Library")->Render();
|
||||
SetTick(); // 初期化開始前の時間をセット
|
||||
result=nn::cup::CTR::Initialize(s_updaterBuffer,sizeof(s_updaterBuffer));
|
||||
if(result==nn::cup::CTR::ResultUpdatePartitionNotFound()){
|
||||
s_scrollBuffer->AppendText(" - Update Partition Not Found (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
*isHandledError=true;
|
||||
return result;
|
||||
}
|
||||
if(result==nn::cup::CTR::ResultUpdateNotRequired()){
|
||||
s_scrollBuffer->AppendText(" - Already Updated (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
*isHandledError=true;
|
||||
return result;
|
||||
}
|
||||
if(result==nn::cup::CTR::ResultInvalidUpdatePartitionFormat()){
|
||||
s_scrollBuffer->AppendText(" - Invalid Update Partition (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
*isHandledError=true;
|
||||
return result;
|
||||
}
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
s_scrollBuffer->AppendText(" - Need Update (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
|
||||
lastResult=UpdateCore();
|
||||
|
||||
// Initializeに成功した場合のみ、再びInitializeするためにFinalizeが必要
|
||||
SetTick();
|
||||
s_scrollBuffer->AppendText("Finalizing Cup Library")->Render();
|
||||
NN_UTIL_RETURN_IF_FAILED(nn::cup::CTR::Finalize());
|
||||
s_scrollBuffer->AppendText(" - Complete (%lldmsec)", GetConsumedMillisec())->Render();
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
|
||||
return lastResult;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void nnMain()
|
||||
{
|
||||
NN_LOG("Start cup demo\n");
|
||||
nn::Result result;
|
||||
Initialize();
|
||||
|
||||
/******************** CUPの実行 *******************/
|
||||
bool isHandledError = false;
|
||||
result = UpdateSequence(&isHandledError);
|
||||
if (isHandledError == false && result.IsFailure())
|
||||
{
|
||||
{
|
||||
// それ以外の場合は、Resultを表示
|
||||
s_scrollBuffer->AppendText(" - Unhandled Error: 0x%08x", result.GetPrintableBits());
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
}
|
||||
}
|
||||
|
||||
s_scrollBuffer->AppendText("")->Render();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
||||
if(result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 0, 1, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 1, 0, 0, 1);
|
||||
}
|
||||
s_RenderSystem.Clear();
|
||||
s_RenderSystem.SwapBuffers();
|
||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY1);
|
||||
if(result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 0, 1, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 1, 0, 0, 1);
|
||||
}
|
||||
s_scrollBuffer->ReplaceText("%c Finished", GetProgressChar())->Render();
|
||||
|
||||
if ( nn::applet::IsExpectedToCloseApplication() )
|
||||
{
|
||||
nn::applet::PrepareToCloseApplication();
|
||||
nn::applet::CloseApplication();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
89
tags/0thNUP_Secure/CardCup/scrollBuffer.cpp
Normal file
89
tags/0thNUP_Secure/CardCup/scrollBuffer.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: scrollBuffer.cpp
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <cstdio>
|
||||
#include "scrollBuffer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
char ScrollBuffer::s_buffers[MAX_BUFFER_LINE][MAX_BUFFER_CHARS];
|
||||
|
||||
char *ScrollBuffer::GetFormattedString(const char *fmt, va_list arg)
|
||||
{
|
||||
static char formattedBuffer[MAX_BUFFER_CHARS];
|
||||
vsnprintf(formattedBuffer, MAX_BUFFER_CHARS, fmt, arg);
|
||||
return formattedBuffer;
|
||||
}
|
||||
|
||||
ScrollBuffer *ScrollBuffer::Update()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
ScrollBuffer *ScrollBuffer::AppendText(const char *fmt, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
va_start(vlist, fmt);
|
||||
|
||||
int nextPosition=(m_tail+1)%MAX_BUFFER_LINE;
|
||||
if(nextPosition==m_head){
|
||||
// ヘッドとビューの移動
|
||||
if(m_head==m_currentView){
|
||||
m_currentView=(m_head+1)%MAX_BUFFER_LINE;
|
||||
}
|
||||
m_head=(m_head+1)%MAX_BUFFER_LINE;
|
||||
|
||||
}
|
||||
strlcpy(s_buffers[m_tail], GetFormattedString(fmt, vlist), MAX_BUFFER_CHARS);
|
||||
m_tail=nextPosition;
|
||||
NN_LOG("cup: %s\n", GetFormattedString(fmt, vlist));
|
||||
|
||||
// ビューの移動
|
||||
if((m_currentView+MAX_DISPLAY_LINES)%MAX_BUFFER_LINE==m_tail){
|
||||
m_currentView=(m_currentView+1)%MAX_BUFFER_LINE;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
ScrollBuffer *ScrollBuffer::ReplaceText(const char *fmt, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
va_start(vlist, fmt);
|
||||
|
||||
NN_ASSERT(m_tail!=m_head);
|
||||
strlcpy(s_buffers[(m_tail-1)%MAX_BUFFER_LINE], GetFormattedString(fmt, vlist), MAX_BUFFER_CHARS);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void ScrollBuffer::Render()
|
||||
{
|
||||
// 描画前処理
|
||||
m_render->SetRenderTarget(NN_GX_DISPLAY1);
|
||||
m_render->Clear();
|
||||
m_render->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
// リングバッファなので、終端条件を調整
|
||||
int tail=(m_tail<m_head) ? m_tail+ScrollBuffer::MAX_BUFFER_LINE : m_tail;
|
||||
|
||||
for(int i=m_currentView; i<tail; i++){
|
||||
if(i<m_currentView+MAX_DISPLAY_LINES-1){
|
||||
m_render->DrawText(0, (i-m_currentView)*FONT_SIZE, s_buffers[i%MAX_BUFFER_LINE]);
|
||||
}
|
||||
}
|
||||
|
||||
// 描画転送
|
||||
m_render->SwapBuffers();
|
||||
}
|
||||
55
tags/0thNUP_Secure/CardCup/scrollBuffer.h
Normal file
55
tags/0thNUP_Secure/CardCup/scrollBuffer.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: scrollBuffer.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SCROLL_BUFFER_H_
|
||||
#define SCROLL_BUFFER_H_
|
||||
|
||||
#include "demo.h"
|
||||
class ScrollBuffer
|
||||
{
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MAX_BUFFER_LINE=128,
|
||||
MAX_BUFFER_CHARS=80,
|
||||
MAX_DISPLAY_LINES=20,
|
||||
FONT_SIZE=12
|
||||
};
|
||||
// 表示文字のバッファ (リングバッファ)
|
||||
static char s_buffers[MAX_BUFFER_LINE][MAX_BUFFER_CHARS];
|
||||
int m_head;
|
||||
int m_tail;
|
||||
int m_currentView;
|
||||
|
||||
demo::RenderSystemDrawing *m_render;
|
||||
|
||||
char *GetFormattedString(const char *fmt, va_list arg);
|
||||
|
||||
public:
|
||||
ScrollBuffer() :
|
||||
m_head(0), m_tail(0), m_currentView(0)
|
||||
{}
|
||||
void Initialize(demo::RenderSystemDrawing *render)
|
||||
{
|
||||
m_render=render;
|
||||
}
|
||||
|
||||
ScrollBuffer *Update(); // キー入力を参照して、スクロールする
|
||||
ScrollBuffer *AppendText(const char *fmt, ...); // 文字列を追加する
|
||||
ScrollBuffer *ReplaceText(const char *fmt, ...); // 最新の文字列を置換する
|
||||
void Render(); // レンダリング
|
||||
};
|
||||
|
||||
#endif // SCROLL_BUFFER_H
|
||||
16
tags/0thNUP_Secure/CardSaveDataMover/Imp/Imp.rsf
Normal file
16
tags/0thNUP_Secure/CardSaveDataMover/Imp/Imp.rsf
Normal file
@ -0,0 +1,16 @@
|
||||
BasicInfo:
|
||||
Title : $(TITLE)
|
||||
BackupMemoryType: None
|
||||
Logo : Nintendo
|
||||
# Companycode: "00"
|
||||
ProductCode : "CTR-N-22MA"
|
||||
# MediaSize: 2GB
|
||||
|
||||
Rom:
|
||||
HostRoot : $(ROMFS_ROOT)
|
||||
|
||||
|
||||
TitleInfo:
|
||||
# UniqueId: 0xffff6
|
||||
UniqueId: 0xf8015
|
||||
Version: 0
|
||||
65
tags/0thNUP_Secure/CardSaveDataMover/Imp/OMakefile
Normal file
65
tags/0thNUP_Secure/CardSaveDataMover/Imp/OMakefile
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev: 31765 $
|
||||
#----------------------------------------------------------------------------
|
||||
SUPPORTED_TARGETS = CTR-*.Process.MPCore.*
|
||||
|
||||
#demoライブラリ位置指定
|
||||
#SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../common/include)
|
||||
#SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../CTR_SDK/sampledemos/common/include)
|
||||
#INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
||||
|
||||
|
||||
SOURCES[] =
|
||||
./source/main.cpp
|
||||
./source/test_data.cpp
|
||||
../common/sleep.cpp
|
||||
../common/common.cpp
|
||||
../common/shfnt.cpp
|
||||
|
||||
TARGET_PROGRAM = CtrSaveDataMover_imp
|
||||
|
||||
TITLE = CSM_imp
|
||||
|
||||
#LIBS += libnn_am
|
||||
|
||||
IMPORTEE_CIA = importee.cia
|
||||
|
||||
#SRC_IMPORTEE_PATH = ../body/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/CtrSaveDataMover.cia
|
||||
#とりあえず、マスタリング時は直おき、配置時に改名
|
||||
SRC_IMPORTEE_PATH = CtrSaveDataMover_master.cia
|
||||
|
||||
# ビルドタイプ別に romfs を作る
|
||||
#ROMFS_ROOT = $`(TARGET.getObjectDirectory)/romfsroot
|
||||
ROMFS_ROOT = ./romfiles
|
||||
DEST_IMPORTEE_PATH = $(ROMFS_ROOT)/$(IMPORTEE_CIA)
|
||||
foreach(TARGET, $(BUILDER.getTargets $(SUPPORTED_TARGETS)))
|
||||
$(DEST_IMPORTEE_PATH): $(SRC_IMPORTEE_PATH) $(makeDirectory $(ROMFS_ROOT))
|
||||
cp $< $@
|
||||
ROMFS_DEPENDENCIES = $(DEST_IMPORTEE_PATH)
|
||||
|
||||
# プログラムから参照するためのROMFSのパスとプログラムIDを定義する
|
||||
ROMFS_IMPORTEE_PATH = L\"rom:/$(IMPORTEE_CIA)\"
|
||||
CCFLAGS += -DROMFS_IMPORTEE_PATH=$(ROMFS_IMPORTEE_PATH)
|
||||
|
||||
ROM_SPEC_FILE = Imp.rsf
|
||||
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/repairtool.desc
|
||||
|
||||
# バナー、アイコン
|
||||
CTR_BANNER_SPEC = banner.bsf
|
||||
|
||||
include $(ROOT_OMAKE)/modulerules
|
||||
|
||||
build: $(DEFAULT_TARGETS)
|
||||
|
||||
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner.bsf
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner.bsf
Normal file
Binary file not shown.
@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<NintendoWareIntermediateFile>
|
||||
<GraphicsContentCtr Version="1.3.0" Namespace="">
|
||||
<EditData>
|
||||
<MetaData>
|
||||
<Key>MetaData</Key>
|
||||
<Create Author="" Date="2010-12-02T15:21:10" Source="COMMON.mb">
|
||||
<ToolDescriptions Name="NW4C_Export for Maya 2009 Service Pack 1" Version="1.2.0" />
|
||||
</Create>
|
||||
<Modify Date="2011-02-28T13:27:46">
|
||||
<ToolDescriptions Name="NintendoWare Creative Studio For Banner." Version="1.3.0.30235" />
|
||||
</Modify>
|
||||
</MetaData>
|
||||
<ContentSummaryMetaData>
|
||||
<Key>ContentSummaries</Key>
|
||||
<Values>
|
||||
<ContentSummary ContentTypeName="GraphicsContent">
|
||||
<ObjectSummaries>
|
||||
<ObjectSummary TypeName="SkeletalModel" Name="">
|
||||
<Notes>
|
||||
<Note Name="MaterialCount" Value="1" />
|
||||
<Note Name="ShapeCount" Value="1" />
|
||||
<Note Name="MeshCount" Value="1" />
|
||||
<Note Name="BoneCount" Value="1" />
|
||||
<Note Name="TotalPrimitiveSetCount" Value="1" />
|
||||
<Note Name="TotalNoneSkinningPrimitiveSetCount" Value="1" />
|
||||
<Note Name="TotalRigidSkinningPrimitiveSetCount" Value="0" />
|
||||
<Note Name="TotalSmoothSkinningPrimitiveSetCount" Value="0" />
|
||||
<Note Name="TotalIndexStreamCount" Value="1" />
|
||||
<Note Name="TotalPolygonCount" Value="2" />
|
||||
<Note Name="TotalVertexCount" Value="4" />
|
||||
</Notes>
|
||||
</ObjectSummary>
|
||||
</ObjectSummaries>
|
||||
</ContentSummary>
|
||||
</Values>
|
||||
</ContentSummaryMetaData>
|
||||
</EditData>
|
||||
<Models>
|
||||
<SkeletalModel Name="" IsBranchVisible="true" IsVisible="true" CullingMode="Dynamic" IsNonuniformScalable="false" LayerId="0" NeededBoneCapacity="20">
|
||||
<EditData>
|
||||
<ModelDccToolExportOption ExportStartFrame="0" Magnify="1" AdjustSkinning="None" MeshVisibilityMode="BindByIndex">
|
||||
<Key>ModelDccToolInfo</Key>
|
||||
</ModelDccToolExportOption>
|
||||
<OptimizationLogArrayMetaData Size="1">
|
||||
<Key>OptimizationLogs</Key>
|
||||
<Values>
|
||||
<OptimizationLog Date="2010-12-02T15:21" EditorVersion="1.2.0.27817">
|
||||
<Options NodeCompressionMode="None" IsMergeMeshOwnerBoneEnabled="false" IsCombineMeshEnabled="false" IsCompressMaterialEnabled="false" IsOptimizePlygonPrimitiveEnabled="false" IsConvertOneBoneSkeletalModelToModel="true" IsDeleteUnusedVertexEnabled="false" PositionQuantizeMode="Float" NormalQuantizeMode="Float" TextureQuantizeMode="Float" GroupByIndexStream="false" />
|
||||
</OptimizationLog>
|
||||
</Values>
|
||||
</OptimizationLogArrayMetaData>
|
||||
</EditData>
|
||||
<AnimationGroupDescriptions>
|
||||
<GraphicsAnimationGroupDescription Name="SkeletalAnimation" EvaluationTiming="AfterSceneCulling">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="CalculatedTransform" IsBinarized="true">
|
||||
<Path>Skeleton.Bones["*"].AnimatedTransform</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
<GraphicsAnimationGroupDescription Name="VisibilityAnimation" EvaluationTiming="BeforeWorldUpdate">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>IsVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>Meshes["*"].IsVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>IsBranchVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
<GraphicsAnimationGroupDescription Name="MaterialAnimation" EvaluationTiming="AfterSceneCulling">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Emission</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Ambient</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Diffuse</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Specular0</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Specular1</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant0</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant1</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant2</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant3</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant4</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant5</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureMappers["*"].Sampler.BorderColor</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Int" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureMappers["*"].Texture</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].FragmentOperation.BlendOperation.BlendColor</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Vector2" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Scale</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Float" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Rotate</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Vector2" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Translate</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
</AnimationGroupDescriptions>
|
||||
<Transform>
|
||||
<Scale X="1" Y="1" Z="1" />
|
||||
<Rotate X="0" Y="0" Z="0" />
|
||||
<Translate X="0" Y="0" Z="0" />
|
||||
</Transform>
|
||||
<Shapes>
|
||||
<SeparateDataShapeCtr>
|
||||
<OrientedBoundingBox>
|
||||
<CenterPosition X="0" Y="0" Z="6.5" />
|
||||
<OrientationMatrix M00="1" M01="0" M02="0" M10="0" M11="1" M12="0" M20="0" M21="0" M22="1" />
|
||||
<Size X="24" Y="12" Z="0" />
|
||||
</OrientedBoundingBox>
|
||||
<PositionOffset X="0" Y="0" Z="0" />
|
||||
<PrimitiveSets>
|
||||
<PrimitiveSetCtr SkinningMode="None">
|
||||
<BoneIndexTable>0</BoneIndexTable>
|
||||
<Primitives>
|
||||
<PrimitiveCtr>
|
||||
<IndexStreams>
|
||||
<UbyteIndexStreamCtr PrimitiveMode="Triangles" Size="6">0 1 2 1 3 2</UbyteIndexStreamCtr>
|
||||
</IndexStreams>
|
||||
</PrimitiveCtr>
|
||||
</Primitives>
|
||||
</PrimitiveSetCtr>
|
||||
</PrimitiveSets>
|
||||
<VertexAttributes>
|
||||
<Vector3VertexStreamCtr Usage="Position" VertexSize="4" Scale="1" QuantizedMode="Float">
|
||||
-12 -6 6.5
|
||||
12 -6 6.5
|
||||
-12 6 6.5
|
||||
12 6 6.5
|
||||
</Vector3VertexStreamCtr>
|
||||
<Vector3VertexAttributeCtr Usage="Normal">0 0 1</Vector3VertexAttributeCtr>
|
||||
<Vector2VertexStreamCtr Usage="TextureCoordinate0" VertexSize="4" Scale="1" QuantizedMode="Float">
|
||||
0 0
|
||||
1 0
|
||||
0 1
|
||||
1 1
|
||||
</Vector2VertexStreamCtr>
|
||||
</VertexAttributes>
|
||||
</SeparateDataShapeCtr>
|
||||
</Shapes>
|
||||
<Materials>
|
||||
<MaterialCtr Name="MT_00" IsCompressible="true" LightSetIndex="0" FogIndex="0" IsFragmentLightEnabled="false" IsVertexLightEnabled="false" IsHemiSphereLightEnabled="false" IsHemiSphereOcclusionEnabled="false" IsFogEnabled="false" TextureCoordinateConfig="Config0120" TranslucencyKind="Layer1" ShaderProgramDescriptionIndex="-1" ShaderBinaryKind="Default">
|
||||
<ShaderReference />
|
||||
<MaterialColor VertexColorScale="1">
|
||||
<Emission R="0" G="0" B="0" A="0" />
|
||||
<Ambient R="1" G="1" B="1" A="0" />
|
||||
<Diffuse R="1" G="1" B="1" A="1" />
|
||||
<Specular0 R="1" G="1" B="1" A="0" />
|
||||
<Specular1 R="0" G="0" B="0" A="0" />
|
||||
<Constant0 R="0" G="0" B="0" A="1" />
|
||||
<Constant1 R="0" G="0" B="0" A="1" />
|
||||
<Constant2 R="0" G="0" B="0" A="1" />
|
||||
<Constant3 R="0" G="0" B="0" A="1" />
|
||||
<Constant4 R="0" G="0" B="0" A="1" />
|
||||
<Constant5 R="0" G="0" B="0" A="1" />
|
||||
</MaterialColor>
|
||||
<Rasterization CullingMode="BackFace" IsPolygonOffsetEnabled="false" PolygonOffsetUnit="0" />
|
||||
<TextureCoordinators>
|
||||
<TextureCoordinatorCtr SourceCoordinate="0" MappingMethod="UvCoordinateMap" ReferenceCamera="0" MatrixMode="DccMaya" ScaleS="1" ScaleT="1" Rotate="0" TranslateS="0" TranslateT="0" />
|
||||
</TextureCoordinators>
|
||||
<TextureMappers>
|
||||
<PixelBasedTextureMapperCtr>
|
||||
<TextureReference>Textures["banner_imp"]@file:Textures/banner_imp.ctex</TextureReference>
|
||||
<StandardTextureSamplerCtr MinFilter="Linear" MagFilter="Linear" WrapS="ClampToEdge" WrapT="ClampToEdge" MinLod="0" LodBias="0">
|
||||
<BorderColor R="0" G="0" B="0" A="1" />
|
||||
</StandardTextureSamplerCtr>
|
||||
</PixelBasedTextureMapperCtr>
|
||||
</TextureMappers>
|
||||
<FragmentShader LayerConfig="ConfigurationType0">
|
||||
<BufferColor R="0" G="0" B="0" A="1" />
|
||||
<FragmentBump BumpTextureIndex="Texture0" BumpMode="NotUsed" IsBumpRenormalize="false" />
|
||||
<FragmentLighting FresnelConfig="No" IsClampHighLight="false" IsDistribution0Enabled="false" IsDistribution1Enabled="false" IsGeometricFactor0Enabled="false" IsGeometricFactor1Enabled="false" IsReflectionEnabled="false" />
|
||||
<FragmentLightingTable>
|
||||
<ReflectanceRSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceRSampler>
|
||||
<ReflectanceGSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceGSampler>
|
||||
<ReflectanceBSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceBSampler>
|
||||
<Distribution0Sampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</Distribution0Sampler>
|
||||
<Distribution1Sampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</Distribution1Sampler>
|
||||
<FresnelSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</FresnelSampler>
|
||||
</FragmentLightingTable>
|
||||
<TextureCombiners>
|
||||
<TextureCombinerCtr CombineRgb="Replace" CombineAlpha="Replace" ScaleRgb="One" ScaleAlpha="One" Constant="Constant0" BufferInputRgb="PreviousBuffer" BufferInputAlpha="PreviousBuffer">
|
||||
<SourceRgb Source0="Texture0" Source1="FragmentPrimaryColor" Source2="FragmentSecondaryColor" />
|
||||
<OperandRgb Operand0="Color" Operand1="Color" Operand2="Color" />
|
||||
<SourceAlpha Source0="Texture0" Source1="Constant" Source2="Constant" />
|
||||
<OperandAlpha Operand0="Alpha" Operand1="Alpha" Operand2="Alpha" />
|
||||
</TextureCombinerCtr>
|
||||
</TextureCombiners>
|
||||
<AlphaTest IsTestEnabled="false" TestFunction="Always" TestReference="0" />
|
||||
</FragmentShader>
|
||||
<FragmentOperation>
|
||||
<DepthOperation IsTestEnabled="true" TestFunction="Less" IsMaskEnabled="false" />
|
||||
<BlendOperation Mode="Blend" LogicOperation="Copy">
|
||||
<RgbParameter BlendFunctionSource="SourceAlpha" BlendFunctionDestination="OneMinusSourceAlpha" BlendEquation="FuncAdd" />
|
||||
<AlphaParameter BlendFunctionSource="One" BlendFunctionDestination="Zero" BlendEquation="FuncAdd" />
|
||||
<BlendColor R="0" G="0" B="0" A="1" />
|
||||
</BlendOperation>
|
||||
<StencilOperation IsTestEnabled="false" TestFunction="Never" TestReference="0" TestMask="255" FailOperation="Keep" ZFailOperation="Keep" PassOperation="Keep" />
|
||||
</FragmentOperation>
|
||||
</MaterialCtr>
|
||||
</Materials>
|
||||
<Meshes>
|
||||
<Mesh IsVisible="true" RenderPriority="0" MeshNodeName="BONE_00">
|
||||
<EditData>
|
||||
<DccToolSourceNodeMetaData>
|
||||
<Key>DccToolSourceNode</Key>
|
||||
<Values>
|
||||
<NodeName>BONE_00</NodeName>
|
||||
</Values>
|
||||
</DccToolSourceNodeMetaData>
|
||||
</EditData>
|
||||
<SeparateShapeReference>Shapes[0]</SeparateShapeReference>
|
||||
<MaterialReference>Materials["MT_00"]</MaterialReference>
|
||||
</Mesh>
|
||||
</Meshes>
|
||||
<Skeleton RootBoneName="BONE_00" ScalingRule="Standard" IsTranslateAnimationEnabled="true">
|
||||
<Bones>
|
||||
<Bone Name="BONE_00" ParentBoneName="" IsSegmentScaleCompensate="false" IsCompressible="true" IsNeededRendering="true" HasSkinningMatrix="false" BillboardMode="YAxial">
|
||||
<Transform>
|
||||
<Scale X="1" Y="1" Z="1" />
|
||||
<Rotate X="0" Y="0" Z="0" />
|
||||
<Translate X="0" Y="0" Z="0" />
|
||||
</Transform>
|
||||
</Bone>
|
||||
</Bones>
|
||||
</Skeleton>
|
||||
</SkeletalModel>
|
||||
</Models>
|
||||
</GraphicsContentCtr>
|
||||
</NintendoWareIntermediateFile>
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/banner_imp.cbmd
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/banner_imp.cbmd
Normal file
Binary file not shown.
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/icon2_24.ctpk
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/icon2_24.ctpk
Normal file
Binary file not shown.
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/icon2_48.ctpk
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/banner/icon2_48.ctpk
Normal file
Binary file not shown.
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/romfiles/importee.cia
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/Imp/romfiles/importee.cia
Normal file
Binary file not shown.
Binary file not shown.
223
tags/0thNUP_Secure/CardSaveDataMover/Imp/source/main.cpp
Normal file
223
tags/0thNUP_Secure/CardSaveDataMover/Imp/source/main.cpp
Normal file
@ -0,0 +1,223 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: main.cpp
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
//#include <nn/srv.h>
|
||||
#include <nn/fs.h>
|
||||
//#include <nn/ns/CTR/ns_ApiShell.h>
|
||||
//#include <nn/ns/CTR/ns_Shell.h>
|
||||
#include <nn/am/am_ApiLocalImporter.h>
|
||||
#include <nn/am/am_ApiSystemMenu.h>
|
||||
#include <nn/applet.h>
|
||||
#include <nn/ndm.h>
|
||||
#include <stdio.h>
|
||||
#include "demo.h"
|
||||
#include "../common/ver.h"
|
||||
#include "../common/sleep.h"
|
||||
#include "../common/common.h"
|
||||
#include "../common/shfnt.h"
|
||||
#include "test_data.h"
|
||||
|
||||
demo::RenderSystemDrawing s_RenderSystem;
|
||||
nn::fnd::ExpHeap appHeap;
|
||||
uptr heapForGx;
|
||||
|
||||
namespace
|
||||
{
|
||||
bit8 readBuf[64 * 1024];
|
||||
}
|
||||
|
||||
bool ImportFile(nn::fs::MediaType mediaType, wchar_t* filename)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
nn::fs::FileOutputStream* stream;
|
||||
result = nn::am::BeginImportProgram(&stream, mediaType);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
//NN_LOG("Importing: %ls...", filename);
|
||||
nn::fs::FileInputStream in(filename);
|
||||
|
||||
while(s32 read = in.Read(readBuf, sizeof(readBuf)))
|
||||
{
|
||||
stream->Write(readBuf, read);
|
||||
}
|
||||
result = nn::am::EndImportProgram(stream);
|
||||
}
|
||||
return result.IsSuccess();
|
||||
}
|
||||
|
||||
|
||||
//#define setColor(r,g,b,a) s_RenderSystem.SetColor(r,g,b,a)
|
||||
void setColor(f32 r,f32 g,f32 b,f32 a){ shf_SetColor(r,g,b,a);}
|
||||
//#define setText(x,y,s) s_RenderSystem.DrawText(x,y,s)
|
||||
void drawText(u16 x,u16 y,char *s){ shf_DrawText_0( x,y,s);}
|
||||
|
||||
|
||||
nn::hid::PadReader *hpr;
|
||||
//---------------------------------------------------------------- 入力待ち
|
||||
nn::hid::PadStatus padStatus;
|
||||
u32 WaitKey(u32 mask)
|
||||
{
|
||||
|
||||
while(1){
|
||||
hpr->ReadLatest(&padStatus);
|
||||
if(padStatus.trigger & mask)return padStatus.trigger;
|
||||
CheckSysBreak();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void endfunc()
|
||||
{
|
||||
nn::hid::Finalize();
|
||||
SharedFontFinalize();
|
||||
nngxWaitVSync(NN_GX_DISPLAY_BOTH);//SDK2.0以降では不要かも?
|
||||
s_RenderSystem.Finalize();
|
||||
}
|
||||
|
||||
char ver[16];
|
||||
void nnMain( void )
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
nn::os::Initialize();
|
||||
nn::fs::Initialize();
|
||||
|
||||
//DEA-SUPにて推奨のフリーズ暫定対策:無線デーモンを停止 (2011.3.1 現在)
|
||||
//ただし、スリープ時の"いつのまに通信"は止まらない
|
||||
//無線は使わないが念の為、本体スイッチで切っとくのが確実
|
||||
nn::ndm::SuspendScheduler();
|
||||
|
||||
//中断処理の準備
|
||||
InitSysBreak((uptr)endfunc);
|
||||
// グラフィックスライブラリの初期化は、以降で行わなければならない
|
||||
// 他、アプリケーションの初期化処理
|
||||
|
||||
nn::hid::Initialize();
|
||||
nn::hid::PadReader padReader;
|
||||
hpr = &padReader;
|
||||
|
||||
//result = nn::ns::CTR::InitializeForShell();
|
||||
//if (result.IsSuccess())
|
||||
result = nn::am::InitializeForLocalImporter();
|
||||
|
||||
nn::applet::DisableSleep();//スリープ非対応
|
||||
|
||||
const size_t ROMFS_BUFFER_SIZE = 1024 * 64;
|
||||
static char buffer[ROMFS_BUFFER_SIZE];
|
||||
|
||||
// ヒープの確保
|
||||
appHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
|
||||
|
||||
const u32 s_GxHeapSize = 0x800000;
|
||||
// RenderSystem の準備
|
||||
heapForGx = reinterpret_cast<uptr>(appHeap.Allocate(s_GxHeapSize));
|
||||
s_RenderSystem.Initialize(heapForGx, s_GxHeapSize);
|
||||
SharedFontInit();
|
||||
|
||||
// スリープ要求に対する返答を有効にする
|
||||
// また、蓋の状態チェックを行い蓋が閉じられているならスリープ要求が発生する
|
||||
// nn::applet::EnableSleep(true);
|
||||
|
||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
||||
s_RenderSystem.Clear();
|
||||
// s_RenderSystem.SetFontSize(12);
|
||||
shf_SetScale(0.8,0.6);
|
||||
setColor(1.0,1.0,1.0,1.0);
|
||||
drawText(20,20,"CTR Card Savedata Mover Setup");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
shf_SetScale(0.5,0.5);
|
||||
sprintf(ver,"version %.2f",VERSION);
|
||||
drawText(250,40,ver);
|
||||
|
||||
shf_SetScale(0.7,0.7);
|
||||
if (result.IsFailure()){//初期化に失敗
|
||||
setColor(1.0, 0.0, 0.0,1.0);
|
||||
drawText(10,70,"Initialize Error");
|
||||
drawText(10,90,"check *.desc file");
|
||||
drawText(10,110,"Push B : Quit");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
while(1){
|
||||
padReader.ReadLatest(&padStatus);
|
||||
if(padStatus.trigger & nn::hid::BUTTON_B)break;
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
nn::fs::MountRom(16, 16, buffer, ROMFS_BUFFER_SIZE);
|
||||
|
||||
drawText(80,100,"Push X : Import");
|
||||
drawText(80,140,"Push Y : Delete");
|
||||
drawText(80,160,"Push R : Test Data");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
u32 trg = WaitKey(nn::hid::BUTTON_X | nn::hid::BUTTON_Y | nn::hid::BUTTON_R);
|
||||
if (trg & nn::hid::BUTTON_R){
|
||||
shf_SetScale(0.6,0.6);
|
||||
TestMain();//テストデータへ
|
||||
}
|
||||
shf_SetScale(0.8,0.8);
|
||||
// CIA のプログラム ID を取得する。
|
||||
nn::am::ProgramInfo programInfo;
|
||||
if (nn::am::GetProgramInfoFromCia(&programInfo, ROMFS_IMPORTEE_PATH).IsFailure())
|
||||
{
|
||||
s_RenderSystem.Clear();
|
||||
setColor(1.0, 0.0, 0.0,1.0);
|
||||
drawText(10,50,"cia infomation Error");
|
||||
drawText(10,120,"Push B : Quit");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
while(1){
|
||||
padReader.ReadLatest(&padStatus);
|
||||
if(padStatus.trigger & nn::hid::BUTTON_B)break;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
s_RenderSystem.Clear();
|
||||
if(padStatus.trigger & nn::hid::BUTTON_X)
|
||||
drawText(10,120,"Importing");
|
||||
else drawText(10,120,"Delete");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
// 既に存在するものをインポートするとエラーが返ってくるので、あらかじめ消しておく。
|
||||
nn::am::DeleteProgram(nn::fs::MEDIA_TYPE_NAND, programInfo.id);
|
||||
// タイトル鍵が違うケースに対応するために、チケットも消しておく。
|
||||
nn::am::DeleteTicket(programInfo.id);
|
||||
|
||||
if(padStatus.trigger & nn::hid::BUTTON_X)
|
||||
{
|
||||
// CIA をインポート
|
||||
if (ImportFile(nn::fs::MEDIA_TYPE_NAND, ROMFS_IMPORTEE_PATH)==false)
|
||||
{
|
||||
s_RenderSystem.Clear();
|
||||
setColor(1.0, 0.0, 0.0,1.0);
|
||||
drawText(10,50,"Impoprt fail");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
}
|
||||
}
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,50,"Complate");
|
||||
}
|
||||
|
||||
drawText(10,120,"Push Power Button & Power Off");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
WaitKey(0);
|
||||
|
||||
}
|
||||
|
||||
673
tags/0thNUP_Secure/CardSaveDataMover/Imp/source/test_data.cpp
Normal file
673
tags/0thNUP_Secure/CardSaveDataMover/Imp/source/test_data.cpp
Normal file
@ -0,0 +1,673 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: main.cpp
|
||||
|
||||
Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not 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 <wchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <nn.h>
|
||||
#include <nn/hid.h>
|
||||
#include "demo.h"
|
||||
|
||||
nn::Result res;
|
||||
|
||||
nn::fs::FileOutputStream fout;
|
||||
nn::fs::FileInputStream fin;
|
||||
|
||||
nn::fs::Directory dc[256];
|
||||
|
||||
wchar_t file_pathw[1024];
|
||||
char file_path[1024];
|
||||
char file_path2[1024];
|
||||
char src_buff[1024*1024];
|
||||
char get_buff[1024*1024];
|
||||
char str[512];
|
||||
|
||||
|
||||
extern demo::RenderSystemDrawing s_RenderSystem;
|
||||
|
||||
//終了処理
|
||||
extern void finish(void);
|
||||
extern u32 WaitKey(u32 mask);
|
||||
|
||||
extern void setColor(f32 r,f32 g,f32 b,f32 a);
|
||||
extern void drawText(u16 x,u16 y,char *s);
|
||||
void drawText(u16 x,u16 y,char *s,int v)
|
||||
{
|
||||
sprintf(str,s,v);
|
||||
drawText( x,y,str);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------- テストパターン
|
||||
void make_pattern()
|
||||
{
|
||||
int i,j;
|
||||
j=0;
|
||||
for (i=0;i<1024*1024;i++){
|
||||
src_buff[i] = j+i;
|
||||
if (i & 0x100)j++;
|
||||
}
|
||||
}
|
||||
|
||||
//TEST ライト
|
||||
s32 size;
|
||||
#define SIZE_TEST1 421888
|
||||
//#define SIZE_TEST1 244736 //dup
|
||||
bool Test1_W()
|
||||
{
|
||||
int total,size2;
|
||||
|
||||
res = nn::fs::FormatSaveData(1,0,false);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"format Fail");
|
||||
return false;
|
||||
}
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
return false;
|
||||
}
|
||||
res = nn::fs::TryCreateFile(L"data:/test1.bin",SIZE_TEST1);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Create Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fout.TryInitialize(L"data:/test1.bin",true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
total =0;
|
||||
size2 = 512;
|
||||
//size2 = 4096;
|
||||
//size2 = SIZE_TEST1;
|
||||
while(1){
|
||||
res = fout.TryWrite( &size,&src_buff[total],size2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"write Fail");
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
total += size;
|
||||
sprintf(str,"size %d",total);
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
//if (size<512)break;
|
||||
if (total >= SIZE_TEST1)break;
|
||||
if ((SIZE_TEST1 - total) < 512)size2 = SIZE_TEST1 - total ;
|
||||
}
|
||||
fout.Finalize();
|
||||
nn::fs::CommitSaveData();
|
||||
nn::fs::Unmount("data:");
|
||||
NN_LOG("total %d",total);
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
//ベリファイ
|
||||
bool Test1_V()
|
||||
{
|
||||
int i,total;
|
||||
|
||||
res = fin.TryInitialize(L"data:/test1.bin");
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
total =0;
|
||||
while(1){
|
||||
res = fin.TryRead( &size,&get_buff[total],512);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"read Fail");
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
//if (size == 0)break;
|
||||
for (i=0;i<size;i++) if (src_buff[total+i] != get_buff[total+i])
|
||||
{
|
||||
drawText(8,100,"verifi Fail at %d",total+i);
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
|
||||
}
|
||||
if (total >= SIZE_TEST1)break;
|
||||
|
||||
total += size;
|
||||
s_RenderSystem.Clear();
|
||||
sprintf(str,"now %d",total);
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
if (size<512)break;
|
||||
}
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//ファイル数
|
||||
bool Test2_W(int n)
|
||||
{
|
||||
int total,size2;
|
||||
|
||||
res = nn::fs::FormatSaveData(680,1,false);//dupなしファイル680
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"format Fail");
|
||||
return false;
|
||||
}
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
total =0;
|
||||
int num = 0;
|
||||
size2 = 512;
|
||||
while(1){
|
||||
sprintf(file_path,"data:/test%d.bin",num);
|
||||
// res = nn::fs::TryCreateFile(L"data:/test2.bin",SIZE_TEST1);
|
||||
// if (res.IsFailure()){
|
||||
// drawText(8,100,"Create Fail");
|
||||
// nn::fs::Unmount("data:");
|
||||
// return false;
|
||||
// }
|
||||
res = fout.TryInitialize(file_path,true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fout.TryWrite( &size,&src_buff[total],size2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"write Fail");
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
fout.Finalize();
|
||||
total += size;
|
||||
num++;
|
||||
sprintf(str,"size %d , num %d",total,num);
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
//if (size<512)break;
|
||||
if (num == n)break;
|
||||
}
|
||||
fout.Finalize();
|
||||
nn::fs::CommitSaveData();
|
||||
nn::fs::Unmount("data:");
|
||||
NN_LOG("total %d",total);
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Test2_V(int n)
|
||||
{
|
||||
int total,size2,i;
|
||||
|
||||
total =0;
|
||||
int num = 0;
|
||||
size2 = 512;
|
||||
while(1){
|
||||
sprintf(file_path,"data:/test%d.bin",num);
|
||||
res = fin.TryInitialize(file_path);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fin.TryRead( &size,&get_buff[total],size2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"read Fail");
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
for (i=0;i<size;i++) if (src_buff[total+i] != get_buff[total+i])
|
||||
{
|
||||
drawText(8,100,"verifi Fail at %d",total+i);
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
|
||||
}
|
||||
fin.Finalize();
|
||||
|
||||
total += size;
|
||||
num++;
|
||||
sprintf(str,"size %d , num %d",total,num);
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
//if (size<512)break;
|
||||
if (num == n)break;
|
||||
}
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
NN_LOG("total %d",total);
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define DirDepth 80
|
||||
|
||||
//ディレクトリ深度
|
||||
bool Test3_W()
|
||||
{
|
||||
int total,size2;
|
||||
|
||||
res = nn::fs::FormatSaveData(200,200,false);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"format Fail");
|
||||
return false;
|
||||
}
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
total =0;
|
||||
size2 = 512;
|
||||
strcpy(file_path,"data:");
|
||||
while(1){
|
||||
sprintf(str,"/%d",num);
|
||||
strcat(file_path,str);
|
||||
res = nn::fs::TryCreateDirectory(file_path);
|
||||
if (res.IsFailure()){
|
||||
sprintf(str,"length = %d",(int)strlen(file_path));
|
||||
drawText(8,110,str);
|
||||
drawText(8,100,"Dir create Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
strcpy(file_path2,file_path);
|
||||
sprintf(str,"/t%d.bin",num);
|
||||
strcat(file_path2,str);
|
||||
res = fout.TryInitialize(file_path2,true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fout.TryWrite( &size,&src_buff[total],size2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"write Fail");
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
fout.Finalize();
|
||||
|
||||
num++;
|
||||
total+=size;
|
||||
s_RenderSystem.Clear();
|
||||
sprintf(str,"num %d",num);
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
if (num == DirDepth)break;
|
||||
}
|
||||
|
||||
nn::fs::CommitSaveData();
|
||||
nn::fs::Unmount("data:");
|
||||
|
||||
drawText(10,100,"end");
|
||||
sprintf(str,"length = %d",(int)strlen(file_path2));
|
||||
drawText(8,110,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Test3_V()
|
||||
{
|
||||
int i,total,size2;
|
||||
|
||||
int num = 0;
|
||||
total =0;
|
||||
size2 = 512;
|
||||
strcpy(file_path,"data:");
|
||||
while(1){
|
||||
sprintf(str,"/%d",num);
|
||||
strcat(file_path,str);
|
||||
strcpy(file_path2,file_path);
|
||||
sprintf(str,"/t%d.bin",num);
|
||||
strcat(file_path2,str);
|
||||
res = fin.TryInitialize(file_path2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fin.TryRead( &size,&get_buff[total],size2);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"read Fail");
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
for (i=0;i<size;i++) if (src_buff[total+i] != get_buff[total+i])
|
||||
{
|
||||
drawText(8,100,"verifi Fail at %d",total+i);
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
|
||||
}
|
||||
fin.Finalize();
|
||||
|
||||
num++;
|
||||
total+=size;
|
||||
s_RenderSystem.Clear();
|
||||
sprintf(str,"num %d",num);
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
if (num == DirDepth) break;
|
||||
}
|
||||
|
||||
nn::fs::Unmount("data:");
|
||||
drawText(10,100,"end");
|
||||
sprintf(str,"length = %d",(int)strlen(file_path2));
|
||||
drawText(8,110,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
//max size of name
|
||||
#define max_len 16
|
||||
bool Test4_W()
|
||||
{
|
||||
int i;
|
||||
|
||||
res = nn::fs::FormatSaveData(1,0,true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"format Fail");
|
||||
return false;
|
||||
}
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
strcpy(str,"data:/");
|
||||
for (i =6;i<max_len+6;i++)str[i] = '-';
|
||||
str[i] = 0;
|
||||
res = fout.TryInitialize(str,true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fout.TryWrite( &size,&src_buff[0],512);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Write Fail");
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
fout.Finalize();
|
||||
nn::fs::CommitSaveData();
|
||||
nn::fs::Unmount("data:");
|
||||
return (size == 512);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Test4_V()
|
||||
{
|
||||
int i;
|
||||
|
||||
strcpy(str,"data:/");
|
||||
for (i =6;i<max_len+6;i++)str[i] = '-';
|
||||
str[i] = 0;
|
||||
res = fin.TryInitialize(str);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fin.TryRead( &size,&get_buff[0],512);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Read Fail");
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
if (size != 512)return false;
|
||||
|
||||
for (i=0;i<size;i++) if (src_buff[i] != get_buff[i])
|
||||
{
|
||||
drawText(8,100,"verifi Fail at %d",i);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
#define SIZE_TEST5 (512*100)
|
||||
//生成サイズに満たないデータ
|
||||
bool Test5_W()
|
||||
{
|
||||
int pos;
|
||||
|
||||
res = nn::fs::FormatSaveData(1,0,true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"format Fail");
|
||||
return false;
|
||||
}
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
res = nn::fs::TryCreateFile(L"data:/test5.bin",SIZE_TEST5);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Create Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
res = fout.TryInitialize(L"data:/test5.bin",true);
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
pos =0;
|
||||
while(1){
|
||||
fout.SetPosition(pos);
|
||||
res = fout.TryWrite( &size,&src_buff[pos],512);
|
||||
if (res.IsFailure() || (size!=512)){
|
||||
drawText(8,100,"write Fail");
|
||||
fout.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
sprintf(str,"position %d",pos);
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
pos += 1024;//512飛ばす
|
||||
if (pos >= SIZE_TEST5)break;
|
||||
}
|
||||
fout.Finalize();
|
||||
nn::fs::CommitSaveData();
|
||||
nn::fs::Unmount("data:");
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Test5_V()
|
||||
{
|
||||
int i,pos;
|
||||
|
||||
res = fin.TryInitialize(L"data:/test5.bin");
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"open Fail");
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
pos =0;
|
||||
while(1){
|
||||
fin.SetPosition(pos);
|
||||
res = fin.TryRead( &size,&get_buff[pos],512);
|
||||
if (res.IsFailure() || (size!=512)){
|
||||
drawText(8,100,"read Fail");
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
return false;
|
||||
}
|
||||
sprintf(str,"position %d",pos);
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,80,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
for (i=0;i<512;i++) if (src_buff[pos+i] != get_buff[pos+i])
|
||||
{
|
||||
drawText(8,100,"verifi Fail at %d",i);
|
||||
return false;
|
||||
}
|
||||
pos += 1024;//512飛ばす
|
||||
if (pos >= SIZE_TEST5)break;
|
||||
}
|
||||
fin.Finalize();
|
||||
nn::fs::Unmount("data:");
|
||||
drawText(10,100,"end");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define menu_ct 6
|
||||
#define menu_max (menu_ct-1)
|
||||
char* menu_str[menu_ct] = {"Casual check","Large size","many files","Deep directry","max size name","data < create size"};
|
||||
|
||||
#define menu_top_Y 80
|
||||
#define menu_top_X 60
|
||||
#define menu_spc 14
|
||||
|
||||
//---------------------------------------------------------------- main
|
||||
void TestMain()
|
||||
{
|
||||
u32 value;
|
||||
int curs = 0;
|
||||
int i;
|
||||
bool sccs;
|
||||
|
||||
//Render
|
||||
setColor(1.0f,1.0f,1.0f,1.0f);
|
||||
|
||||
//TEST PATTERN
|
||||
make_pattern();
|
||||
|
||||
while(1){
|
||||
|
||||
//menu 表示
|
||||
s_RenderSystem.Clear();
|
||||
drawText(8,20," Backup Verifi for SaveDataMover Test ");
|
||||
drawText(8,40," for 512KB Backup");
|
||||
for (i=0;i<menu_ct;i++)drawText(menu_top_X,menu_top_Y+menu_spc*i,menu_str[i]);
|
||||
drawText(menu_top_X-30,menu_top_Y+menu_spc*curs,"->");
|
||||
drawText(menu_top_X,menu_top_Y+menu_spc*(menu_max+2),"push A:Write ,X:Verifi");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
|
||||
//ボタン待ち
|
||||
value = WaitKey(nn::hid::BUTTON_A | nn::hid::BUTTON_X |nn::hid::BUTTON_UP |nn::hid::BUTTON_DOWN);
|
||||
if (value & nn::hid::BUTTON_A){//ライト
|
||||
sccs = false;
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,70,"writing");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
switch(curs){
|
||||
case 0:sccs = Test2_W(10);break;
|
||||
case 1:sccs = Test1_W();break;
|
||||
case 2:sccs = Test2_W(680);break;
|
||||
case 3:sccs = Test3_W();break;
|
||||
case 4:sccs = Test4_W();break;
|
||||
case 5:sccs = Test5_W();break;
|
||||
default:break;
|
||||
}
|
||||
}else if (value & nn::hid::BUTTON_X)
|
||||
{//ベリファイ
|
||||
sccs = false;
|
||||
s_RenderSystem.Clear();
|
||||
drawText(10,70,"verifi");
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
res =nn::fs::MountSaveData();
|
||||
if (res.IsFailure()){
|
||||
drawText(8,100,"Mount Fail");
|
||||
}else
|
||||
switch(curs){
|
||||
case 0:sccs = Test2_V(10);break;
|
||||
case 1:sccs = Test1_V();break;
|
||||
case 2:sccs = Test2_V(680);break;
|
||||
case 3:sccs = Test3_V();break;
|
||||
case 4:sccs = Test4_V();break;
|
||||
case 5:sccs = Test5_V();break;
|
||||
default:break;
|
||||
}
|
||||
}else if (value & nn::hid::BUTTON_UP){
|
||||
if(curs > 0)curs--;
|
||||
}else if(curs < menu_max)curs++;
|
||||
|
||||
if (value & (nn::hid::BUTTON_A | nn::hid::BUTTON_X)){
|
||||
if (sccs == false)drawText(8,120,"Failed");
|
||||
sprintf(str,"desc %d",res.GetDescription());
|
||||
drawText(10,140,str);
|
||||
s_RenderSystem.SwapBuffers();
|
||||
NN_LOG("desc %d",res.GetDescription());
|
||||
WaitKey(nn::hid::BUTTON_B);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
#ifndef TEST_DATA_H_
|
||||
#define TEST_DATA_H_
|
||||
|
||||
void TestMain();
|
||||
|
||||
#endif
|
||||
30
tags/0thNUP_Secure/CardSaveDataMover/OMakefile
Normal file
30
tags/0thNUP_Secure/CardSaveDataMover/OMakefile
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev: 34658 $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#表示にDemoライブラリを使用します
|
||||
#PC環境に合わせてサンプルデモのディレクトリを指定
|
||||
#SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../common/include)
|
||||
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../CTR_SDK/sampledemos/common/include)
|
||||
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
||||
|
||||
LIBS += lib_demo libnn_am
|
||||
|
||||
.SUBDIRS: $(exist-dirs \
|
||||
body \
|
||||
Imp \
|
||||
)
|
||||
|
||||
DefineDefaultRules()
|
||||
73
tags/0thNUP_Secure/CardSaveDataMover/OMakeroot
Normal file
73
tags/0thNUP_Secure/CardSaveDataMover/OMakeroot
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakeroot
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev:$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# ディレクトリレイアウトについての説明
|
||||
#
|
||||
# a) ソースコードがルートディレクトリ直下に配置される場合
|
||||
# 例:
|
||||
# /OMakeroot
|
||||
# /foo/bar/OMakefile
|
||||
#
|
||||
# 結果:
|
||||
# OMakefile と同じディレクトリ以下に objects や images が生成されます。
|
||||
#
|
||||
# /foo/bar/objects/...
|
||||
# /foo/bar/images/..
|
||||
#
|
||||
#
|
||||
# b) ソースコードが sources 以下に配置される場合
|
||||
# 例:
|
||||
# /OMakeroot
|
||||
# /sources/foo/bar/OMakefile
|
||||
#
|
||||
# 結果:
|
||||
# ルートディレクトリ以下に objects や images が生成されます。
|
||||
#
|
||||
# /objects/foo/bar/...
|
||||
# /images/foo/bar/...
|
||||
#
|
||||
#
|
||||
|
||||
# ルート環境変数の取得
|
||||
public.HORIZON_ROOT =
|
||||
if $(defined-env HORIZON_ROOT)
|
||||
HORIZON_ROOT = $(absname $(getenv HORIZON_ROOT))
|
||||
export
|
||||
|
||||
if $(defined-env CTRSDK_ROOT)
|
||||
CTRSDK_ROOT = $(absname $(getenv CTRSDK_ROOT))
|
||||
if $(and $(defined-env HORIZON_ROOT), $(not $(equal $(HORIZON_ROOT), $(CTRSDK_ROOT))))
|
||||
eprintln(HORIZON_ROOT と CTRSDK_ROOT が一致しません。同じパスを設定するか、どちらか一方だけを定義して下さい。)
|
||||
exit(1)
|
||||
HORIZON_ROOT = $(CTRSDK_ROOT)
|
||||
export
|
||||
|
||||
if $(not $(HORIZON_ROOT))
|
||||
eprintln($"$$CTRSDK_ROOT が定義されていません")
|
||||
exit(1)
|
||||
|
||||
include $(HORIZON_ROOT)/build/omake/commondefs
|
||||
|
||||
DefineCommandVars()
|
||||
|
||||
.PHONY: all build clean clobber
|
||||
.PHONY: run run-scripts
|
||||
|
||||
#
|
||||
# OMakefile の読み込み
|
||||
#
|
||||
.SUBDIRS: .
|
||||
|
||||
63
tags/0thNUP_Secure/CardSaveDataMover/body/OMakefile
Normal file
63
tags/0thNUP_Secure/CardSaveDataMover/body/OMakefile
Normal file
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: Omakefile
|
||||
#
|
||||
# Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev: 25650 $
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
||||
#CTR_APPTYPE = BOTH
|
||||
#CTR_APPTYPE = CARD
|
||||
CTR_APPTYPE = NAND
|
||||
|
||||
#demoライブラリ位置指定
|
||||
#SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../common/include)
|
||||
#SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir ../CTR_SDK/sampledemos/common/include)
|
||||
#INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
||||
|
||||
# ビルドするソースコードを指定します。
|
||||
#SDにセーブする場合はmembak -> exsave 変更
|
||||
SOURCES[] =
|
||||
./source/main.cpp
|
||||
./source/savefile/savedata.cpp
|
||||
./source/savefile/membak.cpp
|
||||
./source/savefile/savefile.cpp
|
||||
./source/screen/screen.cpp
|
||||
./source/gui/gui.cpp
|
||||
./source/gui/shfnt.cpp
|
||||
../common/sleep.cpp
|
||||
../common/common.cpp
|
||||
|
||||
#LIBS += lib_demo libnn_am
|
||||
|
||||
TARGET_PROGRAM = CtrSaveDataMover
|
||||
|
||||
TITLE = CSM_body
|
||||
|
||||
# ROMFS のルートパスを指定します。
|
||||
#ROMFS_ROOT =
|
||||
|
||||
# 独自の RSF ファイルを指定する場合
|
||||
ROM_SPEC_FILE = body.rsf
|
||||
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/repairtool.desc
|
||||
|
||||
# バナー、アイコン
|
||||
CTR_BANNER_SPEC = banner.bsf
|
||||
|
||||
|
||||
#Cia バージョン:マスタリング毎に更新すること
|
||||
#メジャーはrsfで指定(Remasterversion)
|
||||
MAKECIAFLAGS = -minor 0 -micro 6
|
||||
|
||||
include $(ROOT_OMAKE)/modulerules
|
||||
|
||||
build: $(DEFAULT_TARGETS)
|
||||
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/banner.bsf
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/banner.bsf
Normal file
Binary file not shown.
@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<NintendoWareIntermediateFile>
|
||||
<GraphicsContentCtr Version="1.3.0" Namespace="">
|
||||
<EditData>
|
||||
<MetaData>
|
||||
<Key>MetaData</Key>
|
||||
<Create Author="" Date="2010-12-02T15:21:10" Source="COMMON.mb">
|
||||
<ToolDescriptions Name="NW4C_Export for Maya 2009 Service Pack 1" Version="1.2.0" />
|
||||
</Create>
|
||||
<Modify Date="2011-02-28T13:21:02">
|
||||
<ToolDescriptions Name="NintendoWare Creative Studio For Banner." Version="1.3.0.30235" />
|
||||
</Modify>
|
||||
</MetaData>
|
||||
<ContentSummaryMetaData>
|
||||
<Key>ContentSummaries</Key>
|
||||
<Values>
|
||||
<ContentSummary ContentTypeName="GraphicsContent">
|
||||
<ObjectSummaries>
|
||||
<ObjectSummary TypeName="SkeletalModel" Name="">
|
||||
<Notes>
|
||||
<Note Name="MaterialCount" Value="1" />
|
||||
<Note Name="ShapeCount" Value="1" />
|
||||
<Note Name="MeshCount" Value="1" />
|
||||
<Note Name="BoneCount" Value="1" />
|
||||
<Note Name="TotalPrimitiveSetCount" Value="1" />
|
||||
<Note Name="TotalNoneSkinningPrimitiveSetCount" Value="1" />
|
||||
<Note Name="TotalRigidSkinningPrimitiveSetCount" Value="0" />
|
||||
<Note Name="TotalSmoothSkinningPrimitiveSetCount" Value="0" />
|
||||
<Note Name="TotalIndexStreamCount" Value="1" />
|
||||
<Note Name="TotalPolygonCount" Value="2" />
|
||||
<Note Name="TotalVertexCount" Value="4" />
|
||||
</Notes>
|
||||
</ObjectSummary>
|
||||
</ObjectSummaries>
|
||||
</ContentSummary>
|
||||
</Values>
|
||||
</ContentSummaryMetaData>
|
||||
</EditData>
|
||||
<Models>
|
||||
<SkeletalModel Name="" IsBranchVisible="true" IsVisible="true" CullingMode="Dynamic" IsNonuniformScalable="false" LayerId="0" NeededBoneCapacity="20">
|
||||
<EditData>
|
||||
<ModelDccToolExportOption ExportStartFrame="0" Magnify="1" AdjustSkinning="None" MeshVisibilityMode="BindByIndex">
|
||||
<Key>ModelDccToolInfo</Key>
|
||||
</ModelDccToolExportOption>
|
||||
<OptimizationLogArrayMetaData Size="1">
|
||||
<Key>OptimizationLogs</Key>
|
||||
<Values>
|
||||
<OptimizationLog Date="2010-12-02T15:21" EditorVersion="1.2.0.27817">
|
||||
<Options NodeCompressionMode="None" IsMergeMeshOwnerBoneEnabled="false" IsCombineMeshEnabled="false" IsCompressMaterialEnabled="false" IsOptimizePlygonPrimitiveEnabled="false" IsConvertOneBoneSkeletalModelToModel="true" IsDeleteUnusedVertexEnabled="false" PositionQuantizeMode="Float" NormalQuantizeMode="Float" TextureQuantizeMode="Float" GroupByIndexStream="false" />
|
||||
</OptimizationLog>
|
||||
</Values>
|
||||
</OptimizationLogArrayMetaData>
|
||||
</EditData>
|
||||
<AnimationGroupDescriptions>
|
||||
<GraphicsAnimationGroupDescription Name="SkeletalAnimation" EvaluationTiming="AfterSceneCulling">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="CalculatedTransform" IsBinarized="true">
|
||||
<Path>Skeleton.Bones["*"].AnimatedTransform</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
<GraphicsAnimationGroupDescription Name="VisibilityAnimation" EvaluationTiming="BeforeWorldUpdate">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>IsVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>Meshes["*"].IsVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Bool" IsBinarized="true">
|
||||
<Path>IsBranchVisible</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
<GraphicsAnimationGroupDescription Name="MaterialAnimation" EvaluationTiming="AfterSceneCulling">
|
||||
<MemberInformationSet>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Emission</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Ambient</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Diffuse</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Specular0</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Specular1</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant0</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant1</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant2</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant3</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant4</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].MaterialColor.Constant5</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureMappers["*"].Sampler.BorderColor</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Int" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureMappers["*"].Texture</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="RgbaColor" IsBinarized="true">
|
||||
<Path>Materials["*"].FragmentOperation.BlendOperation.BlendColor</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Vector2" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Scale</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Float" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Rotate</Path>
|
||||
</AnimationMemberDescription>
|
||||
<AnimationMemberDescription BlendOperationName="Vector2" IsBinarized="true">
|
||||
<Path>Materials["*"].TextureCoordinators["*"].Translate</Path>
|
||||
</AnimationMemberDescription>
|
||||
</MemberInformationSet>
|
||||
</GraphicsAnimationGroupDescription>
|
||||
</AnimationGroupDescriptions>
|
||||
<Transform>
|
||||
<Scale X="1" Y="1" Z="1" />
|
||||
<Rotate X="0" Y="0" Z="0" />
|
||||
<Translate X="0" Y="0" Z="0" />
|
||||
</Transform>
|
||||
<Shapes>
|
||||
<SeparateDataShapeCtr>
|
||||
<OrientedBoundingBox>
|
||||
<CenterPosition X="0" Y="0" Z="6.5" />
|
||||
<OrientationMatrix M00="1" M01="0" M02="0" M10="0" M11="1" M12="0" M20="0" M21="0" M22="1" />
|
||||
<Size X="24" Y="12" Z="0" />
|
||||
</OrientedBoundingBox>
|
||||
<PositionOffset X="0" Y="0" Z="0" />
|
||||
<PrimitiveSets>
|
||||
<PrimitiveSetCtr SkinningMode="None">
|
||||
<BoneIndexTable>0</BoneIndexTable>
|
||||
<Primitives>
|
||||
<PrimitiveCtr>
|
||||
<IndexStreams>
|
||||
<UbyteIndexStreamCtr PrimitiveMode="Triangles" Size="6">0 1 2 1 3 2</UbyteIndexStreamCtr>
|
||||
</IndexStreams>
|
||||
</PrimitiveCtr>
|
||||
</Primitives>
|
||||
</PrimitiveSetCtr>
|
||||
</PrimitiveSets>
|
||||
<VertexAttributes>
|
||||
<Vector3VertexStreamCtr Usage="Position" VertexSize="4" Scale="1" QuantizedMode="Float">
|
||||
-12 -6 6.5
|
||||
12 -6 6.5
|
||||
-12 6 6.5
|
||||
12 6 6.5
|
||||
</Vector3VertexStreamCtr>
|
||||
<Vector3VertexAttributeCtr Usage="Normal">0 0 1</Vector3VertexAttributeCtr>
|
||||
<Vector2VertexStreamCtr Usage="TextureCoordinate0" VertexSize="4" Scale="1" QuantizedMode="Float">
|
||||
0 0
|
||||
1 0
|
||||
0 1
|
||||
1 1
|
||||
</Vector2VertexStreamCtr>
|
||||
</VertexAttributes>
|
||||
</SeparateDataShapeCtr>
|
||||
</Shapes>
|
||||
<Materials>
|
||||
<MaterialCtr Name="MT_00" IsCompressible="true" LightSetIndex="0" FogIndex="0" IsFragmentLightEnabled="false" IsVertexLightEnabled="false" IsHemiSphereLightEnabled="false" IsHemiSphereOcclusionEnabled="false" IsFogEnabled="false" TextureCoordinateConfig="Config0120" TranslucencyKind="Layer1" ShaderProgramDescriptionIndex="-1" ShaderBinaryKind="Default">
|
||||
<ShaderReference />
|
||||
<MaterialColor VertexColorScale="1">
|
||||
<Emission R="0" G="0" B="0" A="0" />
|
||||
<Ambient R="1" G="1" B="1" A="0" />
|
||||
<Diffuse R="1" G="1" B="1" A="1" />
|
||||
<Specular0 R="1" G="1" B="1" A="0" />
|
||||
<Specular1 R="0" G="0" B="0" A="0" />
|
||||
<Constant0 R="0" G="0" B="0" A="1" />
|
||||
<Constant1 R="0" G="0" B="0" A="1" />
|
||||
<Constant2 R="0" G="0" B="0" A="1" />
|
||||
<Constant3 R="0" G="0" B="0" A="1" />
|
||||
<Constant4 R="0" G="0" B="0" A="1" />
|
||||
<Constant5 R="0" G="0" B="0" A="1" />
|
||||
</MaterialColor>
|
||||
<Rasterization CullingMode="BackFace" IsPolygonOffsetEnabled="false" PolygonOffsetUnit="0" />
|
||||
<TextureCoordinators>
|
||||
<TextureCoordinatorCtr SourceCoordinate="0" MappingMethod="UvCoordinateMap" ReferenceCamera="0" MatrixMode="DccMaya" ScaleS="1" ScaleT="1" Rotate="0" TranslateS="0" TranslateT="0" />
|
||||
</TextureCoordinators>
|
||||
<TextureMappers>
|
||||
<PixelBasedTextureMapperCtr>
|
||||
<TextureReference>Textures["banner"]@file:Textures/banner.ctex</TextureReference>
|
||||
<StandardTextureSamplerCtr MinFilter="Linear" MagFilter="Linear" WrapS="ClampToEdge" WrapT="ClampToEdge" MinLod="0" LodBias="0">
|
||||
<BorderColor R="0" G="0" B="0" A="1" />
|
||||
</StandardTextureSamplerCtr>
|
||||
</PixelBasedTextureMapperCtr>
|
||||
</TextureMappers>
|
||||
<FragmentShader LayerConfig="ConfigurationType0">
|
||||
<BufferColor R="0" G="0" B="0" A="1" />
|
||||
<FragmentBump BumpTextureIndex="Texture0" BumpMode="NotUsed" IsBumpRenormalize="false" />
|
||||
<FragmentLighting FresnelConfig="No" IsClampHighLight="false" IsDistribution0Enabled="false" IsDistribution1Enabled="false" IsGeometricFactor0Enabled="false" IsGeometricFactor1Enabled="false" IsReflectionEnabled="false" />
|
||||
<FragmentLightingTable>
|
||||
<ReflectanceRSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceRSampler>
|
||||
<ReflectanceGSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceGSampler>
|
||||
<ReflectanceBSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</ReflectanceBSampler>
|
||||
<Distribution0Sampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</Distribution0Sampler>
|
||||
<Distribution1Sampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</Distribution1Sampler>
|
||||
<FresnelSampler IsAbs="true" Input="CosNormalHalf" Scale="One">
|
||||
<NullLookupTableCtr />
|
||||
</FresnelSampler>
|
||||
</FragmentLightingTable>
|
||||
<TextureCombiners>
|
||||
<TextureCombinerCtr CombineRgb="Replace" CombineAlpha="Replace" ScaleRgb="One" ScaleAlpha="One" Constant="Constant0" BufferInputRgb="PreviousBuffer" BufferInputAlpha="PreviousBuffer">
|
||||
<SourceRgb Source0="Texture0" Source1="FragmentPrimaryColor" Source2="FragmentSecondaryColor" />
|
||||
<OperandRgb Operand0="Color" Operand1="Color" Operand2="Color" />
|
||||
<SourceAlpha Source0="Texture0" Source1="Constant" Source2="Constant" />
|
||||
<OperandAlpha Operand0="Alpha" Operand1="Alpha" Operand2="Alpha" />
|
||||
</TextureCombinerCtr>
|
||||
</TextureCombiners>
|
||||
<AlphaTest IsTestEnabled="false" TestFunction="Always" TestReference="0" />
|
||||
</FragmentShader>
|
||||
<FragmentOperation>
|
||||
<DepthOperation IsTestEnabled="true" TestFunction="Less" IsMaskEnabled="false" />
|
||||
<BlendOperation Mode="Blend" LogicOperation="Copy">
|
||||
<RgbParameter BlendFunctionSource="SourceAlpha" BlendFunctionDestination="OneMinusSourceAlpha" BlendEquation="FuncAdd" />
|
||||
<AlphaParameter BlendFunctionSource="One" BlendFunctionDestination="Zero" BlendEquation="FuncAdd" />
|
||||
<BlendColor R="0" G="0" B="0" A="1" />
|
||||
</BlendOperation>
|
||||
<StencilOperation IsTestEnabled="false" TestFunction="Never" TestReference="0" TestMask="255" FailOperation="Keep" ZFailOperation="Keep" PassOperation="Keep" />
|
||||
</FragmentOperation>
|
||||
</MaterialCtr>
|
||||
</Materials>
|
||||
<Meshes>
|
||||
<Mesh IsVisible="true" RenderPriority="0" MeshNodeName="BONE_00">
|
||||
<EditData>
|
||||
<DccToolSourceNodeMetaData>
|
||||
<Key>DccToolSourceNode</Key>
|
||||
<Values>
|
||||
<NodeName>BONE_00</NodeName>
|
||||
</Values>
|
||||
</DccToolSourceNodeMetaData>
|
||||
</EditData>
|
||||
<SeparateShapeReference>Shapes[0]</SeparateShapeReference>
|
||||
<MaterialReference>Materials["MT_00"]</MaterialReference>
|
||||
</Mesh>
|
||||
</Meshes>
|
||||
<Skeleton RootBoneName="BONE_00" ScalingRule="Standard" IsTranslateAnimationEnabled="true">
|
||||
<Bones>
|
||||
<Bone Name="BONE_00" ParentBoneName="" IsSegmentScaleCompensate="false" IsCompressible="true" IsNeededRendering="true" HasSkinningMatrix="false" BillboardMode="YAxial">
|
||||
<Transform>
|
||||
<Scale X="1" Y="1" Z="1" />
|
||||
<Rotate X="0" Y="0" Z="0" />
|
||||
<Translate X="0" Y="0" Z="0" />
|
||||
</Transform>
|
||||
</Bone>
|
||||
</Bones>
|
||||
</Skeleton>
|
||||
</SkeletalModel>
|
||||
</Models>
|
||||
</GraphicsContentCtr>
|
||||
</NintendoWareIntermediateFile>
|
||||
File diff suppressed because one or more lines are too long
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/banner/banner.cbmd
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/banner/banner.cbmd
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M‡M§U§U†M†M†M†M†M†M†M†M†M†M†M†M†M§U§U§U†M‡U§U§U§U¨]¨]Č]§U¨]Č]É]É]Éeéeęm†M†M‡M§U§U§U¨UČ]§U¨U¨]Č]Č]ÉeÉeęeČ]É]É]ęeéeęmęmnęeęmëmvv,v,v-~Č]ÉeÉeęeęeëmëmvęennvv,~-~M†v,~,~-~-~N†N†oŽM~N†N†oŽoŽp–<70>–‘žn,v,v-~-~N†N†oŽ-~N†N†oŽoŽp–p–‘–nŽoŽpŽ<70>–<EFBFBD>–±ž±ž˛¦‘–˛ž˛žÓ¦Ň¦Ó®Ó®ő¶oŽp–<70>–‘ž‘–˛ž˛žÓ¦‘ž˛¦˛¦Ó¦Ó¦Ô®ô®ő¶Ó¦Ô®ô®ő¶ő¶żż7Çő¶żż7Ç7Ç8ĎXĎYφM‡U§U§U§U¨]Č]É]¨UČ]Č]ÉeÉ]éeęeęmÉ]éeéej]ęmkeK*ë!ęmË2vk+;-~LmN†Éeęeęeęmęmvv,vëmvv,~,v-~-~N†v«!-~ŚK
moŽK*.uN††oŽ<6F>–íS¬:‘ž˛žv-~«!ÍdM†®}K*«!N†nuoŽpŽkđ…Ndl2oŽ<6F>–L2±ž±ž˛¦kĐt±ž˛¦ržŇŤk.Kl2kp–‘–O}°…˛žnK°td
CđtÓ¦Ô®
KÍBő¶żÍ:’Ťkł•ÍB.KÍB…ń|¦7Ç7Çđc÷ĆXĎy×Ó¦ô®ô®ń|ő¶żk7Ç·m:žË!kXĎkY×7ÇXĎXĎY×YĎz×z×zßY×z×zכߛߛç›çĽďm:<3A>[kV¶Ť:W¶îJ®OSzßzß›ßtxľĽçĽď›ß›çśçĽďĽď˝ďÝďŢ÷ĽďÝďÝďŢ÷Ţ÷ţ÷ţ÷˙˙,~-~M~N†N†oŽoŽ<6F>–N†oŽoŽ<6F>–<EFBFBD>–‘ž±ž˛¦<CB9B>–‘ž±ž˛¦˛žÓ¦Ó¦ô®˛¦Ó®Ó®ô¶ô®ő¶·ż<>–±ž±žŇ¦˛¦Ó®Ó®ô¶˛¦Ó®Ô®ô¶ô¶żżżô¶··żż7Ç7ÇXĎż7Ç7ÇXĎXĎY×y×zßÔ®ő¶ő¶żż7Ç7ÇXĎż7Ç7ÇXĎXĎYĎY×z×8ĎYĎYĎy×y×zßzß›çzךߚߛç›çĽçĽç˝ďXĎY×y×z×zכߛߛçzߛߛߜçśçĽďĽďÝď›çĽçĽď˝ď˝ďÝ÷Ý÷Ţ÷ÝďŢ÷Ţ÷ţ÷Ţ÷˙˙˙˙˙˙›ßśçĽç˝ďĽďÝďÝďŢ÷˝ďÝ÷Ý÷Ţ÷Ţ÷ţ˙ţ˙˙˙Ţ÷Ţ÷ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
|
||||
@ -0,0 +1,2 @@
|
||||
†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M‡M‡U§U†M‡U§U§U§U§U§U§U†M†M†M†M†M†M†M§U†M‡U‡U§U‡U§U§U§U§U§U§U§U§U§U¨U¨]§U¨U¨UČ]Č]Č]Č]É]§U§U§U§U§U¨U¨]¨]§U¨]¨]¨]Č]Č]Č]É]¨]Č]Č]É]É]ÉeÉeÉeÉ]ÉeÉeÉeéeęeęeęm¨]Č]Č]Č]É]É]ÉeÉeÉ]É]ÉeéeÉeęeęeęmÉeéeęeęeęeęmęmnęmęmęmnnnvvÉeęeęeęmęmęmęmnęmëmëmnnvvvnvvvv,v,v,~v,v,v-~-~-~-~M†ëmnnvvv,v,~v,vv,~,~-~-~M~,~-~-~-~M~N†N†N†-~N†N†N†N†oŽoŽoŽ,~-~-~M~M~N†N†N†M†N†N†N†N†oŽoŽoŽN†oŽoŽoŽoŽpŽp–<70>–oŽp–<70>–<EFBFBD>–<EFBFBD>–‘–‘–‘žN†N†oŽoŽoŽoŽoŽp–oŽpŽpŽ<70>–<EFBFBD>–<EFBFBD>–<EFBFBD>–‘ž<E28098>–<EFBFBD>–<EFBFBD>–‘ž‘ž±ž±ž˛ž‘ž±ž±ž˛¦˛ž˛¦˛¦Ó¦<C393>–‘–‘–‘ž‘ž±ž˛ž˛¦‘ž˛ž˛ž˛¦˛¦Ó¦Ó¦Ó®˛¦˛¦ł¦Ó¦Ó¦Ó®Ó®ô®Ó®Ô®Ô®ô®ô®ô¶ô¶ő¶†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M‡U†M†M†M†M†M†M†M†M†M†M†M†M†M†M†M‡U†M†M†M‡U‡U‡U§U§U‡U‡U§U§U§U§U§U¨U†M†M†M†M†M‡U‡U§U‡M‡U§U§U§U§U§U¨U§U§U§U¨U¨U¨]¨]Č]¨U¨]¨]Č]Č]Č]Č]É]§U§U§U¨U¨U¨]¨]Č]¨U¨]¨]Č]Č]É]É]ÉeČ]É]É]ÉeÉeÉeÉeęeÉeÉeÉeęeęeęmęmęmČ]Č]Č]É]É]ÉeÉeéeÉ]ÉeÉeęeéeęeęeęméeęeęeęmęmëmnnęmëmëmnnvv,vęeęeęmęmęmëmnvęmnnvvvv,vnvv,v,v,~,~-~v,~,~-~-~M~M†N†nvvvv,v,v-~v,~,~-~-~-~-~N†-~-~-~N†M†N†N†o†N†N†N†OŽNŽoŽoŽpŽ-~M~M~N†N†N†N†oŽN†N†N†oŽoŽoŽoŽp–OŽoŽoŽpŽpŽ<70>–<EFBFBD>–‘–pŽ<70>–<EFBFBD>–‘–‘–‘ž‘ž˛žn†oŽoŽoŽoŽp–<70>–<EFBFBD>–oŽ<6F>–p–<70>–<EFBFBD>–‘ž‘ž±ž<C2B1>–‘–‘ž±ž‘ž˛ž˛ž˛¦±ž˛ž˛ž˛¦˛¦Ó¦Ó¦Ó®‘–‘ž‘ž±ž±ž˛ž˛¦Ň¦˛ž˛¦˛¦ł¦Ň¦Ó¦Ó®Ó®Ň¦Ó¦Ó¦Ó®Ó®ô®ô®ô¶Ó®ô®ô®ô¶ô¶ő¶ő¶ż˛¦Ó¦Ó¦Ó®Ó®Ô®Ô®ô®Ó®Ô®ô®ô¶ô®ő¶ő¶·ô®ő¶ő¶ő¶·żżż·żżżż7Ç7Ç7Çô¶ő¶ő¶··żżżżżżżż7Ç7Ç7Çż7Ç7Ç7Ç7Ç7Ç8ĎXĎ7Ç8ĎXĎXĎXĎYĎYĎy׆M†M†M§U‡U§U§U§U§U§U§U§U§U¨U§U¨]§U§U§U¨]¨]¨]Č]Č]¨]Č]Č]Č]Č]É]É]Ée§U¨U¨U¨]¨]Č]Č]É]¨]Č]Č]É]É]ÉeÉeéeČ]É]É]éeÉeéeęeęeéeęeęeęmęeęmęmëmČ]É]É]ÉeÉeÉeéeęeÉeéeęeęeęeęmęm‹Tęeęmęmëm
|
||||
nnn+e+]Ë2kkkk‹2ËKęeęmęmn«e«!LknnvvË2k‹2kkKT+;,~,~-~-~-~ěd-~íu-~-~N†N†N†vvŚm,v,v-~-~-~kk+;K*l\N†
e~-~M†M†N†N†N††numm*«!kkkŤKK-~N†N†N†N†Ť\OŽŤdN†oŽoŽoŽoŽ/ŽpŽ<70>–kKkěBp–<70>–<EFBFBD>–‘ž«!kŹ}*¬:P}kkoŽoŽoŽp–p–<70>–<EFBFBD>–‘žkíS*Nd‘–±ž±ž˛ž‘–±ž±ž˛ž˛ž˛¦˛¦Ó¦l2kkkĐtÓ®
Cô®‘ž±ž±ž˛ž˛ž˛¦˛¦Ó¦˛ž˛¦:ržÓ¦2žÓ®’Ťkkk«!k”¦kŃ|knSk0dk.Km:kÓ¦Ó¦Ó®Ô®Ó®ô®ô®ô¶Ô®ô®ô®ő¶ő¶<C591>t·*ô¶ő¶ő¶żżżżżkÍBkÎBÇ7Ç7Ç7Çő¶·ő¶żóťkđckżżŐ¶SŤ*2kđck2Ë!k7ÇXĎXĎXĎÎBkÎBkXĎY×Y×y׿7Ç7Ç7Ç7ÇXĎXĎXĎ7ÇXĎXĎXĎXĎYĎYĎy×XĎYĎYĎy×Y×y×z×zßy×z×z×zßzßšßzß›ßXĎY×Y×y×y×z×z×zßy×z×z×zßzߚߛߛçzßzߚߛߛߛç›çśç›ß›ç›çśçśçĽçĽďĽďÉ]ÉeÉeÉeÉeęeęeęméeęeęeęmęmęmnnęeęmęmnnvvvnvvvv,v,v-~ęmëmëmnnvvvnvvvv,~,~-~v,v,~-~-~-~-~M†-~-~-~N†N†N†N†o†v,v,v,~‹2kŚCk-~-~-~M†
ekN†ě:
eN†m\N†N†oŽoŽoŽ*†k*oŽp–Žd/uN†N†N†NŽN††oŽoŽnŽoŽoŽpŽoŽp–<70>–<EFBFBD>–LCkp–đ…kkNd\<5C>–‘ž‘ž±ž±ž˛ž˛ž˛¦oŽpŽp–<70>–<EFBFBD>–‘–‘–‘ž<E28098>–‘–ďt\‘ž˛žŽu‘ž˛ž˛ž˛¦Żl*ł¦rž˛¦ł¦
ColÓ¦Ô®q…/dkk\p…\®SÓ¦Ó®˛¦Ó¦Ó¦Ó®Ó®Ô®Ô®ô¶kkŇ•plkk0d2…ô¶ő¶ő¶··żżżkÍ:*kô®’Ťô¶’Ťl2kk*ő¶0lż0lk0lk‘t‘tku®kkł•k´ť7Çm:7Dz|Ë!óťµ®żżPl7Çu®ż6Ç7Ç7Ç7Ç7Ç7ÇXĎkÔťÔť÷ľXĎ—¶XĎY×XĎXĎXĎY×Y×y×y×z×…Ź[.SË!k6®,2YĎkkkk˛„y×·ľz×<7A>[krtk¸ľz×öšßr|kr|kö›ß®›çkŤ:öĄ¸ľz×zßzßšßz×zßzߚߚߛߛߛçr|k:×¶U•ĽçÚÎĽç›çĽçĽçĽçĽçĽďĽď˝ďzߛߛߛç›ç›ç›çĽç›çśç›çĽçĽçĽďĽď˝ďĽçĽçĽď˝ď˝ďÝď˝ďÝ÷˝ď˝ď˝ďÝ÷Ý÷Ţ÷Ţ÷Ţ÷ĽçĽďĽď˝ď˝ďÝďÝďÝ÷˝ďÝďÝďÝ÷Ý÷Ţ÷Ţ÷Ţ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷ţ÷ţ÷ţ˙Ţ÷ţ÷Ţ÷˙˙˙˙˙˙˙˙˙˙,v,~,~-~-~M~M~N†-~M~M~N†N†N†N†oŽN†N†N†oŽOŽoŽoŽpŽoŽoŽoŽp–pŽ<70>–<EFBFBD>–‘–N†N†N†oŽoŽoŽoŽp–oŽoŽoŽp–<70>–<EFBFBD>–<EFBFBD>–‘–p–<70>–<EFBFBD>–‘–‘–‘ž±ž˛ž‘–±ž±ž˛ž˛ž˛¦˛¦Ó¦pŽ<70>–<EFBFBD>–‘–<E28098>–‘ž‘ž±ž‘–‘ž±ž˛ž˛ž˛¦˛¦˛¦±ž˛¦˛¦˛¦˛¦Ó¦Ó¦Ó®˛¦Ó¦Ó¦Ó®Ó®ô®ô®ô¶˛ž˛¦˛¦Ó¦Ó¦Ó®Ó®Ô®Ó¦Ó®Ó®Ô®Ô®ô®ô¶ő¶Ô®ô®ô®ő¶ô¶ő¶ő¶żő¶ő¶·żżżżżÓ®Ô®ô®ô¶ô¶ő¶ő¶żô¶ő¶ő¶żżżżż·żżżż7Ç7Ç7Çż7Ç7Ç7Ç7Ç8Ď8ĎXĎżżżżż7Ç7Ç7Çż7Ç7Ç7Ç7Ç8ĎXĎXĎ7ÇXĎXĎXĎXĎYĎYĎy×XĎYĎY×y×y×z×z×zß7Ç8Ç8ÇXĎXĎXĎXĎY×XĎYĎYĎY×Y×y×y×z×Y×y×y×z×z×zßzß›ßzßzßzߛߛߛç›ç›çY×y×z×zßzßšßšß›ßzߚߚߛߛߛç›çĽç›ß›ç›çśç›çĽçĽçĽď›çĽçĽçĽďĽď˝ď˝ďÝď›ß›ç›ß›ç›çśçśçĽď›çĽçĽçĽďĽď˝ď˝ď˝ďĽďĽďĽď˝ď˝ďÝďÝďÝ÷˝ďÝďÝďŢ÷Ý÷Ţ÷Ţ÷Ţ÷Ľď˝ď˝ďÝď˝ďÝ÷ÝďŢ÷ÝďÝ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷ţ˙ţ˙˙˙Ţ÷ţ˙˙˙˙˙˙˙˙˙˙˙˙˙Ý÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷˙˙Ţ÷ţ˙ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙p–<70>–<EFBFBD>–‘ž‘ž±ž±ž˛ž‘ž±ž˛ž˛ž˛žŇ¦Ň¦Ó¦˛ž˛¦˛¦Ó¦Ó¦Ó®Ó®Ô®Ó¦Ó®Ó®Ô®Ô®ô¶ô¶ő¶˛¦ł¦˛¦Ó¦Ó¦Ó®Ó®ô®Ó®Ô®Ô®ô®ô®ô¶ô¶·ô®ô¶ô¶ő¶ő¶żżżő¶żżżżż6ż7ÇÔ®ô®ô¶ő¶ő¶··żő¶··żżżż7Çżżż7Ç7Ç7Ç7Ç8Ç7Ç7Ç7Ç8Ď8ÇXĎXĎXĎżżż7Ç7Ç7Ç7ÇXĎ7Ç7Ç7ÇXĎXĎXĎXĎYĎ8ĎXĎXĎYĎYĎY×y×y×YĎY×y×y×y×z×zßšß7ÇXĎXĎXĎXĎY×Y×y×XĎY×y×y×y×z×z×zßy×z×z×zßzߚߛߛßzߛߛߛߛߛç›çĽçy×z×zßzßzߛߛߛçzߛߛߛç›ç›çśçĽç›ç›ç›çĽçĽçĽďĽďĽďĽçĽďĽď˝ď˝ďÝď˝ďÝ÷›ß›ç›çĽçĽçĽçĽçĽďśçĽçĽďĽďĽď˝ď˝ďÝďĽď˝ď˝ďÝď˝ďÝ÷Ý÷Ţ÷ÝďÝ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷ţ÷Ľď˝ď˝ďÝďÝďÝ÷Ý÷Ţ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷ţ˙Ţ÷Ţ÷Ţ÷ţ˙ţ˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
|
||||
28
tags/0thNUP_Secure/CardSaveDataMover/body/body.rsf
Normal file
28
tags/0thNUP_Secure/CardSaveDataMover/body/body.rsf
Normal file
@ -0,0 +1,28 @@
|
||||
# アプリケーションのデフォルト値
|
||||
BasicInfo:
|
||||
# プログラムのタイトル名を指定します。
|
||||
Title : $(TITLE)
|
||||
# BackupMemoryType: 128KB
|
||||
BackupMemoryType: None
|
||||
Logo : Nintendo
|
||||
ProductCode : "CTR-N-22NA"
|
||||
|
||||
TitleInfo:
|
||||
# Category: 0x0010
|
||||
# Category: SystemApplication
|
||||
UniqueId: 0xf8014
|
||||
Version: 0
|
||||
|
||||
Rom:
|
||||
HostRoot : romfiles
|
||||
# SaveDataSize: 512K
|
||||
|
||||
AccessControlInfo:
|
||||
UseExtSaveData : false
|
||||
|
||||
FileSystemAccess:
|
||||
- CategoryFileSystemTool
|
||||
|
||||
SystemControlInfo:
|
||||
RemasterVersion: 2
|
||||
|
||||
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/romfiles/banner.icn
Normal file
BIN
tags/0thNUP_Secure/CardSaveDataMover/body/romfiles/banner.icn
Normal file
Binary file not shown.
Binary file not shown.
636
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/gui.cpp
Normal file
636
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/gui.cpp
Normal file
@ -0,0 +1,636 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: main.cpp
|
||||
|
||||
Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not 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 <string.h>
|
||||
#include <nn.h>
|
||||
#include <nn/os.h>
|
||||
#include <nn/hid.h>
|
||||
#include "demo.h"
|
||||
#include "gui.h"
|
||||
#include "shfnt.h"
|
||||
|
||||
//----------- types etc ---------------
|
||||
typedef struct{
|
||||
u16 x,y;
|
||||
}tU16xy;
|
||||
|
||||
typedef struct{
|
||||
f32 r;
|
||||
f32 g;
|
||||
f32 b;
|
||||
f32 a;
|
||||
}tCol;
|
||||
|
||||
typedef struct{
|
||||
uptr image;
|
||||
tCol color;
|
||||
f32 width;
|
||||
}tStyle;
|
||||
|
||||
typedef void (*FUNCPTR)(u32 value);
|
||||
|
||||
|
||||
//------------------ コンポーネントクラス
|
||||
class cmBase{
|
||||
public:
|
||||
FUNCPTR callback;
|
||||
tU16xy pos;
|
||||
tU16xy size;
|
||||
bool enable;
|
||||
bool visible;
|
||||
u8 scr;
|
||||
u8 padding[1];
|
||||
public:
|
||||
cmBase():enable(false),visible(false){callback = 0;};
|
||||
virtual ~cmBase(){};
|
||||
void SetCallback(uptr adrs){ callback = (FUNCPTR)adrs;};
|
||||
};
|
||||
|
||||
//PADボタン
|
||||
class cmButton: public cmBase
|
||||
{
|
||||
public:
|
||||
u32 mask;//PadStatus.Trigger のマスク
|
||||
public:
|
||||
cmButton(){mask=0;};
|
||||
|
||||
};
|
||||
|
||||
//パネル
|
||||
class cmPanel: public cmBase
|
||||
{
|
||||
public:
|
||||
tStyle style;
|
||||
char *caption;
|
||||
public:
|
||||
cmPanel(){
|
||||
caption="None";
|
||||
style.image = 0;
|
||||
style.color.r = 1.0f;
|
||||
style.color.g = 1.0f;
|
||||
style.color.b = 1.0f;
|
||||
style.color.a = 1.0f;
|
||||
style.width = 2.0f;
|
||||
}
|
||||
};
|
||||
|
||||
//メッセージ
|
||||
class cmMessage: public cmPanel
|
||||
{
|
||||
public:
|
||||
u32 parent;//親コンポーネントID
|
||||
public:
|
||||
cmMessage(){style.width = 8.0f;}
|
||||
};
|
||||
|
||||
|
||||
#define LINES_MAX 20
|
||||
#define CHARS_MAX 128
|
||||
//メモ
|
||||
class cmMemo: public cmBase
|
||||
{
|
||||
private:
|
||||
char strlst[LINES_MAX][CHARS_MAX];
|
||||
public:
|
||||
tStyle style;
|
||||
u32 lines;//行サイズ:strlen配列数以下であること
|
||||
u32 parent;//親コンポーネントID
|
||||
public:
|
||||
cmMemo();
|
||||
bool setline(char *p,u16 ln);
|
||||
char* line(u16 ln);
|
||||
void clr(){
|
||||
for (int i=0;i<lines;i++)strlst[i][0]=0;
|
||||
}
|
||||
};
|
||||
|
||||
cmMemo::cmMemo():lines(10)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<LINES_MAX;i++){
|
||||
strlst[i][0]=0;
|
||||
strlst[i][CHARS_MAX-1]=0;
|
||||
}
|
||||
}
|
||||
|
||||
//文字列の登録
|
||||
bool cmMemo::setline(char *p,u16 ln)
|
||||
{
|
||||
if(lines < ln)return false;
|
||||
char c;
|
||||
int i = 0;
|
||||
while(1){
|
||||
c = p[i];
|
||||
strlst[ln][i]=c;
|
||||
if (c == 0)break;
|
||||
if (i == CHARS_MAX-2)break;
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
char* cmMemo::line(u16 ln)
|
||||
{
|
||||
if(lines < ln)return 0;
|
||||
return &strlst[ln][0];
|
||||
}
|
||||
|
||||
|
||||
//------------- sub routin -------------------
|
||||
#define PANEL_MAX 20
|
||||
#define MEMO_MAX 2
|
||||
#define MESS_MAX 50
|
||||
static cmButton s_Button;
|
||||
static cmPanel s_Panel[PANEL_MAX];
|
||||
static cmMessage s_Message[MESS_MAX];
|
||||
static cmMemo s_Memo[MEMO_MAX];
|
||||
static demo::RenderSystemDrawing s_RenderSystem;
|
||||
void ColorFromCode(eColor c,tCol *col);
|
||||
|
||||
//PANEL上の座標かチェック
|
||||
bool onPanel(u16 x,u16 y,cmPanel *p)
|
||||
{
|
||||
if (x <= p->pos.x)return false;
|
||||
if (x >= (p->pos.x + p->size.x))return false;
|
||||
if (y <= p->pos.y)return false;
|
||||
if (y >= (p->pos.y + p->size.y))return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//(2011.3.10)本体内蔵フォントに変更
|
||||
//作成時のフォントで画面位置を調整
|
||||
|
||||
#define setText(x,y,s) shf_DrawText_0(x,y,s)
|
||||
#define setSize(sz) shf_SetSize(sz)
|
||||
|
||||
void setColor(tCol *col)
|
||||
{
|
||||
//s_RenderSystem.SetColor(col->r, col->g, col->b,col->a);
|
||||
shf_SetColor(col->r,col->g,col->b,col->a);
|
||||
}
|
||||
|
||||
//void setSize(f32 sz)
|
||||
//{
|
||||
// s_RenderSystem.SetFontSize(sz);
|
||||
//}
|
||||
|
||||
/*
|
||||
#define FONT_CAPTION_SIZE 12
|
||||
//caption付きBox描画
|
||||
void drawBox(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
||||
{
|
||||
u16 xe = top.x + size.x -1;
|
||||
u16 ye = top.y + size.y -1;
|
||||
setColor(&st->color);
|
||||
s_RenderSystem.SetLineWidth(st->width);
|
||||
s_RenderSystem.DrawLine(top.x, top.y, xe, top.y);
|
||||
s_RenderSystem.DrawLine(xe, top.y, xe, ye);
|
||||
s_RenderSystem.DrawLine(xe, ye, top.x, ye);
|
||||
s_RenderSystem.DrawLine(top.x, ye, top.x, top.y);
|
||||
if (str != 0){
|
||||
int w = (size.x - strlen(str)*FONT_CAPTION_SIZE) >> 1;
|
||||
int h = (size.y - FONT_CAPTION_SIZE) >> 1;
|
||||
if ((w>0) && (h>0)){
|
||||
setSize(FONT_CAPTION_SIZE);
|
||||
s_RenderSystem.DrawText(top.x + w,top.y + h,str);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//上画面、メッセージ枠表示
|
||||
void drawBox(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
||||
{
|
||||
int i;
|
||||
shf_SetScale(2.0f,2.0f);
|
||||
setColor(&st->color);
|
||||
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y-32,"-");
|
||||
for (i=0;i<size.y/36;i++)setText(top.x-10,top.y+i*36-10,"|");
|
||||
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y+size.y-40,"-");
|
||||
for (i=0;i<size.y/36;i++)setText(top.x+size.x-16,top.y+i*36-10,"|");
|
||||
|
||||
if (str != 0){
|
||||
shf_SetScale(1.0f,1.0f);
|
||||
int w = shf_GetFontWidth()/2;
|
||||
int h = shf_GetFontHeight();
|
||||
w = (size.x - strlen(str)*w) >> 1;
|
||||
h = (size.y - h) >> 1;
|
||||
if ((w>0) && (h>0)){
|
||||
setText(top.x + w+10,top.y + h,str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//下画面ボタン表示
|
||||
void drawBox2(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
||||
{
|
||||
int i;
|
||||
setColor(&st->color);
|
||||
shf_SetScale(2.0f,2.0f);
|
||||
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y-24,"-");
|
||||
for (i=0;i<size.y/40;i++)setText(top.x-8,top.y+i*40,"|");
|
||||
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y+size.y-28,"-");
|
||||
for (i=0;i<size.y/40;i++)setText(top.x+size.x+24,top.y+i*40,"|");
|
||||
|
||||
if (str != 0){
|
||||
shf_SetScale(1.0f,1.0f);
|
||||
int w = shf_GetFontWidth()/2;
|
||||
int h = shf_GetFontHeight();
|
||||
w = (size.x - strlen(str)*w) >> 1;
|
||||
h = (size.y - h) >> 1;
|
||||
if ((w>0) && (h>0)){
|
||||
setText(top.x + w+10,top.y + h+10,str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//描画
|
||||
void drawDisp()
|
||||
{
|
||||
//NN_LOG("draw\n");
|
||||
//上
|
||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
||||
s_RenderSystem.Clear();
|
||||
int i,j;
|
||||
|
||||
for (i=0;i<PANEL_MAX;i++){
|
||||
if ((s_Panel[i].visible) && (s_Panel[i].scr == 0)){
|
||||
drawBox(s_Panel[i].pos,s_Panel[i].size,&s_Panel[i].style,s_Panel[i].caption);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<MESS_MAX;i++){
|
||||
if ( s_Message[i].visible && s_Panel[s_Message[i].parent].visible ){
|
||||
setSize(s_Message[i].style.width);
|
||||
setColor(&s_Message[i].style.color);
|
||||
//s_RenderSystem.DrawText(s_Panel[s_Message[i].parent].pos.x+s_Message[i].pos.x,
|
||||
// s_Panel[s_Message[i].parent].pos.y+s_Message[i].pos.y,s_Message[i].caption);
|
||||
setText(s_Panel[s_Message[i].parent].pos.x+s_Message[i].pos.x,
|
||||
s_Panel[s_Message[i].parent].pos.y+s_Message[i].pos.y,s_Message[i].caption);
|
||||
|
||||
|
||||
//NN_LOG(s_Message[i].caption);
|
||||
//NN_LOG(" %d\n",i);
|
||||
}
|
||||
}
|
||||
for (i=0;i<MEMO_MAX;i++){
|
||||
if ( s_Memo[i].visible && s_Panel[s_Memo[i].parent].visible ){
|
||||
setColor(&s_Memo[i].style.color);
|
||||
setSize(s_Memo[i].style.width);
|
||||
u16 x = s_Panel[s_Memo[i].parent].pos.x+s_Memo[i].pos.x;
|
||||
u16 y = s_Panel[s_Memo[i].parent].pos.y+s_Memo[i].pos.y;
|
||||
for (j=0;j<s_Memo[i].lines;j++){
|
||||
s_RenderSystem.DrawText(x,y,s_Memo[i].line(j));
|
||||
y+=10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s_RenderSystem.SwapBuffers();
|
||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||
|
||||
//下
|
||||
tCol col;
|
||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY1);
|
||||
s_RenderSystem.Clear();
|
||||
for (i=0;i<PANEL_MAX;i++){
|
||||
if ((s_Panel[i].visible) && (s_Panel[i].scr != 0)){
|
||||
if (s_Panel[i].enable==false){
|
||||
col.r = s_Panel[i].style.color.r;
|
||||
col.g = s_Panel[i].style.color.g;
|
||||
col.b = s_Panel[i].style.color.b;
|
||||
ColorFromCode(COLOR_GRAY,&s_Panel[i].style.color);
|
||||
}
|
||||
//drawBox(s_Panel[i].pos,s_Panel[i].size,&s_Panel[i].style,s_Panel[i].caption);
|
||||
drawBox2(s_Panel[i].pos,s_Panel[i].size,&s_Panel[i].style,s_Panel[i].caption);
|
||||
if (s_Panel[i].enable==false){
|
||||
s_Panel[i].style.color.r = col.r;
|
||||
s_Panel[i].style.color.g = col.g;
|
||||
s_Panel[i].style.color.b = col.b;
|
||||
}
|
||||
}
|
||||
}
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
nngxWaitVSync(NN_GX_DISPLAY1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ColorFromCode(eColor c,tCol *col)
|
||||
{
|
||||
switch(c){
|
||||
case COLOR_BLACK:
|
||||
col->r = 0.0;
|
||||
col->g = 0.0;
|
||||
col->b = 0.0;
|
||||
break;
|
||||
case COLOR_GRAY:
|
||||
col->r = 0.5f;
|
||||
col->g = 0.5f;
|
||||
col->b = 0.5f;
|
||||
break;
|
||||
case COLOR_RED:
|
||||
col->r = 1.0f;
|
||||
col->g = 0.0f;
|
||||
col->b = 0.0f;
|
||||
break;
|
||||
case COLOR_BLUE:
|
||||
col->r = 0.0f;
|
||||
col->g = 0.0f;
|
||||
col->b = 1.0f;
|
||||
break;
|
||||
case COLOR_GREEN:
|
||||
col->r = 0.0f;
|
||||
col->g = 1.0f;
|
||||
col->b = 0.0f;
|
||||
break;
|
||||
case COLOR_YELLO:
|
||||
col->r = 1.0f;
|
||||
col->g = 1.0f;
|
||||
col->b = 0.0f;
|
||||
break;
|
||||
case COLOR_WHITE:
|
||||
col->r = 1.0f;
|
||||
col->g = 1.0f;
|
||||
col->b = 1.0f;
|
||||
break;
|
||||
case COLOR_PARPL:
|
||||
col->r = 1.0f;
|
||||
col->g = 0.0f;
|
||||
col->b = 1.0f;
|
||||
break;
|
||||
case COLOR_SKY:
|
||||
col->r = 0.5f;
|
||||
col->g = 1.0f;
|
||||
col->b = 1.0f;
|
||||
break;
|
||||
default:
|
||||
col->r = 1.0f;
|
||||
col->g = 1.0f;
|
||||
col->b = 1.0f;
|
||||
break;
|
||||
}
|
||||
col->a = 1.0f;
|
||||
}
|
||||
|
||||
//------------------ class code ----------------------------
|
||||
|
||||
nn::os::Thread s_thread;
|
||||
|
||||
//thread
|
||||
//void Gui::thUpdate()
|
||||
void thUpdate(nn::os::LightEvent* pEvnt)
|
||||
{
|
||||
nn::hid::PadReader padReader;
|
||||
nn::hid::PadStatus padStatus;
|
||||
nn::hid::TouchPanelStatus tpStatus;
|
||||
tU16xy tpOld = {0,0};
|
||||
nn::hid::TouchPanelReader tpReader;
|
||||
u32 value;
|
||||
int i;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if (pEvnt->TryWait())break;
|
||||
|
||||
if (s_Button.enable && (s_Button.callback !=0))//PADボタン
|
||||
{
|
||||
padReader.ReadLatest(&padStatus);
|
||||
value = padStatus.trigger & s_Button.mask;
|
||||
if (value)(*s_Button.callback)(value);
|
||||
}
|
||||
|
||||
tpReader.ReadLatest(&tpStatus);//タッチ
|
||||
if((tpStatus.x != tpOld.x) || (tpStatus.y != tpOld.y))
|
||||
{
|
||||
tpOld.x = tpStatus.x;
|
||||
tpOld.y = tpStatus.y;
|
||||
if (tpStatus.touch)
|
||||
{
|
||||
for (i=0;i<PANEL_MAX;i++)//PANEL枠内か?
|
||||
{
|
||||
if (s_Panel[i].enable && (s_Panel[i].callback !=0))
|
||||
{
|
||||
if(onPanel(tpStatus.x,tpStatus.y,&s_Panel[i]))
|
||||
(*s_Panel[i].callback)(tpStatus.x | (tpStatus.y<<16));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nn::os::Thread::Yield();//MAINスレッドへ
|
||||
}
|
||||
nn::hid::Finalize();
|
||||
pEvnt->ClearSignal();
|
||||
}
|
||||
|
||||
|
||||
Gui::~Gui()
|
||||
{
|
||||
Finalize();
|
||||
}
|
||||
|
||||
|
||||
//初期化、終了
|
||||
bool Gui::Initialize(uptr pHeap,u32 size,nn::os::LightEvent* pEvnt)
|
||||
{
|
||||
if (Initialized)return false;
|
||||
Initialized = true;
|
||||
|
||||
//コンポーネントの初期化
|
||||
int i;
|
||||
for (i=0;i< PANEL_MAX;i++)PanelEffective(i,false,false);
|
||||
for (i=0;i< MEMO_MAX;i++)MemoEffective(i,false,false);
|
||||
for (i=0;i< MESS_MAX;i++)MessEffective(i,false,false);
|
||||
|
||||
//Render
|
||||
s_RenderSystem.Initialize(pHeap, size);
|
||||
|
||||
SharedFontInit();
|
||||
|
||||
//HID
|
||||
nn::hid::Initialize();
|
||||
|
||||
//Thread
|
||||
NN_LOG("Thread Start\n");
|
||||
nn::Result res =s_thread.TryStartUsingAutoStack(thUpdate,pEvnt,8192);
|
||||
if (res.IsFailure()){
|
||||
NN_LOG("failed :res.desc = %d\n",res.GetDescription());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gui::Finalize()
|
||||
{
|
||||
if (Initialized != true) return;
|
||||
if (s_thread.IsAlive())
|
||||
{
|
||||
s_thread.Join();
|
||||
s_thread.Finalize();
|
||||
}
|
||||
Initialized = false;
|
||||
//nn::hid::Finalize();
|
||||
// nngxFinalize 関数呼び出しと VSync 割り込みが同時に発生すると
|
||||
// 画面が暗転したまま止まる不具合を回避するために VSync 待ちを行う
|
||||
nngxWaitVSync(NN_GX_DISPLAY_BOTH);
|
||||
SharedFontFinalize();
|
||||
nngxWaitVSync(NN_GX_DISPLAY_BOTH);
|
||||
s_RenderSystem.Finalize();
|
||||
|
||||
}
|
||||
|
||||
void Gui::ButtonCallback(uptr adrs)
|
||||
{
|
||||
s_Button.SetCallback(adrs);
|
||||
}
|
||||
|
||||
void Gui::ButtonMask(u32 mask)
|
||||
{
|
||||
s_Button.mask = mask;
|
||||
s_Button.enable = true;
|
||||
}
|
||||
|
||||
myResult Gui::PanelSet(const tPanel *panel)
|
||||
{
|
||||
if (panel->id >= PANEL_MAX)return RESULT_BAD_PARAM;
|
||||
s_Panel[panel->id].pos.x = panel->x;
|
||||
s_Panel[panel->id].pos.y = panel->y;
|
||||
s_Panel[panel->id].size.x = panel->width;
|
||||
s_Panel[panel->id].size.y = panel->height;
|
||||
//if (panel->caption[0] != 0 )
|
||||
s_Panel[panel->id].caption = panel->caption;
|
||||
s_Panel[panel->id].SetCallback(panel->callback);
|
||||
s_Panel[panel->id].scr = panel->scr;
|
||||
s_Panel[panel->id].visible = false;
|
||||
s_Panel[panel->id].enable = false;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::PanelEffective(u8 id,bool enable,bool visible)
|
||||
{
|
||||
if (id >= PANEL_MAX)return RESULT_BAD_PARAM;
|
||||
s_Panel[id].enable = enable;
|
||||
s_Panel[id].visible = visible;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::PanelLineStyle(u8 id,eColor col,u8 width)
|
||||
{
|
||||
if (id >= PANEL_MAX)return RESULT_BAD_PARAM;
|
||||
ColorFromCode(col,&s_Panel[id].style.color);
|
||||
s_Panel[id].style.width = width;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
|
||||
myResult Gui::MessEffective(u8 id,bool enable,bool visible)
|
||||
{
|
||||
if (id >= MESS_MAX)return RESULT_BAD_PARAM;
|
||||
s_Message[id].enable = enable;
|
||||
s_Message[id].visible = visible;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
|
||||
myResult Gui::MessSet(const tMessage *mes)
|
||||
{
|
||||
if ((mes->parent >= PANEL_MAX) || (mes->id >= MESS_MAX))return RESULT_BAD_PARAM;
|
||||
s_Message[mes->id].pos.x = mes->x;
|
||||
s_Message[mes->id].pos.y = mes->y;
|
||||
s_Message[mes->id].caption = mes->str;
|
||||
s_Message[mes->id].parent = mes->parent;
|
||||
s_Message[mes->id].style.width = mes->size;
|
||||
ColorFromCode(mes->color,&s_Message[mes->id].style.color);
|
||||
s_Message[mes->id].visible = false;
|
||||
s_Message[mes->id].enable = false;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::MessStr(u8 id,char *str)
|
||||
{
|
||||
if (id >= MESS_MAX)return RESULT_BAD_PARAM;
|
||||
s_Message[id].caption = str;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::MessCol(u8 id,eColor col)
|
||||
{
|
||||
if (id >= MESS_MAX)return RESULT_BAD_PARAM;
|
||||
ColorFromCode(col,&s_Message[id].style.color);
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::MemoSet(const tMemo *m)
|
||||
{
|
||||
if ((m->parent >= PANEL_MAX) || (m->id >= MEMO_MAX))return RESULT_BAD_PARAM;
|
||||
if (m->lines > LINES_MAX)return RESULT_BAD_PARAM;
|
||||
s_Memo[m->id].lines = m->lines;
|
||||
s_Memo[m->id].pos.x = m->x;
|
||||
s_Memo[m->id].pos.y = m->y;
|
||||
s_Memo[m->id].parent = m->parent;
|
||||
s_Memo[m->id].style.width = m->size;
|
||||
ColorFromCode(m->color,&s_Memo[m->id].style.color);
|
||||
s_Memo[m->id].clr();
|
||||
s_Memo[m->id].visible = false;
|
||||
s_Memo[m->id].enable = false;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
myResult Gui::MemoStr(u8 id,char *str,u16 ln)
|
||||
{
|
||||
if ((id < MEMO_MAX) && s_Memo[id].setline(str,ln) )return RESULT_OK;
|
||||
return RESULT_BAD_PARAM;
|
||||
}
|
||||
|
||||
|
||||
myResult Gui::MemoEffective(u8 id,bool enable,bool visible)
|
||||
{
|
||||
if (id >= MEMO_MAX)return RESULT_BAD_PARAM;
|
||||
s_Memo[id].enable = enable;
|
||||
s_Memo[id].visible = visible;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gui::Draw()
|
||||
{
|
||||
//s_drawFlag = true;
|
||||
drawDisp();
|
||||
}
|
||||
|
||||
|
||||
void Gui::DisableAll()
|
||||
{
|
||||
for (int i=0;i<PANEL_MAX;i++){
|
||||
s_Panel[i].enable = false;
|
||||
s_Panel[i].visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
96
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/gui.h
Normal file
96
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/gui.h
Normal file
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef GUI_H_
|
||||
#define GUI_H_
|
||||
|
||||
#include <nn/os.h>
|
||||
#include <nn/types.h>
|
||||
#include "../my_defs.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uptr callback;
|
||||
char* caption;
|
||||
u16 x,y;
|
||||
u16 width,height;
|
||||
u8 id;
|
||||
u8 scr;//0:up,else down screen
|
||||
u8 padding[2];
|
||||
}tPanel;
|
||||
|
||||
typedef enum {
|
||||
COLOR_BLACK,
|
||||
COLOR_GRAY,
|
||||
COLOR_RED,
|
||||
COLOR_GREEN,
|
||||
COLOR_BLUE,
|
||||
COLOR_YELLO,
|
||||
COLOR_WHITE,
|
||||
COLOR_PARPL,
|
||||
COLOR_SKY
|
||||
}eColor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char* str;
|
||||
u16 x,y;//親の始点との相対
|
||||
eColor color;//
|
||||
u8 size;//文字サイズ
|
||||
u8 id;
|
||||
u8 parent;//親コンポーネント指定
|
||||
}tMessage;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 lines;//表示行数
|
||||
u16 x,y;//親の始点との相対
|
||||
eColor color;//文字色
|
||||
u8 size;//文字サイズ
|
||||
u8 id;
|
||||
u8 parent;//親コンポーネント指定
|
||||
}tMemo;
|
||||
|
||||
|
||||
|
||||
class Gui
|
||||
{
|
||||
private:
|
||||
bool Initialized;
|
||||
|
||||
public:
|
||||
Gui(){};
|
||||
~Gui();
|
||||
bool Initialize(uptr pHeap,u32 size,nn::os::LightEvent* pEvnt);
|
||||
void Finalize();
|
||||
void ButtonCallback(uptr adrs);
|
||||
void ButtonMask(u32 mask);
|
||||
myResult PanelSet(const tPanel *panel);
|
||||
myResult MessSet(const tMessage *mes);
|
||||
myResult MemoSet(const tMemo *m);
|
||||
void Draw();
|
||||
void DisableAll();
|
||||
myResult PanelEffective(u8 id,bool enable=true,bool visible=true);
|
||||
myResult MessEffective(u8 id,bool enable=true,bool visible=true);
|
||||
myResult MemoEffective(u8 id,bool enable=true,bool visible=true);
|
||||
myResult MessStr(u8 id,char *str);
|
||||
myResult MessCol(u8 id,eColor col);
|
||||
myResult MemoStr(u8 id,char *str,u16 ln);
|
||||
myResult PanelLineStyle(u8 id,eColor col=COLOR_WHITE,u8 width = 2);
|
||||
//void thUpdate();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
350
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/shfnt.cpp
Normal file
350
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/shfnt.cpp
Normal file
@ -0,0 +1,350 @@
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/fs.h>
|
||||
#include <nn/font.h>
|
||||
#include <nn/math.h>
|
||||
#include <nn/pl.h>
|
||||
#include <nn/util.h>
|
||||
|
||||
#include "demo.h"
|
||||
|
||||
const char s_ShaderBinaryFilePath[] = "rom:/nnfont_RectDrawerShader.shbin";
|
||||
|
||||
extern nn::fnd::ExpHeap appHeap;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief シェーダの初期化を行います。
|
||||
//!
|
||||
//! @param[in,out] pResource 描画用リソースを管理するオブジェクトへのポインタ。
|
||||
//---------------------------------------------------------------------------
|
||||
void*
|
||||
InitShaders(nn::font::RectDrawer* pDrawer)
|
||||
{
|
||||
const size_t ROMFS_BUFFER_SIZE = 1024 * 64;
|
||||
static char buffer[ROMFS_BUFFER_SIZE];
|
||||
|
||||
nn::fs::MountRom(16, 16, buffer, ROMFS_BUFFER_SIZE);
|
||||
nn::fs::FileReader shaderReader(s_ShaderBinaryFilePath);
|
||||
|
||||
const u32 fileSize = (u32)shaderReader.GetSize();
|
||||
|
||||
void* shaderBinary = appHeap.Allocate(fileSize);
|
||||
NN_NULL_ASSERT(shaderBinary);
|
||||
|
||||
shaderReader.Read(shaderBinary, fileSize);
|
||||
|
||||
const u32 vtxBufCmdBufSize =
|
||||
nn::font::RectDrawer::GetVertexBufferCommandBufferSize(shaderBinary, fileSize);
|
||||
void *const vtxBufCmdBuf = appHeap.Allocate(vtxBufCmdBufSize);
|
||||
NN_NULL_ASSERT(vtxBufCmdBuf);
|
||||
pDrawer->Initialize(vtxBufCmdBuf, shaderBinary, fileSize);
|
||||
|
||||
appHeap.Free(shaderBinary);
|
||||
|
||||
shaderReader.Finalize();
|
||||
nn::fs::Unmount("rom:");
|
||||
return vtxBufCmdBuf;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*
|
||||
@brief グラフィックスの初期設定を行います。
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
InitGX()
|
||||
{
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 描画の初期設定を行います。
|
||||
//!
|
||||
//! @param[in] width 画面の幅。
|
||||
//! @param[in] height 画面の高さ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
InitDraw(
|
||||
int width,
|
||||
int height
|
||||
)
|
||||
{
|
||||
// カラーバッファ情報
|
||||
// LCDの向きに合わせて、幅と高さを入れ替えています。
|
||||
const nn::font::ColorBufferInfo colBufInfo = { width, height, PICA_DATA_DEPTH24_STENCIL8_EXT };
|
||||
|
||||
const u32 screenSettingCommands[] =
|
||||
{
|
||||
|
||||
// ビューポートの設定
|
||||
NN_FONT_CMD_SET_VIEWPORT( 0, 0, colBufInfo.width, colBufInfo.height ),
|
||||
|
||||
// シザー処理を無効
|
||||
NN_FONT_CMD_SET_DISABLE_SCISSOR( colBufInfo ),
|
||||
|
||||
// wバッファの無効化
|
||||
// デプスレンジの設定
|
||||
// ポリゴンオフセットの無効化
|
||||
NN_FONT_CMD_SET_WBUFFER_DEPTHRANGE_POLYGONOFFSET(
|
||||
0.0f, // wScale : 0.0 でWバッファが無効
|
||||
0.0f, // depth range near
|
||||
1.0f, // depth range far
|
||||
0, // polygon offset units : 0.0 で ポリゴンオフセットが無効
|
||||
colBufInfo),
|
||||
};
|
||||
|
||||
nngxAdd3DCommand(screenSettingCommands, sizeof(screenSettingCommands), true);
|
||||
|
||||
static const u32 s_InitCommands[] =
|
||||
{
|
||||
// カリングを無効
|
||||
NN_FONT_CMD_SET_CULL_FACE( NN_FONT_CMD_CULL_FACE_DISABLE ),
|
||||
|
||||
// ステンシルテストを無効
|
||||
NN_FONT_CMD_SET_DISABLE_STENCIL_TEST(),
|
||||
|
||||
// デプステストを無効
|
||||
// カラーバッファの全ての成分を書き込み可
|
||||
NN_FONT_CMD_SET_DEPTH_FUNC_COLOR_MASK(
|
||||
false, // isDepthTestEnabled
|
||||
0, // depthFunc
|
||||
true, // depthMask
|
||||
true, // red
|
||||
true, // green
|
||||
true, // blue
|
||||
true), // alpha
|
||||
|
||||
// アーリーデプステストを無効
|
||||
NN_FONT_CMD_SET_ENABLE_EARLY_DEPTH_TEST( false ),
|
||||
|
||||
// フレームバッファアクセス制御
|
||||
NN_FONT_CMD_SET_FBACCESS(
|
||||
true, // colorRead
|
||||
true, // colorWrite
|
||||
false, // depthRead
|
||||
false, // depthWrite
|
||||
false, // stencilRead
|
||||
false), // stencilWrite
|
||||
};
|
||||
|
||||
nngxAdd3DCommand(s_InitCommands, sizeof(s_InitCommands), true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ResFontを構築します。
|
||||
//!
|
||||
//! @param[out] pFont 構築するフォントへのポインタ。
|
||||
//! @param[in] filePath ロードするフォントリソースファイル名。
|
||||
//!
|
||||
//! @return ResFont構築の成否を返します。
|
||||
//---------------------------------------------------------------------------
|
||||
bool
|
||||
InitFont(
|
||||
nn::font::ResFont* pFont,
|
||||
void* pBuffer
|
||||
)
|
||||
{
|
||||
// フォントリソースをセットします
|
||||
bool bSuccess = pFont->SetResource(pBuffer);
|
||||
|
||||
// 描画用バッファを設定します。
|
||||
const u32 drawBufferSize = nn::font::ResFont::GetDrawBufferSize(pBuffer);
|
||||
void* drawBuffer = appHeap.Allocate(drawBufferSize, 4);
|
||||
pFont->SetDrawBuffer(drawBuffer);
|
||||
NN_NULL_ASSERT(drawBuffer);
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ResFontを破棄します。
|
||||
//!
|
||||
//! @param[in] pFont 破棄するフォントへのポインタ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
CleanupFont(nn::font::ResFont* pFont)
|
||||
{
|
||||
// 描画用バッファの無効化
|
||||
// 描画用バッファがセットされているなら 構築時に SetDrawBuffer に渡したバッファへの
|
||||
// ポインタが返ってきます。
|
||||
void *const drawBuffer = pFont->SetDrawBuffer(NULL);
|
||||
if (drawBuffer != NULL)
|
||||
{
|
||||
appHeap.Free(drawBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 表示文字列用バッファを確保します。
|
||||
//!
|
||||
//! @param[in] charMax 表示する文字列の最大文字数。
|
||||
//!
|
||||
//! @return 確保した表示文字列用バッファへのポインタを返します。
|
||||
//---------------------------------------------------------------------------
|
||||
nn::font::DispStringBuffer*
|
||||
AllocDispStringBuffer(int charMax)
|
||||
{
|
||||
const u32 DrawBufferSize = nn::font::CharWriter::GetDispStringBufferSize(charMax);
|
||||
void *const bufMem = appHeap.Allocate(DrawBufferSize);
|
||||
NN_NULL_ASSERT(bufMem);
|
||||
|
||||
return nn::font::CharWriter::InitDispStringBuffer(bufMem, charMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 文字列表示用にモデルビュー行列と射影行列を設定します。
|
||||
//!
|
||||
//! @param[in] pDrawer RectDrawerオブジェクトへのポインタ。
|
||||
//! @param[in] width 画面の幅。
|
||||
//! @param[in] height 画面の高さ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
SetupTextCamera(
|
||||
nn::font::RectDrawer* pDrawer,
|
||||
int width,
|
||||
int height
|
||||
)
|
||||
{
|
||||
// 射影行列を正射影に設定
|
||||
{
|
||||
// 左上原点とし、Y軸とZ軸の向きが逆になるように設定します。
|
||||
nn::math::MTX44 proj;
|
||||
f32 znear = 0.0f;
|
||||
f32 zfar = -1.0f;
|
||||
f32 t = 0;
|
||||
f32 b = static_cast<f32>(width);
|
||||
f32 l = 0;
|
||||
f32 r = static_cast<f32>(height);
|
||||
nn::math::MTX44OrthoPivot(&proj, l, r, b, t, znear, zfar, nn::math::PIVOT_UPSIDE_TO_TOP);
|
||||
pDrawer->SetProjectionMtx(proj);
|
||||
}
|
||||
|
||||
// モデルビュー行列を単位行列に設定
|
||||
{
|
||||
nn::math::MTX34 mv;
|
||||
nn::math::MTX34Identity(&mv);
|
||||
pDrawer->SetViewMtxForText(mv);
|
||||
}
|
||||
}
|
||||
|
||||
nn::font::RectDrawer drawer;
|
||||
void *drawerBuf;
|
||||
nn::font::DispStringBuffer *pDrawStringBuf0;
|
||||
nn::font::DispStringBuffer *pDrawStringBuf1;
|
||||
nn::font::ResFont font;
|
||||
nn::font::TextWriter writer;
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ASCII文字列を描画します。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
shf_DrawText_0( u16 x,u16 y,char *s)
|
||||
{
|
||||
writer.SetCursor(x, y);
|
||||
|
||||
writer.StartPrint();
|
||||
(void)writer.Print(s);
|
||||
writer.EndPrint();
|
||||
drawer.BuildTextCommand(&writer);
|
||||
|
||||
|
||||
drawer.DrawBegin();
|
||||
|
||||
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||
writer.UseCommandBuffer();
|
||||
|
||||
drawer.DrawEnd();
|
||||
}
|
||||
|
||||
void shf_SetSize(f32 sz)
|
||||
{
|
||||
writer.SetScale(sz/14,sz/20);
|
||||
}
|
||||
|
||||
void shf_SetScale(f32 h,f32 v)
|
||||
{
|
||||
writer.SetScale(h,v);
|
||||
}
|
||||
|
||||
|
||||
void shf_SetFontSize(f32 sz)
|
||||
{
|
||||
writer.SetFontSize(sz);
|
||||
}
|
||||
|
||||
f32 shf_GetFontWidth()
|
||||
{
|
||||
return writer.GetFontWidth();
|
||||
}
|
||||
|
||||
f32 shf_GetFontHeight()
|
||||
{
|
||||
return writer.GetFontHeight();
|
||||
}
|
||||
|
||||
|
||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a)
|
||||
{
|
||||
writer.SetTextColor(nn::util::FloatColor(r,g,b,a));
|
||||
}
|
||||
|
||||
//初期化
|
||||
//AppHeap確保、RenderSystem.Inititの後に呼ぶ
|
||||
void SharedFontInit()
|
||||
{
|
||||
|
||||
InitGX();
|
||||
|
||||
// 共有フォントの初期化
|
||||
NN_UTIL_PANIC_IF_FAILED(nn::pl::InitializeSharedFont());
|
||||
|
||||
// 共有フォントのロードが完了するまで待機
|
||||
while (nn::pl::GetSharedFontLoadState() != nn::pl::SHARED_FONT_LOAD_STATE_LOADED)
|
||||
{
|
||||
// 共有フォントのロードに失敗していないか確認
|
||||
if (nn::pl::GetSharedFontLoadState() == nn::pl::SHARED_FONT_LOAD_STATE_FAILED)
|
||||
{
|
||||
NN_TPANIC_("failed to load shared font!\n");
|
||||
}
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(1));
|
||||
}
|
||||
|
||||
// 共有フォントの種類を取得
|
||||
//nn::pl::SharedFontType sharedFontType = nn::pl::GetSharedFontType();
|
||||
|
||||
// 共有フォントデータのアドレスを取得
|
||||
void* pFontBuffer = nn::pl::GetSharedFontAddress();
|
||||
|
||||
InitFont(&font, pFontBuffer);
|
||||
|
||||
// 描画リソースの構築
|
||||
drawerBuf = InitShaders(&drawer);
|
||||
|
||||
// 描画文字列用バッファの確保
|
||||
pDrawStringBuf0 = AllocDispStringBuffer(1024);
|
||||
pDrawStringBuf1 = AllocDispStringBuffer(512);
|
||||
|
||||
writer.SetDispStringBuffer(pDrawStringBuf0);
|
||||
writer.SetFont(&font);
|
||||
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SharedFontFinalize()
|
||||
{
|
||||
drawer.Finalize();
|
||||
|
||||
// 描画リソースの破棄
|
||||
appHeap.Free(drawerBuf);
|
||||
|
||||
// フォントの破棄
|
||||
CleanupFont(&font);
|
||||
|
||||
// 描画文字列用バッファの解放
|
||||
appHeap.Free(pDrawStringBuf1);
|
||||
appHeap.Free(pDrawStringBuf0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
29
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/shfnt.h
Normal file
29
tags/0thNUP_Secure/CardSaveDataMover/body/source/gui/shfnt.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef GUI_SHFNT_H_
|
||||
#define GUI_SHFNT_H_
|
||||
|
||||
void SharedFontInit();
|
||||
void SharedFontFinalize();
|
||||
void shf_DrawText_0(u16 x,u16 y,char* s);
|
||||
void shf_SetSize(f32 sz);
|
||||
void shf_SetScale(f32 h,f32 v);
|
||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a);
|
||||
void shf_SetFontSize(f32 sz);
|
||||
f32 shf_GetFontWidth();
|
||||
f32 shf_GetFontHeight();
|
||||
|
||||
#endif
|
||||
1455
tags/0thNUP_Secure/CardSaveDataMover/body/source/main.cpp
Normal file
1455
tags/0thNUP_Secure/CardSaveDataMover/body/source/main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
92
tags/0thNUP_Secure/CardSaveDataMover/body/source/my_defs.h
Normal file
92
tags/0thNUP_Secure/CardSaveDataMover/body/source/my_defs.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MYDEFS_H_
|
||||
#define MYDEFS_H_
|
||||
|
||||
//デバグモード有効化
|
||||
//#define DEBUG_ENABLE 1
|
||||
|
||||
//リストア成功時消去
|
||||
#define SUCCESS_DELETE 1
|
||||
|
||||
//SD使用時
|
||||
//#define BKUP_NOTMEM 1
|
||||
|
||||
//データ壊すモード有効
|
||||
//#define CRUSH_ENABLE 1
|
||||
|
||||
|
||||
//エラー表示コード
|
||||
enum {
|
||||
ERC_UNKNOWN = 0, //不明
|
||||
ERC_DEVICE, //デバイスが見つからない(カード抜け)
|
||||
ERC_PRODCODE,//プロダクトコード不一致
|
||||
ERC_VERIFI,//ベリファイエラー
|
||||
ERC_PATH,//パスが長すぎ
|
||||
ERC_DIRDEPTH,//ディレクトリ深すぎ
|
||||
ERC_MEDIA, //メディアが見つからない(サブ基盤外れなど)
|
||||
//ERC_PULLOUT,//抜け検出
|
||||
ERC_READ = 10, //ファイルが見つからない
|
||||
ERC_WRITE_OW = 20, //既に存在
|
||||
ERC_WRITE_NS, //空き容量がない
|
||||
ERC_WRITE_PROTECT, //書込み禁止
|
||||
ERC_ACCESS = 30, //アクセスエラー
|
||||
ERC_FORMAT = 50, //フォーマットエラー
|
||||
ERC_SDK_VERIFI = 60, //検証に失敗、改竄
|
||||
ERC_ROM = 70, //ROM情報エラー
|
||||
ERC_RETRY = 80, //リトライ要求
|
||||
ERC_EXEC = 90, //実行時エラー
|
||||
ERC_FATAL = 99 //深刻なエラー
|
||||
};
|
||||
|
||||
typedef enum{
|
||||
ERC_DEV_CARD = 100,
|
||||
ERC_DEV_OUT = 200,
|
||||
ERC_DEV_OTHER = 300
|
||||
}ErcDev;
|
||||
|
||||
|
||||
//内部使用のエラー
|
||||
typedef enum {
|
||||
RESULT_OK,
|
||||
RESULT_FAIL,
|
||||
RESULT_FAIL_OPEN,
|
||||
RESULT_FAIL_OPENW,
|
||||
RESULT_FAIL_DELETE,
|
||||
RESULT_FAIL_CREATE,
|
||||
RESULT_FAIL_READ,
|
||||
RESULT_FAIL_WRITE,
|
||||
RESULT_FAIL_MOUNT,
|
||||
RESULT_FAIL_FORMAT,
|
||||
RESULT_FAIL_GETDIR,
|
||||
RESULT_NOT_FAUND,
|
||||
RESULT_NO_MEDIA,
|
||||
RESULT_NOT_FORMAT,
|
||||
RESULT_BAD_FORMAT,
|
||||
RESULT_SDK_VERIFI,
|
||||
RESULT_FILE_EXIST,
|
||||
RESULT_NO_EXSAVE,
|
||||
RESULT_ALREADY_MOUNT,
|
||||
RESULT_INVALID_FILE,
|
||||
RESULT_BAD_PARAM,
|
||||
RESULT_DIR_LEVEL_OVER,
|
||||
RESULT_PATH_LENGTH_OVER,
|
||||
RESULT_MAX
|
||||
}myResult;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,301 @@
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <nn/fs.h>
|
||||
#include <../fs/fs_ResultPrivate.h>
|
||||
#include "exsave.h"
|
||||
|
||||
#define OWN_UID 0xf8014
|
||||
const char *exsaveName = "exsave:";
|
||||
const wchar_t *exsaveRoot_w = L"exsave:/save/";
|
||||
const char *exsaveRoot = "exsave:/save/";
|
||||
#define ROOTLENGTH_EX 8
|
||||
const wchar_t *exsaveSys_w = L"exsave:/ncl_sysdata.ncl";//暫定
|
||||
#define PATHLENGTH_MAX_EX 512
|
||||
wchar_t expath_w[PATHLENGTH_MAX_EX];//パス名
|
||||
wchar_t expathu_w[100][PATHLENGTH_MAX_EX];//上層パス名
|
||||
wchar_t expathw_w[PATHLENGTH_MAX_EX];//パス名ワーク
|
||||
#define MAX_LEVEL_EX 128
|
||||
static nn::fs::DirectoryEntry exdcEntry[MAX_LEVEL_EX];
|
||||
static nn::fs::Directory exdc[MAX_LEVEL_EX];
|
||||
|
||||
|
||||
//拡張セーブデータ
|
||||
//存在確認
|
||||
bool ExSave::IsExist()
|
||||
{
|
||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
||||
nn::fs::Unmount(exsaveName);
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
//パス検索位置のリセット
|
||||
void ExSave::ResetPath()
|
||||
{
|
||||
s_lv=0;
|
||||
s_serch = false;
|
||||
wcscpy(expath_w,exsaveRoot_w);
|
||||
//wcscpy(expathu_w,expath_w);
|
||||
}
|
||||
|
||||
|
||||
myResult ExSave::GetPath(wchar_t *path)
|
||||
{
|
||||
int n;
|
||||
while(1){
|
||||
if (s_serch==false){
|
||||
LastNnResult = exdc[s_lv].TryInitialize(expath_w);//Open
|
||||
if (LastNnResult.IsFailure()){
|
||||
return RESULT_FAIL;
|
||||
}
|
||||
}
|
||||
while(1){
|
||||
n = (exdc[s_lv].Read(&exdcEntry[s_lv],1));
|
||||
if ( n==0 )//終端
|
||||
{
|
||||
exdc[s_lv].Finalize();
|
||||
if (s_lv == 0){path[0]=0;return RESULT_OK;}// ---- rootなら終了
|
||||
s_lv--;//上の層に戻る
|
||||
wcscpy(expath_w,expathu_w[s_lv]);//パス戻す
|
||||
}else{
|
||||
if(exdcEntry[s_lv].attributes.isDirectory){//ディレクトリ
|
||||
//m_info.DirCount++;
|
||||
wcscpy(expathu_w[s_lv],expath_w);//パス保存
|
||||
wcscat(expath_w,exdcEntry[s_lv].entryName);//次のディレクトリパス
|
||||
wcscat(expath_w,L"/");
|
||||
if (++s_lv == MAX_LEVEL_EX)return RESULT_DIR_LEVEL_OVER;
|
||||
s_serch = false;
|
||||
break;
|
||||
}else{//ファイル
|
||||
//m_info.FileCount++;
|
||||
s_serch = true;
|
||||
wcscpy(path,pPathTop);
|
||||
wcscat(path,exdcEntry[s_lv].entryName);
|
||||
return RESULT_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//削除
|
||||
bool ExSave::Delete()
|
||||
{
|
||||
LastNnResult = nn::fs::DeleteExtSaveData(OWN_UID);
|
||||
//if (nn::fs::ResultNotFound().Includes(LastNnResult))return RESULT_NOT_FOUND;
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
//セーブ作成、成功時はマウント状態
|
||||
myResult ExSave::Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile)
|
||||
{
|
||||
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
||||
LastNnResult = nn::fs::CreateExtSaveData(OWN_UID,icon,iconSize,entryDir,entryFile);
|
||||
if (LastNnResult.IsFailure())return RESULT_FAIL_CREATE;
|
||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
||||
if (LastNnResult.IsFailure())return RESULT_FAIL_MOUNT;
|
||||
LastNnResult = nn::fs::TryCreateDirectory(exsaveRoot_w);
|
||||
if (LastNnResult.IsFailure()){
|
||||
nn::fs::Unmount(exsaveName);
|
||||
return RESULT_FAIL_MOUNT;
|
||||
}
|
||||
IsMounted = true;
|
||||
return RESULT_OK;
|
||||
}
|
||||
//マウント
|
||||
myResult ExSave::Mount()
|
||||
{
|
||||
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
||||
if (LastNnResult.IsFailure()){
|
||||
return RESULT_FAIL_MOUNT;
|
||||
}
|
||||
IsMounted = true;
|
||||
return RESULT_OK;
|
||||
}
|
||||
void ExSave::Unmount()
|
||||
{
|
||||
IsMounted = false;
|
||||
nn::fs::Unmount(exsaveName);
|
||||
}
|
||||
//ライト属性ファイルを閉じる
|
||||
void ExSave::CloseW()
|
||||
{
|
||||
writer.Finalize();
|
||||
}
|
||||
|
||||
//ファイルライト
|
||||
s32 ExSave::Write(char *buffer,size_t size)
|
||||
{
|
||||
s32 ct;
|
||||
LastNnResult = writer.TryWrite(&ct,(void*)buffer,size);
|
||||
if(LastNnResult.IsFailure())ct=0;
|
||||
return ct;
|
||||
}
|
||||
|
||||
|
||||
//管理用ファイル
|
||||
//ライト属性で開く
|
||||
bool ExSave::OpenSysW()
|
||||
{
|
||||
LastNnResult = nn::fs::TryCreateFile(exsaveSys_w,sizeof(tArcInfo));
|
||||
LastNnResult = writerSys.TryInitialize(exsaveSys_w,false);
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
//ライト属性ファイルを閉じる
|
||||
void ExSave::CloseSysW()
|
||||
{
|
||||
writerSys.Finalize();
|
||||
}
|
||||
//システムファイルライト
|
||||
bool ExSave::WriteSys(tArcInfo *pinfo)
|
||||
{
|
||||
s32 ct;
|
||||
pinfo->Ver = INFO_VERSION;
|
||||
LastNnResult = writerSys.TryWrite(&ct,(void*)pinfo,sizeof(tArcInfo));
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
//リード属性で開く
|
||||
bool ExSave::OpenSysR()
|
||||
{
|
||||
LastNnResult = readerSys.TryInitialize(exsaveSys_w);
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
//ライト属性ファイルを閉じる
|
||||
void ExSave::CloseSysR()
|
||||
{
|
||||
readerSys.Finalize();
|
||||
}
|
||||
//ファイルリード
|
||||
bool ExSave::ReadSys(tArcInfo *pinfo)
|
||||
{
|
||||
s32 ct;
|
||||
LastNnResult = readerSys.TryRead(&ct,(void*)pinfo,sizeof(tArcInfo));
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//ライト属性ファイルを開く
|
||||
bool ExSave::OpenW(wchar_t *path,s64 size)
|
||||
{
|
||||
int pos,pos2;
|
||||
|
||||
wcscpy(expath_w,exsaveRoot_w);
|
||||
wcscat(expath_w,path);
|
||||
while(1){
|
||||
LastNnResult = nn::fs::TryCreateFile(expath_w,size);
|
||||
if(LastNnResult.IsSuccess())break;
|
||||
//ディレクトリがなければディレクトリを作成
|
||||
pos = GetPosDelmLast(expath_w,ROOTLENGTH_EX);//ファイルが存在するディレクトリ
|
||||
if (pos <= 0)return false;//rootかパスが不正
|
||||
//while (1){
|
||||
wcscpy(expathw_w,expath_w);//ワークにコピー
|
||||
while (LastNnResult.IsFailure()){//ディレクトリ作成できるまで遡る
|
||||
if(LastNnResult.GetDescription()!=nn::fs::DESCRIPTION_DBM_DIRECTORY_NOT_FOUND)return false;
|
||||
pos2 = GetPosDelmLast(expathw_w,ROOTLENGTH_EX);//境界位置を探す
|
||||
if (pos2 == 0)return false;//root到達
|
||||
expathw_w[pos2] = 0;//境界まで削除 (例) dir1/dir2/file -> dir1/dir2 -> dir1
|
||||
LastNnResult = nn::fs::TryCreateDirectory(expathw_w);
|
||||
}
|
||||
//if (pos2 == pos)break;//配置ディレクトリなら抜ける
|
||||
//todo:ディレクトリが深いとき時間がかかるなら、無駄なTryCreateを省く
|
||||
//案)直上から最初の成功までのデリミタ位置を記録
|
||||
//先に全ディレクトリ作っておくのがよさげ
|
||||
//}
|
||||
}
|
||||
LastNnResult = writer.TryInitialize(expath_w,false);
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
//ファイルリード
|
||||
s32 ExSave::Read(char *buffer,size_t size)
|
||||
{
|
||||
// if (IsMounted==false)return 0;
|
||||
s32 ct;
|
||||
LastNnResult = reader.TryRead(&ct,(void*)buffer,size);
|
||||
if(LastNnResult.IsFailure())ct=0;
|
||||
return ct;
|
||||
}
|
||||
|
||||
|
||||
void ExSave::Close()
|
||||
{
|
||||
reader.Finalize();
|
||||
}
|
||||
|
||||
|
||||
//ファイルを開く
|
||||
//パス指定はルート以降
|
||||
//(ex)data:/dir/file -> dir/file
|
||||
bool ExSave::Open(wchar_t *path)
|
||||
{
|
||||
wcscpy(expathw_w,exsaveRoot_w);
|
||||
wcscat(expathw_w,path);
|
||||
LastNnResult = reader.TryInitialize(expathw_w);
|
||||
if (LastNnResult.IsSuccess())
|
||||
{
|
||||
LastNnResult = reader.TryGetSize(&FileSize);
|
||||
if (LastNnResult.IsSuccess())return true;
|
||||
else Close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//アーカイブ情報の取得
|
||||
bool ExSave::GetInfo(tArcInfo *pinfo)
|
||||
{
|
||||
if(Mount()==RESULT_FAIL_MOUNT)return false;
|
||||
//システムデータからフォーマット情報
|
||||
if (OpenSysR())
|
||||
{
|
||||
if(ReadSys(pinfo) == false){
|
||||
pinfo->Pcode[0]=0;
|
||||
CloseSysR();//クローズ
|
||||
Unmount();
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
Unmount();
|
||||
return false;
|
||||
}
|
||||
CloseSysR();//クローズ
|
||||
// Unmount();
|
||||
//#ifdef INFO_API_USE
|
||||
//API情報と比較
|
||||
// LastNnResult = nn::fs::GetExtSaveDataFormatInfo(OWN_UID,&m_info.FileEntry,&m_info.DirEntry);
|
||||
// if (m_info.FileEntry != pinfo->FileEntry)return false;
|
||||
// if (m_info.DirEntry != pinfo->DirEntry)return false;
|
||||
// //if (m_info.Dup != pinfo->Dup)return false; //ExSaveには無い
|
||||
//#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//コンストラクタ
|
||||
ExSave::ExSave()
|
||||
{
|
||||
IsMounted = false;
|
||||
s_lv=0;
|
||||
m_info.DirCount = 0;
|
||||
m_info.FileCount = 0;
|
||||
m_info.DirEntry = 0;
|
||||
m_info.FileEntry = 0;
|
||||
wcscpy(expath_w,exsaveRoot_w);
|
||||
//wcscpy(expathu_w,expath_w);
|
||||
pPathTop = (wchar_t*)((u32)&expath_w+strlen(exsaveRoot)*2);
|
||||
}
|
||||
|
||||
void ExSave::Finalize()
|
||||
{
|
||||
Close();
|
||||
Unmount();
|
||||
}
|
||||
//デストラクタ
|
||||
ExSave::~ExSave()
|
||||
{
|
||||
Finalize();
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef EXSAVE_H_
|
||||
#define EXSAVE_H_
|
||||
|
||||
#include <nn/types.h>
|
||||
#include <nn/Result.h>
|
||||
#include "../my_defs.h"
|
||||
#include "savefile.h"
|
||||
|
||||
class ExSave
|
||||
{
|
||||
public:
|
||||
s64 FileSize;
|
||||
nn::Result LastNnResult;
|
||||
private:
|
||||
nn::fs::FileReader reader;
|
||||
nn::fs::FileWriter writer;
|
||||
nn::fs::FileReader readerSys;
|
||||
nn::fs::FileWriter writerSys;
|
||||
wchar_t *pPathTop;
|
||||
tArcInfo m_info;
|
||||
int s_lv;
|
||||
int exrootlen;
|
||||
bool IsMounted;
|
||||
bool s_serch;
|
||||
public:
|
||||
ExSave();
|
||||
~ExSave();
|
||||
void Finalize();
|
||||
myResult Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile);
|
||||
myResult CreateSys(const void* icon,size_t iconSize);
|
||||
myResult Mount();
|
||||
myResult MountSys();
|
||||
bool IsExist();
|
||||
void Unmount();
|
||||
bool Delete();
|
||||
void CloseW();
|
||||
bool OpenW(wchar_t *path,s64 size);
|
||||
bool OpenSysW();//暫定
|
||||
void CloseSysW();//暫定
|
||||
bool OpenSysR();//暫定
|
||||
void CloseSysR();//暫定
|
||||
s32 Write(char *buffer,size_t size);
|
||||
bool WriteSys(tArcInfo *pinfo);
|
||||
bool ReadSys(tArcInfo *pinfo);
|
||||
void ResetPath();
|
||||
s32 Read(char *buffer,size_t size);
|
||||
void Close();
|
||||
bool Open(wchar_t *path);
|
||||
myResult GetPath(wchar_t *path);
|
||||
bool GetInfo(tArcInfo *pinfo);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,228 @@
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <nn/fs.h>
|
||||
#include <nn/fs/fs_ResultPrivate.h>
|
||||
#include "membak.h"
|
||||
|
||||
using namespace nn;
|
||||
|
||||
namespace
|
||||
{
|
||||
const size_t BUFFER_SIZE = 10 * 1024 * 1024;
|
||||
bit8 s_Buffer[BUFFER_SIZE] NN_ATTRIBUTE_ALIGN(32);
|
||||
}
|
||||
|
||||
bool info_alive;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
|
||||
|
||||
//コンストラクタ
|
||||
MemBak::MemBak()
|
||||
{
|
||||
m_Exists = false;
|
||||
m_pBuffer = s_Buffer;
|
||||
m_pBufferPos = s_Buffer;
|
||||
m_pBufferSize = sizeof(s_Buffer);
|
||||
LastNnResult = ResultSuccess();
|
||||
ResetPath();
|
||||
|
||||
info_alive = false;
|
||||
}
|
||||
|
||||
void MemBak::Finalize()
|
||||
{
|
||||
}
|
||||
//デストラクタ
|
||||
MemBak::~MemBak()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// mount, unmount, create, delete
|
||||
|
||||
//拡張セーブデータ
|
||||
//存在確認
|
||||
bool MemBak::IsExist()
|
||||
{
|
||||
return m_Exists;
|
||||
}
|
||||
|
||||
//セーブ作成、成功時はマウント状態
|
||||
myResult MemBak::Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile)
|
||||
{
|
||||
NN_UNUSED_VAR(icon);
|
||||
NN_UNUSED_VAR(iconSize);
|
||||
|
||||
if ( m_IsMounted )
|
||||
{
|
||||
return RESULT_ALREADY_MOUNT;
|
||||
}
|
||||
|
||||
m_NumDirEntry = entryDir;
|
||||
m_NumFileEntry = entryFile;
|
||||
|
||||
m_Exists = true;
|
||||
m_IsMounted = true;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
//削除
|
||||
bool MemBak::Delete()
|
||||
{
|
||||
m_Exists = false;
|
||||
info_alive = false;
|
||||
m_pBufferPos = m_pBuffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
//マウント
|
||||
myResult MemBak::Mount()
|
||||
{
|
||||
if ( m_IsMounted )
|
||||
{
|
||||
return RESULT_ALREADY_MOUNT;
|
||||
}
|
||||
|
||||
m_IsMounted = true;
|
||||
return RESULT_OK;
|
||||
}
|
||||
void MemBak::Unmount()
|
||||
{
|
||||
m_IsMounted = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// SetInfo, GetInfo
|
||||
|
||||
//アーカイブ情報の取得
|
||||
bool MemBak::GetInfo(tArcInfo *pinfo)
|
||||
{
|
||||
if (info_alive==false)return false;
|
||||
*pinfo = m_ArcInfo;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//管理用ファイル
|
||||
//ライト属性で開く
|
||||
bool MemBak::OpenSysW()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//ライト属性ファイルを閉じる
|
||||
void MemBak::CloseSysW()
|
||||
{
|
||||
}
|
||||
|
||||
//システムファイルライト
|
||||
bool MemBak::WriteSys(tArcInfo *pinfo)
|
||||
{
|
||||
info_alive = true;
|
||||
pinfo->Ver = INFO_VERSION;
|
||||
m_ArcInfo = *pinfo;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Traverse
|
||||
|
||||
//パス検索位置のリセット
|
||||
void MemBak::ResetPath()
|
||||
{
|
||||
m_pFind = reinterpret_cast<EntryHeader*>(m_pBuffer);
|
||||
}
|
||||
|
||||
|
||||
myResult MemBak::GetPath(wchar_t *path)
|
||||
{
|
||||
if( m_pFind->IsEnd() )
|
||||
{
|
||||
path[0] = '\0';
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
std::wcscpy(path, m_pFind->GetName());
|
||||
m_pFind = m_pFind->GetNext();
|
||||
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Write
|
||||
|
||||
//ライト属性ファイルを閉じる
|
||||
void MemBak::CloseW()
|
||||
{
|
||||
}
|
||||
|
||||
//ファイルライト
|
||||
s32 MemBak::Write(char *buffer,size_t size)
|
||||
{
|
||||
return m_ForWrite.Write(buffer, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ライト属性ファイルを開く
|
||||
bool MemBak::OpenW(wchar_t *path,s64 size)
|
||||
{
|
||||
m_ForWrite.Init(reinterpret_cast<EntryHeader*>(m_pBufferPos));
|
||||
m_ForWrite.Set(path, size);
|
||||
m_pBufferPos = reinterpret_cast<bit8*>(m_ForWrite.GetNext());
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Read
|
||||
|
||||
//ファイルリード
|
||||
s32 MemBak::Read(char *buffer,size_t size)
|
||||
{
|
||||
return m_ForRead.Read(buffer, size);
|
||||
}
|
||||
|
||||
|
||||
void MemBak::Close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//ファイルを開く
|
||||
//パス指定はルート以降
|
||||
//(ex)data:/dir/file -> dir/file
|
||||
bool MemBak::Open(wchar_t *path)
|
||||
{
|
||||
EntryHeader* pE = reinterpret_cast<EntryHeader*>(m_pBuffer);
|
||||
|
||||
while( ! pE->IsEnd() )
|
||||
{
|
||||
if( pE->Match(path) )
|
||||
{
|
||||
m_ForRead.Init(pE);
|
||||
FileSize = m_ForRead.GetSize();
|
||||
return true;
|
||||
}
|
||||
|
||||
pE = pE->GetNext();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MEMBAK_H_
|
||||
#define MEMBAK_H_
|
||||
|
||||
#include <nn/types.h>
|
||||
#include <nn/Result.h>
|
||||
#include "../my_defs.h"
|
||||
#include "savefile.h"
|
||||
#include <nn/math.h>
|
||||
|
||||
class MemBak
|
||||
{
|
||||
public:
|
||||
s64 FileSize;
|
||||
NN_PADDING4;
|
||||
nn::Result LastNnResult;
|
||||
private:
|
||||
struct EntryHeader
|
||||
{
|
||||
s16 nameSize;
|
||||
NN_PADDING2;
|
||||
s32 dataSize;
|
||||
s32 nextOffset;
|
||||
|
||||
EntryHeader* GetNext()
|
||||
{
|
||||
return reinterpret_cast<EntryHeader*>(
|
||||
reinterpret_cast<bit8*>(this) + nextOffset);
|
||||
}
|
||||
bit8* GetDataPointer()
|
||||
{
|
||||
return reinterpret_cast<bit8*>(this + 1) + nameSize;
|
||||
}
|
||||
const wchar_t* GetName() const
|
||||
{
|
||||
return reinterpret_cast<const wchar_t*>(
|
||||
reinterpret_cast<const bit8*>(this + 1));
|
||||
}
|
||||
void SetName(const wchar_t* name)
|
||||
{
|
||||
s32 len = std::wcslen(name);
|
||||
nameSize = len * 2 + 2;
|
||||
std::memcpy(this + 1, name, nameSize);
|
||||
}
|
||||
void SetSize(size_t size)
|
||||
{
|
||||
dataSize = size;
|
||||
}
|
||||
s32 GetSize() const
|
||||
{
|
||||
return dataSize;
|
||||
}
|
||||
void SetNext()
|
||||
{
|
||||
nextOffset = nn::math::RoundUp(sizeof(*this) + nameSize + dataSize, 4);
|
||||
}
|
||||
bool Match(const wchar_t* p)
|
||||
{
|
||||
return std::wcscmp(p, GetName()) == 0;
|
||||
}
|
||||
bool IsEnd() const
|
||||
{
|
||||
return nameSize == 0;
|
||||
}
|
||||
};
|
||||
struct FileState
|
||||
{
|
||||
EntryHeader* pE;
|
||||
s32 pos;
|
||||
|
||||
void Init(EntryHeader* p)
|
||||
{
|
||||
pE = p;
|
||||
pos = 0;
|
||||
}
|
||||
void Set(const wchar_t* name, size_t size)
|
||||
{
|
||||
pE->SetName(name);
|
||||
pE->SetSize(size);
|
||||
pE->SetNext();
|
||||
pE->GetNext()->nameSize = 0;
|
||||
}
|
||||
s32 GetSize() const { return pE->GetSize(); }
|
||||
EntryHeader* GetNext()
|
||||
{
|
||||
return pE->GetNext();
|
||||
}
|
||||
bit8* GetCurrentPointer()
|
||||
{
|
||||
return pE->GetDataPointer() + pos;
|
||||
}
|
||||
s32 GetRemain() const
|
||||
{
|
||||
return pE->dataSize - pos;
|
||||
}
|
||||
void Advance(s32 size)
|
||||
{
|
||||
pos += size;
|
||||
}
|
||||
s32 Write(const void* p, size_t size)
|
||||
{
|
||||
s32 remain = GetRemain();
|
||||
if( remain <= 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 copySize = nn::math::Min<s32>(remain, size);
|
||||
std::memcpy(GetCurrentPointer(), p, copySize);
|
||||
Advance(copySize);
|
||||
|
||||
return copySize;
|
||||
}
|
||||
s32 Read(void* p, size_t size)
|
||||
{
|
||||
s32 remain = GetRemain();
|
||||
if( remain <= 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 copySize = nn::math::Min<s32>(remain, size);
|
||||
std::memcpy(p, GetCurrentPointer(), copySize);
|
||||
Advance(copySize);
|
||||
|
||||
return copySize;
|
||||
}
|
||||
};
|
||||
|
||||
tArcInfo m_ArcInfo;
|
||||
FileState m_ForRead;
|
||||
FileState m_ForWrite;
|
||||
|
||||
bool m_Exists;
|
||||
bool m_IsMounted;
|
||||
NN_PADDING2;
|
||||
bit8* m_pBuffer;
|
||||
size_t m_pBufferSize;
|
||||
bit8* m_pBufferPos;
|
||||
EntryHeader* m_pFind;
|
||||
|
||||
u32 m_NumDirEntry;
|
||||
u32 m_NumFileEntry;
|
||||
|
||||
public:
|
||||
MemBak();
|
||||
~MemBak();
|
||||
void Finalize();
|
||||
myResult Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile);
|
||||
myResult CreateSys(const void* icon,size_t iconSize);
|
||||
myResult Mount();
|
||||
// myResult MountSys();
|
||||
bool IsExist();
|
||||
void Unmount();
|
||||
bool Delete();
|
||||
void CloseW();
|
||||
bool OpenW(wchar_t *path,s64 size);
|
||||
bool OpenSysW();//Žb’è
|
||||
void CloseSysW();//Žb’è
|
||||
// bool OpenSysR();//Žb’è
|
||||
// void CloseSysR();//Žb’è
|
||||
s32 Write(char *buffer,size_t size);
|
||||
bool WriteSys(tArcInfo *pinfo);
|
||||
// bool ReadSys(tArcInfo *pinfo);
|
||||
void ResetPath();
|
||||
s32 Read(char *buffer,size_t size);
|
||||
void Close();
|
||||
bool Open(wchar_t *path);
|
||||
myResult GetPath(wchar_t *path);
|
||||
bool GetInfo(tArcInfo *pinfo);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,445 @@
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <nn/fs.h>
|
||||
#include "savedata.h"
|
||||
#include <nn/fs/fs_ResultPrivate.h>
|
||||
//#include <../fs/fs_ApiSysSaveData.h>
|
||||
//#include <../fs/ctr/mpcore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_ApiForHwCheck.h>
|
||||
#include <nn/am/am_ApiSystemMenu.h>
|
||||
#include <nn/am/am_ApiLocalImporter.h>
|
||||
|
||||
#define MAX_LEVEL 256
|
||||
//static nn::fs::DirectoryEntry dcEntry[MAX_LEVEL];
|
||||
//static nn::fs::Directory dc[MAX_LEVEL];
|
||||
int dc_readed[MAX_LEVEL];//リード済みエントリ数
|
||||
|
||||
//生成時のデバイス名を超えるとパス長上限をこえる
|
||||
//可能性があるので1文字にする(無用な心配かも)
|
||||
const wchar_t *sdataRoot_w = L"s:/";
|
||||
#define ROOTLENGTH 3
|
||||
const char *sdataName = "s:";
|
||||
const wchar_t *Dummy_w = L"ncltool";
|
||||
//char path[512];//パス名
|
||||
static bool IsMounted;
|
||||
wchar_t path_w[MAX_PATH_LENGTH];//パス名
|
||||
wchar_t pathu_w[MAX_LEVEL][MAX_PATH_LENGTH];//パス名履歴
|
||||
wchar_t pathw_w[MAX_PATH_LENGTH];//パス名ワーク
|
||||
|
||||
//#define SysSaveId 0x20300
|
||||
|
||||
//セーブ作成、成功時はマウント状態
|
||||
myResult SaveData::Format(tArcInfo *pinfo)
|
||||
{
|
||||
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
||||
#ifdef USE_SYS_SAVE
|
||||
LastNnResult = nn::fs::CreateSystemSaveData(
|
||||
SysSaveId,pinfo->FileEntry,pinfo->DirEntry,0x100000,pinfo->Dup);
|
||||
if (LastNnResult.IsFailure())return RESULT_FAIL_FORMAT;
|
||||
#else
|
||||
LastNnResult = nn::fs::FormatCtrCardSaveData(pinfo->FileEntry,pinfo->DirEntry,pinfo->Dup);
|
||||
if (LastNnResult.IsFailure())return RESULT_FAIL_FORMAT;
|
||||
#endif
|
||||
if ( Mount() != RESULT_OK )return RESULT_FAIL_MOUNT;
|
||||
IsMounted = true;
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
void SaveData::ResetPath()
|
||||
{
|
||||
s_lv=0;
|
||||
s_serch = false;
|
||||
wcscpy(path_w,sdataRoot_w);
|
||||
for (int n = 0;n<MAX_LEVEL;n++)dc_readed[n] = 0;
|
||||
//wcscpy(pathu_w,path_w);
|
||||
}
|
||||
|
||||
myResult SaveData::GetPath(wchar_t *path)
|
||||
{
|
||||
static nn::fs::DirectoryEntry dcEntryl;
|
||||
static nn::fs::Directory dcl;
|
||||
|
||||
int n,ct;
|
||||
while(1){
|
||||
LastNnResult = dcl.TryInitialize(path_w);//Open
|
||||
if (LastNnResult.IsFailure()){
|
||||
return RESULT_FAIL;
|
||||
}
|
||||
if (dc_readed[s_lv] != 0)for(n=0;n<dc_readed[s_lv];n++)dcl.Read(&dcEntryl,1);
|
||||
n = (dcl.Read(&dcEntryl,1));
|
||||
dc_readed[s_lv]++;
|
||||
dcl.Finalize();
|
||||
if ( n==0 )//終端
|
||||
{
|
||||
if (s_lv == 0){path[0]=0;return RESULT_OK;}// ---- rootなら終了
|
||||
s_lv--;//上の層に戻る
|
||||
wcscpy(path_w,pathu_w[s_lv]);//パス戻す
|
||||
}else{
|
||||
if(dcEntryl.attributes.isDirectory){//ディレクトリ
|
||||
//m_info.DirCount++;
|
||||
wcscpy(pathu_w[s_lv],path_w);//パス保存
|
||||
wcscat(path_w,dcEntryl.entryName);//次のディレクトリパス
|
||||
wcscat(path_w,L"/");
|
||||
if (++s_lv == MAX_LEVEL)return RESULT_DIR_LEVEL_OVER;
|
||||
}else{//ファイル
|
||||
//m_info.FileCount++;
|
||||
wcscpy(path,pPathTop);
|
||||
ct =wcslen(path) + wcslen(dcEntryl.entryName);
|
||||
if (ct>MAX_PATH_LENGTH - 1)return RESULT_PATH_LENGTH_OVER;
|
||||
wcscat(path,dcEntryl.entryName);
|
||||
return RESULT_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//アンマウント
|
||||
void SaveData::Unmount()
|
||||
{
|
||||
if(IsMounted){
|
||||
IsMounted = false;
|
||||
nn::fs::Unmount(sdataName);
|
||||
}
|
||||
}
|
||||
|
||||
//バックアップの存在チェック
|
||||
myResult SaveData::IsExist(){
|
||||
myResult res;
|
||||
res = Mount();
|
||||
Unmount();
|
||||
return res;
|
||||
}
|
||||
/*
|
||||
//アーカイブ情報の取得
|
||||
bool SaveData::GetInfo(tArcInfo *pinfo)
|
||||
{
|
||||
|
||||
//strcpy(path,readerRoot);
|
||||
s_lv=0;
|
||||
m_info.DirCount = 0;
|
||||
m_info.FileCount = 0;
|
||||
m_info.DirEntry = 0;
|
||||
m_info.FileEntry = 0;
|
||||
m_info.Dup = false;
|
||||
wcscpy(path_w,sdataRoot_w);
|
||||
//wcscpy(pathu_w,path_w);
|
||||
|
||||
int n;
|
||||
int lv = 0;
|
||||
bool cont = true;
|
||||
while(cont){
|
||||
LastNnResult = dc[lv].TryInitialize(path_w);//Open
|
||||
if (LastNnResult.IsFailure())return false;
|
||||
while(1){
|
||||
n = (dc[lv].Read(&dcEntry[lv],1));
|
||||
if ( n==0 )//終端
|
||||
{
|
||||
dc[lv].Finalize();
|
||||
if (lv == 0){cont=false;break;}// ---- 終了
|
||||
lv--;//上の層に戻る
|
||||
wcscpy(path_w,pathu_w[lv]);//パス戻す
|
||||
}else{
|
||||
if(dcEntry[lv].attributes.isDirectory){//ディレクトリ
|
||||
m_info.DirCount++;
|
||||
wcscpy(pathu_w[lv],path_w);//パス保存
|
||||
wcscat(path_w,dcEntry[lv].entryName);//次のディレクトリパス
|
||||
wcscat(path_w,L"/");
|
||||
if (++lv == MAX_LEVEL)return false;
|
||||
break;
|
||||
}else{//ファイル
|
||||
m_info.FileCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef INFO_API_USE
|
||||
//アーカイブのエントリ数
|
||||
// .. APIまでの暫定
|
||||
m_info.DirEntry = m_info.DirCount;
|
||||
m_info.FileEntry = m_info.FileCount;
|
||||
#else
|
||||
//API使用
|
||||
#ifdef USE_SYS_SAVE
|
||||
size_t sz;
|
||||
LastNnResult = nn::fs::GetSystemSaveDataFormatInfo(SysSaveId, &m_info.FileEntry, &m_info.DirEntry, &sz, &m_info.Dup);
|
||||
#else
|
||||
//LastNnResult = nn::fs::GetSaveDataFormatInfo(&m_info.FileEntry,&m_info.DirEntry,&m_info.Dup);
|
||||
LastNnResult = nn::fs::GetCtrCardSaveDataFormatInfo(&m_info.FileEntry,&m_info.DirEntry,&m_info.Dup);
|
||||
#endif
|
||||
if (LastNnResult.IsFailure())return false;
|
||||
|
||||
#endif
|
||||
|
||||
*pinfo = m_info;//構造体コピー
|
||||
return true;
|
||||
|
||||
}
|
||||
*/
|
||||
//アーカイブ情報の取得
|
||||
bool SaveData::GetInfo(tArcInfo *pinfo)
|
||||
{
|
||||
static nn::fs::DirectoryEntry dcEntryl;
|
||||
static nn::fs::Directory dcl;
|
||||
|
||||
//strcpy(path,readerRoot);
|
||||
s_lv=0;
|
||||
m_info.DirCount = 0;
|
||||
m_info.FileCount = 0;
|
||||
m_info.DirEntry = 0;
|
||||
m_info.FileEntry = 0;
|
||||
m_info.Dup = false;
|
||||
wcscpy(path_w,sdataRoot_w);
|
||||
//wcscpy(pathu_w,path_w);
|
||||
|
||||
int n;
|
||||
int lv = 0;
|
||||
for (n = 0;n<MAX_LEVEL;n++)dc_readed[n] = 0;
|
||||
bool cont = true;
|
||||
while(cont){
|
||||
LastNnResult = dcl.TryInitialize(path_w);//Open
|
||||
if (LastNnResult.IsFailure())return false;
|
||||
if (dc_readed[lv] != 0)for(n=0;n<dc_readed[lv];n++)dcl.Read(&dcEntryl,1);
|
||||
while(1){
|
||||
n = (dcl.Read(&dcEntryl,1));
|
||||
dc_readed[lv]++;
|
||||
if ( n==0 )//終端
|
||||
{
|
||||
if (lv == 0){cont=false;break;}// ---- 終了
|
||||
lv--;//上の層に戻る
|
||||
wcscpy(path_w,pathu_w[lv]);//パス戻す
|
||||
break;
|
||||
}else{
|
||||
if(dcEntryl.attributes.isDirectory){//ディレクトリ
|
||||
m_info.DirCount++;
|
||||
wcscpy(pathu_w[lv],path_w);//パス保存
|
||||
wcscat(path_w,dcEntryl.entryName);//次のディレクトリパス
|
||||
wcscat(path_w,L"/");
|
||||
if (++lv == MAX_LEVEL)return false;
|
||||
break;
|
||||
}else{//ファイル
|
||||
m_info.FileCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
dcl.Finalize();
|
||||
}
|
||||
for (n = 0;n<MAX_LEVEL;n++)dc_readed[n] = 0;
|
||||
|
||||
#ifndef INFO_API_USE
|
||||
//アーカイブのエントリ数
|
||||
// .. APIまでの暫定
|
||||
m_info.DirEntry = m_info.DirCount;
|
||||
m_info.FileEntry = m_info.FileCount;
|
||||
#else
|
||||
//API使用
|
||||
#ifdef USE_SYS_SAVE
|
||||
size_t sz;
|
||||
LastNnResult = nn::fs::GetSystemSaveDataFormatInfo(SysSaveId, &m_info.FileEntry, &m_info.DirEntry, &sz, &m_info.Dup);
|
||||
#else
|
||||
//LastNnResult = nn::fs::GetSaveDataFormatInfo(&m_info.FileEntry,&m_info.DirEntry,&m_info.Dup);
|
||||
LastNnResult = nn::fs::GetCtrCardSaveDataFormatInfo(&m_info.FileEntry,&m_info.DirEntry,&m_info.Dup);
|
||||
#endif
|
||||
if (LastNnResult.IsFailure())return false;
|
||||
|
||||
#endif
|
||||
|
||||
*pinfo = m_info;//構造体コピー
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//プロダクトコード
|
||||
//結果は PrdCord に格納
|
||||
bool SaveData::GetPrdCode()
|
||||
{
|
||||
PrdCode[0] = 0;//clear
|
||||
s32 numPrograms;
|
||||
nn::ProgramId programId;
|
||||
|
||||
LastNnResult = nn::am::InitializeForLocalImporter();
|
||||
//LastNnResult = nn::am::InitializeForSystemMenu();
|
||||
if (LastNnResult.IsFailure()){
|
||||
//NN_LOG("%d",LastNnResult.GetDescription());
|
||||
//nn::am::FinalizeForSystemMenu();
|
||||
nn::am::FinalizeForLocalImporter();
|
||||
return false;
|
||||
}
|
||||
LastNnResult = nn::am::GetProgramList(&numPrograms, &programId, 1, nn::fs::MEDIA_TYPE_CTRCARD);
|
||||
if (LastNnResult.IsFailure()){
|
||||
//NN_LOG("%d",LastNnResult.GetDescription());
|
||||
//nn::am::FinalizeForSystemMenu();
|
||||
nn::am::FinalizeForLocalImporter();
|
||||
return false;
|
||||
}
|
||||
LastNnResult = nn::am::GetProductCode( (nn::ProductCode*)&PrdCode,nn::fs::MEDIA_TYPE_CTRCARD,programId);
|
||||
//nn::am::FinalizeForSystemMenu();
|
||||
nn::am::FinalizeForLocalImporter();
|
||||
PrdCode[sizeof(nn::ProductCode)] = 0;//表示時のオーバラン対策
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
//マウント&アーカイブ情報の取得
|
||||
myResult SaveData::Mount()
|
||||
{
|
||||
if (IsMounted)return RESULT_ALREADY_MOUNT;
|
||||
|
||||
#ifdef USE_SYS_SAVE
|
||||
LastNnResult=nn::fs::MountSystemSaveData(sdataName,SysSaveId);
|
||||
#else
|
||||
//LastNnResult=nn::fs::MountSaveDataOnCard(sdataName);//FileSystemBasePrivate
|
||||
LastNnResult = nn::fs::MountCtrCardSaveDataForCheck(sdataName);//ApiForHwCheck
|
||||
#endif
|
||||
IsMounted = LastNnResult.IsSuccess();
|
||||
if (IsMounted)return RESULT_OK;
|
||||
if (nn::fs::ResultMediaNotFound().Includes(LastNnResult))return RESULT_NO_MEDIA;
|
||||
if (nn::fs::ResultFatNotFound().Includes(LastNnResult))return RESULT_NOT_FAUND;//書けるのか?
|
||||
if (nn::fs::ResultNotFormatted().Includes(LastNnResult))return RESULT_NOT_FORMAT;
|
||||
if (nn::fs::ResultBadFormat().Includes(LastNnResult))return RESULT_BAD_FORMAT;
|
||||
if (nn::fs::ResultVerificationFailed().Includes(LastNnResult))return RESULT_SDK_VERIFI;
|
||||
|
||||
return RESULT_FAIL;
|
||||
}
|
||||
|
||||
//システムセーブのデリート
|
||||
//API実装までのテスト用データを消す用
|
||||
#ifdef USE_SYS_SAVE
|
||||
void SaveData::Delete()
|
||||
{
|
||||
LastNnResult=nn::fs::DeleteSystemSaveData(SysSaveId);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//ファイルリード
|
||||
s32 SaveData::Read(char *buffer,size_t size)
|
||||
{
|
||||
//if (IsMounted==false)return 0;
|
||||
s32 ct;
|
||||
LastNnResult = reader.TryRead(&ct,(void*)buffer,size);
|
||||
if(LastNnResult.IsFailure())ct=0;
|
||||
return ct;
|
||||
}
|
||||
|
||||
|
||||
void SaveData::Close()
|
||||
{
|
||||
reader.Finalize();
|
||||
}
|
||||
|
||||
void SaveData::CloseW()
|
||||
{
|
||||
writer.Finalize();
|
||||
}
|
||||
|
||||
//ファイルを開く
|
||||
//パス指定はルート以降
|
||||
//(ex)data:/dir/file -> dir/file
|
||||
bool SaveData::Open(wchar_t *path)
|
||||
{
|
||||
wcscpy(pathw_w,sdataRoot_w);
|
||||
wcscat(pathw_w,path);
|
||||
LastNnResult = reader.TryInitialize(pathw_w);
|
||||
if (LastNnResult.IsSuccess())
|
||||
{
|
||||
LastNnResult = reader.TryGetSize(&FileSize);
|
||||
if (LastNnResult.IsSuccess())return true;
|
||||
else Close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SaveData::OpenW(wchar_t *path,s64 size,bool *mkdir)
|
||||
{
|
||||
int pos,pos2;
|
||||
|
||||
wcscpy(path_w,sdataRoot_w);
|
||||
wcscat(path_w,path);
|
||||
*mkdir = false;
|
||||
//while(1){
|
||||
LastNnResult = nn::fs::TryCreateFile(path_w,size);
|
||||
if(LastNnResult.IsSuccess())
|
||||
{
|
||||
LastNnResult = writer.TryInitialize(path_w,false);
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
//ディレクトリがなければディレクトリを作成
|
||||
pos = GetPosDelmLast(path_w,ROOTLENGTH);//ファイルが存在するディレクトリ
|
||||
if (pos <= 0)return false;//rootかパスが不正
|
||||
//while (1){
|
||||
wcscpy(pathw_w,path_w);//ワークにコピー
|
||||
while (LastNnResult.IsFailure()){//ディレクトリ作成できるまで遡る
|
||||
if(LastNnResult.GetDescription()!=nn::fs::DESCRIPTION_DBM_DIRECTORY_NOT_FOUND)return false;
|
||||
pos2 = GetPosDelmLast(pathw_w,ROOTLENGTH);//境界位置を探す
|
||||
if (pos2 == 0)return false;//root到達
|
||||
pathw_w[pos2] = 0;//境界まで削除 (例) dir1/dir2/file -> dir1/dir2 -> dir1
|
||||
LastNnResult = nn::fs::TryCreateDirectory(pathw_w);
|
||||
}
|
||||
//作成ディレクトリ多いと画面止まるので、作成ごとに抜ける
|
||||
*mkdir = true; // 帰値:false で mkdir=true ならディレクトリ作成のみ
|
||||
return false;
|
||||
//if (pos2 == pos)break;//配置ディレクトリなら抜ける
|
||||
//todo:ディレクトリが深いとき時間がかかるなら、無駄なTryCreateを省く
|
||||
//案)直上から最初の成功までのデリミタ位置を記録
|
||||
//先に全ディレクトリ作っておくのがよさげ
|
||||
//}
|
||||
//}
|
||||
//LastNnResult = writer.TryInitialize(path_w,false);
|
||||
//return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
|
||||
//ファイルライト
|
||||
s32 SaveData::Write(char *buffer,size_t size)
|
||||
{
|
||||
s32 ct;
|
||||
LastNnResult = writer.TryWrite(&ct,(void*)buffer,size);
|
||||
if(LastNnResult.IsFailure())ct=0;
|
||||
return ct;
|
||||
}
|
||||
|
||||
//コミット
|
||||
bool SaveData::Commit()
|
||||
{
|
||||
#ifdef USE_SYS_SAVE
|
||||
LastNnResult=nn::fs::CommitSystemSaveData(sdataName);
|
||||
#else
|
||||
LastNnResult=nn::fs::CommitSaveData(sdataName);
|
||||
#endif
|
||||
return LastNnResult.IsSuccess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//コンストラクタ
|
||||
SaveData::SaveData()
|
||||
{
|
||||
IsMounted = false;
|
||||
s_lv=0;
|
||||
PrdCode[0] = 0;
|
||||
m_info.DirCount = 0;
|
||||
m_info.FileCount = 0;
|
||||
m_info.DirEntry = 0;
|
||||
m_info.FileEntry = 0;
|
||||
wcscpy(path_w,sdataRoot_w);
|
||||
//wcscpy(pathu_w,path_w);
|
||||
pPathTop = (wchar_t*)((u32)&path_w+strlen(sdataName)*2+2);
|
||||
|
||||
}
|
||||
|
||||
void SaveData::Finalize()
|
||||
{
|
||||
Close();
|
||||
Unmount();
|
||||
}
|
||||
//デストラクタ
|
||||
SaveData::~SaveData()
|
||||
{
|
||||
Finalize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SAVEDATA_H_
|
||||
#define SAVEDATA_H_
|
||||
|
||||
#include <nn/types.h>
|
||||
#include <nn/Result.h>
|
||||
//#include <nn/am/am_ApiSystemMenu.h>
|
||||
#include "../my_defs.h"
|
||||
#include "savefile.h"
|
||||
|
||||
#define MAX_PATH_LENGTH 512
|
||||
|
||||
class SaveData
|
||||
{
|
||||
public:
|
||||
s64 FileSize;
|
||||
nn::Result LastNnResult;
|
||||
char PrdCode[20];
|
||||
private:
|
||||
nn::fs::FileReader reader;
|
||||
nn::fs::FileWriter writer;
|
||||
int s_lv;
|
||||
wchar_t *pPathTop;
|
||||
tArcInfo m_info;
|
||||
bool s_serch;
|
||||
u8 pad[3];//padding
|
||||
public:
|
||||
SaveData();
|
||||
~SaveData();
|
||||
myResult Mount();
|
||||
void Unmount();
|
||||
myResult GetPath(wchar_t *path);
|
||||
void ResetPath();
|
||||
bool Open(wchar_t *path);
|
||||
void Finalize();
|
||||
void Close();
|
||||
void CloseW();
|
||||
s32 Read(char *buffer,size_t size);
|
||||
myResult IsExist();
|
||||
bool GetInfo(tArcInfo *pinfo);
|
||||
myResult Format(tArcInfo *pinfo);
|
||||
bool OpenW(wchar_t *path,s64 size,bool *mkdir);
|
||||
s32 Write(char *buffer,size_t size);
|
||||
bool Commit();
|
||||
bool GetPrdCode();
|
||||
#ifdef USE_SYS_SAVE
|
||||
void Delete();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,18 @@
|
||||
//共通関数
|
||||
|
||||
#include "savefile.h"
|
||||
|
||||
//終端から前方検索で見つかった境界("/"=0x2f)位置を返す
|
||||
//top :検索範囲の先頭指定
|
||||
int GetPosDelmLast(wchar_t *s,int top)
|
||||
{
|
||||
size_t i = wcslen(s);
|
||||
if (i < top)return -1;
|
||||
if (i ==top)return 0;
|
||||
i--;
|
||||
while(i > top-1){
|
||||
if (s[i]==L'/')return i;
|
||||
i--;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
#ifndef SAVEFILE_H_
|
||||
#define SAVEFILE_H_
|
||||
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <nn/types.h>
|
||||
|
||||
//API使用してアーカイブ情報を取得
|
||||
#define INFO_API_USE 1
|
||||
|
||||
//カードの変わりにシステムセーブを使用(API対応までの暫定)
|
||||
//#define USE_SYS_SAVE 1
|
||||
|
||||
//SD保存
|
||||
//#define BKUP_NOTMEM 1
|
||||
|
||||
int GetPosDelmLast(wchar_t *s,int top);
|
||||
|
||||
//情報ファイルのバージョン
|
||||
#define INFO_VERSION 1
|
||||
|
||||
//SDバックアップに同梱する情報
|
||||
//変更の際は後方互換とれるよう追加のみとする
|
||||
typedef struct{
|
||||
u32 DirEntry,FileEntry;
|
||||
u32 DirCount,FileCount;
|
||||
bool Dup;
|
||||
u8 Ver;//バージョン
|
||||
char Pcode[20];//product code save,exsaveクラスのPrdCodeサイズを下回らないこと
|
||||
u8 padding[3];//パディング
|
||||
}tArcInfo;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,759 @@
|
||||
#include <nn.h>
|
||||
#include <stdio.h>
|
||||
#include "screen.h"
|
||||
#include "../my_defs.h"
|
||||
#include "../common/ver.h"
|
||||
|
||||
|
||||
Gui gui;
|
||||
u8 scr_evnt;
|
||||
|
||||
enum{
|
||||
//PANEL_END,
|
||||
PANEL_ERROR,
|
||||
PANEL_SUCCESS,
|
||||
PANEL_TOPMENU,
|
||||
PANEL_TITLE,
|
||||
PANEL_QUIT,
|
||||
PANEL_READ,
|
||||
PANEL_WRITE,
|
||||
PANEL_YES,
|
||||
PANEL_NO,
|
||||
PANEL_CONFIRM,
|
||||
PANEL_DELCONF,
|
||||
PANEL_MENU,
|
||||
PANEL_BKUP,
|
||||
PANEL_INSEXIT,
|
||||
PANEL_DBGLOG
|
||||
};
|
||||
|
||||
enum{
|
||||
MESSAGE_VERSION,
|
||||
MESSAGE_PRODUCT,
|
||||
MESSAGE_PRODUCT2,
|
||||
MESSAGE_ERROR_TITLE,
|
||||
MESSAGE_ERROR_INFO,
|
||||
MESSAGE_ERROR_INFO2,
|
||||
MESSAGE_ERROR_INFO3,
|
||||
MESSAGE_SUCCESS_TITLE,
|
||||
MESSAGE_SUCCESS_INFO,
|
||||
MESSAGE_SUCCESS_INFO2,
|
||||
MESSAGE_CONFIRM_TITLE,
|
||||
MESSAGE_CONFIRM_MSG,
|
||||
MESSAGE_DELCONF_TITLE,
|
||||
MESSAGE_DELCONF_MSG,
|
||||
MESSAGE_DELCONF_MSG2,
|
||||
MESSAGE_DELCONF_MSG3,
|
||||
//MESSAGE_TOPMENU_HELP_TITLE,
|
||||
MESSAGE_TOPMENU_HELP_READ,
|
||||
MESSAGE_TOPMENU_HELP_WRITE,
|
||||
MESSAGE_TOPMENU_HELP_END,
|
||||
MESSAGE_TOPMENU_HELP_OPERATE,
|
||||
MESSAGE_TITLE,
|
||||
MESSAGE_MENU_READ,
|
||||
MESSAGE_MENU_WRITE,
|
||||
//MESSAGE_MENU_END,
|
||||
MESSAGE_MENU_OPERATE,
|
||||
MESSAGE_MENU_CAUTION,
|
||||
MESSAGE_MENU_ERROR,
|
||||
MESSAGE_MENU_DEBUG,
|
||||
MESSAGE_INSEXT_1,
|
||||
MESSAGE_INSEXT_2,
|
||||
MESSAGE_INSEXT_3,
|
||||
MESSAGE_OPERATE,
|
||||
MESSAGE_RESULT,
|
||||
MESSAGE_QUIT_OPERATE,
|
||||
MESSAGE_CONF,
|
||||
MESSAGE_COUNT,
|
||||
MESSAGE_COUNT2,
|
||||
MESSAGE_STATUS
|
||||
};
|
||||
|
||||
enum{
|
||||
MEMO_DBGLOG
|
||||
};
|
||||
|
||||
|
||||
//画面消去、コンポーネントをディセーブル
|
||||
void ScrClr()
|
||||
{
|
||||
gui.ButtonMask(0);
|
||||
gui.DisableAll();
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------イベントコールバック
|
||||
//----------------PADボタン
|
||||
void pushButton(u32 button)
|
||||
{
|
||||
//NN_LOG("button > %4x\n",button);
|
||||
if (button & nn::hid::BUTTON_LEFT)//同時押し
|
||||
{
|
||||
if (button & nn::hid::BUTTON_X)
|
||||
scr_evnt = EVNT_PUSH_LEFT_X;
|
||||
}
|
||||
#ifdef DEBUG_ENABLE
|
||||
else if (button & nn::hid::BUTTON_DOWN)//同時押し
|
||||
{
|
||||
if (button & nn::hid::BUTTON_Y)
|
||||
if (button & nn::hid::BUTTON_X)
|
||||
scr_evnt = EVNT_PUSH_DOWN_Y;
|
||||
}
|
||||
else if (button & nn::hid::BUTTON_R)scr_evnt = EVNT_PUSH_R;
|
||||
else if (button & nn::hid::BUTTON_L)scr_evnt = EVNT_PUSH_L;
|
||||
#endif
|
||||
#ifdef ENABLE_CRUSH
|
||||
else if (button & nn::hid::BUTTON_Y)scr_evnt = EVNT_PUSH_Y;
|
||||
#endif
|
||||
else if (button & nn::hid::BUTTON_B)scr_evnt = EVNT_PUSH_B;
|
||||
}
|
||||
|
||||
//-----------------パネルをタッチ
|
||||
// ---- Top Menu :READ
|
||||
void touchRead(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_SEL_READ;
|
||||
}
|
||||
// ---- Top Menu :WRITE
|
||||
void touchWrite(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_SEL_WRITE;
|
||||
}
|
||||
|
||||
//---- Top Menu :END
|
||||
//void touchEnd(u32 pos NN_IS_UNUSED_VAR)
|
||||
//{
|
||||
// scr_evnt = EVNT_SEL_END;
|
||||
//}
|
||||
|
||||
//---- YES
|
||||
void touchYes(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_YES;
|
||||
}
|
||||
|
||||
//---- NO
|
||||
void touchNo(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_NO;
|
||||
}
|
||||
|
||||
void touchQuit(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_QUIT;
|
||||
}
|
||||
|
||||
#define NULL_PTR 0
|
||||
#define NULL_STR 0
|
||||
#define SCREEN_UPPER 0
|
||||
#define SCREEN_LOWER 1
|
||||
#define LOC_CONF_X 60
|
||||
#define LOC_CONF_Y 20
|
||||
#define LOC_CONF_W (400 - LOC_CONF_X*2)
|
||||
#define LOC_CONF_H 70
|
||||
#define LOC_LOG_X 50
|
||||
#define LOC_LOG_W (400 - LOC_LOG_X*2)
|
||||
#define LOC_LOG_Y (LOC_CONF_Y + LOC_CONF_H + 10)
|
||||
#define LOC_LOG_H (240 - LOC_LOG_Y - 10)
|
||||
#define LOG_MAX 10
|
||||
|
||||
// -------------------------------------------------- コンポーネント設計
|
||||
//下画面
|
||||
|
||||
//Top Menu
|
||||
const tPanel panel_Read = {(uptr)touchRead,"Backup",80+20,30,160,80,PANEL_READ,SCREEN_LOWER};
|
||||
const tPanel panel_Write = {(uptr)touchWrite,"Restore",80+20,130,160,80,PANEL_WRITE,SCREEN_LOWER};
|
||||
//const tPanel panel_End = {(uptr)touchEnd,"End",80,180,160,30,PANEL_END,SCREEN_LOWER};
|
||||
|
||||
//Yes No
|
||||
const tPanel panel_Yes = {(uptr)touchYes,"YES",40+10,60,80,120,PANEL_YES,SCREEN_LOWER};
|
||||
const tPanel panel_No = {(uptr)touchNo,"NO",200+30,60,80,120,PANEL_NO,SCREEN_LOWER};
|
||||
|
||||
//Quit
|
||||
const tPanel panel_Quit = {(uptr)touchQuit,"Quit",80+20,60,160,120,PANEL_QUIT,SCREEN_LOWER};
|
||||
|
||||
//上画面
|
||||
//デバグ用
|
||||
//エラー表示
|
||||
const tPanel panel_Error = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_ERROR,SCREEN_UPPER};
|
||||
const tMessage mess_Title_Err = {"title",10,10,COLOR_RED,8,MESSAGE_ERROR_TITLE,PANEL_ERROR};
|
||||
const tMessage mess_Info_Err = {"info",10,22,COLOR_RED,8,MESSAGE_ERROR_INFO,PANEL_ERROR};
|
||||
const tMessage mess_Info2_Err = {"info2",10,40,COLOR_RED,8,MESSAGE_ERROR_INFO2,PANEL_ERROR};
|
||||
const tMessage mess_Info3_Err = {"info3",10,50,COLOR_RED,8,MESSAGE_ERROR_INFO3,PANEL_ERROR};
|
||||
|
||||
//成功
|
||||
const tPanel panel_Success = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_SUCCESS,SCREEN_UPPER};
|
||||
const tMessage mess_Title_Suc = {"title",10,10,COLOR_GREEN,8,MESSAGE_SUCCESS_TITLE,PANEL_SUCCESS};
|
||||
const tMessage mess_Info_Suc = {"info",10,40,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO,PANEL_SUCCESS};
|
||||
const tMessage mess_Info2_Suc = {"info2",10,50,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO2,PANEL_SUCCESS};
|
||||
|
||||
//実行確認
|
||||
const tPanel panel_Confirm = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_CONFIRM,SCREEN_UPPER};
|
||||
const tMessage mess_conf_Title = {"title",10,10,COLOR_YELLO,8,MESSAGE_CONFIRM_TITLE,PANEL_CONFIRM};
|
||||
const tMessage mess_conf_Msg = {"Do you execute?",10,40,COLOR_WHITE,8,MESSAGE_CONFIRM_MSG,PANEL_CONFIRM};
|
||||
|
||||
//トップメニュー
|
||||
const tPanel panel_topmenu_help = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_TOPMENU,SCREEN_UPPER};
|
||||
const tMessage mess_topmenu_help_read = {"[Backup] Card -> bkup",10,4,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_notread = {"[Backup] is Invalid",10,4,COLOR_RED,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_write = {"[Restore] bkup -> Card",10,16,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_notwrite = {"[Restore] is Invalid",10,16,COLOR_RED,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_end = {"[End] return to SystemMenu",10,28,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_END,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_operate = {"touch below",10,48,COLOR_GREEN,8,MESSAGE_TOPMENU_HELP_OPERATE,PANEL_TOPMENU};
|
||||
|
||||
//ログ表示
|
||||
const tPanel panel_dbglog = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_DBGLOG,SCREEN_UPPER};
|
||||
const tMemo memo_dbglog = {LOG_MAX,10,10,COLOR_WHITE,8,MEMO_DBGLOG,PANEL_DBGLOG};
|
||||
|
||||
|
||||
//通常時
|
||||
//タイトル
|
||||
#define FONT_SIZE_TITLE 12
|
||||
#define LOC_TITL_X (40-FONT_SIZE_TITLE*2)
|
||||
#define LOC_TITL_Y 20
|
||||
#define LOC_TITL_W (400 - LOC_CONF_X*2)
|
||||
#define LOC_TITL_H 50
|
||||
#define FONT_SIZE_PRODUCT 10
|
||||
const tPanel panel_title = {NULL_PTR,NULL_STR,LOC_TITL_X,LOC_TITL_Y,LOC_TITL_W,LOC_TITL_H,PANEL_TITLE,SCREEN_UPPER};
|
||||
const tMessage mess_title = {"title",0,0,COLOR_WHITE,FONT_SIZE_TITLE,MESSAGE_TITLE,PANEL_TITLE};
|
||||
const tMessage mess_product = {"product",0,LOC_TITL_H - 22,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT,PANEL_TITLE};
|
||||
const tMessage mess_product2 = {"product2",0,LOC_TITL_H - 10,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT2,PANEL_TITLE};
|
||||
const tMessage mess_version = {"version",LOC_TITL_W-FONT_SIZE_PRODUCT*6,FONT_SIZE_TITLE+2,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_VERSION,PANEL_TITLE};
|
||||
|
||||
#define LOC_MESS_X 20
|
||||
#define LOC_MESS_W (400 - LOC_MESS_X*2)
|
||||
#define LOC_MESS_Y (LOC_TITL_Y + LOC_TITL_H + 10)
|
||||
#define LOC_MESS_H (240 - LOC_MESS_Y - 10)
|
||||
//TOPメニュー
|
||||
//情報表示はログと排他
|
||||
#define FONT_SIZE 10
|
||||
#define STR_LINE(ln) (FONT_SIZE + 2)*ln
|
||||
const tPanel panel_menu = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_MENU,SCREEN_UPPER};
|
||||
const tMessage mess_menu_read = {"[Backup] Card savedata Backup",10,STR_LINE(1),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_READ,PANEL_MENU};
|
||||
const tMessage mess_menu_write = {"[Restore] restore to Card",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_WRITE,PANEL_MENU};
|
||||
//const tMessage mess_menu_end = {"[End] close this apprication",10,STR_LINE(3),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_END,PANEL_MENU};
|
||||
const tMessage mess_menu_operate = {"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_MENU_OPERATE,PANEL_MENU};
|
||||
const tMessage mess_bkuperr = {"Backup error",10,STR_LINE(6),COLOR_RED,FONT_SIZE,MESSAGE_MENU_ERROR,PANEL_MENU};
|
||||
const tMessage mess_carderr = {"CARD error",10,STR_LINE(7),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_CAUTION,PANEL_MENU};
|
||||
const tMessage mess_debug = {"Crush Mode",10,STR_LINE(3),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_DEBUG,PANEL_MENU};
|
||||
|
||||
//Backup
|
||||
//const tPanel panel_bkup = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_BKUP,SCREEN_UPPER};
|
||||
const tPanel panel_bkup = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_BKUP,SCREEN_UPPER};
|
||||
const tMessage mess_quit_operate = {"touch [Quit],or Push B",10,STR_LINE(4),COLOR_SKY,FONT_SIZE,MESSAGE_QUIT_OPERATE,PANEL_BKUP};
|
||||
const tMessage mess_conf = {"Do you execute?",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_CONF,PANEL_BKUP};
|
||||
const tMessage mess_result = {"result",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_RESULT,PANEL_BKUP};
|
||||
const tMessage mess_operate = {"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_OPERATE,PANEL_BKUP};
|
||||
const tMessage mess_status = {"status",10,STR_LINE(7),COLOR_WHITE,FONT_SIZE,MESSAGE_STATUS,PANEL_BKUP};
|
||||
const tMessage mess_count = {"count",10,STR_LINE(8),COLOR_WHITE,FONT_SIZE,MESSAGE_COUNT,PANEL_BKUP};
|
||||
const tMessage mess_count2 = {"count2",10,STR_LINE(9),COLOR_GREEN,FONT_SIZE,MESSAGE_COUNT2,PANEL_BKUP};
|
||||
|
||||
|
||||
//挿抜発生時
|
||||
//const tPanel panel_insexit = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_INSEXIT,SCREEN_UPPER};
|
||||
const tPanel panel_insexit = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_INSEXIT,SCREEN_UPPER};
|
||||
const tMessage mess_insexit = {"device insert or pull out is detected",10,STR_LINE(3),COLOR_RED,8,MESSAGE_INSEXT_1,PANEL_INSEXIT};
|
||||
const tMessage mess_insexit2 = {"return to top menu",10,STR_LINE(5),COLOR_WHITE,8,MESSAGE_INSEXT_2,PANEL_INSEXIT};
|
||||
const tMessage mess_insexit3 = {"please touch or push B",10,STR_LINE(6),COLOR_WHITE,8,MESSAGE_INSEXT_3,PANEL_INSEXIT};
|
||||
|
||||
//削除確認
|
||||
//const tPanel panel_delconf = {NULL_PTR,NULL_STR,LOC_CONF_X-10,LOC_CONF_Y,LOC_CONF_W+10,LOC_CONF_H*2,PANEL_DELCONF,SCREEN_UPPER};
|
||||
const tPanel panel_delconf = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y-36,LOC_MESS_W,LOC_MESS_H,PANEL_DELCONF,SCREEN_UPPER};
|
||||
const tMessage mess_delconf_Title = {" *** DELETE *** ",10,10,COLOR_YELLO,16,MESSAGE_DELCONF_TITLE,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg = {" caution!",10,50,COLOR_YELLO,12,MESSAGE_DELCONF_MSG,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg2 = {"this is delete backup",10,70,COLOR_YELLO,12,MESSAGE_DELCONF_MSG2,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg3 = {"Do you execute?",10,90,COLOR_YELLO,12,MESSAGE_DELCONF_MSG3,PANEL_DELCONF};
|
||||
|
||||
|
||||
|
||||
nn::os::LightEvent stopEvnt(true);
|
||||
|
||||
char scr_ver[16];
|
||||
char scr_err[32];
|
||||
char scr_debug[32];
|
||||
//menu
|
||||
bool ScrInitialize(uptr heap,u32 size)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
|
||||
if (gui.Initialize(heap,size,&stopEvnt)==false)return false;
|
||||
|
||||
|
||||
gui.ButtonCallback((uptr)pushButton);
|
||||
//コンポーネント登録
|
||||
gui.PanelSet(&panel_Read);
|
||||
gui.PanelSet(&panel_Write);
|
||||
// gui.PanelSet(&panel_End);
|
||||
gui.PanelSet(&panel_Yes);
|
||||
gui.PanelSet(&panel_No);
|
||||
gui.PanelSet(&panel_Quit);
|
||||
gui.PanelSet(&panel_Error);
|
||||
gui.PanelSet(&panel_Success);
|
||||
gui.PanelSet(&panel_Confirm);
|
||||
gui.PanelSet(&panel_delconf);
|
||||
gui.PanelSet(&panel_topmenu_help);
|
||||
gui.PanelSet(&panel_title);
|
||||
gui.PanelSet(&panel_menu);
|
||||
gui.PanelSet(&panel_bkup);
|
||||
gui.PanelSet(&panel_dbglog);
|
||||
gui.PanelSet(&panel_insexit);
|
||||
|
||||
gui.PanelLineStyle(PANEL_TITLE,COLOR_BLACK);
|
||||
|
||||
|
||||
gui.MessSet(&mess_Title_Err);
|
||||
gui.MessSet(&mess_Info_Err);
|
||||
gui.MessSet(&mess_Info2_Err);
|
||||
gui.MessSet(&mess_Info3_Err);
|
||||
gui.MessSet(&mess_Title_Suc);
|
||||
gui.MessSet(&mess_Info_Suc);
|
||||
gui.MessSet(&mess_Info2_Suc);
|
||||
gui.MessSet(&mess_conf_Title);
|
||||
gui.MessSet(&mess_conf_Msg);
|
||||
gui.MessSet(&mess_delconf_Title);
|
||||
gui.MessSet(&mess_delconf_Msg);
|
||||
gui.MessSet(&mess_delconf_Msg2);
|
||||
gui.MessSet(&mess_delconf_Msg3);
|
||||
|
||||
gui.MessSet(&mess_topmenu_help_read);
|
||||
gui.MessSet(&mess_topmenu_help_write);
|
||||
gui.MessSet(&mess_topmenu_help_end);
|
||||
gui.MessSet(&mess_topmenu_help_operate);
|
||||
|
||||
gui.MessSet(&mess_title);
|
||||
gui.MessSet(&mess_version);
|
||||
gui.MessSet(&mess_product);
|
||||
gui.MessSet(&mess_product2);
|
||||
gui.MessSet(&mess_menu_read);
|
||||
gui.MessSet(&mess_menu_write);
|
||||
// gui.MessSet(&mess_menu_end);
|
||||
gui.MessSet(&mess_menu_operate);
|
||||
gui.MessSet(&mess_quit_operate);
|
||||
gui.MessSet(&mess_conf);
|
||||
gui.MessSet(&mess_operate);
|
||||
gui.MessSet(&mess_bkuperr);
|
||||
gui.MessSet(&mess_carderr);
|
||||
gui.MessSet(&mess_debug);
|
||||
gui.MessSet(&mess_result);
|
||||
gui.MessSet(&mess_status);
|
||||
gui.MessSet(&mess_count);
|
||||
gui.MessSet(&mess_count2);
|
||||
|
||||
gui.MessSet(&mess_insexit);
|
||||
gui.MessSet(&mess_insexit2);
|
||||
gui.MessSet(&mess_insexit3);
|
||||
|
||||
gui.MemoSet(&memo_dbglog);
|
||||
|
||||
gui.MemoEffective(MESSAGE_PRODUCT);
|
||||
gui.MessEffective(MESSAGE_ERROR_TITLE);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO2);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO3);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_TITLE);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_INFO);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_INFO2);
|
||||
gui.MessEffective(MESSAGE_CONFIRM_TITLE);
|
||||
gui.MessEffective(MESSAGE_CONFIRM_MSG);
|
||||
gui.MessEffective(MESSAGE_DELCONF_TITLE);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG2);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG3);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_READ);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_END);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_OPERATE);
|
||||
gui.MessEffective(MESSAGE_MENU_READ);
|
||||
gui.MessEffective(MESSAGE_MENU_WRITE);
|
||||
// gui.MessEffective(MESSAGE_MENU_END);
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.MessEffective(MESSAGE_INSEXT_1);
|
||||
gui.MessEffective(MESSAGE_INSEXT_2);
|
||||
gui.MessEffective(MESSAGE_INSEXT_3);
|
||||
gui.MessEffective(MESSAGE_TITLE);
|
||||
gui.MessEffective(MESSAGE_VERSION);
|
||||
gui.MemoEffective(MEMO_DBGLOG);
|
||||
|
||||
gui.PanelLineStyle(PANEL_DELCONF,COLOR_YELLO);
|
||||
|
||||
sprintf(scr_ver,"ver %.2f",VERSION);
|
||||
gui.MessStr(MESSAGE_VERSION,scr_ver);
|
||||
gui.MessStr(MESSAGE_MENU_CAUTION,scr_err);
|
||||
gui.MessStr(MESSAGE_MENU_ERROR,scr_err);
|
||||
gui.MessStr(MESSAGE_MENU_DEBUG,scr_debug);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void ScrFinalize()
|
||||
{
|
||||
stopEvnt.Signal();
|
||||
while(stopEvnt.TryWait()){
|
||||
nn::os::Thread::Yield();
|
||||
|
||||
};
|
||||
gui.Finalize();
|
||||
}
|
||||
|
||||
//YES-NO ボタン
|
||||
void YesNo()
|
||||
{
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B);
|
||||
gui.PanelEffective(PANEL_YES);
|
||||
gui.PanelEffective(PANEL_NO);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void Quit()
|
||||
{
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B);
|
||||
gui.PanelEffective(PANEL_QUIT);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//トップメニュー画面
|
||||
//引数:カード状態
|
||||
void scr_TopMenuDbg(bool formatted,bool insertted)//デバッグ用
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_R | nn::hid::BUTTON_L);
|
||||
|
||||
if (formatted)
|
||||
{//リード可能
|
||||
gui.MessSet(&mess_topmenu_help_read);
|
||||
gui.PanelEffective(PANEL_READ);
|
||||
}else{//リード不可
|
||||
gui.MessSet(&mess_topmenu_help_notread);
|
||||
gui.PanelEffective(PANEL_READ,false);
|
||||
}
|
||||
if (insertted)
|
||||
{//書き込み可
|
||||
gui.MessSet(&mess_topmenu_help_write);
|
||||
gui.PanelEffective(PANEL_WRITE);
|
||||
}else{//書き込み不可
|
||||
gui.MessSet(&mess_topmenu_help_notwrite);
|
||||
gui.PanelEffective(PANEL_WRITE,false);
|
||||
}
|
||||
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_READ);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE);
|
||||
// gui.PanelEffective(PANEL_END);
|
||||
gui.PanelEffective(PANEL_TOPMENU);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//通常時
|
||||
|
||||
//プロダクトコード
|
||||
//引数:カード、拡張セーブに記録されたもの
|
||||
char scr_pcode[32];
|
||||
void scr_PrdCode(char *s)
|
||||
{
|
||||
strcpy(scr_pcode,"CARD : ");
|
||||
if (s[0]==0) strcat(scr_pcode,"----");
|
||||
else strcat(scr_pcode,s);
|
||||
gui.MessStr(MESSAGE_PRODUCT,scr_pcode);
|
||||
}
|
||||
|
||||
char scr_pcode2[64];
|
||||
void scr_PrdCodeEx(char *s)
|
||||
{
|
||||
strcpy(scr_pcode2,"BKUP : ");
|
||||
if (s[0]==0) strcat(scr_pcode2,"----");
|
||||
else strcat(scr_pcode2,s);
|
||||
gui.MessStr(MESSAGE_PRODUCT2,scr_pcode2);
|
||||
}
|
||||
|
||||
//削除の実行確認
|
||||
void scr_DelConf()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelEffective(PANEL_DELCONF);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
//Top menu
|
||||
//引数:デバイス状態
|
||||
//arg : プロダクトコード一致
|
||||
void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool bkupins,int err)
|
||||
{
|
||||
|
||||
int i;
|
||||
scr_evnt = EVNT_NONE;
|
||||
|
||||
u32 mask = 0;
|
||||
#ifdef DEBUG_ENABLE
|
||||
mask | = ( nn::hid::BUTTON_DOWN | nn::hid::BUTTON_Y |nn::hid::BUTTON_X|nn::hid::BUTTON_L | nn::hid::BUTTON_R);
|
||||
#endif
|
||||
#ifdef CRUSH_ENABLE
|
||||
extern bool CrashForDebug;
|
||||
mask | = nn::hid::BUTTON_Y;
|
||||
if (CrashForDebug==0) gui.MessEffective(MESSAGE_MENU_DEBUG,false,false);
|
||||
else{
|
||||
sprintf(scr_debug,"Crush mode %d",CrashForDebug);
|
||||
gui.MessEffective(MESSAGE_MENU_DEBUG);
|
||||
}
|
||||
#endif
|
||||
|
||||
gui.MessStr(MESSAGE_TITLE," < CTR Card Savedata Mover >");
|
||||
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR,false,false);
|
||||
gui.MessEffective(MESSAGE_MENU_CAUTION,false,false);
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE,false,false);
|
||||
//片方のみ有効
|
||||
if (formatted && bkupins && (exfm == false))
|
||||
{//バックアップ
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.PanelEffective(PANEL_READ);
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
}else if (exfm && inserted)
|
||||
{//リストア
|
||||
mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効
|
||||
gui.PanelEffective(PANEL_READ,false,false);
|
||||
i =0;
|
||||
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//バックアップがない
|
||||
else
|
||||
if (err & SDATA_ERRPUT_PCODE) i = ERC_DEV_OTHER + ERC_PRODCODE;//プロダクトコード不一致
|
||||
if (i !=0 )
|
||||
{
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
sprintf(scr_err,"ERROR %d",i);
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR);
|
||||
}
|
||||
else{
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.PanelEffective(PANEL_WRITE);
|
||||
}
|
||||
}else{//なし
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
gui.PanelEffective(PANEL_READ,false,false);
|
||||
|
||||
if (inserted == false)
|
||||
{
|
||||
strcpy(scr_err,"Please Insert Card");
|
||||
gui.MessEffective(MESSAGE_MENU_CAUTION);
|
||||
|
||||
}else{
|
||||
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//バックアップがない
|
||||
else
|
||||
if (err & SDATA_ERRPUT_VERIFI) i = ERC_SDK_VERIFI + ERC_DEV_CARD;//データが壊れている
|
||||
else if (bkupins == false) i = ERC_DEVICE + ERC_DEV_OUT;//書出し先デバイスが無い
|
||||
else i = ERC_FORMAT + ERC_DEV_CARD;//フォーマットエラー
|
||||
sprintf(scr_err,"ERROR %d",i);
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
gui.ButtonMask(mask);
|
||||
|
||||
gui.MessEffective(MESSAGE_PRODUCT);
|
||||
gui.MessEffective(MESSAGE_PRODUCT2);
|
||||
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
gui.PanelEffective(PANEL_MENU);
|
||||
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//デバッグ用、ボタン待ち
|
||||
void ScrStep()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.ButtonMask(nn::hid::BUTTON_B);
|
||||
}
|
||||
|
||||
|
||||
void ClearBkupMess()
|
||||
{
|
||||
gui.MessEffective(MESSAGE_CONF,false,false);
|
||||
gui.MessEffective(MESSAGE_RESULT,false,false);
|
||||
gui.MessEffective(MESSAGE_OPERATE,false,false);
|
||||
gui.MessEffective(MESSAGE_QUIT_OPERATE,false,false);
|
||||
gui.MessEffective(MESSAGE_STATUS,false,false);
|
||||
gui.MessEffective(MESSAGE_COUNT,false,false);
|
||||
gui.MessEffective(MESSAGE_COUNT2,false,false);
|
||||
gui.PanelEffective(PANEL_BKUP);
|
||||
}
|
||||
|
||||
//Backup
|
||||
void scr_Backup()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelLineStyle(PANEL_BKUP,COLOR_SKY);
|
||||
gui.MessStr(MESSAGE_TITLE," --- Backup Card Savedata ---");
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
ClearBkupMess();
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
void scr_BackupYesNo()
|
||||
{
|
||||
scr_Backup();
|
||||
gui.MessEffective(MESSAGE_CONF);
|
||||
gui.MessEffective(MESSAGE_OPERATE);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
//restore
|
||||
void scr_Restore()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelLineStyle(PANEL_BKUP,COLOR_PARPL);
|
||||
gui.MessStr(MESSAGE_TITLE,"--- Restore Card Savedata ---");
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
ClearBkupMess();//backupと同じパネルを使う
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
void scr_RestoreYesNo()
|
||||
{
|
||||
scr_Restore();
|
||||
gui.MessEffective(MESSAGE_CONF);
|
||||
gui.MessEffective(MESSAGE_OPERATE);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
void scr_Status(char *s,eColor col)
|
||||
{
|
||||
gui.MessCol(MESSAGE_STATUS,col);
|
||||
gui.MessStr(MESSAGE_STATUS,s);
|
||||
gui.MessEffective(MESSAGE_STATUS);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void scr_ResultQuit(char *s,eColor col)
|
||||
{
|
||||
gui.MessCol(MESSAGE_RESULT,col);
|
||||
gui.MessStr(MESSAGE_RESULT,s);
|
||||
gui.MessEffective(MESSAGE_RESULT);
|
||||
gui.MessEffective(MESSAGE_QUIT_OPERATE);
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
void scr_InsExitQuit()
|
||||
{
|
||||
ClearBkupMess();
|
||||
gui.PanelLineStyle(PANEL_INSEXIT,COLOR_RED);
|
||||
gui.PanelEffective(PANEL_INSEXIT);
|
||||
Quit();
|
||||
}
|
||||
|
||||
// カウント/MAX 表示
|
||||
char str_Counter[128];
|
||||
char str_Counter2[128];
|
||||
void scr_CountPerMax(int ct,int max)
|
||||
{
|
||||
sprintf(str_Counter,"%d / %d",ct,max);
|
||||
gui.MessStr(MESSAGE_COUNT,str_Counter);
|
||||
gui.MessEffective(MESSAGE_COUNT);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//ゲージ&total
|
||||
void scr_CountPerMax2(int ct,int max,int total)
|
||||
{
|
||||
if (total == -1) str_Counter2[0]=0;
|
||||
else if (total != 0){
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_WHITE);
|
||||
sprintf(str_Counter2,"total size %d",total);
|
||||
}else{
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
|
||||
int i;
|
||||
int lv = ct/(max/25);
|
||||
for (i =0;i<lv;i++)str_Counter2[i] = '>';
|
||||
while ( i < 25 )str_Counter2[i++] = '|';
|
||||
str_Counter2[i] = 0;
|
||||
}
|
||||
//sprintf(str_Counter2,"%d / %d",ct,max);
|
||||
gui.MessStr(MESSAGE_COUNT2,str_Counter2);
|
||||
gui.MessEffective(MESSAGE_COUNT2);
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
|
||||
void scr_MessOnCount2(char *str)
|
||||
{
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
|
||||
gui.MessStr(MESSAGE_COUNT2,str);
|
||||
gui.MessEffective(MESSAGE_COUNT2);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//実行確認
|
||||
void scr_ConfirmDbg(char *str)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_CONFIRM_TITLE,str);
|
||||
gui.PanelEffective(PANEL_CONFIRM);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
//エラー表示とQuitボタン
|
||||
void scr_ErrorQuitDbg(tColStr **s)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_ERROR_TITLE,s[0]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_TITLE,s[0]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO,s[1]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO,s[1]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO2,s[2]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO2,s[2]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO3,s[3]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO3,s[3]->color);
|
||||
gui.PanelEffective(PANEL_ERROR);
|
||||
Quit();
|
||||
}
|
||||
|
||||
//成功表示とQuitボタン
|
||||
void scr_SuccessQuitDbg(tColStr **s)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_SUCCESS_TITLE,s[0]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_TITLE,s[0]->color);
|
||||
gui.MessStr(MESSAGE_SUCCESS_INFO,s[1]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_INFO,s[1]->color);
|
||||
gui.MessStr(MESSAGE_SUCCESS_INFO2,s[2]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_INFO2,s[2]->color);
|
||||
gui.PanelEffective(PANEL_SUCCESS);
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
//デバッグログ
|
||||
void scr_DgbLog(cStrLst *p)
|
||||
{
|
||||
gui.PanelLineStyle(PANEL_DBGLOG,COLOR_BLUE);
|
||||
|
||||
for (int i=0;i<p->getpos()+1;i++)gui.MemoStr(MEMO_DBGLOG,p->line(i),i);
|
||||
|
||||
gui.PanelEffective(PANEL_DBGLOG);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ScrDbgLogGetMax()
|
||||
{
|
||||
return LOG_MAX;
|
||||
}
|
||||
|
||||
|
||||
void scr_Draw()
|
||||
{
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void scr_GetEvnt()
|
||||
{
|
||||
// gui.thUpdate();
|
||||
}
|
||||
|
||||
|
||||
115
tags/0thNUP_Secure/CardSaveDataMover/body/source/screen/screen.h
Normal file
115
tags/0thNUP_Secure/CardSaveDataMover/body/source/screen/screen.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef SCREEN_H_
|
||||
#define SCREEN_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <nn/types.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
//パネルのID
|
||||
enum {
|
||||
EVNT_NONE,
|
||||
EVNT_YES,
|
||||
EVNT_NO,
|
||||
EVNT_QUIT,
|
||||
EVNT_PUSH_A,
|
||||
EVNT_PUSH_B,
|
||||
EVNT_PUSH_R,
|
||||
EVNT_PUSH_L,
|
||||
EVNT_PUSH_X,
|
||||
EVNT_PUSH_Y,
|
||||
EVNT_PUSH_LEFT_X,
|
||||
EVNT_PUSH_DOWN_Y,
|
||||
EVNT_SEL_READ,
|
||||
EVNT_SEL_WRITE,
|
||||
EVNT_SEL_END,
|
||||
EVNT_ERROR,
|
||||
EVNT_FATAL
|
||||
};
|
||||
|
||||
typedef struct{
|
||||
char *str;
|
||||
eColor color;
|
||||
u8 pad[3];
|
||||
}tColStr;
|
||||
|
||||
|
||||
#define LST_MAX 30
|
||||
#define LST_LENGTH 128
|
||||
class cStrLst {
|
||||
private:
|
||||
int pos;
|
||||
int buttom;
|
||||
char str[LST_MAX][LST_LENGTH];
|
||||
public:
|
||||
cStrLst():pos(0){};
|
||||
void add(char *p){
|
||||
if (pos>=LST_MAX)return;
|
||||
//char *s = &str[pos][0];
|
||||
int i;
|
||||
if (pos == buttom)
|
||||
{
|
||||
i =0;
|
||||
while(i < buttom){ strcpy(str[i],str[i+1]);i++;}
|
||||
}else pos++;
|
||||
i=0;
|
||||
while(i < (LST_LENGTH-1)){ //オーバーロード対策
|
||||
if (p[i]!=0){
|
||||
str[pos][i] = p[i];
|
||||
i++;
|
||||
}else break;
|
||||
}
|
||||
str[pos][i] = 0;
|
||||
//strcpy(str[pos],p);
|
||||
//for (i =0;i<LST_LENGTH;i++){
|
||||
// s[i]=p[i];
|
||||
// if (p[i] ==0) return;
|
||||
//}
|
||||
};
|
||||
void clr(){pos = 0;for (int i =0;i<LST_MAX;i++)str[i][0]=0;};
|
||||
u16 getpos(){return pos;};
|
||||
char* line(u16 ln){return &str[ln][0];};
|
||||
bool setbuttom(int btm)
|
||||
{
|
||||
if ((btm<0)||(btm>=LST_MAX))return false;
|
||||
buttom = btm;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Topメニューでのエラー表示用のフラグ
|
||||
//bitチェック
|
||||
#define SDATA_ERRPUT_PCODE 1
|
||||
#define SDATA_ERRPUT_MEDIA 2
|
||||
#define SDATA_ERRPUT_VERIFI 4
|
||||
|
||||
|
||||
bool ScrInitialize(uptr heap,u32 size);
|
||||
void ScrFinalize();
|
||||
void ScrClr();
|
||||
int ScrDbgLogGetMax();
|
||||
void ScrStep();
|
||||
void scr_TopMenuDbg(bool formatted,bool insertted);
|
||||
void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool sdins,int err);
|
||||
void scr_ErrorQuitDbg(tColStr **s);
|
||||
void scr_SuccessQuitDbg(tColStr **s);
|
||||
void scr_ConfirmDbg(char *str);
|
||||
void scr_DgbLog(cStrLst *p);
|
||||
void scr_BackupYesNo();
|
||||
void scr_Backup();
|
||||
void scr_RestoreYesNo();
|
||||
void scr_Restore();
|
||||
void scr_InsExitQuit();
|
||||
void scr_Status(char *s,eColor col);
|
||||
void scr_ResultQuit(char *s,eColor col);
|
||||
void scr_CountPerMax(int ct,int max);
|
||||
void scr_CountPerMax2(int ct,int max,int total);
|
||||
void scr_PrdCode(char *s);
|
||||
void scr_PrdCodeEx(char *s);
|
||||
void scr_DelConf();
|
||||
void scr_MessOnCount2(char *str);
|
||||
void scr_Draw();
|
||||
void scr_GetEvnt();
|
||||
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,791 @@
|
||||
#include <nn.h>
|
||||
#include "screen.h"
|
||||
#include <stdio.h>
|
||||
#include "../my_defs.h"
|
||||
#include "../common/ver.h"
|
||||
|
||||
//todo: 初期仕様の名残の"SD"が関数や変数名
|
||||
// に残ってるので気になるなら掃除
|
||||
|
||||
Gui gui;
|
||||
u8 scr_evnt;
|
||||
|
||||
enum{
|
||||
//PANEL_END,
|
||||
PANEL_ERROR,
|
||||
PANEL_SUCCESS,
|
||||
PANEL_TOPMENU,
|
||||
PANEL_TITLE,
|
||||
PANEL_QUIT,
|
||||
PANEL_READ,
|
||||
PANEL_WRITE,
|
||||
PANEL_YES,
|
||||
PANEL_NO,
|
||||
PANEL_CONFIRM,
|
||||
PANEL_DELCONF,
|
||||
PANEL_MENU,
|
||||
PANEL_BKUP,
|
||||
PANEL_INSEXIT,
|
||||
PANEL_DBGLOG
|
||||
};
|
||||
|
||||
enum{
|
||||
MESSAGE_VERSION,
|
||||
MESSAGE_PRODUCT,
|
||||
MESSAGE_PRODUCT2,
|
||||
MESSAGE_ERROR_TITLE,
|
||||
MESSAGE_ERROR_INFO,
|
||||
MESSAGE_ERROR_INFO2,
|
||||
MESSAGE_ERROR_INFO3,
|
||||
MESSAGE_SUCCESS_TITLE,
|
||||
MESSAGE_SUCCESS_INFO,
|
||||
MESSAGE_SUCCESS_INFO2,
|
||||
MESSAGE_CONFIRM_TITLE,
|
||||
MESSAGE_CONFIRM_MSG,
|
||||
MESSAGE_DELCONF_TITLE,
|
||||
MESSAGE_DELCONF_MSG,
|
||||
MESSAGE_DELCONF_MSG2,
|
||||
MESSAGE_DELCONF_MSG3,
|
||||
//MESSAGE_TOPMENU_HELP_TITLE,
|
||||
MESSAGE_TOPMENU_HELP_READ,
|
||||
MESSAGE_TOPMENU_HELP_WRITE,
|
||||
MESSAGE_TOPMENU_HELP_END,
|
||||
MESSAGE_TOPMENU_HELP_OPERATE,
|
||||
MESSAGE_TITLE,
|
||||
MESSAGE_MENU_READ,
|
||||
MESSAGE_MENU_WRITE,
|
||||
//MESSAGE_MENU_END,
|
||||
MESSAGE_MENU_OPERATE,
|
||||
MESSAGE_MENU_CAUTION,
|
||||
MESSAGE_MENU_ERROR,
|
||||
MESSAGE_MENU_DEBUG,
|
||||
MESSAGE_INSEXT_1,
|
||||
MESSAGE_INSEXT_2,
|
||||
MESSAGE_INSEXT_3,
|
||||
MESSAGE_OPERATE,
|
||||
MESSAGE_RESULT,
|
||||
MESSAGE_QUIT_OPERATE,
|
||||
MESSAGE_CONF,
|
||||
MESSAGE_COUNT,
|
||||
MESSAGE_COUNT2,
|
||||
MESSAGE_STATUS
|
||||
};
|
||||
|
||||
enum{
|
||||
MEMO_DBGLOG
|
||||
};
|
||||
|
||||
|
||||
//画面消去、コンポーネントをディセーブル
|
||||
void ScrClr()
|
||||
{
|
||||
gui.ButtonMask(0);
|
||||
gui.DisableAll();
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------イベントコールバック
|
||||
//----------------PADボタン
|
||||
void pushButton(u32 button)
|
||||
{
|
||||
//NN_LOG("button > %4x\n",button);
|
||||
if (button & nn::hid::BUTTON_LEFT)//同時押し
|
||||
{
|
||||
if (button & nn::hid::BUTTON_X)
|
||||
scr_evnt = EVNT_PUSH_LEFT_X;
|
||||
}
|
||||
#ifdef DEBUG_ENABLE
|
||||
else if (button & nn::hid::BUTTON_DOWN)//同時押し
|
||||
{
|
||||
if (button & nn::hid::BUTTON_Y)
|
||||
if (button & nn::hid::BUTTON_X)
|
||||
scr_evnt = EVNT_PUSH_DOWN_Y;
|
||||
}
|
||||
else if (button & nn::hid::BUTTON_R)scr_evnt = EVNT_PUSH_R;
|
||||
else if (button & nn::hid::BUTTON_L)scr_evnt = EVNT_PUSH_L;
|
||||
#endif
|
||||
#ifdef ENABLE_CRUSH
|
||||
else if (button & nn::hid::BUTTON_Y)scr_evnt = EVNT_PUSH_Y;
|
||||
#endif
|
||||
else if (button & nn::hid::BUTTON_B)scr_evnt = EVNT_PUSH_B;
|
||||
}
|
||||
|
||||
//-----------------パネルをタッチ
|
||||
// ---- Top Menu :READ
|
||||
void touchRead(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_SEL_READ;
|
||||
}
|
||||
// ---- Top Menu :WRITE
|
||||
void touchWrite(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_SEL_WRITE;
|
||||
}
|
||||
|
||||
//---- Top Menu :END
|
||||
//void touchEnd(u32 pos NN_IS_UNUSED_VAR)
|
||||
//{
|
||||
// scr_evnt = EVNT_SEL_END;
|
||||
//}
|
||||
|
||||
//---- YES
|
||||
void touchYes(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_YES;
|
||||
}
|
||||
|
||||
//---- NO
|
||||
void touchNo(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_NO;
|
||||
}
|
||||
|
||||
void touchQuit(u32 pos NN_IS_UNUSED_VAR)
|
||||
{
|
||||
scr_evnt = EVNT_QUIT;
|
||||
}
|
||||
|
||||
#define NULL_PTR 0
|
||||
#define NULL_STR 0
|
||||
#define SCREEN_UPPER 0
|
||||
#define SCREEN_LOWER 1
|
||||
#define LOC_CONF_X 60
|
||||
#define LOC_CONF_Y 20
|
||||
#define LOC_CONF_W (400 - LOC_CONF_X*2)
|
||||
#define LOC_CONF_H 70
|
||||
#define LOC_LOG_X 50
|
||||
#define LOC_LOG_W (400 - LOC_LOG_X*2)
|
||||
#define LOC_LOG_Y (LOC_CONF_Y + LOC_CONF_H + 10)
|
||||
#define LOC_LOG_H (240 - LOC_LOG_Y - 10)
|
||||
#define LOG_MAX 10
|
||||
|
||||
// -------------------------------------------------- コンポーネント設計
|
||||
//下画面
|
||||
|
||||
//Top Menu
|
||||
const tPanel panel_Read = {(uptr)touchRead,"Backup",80,30,160,60,PANEL_READ,SCREEN_LOWER};
|
||||
const tPanel panel_Write = {(uptr)touchWrite,"Restore",80,150,160,60,PANEL_WRITE,SCREEN_LOWER};
|
||||
//const tPanel panel_End = {(uptr)touchEnd,"End",80,180,160,30,PANEL_END,SCREEN_LOWER};
|
||||
|
||||
//Yes No
|
||||
const tPanel panel_Yes = {(uptr)touchYes,"YES",40,60,80,120,PANEL_YES,SCREEN_LOWER};
|
||||
const tPanel panel_No = {(uptr)touchNo,"NO",200,60,80,120,PANEL_NO,SCREEN_LOWER};
|
||||
|
||||
//Quit
|
||||
const tPanel panel_Quit = {(uptr)touchQuit,"Quit",80,60,160,120,PANEL_QUIT,SCREEN_LOWER};
|
||||
|
||||
//上画面
|
||||
//デバグ用
|
||||
//エラー表示
|
||||
const tPanel panel_Error = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_ERROR,SCREEN_UPPER};
|
||||
const tMessage mess_Title_Err = {"title",10,10,COLOR_RED,8,MESSAGE_ERROR_TITLE,PANEL_ERROR};
|
||||
const tMessage mess_Info_Err = {"info",10,22,COLOR_RED,8,MESSAGE_ERROR_INFO,PANEL_ERROR};
|
||||
const tMessage mess_Info2_Err = {"info2",10,40,COLOR_RED,8,MESSAGE_ERROR_INFO2,PANEL_ERROR};
|
||||
const tMessage mess_Info3_Err = {"info3",10,50,COLOR_RED,8,MESSAGE_ERROR_INFO3,PANEL_ERROR};
|
||||
|
||||
//成功
|
||||
const tPanel panel_Success = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_SUCCESS,SCREEN_UPPER};
|
||||
const tMessage mess_Title_Suc = {"title",10,10,COLOR_GREEN,8,MESSAGE_SUCCESS_TITLE,PANEL_SUCCESS};
|
||||
const tMessage mess_Info_Suc = {"info",10,40,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO,PANEL_SUCCESS};
|
||||
const tMessage mess_Info2_Suc = {"info2",10,50,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO2,PANEL_SUCCESS};
|
||||
|
||||
//実行確認
|
||||
const tPanel panel_Confirm = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_CONFIRM,SCREEN_UPPER};
|
||||
const tMessage mess_conf_Title = {"title",10,10,COLOR_YELLO,8,MESSAGE_CONFIRM_TITLE,PANEL_CONFIRM};
|
||||
const tMessage mess_conf_Msg = {"Do you execute?",10,40,COLOR_WHITE,8,MESSAGE_CONFIRM_MSG,PANEL_CONFIRM};
|
||||
|
||||
//トップメニュー
|
||||
const tPanel panel_topmenu_help = {NULL_PTR,NULL_STR,LOC_CONF_X,LOC_CONF_Y,LOC_CONF_W,LOC_CONF_H,PANEL_TOPMENU,SCREEN_UPPER};
|
||||
const tMessage mess_topmenu_help_read = {"[Backup] Card -> bkup",10,4,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_notread = {"[Backup] is Invalid",10,4,COLOR_RED,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_write = {"[Restore] bkup -> Card",10,16,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_notwrite = {"[Restore] is Invalid",10,16,COLOR_RED,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_end = {"[End] return to SystemMenu",10,28,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_END,PANEL_TOPMENU};
|
||||
const tMessage mess_topmenu_help_operate = {"touch below",10,48,COLOR_GREEN,8,MESSAGE_TOPMENU_HELP_OPERATE,PANEL_TOPMENU};
|
||||
|
||||
//ログ表示
|
||||
const tPanel panel_dbglog = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_DBGLOG,SCREEN_UPPER};
|
||||
const tMemo memo_dbglog = {LOG_MAX,10,10,COLOR_WHITE,8,MEMO_DBGLOG,PANEL_DBGLOG};
|
||||
|
||||
|
||||
//通常時
|
||||
//タイトル
|
||||
#define FONT_SIZE_TITLE 12
|
||||
#define LOC_TITL_X (40-FONT_SIZE_TITLE*2)
|
||||
#define LOC_TITL_Y 20
|
||||
#define LOC_TITL_W (400 - LOC_CONF_X*2)
|
||||
#define LOC_TITL_H 50
|
||||
#define FONT_SIZE_PRODUCT 10
|
||||
const tPanel panel_title = {NULL_PTR,NULL_STR,LOC_TITL_X,LOC_TITL_Y,LOC_TITL_W,LOC_TITL_H,PANEL_TITLE,SCREEN_UPPER};
|
||||
const tMessage mess_title = {"title",0,0,COLOR_WHITE,FONT_SIZE_TITLE,MESSAGE_TITLE,PANEL_TITLE};
|
||||
const tMessage mess_product = {"product",0,LOC_TITL_H - 20,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT,PANEL_TITLE};
|
||||
const tMessage mess_product2 = {"product2",0,LOC_TITL_H - 10,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT2,PANEL_TITLE};
|
||||
const tMessage mess_version = {"version",LOC_TITL_W-FONT_SIZE_PRODUCT*6,FONT_SIZE_TITLE+2,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_VERSION,PANEL_TITLE};
|
||||
|
||||
#define LOC_MESS_X 20
|
||||
#define LOC_MESS_W (400 - LOC_MESS_X*2)
|
||||
#define LOC_MESS_Y (LOC_TITL_Y + LOC_TITL_H + 10)
|
||||
#define LOC_MESS_H (240 - LOC_MESS_Y - 10)
|
||||
//TOPメニュー
|
||||
//情報表示はログと排他
|
||||
#define FONT_SIZE 10
|
||||
#define STR_LINE(ln) (FONT_SIZE + 2)*ln
|
||||
const tPanel panel_menu = {NULL_PTR,NULL_STR,LOC_MESS_X,LOC_MESS_Y,LOC_MESS_W,LOC_MESS_H,PANEL_MENU,SCREEN_UPPER};
|
||||
const tMessage mess_menu_read = {"[Backup] Card savedata Backup",10,STR_LINE(1),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_READ,PANEL_MENU};
|
||||
const tMessage mess_menu_write = {"[Restore] restore to Card",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_WRITE,PANEL_MENU};
|
||||
//const tMessage mess_menu_end = {"[End] close this apprication",10,STR_LINE(3),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_END,PANEL_MENU};
|
||||
const tMessage mess_menu_operate = {"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_MENU_OPERATE,PANEL_MENU};
|
||||
const tMessage mess_sderr = {"Backup error",10,STR_LINE(6),COLOR_RED,FONT_SIZE,MESSAGE_MENU_ERROR,PANEL_MENU};
|
||||
const tMessage mess_carderr = {"CARD error",10,STR_LINE(7),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_CAUTION,PANEL_MENU};
|
||||
const tMessage mess_debug = {"Crush Mode",10,STR_LINE(3),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_DEBUG,PANEL_MENU};
|
||||
|
||||
//Backup
|
||||
const tPanel panel_bkup = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_BKUP,SCREEN_UPPER};
|
||||
const tMessage mess_quit_operate = {"touch [Quit],or Push B",10,STR_LINE(4),COLOR_SKY,FONT_SIZE,MESSAGE_QUIT_OPERATE,PANEL_BKUP};
|
||||
const tMessage mess_conf = {"Do you execute?",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_CONF,PANEL_BKUP};
|
||||
const tMessage mess_result = {"result",10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_RESULT,PANEL_BKUP};
|
||||
const tMessage mess_operate = {"touch below",10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_OPERATE,PANEL_BKUP};
|
||||
const tMessage mess_status = {"status",10,STR_LINE(7),COLOR_WHITE,FONT_SIZE,MESSAGE_STATUS,PANEL_BKUP};
|
||||
const tMessage mess_count = {"count",10,STR_LINE(8),COLOR_WHITE,FONT_SIZE,MESSAGE_COUNT,PANEL_BKUP};
|
||||
const tMessage mess_count2 = {"count2",10,STR_LINE(9),COLOR_GREEN,FONT_SIZE,MESSAGE_COUNT2,PANEL_BKUP};
|
||||
|
||||
|
||||
//挿抜発生時
|
||||
const tPanel panel_insexit = {NULL_PTR,NULL_STR,LOC_LOG_X,LOC_LOG_Y,LOC_LOG_W,LOC_LOG_H,PANEL_INSEXIT,SCREEN_UPPER};
|
||||
const tMessage mess_insexit = {"device insert or pull out is detected",10,STR_LINE(3),COLOR_RED,8,MESSAGE_INSEXT_1,PANEL_INSEXIT};
|
||||
const tMessage mess_insexit2 = {"return to top menu",10,STR_LINE(5),COLOR_WHITE,8,MESSAGE_INSEXT_2,PANEL_INSEXIT};
|
||||
const tMessage mess_insexit3 = {"please touch or push B",10,STR_LINE(6),COLOR_WHITE,8,MESSAGE_INSEXT_3,PANEL_INSEXIT};
|
||||
|
||||
//削除確認
|
||||
const tPanel panel_delconf = {NULL_PTR,NULL_STR,LOC_CONF_X-10,LOC_CONF_Y,LOC_CONF_W+10,LOC_CONF_H*2,PANEL_DELCONF,SCREEN_UPPER};
|
||||
const tMessage mess_delconf_Title = {" *** DELETE *** ",10,10,COLOR_YELLO,16,MESSAGE_DELCONF_TITLE,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg = {" caution!",10,50,COLOR_YELLO,12,MESSAGE_DELCONF_MSG,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg2 = {"this is delete backup",10,70,COLOR_YELLO,12,MESSAGE_DELCONF_MSG2,PANEL_DELCONF};
|
||||
const tMessage mess_delconf_Msg3 = {"Do you execute?",10,90,COLOR_YELLO,12,MESSAGE_DELCONF_MSG3,PANEL_DELCONF};
|
||||
|
||||
|
||||
|
||||
nn::os::LightEvent stopEvnt(true);
|
||||
|
||||
char scr_ver[16];
|
||||
char scr_err[32];
|
||||
char scr_debug[32];
|
||||
//menu
|
||||
bool ScrInitialize(uptr heap,u32 size)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
|
||||
if (gui.Initialize(heap,size,&stopEvnt)==false)return false;
|
||||
|
||||
|
||||
gui.ButtonCallback((uptr)pushButton);
|
||||
//コンポーネント登録
|
||||
gui.PanelSet(&panel_Read);
|
||||
gui.PanelSet(&panel_Write);
|
||||
// gui.PanelSet(&panel_End);
|
||||
gui.PanelSet(&panel_Yes);
|
||||
gui.PanelSet(&panel_No);
|
||||
gui.PanelSet(&panel_Quit);
|
||||
gui.PanelSet(&panel_Error);
|
||||
gui.PanelSet(&panel_Success);
|
||||
gui.PanelSet(&panel_Confirm);
|
||||
gui.PanelSet(&panel_delconf);
|
||||
gui.PanelSet(&panel_topmenu_help);
|
||||
gui.PanelSet(&panel_title);
|
||||
gui.PanelSet(&panel_menu);
|
||||
gui.PanelSet(&panel_bkup);
|
||||
gui.PanelSet(&panel_dbglog);
|
||||
gui.PanelSet(&panel_insexit);
|
||||
|
||||
gui.PanelLineStyle(PANEL_TITLE,COLOR_BLACK);
|
||||
|
||||
|
||||
gui.MessSet(&mess_Title_Err);
|
||||
gui.MessSet(&mess_Info_Err);
|
||||
gui.MessSet(&mess_Info2_Err);
|
||||
gui.MessSet(&mess_Info3_Err);
|
||||
gui.MessSet(&mess_Title_Suc);
|
||||
gui.MessSet(&mess_Info_Suc);
|
||||
gui.MessSet(&mess_Info2_Suc);
|
||||
gui.MessSet(&mess_conf_Title);
|
||||
gui.MessSet(&mess_conf_Msg);
|
||||
gui.MessSet(&mess_delconf_Title);
|
||||
gui.MessSet(&mess_delconf_Msg);
|
||||
gui.MessSet(&mess_delconf_Msg2);
|
||||
gui.MessSet(&mess_delconf_Msg3);
|
||||
|
||||
gui.MessSet(&mess_topmenu_help_read);
|
||||
gui.MessSet(&mess_topmenu_help_write);
|
||||
gui.MessSet(&mess_topmenu_help_end);
|
||||
gui.MessSet(&mess_topmenu_help_operate);
|
||||
|
||||
gui.MessSet(&mess_title);
|
||||
gui.MessSet(&mess_version);
|
||||
gui.MessSet(&mess_product);
|
||||
gui.MessSet(&mess_product2);
|
||||
gui.MessSet(&mess_menu_read);
|
||||
gui.MessSet(&mess_menu_write);
|
||||
// gui.MessSet(&mess_menu_end);
|
||||
gui.MessSet(&mess_menu_operate);
|
||||
gui.MessSet(&mess_quit_operate);
|
||||
gui.MessSet(&mess_conf);
|
||||
gui.MessSet(&mess_operate);
|
||||
gui.MessSet(&mess_sderr);
|
||||
gui.MessSet(&mess_carderr);
|
||||
gui.MessSet(&mess_debug);
|
||||
gui.MessSet(&mess_result);
|
||||
gui.MessSet(&mess_status);
|
||||
gui.MessSet(&mess_count);
|
||||
gui.MessSet(&mess_count2);
|
||||
|
||||
gui.MessSet(&mess_insexit);
|
||||
gui.MessSet(&mess_insexit2);
|
||||
gui.MessSet(&mess_insexit3);
|
||||
|
||||
gui.MemoSet(&memo_dbglog);
|
||||
|
||||
gui.MemoEffective(MESSAGE_PRODUCT);
|
||||
gui.MessEffective(MESSAGE_ERROR_TITLE);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO2);
|
||||
gui.MessEffective(MESSAGE_ERROR_INFO3);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_TITLE);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_INFO);
|
||||
gui.MessEffective(MESSAGE_SUCCESS_INFO2);
|
||||
gui.MessEffective(MESSAGE_CONFIRM_TITLE);
|
||||
gui.MessEffective(MESSAGE_CONFIRM_MSG);
|
||||
gui.MessEffective(MESSAGE_DELCONF_TITLE);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG2);
|
||||
gui.MessEffective(MESSAGE_DELCONF_MSG3);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_READ);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_END);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_OPERATE);
|
||||
gui.MessEffective(MESSAGE_MENU_READ);
|
||||
gui.MessEffective(MESSAGE_MENU_WRITE);
|
||||
// gui.MessEffective(MESSAGE_MENU_END);
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.MessEffective(MESSAGE_INSEXT_1);
|
||||
gui.MessEffective(MESSAGE_INSEXT_2);
|
||||
gui.MessEffective(MESSAGE_INSEXT_3);
|
||||
gui.MessEffective(MESSAGE_TITLE);
|
||||
gui.MessEffective(MESSAGE_VERSION);
|
||||
gui.MemoEffective(MEMO_DBGLOG);
|
||||
|
||||
gui.PanelLineStyle(PANEL_DELCONF,COLOR_YELLO);
|
||||
|
||||
sprintf(scr_ver,"ver %.2f",VERSION);
|
||||
gui.MessStr(MESSAGE_VERSION,scr_ver);
|
||||
gui.MessStr(MESSAGE_MENU_CAUTION,scr_err);
|
||||
gui.MessStr(MESSAGE_MENU_ERROR,scr_err);
|
||||
gui.MessStr(MESSAGE_MENU_DEBUG,scr_debug);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void ScrFinalize()
|
||||
{
|
||||
stopEvnt.Signal();
|
||||
while(stopEvnt.TryWait()){
|
||||
nn::os::Thread::Yield();
|
||||
|
||||
};
|
||||
gui.Finalize();
|
||||
}
|
||||
|
||||
//YES-NO ボタン
|
||||
void YesNo()
|
||||
{
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B);
|
||||
gui.PanelEffective(PANEL_YES);
|
||||
gui.PanelEffective(PANEL_NO);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void Quit()
|
||||
{
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_B);
|
||||
gui.PanelEffective(PANEL_QUIT);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//トップメニュー画面
|
||||
//引数:カード状態
|
||||
void scr_TopMenuDbg(bool formatted,bool insertted)//デバッグ用
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_R | nn::hid::BUTTON_L);
|
||||
|
||||
if (formatted)
|
||||
{//リード可能
|
||||
gui.MessSet(&mess_topmenu_help_read);
|
||||
gui.PanelEffective(PANEL_READ);
|
||||
}else{//リード不可
|
||||
gui.MessSet(&mess_topmenu_help_notread);
|
||||
gui.PanelEffective(PANEL_READ,false);
|
||||
}
|
||||
if (insertted)
|
||||
{//書き込み可
|
||||
gui.MessSet(&mess_topmenu_help_write);
|
||||
gui.PanelEffective(PANEL_WRITE);
|
||||
}else{//書き込み不可
|
||||
gui.MessSet(&mess_topmenu_help_notwrite);
|
||||
gui.PanelEffective(PANEL_WRITE,false);
|
||||
}
|
||||
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_READ);
|
||||
gui.MessEffective(MESSAGE_TOPMENU_HELP_WRITE);
|
||||
// gui.PanelEffective(PANEL_END);
|
||||
gui.PanelEffective(PANEL_TOPMENU);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//通常時
|
||||
|
||||
//プロダクトコード
|
||||
//引数:カード、拡張セーブに記録されたもの
|
||||
char scr_pcode[32];
|
||||
void scr_PrdCode(char *s)
|
||||
{
|
||||
strcpy(scr_pcode,"CARD : ");
|
||||
if (s[0]==0) strcat(scr_pcode,"----");
|
||||
else strcat(scr_pcode,s);
|
||||
gui.MessStr(MESSAGE_PRODUCT,scr_pcode);
|
||||
}
|
||||
|
||||
char scr_pcode2[64];
|
||||
void scr_PrdCodeEx(char *s)
|
||||
{
|
||||
strcpy(scr_pcode2,"BKUP : ");
|
||||
if (s[0]==0) strcat(scr_pcode2,"----");
|
||||
else strcat(scr_pcode2,s);
|
||||
gui.MessStr(MESSAGE_PRODUCT2,scr_pcode2);
|
||||
}
|
||||
|
||||
//削除の実行確認
|
||||
void scr_DelConf()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelEffective(PANEL_DELCONF);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
//Top menu
|
||||
//引数:デバイス状態
|
||||
//arg : プロダクトコード一致
|
||||
void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool sdins,int err)
|
||||
{
|
||||
|
||||
int i;
|
||||
scr_evnt = EVNT_NONE;
|
||||
//gui.ButtonMask(nn::hid::BUTTON_A | nn::hid::BUTTON_L nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);
|
||||
|
||||
#ifdef ENABLE_CRUSH
|
||||
extern bool CrashForDebug;
|
||||
//デバグ用 Y-> クラッシュモード,L -> デバグモード
|
||||
gui.ButtonMask(nn::hid::BUTTON_Y | nn::hid::BUTTON_L | nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);
|
||||
if (CrashForDebug==0) gui.MessEffective(MESSAGE_MENU_DEBUG,false,false);
|
||||
else{
|
||||
sprintf(scr_debug,"Crush mode %d",CrashForDebug);
|
||||
gui.MessEffective(MESSAGE_MENU_DEBUG);
|
||||
}
|
||||
#else//DOWN+Y = debug
|
||||
gui.ButtonMask( nn::hid::BUTTON_DOWN | nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X | nn::hid::BUTTON_Y);
|
||||
#endif
|
||||
|
||||
//gui.PanelLineStyle(PANEL_MENU,COLOR_WHITE);
|
||||
//gui.PanelLineStyle(PANEL_TITLE,COLOR_BLACK);
|
||||
gui.MessStr(MESSAGE_TITLE," < CTR Card Savedata Mover >");
|
||||
//bool flg = formatted && sdins;
|
||||
// gui.PanelEffective(PANEL_READ,flg,flg);//savedata & SD exist
|
||||
//bool flg2= inserted && exfm;
|
||||
// gui.PanelEffective(PANEL_WRITE,flg2,flg2);//CARD & exsave exist
|
||||
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR,false,false);
|
||||
gui.MessEffective(MESSAGE_MENU_CAUTION,false,false);
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE,false,false);
|
||||
//片方のみ有効
|
||||
if (formatted && sdins && (exfm == false))
|
||||
{//バックアップ
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.PanelEffective(PANEL_READ);
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
}else if (exfm && inserted)
|
||||
{//リストア
|
||||
gui.PanelEffective(PANEL_READ,false,false);
|
||||
i =0;
|
||||
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//バックアップがない
|
||||
else
|
||||
if (err & SDATA_ERRPUT_PCODE) i = ERC_DEV_OTHER + ERC_PRODCODE;//プロダクトコード不一致
|
||||
if (i !=0 )
|
||||
{
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
sprintf(scr_err,"ERROR %d",i);
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR);
|
||||
}
|
||||
else{
|
||||
gui.MessEffective(MESSAGE_MENU_OPERATE);
|
||||
gui.PanelEffective(PANEL_WRITE);
|
||||
}
|
||||
}else{//なし
|
||||
gui.PanelEffective(PANEL_WRITE,false,false);
|
||||
gui.PanelEffective(PANEL_READ,false,false);
|
||||
|
||||
//if (inserted == false) i = ERC_DEVICE + ERC_DEV_CARD;//カードが無い
|
||||
//else
|
||||
if (inserted == false)
|
||||
{
|
||||
strcpy(scr_err,"Please Insert Card");
|
||||
gui.MessEffective(MESSAGE_MENU_CAUTION);
|
||||
|
||||
}else{
|
||||
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//バックアップがない
|
||||
else
|
||||
if (err & SDATA_ERRPUT_VERIFI) i = ERC_SDK_VERIFI + ERC_DEV_CARD;//データが壊れている
|
||||
else if (sdins == false) i = ERC_DEVICE + ERC_DEV_OUT;//書出し先デバイスが無い
|
||||
else i = ERC_FORMAT + ERC_DEV_CARD;//フォーマットエラー
|
||||
sprintf(scr_err,"ERROR %d",i);
|
||||
gui.MessEffective(MESSAGE_MENU_ERROR);
|
||||
}
|
||||
//}else if ((flg ==false) || (flg2 == false))
|
||||
//{//どっちかダメ
|
||||
// if (formatted == false) i = ERC_FORMAT + ERC_DEV_CARD;//カード未フオーマット
|
||||
// else i = ERC_FORMAT + ERC_DEV_OUT;//バックアップ先が未フオーマット
|
||||
// sprintf(scr_err,"CAUTION %d",i);
|
||||
// gui.MessEffective(MESSAGE_MENU_CAUTION);
|
||||
//}else if(agr==false)
|
||||
}
|
||||
|
||||
|
||||
gui.MessEffective(MESSAGE_PRODUCT);
|
||||
gui.MessEffective(MESSAGE_PRODUCT2);
|
||||
|
||||
/*
|
||||
eColor col;
|
||||
if ((flg == false) && (flg2 == false))col = COLOR_RED;
|
||||
else if ((flg == false) || (flg2 == false))col = COLOR_YELLO;
|
||||
if (formatted) gui.MessEffective(MESSAGE_MENU_CARDERR,false,false);
|
||||
else{
|
||||
gui.MessCol(MESSAGE_MENU_CARDERR,col);
|
||||
if (inserted) gui.MessStr(MESSAGE_MENU_CARDERR,"savedata is not format or broken");
|
||||
else gui.MessStr(MESSAGE_MENU_CARDERR,"CARD is not found");
|
||||
gui.MessEffective(MESSAGE_MENU_CARDERR);
|
||||
}
|
||||
if (exfm) gui.MessEffective(MESSAGE_MENU_SDERR,false,false);
|
||||
else{
|
||||
gui.MessCol(MESSAGE_MENU_SDERR,col);
|
||||
if (sdins) gui.MessStr(MESSAGE_MENU_SDERR,"backup data is not in SD");
|
||||
else gui.MessStr(MESSAGE_MENU_SDERR,"SD is not found");
|
||||
gui.MessEffective(MESSAGE_MENU_SDERR);
|
||||
}
|
||||
*/
|
||||
// gui.PanelEffective(PANEL_END);
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
gui.PanelEffective(PANEL_MENU);
|
||||
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//デバッグ用、ボタン待ち
|
||||
void ScrStep()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.ButtonMask(nn::hid::BUTTON_B);
|
||||
}
|
||||
|
||||
|
||||
void ClearBkupMess()
|
||||
{
|
||||
gui.MessEffective(MESSAGE_CONF,false,false);
|
||||
gui.MessEffective(MESSAGE_RESULT,false,false);
|
||||
gui.MessEffective(MESSAGE_OPERATE,false,false);
|
||||
gui.MessEffective(MESSAGE_QUIT_OPERATE,false,false);
|
||||
gui.MessEffective(MESSAGE_STATUS,false,false);
|
||||
gui.MessEffective(MESSAGE_COUNT,false,false);
|
||||
gui.MessEffective(MESSAGE_COUNT2,false,false);
|
||||
gui.PanelEffective(PANEL_BKUP);
|
||||
}
|
||||
|
||||
//Backup
|
||||
void scr_Backup()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelLineStyle(PANEL_BKUP,COLOR_SKY);
|
||||
gui.MessStr(MESSAGE_TITLE," --- Backup Card Savedata ---");
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
ClearBkupMess();
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
void scr_BackupYesNo()
|
||||
{
|
||||
scr_Backup();
|
||||
gui.MessEffective(MESSAGE_CONF);
|
||||
gui.MessEffective(MESSAGE_OPERATE);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
//restore
|
||||
void scr_Restore()
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.PanelLineStyle(PANEL_BKUP,COLOR_PARPL);
|
||||
gui.MessStr(MESSAGE_TITLE,"--- Restore Card Savedata ---");
|
||||
gui.PanelEffective(PANEL_TITLE);
|
||||
ClearBkupMess();//backupと同じパネルを使う
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
void scr_RestoreYesNo()
|
||||
{
|
||||
scr_Restore();
|
||||
gui.MessEffective(MESSAGE_CONF);
|
||||
gui.MessEffective(MESSAGE_OPERATE);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
void scr_Status(char *s,eColor col)
|
||||
{
|
||||
gui.MessCol(MESSAGE_STATUS,col);
|
||||
gui.MessStr(MESSAGE_STATUS,s);
|
||||
gui.MessEffective(MESSAGE_STATUS);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void scr_ResultQuit(char *s,eColor col)
|
||||
{
|
||||
gui.MessCol(MESSAGE_RESULT,col);
|
||||
gui.MessStr(MESSAGE_RESULT,s);
|
||||
gui.MessEffective(MESSAGE_RESULT);
|
||||
gui.MessEffective(MESSAGE_QUIT_OPERATE);
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
void scr_InsExitQuit()
|
||||
{
|
||||
ClearBkupMess();
|
||||
gui.PanelLineStyle(PANEL_INSEXIT,COLOR_RED);
|
||||
gui.PanelEffective(PANEL_INSEXIT);
|
||||
Quit();
|
||||
}
|
||||
|
||||
// カウント/MAX 表示
|
||||
char str_Counter[128];
|
||||
char str_Counter2[128];
|
||||
void scr_CountPerMax(int ct,int max)
|
||||
{
|
||||
sprintf(str_Counter,"%d / %d",ct,max);
|
||||
gui.MessStr(MESSAGE_COUNT,str_Counter);
|
||||
gui.MessEffective(MESSAGE_COUNT);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
//ゲージ&total
|
||||
void scr_CountPerMax2(int ct,int max,int total)
|
||||
{
|
||||
if (total == -1) str_Counter2[0]=0;
|
||||
else if (total != 0){
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_WHITE);
|
||||
sprintf(str_Counter2,"total size %d",total);
|
||||
}else{
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
|
||||
int i;
|
||||
int lv = ct/(max/25);
|
||||
for (i =0;i<lv;i++)str_Counter2[i] = '>';
|
||||
while ( i < 25 )str_Counter2[i++] = '|';
|
||||
str_Counter2[i] = 0;
|
||||
}
|
||||
//sprintf(str_Counter2,"%d / %d",ct,max);
|
||||
gui.MessStr(MESSAGE_COUNT2,str_Counter2);
|
||||
gui.MessEffective(MESSAGE_COUNT2);
|
||||
gui.Draw();
|
||||
|
||||
}
|
||||
|
||||
void scr_MessOnCount2(char *str)
|
||||
{
|
||||
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
|
||||
gui.MessStr(MESSAGE_COUNT2,str);
|
||||
gui.MessEffective(MESSAGE_COUNT2);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
//実行確認
|
||||
void scr_ConfirmDbg(char *str)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_CONFIRM_TITLE,str);
|
||||
gui.PanelEffective(PANEL_CONFIRM);
|
||||
YesNo();
|
||||
}
|
||||
|
||||
|
||||
//エラー表示とQuitボタン
|
||||
void scr_ErrorQuitDbg(tColStr **s)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_ERROR_TITLE,s[0]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_TITLE,s[0]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO,s[1]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO,s[1]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO2,s[2]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO2,s[2]->color);
|
||||
gui.MessStr(MESSAGE_ERROR_INFO3,s[3]->str);
|
||||
gui.MessCol(MESSAGE_ERROR_INFO3,s[3]->color);
|
||||
gui.PanelEffective(PANEL_ERROR);
|
||||
Quit();
|
||||
}
|
||||
|
||||
//成功表示とQuitボタン
|
||||
void scr_SuccessQuitDbg(tColStr **s)
|
||||
{
|
||||
scr_evnt = EVNT_NONE;
|
||||
gui.MessStr(MESSAGE_SUCCESS_TITLE,s[0]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_TITLE,s[0]->color);
|
||||
gui.MessStr(MESSAGE_SUCCESS_INFO,s[1]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_INFO,s[1]->color);
|
||||
gui.MessStr(MESSAGE_SUCCESS_INFO2,s[2]->str);
|
||||
gui.MessCol(MESSAGE_SUCCESS_INFO2,s[2]->color);
|
||||
gui.PanelEffective(PANEL_SUCCESS);
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
//デバッグログ
|
||||
void scr_DgbLog(cStrLst *p)
|
||||
{
|
||||
gui.PanelLineStyle(PANEL_DBGLOG,COLOR_BLUE);
|
||||
|
||||
for (int i=0;i<p->getpos()+1;i++)gui.MemoStr(MEMO_DBGLOG,p->line(i),i);
|
||||
|
||||
gui.PanelEffective(PANEL_DBGLOG);
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ScrDbgLogGetMax()
|
||||
{
|
||||
return LOG_MAX;
|
||||
}
|
||||
|
||||
|
||||
void scr_Draw()
|
||||
{
|
||||
gui.Draw();
|
||||
}
|
||||
|
||||
void scr_GetEvnt()
|
||||
{
|
||||
// gui.thUpdate();
|
||||
}
|
||||
|
||||
|
||||
187
tags/0thNUP_Secure/CardSaveDataMover/common/common.cpp
Normal file
187
tags/0thNUP_Secure/CardSaveDataMover/common/common.cpp
Normal file
@ -0,0 +1,187 @@
|
||||
#include <nn.h>
|
||||
#include <nn/applet.h>
|
||||
#include "common.h"
|
||||
#include "sleep.h"
|
||||
#include "demo.h"
|
||||
|
||||
|
||||
extern demo::RenderSystemDrawing s_RenderSystem;
|
||||
extern nn::fnd::ExpHeap appHeap;
|
||||
extern uptr heapForGx;
|
||||
|
||||
// ファイルシステム処理と遷移やスリープ処理との排他制御に利用
|
||||
//nn::os::CriticalSection g_SleepCS;
|
||||
// HOME ボタン遷移とファイルシステム処理の排他制御に利用(手動リセット)
|
||||
nn::os::LightEvent g_TransitionEvent;
|
||||
// スリープとファイルシステム処理の排他制御に利用(手動リセット)
|
||||
nn::os::LightEvent g_AwakeEvent;
|
||||
|
||||
void restoreGraphicSetting()
|
||||
{
|
||||
// GPU レジスタ設定の復帰
|
||||
// ただし、下記は DMPGL API を使用して設定した状態の復帰のみ
|
||||
// レジスタ設定コマンドは全て再発行するべき
|
||||
nngxUpdateState(NN_GX_STATE_ALL);
|
||||
nngxValidateState(NN_GX_STATE_ALL,GL_TRUE);
|
||||
}
|
||||
|
||||
FUNCP end_func;
|
||||
void InitSysBreak(uptr adrs){
|
||||
end_func = (FUNCP)adrs;
|
||||
|
||||
SleepHandler::Initialize();
|
||||
|
||||
//g_SleepCS.Initialize();
|
||||
g_AwakeEvent.Initialize(true);
|
||||
g_TransitionEvent.Initialize(true);
|
||||
|
||||
// 起床中は常に Signal 状態にしておく
|
||||
g_AwakeEvent.Signal();
|
||||
g_TransitionEvent.Signal();
|
||||
|
||||
// アプレットライブラリに関する機能を有効にする
|
||||
nn::applet::Enable(false);
|
||||
// gx, snd, dsp 各ライブラリの Initialize 関数は applet::Enable() の後に呼ばれなければならない
|
||||
// 特に、gx の初期化である nngxInitialize 関数は、Enable() 直後の終了判定の後に行われるべき
|
||||
|
||||
// ロゴ表示時に電源ボタンが押されたなど、既に終了条件が立っていた場合、ここでアプリを終了させる
|
||||
if ( nn::applet::IsExpectedToCloseApplication() )
|
||||
{
|
||||
SleepHandler::Finalize();
|
||||
nn::Result result = nn::applet::PrepareToCloseApplication();
|
||||
NN_UTIL_PANIC_IF_FAILED( result );
|
||||
nn::applet::CloseApplication();
|
||||
}
|
||||
// グラフィックスライブラリの初期化は、以降で行わなければならない
|
||||
// 他、アプリケーションの初期化処理
|
||||
|
||||
}
|
||||
|
||||
|
||||
//終了処理
|
||||
void finish()
|
||||
{
|
||||
|
||||
SleepHandler::Finalize();//SLEEP
|
||||
//g_SleepCS.Finalize();
|
||||
|
||||
(*end_func)();
|
||||
|
||||
g_AwakeEvent.Finalize();
|
||||
g_TransitionEvent.Finalize();
|
||||
|
||||
nn::fs::Finalize();
|
||||
|
||||
|
||||
appHeap.Free(reinterpret_cast<void*>(heapForGx));
|
||||
appHeap.Finalize();
|
||||
|
||||
nn::os::SetDeviceMemorySize(0);
|
||||
nn::os::SetHeapSize(0);
|
||||
|
||||
NN_LOG("End\n");
|
||||
nn::applet::PrepareToCloseApplication();
|
||||
nn::applet::CloseApplication();
|
||||
}
|
||||
|
||||
|
||||
void CheckSysBreak(){
|
||||
// スリープからの起床時は、1フレーム分の描画完了を待ってから LCD を有効にする
|
||||
if ( SleepHandler::s_IsAfterWakeUp ) {
|
||||
nn::gx::StartLcdDisplay();
|
||||
SleepHandler::s_IsAfterWakeUp = false;
|
||||
}
|
||||
|
||||
// GPU のレジスタ設定の整合性を考慮した場合、
|
||||
// 各種遷移、スリープ要求への返答は描画終了後に行うべき
|
||||
|
||||
// 本体スリープ判定
|
||||
if ( SleepHandler::IsSleepRequested() )
|
||||
{
|
||||
SleepHandler::SleepSystem();
|
||||
}
|
||||
|
||||
// 終了要求をチェック
|
||||
if ( nn::applet::IsExpectedToCloseApplication() )
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
// アプリケーションの遷移処理を行う
|
||||
|
||||
// HOMEボタン処理(グラフィックスライブラリが初期化済みでなければならない)
|
||||
if ( nn::applet::IsExpectedToProcessHomeButton() )
|
||||
{
|
||||
// ここでフラグなどを判定してブロックを抜けるようにすれば HOME ボタン禁止区間を実現できる
|
||||
// nn::applet::ClearHomeButtonState() による HOME ボタンフラグ削除も必要
|
||||
|
||||
g_TransitionEvent.ClearSignal();
|
||||
|
||||
// ファイルシステム処理中は遷移を待つ
|
||||
//if ( g_SleepCS.TryEnter() )
|
||||
{
|
||||
// スリープ要求を REJECT するように
|
||||
nn::applet::DisableSleep();
|
||||
|
||||
//nngxWaitCmdlistDone();
|
||||
nn::applet::ProcessHomeButton();
|
||||
nn::applet::AppletWakeupState wState = nn::applet::WaitForStarting();
|
||||
NN_UNUSED_VAR(wState);
|
||||
|
||||
//g_SleepCS.Leave();
|
||||
g_TransitionEvent.Signal();
|
||||
|
||||
// HOME メニューからの中断やバッテリー不足の要因により
|
||||
// アプリ終了と判断された場合、アプリのメインループを抜けて終了処理へ
|
||||
if ( nn::applet::IsExpectedToCloseApplication() )
|
||||
{
|
||||
// 描画権は渡されていない
|
||||
finish();
|
||||
}
|
||||
|
||||
nn::applet::EnableSleep(true);
|
||||
|
||||
// グラフィックの設定を戻す
|
||||
restoreGraphicSetting();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 電源ボタン処理(グラフィックスライブラリが初期化済みでなければならない)
|
||||
if ( nn::applet::IsExpectedToProcessPowerButton() )
|
||||
{
|
||||
g_TransitionEvent.ClearSignal();
|
||||
|
||||
// ファイルシステム処理中は遷移を待つ
|
||||
//if ( g_SleepCS.TryEnter() )
|
||||
{
|
||||
nn::applet::DisableSleep();
|
||||
//nngxWaitCmdlistDone();
|
||||
nn::applet::ProcessPowerButton();
|
||||
nn::applet::AppletWakeupState wState = nn::applet::WaitForStarting();
|
||||
|
||||
NN_UNUSED_VAR(wState);
|
||||
|
||||
//g_SleepCS.Leave();
|
||||
g_TransitionEvent.Signal();
|
||||
|
||||
// アプリ終了と判断された場合、アプリのメインループを抜けて終了処理へ
|
||||
if ( nn::applet::IsExpectedToCloseApplication() )
|
||||
{
|
||||
// 描画権は渡されていない
|
||||
finish();
|
||||
}
|
||||
|
||||
nn::applet::EnableSleep(true);
|
||||
|
||||
// グラフィックの設定を戻す
|
||||
restoreGraphicSetting();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
11
tags/0thNUP_Secure/CardSaveDataMover/common/common.h
Normal file
11
tags/0thNUP_Secure/CardSaveDataMover/common/common.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
|
||||
typedef void (*FUNCP)();
|
||||
|
||||
void finish();
|
||||
void CheckSysBreak();
|
||||
void InitSysBreak(uptr adrs);
|
||||
|
||||
|
||||
#endif
|
||||
368
tags/0thNUP_Secure/CardSaveDataMover/common/shfnt.cpp
Normal file
368
tags/0thNUP_Secure/CardSaveDataMover/common/shfnt.cpp
Normal file
@ -0,0 +1,368 @@
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/fs.h>
|
||||
#include <nn/font.h>
|
||||
#include <nn/math.h>
|
||||
#include <nn/pl.h>
|
||||
#include <nn/util.h>
|
||||
|
||||
#include "demo.h"
|
||||
|
||||
const char s_ShaderBinaryFilePath[] = "rom:/nnfont_RectDrawerShader.shbin";
|
||||
|
||||
extern nn::fnd::ExpHeap appHeap;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief シェーダの初期化を行います。
|
||||
//!
|
||||
//! @param[in,out] pResource 描画用リソースを管理するオブジェクトへのポインタ。
|
||||
//---------------------------------------------------------------------------
|
||||
void*
|
||||
InitShaders(nn::font::RectDrawer* pDrawer)
|
||||
{
|
||||
const size_t ROMFS_BUFFER_SIZE = 1024 * 64;
|
||||
static char buffer[ROMFS_BUFFER_SIZE];
|
||||
|
||||
nn::fs::MountRom(16, 16, buffer, ROMFS_BUFFER_SIZE);
|
||||
nn::fs::FileReader shaderReader(s_ShaderBinaryFilePath);
|
||||
|
||||
const u32 fileSize = (u32)shaderReader.GetSize();
|
||||
|
||||
void* shaderBinary = appHeap.Allocate(fileSize);
|
||||
NN_NULL_ASSERT(shaderBinary);
|
||||
|
||||
shaderReader.Read(shaderBinary, fileSize);
|
||||
|
||||
const u32 vtxBufCmdBufSize =
|
||||
nn::font::RectDrawer::GetVertexBufferCommandBufferSize(shaderBinary, fileSize);
|
||||
void *const vtxBufCmdBuf = appHeap.Allocate(vtxBufCmdBufSize);
|
||||
NN_NULL_ASSERT(vtxBufCmdBuf);
|
||||
pDrawer->Initialize(vtxBufCmdBuf, shaderBinary, fileSize);
|
||||
|
||||
appHeap.Free(shaderBinary);
|
||||
|
||||
shaderReader.Finalize();
|
||||
nn::fs::Unmount("rom:");
|
||||
return vtxBufCmdBuf;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*
|
||||
@brief グラフィックスの初期設定を行います。
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
InitGX()
|
||||
{
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 描画の初期設定を行います。
|
||||
//!
|
||||
//! @param[in] width 画面の幅。
|
||||
//! @param[in] height 画面の高さ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
InitDraw(
|
||||
int width,
|
||||
int height
|
||||
)
|
||||
{
|
||||
// カラーバッファ情報
|
||||
// LCDの向きに合わせて、幅と高さを入れ替えています。
|
||||
const nn::font::ColorBufferInfo colBufInfo = { width, height, PICA_DATA_DEPTH24_STENCIL8_EXT };
|
||||
|
||||
const u32 screenSettingCommands[] =
|
||||
{
|
||||
|
||||
// ビューポートの設定
|
||||
NN_FONT_CMD_SET_VIEWPORT( 0, 0, colBufInfo.width, colBufInfo.height ),
|
||||
|
||||
// シザー処理を無効
|
||||
NN_FONT_CMD_SET_DISABLE_SCISSOR( colBufInfo ),
|
||||
|
||||
// wバッファの無効化
|
||||
// デプスレンジの設定
|
||||
// ポリゴンオフセットの無効化
|
||||
NN_FONT_CMD_SET_WBUFFER_DEPTHRANGE_POLYGONOFFSET(
|
||||
0.0f, // wScale : 0.0 でWバッファが無効
|
||||
0.0f, // depth range near
|
||||
1.0f, // depth range far
|
||||
0, // polygon offset units : 0.0 で ポリゴンオフセットが無効
|
||||
colBufInfo),
|
||||
};
|
||||
|
||||
nngxAdd3DCommand(screenSettingCommands, sizeof(screenSettingCommands), true);
|
||||
|
||||
static const u32 s_InitCommands[] =
|
||||
{
|
||||
// カリングを無効
|
||||
NN_FONT_CMD_SET_CULL_FACE( NN_FONT_CMD_CULL_FACE_DISABLE ),
|
||||
|
||||
// ステンシルテストを無効
|
||||
NN_FONT_CMD_SET_DISABLE_STENCIL_TEST(),
|
||||
|
||||
// デプステストを無効
|
||||
// カラーバッファの全ての成分を書き込み可
|
||||
NN_FONT_CMD_SET_DEPTH_FUNC_COLOR_MASK(
|
||||
false, // isDepthTestEnabled
|
||||
0, // depthFunc
|
||||
true, // depthMask
|
||||
true, // red
|
||||
true, // green
|
||||
true, // blue
|
||||
true), // alpha
|
||||
|
||||
// アーリーデプステストを無効
|
||||
NN_FONT_CMD_SET_ENABLE_EARLY_DEPTH_TEST( false ),
|
||||
|
||||
// フレームバッファアクセス制御
|
||||
NN_FONT_CMD_SET_FBACCESS(
|
||||
true, // colorRead
|
||||
true, // colorWrite
|
||||
false, // depthRead
|
||||
false, // depthWrite
|
||||
false, // stencilRead
|
||||
false), // stencilWrite
|
||||
};
|
||||
|
||||
nngxAdd3DCommand(s_InitCommands, sizeof(s_InitCommands), true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ResFontを構築します。
|
||||
//!
|
||||
//! @param[out] pFont 構築するフォントへのポインタ。
|
||||
//! @param[in] filePath ロードするフォントリソースファイル名。
|
||||
//!
|
||||
//! @return ResFont構築の成否を返します。
|
||||
//---------------------------------------------------------------------------
|
||||
bool
|
||||
InitFont(
|
||||
nn::font::ResFont* pFont,
|
||||
void* pBuffer
|
||||
)
|
||||
{
|
||||
// フォントリソースをセットします
|
||||
bool bSuccess = pFont->SetResource(pBuffer);
|
||||
|
||||
// 描画用バッファを設定します。
|
||||
const u32 drawBufferSize = nn::font::ResFont::GetDrawBufferSize(pBuffer);
|
||||
void* drawBuffer = appHeap.Allocate(drawBufferSize, 4);
|
||||
pFont->SetDrawBuffer(drawBuffer);
|
||||
NN_NULL_ASSERT(drawBuffer);
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ResFontを破棄します。
|
||||
//!
|
||||
//! @param[in] pFont 破棄するフォントへのポインタ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
CleanupFont(nn::font::ResFont* pFont)
|
||||
{
|
||||
// 描画用バッファの無効化
|
||||
// 描画用バッファがセットされているなら 構築時に SetDrawBuffer に渡したバッファへの
|
||||
// ポインタが返ってきます。
|
||||
void *const drawBuffer = pFont->SetDrawBuffer(NULL);
|
||||
if (drawBuffer != NULL)
|
||||
{
|
||||
appHeap.Free(drawBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 表示文字列用バッファを確保します。
|
||||
//!
|
||||
//! @param[in] charMax 表示する文字列の最大文字数。
|
||||
//!
|
||||
//! @return 確保した表示文字列用バッファへのポインタを返します。
|
||||
//---------------------------------------------------------------------------
|
||||
nn::font::DispStringBuffer*
|
||||
AllocDispStringBuffer(int charMax)
|
||||
{
|
||||
const u32 DrawBufferSize = nn::font::CharWriter::GetDispStringBufferSize(charMax);
|
||||
void *const bufMem = appHeap.Allocate(DrawBufferSize);
|
||||
NN_NULL_ASSERT(bufMem);
|
||||
|
||||
return nn::font::CharWriter::InitDispStringBuffer(bufMem, charMax);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief 文字列表示用にモデルビュー行列と射影行列を設定します。
|
||||
//!
|
||||
//! @param[in] pDrawer RectDrawerオブジェクトへのポインタ。
|
||||
//! @param[in] width 画面の幅。
|
||||
//! @param[in] height 画面の高さ。
|
||||
//---------------------------------------------------------------------------
|
||||
void
|
||||
SetupTextCamera(
|
||||
nn::font::RectDrawer* pDrawer,
|
||||
int width,
|
||||
int height
|
||||
)
|
||||
{
|
||||
// 射影行列を正射影に設定
|
||||
{
|
||||
// 左上原点とし、Y軸とZ軸の向きが逆になるように設定します。
|
||||
nn::math::MTX44 proj;
|
||||
f32 znear = 0.0f;
|
||||
f32 zfar = -1.0f;
|
||||
f32 t = 0;
|
||||
f32 b = static_cast<f32>(width);
|
||||
f32 l = 0;
|
||||
f32 r = static_cast<f32>(height);
|
||||
nn::math::MTX44OrthoPivot(&proj, l, r, b, t, znear, zfar, nn::math::PIVOT_UPSIDE_TO_TOP);
|
||||
pDrawer->SetProjectionMtx(proj);
|
||||
}
|
||||
|
||||
// モデルビュー行列を単位行列に設定
|
||||
{
|
||||
nn::math::MTX34 mv;
|
||||
nn::math::MTX34Identity(&mv);
|
||||
pDrawer->SetViewMtxForText(mv);
|
||||
}
|
||||
}
|
||||
|
||||
nn::font::RectDrawer drawer;
|
||||
void *drawerBuf;
|
||||
nn::font::DispStringBuffer *pDrawStringBuf0;
|
||||
nn::font::DispStringBuffer *pDrawStringBuf1;
|
||||
nn::font::ResFont font;
|
||||
nn::font::TextWriter writer;
|
||||
//---------------------------------------------------------------------------
|
||||
//! @brief ASCII文字列を描画します。
|
||||
//---------------------------------------------------------------------------
|
||||
void shf_DrawText_0( u16 x,u16 y,char *s)
|
||||
{
|
||||
writer.SetCursor(x, y);
|
||||
|
||||
writer.StartPrint();
|
||||
(void)writer.Print(s);
|
||||
writer.EndPrint();
|
||||
drawer.BuildTextCommand(&writer);
|
||||
|
||||
|
||||
drawer.DrawBegin();
|
||||
|
||||
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||
writer.UseCommandBuffer();
|
||||
|
||||
drawer.DrawEnd();
|
||||
}
|
||||
|
||||
void shf_DrawText_1( u16 x,u16 y,char *s)
|
||||
{
|
||||
writer.SetCursor(x, y);
|
||||
|
||||
writer.StartPrint();
|
||||
(void)writer.Print(s);
|
||||
writer.EndPrint();
|
||||
drawer.BuildTextCommand(&writer);
|
||||
|
||||
|
||||
drawer.DrawBegin();
|
||||
|
||||
SetupTextCamera(&drawer, NN_GX_DISPLAY1_WIDTH, NN_GX_DISPLAY1_HEIGHT);
|
||||
writer.UseCommandBuffer();
|
||||
|
||||
drawer.DrawEnd();
|
||||
}
|
||||
|
||||
|
||||
void shf_SetSize(f32 sz)
|
||||
{
|
||||
writer.SetScale(sz/14,sz/20);
|
||||
}
|
||||
|
||||
void shf_SetScale(f32 h,f32 v)
|
||||
{
|
||||
writer.SetScale(h,v);
|
||||
}
|
||||
|
||||
|
||||
void shf_SetFontSize(f32 sz)
|
||||
{
|
||||
writer.SetFontSize(sz);
|
||||
}
|
||||
|
||||
f32 shf_GetFontWidth()
|
||||
{
|
||||
return writer.GetFontWidth();
|
||||
}
|
||||
|
||||
f32 shf_GetFontHeight()
|
||||
{
|
||||
return writer.GetFontHeight();
|
||||
}
|
||||
|
||||
|
||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a)
|
||||
{
|
||||
writer.SetTextColor(nn::util::FloatColor(r,g,b,a));
|
||||
}
|
||||
|
||||
//初期化
|
||||
//AppHeap確保、RenderSystem.Inititの後に呼ぶ
|
||||
void SharedFontInit()
|
||||
{
|
||||
|
||||
InitGX();
|
||||
|
||||
// 共有フォントの初期化
|
||||
NN_UTIL_PANIC_IF_FAILED(nn::pl::InitializeSharedFont());
|
||||
|
||||
// 共有フォントのロードが完了するまで待機
|
||||
while (nn::pl::GetSharedFontLoadState() != nn::pl::SHARED_FONT_LOAD_STATE_LOADED)
|
||||
{
|
||||
// 共有フォントのロードに失敗していないか確認
|
||||
if (nn::pl::GetSharedFontLoadState() == nn::pl::SHARED_FONT_LOAD_STATE_FAILED)
|
||||
{
|
||||
NN_TPANIC_("failed to load shared font!\n");
|
||||
}
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(1));
|
||||
}
|
||||
|
||||
// 共有フォントの種類を取得
|
||||
//nn::pl::SharedFontType sharedFontType = nn::pl::GetSharedFontType();
|
||||
|
||||
// 共有フォントデータのアドレスを取得
|
||||
void* pFontBuffer = nn::pl::GetSharedFontAddress();
|
||||
|
||||
InitFont(&font, pFontBuffer);
|
||||
|
||||
// 描画リソースの構築
|
||||
drawerBuf = InitShaders(&drawer);
|
||||
|
||||
// 描画文字列用バッファの確保
|
||||
pDrawStringBuf0 = AllocDispStringBuffer(1024);
|
||||
pDrawStringBuf1 = AllocDispStringBuffer(512);
|
||||
|
||||
writer.SetDispStringBuffer(pDrawStringBuf0);
|
||||
writer.SetFont(&font);
|
||||
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SharedFontFinalize()
|
||||
{
|
||||
drawer.Finalize();
|
||||
|
||||
// 描画リソースの破棄
|
||||
appHeap.Free(drawerBuf);
|
||||
|
||||
// フォントの破棄
|
||||
CleanupFont(&font);
|
||||
|
||||
// 描画文字列用バッファの解放
|
||||
appHeap.Free(pDrawStringBuf1);
|
||||
appHeap.Free(pDrawStringBuf0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
End of file
|
||||
*---------------------------------------------------------------------------*/
|
||||
30
tags/0thNUP_Secure/CardSaveDataMover/common/shfnt.h
Normal file
30
tags/0thNUP_Secure/CardSaveDataMover/common/shfnt.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef GUI_SHFNT_H_
|
||||
#define GUI_SHFNT_H_
|
||||
|
||||
void SharedFontInit();
|
||||
void SharedFontFinalize();
|
||||
void shf_DrawText_0(u16 x,u16 y,char* s);
|
||||
void shf_DrawText_1(u16 x,u16 y,char* s);
|
||||
void shf_SetSize(f32 sz);
|
||||
void shf_SetScale(f32 h,f32 v);
|
||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a);
|
||||
void shf_SetFontSize(f32 sz);
|
||||
f32 shf_GetFontWidth();
|
||||
f32 shf_GetFontHeight();
|
||||
|
||||
#endif
|
||||
110
tags/0thNUP_Secure/CardSaveDataMover/common/sleep.cpp
Normal file
110
tags/0thNUP_Secure/CardSaveDataMover/common/sleep.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: sleep.cpp
|
||||
|
||||
Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn/applet.h>
|
||||
|
||||
#include "sleep.h"
|
||||
|
||||
//extern nn::os::CriticalSection g_SleepCS;
|
||||
extern nn::os::LightEvent g_TransitionEvent;
|
||||
extern nn::os::LightEvent g_AwakeEvent;
|
||||
|
||||
volatile bool SleepHandler::s_IsAfterWakeUp = false;
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
void SleepHandler::Initialize( void )
|
||||
{
|
||||
nn::applet::SetSleepQueryCallback(SleepQueryCallback, 0);
|
||||
nn::applet::SetAwakeCallback(AwakeCallback, 0);
|
||||
// nn::applet::SetSleepCancelCallback(NULL, 0); // CancelCallback は使わないことを推奨します
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
void SleepHandler::Finalize( void )
|
||||
{
|
||||
nn::applet::SetSleepQueryCallback(NULL, 0);
|
||||
nn::applet::SetAwakeCallback(NULL, 0);
|
||||
|
||||
nn::applet::DisableSleep();
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
システムスリープの指示が来ているかどうかを返します。
|
||||
*------------------------------------------------------------------------*/
|
||||
bool SleepHandler::IsSleepRequested( void )
|
||||
{
|
||||
if ( nn::applet::IsExpectedToReplySleepQuery() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
本体スリープ状態に移行させるための処理を行います。
|
||||
グラフィックスなどの処理がスリープに入っても問題ない
|
||||
適切なタイミングで呼び出す必要があります。
|
||||
*------------------------------------------------------------------------*/
|
||||
void SleepHandler::SleepSystem( void )
|
||||
{
|
||||
// SleepHandler::IsSleepRequested() == true における呼び出しが前提
|
||||
|
||||
// 何らかの理由で SleepQuery に対して REJECT を返す場合は、ここで判定して
|
||||
// REJECT を返し、この関数を抜ける
|
||||
|
||||
// ファイルシステム処理中はスリープをしない
|
||||
//if ( g_SleepCS.TryEnter() )
|
||||
{
|
||||
// スリープ前処理
|
||||
|
||||
nn::applet::ReplySleepQuery(nn::applet::REPLY_ACCEPT);
|
||||
|
||||
g_AwakeEvent.Wait();
|
||||
|
||||
// スリープ復帰時の処理
|
||||
|
||||
// g_SleepCS.Leave();
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
スリープ問い合わせ時に呼ばれるコールバック
|
||||
*------------------------------------------------------------------------*/
|
||||
AppletQueryReply SleepHandler::SleepQueryCallback( uptr arg )
|
||||
{
|
||||
NN_UNUSED_VAR(arg);
|
||||
g_AwakeEvent.ClearSignal();
|
||||
|
||||
if ( !nn::applet::IsActive() )
|
||||
{
|
||||
// Inactive なとき、メインスレッドは applet::WaitForStarting() で停止状態であり、
|
||||
// 他のスレッドも停止状態になっているはず(アプリケーション側の実装依存)
|
||||
return nn::applet::REPLY_ACCEPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nn::applet::REPLY_LATER;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
スリープ復帰時に呼ばれるコールバック
|
||||
*------------------------------------------------------------------------*/
|
||||
void SleepHandler::AwakeCallback( uptr arg )
|
||||
{
|
||||
NN_UNUSED_VAR(arg);
|
||||
g_AwakeEvent.Signal();
|
||||
|
||||
s_IsAfterWakeUp = true;
|
||||
}
|
||||
46
tags/0thNUP_Secure/CardSaveDataMover/common/sleep.h
Normal file
46
tags/0thNUP_Secure/CardSaveDataMover/common/sleep.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: sleep.h
|
||||
|
||||
Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NN_SAMPLE_DEMOS_DEMO2_SLEEP_H_
|
||||
#define NN_SAMPLE_DEMOS_DEMO2_SLEEP_H_
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
本体スリープに関連する処理
|
||||
*------------------------------------------------------------------------*/
|
||||
class SleepHandler
|
||||
{
|
||||
public:
|
||||
SleepHandler() {}
|
||||
~SleepHandler() {}
|
||||
|
||||
static void Initialize( void );
|
||||
static void Finalize( void );
|
||||
static bool IsSleepRequested( void );
|
||||
static void SleepSystem( void );
|
||||
|
||||
static AppletQueryReply SleepQueryCallback( uptr arg );
|
||||
static void AwakeCallback( uptr arg );
|
||||
static void CancelCallback( uptr arg );
|
||||
|
||||
// スリープからの復帰後、1フレーム分描画を待ってから LCD を有効にするためのフラグ
|
||||
static volatile bool s_IsAfterWakeUp;
|
||||
|
||||
private:
|
||||
static nn::os::LightEvent s_AwakeEvent;
|
||||
static bool s_IsInitialized;
|
||||
};
|
||||
|
||||
|
||||
#endif // NN_SAMPLE_DEMOS_DEMO2_SLEEP_H_
|
||||
22
tags/0thNUP_Secure/CardSaveDataMover/common/ver.h
Normal file
22
tags/0thNUP_Secure/CardSaveDataMover/common/ver.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: irp.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef VER_H_
|
||||
#define VER_H_
|
||||
|
||||
#define VERSION 1.02
|
||||
|
||||
|
||||
#endif
|
||||
37
tags/0thNUP_Secure/CardSaveDataMover/docs/Error_code.txt
Normal file
37
tags/0thNUP_Secure/CardSaveDataMover/docs/Error_code.txt
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
//エラー表示コードの下位2桁
|
||||
0, //不明
|
||||
1, //デバイスが見つからない
|
||||
2,//プロダクトコード不一致
|
||||
3,//ベリファイエラー
|
||||
4,//パスが長すぎ
|
||||
5,//ディレクトリ深すぎ
|
||||
6, //メディアが見つからない(サブ基盤外れなど)
|
||||
10, //ファイルが見つからない
|
||||
20, //既に存在
|
||||
21, //空き容量がない
|
||||
22, //書込み禁止
|
||||
30, //アクセスエラー
|
||||
50, //フォーマットエラー
|
||||
60, //検証に失敗、改竄
|
||||
70, //ROM情報エラー
|
||||
80, //リトライ要求
|
||||
90, //実行時エラー
|
||||
99 //深刻なエラー
|
||||
|
||||
|
||||
//上位
|
||||
CARD = 100,
|
||||
BKUP DEVICE = 200,
|
||||
OTHER = 300
|
||||
|
||||
|
||||
これらの合成で表示される
|
||||
例えば、カードが刺さっていない場合は 101 となる
|
||||
|
||||
|
||||
通常時に発生しやすいと思われるもの
|
||||
|
||||
302 .. プロダクトコードが一致しない
|
||||
101 .. カードが見つからない
|
||||
|
||||
24
tags/0thNUP_Secure/CardSaveDataMover/docs/HowToビルド.txt
Normal file
24
tags/0thNUP_Secure/CardSaveDataMover/docs/HowToビルド.txt
Normal file
@ -0,0 +1,24 @@
|
||||
動作確認環境:
|
||||
ARM製 RVC_Nintendo 4.1
|
||||
omake 0.9.8.5
|
||||
CTR SDK2.0 + Repairtoolプライベートパッチ
|
||||
SDK2.0用のSampledemos のcommon,gxをビルドしておく
|
||||
|
||||
動作要件:上SDK以降のバージョンにシステムアップデートされた本体
|
||||
|
||||
omakerootのあるディレクトリでomake
|
||||
個別の場合
|
||||
body下でビルドし出来たcia を、Imp下のomakeで指定
|
||||
ビルドするとNANDインポート用のcciができる
|
||||
|
||||
インポート先:
|
||||
ciaをSDからインポート -> SD .. DevMenuが必要
|
||||
カード起動しインポート -> NAND
|
||||
|
||||
量産実機での実行にはマスタリング必須
|
||||
cia をOLS付でマスタリングし
|
||||
そのciaで作成したcciをマスタリング
|
||||
|
||||
カードインポートで失敗する場合はciaをチェック
|
||||
ciaのマスタリングはSDインポート可否で確認できる
|
||||
|
||||
55
tags/0thNUP_Secure/CardSaveDataMover/docs/release.txt
Normal file
55
tags/0thNUP_Secure/CardSaveDataMover/docs/release.txt
Normal file
@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
本ツールは 「Nintendo for 3DS」および専用カード用です
|
||||
カード上のセーブデータをバックアップ及びリストアします
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
NANDインポートしてから、内臓アプリ同様の手順で起動
|
||||
|
||||
(インポート手順)
|
||||
・デバッガもしくはライタで"cci"をカードに書き込む
|
||||
・Homeメニューよりカード起動しメニューからInport実行
|
||||
・メニューのImportを選ぶ
|
||||
・終了したら電源ボタンを短押し ->"電源を切る"をタッチ
|
||||
電源を入れなおさないとアイコンがメニューに現れません
|
||||
|
||||
|
||||
(NANDから削除)
|
||||
起動まではインポートと同様
|
||||
・メニューからDelete実行
|
||||
終了後はメニューに戻ります
|
||||
|
||||
(テストパターン書き込み)
|
||||
カード上のバックアップにテストデータを書き込みます
|
||||
手元に使えるゲームカードが無い場合の動作確認用です
|
||||
起動まではインポートと同様
|
||||
・デバッガもしくはライタで"cci"をカードに書き込む
|
||||
・カードを本体に差しメニューからTest Data実行
|
||||
・カーソルで内容を選択、Aでライト、Xでベリファイ
|
||||
種別はCasual Test を選ぶ、他はリリース時のチェックに使う程度
|
||||
|
||||
<テスト手順>
|
||||
ライト後に一旦終了してHomeメニューにもどり
|
||||
Nand上のツールを起動し、リード&リストア
|
||||
Homeボタンなどでツール終了、カード起動しベリファイ
|
||||
|
||||
|
||||
ツール本体の操作は操作マニュアル参照
|
||||
|
||||
|
||||
[Histry]
|
||||
1.02 Remaster 2.0.6(予定)
|
||||
正式版SDK_2.0 でビルド
|
||||
起動時に無線デーモンOFF -> DEA-SUPで出ていたフリーズ暫定対策、本ツールでは発生して無いが一応
|
||||
(いつのまに通信は切れない、完全な停止は本体スイッチ)
|
||||
バナー、アイコンをデフォルトから変更
|
||||
Homeメニュー環境で動作確認
|
||||
フォントを本体内蔵フォントに変更
|
||||
1.01 Remaster 2.0.5
|
||||
Homeボタン、電源での中断終了に対応
|
||||
終了が安定しないので表示をスレッドから関数コールに変更
|
||||
サブカードなし時などメディア認識できない場合のエラー追加
|
||||
|
||||
1.00 リリース:Remaser 2.0.4
|
||||
デバッグモードの無効化
|
||||
|
||||
|
||||
9
tags/0thNUP_Secure/CardSaveDataMover/docs/マスタリング.txt
Normal file
9
tags/0thNUP_Secure/CardSaveDataMover/docs/マスタリング.txt
Normal file
@ -0,0 +1,9 @@
|
||||
量産実機での動作にはマスタリングが必要
|
||||
|
||||
ciaはサーバ認証(OLS)必須で
|
||||
取得には前回取得時よりリマスタバージョンを上げる必要あり(2011/2月現在)
|
||||
メジャーはrsfで指定(Remasterversion)
|
||||
マイナとマイクロはOmakefile
|
||||
MAKECIAFLAGS = -minor 0 -micro 1
|
||||
上の場合 *.0.1 (*はrsfのRemasterversion)
|
||||
|
||||
41
tags/0thNUP_Secure/CardSaveDataMover/docs/操作説明.txt
Normal file
41
tags/0thNUP_Secure/CardSaveDataMover/docs/操作説明.txt
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
<操作メニュー>
|
||||
|
||||
操作が出来る状態のとき下画面にボタン表示
|
||||
|
||||
・バックアップが無い状態でカードを差すと
|
||||
バックアップが有効
|
||||
|
||||
・バックアップがある状態では
|
||||
リストアが有効
|
||||
|
||||
(バックアップ)
|
||||
タッチして実行画面
|
||||
カードから本体内メモリに読み出します
|
||||
|
||||
(リストア)
|
||||
タッチして実行画面
|
||||
バックアップした内容をカードへ書きます
|
||||
成功すると自動で消去
|
||||
失敗の場合は消去しません
|
||||
|
||||
(バックアップデリート)
|
||||
先頭画面で 方向キー LEFT + X 同時押し
|
||||
|
||||
|
||||
|
||||
以下、ビルド時にフラグ有効(my_dess.h 内)にした場合のみ使える
|
||||
|
||||
//クラッシュモード
|
||||
書き戻す際にデータを壊す、ベリファイで必ずエラー
|
||||
先頭画面で Y ボタン
|
||||
|
||||
//デバグモード
|
||||
先頭画面で 方向下+Y(0.09まで)
|
||||
先頭画面で 方向下+X+Y(1.00以降)
|
||||
|
||||
クラッシュモード有効時: L ボタン
|
||||
|
||||
//テストデータ書き込み
|
||||
デバグモード中に先頭画面でRボタン
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,449 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ConsoleBackup.cpp
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/version.h>
|
||||
#include <nn/ptm/CTR/ptm_ApiSysmenu.h>
|
||||
#include <nn/mcu.h>
|
||||
#include <nn/cfg/CTR/cfg_Api.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiInit.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||
#include <nn/ps.h>
|
||||
#include <nn/nwm.h>
|
||||
#include <nn/ac.h>
|
||||
#include <nn/friends.h>
|
||||
#include <nn/friends/CTR/friends_ApiPrivate.h>
|
||||
#include <nn/fs/CTR/fs_ArchiveTypesForSystem.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/fs/fs_ApiSysSaveData.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiNor.h>
|
||||
#include <nn/os/os_SharedInfo.h>
|
||||
#include <nn/pl/CTR/pl_Version.h>
|
||||
#include <nn/fs/fs_ApiSharedExtSaveData.h>
|
||||
#include <nn/nim.h>
|
||||
#include <nn/ndm.h>
|
||||
|
||||
#include "demo.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "ConsoleBackup.h"
|
||||
#include "DrawSystemState.h"
|
||||
#include "FileName.h"
|
||||
#include "Controller.h"
|
||||
#include "SimplePlayer.h"
|
||||
#include "Exporter.h"
|
||||
#include "CommonLogger.h"
|
||||
#include "SDMountManager.h"
|
||||
#include "HeapManager.h"
|
||||
#include "PlayHistoryManager.h"
|
||||
#include "common_Types.h"
|
||||
#include "VersionDetect.h"
|
||||
#include "HardwareInfo.h"
|
||||
|
||||
// svnリビジョン埋め込み用
|
||||
#include "version.h"
|
||||
#ifndef BACKUP_VERSION_NUM
|
||||
#define BACKUP_VERSION_NUM 0
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// グラフィックスに割り当てるメモリ
|
||||
const size_t s_GxHeapSize = 0x800000;
|
||||
|
||||
|
||||
// バッテリ残量
|
||||
u8 batteryRemain = 100;
|
||||
|
||||
// シリアルナンバー
|
||||
u8 s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN];
|
||||
|
||||
// デバイスID
|
||||
bit32 s_DeviceId;
|
||||
|
||||
// シリアルナンバーが読めるかどうか
|
||||
bool s_CanReadSerialNumber = false;
|
||||
|
||||
// IVSへのポインタ
|
||||
void* sp_Ivs;
|
||||
|
||||
size_t s_SizeofIvs;
|
||||
|
||||
// IVSが読めるかどうか
|
||||
bool s_CanReadIvs = false;
|
||||
|
||||
// バージョン情報
|
||||
common::VerDef s_VerData;
|
||||
|
||||
nn::Handle s_McuSession;
|
||||
|
||||
} // namespace <unnamed>
|
||||
|
||||
namespace ConsoleBackup{
|
||||
|
||||
bool IsAdapterConnected()
|
||||
{
|
||||
return nn::ptm::CTR::GetAdapterState() == nn::ptm::CTR::ADAPTERSTATE_CONNECTED;
|
||||
}
|
||||
|
||||
bool IsBatteryLower()
|
||||
{
|
||||
return batteryRemain <= 10;
|
||||
}
|
||||
|
||||
bool CanReadIVS()
|
||||
{
|
||||
return s_CanReadIvs;
|
||||
}
|
||||
|
||||
bool CanReadSerialNumber()
|
||||
{
|
||||
return s_CanReadSerialNumber;
|
||||
}
|
||||
|
||||
void GetSerialNumber(u8** serial, size_t* size)
|
||||
{
|
||||
*serial = s_SerialNo;
|
||||
*size = nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN;
|
||||
}
|
||||
|
||||
void GetIvs(void** ivs, size_t* size)
|
||||
{
|
||||
*ivs = sp_Ivs;
|
||||
*size = s_SizeofIvs;
|
||||
}
|
||||
|
||||
bit32 GetDeviceId()
|
||||
{
|
||||
return s_DeviceId;
|
||||
}
|
||||
|
||||
void GetVersionData(common::VerDef* version)
|
||||
{
|
||||
*version = s_VerData;
|
||||
}
|
||||
|
||||
nn::Handle GetMcuHandle()
|
||||
{
|
||||
return s_McuSession;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void nnMain(void)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
// os の初期化
|
||||
nn::os::Initialize();
|
||||
|
||||
// fs の初期化
|
||||
nn::fs::Initialize();
|
||||
|
||||
// appletの初期化
|
||||
nn::applet::Enable( false );
|
||||
|
||||
// hid の初期化
|
||||
result = nn::hid::Initialize();
|
||||
NN_UTIL_PANIC_IF_FAILED(result);
|
||||
|
||||
// ndmの初期化
|
||||
result = nn::ndm::Initialize();
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
|
||||
// デーモンの自律動作を停止
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_CEC);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_BOSS);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_FRIENDS);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_NIM);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
|
||||
// cfg の初期化
|
||||
nn::cfg::CTR::init::Initialize();
|
||||
nn::cfg::CTR::system::Initialize();
|
||||
|
||||
// 時計設定用ptm初期化
|
||||
nn::ptm::CTR::InitializeForSystemMenu();
|
||||
|
||||
// ps の初期化
|
||||
nn::ps::Initialize();
|
||||
|
||||
// friendsの初期化
|
||||
result = nn::friends::detail::Initialize();
|
||||
|
||||
// mcuの初期化
|
||||
nn::mcu::CTR::InitializeHwCheck(&s_McuSession);
|
||||
|
||||
nn::mcu::CTR::HwCheck mcu(s_McuSession);
|
||||
|
||||
// ヒープの確保
|
||||
common::HeapManager::GetHeap()->Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
|
||||
|
||||
// RenderSystem の準備
|
||||
uptr heapForGx = reinterpret_cast<uptr>(common::HeapManager::GetHeap()->Allocate(s_GxHeapSize));
|
||||
demo::RenderSystemDrawing s_RenderSystem;
|
||||
s_RenderSystem.Initialize(heapForGx, s_GxHeapSize);
|
||||
|
||||
// サウンドスレッドの起動
|
||||
common::InitializeSimplePlayer();
|
||||
|
||||
// ログ描画の初期化
|
||||
common::Logger::GetLoggerInstance()->Initialize(CONSOLE_WIDTH, CONSOLE_HEIGHT, CONSOLE_MAX_LINE, &s_RenderSystem);
|
||||
|
||||
// RenderSystemを作ってからログが出せる
|
||||
common::Logger::InitializeEjectThread();
|
||||
common::Logger::SetEjectHandler(OnSdEjected);
|
||||
// 起動時に削除
|
||||
common::Logger::GetLoggerInstance()->ClearLog();
|
||||
|
||||
COMMON_LOGGER("\n");
|
||||
COMMON_LOGGER("CTR Console Backup start\n");
|
||||
|
||||
// ボタン入力
|
||||
nn::hid::PadReader s_PadReader;
|
||||
nn::hid::PadStatus padStatus;
|
||||
|
||||
// データの準備
|
||||
|
||||
// 完全性検証SEEDの取得
|
||||
result = nn::fs::MountSpecialArchive(common::NAND_ARCHIVE_NAME, nn::fs::CTR::ARCHIVE_TYPE_CTR_NAND);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
nn::fs::FileInputStream fis;
|
||||
|
||||
result = fis.TryInitialize(common::IVS_NAND_PATHNAME);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s64 fileSize = fis.GetSize();
|
||||
s32 ret;
|
||||
void* addr = NULL;
|
||||
addr = common::HeapManager::GetHeap()->Allocate(fileSize);
|
||||
if (addr != NULL)
|
||||
{
|
||||
sp_Ivs = addr;
|
||||
s_SizeofIvs = fileSize;
|
||||
result = fis.TryRead(&ret, addr, fileSize);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s_CanReadIvs = true;
|
||||
}
|
||||
// 後でIVSを参照するのでFreeしない
|
||||
}
|
||||
}
|
||||
fis.Finalize();
|
||||
}
|
||||
// 一旦アンマウントしておく
|
||||
nn::fs::Unmount(common::NAND_ARCHIVE_NAME);
|
||||
|
||||
// リージョンの取得
|
||||
nn::cfg::CTR::CfgRegionCode region;
|
||||
region = nn::cfg::CTR::GetRegion();
|
||||
|
||||
// シリアルナンバーの取得
|
||||
std::memset(s_SerialNo, '\0',
|
||||
nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN);
|
||||
result = nn::cfg::CTR::system::GetSerialNo(s_SerialNo);
|
||||
if(result.IsSuccess())
|
||||
{
|
||||
s_CanReadSerialNumber = true;
|
||||
}
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
common::HardwareInfo hwInfo;
|
||||
hwInfo.AddCheckDigit(reinterpret_cast<char*>(s_SerialNo));
|
||||
|
||||
// デバイスIDの取得
|
||||
result = nn::ps::CTR::GetDeviceId(&s_DeviceId);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
bit64 infraDeviceId;
|
||||
result = nn::nim::CTR::InitializeForShop();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
result = nn::nim::CTR::Shop::GetInfraDeviceId(s_DeviceId, &infraDeviceId);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
result = nn::nim::CTR::FinalizeForShop();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// MACアドレスの取得
|
||||
nn::nwm::Mac mac;
|
||||
char8 macAddress[nn::nwm::Mac::MAC_STRING_SIZE];
|
||||
|
||||
result = nn::nwm::GetMacAddress(mac);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
mac.GetString(macAddress);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// フレンドコードの取得
|
||||
nn::friends::CTR::FriendKey friendKey;
|
||||
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
u64 friendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
|
||||
|
||||
// バージョンの取得
|
||||
common::GetSystemVersion(&s_VerData, region);
|
||||
|
||||
// 情報出力
|
||||
COMMON_LOGGER("CTR Console Backup %s Rev.%s\n", __DATE__, BACKUP_VERSION_NUM);
|
||||
COMMON_LOGGER("System Ver. %d.%d.%d-%d\n", s_VerData.cup.majorVersion, s_VerData.cup.minorVersion, s_VerData.cup.microVersion,
|
||||
s_VerData.nup.majorVersion);
|
||||
COMMON_LOGGER("System Region %s\n", nn::cfg::CTR::GetRegionCodeA3(region));
|
||||
COMMON_LOGGER("Serial Number %s\n", s_SerialNo);
|
||||
COMMON_LOGGER("Device ID %llu\n", infraDeviceId);
|
||||
COMMON_LOGGER("MAC Address %s\n", macAddress);
|
||||
COMMON_LOGGER("Friend Code %04u-%04u-%04u\n",
|
||||
static_cast<u32>(friendCode / 100000000ULL % 10000ULL),
|
||||
static_cast<u32>(friendCode / 10000ULL % 10000ULL),
|
||||
static_cast<u32>(friendCode % 10000ULL) );
|
||||
|
||||
|
||||
bool flip = false;
|
||||
bool continueBackup = false;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
bool nextStep = false;
|
||||
s_PadReader.ReadLatest(&padStatus);
|
||||
|
||||
// AまたはSTARTボタンで進行
|
||||
if(padStatus.trigger & nn::hid::BUTTON_A ||
|
||||
padStatus.trigger & nn::hid::BUTTON_START)
|
||||
{
|
||||
nextStep = true;
|
||||
}
|
||||
|
||||
// LまたはRボタンで上下画面フリップ
|
||||
if(padStatus.trigger & nn::hid::BUTTON_R ||
|
||||
padStatus.trigger & nn::hid::BUTTON_L)
|
||||
{
|
||||
flip = !flip;
|
||||
}
|
||||
|
||||
// コンソールスクロール
|
||||
if(padStatus.hold & nn::hid::BUTTON_UP)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollUp();
|
||||
}
|
||||
|
||||
// コンソールスクロール
|
||||
if(padStatus.hold & nn::hid::BUTTON_DOWN)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollDown();
|
||||
}
|
||||
|
||||
if(padStatus.hold & nn::hid::BUTTON_LEFT)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollToBegin();
|
||||
}
|
||||
|
||||
if(padStatus.hold & nn::hid::BUTTON_RIGHT)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollToEnd();
|
||||
}
|
||||
|
||||
|
||||
// 情報更新
|
||||
// バッテリ
|
||||
mcu.GetBatteryRemain(&batteryRemain);
|
||||
// ACアダプタ
|
||||
std::string adapterState;
|
||||
if(IsAdapterConnected())
|
||||
{
|
||||
adapterState += ::std::string("Connected");
|
||||
}
|
||||
else
|
||||
{
|
||||
adapterState += ::std::string("Not Connected");
|
||||
}
|
||||
|
||||
// 操作用メッセージ
|
||||
// 進捗確認メッセージを兼ねる?
|
||||
::std::vector<std::string> operationMessage;
|
||||
|
||||
ControlState(operationMessage, nextStep, continueBackup);
|
||||
|
||||
nn::util::FloatColor titleColor;
|
||||
|
||||
titleColor.r = 0.3f;
|
||||
titleColor.g = 0.f;
|
||||
titleColor.b = 0.2f;
|
||||
|
||||
// 上画面表示
|
||||
common::DrawSystemState("CTR Console Backup",
|
||||
s_RenderSystem,
|
||||
titleColor,
|
||||
flip,
|
||||
adapterState,
|
||||
BACKUP_VERSION_NUM,
|
||||
&s_VerData,
|
||||
batteryRemain,
|
||||
infraDeviceId,
|
||||
friendCode,
|
||||
GetProgress(),
|
||||
macAddress,
|
||||
operationMessage,
|
||||
region,
|
||||
s_SerialNo
|
||||
);
|
||||
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
// デフォルトで下画面に描画するもの
|
||||
s_RenderSystem.SetRenderTarget(common::GetRenderTarget(NN_GX_DISPLAY1, flip));
|
||||
if(IsBackupSucceeded())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), SUCCESS_COLOR);
|
||||
}
|
||||
if(IsBackupFailed())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), FAIL_COLOR);
|
||||
}
|
||||
s_RenderSystem.Clear();
|
||||
s_RenderSystem.SetColor(1.f, 1.f, 1.f);
|
||||
|
||||
common::Logger::GetLoggerInstance()->DrawConsole();
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
|
||||
s_RenderSystem.WaitVsync(NN_GX_DISPLAY_BOTH);
|
||||
|
||||
// 電源長押しで終了
|
||||
if ( nn::applet::IsExpectedToCloseApplication())
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->Finalize();
|
||||
// アンマウント
|
||||
nn::fs::Unmount(common::NAND_ARCHIVE_NAME);
|
||||
nn::fs::Unmount(common::SDMC_ARCHIVE_NAME);
|
||||
s_RenderSystem.Finalize();
|
||||
|
||||
nn::mcu::CTR::FinalizeHwCheck(&s_McuSession);
|
||||
nn::friends::detail::Finalize();
|
||||
nn::ps::Finalize();
|
||||
nn::ptm::CTR::FinalizeForSystemMenu();
|
||||
nn::cfg::CTR::system::Finalize();
|
||||
nn::cfg::CTR::init::Finalize();
|
||||
nn::hid::Finalize();
|
||||
nn::fs::Finalize();
|
||||
|
||||
nn::applet::PrepareToCloseApplication();
|
||||
nn::applet::CloseApplication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ConsoleBackup.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NN_CONSOLEBACKUP_H_
|
||||
#define NN_CONSOLEBACKUP_H_
|
||||
|
||||
#include <nn.h>
|
||||
#include "VersionDetect.h"
|
||||
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
bool IsAdapterConnected();
|
||||
bool IsBatteryLower();
|
||||
bool CanReadIVS();
|
||||
bool CanReadSerialNumber();
|
||||
void GetSerialNumber(u8** serial, size_t* size);
|
||||
void GetIvs(void** ivs, size_t* size);
|
||||
nn::Handle GetMcuHandle();
|
||||
void GetVersionData(common::VerDef* version);
|
||||
bit32 GetDeviceId();
|
||||
|
||||
const u32 CONSOLE_WIDTH = 38;
|
||||
const u32 CONSOLE_HEIGHT = 24;
|
||||
const u32 CONSOLE_MAX_LINE = 1000;
|
||||
|
||||
}
|
||||
|
||||
/* NN_CONSOLEBACKUP_H_ */
|
||||
#endif
|
||||
@ -0,0 +1,52 @@
|
||||
BasicInfo:
|
||||
Title : ConsoleBackup
|
||||
ProductCode: ConsoleBackup
|
||||
BackupMemoryType: None
|
||||
|
||||
TitleInfo:
|
||||
Use: Evaluation
|
||||
Category: Application
|
||||
UniqueId: 0xf8021
|
||||
Version: 0
|
||||
|
||||
SystemControlInfo:
|
||||
AppType : Application
|
||||
StackSize : 0x4000
|
||||
Dependency :
|
||||
- gpio
|
||||
- pdn
|
||||
- spi
|
||||
- i2c
|
||||
- mcu
|
||||
- ptm
|
||||
- codec
|
||||
- cfg
|
||||
- hid
|
||||
- gsp
|
||||
- friends
|
||||
- nim
|
||||
- ac
|
||||
- ndm
|
||||
|
||||
AccessControlInfo:
|
||||
Priority : 16
|
||||
DisableDebug : true
|
||||
|
||||
FileSystemAccess:
|
||||
- DirectSdmc
|
||||
- Debug
|
||||
- Core
|
||||
- CategoryFileSystemTool
|
||||
|
||||
IoAccessControl:
|
||||
- FsMountCardSpi
|
||||
- FsMountNand
|
||||
- FsMountTwln
|
||||
|
||||
Option:
|
||||
FreeProductCode: true
|
||||
|
||||
|
||||
Rom:
|
||||
# ROM に含めるファイルシステムのルートパスを指定します。
|
||||
HostRoot: "$(ROMFS_ROOT)"
|
||||
@ -0,0 +1,313 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Controller.cpp
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Controller.h"
|
||||
#include "FileChecker.h"
|
||||
#include "ConsoleBackup.h"
|
||||
#include "Exporter.h"
|
||||
#include "SimplePlayer.h"
|
||||
#include "CommonLogger.h"
|
||||
|
||||
#include <nn.h>
|
||||
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
typedef enum BackupState
|
||||
{
|
||||
STARTUP, // 初期値
|
||||
EXPORT_TWL_SOUND, // TWLサウンド領域の吸出し中
|
||||
EXPORT_TWL_PHOTO, // TWL写真領域の吸出し中
|
||||
EXPORT_CTR_NAND, // 吸出し中
|
||||
DELETE_NIM, // nimのシステムセーブデータ削除
|
||||
DONE, // 吸出し完了
|
||||
FINISHED, // SDカード抜き完了
|
||||
FAIL // 失敗
|
||||
} BackupState;
|
||||
|
||||
|
||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistAPSettingAnnotation = false;
|
||||
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
||||
bool s_SdWriteProetctAnnotation = false;
|
||||
|
||||
BackupState s_BackupState = STARTUP;
|
||||
bool s_PlayedStartCursor = false;
|
||||
bool s_PlayedSdPullOutCursor = false;
|
||||
bool s_PlayedFinishedSound = false;
|
||||
bool s_PlayedFailSound = false;
|
||||
|
||||
} // namespace <unnamed>
|
||||
|
||||
bool NeedsAcAdateper()
|
||||
{
|
||||
return IsBatteryLower() && !IsAdapterConnected();
|
||||
}
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueBackup)
|
||||
{
|
||||
// 状態遷移Controller
|
||||
switch (s_BackupState)
|
||||
{
|
||||
|
||||
// 起動時
|
||||
case STARTUP:
|
||||
{
|
||||
bool error = false;
|
||||
// 完全性検証SEEDを読めるか?
|
||||
if (CanReadIVS())
|
||||
{
|
||||
// SDカードが挿入されているか?
|
||||
if (nn::fs::IsSdmcInserted())
|
||||
{
|
||||
// SDカードに書き込みできるか?
|
||||
if (!nn::fs::IsSdmcWritable())
|
||||
{
|
||||
if (!s_SdWriteProetctAnnotation)
|
||||
{
|
||||
s_SdWriteProetctAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
operationMessage.push_back(::std::string("Can*t Write SD Card!!\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
// 無線設定ファイルがあるか?
|
||||
if (common::ExistsAPSetting())
|
||||
{
|
||||
// 書き込み中に抜かないように
|
||||
if (nextStep)
|
||||
{
|
||||
// シリアルナンバーを読み取れるか?
|
||||
if (!CanReadSerialNumber())
|
||||
{
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
COMMON_LOGGER("Can't Read Serial Number\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
if (!s_ExistAPSettingAnnotation)
|
||||
{
|
||||
s_ExistAPSettingAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
operationMessage.push_back(::std::string("Accsess_Point_Setting does not exist!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Insert SD Card!!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Can't Read IVS!!"));
|
||||
}
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdateper())
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// エラーが無ければ進行用メッセージ表示
|
||||
if(!error)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
if(!s_PlayedStartCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextStep && !error)
|
||||
{
|
||||
COMMON_LOGGER("Start Export Data\n");
|
||||
s_BackupState = EXPORT_TWL_SOUND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// TWLサウンド領域の吸出し中
|
||||
case EXPORT_TWL_SOUND:
|
||||
{
|
||||
static bool init = true;
|
||||
if(init)
|
||||
{
|
||||
// データを書き込む
|
||||
ExportTwlSoundData();
|
||||
init = false;
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsExportFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
s_BackupState = EXPORT_TWL_PHOTO;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// TWL写真領域の吸出し中
|
||||
case EXPORT_TWL_PHOTO:
|
||||
{
|
||||
static bool init = true;
|
||||
if(init)
|
||||
{
|
||||
// データを書き込む
|
||||
ExportTwlPhotoData();
|
||||
init = false;
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsExportFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
s_BackupState = EXPORT_CTR_NAND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 吸出し中
|
||||
case EXPORT_CTR_NAND:
|
||||
{
|
||||
continueBackup = true;
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdateper())
|
||||
{
|
||||
continueBackup = false;
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// データを書き込む
|
||||
ExportData();
|
||||
|
||||
// 処理が完了した
|
||||
if (continueBackup && IsExportFinished())
|
||||
{
|
||||
FinalizeExportThread();
|
||||
COMMON_LOGGER("Export NAND Data Finished.\n");
|
||||
|
||||
if(GetProgress() > 99)
|
||||
{
|
||||
s_BackupState = DELETE_NIM;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_BackupState = FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// nimのシステムセーブデータ削除
|
||||
case DELETE_NIM:
|
||||
{
|
||||
DeleteNimSaveData();
|
||||
s_BackupState = DONE;
|
||||
}
|
||||
break;
|
||||
|
||||
// 吸出し完了
|
||||
case DONE:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Backup Done. Pull Out SD Card."));
|
||||
if(!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// SDカード抜き完了
|
||||
case FINISHED:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Backup Succeeded!!\n"));
|
||||
if(!s_PlayedFinishedSound)
|
||||
{
|
||||
common::PlaySound(common::SOUND_OK);
|
||||
s_PlayedFinishedSound = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 吸出し失敗
|
||||
case FAIL:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Backup Failed."));
|
||||
if(!s_PlayedFailSound)
|
||||
{
|
||||
common::PlaySound(common::SOUND_NG);
|
||||
s_PlayedFailSound = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool InProgress()
|
||||
{
|
||||
return s_BackupState == EXPORT_CTR_NAND;
|
||||
}
|
||||
|
||||
bool IsBackupSucceeded()
|
||||
{
|
||||
return s_BackupState == FINISHED;
|
||||
}
|
||||
|
||||
bool IsBackupFailed()
|
||||
{
|
||||
return s_BackupState == FAIL;
|
||||
}
|
||||
|
||||
void OnSdEjected()
|
||||
{
|
||||
if(s_BackupState == DONE || s_BackupState == FINISHED)
|
||||
{
|
||||
s_BackupState = FINISHED;
|
||||
}
|
||||
else
|
||||
{
|
||||
common::InitializeFileCheck();
|
||||
InitializeState();
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeState()
|
||||
{
|
||||
s_BackupState = STARTUP;
|
||||
s_PlayedFailSound = false;
|
||||
s_PlayedFinishedSound = false;
|
||||
s_ExistAPSettingAnnotation = false;
|
||||
s_PlayedStartCursor = false;
|
||||
s_PlayedSdPullOutCursor = false;
|
||||
s_SdWriteProetctAnnotation = false;
|
||||
}
|
||||
|
||||
} // namespace ConsoleBackup
|
||||
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Contoroller.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CONTOROLLER_H_
|
||||
#define CONTOROLLER_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueBackup);
|
||||
bool InProgress();
|
||||
bool IsBackupSucceeded();
|
||||
bool IsBackupFailed();
|
||||
void OnSdEjected();
|
||||
void InitializeState();
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONTOROLLER_H_ */
|
||||
@ -0,0 +1,564 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Exporter.cpp
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <cwchar>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <nn/fs/CTR/fs_ArchiveTypesForSystem.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/cfg/CTR/cfg_Api.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiNor.h> // cfg:norの初期化に必要
|
||||
#include <nn/cfg/CTR/cfg_NtrSettings.h>
|
||||
#include <nn/ps/CTR/ps_API.h>
|
||||
#include <nn/drivers/aes/CTR/ARM946ES/driverAes_Types.h>
|
||||
#include <nn/crypto/crypto_SwAesCtrContext.h>
|
||||
#include <nn/mcu.h>
|
||||
|
||||
#include "Exporter.h"
|
||||
#include "CommonLogger.h"
|
||||
#include "SDMountManager.h"
|
||||
#include "ConsoleBackup.h"
|
||||
#include "HeapManager.h"
|
||||
#include "SdReaderWriter.h"
|
||||
#include "FileName.h"
|
||||
#include "FileTransfer.h"
|
||||
#include "common_Types.h"
|
||||
#include "Aes_define.h"
|
||||
#include "PlayHistoryManager.h"
|
||||
#include "VersionDetect.h"
|
||||
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
common::SdReaderWriter s_SdWriter;
|
||||
common::NtrNorData s_NtrNorData;
|
||||
common::CfgCountryLanguage s_CountryLanguage;
|
||||
|
||||
::std::string s_SysSaveRoot;
|
||||
|
||||
const size_t EXPORT_THREAD_STACK_SIZE = 0x4000;
|
||||
nn::os::Thread s_ExportThread;
|
||||
nn::os::StackBuffer<EXPORT_THREAD_STACK_SIZE> s_ExportThreadStack;
|
||||
|
||||
wchar_t s_RootName[256];
|
||||
|
||||
}
|
||||
|
||||
void DeleteTrash(std::wstring currentDirectory)
|
||||
{
|
||||
// TODO: リードオンリーのファイルが消去できない
|
||||
|
||||
COMMON_LOGGER("Delete Trash.\n");
|
||||
|
||||
nn::fs::FileInputStream fis;
|
||||
nn::fs::Directory dir;
|
||||
nn::Result result;
|
||||
std::vector<nn::fs::DirectoryEntry> entryList; //カレントディレクトリのエントリ一覧を格納
|
||||
std::vector<nn::fs::DirectoryEntry>::iterator entryIndex;
|
||||
|
||||
common::SdMountManager::Mount();
|
||||
|
||||
result = dir.TryInitialize(currentDirectory.c_str());
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
nn::fs::DirectoryEntry entry;
|
||||
s32 numEntry;
|
||||
for (;;)
|
||||
{
|
||||
result = dir.TryRead(&numEntry, &entry, 1);
|
||||
if (result.IsFailure())
|
||||
{
|
||||
dir.Finalize();
|
||||
}
|
||||
if (numEntry == 0)
|
||||
{
|
||||
// ルートディレクトリを閉じる
|
||||
dir.Finalize();
|
||||
|
||||
// ルートディレクトリの子を開く
|
||||
for (entryIndex = entryList.begin(); entryIndex != entryList.end(); entryIndex++)
|
||||
{
|
||||
// ディレクトリなら削除する
|
||||
if (entryIndex->attributes.isDirectory)
|
||||
{
|
||||
NN_LOG("Try Delete %ls%ls/\n", currentDirectory.c_str(), entryIndex->entryName);
|
||||
result = nn::fs::TryDeleteDirectoryRecursively((currentDirectory + ::std::wstring(
|
||||
entryIndex->entryName)).c_str());
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
}
|
||||
// ファイルならログとAP設定以外は削除する
|
||||
else
|
||||
{
|
||||
if (std::wcscmp(entryIndex->entryName, common::AP_SETTING_FILENAME) != 0 && std::wcscmp(
|
||||
entryIndex->entryName, common::LOG_FILENAME) != 0)
|
||||
{
|
||||
NN_LOG("Try Delete %ls%ls\n", currentDirectory.c_str(), entryIndex->entryName);
|
||||
result = nn::fs::TryDeleteFile(
|
||||
(currentDirectory + ::std::wstring(entryIndex->entryName)).c_str());
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 削除完了
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// vectorに保存する
|
||||
entryList.push_back(entry);
|
||||
if (entry.attributes.isDirectory)
|
||||
{
|
||||
NN_LOG("%ls%ls/\n", currentDirectory.c_str(), entry.entryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
NN_LOG("%ls%ls\n", currentDirectory.c_str(), entry.entryName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NN_LOG("failed initialize directory\n");
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
dir.Finalize();
|
||||
}
|
||||
|
||||
common::SdMountManager::Unmount();
|
||||
}
|
||||
|
||||
void WriteRegionData()
|
||||
{
|
||||
COMMON_LOGGER("Export Region Data.\n");
|
||||
|
||||
nn::cfg::CTR::CfgRegionCode region;
|
||||
region = nn::cfg::CTR::GetRegion();
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::REGION_DATA_PATHNAME, ®ion, sizeof(nn::cfg::CTR::CfgRegionCode));
|
||||
}
|
||||
|
||||
void WriteCountryLanguageData()
|
||||
{
|
||||
COMMON_LOGGER("Export Country and Language Data.\n");
|
||||
|
||||
nn::Result result;
|
||||
|
||||
nn::cfg::nor::CTR::Initialize();
|
||||
|
||||
// 国設定
|
||||
s_CountryLanguage.country = nn::cfg::CTR::GetCountry();
|
||||
if (s_CountryLanguage.country != nn::cfg::CTR::CFG_COUNTRY_UNKNOWN)
|
||||
{
|
||||
// 言語設定
|
||||
s_CountryLanguage.language = nn::cfg::CTR::GetLanguage();
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::COUNTRY_SETTING_PATHNAME, &s_CountryLanguage, sizeof(s_CountryLanguage));
|
||||
}
|
||||
}
|
||||
|
||||
void WriteNorData()
|
||||
{
|
||||
COMMON_LOGGER("Export NOR Data.\n");
|
||||
|
||||
nn::Result result;
|
||||
|
||||
nn::cfg::nor::CTR::Initialize();
|
||||
|
||||
NN_LOG("Get NTR User Setting\n");
|
||||
|
||||
// NTR設定
|
||||
result = nn::cfg::nor::CTR::GetNtrSetting(&s_NtrNorData.ntrConfig.ncd, &s_NtrNorData.ntrConfig.ncd_ex);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// TWL WiFi設定
|
||||
result = nn::cfg::nor::CTR::ReadTwlWifiSetting(0, s_NtrNorData.TwlWiFiSetting, common::TWL_WIFI_SETTING_SIZE);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// NTR WiFi設定
|
||||
result = nn::cfg::nor::CTR::ReadNtrWifiSetting(0, s_NtrNorData.NtrWiFiSetting, common::NTR_WIFI_SETTING_SIZE);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::NOR_PATHNAME, &s_NtrNorData, sizeof(common::NtrNorData));
|
||||
}
|
||||
|
||||
void WriteSerialNumber()
|
||||
{
|
||||
COMMON_LOGGER("Export Serial Number.\n");
|
||||
|
||||
u8* serial;
|
||||
size_t size;
|
||||
GetSerialNumber(&serial, &size);
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::SERIAL_PATHNAME, serial, size);
|
||||
}
|
||||
|
||||
void WriteDeviceId()
|
||||
{
|
||||
COMMON_LOGGER("Export Device ID.\n");
|
||||
|
||||
bit32 deviceId = GetDeviceId();
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::DEVICE_ID_PATHNAME, &deviceId, sizeof(deviceId));
|
||||
}
|
||||
|
||||
void WriteIvs()
|
||||
{
|
||||
COMMON_LOGGER("Export IVS.\n");
|
||||
|
||||
void* ivs;
|
||||
size_t size;
|
||||
GetIvs(&ivs, &size);
|
||||
|
||||
void* enc;
|
||||
nn::Result result;
|
||||
enc = common::HeapManager::GetHeap()->Allocate(size);
|
||||
if(enc != NULL)
|
||||
{
|
||||
// AES暗号化する
|
||||
nn::crypto::Initialize();
|
||||
|
||||
nn::crypto::SwAesCtrContext swAesCtrContest;
|
||||
|
||||
swAesCtrContest.Initialize(common::iv, common::key, sizeof(common::key));
|
||||
swAesCtrContest.Encrypt(enc, ivs, size);
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::IVS_PATHNAME, enc, size);
|
||||
|
||||
common::HeapManager::GetHeap()->Free(enc);
|
||||
}
|
||||
}
|
||||
|
||||
// IVSからセーブデータディレクトリ名を生成する
|
||||
void GetSaveDataDirectoryRoot()
|
||||
{
|
||||
nn::Result result;
|
||||
using namespace nn::dbg;
|
||||
|
||||
const size_t SEED_SIZE = 16;
|
||||
bit8 hash[nn::crypto::Sha256Context::HASH_SIZE];
|
||||
const size_t SYS_SAVE_ROOT_LENGTH = 16;
|
||||
char rootHash[SYS_SAVE_ROOT_LENGTH];
|
||||
char rootStr[SYS_SAVE_ROOT_LENGTH * 2 + 1];
|
||||
|
||||
void* addr;
|
||||
size_t size;
|
||||
GetIvs(&addr, &size);
|
||||
|
||||
// 最後の16バイトのハッシュを使う
|
||||
nn::crypto::CalculateSha256(hash, &reinterpret_cast<bit8*> (addr)[size - SEED_SIZE], SEED_SIZE);
|
||||
|
||||
for (u8 i = 0; i < SEED_SIZE / 4; i++)
|
||||
{
|
||||
for (u8 j = 0; j < SEED_SIZE / 4; j++)
|
||||
{
|
||||
rootHash[i * 4 + j] = hash[i * 4 + 3 - j];
|
||||
}
|
||||
}
|
||||
|
||||
// 得られたハッシュから文字列を生成
|
||||
for (s32 k = 0; k < SEED_SIZE; k++)
|
||||
{
|
||||
for (s32 i = 6; i < 8; ++i)
|
||||
{
|
||||
bit32 n = (rootHash[k] >> ((7 - i) * 4)) & 0xf;
|
||||
NN_TASSERT_(n < 16);
|
||||
rootStr[i - 6 + k * 2] = static_cast<char> (n < 10 ? '0' + n : 'a' + (n - 10));
|
||||
}
|
||||
}
|
||||
rootStr[SYS_SAVE_ROOT_LENGTH * 2] = '\0';
|
||||
|
||||
// セーブデータディレクトリ名を保存する
|
||||
s_SysSaveRoot = ::std::string(rootStr);
|
||||
|
||||
NN_LOG("%s\n", s_SysSaveRoot.c_str());
|
||||
}
|
||||
|
||||
void CreateTwlDirectory(enum common::TWL_PATH_INDEX path)
|
||||
{
|
||||
NN_ASSERT(path < common::TWL_PATHNAME_MAX);
|
||||
|
||||
s_SdWriter.CreateDirectory((::std::wstring(common::SDMC_ROOT_DIRECTORY_PATH) +
|
||||
std::wstring(common::SD_TWL_ROOTNAME_TABLE[path])).c_str());
|
||||
}
|
||||
|
||||
void WriteTwlData(enum common::TWL_PATH_INDEX path)
|
||||
{
|
||||
NN_ASSERT(path < common::TWL_PATHNAME_MAX);
|
||||
|
||||
nn::Result result;
|
||||
|
||||
result = nn::fs::MountSpecialArchive(common::TWL_ARCHIVE_NAME_TABLE[path], common::TWL_FS_ARCHIVE_KIND[path]);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
result = common::SdMountManager::Mount();
|
||||
|
||||
size_t bufSize = common::HeapManager::GetHeap()->GetAllocatableSize();
|
||||
NN_LOG("AllocatableSize = %d\n", bufSize);
|
||||
|
||||
u32 fileNum = 0;
|
||||
u32 fileSize = 0;
|
||||
common::CalculateFileNum(::std::wstring(common::NAND_TWL_ROOT_PATHNAME_WITH_SLASH_TABLE[path]), fileNum, fileSize);
|
||||
|
||||
nn::fs::Unmount(common::NAND_ARCHIVE_NAME);
|
||||
|
||||
NN_LOG("File Number = %d\n", fileNum);
|
||||
NN_LOG("File Size = %d\n", fileSize);
|
||||
// 進捗表示用
|
||||
common::InitializeTransferProgress(fileSize);
|
||||
|
||||
void* buf = common::HeapManager::GetHeap()->Allocate(bufSize, AES_BLOCK_SIZE);
|
||||
if (buf != NULL)
|
||||
{
|
||||
wchar_t archiveName[256];
|
||||
::std::mbstowcs(archiveName, common::TWL_ARCHIVE_NAME_TABLE[path], std::strlen(common::TWL_ARCHIVE_NAME_TABLE[path]) + 1);
|
||||
std::wstring archiveString(archiveName);
|
||||
common::CopyDirectory(
|
||||
(archiveString + ::std::wstring(L"/")).c_str(),
|
||||
(common::SDMC_ROOT_DIRECTORY_PATH + ::std::wstring(common::SD_TWL_ROOTNAME_TABLE[path])).c_str(),
|
||||
buf, bufSize, true);
|
||||
|
||||
common::HeapManager::GetHeap()->Free(buf);
|
||||
}
|
||||
|
||||
common::SdMountManager::Unmount();
|
||||
nn::fs::Unmount(common::TWL_ARCHIVE_NAME_TABLE[path]);
|
||||
|
||||
}
|
||||
|
||||
void WriteTwlPhotoData()
|
||||
{
|
||||
COMMON_LOGGER("Export Twl Photo Data.\n");
|
||||
CreateTwlDirectory(common::TWL_PHOTO);
|
||||
WriteTwlData(common::TWL_PHOTO);
|
||||
}
|
||||
|
||||
void WriteTwlSoundData()
|
||||
{
|
||||
COMMON_LOGGER("Export Twl Sound Data.\n");
|
||||
CreateTwlDirectory(common::TWL_SOUND);
|
||||
WriteTwlData(common::TWL_SOUND);
|
||||
}
|
||||
|
||||
void ExportTwlPhotoData()
|
||||
{
|
||||
s_ExportThread.Start(WriteTwlPhotoData, s_ExportThreadStack);
|
||||
}
|
||||
|
||||
void ExportTwlSoundData()
|
||||
{
|
||||
// 不要なデータを削除する
|
||||
DeleteTrash(common::SDMC_ROOT_DIRECTORY_PATH);
|
||||
|
||||
s_ExportThread.Start(WriteTwlSoundData, s_ExportThreadStack);
|
||||
}
|
||||
|
||||
|
||||
void WriteMcuRtcData()
|
||||
{
|
||||
COMMON_LOGGER("Export RTC Data.\n");
|
||||
nn::Result result;
|
||||
nn::Handle handle = GetMcuHandle();
|
||||
|
||||
if(handle.IsValid())
|
||||
{
|
||||
nn::mcu::CTR::HwCheck mcu(handle);
|
||||
|
||||
nn::mcu::CTR::RtcData rtc;
|
||||
result = mcu.GetRtcAll(&rtc);
|
||||
NN_LOG("RTC = 20%02d/%02d/%02d %02d:%02d:%02d\n", rtc.m_Year, rtc.m_Month, rtc.m_Day, rtc.m_Hour, rtc.m_Minute, rtc.m_Second);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::MCU_RTC_PATHNAME, &rtc, sizeof(rtc));
|
||||
}
|
||||
else
|
||||
{
|
||||
NN_LOG("invalid handle\n");
|
||||
}
|
||||
}
|
||||
|
||||
void ExportThreadFunc()
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
result = nn::fs::MountSpecialArchive(common::NAND_ARCHIVE_NAME, nn::fs::CTR::ARCHIVE_TYPE_CTR_NAND);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
result = common::SdMountManager::Mount();
|
||||
|
||||
size_t bufSize = common::HeapManager::GetHeap()->GetAllocatableSize();
|
||||
NN_LOG("AllocatableSize = %d\n", bufSize);
|
||||
|
||||
void* buf = common::HeapManager::GetHeap()->Allocate(bufSize, AES_BLOCK_SIZE);
|
||||
if (buf != NULL)
|
||||
{
|
||||
|
||||
common::CopyDirectory(
|
||||
(::std::wstring(common::NAND_DATA_ROOT_PATHNAME_WITH_SLASH) + ::std::wstring(s_RootName) + ::std::wstring(L"/")).c_str(),
|
||||
(common::SDMC_ROOT_DIRECTORY_PATH + ::std::wstring(common::SD_SAVEDATA_ROOT_NAME) + ::std::wstring(s_RootName) + ::std::wstring(L"/")).c_str(),
|
||||
buf, bufSize, true);
|
||||
|
||||
common::HeapManager::GetHeap()->Free(buf);
|
||||
}
|
||||
|
||||
common::SdMountManager::Unmount();
|
||||
nn::fs::Unmount(common::NAND_ARCHIVE_NAME);
|
||||
|
||||
NN_LOG("Export Thread Finalize\n");
|
||||
}
|
||||
|
||||
nn::Result WriteSaveData()
|
||||
{
|
||||
// NANDからSDカードに書き出し
|
||||
nn::Result result;
|
||||
|
||||
result = nn::fs::MountSpecialArchive(common::NAND_ARCHIVE_NAME, nn::fs::CTR::ARCHIVE_TYPE_CTR_NAND);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
u32 fileNum = 0;
|
||||
u32 fileSize = 0;
|
||||
common::CalculateFileNum(::std::wstring(common::NAND_DATA_ROOT_PATHNAME_WITH_SLASH), fileNum, fileSize);
|
||||
|
||||
nn::fs::Unmount(common::NAND_ARCHIVE_NAME);
|
||||
|
||||
NN_LOG("File Number = %d\n", fileNum);
|
||||
NN_LOG("File Size = %d\n", fileSize);
|
||||
// 進捗表示用
|
||||
common::InitializeTransferProgress(fileSize);
|
||||
|
||||
::std::mbstowcs(s_RootName, s_SysSaveRoot.c_str(), s_SysSaveRoot.size() + 1);
|
||||
|
||||
NN_LOG("%ls\n", (::std::wstring(common::NAND_DATA_ROOT_PATHNAME_WITH_SLASH) + ::std::wstring(s_RootName) + ::std::wstring(L"/")).c_str());
|
||||
|
||||
// セーブデータディレクトリ以下のデータをSDカードにコピー
|
||||
// コピー用ディレクトリ作成
|
||||
s_SdWriter.CreateDirectory((::std::wstring(common::SDMC_ROOT_DIRECTORY_PATH) + ::std::wstring(
|
||||
common::SD_SAVEDATA_ROOT_NAME)).c_str());
|
||||
s_SdWriter.CreateDirectory((::std::wstring(common::SDMC_ROOT_DIRECTORY_PATH) + ::std::wstring(
|
||||
common::SD_SAVEDATA_ROOT_NAME) + ::std::wstring(s_RootName) + ::std::wstring(L"/")).c_str());
|
||||
|
||||
COMMON_LOGGER("Export NAND Data Start...\n");
|
||||
|
||||
// SDにコピーするためのスレッドの作成
|
||||
s_ExportThread.Start(ExportThreadFunc, s_ExportThreadStack);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void FinalizeExportThread()
|
||||
{
|
||||
s_ExportThread.Join();
|
||||
s_ExportThread.Finalize();
|
||||
}
|
||||
|
||||
void WriteVersionData()
|
||||
{
|
||||
COMMON_LOGGER("Export Version Data.\n");
|
||||
|
||||
common::VerDef versionData;
|
||||
GetVersionData(&versionData);
|
||||
|
||||
s_SdWriter.WriteBufWithCmac(common::VERSION_DATA_PATHNAME, &versionData, sizeof(common::VerDef));
|
||||
}
|
||||
|
||||
void WritePlayHistory()
|
||||
{
|
||||
common::PlayHistoryManager historyManager;
|
||||
|
||||
COMMON_LOGGER("Export PlayHistory\n");
|
||||
historyManager.Export();
|
||||
}
|
||||
|
||||
void DeleteNimSaveData()
|
||||
{
|
||||
nn::Result result;
|
||||
::std::wstring nimSaveDataPath =
|
||||
::std::wstring(common::SDMC_ROOT_DIRECTORY_PATH) +
|
||||
::std::wstring(common::SD_SAVEDATA_ROOT_NAME) +
|
||||
::std::wstring(s_RootName) +
|
||||
::std::wstring(L"/") +
|
||||
std::wstring(common::NIM_SAVEDATA_DIRECTORY_NAME);
|
||||
|
||||
common::SdMountManager::Mount();
|
||||
|
||||
NN_LOG("%ls\n", nimSaveDataPath.c_str());
|
||||
result = nn::fs::TryDeleteDirectoryRecursively(nimSaveDataPath.c_str());
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
common::SdMountManager::Unmount();
|
||||
}
|
||||
|
||||
|
||||
void ExportData()
|
||||
{
|
||||
static bool init = true;
|
||||
|
||||
if (init)
|
||||
{
|
||||
// リージョンデータをSDに書き込む
|
||||
WriteRegionData();
|
||||
|
||||
// 国データと言語データをSDに書き込む
|
||||
WriteCountryLanguageData();
|
||||
|
||||
// NORデータをSDカードに書き込む
|
||||
WriteNorData();
|
||||
|
||||
// シリアルナンバーをSDカードに書き込む
|
||||
WriteSerialNumber();
|
||||
|
||||
// デバイスIDをSDカードに書き込む
|
||||
WriteDeviceId();
|
||||
|
||||
// 完全性検証SEEDをSDカードに書き込む
|
||||
WriteIvs();
|
||||
|
||||
// IVSからセーブデータディレクトリ名を計算
|
||||
GetSaveDataDirectoryRoot();
|
||||
|
||||
// プレイ履歴をSDに書き出す
|
||||
//WritePlayHistory();
|
||||
|
||||
// RTCをSDに書き出す
|
||||
WriteMcuRtcData();
|
||||
|
||||
// バージョン情報をSDに書き出す
|
||||
WriteVersionData();
|
||||
|
||||
// NANDのセーブデータをSDに書き出す
|
||||
WriteSaveData();
|
||||
|
||||
init = false;
|
||||
}
|
||||
}
|
||||
|
||||
u32 GetProgress()
|
||||
{
|
||||
return common::GetProgress();
|
||||
}
|
||||
|
||||
bool IsExportFinished()
|
||||
{
|
||||
return s_ExportThread.IsValid() && !s_ExportThread.IsAlive();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Exporter.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef EXPORTER_H_
|
||||
#define EXPORTER_H_
|
||||
|
||||
#include <nn.h>
|
||||
|
||||
namespace ConsoleBackup
|
||||
{
|
||||
|
||||
void ExportTwlPhotoData();
|
||||
void ExportTwlSoundData();
|
||||
void ExportData();
|
||||
void DeleteNimSaveData();
|
||||
|
||||
u32 GetProgress();
|
||||
bool IsExportFinished();
|
||||
void FinalizeExportThread();
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* EXPORTER_H_ */
|
||||
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev$
|
||||
#----------------------------------------------------------------------------
|
||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
||||
#MAKECSU = true
|
||||
#INSTALL_SDK_TOOL = true
|
||||
CTR_APPTYPE = BOTH
|
||||
CTR_MAKE_DEVELOPMENT_IMAGE = true
|
||||
|
||||
TARGET_PROGRAM = ConsoleBackup
|
||||
|
||||
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
||||
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) \
|
||||
../common
|
||||
|
||||
SOURCES[] =
|
||||
ConsoleBackup.cpp
|
||||
Controller.cpp
|
||||
Exporter.cpp
|
||||
../common/HardwareInfo.cpp
|
||||
../common/DrawSystemState.cpp
|
||||
../common/FileTransfer.cpp
|
||||
../common/FileChecker.cpp
|
||||
../common/SdReaderWriter.cpp
|
||||
../common/HeapManager.cpp
|
||||
../common/SdLogger.cpp
|
||||
../common/wave.cpp
|
||||
../common/SimplePlayer.cpp
|
||||
../common/LogConsole.cpp
|
||||
../common/CommonLogger.cpp
|
||||
../common/SdMountManager.cpp
|
||||
../common/PlayHistoryManager.cpp
|
||||
../common/VersionDetect.cpp
|
||||
|
||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
||||
|
||||
ROMFS_ROOT = ../common/romfiles
|
||||
|
||||
LIBS += libnn_cfg \
|
||||
libnn_driversEeprom \
|
||||
libnn_driversi2c \
|
||||
libnn_driversCal \
|
||||
libnn_crypto \
|
||||
libnn_driversCodec \
|
||||
libnn_spi \
|
||||
libnn_gpio \
|
||||
libnn_pdn \
|
||||
libnn_mcu \
|
||||
libnn_i2c \
|
||||
libnn_driversCamera \
|
||||
libnn_ps \
|
||||
libnn_driversRsa \
|
||||
lib_demo \
|
||||
libnn_nwm \
|
||||
libnn_friends \
|
||||
libnn_nim \
|
||||
|
||||
INSTALL_SDK_TOOL = true
|
||||
|
||||
ROM_SPEC_FILE = $(TARGET_PROGRAM).rsf
|
||||
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/_private/RepairTool.desc
|
||||
|
||||
include $(ROOT_OMAKE)/modulerules
|
||||
|
||||
VERSION_H = $(file version.h)
|
||||
|
||||
$(VERSION_H): $(SOURCES)
|
||||
section
|
||||
bash genversion.sh
|
||||
|
||||
RequireSetup($(VERSION_H))
|
||||
build: $(VERSION_H) $(DEFAULT_TARGETS)
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ф8ф8фШчГГГГГГВ╫В╫8фВ╫В╫В╫В╫В╫ГГГГшчфГШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГШчyнYнВ╫шчшчВ╫В╫фВ╫В╫шчyнШчВ╫yнГГГГyнШФГГГГГшчВ╫В╫В╫В╫YнГyнГВ╫В╫В╫В╫В╫yнфшчГШФГYнyнВ╫В╫В╫yнВ╫╨жВ╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнГYнГВ╫В╫В╫В╫В╫фВ╫В╫ГyнГ8фВ╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫8ф8фВ╫В╫В╫╨ж8ф╨жГГшчГГГГГГГГГГГГГГГГГГГГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8ф8фВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГШФГГГГГГГГГГ жфГГВ╫В╫ жВ╫ГГГГГ жГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫шчВ╫В╫В╫В╫В╫ГВ╫ШчВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫╨жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГГГГГГГГГГГГГГШФ8фШчшчВ╫В╫ жВ╫YнВ╫В╫В╫В╫В╫ГГYнyнГГyнфВ╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчшчГшчШФВ╫В╫ГГYнГВ╫В╫В╫В╫В╫шчВ╫шчГГГГГГГГГГГГГГГГВ╫В╫YнШч жГГГГГГГГГГГГГГГГГГГГГГГГшч╨жВ╫ жВ╫шчВ╫В╫В╫В╫В╫ШФВ╫ШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫yнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫ жГГГГВ╫шчВ╫шчГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫╨жшчВ╫В╫В╫В╫В╫YнфyнГГГГГГГГГ жГГГГ╨жВ╫YнВ╫ШФYнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шч жВ╫В╫В╫В╫В╫В╫yнВ╫ГШФВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ШФВ╫ГГГГГВ╫ШчВ╫YнГГШФГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГ жВ╫шчВ╫ГГГшч жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
4
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleBackup/genversion.sh
Executable file
4
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleBackup/genversion.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash -f
|
||||
|
||||
cd ../
|
||||
echo "#define BACKUP_VERSION_NUM \"`svn info|grep 'Last Changed Rev:'| awk -F ':' '{print $2}'|tr -d '\n'| sed 's/ //g'`\"" > ./ConsoleBackup/version.h
|
||||
Binary file not shown.
@ -0,0 +1,469 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ConsoleRestore.cpp
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/version.h>
|
||||
#include <nn/ptm/CTR/ptm_ApiSysmenu.h>
|
||||
#include <nn/mcu.h>
|
||||
#include <nn/cfg/CTR/cfg_Api.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiInit.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||
#include <nn/ps.h>
|
||||
#include <nn/nwm.h>
|
||||
#include <nn/ac.h>
|
||||
#include <nn/friends.h>
|
||||
#include <nn/friends/CTR/friends_ApiPrivate.h>
|
||||
#include <nn/fs/CTR/fs_ArchiveTypesForSystem.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/fs/fs_ApiSysSaveData.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiNor.h>
|
||||
#include <nn/am/am_ApiSystemMenu.h>
|
||||
#include <nn/os/os_SharedInfo.h>
|
||||
#include <nn/ndm.h>
|
||||
#include <nn/nim.h>
|
||||
#include "demo.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "ConsoleRestore.h"
|
||||
#include "DrawSystemState.h"
|
||||
#include "Controller.h"
|
||||
#include "SimplePlayer.h"
|
||||
#include "CommonLogger.h"
|
||||
#include "SDMountManager.h"
|
||||
#include "HeapManager.h"
|
||||
#include "VersionDetect.h"
|
||||
#include "HardwareInfo.h"
|
||||
|
||||
// svnリビジョン埋め込み用
|
||||
#include "version.h"
|
||||
#ifndef RESTORE_VERSION_NUM
|
||||
#define RESOTRE_VERSION_NUM 0
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// グラフィックスに割り当てるメモリ
|
||||
const size_t s_GxHeapSize = 0x800000;
|
||||
|
||||
demo::RenderSystemDrawing s_RenderSystem;
|
||||
nn::Handle s_McuSession;
|
||||
|
||||
// バッテリ残量
|
||||
u8 batteryRemain = 100;
|
||||
|
||||
// シリアルナンバー
|
||||
u8 s_SerialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN];
|
||||
|
||||
// デバイスID
|
||||
bit32 s_DeviceId;
|
||||
|
||||
// シリアルナンバーが読めるかどうか
|
||||
bool s_CanReadSerialNumber = false;
|
||||
|
||||
// IVSへのポインタ
|
||||
void* sp_Ivs;
|
||||
|
||||
size_t s_SizeofIvs;
|
||||
|
||||
// IVSが読めるかどうか
|
||||
bool s_CanReadIvs = false;
|
||||
|
||||
// バージョン情報
|
||||
common::VerDef s_VerData;
|
||||
|
||||
} // namespace <unnamed>
|
||||
|
||||
namespace ConsoleRestore{
|
||||
|
||||
bool IsAdapterConnected()
|
||||
{
|
||||
return nn::ptm::CTR::GetAdapterState() == nn::ptm::CTR::ADAPTERSTATE_CONNECTED;
|
||||
}
|
||||
|
||||
bool IsBatteryLower()
|
||||
{
|
||||
return batteryRemain <= 10;
|
||||
}
|
||||
|
||||
bool CanReadIVS()
|
||||
{
|
||||
return s_CanReadIvs;
|
||||
}
|
||||
|
||||
bool CanReadSerialNumber()
|
||||
{
|
||||
return s_CanReadSerialNumber;
|
||||
}
|
||||
|
||||
void GetSerialNumber(u8** serial, size_t* size)
|
||||
{
|
||||
*serial = s_SerialNo;
|
||||
*size = nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN;
|
||||
}
|
||||
|
||||
void GetIvs(void** ivs, size_t* size)
|
||||
{
|
||||
*ivs = sp_Ivs;
|
||||
*size = s_SizeofIvs;
|
||||
}
|
||||
|
||||
bit32 GetDeviceId()
|
||||
{
|
||||
return s_DeviceId;
|
||||
}
|
||||
|
||||
void GetVersionData(common::VerDef* version)
|
||||
{
|
||||
*version = s_VerData;
|
||||
}
|
||||
|
||||
void FinalizeAll()
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->Finalize();
|
||||
// アンマウント
|
||||
nn::fs::Unmount("nand:");
|
||||
nn::fs::Unmount("sdmc:");
|
||||
s_RenderSystem.Finalize();
|
||||
|
||||
nn::mcu::CTR::FinalizeHwCheck(&s_McuSession);
|
||||
nn::friends::detail::Finalize();
|
||||
nn::ps::Finalize();
|
||||
nn::ptm::CTR::FinalizeForSystemMenu();
|
||||
nn::cfg::CTR::system::Finalize();
|
||||
nn::cfg::CTR::init::Finalize();
|
||||
nn::hid::Finalize();
|
||||
nn::fs::Finalize();
|
||||
|
||||
nn::applet::PrepareToCloseApplication();
|
||||
nn::applet::CloseApplication();
|
||||
}
|
||||
|
||||
nn::Handle GetMcuHandle()
|
||||
{
|
||||
return s_McuSession;
|
||||
}
|
||||
|
||||
extern "C" void nnMain(void)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
// os の初期化
|
||||
nn::os::Initialize();
|
||||
|
||||
// fs の初期化
|
||||
nn::fs::Initialize();
|
||||
|
||||
// appletの初期化
|
||||
nn::applet::Enable( false );
|
||||
|
||||
// hid の初期化
|
||||
result = nn::hid::Initialize();
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
|
||||
// ndmの初期化
|
||||
result = nn::ndm::Initialize();
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
|
||||
// デーモンの自律動作を停止
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_CEC);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_BOSS);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_FRIENDS);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
result = nn::ndm::Suspend(nn::ndm::DN_NIM);
|
||||
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
|
||||
|
||||
// cfg の初期化
|
||||
nn::cfg::CTR::init::Initialize();
|
||||
nn::cfg::CTR::system::Initialize();
|
||||
|
||||
// 時計設定用ptm初期化
|
||||
nn::ptm::CTR::InitializeForSystemMenu();
|
||||
|
||||
// ps の初期化
|
||||
nn::ps::Initialize();
|
||||
|
||||
// friendsの初期化
|
||||
result = nn::friends::detail::Initialize();
|
||||
|
||||
// mcuの初期化
|
||||
nn::mcu::CTR::InitializeHwCheck(&s_McuSession);
|
||||
nn::mcu::CTR::HwCheck mcu(s_McuSession);
|
||||
|
||||
// amの初期化
|
||||
nn::am::InitializeForSystemMenu();
|
||||
|
||||
// ヒープの確保
|
||||
common::HeapManager::GetHeap()->Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
|
||||
|
||||
// RenderSystem の準備
|
||||
uptr heapForGx = reinterpret_cast<uptr>(common::HeapManager::GetHeap()->Allocate(s_GxHeapSize));
|
||||
s_RenderSystem.Initialize(heapForGx, s_GxHeapSize);
|
||||
|
||||
// サウンドスレッドの起動
|
||||
common::InitializeSimplePlayer();
|
||||
|
||||
// ログ描画の初期化
|
||||
common::Logger::GetLoggerInstance()->Initialize(CONSOLE_WIDTH, CONSOLE_HEIGHT, CONSOLE_MAX_LINE, &s_RenderSystem);
|
||||
|
||||
// RenderSystemを作ってからログが出せる
|
||||
common::Logger::InitializeEjectThread();
|
||||
common::Logger::SetEjectHandler(OnSdEjected);
|
||||
COMMON_LOGGER("\n");
|
||||
COMMON_LOGGER("CTR Console Restore start\n");
|
||||
|
||||
// ボタン入力
|
||||
nn::hid::PadReader s_PadReader;
|
||||
nn::hid::PadStatus padStatus;
|
||||
|
||||
// データの準備
|
||||
|
||||
// 完全性検証SEEDの取得
|
||||
result = nn::fs::MountSpecialArchive("nand:", nn::fs::CTR::ARCHIVE_TYPE_CTR_NAND);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
nn::fs::FileInputStream fis;
|
||||
|
||||
result = fis.TryInitialize(L"nand:/private/movable.sed");
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s64 fileSize = fis.GetSize();
|
||||
s32 ret;
|
||||
void* addr = NULL;
|
||||
addr = common::HeapManager::GetHeap()->Allocate(fileSize);
|
||||
if (addr != NULL)
|
||||
{
|
||||
sp_Ivs = addr;
|
||||
s_SizeofIvs = fileSize;
|
||||
result = fis.TryRead(&ret, addr, fileSize);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
s_CanReadIvs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
fis.Finalize();
|
||||
}
|
||||
// 一旦アンマウントしておく
|
||||
nn::fs::Unmount("nand:");
|
||||
|
||||
// リージョンの取得
|
||||
nn::cfg::CTR::CfgRegionCode region;
|
||||
region = nn::cfg::CTR::GetRegion();
|
||||
|
||||
// シリアルナンバーの取得
|
||||
std::memset(s_SerialNo, '\0',
|
||||
nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN);
|
||||
result = nn::cfg::CTR::system::GetSerialNo(s_SerialNo);
|
||||
common::HardwareInfo hwInfo;
|
||||
hwInfo.AddCheckDigit(reinterpret_cast<char*>(s_SerialNo));
|
||||
if(result.IsSuccess())
|
||||
{
|
||||
s_CanReadSerialNumber = true;
|
||||
}
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// デバイスIDの取得
|
||||
result = nn::ps::CTR::GetDeviceId(&s_DeviceId);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
bit64 infraDeviceId;
|
||||
result = nn::nim::CTR::InitializeForShop();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
result = nn::nim::CTR::Shop::GetInfraDeviceId(s_DeviceId, &infraDeviceId);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
result = nn::nim::CTR::FinalizeForShop();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// MACアドレスの取得
|
||||
nn::nwm::Mac mac;
|
||||
char8 macAddress[nn::nwm::Mac::MAC_STRING_SIZE];
|
||||
|
||||
result = nn::nwm::GetMacAddress(mac);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
mac.GetString(macAddress);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// フレンドコードの取得
|
||||
nn::friends::CTR::FriendKey friendKey;
|
||||
result = nn::friends::CTR::GetMyFriendKey(&friendKey);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
u64 friendCode = nn::friends::CTR::FriendKeyToFriendCode(friendKey);
|
||||
|
||||
// バージョンの取得
|
||||
common::GetSystemVersion(&s_VerData, region);
|
||||
|
||||
// 情報出力
|
||||
COMMON_LOGGER("CTR Console Restore %s Rev.%s\n", __DATE__, RESTORE_VERSION_NUM);
|
||||
COMMON_LOGGER("System Ver. %d.%d.%d-%d\n", s_VerData.cup.majorVersion, s_VerData.cup.minorVersion, s_VerData.cup.microVersion,
|
||||
s_VerData.nup.majorVersion);
|
||||
COMMON_LOGGER("System Region %s\n", nn::cfg::CTR::GetRegionCodeA3(region));
|
||||
COMMON_LOGGER("Serial Number %s\n", s_SerialNo);
|
||||
COMMON_LOGGER("Device ID %llu\n", infraDeviceId);
|
||||
COMMON_LOGGER("MAC Address %s\n", macAddress);
|
||||
COMMON_LOGGER("Friend Code %04u-%04u-%04u\n",
|
||||
static_cast<u32>(friendCode / 100000000ULL % 10000ULL),
|
||||
static_cast<u32>(friendCode / 10000ULL % 10000ULL),
|
||||
static_cast<u32>(friendCode % 10000ULL) );
|
||||
|
||||
|
||||
bool flip = false;
|
||||
bool continueRestore = false;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
bool nextStep = false;
|
||||
|
||||
s_PadReader.ReadLatest(&padStatus);
|
||||
|
||||
// AまたはSTARTボタンで進行
|
||||
if(padStatus.trigger & nn::hid::BUTTON_A ||
|
||||
padStatus.trigger & nn::hid::BUTTON_START)
|
||||
{
|
||||
nextStep = true;
|
||||
}
|
||||
|
||||
// LまたはRボタンで上下画面フリップ
|
||||
if(padStatus.trigger & nn::hid::BUTTON_R ||
|
||||
padStatus.trigger & nn::hid::BUTTON_L)
|
||||
{
|
||||
flip = !flip;
|
||||
}
|
||||
|
||||
// コンソールスクロール
|
||||
if(padStatus.hold & nn::hid::BUTTON_UP)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollUp();
|
||||
}
|
||||
|
||||
// コンソールスクロール
|
||||
if(padStatus.hold & nn::hid::BUTTON_DOWN)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollDown();
|
||||
}
|
||||
|
||||
if(padStatus.hold & nn::hid::BUTTON_LEFT)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollToBegin();
|
||||
}
|
||||
|
||||
if(padStatus.hold & nn::hid::BUTTON_RIGHT)
|
||||
{
|
||||
common::Logger::GetLoggerInstance()->ScrollToEnd();
|
||||
}
|
||||
|
||||
// 情報更新
|
||||
// バッテリ
|
||||
mcu.GetBatteryRemain(&batteryRemain);
|
||||
// ACアダプタ
|
||||
std::string adapterState;
|
||||
if(IsAdapterConnected())
|
||||
{
|
||||
adapterState += ::std::string("Connected");
|
||||
}
|
||||
else
|
||||
{
|
||||
adapterState += ::std::string("Not Connected");
|
||||
}
|
||||
|
||||
// 操作用メッセージ
|
||||
// 進捗確認メッセージを兼ねる?
|
||||
::std::vector<std::string> operationMessage;
|
||||
|
||||
ControlState(operationMessage, nextStep, continueRestore);
|
||||
|
||||
nn::util::FloatColor titleColor;
|
||||
|
||||
if(GetRestoreMode() == RESTORE_MODE_RESTORE)
|
||||
{
|
||||
titleColor.r = 0.1f;
|
||||
titleColor.g = 0.25f;
|
||||
titleColor.b = 0.1f;
|
||||
}
|
||||
else if(GetRestoreMode() == RESTORE_MODE_NUP_ONLY)
|
||||
{
|
||||
titleColor.r = 0.35f;
|
||||
titleColor.g = 0.35f;
|
||||
titleColor.b = 0.f;
|
||||
}
|
||||
|
||||
// 上画面表示
|
||||
common::DrawSystemState("CTR Console Restore",
|
||||
s_RenderSystem,
|
||||
titleColor,
|
||||
flip,
|
||||
adapterState,
|
||||
RESTORE_VERSION_NUM,
|
||||
&s_VerData,
|
||||
batteryRemain,
|
||||
infraDeviceId,
|
||||
friendCode,
|
||||
GetProgress(),
|
||||
macAddress,
|
||||
operationMessage,
|
||||
region,
|
||||
s_SerialNo
|
||||
);
|
||||
|
||||
if (GetRestoreMode() == RESTORE_MODE_NUP_ONLY)
|
||||
{
|
||||
const u8 spaceSize = 10;
|
||||
const u8 lineBottom = 23;
|
||||
const u32 screenWidth = 400;
|
||||
|
||||
s_RenderSystem.SetColor(1.f, 1.f, 1.f);
|
||||
s_RenderSystem.DrawText(0, lineBottom * spaceSize, "NUP-Only Mode");
|
||||
s_RenderSystem.SetColor(titleColor.r, titleColor.g, titleColor.b);
|
||||
s_RenderSystem.FillRectangle(0, lineBottom * spaceSize, screenWidth, spaceSize);
|
||||
s_RenderSystem.SetColor(1.f, 1.f, 1.f);
|
||||
}
|
||||
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
// デフォルトで下画面に描画するもの
|
||||
s_RenderSystem.SetRenderTarget(common::GetRenderTarget(NN_GX_DISPLAY1, flip));
|
||||
if(IsRestoreSucceeded())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), SUCCESS_COLOR);
|
||||
}
|
||||
else if(IsRestoreFailed())
|
||||
{
|
||||
s_RenderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), FAIL_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RenderSystem.SetClearColor(common::GetRenderTarget(NN_GX_DISPLAY1, flip), NORMAL_COLOR);
|
||||
}
|
||||
s_RenderSystem.Clear();
|
||||
s_RenderSystem.SetColor(1.f, 1.f, 1.f);
|
||||
|
||||
common::Logger::GetLoggerInstance()->DrawConsole();
|
||||
s_RenderSystem.SwapBuffers();
|
||||
|
||||
|
||||
s_RenderSystem.WaitVsync(NN_GX_DISPLAY_BOTH);
|
||||
|
||||
// 電源長押しで終了
|
||||
if ( nn::applet::IsExpectedToCloseApplication())
|
||||
{
|
||||
FinalizeAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: ConsoleRestore.h
|
||||
|
||||
Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs contain
|
||||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
Company Ltd., and are protected by Federal copyright law. They may
|
||||
not be disclosed to third parties or copied or duplicated in any form,
|
||||
in whole or in part, without the prior written consent of Nintendo.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NN_CONSOLERESTORE_H_
|
||||
#define NN_CONSOLERESTORE_H_
|
||||
|
||||
#include <nn.h>
|
||||
#include "VersionDetect.h"
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
bool IsAdapterConnected();
|
||||
bool IsBatteryLower();
|
||||
bool CanReadIVS();
|
||||
bool CanReadSerialNumber();
|
||||
void GetSerialNumber(u8** serial, size_t* size);
|
||||
void GetIvs(void** ivs, size_t* size);
|
||||
nn::Handle GetMcuHandle();
|
||||
void GetVersionData(common::VerDef* version);
|
||||
bit32 GetDeviceId();
|
||||
|
||||
void FinalizeAll();
|
||||
|
||||
const u32 CONSOLE_WIDTH = 38;
|
||||
const u32 CONSOLE_HEIGHT = 24;
|
||||
const u32 CONSOLE_MAX_LINE = 1000;
|
||||
|
||||
}
|
||||
|
||||
// 描画色の定義
|
||||
#define WHITE_COLOR 1.f, 1.f, 1.f, 1.f
|
||||
#define GRAY_COLOR 0.5, 0.5, 0.5, 1.f
|
||||
#define RED_COLOR 1.f, 0.f, 0.f, 1.f
|
||||
#define GREEN_COLOR 0.f, 1.f, 0.f, 1.f
|
||||
#define BLUE_COLOR 0.f, 0.f, 1.f, 1.f
|
||||
#define SUCCESS_COLOR 0.f, 0.6f,0.f, 1.f
|
||||
#define FAIL_COLOR 0.6f, 0.f,0.f, 1.f
|
||||
#define NORMAL_COLOR 0.f, 0.f, 0.f, 1.f
|
||||
|
||||
/* NN_CONSOLERESTORE_H_ */
|
||||
#endif
|
||||
@ -0,0 +1,52 @@
|
||||
BasicInfo:
|
||||
Title : ConsoleRestore
|
||||
ProductCode: ConsoleRestore
|
||||
BackupMemoryType: None
|
||||
|
||||
TitleInfo:
|
||||
Use: Evaluation
|
||||
Category: Application
|
||||
UniqueId: 0xf8022
|
||||
Version: 0
|
||||
|
||||
SystemControlInfo:
|
||||
AppType : Application
|
||||
StackSize : 0x4000
|
||||
Dependency :
|
||||
- gpio
|
||||
- pdn
|
||||
- spi
|
||||
- i2c
|
||||
- mcu
|
||||
- ptm
|
||||
- codec
|
||||
- cfg
|
||||
- hid
|
||||
- gsp
|
||||
- friends
|
||||
- nim
|
||||
- ac
|
||||
- ndm
|
||||
|
||||
AccessControlInfo:
|
||||
Priority : 16
|
||||
DisableDebug : true
|
||||
|
||||
FileSystemAccess:
|
||||
- DirectSdmc
|
||||
- Debug
|
||||
- Core
|
||||
- CategoryFileSystemTool
|
||||
|
||||
IoAccessControl:
|
||||
- FsMountCardSpi
|
||||
- FsMountNand
|
||||
- FsMountTwln
|
||||
|
||||
Option:
|
||||
FreeProductCode: true
|
||||
|
||||
|
||||
Rom:
|
||||
# ROM に含めるファイルシステムのルートパスを指定します。
|
||||
HostRoot: "$(ROMFS_ROOT)"
|
||||
@ -0,0 +1,940 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Controller.cpp
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/ns.h>
|
||||
#include <nn/CTR/CTR_DeliverArg.h>
|
||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
||||
#include <nn/ptm/CTR/ptm_ApiSysmenu.h>
|
||||
#include <nn/ptm/CTR/ptm_ApiSystem.h>
|
||||
#include <nn/pl/CTR/pl_PlayHistoryApiSysmenu.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiSys.h>
|
||||
|
||||
#include "Controller.h"
|
||||
#include "FileChecker.h"
|
||||
#include "ConsoleRestore.h"
|
||||
#include "SimplePlayer.h"
|
||||
#include "CommonLogger.h"
|
||||
#include "Importer.h"
|
||||
#include "Updater.h"
|
||||
#include "NtpClient.h"
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
typedef enum RestoreState
|
||||
{
|
||||
STARTUP, // 初期値
|
||||
SERIAL_IS_NOT_IN_SD, // シリアルナンバーファイルがSDカードにないことを表示
|
||||
SERIAL_IN_SD, // シリアルナンバーの情報を表示
|
||||
UPDATE_IN_PROGRESS, // アップデート中
|
||||
UPDATE_DONE, // アップデート完了
|
||||
NUP_ONLY_WAIT_SD_EJECT, // NUP_ONLYモードでSDカード抜き待ち
|
||||
NUP_ONLY_WAIT_NEXT, // NUP_ONLYモードでキー入力待ち
|
||||
RESTORE_TWL_SOUND, // TWLサウンドの書き込み中
|
||||
RESTORE_TWL_PHOTO, // TWL写真の書き込み中
|
||||
RESTORE_IN_PROGRESS, // 書き込み中
|
||||
POST_RESTORE, // 書き込み後の処理
|
||||
RESTORE_DONE, // 書き込み完了
|
||||
REBOOTING, // 再起動を行う
|
||||
ERASE, // 削除処理を行う
|
||||
HISTORY_RECOVER, // プレイ履歴の書き戻しを行う
|
||||
TIME_ADJUST, // 時計あわせを行う
|
||||
WAIT_SD_EJECT, // SDカードぬき待ち
|
||||
ALL_DONE, // すべて完了
|
||||
SHUTDOWN, // シャットダウン中
|
||||
FAIL // 失敗
|
||||
} RestoreState;
|
||||
|
||||
// Restore状態管理
|
||||
RestoreState s_RestoreState = STARTUP;
|
||||
// Restoreモード管理
|
||||
RestoreMode s_RestoreMode = RESTORE_MODE_RESTORE;
|
||||
|
||||
// インターネット設定を読んだかどうか
|
||||
bool s_ReadSettingDone = false;
|
||||
// インターネット設定を読んだ結果
|
||||
bool s_ReadSettingSuccess = false;
|
||||
// NUP専用モードかどうか
|
||||
bool s_NupOnlyMode = false;
|
||||
|
||||
// APSettingの書式が無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistAPSettingAnnotation = false;
|
||||
// APSettingの書式が違っている警告サウンドを鳴らしたかどうか
|
||||
bool s_APSettingAnnotation = false;
|
||||
// シリアルナンバーがない警告サウンドを鳴らしたかどうか
|
||||
bool s_SerialNumberAnnotation = false;
|
||||
// 失敗サウンドを鳴らしたかどうか
|
||||
bool s_PlayedFailSound = false;
|
||||
// 操作開始サウンドを鳴らしたかどうか
|
||||
bool s_PlayedStartCursor = false;
|
||||
// リブート開始前サウンドを鳴らしたかどうか
|
||||
bool s_PlayedRebootCursor = false;
|
||||
// SD抜き出し前サウンドを鳴らしたかどうか
|
||||
bool s_PlayedSdPullOutCursor = false;
|
||||
// バージョンデータが無い警告サウンドを鳴らしたかどうか
|
||||
bool s_ExistsVersionDataAnnotation = false;
|
||||
// バージョンデータを読んだかどうか
|
||||
bool s_ReadVersionDone = false;
|
||||
// バージョンデータを読んだ結果
|
||||
nn::Result s_ReadVersionResult = nn::ResultSuccess();
|
||||
// SDに書き込みできない警告サウンドを鳴らしたかどうか
|
||||
bool s_SdWriteProetctAnnotation = false;
|
||||
|
||||
// ネットワークアップデートを開始したかどうか
|
||||
bool s_ExecuteFgNup = false;
|
||||
// FGNUPを何回リトライしたか
|
||||
u32 s_FgNupRetryCount = 0;
|
||||
|
||||
|
||||
} // namespace <unnamed>
|
||||
|
||||
bool NeedsAcAdater()
|
||||
{
|
||||
return IsBatteryLower() && !IsAdapterConnected();
|
||||
}
|
||||
|
||||
bool CheckAndReadAPSetting(::std::vector<std::string>& operationMessage)
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
if (!ExistsAPSetting())
|
||||
{
|
||||
if(!s_ExistAPSettingAnnotation)
|
||||
{
|
||||
s_ExistAPSettingAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
operationMessage.push_back(::std::string("Accsess_Point_Setting does not exist!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// 設定ファイルからAP設定を読み込む
|
||||
if (!s_ReadSettingDone)
|
||||
{
|
||||
s_ReadSettingDone = true;
|
||||
s_ReadSettingSuccess = ReadSetting(&s_NupOnlyMode);
|
||||
}
|
||||
|
||||
if(s_NupOnlyMode)
|
||||
{
|
||||
s_RestoreMode = RESTORE_MODE_NUP_ONLY;
|
||||
}
|
||||
|
||||
if (!s_ReadSettingSuccess)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Invalid Accsess_Point_Setting format!"));
|
||||
if(!s_APSettingAnnotation)
|
||||
{
|
||||
s_APSettingAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return s_ReadSettingSuccess;
|
||||
}
|
||||
|
||||
nn::Result CheckAndReadVersionData(::std::vector<std::string>& operationMessage)
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
if (!ExistsVersionData())
|
||||
{
|
||||
if(!s_ExistsVersionDataAnnotation)
|
||||
{
|
||||
s_ExistsVersionDataAnnotation = true;
|
||||
common::PlaySound(common::SOUND_ANNOTATION);
|
||||
}
|
||||
operationMessage.push_back(::std::string("Version Data does not exist!"));
|
||||
return nn::Result(nn::Result::LEVEL_PERMANENT, nn::Result::SUMMARY_NOT_FOUND, nn::Result::MODULE_COMMON,
|
||||
nn::Result::DESCRIPTION_NOT_FOUND);
|
||||
}
|
||||
|
||||
// バージョン情報ファイルを読み込む
|
||||
if (!s_ReadVersionDone)
|
||||
{
|
||||
s_ReadVersionDone = true;
|
||||
s_ReadVersionResult = ReadVersionData();
|
||||
}
|
||||
|
||||
return s_ReadVersionResult;
|
||||
}
|
||||
|
||||
void PutAliveMessage(::std::vector<std::string>& operationMessage, const char* str)
|
||||
{
|
||||
std::string message = std::string(str);
|
||||
static u8 i = 0;
|
||||
if (i < 0xff / 4)
|
||||
{
|
||||
operationMessage.push_back(message + std::string(" /"));
|
||||
}
|
||||
else if (i < 0xff * 2 / 4)
|
||||
{
|
||||
operationMessage.push_back(message + std::string(" |"));
|
||||
}
|
||||
else if (i < 0xff * 3 / 4)
|
||||
{
|
||||
operationMessage.push_back(message + std::string(" \\"));
|
||||
}
|
||||
else
|
||||
{
|
||||
operationMessage.push_back(message + std::string(" -"));
|
||||
}
|
||||
i += 4;
|
||||
}
|
||||
|
||||
nn::Result ExecSyncMcuRtc()
|
||||
{
|
||||
nn::Result result = nn::ResultSuccess();
|
||||
if(!common::ExistsRtcSyncFinishedFile())
|
||||
{
|
||||
result = ImportMcuRtc();
|
||||
if(result.IsSuccess())
|
||||
{
|
||||
// RTCを同期完了ファイルを作る
|
||||
CreateRtcSyncFinishedFile();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Zero NUP限定コード
|
||||
bool NeedsNup()
|
||||
{
|
||||
if(AlreadyExecutedNup() || s_NupOnlyMode)
|
||||
{
|
||||
return !common::ExistsUpdateCheckedFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore)
|
||||
{
|
||||
using namespace common;
|
||||
nn::Result result;
|
||||
|
||||
// 状態遷移Controller
|
||||
switch (s_RestoreState)
|
||||
{
|
||||
// 起動時
|
||||
case STARTUP:
|
||||
{
|
||||
bool error = false;
|
||||
bool needsUpdate = false;
|
||||
bool needsErase = false;
|
||||
bool validApSetting = false;
|
||||
|
||||
// SDカードが挿入されているか?
|
||||
if (nn::fs::IsSdmcInserted())
|
||||
{
|
||||
// SDカードに書き込みできるか?
|
||||
if (!nn::fs::IsSdmcWritable())
|
||||
{
|
||||
if (!s_SdWriteProetctAnnotation)
|
||||
{
|
||||
s_SdWriteProetctAnnotation = true;
|
||||
PlaySound(SOUND_ANNOTATION);
|
||||
}
|
||||
operationMessage.push_back(::std::string("Can*t Write SD Card!!\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
result = CheckAndReadVersionData(operationMessage);
|
||||
if(result.IsFailure())
|
||||
{
|
||||
// バージョン情報の取得に失敗
|
||||
error = true;
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
validApSetting = CheckAndReadAPSetting(operationMessage);
|
||||
if (!validApSetting)
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// NUPが必要か?
|
||||
if (!NeedsNup())
|
||||
{
|
||||
if (s_NupOnlyMode)
|
||||
{
|
||||
s_RestoreState = NUP_ONLY_WAIT_SD_EJECT;
|
||||
|
||||
// リストア状態チェックファイルをすべて削除
|
||||
DeleteAllCheckFiles();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// SDカードに書き込み完了ファイルがあるか?
|
||||
if (!ExistsWriteFinishedFile())
|
||||
{
|
||||
// IVSを読めるか?
|
||||
if (CanReadIVS())
|
||||
{
|
||||
// 本体初期化完了ファイルがあるか?
|
||||
if (ExistsConsoleInitializedFile())
|
||||
{
|
||||
// SDカードにシリアルナンバーがあるか?
|
||||
if (!ExistsSerialNumberFile())
|
||||
{
|
||||
COMMON_LOGGER("Can't Read Serial Number in SD Card!!\n");
|
||||
error = true;
|
||||
s_RestoreState = SERIAL_IS_NOT_IN_SD;
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 serial[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN];
|
||||
result = ReadSerialNumber(serial);
|
||||
if(result.IsSuccess())
|
||||
{
|
||||
::std::string serialStr(reinterpret_cast<char*> (serial));
|
||||
operationMessage.push_back(::std::string("Serial Number in SD : ") + serialStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SDカードにリージョンデータがあるか?
|
||||
if (ExistsRegionData())
|
||||
{
|
||||
// リージョンデータは一致しているか?
|
||||
if (EqualsRegionDataandRegion().IsFailure())
|
||||
{
|
||||
COMMON_LOGGER("Current Region and Region in SD differ!!\n");
|
||||
error = true;
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 移行不能なのでFAIL
|
||||
COMMON_LOGGER("Can't Read Region in SD Card!!\n");
|
||||
error = true;
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ExistsIVSFile())
|
||||
{
|
||||
// 移行不能なのでFAIL
|
||||
COMMON_LOGGER("Can't Read IVS in SD Card!!\n");
|
||||
error = true;
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Initialize Console\n");
|
||||
|
||||
// 本体初期化完了ファイルを作る
|
||||
CreateConsoleInitializedFile();
|
||||
|
||||
// ファイルシステムの初期化を行う
|
||||
InitializeFileSystem();
|
||||
error = true;
|
||||
s_RestoreState = REBOOTING;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Can't Read IVS!!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (validApSetting)
|
||||
{
|
||||
// 削除処理を行う
|
||||
needsErase = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (validApSetting)
|
||||
{
|
||||
// ネットワークアップデートを行う
|
||||
needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Insert SD Card!!"));
|
||||
}
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdater())
|
||||
{
|
||||
error = true;
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// エラーが無ければ進行用メッセージ表示
|
||||
if (!error)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
if(needsUpdate)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Network Update Mode"));
|
||||
}
|
||||
else if(needsErase)
|
||||
{
|
||||
operationMessage.push_back(::std::string("Clock Sync Mode"));
|
||||
}
|
||||
else
|
||||
{
|
||||
operationMessage.push_back(::std::string("Import Data Mode"));
|
||||
}
|
||||
|
||||
if(!s_PlayedStartCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedStartCursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextStep && !error)
|
||||
{
|
||||
if (needsUpdate)
|
||||
{
|
||||
COMMON_LOGGER("Start Network Update\n");
|
||||
s_RestoreState = UPDATE_IN_PROGRESS;
|
||||
}
|
||||
else if(needsErase)
|
||||
{
|
||||
COMMON_LOGGER("Erase Trash\n");
|
||||
s_RestoreState = ERASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Start Import Data\n");
|
||||
// Zero NUP限定
|
||||
// RTC同期を行う
|
||||
// NUPされない場合があるのでここで同期
|
||||
result = ExecSyncMcuRtc();
|
||||
if(result <= nn::fs::ResultVerificationFailed())
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = RESTORE_TWL_SOUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// シリアルナンバーがSDカードにないこと警告
|
||||
case SERIAL_IS_NOT_IN_SD:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Serial Number Is Not In SD Card"));
|
||||
operationMessage.push_back(::std::string("Push A or START Button"));
|
||||
operationMessage.push_back(::std::string("Import Data Mode"));
|
||||
|
||||
if (!s_SerialNumberAnnotation)
|
||||
{
|
||||
s_SerialNumberAnnotation = true;
|
||||
PlaySound(SOUND_ANNOTATION);
|
||||
}
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
s_RestoreState = RESTORE_TWL_SOUND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// アップデート中
|
||||
case UPDATE_IN_PROGRESS:
|
||||
{
|
||||
continueRestore = true;
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdater())
|
||||
{
|
||||
continueRestore = false;
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// アップデートを行う
|
||||
if(!s_ExecuteFgNup)
|
||||
{
|
||||
if(ImportCountryLanguageData().IsSuccess())
|
||||
{
|
||||
StartFGNetworkUpdate();
|
||||
s_ExecuteFgNup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// 動いていることを表示
|
||||
{
|
||||
PutAliveMessage(operationMessage, "Updating");
|
||||
}
|
||||
|
||||
|
||||
if (IsNetworkUpdateFinished())
|
||||
{
|
||||
FinishFGNetworkUpdate();
|
||||
// エラーがあったら表示する
|
||||
if(GetUpdateResult().IsFailure())
|
||||
{
|
||||
// APが見つからない
|
||||
if(GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint())
|
||||
{
|
||||
COMMON_LOGGER("No Access Point Found!");
|
||||
}
|
||||
}
|
||||
|
||||
if (GetUpdateResult().IsSuccess())
|
||||
{
|
||||
COMMON_LOGGER("Network Update Finished.\n");
|
||||
// アップデート完了ファイルを作成
|
||||
CreateUpdateFinishedFile();
|
||||
|
||||
s_RestoreState = UPDATE_DONE;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_FgNupRetryCount++ < RETRY_MAX)
|
||||
{
|
||||
// エラーのためやり直す
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(GetUpdateResult());
|
||||
COMMON_LOGGER("Network Update Failed. Retrying... %d\n", s_FgNupRetryCount);
|
||||
|
||||
// FGNUP用のスレッドを作るとこからやり直し
|
||||
s_ExecuteFgNup = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// アップデート完了
|
||||
case UPDATE_DONE:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Network Update Done."));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
|
||||
|
||||
if(!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
s_RestoreState = REBOOTING;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// TWLサウンド領域の書き込み中
|
||||
case RESTORE_TWL_SOUND:
|
||||
{
|
||||
static bool init = true;
|
||||
if (init)
|
||||
{
|
||||
// データを書き込む
|
||||
ImportTwlSoundData();
|
||||
init = false;
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsImportFinished())
|
||||
{
|
||||
FinalizeImportThread();
|
||||
s_RestoreState = RESTORE_TWL_PHOTO;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// TWL写真領域の書き込み
|
||||
case RESTORE_TWL_PHOTO:
|
||||
{
|
||||
static bool init = true;
|
||||
if (init)
|
||||
{
|
||||
// データを書き込む
|
||||
ImportTwlPhotoData();
|
||||
init = false;
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (IsImportFinished())
|
||||
{
|
||||
FinalizeImportThread();
|
||||
s_RestoreState = RESTORE_IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// 書き込み中
|
||||
case RESTORE_IN_PROGRESS:
|
||||
{
|
||||
continueRestore = true;
|
||||
|
||||
// ACアダプタが必要か?
|
||||
if (NeedsAcAdater())
|
||||
{
|
||||
continueRestore = false;
|
||||
operationMessage.push_back(::std::string("Connect AC Adapter!!"));
|
||||
}
|
||||
|
||||
// データを読み込む
|
||||
if(ImportData().IsFailure())
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
// 処理が完了した
|
||||
if (continueRestore && IsImportFinished())
|
||||
{
|
||||
COMMON_LOGGER("Import NAND Data Finished.\n");
|
||||
|
||||
if (GetProgress() > 99)
|
||||
{
|
||||
s_RestoreState = POST_RESTORE;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// リブート中
|
||||
case REBOOTING:
|
||||
{
|
||||
static bool init = true;
|
||||
|
||||
if (init)
|
||||
{
|
||||
// ErrDispから引用
|
||||
result = nn::ns::CTR::InitializeForShell();
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
COMMON_LOGGER("System Reboot.\n");
|
||||
|
||||
nn::ns::CTR::HardwareResetAsync(nn::CTR::MEMORY_ARRANGE_NORMAL);
|
||||
while (!nn::applet::IsExpectedToCloseApplication())
|
||||
{
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(5));
|
||||
}
|
||||
|
||||
nn::ns::CTR::FinalizeForShell();
|
||||
|
||||
// INFO: リブートは非同期のため処理は継続
|
||||
}
|
||||
init = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 書き込み後の処理
|
||||
case POST_RESTORE:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Post Process..."));
|
||||
// 書き込み完了ファイルを作成
|
||||
CreateWriteFinishedFile();
|
||||
|
||||
s_RestoreState = RESTORE_DONE;
|
||||
}
|
||||
break;
|
||||
|
||||
// 書き込み完了
|
||||
case RESTORE_DONE:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Restore Done."));
|
||||
operationMessage.push_back(::std::string("Press A or START Button to Reboot"));
|
||||
|
||||
if(!s_PlayedRebootCursor)
|
||||
{
|
||||
PlaySound(SOUND_CURSOR);
|
||||
s_PlayedRebootCursor = true;
|
||||
}
|
||||
|
||||
if (nextStep)
|
||||
{
|
||||
s_RestoreState = REBOOTING;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 削除処理
|
||||
case ERASE:
|
||||
{
|
||||
Cleanup();
|
||||
s_RestoreState = HISTORY_RECOVER;
|
||||
}
|
||||
break;
|
||||
|
||||
// 削除処理
|
||||
case HISTORY_RECOVER:
|
||||
{
|
||||
static bool init = true;
|
||||
if (init)
|
||||
{
|
||||
// ptmのセーブデータ移行後に時計を無効化する
|
||||
nn::ptm::CTR::InvalidateSystemTime();
|
||||
|
||||
// cfgの本体固有値をcal値で初期化する
|
||||
InitializeHardwareDependentSetting();
|
||||
|
||||
init = false;
|
||||
}
|
||||
|
||||
s_RestoreState = TIME_ADJUST;
|
||||
}
|
||||
|
||||
|
||||
// 時計あわせ
|
||||
case TIME_ADJUST:
|
||||
{
|
||||
static bool init = true;
|
||||
if(init)
|
||||
{
|
||||
COMMON_LOGGER("Adjust Time\n");
|
||||
AdjustTime();
|
||||
init = false;
|
||||
}
|
||||
|
||||
// 動いていることを表示
|
||||
{
|
||||
PutAliveMessage(operationMessage, "Sync Clock");
|
||||
}
|
||||
|
||||
if(IsTimeAdjustFinished())
|
||||
{
|
||||
if(IsTimeAdjustSuccessed())
|
||||
{
|
||||
s_RestoreState = WAIT_SD_EJECT;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_RestoreState = FAIL;
|
||||
}
|
||||
|
||||
// リストア状態チェックファイルをすべて削除
|
||||
DeleteAllCheckFiles();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// すべて完了
|
||||
case WAIT_SD_EJECT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("ALL Done. Pull Out SD Card."));
|
||||
// SDカード抜けのみで次の状態に遷移する
|
||||
|
||||
if (!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
// すべて完了
|
||||
case ALL_DONE:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Restore Succeeded!!"));
|
||||
static bool init = true;
|
||||
if (init)
|
||||
{
|
||||
PlaySound(SOUND_OK);
|
||||
init = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// 書き込み失敗
|
||||
case FAIL:
|
||||
{
|
||||
static bool init = true;
|
||||
if(init)
|
||||
{
|
||||
// 状態初期化
|
||||
DeleteAllCheckFiles();
|
||||
init = false;
|
||||
}
|
||||
|
||||
operationMessage.push_back(::std::string("Failed."));
|
||||
if (!s_PlayedFailSound)
|
||||
{
|
||||
PlaySound(SOUND_NG);
|
||||
s_PlayedFailSound = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NUP_ONLY_WAIT_SD_EJECT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("Update Done. Pull Out SD Card."));
|
||||
|
||||
// SDカード抜けのみで次の状態に遷移する
|
||||
if (!s_PlayedSdPullOutCursor)
|
||||
{
|
||||
common::PlaySound(common::SOUND_CURSOR);
|
||||
s_PlayedSdPullOutCursor = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NUP_ONLY_WAIT_NEXT:
|
||||
{
|
||||
operationMessage.push_back(::std::string("A or START Button to Shutdown."));
|
||||
|
||||
if(nextStep)
|
||||
{
|
||||
s_RestoreState = SHUTDOWN;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHUTDOWN:
|
||||
{
|
||||
// 本体初期化を行う
|
||||
InitializeFileSystem();
|
||||
|
||||
// シャットダウンする
|
||||
nn::ptm::CTR::ShutdownAsync(0, nn::fnd::TimeSpan::FromSeconds(0));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool InProgress()
|
||||
{
|
||||
return s_RestoreState == RESTORE_IN_PROGRESS;
|
||||
}
|
||||
|
||||
bool IsRestoreSucceeded()
|
||||
{
|
||||
return s_RestoreState == ALL_DONE;
|
||||
}
|
||||
|
||||
bool IsRestoreFailed()
|
||||
{
|
||||
return s_RestoreState == FAIL;
|
||||
}
|
||||
|
||||
void OnSdEjected()
|
||||
{
|
||||
if(s_RestoreState == WAIT_SD_EJECT || s_RestoreState == ALL_DONE)
|
||||
{
|
||||
s_RestoreState = ALL_DONE;
|
||||
}
|
||||
else if(s_RestoreState == NUP_ONLY_WAIT_SD_EJECT || s_RestoreState == NUP_ONLY_WAIT_NEXT)
|
||||
{
|
||||
s_RestoreState = NUP_ONLY_WAIT_NEXT;
|
||||
}
|
||||
// FAILのときは一旦電源を切らないと動かないようにしておく
|
||||
else if(s_RestoreState != FAIL)
|
||||
{
|
||||
InitializeState();
|
||||
ClearFileReadResult();
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeState()
|
||||
{
|
||||
s_RestoreState = STARTUP;
|
||||
s_RestoreMode = RESTORE_MODE_RESTORE;
|
||||
|
||||
common::InitializeFileCheck();
|
||||
|
||||
s_ExistAPSettingAnnotation = false;
|
||||
s_ReadSettingDone = false;
|
||||
s_ReadSettingSuccess = false;
|
||||
s_APSettingAnnotation = false;
|
||||
s_SerialNumberAnnotation = false;
|
||||
s_PlayedFailSound = false;
|
||||
s_ExecuteFgNup = false;
|
||||
s_FgNupRetryCount = 0;
|
||||
s_PlayedStartCursor = false;
|
||||
s_PlayedRebootCursor = false;
|
||||
s_PlayedSdPullOutCursor = false;
|
||||
s_NupOnlyMode = false;
|
||||
s_ReadVersionDone = false;
|
||||
s_SdWriteProetctAnnotation = false;
|
||||
s_ReadVersionResult = nn::ResultSuccess();
|
||||
}
|
||||
|
||||
u32 GetProgress()
|
||||
{
|
||||
if(s_RestoreState == RESTORE_TWL_SOUND ||
|
||||
s_RestoreState == RESTORE_TWL_PHOTO ||
|
||||
s_RestoreState == RESTORE_IN_PROGRESS ||
|
||||
s_RestoreState == POST_RESTORE ||
|
||||
s_RestoreState == RESTORE_DONE)
|
||||
{
|
||||
return GetImportProgress();
|
||||
}
|
||||
else if(s_RestoreState == UPDATE_IN_PROGRESS ||
|
||||
s_RestoreState == UPDATE_DONE)
|
||||
{
|
||||
return GetUpdateProgress();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RestoreMode GetRestoreMode()
|
||||
{
|
||||
return s_RestoreMode;
|
||||
}
|
||||
|
||||
} // namespace ConsoleRestore
|
||||
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Contoroller.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CONTOROLLER_H_
|
||||
#define CONTOROLLER_H_
|
||||
|
||||
#include <nn.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
typedef enum RestoreMode
|
||||
{
|
||||
RESTORE_MODE_RESTORE,
|
||||
RESTORE_MODE_NUP_ONLY
|
||||
} RestoreMode;
|
||||
|
||||
const u32 RETRY_MAX = 3;
|
||||
|
||||
void ControlState(::std::vector<std::string>& operationMessage, bool& nextStep, bool& continueRestore);
|
||||
bool InProgress();
|
||||
bool IsRestoreSucceeded();
|
||||
bool IsRestoreFailed();
|
||||
u32 GetProgress();
|
||||
|
||||
void OnSdEjected();
|
||||
void InitializeState();
|
||||
RestoreMode GetRestoreMode();
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONTOROLLER_H_ */
|
||||
1551
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleRestore/Importer.cpp
Normal file
1551
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleRestore/Importer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Importer.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IMPORTER_H_
|
||||
#define IMPORTER_H_
|
||||
|
||||
#include <nn.h>
|
||||
#include "FileName.h"
|
||||
#include <nn/ac/CTR/private/ac_NetworkSetting.h>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
nn::Result EqualsDeviceIdFileandDeviceId();
|
||||
nn::Result EqualsRegionDataandRegion();
|
||||
nn::Result ReadSerialNumber(u8* serial);
|
||||
|
||||
void FinalizeImportThread();
|
||||
bool IsImportFinished();
|
||||
void ImportTwlSoundData();
|
||||
void ImportTwlPhotoData();
|
||||
nn::Result ImportData();
|
||||
void CreateWriteFinishedFile();
|
||||
void CreateUpdateFinishedFile();
|
||||
void CreateConsoleInitializedFile();
|
||||
void CreateRtcSyncFinishedFile();
|
||||
u32 GetImportProgress();
|
||||
|
||||
// NANDのごみを削除する
|
||||
void Cleanup();
|
||||
|
||||
const wchar_t* const CHECK_FILENAME_TABLE[] =
|
||||
{
|
||||
common::UPDATE_CHECK_PATHNAME,
|
||||
common::INITIALIZED_CHECK_PATHNAME,
|
||||
common::WRITE_FINISHED_CHECK_PATHNAME,
|
||||
common::RTC_SYNC_CHECK_PATHNAME,
|
||||
};
|
||||
|
||||
void DeleteAllCheckFiles();
|
||||
|
||||
struct TimeZone
|
||||
{
|
||||
u32 hour;
|
||||
u32 minutes;
|
||||
bool isMinus;
|
||||
NN_PADDING3;
|
||||
};
|
||||
|
||||
bool ReadSetting(bool* nupOnly);
|
||||
char* GetNtpServerName();
|
||||
TimeZone GetTimeZone();
|
||||
|
||||
struct CheckedNetworkSetting
|
||||
{
|
||||
nn::ac::CTR::NetworkSetting setting;
|
||||
bool isValid;
|
||||
NN_PADDING3;
|
||||
};
|
||||
|
||||
CheckedNetworkSetting* GetTempNetworkSetting();
|
||||
nn::Result ImportCountryLanguageData();
|
||||
nn::Result ImportMcuRtc();
|
||||
|
||||
// TWL写真領域を初期化してから本体初期化を行う
|
||||
void InitializeFileSystem();
|
||||
|
||||
void ClearFileReadResult();
|
||||
|
||||
// プレイ履歴を読み込みます。ptmのセーブデータ移行後に呼び出す必要があります
|
||||
void ImportPlayHistory();
|
||||
|
||||
// cfgのハードウェア固有領域をcal値で初期化します
|
||||
nn::Result InitializeHardwareDependentSetting();
|
||||
|
||||
// SDカード上のバージョン情報を読みます
|
||||
nn::Result ReadVersionData();
|
||||
// 移行元本体がNUP済みかどうか
|
||||
bool AlreadyExecutedNup();
|
||||
|
||||
}
|
||||
|
||||
#endif /* IMPORTER_H_ */
|
||||
@ -0,0 +1,376 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: NtpClient.cpp
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn.h>
|
||||
#include <nn/socket.h>
|
||||
#include <nn/ac.h>
|
||||
#include <nn/ptm.h>
|
||||
#include <nn/ptm/CTR/ptm_ApiSysmenu.h>
|
||||
#include <nn/ac/private/ac.h>
|
||||
#include <nn/ac/CTR/private/ac_InternalApi.h>
|
||||
#include <nn/ac/CTR/private/ac_NetworkSetting.h>
|
||||
#include <nn/math.h>
|
||||
|
||||
#include "Importer.h"
|
||||
#include "CommonLogger.h"
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
namespace {
|
||||
|
||||
const size_t NTP_THREAD_STACK_SIZE = 0x1000;
|
||||
nn::os::Thread s_NtpThread;
|
||||
nn::os::StackBuffer<NTP_THREAD_STACK_SIZE> s_NtpThreadStack;
|
||||
bool s_NtpSyncSuccessed = false;
|
||||
|
||||
|
||||
struct NTP_Packet{ // NTPパケット
|
||||
u32 controlWord;
|
||||
u32 rootDelay;
|
||||
u32 rootDispersion;
|
||||
u32 referenceId;
|
||||
s64 referenceTimestamp;
|
||||
s64 startTimestamp;
|
||||
s64 receiveTimestamp;
|
||||
u32 transmitTimestampSeconds;
|
||||
u32 transmitTimestampFractions;
|
||||
};
|
||||
|
||||
const size_t TIMEOUT_MILLISECOND = 5000; // タイムアウト ミリ秒数
|
||||
NTP_Packet s_NTPSendPacket; // 送信するNTPパケット
|
||||
NTP_Packet s_NTPRecvPacket; // 受信するNTPパケット
|
||||
const u32 NTP_PORT_NUM = 123;
|
||||
|
||||
nn::Result InitializeNetwork(void)
|
||||
{
|
||||
nn::Result result;
|
||||
nn::ac::Config config;
|
||||
|
||||
result = nn::ac::Initialize();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
// 接続要求用のパラメータを作成
|
||||
result = nn::ac::CreateDefaultConfig(&config);
|
||||
if (result.IsFailure())
|
||||
{
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// デバッグ用に接続テストを無効化
|
||||
nn::ac::DebugSetNetworkArea(&config, nn::ac::NETWORK_AREA_LAN);
|
||||
|
||||
// 接続要求を発行
|
||||
result = nn::ac::ConnectWithoutEula(config);
|
||||
if (result.IsFailure())
|
||||
{
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
nn::Result FinalizeNetwork(void)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
// 接続要求用のパラメータを作成
|
||||
result = nn::ac::Close();
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
result = nn::ac::Finalize();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
bool GetNtpTime(u32* ntpTime)
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
bool retval = true;
|
||||
NN_LOG("Initializing network.\n");
|
||||
|
||||
// 本体に書き込まれているネットワーク設定を使ってネットワーク接続を初期化
|
||||
result = InitializeNetwork();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
{
|
||||
NN_LOG("Initializing socket..\n");
|
||||
|
||||
// 一つのスレッドからソケット API を利用する
|
||||
const s32 sessionCount = 1;
|
||||
// ソケットの送受信バッファとして 64 KB を割り当て
|
||||
const size_t bufferSizeForSockets = 65536;
|
||||
// ソケットライブラリに必要なワークサイズを求める
|
||||
const size_t workSizeForLibrary = nn::socket::GetRequiredMemorySize(bufferSizeForSockets, sessionCount);
|
||||
|
||||
// ワークメモリを確保して 4KB にアラインにする
|
||||
u8* pWorkMemory = new u8[workSizeForLibrary + 4096];
|
||||
uptr workMemoryAddress = nn::math::RoundUp<uptr>(reinterpret_cast<uptr> (pWorkMemory), 4096);
|
||||
|
||||
// ソケットライブラリの初期化
|
||||
result = nn::socket::Initialize(workMemoryAddress, workSizeForLibrary, bufferSizeForSockets, sessionCount);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
{
|
||||
s32 ret;
|
||||
nn::socket::InAddr addr, netmask;
|
||||
ret = nn::socket::GetPrimaryAddress(reinterpret_cast<u8*> (&addr), reinterpret_cast<u8*> (&netmask));
|
||||
NN_ASSERT(ret == 0);
|
||||
COMMON_LOGGER("host : %s\n", nn::socket::InetNtoA(addr));
|
||||
COMMON_LOGGER("netmask : %s\n", nn::socket::InetNtoA(netmask));
|
||||
|
||||
nn::socket::InAddr dns1, dns2;
|
||||
ret = nn::socket::GetResolver(reinterpret_cast<u8*> (&dns1), reinterpret_cast<u8*> (&dns2));
|
||||
if (ret == 0)
|
||||
{
|
||||
COMMON_LOGGER("dns1 : %s\n", nn::socket::InetNtoA(dns1));
|
||||
COMMON_LOGGER("dns2 : %s\n", nn::socket::InetNtoA(dns2));
|
||||
}
|
||||
|
||||
nn::socket::InAddr gateway;
|
||||
ret = nn::socket::GetDefaultGateway(reinterpret_cast<u8*> (&gateway));
|
||||
if (ret == 0)
|
||||
{
|
||||
COMMON_LOGGER("gateway : %s\n", nn::socket::InetNtoA(gateway));
|
||||
}
|
||||
|
||||
COMMON_LOGGER("\n");
|
||||
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
||||
nn::socket::DumpRoutingTable();
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
s32 socket = nn::socket::Socket(nn::socket::PF_INET, nn::socket::SOCK_DGRAM, 0);
|
||||
NN_LOG("socket = %d\n", socket);
|
||||
|
||||
// クライアントアドレスの設定
|
||||
nn::socket::SockAddrIn host_addr;
|
||||
host_addr.len = sizeof(nn::socket::SockAddrIn);
|
||||
host_addr.family = nn::socket::AF_INET;
|
||||
host_addr.addr.addr = 0;
|
||||
host_addr.port = nn::socket::HtoNs(NTP_PORT_NUM);
|
||||
|
||||
// ローカルアドレスをバインド
|
||||
s32 ret = nn::socket::Bind(socket, &host_addr);
|
||||
NN_LOG("bind = %d\n", ret);
|
||||
|
||||
// ********************************************************************************
|
||||
// NTPパケットを生成して送る
|
||||
// ********************************************************************************
|
||||
|
||||
// サーバアドレスの設定
|
||||
nn::socket::SockAddrIn serverSockAddrIn;
|
||||
serverSockAddrIn.len = sizeof(nn::socket::SockAddrIn);
|
||||
serverSockAddrIn.family = nn::socket::AF_INET;
|
||||
|
||||
// GetHostByNameを使う場合
|
||||
nn::socket::HostEnt* serverHostent;
|
||||
u64 serveraddr = 0;
|
||||
serverHostent = nn::socket::GetHostByName(GetNtpServerName());
|
||||
if (serverHostent == NULL)
|
||||
{
|
||||
COMMON_LOGGER("Error: GetHostByName %s\n", GetNtpServerName());
|
||||
retval = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// サーバのホスト情報からIPアドレスをコピー
|
||||
serveraddr = *(reinterpret_cast<u64 *> (serverHostent->addrList[0]));
|
||||
}
|
||||
serverSockAddrIn.addr.addr = serveraddr;
|
||||
COMMON_LOGGER("Destination address: %s\n", nn::socket::InetNtoA(serverSockAddrIn.addr));
|
||||
serverSockAddrIn.port = nn::socket::HtoNs(NTP_PORT_NUM); // ポート番号
|
||||
|
||||
// NTPパケットをSNTP用に初期化する
|
||||
s_NTPSendPacket.controlWord = nn::socket::HtoNl(0x0B000000);
|
||||
s_NTPSendPacket.rootDelay = 0;
|
||||
s_NTPSendPacket.rootDispersion = 0;
|
||||
s_NTPSendPacket.referenceId = 0;
|
||||
s_NTPSendPacket.referenceTimestamp = 0;
|
||||
s_NTPSendPacket.startTimestamp = 0;
|
||||
s_NTPSendPacket.receiveTimestamp = 0;
|
||||
s_NTPSendPacket.transmitTimestampSeconds = 0;
|
||||
s_NTPSendPacket.transmitTimestampFractions = 0;
|
||||
|
||||
// サーバを指定してNTPパケットを送信する
|
||||
if ((ret = nn::socket::SendTo(socket, reinterpret_cast<const void*> (&s_NTPSendPacket), sizeof(s_NTPSendPacket), 0,
|
||||
&serverSockAddrIn)) < 0)
|
||||
{
|
||||
COMMON_LOGGER("Error: Failed Send to Server, %d\n", ret);
|
||||
retval = false;
|
||||
}
|
||||
|
||||
NN_LOG("SendTo finished\n");
|
||||
|
||||
// 受信待ち
|
||||
nn::socket::PollFd pollFd;
|
||||
pollFd.fd = socket;
|
||||
pollFd.events = nn::socket::POLLRDNORM;
|
||||
if ((ret = nn::socket::Poll(&pollFd, 1, TIMEOUT_MILLISECOND)) < 0)
|
||||
{
|
||||
COMMON_LOGGER("Error: recv error, %d\n", ret);
|
||||
retval = false;
|
||||
}
|
||||
|
||||
NN_LOG("Poll Finished\n");
|
||||
|
||||
switch (pollFd.revents)
|
||||
{
|
||||
case nn::socket::POLLERR: // ソケットにエラーが発生しました。
|
||||
COMMON_LOGGER("Error: POLLERR %s %d\n", __FILE__, __LINE__);
|
||||
retval = false;
|
||||
break;
|
||||
case nn::socket::POLLHUP: // ストリーム・ソケットが未接続です。
|
||||
COMMON_LOGGER("Error: POLLHUP %s %d\n", __FILE__, __LINE__);
|
||||
retval = false;
|
||||
break;
|
||||
case nn::socket::POLLNVAL: // 不正なソケット記述子です。
|
||||
COMMON_LOGGER("Error: POLLNVAL %s %d\n", __FILE__, __LINE__);
|
||||
retval = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// サーバから時刻情報を受信する
|
||||
// サーバを指定して受信を行う
|
||||
// 受信するまで待たされる
|
||||
if ((ret = nn::socket::RecvFrom(socket, reinterpret_cast<void*> (&s_NTPRecvPacket), sizeof(s_NTPRecvPacket), nn::socket::MSG_DONTWAIT,
|
||||
&serverSockAddrIn)) < 0)
|
||||
{
|
||||
COMMON_LOGGER("Error: RecvFrom, %d\n", ret);
|
||||
retval = false;
|
||||
}
|
||||
|
||||
NN_LOG("RecvFrom finished\n");
|
||||
|
||||
// NTPサーバから取得した時刻を現地時間に変換する
|
||||
*ntpTime = nn::socket::NtoHl(s_NTPRecvPacket.transmitTimestampSeconds) - 2208988800; /* 1970/01/01 からの秒数に変換 */
|
||||
NN_LOG("ntp_time = %d\n", ntpTime);
|
||||
|
||||
nn::socket::Close(socket);
|
||||
NN_UNUSED_VAR(ret);
|
||||
}
|
||||
|
||||
NN_LOG("Finalizing socket..\n");
|
||||
// ソケットライブラリの終了
|
||||
result = nn::socket::Finalize();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
}
|
||||
|
||||
NN_LOG("Finalizing network.\n");
|
||||
result = FinalizeNetwork();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void RestoreCurrentInternetSetting()
|
||||
{
|
||||
COMMON_LOGGER("Restore Current Internet Setting\n");
|
||||
nn::Result result;
|
||||
if (GetTempNetworkSetting()->isValid)
|
||||
{
|
||||
result = nn::ac::CTR::UpdateNetworkSetting(0, GetTempNetworkSetting()->setting);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 無効の場合は消去しておく
|
||||
result = nn::ac::CTR::RemoveNetworkSetting(0);
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
}
|
||||
|
||||
result = nn::ac::FlushNetworkSetting();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
|
||||
result = nn::ac::FinalizeInternal();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void NtpThreadFunc()
|
||||
{
|
||||
// NTP時間を取得する
|
||||
u32 ntpTime;
|
||||
if (GetNtpTime(&ntpTime))
|
||||
{
|
||||
// タイムゾーンを考慮してDateTimeに変換する
|
||||
TimeZone timeZone = GetTimeZone();
|
||||
|
||||
// 1970/01/01
|
||||
nn::fnd::DateTime utc = nn::fnd::DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
nn::fnd::DateTime current = utc + nn::fnd::TimeSpan::FromSeconds(ntpTime);
|
||||
|
||||
if (timeZone.isMinus)
|
||||
{
|
||||
current -= (nn::fnd::TimeSpan::FromHours(timeZone.hour) + nn::fnd::TimeSpan::FromMinutes(timeZone.minutes));
|
||||
}
|
||||
else
|
||||
{
|
||||
current += nn::fnd::TimeSpan::FromHours(timeZone.hour) + nn::fnd::TimeSpan::FromMinutes(timeZone.minutes);
|
||||
}
|
||||
|
||||
// SWCを書き込む
|
||||
nn::ptm::CTR::SetUserTime(current);
|
||||
|
||||
COMMON_LOGGER("Set User Time %04d/%02d/%02d %02d:%02d:%02d\n",
|
||||
current.GetYear(), current.GetMonth(), current.GetDay(), current.GetHour(), current.GetMinute(), current.GetSecond());
|
||||
|
||||
s_NtpSyncSuccessed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
COMMON_LOGGER("Failed Get Ntp Time\n");
|
||||
s_NtpSyncSuccessed = false;
|
||||
}
|
||||
|
||||
// インターネット設定を元に戻す
|
||||
RestoreCurrentInternetSetting();
|
||||
}
|
||||
|
||||
bool IsTimeAdjustFinished()
|
||||
{
|
||||
// Initialize済みかつ終了
|
||||
return s_NtpThread.IsValid() && !s_NtpThread.IsAlive();
|
||||
}
|
||||
|
||||
bool IsTimeAdjustSuccessed()
|
||||
{
|
||||
return s_NtpSyncSuccessed;
|
||||
}
|
||||
|
||||
void AdjustTime()
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
result = nn::ac::CTR::InitializeInternal();
|
||||
COMMON_LOGGER_RESULT_IF_FAILED(result);
|
||||
|
||||
if(IsTimeAdjustFinished())
|
||||
{
|
||||
s_NtpThread.Join();
|
||||
s_NtpThread.Finalize();
|
||||
}
|
||||
s_NtpThread.Start( NtpThreadFunc, s_NtpThreadStack);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: NtpClient.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NTPCLIENT_H_
|
||||
#define NTPCLIENT_H_
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
u32 AdjustTime();
|
||||
bool IsTimeAdjustFinished();
|
||||
bool IsTimeAdjustSuccessed();
|
||||
|
||||
}
|
||||
|
||||
#endif /* NTPCLIENT_H_ */
|
||||
@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev$
|
||||
#----------------------------------------------------------------------------
|
||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
||||
#MAKECSU = true
|
||||
#INSTALL_SDK_TOOL = true
|
||||
CTR_APPTYPE = BOTH
|
||||
CTR_MAKE_DEVELOPMENT_IMAGE = true
|
||||
|
||||
TARGET_PROGRAM = ConsoleRestore
|
||||
|
||||
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
||||
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) \
|
||||
../common
|
||||
|
||||
SOURCES[] =
|
||||
ConsoleRestore.cpp
|
||||
Controller.cpp
|
||||
Importer.cpp
|
||||
Updater.cpp
|
||||
Ntpclient.cpp
|
||||
../common/HardwareInfo.cpp
|
||||
../common/DrawSystemState.cpp
|
||||
../common/FileTransfer.cpp
|
||||
../common/FileChecker.cpp
|
||||
../common/SdReaderWriter.cpp
|
||||
../common/HeapManager.cpp
|
||||
../common/SdLogger.cpp
|
||||
../common/wave.cpp
|
||||
../common/SimplePlayer.cpp
|
||||
../common/LogConsole.cpp
|
||||
../common/CommonLogger.cpp
|
||||
../common/SdMountManager.cpp
|
||||
../common/configLoader.cpp
|
||||
../common/PlayHistoryManager.cpp
|
||||
../common/VersionDetect.cpp
|
||||
|
||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
||||
|
||||
ROMFS_ROOT = ../common/romfiles
|
||||
|
||||
LIBS += libnn_cfg \
|
||||
libnn_driversEeprom \
|
||||
libnn_driversi2c \
|
||||
libnn_driversCal \
|
||||
libnn_crypto \
|
||||
libnn_driversCodec \
|
||||
libnn_spi \
|
||||
libnn_gpio \
|
||||
libnn_pdn \
|
||||
libnn_mcu \
|
||||
libnn_i2c \
|
||||
libnn_driversCamera \
|
||||
libnn_ps \
|
||||
libnn_driversRsa \
|
||||
lib_demo \
|
||||
libnn_nwm \
|
||||
libnn_friends \
|
||||
libnn_ns \
|
||||
libnn_am \
|
||||
libnn_nim \
|
||||
|
||||
INSTALL_SDK_TOOL = true
|
||||
|
||||
ROM_SPEC_FILE = $(TARGET_PROGRAM).rsf
|
||||
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/_private/RepairTool.desc
|
||||
|
||||
include $(ROOT_OMAKE)/modulerules
|
||||
|
||||
VERSION_H = $(file version.h)
|
||||
|
||||
$(VERSION_H): $(SOURCES)
|
||||
section
|
||||
bash genversion.sh
|
||||
|
||||
RequireSetup($(VERSION_H))
|
||||
build: version.h $(DEFAULT_TARGETS)
|
||||
@ -0,0 +1,249 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Updater.cpp
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <nn/os.h>
|
||||
#include <nn/Handle.h>
|
||||
#include <nn/dbg.h>
|
||||
#include <nn/nim.h>
|
||||
#include <nn/cfg.h>
|
||||
#include <nn/cfg/CTR/cfg_ApiInit.h>
|
||||
#include <nn/ac/private/ac.h>
|
||||
#include <nn/ac/CTR/private/ac_InternalApi.h>
|
||||
|
||||
#include "CommonLogger.h"
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
using namespace ES_NAMESPACE;
|
||||
using namespace EC_NAMESPACE;
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
GetCustomerSupportCode
|
||||
-------------------------------------------------------------------- */
|
||||
#define NIM_UPDATER_RESULT_CHECK(result) \
|
||||
do { \
|
||||
if (result.IsFailure()) \
|
||||
{ \
|
||||
ECCustomerSupportCode csc; \
|
||||
NN_UTIL_PANIC_IF_FAILED( \
|
||||
nn::nim::Updater::GetCustomerSupportCode(&csc)); \
|
||||
COMMON_LOGGER("CSCode: %d\n", csc); \
|
||||
nn::dbg::PrintResult(result); \
|
||||
s_Result = result; \
|
||||
goto LABEL_FINALIZE; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
nn::Result s_Result = nn::ResultSuccess();
|
||||
|
||||
const size_t UPDATER_THREAD_STACK_SIZE = 0x1000;
|
||||
nn::os::Thread s_UpdaterThread;
|
||||
nn::os::StackBuffer<UPDATER_THREAD_STACK_SIZE> s_UpdaterThreadStack;
|
||||
|
||||
u64 s_Progress = 0;
|
||||
|
||||
}
|
||||
|
||||
nn::Result PrintNetworkSetting()
|
||||
{
|
||||
nn::ac::NetworkSetting networkSetting;
|
||||
NN_UTIL_RETURN_IF_FAILED(nn::ac::LoadNetworkSetting(0, networkSetting));
|
||||
COMMON_LOGGER("SSID: %s\n", networkSetting.wireless.essidSecurity.ssid);
|
||||
COMMON_LOGGER("DNS : %d.%d.%d.%d\n",
|
||||
networkSetting.ip.dns[0][0], networkSetting.ip.dns[0][1],
|
||||
networkSetting.ip.dns[0][2], networkSetting.ip.dns[0][3]);
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
nn::Result ConnectNetwork()
|
||||
{
|
||||
nn::Result result = nn::ResultSuccess();
|
||||
nn::ac::Config config;
|
||||
|
||||
result = nn::ac::CreateDefaultConfig(&config);
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
result = nn::ac::ConnectWithoutEula(config);
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
NN_LOG("Success nn::ac::ConnectWithoutEula\n");
|
||||
|
||||
NN_UTIL_RETURN_IF_FAILED(PrintNetworkSetting());
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
nn::Result InitializeInternal()
|
||||
{
|
||||
nn::Result result = nn::ResultSuccess();
|
||||
|
||||
result = nn::ac::InitializeInternal();
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
result = ConnectNetwork();
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
nn::Result FinalizeInternal()
|
||||
{
|
||||
nn::Result result = nn::ResultSuccess();
|
||||
|
||||
nn::ac::CloseAll();
|
||||
|
||||
result = nn::ac::FinalizeInternal();
|
||||
NN_UTIL_RETURN_IF_FAILED(result);
|
||||
|
||||
return nn::ResultSuccess();
|
||||
}
|
||||
|
||||
void UpdateThreadFunc()
|
||||
{
|
||||
nn::Result result;
|
||||
|
||||
NN_LOG("********************UpdateThreadFunc Start********************\n");
|
||||
nn::cfg::CTR::init::Initialize();
|
||||
nn::cfg::CfgCountryCode country;
|
||||
nn::cfg::CfgRegionCode region;
|
||||
const char *regionStr;
|
||||
const char *countryStr;
|
||||
NN_UNUSED_VAR(regionStr);
|
||||
NN_UNUSED_VAR(countryStr);
|
||||
|
||||
country = nn::cfg::GetCountry();
|
||||
region = nn::cfg::GetRegion();
|
||||
countryStr = nn::cfg::GetCountryCodeA2(country);
|
||||
regionStr = nn::cfg::GetRegionCodeA3(region);
|
||||
|
||||
COMMON_LOGGER("[Updater] country:%2d:%s\n", country, countryStr);
|
||||
COMMON_LOGGER("[Updater] region :%2d:%s\n", region, regionStr);
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
Initialize
|
||||
-------------------------------------------------------------------- */
|
||||
NN_LOG("[Updater] nn::nim::InitializeForUpdater\n");
|
||||
result = nn::nim::InitializeForUpdater();
|
||||
NIM_UPDATER_RESULT_CHECK(result);
|
||||
|
||||
NN_LOG("[Updater] InitializeInternal\n");
|
||||
result = InitializeInternal();
|
||||
NIM_UPDATER_RESULT_CHECK(result);
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
StartNetworkUpdate
|
||||
-------------------------------------------------------------------- */
|
||||
NN_LOG("[Updater] nn::nim::Updater::StartNetworkUpdate()\n");
|
||||
result = nn::nim::Updater::StartNetworkUpdate();
|
||||
NIM_UPDATER_RESULT_CHECK(result);
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
GetProgress
|
||||
-------------------------------------------------------------------- */
|
||||
NN_LOG("[Updater] nn::nim::Updater::GetProgress()\n");
|
||||
|
||||
while(true)
|
||||
{
|
||||
nn::nim::NetworkUpdateProgress progress;
|
||||
NIM_UPDATER_RESULT_CHECK(nn::nim::Updater::GetProgress(&progress));
|
||||
NIM_UPDATER_RESULT_CHECK(progress.lastResult);
|
||||
NN_LOG("\x1b[1A\x1b[K");
|
||||
NN_LOG("Downloading %2lld/%2lld %8lld/%8lld (%d)\n",
|
||||
progress.downloadedTitleNum,
|
||||
progress.totalTitleNum,
|
||||
progress.currentDownloadedSize,
|
||||
progress.currentTotalSize,
|
||||
progress.state);
|
||||
|
||||
// ゼロ除算を防ぐ
|
||||
if(progress.totalTitleNum == 0)
|
||||
{
|
||||
progress.totalTitleNum++;
|
||||
progress.downloadedTitleNum++;
|
||||
}
|
||||
if(progress.state > nn::nim::CTR::NUP_STATE_CHECKING)
|
||||
{
|
||||
s_Progress = progress.downloadedTitleNum * 100 / progress.totalTitleNum;
|
||||
}
|
||||
|
||||
if (progress.state == nn::nim::NUP_STATE_NO_NEED)
|
||||
{
|
||||
COMMON_LOGGER("[Updater] No need to NetworkUpdate\n");
|
||||
s_Progress = 100;
|
||||
break;
|
||||
}
|
||||
if (progress.state == nn::nim::NUP_STATE_FINISHED)
|
||||
{
|
||||
COMMON_LOGGER("[Updater] Finished NetworkUpdate\n");
|
||||
s_Progress = 100;
|
||||
break;
|
||||
}
|
||||
|
||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(300));
|
||||
}
|
||||
|
||||
LABEL_FINALIZE:
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
Finalize
|
||||
-------------------------------------------------------------------- */
|
||||
NN_LOG("[Updater] nn::nim::FinalizeForUpdater\n");
|
||||
result = nn::nim::FinalizeForUpdater();
|
||||
NIM_UPDATER_RESULT_CHECK(result);
|
||||
|
||||
result = FinalizeInternal();
|
||||
NIM_UPDATER_RESULT_CHECK(result);
|
||||
|
||||
NN_LOG("[Updater] Finish nim Updater demo.\n");
|
||||
|
||||
}
|
||||
|
||||
void StartFGNetworkUpdate()
|
||||
{
|
||||
NN_LOG("Start FGNetworkUpdate\n");
|
||||
s_Result = nn::ResultSuccess();
|
||||
s_UpdaterThread.Start(UpdateThreadFunc, s_UpdaterThreadStack);
|
||||
}
|
||||
|
||||
void FinishFGNetworkUpdate()
|
||||
{
|
||||
NN_LOG("Finalize FGNetworkUpdate\n");
|
||||
s_UpdaterThread.Join();
|
||||
s_UpdaterThread.Finalize();
|
||||
}
|
||||
|
||||
bool IsNetworkUpdateFinished()
|
||||
{
|
||||
return s_UpdaterThread.IsValid() && !s_UpdaterThread.IsAlive();
|
||||
}
|
||||
|
||||
u32 GetUpdateProgress()
|
||||
{
|
||||
return s_Progress;
|
||||
}
|
||||
|
||||
nn::Result GetUpdateResult()
|
||||
{
|
||||
return s_Result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------*
|
||||
Project: Horizon
|
||||
File: Updater.h
|
||||
|
||||
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.
|
||||
|
||||
$Rev$
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef UPDATER_H_
|
||||
#define UPDATER_H_
|
||||
|
||||
#include <nn.h>
|
||||
|
||||
namespace ConsoleRestore
|
||||
{
|
||||
|
||||
void StartFGNetworkUpdate();
|
||||
void FinishFGNetworkUpdate();
|
||||
bool IsNetworkUpdateFinished();
|
||||
u32 GetUpdateProgress();
|
||||
nn::Result GetUpdateResult();
|
||||
|
||||
}
|
||||
|
||||
#endif /* UPDATER_H_ */
|
||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ф8ф8фШчГГГГГГВ╫В╫8фВ╫В╫В╫В╫В╫ГГГГшчфГШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГШчyнYнВ╫шчшчВ╫В╫фВ╫В╫шчyнШчВ╫yнГГГГyнШФГГГГГшчВ╫В╫В╫В╫YнГyнГВ╫В╫В╫В╫В╫yнфшчГШФГYнyнВ╫В╫В╫yнВ╫╨жВ╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнГYнГВ╫В╫В╫В╫В╫фВ╫В╫ГyнГ8фВ╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
@ -0,0 +1 @@
|
||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫8ф8фВ╫В╫В╫╨ж8ф╨жГГшчГГГГГГГГГГГГГГГГГГГГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8ф8фВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГШФГГГГГГГГГГ жфГГВ╫В╫ жВ╫ГГГГГ жГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫шчВ╫В╫В╫В╫В╫ГВ╫ШчВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫╨жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГГГГГГГГГГГГГГШФ8фШчшчВ╫В╫ жВ╫YнВ╫В╫В╫В╫В╫ГГYнyнГГyнфВ╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчшчГшчШФВ╫В╫ГГYнГВ╫В╫В╫В╫В╫шчВ╫шчГГГГГГГГГГГГГГГГВ╫В╫YнШч жГГГГГГГГГГГГГГГГГГГГГГГГшч╨жВ╫ жВ╫шчВ╫В╫В╫В╫В╫ШФВ╫ШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫yнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫ жГГГГВ╫шчВ╫шчГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫╨жшчВ╫В╫В╫В╫В╫YнфyнГГГГГГГГГ жГГГГ╨жВ╫YнВ╫ШФYнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шч жВ╫В╫В╫В╫В╫В╫yнВ╫ГШФВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ШФВ╫ГГГГГВ╫ШчВ╫YнГГШФГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГ жВ╫шчВ╫ГГГшч жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
||||
4
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleRestore/genversion.sh
Executable file
4
tags/0thNUP_Secure/ConsoleDataMigration/ConsoleRestore/genversion.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash -f
|
||||
|
||||
cd ../
|
||||
echo "#define RESTORE_VERSION_NUM \"`svn info|grep 'Last Changed Rev:'| awk -F ':' '{print $2}'|tr -d '\n'| sed 's/ //g'`\"" > ./ConsoleRestore/version.h
|
||||
24
tags/0thNUP_Secure/ConsoleDataMigration/OMakefile
Normal file
24
tags/0thNUP_Secure/ConsoleDataMigration/OMakefile
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env omake
|
||||
#----------------------------------------------------------------------------
|
||||
# Project: Horizon
|
||||
# File: OMakefile
|
||||
#
|
||||
# Copyright (C)2009 Nintendo Co., Ltd. All rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs contain
|
||||
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||
# Company Ltd., and are protected by Federal copyright law. They may
|
||||
# not be disclosed to third parties or copied or duplicated in any form,
|
||||
# in whole or in part, without the prior written consent of Nintendo.
|
||||
#
|
||||
# $Rev$
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#.SUBDIRS: $(glob D, *)
|
||||
.SUBDIRS: $(exist-dirs \
|
||||
common \
|
||||
ConsoleBackup \
|
||||
ConsoleRestore \
|
||||
)
|
||||
|
||||
DefineDefaultRules()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user