diff --git a/build/debugsoft/Jpeg/SdToPhoto/Makefile b/build/debugsoft/Jpeg/SdToPhoto/Makefile new file mode 100644 index 00000000..3707d142 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/Makefile @@ -0,0 +1,138 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - NandFiler +# File: Makefile +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +SRCS = main.cpp +TARGET_NAME = sd2photo +TWLNMENU_ROOT ?= . + + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = $(TARGET_NAME)$(ROM_SPEC_NAME_PART).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=4S01 \ + Secure=TRUE \ + BannerFile=./banner/banner.bnr \ + NANDAccess=TRUE \ + SDCardAccess=TRUE \ + TitleName=$(TARGET_NAME) + +#------------------------- +#-- CARD, NANDによるオプションの指定 + +TWL_NANDAPP = TRUE + +ifeq ($(APP_TYPE),) +APP_TYPE = CARD +endif + +ifeq ($(APP_TYPE),CARD) +MEDIA = GameCard +SUFFIX = .srl +endif + +ifeq ($(APP_TYPE),NAND) +MEDIA = NAND +SUFFIX = .tad +ROM_SPEC_NAME_PART := $(ROM_SPEC_NAME_PART).nand +endif + +ROM_SPEC_PARAM += Media=$(MEDIA) +TARGET_BIN = $(TARGET_NAME)$(SUFFIX) + +#------------------------- +# 対象拡張子のためのインクルードファイルを決定 +ifneq ($(SUFFIX_DEFINE),) +SUFFIX_FILE = $(SUFFIX_DEFINE) +else +SUFFIX_FILE = default_suffix.h +endif + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#------------------------- +# セキュア用 +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +MAKETAD_OPTION := -s + + +#------------------------- +# ビルドパラメータ +INCDIR = $(TWLSYSTEM_ROOT)/include \ + ./include + + +#------------------------- +# インストール指定 + +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + +#------------------------- +# 対象拡張子のためのインクルードファイルをビルドディレクトリにコピー +.PHONY: suffix + +suffix: + cp $(SUFFIX_FILE) ./include/suffix.h + +#------------------------- +# ビルド +do-build: suffix $(TARGETS) + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +ifdef MAKE_BANNER +$(BINDIR)/$(TARGET_NAME)$(ROM_SPEC_NAME_PART).srl: $(BANNER) +endif + + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr b/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr new file mode 100644 index 00000000..c299ae43 Binary files /dev/null and b/build/debugsoft/Jpeg/SdToPhoto/banner/banner.bnr differ diff --git a/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h b/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h new file mode 100644 index 00000000..9e83a577 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/default_suffix.h @@ -0,0 +1,9 @@ +namespace{ + const char* SUFFIX[] = + { + ".jpg", + ".jpeg", + ".JPG", + ".JPEG", + }; +} \ No newline at end of file diff --git a/build/debugsoft/Jpeg/SdToPhoto/readme.txt b/build/debugsoft/Jpeg/SdToPhoto/readme.txt new file mode 100644 index 00000000..6bdf0cb0 --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/readme.txt @@ -0,0 +1,28 @@ +sd2photo + +*概要 +  SDカード内を走査して、指定した拡張子のファイルを探し、 +  "photo:/"以下へコピーするツールです。 + +*拡張子の指定方法 + コピー対象とする拡張子を記述したファイルをビルド時に指定します。 + 具体的な指定はmake時に下記の変数を渡すことで行ってください。 + + SUFFIX_DEFINE=hoge + + 省略すると、default_suffix.h が指定されます。(".jpg", ".jpeg", ".JPG", "JPEG"に対応します。) + +*操作方法 +  SDカードを挿入した状態でデバッガ等で起動してください。 + (SDを指さずに起動すると画面が赤くなり、SDが挿されるまで待ちます) + +  自動的に、ファイルの検索とコピーが始まります。 +   +  検索、コピー中は、画面の色が緑色になっています。 +  (SDを抜いたり電源を切ったりしないほうが無難です。) +  処理が終わったら青色になります。 + +*仕様 +  ・フォルダ構成をそのままコピーします。例えば、SD上で"/test/aa.jpg"があったとすれば、NAND上で"photo:/test/aa.jpg"が作成されます。 +  ・NAND上に同名のファイルが存在する場合、問答無用に上書きされます。 +  ・残り容量が少ない場合、上書きになる場合でもファイルをコピーできないことがあります。 diff --git a/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp b/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp new file mode 100644 index 00000000..0c5502cc --- /dev/null +++ b/build/debugsoft/Jpeg/SdToPhoto/src/main.cpp @@ -0,0 +1,286 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - NandFiler + File: main.cpp + + Copyright 2008 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include +#include +#include + +#include +#include +#include "suffix.h" + +inline void* operator new(size_t size) { return OS_Alloc(size); } +inline void* operator new[](size_t size) { return OS_Alloc(size); } +inline void operator delete(void* ptr) { OS_Free(ptr); } +inline void operator delete[](void* ptr) { OS_Free(ptr); } + +typedef std::list PathList; + +namespace +{ + void + InitInterrupt(void) + { + OS_EnableIrq(); + OS_EnableInterrupts(); + } + + void + InitAlloc(void) + { + OSHeapHandle hHeap; + void* lo = OS_GetMainArenaLo(); + void* hi = OS_GetMainArenaHi(); + + lo = OS_InitAlloc(OS_ARENA_MAIN, lo, hi, 1); + OS_SetArenaLo(OS_ARENA_MAIN, lo); + + hHeap = OS_CreateHeap(OS_ARENA_MAIN, lo, hi); + SDK_ASSERT( hHeap >= 0 ); + + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); + } +} + + + +static void InitInteruptSystem(); +static void InitFileSystem(); + +static void PickupTargetPath(const char* root, const char* suffix, PathList& out); +static void CopyTarget(const char* to, const char* header, PathList& out); +static void CopyFile(const char* src, const char* dest); + +void +TwlStartUp() +{ + OS_Init(); + InitAlloc(); +} + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数です。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + InitInteruptSystem(); + InitFileSystem(); + + GX_DispOn(); + GXS_DispOn(); + + // SDがささってなかったら刺さるまで待つ + { + FSArchiveResource res; + while(!FS_GetArchiveResource("sdmc:/", &res)) + { + *(u16*)HW_PLTT = static_cast(0x001f); + *(u16*)HW_DB_PLTT = static_cast(0x001f); + } + } + + PathList path; + + for(u32 i = 0; i < sizeof(SUFFIX) / sizeof(char*); ++i) + { + PickupTargetPath("sdmc:/", SUFFIX[i], path); + } + CopyTarget("nand2:/photo", "sdmc:", path); + + + *(u16*)HW_PLTT = 0x001f << 10; + *(u16*)HW_DB_PLTT = 0x001f << 10; + // ランチャーに戻れるように、 終了しない + for (;;) + { + // フレーム更新。 + { + OS_WaitVBlankIntr(); + } + } + + OS_Terminate(); +} + +/*---------------------------------------------------------------------------* + Name: InitInteruptSystem + + Description: 割り込みを初期化します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitInteruptSystem() +{ + // 個別割り込みフラグを全て不許可に + (void)OS_SetIrqMask(0); + + // マスター割り込みフラグを許可に + (void)OS_EnableIrq(); + + // IRQ 割り込みを許可します + (void)OS_EnableInterrupts(); + + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); +} + + +/*---------------------------------------------------------------------------* + Name: InitFileSystem + + Description: FS を初期化して rom にアクセスできるようにします。 + この関数を呼び出す前に InitInteruptSystem() が + 呼ばれている必要があります。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitFileSystem() +{ + // ARM7との通信FIFO割り込み許可 + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); + + // ファイルシステム初期化 + FS_Init( FS_DMA_NOT_USE ); +} + + +static void PickupTargetPath(const char* root, const char* suffix, PathList& out) +{ + FSFile fp; + FSDirectoryEntryInfo fdei; + BOOL result; + + FS_InitFile(&fp); + // ディレクトリのオープン + result = FS_OpenDirectory(&fp, root, NULL); + if(!result) + { + OS_TPrintf("%s: Fail Open\nErrorCode:%d\n", root, FS_GetArchiveResultCode(root)); + return; + } + + while(FS_ReadDirectory(&fp, &fdei)) + { + if(STD_StrCmp(fdei.longname, ".") == 0 || STD_StrCmp(fdei.longname, "..") == 0) + continue; + + OS_TPrintf("%s:\n", fdei.longname); + // ディレクトリなら子を読む + if(fdei.attributes & FS_ATTRIBUTE_IS_DIRECTORY) + { + PickupTargetPath((std::string(root) + fdei.longname + "/").c_str(), suffix, out); + } + else // ファイルならoutに追加 + { + // 拡張子を判定 + if(std::string(fdei.longname).rfind(suffix) + STD_StrLen(suffix) == STD_StrLen(fdei.longname)) + { + out.push_back(std::string(root) + fdei.longname); + } + } + } + + FS_CloseDirectory(&fp); + +} + +static void CopyTarget(const char* to, const char* header, PathList& list) +{ + PathList::iterator itr = list.begin(), end = list.end(); + u16 color = 0; + for(; itr != end; ++itr) + { + std::string dest = std::string(to) + (*itr).substr(static_cast(STD_StrLen(header))); + + CopyFile((*itr).c_str(), dest.c_str()); + color = static_cast((color + 2) & 0x001f); + *(u16*)HW_PLTT = static_cast(color << 5); + *(u16*)HW_DB_PLTT = static_cast(color << 5); + } +} + +static void CopyFile(const char* src, const char* dest) +{ + FSFile sfp, dfp; + BOOL result; + std::string tmp_name = dest; + + tmp_name += "___tmp"; + + OS_TPrintf("Copying %s...", dest); + + // テンポラリファイルにコピー + FS_DeleteFile(tmp_name.c_str()); + result = FS_CreateFileAuto(tmp_name.c_str(), FS_PERMIT_R | FS_PERMIT_W); +// result = FS_CreateFileAuto(dest, FS_PERMIT_R | FS_PERMIT_W); + if(!result) + { + OS_TPrintf("%s:Cant create\n", tmp_name.c_str()); + return; + } + + result = FS_OpenFileEx(&sfp, src, FS_FILEMODE_R); + if(!result) + { + OS_TPrintf("%s:Cant open\n", src); + return; + } + + result = FS_OpenFileEx(&dfp, tmp_name.c_str(), FS_FILEMODE_W); + if(!result) + { + OS_TPrintf("%s:Cant open\n", src); + FS_CloseFile(&sfp); + return; + } + + const u32 BUFSIZE = 4096; + u8 buf[BUFSIZE]; + s32 count = 0; + while((count = FS_ReadFile(&sfp, buf, BUFSIZE)) > 0) + { + s32 write = FS_WriteFile(&dfp, buf, count); + if(write <= 0) + { + OS_TPrintf("Cant Write\n"); + FS_CloseFile(&sfp); + FS_CloseFile(&dfp); + FS_DeleteFile(tmp_name.c_str()); + return; + } + } + + FS_CloseFile(&sfp); + FS_CloseFile(&dfp); + + // テンポラリファイルをリネーム + // すでにファイルが存在するなら削除 + FS_DeleteFileAuto(dest); + FS_RenameFile(tmp_name.c_str(), dest); + + OS_TPrintf("...ok\n"); +} + diff --git a/build/debugsoft/Wireless/WifiIcon/Makefile b/build/debugsoft/Wireless/WifiIcon/Makefile new file mode 100644 index 00000000..abf9410a --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/Makefile @@ -0,0 +1,101 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tools - WiFiIcon +# File: Makefile +# +# Copyright 2008 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Date:: $ +# $Rev$ +# $Author$ +#---------------------------------------------------------------------------- + +override TARGET_PLATFORM = TWL +override TARGET_CODEGEN = ARM +override TWL_ARCHGEN = LIMITED + + +#---------------------------------------------------------------------------- +TARGET_PLATFORM := TWL +TWL_ARCHGEN := LIMITED +SRCS = main.c +TARGET_NAME := WiFiIcon +TARGET_BIN := main.tad +TWLNMENU_ROOT ?= . + +TWL_NANDAPP = TRUE + +#------------------------- +#-- バナーデータを生成します +BANNER = ./banner/banner.bnr +BANNERSRC := $(wildcard ./banner/data/Cell/*.nce) +MAKEBANNER = $(TWL_TOOLSDIR)/bin/makebanner.TWL.exe +BANNERCVTR = $(TWL_TOOLSDIR)/bin/bannercvtr.exe + + +#------------------------- +#-- NAND アプリではいくつかのパラメータの指定のために固有の RSF ファイルが必要です。 + +ROM_SPEC = $(TARGET_NAME).autogen.rsf +ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf +ROM_SPEC_PARAM = MakerCode=01 \ + GameCode=4S02 \ + BannerFile=./banner/banner.bnr \ + TitleName=$(TARGET_NAME) \ + Media=NAND \ + WiFiConnectionIcon=TRUE \ + Secure=TRUE +# DSWirelessIcon=TRUE \ + + + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +#------------------------- +# セキュア用 +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe +MAKETAD_OPTION := -s + + +#------------------------- +# ビルドパラメータ +INCDIR = $(TWLSYSTEM_ROOT)/include \ + ./include + +#------------------------- +# インストール指定 +ifneq ($(TWL_IPL_RED_ROOT),) +INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME) +INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN) +endif + + +#------------------------- +# ビルド +do-build: $(TARGETS) + +#------------------------- +#-- SRL を作成する前にバナーが作成されるようにします。 + +#ifdef MAKE_BANNER +#$(BINDIR)/$(TARGET_NAME)$(ROM_SPEC_NAME_PART).srl: $(BANNER) +#endif + +#------------------------- +#-- バナー作成用ターゲット + +$(BANNER): $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) + $(MAKEBANNER) -A $(BANNER:.bnr=.bin) $(BANNER:.bnr=.bsf) $@ + +$(BANNER:.bnr=.bin): $(BANNERSRC) + $(BANNERCVTR) -o $@ $< + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr b/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr new file mode 100644 index 00000000..2a5447a2 Binary files /dev/null and b/build/debugsoft/Wireless/WifiIcon/banner/banner.bnr differ diff --git a/build/debugsoft/Wireless/WifiIcon/readme.txt b/build/debugsoft/Wireless/WifiIcon/readme.txt new file mode 100644 index 00000000..4f4ce4e8 --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/readme.txt @@ -0,0 +1,6 @@ +WiFiIcon + +*概要 +  WiFiアイコン確認用のアプリ。 +  WiFiアイコンのフラグをオンにしてビルドされます。 +  アプリ自身の機能はありません。 diff --git a/build/debugsoft/Wireless/WifiIcon/src/main.c b/build/debugsoft/Wireless/WifiIcon/src/main.c new file mode 100644 index 00000000..5d509820 --- /dev/null +++ b/build/debugsoft/Wireless/WifiIcon/src/main.c @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tools - WiFiIcon + File: main.c + + Copyright 2008 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ +#include + +static void InitInterrupt(void) +{ + OS_EnableIrq(); + OS_EnableInterrupts(); +} + +static void InitAlloc(void) +{ + OSHeapHandle hHeap; + void* lo = OS_GetMainArenaLo(); + void* hi = OS_GetMainArenaHi(); + + lo = OS_InitAlloc(OS_ARENA_MAIN, lo, hi, 1); + OS_SetArenaLo(OS_ARENA_MAIN, lo); + + hHeap = OS_CreateHeap(OS_ARENA_MAIN, lo, hi); + SDK_ASSERT( hHeap >= 0 ); + + OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); +} + +static void InitInteruptSystem(); + + +void +TwlStartUp() +{ + OS_Init(); + InitAlloc(); +} + + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: メイン関数です。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +void TwlMain(void) +{ + InitInteruptSystem(); + + GX_DispOn(); + GXS_DispOn(); + + *(u16*)HW_PLTT = 0x001f << 10; + *(u16*)HW_DB_PLTT = 0x001f << 10; + // ランチャーに戻れるように、 終了しない + for (;;) + { + // フレーム更新。 + { + OS_WaitVBlankIntr(); + } + } + + OS_Terminate(); +} + + +/*---------------------------------------------------------------------------* + Name: InitInteruptSystem + + Description: 割り込みを初期化します。 + + Arguments: なし。 + + Returns: なし。 + *---------------------------------------------------------------------------*/ +static void InitInteruptSystem() +{ + // 個別割り込みフラグを全て不許可に + (void)OS_SetIrqMask(0); + + // マスター割り込みフラグを許可に + (void)OS_EnableIrq(); + + // IRQ 割り込みを許可します + (void)OS_EnableInterrupts(); + + (void)OS_EnableIrqMask(OS_IE_SPFIFO_RECV); +}