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

This commit is contained in:
mizu 2011-12-13 02:34:46 +00:00
parent 828778a667
commit 08a942a45e
17 changed files with 2253 additions and 562 deletions

View File

@ -23,6 +23,7 @@ SUPPORTED_TARGETS = CTR-*.Process.MPCore.*
SOURCES[] =
./source/main.cpp
#./source/main_nochk.cpp
../../common/test_data.cpp
../../common/shfnt.cpp
../../common/sleep.cpp
@ -39,9 +40,9 @@ LIBS += libnn_ps
IMPORTEE_CIA = importee.cia
SRC_IMPORTEE_PATH = ../body/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/CtrSaveDataMover.cia
#SRC_IMPORTEE_PATH = ../body/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/CtrSaveDataMover.cia
#とりあえず、マスタリング時は直おき、配置時に改名
#SRC_IMPORTEE_PATH = CtrSaveDataMover_master.cia
SRC_IMPORTEE_PATH = CtrSaveDataMover_master.cia
# ビルドタイプ別に romfs を作る
#ROMFS_ROOT = $`(TARGET.getObjectDirectory)/romfsroot
@ -57,7 +58,7 @@ 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
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/private/repairtool.desc
# バナー、アイコン
#CTR_BANNER_SPEC = banner.bsf

View File

@ -300,9 +300,12 @@ void nnMain( void )
s_RenderSystem.SwapBuffers();
shf_SetScale(0.5,0.5);
sprintf(ver,"version %.2f",VERSION);
drawText(250,40,ver);
if (VERSION != 0.0){
sprintf(ver,"version %.2f",VERSION);
drawText(250,40,ver);
}else{
drawText(250,40,VERSION_TXT);
}
shf_SetScale(0.7,0.7);
if (result.IsFailure())ErrorStop("Initialize");//初期化に失敗
if (READ_BUFFER_SIZE < LIST_LENGTH)ErrorStop("buffer size");//バッファサイズのチェック
@ -350,7 +353,7 @@ void nnMain( void )
//シリアル表示(オプション)後にチェック
//デバッガ=15,実機=11
if (GettedSerLen < 11)ErrorStop("invalid Serial");
//if (GettedSerLen < 11)ErrorStop("invalid Serial");
fsize = FileRead(SIGN_FILE);//署名リード
if(fsize != 256)ErrorStop("sign file");//鍵のbit長は2046固定
@ -400,9 +403,8 @@ void nnMain( void )
}
//プログラムミス、コードバグ対策
//値が小さいと判定が緩くなるが、動作確認時にスルーしそうなので
//念の為チェック
if (GettedSerLen < 11)ErrorStop("invalid Serial");
//2011.11 海外は桁が少ないらしい、NOA配布で問題出たので削除
// if (GettedSerLen < 11)ErrorStop("invalid Serial");
//本体シリアルがリストにあるかチェック
n =0;

View File

@ -0,0 +1,398 @@
/*---------------------------------------------------------------------------*
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.
*---------------------------------------------------------------------------*/
//****************** 注意 *********************
// 作成者が手元でテストするためのインポータ
// シリアルチェックを省いているので
// 部外リリースに使ってはいけない
//***********************************************
#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 "../../../common/test_data.h"
#define INF_FILE "sdmc:/csm_inf.txt"
#define KEY_LENGTH 2048
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;
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();
}
//エラー
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_test=false;
//int 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::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.IsSuccess()){
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++;
}
}
nn::fs::Unmount("sdmc:");
}
*/
u32 mask = 0;
//メニュー表示
{
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,163 @@
/*---------------------------------------------------------------------------*
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.
*---------------------------------------------------------------------------*/
//****************** 注意 *********************
// 作成者が手元でテストするためのインポータ
// シリアルチェックを省いているので
// 部外リリースに使ってはいけない
//***********************************************
#include <nn.h>
#include <nn/fs.h>
#include <nn/applet.h>
#include <nn/ndm.h>
//#include <nn/ndm/ndm_DebugControl.h>
#include <nn/ndm/ndm_UserControl.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 "../../../common/test_data.h"
demo::RenderSystemDrawing s_RenderSystem;
nn::fnd::ExpHeap appHeap;
uptr heapForGx;
void ErrorStop(char *s);
void ErrorPOff(char *s);
nn::Result result;
//#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()
{
nn::hid::Finalize();
SharedFontFinalize();
nngxWaitVSync(NN_GX_DISPLAY_BOTH);//SDK2.0以降では不要?
s_RenderSystem.Finalize();
}
//エラー
void ErrorCommon(char *s,char *ss)
{
char str[128];
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);
}
void nnMain( void )
{
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;
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::applet::EnableSleep(true);
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
s_RenderSystem.Clear();
// s_RenderSystem.SetFontSize(12);
shf_SetScale(0.7,0.7);
if (result.IsFailure())ErrorStop("Initialize");//初期化に失敗
TestMain();//テストデータへ
}

