mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@639 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
e50f822f0c
commit
68c9011a61
@ -25,6 +25,7 @@ LIBS += lib_demo libnn_am
|
|||||||
.SUBDIRS: $(exist-dirs \
|
.SUBDIRS: $(exist-dirs \
|
||||||
Mover \
|
Mover \
|
||||||
ToSD \
|
ToSD \
|
||||||
|
Mover_child \
|
||||||
)
|
)
|
||||||
|
|
||||||
DefineDefaultRules()
|
DefineDefaultRules()
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
EJF10000237
|
EJF10000308
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
<EFBFBD>c°Ŕć;q’i|xŰ$^D˙Q¨lڎË_ňůO?·OQwř]i…łľÄdžÁUÄĘ›P<E280BA>ŕíđŤŕL8ŞýQLĘîQ’j€ô)°~SVO>( $6çůi(—H?ä8?0Ű„U
‹zO¤Wó<>ł˝$<24>‘}葯šŔPĐ“Ž<ö]ϨúÖď[¤ŘÝ)3„Öčv}2^Fˇođż{5íÔTzdNA*-‰—Í\Â$4ŚĐ]Î9éěKmČT¬F0ÍúăL—3’9<>őÖi=ĺčŽô’'[4<>>ł÷ż´•Q,/µ†łGČ—]<5D>žźß03‡
|
C╞┌ОО▒б÷$3⌡╢dbh╤╠
|
||||||
ţ“›Đâ×Ű=
|
Й?YЫa+! ╛ ⌠▄Н*S©WиIзйvА╤фDY╜ 0╢xH╪B╢nс&R pjD/'┤ЙY
j9й╬▐lТ|э<S<О²÷²л60X∙
т╘@╗хшo·╫╩&$фoч≈Шф╢екцjXX°К╓0rИ_⌠Lш┴╦√{С╖
|
||||||
|
#Ъ{·ПКХЖ⌠tV&$жLЖ╘pQ:°╥█6L<И8 Ю∙а▐H╒o╖ч|8═─|yиял√[Е=YЗyN║фwЦ√┘┤дэ*GХ▒pраmk╚▐!└k-rLы╘Ю│─╖ш■╔[/аZЭ⌠+3
|
||||||
@ -55,7 +55,7 @@ CTR_BANNER_SPEC = banner.bsf
|
|||||||
|
|
||||||
#Cia バージョン:マスタリング毎に更新すること
|
#Cia バージョン:マスタリング毎に更新すること
|
||||||
#メジャーはrsfで指定(Remasterversion)
|
#メジャーはrsfで指定(Remasterversion)
|
||||||
MAKECIAFLAGS = -minor 0 -micro 0
|
MAKECIAFLAGS = -minor 0 -micro 1
|
||||||
|
|
||||||
include $(ROOT_OMAKE)/modulerules
|
include $(ROOT_OMAKE)/modulerules
|
||||||
|
|
||||||
|
|||||||
@ -249,21 +249,32 @@ RetCode Card2Sd()
|
|||||||
//ディレクトリ作成
|
//ディレクトリ作成
|
||||||
//空ディレクトリもチェックするゲームあるので(マリカ7)
|
//空ディレクトリもチェックするゲームあるので(マリカ7)
|
||||||
//ファイルの存在と関係なく作成
|
//ファイルの存在と関係なく作成
|
||||||
//todo:パス名チェック
|
|
||||||
if(dcList.num >0)
|
if(dcList.num >0)
|
||||||
{
|
{
|
||||||
int i,rev=0;
|
int i,rev=0;
|
||||||
for (i=0;i<dcList.num;i++)
|
for (i=0;i<dcList.num;i++)
|
||||||
{
|
{
|
||||||
while(1){
|
exsave.GetRootPath(file_pathw2);//格納先ルート取得
|
||||||
if (exsave.MakeDir(dcList.name[i],&mkdir)==false)
|
ChainPath(file_pathw2,&dcList.name[i][6]);//"save:/"の次から
|
||||||
|
if (CheckPath(file_pathw2)==false)//パス名チェック..エラーにならず化けるもの
|
||||||
|
{
|
||||||
|
if (exsave.OpenVnfW(file_pathw2,0)==false)//ディレクトリ退避
|
||||||
{
|
{
|
||||||
if(mkdir==false)
|
res = RESULT_FAIL_OPENW;
|
||||||
|
}else exsave.CloseW();
|
||||||
|
}else{
|
||||||
|
while(1){
|
||||||
|
if (exsave.MakeDir(file_pathw2,&mkdir)==false)
|
||||||
{
|
{
|
||||||
res = RESULT_FAIL_OPENW;
|
if(mkdir==false){//作成失敗
|
||||||
break;
|
if (exsave.OpenVnfW(file_pathw2,0)==false)//ディレクトリ退避
|
||||||
}
|
{
|
||||||
}else break;
|
res = RESULT_FAIL_OPENW;
|
||||||
|
}else exsave.CloseW();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (res != RESULT_OK)break;
|
if (res != RESULT_OK)break;
|
||||||
rev^=1;
|
rev^=1;
|
||||||
@ -332,7 +343,7 @@ RetCode Card2Sd()
|
|||||||
//SDで支障あるパス名の場合は別ファイルに格納する
|
//SDで支障あるパス名の場合は別ファイルに格納する
|
||||||
exsave.GetRootPath(file_pathw2);//格納先ルート取得
|
exsave.GetRootPath(file_pathw2);//格納先ルート取得
|
||||||
ChainPath(file_pathw2,file_pathw);//実パス名に変換
|
ChainPath(file_pathw2,file_pathw);//実パス名に変換
|
||||||
if (CheckPath(file_pathw2)==false)//パス名チェック
|
if (CheckPath(file_pathw2)==false)//パス名チェック..エラーにならず化けるもの
|
||||||
{
|
{
|
||||||
if (exsave.OpenVnfW(file_pathw,fsize)==false)//退避ファイル
|
if (exsave.OpenVnfW(file_pathw,fsize)==false)//退避ファイル
|
||||||
{
|
{
|
||||||
|
|||||||
@ -183,6 +183,7 @@ void touchQuit(u32 pos NN_IS_UNUSED_VAR)
|
|||||||
//‰º‰æ–Ê
|
//‰º‰æ–Ê
|
||||||
|
|
||||||
//Top Menu
|
//Top Menu
|
||||||
|
#ifdef USE_WCHAR
|
||||||
const tPanel panel_Read = {(uptr)touchRead,L"Export",80+20,30,160,80,PANEL_READ,SCREEN_LOWER};
|
const tPanel panel_Read = {(uptr)touchRead,L"Export",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_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};
|
//const tPanel panel_End = {(uptr)touchEnd,"End",80,180,160,30,PANEL_END,SCREEN_LOWER};
|
||||||
@ -190,9 +191,17 @@ const tPanel panel_Read = {(uptr)touchRead,L"Export",80+20,30,160,80,PANEL_READ,
|
|||||||
//Yes No
|
//Yes No
|
||||||
const tPanel panel_Yes = {(uptr)touchYes,L"YES",40+10,60,80,120,PANEL_YES,SCREEN_LOWER};
|
const tPanel panel_Yes = {(uptr)touchYes,L"YES",40+10,60,80,120,PANEL_YES,SCREEN_LOWER};
|
||||||
const tPanel panel_No = {(uptr)touchNo,L"NO",200+30,60,80,120,PANEL_NO,SCREEN_LOWER};
|
const tPanel panel_No = {(uptr)touchNo,L"NO",200+30,60,80,120,PANEL_NO,SCREEN_LOWER};
|
||||||
|
|
||||||
//Quit
|
//Quit
|
||||||
const tPanel panel_Quit = {(uptr)touchQuit,L"Quit",80+20,60,160,120,PANEL_QUIT,SCREEN_LOWER};
|
const tPanel panel_Quit = {(uptr)touchQuit,L"Quit",80+20,60,160,120,PANEL_QUIT,SCREEN_LOWER};
|
||||||
|
#else
|
||||||
|
const tPanel panel_Read = {(uptr)touchRead,"Export",80+20,30,160,80,PANEL_READ,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};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//<2F>ã‰æ–Ê
|
//<2F>ã‰æ–Ê
|
||||||
//ƒfƒoƒO—p
|
//ƒfƒoƒO—p
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#ifndef VER_H_
|
#ifndef VER_H_
|
||||||
#define VER_H_
|
#define VER_H_
|
||||||
|
|
||||||
#define VERSION 0.01
|
#define VERSION 0.02
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -30,6 +30,8 @@ NAND
|
|||||||
ツール本体の操作は操作マニュアル参照
|
ツール本体の操作は操作マニュアル参照
|
||||||
|
|
||||||
履歴:
|
履歴:
|
||||||
|
2012.2.15 ver0.02(リマスタバージョン1.0.1)
|
||||||
|
マリカ7対応:中身のないディレクトリも作成するよう修正
|
||||||
2011.6.8 ver0.01(リマスタバージョン1.0.0)
|
2011.6.8 ver0.01(リマスタバージョン1.0.0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -14,17 +15,17 @@ extern uptr heapForGx;
|
|||||||
|
|
||||||
|
|
||||||
//エラー表示用文字列生成
|
//エラー表示用文字列生成
|
||||||
void GetErrorStr(ErcDev dev,nn::Result res,int cd,char* s)
|
void GetErrorStr(TgtDev dev,nn::Result res,int cd,tChar* s)
|
||||||
{
|
{
|
||||||
int desc=0,code;
|
int desc=0,code;
|
||||||
|
|
||||||
if ((cd ==0 ) && (dev != ERC_DEV_OTHER))
|
if ( (cd ==0 ) && ((dev == TGT_SD) || (dev == TGT_CARD)))
|
||||||
{
|
{
|
||||||
desc = res.GetDescription();
|
desc = res.GetDescription();
|
||||||
if (desc < 100 ) code = ERC_UNKNOWN;//キー検索完了 .. ありえない
|
if (desc < 100 ) code = ERC_UNKNOWN;//キー検索完了 .. ありえない
|
||||||
else if (desc < 180 ) code = ERC_READ;//ファイルが見つからないか不正
|
else if (desc < 180 ) code = ERC_READ;//ファイルが見つからないか不正
|
||||||
else if (desc < 200 ) code = ERC_WRITE_OW;//ファイルが存在 .. 削除失敗?
|
else if (desc < 200 ) code = ERC_WRITE;//ファイルが存在
|
||||||
else if (desc < 220 ) code = ERC_WRITE_NS;//空きが無い
|
else if (desc < 220 ) code = ERC_NOSPACE;//空きが無い
|
||||||
else if (desc < 260 ) code = ERC_ACCESS;//操作拒否
|
else if (desc < 260 ) code = ERC_ACCESS;//操作拒否
|
||||||
else if (desc < 280 ) code = ERC_WRITE_PROTECT;//書き込み禁止
|
else if (desc < 280 ) code = ERC_WRITE_PROTECT;//書き込み禁止
|
||||||
else if (desc < 340 ) code = ERC_ACCESS;//アクセスエラー
|
else if (desc < 340 ) code = ERC_ACCESS;//アクセスエラー
|
||||||
@ -39,7 +40,11 @@ void GetErrorStr(ErcDev dev,nn::Result res,int cd,char* s)
|
|||||||
//if (desc>=600){
|
//if (desc>=600){
|
||||||
// sprintf(s,"ERROR %d, desc %d",dev+code,desc);
|
// sprintf(s,"ERROR %d, desc %d",dev+code,desc);
|
||||||
//}else{
|
//}else{
|
||||||
|
#ifdef USE_WCHAR
|
||||||
|
swprintf(s,16,L"ERROR %d",dev+code);
|
||||||
|
#else
|
||||||
sprintf(s,"ERROR %d",dev+code);
|
sprintf(s,"ERROR %d",dev+code);
|
||||||
|
#endif
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +112,7 @@ void finish()
|
|||||||
g_AwakeEvent.Finalize();
|
g_AwakeEvent.Finalize();
|
||||||
g_TransitionEvent.Finalize();
|
g_TransitionEvent.Finalize();
|
||||||
|
|
||||||
nn::fs::Finalize();
|
//nn::fs::Finalize();
|
||||||
|
|
||||||
|
|
||||||
appHeap.Free(reinterpret_cast<void*>(heapForGx));
|
appHeap.Free(reinterpret_cast<void*>(heapForGx));
|
||||||
|
|||||||
@ -8,7 +8,7 @@ typedef void (*FUNCP)();
|
|||||||
void finish();
|
void finish();
|
||||||
void CheckSysBreak();
|
void CheckSysBreak();
|
||||||
void InitSysBreak(uptr adrs);
|
void InitSysBreak(uptr adrs);
|
||||||
void GetErrorStr(ErcDev dev,nn::Result res,int cd,char* s);
|
void GetErrorStr(TgtDev dev,nn::Result res,int cd,tChar* s);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
#include <nn.h>
|
#include <nn.h>
|
||||||
#include <nn/os.h>
|
#include <nn/os.h>
|
||||||
#include <nn/hid.h>
|
#include <nn/hid.h>
|
||||||
@ -67,15 +68,20 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//パネル
|
//パネル
|
||||||
class cmPanel: public cmBase
|
class cmPanel: public cmBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
tStyle style;
|
tStyle style;
|
||||||
char *caption;
|
tChar *caption;
|
||||||
public:
|
public:
|
||||||
cmPanel(){
|
cmPanel(){
|
||||||
|
#ifdef USE_WCHAR
|
||||||
|
caption=L"None";
|
||||||
|
#else
|
||||||
caption="None";
|
caption="None";
|
||||||
|
#endif
|
||||||
style.image = 0;
|
style.image = 0;
|
||||||
style.color.r = 1.0f;
|
style.color.r = 1.0f;
|
||||||
style.color.g = 1.0f;
|
style.color.g = 1.0f;
|
||||||
@ -85,6 +91,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//メッセージ
|
//メッセージ
|
||||||
class cmMessage: public cmPanel
|
class cmMessage: public cmPanel
|
||||||
{
|
{
|
||||||
@ -95,58 +103,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define LINES_MAX 20
|
|
||||||
#define CHARS_MAX 128
|
|
||||||
//メモ
|
|
||||||
class cmMemo: public cmBase
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
char strlst[LINES_MAX][CHARS_MAX];
|
|
||||||
public:
|
|
||||||
tStyle style;
|
|
||||||
u32 lines;//行サイズ:strlen配列数以下であること
|
|
||||||
u32 parent;//親コンポーネントID
|
|
||||||
public:
|
|
||||||
cmMemo();
|
|
||||||
bool setline(char *p,u16 ln);
|
|
||||||
char* line(u16 ln);
|
|
||||||
void clr(){
|
|
||||||
for (int i=0;i<lines;i++)strlst[i][0]=0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cmMemo::cmMemo():lines(10)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i=0;i<LINES_MAX;i++){
|
|
||||||
strlst[i][0]=0;
|
|
||||||
strlst[i][CHARS_MAX-1]=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//文字列の登録
|
|
||||||
bool cmMemo::setline(char *p,u16 ln)
|
|
||||||
{
|
|
||||||
if(lines < ln)return false;
|
|
||||||
char c;
|
|
||||||
int i = 0;
|
|
||||||
while(1){
|
|
||||||
c = p[i];
|
|
||||||
strlst[ln][i]=c;
|
|
||||||
if (c == 0)break;
|
|
||||||
if (i == CHARS_MAX-2)break;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* cmMemo::line(u16 ln)
|
|
||||||
{
|
|
||||||
if(lines < ln)return 0;
|
|
||||||
return &strlst[ln][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------- sub routin -------------------
|
//------------- sub routin -------------------
|
||||||
#define PANEL_MAX 20
|
#define PANEL_MAX 20
|
||||||
#define MEMO_MAX 2
|
#define MEMO_MAX 2
|
||||||
@ -154,7 +110,6 @@ char* cmMemo::line(u16 ln)
|
|||||||
static cmButton s_Button;
|
static cmButton s_Button;
|
||||||
static cmPanel s_Panel[PANEL_MAX];
|
static cmPanel s_Panel[PANEL_MAX];
|
||||||
static cmMessage s_Message[MESS_MAX];
|
static cmMessage s_Message[MESS_MAX];
|
||||||
static cmMemo s_Memo[MEMO_MAX];
|
|
||||||
static demo::RenderSystemDrawing s_RenderSystem;
|
static demo::RenderSystemDrawing s_RenderSystem;
|
||||||
void ColorFromCode(eColor c,tCol *col);
|
void ColorFromCode(eColor c,tCol *col);
|
||||||
|
|
||||||
@ -187,61 +142,53 @@ bool onPanel(u16 x,u16 y,cmPanel *p)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_WCHAR
|
||||||
#define setText(x,y,s) shf_DrawText_0(x,y,s)
|
tChar* Wak_H = L"-";
|
||||||
#define setSize(sz) shf_SetSize(sz)
|
tChar* Wak_V = L"|";
|
||||||
|
#define setText(x,y,s) shf_DrawText_0w(x,y,s)
|
||||||
|
#define setSize(sz) shf_SetSizeW(sz)
|
||||||
|
#define setScale(h,v) shf_SetScaleW(h,v)
|
||||||
|
#define getFontwidth shf_GetFontWidthW()
|
||||||
|
#define getFontheight shf_GetFontHeightW()
|
||||||
|
#define getLen(s) wcslen(s)
|
||||||
|
|
||||||
void setColor(tCol *col)
|
void setColor(tCol *col)
|
||||||
{
|
{
|
||||||
//s_RenderSystem.SetColor(col->r, col->g, col->b,col->a);
|
shf_SetColorW(col->r,col->g,col->b,col->a);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
tChar* Wak_H = "-";
|
||||||
|
tChar* Wak_V = "|";
|
||||||
|
#define setText(x,y,s) shf_DrawText_0(x,y,s)
|
||||||
|
#define setSize(sz) shf_SetSize(sz)
|
||||||
|
#define setScale(h,v) shf_SetScale(h,v)
|
||||||
|
#define getFontwidth shf_GetFontWidth()
|
||||||
|
#define getFontheight shf_GetFontHeight()
|
||||||
|
#define getLen(s) strlen(s)
|
||||||
|
void setColor(tCol *col)
|
||||||
|
{
|
||||||
shf_SetColor(col->r,col->g,col->b,col->a);
|
shf_SetColor(col->r,col->g,col->b,col->a);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//void setSize(f32 sz)
|
|
||||||
//{
|
|
||||||
// s_RenderSystem.SetFontSize(sz);
|
|
||||||
//}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define FONT_CAPTION_SIZE 12
|
|
||||||
//caption付きBox描画
|
|
||||||
void drawBox(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
|
||||||
{
|
|
||||||
u16 xe = top.x + size.x -1;
|
|
||||||
u16 ye = top.y + size.y -1;
|
|
||||||
setColor(&st->color);
|
|
||||||
s_RenderSystem.SetLineWidth(st->width);
|
|
||||||
s_RenderSystem.DrawLine(top.x, top.y, xe, top.y);
|
|
||||||
s_RenderSystem.DrawLine(xe, top.y, xe, ye);
|
|
||||||
s_RenderSystem.DrawLine(xe, ye, top.x, ye);
|
|
||||||
s_RenderSystem.DrawLine(top.x, ye, top.x, top.y);
|
|
||||||
if (str != 0){
|
|
||||||
int w = (size.x - strlen(str)*FONT_CAPTION_SIZE) >> 1;
|
|
||||||
int h = (size.y - FONT_CAPTION_SIZE) >> 1;
|
|
||||||
if ((w>0) && (h>0)){
|
|
||||||
setSize(FONT_CAPTION_SIZE);
|
|
||||||
s_RenderSystem.DrawText(top.x + w,top.y + h,str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//上画面、メッセージ枠表示
|
//上画面、メッセージ枠表示
|
||||||
void drawBox(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
void drawBox(tU16xy top,tU16xy size,tStyle *st,tChar* str = 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
shf_SetScale(2.0f,2.0f);
|
setScale(2.0f,2.0f);
|
||||||
setColor(&st->color);
|
setColor(&st->color);
|
||||||
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y-32,"-");
|
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y-32,Wak_H);
|
||||||
for (i=0;i<size.y/36;i++)setText(top.x-10,top.y+i*36-10,"|");
|
for (i=0;i<size.y/36;i++)setText(top.x-10,top.y+i*36-10,Wak_V);
|
||||||
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y+size.y-40,"-");
|
for (i=0;i<size.x/16;i++)setText(top.x+i*16,top.y+size.y-40,Wak_H);
|
||||||
for (i=0;i<size.y/36;i++)setText(top.x+size.x-16,top.y+i*36-10,"|");
|
for (i=0;i<size.y/36;i++)setText(top.x+size.x-16,top.y+i*36-10,Wak_V);
|
||||||
|
|
||||||
if (str != 0){
|
if (str != 0){
|
||||||
shf_SetScale(1.0f,1.0f);
|
int w = getFontwidth/2;
|
||||||
int w = shf_GetFontWidth()/2;
|
int h = getFontheight;
|
||||||
int h = shf_GetFontHeight();
|
setScale(1.0f,1.0f);
|
||||||
w = (size.x - strlen(str)*w) >> 1;
|
w = (size.x - getLen(str)*w) >> 1;
|
||||||
h = (size.y - h) >> 1;
|
h = (size.y - h) >> 1;
|
||||||
if ((w>0) && (h>0)){
|
if ((w>0) && (h>0)){
|
||||||
setText(top.x + w+10,top.y + h,str);
|
setText(top.x + w+10,top.y + h,str);
|
||||||
@ -251,21 +198,21 @@ void drawBox(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//下画面ボタン表示
|
//下画面ボタン表示
|
||||||
void drawBox2(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
void drawBox2(tU16xy top,tU16xy size,tStyle *st,tChar* str = 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
setColor(&st->color);
|
setColor(&st->color);
|
||||||
shf_SetScale(2.0f,2.0f);
|
setScale(2.0f,2.0f);
|
||||||
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y-24,"-");
|
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y-24,Wak_H);
|
||||||
for (i=0;i<size.y/40;i++)setText(top.x-8,top.y+i*40,"|");
|
for (i=0;i<size.y/40;i++)setText(top.x-8,top.y+i*40,Wak_V);
|
||||||
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y+size.y-28,"-");
|
for (i=0;i<size.x/16+2;i++)setText(top.x+i*16,top.y+size.y-28,Wak_H);
|
||||||
for (i=0;i<size.y/40;i++)setText(top.x+size.x+24,top.y+i*40,"|");
|
for (i=0;i<size.y/40;i++)setText(top.x+size.x+24,top.y+i*40,Wak_V);
|
||||||
|
|
||||||
if (str != 0){
|
if (str != 0){
|
||||||
shf_SetScale(1.0f,1.0f);
|
setScale(1.0f,1.0f);
|
||||||
int w = shf_GetFontWidth()/2;
|
int w = getFontwidth/2;
|
||||||
int h = shf_GetFontHeight();
|
int h = getFontheight;
|
||||||
w = (size.x - strlen(str)*w) >> 1;
|
w = (size.x - getLen(str)*w) >> 1;
|
||||||
h = (size.y - h) >> 1;
|
h = (size.y - h) >> 1;
|
||||||
if ((w>0) && (h>0)){
|
if ((w>0) && (h>0)){
|
||||||
setText(top.x + w+10,top.y + h+10,str);
|
setText(top.x + w+10,top.y + h+10,str);
|
||||||
@ -274,7 +221,7 @@ void drawBox2(tU16xy top,tU16xy size,tStyle *st,char* str = 0)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int si;
|
||||||
|
|
||||||
//描画
|
//描画
|
||||||
void drawDisp()
|
void drawDisp()
|
||||||
@ -283,7 +230,7 @@ void drawDisp()
|
|||||||
//上
|
//上
|
||||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
int i,j;
|
int i;
|
||||||
|
|
||||||
for (i=0;i<PANEL_MAX;i++){
|
for (i=0;i<PANEL_MAX;i++){
|
||||||
if ((s_Panel[i].visible) && (s_Panel[i].scr == 0)){
|
if ((s_Panel[i].visible) && (s_Panel[i].scr == 0)){
|
||||||
@ -291,32 +238,20 @@ void drawDisp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<MESS_MAX;i++){
|
for (si=0;si<MESS_MAX;si++){
|
||||||
if ( s_Message[i].visible && s_Panel[s_Message[i].parent].visible ){
|
if ( s_Message[si].visible && s_Panel[s_Message[si].parent].visible ){
|
||||||
setSize(s_Message[i].style.width);
|
setSize(s_Message[si].style.width);
|
||||||
setColor(&s_Message[i].style.color);
|
setColor(&s_Message[si].style.color);
|
||||||
//s_RenderSystem.DrawText(s_Panel[s_Message[i].parent].pos.x+s_Message[i].pos.x,
|
//s_RenderSystem.DrawText(s_Panel[s_Message[i].parent].pos.x+s_Message[i].pos.x,
|
||||||
// s_Panel[s_Message[i].parent].pos.y+s_Message[i].pos.y,s_Message[i].caption);
|
// s_Panel[s_Message[i].parent].pos.y+s_Message[i].pos.y,s_Message[i].caption);
|
||||||
setText(s_Panel[s_Message[i].parent].pos.x+s_Message[i].pos.x,
|
setText(s_Panel[s_Message[si].parent].pos.x+s_Message[si].pos.x,
|
||||||
s_Panel[s_Message[i].parent].pos.y+s_Message[i].pos.y,s_Message[i].caption);
|
s_Panel[s_Message[si].parent].pos.y+s_Message[si].pos.y,s_Message[si].caption);
|
||||||
|
|
||||||
|
|
||||||
//NN_LOG(s_Message[i].caption);
|
//NN_LOG(s_Message[i].caption);
|
||||||
//NN_LOG(" %d\n",i);
|
//NN_LOG(" %d\n",i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0;i<MEMO_MAX;i++){
|
|
||||||
if ( s_Memo[i].visible && s_Panel[s_Memo[i].parent].visible ){
|
|
||||||
setColor(&s_Memo[i].style.color);
|
|
||||||
setSize(s_Memo[i].style.width);
|
|
||||||
u16 x = s_Panel[s_Memo[i].parent].pos.x+s_Memo[i].pos.x;
|
|
||||||
u16 y = s_Panel[s_Memo[i].parent].pos.y+s_Memo[i].pos.y;
|
|
||||||
for (j=0;j<s_Memo[i].lines;j++){
|
|
||||||
s_RenderSystem.DrawText(x,y,s_Memo[i].line(j));
|
|
||||||
y+=10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s_RenderSystem.SwapBuffers();
|
s_RenderSystem.SwapBuffers();
|
||||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||||
@ -440,7 +375,7 @@ void thUpdate(nn::os::LightEvent* pEvnt)
|
|||||||
tpOld.y = tpStatus.y;
|
tpOld.y = tpStatus.y;
|
||||||
if (tpStatus.touch)
|
if (tpStatus.touch)
|
||||||
{
|
{
|
||||||
NN_LOG("x =%d , y=%d\n",tpStatus.x,tpStatus.y);
|
//NN_LOG("x =%d , y=%d\n",tpStatus.x,tpStatus.y);
|
||||||
for (i=0;i<PANEL_MAX;i++)//PANEL枠内か?
|
for (i=0;i<PANEL_MAX;i++)//PANEL枠内か?
|
||||||
{
|
{
|
||||||
if (s_Panel[i].enable && (s_Panel[i].callback !=0))
|
if (s_Panel[i].enable && (s_Panel[i].callback !=0))
|
||||||
@ -475,7 +410,7 @@ bool Gui::Initialize(uptr pHeap,u32 size,nn::os::LightEvent* pEvnt)
|
|||||||
//コンポーネントの初期化
|
//コンポーネントの初期化
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i< PANEL_MAX;i++)PanelEffective(i,false,false);
|
for (i=0;i< PANEL_MAX;i++)PanelEffective(i,false,false);
|
||||||
for (i=0;i< MEMO_MAX;i++)MemoEffective(i,false,false);
|
// for (i=0;i< MEMO_MAX;i++)MemoEffective(i,false,false);
|
||||||
for (i=0;i< MESS_MAX;i++)MessEffective(i,false,false);
|
for (i=0;i< MESS_MAX;i++)MessEffective(i,false,false);
|
||||||
|
|
||||||
//Render
|
//Render
|
||||||
@ -585,7 +520,7 @@ myResult Gui::MessSet(const tMessage *mes)
|
|||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myResult Gui::MessStr(u8 id,char *str)
|
myResult Gui::MessStr(u8 id,tChar *str)
|
||||||
{
|
{
|
||||||
if (id >= MESS_MAX)return RESULT_BAD_PARAM;
|
if (id >= MESS_MAX)return RESULT_BAD_PARAM;
|
||||||
s_Message[id].caption = str;
|
s_Message[id].caption = str;
|
||||||
@ -599,38 +534,6 @@ myResult Gui::MessCol(u8 id,eColor col)
|
|||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myResult Gui::MemoSet(const tMemo *m)
|
|
||||||
{
|
|
||||||
if ((m->parent >= PANEL_MAX) || (m->id >= MEMO_MAX))return RESULT_BAD_PARAM;
|
|
||||||
if (m->lines > LINES_MAX)return RESULT_BAD_PARAM;
|
|
||||||
s_Memo[m->id].lines = m->lines;
|
|
||||||
s_Memo[m->id].pos.x = m->x;
|
|
||||||
s_Memo[m->id].pos.y = m->y;
|
|
||||||
s_Memo[m->id].parent = m->parent;
|
|
||||||
s_Memo[m->id].style.width = m->size;
|
|
||||||
ColorFromCode(m->color,&s_Memo[m->id].style.color);
|
|
||||||
s_Memo[m->id].clr();
|
|
||||||
s_Memo[m->id].visible = false;
|
|
||||||
s_Memo[m->id].enable = false;
|
|
||||||
return RESULT_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
myResult Gui::MemoStr(u8 id,char *str,u16 ln)
|
|
||||||
{
|
|
||||||
if ((id < MEMO_MAX) && s_Memo[id].setline(str,ln) )return RESULT_OK;
|
|
||||||
return RESULT_BAD_PARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
myResult Gui::MemoEffective(u8 id,bool enable,bool visible)
|
|
||||||
{
|
|
||||||
if (id >= MEMO_MAX)return RESULT_BAD_PARAM;
|
|
||||||
s_Memo[id].enable = enable;
|
|
||||||
s_Memo[id].visible = visible;
|
|
||||||
return RESULT_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Gui::Draw()
|
void Gui::Draw()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uptr callback;
|
uptr callback;
|
||||||
char* caption;
|
tChar* caption;
|
||||||
u16 x,y;
|
u16 x,y;
|
||||||
u16 width,height;
|
u16 width,height;
|
||||||
u16 id;
|
u16 id;
|
||||||
@ -44,7 +44,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char* str;
|
tChar* str;
|
||||||
u16 x,y;//親の始点との相対
|
u16 x,y;//親の始点との相対
|
||||||
eColor color;//
|
eColor color;//
|
||||||
u8 size;//文字サイズ
|
u8 size;//文字サイズ
|
||||||
@ -78,15 +78,15 @@ public:
|
|||||||
void ButtonMask(u32 mask);
|
void ButtonMask(u32 mask);
|
||||||
myResult PanelSet(const tPanel *panel);
|
myResult PanelSet(const tPanel *panel);
|
||||||
myResult MessSet(const tMessage *mes);
|
myResult MessSet(const tMessage *mes);
|
||||||
myResult MemoSet(const tMemo *m);
|
// myResult MemoSet(const tMemo *m);
|
||||||
void Draw();
|
void Draw();
|
||||||
void DisableAll();
|
void DisableAll();
|
||||||
myResult PanelEffective(u8 id,bool enable=true,bool visible=true);
|
myResult PanelEffective(u8 id,bool enable=true,bool visible=true);
|
||||||
myResult MessEffective(u8 id,bool enable=true,bool visible=true);
|
myResult MessEffective(u8 id,bool enable=true,bool visible=true);
|
||||||
myResult MemoEffective(u8 id,bool enable=true,bool visible=true);
|
// myResult MemoEffective(u8 id,bool enable=true,bool visible=true);
|
||||||
myResult MessStr(u8 id,char *str);
|
myResult MessStr(u8 id,tChar *str);
|
||||||
myResult MessCol(u8 id,eColor col);
|
myResult MessCol(u8 id,eColor col);
|
||||||
myResult MemoStr(u8 id,char *str,u16 ln);
|
// myResult MemoStr(u8 id,tChar *str,u16 ln);
|
||||||
myResult PanelLineStyle(u8 id,eColor col=COLOR_WHITE,u8 width = 2);
|
myResult PanelLineStyle(u8 id,eColor col=COLOR_WHITE,u8 width = 2);
|
||||||
//void thUpdate();
|
//void thUpdate();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -16,20 +16,38 @@
|
|||||||
#ifndef MYDEFS_H_
|
#ifndef MYDEFS_H_
|
||||||
#define MYDEFS_H_
|
#define MYDEFS_H_
|
||||||
|
|
||||||
|
//拡張セーブ用のID
|
||||||
|
//rsfのUIDと合わせる
|
||||||
|
#define OWN_UID 0xf8014
|
||||||
|
|
||||||
|
#define USE_WCHAR 1
|
||||||
|
|
||||||
|
//文字列型
|
||||||
|
#ifdef USE_WCHAR
|
||||||
|
typedef wchar_t tChar;
|
||||||
|
#else
|
||||||
|
typedef char tChar;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//エラー表示コード
|
//エラー表示コード
|
||||||
|
//v2.0で変更
|
||||||
|
//ERC_PATH:パスが長すぎ,ERC_DIRDEPTH:ディレクトリ深すぎ
|
||||||
|
//->ERC_WORK にまとめる
|
||||||
|
//5番をPULLOUTに変更
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ERC_UNKNOWN = 0, //不明
|
ERC_UNKNOWN = 0, //不明
|
||||||
ERC_DEVICE, //デバイスが見つからない(カード抜け)
|
ERC_DEVICE, //デバイスが見つからない(カード抜け)
|
||||||
ERC_PRODCODE,//プロダクトコード不一致
|
ERC_PRODCODE,//プロダクトコード不一致
|
||||||
ERC_VERIFI,//ベリファイエラー
|
ERC_VERIFI,//ベリファイエラー
|
||||||
ERC_PATH,//パスが長すぎ
|
ERC_WORK,//ワーク作成に失敗
|
||||||
ERC_DIRDEPTH,//ディレクトリ深すぎ
|
ERC_PULLOUT,//抜け検出
|
||||||
ERC_MEDIA, //メディアが見つからない(サブ基盤外れなど)
|
ERC_MEDIA, //メディアが見つからない(サブ基盤外れなど)
|
||||||
//ERC_PULLOUT,//抜け検出
|
|
||||||
ERC_READ = 10, //ファイルが見つからない
|
ERC_READ = 10, //ファイルが見つからない
|
||||||
ERC_WRITE_OW = 20, //既に存在
|
//ERC_WRITE_OW = 20, //既に存在
|
||||||
ERC_WRITE_NS, //空き容量がない
|
ERC_WRITE = 20, //ライトエラー
|
||||||
|
ERC_NOSPACE, //空き容量がない
|
||||||
ERC_WRITE_PROTECT, //書込み禁止
|
ERC_WRITE_PROTECT, //書込み禁止
|
||||||
ERC_ACCESS = 30, //アクセスエラー
|
ERC_ACCESS = 30, //アクセスエラー
|
||||||
ERC_FORMAT = 50, //フォーマットエラー
|
ERC_FORMAT = 50, //フォーマットエラー
|
||||||
@ -40,12 +58,13 @@ ERC_EXEC = 90, //実行時エラー
|
|||||||
ERC_FATAL = 99 //深刻なエラー
|
ERC_FATAL = 99 //深刻なエラー
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{//対象デバイス指定
|
||||||
ERC_DEV_CARD = 100,
|
TGT_NONE = 0,
|
||||||
ERC_DEV_OUT = 200,
|
TGT_CARD = 100,
|
||||||
ERC_DEV_OTHER = 300
|
TGT_SD = 200,
|
||||||
}ErcDev;
|
TGT_MEM = 300
|
||||||
|
}TgtDev;
|
||||||
|
//OUT=SD or MEM
|
||||||
|
|
||||||
//内部使用のエラー
|
//内部使用のエラー
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -74,6 +93,7 @@ typedef enum {
|
|||||||
RESULT_DIR_LEVEL_OVER,
|
RESULT_DIR_LEVEL_OVER,
|
||||||
RESULT_PATH_LENGTH_OVER,
|
RESULT_PATH_LENGTH_OVER,
|
||||||
RESULT_DEVICE_FULL,
|
RESULT_DEVICE_FULL,
|
||||||
|
RESULT_WORK_OVER,
|
||||||
RESULT_MAX
|
RESULT_MAX
|
||||||
}myResult;
|
}myResult;
|
||||||
|
|
||||||
|
|||||||
@ -1,81 +1,49 @@
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <nn/fs.h>
|
#include <nn/fs.h>
|
||||||
#include <../fs/fs_ResultPrivate.h>
|
|
||||||
#include "exsave.h"
|
#include "exsave.h"
|
||||||
|
#include <nn/fs/fs_ResultPrivate.h>
|
||||||
#define OWN_UID 0xf8014
|
#include <nn/fs/CTR/MPCore/fs_ApiForHwCheck.h>
|
||||||
const char *exsaveName = "exsave:";
|
//#include <nn/am/am_ApiSystemMenu.h>
|
||||||
const wchar_t *exsaveRoot_w = L"exsave:/save/";
|
//#include <nn/am/am_ApiLocalImporter.h>
|
||||||
const char *exsaveRoot = "exsave:/save/";
|
|
||||||
#define ROOTLENGTH_EX 8
|
|
||||||
const wchar_t *exsaveSys_w = L"exsave:/ncl_sysdata.ncl";//暫定
|
|
||||||
wchar_t expath_w[PATHLENGTH_MAX];//パス名
|
|
||||||
wchar_t expathu_w[100][PATHLENGTH_MAX];//上層パス名
|
|
||||||
wchar_t expathw_w[PATHLENGTH_MAX];//パス名ワーク
|
|
||||||
static nn::fs::DirectoryEntry exdcEntry[MAX_LEVEL];
|
|
||||||
static nn::fs::Directory exdc[MAX_LEVEL];
|
|
||||||
|
|
||||||
|
|
||||||
//拡張セーブデータ
|
extern "C" {
|
||||||
//存在確認
|
extern u8* ICON_BEGIN[];
|
||||||
bool ExSave::IsExist()
|
extern u8* ICON_END[];
|
||||||
{
|
|
||||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
|
||||||
nn::fs::Unmount(exsaveName);
|
|
||||||
return LastNnResult.IsSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
//パス検索位置のリセット
|
const void* ICON = ICON_BEGIN;
|
||||||
void ExSave::ResetPath()
|
const size_t ICON_SIZE = ICON_END-ICON_BEGIN;
|
||||||
{
|
|
||||||
s_lv=0;
|
|
||||||
s_serch = false;
|
|
||||||
wcscpy(expath_w,exsaveRoot_w);
|
|
||||||
//wcscpy(expathu_w,expath_w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
myResult ExSave::GetPath(wchar_t *path)
|
//セーブ作成、成功時はマウント状態
|
||||||
|
myResult ExSave::Create(u32 entryDir,u32 entryFile)
|
||||||
{
|
{
|
||||||
int n;
|
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
||||||
while(1){
|
LastNnResult = nn::fs::CreateExtSaveData(OWN_UID,ICON,ICON_SIZE,entryDir,entryFile);
|
||||||
if (s_serch==false){
|
if (LastNnResult.IsFailure())return RESULT_FAIL_CREATE;
|
||||||
LastNnResult = exdc[s_lv].TryInitialize(expath_w);//Open
|
LastNnResult = nn::fs::MountExtSaveData(devName,OWN_UID);
|
||||||
if (LastNnResult.IsFailure()){
|
if (LastNnResult.IsFailure())return RESULT_FAIL_MOUNT;
|
||||||
return RESULT_FAIL;
|
//LastNnResult = nn::fs::TryCreateDirectory(root_w);
|
||||||
}
|
//if (LastNnResult.IsFailure()){
|
||||||
}
|
// nn::fs::Unmount(devName);
|
||||||
while(1){
|
// return RESULT_FAIL_MOUNT;
|
||||||
n = (exdc[s_lv].Read(&exdcEntry[s_lv],1));
|
//}
|
||||||
if ( n==0 )//終端
|
IsMounted = true;
|
||||||
{
|
return RESULT_OK;
|
||||||
exdc[s_lv].Finalize();
|
|
||||||
if (s_lv == 0){path[0]=0;return RESULT_OK;}// ---- rootなら終了
|
|
||||||
s_lv--;//上の層に戻る
|
|
||||||
wcscpy(expath_w,expathu_w[s_lv]);//パス戻す
|
|
||||||
}else{
|
|
||||||
if(exdcEntry[s_lv].attributes.isDirectory){//ディレクトリ
|
|
||||||
//m_info.DirCount++;
|
|
||||||
wcscpy(expathu_w[s_lv],expath_w);//パス保存
|
|
||||||
wcscat(expath_w,exdcEntry[s_lv].entryName);//次のディレクトリパス
|
|
||||||
wcscat(expath_w,L"/");
|
|
||||||
if (++s_lv == MAX_LEVEL)return RESULT_DIR_LEVEL_OVER;
|
|
||||||
s_serch = false;
|
|
||||||
break;
|
|
||||||
}else{//ファイル
|
|
||||||
//m_info.FileCount++;
|
|
||||||
s_serch = true;
|
|
||||||
wcscpy(path,pPathTop);
|
|
||||||
wcscat(path,exdcEntry[s_lv].entryName);
|
|
||||||
return RESULT_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//空き容量
|
||||||
|
s64 ExSave::GetFreeSize()
|
||||||
|
{
|
||||||
|
if (IsMounted==false)if(MountCore()==false)return 0;
|
||||||
|
s64 a,b;
|
||||||
|
LastNnResult = nn::fs::GetSdmcSize(&a,&b);
|
||||||
|
if (IsMounted==false)Unmount();
|
||||||
|
if (LastNnResult.IsFailure())return 0;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
//削除
|
//削除
|
||||||
bool ExSave::Delete()
|
bool ExSave::Delete()
|
||||||
@ -85,215 +53,29 @@ bool ExSave::Delete()
|
|||||||
return LastNnResult.IsSuccess();
|
return LastNnResult.IsSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
//セーブ作成、成功時はマウント状態
|
|
||||||
myResult ExSave::Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile)
|
|
||||||
{
|
|
||||||
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
|
||||||
LastNnResult = nn::fs::CreateExtSaveData(OWN_UID,icon,iconSize,entryDir,entryFile);
|
|
||||||
if (LastNnResult.IsFailure())return RESULT_FAIL_CREATE;
|
|
||||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
|
||||||
if (LastNnResult.IsFailure())return RESULT_FAIL_MOUNT;
|
|
||||||
LastNnResult = nn::fs::TryCreateDirectory(exsaveRoot_w);
|
|
||||||
if (LastNnResult.IsFailure()){
|
|
||||||
nn::fs::Unmount(exsaveName);
|
|
||||||
return RESULT_FAIL_MOUNT;
|
|
||||||
}
|
|
||||||
IsMounted = true;
|
|
||||||
return RESULT_OK;
|
|
||||||
}
|
|
||||||
//マウント
|
//マウント
|
||||||
myResult ExSave::Mount()
|
bool ExSave::MountCore()
|
||||||
{
|
{
|
||||||
if ( IsMounted )return RESULT_ALREADY_MOUNT;
|
LastNnResult = nn::fs::MountExtSaveData(devName,OWN_UID);
|
||||||
LastNnResult = nn::fs::MountExtSaveData(exsaveName,OWN_UID);
|
|
||||||
if (LastNnResult.IsFailure()){
|
|
||||||
return RESULT_FAIL_MOUNT;
|
|
||||||
}
|
|
||||||
IsMounted = true;
|
|
||||||
return RESULT_OK;
|
|
||||||
}
|
|
||||||
void ExSave::Unmount()
|
|
||||||
{
|
|
||||||
IsMounted = false;
|
|
||||||
nn::fs::Unmount(exsaveName);
|
|
||||||
}
|
|
||||||
//ライト属性ファイルを閉じる
|
|
||||||
void ExSave::CloseW()
|
|
||||||
{
|
|
||||||
writer.Finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
//ファイルライト
|
|
||||||
s32 ExSave::Write(char *buffer,size_t size)
|
|
||||||
{
|
|
||||||
s32 ct;
|
|
||||||
LastNnResult = writer.TryWrite(&ct,(void*)buffer,size);
|
|
||||||
if(LastNnResult.IsFailure())ct=0;
|
|
||||||
return ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//管理用ファイル
|
|
||||||
//ライト属性で開く
|
|
||||||
bool ExSave::OpenSysW()
|
|
||||||
{
|
|
||||||
LastNnResult = nn::fs::TryCreateFile(exsaveSys_w,sizeof(tArcInfo));
|
|
||||||
LastNnResult = writerSys.TryInitialize(exsaveSys_w,false);
|
|
||||||
return LastNnResult.IsSuccess();
|
|
||||||
}
|
|
||||||
//ライト属性ファイルを閉じる
|
|
||||||
void ExSave::CloseSysW()
|
|
||||||
{
|
|
||||||
writerSys.Finalize();
|
|
||||||
}
|
|
||||||
//システムファイルライト
|
|
||||||
bool ExSave::WriteSys(tArcInfo *pinfo)
|
|
||||||
{
|
|
||||||
s32 ct;
|
|
||||||
pinfo->Ver = INFO_VERSION;
|
|
||||||
LastNnResult = writerSys.TryWrite(&ct,(void*)pinfo,sizeof(tArcInfo));
|
|
||||||
return LastNnResult.IsSuccess();
|
|
||||||
}
|
|
||||||
//リード属性で開く
|
|
||||||
bool ExSave::OpenSysR()
|
|
||||||
{
|
|
||||||
LastNnResult = readerSys.TryInitialize(exsaveSys_w);
|
|
||||||
return LastNnResult.IsSuccess();
|
|
||||||
}
|
|
||||||
//ライト属性ファイルを閉じる
|
|
||||||
void ExSave::CloseSysR()
|
|
||||||
{
|
|
||||||
readerSys.Finalize();
|
|
||||||
}
|
|
||||||
//ファイルリード
|
|
||||||
bool ExSave::ReadSys(tArcInfo *pinfo)
|
|
||||||
{
|
|
||||||
s32 ct;
|
|
||||||
LastNnResult = readerSys.TryRead(&ct,(void*)pinfo,sizeof(tArcInfo));
|
|
||||||
return LastNnResult.IsSuccess();
|
return LastNnResult.IsSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//フォーマット情報
|
||||||
|
void ExSave::GetFormatInfoCore(tArcInfo *ifo)
|
||||||
|
|
||||||
//ライト属性ファイルを開く
|
|
||||||
bool ExSave::OpenW(wchar_t *path,s64 size)
|
|
||||||
{
|
{
|
||||||
int pos,pos2;
|
LastNnResult = nn::fs::GetExtSaveDataFormatInfo(&ifo->FileEntry,&ifo->DirEntry,OWN_UID);
|
||||||
|
|
||||||
wcscpy(expath_w,exsaveRoot_w);
|
|
||||||
wcscat(expath_w,path);
|
|
||||||
while(1){
|
|
||||||
LastNnResult = nn::fs::TryCreateFile(expath_w,size);
|
|
||||||
if(LastNnResult.IsSuccess())break;
|
|
||||||
//ディレクトリがなければディレクトリを作成
|
|
||||||
pos = GetPosDelmLast(expath_w,ROOTLENGTH_EX);//ファイルが存在するディレクトリ
|
|
||||||
if (pos <= 0)return false;//rootかパスが不正
|
|
||||||
//while (1){
|
|
||||||
wcscpy(expathw_w,expath_w);//ワークにコピー
|
|
||||||
while (LastNnResult.IsFailure()){//ディレクトリ作成できるまで遡る
|
|
||||||
if(LastNnResult.GetDescription()!=nn::fs::DESCRIPTION_DBM_DIRECTORY_NOT_FOUND)return false;
|
|
||||||
pos2 = GetPosDelmLast(expathw_w,ROOTLENGTH_EX);//境界位置を探す
|
|
||||||
if (pos2 == 0)return false;//root到達
|
|
||||||
expathw_w[pos2] = 0;//境界まで削除 (例) dir1/dir2/file -> dir1/dir2 -> dir1
|
|
||||||
LastNnResult = nn::fs::TryCreateDirectory(expathw_w);
|
|
||||||
}
|
|
||||||
//if (pos2 == pos)break;//配置ディレクトリなら抜ける
|
|
||||||
//todo:ディレクトリが深いとき時間がかかるなら、無駄なTryCreateを省く
|
|
||||||
//案)直上から最初の成功までのデリミタ位置を記録
|
|
||||||
//先に全ディレクトリ作っておくのがよさげ
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
LastNnResult = writer.TryInitialize(expath_w,false);
|
|
||||||
return LastNnResult.IsSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
//ファイルリード
|
|
||||||
s32 ExSave::Read(char *buffer,size_t size)
|
|
||||||
{
|
|
||||||
// if (IsMounted==false)return 0;
|
|
||||||
s32 ct;
|
|
||||||
LastNnResult = reader.TryRead(&ct,(void*)buffer,size);
|
|
||||||
if(LastNnResult.IsFailure())ct=0;
|
|
||||||
return ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExSave::Close()
|
|
||||||
{
|
|
||||||
reader.Finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//ファイルを開く
|
|
||||||
//パス指定はルート以降
|
|
||||||
//(ex)data:/dir/file -> dir/file
|
|
||||||
bool ExSave::Open(wchar_t *path)
|
|
||||||
{
|
|
||||||
wcscpy(expathw_w,exsaveRoot_w);
|
|
||||||
wcscat(expathw_w,path);
|
|
||||||
LastNnResult = reader.TryInitialize(expathw_w);
|
|
||||||
if (LastNnResult.IsSuccess())
|
|
||||||
{
|
|
||||||
LastNnResult = reader.TryGetSize(&FileSize);
|
|
||||||
if (LastNnResult.IsSuccess())return true;
|
|
||||||
else Close();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//アーカイブ情報の取得
|
|
||||||
bool ExSave::GetInfo(tArcInfo *pinfo)
|
|
||||||
{
|
|
||||||
if(Mount()==RESULT_FAIL_MOUNT)return false;
|
|
||||||
//システムデータからフォーマット情報
|
|
||||||
if (OpenSysR())
|
|
||||||
{
|
|
||||||
if(ReadSys(pinfo) == false){
|
|
||||||
pinfo->Pcode[0]=0;
|
|
||||||
CloseSysR();//クローズ
|
|
||||||
Unmount();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Unmount();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CloseSysR();//クローズ
|
|
||||||
// Unmount();
|
|
||||||
//#ifdef INFO_API_USE
|
|
||||||
//API情報と比較
|
|
||||||
// LastNnResult = nn::fs::GetExtSaveDataFormatInfo(OWN_UID,&m_info.FileEntry,&m_info.DirEntry);
|
|
||||||
// if (m_info.FileEntry != pinfo->FileEntry)return false;
|
|
||||||
// if (m_info.DirEntry != pinfo->DirEntry)return false;
|
|
||||||
// //if (m_info.Dup != pinfo->Dup)return false; //ExSaveには無い
|
|
||||||
//#endif
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//コンストラクタ
|
//コンストラクタ
|
||||||
ExSave::ExSave()
|
ExSave::ExSave()
|
||||||
{
|
{
|
||||||
IsMounted = false;
|
PrdCode[0] = 0;
|
||||||
s_lv=0;
|
strcpy(devName,"exsave:");
|
||||||
m_info.DirCount = 0;
|
SetRootPath(L"exsave:");
|
||||||
m_info.FileCount = 0;
|
|
||||||
m_info.DirEntry = 0;
|
|
||||||
m_info.FileEntry = 0;
|
|
||||||
wcscpy(expath_w,exsaveRoot_w);
|
|
||||||
//wcscpy(expathu_w,expath_w);
|
|
||||||
pPathTop = (wchar_t*)((u32)&expath_w+strlen(exsaveRoot)*2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExSave::Finalize()
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
Unmount();
|
|
||||||
}
|
|
||||||
//デストラクタ
|
|
||||||
ExSave::~ExSave()
|
|
||||||
{
|
|
||||||
Finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -21,50 +21,22 @@
|
|||||||
#include "../my_defs.h"
|
#include "../my_defs.h"
|
||||||
#include "savefile.h"
|
#include "savefile.h"
|
||||||
|
|
||||||
class ExSave
|
class ExSave: public SaveFileRead,public SaveFileWrite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
s64 FileSize;
|
char PrdCode[20];
|
||||||
nn::Result LastNnResult;
|
|
||||||
private:
|
private:
|
||||||
nn::fs::FileReader reader;
|
void GetFormatInfoCore(tArcInfo *ifo);
|
||||||
nn::fs::FileWriter writer;
|
|
||||||
nn::fs::FileReader readerSys;
|
|
||||||
nn::fs::FileWriter writerSys;
|
|
||||||
wchar_t *pPathTop;
|
|
||||||
tArcInfo m_info;
|
|
||||||
int s_lv;
|
|
||||||
int exrootlen;
|
|
||||||
bool IsMounted;
|
|
||||||
bool s_serch;
|
|
||||||
public:
|
public:
|
||||||
ExSave();
|
bool MountCore();
|
||||||
~ExSave();
|
|
||||||
void Finalize();
|
|
||||||
myResult Create(const void* icon,size_t iconSize,u32 entryDir,u32 entryFile);
|
|
||||||
myResult CreateSys(const void* icon,size_t iconSize);
|
|
||||||
myResult Mount();
|
|
||||||
myResult MountSys();
|
|
||||||
bool IsExist();
|
|
||||||
void Unmount();
|
|
||||||
bool Delete();
|
bool Delete();
|
||||||
void CloseW();
|
s64 GetFreeSize();
|
||||||
bool OpenW(wchar_t *path,s64 size);
|
myResult Create(u32 entryDir,u32 entryFile);
|
||||||
bool OpenSysW();//暫定
|
void Finalize(){Close();};
|
||||||
void CloseSysW();//暫定
|
// bool GetPrdCode();
|
||||||
bool OpenSysR();//暫定
|
ExSave();
|
||||||
void CloseSysR();//暫定
|
~ExSave(){Finalize();};
|
||||||
s32 Write(char *buffer,size_t size);
|
|
||||||
bool WriteSys(tArcInfo *pinfo);
|
|
||||||
bool ReadSys(tArcInfo *pinfo);
|
|
||||||
void ResetPath();
|
|
||||||
s32 Read(char *buffer,size_t size);
|
|
||||||
void Close();
|
|
||||||
bool Open(wchar_t *path);
|
|
||||||
myResult GetPath(wchar_t *path);
|
|
||||||
bool GetInfo(tArcInfo *pinfo);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace
|
|||||||
bit8 s_Buffer[BUFFER_SIZE] NN_ATTRIBUTE_ALIGN(4096);
|
bit8 s_Buffer[BUFFER_SIZE] NN_ATTRIBUTE_ALIGN(4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool info_alive;
|
//bool info_alive;
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@ -28,7 +28,7 @@ MemBak::MemBak()
|
|||||||
LastNnResult = ResultSuccess();
|
LastNnResult = ResultSuccess();
|
||||||
ResetPath();
|
ResetPath();
|
||||||
|
|
||||||
info_alive = false;
|
// info_alive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemBak::Finalize()
|
void MemBak::Finalize()
|
||||||
@ -61,10 +61,13 @@ myResult MemBak::Create(u32 entryDir,u32 entryFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_NumDirEntry = entryDir;
|
m_NumDirEntry = entryDir;
|
||||||
|
m_ArcInfo.DirEntry = entryDir;
|
||||||
m_NumFileEntry = entryFile;
|
m_NumFileEntry = entryFile;
|
||||||
|
m_ArcInfo.FileEntry = entryFile;
|
||||||
|
|
||||||
m_Exists = true;
|
m_Exists = true;
|
||||||
m_IsMounted = true;
|
m_IsMounted = true;
|
||||||
|
m_pBufferPos = m_pBuffer;
|
||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,14 +75,16 @@ myResult MemBak::Create(u32 entryDir,u32 entryFile)
|
|||||||
bool MemBak::Delete()
|
bool MemBak::Delete()
|
||||||
{
|
{
|
||||||
m_Exists = false;
|
m_Exists = false;
|
||||||
info_alive = false;
|
// info_alive = false;
|
||||||
m_pBufferPos = m_pBuffer;
|
m_pBufferPos = m_pBuffer;
|
||||||
|
m_IsMounted = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//マウント
|
//マウント
|
||||||
myResult MemBak::Mount()
|
myResult MemBak::Mount()
|
||||||
{
|
{
|
||||||
|
if (m_Exists == false)return RESULT_FAIL_MOUNT;
|
||||||
if ( m_IsMounted )
|
if ( m_IsMounted )
|
||||||
{
|
{
|
||||||
return RESULT_ALREADY_MOUNT;
|
return RESULT_ALREADY_MOUNT;
|
||||||
@ -88,6 +93,7 @@ myResult MemBak::Mount()
|
|||||||
m_IsMounted = true;
|
m_IsMounted = true;
|
||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemBak::Unmount()
|
void MemBak::Unmount()
|
||||||
{
|
{
|
||||||
m_IsMounted = false;
|
m_IsMounted = false;
|
||||||
@ -102,12 +108,11 @@ void MemBak::Unmount()
|
|||||||
//アーカイブ情報の取得
|
//アーカイブ情報の取得
|
||||||
bool MemBak::GetInfo(tArcInfo *pinfo)
|
bool MemBak::GetInfo(tArcInfo *pinfo)
|
||||||
{
|
{
|
||||||
if (info_alive==false)return false;
|
|
||||||
*pinfo = m_ArcInfo;
|
*pinfo = m_ArcInfo;
|
||||||
return true;
|
return m_Exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
//管理用ファイル
|
//管理用ファイル
|
||||||
//ライト属性で開く
|
//ライト属性で開く
|
||||||
bool MemBak::OpenSysW()
|
bool MemBak::OpenSysW()
|
||||||
@ -128,7 +133,7 @@ bool MemBak::WriteSys(tArcInfo *pinfo)
|
|||||||
m_ArcInfo = *pinfo;
|
m_ArcInfo = *pinfo;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -173,12 +173,12 @@ public:
|
|||||||
bool Delete();
|
bool Delete();
|
||||||
void CloseW();
|
void CloseW();
|
||||||
bool OpenW(wchar_t *path,s64 size);
|
bool OpenW(wchar_t *path,s64 size);
|
||||||
bool OpenSysW();//暫定
|
// bool OpenSysW();//暫定
|
||||||
void CloseSysW();//暫定
|
// void CloseSysW();//暫定
|
||||||
// bool OpenSysR();//Žb’è
|
// bool OpenSysR();//Žb’è
|
||||||
// void CloseSysR();//Žb’è
|
// void CloseSysR();//Žb’è
|
||||||
s32 Write(char *buffer,size_t size);
|
s32 Write(char *buffer,size_t size);
|
||||||
bool WriteSys(tArcInfo *pinfo);
|
// bool WriteSys(tArcInfo *pinfo);
|
||||||
// bool ReadSys(tArcInfo *pinfo);
|
// bool ReadSys(tArcInfo *pinfo);
|
||||||
void ResetPath();
|
void ResetPath();
|
||||||
s32 Read(char *buffer,size_t size);
|
s32 Read(char *buffer,size_t size);
|
||||||
|
|||||||
@ -16,17 +16,21 @@ bool SaveData::GetPrdCode()
|
|||||||
nn::ProgramId programId;
|
nn::ProgramId programId;
|
||||||
|
|
||||||
LastNnResult = nn::am::InitializeForLocalImporter();
|
LastNnResult = nn::am::InitializeForLocalImporter();
|
||||||
|
// LastNnResult = nn::am::InitializeForSystemMenu();
|
||||||
if (LastNnResult.IsFailure()){
|
if (LastNnResult.IsFailure()){
|
||||||
nn::am::FinalizeForLocalImporter();
|
nn::am::FinalizeForLocalImporter();
|
||||||
|
// nn::am::FinalizeForSystemMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LastNnResult = nn::am::GetProgramList(&numPrograms, &programId, 1, nn::fs::MEDIA_TYPE_CTRCARD);
|
LastNnResult = nn::am::GetProgramList(&numPrograms, &programId, 1, nn::fs::MEDIA_TYPE_CTRCARD);
|
||||||
if (LastNnResult.IsFailure()){
|
if (LastNnResult.IsFailure()){
|
||||||
nn::am::FinalizeForLocalImporter();
|
nn::am::FinalizeForLocalImporter();
|
||||||
|
//nn::am::FinalizeForSystemMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LastNnResult = nn::am::GetProductCode( (nn::ProductCode*)&PrdCode,nn::fs::MEDIA_TYPE_CTRCARD,programId);
|
LastNnResult = nn::am::GetProductCode( (nn::ProductCode*)&PrdCode,nn::fs::MEDIA_TYPE_CTRCARD,programId);
|
||||||
nn::am::FinalizeForLocalImporter();
|
nn::am::FinalizeForLocalImporter();
|
||||||
|
//nn::am::FinalizeForSystemMenu();
|
||||||
PrdCode[sizeof(nn::ProductCode)] = 0;//表示時のオーバラン対策
|
PrdCode[sizeof(nn::ProductCode)] = 0;//表示時のオーバラン対策
|
||||||
return LastNnResult.IsSuccess();
|
return LastNnResult.IsSuccess();
|
||||||
}
|
}
|
||||||
@ -76,4 +80,3 @@ SaveData::SaveData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ void ChainPath(wchar_t *p1,wchar_t *p2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//パス名チェック for SD
|
//パス名チェック for SDMC
|
||||||
//fs関数で引数エラー(INVALID_ARGUMENT)にならないものをチェック
|
//fs関数で引数エラー(INVALID_ARGUMENT)にならないものをチェック
|
||||||
bool CheckPath(wchar_t *s)
|
bool CheckPath(wchar_t *s)
|
||||||
{
|
{
|
||||||
@ -48,6 +48,72 @@ bool CheckPath(wchar_t *s)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//パス名チェック for 拡張セーブ
|
||||||
|
bool CheckPathEx(wchar_t *s)
|
||||||
|
{
|
||||||
|
size_t n = wcslen(s);
|
||||||
|
if ((n > 248) || (n==0))return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ディレクトリ一致チェック
|
||||||
|
//ret= 0:なし、他:最初に一致した階層
|
||||||
|
//ex) s = "/d1/d2/d3",s2 ="d2" or "/d2" ret=2
|
||||||
|
// "/"で囲まれた文字列をディレクトリと見なす
|
||||||
|
int CmpDirW(wchar_t *s,wchar_t *s2)
|
||||||
|
{
|
||||||
|
int i=0,j,n = wcslen(s),n2 = wcslen(s2);
|
||||||
|
int lv=1;
|
||||||
|
wchar_t *ss;
|
||||||
|
if (s2[0]==L'/')
|
||||||
|
{
|
||||||
|
ss = &s2[1];
|
||||||
|
n2--;
|
||||||
|
}else ss = s2;
|
||||||
|
while(i<n){
|
||||||
|
if(s[i] == L'/')
|
||||||
|
{//次のスラッシュまで
|
||||||
|
j = i+1;
|
||||||
|
while(j<n){
|
||||||
|
if(s[j] == L'/')break;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
if (j>=n)return 0;
|
||||||
|
if ((j-i-1) == n2)
|
||||||
|
{//文字長一致したら比較
|
||||||
|
if(memcmp((void*)&s[i+1],(void*)ss,n2)==0)return lv;
|
||||||
|
}
|
||||||
|
lv++;
|
||||||
|
i=j;//次
|
||||||
|
}else i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//ファイル名の一致確認
|
||||||
|
//s:パス ex)"/dir/name"
|
||||||
|
//s2:ファイル名 ex) "/name"
|
||||||
|
bool CmpNameW(wchar_t *s,wchar_t *s2)
|
||||||
|
{
|
||||||
|
int n,n2,i;
|
||||||
|
n = wcslen(s);
|
||||||
|
n2 = wcslen(s2);
|
||||||
|
i = GetPosDelmLast(s,1);//"/"の位置
|
||||||
|
if (n2 != n-i)return false;//文字数一致?
|
||||||
|
return memcmp((void*)&s[i],(void*)s2,n2*2)==0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CmpPathW(wchar_t *s,wchar_t *s2)
|
||||||
|
{
|
||||||
|
int n,n2;
|
||||||
|
n = wcslen(s);
|
||||||
|
n2 = wcslen(s2);
|
||||||
|
if (n2 != n)return false;//文字数一致?
|
||||||
|
return memcmp((void*)s,(void*)s2,n2*2)==0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------- Class SaveFileWrite
|
//-------------- Class SaveFileWrite
|
||||||
//ディレクトリ作成ありのオープン
|
//ディレクトリ作成ありのオープン
|
||||||
bool SaveFileWrite::OpenC(wchar_t *path,s64 size,bool *mkdir)
|
bool SaveFileWrite::OpenC(wchar_t *path,s64 size,bool *mkdir)
|
||||||
@ -81,6 +147,35 @@ bool SaveFileWrite::OpenC(wchar_t *path,s64 size,bool *mkdir)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ディレクトリ作成
|
||||||
|
//無ければパスに含むディレクトリも作成
|
||||||
|
bool SaveFileWrite::MakeDir(wchar_t *path,bool *mkdir)
|
||||||
|
{
|
||||||
|
int pos,pos2;
|
||||||
|
|
||||||
|
*mkdir = false;
|
||||||
|
LastNnResult = nn::fs::TryCreateDirectory(path);
|
||||||
|
if(LastNnResult.IsSuccess())return true;
|
||||||
|
if(nn::fs::ResultAlreadyExists::Includes(LastNnResult))return true;
|
||||||
|
|
||||||
|
//ディレクトリがなければディレクトリを作成
|
||||||
|
pos = GetPosDelmLast(path,RootLength);//ファイルが存在するディレクトリ
|
||||||
|
if (pos <= 0)return false;//rootかパスが不正
|
||||||
|
wcscpy(pathw_w2,path);//ワークにコピー
|
||||||
|
while (LastNnResult.IsFailure()){//ディレクトリ作成できるまで遡る
|
||||||
|
if(nn::fs::ResultNotFound::Includes(LastNnResult)==false)return false;
|
||||||
|
pos2 = GetPosDelmLast(pathw_w2,RootLength);//境界位置を探す
|
||||||
|
if (pos2 == 0)return false;//root到達
|
||||||
|
pathw_w2[pos2] = 0;//境界まで削除 (例) dir1/dir2/file -> dir1/dir2 -> dir1
|
||||||
|
LastNnResult = nn::fs::TryCreateDirectory(pathw_w2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//作成ディレクトリ多いと画面止まるので、作成ごとに抜ける
|
||||||
|
*mkdir = true; // 帰値:false で mkdir=true ならディレクトリ作成のみ
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//ディレクトリ作成なしオープン、存在する場合は追記
|
//ディレクトリ作成なしオープン、存在する場合は追記
|
||||||
bool SaveFileWrite::OpenAdd(wchar_t *path)
|
bool SaveFileWrite::OpenAdd(wchar_t *path)
|
||||||
{
|
{
|
||||||
@ -140,6 +235,11 @@ bool SaveFileWrite::DeleteDir(const wchar_t *dir)
|
|||||||
return LastNnResult.IsSuccess();
|
return LastNnResult.IsSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SaveFileWrite::DeleteFile(const wchar_t *path)
|
||||||
|
{
|
||||||
|
LastNnResult = nn::fs::TryDeleteFile(path);
|
||||||
|
return LastNnResult.IsSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------ Class SaveFileRead
|
//------------------------------------------------------ Class SaveFileRead
|
||||||
bool SaveFileRead::Open(const wchar_t *path)
|
bool SaveFileRead::Open(const wchar_t *path)
|
||||||
@ -163,6 +263,15 @@ void SaveFileRead::Close()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//シーク
|
||||||
|
bool SaveFileRead::SetPos(s64 pos)
|
||||||
|
{
|
||||||
|
LastNnResult = reader.TrySetPosition(pos);
|
||||||
|
return LastNnResult.IsSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ファイルリード
|
//ファイルリード
|
||||||
s32 SaveFileRead::Read(char *buffer,size_t size)
|
s32 SaveFileRead::Read(char *buffer,size_t size)
|
||||||
{
|
{
|
||||||
@ -173,11 +282,11 @@ s32 SaveFileRead::Read(char *buffer,size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//存在チェック
|
//存在チェック
|
||||||
myResult SaveFileRead::IsExist(){
|
bool SaveFileRead::IsExist(){
|
||||||
myResult res;
|
myResult res;
|
||||||
res = Mount();
|
res = Mount();
|
||||||
Unmount();
|
Unmount();
|
||||||
return res;
|
return (res != RESULT_FAIL_MOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -227,9 +336,9 @@ static nn::fs::Directory dcl;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//アーカイブ情報の取得
|
//アーカイブ情報の取得
|
||||||
bool SaveFileRead::GetInfo(tArcInfo *pinfo,size_t clsz)
|
//clsz:SDの場合クラスタサイズ指定で現実に近いサイズに調整
|
||||||
|
bool SaveFileRead::GetInfo(tArcInfo *pinfo,tDcList *pDcList,size_t clsz)
|
||||||
{
|
{
|
||||||
static nn::fs::DirectoryEntry dcEntryl;
|
static nn::fs::DirectoryEntry dcEntryl;
|
||||||
static nn::fs::Directory dcl;
|
static nn::fs::Directory dcl;
|
||||||
@ -246,6 +355,9 @@ static nn::fs::Directory dcl;
|
|||||||
wcscpy(pathw_w,root_w);
|
wcscpy(pathw_w,root_w);
|
||||||
wcscat(pathw_w,L"/");
|
wcscat(pathw_w,L"/");
|
||||||
|
|
||||||
|
CheckPathBit = 0;
|
||||||
|
pDcList->num = 0;
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
int lv = 0;
|
int lv = 0;
|
||||||
for (n = 0;n<MAX_LEVEL;n++)dc_readed[n] = 0;
|
for (n = 0;n<MAX_LEVEL;n++)dc_readed[n] = 0;
|
||||||
@ -267,10 +379,12 @@ static nn::fs::Directory dcl;
|
|||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
if(dcEntryl.attributes.isDirectory){//ディレクトリ
|
if(dcEntryl.attributes.isDirectory){//ディレクトリ
|
||||||
m_info.DirCount++;
|
|
||||||
if (clsz>0)m_info.total +=clsz;//SD..ディレクトリでクラスタ分取る
|
if (clsz>0)m_info.total +=clsz;//SD..ディレクトリでクラスタ分取る
|
||||||
wcscpy(pathu_w[lv],pathw_w);//パス保存
|
wcscpy(pathu_w[lv],pathw_w);//パス保存
|
||||||
wcscat(pathw_w,dcEntryl.entryName);//次のディレクトリパス
|
wcscat(pathw_w,dcEntryl.entryName);//次のディレクトリパス
|
||||||
|
if ( m_info.DirCount < MAX_DCLIST)
|
||||||
|
wcscpy(pDcList->name[m_info.DirCount],pathw_w);//リストに格納
|
||||||
|
m_info.DirCount++;
|
||||||
wcscat(pathw_w,L"/");
|
wcscat(pathw_w,L"/");
|
||||||
if (++lv == MAX_LEVEL)return false;
|
if (++lv == MAX_LEVEL)return false;
|
||||||
break;
|
break;
|
||||||
@ -283,6 +397,10 @@ static nn::fs::Directory dcl;
|
|||||||
if ((dcEntryl.entrySize % clsz) > 0 )sn++;
|
if ((dcEntryl.entrySize % clsz) > 0 )sn++;
|
||||||
m_info.total += sn*clsz;
|
m_info.total += sn*clsz;
|
||||||
}
|
}
|
||||||
|
wcscpy(pathw_w2,pathw_w);
|
||||||
|
wcscat(pathw_w2,dcEntryl.entryName);
|
||||||
|
if(CheckPathEx(pathw_w2)==false)CheckPathBit |= cpb_ex;
|
||||||
|
if(CheckPath(pathw_w2)==false)CheckPathBit |= cpb_sdmc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +411,7 @@ static nn::fs::Directory dcl;
|
|||||||
Unmount();//GetCtrCardSaveDataFormatInfo内でマウントするので一旦アンマウント(SDK2.1~3のみエラー?)
|
Unmount();//GetCtrCardSaveDataFormatInfo内でマウントするので一旦アンマウント(SDK2.1~3のみエラー?)
|
||||||
GetFormatInfoCore(&m_info);
|
GetFormatInfoCore(&m_info);
|
||||||
Mount();
|
Mount();
|
||||||
|
pDcList->num = m_info.DirCount;
|
||||||
*pinfo = m_info;
|
*pinfo = m_info;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@ -14,21 +14,45 @@
|
|||||||
//アーカイブ名およびSD格納ディレクトリの余裕分をみとく
|
//アーカイブ名およびSD格納ディレクトリの余裕分をみとく
|
||||||
#define MAX_PATH_LENGTH 512
|
#define MAX_PATH_LENGTH 512
|
||||||
//パス階層上限
|
//パス階層上限
|
||||||
//ファイル検索時に使用、"/"+1文字が最短なので128で十分
|
//ファイル検索時に使用、パス長上限(253)から128で十分
|
||||||
#define MAX_LEVEL 128
|
#define MAX_LEVEL 128
|
||||||
|
|
||||||
|
//ディレクトリリスト上限
|
||||||
|
#define MAX_DCLIST 256
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
cpb_sdmc = 1,
|
||||||
|
cpb_ex
|
||||||
|
}Cpb_bits;
|
||||||
|
|
||||||
|
|
||||||
//******************************** functions **********
|
//******************************** functions **********
|
||||||
//パス名チェック
|
//パス名チェック .. for sdmc
|
||||||
//FAT違反の半角スペースあるかチェック
|
//FAT違反の半角スペースあるかチェック
|
||||||
//文字、予約名、パス長はAPIエラー(INVALID_ARGUMENT)で判定
|
//文字、予約名、パス長はAPIエラー(INVALID_ARGUMENT)で判定
|
||||||
bool CheckPath(wchar_t *s);
|
bool CheckPath(wchar_t *s);
|
||||||
|
|
||||||
|
//パス名チェック .. 拡張セーブ
|
||||||
|
bool CheckPathEx(wchar_t *s);
|
||||||
|
|
||||||
//デリミタ("/")位置を返す
|
//デリミタ("/")位置を返す
|
||||||
|
//top:検索開始位置
|
||||||
int GetPosDelmLast(wchar_t *s,int top);
|
int GetPosDelmLast(wchar_t *s,int top);
|
||||||
|
|
||||||
//パス結合
|
//パス結合
|
||||||
void ChainPath(wchar_t *p1,wchar_t *p2);
|
void ChainPath(wchar_t *p1,wchar_t *p2);
|
||||||
|
|
||||||
|
//ディレクトリ一致チェック
|
||||||
|
//ret= 0:なし、他:最初に一致した階層
|
||||||
|
//ex) s = "/d1/d2/d3",s2 ="d2" or "/d2" ret=2
|
||||||
|
int CmpDirW(wchar_t *s,wchar_t *s2);
|
||||||
|
|
||||||
|
//ファイル名の一致確認
|
||||||
|
//s:パス ex)"/dir/name"
|
||||||
|
//s2:ファイル ex) "name"
|
||||||
|
bool CmpNameW(wchar_t *s,wchar_t *s2);
|
||||||
|
|
||||||
|
bool CmpPathW(wchar_t *s,wchar_t *s2);
|
||||||
|
|
||||||
//******************************** Types **********
|
//******************************** Types **********
|
||||||
//セーブに関する情報
|
//セーブに関する情報
|
||||||
@ -40,14 +64,26 @@ struct tArcInfo{
|
|||||||
char Pcode[20];//product code SDKのサイズを下回らないこと
|
char Pcode[20];//product code SDKのサイズを下回らないこと
|
||||||
bool Dup;//2重化
|
bool Dup;//2重化
|
||||||
u8 Ver;
|
u8 Ver;
|
||||||
u8 yobi;//パディング
|
//u8 yobi;//パディング
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//ディレクトリ
|
||||||
|
struct tDcList{
|
||||||
|
u16 num;
|
||||||
|
wchar_t name[MAX_DCLIST][MAX_PATH_LENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
|
//ワーニング抑制
|
||||||
|
//1300:inherits implisit virtual
|
||||||
|
//1301:insert padding
|
||||||
|
#pragma diag_suppress 1300,1301
|
||||||
|
|
||||||
//******************************** Class ***************
|
//******************************** Class ***************
|
||||||
class SaveFileBase
|
class SaveFileBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nn::Result LastNnResult;
|
nn::Result LastNnResult;
|
||||||
|
u8 CheckPathBit; //パス名違反チェックbit
|
||||||
protected:
|
protected:
|
||||||
wchar_t root_w[MAX_PATH_LENGTH];//基底パス(デバイス名含)
|
wchar_t root_w[MAX_PATH_LENGTH];//基底パス(デバイス名含)
|
||||||
wchar_t path_w[MAX_PATH_LENGTH];//パス名
|
wchar_t path_w[MAX_PATH_LENGTH];//パス名
|
||||||
@ -98,6 +134,8 @@ public:
|
|||||||
SaveFileWrite(){RootLength=0;};
|
SaveFileWrite(){RootLength=0;};
|
||||||
~SaveFileWrite(){};
|
~SaveFileWrite(){};
|
||||||
bool DeleteDir(const wchar_t *dir);
|
bool DeleteDir(const wchar_t *dir);
|
||||||
|
bool MakeDir(wchar_t *path,bool *mkdir);
|
||||||
|
bool DeleteFile(const wchar_t *path);
|
||||||
bool OpenW(const wchar_t *path);
|
bool OpenW(const wchar_t *path);
|
||||||
bool OpenC(wchar_t *path,s64 size,bool *mkdir);
|
bool OpenC(wchar_t *path,s64 size,bool *mkdir);
|
||||||
bool OpenAdd(wchar_t *path);
|
bool OpenAdd(wchar_t *path);
|
||||||
@ -120,12 +158,13 @@ private:
|
|||||||
tArcInfo m_info;
|
tArcInfo m_info;
|
||||||
bool s_serch;
|
bool s_serch;
|
||||||
public:
|
public:
|
||||||
myResult IsExist();
|
bool IsExist();
|
||||||
bool Open(const wchar_t *path);
|
bool Open(const wchar_t *path);
|
||||||
void Close();
|
void Close();
|
||||||
|
bool SetPos(s64 pos);
|
||||||
myResult GetPath(wchar_t *path);
|
myResult GetPath(wchar_t *path);
|
||||||
void ResetPath();
|
void ResetPath();
|
||||||
bool GetInfo(tArcInfo *pinfo,size_t clsz = 0);
|
bool GetInfo(tArcInfo *pinfo,tDcList *pDcList,size_t clsz = 0);
|
||||||
s32 Read(char *buffer,size_t size);
|
s32 Read(char *buffer,size_t size);
|
||||||
SaveFileRead(){
|
SaveFileRead(){
|
||||||
s_lv=0;
|
s_lv=0;
|
||||||
@ -136,6 +175,7 @@ public:
|
|||||||
};
|
};
|
||||||
~SaveFileRead(){};
|
~SaveFileRead(){};
|
||||||
};
|
};
|
||||||
|
//警告を戻す
|
||||||
|
//#pragma diag_warning 1300,1301
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -33,8 +33,9 @@ std::wstring Sdmcwo::GetDateName()
|
|||||||
|
|
||||||
|
|
||||||
//char型 :表示で使う
|
//char型 :表示で使う
|
||||||
wcstombs(DirName, name.str().c_str(), 14);
|
//wcstombs(DirName, name.str().c_str(), 14);
|
||||||
DirName[14] = 0;
|
//DirName[14] = 0;
|
||||||
|
wcscpy(DirName,name.str().c_str());
|
||||||
return name.str();
|
return name.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ struct AdditionalInfo
|
|||||||
class Sdmcwo: public SaveFileWrite
|
class Sdmcwo: public SaveFileWrite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char DirName[16];
|
wchar_t DirName[16];
|
||||||
size_t ClasterSize;//SDクラスタサイズ .. Create後有効
|
size_t ClasterSize;//SDクラスタサイズ .. Create後有効
|
||||||
size_t FreeSize;//Create直後の空き..Create後有効
|
size_t FreeSize;//Create直後の空き..Create後有効
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include <nn/util.h>
|
#include <nn/util.h>
|
||||||
|
|
||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
const char s_ShaderBinaryFilePath[] = "rom:/nnfont_RectDrawerShader.shbin";
|
const char s_ShaderBinaryFilePath[] = "rom:/nnfont_RectDrawerShader.shbin";
|
||||||
|
|
||||||
@ -231,6 +232,7 @@ nn::font::DispStringBuffer *pDrawStringBuf0;
|
|||||||
nn::font::DispStringBuffer *pDrawStringBuf1;
|
nn::font::DispStringBuffer *pDrawStringBuf1;
|
||||||
nn::font::ResFont font;
|
nn::font::ResFont font;
|
||||||
nn::font::TextWriter writer;
|
nn::font::TextWriter writer;
|
||||||
|
nn::font::WideTextWriter writer_w;
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//! @brief ASCII文字列を描画します。
|
//! @brief ASCII文字列を描画します。
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -270,7 +272,6 @@ void shf_DrawText_1( u16 x,u16 y,char *s)
|
|||||||
drawer.DrawEnd();
|
drawer.DrawEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void shf_SetSize(f32 sz)
|
void shf_SetSize(f32 sz)
|
||||||
{
|
{
|
||||||
writer.SetScale(sz/14,sz/20);
|
writer.SetScale(sz/14,sz/20);
|
||||||
@ -297,12 +298,104 @@ f32 shf_GetFontHeight()
|
|||||||
return writer.GetFontHeight();
|
return writer.GetFontHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a)
|
void shf_SetColor(f32 r,f32 g,f32 b,f32 a)
|
||||||
{
|
{
|
||||||
writer.SetTextColor(nn::util::FloatColor(r,g,b,a));
|
writer.SetTextColor(nn::util::FloatColor(r,g,b,a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//******** ワイド文字列 ************
|
||||||
|
|
||||||
|
//エラーになるコードを置き換える
|
||||||
|
//int chgCode(int size,wchar_t *s)
|
||||||
|
//{
|
||||||
|
// for (int i=0;i<size;i++)
|
||||||
|
// {
|
||||||
|
// if ((s[i] & 0xff00) == 0xff00)s[i]= (s[i] & 0x00ff)+0x20;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
void shf_DrawText_0w( u16 x,u16 y,wchar_t *s)
|
||||||
|
{
|
||||||
|
wchar_t ss[32];
|
||||||
|
|
||||||
|
int size = wcslen(s);
|
||||||
|
if (size > 32){
|
||||||
|
NN_LOG("DrawText:size over");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wcscpy(ss,s);
|
||||||
|
|
||||||
|
writer_w.SetCursor(x, y);
|
||||||
|
|
||||||
|
// chgCode(size,ss);
|
||||||
|
|
||||||
|
writer_w.StartPrint();
|
||||||
|
(void)writer_w.Print(ss);
|
||||||
|
writer_w.EndPrint();
|
||||||
|
drawer.BuildTextCommand(&writer_w);
|
||||||
|
|
||||||
|
|
||||||
|
drawer.DrawBegin();
|
||||||
|
|
||||||
|
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||||
|
writer_w.UseCommandBuffer();
|
||||||
|
|
||||||
|
drawer.DrawEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shf_DrawText_1w( u16 x,u16 y,wchar_t *s)
|
||||||
|
{
|
||||||
|
writer_w.SetCursor(x, y);
|
||||||
|
|
||||||
|
writer_w.StartPrint();
|
||||||
|
(void)writer_w.Print(s);
|
||||||
|
writer_w.EndPrint();
|
||||||
|
drawer.BuildTextCommand(&writer_w);
|
||||||
|
|
||||||
|
|
||||||
|
drawer.DrawBegin();
|
||||||
|
|
||||||
|
SetupTextCamera(&drawer, NN_GX_DISPLAY1_WIDTH, NN_GX_DISPLAY1_HEIGHT);
|
||||||
|
writer_w.UseCommandBuffer();
|
||||||
|
|
||||||
|
drawer.DrawEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void shf_SetSizeW(f32 sz)
|
||||||
|
{
|
||||||
|
writer_w.SetScale(sz/14,sz/20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void shf_SetScaleW(f32 h,f32 v)
|
||||||
|
{
|
||||||
|
writer_w.SetScale(h,v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void shf_SetFontSizeW(f32 sz)
|
||||||
|
{
|
||||||
|
writer_w.SetFontSize(sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 shf_GetFontWidthW()
|
||||||
|
{
|
||||||
|
return writer_w.GetFontWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 shf_GetFontHeightW()
|
||||||
|
{
|
||||||
|
return writer_w.GetFontHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shf_SetColorW(f32 r,f32 g,f32 b,f32 a)
|
||||||
|
{
|
||||||
|
writer_w.SetTextColor(nn::util::FloatColor(r,g,b,a));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//初期化
|
//初期化
|
||||||
//AppHeap確保、RenderSystem.Inititの後に呼ぶ
|
//AppHeap確保、RenderSystem.Inititの後に呼ぶ
|
||||||
void SharedFontInit()
|
void SharedFontInit()
|
||||||
@ -341,6 +434,10 @@ void SharedFontInit()
|
|||||||
|
|
||||||
writer.SetDispStringBuffer(pDrawStringBuf0);
|
writer.SetDispStringBuffer(pDrawStringBuf0);
|
||||||
writer.SetFont(&font);
|
writer.SetFont(&font);
|
||||||
|
|
||||||
|
writer_w.SetDispStringBuffer(pDrawStringBuf0);
|
||||||
|
writer_w.SetFont(&font);
|
||||||
|
|
||||||
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
SetupTextCamera(&drawer, NN_GX_DISPLAY0_WIDTH, NN_GX_DISPLAY0_HEIGHT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,11 +20,19 @@ void SharedFontInit();
|
|||||||
void SharedFontFinalize();
|
void SharedFontFinalize();
|
||||||
void shf_DrawText_0(u16 x,u16 y,char* s);
|
void shf_DrawText_0(u16 x,u16 y,char* s);
|
||||||
void shf_DrawText_1(u16 x,u16 y,char* s);
|
void shf_DrawText_1(u16 x,u16 y,char* s);
|
||||||
|
void shf_DrawText_0w(u16 x,u16 y,wchar_t* s);
|
||||||
|
void shf_DrawText_1w(u16 x,u16 y,wchar_t* s);
|
||||||
void shf_SetSize(f32 sz);
|
void shf_SetSize(f32 sz);
|
||||||
void shf_SetScale(f32 h,f32 v);
|
void shf_SetScale(f32 h,f32 v);
|
||||||
void shf_SetColor(f32 r,f32 g,f32 b,f32 a);
|
void shf_SetColor(f32 r,f32 g,f32 b,f32 a);
|
||||||
void shf_SetFontSize(f32 sz);
|
void shf_SetFontSize(f32 sz);
|
||||||
f32 shf_GetFontWidth();
|
f32 shf_GetFontWidth();
|
||||||
f32 shf_GetFontHeight();
|
f32 shf_GetFontHeight();
|
||||||
|
void shf_SetSizeW(f32 sz);
|
||||||
|
void shf_SetScaleW(f32 h,f32 v);
|
||||||
|
void shf_SetColorW(f32 r,f32 g,f32 b,f32 a);
|
||||||
|
void shf_SetFontSizeW(f32 sz);
|
||||||
|
f32 shf_GetFontWidthW();
|
||||||
|
f32 shf_GetFontHeightW();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -65,10 +65,13 @@ void make_pattern()
|
|||||||
s32 size;
|
s32 size;
|
||||||
#define SIZE_TEST1 421888
|
#define SIZE_TEST1 421888
|
||||||
//#define SIZE_TEST1 244736 //dup
|
//#define SIZE_TEST1 244736 //dup
|
||||||
|
#define DMX_TEST0 100
|
||||||
|
#define FMX_TEST0 100
|
||||||
|
#define DUP_TEST0 true
|
||||||
bool Test0_W(int n)//Casual
|
bool Test0_W(int n)//Casual
|
||||||
{
|
{
|
||||||
|
|
||||||
res = nn::fs::FormatSaveData(100,100,false);
|
res = nn::fs::FormatSaveData(DMX_TEST0,FMX_TEST0,DUP_TEST0);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"format Fail");
|
drawText(8,100,"format Fail");
|
||||||
return false;
|
return false;
|
||||||
@ -79,23 +82,57 @@ bool Test0_W(int n)//Casual
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = 0,total=0;
|
int num = 0,total=0,size=512;
|
||||||
while(1){
|
while(1){
|
||||||
sprintf(file_path,"data:/test%d",num);
|
/*
|
||||||
|
swprintf(file_pathw,512,L"data:/空ディレクトリ%d",num);
|
||||||
|
res = nn::fs::TryCreateDirectory(file_pathw);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"Dir create Fail");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
sprintf(file_path,"data:/nulldir%d",num);
|
||||||
res = nn::fs::TryCreateDirectory(file_path);
|
res = nn::fs::TryCreateDirectory(file_path);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"Dir create Fail");
|
drawText(8,100,"Dir create Fail");
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sprintf(file_path,"data:/test%d/test%d.bin",num,num);
|
sprintf(file_path,"data:/null%d",num);
|
||||||
res = fout.TryInitialize(file_path,true);
|
res = nn::fs::TryCreateDirectory(file_path);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"Dir create Fail");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sprintf(file_path,"data:/null%d/nulldir",num);
|
||||||
|
res = nn::fs::TryCreateDirectory(file_path);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"Dir create Fail");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//swprintf(file_pathw,512,L"data:/テスト%d",num);
|
||||||
|
swprintf(file_pathw,512,L"data:/test%d",num);
|
||||||
|
res = nn::fs::TryCreateDirectory(file_pathw);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"Dir create Fail");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//sprintf(file_path,"data:/test%d/test%d.bin",num,num);
|
||||||
|
//res = fout.TryInitialize(file_path,true);
|
||||||
|
//swprintf(file_pathw,512,L"data:/テスト%d/テスト%d.bin",num,num);
|
||||||
|
swprintf(file_pathw,512,L"data:/test%d/test%d.bin",num,num);
|
||||||
|
res = fout.TryInitialize(file_pathw,true);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"open Fail");
|
drawText(8,100,"open Fail");
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
res = fout.TryWrite( &size,&src_buff[total],512);
|
res = fout.TryWrite( &size,&src_buff[total],size);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"write Fail");
|
drawText(8,100,"write Fail");
|
||||||
fout.Finalize();
|
fout.Finalize();
|
||||||
@ -103,7 +140,8 @@ bool Test0_W(int n)//Casual
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fout.Finalize();
|
fout.Finalize();
|
||||||
total += 512;
|
total += size;
|
||||||
|
size += size;
|
||||||
num++;
|
num++;
|
||||||
sprintf(str,"size %d , num %d",total,num);
|
sprintf(str,"size %d , num %d",total,num);
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
@ -125,25 +163,75 @@ bool Test0_W(int n)//Casual
|
|||||||
bool Test0_V(int n)//Casual
|
bool Test0_V(int n)//Casual
|
||||||
{
|
{
|
||||||
|
|
||||||
int num = 0,total=0;
|
int num = 0,total=0,size = 512;
|
||||||
|
size_t maxF,maxD;
|
||||||
|
bool isDup;
|
||||||
|
|
||||||
|
nn::fs::Directory dc;
|
||||||
|
|
||||||
|
res = nn::fs::GetSaveDataFormatInfo(&maxF,&maxD,&isDup);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"fail to get formatinfo");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((maxF != FMX_TEST0)||(maxD!=DMX_TEST0)||(isDup != DUP_TEST0)){
|
||||||
|
drawText(8,100,"wrong format");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
sprintf(file_path,"data:/test%d/test%d.bin",num,num);
|
sprintf(file_path,"data:/nulldir%d",num);//ディレクトリ
|
||||||
res = fin.TryInitialize(file_path);
|
res = dc.TryInitialize(file_path);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"open Dir");
|
||||||
|
dc.Finalize();
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dc.Finalize();
|
||||||
|
sprintf(file_path,"data:/null%d/nulldir",num);//ディレクトリ
|
||||||
|
res = dc.TryInitialize(file_path);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"open Dir");
|
||||||
|
dc.Finalize();
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dc.Finalize();
|
||||||
|
/*
|
||||||
|
swprintf(file_pathw,512,L"data:/空ディレクトリ%d",num);//ディレクトリ
|
||||||
|
res = dc.TryInitialize(file_pathw);
|
||||||
|
if (res.IsFailure()){
|
||||||
|
drawText(8,100,"open Dir");
|
||||||
|
dc.Finalize();
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dc.Finalize();
|
||||||
|
*/
|
||||||
|
//swprintf(file_pathw,512,L"data:/テスト%d/テスト%d.bin",num,num);
|
||||||
|
swprintf(file_pathw,512,L"data:/test%d/test%d.bin",num,num);
|
||||||
|
res = fin.TryInitialize(file_pathw);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"open Fail");
|
drawText(8,100,"open Fail");
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
res = fin.TryRead( &size,&get_buff[total],512);
|
res = fin.TryRead( &size,&get_buff[total],size);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"read Fail");
|
drawText(8,100,"read Fail");
|
||||||
fin.Finalize();
|
fin.Finalize();
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(int i=0;i<512;i++)if (src_buff[total+i]!=get_buff[total+i])return false;
|
for(int i=0;i<size;i++)if (src_buff[total+i]!=get_buff[total+i])return false;
|
||||||
fin.Finalize();
|
fin.Finalize();
|
||||||
total += 512;
|
total += size;
|
||||||
|
size+=size;
|
||||||
num++;
|
num++;
|
||||||
sprintf(str,"size %d , num %d",total,num);
|
sprintf(str,"size %d , num %d",total,num);
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
@ -163,8 +251,6 @@ bool Test0_V(int n)//Casual
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Test1_W()
|
bool Test1_W()
|
||||||
{
|
{
|
||||||
int total,size2;
|
int total,size2;
|
||||||
@ -271,13 +357,18 @@ bool Test1_V()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define test2_max 680
|
||||||
|
#define test2_ct test2_max
|
||||||
|
//#define test2_max 10
|
||||||
|
//#define test2_ct 5
|
||||||
|
#define test2_size 512
|
||||||
|
|
||||||
//ファイル数
|
//ファイル数
|
||||||
bool Test2_W(int n)
|
bool Test2_W(int n)
|
||||||
{
|
{
|
||||||
int total,size2;
|
int total,size2;
|
||||||
|
|
||||||
res = nn::fs::FormatSaveData(680,1,false);//dupなしファイル680
|
res = nn::fs::FormatSaveData(test2_max,1,false);//dupなしファイル680
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"format Fail");
|
drawText(8,100,"format Fail");
|
||||||
return false;
|
return false;
|
||||||
@ -290,7 +381,7 @@ bool Test2_W(int n)
|
|||||||
|
|
||||||
total =0;
|
total =0;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
size2 = 512;
|
size2 = test2_size;
|
||||||
while(1){
|
while(1){
|
||||||
sprintf(file_path,"data:/test%d.bin",num);
|
sprintf(file_path,"data:/test%d.bin",num);
|
||||||
// res = nn::fs::TryCreateFile(L"data:/test2.bin",SIZE_TEST1);
|
// res = nn::fs::TryCreateFile(L"data:/test2.bin",SIZE_TEST1);
|
||||||
@ -356,7 +447,7 @@ bool Test2_V(int n)
|
|||||||
}
|
}
|
||||||
for (i=0;i<size;i++) if (src_buff[total+i] != get_buff[total+i])
|
for (i=0;i<size;i++) if (src_buff[total+i] != get_buff[total+i])
|
||||||
{
|
{
|
||||||
drawText(8,100,"verifi Fail at %d",total+i);
|
drawText(8,100,"verifi Fail at %d",total+i);
|
||||||
fin.Finalize();
|
fin.Finalize();
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
@ -382,9 +473,13 @@ bool Test2_V(int n)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DirDepth 80
|
//85のとき252文字
|
||||||
|
#define DirDepth 85
|
||||||
|
//ファイルをパス長いものに限定
|
||||||
|
//#define DirDepthLow 80
|
||||||
|
#define DirDepthLow 0
|
||||||
|
|
||||||
//ディレクトリ深度
|
//ディレクトリ深度とパス長
|
||||||
bool Test3_W()
|
bool Test3_W()
|
||||||
{
|
{
|
||||||
int total,size2;
|
int total,size2;
|
||||||
@ -409,32 +504,33 @@ bool Test3_W()
|
|||||||
strcat(file_path,str);
|
strcat(file_path,str);
|
||||||
res = nn::fs::TryCreateDirectory(file_path);
|
res = nn::fs::TryCreateDirectory(file_path);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
sprintf(str,"length = %d",(int)strlen(file_path));
|
sprintf(str,"length = %d",(int)strlen(file_path));
|
||||||
drawText(8,110,str);
|
drawText(8,110,str);
|
||||||
drawText(8,100,"Dir create Fail");
|
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:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (num>=DirDepthLow){
|
||||||
|
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();
|
||||||
|
total+=size;
|
||||||
}
|
}
|
||||||
fout.Finalize();
|
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
total+=size;
|
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
sprintf(str,"num %d",num);
|
sprintf(str,"num %d",num);
|
||||||
drawText(10,80,str);
|
drawText(10,80,str);
|
||||||
@ -446,7 +542,7 @@ bool Test3_W()
|
|||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
|
|
||||||
drawText(10,100,"end");
|
drawText(10,100,"end");
|
||||||
sprintf(str,"length = %d",(int)strlen(file_path2));
|
sprintf(str,"length = %d",(int)strlen(file_path2)-6);
|
||||||
drawText(8,110,str);
|
drawText(8,110,str);
|
||||||
s_RenderSystem.SwapBuffers();
|
s_RenderSystem.SwapBuffers();
|
||||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||||
@ -465,34 +561,34 @@ bool Test3_V()
|
|||||||
while(1){
|
while(1){
|
||||||
sprintf(str,"/%d",num);
|
sprintf(str,"/%d",num);
|
||||||
strcat(file_path,str);
|
strcat(file_path,str);
|
||||||
strcpy(file_path2,file_path);
|
if (num>=DirDepthLow){
|
||||||
sprintf(str,"/t%d.bin",num);
|
strcpy(file_path2,file_path);
|
||||||
strcat(file_path2,str);
|
sprintf(str,"/t%d.bin",num);
|
||||||
res = fin.TryInitialize(file_path2);
|
strcat(file_path2,str);
|
||||||
if (res.IsFailure()){
|
res = fin.TryInitialize(file_path2);
|
||||||
drawText(8,100,"open Fail");
|
if (res.IsFailure()){
|
||||||
nn::fs::Unmount("data:");
|
drawText(8,100,"open Fail");
|
||||||
return false;
|
nn::fs::Unmount("data:");
|
||||||
}
|
return false;
|
||||||
res = fin.TryRead( &size,&get_buff[total],size2);
|
}
|
||||||
if (res.IsFailure()){
|
res = fin.TryRead( &size,&get_buff[total],size2);
|
||||||
drawText(8,100,"read Fail");
|
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();
|
fin.Finalize();
|
||||||
nn::fs::Unmount("data:");
|
total+=size;
|
||||||
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++;
|
num++;
|
||||||
total+=size;
|
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
sprintf(str,"num %d",num);
|
sprintf(str,"num %d",num);
|
||||||
drawText(10,80,str);
|
drawText(10,80,str);
|
||||||
@ -502,7 +598,7 @@ bool Test3_V()
|
|||||||
|
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
drawText(10,100,"end");
|
drawText(10,100,"end");
|
||||||
sprintf(str,"length = %d",(int)strlen(file_path2));
|
sprintf(str,"length = %d",(int)strlen(file_path2)-6);
|
||||||
drawText(8,110,str);
|
drawText(8,110,str);
|
||||||
s_RenderSystem.SwapBuffers();
|
s_RenderSystem.SwapBuffers();
|
||||||
nngxWaitVSync(NN_GX_DISPLAY0);
|
nngxWaitVSync(NN_GX_DISPLAY0);
|
||||||
@ -523,7 +619,10 @@ bool Test4_W()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(file_path,"data:/0123456789abcdef");//16文字
|
strcpy(file_path,"data:/");
|
||||||
|
while(strlen(file_path)<(16+6)){//16文字
|
||||||
|
strcat(file_path,"0");
|
||||||
|
}
|
||||||
res = nn::fs::TryCreateDirectory(file_path);
|
res = nn::fs::TryCreateDirectory(file_path);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
sprintf(str,"length = %d",(int)strlen(file_path)-6);
|
sprintf(str,"length = %d",(int)strlen(file_path)-6);
|
||||||
@ -532,12 +631,14 @@ bool Test4_W()
|
|||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
strcat(file_path,"/0123456789ab.bin");//16文字
|
strcat(file_path,"/123456789abc.bin");//16文字
|
||||||
res = fout.TryInitialize(file_path,true);
|
res = fout.TryInitialize(file_path,true);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"Open Fail");
|
sprintf(str,"length = %d",(int)strlen(file_path)-6);
|
||||||
nn::fs::Unmount("data:");
|
drawText(8,110,str);
|
||||||
return false;
|
drawText(8,100,"Open Fail");
|
||||||
|
nn::fs::Unmount("data:");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
res = fout.TryWrite( &size,&src_buff[0],512);
|
res = fout.TryWrite( &size,&src_buff[0],512);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
@ -557,8 +658,11 @@ bool Test4_W()
|
|||||||
bool Test4_V()
|
bool Test4_V()
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy(file_path,"data:/0123456789abcdef");//16文字
|
strcpy(file_path,"data:/");
|
||||||
strcat(file_path,"/0123456789ab.bin");//16文字
|
while(strlen(file_path)<(16+6)){//16文字
|
||||||
|
strcat(file_path,"0");
|
||||||
|
}
|
||||||
|
strcat(file_path,"/123456789abc.bin");//16文字
|
||||||
res = fin.TryInitialize(file_path);
|
res = fin.TryInitialize(file_path);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"Open Fail");
|
drawText(8,100,"Open Fail");
|
||||||
@ -661,7 +765,19 @@ bool Test4_V()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define SIZE_TEST5 (512*100)
|
#define SIZE_TEST5 (512*100)
|
||||||
//生成サイズに満たないデータ
|
#define SIZE_TEST5_HZ 4096
|
||||||
|
#define SIZE_TEST5_START 512*16
|
||||||
|
//SDK3.1はバグで最初のアクセスでOKだと、2回目以降もOKになる
|
||||||
|
//SDK3.x より?:4096単位でハッシュ
|
||||||
|
//先頭はヘッダ2ブロック含むっぽい
|
||||||
|
//ファイル先頭~3071(512*6),3072以降は4096ごと
|
||||||
|
//ハッシュ単位間に書き込むと未書込み部分は0クリアされてる
|
||||||
|
//例)クリエート後に先頭から4096バイト目に512書き込むと、
|
||||||
|
//3072-4095(512*2)、4608-7168(512*5)は未書込みでも
|
||||||
|
//エラーなし0埋めされたデータが読める
|
||||||
|
//尚、クリエート時に先頭512書込ので先頭3072バイトは常に読める
|
||||||
|
|
||||||
|
//生成サイズに満たないデータ..未書込領域
|
||||||
bool Test5_W()
|
bool Test5_W()
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
@ -683,13 +799,15 @@ bool Test5_W()
|
|||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
res = fout.TryInitialize(L"data:/test5.bin",true);
|
res = fout.TryInitialize(L"data:/test5.bin",true);
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
drawText(8,100,"open Fail");
|
drawText(8,100,"open Fail");
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pos =0;
|
pos = SIZE_TEST5_START;
|
||||||
while(1){
|
while(1){
|
||||||
fout.SetPosition(pos);
|
fout.SetPosition(pos);
|
||||||
res = fout.TryWrite( &size,&src_buff[pos],512);
|
res = fout.TryWrite( &size,&src_buff[pos],512);
|
||||||
@ -703,9 +821,10 @@ bool Test5_W()
|
|||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
drawText(10,80,str);
|
drawText(10,80,str);
|
||||||
s_RenderSystem.SwapBuffers();
|
s_RenderSystem.SwapBuffers();
|
||||||
pos += 1024;//512飛ばす
|
pos += SIZE_TEST5_HZ;//間を飛ばす
|
||||||
if (pos >= SIZE_TEST5)break;
|
if (pos >= SIZE_TEST5)break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fout.Finalize();
|
fout.Finalize();
|
||||||
nn::fs::CommitSaveData();
|
nn::fs::CommitSaveData();
|
||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
@ -718,7 +837,8 @@ bool Test5_W()
|
|||||||
|
|
||||||
bool Test5_V()
|
bool Test5_V()
|
||||||
{
|
{
|
||||||
int i,pos;
|
int i;
|
||||||
|
s64 pos;
|
||||||
|
|
||||||
res = fin.TryInitialize(L"data:/test5.bin");
|
res = fin.TryInitialize(L"data:/test5.bin");
|
||||||
if (res.IsFailure()){
|
if (res.IsFailure()){
|
||||||
@ -726,7 +846,7 @@ bool Test5_V()
|
|||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pos =0;
|
pos = SIZE_TEST5_START;
|
||||||
while(1){
|
while(1){
|
||||||
fin.SetPosition(pos);
|
fin.SetPosition(pos);
|
||||||
res = fin.TryRead( &size,&get_buff[pos],512);
|
res = fin.TryRead( &size,&get_buff[pos],512);
|
||||||
@ -736,7 +856,7 @@ bool Test5_V()
|
|||||||
nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sprintf(str,"position %d",pos);
|
sprintf(str,"position %d",(int)pos);
|
||||||
s_RenderSystem.Clear();
|
s_RenderSystem.Clear();
|
||||||
drawText(10,80,str);
|
drawText(10,80,str);
|
||||||
s_RenderSystem.SwapBuffers();
|
s_RenderSystem.SwapBuffers();
|
||||||
@ -746,7 +866,7 @@ bool Test5_V()
|
|||||||
drawText(8,100,"verifi Fail at %d",i);
|
drawText(8,100,"verifi Fail at %d",i);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pos += 1024;//512飛ばす
|
pos += SIZE_TEST5_HZ;//飛ばす
|
||||||
if (pos >= SIZE_TEST5)break;
|
if (pos >= SIZE_TEST5)break;
|
||||||
}
|
}
|
||||||
fin.Finalize();
|
fin.Finalize();
|
||||||
@ -1085,7 +1205,7 @@ void TestMain()
|
|||||||
switch(curs){
|
switch(curs){
|
||||||
case 0:sccs = Test0_W(5);break;
|
case 0:sccs = Test0_W(5);break;
|
||||||
case 1:sccs = Test1_W();break;
|
case 1:sccs = Test1_W();break;
|
||||||
case 2:sccs = Test2_W(680);break;
|
case 2:sccs = Test2_W(test2_ct);break;
|
||||||
case 3:sccs = Test3_W();break;
|
case 3:sccs = Test3_W();break;
|
||||||
case 4:sccs = Test4_W();break;
|
case 4:sccs = Test4_W();break;
|
||||||
case 5:sccs = Test5_W();break;
|
case 5:sccs = Test5_W();break;
|
||||||
@ -1121,7 +1241,7 @@ void TestMain()
|
|||||||
if (sccs == false){
|
if (sccs == false){
|
||||||
fin.Finalize();
|
fin.Finalize();
|
||||||
fout.Finalize();
|
fout.Finalize();
|
||||||
res =nn::fs::Unmount("data:");
|
nn::fs::Unmount("data:");
|
||||||
drawText(8,120,"Failed");
|
drawText(8,120,"Failed");
|
||||||
}
|
}
|
||||||
sprintf(str,"desc %d",res.GetDescription());
|
sprintf(str,"desc %d",res.GetDescription());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user