|
| 1 | +@echo off |
| 2 | +chcp 65001 >nul 2>&1 |
| 3 | +title YouClaw Server Debug |
| 4 | + |
| 5 | +echo ============================================ |
| 6 | +echo YouClaw Server Debug Launcher |
| 7 | +echo ============================================ |
| 8 | +echo. |
| 9 | + |
| 10 | +:: ---- System Info ---- |
| 11 | +echo [System Info] |
| 12 | +echo OS: |
| 13 | +ver |
| 14 | +echo Architecture: %PROCESSOR_ARCHITECTURE% |
| 15 | +echo Username: %USERNAME% |
| 16 | +echo. |
| 17 | + |
| 18 | +:: ---- Check VC++ Runtime ---- |
| 19 | +echo [VC++ Runtime Check] |
| 20 | +if exist "%SystemRoot%\System32\vcruntime140.dll" ( |
| 21 | + echo vcruntime140.dll: OK |
| 22 | +) else ( |
| 23 | + echo vcruntime140.dll: MISSING !!! |
| 24 | +) |
| 25 | +if exist "%SystemRoot%\System32\msvcp140.dll" ( |
| 26 | + echo msvcp140.dll: OK |
| 27 | +) else ( |
| 28 | + echo msvcp140.dll: MISSING !!! |
| 29 | +) |
| 30 | +echo. |
| 31 | + |
| 32 | +:: ---- Locate server exe ---- |
| 33 | +set "SERVER_EXE=" |
| 34 | + |
| 35 | +:: Support drag-and-drop: user drags youclaw-server.exe onto this bat |
| 36 | +if not "%~1"=="" ( |
| 37 | + if exist "%~1" ( |
| 38 | + set "SERVER_EXE=%~1" |
| 39 | + goto :found |
| 40 | + ) |
| 41 | +) |
| 42 | + |
| 43 | +:: Same directory as this script |
| 44 | +if exist "%~dp0youclaw-server.exe" ( |
| 45 | + set "SERVER_EXE=%~dp0youclaw-server.exe" |
| 46 | + goto :found |
| 47 | +) |
| 48 | + |
| 49 | +:: Common install paths |
| 50 | +for %%D in ( |
| 51 | + "%LOCALAPPDATA%\YouClaw" |
| 52 | + "%LOCALAPPDATA%\Programs\YouClaw" |
| 53 | + "%ProgramFiles%\YouClaw" |
| 54 | +) do ( |
| 55 | + if exist "%%~D\youclaw-server.exe" ( |
| 56 | + set "SERVER_EXE=%%~D\youclaw-server.exe" |
| 57 | + goto :found |
| 58 | + ) |
| 59 | +) |
| 60 | + |
| 61 | +:: Search all drives for YouClaw folder |
| 62 | +for %%X in (C D E F G) do ( |
| 63 | + if exist "%%X:\YouClaw\youclaw-server.exe" ( |
| 64 | + set "SERVER_EXE=%%X:\YouClaw\youclaw-server.exe" |
| 65 | + goto :found |
| 66 | + ) |
| 67 | +) |
| 68 | + |
| 69 | +echo [ERROR] youclaw-server.exe not found. |
| 70 | +echo. |
| 71 | +echo Usage: |
| 72 | +echo 1. Copy this script next to youclaw-server.exe, then double-click |
| 73 | +echo 2. Or drag youclaw-server.exe onto this script |
| 74 | +echo. |
| 75 | +goto :end |
| 76 | + |
| 77 | +:found |
| 78 | +echo [Server Location] |
| 79 | +echo %SERVER_EXE% |
| 80 | +echo. |
| 81 | + |
| 82 | +:: ---- Check exe architecture ---- |
| 83 | +echo [Binary Check] |
| 84 | +if exist "%SERVER_EXE%" ( |
| 85 | + for %%F in ("%SERVER_EXE%") do echo File size: %%~zF bytes |
| 86 | +) |
| 87 | +echo. |
| 88 | + |
| 89 | +:: ---- Set environment variables ---- |
| 90 | +set "PORT=62601" |
| 91 | +set "HOME=%USERPROFILE%" |
| 92 | +set "BUN_TMPDIR=%TEMP%" |
| 93 | +set "LOG_LEVEL=debug" |
| 94 | + |
| 95 | +echo [Environment] |
| 96 | +echo PORT=%PORT% |
| 97 | +echo HOME=%HOME% |
| 98 | +echo USERPROFILE=%USERPROFILE% |
| 99 | +echo TEMP=%TEMP% |
| 100 | +echo BUN_TMPDIR=%BUN_TMPDIR% |
| 101 | +echo LOG_LEVEL=%LOG_LEVEL% |
| 102 | +echo. |
| 103 | + |
| 104 | +echo ============================================ |
| 105 | +echo Starting server... (errors will show below) |
| 106 | +echo ============================================ |
| 107 | +echo. |
| 108 | + |
| 109 | +"%SERVER_EXE%" 2>&1 |
| 110 | + |
| 111 | +echo. |
| 112 | +echo ============================================ |
| 113 | +set "EXIT_CODE=%ERRORLEVEL%" |
| 114 | +echo Server exited with code: %EXIT_CODE% |
| 115 | + |
| 116 | +:: Decode common Windows error codes |
| 117 | +if "%EXIT_CODE%"=="-1073741795" echo = 0xC000001D: Illegal Instruction (CPU not supported?) |
| 118 | +if "%EXIT_CODE%"=="-1073741795" echo Bun requires a CPU with AVX support. Check if your CPU supports AVX. |
| 119 | +if "%EXIT_CODE%"=="-1073741819" echo = 0xC0000005: Access Violation (memory error) |
| 120 | +if "%EXIT_CODE%"=="-1073741515" echo = 0xC0000135: DLL Not Found (missing vcruntime140.dll?) |
| 121 | +if "%EXIT_CODE%"=="-1073740791" echo = 0xC0000409: Stack Buffer Overrun |
| 122 | +if "%EXIT_CODE%"=="-1073740940" echo = 0xC0000374: Heap Corruption |
| 123 | +echo ============================================ |
| 124 | + |
| 125 | +:end |
| 126 | +echo. |
| 127 | +echo Press any key to close... |
| 128 | +pause >nul |
0 commit comments