#!/bin/bash ############################################################################### # # Copyright (C) 2009-2013 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. # ############################################################################### BIN_DIR=${CAFE_ROOT}/system/bin RPX_NAME="content_dump.rpx" RPX_CATEGORY="app" DEBUG_FLG="" RPX_DBG_DIR="${RPX_CATEGORY}/${RPX_NAME%.rpx}/DEBUG" RPX_DBG="${RPX_CATEGORY}/${RPX_NAME%.rpx}/DEBUG/${RPX_NAME}" RPX_NDBG_DIR="${RPX_CATEGORY}/${RPX_NAME%.rpx}/NDEBUG" RPX_NDBG="${RPX_CATEGORY}/${RPX_NAME%.rpx}/NDEBUG/${RPX_NAME}" if [ -f ${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/${RPX_NDBG} ]; then RPX_DIR=${RPX_NDBG_DIR} RPX=${RPX_NDBG} elif [ -f ${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/${RPX_DBG} ]; then RPX_DIR=${RPX_DBG_DIR} RPX=${RPX_DBG} DEBUG_FLG="-b" else echo "Error: Could not find ${RPX_NAME}" fi DEFAULT_APP_XML=${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/boot/app_default.xml APP_XML=${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/${RPX_DIR}/app.xml usage() { cat < (ex. $(basename $0) -v -d usb -o c:/cygwin/temp -t 0005000011000000) Dump the content directory to your PC from the application in NAND memory on CAT-DEV or USB storage device. Dumped files is stored in the directory called "/c_". Options: -d : [Device where the target title is installed]. "usb" or "nand" can be used. If omitted, the application use "nand". -o : [The path for the output directory]. Both Cygpath and Windows path expressions can be used. If omitted, use \$CAFE_ROOT as the output path. -t : [The title ID to be dumped]. the title ID is represented by 16 hexadecimal digits. This option must be set to use this tool. -v : [Enable to verify copied files]. This feature is disabled by default. -h : Show this help. EOF } ENABLE_VERIFY=0 DEV_TYPE="nand" DEST_PATH=${CAFE_ROOT} TITLE_ID= while getopts "d:o:t:vh" opt; do case $opt in d ) DEV_TYPE=${OPTARG} ;; o ) DEST_PATH=${OPTARG} ;; t ) TITLE_ID=${OPTARG} ;; v ) ENABLE_VERIFY=1 ;; h ) usage exit 1 ;; \? ) usage exit 1 ;; esac done if [ -z ${TITLE_ID} ]; then usage exit 1 else TITLE_ID=`echo ${TITLE_ID} | sed -e "s/0x//g" | tr "[A-Z]" "[a-z]"` echo "Updating ${APP_XML} with title ID(${TITLE_ID})..." cat ${DEFAULT_APP_XML} | \ sed -e "s|\(\)\(.*\)\(\)|\1${TITLE_ID}\3|" | \ sed -e "s|\(\)\(.*\)\(\)|\12000\3|" > ${APP_XML} fi if [ `echo ${DEST_PATH} | grep -ir c:/cygwin` ]; then DEST_PATH=`echo ${DEST_PATH} | sed -e "s/c:\/cygwin/\/cygdrive\/c\/cygwin/g"` fi DEST_HFIO_PATH=`cygpath -a ${DEST_PATH} | sed -e "s/\/cygdrive\///g"` DEV_TYPE=`echo ${DEV_TYPE} | sed -e "s/0x//g" | tr "[A-Z]" "[a-z]" | sed -e "s/\"//g"` echo "caferun ${DEBUG_FLG} ${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/${RPX} ${ENABLE_VERIFY} ${DEST_HFIO_PATH} ${DEV_TYPE}" caferun ${DEBUG_FLG} ${BIN_DIR}/${TOOLCHAIN}/${PLATFORM}/${RPX} ${ENABLE_VERIFY} ${DEST_HFIO_PATH} ${DEV_TYPE} cafestop