git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@241 385bec56-5757-e545-9c3a-d8741f4650f1

This commit is contained in:
mizu 2011-04-28 00:15:48 +00:00
parent 645f7f13d5
commit 6ff730a779
128 changed files with 12241 additions and 0 deletions

View File

@ -0,0 +1,18 @@
BasicInfo:
Title : $(TITLE)
BackupMemoryType: None
Logo : Nintendo
# Companycode: "00"
ProductCode : "CTR-P-22MA"
# MediaSize: 2GB
AccessControlInfo:
FileSystemAccess:
- Debug
Rom:
HostRoot : $(ROMFS_ROOT)
TitleInfo:
UniqueId: 0xf8015
Version: 0

View File

@ -0,0 +1,69 @@
#!/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/shfnt.cpp
../../common/sleep.cpp
../../common/common.cpp
OBJECTS[] =
$`(ObjectFromBinary $(TARGET), ./Imp_list/key/Public_Key.der)
TARGET_PROGRAM = CtrSaveDataMover_imp
TITLE = CSM_imp
LIBS += libnn_ps
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
CTR_BANNER_SPEC = banner_null_icon.bsf
include $(ROOT_OMAKE)/modulerules
build: $(DEFAULT_TARGETS)

Binary file not shown.

View File

@ -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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
-p
-t

View File

@ -0,0 +1,2 @@
#
EJF10000237

View File

@ -0,0 +1 @@
\ï q$#¾Ž9¥#µæ1ŲæÂ‰vŽßô:ɯž“'´­T0óUtWÀw^<5E>V¹úOOk$¡ ±×Z¿[ã-ÛXøëÞ³™¢ÚAõWÆIóˆhnL<6E>6.YZ3+<2B>db7ªf{—ôàqË<>ôåi;/µ*>eN˜]Öò+†q:±A)Æ2x#Þ%r ΦORÄZ»¢Ûà<C39B>‡-o:'#ôÿ¯zèßKàúØ>»ÈlbLéU¢Uc‡AˆudlY?²•e«mC°Ja WðíkÜâ g€©dˆfíe6<47>¶¾$s¼Ñ!<21>2a“M „à¯

View File

@ -0,0 +1,4 @@
openssl genrsa -out private_key.pem 2048
openssl enc -d -base64 -in private_key.pem -out private_key.der
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der

View File

@ -0,0 +1,3 @@
rem ver1.0.0—p
openssl genpkey -out private_key.der -outform DER -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der

View File

@ -0,0 +1,7 @@
@echo off
if "%1"=="" goto 1
openssl dgst -sha256 -binary -keyform DER -sign ../key/private_key.der -out csm_sign.dat %1
goto end
:1
openssl dgst -sha256 -binary -keyform DER -sign ../key/private_key.der -out csm_sign.dat csm_list.txt
:end

View File

@ -0,0 +1,5 @@
秘密鍵の扱いは注意
署名作成する必要の無い所には出さない
署名作成時は、配布先で使用するバージョンに入っている
鍵とペアの秘密鍵を使うこと

View File

@ -0,0 +1,45 @@
本体印刷のシリアル最後尾の四角い枠に入った数字は
digitというものらしい
リスト作成時に入力違いをチェックするのに使えそう
コマンドラインでファイル指定する簡単なチェッカーとか
以下、長谷川さんメール抜粋
----------------
チェックデジットの計算方法は一般的なものらしく、
"モジュラス10 ウェイト3・1M10W31"というものらしいです。
// NULL終端されたシリアルナンバーを受け取る
// NULL文字の場所にチェックデジットを付加して新たにNULL終端する
void AddCheckDigit(char* serial)
{
size_t len = std::strlen(serial);
u8 digit = 0;
bool odd = true;
for(u8 i = len - 1; i > 0 && std::isdigit(serial[i]); i--)
{
if(odd)
{
digit += (serial[i] - '0') * 3;
}
else
{
digit += (serial[i] - '0');
}
odd = !odd;
}
if(digit % 10 != 0)
{
serial[len] = 10 - (digit % 10) + '0';
}
else
{
serial[len] = '0';
}
serial[len + 1] = '\0';
}

View File

@ -0,0 +1,27 @@
目的:許可した本体のみインポート
公開鍵はROMから読み込む
SC ツール用本体のシリアルをメールなどでREDへ連絡
RED) リスト(csm_list)と署名(csm_sign)を作成し送る
インポート手順
 リスト、署名を書き込んだSDをCTRに差す
・ インポート用アプリをカード起動
・ 有効な本体ならインポートメニューが表示される
署名はOpeneelで作成
特に手を加えずSDルートに置く
リストの書き方
インポート許可シリアルをテキストで羅列
---
aaaaaaaa
bbbbbbbb
----
本体裏シリアル終端のdigit(四角い枠の数字)は省く
digit確認したい場合はリスト作成時にやっとく
ファイルサイズは64Kまで(シリアルのみ記載で、およそ4000台)

View File

@ -0,0 +1,11 @@
<インポータのオプション有効化>
cms_inf.txtの名前でファイル作成しSDのルート下に配置
以下の記述でオプションが有効になる
デバグや不具合調査時用、通常はいらない
-t: テストメニュー
   カード上のセーブにテストパターン書き込み&ベリファイ
-p: 本体シリアルを表示

Binary file not shown.

View File

@ -0,0 +1,490 @@
/*---------------------------------------------------------------------------*
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/fs.h>
#include <nn/cfg/CTR/cfg_ApiSys.h>
#include <nn/cfg/CTR/cfg_ApiInit.h>
#include <nn/am/am_ApiLocalImporter.h>
#include <nn/am/am_ApiSystemMenu.h>
#include <nn/applet.h>
#include <nn/ndm.h>
#include <nn/ndm/ndm_DebugControl.h>
#include <nn/crypto/crypto_RsaKey.h>
#include <nn/ps/ctr/ps_Api.h>
#include <stdio.h>
#include <string.h>
#include "demo.h"
#include "../../body/ver.h"
#include "../../../common/sleep.h"
#include "../../../common/common.h"
#include "../../../common/shfnt.h"
#include "test_data.h"
#define INF_FILE "sdmc:/csm_inf.txt"
#define KEY_LENGTH 2048
#define LIST_FILE "sdmc:/csm_list.txt"
#define SIGN_FILE "sdmc:/csm_sign.dat"
extern "C" {
extern u8* PUBLIC_KEY_BEGIN[];
extern u8* PUBLIC_KEY_END[];
const void* PUBLIC_KEY = PUBLIC_KEY_BEGIN;
}
demo::RenderSystemDrawing s_RenderSystem;
nn::fnd::ExpHeap appHeap;
uptr heapForGx;
void ErrorStop(char *s);
void ErrorPOff(char *s);
const size_t ROMFS_BUFFER_SIZE = 64*1024;//ROMマウント用
const size_t READ_BUFFER_SIZE = 64*1024;
#define SDK_SER_LEN nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN
namespace
{
u8* readBuf;
u8* romfsBuf;
}
nn::Result result;
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, READ_BUFFER_SIZE))
{
stream->Write(readBuf, read);
}
result = nn::am::EndImportProgram(stream);
}
return result.IsSuccess();
}
#define LIST_MAX 4000
#define LIST_LENGTH (LIST_MAX * (nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1))
u8 s_list[LIST_MAX][nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1];//シリアルリスト
u8 sign[256];//署名
u8 serialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1];
//本体シリアル取得
int GettedSerLen;
bool GetSerial(){
nn::cfg::CTR::init::Initialize();
nn::cfg::CTR::system::Initialize();
result = nn::cfg::CTR::system::GetSerialNo(serialNo);
nn::cfg::CTR::system::Finalize();
nn::cfg::CTR::init::Finalize();
serialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN] = 0;
GettedSerLen = strlen((char*)serialNo);
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);}
//上はASCIIのみ対応したTextWriterへのラッパ
//日本語表示の場合、WideTextWriterを使う(要sft_側の関数追加)
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();
int i = nn::ndm::GetDaemonStatus( nn::ndm::DN_CEC );
if (i !=3 )NN_LOG("DN_CEC %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_BOSS );
if (i !=3 )NN_LOG("DN_BOSS %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_NIM );
if (i !=3 )NN_LOG("DN_NIM %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_FRIENDS );
if (i !=3 )NN_LOG("DN_FRIENDS %d\n",i);
}
}
//終了
void endfunc()
{
appHeap.Free(reinterpret_cast<void*>(readBuf));
appHeap.Free(reinterpret_cast<void*>(romfsBuf));
nn::hid::Finalize();
SharedFontFinalize();
nngxWaitVSync(NN_GX_DISPLAY_BOTH);//SDK2.0以降では不要?
s_RenderSystem.Finalize();
}
//署名検証
bool VeriRsa(u8* src,size_t sz,u8* sig)
{
nn::crypto::RsaKey key;
//nn::crypto::Initialize();
nn::ps::CTR::Initialize();
result = key.InitializePublicKey(PUBLIC_KEY_BEGIN,KEY_LENGTH);
if (result.IsSuccess())
{
result = nn::ps::CTR::VerifyRsaSha256(src,sz,sig,key);
}
//nn::crypto::Finalize();
nn::ps::CTR::Finalize();
return result.IsSuccess();
}
//エラー
void ErrorCommon(char *s,char *ss)
{
char str[128];
nn::am::FinalizeForLocalImporter();
nn::fs::Unmount("sdmc:");
nn::fs::Unmount("rom:");
NN_LOG(s);
NN_LOG(" result = %d\n",result.GetDescription());
shf_SetScale(0.7,0.7);
setColor(1.0, 0.0, 0.0,1.0);
strcpy(str,"Error: ");
strcat(str,s);
drawText(10,100,str);
drawText(10,140,ss);
}
void ErrorStop(char *s)
{
ErrorCommon(s,"Push Home Button & end");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}
void ErrorPoff(char *s)
{
ErrorCommon(s,"Push Power Button & Power Off");
drawText(10,160,"Home Button is invalid");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}
//改行後の位置を返す、0=見つからなかった
int CrLf(int n,int max)
{
u8 d;
while(n < max)
{
d = readBuf[n];
if (d==0x0a)return n+1;//LF
if (d==0x0d)//CR
{
if (n == max-1)return 0;//終端
n++;
if (readBuf[n]==0x0a)return n+1;//CR+LF
ErrorStop("list broken");//CRのみは異常、署名時にファイル壊れてた
}
n++;
}
return 0;
}
nn::fs::FileInputStream fi;
//ファイルリード
s32 FileRead(char* fname)
{
s32 size;
result = fi.TryInitialize(fname);
if (result.IsFailure()){//open error
//NN_LOG("desc= %d\n",result.GetDescription());
return 0;
}
result = fi.TryRead(&size,readBuf,READ_BUFFER_SIZE);
fi.Finalize();
if (result.IsFailure()){
//NN_LOG("desc= %d\n",result.GetDescription());
return 0;
}
return size;
}
char ver[16];
char seri[32];
void nnMain( void )
{
//nn::Result result;
bool flg_applove=false;
bool flg_test=false;
int i,j,n;
s32 fsize;
extern bool prohibitHome;// HOME ボタン禁止
nn::os::Initialize();
nn::fs::Initialize();
//DEA-SUPにて推奨のフリーズ暫定対策無線デーモンを停止 (2011.3.1 現在)
//ただし、スリープ時の"いつのまに通信"は止まらない
//無線は使わないので本体横スイッチ切っとくのが確実
nn::ndm::Initialize();
result = nn::ndm::SuspendScheduler();
NN_LOG("%d",result.GetDescription());
//中断処理の準備
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();//スリープ非対応
// ヒープの確保
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::pl::SharedFontType sftype = nn::pl::GetSharedFontType();
// スリープ要求に対する返答を有効にする
// また、蓋の状態チェックを行い蓋が閉じられているならスリープ要求が発生する
// 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())ErrorStop("Initialize");//初期化に失敗
if (READ_BUFFER_SIZE < LIST_LENGTH)ErrorStop("buffer size");//バッファサイズのチェック
//ファイルバッファ
//カゲマイ上のSDリード速度比較実験で32アラインが良かったので、おまじない
//回数もサイズも少ないので気にする必要ないかも
if (READ_BUFFER_SIZE > appHeap.GetTotalFreeSize())ErrorStop("memory alloc");
readBuf = reinterpret_cast<u8*>(appHeap.Allocate(READ_BUFFER_SIZE,32));
if (ROMFS_BUFFER_SIZE > appHeap.GetTotalFreeSize())ErrorStop("memory alloc");
romfsBuf = reinterpret_cast<u8*>(appHeap.Allocate(ROMFS_BUFFER_SIZE,32));
//シリアルチェック
if( GetSerial() == false)ErrorStop("Get Serial");//本体シリの取得に失敗
result = nn::fs::MountSdmc();//ダイレクトでマウント..マスタリング時にワーニング
if (result.IsFailure())ErrorStop("Mount SD");
fsize = FileRead(INF_FILE);//設定ファイルがあるか
if((fsize < 1024) && (fsize > 0))//サイズチェック,増えても1Kは超えない
{//不具合調査時に状況にあわせて現場で作成&変更を想定したオプション
//通常は不要なので無しでも動くようしとく
n = 0;
while(n < fsize)
{
if (readBuf[n] == '-'){
if (n == fsize-1)break;//終端
n++;
switch (readBuf[n]){
case 'p':// -p .. 本体シリアル表示
strcpy(seri,"s/n: ");
strcat(seri,(char *)serialNo);
shf_SetScale(0.5,0.5);
drawText(10,40,(char*)seri);
shf_SetScale(0.7,0.7);
break;
case 't':// -t .. テストメニュー有効
flg_test = true;
break;
}
}
n++;
}
}
//シリアル表示(オプション)後にチェック
//デバッガ=15,実機=11
if (GettedSerLen < 11)ErrorStop("invalid Serial");
fsize = FileRead(SIGN_FILE);//署名リード
if(fsize != 256)ErrorStop("sign file");//鍵のbit長は2046固定
memcpy(sign,readBuf,256);//readBuf -> sign
fsize = FileRead(LIST_FILE);//リストリード
if((fsize > LIST_LENGTH ) || (fsize == 0))ErrorStop("list file");
nn::fs::Unmount("sdmc:"); //検証後はSDから読まないでメモリバッファ上のデータを使う: 差替え対策
if (VeriRsa(readBuf,fsize,sign) == false)ErrorStop("sign verify");
//署名検証OK
int list_ct = 0;
n=0;
while(n < fsize)//リスト作成
{
if (readBuf[n] == '#')//コメント行を無視、ワイド文字非対応
{
i = CrLf(n,fsize);//コメントの次行
if (i == 0)break;//ファイル終わりまで改行が見つからない
}else
{
//改行さがし
if ((fsize-n) > (SDK_SER_LEN+2))
{//シリアルは改行つける
i = CrLf(n,n+SDK_SER_LEN+2);
if (i == 0)ErrorStop("list broken");//改行が見つからない
}else{
i = CrLf(n,fsize);
if (i ==0)i = fsize;//改行以外でファイル終
}
if ((i-n) > GettedSerLen)//シリアルをリスト化
{
j = 0;
while(n<i)
{
if ((readBuf[n] == 0x0d) || (readBuf[n] == 0x0a))break;
s_list[list_ct][j] = readBuf[n];
j++;n++;
}
s_list[list_ct][j] = 0;//終端
list_ct++;
if (list_ct>=LIST_MAX)ErrorStop("List too Long");
}
}
if ((fsize-i) < GettedSerLen)break;//ファイル終
n=i;//ポインタを改行の次へ
}
//プログラムミス、コードバグ対策
//値が小さいと判定が緩くなるが、動作確認時にスルーしそうなので
//念の為チェック
if (GettedSerLen < 11)ErrorStop("invalid Serial");
//本体シリアルがリストにあるかチェック
n =0;
while(n<list_ct)
{
if (GettedSerLen == strlen((char*)s_list[n]))
{
for(i=0;i<GettedSerLen;i++)
{
if (serialNo[i] != s_list[n][i])break;
}
if (i == GettedSerLen)
{
flg_applove = true;
break;
}
}
n++;
}
u32 mask = 0;
//メニュー表示
if (flg_applove){//インポート許可本体
drawText(80,100,"Push X : Import");
drawText(80,140,"Push Y : Delete");
mask |= nn::hid::BUTTON_X | nn::hid::BUTTON_Y;
}
//本体機能で消せるようなったら、そっち使うべき
//将来的にdeleteは省いていいかも
if (flg_test)//テストメニュー
{
drawText(80,160,"Push R : Test Data");
mask |= nn::hid::BUTTON_R;
}
s_RenderSystem.SwapBuffers();
if (mask == 0)ErrorStop("Serial Check");//実行できるメニューないときトラップ
u32 trg = WaitKey(mask);
if (trg & nn::hid::BUTTON_R){
shf_SetScale(0.6,0.6);
TestMain();//テストデータへ
}
nn::fs::MountRom(16, 16, romfsBuf, ROMFS_BUFFER_SIZE);
shf_SetScale(0.8,0.8);
// CIA のプログラム ID を取得する。
nn::am::ProgramInfo programInfo;
if (nn::am::GetProgramInfoFromCia(&programInfo, ROMFS_IMPORTEE_PATH).IsFailure())ErrorStop("cia infomation");
// Imprting/Delete 表示
s_RenderSystem.Clear();
if(trg & nn::hid::BUTTON_X) drawText(10,120,"Importing");
else drawText(10,120,"Delete");
s_RenderSystem.SwapBuffers();
// HOME ボタン禁止
//Homeで中断するとアイコンが更新されない、電源OFF画面からHomeは問題なし
prohibitHome = true;
// 既に存在するものをインポートするとエラーが返ってくるので、あらかじめ消しておく。
nn::am::DeleteProgram(nn::fs::MEDIA_TYPE_NAND, programInfo.id);
// タイトル鍵が違うケースに対応するために、チケットも消しておく。
nn::am::DeleteTicket(programInfo.id);
if(trg & nn::hid::BUTTON_X)
{
// CIA をインポート
if (ImportFile(nn::fs::MEDIA_TYPE_NAND, ROMFS_IMPORTEE_PATH)==false)ErrorPoff("Import");
}
nn::fs::Unmount("rom:");
s_RenderSystem.Clear();
drawText(10,50,"Complate");
drawText(10,120,"Push Power Button & Power Off");
drawText(10,140,"Home Button is invalid");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}

View 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
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,6 @@
#ifndef TEST_DATA_H_
#define TEST_DATA_H_
void TestMain();
#endif

View 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 $(HORIZON_ROOT)/../CTR/sampledemos/common/include)
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
LIBS += lib_demo libnn_am
.SUBDIRS: $(exist-dirs \
body \
Imp \
)
DefineDefaultRules()

View File

@ -0,0 +1,64 @@
#!/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/screen/screen.cpp
../../common/savefile/savedata.cpp
../../common/savefile/membak.cpp
../../common/savefile/savefile.cpp
../../common/gui/gui.cpp
../../common/shfnt.cpp
../../common/sleep.cpp
../../common/common.cpp
#LIBS += lib_demo libnn_am
#LIBS += libnn_ps
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_null_icon.bsf
#Cia バージョン:マスタリング毎に更新すること
#メジャーはrsfで指定(Remasterversion)
MAKECIAFLAGS = -minor 0 -micro 11
include $(ROOT_OMAKE)/modulerules
build: $(DEFAULT_TARGETS)

Binary file not shown.

View File

@ -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

Binary file not shown.

View File

@ -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ęm nęeęmëm v v,v,v-~Č]ÉeÉeęeęeëmëm vęe n n v v,~-~M† v,~,~-~-~N†N†oŽM~N†N†oŽoŽp<70>ž n,v,v-~-~N†N†oŽ-~N†N†oŽoŽppnŽ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Ë2 vk+;-~LmN†Éeęeęeęmęm v v,vëm v v,~,v-~-~N† v«!-~ŚK moŽK*.uN††oŽ<6F>íS¬:‘ž˛ž v-~«!ÍdM†®}K*«!N†nuoŽpŽkđ…Ndl2oŽ<6F>L2±ž±ž˛¦kĐt±ž˛¦ržŇŤk.Kl2kpO}°…˛žnK°td CđtÓ¦Ô® KÍBő¶żÍ:Ťkł•ÍB.KÍB…ń|¦7Ç7Çđc÷ĆXĎy×Ó¦ô®ô®ń|ő¶żk·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ßßßśçśçĽďĽďÝďçĽçĽď˝ď˝ďÝ÷Ý÷Ţ÷ÝďŢ÷Ţ÷ţ÷Ţ÷˙˙˙˙˙˙ßśçĽç˝ďĽďÝďÝďŢ÷˝ďÝ÷Ý÷Ţ÷Ţ÷ţ˙ţ˙˙˙Ţ÷Ţ÷ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

View File

@ -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ęm nęmęmęm n n n v vÉeęeęeęmęmęmęm nęmëmëm n n v v v n v v v v,v,v,~ v,v,v-~-~-~-~M†ëm n n v v v,v,~ v,v v,~,~-~-~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ŽpoŽ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ëm n nęmëmëm n n v v,vęeęeęmęmęmëm n vęm n n v v v v,v n v v,v,v,~,~-~ v,~,~-~-~M~M†N† n v v v v,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ŽpOŽoŽoŽpŽpŽ<70><EFBFBD><70><EFBFBD>žž˛žn†oŽoŽoŽoŽp<70><EFBFBD><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ęmTęeęmęmëm
n n n+e+]Ë2kkkk2ËKęeęmęm n«e«! Lk n n v vË2k2kkKT+;,~,~-~-~-~ěd-~íu-~-~N†N†N† v vŚm,v,v-~-~-~kk+;K*l\N† e~-~M†M†N†N†N††numm *«!kkkŤK­K-~N†N†N†N†Ť\OŽŤdN†oŽoŽoŽoŽ/ŽpŽ<70>k­KkěBp<70><EFBFBD>ž«!kŹ} *¬:P}kkoŽoŽoŽpp<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đck 2Ë!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ęm n nęeęmęm n n v v v n v v v v,v,v-~ęmëmëm n n v v v n v v v v,~,~-~ 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ż0lk0lkttku®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<70><EFBFBD>N†N†N†oŽoŽoŽoŽpoŽ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ßßßçççśçĽççççĽçĽçĽďĽďĽďĽçĽďĽď˝ď˝ďÝď˝ďÝ÷ßççĽçĽçĽçĽçĽďśçĽçĽďĽďĽď˝ď˝ďÝďĽď˝ď˝ďÝď˝ďÝ÷Ý÷Ţ÷ÝďÝ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷ţ÷Ľď˝ď˝ďÝďÝďÝ÷Ý÷Ţ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷ţ˙Ţ÷Ţ÷Ţ÷ţ˙ţ˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

Binary file not shown.

View File

@ -0,0 +1,29 @@
# アプリケーションのデフォルト値
BasicInfo:
# プログラムのタイトル名を指定します。
Title : $(TITLE)
# BackupMemoryType: 128KB
BackupMemoryType: None
Logo : Nintendo
# CompanyCode: "00"
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

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,793 @@
#include <nn.h>
#include <stdio.h>
#include "screen.h"
#include "../../../../common/my_defs.h"
#include "../../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();
}
nn::os::Tick holdTck;
u32 holdVal;
//---------------------------------イベントコールバック
//----------------PADボタン
void pushButton(u32 sts)
{
//NN_LOG("button > %4x\n",button);
u32 trg = sts & 0x0ffff;
u32 hld = sts >> 16;
/*
if (holdVal)//同時押し猶予期間
{
if (nn::fnd::TimeSpan::FromMilliSeconds(100) > (nn::os::Tick::GetSystemCurrent()-holdTck)){
holdVal |= trg;
if (holdVal == nn::hid::BUTTON_LEFT | holdVal & nn::hid::BUTTON_X ){
holdVal = 0;
scr_evnt = EVNT_PUSH_LEFT_X;
}
}else holdVal = 0;
}else if( (holdVal = trg & (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X ))>0)
{//一定時間どっちかのボタン押し維持
holdTck = nn::os::Tick::GetSystemCurrent();
}
*/
if( holdVal )//押し続け判定
{
if (hld != holdVal)
{
holdVal = 0;
}else
if (nn::fnd::TimeSpan::FromMilliSeconds(4000) < (nn::os::Tick::GetSystemCurrent()-holdTck))
{
holdVal = 0;
scr_evnt = EVNT_PUSH_LEFT_X;
}
}else if (hld == ( nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X ))
{
holdVal = hld;
holdTck = nn::os::Tick::GetSystemCurrent();
}
#ifdef DEBUG_ENABLE
else if (hld & nn::hid::BUTTON_DOWN)//同時押し
{
if (hld & nn::hid::BUTTON_Y)
if (hld & nn::hid::BUTTON_X)
scr_evnt = EVNT_PUSH_DOWN_Y;
}
else if (trg & nn::hid::BUTTON_R)scr_evnt = EVNT_PUSH_R;
else if (trg & nn::hid::BUTTON_L)scr_evnt = EVNT_PUSH_L;
#endif
#ifdef ENABLE_CRUSH
else if (trg & nn::hid::BUTTON_Y)scr_evnt = EVNT_PUSH_Y;
#endif
else if (trg & 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;
holdVal = 0;
holdTck = nn::fnd::TimeSpan(0);
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;
mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効
#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();
}

View File

@ -0,0 +1,115 @@
#ifndef SCREEN_H_
#define SCREEN_H_
#include <string.h>
#include <nn/types.h>
#include "../../../../common/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

View 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.05
#endif

View 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 .. カードが見つからない

View File

@ -0,0 +1,57 @@
動作確認環境:
ARM製 RVC_Nintendo 4.1
omake 0.9.8.5
CTR SDK2.0 + Repairtoolプライベートパッチ
v1.03以降は ps_api.h と libnn_psも(SystemProgramKitに入っている)
動作要件SDK2.0以降のシステム本体
準備)
SDK2.0用のSampledemos のcommon,gxをビルドしておく
omakerootのあるディレクトリにあるomakeファイルで
SAMPLED_DEMOS_COMMON_INCLUDE_DIR に 
sampledemos/common/includeの位置を指定しておく
公開鍵pubkeyをimp/omakeで指定
ビルド)
omakerootのあるディレクトリでomake実行
body下でビルドし出来たcia を、Imp下のomake(SRC_IMPORTEE_PATH)で指定
(量産機で使うには、マスタリング後のciaを指定)
ビルドするとNANDインポート用のcciができる
インポート先:
ciaをからインポート -> SD .. DevMenu使用,DevMenufullならnandにも入れられる
カード起動しインポート -> NAND
量産実機での実行にはマスタリング必須
body下で作成したcia をOLS付でマスタリングし
そのciaを使って作成したcciをマスタリング
マスタリングの流れ:
・body/images下に出来たciaをマスタリングしOLSを付ける
・このciaをImpのomakeで指定、もしくは指定場所に置く
bodyのビルドで上書きされないよう場所かファイル名変えたほうが安全
・imp/omake実行し、cci作成
・cciをマスタリング
OLSごとリマスタバージョン更新が必要
common/ver.hは表示バージョン、ここだけ変更してもダメ
body/omekeのコメントを参考
NANDインポートで失敗する場合はciaをチェック
SDインポートし
開発実機で動く- マスタリングしてない
量産実機で動く- OLSが付いてない
1.03以降はインポート先の本体をシリアル番号で制限
"imp/imp_lis/"下にリストと署名サンプル
OpenSSL0.9.6k,rと 1.0.0d で動作確認
imp/imp_list 下にコマンドラインツール(win32版)用バッチ
使い方はcygwinでも同じ
ユーザにはomake指定のpubkeyと組のprivatekeyで作った署名を渡す
本ツール開発時のマスタリングは推進G(高橋さん)に依頼した
マスタリング済みDevMenu(full)および
CUP作成は飯島さんに聞く

View File

@ -0,0 +1,10 @@
<インポータのオプション有効化>
cms_inf.txtの名前でファイル作成
以下の記述でオプションが有効になる
-t: テストメニュー
   カード上のセーブにテストパターン書き込み&ベリファイ
-p: 本体シリアルを表示

View File

@ -0,0 +1,55 @@
////////////////////////////////////////////////////////////////
本ツールは 「Nintendo for 3DS」および専用カード用です
カード上のセーブデータをバックアップ及びリストアします
////////////////////////////////////////////////////////////////
NANDインポートしてから、内臓アプリ同様の手順で起動
本体システム2.0以降にしておく
CUP版(v1.02以降)は本体システムが古い場合自動更新メニュー起動
ただし、UPP(?)はHomeメニュー起動でないと使えない
(インポート手順)
・デバッガもしくはライタで"cci"をカードに書き込む
・Homeメニューよりカード起動しメニューからInport実行
・メニューのImportを選ぶ
・終了したら電源ボタンを短押し ->"電源を切る"をタッチ
電源を入れなおさないとアイコンがメニューに現れません
(NANDから削除)
起動まではインポートと同様
・メニューからDelete実行
終了後はメニューに戻ります
(テストパターン書き込み)
カード上のバックアップにテストデータを書き込みます
手元に使えるゲームカードが無い場合の動作確認用です
起動まではインポートと同様
・デバッガもしくはライタで"cci"をカードに書き込む
・カードを本体に差しメニューからTest Data実行
・カーソルで内容を選択、Aでライト、Xでベリファイ
種別はCasual Test を選ぶ、他はリリース時のチェックに使う程度
<テスト手順>
ライト後に一旦終了してHomeメニューにもどり
Nand上のツールを起動し、リードリストア
Homeボタンなどでツール終了、カード起動しベリファイ
ツール本体の操作は操作マニュアル参照
[Histry]
#表示ver マスタリング時のver
# 変更内容
v1.04 - Remaster 2.0.9 - svnリビジョン 190
body,imp: アイコンを?に変更:初期メニューのバグでフラグで拒否しても履歴に見えてしまう
動作中の無線停止
v1.03 - Remaster 2.0.8 - svnリビジョン 181
body: "LEFT+X"同時押を4秒押し続けに変更
タッチ判定の調整
imp: インポート先を本体シリアル番号で制限
設定ファイルでオプション有効化するようした
SDK2.0+ロンチメニューで動作確認

View File

@ -0,0 +1,10 @@
量産実機での動作にはマスタリングが必要
ciaはサーバ認証OLS必須
OLSは前回取得時からリマスタバージョンを上げる必要あり(2011/2月現在)
(例えば、前回 1.0.0 なら 1.0.1 )
メジャーはrsfで指定(Remasterversion)
マイナとマイクロはOmakefile
MAKECIAFLAGS = -minor 0 -micro 1
上の場合 *.0.1 (*はrsfのRemasterversion)

View File

@ -0,0 +1,41 @@
<操作メニュー>
操作が出来る状態のとき下画面にボタン表示
・バックアップが無い状態でカードを差すと
バックアップが有効
・バックアップがある状態では
リストアが有効
(バックアップ)
タッチして実行画面
カードから本体内メモリに読み出します
(リストア)
タッチして実行画面
バックアップした内容をカードへ書きます
成功すると自動で消去
失敗の場合は消去しません
(バックアップデリート)
先頭画面で 方向キー LEFT + X 同時押し
以下、ビルド時にフラグ有効(my_dess.h 内)にした場合のみ使える
//クラッシュモード
書き戻す際にデータを壊す、ベリファイで必ずエラー
先頭画面で Y ボタン
//デバグモード
先頭画面で 方向下+(0.09まで)
先頭画面で 方向下+X+(1.00以降)
クラッシュモード有効時 L ボタン
//テストデータ書き込み
デバグモード中に先頭画面でRボタン

View File

@ -0,0 +1,34 @@
ビルド時に組み込んだ公開鍵のペアとなるプライベート鍵を使って署名を行う
バージョンで鍵を識別する
鍵変更だけの場合でもバージョンを変えること
Openssl.exe : cygwinのインスト、Win版がある
RSA鍵、ビット長はのみ
SHA256のダイジェストに署名する
Openssl0.9.6.k(r),1.0.0d作成の書名で動作確認
(鍵作成)
openssl genrsa -out private_key.pem 2048
openssl enc -d -base64 -in private_key.pem -out private_key.der
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der
(1.0.0の場合)
openssl genpkey -out private_key.der -outform DER -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der
(署名)
openssl dgst -sha256 -binary -keyform DER -sign private_key.der -out csm_sign.dat csm_list.txt
プライベート鍵のバイナリが不要なら
openssl genrsa -out private_key.pem 2048
openssl rsa -pubout -outform DER -in private_key.pem -out public_key.der
openssl dgst -sha256 -binary -sign private_key.pem -out csm_sign.dat csm_list.txt
作成したpub鍵をインポートアプリのomakeで指定
OBJECTS[] =
$`(ObjectFromBinary $(TARGET), ./Imp_list/Public_Key.der)
リストをプライベート鍵で署名作成、リストと署名をインポート時にSDから読む