View File

@ -31,15 +31,21 @@ SOURCES[] =
./source/screen/screen.cpp
../../common/savefile/savedata.cpp
../../common/savefile/membak.cpp
../../common/savefile/exsave.cpp
../../common/savefile/savefile.cpp
../../common/gui/gui.cpp
../../common/shfnt.cpp
../../common/sleep.cpp
../../common/common.cpp
#LIBS += lib_demo libnn_am
LIBS += lib_demo libnn_am
#LIBS += libnn_ps
#ExtSave使用時にアイコン必要
OBJECTS[] =
$`(ObjectFromBinary $(TARGET), ../../common/icon.icn)
TARGET_PROGRAM = CtrSaveDataMover
TITLE = CSM_body
@ -48,8 +54,14 @@ TITLE = CSM_body
#ROMFS_ROOT =
# 独自の RSF ファイルを指定する場合
ROM_SPEC_FILE = body.rsf
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/repairtool.desc
ROM_SPEC_FILE = body_card1.rsf
#ROM_SPEC_FILE = body_card2.rsf
#SDK3.1まで
#DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/repairtool.desc
#SDK3.2より
DESCRIPTOR = $(CTRSDK_ROOT)/resources/specfiles/private/repairtool.desc
#DESCRIPTOR = ../../repairtool.desc
# バナー、アイコン
CTR_BANNER_SPEC = banner_null_icon.bsf
@ -57,7 +69,8 @@ CTR_BANNER_SPEC = banner_null_icon.bsf
#Cia バージョン:マスタリング毎に更新すること
#メジャーはrsfで指定(Remasterversion)
MAKECIAFLAGS = -minor 0 -micro 12
#micro の上限は15(4bit)
MAKECIAFLAGS = -minor 1 -micro 1
include $(ROOT_OMAKE)/modulerules

View File

@ -0,0 +1,30 @@
# アプリケーションのデフォルト値
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 : true
ExtSaveDataNumber: 0xf8014
FileSystemAccess:
- CategoryFileSystemTool
SystemControlInfo:
RemasterVersion: 2

View File

@ -0,0 +1,33 @@
#Card2—p
BasicInfo:
Title : $(TITLE)
BackupMemoryType: None
Logo : Nintendo
# CompanyCode: "00"
ProductCode : "CTR-N-22NA"
MediaSize : 512MB
TitleInfo:
# Category: 0x0010
# Category: SystemApplication
UniqueId: 0xf8014
# Version: 0
Rom:
HostRoot : romfiles
SaveDataSize: 256MB
CardInfo:
CardDevice: None
MediaType: Card2
AccessControlInfo:
UseExtSaveData : true
ExtSaveDataNumber: 0xf8014
FileSystemAccess:
- CategoryFileSystemTool
SystemControlInfo:
RemasterVersion: 2

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
U16で作成
改行はLF(0A)のみ
DOSのファイル識別が先頭にある場合(2バイト、アスキーで"BM")削除する

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
//デバグ用
//#define CSM_FLAG_DEBUG 1
//一時保存先にSDも使う総サイズがメモリに納まらない場合 .. Card2
//#define CSM_FLAG_USE_SD 1
#ifdef CSM_FLAG_USE_SD
#define CSM_FLAG_FORCE_SD 1 //強制SD使用
#endif

View File

@ -1,3 +1,7 @@
#include <wchar.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <nn.h>
#include <stdio.h>
#include "screen.h"
@ -162,52 +166,120 @@ void touchQuit(u32 pos NN_IS_UNUSED_VAR)
// -------------------------------------------------- コンポーネント設計
//下画面
#ifdef USE_WCHAR
/*
tChar* S_Backup = L"読込";
tChar* S_Restore = L"書込";
tChar* S_Yes = L"はい";
tChar* S_No = L"いいえ";
tChar* S_Quit = L"戻る";
tChar* S_Space = L" ";
tChar* S_Execute = L"実行しますか?";
tChar* S_HelpBackup = L"[読込] カードから読む";
tChar* S_HelpRestore = L"[書込] カードに書く";
tChar* S_Touch = L"タッチで実行します";
tChar* S_Version = L"";
tChar* S_QuitB = L"タッチかBボタンで戻ります";
tChar* S_Insexit = L"デバイスの挿抜を検知しました";
tChar* S_RetTop = L"開始画面に戻ります";
tChar* S_Del = L" ** 削除 ** ";
tChar* S_Del2 = L"    注意";
tChar* S_Del3 = L"読出したデータを削除します";
tChar* S_Title = L" <カードセーブ移行>";
tChar* S_InsertCard = L"カードを挿入して下さい";
tChar* S_TitleBkup = L" -- カードから読込 --";
tChar* S_TitleRestore = L" -- カードへ書込 --";
*/
tChar* S_Backup = L"Backup";
tChar* S_Restore = L"Restore";
tChar* S_Yes = L"YES";
tChar* S_No = L"NO";
tChar* S_Quit = L"Quit";
tChar* S_Space = L" ";
tChar* S_Execute = L"Do you execute?";
tChar* S_HelpBackup = L"[Backup] read from Card";
tChar* S_HelpRestore = L"[Restore] write to Card";
tChar* S_Touch = L"Touch below";
tChar* S_Version = L"version";
tChar* S_QuitB = L"touch [Quit] or push B";
tChar* S_Insexit = L"device insert or pull out is detected";
tChar* S_RetTop = L"return to top menu";
tChar* S_Del = L" *** DELETE *** ";
tChar* S_Del2 = L" caution!";
tChar* S_Del3 = L"this is delete backup";
tChar* S_Title = L" < CTR Card Savedata Mover >";
tChar* S_InsertCard = L"Please Insert Card";
tChar* S_TitleBkup = L" --- Backup Card Savedata ---";
tChar* S_TitleRestore = L"--- Restore Card Savedata ---";
#else
tChar* S_Backup = "Backup";
tChar* S_Restore = "Restore";
tChar* S_Yes = "YES";
tChar* S_No = "NO";
tChar* S_Quit = "Quit";
tChar* S_Space = " ";
tChar* S_Execute = "Do you execute?";
tChar* S_HelpBackup = "[Backup] read from Card";
tChar* S_HelpRestore = "[Restore] write to Card";
tChar* S_Touch = "Touch below";
tChar* S_Version = "version";
tChar* S_QuitB = "touch [Quit] or push B";
tChar* S_Insexit = "device insert or pull out is detected";
tChar* S_RetTop = "return to top menu";
tChar* S_Del = " *** DELETE *** ";
tChar* S_Del2 = " caution!";
tChar* S_Del3 = "this is delete backup";
tChar* S_Title = " < CTR Card Savedata Mover >";
tChar* S_InsertCard = "Please Insert Card";
tChar* S_TitleBkup = " --- Backup Card Savedata ---";
tChar* S_TitleRestore = "--- Restore Card Savedata ---";
#endif
//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_Read = {(uptr)touchRead,S_Backup,80+20,30,160,80,PANEL_READ,SCREEN_LOWER};
const tPanel panel_Write = {(uptr)touchWrite,S_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};
const tPanel panel_Yes = {(uptr)touchYes,S_Yes,40+10,60,80,120,PANEL_YES,SCREEN_LOWER};
const tPanel panel_No = {(uptr)touchNo,S_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_Quit = {(uptr)touchQuit,S_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 tMessage mess_Title_Err = {S_Space,10,10,COLOR_RED,8,MESSAGE_ERROR_TITLE,PANEL_ERROR};
const tMessage mess_Info_Err = {S_Space,10,22,COLOR_RED,8,MESSAGE_ERROR_INFO,PANEL_ERROR};
const tMessage mess_Info2_Err = {S_Space,10,40,COLOR_RED,8,MESSAGE_ERROR_INFO2,PANEL_ERROR};
const tMessage mess_Info3_Err = {S_Space,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 tMessage mess_Title_Suc = {S_Space,10,10,COLOR_GREEN,8,MESSAGE_SUCCESS_TITLE,PANEL_SUCCESS};
const tMessage mess_Info_Suc = {S_Space,10,40,COLOR_WHITE,8,MESSAGE_SUCCESS_INFO,PANEL_SUCCESS};
const tMessage mess_Info2_Suc = {S_Space,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 tMessage mess_conf_Title = {S_Space,10,10,COLOR_YELLO,8,MESSAGE_CONFIRM_TITLE,PANEL_CONFIRM};
const tMessage mess_conf_Msg = {S_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_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 = {S_HelpBackup,10,4,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_READ,PANEL_TOPMENU};
//const tMessage mess_topmenu_help_write = {S_HelpRestore,10,16,COLOR_WHITE,8,MESSAGE_TOPMENU_HELP_WRITE,PANEL_TOPMENU};
//const tMessage mess_topmenu_help_operate = {S_Touch,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};
*/
//通常時
//タイトル
@ -218,64 +290,58 @@ const tMemo memo_dbglog = {LOG_MAX,10,10,COLOR_WHITE,8,MEMO_DBGLOG,PANEL_DBGLOG}
#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};
const tMessage mess_title = {S_Space,0,0,COLOR_WHITE,FONT_SIZE_TITLE,MESSAGE_TITLE,PANEL_TITLE};
const tMessage mess_product = {S_Space,0,LOC_TITL_H - 22,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT,PANEL_TITLE};
const tMessage mess_product2 = {S_Space,0,LOC_TITL_H - 10,COLOR_WHITE,FONT_SIZE_PRODUCT,MESSAGE_PRODUCT2,PANEL_TITLE};
const tMessage mess_version = {S_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};
const tMessage mess_menu_read = {S_HelpBackup,10,STR_LINE(1),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_READ,PANEL_MENU};
const tMessage mess_menu_write = {S_HelpRestore,10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_MENU_WRITE,PANEL_MENU};
const tMessage mess_menu_operate = {S_Touch,10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_MENU_OPERATE,PANEL_MENU};
const tMessage mess_bkuperr = {S_Space,10,STR_LINE(6),COLOR_RED,FONT_SIZE,MESSAGE_MENU_ERROR,PANEL_MENU};
const tMessage mess_carderr = {S_Space,10,STR_LINE(7),COLOR_YELLO,FONT_SIZE,MESSAGE_MENU_CAUTION,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 tMessage mess_quit_operate = {S_QuitB,10,STR_LINE(4),COLOR_SKY,FONT_SIZE,MESSAGE_QUIT_OPERATE,PANEL_BKUP};
const tMessage mess_conf = {S_Execute,10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_CONF,PANEL_BKUP};
const tMessage mess_result = {S_Space,10,STR_LINE(2),COLOR_WHITE,FONT_SIZE,MESSAGE_RESULT,PANEL_BKUP};
const tMessage mess_operate = {S_Touch,10,STR_LINE(4),COLOR_GREEN,FONT_SIZE,MESSAGE_OPERATE,PANEL_BKUP};
const tMessage mess_status = {S_Space,10,STR_LINE(7),COLOR_WHITE,FONT_SIZE,MESSAGE_STATUS,PANEL_BKUP};
const tMessage mess_count = {S_Space,10,STR_LINE(8),COLOR_WHITE,FONT_SIZE,MESSAGE_COUNT,PANEL_BKUP};
const tMessage mess_count2 = {S_Space,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 tMessage mess_insexit = {S_Insexit,10,STR_LINE(3),COLOR_RED,8,MESSAGE_INSEXT_1,PANEL_INSEXIT};
const tMessage mess_insexit2 = {S_RetTop,10,STR_LINE(5),COLOR_WHITE,8,MESSAGE_INSEXT_2,PANEL_INSEXIT};
const tMessage mess_insexit3 = {S_QuitB,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};
const tMessage mess_delconf_Title = {S_Del,10,10,COLOR_YELLO,16,MESSAGE_DELCONF_TITLE,PANEL_DELCONF};
const tMessage mess_delconf_Msg = {S_Del2,10,50,COLOR_YELLO,12,MESSAGE_DELCONF_MSG,PANEL_DELCONF};
const tMessage mess_delconf_Msg2 = {S_Del3,10,70,COLOR_YELLO,12,MESSAGE_DELCONF_MSG2,PANEL_DELCONF};
const tMessage mess_delconf_Msg3 = {S_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];
tChar scr_ver[16];
tChar scr_err[32];
tChar scr_debug[32];
//menu
bool ScrInitialize(uptr heap,u32 size)
bool ScrInitialize(uptr heap,u32 size,bool jp,bool deb)
{
scr_evnt = EVNT_NONE;
holdVal = 0;
@ -291,38 +357,38 @@ bool ScrInitialize(uptr heap,u32 size)
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_Error);
// gui.PanelSet(&panel_Success);
// gui.PanelSet(&panel_Confirm);
gui.PanelSet(&panel_delconf);
gui.PanelSet(&panel_topmenu_help);
// gui.PanelSet(&panel_topmenu_help);
gui.PanelSet(&panel_title);
gui.PanelSet(&panel_menu);
gui.PanelSet(&panel_bkup);
gui.PanelSet(&panel_dbglog);
// 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_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_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);
@ -337,7 +403,7 @@ bool ScrInitialize(uptr heap,u32 size)
gui.MessSet(&mess_operate);
gui.MessSet(&mess_bkuperr);
gui.MessSet(&mess_carderr);
gui.MessSet(&mess_debug);
// gui.MessSet(&mess_debug);
gui.MessSet(&mess_result);
gui.MessSet(&mess_status);
gui.MessSet(&mess_count);
@ -347,9 +413,9 @@ bool ScrInitialize(uptr heap,u32 size)
gui.MessSet(&mess_insexit2);
gui.MessSet(&mess_insexit3);
gui.MemoSet(&memo_dbglog);
// gui.MemoSet(&memo_dbglog);
gui.MemoEffective(MESSAGE_PRODUCT);
// gui.MemoEffective(MESSAGE_PRODUCT);
gui.MessEffective(MESSAGE_ERROR_TITLE);
gui.MessEffective(MESSAGE_ERROR_INFO);
gui.MessEffective(MESSAGE_ERROR_INFO2);
@ -376,15 +442,25 @@ bool ScrInitialize(uptr heap,u32 size)
gui.MessEffective(MESSAGE_INSEXT_3);
gui.MessEffective(MESSAGE_TITLE);
gui.MessEffective(MESSAGE_VERSION);
gui.MemoEffective(MEMO_DBGLOG);
// gui.MemoEffective(MEMO_DBGLOG);
gui.PanelLineStyle(PANEL_DELCONF,COLOR_YELLO);
sprintf(scr_ver,"ver %.2f",VERSION);
#ifdef USE_WCHAR
if (VERSION != 0.0){
swprintf(scr_ver,10,L"ver %.2f",VERSION);
if (deb)wcscat(scr_ver,L" DEBUG");
}else wcscpy(scr_ver,VERSION_TXT_W);
#else
if (VERSION != 0.0){
sprintf(scr_ver,"ver %.2f",VERSION);
if (deb)strcat(scr_ver," DEBUG");
}else strcpy(scr_ver,VERSION_TXT);
#endif
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);
// gui.MessStr(MESSAGE_MENU_DEBUG,scr_debug);
return true;
@ -416,7 +492,7 @@ void Quit()
gui.Draw();
}
/*
//トップメニュー画面
//引数:カード状態
void scr_TopMenuDbg(bool formatted,bool insertted)//デバッグ用
@ -447,12 +523,32 @@ void scr_TopMenuDbg(bool formatted,bool insertted)//
gui.PanelEffective(PANEL_TOPMENU);
gui.Draw();
}
*/
//通常時
//プロダクトコード
//引数:カード、拡張セーブに記録されたもの
char scr_pcode[32];
tChar scr_pcode[32];
tChar scr_pcode2[32];
#ifdef USE_WCHAR
void scr_PrdCode(char *s)
{
wcscpy(scr_pcode,L"CARD : ");
if (s[0]==0) wcscat(scr_pcode,L"----");
else mbstowcs(&scr_pcode[7],s,30);
gui.MessStr(MESSAGE_PRODUCT,scr_pcode);
}
void scr_PrdCodeEx(char *s)
{
wcscpy(scr_pcode2,L"BKUP : ");
if (s[0]==0) wcscat(scr_pcode2,L"----");
else mbstowcs(&scr_pcode2[7],s,30);
gui.MessStr(MESSAGE_PRODUCT2,scr_pcode2);
}
#else
void scr_PrdCode(char *s)
{
strcpy(scr_pcode,"CARD : ");
@ -461,7 +557,6 @@ void scr_PrdCode(char *s)
gui.MessStr(MESSAGE_PRODUCT,scr_pcode);
}
char scr_pcode2[64];
void scr_PrdCodeEx(char *s)
{
strcpy(scr_pcode2,"BKUP : ");
@ -469,6 +564,9 @@ void scr_PrdCodeEx(char *s)
else strcat(scr_pcode2,s);
gui.MessStr(MESSAGE_PRODUCT2,scr_pcode2);
}
#endif
//削除の実行確認
void scr_DelConf()
@ -478,6 +576,29 @@ void scr_DelConf()
YesNo();
}
//エラー表示
#ifdef USE_WCHAR
inline void set_err(int i)
{
swprintf(scr_err,16,L"ERROR %d",i);
}
inline void set_err(wchar_t* s)
{
wcscpy(scr_err,s);
}
#else
inline void set_err(int i)
{
sprintf(scr_err,"ERROR %d",i);
}
inline void set_err(char* s)
{
strcpy(scr_err,s);
}
#endif
//Top menu
//引数:デバイス状態
@ -491,11 +612,11 @@ void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool bkupins,int err)
u32 mask = 0;
mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効
gui.MessStr(MESSAGE_TITLE," < CTR Card Savedata Mover >");
gui.MessStr(MESSAGE_TITLE,S_Title);
gui.MessEffective(MESSAGE_MENU_ERROR,false,false);
gui.MessEffective(MESSAGE_MENU_CAUTION,false,false);
gui.MessEffective(MESSAGE_MENU_OPERATE,false,false);
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))
{//バックアップ
@ -507,13 +628,13 @@ void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool bkupins,int err)
mask |= (nn::hid::BUTTON_LEFT | nn::hid::BUTTON_X);//LEFT+X = Delete 有効
gui.PanelEffective(PANEL_READ,false,false);
i =0;
if (err & SDATA_ERRPUT_PCODE) i = ERC_DEV_OTHER + ERC_PRODCODE;//プロダクトコード不一致
if (err & SDATA_ERRPUT_PCODE) i = TGT_CARD + ERC_PRODCODE;//プロダクトコード不一致
//else
//if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//バックアップなし
//if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + TGT_CARD;//バックアップなし
if (i !=0 )
{
gui.PanelEffective(PANEL_WRITE,false,false);
sprintf(scr_err,"ERROR %d",i);
set_err(i);
gui.MessEffective(MESSAGE_MENU_ERROR);
}
else{
@ -526,14 +647,14 @@ void scr_TopMenu(bool formatted,bool inserted,bool exfm,bool bkupins,int err)
if (inserted == false)
{
strcpy(scr_err,"Please Insert Card");
set_err(S_InsertCard);
gui.MessEffective(MESSAGE_MENU_CAUTION);
}else{
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + ERC_DEV_CARD;//セーブデータがマウントできない
else if (bkupins == false) i = ERC_DEVICE + ERC_DEV_OUT;//書出し先デバイスが無い
else i = ERC_DEV_OTHER;//不明
sprintf(scr_err,"ERROR %d",i);
if (err & SDATA_ERRPUT_MEDIA) i = ERC_MEDIA + TGT_CARD;//セーブデータがマウントできない
else if (bkupins == false) i = ERC_DEVICE + TGT_SD;//書出し先デバイスが無い(SDのみ発生)
else i = ERC_EXEC;//実行エラー、フラグ設定ミス?
set_err(i);
gui.MessEffective(MESSAGE_MENU_ERROR);
}
}
@ -574,7 +695,7 @@ void scr_Backup()
{
scr_evnt = EVNT_NONE;
gui.PanelLineStyle(PANEL_BKUP,COLOR_SKY);
gui.MessStr(MESSAGE_TITLE," --- Backup Card Savedata ---");
gui.MessStr(MESSAGE_TITLE,S_TitleBkup);
gui.PanelEffective(PANEL_TITLE);
ClearBkupMess();
gui.Draw();
@ -593,7 +714,7 @@ void scr_Restore()
{
scr_evnt = EVNT_NONE;
gui.PanelLineStyle(PANEL_BKUP,COLOR_PARPL);
gui.MessStr(MESSAGE_TITLE,"--- Restore Card Savedata ---");
gui.MessStr(MESSAGE_TITLE,S_TitleRestore);
gui.PanelEffective(PANEL_TITLE);
ClearBkupMess();//backupと同じパネルを使う
gui.Draw();
@ -608,7 +729,7 @@ void scr_RestoreYesNo()
}
void scr_Status(char *s,eColor col)
void scr_Status(tChar *s,eColor col)
{
gui.MessCol(MESSAGE_STATUS,col);
gui.MessStr(MESSAGE_STATUS,s);
@ -616,7 +737,7 @@ void scr_Status(char *s,eColor col)
gui.Draw();
}
void scr_ResultQuit(char *s,eColor col)
void scr_ResultQuit(tChar *s,eColor col)
{
gui.MessCol(MESSAGE_RESULT,col);
gui.MessStr(MESSAGE_RESULT,s);
@ -635,11 +756,15 @@ void scr_InsExitQuit()
}
// カウント/MAX 表示
char str_Counter[128];
char str_Counter2[128];
tChar str_Counter[32];
tChar str_Counter2[32];
void scr_CountPerMax(int ct,int max)
{
#ifdef USE_WCHAR
swprintf(str_Counter,30,L"%d / %d",ct,max);
#else
sprintf(str_Counter,"%d / %d",ct,max);
#endif
gui.MessStr(MESSAGE_COUNT,str_Counter);
gui.MessEffective(MESSAGE_COUNT);
gui.Draw();
@ -648,18 +773,29 @@ void scr_CountPerMax(int ct,int max)
//ゲージtotal
void scr_CountPerMax2(int ct,int max,int total)
{
int i,lv;
if (total == -1) str_Counter2[0]=0;
else if (total != 0){
// gui.MessCol(MESSAGE_COUNT2,COLOR_WHITE);
#ifdef USE_WCHAR
swprintf(str_Counter2,30,L"total size %d",total);
}else{
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
lv = ct/(max/25);
for (i =0;i<lv;i++)str_Counter2[i] = L'>';
while ( i < 25 )str_Counter2[i++] = L'|';
str_Counter2[i] = 0;
}
#else
sprintf(str_Counter2,"total size %d",total);
}else{
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
int i;
int lv = ct/(max/25);
lv = ct/(max/25);
for (i =0;i<lv;i++)str_Counter2[i] = '>';
while ( i < 25 )str_Counter2[i++] = '|';
str_Counter2[i] = 0;
}
#endif
//sprintf(str_Counter2,"%d / %d",ct,max);
gui.MessStr(MESSAGE_COUNT2,str_Counter2);
gui.MessEffective(MESSAGE_COUNT2);
@ -667,7 +803,7 @@ void scr_CountPerMax2(int ct,int max,int total)
}
void scr_MessOnCount2(char *str)
void scr_MessOnCount2(tChar *str)
{
// gui.MessCol(MESSAGE_COUNT2,COLOR_YELLO);
gui.MessStr(MESSAGE_COUNT2,str);
@ -677,7 +813,7 @@ void scr_MessOnCount2(char *str)
//実行確認
void scr_ConfirmDbg(char *str)
void scr_ConfirmDbg(tChar *str)
{
scr_evnt = EVNT_NONE;
gui.MessStr(MESSAGE_CONFIRM_TITLE,str);
@ -717,23 +853,6 @@ void scr_SuccessQuitDbg(tColStr **s)
}
//デバッグログ
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()

View File

@ -23,68 +23,26 @@ enum {
EVNT_SEL_WRITE,
EVNT_SEL_END,
EVNT_ERROR,
EVNT_FATAL
EVNT_FATAL,
EVNT_INEX //挿抜判定はメイン側でセットする
};
typedef struct{
char *str;
tChar *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
//bit位置の
#define SDATA_ERRPUT_PCODE (1 << 0)
#define SDATA_ERRPUT_MEDIA (1 << 1)
#define SDATA_ERRPUT_VERIFI (1 << 2)
//デバグモードの表示
//#define SDATA_ERRPUT_DEBUG (1>>3)
bool ScrInitialize(uptr heap,u32 size);
bool ScrInitialize(uptr heap,u32 size,bool jp,bool deb);
void ScrFinalize();
void ScrClr();
int ScrDbgLogGetMax();
@ -94,20 +52,19 @@ 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_Status(tChar *s,eColor col);
void scr_ResultQuit(tChar *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_MessOnCount2(tChar *str);
void scr_Draw();
void scr_GetEvnt();

View File

@ -16,7 +16,10 @@
#ifndef VER_H_
#define VER_H_
#define VERSION 1.10
#define VERSION 1.2
// ver = 0 ならテキストの方を表示
//#define VERSION 0.0
#define VERSION_TXT "TEST ONLY"
#define VERSION_TXT_W L"TEST ONLY"
#endif

View File

@ -29,6 +29,11 @@ CUP
[Histry]
#表示ver マスタリング時のver
# 変更内容
v1.20 - body:空のディレクトリが作成されない不具合を修正
メッセージを日本語表示
v1.10改 impNOAでインポート出来なかったので桁チェック削除
ツール本体の変更なし、マスタリング品は飯島さん
v1.10 - Remaster 2.0.12
body:ルート下ディレクトリの最初しか検索しない不具合を修正(ロンチゲー影響なし)
ファイルがメモリ上の確保サイズを超えた時にエラー表示