2015-09-01 15:00:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
RARCH_VERSION=1.2.2
|
|
|
|
PLATFORM=$1
|
2015-09-01 15:31:34 +00:00
|
|
|
SALAMANDER=no
|
|
|
|
MAKEFILE_GRIFFIN=no
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-01 15:14:14 +00:00
|
|
|
# PSP
|
|
|
|
if [ $PLATFORM = "psp1" ] ; then
|
|
|
|
platform=psp1
|
2015-09-01 15:31:34 +00:00
|
|
|
SALAMANDER=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:14:14 +00:00
|
|
|
|
|
|
|
mkdir -p ../pkg/${platform}/cores/
|
|
|
|
|
|
|
|
make -C ../${platform}/kernelFunctionsPrx/ clean || exit 1
|
|
|
|
make -C ../${platform}/kernelFunctionsPrx/ || exit 1
|
|
|
|
cp -f ../kernel_functions.prx ../pkg/${platform}/kernel_functions.prx
|
|
|
|
mv -f ../EBOOT.PBP ../pkg/${platform}/EBOOT.PBP
|
2015-09-01 15:31:34 +00:00
|
|
|
|
|
|
|
# Vita
|
|
|
|
elif [ $PLATFORM = "vita" ] ; then
|
|
|
|
platform=vita
|
|
|
|
MAKEFILE_GRIFFIN=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:31:34 +00:00
|
|
|
|
2015-09-02 12:00:36 +00:00
|
|
|
# Emscripten
|
|
|
|
elif [ $PLATFORM = "emscripten" ] ; then
|
|
|
|
platform=emscripten
|
|
|
|
EXT=bc
|
|
|
|
|
|
|
|
if [ -z "$EMSCRIPTEN" ] ; then
|
|
|
|
echo "run this script with emmake. Ex: emmake $0"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-09-01 15:41:20 +00:00
|
|
|
# Wii
|
|
|
|
elif [ $PLATFORM = "wii" ] ; then
|
|
|
|
platform=wii
|
|
|
|
MAKEFILE_GRIFFIN=yes
|
|
|
|
SALAMANDER=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:41:20 +00:00
|
|
|
|
|
|
|
# NGC
|
|
|
|
elif [ $PLATFORM = "ngc" ] ; then
|
|
|
|
platform=ngc
|
|
|
|
MAKEFILE_GRIFFIN=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:41:20 +00:00
|
|
|
|
2015-09-01 15:14:14 +00:00
|
|
|
# DEX PS3
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "dex-ps3" ] ; then
|
2015-09-01 15:00:07 +00:00
|
|
|
platform=ps3
|
2015-09-01 15:31:34 +00:00
|
|
|
SALAMANDER=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:00:07 +00:00
|
|
|
|
|
|
|
EXE_PATH=/usr/local/cell/host-win32/bin
|
|
|
|
MAKE_FSELF_NPDRM=$EXE_PATH/make_fself_npdrm.exe
|
|
|
|
MAKE_PACKAGE_NPDRM=$EXE_PATH/make_package_npdrm.exe
|
2015-09-01 15:31:34 +00:00
|
|
|
|
2015-09-01 15:14:14 +00:00
|
|
|
# CEX PS3
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "cex-ps3" ]; then
|
2015-09-01 15:00:07 +00:00
|
|
|
platform=ps3
|
2015-09-01 15:31:34 +00:00
|
|
|
SALAMANDER=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:00:07 +00:00
|
|
|
|
|
|
|
EXE_PATH=/usr/local/cell/host-win32/bin
|
2015-09-01 15:31:34 +00:00
|
|
|
|
2015-09-01 15:14:14 +00:00
|
|
|
# ODE PS3
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "ode-ps3" ]; then
|
2015-09-01 15:07:13 +00:00
|
|
|
#For this script to work correctly, you must place the "data" folder containing your ps3 keys for scetool to use in the dist-scripts folder.
|
|
|
|
platform=ps3
|
2015-09-01 15:31:34 +00:00
|
|
|
SALAMANDER=yes
|
2015-09-02 10:34:05 +00:00
|
|
|
EXT=a
|
2015-09-01 15:07:13 +00:00
|
|
|
|
|
|
|
GENPS3ISO_PATH=/cygdrive/c/Cobra_ODE_GenPS3iso_v2.3/genps3iso.exe
|
|
|
|
SCETOOL_PATH=/cygdrive/c/Users/aaa801/ps3tools/ps3tools/tools/scetool/scetool.exe
|
|
|
|
SCETOOL_FLAGS="--sce-type SELF --compress-data FALSE --self-type APP --key-revision 0004 --self-fw-version 0003004100000000 --self-app-version 0001000000000000 --self-auth-id 1010000001000003 --self-vendor-id 01000002 --self-cap-flags 00000000000000000000000000000000000000000000003b0000000100040000"
|
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Cleanup Salamander core if it exists
|
|
|
|
if [ $SALAMANDER = "yes" ]; then
|
2015-09-01 15:00:07 +00:00
|
|
|
make -C ../ -f Makefile.${platform}.salamander clean || exit 1
|
2015-09-01 15:31:34 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Cleanup existing core if it exists
|
2015-09-01 15:07:13 +00:00
|
|
|
if [ $PLATFORM = "ode-ps3" ]; then
|
|
|
|
make -C ../ -f Makefile.${platform}.cobra clean || exit 1
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $MAKEFILE_GRIFFIN = "yes" ]; then
|
|
|
|
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
|
2015-09-01 15:07:13 +00:00
|
|
|
else
|
|
|
|
make -C ../ -f Makefile.${platform} clean || exit 1
|
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Compile Salamander core
|
|
|
|
if [ $SALAMANDER = "yes" ]; then
|
|
|
|
make -C ../ -f Makefile.${platform}.salamander || exit 1
|
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-02 10:34:05 +00:00
|
|
|
for f in *_${platform}.${EXT} ; do
|
|
|
|
name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).${EXT}$//"`
|
2015-09-02 12:00:36 +00:00
|
|
|
lto=0
|
2015-09-01 15:00:07 +00:00
|
|
|
whole_archive=
|
2015-09-01 16:27:49 +00:00
|
|
|
big_stack=
|
2015-09-01 15:00:07 +00:00
|
|
|
if [ $name = "nxengine" ] ; then
|
|
|
|
echo "Applying whole archive linking..."
|
|
|
|
whole_archive="WHOLE_ARCHIVE_LINK=1"
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $name = "tyrquake" ] ; then
|
2015-09-01 15:00:07 +00:00
|
|
|
echo "Applying big stack..."
|
2015-09-02 12:00:36 +00:00
|
|
|
lto=0
|
2015-09-01 15:00:07 +00:00
|
|
|
big_stack="BIG_STACK=1"
|
|
|
|
fi
|
|
|
|
echo "-- Building core: $name --"
|
2015-09-02 10:34:05 +00:00
|
|
|
cp -f "$f" ../libretro_${platform}.${EXT}
|
2015-09-01 15:14:14 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Do cleanup if this is a big stack core
|
2015-09-01 15:14:14 +00:00
|
|
|
if [ $big_stack="BIG_STACK=1" ] ; then
|
2015-09-01 15:31:34 +00:00
|
|
|
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
|
|
|
|
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
|
2015-09-02 12:00:36 +00:00
|
|
|
elif [ $PLATFORM = "emscripten" ]; then
|
|
|
|
make -C ../ -f Makefile.emscripten LTO=$lto -j7 clean || exit 1
|
2015-09-01 15:31:34 +00:00
|
|
|
else
|
|
|
|
make -C ../ -f Makefile.${platform} clean || exit 1
|
|
|
|
fi
|
2015-09-01 15:14:14 +00:00
|
|
|
fi
|
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Compile core
|
2015-09-01 15:07:13 +00:00
|
|
|
if [ $PLATFORM = "ode-ps3" ] ; then
|
|
|
|
make -C ../ -f Makefile.${platform}.cobra $whole_archive -j3 || exit 1
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $MAKEFILE_GRIFFIN = "yes" ]; then
|
|
|
|
make -C ../ -f Makefile.griffin platform=${platform} $whole_archive $big_stack -j3 || exit 1
|
2015-09-02 12:00:36 +00:00
|
|
|
elif [ $PLATFORM = "emscripten" ]; then
|
|
|
|
make -C ../ -f Makefile.emscripten LTO=$lto -j7 || exit 1
|
2015-09-01 15:07:13 +00:00
|
|
|
else
|
|
|
|
make -C ../ -f Makefile.${platform} $whole_archive $big_stack -j3 || exit 1
|
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Do manual executable step
|
2015-09-01 15:00:07 +00:00
|
|
|
if [ $PLATFORM = "dex-ps3" ] ; then
|
|
|
|
$MAKE_FSELF_NPDRM ../retroarch_${platform}.elf ../CORE.SELF
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "cex-ps3" ] ; then
|
2015-09-01 15:00:07 +00:00
|
|
|
make_self_wc ../retroarch_${platform}.elf ../CORE.SELF
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "ode-ps3" ] ; then
|
2015-09-01 15:07:13 +00:00
|
|
|
$SCETOOL_PATH $SCETOOL_FLAGS --encrypt ../retroarch_${platform}.elf ../CORE.SELF
|
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Move executable files
|
2015-09-01 15:00:07 +00:00
|
|
|
if [ $platform = "ps3" ] ; then
|
2015-09-01 15:07:13 +00:00
|
|
|
if [ $PLATFORM = "ode-ps3" ] ; then
|
|
|
|
mv -f ../CORE.SELF ../${platform}/iso/PS3_GAME/USRDIR/cores/"${name}_libretro_${platform}.SELF"
|
2015-09-01 16:27:49 +00:00
|
|
|
else
|
|
|
|
mv -f ../CORE.SELF ../pkg/${platform}/USRDIR/cores/"${name}_libretro_${platform}.SELF"
|
2015-09-01 15:07:13 +00:00
|
|
|
fi
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "psp1" ] ; then
|
|
|
|
mv -f ../EBOOT.PBP ../pkg/${platform}/cores/${name}_libretro.PBP
|
|
|
|
elif [ $PLATFORM = "vita" ] ; then
|
|
|
|
mv -f ../retroarch_${platform}.velf ../pkg/${platform}/${name}_libretro_${platform}.velf
|
2015-09-01 15:41:20 +00:00
|
|
|
elif [ $PLATFORM = "ngc" ] ; then
|
|
|
|
mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
|
|
|
|
elif [ $PLATFORM = "wii" ] ; then
|
|
|
|
mv -f ../retroarch_${platform}.dol ../pkg/${platform}/${name}_libretro_${platform}.dol
|
2015-09-02 12:00:36 +00:00
|
|
|
elif [ $PLATFORM = "emscripten" ] ; then
|
|
|
|
mv -f ../retroarch.js ../emscripten/$name.js
|
2015-09-01 15:31:34 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove executable files
|
|
|
|
if [ $platform = "ps3" ] ; then
|
2015-09-01 15:00:07 +00:00
|
|
|
rm -f ../retroarch_${platform}.elf ../retroarch_${platform}.self ../CORE.SELF
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "psp1" ] ; then
|
|
|
|
rm -f ../retroarchpsp.elf
|
|
|
|
elif [ $PLATFORM = "vita" ] ; then
|
|
|
|
rm -f ../retroarch_${platform}.velf ../retroarch_${platform}.elf
|
2015-09-01 15:41:20 +00:00
|
|
|
elif [ $PLATFORM = "ngc" ] ; then
|
|
|
|
rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
|
|
|
|
elif [ $PLATFORM = "wii" ] ; then
|
|
|
|
rm -f ../retroarch_${platform}.dol ../retroarch_${platform}.elf ../retroarch_${platform}.elf.map
|
2015-09-02 12:00:36 +00:00
|
|
|
elif [ $platform = "emscripten" ] ; then
|
|
|
|
rm -f ../retroarch.js
|
2015-09-01 15:00:07 +00:00
|
|
|
fi
|
2015-09-01 15:14:14 +00:00
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Do cleanup if this is a big stack core
|
2015-09-01 15:14:14 +00:00
|
|
|
if [ $big_stack="BIG_STACK=1" ] ; then
|
2015-09-01 15:31:34 +00:00
|
|
|
if [ $MAKEFILE_GRIFFIN = "yes" ]; then
|
|
|
|
make -C ../ -f Makefile.griffin platform=${platform} clean || exit 1
|
2015-09-02 12:00:36 +00:00
|
|
|
elif [ $PLATFORM = "emscripten" ]; then
|
|
|
|
make -C ../ -f Makefile.emscripten LTO=$lto -j7 clean || exit 1
|
2015-09-01 15:31:34 +00:00
|
|
|
else
|
|
|
|
make -C ../ -f Makefile.${platform} clean || exit 1
|
|
|
|
fi
|
2015-09-01 15:14:14 +00:00
|
|
|
fi
|
2015-09-01 15:00:07 +00:00
|
|
|
done
|
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Additional build step
|
2015-09-01 15:00:07 +00:00
|
|
|
if [ $PLATFORM = "ps3" ] ; then
|
|
|
|
make -C ../ -f Makefile.griffin platform=${platform} shaders-deploy
|
|
|
|
fi
|
|
|
|
|
2015-09-01 15:31:34 +00:00
|
|
|
# Packaging
|
2015-09-01 15:00:07 +00:00
|
|
|
if [ $PLATFORM = "dex-ps3" ] ; then
|
|
|
|
$MAKE_FSELF_NPDRM ../retroarch-salamander_${platform}.elf ../pkg/${platform}/USRDIR/EBOOT.BIN
|
|
|
|
rm -rf ../retroarch-salamander_${platform}.elf
|
|
|
|
$MAKE_PACKAGE_NPDRM ../pkg/${platform}/package.conf ../pkg/${platform}
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "cex-ps3" ] ; then
|
2015-09-01 15:00:07 +00:00
|
|
|
make_self_wc ../retroarch-salamander_${platform}.elf ../pkg/${platform}/USRDIR/EBOOT.BIN
|
|
|
|
rm -rf ../retroarch-salamander_${platform}.elf
|
|
|
|
python2 ../ps3/ps3py/pkg.py --contentid UP0001-SSNE10000_00-0000000000000001 ../pkg/${platform} retroarch-${platform}-cfw-$RARCH_VERSION.pkg
|
2015-09-01 15:31:34 +00:00
|
|
|
elif [ $PLATFORM = "ode-ps3" ] ; then
|
2015-09-01 15:07:13 +00:00
|
|
|
$SCETOOL_PATH $SCETOOL_FLAGS --encrypt ../retroarch-salamander_${platform}.elf ../${platform}/iso/PS3_GAME/USRDIR/EBOOT.BIN
|
|
|
|
rm -rf ../retroarch-salamander_${platform}.elf
|
|
|
|
|
|
|
|
$GENPS3ISO_PATH ../${platform}/iso RetroArch-COBRA-ODE.iso
|
|
|
|
fi
|