Repository navigation
Expand file tree
/
Copy pathTestDebugAsHatMod.cmd
More file actions
83 lines (66 loc) · 2.13 KB
/
Copy pathTestDebugAsHatMod.cmd
File metadata and controls
83 lines (66 loc) · 2.13 KB
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
@REM echo should only be one for debugging this script
@echo off
@setlocal EnableDelayedExpansion
@REM Note: this file has the @ symbol at every line because it makes debugging easier, as it lets us silence lines we know work
@goto main
@REM Start of custom subroutines block
:normalize_fezpath
@REM This label is for future expansion
@call :replace_doublebacks
@goto :eof
:replace_doublebacks
@REM Replace all instances of \\ with \
@set "temp=%fezpath%"
@set "fezpath=%fezpath:\\=\%"
@if "%temp%"=="%fezpath%" @goto :eof
@goto replace_doublebacks
@REM End of custom subroutines block
:main
@set projectpath=%cd%
@set fezpath=
@REM Find the location of the FEZ game folder
@set FezSteamAppId=224760
@REM Get Steam library folders
@FOR /F "tokens=2* skip=2" %%a in ('reg query "HKCU\SOFTWARE\Valve\Steam" /v "SteamPath"') do @set "steamlibs=%%b\steamapps\libraryfolders.vdf"
@if defined steamlibs (
@echo Searching Steam libraries for FEZ...
@set curpath=
REM look through steamapps\libraryfolders.vdf to find FEZ (steam app id 224760)
@FOR /F "tokens=1*" %%L in ('FINDSTR /r /c:"path" /c:"\<%FezSteamAppId%\>" "%steamlibs%"') do @(
@if %%L=="%FezSteamAppId%" (
@set fezpath=!curpath!
)
@if %%L=="path" (
@set curpath=%%M
)
)
@REM Note: you must use delayed expansion when reading the values of variables set within an if statement
if defined fezpath @(
@set "fezpath=!fezpath:"=!\steamapps\common\FEZ"
@call :normalize_fezpath
@echo Found FEZ at "!fezpath!"
)
) else (
@REM TODO add support for other locations?
)
@if not defined fezpath (
@echo Warning: FEZ game path not found. Attempting default path
@set "fezpath=%ProgramFiles(x86)%\Steam\steamapps\common\FEZ"
)
@set mmfez=FEZ.exe
echo FEZ path: "%fezpath%"
@if EXIST "%fezpath%\" (
cd /D "%fezpath%"
@if NOT EXIST "%mmfez%" @(
@echo Failed to find FEZ.exe
@REM echo Exit Code is %errorlevel%
)
@if ERRORLEVEL 0 (
@REM launch MONOMODDED_FEZ
@REM Note: MONOMODDED_FEZ must be launched from the FEZ game path, as FEZ uses the current working directory to locate game resources
start %mmfez%
)
) ELSE (
@echo Failed to locate FEZ game directory.
)
cd %projectpath%