@echo off title AutoPOE2 - Single Source of Truth Launcher cd /d "%~dp0" setlocal EnableExtensions EnableDelayedExpansion :: Thiet lap UTF-8 cho console va Python chcp 65001 >nul 2>&1 set PYTHONUTF8=1 set PYTHONIOENCODING=utf-8 echo =============================================================================== echo AutoPOE2 - HE THONG TU HANH PATH OF EXILE 2 (SSoT) echo =============================================================================== echo * Diem khoi dong DUY NHAT: run_full_system.bat echo * Dashboard dieu khien: Control Center GUI echo * Phim tat Bot: [F8] Bat/Tat Tu Hanh ^| [Pause/F12] Dung Khan Cap echo =============================================================================== :: 1. Kiem tra quyen Administrator net session >nul 2>&1 if %errorLevel% equ 0 ( echo [OK] Quyen Administrator: Da kich hoat [High Integrity RPM]. ) else ( echo [INFO] Quyen Standard User: Control Center se tu dong nang quyen khi bam F8. ) :: 2. Xac dinh trinh thuc thi Python set "PYTHON_EXE=" if exist "%~dp0.venv\Scripts\python.exe" set "PYTHON_EXE=%~dp0.venv\Scripts\python.exe" if not defined PYTHON_EXE if exist "%~dp0..\.venv\Scripts\python.exe" set "PYTHON_EXE=%~dp0..\.venv\Scripts\python.exe" if not defined PYTHON_EXE if exist "C:\Users\Admin\AppData\Local\Programs\Python\Python311\python.exe" set "PYTHON_EXE=C:\Users\Admin\AppData\Local\Programs\Python\Python311\python.exe" if not defined PYTHON_EXE if exist "%LocalAppData%\Programs\Python\Python311\python.exe" set "PYTHON_EXE=%LocalAppData%\Programs\Python\Python311\python.exe" if not defined PYTHON_EXE if exist "%USERPROFILE%\AppData\Local\Programs\Python\Python311\python.exe" set "PYTHON_EXE=%USERPROFILE%\AppData\Local\Programs\Python\Python311\python.exe" if not defined PYTHON_EXE if exist "C:\Program Files\Python311\python.exe" set "PYTHON_EXE=C:\Program Files\Python311\python.exe" if not defined PYTHON_EXE set "PYTHON_EXE=python" echo [OK] Python: "%PYTHON_EXE%" :: 3. Kiem tra thu vien Python can thiet (customtkinter, pywin32) "%PYTHON_EXE%" -c "import customtkinter, win32gui" >nul 2>&1 if %errorLevel% neq 0 ( echo [CANH BAO] Dang tu dong cai dat thu vien thieu tu requirements.txt... "%PYTHON_EXE%" -m pip install -r "%~dp0requirements.txt" ) :: 4. Do tim C++ Core Engine set "CORE_EXE=" if exist "%~dp0bin\Release\AutoPOE2_Core.exe" ( set "CORE_EXE=%~dp0bin\Release\AutoPOE2_Core.exe" ) else if exist "%~dp0build\bin\Release\AutoPOE2_Core.exe" ( set "CORE_EXE=%~dp0build\bin\Release\AutoPOE2_Core.exe" ) else if exist "%~dp0bin\AutoPOE2_Core.exe" ( set "CORE_EXE=%~dp0bin\AutoPOE2_Core.exe" ) if "%~1"=="--core" goto run_core_only if "%~1"=="--standalone" goto run_core_only if not defined CORE_EXE ( if exist "%~dp0CMakeLists.txt" ( echo [INFO] Chua co AutoPOE2_Core.exe - Dang tu dong bien dich CMake Release... if not exist "%~dp0build" cmake -B "%~dp0build" -S "%~dp0." -DCMAKE_BUILD_TYPE=Release cmake --build "%~dp0build" --config Release --target AutoPOE2_Core if exist "%~dp0bin\Release\AutoPOE2_Core.exe" set "CORE_EXE=%~dp0bin\Release\AutoPOE2_Core.exe" if exist "%~dp0build\bin\Release\AutoPOE2_Core.exe" if not defined CORE_EXE set "CORE_EXE=%~dp0build\bin\Release\AutoPOE2_Core.exe" ) ) if defined CORE_EXE ( echo [OK] Core: "%CORE_EXE%" ) else ( echo [CANH BAO] Chua tim thay AutoPOE2_Core.exe. F8 se that bai cho den khi bien dich xong. ) :: 5. Khoi chay Control Center Dashboard echo. echo [AutoPOE2] Dang mo Control Center Dashboard... "%PYTHON_EXE%" run_control_center.py %* set "EXIT_CODE=%errorLevel%" if %EXIT_CODE% neq 0 ( echo. echo [LOI] Control Center gap su co [Ma loi: %EXIT_CODE%]. pause exit /b %EXIT_CODE% ) exit /b 0 :run_core_only if not defined CORE_EXE ( echo [LOI] Khong tim thay AutoPOE2_Core.exe! pause exit /b 1 ) "%CORE_EXE%" %* pause exit /b 0