@echo off 

if not exist \Utils\ArMips\armips.exe goto EmulatorFail

set BuildFile=%1
set BuildPath=%2
if exist \utils\SelectedBuildFile.bat call \utils\SelectedBuildFile.bat 

cd %BuildPath%
if not %BuildPath:~0,1%==%CD:~0,1% goto InvalidPath



\Utils\ArMips\armips.exe %BuildFile% -temp \BldN64\listing.txt -definelabel buildn64 1

if not "%errorlevel%"=="0" goto abort
\Utils\rn64crc.exe -u \RelN64\cart.N64

cd \emu\Mupen64pp\
mupen64pp.exe \RelN64\cart.N64

rem cd \emu\Mupen64Plus 
rem mupen64plus-ui-console.exe -windowed "\RelN64\cart.N64"

goto Abandon

:InvalidPath
echo Error: ASM file must be on same drive as devtools 
echo File: %BuildPath%\%BuildFile% 
echo Devtools Drive: %CD:~0,1% 
goto Abandon

:EmulatorFail
echo Error: Can't find \Utils\ArMips\armips.exe

:Abandon
if "%3"=="nopause" exit
pause

