#
# Crystal Chips BootManager "Boot Menu" PBAT Script v1.2
#
# (c) 2005 Crystal Chips - http://www.crystal-chips.com/
#
# For use only with Crystal Chips hardware and software.
#
# Modification Info:
# This file is unmodified.  If you modify this script and distribute it,
#   please edit this text.  Please do not change the copyright information.
#
# Description:
#
# This script is used by BootManager(BM) to load and execute modules which are
# required by BM, as well as to set up some environmental variables.
# You can modify this script to load additional modules, add new devices, etc.
# on BM startup.
#

#
# Set up some "environmental" variables
#

# Location of BootManager files
SET "BM.BM_PATH" "$PWD$"

# Location of shared IRX modules which are used by multiple applications
SET "BM.SHARED_PATH" "mc0:/BOOT/SHARED"

# These 3 devices are supported by default.
ADDDEV "CDROM" "cdrom0:/BOOT" "CD/DVD ROM"
ADDDEV "MC0" "mc0:/BOOT" "Memory Card Slot 1"
ADDDEV "MC1" "mc1:/BOOT" "Memory Card Slot 2"

# Reboot the IOP if not loaded from host(naplink/ps2link)
IF NOT ISIN "host:" "$PWD$"
    # Reboot the IOP
    REBOOTIOP "rom0:UDNL rom0:EELOADCNF"

    # This is the default "source" path(ie where apps are installed from)
    SET "BM.SRC_PATH" "cdrom0:/BOOT"

    # This is the default "destination" path(ie where apps are installed to, run from, etc)
    SET "BM.DEST_PATH" "mc0:/BOOT"

ELSE
    # Add the "host" device
    ADDDEV "HOST" "host:." "PC HOST:"

    # This is the default "source" path(ie where apps are installed from)
    SET "BM.SRC_PATH" "host:."

    # This is the default "destination" path(ie where apps are installed to, run from, etc)
    SET "BM.DEST_PATH" "mc0:/BOOT"
ENDIF

#
# !! IMPORTANT NOTE !!
#
# BMINIT.PBT *MUST* load these 3 modules!
#

LOADEXEC "IOPELF" "rom0:XSIO2MAN"
LOADEXEC "IOPELF" "rom0:XMCMAN"
LOADEXEC "IOPELF" "rom0:XPADMAN"

#this is just used for debugging...
IF ISIN "host:" "$PWD$"
ENDIF

# Attempt to load USBD.IRX(main USB driver) and USBMASS.IRX(USB harddrive/pendrive driver)
IF NOT FAIL LOADEXEC "IRX" "$BM.SHARED_PATH$/USBD.IRX"
    IF NOT FAIL LOADEXEC "IRX" "$BM.SHARED_PATH$/USBMASS.IRX"

# If both drivers are available install and add USBMASS device to device list
        ADDDEV "USBMASS" "mass:/BOOT" "USB HardDrive or PenDrive."
    ELSE
        ECHO "Failed loading USBMASS.IRX"
    ENDIF
ELSE
    ECHO "Failed loading USBD.IRX"
ENDIF

# Load drivers for HDD/etc here...
