@echo off
setlocal
pushd "%~dp0"

echo ============================================================
echo FFBE Memorial - English Patch Installer
echo ============================================================
echo.
echo Make sure:
echo   1. Your phone is connected via USB
echo   2. USB debugging is enabled (Developer Options)
echo   3. You accept the "Allow USB debugging" prompt on your phone
echo.
pause

set ADB=%~dp0adb\adb.exe

echo.
echo Checking for connected device...
"%ADB%" devices
echo.

echo Installing FFBE-Memorial-EN.apk...
echo (This may take a minute. The APK is ~115 MB.)
echo.
"%ADB%" install -r --no-incremental "%~dp0FFBE-Memorial-EN.apk"
set RC=%ERRORLEVEL%

echo.
if %RC% == 0 (
    echo ============================================================
    echo  Installation complete!
    echo ============================================================
    echo.
    echo  Launch "FFBE" from your app drawer to start.
    echo  First run will download ~6 GB of game assets.
) else (
    echo ============================================================
    echo  Installation failed.
    echo ============================================================
    echo.
    echo  Check that your phone is connected and USB debugging is enabled.
    echo  You may need to uninstall any existing "FFBE" app first.
)

echo.
pause
popd
