-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPostBuild.bat
145 lines (120 loc) · 4.74 KB
/
PostBuild.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@echo off
set POSTBUILD_CONFIG=%~dp0\PostBuild_Config.bat
rem +-------------------------------------------------------------------------------------
rem |
rem | Copies plugins into game on build
rem |
rem | Queries registry to find game locations. Assumes they are the standard versions.
rem |
rem | Locations can be overriden by a file named 'PostBuild_Config.bat' if it
rem | exists in the solution and contains SET directives for XX_DIR, where XX is the
rem | target game. Any that are not set via the registry or the override file will be ignored.
rem |
rem | Example contents:
rem | @echo off
rem | set KK_DIR=C:\Games\Koikatu
rem |
rem +-------------------------------------------------------------------------------------
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\AI-Syoujyo\AI-Syoujyo" /v "INSTALLDIR" 2^>nul') do set "AI_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\AI-Shoujo\AI-Shoujo" /v "INSTALLDIR" 2^>nul') do set "AI_ALT_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\emotioncreators\emotioncreators" /v "INSTALLDIR" 2^>nul') do set "EC_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\HoneySelect\HoneySelect" /v "INSTALLDIR" 2^>nul') do set "HS_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\Software\illusion\HoneySelect2\HoneySelect2" /v "INSTALLDIR" 2^>nul') do set "HS2_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\Koikatu\koikatu" /v "INSTALLDIR" 2^>nul') do set "KK_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\Koikatsu\Koikatsu Party" /v "INSTALLDIR" 2^>nul') do set "KK_PARTY_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\PlayHome" /v "INSTALLDIR" 2^>nul') do set "PH_DIR=%%a"
rem -- set trial first, full game will overwrite
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\KoikatsuSunshine\KoikatsuSunshineTrial" /v "INSTALLDIR" 2^>nul') do set "KKS_DIR=%%a"
for /f "tokens=3" %%a in ('REG query "HKEY_CURRENT_USER\SOFTWARE\illusion\KoikatsuSunshine\KoikatsuSunshine" /v "INSTALLDIR" 2^>nul') do set "KKS_DIR=%%a"
IF EXIST %POSTBUILD_CONFIG% CALL "%POSTBUILD_CONFIG%"
set TARGET_SUBDIR=BepInEx\plugins\TranslationTools
IF "%2" == "ALL" (
call %~dpnx0 "%1" HS
call %~dpnx0 "%1" PH
call %~dpnx0 "%1" KK
call %~dpnx0 "%1" EC
call %~dpnx0 "%1" AI
call %~dpnx0 "%1" HS2
call %~dpnx0 "%1" KKS
goto END
)
IF "%2" == "KK" (
IF NOT "%KK_DIR%" == "" (
set TARGET=%KK_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
)
IF NOT "%KK_PARTY_DIR%" == "" (
set TARGET=%KK_PARTY_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
)
goto END
)
IF "%2" == "KK_ONLY" IF NOT "%KK_DIR%" == "" (
set TARGET=%KK_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "KK_PARTY" IF NOT "%KK_PARTY_DIR%" == "" (
set TARGET=%KK_PARTY_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "EC" IF NOT "%EC_DIR%" == "" (
set TARGET=%EC_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "AI" (
IF NOT "%AI_DIR%" == "" (
set TARGET=%AI_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
)
IF NOT "%AI_ALT_DIR%" == "" (
set TARGET=%AI_ALT_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
)
goto END
)
IF "%2" == "AI_ONLY" IF NOT "%AI_DIR%" == "" (
set TARGET=%AI_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "AI_INT" IF NOT "%AI_ALT_DIR%" == "" (
set TARGET=%AI_ALT_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "HS" IF NOT "%HS_DIR%" == "" (
set TARGET=%HS_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "PH" IF NOT "%PH_DIR%" == "" (
set TARGET=%PH_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "HS2" IF NOT "%HS2_DIR%" == "" (
set TARGET=%HS2_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
IF "%2" == "KKS" IF NOT "%KKS_DIR%" == "" (
set TARGET=%KKS_DIR%\%TARGET_SUBDIR%
call :COPY_TARGET "%1" "%TARGET%"
goto END
)
goto NO_TARGET
:COPY_TARGET
IF NOT EXIST "%TARGET%\" mkdir "%TARGET%"
IF EXIST "%TARGET%\" (
XCOPY /f /y "%1" "%TARGET%"
exit /b
)
:TARGET_NOT_EXIST
echo Target dir %TARGET% does not exist and can not create
exit 2
:NO_TARGET
echo Skipping postbuild: '%2' is not a valid target ID or '%2_DIR' is not found in registry or in %POSTBUILD_CONFIG%
:END