mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
UTL_FileRecoveryライブラリ、およびFileRecoveryTestの追加。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1856 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
be575500b1
commit
60b6dedb8c
@ -27,8 +27,9 @@ TWL_PROC = ARM9
|
|||||||
SRCDIR = src
|
SRCDIR = src
|
||||||
SRCS = util.c \
|
SRCS = util.c \
|
||||||
masterkey.c \
|
masterkey.c \
|
||||||
util_menuAppManager.c
|
util_menuAppManager.c \
|
||||||
|
util_recoveryFile.c
|
||||||
|
#SRCS = util_recoveryFile.c
|
||||||
|
|
||||||
TARGET_LIB = libsysmutil$(TWL_LIBSUFFIX).a
|
TARGET_LIB = libsysmutil$(TWL_LIBSUFFIX).a
|
||||||
|
|
||||||
|
|||||||
200
build/libraries_sysmenu/util/ARM9/src/util_recoveryFile.c
Normal file
200
build/libraries_sysmenu/util/ARM9/src/util_recoveryFile.c
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlIPL
|
||||||
|
File: util_recoveryFile.h
|
||||||
|
|
||||||
|
Copyright **** 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 <twl.h>
|
||||||
|
#include <sysmenu/util_recoveryFile.h>
|
||||||
|
|
||||||
|
typedef enum CheckStatus {
|
||||||
|
CHECK_EXIST = 0,
|
||||||
|
CHECK_CREATE = 1,
|
||||||
|
CHECK_FAILED = 2
|
||||||
|
} CheckStatus;
|
||||||
|
|
||||||
|
CheckStatus UTL_CheckAndCreateDirectory( const char *path );
|
||||||
|
CheckStatus UTL_CheckAndCreateDirectoryRec( const char *path );
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: UTL_RecoveryFile
|
||||||
|
|
||||||
|
Description: この関数は受け取ったパスにあるファイルをチェックします。
|
||||||
|
対象のファイルが存在してサイズが等しければ何もしません。
|
||||||
|
サイズが異なった場合は指定サイズに変更を行い、
|
||||||
|
ファイルが存在しなければ作成したうえで、サイズ設定を行います。
|
||||||
|
|
||||||
|
Arguments: path: チェックを行うファイルのパス
|
||||||
|
filesize: 対象ファイルのサイズ
|
||||||
|
|
||||||
|
Returns: ファイルが存在し、サイズも適正な場合は場合はUTL_RCV_OKを、
|
||||||
|
サイズが異なり、変更した場合はUTL_RCV_SIZE_CHANGEDを、
|
||||||
|
ファイルが存在せず、作成した場合はUTL_RCV_FILE_CREATED、
|
||||||
|
ファイル作成に失敗した場合はUTL_RCV_FAILEDを返します。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
UTL_RecoveryStatus UTL_RecoveryFile( const char* path, const u32 filesize )
|
||||||
|
{
|
||||||
|
FSFile file;
|
||||||
|
BOOL openRes;
|
||||||
|
|
||||||
|
if( !FS_IsAvailable() )
|
||||||
|
{
|
||||||
|
// FSがInitされてなかったらInitする
|
||||||
|
FS_Init( FS_DMA_NOT_USE );
|
||||||
|
}
|
||||||
|
|
||||||
|
FS_InitFile( &file );
|
||||||
|
|
||||||
|
if( UTL_CheckAndCreateDirectoryRec( path ) == CHECK_FAILED )
|
||||||
|
{
|
||||||
|
// ファイルに至るまでのディレクトリを作成できなかった。
|
||||||
|
return UTL_RCV_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (openRes = FS_OpenFileEx( &file, path, FS_FILEMODE_RWL )) == TRUE )
|
||||||
|
{
|
||||||
|
if (FS_GetFileLength( &file ) == filesize )
|
||||||
|
{
|
||||||
|
// ファイルが存在してサイズが合ってれば何も言わない
|
||||||
|
return UTL_RCV_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ファイルが存在しないので作成する
|
||||||
|
if( (!openRes) && !FS_CreateFile( path, FS_PERMIT_R | FS_PERMIT_W ) )
|
||||||
|
{
|
||||||
|
OS_TPrintf("UTL RecoveryFile Error: FS_CreateFile() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) );
|
||||||
|
// ファイル作成に失敗
|
||||||
|
return UTL_RCV_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ファイル作成に成功
|
||||||
|
if( !FS_OpenFileEx( &file, path, FS_FILEMODE_RW ) )
|
||||||
|
{
|
||||||
|
// 作成したファイルをopenできなかった場合
|
||||||
|
OS_TPrintf("UTL RecoveryFile Error: FS_OpenFileEx() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) );
|
||||||
|
return UTL_RCV_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( FS_SetFileLength( &file, filesize ) != FS_RESULT_SUCCESS )
|
||||||
|
{
|
||||||
|
// 作成したファイルのサイズを設定できなかった
|
||||||
|
OS_TPrintf(" UTL RecoveryFile Error: FS_SetFileLength() failed. FSResult: %d\n", FS_GetArchiveResultCode(path) );
|
||||||
|
FS_CloseFile( &file );
|
||||||
|
return UTL_RCV_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return openRes ? UTL_RCV_SIZE_CHANGED : UTL_RCV_FILE_CREATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: UTL_CheckAndCreateDirectoryRec
|
||||||
|
|
||||||
|
Description: 該当パスに到達するまでのディレクトリを再起的にチェックし、
|
||||||
|
存在しないディレクトリの場合は全て作成します。
|
||||||
|
パスの最後が'/'なら最後までディレクトリして扱い、
|
||||||
|
そうでない場合は最後をファイル名とし、'/'の手前に記述された
|
||||||
|
ディレクトリまでをチェックします。
|
||||||
|
|
||||||
|
Arguments: path: チェックを行うパス
|
||||||
|
|
||||||
|
Returns: ディレクトリが最後まで存在した場合はCHECK_EXISTを、
|
||||||
|
存在しておらず作成し、最後まで成功した場合はCHECK_CREATEを、
|
||||||
|
途中でディレクトリ作成に失敗した場合はCHECK_FAILEDを返します。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
CheckStatus UTL_CheckAndCreateDirectoryRec( const char *path )
|
||||||
|
{
|
||||||
|
BOOL createFlag = FALSE;
|
||||||
|
char subPath[FS_FILE_NAME_MAX];
|
||||||
|
char *p;
|
||||||
|
int pathLength = STD_StrLen( path );
|
||||||
|
|
||||||
|
p = STD_StrChr( path, '/');
|
||||||
|
|
||||||
|
while( p != NULL )
|
||||||
|
// スラッシュが出てこなくなるまで続ける
|
||||||
|
{
|
||||||
|
CheckStatus result;
|
||||||
|
|
||||||
|
// 次のスラッシュまでの部分文字列を作る
|
||||||
|
int slashPos = pathLength - STD_StrLen( p );
|
||||||
|
STD_StrLCpy( subPath, path, slashPos+1 );
|
||||||
|
subPath[slashPos+1] = '\0';
|
||||||
|
|
||||||
|
result = UTL_CheckAndCreateDirectory( subPath );
|
||||||
|
|
||||||
|
switch( result )
|
||||||
|
{
|
||||||
|
case CHECK_FAILED:
|
||||||
|
// 失敗したらそこで終わり
|
||||||
|
return result;
|
||||||
|
case CHECK_CREATE:
|
||||||
|
createFlag = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = STD_StrChr( ++p, '/' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return createFlag ? CHECK_CREATE : CHECK_EXIST;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: UTL_CheckAndCreateDirectory
|
||||||
|
|
||||||
|
Description: この関数は該当ディレクトリが存在していれば何もしません。
|
||||||
|
該当ディレクトリが存在していなかった場合は
|
||||||
|
ディレクトリを作成します。
|
||||||
|
|
||||||
|
Arguments: path: チェックを行うディレクトリのパス
|
||||||
|
|
||||||
|
Returns: ディレクトリが存在した場合はCHECK_EXISTを、
|
||||||
|
存在しておらず作成した場合はCHECK_CREATEを、
|
||||||
|
ディレクトリ作成に失敗した場合はCHECK_FAILEDを返します。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
CheckStatus UTL_CheckAndCreateDirectory( const char *path )
|
||||||
|
{
|
||||||
|
FSFile dir;
|
||||||
|
|
||||||
|
FS_InitFile( &dir );
|
||||||
|
|
||||||
|
if( FS_OpenDirectory( &dir, path, FS_FILEMODE_RW ) )
|
||||||
|
{
|
||||||
|
// ディレクトリが存在していたらそのままCloseして戻る
|
||||||
|
FS_CloseDirectory( &dir );
|
||||||
|
return CHECK_EXIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ディレクトリが存在しないのでディレクトリを作成
|
||||||
|
if( ! FS_CreateDirectory( path, FS_PERMIT_R | FS_PERMIT_W ) )
|
||||||
|
{
|
||||||
|
OS_TPrintf("EL Error: FS_CreateDirectory() failed. path: %s FSResult: %d\n", path, FS_GetArchiveResultCode(path) );
|
||||||
|
// ディレクトリ作成に失敗
|
||||||
|
return CHECK_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ディレクトリ作成に成功
|
||||||
|
OS_TPrintf("EL createDirectory succeeded. : %s\n", path );
|
||||||
|
return CHECK_CREATE;
|
||||||
|
}
|
||||||
43
build/tests/FileRecoveryTest/Makefile
Normal file
43
build/tests/FileRecoveryTest/Makefile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlIPL - tests - FileRecoveryTest
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright **** 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:$
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
SUBDIRS = $(TWL_IPL_RED_ROOT)/build/libraries_sysmenu/util/
|
||||||
|
|
||||||
|
TARGET_FIRM = SYSTEMMENU
|
||||||
|
TARGET_PLATFORM = TWL
|
||||||
|
TWL_ARCHGEN = LIMITED
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET_BIN = main.srl
|
||||||
|
|
||||||
|
SRCS = main.c
|
||||||
|
|
||||||
|
LLIBRARIES += libsysmutil$(TWL_LIBSUFFIX).a
|
||||||
|
|
||||||
|
ROM_SPEC = main.rsf
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/commondefs
|
||||||
|
MAKEROM = $(TWL_TOOLSDIR)/bin/makerom.TWL.secure.exe
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
do-build: $(TARGETS)
|
||||||
|
|
||||||
|
include $(TWL_IPL_RED_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
269
build/tests/FileRecoveryTest/main.rsf
Normal file
269
build/tests/FileRecoveryTest/main.rsf
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlSDK - include
|
||||||
|
# File: ROM-TS.rsf
|
||||||
|
#
|
||||||
|
# Copyright 2007 Nintendo. All rights reserved.
|
||||||
|
#
|
||||||
|
# These coded insructions, 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$
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# TWL ROM SPEC FILE
|
||||||
|
#
|
||||||
|
|
||||||
|
Arm9
|
||||||
|
{
|
||||||
|
Static "$(MAKEROM_ARM9:r).TWL.FLX.sbin$(COMPSUFFIX9)"
|
||||||
|
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.FLX.sbin$(COMPSUFFIX9)"
|
||||||
|
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.FLX.sbin$(COMPSUFFIX9)"
|
||||||
|
Elf "$(MAKEROM_ARM9:r).tef"
|
||||||
|
}
|
||||||
|
|
||||||
|
Arm7
|
||||||
|
{
|
||||||
|
Static "$(MAKEROM_ARM7_BASE:r).TWL.FLX.sbin$(COMPSUFFIX7)"
|
||||||
|
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.FLX.sbin$(COMPSUFFIX7)"
|
||||||
|
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.FLX.sbin$(COMPSUFFIX7)"
|
||||||
|
Elf "$(MAKEROM_ARM7_BASE:r).tef"
|
||||||
|
}
|
||||||
|
|
||||||
|
Arm9.Ltd
|
||||||
|
{
|
||||||
|
Static "$(MAKEROM_ARM9:r).TWL.LTD.sbin$(COMPSUFFIX9)"
|
||||||
|
OverlayDefs "$(MAKEROM_ARM9:r)_defs.TWL.LTD.sbin$(COMPSUFFIX9)"
|
||||||
|
OverlayTable "$(MAKEROM_ARM9:r)_table.TWL.LTD.sbin$(COMPSUFFIX9)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Arm7.Ltd
|
||||||
|
{
|
||||||
|
Static "$(MAKEROM_ARM7_BASE:r).TWL.LTD.sbin$(COMPSUFFIX7)"
|
||||||
|
OverlayDefs "$(MAKEROM_ARM7_BASE:r)_defs.TWL.LTD.sbin$(COMPSUFFIX7)"
|
||||||
|
OverlayTable "$(MAKEROM_ARM7_BASE:r)_table.TWL.LTD.sbin$(COMPSUFFIX7)"
|
||||||
|
}
|
||||||
|
|
||||||
|
Property
|
||||||
|
{
|
||||||
|
###
|
||||||
|
### Settings for FinalROM
|
||||||
|
###
|
||||||
|
#### BEGIN
|
||||||
|
#
|
||||||
|
# TITLE NAME: Your product name within 12bytes
|
||||||
|
#
|
||||||
|
#TitleName "MY APP NAME"
|
||||||
|
|
||||||
|
#
|
||||||
|
# MAKER CODE: Your company ID# in 2 ascii words
|
||||||
|
# issued by NINTENDO
|
||||||
|
#
|
||||||
|
#MakerCode "00"
|
||||||
|
|
||||||
|
#
|
||||||
|
# REMASTER VERSION: Mastering version
|
||||||
|
#
|
||||||
|
#RomVersion 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# ROM SPEED TYPE: [MROM/1TROM/UNDEFINED]
|
||||||
|
#
|
||||||
|
RomSpeedType $(MAKEROM_ROMSPEED)
|
||||||
|
|
||||||
|
#
|
||||||
|
# ROM SIZE: in bit [64M/128M/256M/512M/1G/2G]
|
||||||
|
#
|
||||||
|
#RomSize 128M
|
||||||
|
#RomSize 256M
|
||||||
|
|
||||||
|
#
|
||||||
|
# ROM PADDING: TRUE if finalrom
|
||||||
|
#
|
||||||
|
#RomFootPadding TRUE
|
||||||
|
|
||||||
|
#
|
||||||
|
# ROM HEADER TEMPLATE: Provided to every product by NINTENDO
|
||||||
|
#
|
||||||
|
#RomHeaderTemplate ./etc/rom_header.template.sbin
|
||||||
|
|
||||||
|
#
|
||||||
|
# BANNER FILE: generated from Banner Spec File
|
||||||
|
#
|
||||||
|
#BannerFile ./etc/myGameBanner.bnr
|
||||||
|
BannerFile $(TWLSDK_ROOT)/include/twl/specfiles/default.bnr
|
||||||
|
|
||||||
|
#
|
||||||
|
# Permit LandingNormalJump: for TWL "ApplicationJump" function [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#PermitLandingNormalJump FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Permit LandingTmpJump: for TWL "ApplicationJump" function [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#PermitLandingTmpJump FALSE
|
||||||
|
|
||||||
|
###
|
||||||
|
### Setting for TWL
|
||||||
|
###
|
||||||
|
|
||||||
|
#
|
||||||
|
# ROM HEADER Ltd: Provided to every product by NINTENDO
|
||||||
|
#
|
||||||
|
RomHeaderLtd $(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin
|
||||||
|
|
||||||
|
#
|
||||||
|
# Digest parameters:
|
||||||
|
#
|
||||||
|
DigestParam 1024 32
|
||||||
|
|
||||||
|
#
|
||||||
|
# WRAM mapping: [MAP_BB_HYB/MAP_BB_LTD/MAP_TS_HYB/MAP_TS_LTD
|
||||||
|
# MAP2_BB_HYB/MAP2_BB_LTD/MAP2_TS_HYB/MAP2_TS_LTD]
|
||||||
|
# don't have to edit
|
||||||
|
#
|
||||||
|
WramMapping $(MAKEROM_WRAM_MAPPING)
|
||||||
|
|
||||||
|
#
|
||||||
|
# CardRegion: card region [Japan/America/Europe/Australia/China/Korea]
|
||||||
|
#
|
||||||
|
CardRegion ALL
|
||||||
|
|
||||||
|
#
|
||||||
|
# SDCardAccess: sd card access control [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#SDCardAccess FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# NANDAccess: NAND access control [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#NANDAccess FALSE
|
||||||
|
NANDAccess TRUE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Codec mode:
|
||||||
|
# don't have to edit
|
||||||
|
#
|
||||||
|
CodecMode $(MAKEROM_CODEC_MODE)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disp WiFiConnection Icon for Launcher [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#WiFiConnectionIcon FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disp DSWireless Icon for Launcher [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#DSWirelessIcon FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Disable debug [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
DisableDebug FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Agree EULA [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#AgreeEULA FALSE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Agree EULA version [0 - 255]
|
||||||
|
#
|
||||||
|
#AgreeEULAVersion 0
|
||||||
|
|
||||||
|
###
|
||||||
|
#### END
|
||||||
|
}
|
||||||
|
|
||||||
|
AppendProperty
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Boot allowed Media: [GameCard]
|
||||||
|
#
|
||||||
|
Media NAND
|
||||||
|
|
||||||
|
#
|
||||||
|
# GameCode for TitleID : Your GameCode in 4 ascii words
|
||||||
|
#
|
||||||
|
#GameCode ABCJ
|
||||||
|
|
||||||
|
#
|
||||||
|
# Public save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
|
||||||
|
#
|
||||||
|
#PublicSaveDataSize 0K
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Private save data size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
|
||||||
|
#
|
||||||
|
#PrivateSaveDataSize 0K
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enable SubBannerFile
|
||||||
|
#SubBannerFile TRUE
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use Shared2 file index: [0-65535]
|
||||||
|
#Shared2FileIndex 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use Shared2 file size: [0K/16K/32K/64K/128K/256K/512K/1M/2M/4M]
|
||||||
|
#Shared2FileSize 0K
|
||||||
|
|
||||||
|
#
|
||||||
|
# Game card power on: [TRUE/FALSE]
|
||||||
|
#
|
||||||
|
#GameCardOn FALSE
|
||||||
|
|
||||||
|
Secure TRUE
|
||||||
|
AppType System
|
||||||
|
}
|
||||||
|
|
||||||
|
RomSpec
|
||||||
|
{
|
||||||
|
Offset 0x00000000
|
||||||
|
Segment ALL
|
||||||
|
HostRoot $(TWL_IPL_RED_ROOT)/build/systemMenu_RED/data
|
||||||
|
Root /data
|
||||||
|
File NTR_IPL_font_m.NFTR
|
||||||
|
}
|
||||||
|
|
||||||
|
Rating
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Permited age to play for each rating organization [0 - 31, ALWAYS, FREE]
|
||||||
|
#
|
||||||
|
# Supported organization
|
||||||
|
# - CERO (OGN0) : for Japan
|
||||||
|
# - ESRB (OGN1) : for North America
|
||||||
|
# - BBFC (OGN2) : obsolete organization
|
||||||
|
# - USK (OGN3) : for German
|
||||||
|
# - PEGI_GEN (OGN4) : for Europe
|
||||||
|
# - PEGI_FINLAND (OGN5) : obsolete organization
|
||||||
|
# - PEGI_PRT (OGN6) : for Portugal
|
||||||
|
# - PEGI_BBFC (OGN7) : for UK
|
||||||
|
# - OFLC (OGN8) : for Australia and NewZealand
|
||||||
|
# - GRB (OGN9) : for Korea
|
||||||
|
# - OGN10 : reserved
|
||||||
|
# - OGN11 : reserved
|
||||||
|
# - OGN12 : reserved
|
||||||
|
# - OGN13 : reserved
|
||||||
|
# - OGN14 : reserved
|
||||||
|
# - OGN15 : reserved
|
||||||
|
#
|
||||||
|
# Available age [ 0 - 31 / ALWAYS / FREE ]
|
||||||
|
|
||||||
|
CERO FREE
|
||||||
|
# ESRB FREE
|
||||||
|
# USK FREE
|
||||||
|
# PEGI_GEN FREE
|
||||||
|
# PEGI_PRT FREE
|
||||||
|
# PEGI_BBFC FREE
|
||||||
|
# OFLC FREE
|
||||||
|
# GRB FREE
|
||||||
|
}
|
||||||
51
build/tests/FileRecoveryTest/src/main.c
Normal file
51
build/tests/FileRecoveryTest/src/main.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlIPL
|
||||||
|
File: util_recoveryFile.h
|
||||||
|
|
||||||
|
Copyright **** 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 <twl.h>
|
||||||
|
#include <sysmenu/util_recoveryFile.h>
|
||||||
|
|
||||||
|
|
||||||
|
void VBlankIntr(void);
|
||||||
|
|
||||||
|
void TwlMain( void )
|
||||||
|
{
|
||||||
|
char path[] = "nand:/shared2/a/b/c/d/hogehoge.dat";
|
||||||
|
UTL_RecoveryStatus result;
|
||||||
|
|
||||||
|
OS_Init();
|
||||||
|
|
||||||
|
//---- interrupt setting
|
||||||
|
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||||
|
OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||||
|
OS_EnableIrq();
|
||||||
|
GX_VBlankIntr(TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
// とりあえずファイルサイズに4KB指定
|
||||||
|
result = UTL_RecoveryFile( path, 0x1000 );
|
||||||
|
|
||||||
|
OS_TPrintf("recovery result: %d\n", result);
|
||||||
|
OS_TPrintf( "*** End of demo\n" );
|
||||||
|
OS_Terminate();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void VBlankIntr(void)
|
||||||
|
{
|
||||||
|
OS_SetIrqCheckFlag(OS_IE_V_BLANK);
|
||||||
|
}
|
||||||
33
include/sysmenu/util_recoveryFile.h
Normal file
33
include/sysmenu/util_recoveryFile.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlIPL
|
||||||
|
File: util_recoveryFile.h
|
||||||
|
|
||||||
|
Copyright **** 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:$
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __UTIL_RECOVERY_FILE__
|
||||||
|
#define __UTIL_RECOVERY_FILE__
|
||||||
|
|
||||||
|
#include <twl.h>
|
||||||
|
|
||||||
|
typedef enum UTL_RecoveryStatus{
|
||||||
|
UTL_RCV_OK = 0,
|
||||||
|
UTL_RCV_SIZE_CHANGED,
|
||||||
|
UTL_RCV_FILE_CREATED,
|
||||||
|
UTL_RCV_FAILED
|
||||||
|
} UTL_RecoveryStatus;
|
||||||
|
|
||||||
|
/*-- function prototype -------------------------*/
|
||||||
|
extern UTL_RecoveryStatus UTL_RecoveryFile( const char* path, const u32 filesize );
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user