View 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 $(HORIZON_ROOT)/../CTR/sampledemos/common/include)
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
LIBS += lib_demo libnn_am
.SUBDIRS: $(exist-dirs \
Mover \
ToSD \
)
DefineDefaultRules()

View 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: .

View File

@ -0,0 +1,19 @@
BasicInfo:
Title : $(TITLE)
BackupMemoryType: None
Logo : Nintendo
# Companycode: "00"
ProductCode : "CTR-P-23BA"
# MediaSize: 2GB
AccessControlInfo:
FileSystemAccess:
- Debug
Rom:
HostRoot : $(ROMFS_ROOT)
TitleInfo:
# UniqueId: 0xffff6
UniqueId: 0xf8031
Version: 0

View File

@ -0,0 +1,71 @@
#!/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/shfnt.cpp
../../common/sleep.cpp
../../common/common.cpp
OBJECTS[] =
$`(ObjectFromBinary $(TARGET), ./Imp_list/key/Public_Key.der)
TARGET_PROGRAM = CtrSaveToSd_imp
TITLE = imp
LIBS += lib_demo libnn_am
LIBS += libnn_ps
IMPORTEE_CIA = importee.cia
SRC_IMPORTEE_PATH = ../body/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/CtrSaveToSd.cia
#とりあえず、マスタリング時は直おき、配置時に改名
#SRC_IMPORTEE_PATH = CtrSaveToSd_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
CTR_BANNER_SPEC = banner_null_icon.bsf
include $(ROOT_OMAKE)/modulerules
build: $(DEFAULT_TARGETS)

View File

@ -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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
-t

View File

@ -0,0 +1 @@
EJF10000237

View File

@ -0,0 +1,2 @@
<EFBFBD>c°Ŕć;qi|xŰ$^D˙Q¨lڎË_ňůO?·OQwř]i…łľÄdžÁUÄĘP<E280BA>ŕíđŤŕL8ŞýQLĘîQj€ô)°~SVO>( $6çůi(—H?ä8?0Ű„U zO¤Wó<>ł˝$<24>ŻšŔPĐ“Ž<ö]ϨúÖď[¤Ř Ý)3„Öčv}2^Fˇođż{5íÔTzdNA*-‰—Í\Â$4ŚĐ]Î9éěKmČT¬F­0ÍúăL—39<>őÖi=ĺčŽô'[4<>>ł÷ż´•Q,/µ†łGČ—]<5D>žźß03‡
ţ“›Đâ×Ű=

View File

@ -0,0 +1,4 @@
openssl genrsa -out private_key.pem 2048
openssl enc -d -base64 -in private_key.pem -out private_key.der
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der

View File

@ -0,0 +1,3 @@
rem ver1.0.0—p
openssl genpkey -out private_key.der -outform DER -algorithm rsa -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
openssl rsa -pubout -inform DER -outform DER -in private_key.der -out public_key.der

View File

@ -0,0 +1,7 @@
@echo off
if "%1"=="" goto 1
openssl dgst -sha256 -binary -keyform DER -sign ../key/private_key.der -out cts_sign.dat %1
goto end
:1
openssl dgst -sha256 -binary -keyform DER -sign ../key/private_key.der -out cts_sign.dat cts_list.txt
:end

View File

@ -0,0 +1,5 @@
秘密鍵の扱いは注意
署名作成する必要の無い所には出さない
署名作成時は、配布先で使用するバージョンに入っている
鍵とペアの秘密鍵を使うこと

View File

@ -0,0 +1,45 @@
本体印刷のシリアル最後尾の四角い枠に入った数字は
digitというものらしい
リスト作成時に入力違いをチェックするのに使えそう
コマンドラインでファイル指定する簡単なチェッカーとか
以下、長谷川さんメール抜粋
----------------
チェックデジットの計算方法は一般的なものらしく、
"モジュラス10 ウェイト3・1M10W31"というものらしいです。
// NULL終端されたシリアルナンバーを受け取る
// NULL文字の場所にチェックデジットを付加して新たにNULL終端する
void AddCheckDigit(char* serial)
{
size_t len = std::strlen(serial);
u8 digit = 0;
bool odd = true;
for(u8 i = len - 1; i > 0 && std::isdigit(serial[i]); i--)
{
if(odd)
{
digit += (serial[i] - '0') * 3;
}
else
{
digit += (serial[i] - '0');
}
odd = !odd;
}
if(digit % 10 != 0)
{
serial[len] = 10 - (digit % 10) + '0';
}
else
{
serial[len] = '0';
}
serial[len + 1] = '\0';
}

View File

@ -0,0 +1,27 @@
目的:許可した本体のみインポート
公開鍵はROMから読み込む
SC ツール用本体のシリアルをメールなどでREDへ連絡
RED) リスト(csm_list)と署名(csm_sign)を作成し送る
インポート手順
 リスト、署名を書き込んだSDをCTRに差す
・ インポート用アプリをカード起動
・ 有効な本体ならインポートメニューが表示される
署名はOpeneelで作成
特に手を加えずSDルートに置く
リストの書き方
インポート許可シリアルをテキストで羅列
---
aaaaaaaa
bbbbbbbb
----
本体裏シリアル終端のdigit(四角い枠の数字)は省く
digit確認したい場合はリスト作成時にやっとく
ファイルサイズは64Kまで(シリアルのみ記載で、およそ4000台)

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAsOicKm/hXrlKcKyJd+jBeg1yEa5j8tT9UINkCP/UWFyLQ9xs
/EYImuQlGhzqk+TWTU9sdLnOqbQFxzCPSDu/ictKayv8ZZwW53N1YodMITEPLo2i
ZVuknNkl/XQcLGjl9SymFXShry0g433QO2SxuyLcREkV9ZSRanS8Ei/NftyK7OEZ
zbcf5D8MSwhmF5gwU5h9xt0UvEkSwYUjQXBsvwJzVb5c5pDhiGX2+4KWo3+ZQlbS
OCL86HA31SzMNyKvI5zrLPpEJNLLOp8s7wX1S2YPrVbwYtxciHsQCNfhFnZKK4iI
78Sx6L6km8NARte3Q7fmi+lQHNFLKJyOcyKuwwIDAQABAoIBAE9vMufvMp/ozR8I
qfU4gt99+BEuX9yifFfRl3JfBQbkDvhammkwPR7ngC1YfJAJuZwfJJDI+Z3DorCN
Alkp0thZesHij0NEshgdBMFIBQwGTk3V9OxUGPcAnglPQHNEarUK5kxOAWd5+QGM
9ZolnZRsk8DpnD2YBy9o2SXFZx0lxOb3UoMDcm46mMfFf+dJFX3iF8LurLllkzHr
IMiqWkU2q2B2+M93LMDr4Sh4JTta9mMMYnBGE2Yuy1SqxBivByHfnIXFJAooAwuz
0B9uJTxvdyUtNvmGyWKrY0nFdzaDAY64hfpRF0I5D9QTQXso3gKyWxytiDTUWF8S
H7nTZuECgYEA2YH0wVTdIhnpEO3tQZ4wI7r2AM7tUgEsmca4wo4vahScxt/fuXE/
WZ0qmjBUaky9liRy8GwkRz4SSd6cYRDf5ht5OdFh/0ksFwcZscCDbowx8d0qVRMR
BPIGSjJZg8gBuLzcrdx6XfbUVUzFVIm9l8NTd6DHaDNqxUSrUrCWGlECgYEA0DdX
i5iYqbrgarbJYzDV2yy4mvkL2rTCC34Eya//yDwhsNFVR6GdzmJJoz04Ka5i2/67
BmPQZXioBMckcUdYDqDsEtCdV6nqbX6HmL/Hxvhe3FgKMK8rPwH3adkYzoWZerza
W3AR4W5KBWwtje/ncDXlNqrR956vNtfausgdntMCgYBXSgUstV8NeXKEXcfShqZx
IG3rgx/QwjHhANRTF/bFTsJgOaYyaNVwpFddi7nE80k+gSAzhmLEyI9UX+dIORpx
4WK0Jmh6qCXuk+Xm5QiaC99bXlPH0qAI6QxHKI+uCE1Qk1LI32uoXA94sBedRq30
wumzX63HDqNxyY4r4DxNEQKBgDQOcgvLpfdhanQjqOvsrLr0Tl8ofsc6Q/1dj1Lh
dsCYEBBF9d1H0c1kk2aFisIZAExiPl4VnGeSJ+ex5jGQFbrqjrsRfxUIvTyM0tfk
sszTEdxjAoEzektxcWr8RRB1JG8kQi90MHQ8/7KlXipLXYCXaOwm/wG6obHDe8MQ
/x7TAoGAZ+092oEfNVyZaniPn4B7C3FMmCz555THhUHTzlmAITkFeXH006hbqHYX
romWUfA4qexKWKoSb5crBPm9h/3OlwcWgkldDDYDm1SKTrEDKmpmkDOKMXrDivsV
mJULZt10BA0tTb35ToxPy3ChtI2Qy2G+m9nCMu9AdvEos/oRL68=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,11 @@
<インポータのオプション有効化>
cms_inf.txtの名前でファイル作成しSDのルート下に配置
以下の記述でオプションが有効になる
デバグや不具合調査時用、通常はいらない
-t: テストメニュー
   カード上のセーブにテストパターン書き込み&ベリファイ
-p: 本体シリアルを表示

Binary file not shown.

View File

@ -0,0 +1,492 @@
/*---------------------------------------------------------------------------*
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/fs.h>
#include <nn/cfg/CTR/cfg_ApiSys.h>
#include <nn/cfg/CTR/cfg_ApiInit.h>
#include <nn/am/am_ApiLocalImporter.h>
#include <nn/am/am_ApiSystemMenu.h>
#include <nn/applet.h>
#include <nn/ndm.h>
#include <nn/ndm/ndm_DebugControl.h>
#include <nn/crypto/crypto_RsaKey.h>
#include <nn/ps/ctr/ps_Api.h>
#include <stdio.h>
#include <string.h>
#include "demo.h"
#include "../../body/ver.h"
#include "../common/sleep.h"
#include "../common/common.h"
#include "../common/shfnt.h"
#include "test_data.h"
#define INF_FILE "sdmc:/cts_inf.txt"
#define KEY_LENGTH 2048
#define LIST_FILE "sdmc:/cts_list.txt"
#define SIGN_FILE "sdmc:/cts_sign.dat"
extern "C" {
extern u8* PUBLIC_KEY_BEGIN[];
extern u8* PUBLIC_KEY_END[];
const void* PUBLIC_KEY = PUBLIC_KEY_BEGIN;
}
demo::RenderSystemDrawing s_RenderSystem;
nn::fnd::ExpHeap appHeap;
uptr heapForGx;
void ErrorStop(char *s);
void ErrorPOff(char *s);
const size_t ROMFS_BUFFER_SIZE = 64*1024;//ROMマウント用
const size_t READ_BUFFER_SIZE = 64*1024;
#define SDK_SER_LEN nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN
namespace
{
u8* readBuf;
u8* romfsBuf;
}
nn::Result result;
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, READ_BUFFER_SIZE))
{
stream->Write(readBuf, read);
}
result = nn::am::EndImportProgram(stream);
}
return result.IsSuccess();
}
#define LIST_MAX 4000
#define LIST_LENGTH (LIST_MAX * (nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1))
u8 s_list[LIST_MAX][nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1];//シリアルリスト
u8 sign[256];//署名
u8 serialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN+1];
//本体シリアル取得
int GettedSerLen;
bool GetSerial(){
nn::cfg::CTR::init::Initialize();
nn::cfg::CTR::system::Initialize();
result = nn::cfg::CTR::system::GetSerialNo(serialNo);
nn::cfg::CTR::system::Finalize();
nn::cfg::CTR::init::Finalize();
serialNo[nn::cfg::CTR::CFG_SECURE_INFO_SERIAL_NO_LEN] = 0;
GettedSerLen = strlen((char*)serialNo);
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);}
//上はASCIIのみ対応したTextWriterへのラッパ
//日本語表示の場合、WideTextWriterを使う(要sft_側の関数追加)
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();
/*
int i = nn::ndm::GetDaemonStatus( nn::ndm::DN_CEC );
if (i !=3 )NN_LOG("DN_CEC %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_BOSS );
if (i !=3 )NN_LOG("DN_BOSS %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_NIM );
if (i !=3 )NN_LOG("DN_NIM %d\n",i);
i = nn::ndm::GetDaemonStatus( nn::ndm::DN_FRIENDS );
if (i !=3 )NN_LOG("DN_FRIENDS %d\n",i);
*/
}
}
//終了
void endfunc()
{
appHeap.Free(reinterpret_cast<void*>(readBuf));
appHeap.Free(reinterpret_cast<void*>(romfsBuf));
nn::hid::Finalize();
SharedFontFinalize();
nngxWaitVSync(NN_GX_DISPLAY_BOTH);//SDK2.0以降では不要?
s_RenderSystem.Finalize();
}
//署名検証
bool VeriRsa(u8* src,size_t sz,u8* sig)
{
nn::crypto::RsaKey key;
//nn::crypto::Initialize();
nn::ps::CTR::Initialize();
result = key.InitializePublicKey(PUBLIC_KEY_BEGIN,KEY_LENGTH);
if (result.IsSuccess())
{
result = nn::ps::CTR::VerifyRsaSha256(src,sz,sig,key);
}
//nn::crypto::Finalize();
nn::ps::CTR::Finalize();
return result.IsSuccess();
}
//エラー
void ErrorCommon(char *s,char *ss)
{
char str[128];
nn::am::FinalizeForLocalImporter();
nn::fs::Unmount("sdmc:");
nn::fs::Unmount("rom:");
NN_LOG(s);
NN_LOG(" result = %d\n",result.GetDescription());
shf_SetScale(0.7,0.7);
setColor(1.0, 0.0, 0.0,1.0);
strcpy(str,"Error: ");
strcat(str,s);
drawText(10,100,str);
drawText(10,140,ss);
}
void ErrorStop(char *s)
{
ErrorCommon(s,"Push Home Button & end");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}
void ErrorPoff(char *s)
{
ErrorCommon(s,"Push Power Button & Power Off");
drawText(10,160,"Home Button is invalid");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}
//改行後の位置を返す、0=見つからなかった
int CrLf(int n,int max)
{
u8 d;
while(n < max)
{
d = readBuf[n];
if (d==0x0a)return n+1;//LF
if (d==0x0d)//CR
{
if (n == max-1)return 0;//終端
n++;
if (readBuf[n]==0x0a)return n+1;//CR+LF
ErrorStop("list broken");//CRのみは異常、署名時にファイル壊れてた
}
n++;
}
return 0;
}
nn::fs::FileInputStream fi;
//ファイルリード
s32 FileRead(char* fname)
{
s32 size;
result = fi.TryInitialize(fname);
if (result.IsFailure()){//open error
//NN_LOG("desc= %d\n",result.GetDescription());
return 0;
}
result = fi.TryRead(&size,readBuf,READ_BUFFER_SIZE);
fi.Finalize();
if (result.IsFailure()){
//NN_LOG("desc= %d\n",result.GetDescription());
return 0;
}
return size;
}
char ver[16];
char seri[32];
void nnMain( void )
{
//nn::Result result;
bool flg_applove=false;
bool flg_test=false;
int i,j,n;
s32 fsize;
extern bool prohibitHome;// HOME ボタン禁止
nn::os::Initialize();
nn::fs::Initialize();
//DEA-SUPにて推奨のフリーズ暫定対策無線デーモンを停止 (2011.3.1 現在)
//ただし、スリープ時の"いつのまに通信"は止まらない
//無線は使わないので本体横スイッチ切っとくのが確実
nn::ndm::Initialize();
result = nn::ndm::SuspendScheduler();
//NN_LOG("%d",result.GetDescription());
//中断処理の準備
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();//スリープ非対応
// ヒープの確保
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::pl::SharedFontType sftype = nn::pl::GetSharedFontType();
// スリープ要求に対する返答を有効にする
// また、蓋の状態チェックを行い蓋が閉じられているならスリープ要求が発生する
// 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 to SD 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())ErrorStop("Initialize");//初期化に失敗
if (READ_BUFFER_SIZE < LIST_LENGTH)ErrorStop("buffer size");//バッファサイズのチェック
//ファイルバッファ
//カゲマイ上のSDリード速度比較実験で32アラインが良かったので、おまじない
//回数もサイズも少ないので気にする必要ないかも
if (READ_BUFFER_SIZE > appHeap.GetTotalFreeSize())ErrorStop("memory alloc");
readBuf = reinterpret_cast<u8*>(appHeap.Allocate(READ_BUFFER_SIZE,32));
if (ROMFS_BUFFER_SIZE > appHeap.GetTotalFreeSize())ErrorStop("memory alloc");
romfsBuf = reinterpret_cast<u8*>(appHeap.Allocate(ROMFS_BUFFER_SIZE,32));
/*
//シリアルチェック
if( GetSerial() == false)ErrorStop("Get Serial");//本体シリの取得に失敗
result = nn::fs::MountSdmc();//ダイレクトでマウント..マスタリング時にワーニング
if (result.IsFailure())ErrorStop("Mount SD");
fsize = FileRead(INF_FILE);//設定ファイルがあるか
if((fsize < 1024) && (fsize > 0))//サイズチェック,増えても1Kは超えない
{//不具合調査時に状況にあわせて現場で作成&変更を想定したオプション
//通常は不要なので無しでも動くようしとく
n = 0;
while(n < fsize)
{
if (readBuf[n] == '-'){
if (n == fsize-1)break;//終端
n++;
switch (readBuf[n]){
case 'p':// -p .. 本体シリアル表示
strcpy(seri,"s/n: ");
strcat(seri,(char *)serialNo);
shf_SetScale(0.5,0.5);
drawText(10,40,(char*)seri);
shf_SetScale(0.7,0.7);
break;
case 't':// -t .. テストメニュー有効
flg_test = true;
break;
}
}
n++;
}
}
//シリアル表示(オプション)後にチェック
//デバッガ=15,実機=11
if (GettedSerLen < 11)ErrorStop("invalid Serial");
fsize = FileRead(SIGN_FILE);//署名リード
if(fsize != 256)ErrorStop("sign file");//鍵のbit長は2046固定
memcpy(sign,readBuf,256);//readBuf -> sign
fsize = FileRead(LIST_FILE);//リストリード
if((fsize > LIST_LENGTH ) || (fsize == 0))ErrorStop("list file");
nn::fs::Unmount("sdmc:"); //検証後はSDから読まないでメモリバッファ上のデータを使う: 差替え対策
if (VeriRsa(readBuf,fsize,sign) == false)ErrorStop("sign verify");
//署名検証OK
int list_ct = 0;
n=0;
while(n < fsize)//リスト作成
{
if (readBuf[n] == '#')//コメント行を無視、ワイド文字非対応
{
i = CrLf(n,fsize);//コメントの次行
if (i == 0)break;//ファイル終わりまで改行が見つからない
}else
{
//改行さがし
if ((fsize-n) > (SDK_SER_LEN+2))
{//シリアルは改行つける
i = CrLf(n,n+SDK_SER_LEN+2);
if (i == 0)ErrorStop("list broken");//改行が見つからない
}else{
i = CrLf(n,fsize);
if (i ==0)i = fsize;//改行以外でファイル終
}
if ((i-n) > GettedSerLen)//シリアルをリスト化
{
j = 0;
while(n<i)
{
if ((readBuf[n] == 0x0d) || (readBuf[n] == 0x0a))break;
s_list[list_ct][j] = readBuf[n];
j++;n++;
}
s_list[list_ct][j] = 0;//終端
list_ct++;
if (list_ct>=LIST_MAX)ErrorStop("List too Long");
}
}
if ((fsize-i) < GettedSerLen)break;//ファイル終
n=i;//ポインタを改行の次へ
}
//プログラムミス、コードバグ対策
//値が小さいと判定が緩くなるが、動作確認時にスルーしそうなので
//念の為チェック
if (GettedSerLen < 11)ErrorStop("invalid Serial");
//本体シリアルがリストにあるかチェック
n =0;
while(n<list_ct)
{
if (GettedSerLen == strlen((char*)s_list[n]))
{
for(i=0;i<GettedSerLen;i++)
{
if (serialNo[i] != s_list[n][i])break;
}
if (i == GettedSerLen)
{
flg_applove = true;
break;
}
}
n++;
}
*/
u32 mask = 0;
//メニュー表示
// if (flg_applove)//インポート許可本体
{
drawText(80,100,"Push X : Import");
drawText(80,140,"Push Y : Delete");
mask |= nn::hid::BUTTON_X | nn::hid::BUTTON_Y;
}
//本体機能で消せるようなったら、そっち使うべき
//将来的にdeleteは省いていいかも
//if (flg_test)//テストメニュー
{
drawText(80,160,"Push R : Test Data");
mask |= nn::hid::BUTTON_R;
}
s_RenderSystem.SwapBuffers();
if (mask == 0)ErrorStop("Serial Check");//実行できるメニューないときトラップ
u32 trg = WaitKey(mask);
if (trg & nn::hid::BUTTON_R){
shf_SetScale(0.6,0.6);
TestMain();//テストデータへ
}
nn::fs::MountRom(16, 16, romfsBuf, ROMFS_BUFFER_SIZE);
shf_SetScale(0.8,0.8);
// CIA のプログラム ID を取得する。
nn::am::ProgramInfo programInfo;
if (nn::am::GetProgramInfoFromCia(&programInfo, ROMFS_IMPORTEE_PATH).IsFailure())ErrorStop("cia infomation");
// Imprting/Delete 表示
s_RenderSystem.Clear();
if(trg & nn::hid::BUTTON_X) drawText(10,120,"Importing");
else drawText(10,120,"Delete");
s_RenderSystem.SwapBuffers();
// HOME ボタン禁止
//Homeで中断するとアイコンが更新されない、電源OFF画面からHomeは問題なし
prohibitHome = true;
// 既に存在するものをインポートするとエラーが返ってくるので、あらかじめ消しておく。
nn::am::DeleteProgram(nn::fs::MEDIA_TYPE_NAND, programInfo.id);
// タイトル鍵が違うケースに対応するために、チケットも消しておく。
nn::am::DeleteTicket(programInfo.id);
if(trg & nn::hid::BUTTON_X)
{
// CIA をインポート
if (ImportFile(nn::fs::MEDIA_TYPE_NAND, ROMFS_IMPORTEE_PATH)==false)ErrorPoff("Import");
}
nn::fs::Unmount("rom:");
s_RenderSystem.Clear();
drawText(10,50,"Complate");
drawText(10,120,"Push Power Button & Power Off");
drawText(10,140,"Home Button is invalid");
s_RenderSystem.SwapBuffers();
WaitKey(0);
}

View File

@ -0,0 +1,957 @@
/*---------------------------------------------------------------------------*
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())
{
//NN_LOG("%d\n",res.GetDescription());
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;
}
const char kinsi[] = {0x22,'<','>','?','*','|',0x5c,':',' ','/',0};//0x22 = "",0x5c = 円マーク
const char *kinsi2[] = { "CON","PRN","NUL","AUX","LPT1","LPT2","LPT3","LPT4","COM1","COM2","COM3","COM4"
,"con","prn","nul","aux","lpt1","lpt2","lpt3","lpt4","com1","com2","com3","com4",""};
//FAT違反の名前
bool Test6_W()
{
res = nn::fs::FormatSaveData(100,100,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;
}
//禁止文字
char *base = "test6";
char dname[128],fname[128];
int ofst=0;
//頭に付ける
strcpy(dname,"data:/");
int pos = strlen(dname);
strcat(dname,"_");
strcat(dname,base);//data:/_base
int pos2 = strlen(dname)+1;
strcpy(fname,dname);
strcat(fname,"/_");
strcat(fname,base);
strcat(fname,".bin");//data:/_base/_base.bin
int i =0;
char c;
while(kinsi[i] != 0)
{
c = kinsi[i];
dname[pos] = c;
res = nn::fs::TryCreateDirectory(dname);
if (res.IsFailure()){
drawText(8,100,"Dir fail");
nn::fs::Unmount("data:");
return false;
}
fname[pos] = c;
fname[pos2] = c;
res = fout.TryInitialize(fname,true);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fout.TryWrite( &size,&src_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"write fail");
nn::fs::Unmount("data:");
return false;
}
fout.Finalize();
i++;
ofst+=512;
}
//末尾
strcpy(dname,"data:/");
strcat(dname,base);//data:/base
pos = strlen(dname);
strcat(dname,"_");//data:/base_
strcpy(fname,dname);
strcat(fname,"/");
strcat(fname,base);//data:/base_/base
pos2 = strlen(fname);
strcat(fname,"_.bin");//data:/base_/base_.bin
i =0;
while(kinsi[i] != '/')//末尾スラッシュは名無しでエラー
{
c = kinsi[i];
dname[pos] = c;
res = nn::fs::TryCreateDirectory(dname);
if (res.IsFailure()){
drawText(8,100,"dir fail");
nn::fs::Unmount("data:");
return false;
}
fname[pos] = c;
fname[pos2] = c;
res = fout.TryInitialize(fname,true);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fout.TryWrite( &size,&src_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"write fail");
nn::fs::Unmount("data:");
return false;
}
fout.Finalize();
i++;
ofst+=512;
}
//禁止名
i=0;
while(kinsi2[i][0] != 0)
{
strcpy(dname,"data:/");
strcat(dname,kinsi2[i]);
res = nn::fs::TryCreateDirectory(dname);
if (res.IsFailure()){
drawText(8,100,"dir fail");
nn::fs::Unmount("data:");
return false;
}
strcpy(fname,dname);
strcat(fname,"/");
strcat(fname,kinsi2[i]);
res = fout.TryInitialize(fname,true);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fout.TryWrite( &size,&src_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"write fail");
nn::fs::Unmount("data:");
return false;
}
fout.Finalize();
i++;
ofst+=512;
}
nn::fs::CommitSaveData();
nn::fs::Unmount("data:");
drawText(10,100,"end");
s_RenderSystem.SwapBuffers();
nngxWaitVSync(NN_GX_DISPLAY0);
return true;
}
bool Test6_V()
{
//禁止文字
char *base = "test6";
char fname[128];
int ofst=0;
//頭に付ける
strcpy(fname,"data:/");
int pos = strlen(fname);
strcat(fname,"_");
strcat(fname,base);//data:/_base
int pos2 = strlen(fname)+1;
strcat(fname,"/_");
strcat(fname,base);
strcat(fname,".bin");//data:/_base/_base.bin
int i =0;
int j;
char c;
while(kinsi[i] != 0)
{
c = kinsi[i];
fname[pos] = c;
fname[pos2] = c;
res = fin.TryInitialize(fname);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fin.TryRead( &size,&get_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"read fail");
nn::fs::Unmount("data:");
return false;
}
fin.Finalize();
for(j=0;j<512;j++)if(src_buff[ofst+i] != get_buff[ofst+i]){
drawText(8,100,"verifi fail");
nn::fs::Unmount("data:");
return false;
}
i++;
ofst+=512;
}
//末尾
strcpy(fname,"data:/");
strcat(fname,base);//data:/base
pos = strlen(fname);
strcat(fname,"_/");//data:/base_/
strcat(fname,base);//data:/base_/base
pos2 = strlen(fname);
strcat(fname,"_.bin");//data:/base_/base_.bin
i =0;
while(kinsi[i] != '/')//末尾スラッシュは名無しでエラー
{
c = kinsi[i];
fname[pos] = c;
fname[pos2] = c;
res = fin.TryInitialize(fname);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fin.TryRead( &size,&get_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"write fail");
nn::fs::Unmount("data:");
return false;
}
fout.Finalize();
for(j=0;j<512;j++)if(src_buff[ofst+i] != get_buff[ofst+i]){
drawText(8,100,"verifi fail");
nn::fs::Unmount("data:");
return false;
}
i++;
ofst+=512;
}
//禁止名
i=0;
while(kinsi2[i][0] != 0)
{
strcpy(fname,"data:/");
strcat(fname,kinsi2[i]);
strcat(fname,"/");
strcat(fname,kinsi2[i]);
res = fin.TryInitialize(fname);
if (res.IsFailure()){
drawText(8,100,"open fail");
nn::fs::Unmount("data:");
return false;
}
res = fin.TryRead( &size,&get_buff[ofst],512);
if (res.IsFailure()){
drawText(8,100,"read fail");
nn::fs::Unmount("data:");
return false;
}
fin.Finalize();
for(j=0;j<512;j++)if(src_buff[ofst+i] != get_buff[ofst+i]){
drawText(8,100,"verifi fail");
nn::fs::Unmount("data:");
return false;
}
i++;
ofst+=512;
}
fin.Finalize();
nn::fs::Unmount("data:");
drawText(10,100,"end");
s_RenderSystem.SwapBuffers();
nngxWaitVSync(NN_GX_DISPLAY0);
return true;
}
#define menu_ct 7
#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","fat error name"};
#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;
case 6:sccs = Test6_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;
case 6:sccs = Test6_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
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,6 @@
#ifndef TEST_DATA_H_
#define TEST_DATA_H_
void TestMain();
#endif

View 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 $(HORIZON_ROOT)/../CTR/sampledemos/common/include)
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
#LIBS += lib_demo libnn_am
.SUBDIRS: $(exist-dirs \
body \
Imp \
)
DefineDefaultRules()

View File

@ -0,0 +1,62 @@
#!/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)
# ビルドするソースコードを指定します。
SOURCES[] =
./source/main.cpp
./source/screen/screen.cpp
../../common/savefile/savedata.cpp
../../common/savefile/sdmc.cpp
../../common/savefile/savefile.cpp
../../common/gui/gui.cpp
../../common/shfnt.cpp
../../common/sleep.cpp
../../common/common.cpp
#LIBS += lib_demo libnn_am
TARGET_PROGRAM = CtrSaveToSd
TITLE = body
# ROMFS のルートパスを指定します。
#ROMFS_ROOT =
# 独自の RSF ファイルを指定する場合
ROM_SPEC_FILE = body.rsf
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/repairtool.desc
# バナー、アイコン
CTR_BANNER_SPEC = banner_null_icon.bsf
#Cia バージョン:マスタリング毎に更新すること
#メジャーはrsfで指定(Remasterversion)
MAKECIAFLAGS = -minor 0 -micro 0
include $(ROOT_OMAKE)/modulerules
build: $(DEFAULT_TARGETS)

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -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ęm nęeęmëm v v,v,v-~Č]ÉeÉeęeęeëmëm vęe n n v v,~-~M† v,~,~-~-~N†N†oŽM~N†N†oŽoŽp<70>ž n,v,v-~-~N†N†oŽ-~N†N†oŽoŽppnŽ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Ë2 vk+;-~LmN†Éeęeęeęmęm v v,vëm v v,~,v-~-~N† v«!-~ŚK moŽK*.uN††oŽ<6F>íS¬:‘ž˛ž v-~«!ÍdM†®}K*«!N†nuoŽpŽkđ…Ndl2oŽ<6F>L2±ž±ž˛¦kĐt±ž˛¦ržŇŤk.Kl2kpO}°…˛žnK°td CđtÓ¦Ô® KÍBő¶żÍ:Ťkł•ÍB.KÍB…ń|¦7Ç7Çđc÷ĆXĎy×Ó¦ô®ô®ń|ő¶żk·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ßßßśçśçĽďĽďÝďçĽçĽď˝ď˝ďÝ÷Ý÷Ţ÷ÝďŢ÷Ţ÷ţ÷Ţ÷˙˙˙˙˙˙ßśçĽç˝ďĽďÝďÝďŢ÷˝ďÝ÷Ý÷Ţ÷Ţ÷ţ˙ţ˙˙˙Ţ÷Ţ÷ţ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

View File

@ -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ęm nęmęmęm n n n v vÉeęeęeęmęmęmęm nęmëmëm n n v v v n v v v v,v,v,~ v,v,v-~-~-~-~M†ëm n n v v v,v,~ v,v v,~,~-~-~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ŽpoŽ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ëm n nęmëmëm n n v v,vęeęeęmęmęmëm n vęm n n v v v v,v n v v,v,v,~,~-~ v,~,~-~-~M~M†N† n v v v v,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ŽpOŽoŽoŽpŽpŽ<70><EFBFBD><70><EFBFBD>žž˛žn†oŽoŽoŽoŽp<70><EFBFBD><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ęmTęeęmęmëm
n n n+e+]Ë2kkkk2ËKęeęmęm n«e«! Lk n n v vË2k2kkKT+;,~,~-~-~-~ěd-~íu-~-~N†N†N† v vŚm,v,v-~-~-~kk+;K*l\N† e~-~M†M†N†N†N††numm *«!kkkŤK­K-~N†N†N†N†Ť\OŽŤdN†oŽoŽoŽoŽ/ŽpŽ<70>k­KkěBp<70><EFBFBD>ž«!kŹ} *¬:P}kkoŽoŽoŽpp<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đck 2Ë!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ęm n nęeęmęm n n v v v n v v v v,v,v-~ęmëmëm n n v v v n v v v v,~,~-~ 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ż0lk0lkttku®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<70><EFBFBD>N†N†N†oŽoŽoŽoŽpoŽ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ßßßçççśçĽççççĽçĽçĽďĽďĽďĽçĽďĽď˝ď˝ďÝď˝ďÝ÷ßççĽçĽçĽçĽçĽďśçĽçĽďĽďĽď˝ď˝ďÝďĽď˝ď˝ďÝď˝ďÝ÷Ý÷Ţ÷ÝďÝ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷ţ÷Ľď˝ď˝ďÝďÝďÝ÷Ý÷Ţ÷Ý÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷ţ˙Ţ÷Ţ÷Ţ÷ţ˙ţ˙˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙Ţ÷Ţ÷Ţ÷Ţ÷Ţ÷˙˙˙˙˙˙Ţ÷˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

Binary file not shown.

View File

@ -0,0 +1,30 @@
# アプリケーションのデフォルト値
BasicInfo:
# プログラムのタイトル名を指定します。
Title : $(TITLE)
# BackupMemoryType: 128KB
BackupMemoryType: None
Logo : Nintendo
# CompanyCode: "00"
ProductCode : "CTR-N-23AA"
TitleInfo:
# Category: 0x0010
# Category: SystemApplication
UniqueId: 0xf8030
Version: 0
Rom:
HostRoot : romfiles
# SaveDataSize: 512K
AccessControlInfo:
UseExtSaveData : false
FileSystemAccess:
- CategoryFileSystemTool
- DirectSdmcWrite
SystemControlInfo:
RemasterVersion: 1

Binary file not shown.

View File

@ -0,0 +1,691 @@
/*---------------------------------------------------------------------------*
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/os.h>
#include <nn/applet.h>
#include <nn/ndm.h>
//#include <nn/ndm/ndm_DebugControl.h>
#include <nn/fs/ctr/mpcore/fs_FileSystemBasePrivate.h>
#include <nn/fs/fs_Parameters.h>
#include "../../../common/savefile/savefile.h"
#include "../../../common/savefile/savedata.h"
#include "../../../common/savefile/sdmc.h"
#include "../../../common/common.h"
#include "./screen/screen.h"
nn::fnd::ExpHeap appHeap;
uptr heapForGx;
myResult errRes;
SaveData savedata;
nn::os::LightEvent ejectEvnt(false);
nn::os::LightEvent insEvnt(false);
Sdmc exsave;
nn::os::LightEvent ejectEvntSd(false);
nn::os::LightEvent insEvntSd(false);
//バックアップの状態
bool Active,Formatted;
bool exActive;
tArcInfo arcInfo,arcInfo_ex;//アーカイブ情報
//Top画面エラー表示
int tmerr;
//結果
typedef enum {
SUCCESS
,ERROR
,CANCEL
,INSEXIT
}RetCode;
//挿抜イベント時に設定
typedef enum {
InEx_None
,InEx_InsCard
,InEx_EjcCard
,InEx_InsSd
,InEx_EjcSd
}tIsInsEject;
tIsInsEject isInsEject;
extern u8 scr_evnt;
void WaitUI();
void PutError(ErcDev dev,int cd=0);
bool CheckInsExit();
//終了処理
void endfunc()
{
nn::fs::UnregisterCardEjectedEvent();
nn::fs::UnregisterCardInsertedEvent();
ejectEvnt.Finalize();
insEvnt.Finalize();
nn::fs::UnregisterSdmcEjectedEvent();
nn::fs::UnregisterSdmcInsertedEvent();
ejectEvntSd.Finalize();
insEvntSd.Finalize();
savedata.Finalize();
exsave.Finalize();
ScrFinalize();
}
//エラー停止
void failstop()
{
NN_LOG("fail %d,stop\n",errRes);
finish();
}
char sts[128];
//エラー表示
void PutError(ErcDev dev,int cd)
{
int desc,code;
nn::Result res;
switch (dev)
{
case ERC_DEV_CARD: res = savedata.LastNnResult;break;
case ERC_DEV_OUT: res = exsave.LastNnResult;break;
}
if ((cd ==0 ) && (dev != ERC_DEV_OTHER))
{
desc = res.GetDescription();
if (desc < 100 ) code = ERC_UNKNOWN;//キー検索完了 .. ありえない
else if (desc < 180 ) code = ERC_READ;//ファイルが見つからないか不正
else if (desc < 200 ) code = ERC_WRITE_OW;//ファイルが存在 .. 削除失敗?
else if (desc < 220 ) code = ERC_WRITE_NS;//空きが無い
else if (desc < 260 ) code = ERC_ACCESS;//操作拒否
else if (desc < 280 ) code = ERC_WRITE_PROTECT;//書き込み禁止
else if (desc < 340 ) code = ERC_ACCESS;//アクセスエラー
else if (desc < 390 ) code = ERC_FORMAT;//フォーマットエラー
else if (desc < 400 ) code = ERC_SDK_VERIFI;//改竄
else if (desc < 580 ) code = ERC_ROM;//ROM情報エラー
else if (desc < 590 ) code = ERC_RETRY;//リトライ要求
else if (desc < 600 ) code = ERC_UNKNOWN;//CCI,CXI不正 .. ありえない
else if (desc < 900 ) code = ERC_EXEC;//実行時エラー、ソフトバグ
else code = ERC_FATAL;//本体に問題の可能性
}else code = cd;
if (desc>=600){
sprintf(sts,"desc %d",desc);
}else{
sprintf(sts,"ERROR %d",dev+code);
}
scr_Status(sts,COLOR_RED);
}
wchar_t file_pathw[MAX_PATH_LENGTH];
char file_path[MAX_PATH_LENGTH];
//ドライバの仕様で速度的に4バイトアラインした方がいい(SDK 0.14.23 時点)
char fileBuffer[512] NN_ATTRIBUTE_ALIGN(4);//検証が512単位なので
char fileBuffer_ex[512] NN_ATTRIBUTE_ALIGN(4);
#define FILEBUFF_SIZE sizeof(fileBuffer)
//デバグ用ウエイト
void waitSec(int sec)
{
nn::os::Tick tm,tn;
tm = nn::os::Tick::GetSystemCurrent();
while(1)
{
tn = nn::os::Tick::GetSystemCurrent()-tm;
if(tn.ToTimeSpan().GetSeconds() > sec)break;
}
}
//保存先のディレクトリ削除
bool TryDeleteDir()
{
nn::Result resbk = exsave.LastNnResult;
if(exsave.Delete()==false)
{
//フォルダ削除に失敗したら手削除
strcpy(sts,"Please delete folder[ ");
strcat(sts,exsave.DirName);//フォルダ名
strcat(sts," ]");
scr_Status(sts,COLOR_RED);
return false;
}
exsave.LastNnResult = resbk;
return true;
}
//------------------------------------------------------------- Verifi
bool Verifi()
{
myResult res;
int ct=0,msize,rsize,i;
s64 total=0;
if (arcInfo.FileCount == 0)return true;//ファイル無し
//セーブデータのマウント
scr_Status("Mount SaveData",COLOR_YELLO);
res = savedata.Mount();
if(res != RESULT_OK)return false;
scr_Status("Mount SD",COLOR_YELLO);
res = exsave.Mount();
if(res != RESULT_OK)return false;
//ファイル比較
scr_Status("file compairing",COLOR_YELLO);
savedata.ResetPath();
s64 fsize;
res = RESULT_OK;
while(res==RESULT_OK){
if(CheckInsExit())break;//挿抜による中断
res = savedata.GetPath(file_pathw);
if (res != RESULT_OK)break;
if (file_pathw[0] == 0)break;//root then end
if (ct>=arcInfo.FileCount)
{
res = RESULT_FAIL;
break;
}
if(CheckInsExit())break;//挿抜による中断
scr_CountPerMax(ct,arcInfo.FileCount);
if (savedata.Open(file_pathw)==false)
{
res = RESULT_FAIL_OPEN;
break;
}
fsize = savedata.FileSize;
total += fsize;
if(CheckInsExit())break;//挿抜による中断
if (exsave.Open(file_pathw)==false)
{
res = RESULT_FAIL_OPEN;
break;
}
msize=fsize;
while(fsize)
{
if(msize > FILEBUFF_SIZE * 2){//サイズが大きい場合にゲージ表示
scr_CountPerMax2(msize-fsize,msize,0);
}
if (fsize>FILEBUFF_SIZE)
{
rsize = FILEBUFF_SIZE;
fsize -= FILEBUFF_SIZE;
}else{
rsize = fsize;
fsize = 0;
}
if(CheckInsExit())break;//挿抜による中断
if(savedata.Read(fileBuffer,rsize) != rsize )
{
if(nn::fs::ResultVerificationFailed::Includes(savedata.LastNnResult))
{
for ( i = 0; i < rsize; i++)
{
fileBuffer[i] = 0;//0埋め
}
}else{
res = RESULT_FAIL_READ;
break;
}
}
if(CheckInsExit())break;//挿抜による中断
if(exsave.Read(fileBuffer_ex,rsize) != rsize )
{
res = RESULT_FAIL_READ;
break;
}
}
savedata.Close();
exsave.Close();
if (res != RESULT_OK)break;
if(isInsEject != InEx_None )break;//挿抜による中断
for (i=0;i<rsize;i++)if (fileBuffer[i]!=fileBuffer_ex[i]){
res = RESULT_FAIL;
break;
}
ct++;
}
savedata.Close();
exsave.Close();
savedata.Unmount();
exsave.Unmount();
return res == RESULT_OK;
}
//---------------------------------------------------------------------- CARD to SD
RetCode Card2Sd()
{
myResult res;
int ct=0,msize,rsize;
s64 total=0;
scr_BackupYesNo();//実行確認
WaitUI();//入力待ち
if(isInsEject != InEx_None )return INSEXIT;//挿抜による中断
if (scr_evnt != EVNT_YES)return CANCEL;//キャンセル
scr_Backup();//画面表示
scr_Status("Mount SaveData",COLOR_YELLO);
//セーブデータのマウント
res = savedata.Mount();
if(res != RESULT_OK){
PutError(ERC_DEV_CARD);
return ERROR;
}
scr_Status("Get Dir",COLOR_YELLO);
if(savedata.GetInfo(&arcInfo)==false)
{
savedata.Unmount();
PutError(ERC_DEV_CARD);
return ERROR;
}
if (arcInfo.FileCount == 0)//ファイルが無い
{
scr_Status("no files",COLOR_YELLO);
savedata.Unmount();
return SUCCESS;//何もしない
}else{
//保存先ディレクトリ作成
scr_Status("Create Dir",COLOR_YELLO);
if (exsave.Create() == false)
{
savedata.Unmount();
if(TryDeleteDir())PutError(ERC_DEV_OUT);
return ERROR;
}
//ファイルコピー
scr_Status("file copying",COLOR_SKY);
savedata.ResetPath();
s64 fsize;
res = RESULT_OK;
while(res==RESULT_OK){
if(CheckInsExit())break;//挿抜による中断
res = savedata.GetPath(file_pathw);
if (res != RESULT_OK)
{
if (res == RESULT_DIR_LEVEL_OVER){
PutError(ERC_DEV_CARD,ERC_DIRDEPTH);
break;
}
if (res == RESULT_PATH_LENGTH_OVER){
PutError(ERC_DEV_CARD,ERC_PATH);
break;
}
res = RESULT_FAIL_OPEN;
break;
}
if (file_pathw[0] == 0)break;//root then end
if (ct>=arcInfo.FileCount)
{
res = RESULT_FAIL;
break;
}
if(CheckInsExit())break;//挿抜による中断
scr_CountPerMax(ct,arcInfo.FileCount);
if (savedata.Open(file_pathw)==false)
{
res = RESULT_FAIL_OPEN;
break;
}
fsize = savedata.FileSize;
total += fsize;
if(CheckInsExit())break;//挿抜による中断
if (exsave.OpenW(file_pathw,fsize)==false)
{
res = RESULT_FAIL_OPENW;
break;
}
msize=fsize;
while(fsize)
{
if(msize > FILEBUFF_SIZE * 2){//サイズが大きい場合にゲージ表示
scr_CountPerMax2(msize-fsize,msize,0);
}
if (fsize>FILEBUFF_SIZE)
{
rsize = FILEBUFF_SIZE;
fsize -= FILEBUFF_SIZE;
}else{
rsize = fsize;
fsize = 0;
}
if(CheckInsExit())break;//挿抜による中断
if(savedata.Read(fileBuffer,rsize) != rsize )
{
//中身のデータが作成サイズに満たない場合に検証エラーとなる対策
//読めないブロックは置き換える
//検証は512単位でされるので読めてるとこまで置き換えないよう
//リードサイズは512にしておく
if(nn::fs::ResultVerificationFailed::Includes(savedata.LastNnResult))
{
for (int i = 0; i < rsize; i++)
{
fileBuffer[i] = 0;//0埋め
}
}else{
res = RESULT_FAIL_READ;
break;
}
}
if(CheckInsExit())break;//挿抜による中断
if(exsave.Write(fileBuffer,rsize) != rsize )
{
res = RESULT_FAIL_WRITE;
break;
}
}
savedata.Close();
exsave.CloseW();
if(isInsEject != InEx_None )break;//挿抜による中断
ct++;
}
savedata.Close();
exsave.CloseW();
}
savedata.Unmount();
exsave.Unmount();
//結果
if(isInsEject != InEx_None )
{//挿抜による中断
TryDeleteDir();
return INSEXIT;
}else{
if (res == RESULT_OK)
{
if(Verifi())
{
if (exsave.WriteSys(&arcInfo))
{//フォーマットパラメータなど情報ファイル
if(CheckInsExit()==false)
{
if (exsave.GetInfo(&arcInfo_ex))
{ //リードチェック
if ((arcInfo.DirEntry != arcInfo_ex.DirEntry) ||
(arcInfo.FileEntry != arcInfo_ex.FileEntry) ||
(arcInfo.DirCount != arcInfo_ex.DirCount) ||
(arcInfo.FileCount != arcInfo_ex.FileCount) ||
(arcInfo.Dup != arcInfo_ex.Dup))res = RESULT_FAIL_WRITE;
}else res = RESULT_FAIL_WRITE;
}else res = RESULT_FAIL_WRITE;
}else res = RESULT_FAIL_WRITE;
}else res = RESULT_FAIL_VERIFI;
}
if (res != RESULT_OK)
{
if (TryDeleteDir())
{
if ((res == RESULT_FAIL_WRITE) || (res== RESULT_FAIL_OPENW)) PutError(ERC_DEV_OUT);
else if ((res == RESULT_FAIL_READ) || (res== RESULT_FAIL_OPEN)) PutError(ERC_DEV_CARD);
else if (res == RESULT_FAIL_VERIFI) PutError(ERC_DEV_OUT,ERC_VERIFI);
else PutError(ERC_DEV_OTHER);
}
}else
{
strcpy(sts,"output folder [ ");
strcat(sts,exsave.DirName);//保存先
strcat(sts," ]");
scr_Status(sts,COLOR_WHITE);
scr_CountPerMax(ct,arcInfo.FileCount);//ファイル数
scr_CountPerMax2(0,0,total);//総サイズ
return SUCCESS;
}
}
return ERROR;
}
bool mkdir;
//--------------------------------------------------------------- セーブデータの情報取得
//呼ぶ前に tmerr のクリアを忘れない事
void CheckSaveDataState()
{
myResult myres;
Formatted = false;//フォーマット
Active = false;
//failveri = false;
if (savedata.GetPrdCode())
{
myres = savedata.IsExist();
if (myres != RESULT_FAIL)
{
Active = true;//アクセス可能
switch(myres){
case RESULT_OK:
Formatted=true;
break;
case RESULT_NO_MEDIA:
tmerr |= SDATA_ERRPUT_MEDIA;
break;
case RESULT_NOT_FAUND:
break;
case RESULT_SDK_VERIFI:
//failveri = true;
tmerr |= SDATA_ERRPUT_VERIFI;
break;
default:
break;
}
}
}
scr_PrdCode(savedata.PrdCode);
}
void CheckExSaveState()
{
exActive = nn::fs::IsSdmcInserted();
}
//------------------------------------------------------------ 挿抜チェック
bool CheckInsExit()
{
if (ejectEvnt.TryWait()){
//CARD抜け
CheckSaveDataState();
isInsEject = InEx_EjcCard;
return true;
}
if (insEvnt.TryWait()){
//CARD挿入
CheckSaveDataState();
isInsEject = InEx_InsCard;
return true;
}
if (ejectEvntSd.TryWait()){
//SD抜け
CheckExSaveState();
isInsEject = InEx_EjcSd;
return true;
}
if (insEvntSd.TryWait()){
//SD挿入
CheckExSaveState();
isInsEject = InEx_InsSd;
return true;
}
return false;
}
//---------------------------------------------------------------- 入力待ち
void WaitUI()
{
tmerr = 0;
scr_Draw();//画面更新
scr_evnt = EVNT_NONE;
while(scr_evnt == EVNT_NONE)
{
nn::os::Thread::Yield();//スレッド実行
//scr_GetEvnt();//入力イベント
CheckSysBreak();//中断処理
// int i = nn::ndm::GetDaemonStatus( nn::ndm::DN_CEC );
// if (i !=3 )NN_LOG("DN_CEC %d\n",i);
// i = nn::ndm::GetDaemonStatus( nn::ndm::DN_BOSS );
// if (i !=3 )NN_LOG("DN_BOSS %d\n",i);
// i = nn::ndm::GetDaemonStatus( nn::ndm::DN_NIM );
// if (i !=3 )NN_LOG("DN_NIM %d\n",i);
// i = nn::ndm::GetDaemonStatus( nn::ndm::DN_FRIENDS );
// if (i !=3 )NN_LOG("DN_FRIENDS %d\n",i);
//挿抜を検知したら中断して抜ける
//トップ以外ではトップメニューへ戻るようする
if (CheckInsExit())return;
}
ScrClr();//画面消去
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(500));//チャタ対策
}
//---------------------- main loop --------------------------
void nnMain()
{
RetCode retc;
isInsEject = InEx_None;
//NN_LOG("Start\n");
nn::os::Initialize();
nn::fs::Initialize();
//DEA-SUPにて推奨のフリーズ暫定対策無線デーモンを停止 (2011.3.1 現在)
//ただし、スリープ時は止まらない
//心配なら本体スイッチで切っとく
nn::ndm::Initialize();
nn::ndm::SuspendScheduler();
//中断処理の準備
InitSysBreak((uptr)endfunc);
// グラフィックスライブラリの初期化は、以降で行わなければならない
// 他、アプリケーションの初期化処理
nn::applet::DisableSleep();//スリープ非対応
//Heap
appHeap.Initialize(nn::os::GetDeviceMemoryAddress(),
nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
const u32 GxHeapSize = 0x800000;
heapForGx = reinterpret_cast<uptr>(appHeap.Allocate(GxHeapSize));
//画面初期化
if (ScrInitialize(heapForGx,GxHeapSize) == false)failstop();
ejectEvnt.ClearSignal();
insEvnt.ClearSignal();
nn::fs::RegisterCardEjectedEvent(&ejectEvnt);
nn::fs::RegisterCardInsertedEvent(&insEvnt);
ejectEvntSd.ClearSignal();
insEvntSd.ClearSignal();
nn::fs::RegisterSdmcEjectedEvent(&ejectEvntSd);
nn::fs::RegisterSdmcInsertedEvent(&insEvntSd);
// スリープ要求に対する返答を有効にする
// また、蓋の状態チェックを行い蓋が閉じられているならスリープ要求が発生する
//nn::applet::EnableSleep(true);
extern u8 scr_evnt;
while(1)
{
tmerr = 0;
CheckSaveDataState(); //セーブデータの状態取得
CheckExSaveState(); //SD挿入状態
scr_TopMenu(Formatted,Active,exActive,tmerr);
WaitUI();//入力待ち
if (isInsEject != InEx_None){
ScrClr();//画面消去
isInsEject= InEx_None;
}else
switch(scr_evnt)
{
case EVNT_SEL_READ://リード
NN_LOG("select read\n");
retc = Card2Sd();
switch (retc)
{
case SUCCESS:
//CheckExSaveState(); //状態の更新
scr_ResultQuit("Success",COLOR_GREEN);//成功とQuitボタン
break;
case INSEXIT:
//scr_InsExitQuit();//挿抜検知表示 & Quit
ScrClr();//画面消去
scr_Backup();
if (isInsEject == InEx_EjcCard)PutError(ERC_DEV_CARD,ERC_DEVICE);
else if (isInsEject == InEx_EjcSd)PutError(ERC_DEV_OUT,ERC_DEVICE);
else PutError(ERC_DEV_OTHER);
scr_ResultQuit("Break",COLOR_RED);//エラーとQuitボタン
break;
default://errors
scr_ResultQuit("Failed",COLOR_RED);//エラーとQuitボタン
break;
}
if (retc == CANCEL)break;
while(1){
WaitUI();
if (isInsEject != InEx_None){
isInsEject = InEx_None;
}
if(scr_evnt==EVNT_QUIT)break;
if(scr_evnt==EVNT_PUSH_B)break;
}
break;
case EVNT_PUSH_LEFT_X:// ------------------------------------- LEFT + X
//バックアップ削除
scr_DelConf();//実行確認
WaitUI();
if (scr_evnt != EVNT_YES)break;
exsave.DeleteAll();//全削除
//CheckExSaveState(); //状態更新
break;
}
}//while()
}
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,769 @@
#include <nn.h>
#include <stdio.h>
#include "screen.h"
#include "../../../../common/my_defs.h"
#include "../../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();
}
nn::os::Tick holdTck;
u32 holdVal;
//---------------------------------イベントコールバック
//----------------PADボタン
void pushButton(u32 sts)
{
//NN_LOG("button > %4x\n",button);
u32 trg = sts & 0x0ffff;
u32 hld = sts >> 16;
/*
if (holdVal)//同時押し猶予期間
{
if (nn::fnd::TimeSpan::FromMilliSeconds(100) > (nn::os::Tick::GetSystemCurrent()-holdTck)){
holdVal |= trg;
if (holdVal == nn::hid::BUTTON_LEFT | holdVal & nn::hid::BUTTON_X ){
holdVal = 0;
scr_evnt = EVNT_PUSH_LEFT_X;
}
}else holdVal = 0;
}else if( (holdVal = trg & (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X ))>0)
{//一定時間どっちかのボタン押し維持
holdTck = nn::os::Tick::GetSystemCurrent();
}
*/
if( holdVal )//押し続け判定
{
if (hld != holdVal)
{
holdVal = 0;
}else
if (nn::fnd::TimeSpan::FromMilliSeconds(4000) < (nn::os::Tick::GetSystemCurrent()-holdTck))
{
holdVal = 0;
scr_evnt = EVNT_PUSH_LEFT_X;
}
}else if (hld == ( nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X ))
{
holdVal = hld;
holdTck = nn::os::Tick::GetSystemCurrent();
}
#ifdef DEBUG_ENABLE
else if (hld & nn::hid::BUTTON_DOWN)//同時押し
{
if (hld & nn::hid::BUTTON_Y)
if (hld & nn::hid::BUTTON_X)
scr_evnt = EVNT_PUSH_DOWN_Y;
}
else if (trg & nn::hid::BUTTON_R)scr_evnt = EVNT_PUSH_R;
else if (trg & nn::hid::BUTTON_L)scr_evnt = EVNT_PUSH_L;
#endif
#ifdef ENABLE_CRUSH
else if (trg & nn::hid::BUTTON_Y)scr_evnt = EVNT_PUSH_Y;
#endif
else if (trg & 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,"to SD",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 -> SD",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 = {"[to SD] Write to SD",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 = {"SD 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 data on SD",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;
holdVal = 0;
holdTck = nn::fnd::TimeSpan(0);
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)//デバッグ用
{
NN_UNUSED_VAR(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 sdins,int err)
{
int i;
scr_evnt = EVNT_NONE;
u32 mask = 0;
mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効
#ifdef DEBUG_ENABLE
mask | = ( nn::hid::BUTTON_DOWN | nn::hid::BUTTON_Y | nn::hid::BUTTON_L | nn::hid::BUTTON_R);
#endif
gui.MessStr(MESSAGE_TITLE," < CTR Card Savedata to SD >");
gui.MessEffective(MESSAGE_MENU_ERROR,false,false);
gui.MessEffective(MESSAGE_MENU_CAUTION,false,false);
gui.MessEffective(MESSAGE_MENU_OPERATE,false,false);
if (formatted && sdins)
{//バックアップ可能
gui.MessEffective(MESSAGE_MENU_OPERATE);
gui.PanelEffective(PANEL_READ);
}else
{
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 (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);
}
}
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();
}

View File

@ -0,0 +1,115 @@
#ifndef SCREEN_H_
#define SCREEN_H_
#include <string.h>
#include <nn/types.h>
#include "../../../../common/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 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

View 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 0.01
#endif

View 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 .. カードが見つからない

View File

@ -0,0 +1,57 @@
動作確認環境:
ARM製 RVC_Nintendo 4.1
omake 0.9.8.5
CTR SDK2.0 + Repairtoolプライベートパッチ
v1.03以降は ps_api.h と libnn_psも(SystemProgramKitに入っている)
動作要件SDK2.31以降のシステム本体
準備)
SDKのSampledemos のcommon,gxをビルドしておく
omakerootのあるディレクトリにあるomakeファイルで
SAMPLED_DEMOS_COMMON_INCLUDE_DIR に 
sampledemos/common/includeの位置を指定しておく
公開鍵pubkeyをimp/omakeで指定
ビルド)
omakerootのあるディレクトリでomake実行
body下でビルドし出来たcia を、Imp下のomake(SRC_IMPORTEE_PATH)で指定
(量産機で使うには、マスタリング後のciaを指定)
ビルドするとNANDインポート用のcciができる
インポート先:
ciaをSDからインポート -> SD .. DevMenu使用,DevMenufullならnandにも入れられる
カード起動しインポート -> NAND
量産実機での実行にはマスタリング必須
body下で作成したcia をOLS付でマスタリングし
そのciaを使って作成したcciをマスタリング
マスタリングの流れ:
・body/images下に出来たciaをマスタリングしOLSを付ける
・このciaをImpのomakeで指定、もしくは指定場所に置く
bodyのビルドで上書きされないよう場所かファイル名変えたほうが安全
・imp/omake実行し、cci作成
・cciをマスタリング
OLSごとリマスタバージョン更新が必要
common/ver.hは表示バージョン、ここだけ変更してもダメ
body/omekeのコメントを参考
NANDインポートで失敗する場合はciaをチェック
SDインポートし
開発実機で動く- マスタリングしてない
量産実機で動く- OLSが付いてない
インポートする本体をシリアル番号で制限してます
"imp/imp_lis/"下にリストと署名サンプル
OpenSSL0.9.6k,rと 1.0.0d で動作確認
imp/imp_list 下にコマンドラインツール(win32版)用バッチ
使い方はcygwinでも同じ
ユーザにはomake指定のpubkeyと組のprivatekeyで作った署名を渡す
本ツール開発時のマスタリングは推進G(高橋さん)に依頼した
マスタリング済みDevMenu(full)および
CUP作成は飯島さんに聞く

View File

@ -0,0 +1,10 @@
<インポータのオプション有効化>
cms_inf.txtの名前でファイル作成
以下の記述でオプションが有効になる
-t: テストメニュー
   カード上のセーブにテストパターン書き込み&ベリファイ
-p: 本体シリアルを表示

Some files were not shown because too many files have changed in this diff Show More