-
Notifications
You must be signed in to change notification settings - Fork 9
/
wemod.bat
87 lines (78 loc) · 2.29 KB
/
wemod.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@echo off
@title Wemod Launcher
SET mypath=%~dp0
SET wemodname=WeMod.exe
SET wemodpath=%mypath:~0,-1%\wemod_bin\%wemodname%
SET temptime=%mypath:~0,-1%\.cache\early.tmp
SET returnfile=%mypath:~0,-1%\.cache\return.tmp
echo Hello from the WeMod Launcher, the WeMod bat was started successfully.
echo.
echo WEMOD EXE:
echo "%wemodpath%"
echo.
echo PWD:
echo "%cd%"
echo.
echo command:
echo %*
echo.
echo.
REM Start WeMod.exe and get its PID
echo Starting WeMod by using %wemodname%.
start "" %wemodpath%
echo Cheking for running WeMod pid
set wemodPID=
REM Get the wemod pid over proton
for /F "TOKENS=1,2,*" %%a in ('C:/windows/system32/tasklist /FI "IMAGENAME eq %wemodname%" 2>NUL') do (
set void=%%a
set wemodPID=%%b
)
REM On fail try once more to get the wemod pid over proton
if not defined wemodPID (
for /F "TOKENS=1,2,*" %%a in ('C:/windows/system32/tasklist /FI "IMAGENAME eq %wemodname%" 2>NUL') do (
set void=%%a
set wemodPID=%%b
)
)
REM If still not set get wemod pid over wine
if not defined wemodPID (
for /F "TOKENS=2 delims=," %%d in ('C:/windows/system32/tasklist /FI "IMAGENAME eq %wemodname%" 2>NUL') do (
set wemodPID=%%d
)
)
REM On fail try once more to get wemod pid over wine
if not defined wemodPID (
for /F "TOKENS=2 delims=," %%d in ('C:/windows/system32/tasklist /FI "IMAGENAME eq %wemodname%" 2>NUL') do (
set wemodPID=%%d
)
)
echo WeMod found with pid %wemodPID%
echo.
REM Start the game and wait for exit
echo Running game "%~1" and waiting for close
echo The full command is: %*
start /wait "" %*
echo.
echo The game was closed
if defined wemodPID (
if exist %temptime% (
del %temptime%
echo Game closed to fast, Game detection may have failed > %returnfile%
echo.
echo Game closed to fast, Game detection may have failed, sending problem to python script and waiting for awnser
:WaitUser
@ping localhost -n 1 > NUL 2>&1
if exist %returnfile% (
goto WaitUser
)
)
echo Closing WeMod
C:/windows/system32/taskkill.exe /PID %wemodPID% /F 2>NUL
C:/windows/system32/taskkill.exe /PID %wemodPID% /F 2>NUL
echo.
echo Killed %wemodname% with pid %wemodPID%
)
echo.
echo Done running bat, closing in 1 second
@ping localhost -n 1 > NUL 2>&1
echo.