#!/usr/bin/env 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. # ############################################################################### if [ "$_" = "$0" ] then echo "$(basename $0): Error! I can't be run as a script." echo echo "Please run as:" echo " source $(basename $0) $@" echo " - or -" echo " . $(basename $0) $@" echo exit 1 fi # Run setbridgeconfig to update INI file setbridgeconfig.exe "$@" if [ $? != 0 ] then # Something went wrong; setbridgeconfig should have # issued an error message, so let's just die here. return 1 fi # Find bridge name ==> first argument that's not an option (something starting with a dash) unset bridge_name unset is_default for arg do if [ "${arg:0:1}" != "-" -a -z "$bridge_name" ] then bridge_name=$arg fi if [ "$arg" = "-default" ] then is_default=" (and default)" fi done # Parse bridge_env.ini file, looking for $bridge_name OLD_IFS=$IFS IFS="=" while read name ipaddr do if [ "$name" = "${name#BRIDGE_NAME_}" ] then # It's not a bridge/IP line continue fi # Remove the "BRIDGE_NAME_" prefix name=${name#BRIDGE_NAME_} # If we've found the $bridge_name, save off the IP address if [ "$name" == "$bridge_name" ] then bridge_ipaddr=$ipaddr fi done < "${APPDATA}/bridge_env.ini" # Set variables if [ -z "$bridge_ipaddr" ] then # Must've deleted a bridge with "-d" option... # TODO: Should I clear the BRIDGE_CURRENT_* variables, or set them to # the default bridge, if we cleared the current session's bridge? echo "Cleared stored IP address for $bridge_name (current environment unchanged)." else echo "Setting hostbridge for current session$is_default to $bridge_name $bridge_ipaddr." export BRIDGE_CURRENT_NAME=$bridge_name export BRIDGE_CURRENT_IP_ADDRESS=$bridge_ipaddr fi IFS=$OLD_IFS unset arg is_default name ipaddr bridge_name bridge_ipaddr OLD_IFS if [ "$SESSION_MANAGER" == "1" ] then export SESSION_NAME=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p NAME` export SESSION_DEBUG_OUT_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p DEBUG_OUT` export SESSION_DEBUG_CONTROL_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p DEBUG_CONTROL` export SESSION_HIO_OUT_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p HIO_OUT` export SESSION_LAUNCH_CTRL_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p LAUNCH_CTRL` export SESSION_NET_MANAGE_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p NET_MANAGE` export SESSION_PCFS_SATA_PORT=`"$MION_BRIDGE_TOOLS/SessionManagerUtil.exe" -p PCFS_SATA` export SESSION_PATH_PREFIX=${SESSION_NAME}_ export CAFE_DATA_DIR=$CAFE_ROOT/${SESSION_PATH_PREFIX}data export CAFE_CONTENT_DIR=$CAFE_DATA_DIR/disc/content export CAFE_META_DIR=$CAFE_DATA_DIR/disc/meta export CAFE_SAVE_DIR=$CAFE_DATA_DIR/save export CAFE_SLC_DIR=$CAFE_DATA_DIR/slc export CAFE_MLC_DIR=$CAFE_DATA_DIR/mlc export CAFE_DATA_TMP=$CAFE_DATA_DIR/tmp # Updates the window title source $CAFE_ROOT/system/bin/tool/cafe_profile.sh fi