All pastes #1460054 Raw Edit

Mine

public shellscript v1 · immutable
#1460054 ·published 2009-06-14 15:25 UTC
rendered paste body
#!/bin/sh# Configuration optionsPURESTART=8323072               # Start offsetROMSTART=2961113088             # Start offset + 0xB??????? prefixROM="./MARIO64.Z64"             # ROM fileROM_MODEL="./MARIO-MODEL.Z64"   # Unmodified ROM fileBINDIR="./bin"#### Prerequisites### Create a clean copy of our ROMcp ${ROM_MODEL} ${ROM}#### Checks### Check for `f2c`if [ ! -f ./f2c ]then    echo "Can't find \"f2c\" binary."    exit 1fi# Check for `putbin`if [ ! -f ./putbin ]then    echo "Can't find \"putbin\" binary."    exit 1fi#### User binary### Build user binarymake -C ${BINDIR}# Error checking...if [ "$?" != 0 ]then        echo "Problem building binary."        exit 1fi#### Stage 2### Copy the game's entry point to be replaceddd if=${ROM} bs=1 skip=4096 count=1024 | ./f2c entry_point > stage2/game-ep.c# Move user binary to stage2cp -vf ${BINDIR}/bin.a ./stage2/bin.a# Clean & buildmake -C stage2 cleanmake -C stage2# Error checkingif [ "$?" != 0 ]then        echo "Problem building stage2."        exit 1fi#### Stage 1### Get filesize of stage 2 binarySTAGE2SIZE=`stat --printf="%s" stage2/nbl-stage2.bin`# Calculate ROM ending addressROMEND=`echo ${ROMSTART} ${STAGE2SIZE} + p | dc`# Generate config.hrm -fv ./stage1/config.hecho "#ifndef __N64BL_CONF_H__" >> ./stage1/config.hecho "#define __N64BL_CONF_H__" >> ./stage1/config.hecho "#define BL_STACK_TMP      0x807FFFF0" >> ./stage1/config.hecho "#define BL_ROM_START      `printf "0x%08X" ${ROMSTART}`" >> ./stage1/config.hecho "#define BL_ROM_END        `printf "0x%08X" ${ROMEND}`" >> ./stage1/config.hecho "#define BL_RAM_START      0xA0400000" >> ./stage1/config.hecho "#endif /* __N64BL_CONF_H__ */" >> ./stage1/config.h# Clean & buildmake -C stage1 cleanmake -C stage1#### Finishing touches### Copy the binaries to their respective locations./putbin ./stage1/nbl-stage1.bin ${ROM} 1000./putbin ./stage2/nbl-stage2.bin ${ROM} `printf "%08X" ${PURESTART}`# Fix the ROM CRCucon64 --n64 --chk ${ROM}