forked from JonathanTroyer/Progress-Renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install.bat
123 lines (115 loc) · 3.83 KB
/
Install.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
REM ################ Mod build and install script (c) Andreas Pardeike 2020 ################
REM
REM Call this script from Visual Studio's Build Events post-build event command line box:
REM "$(ProjectDir)Install.bat" $(ConfigurationName) "$(ProjectDir)" "$(ProjectName)" "About Assemblies Languages Textures v1.1" "LoadFolders.xml"
REM
REM The project structure should look like this:
REM
REM Modname
REM +- .git
REM +- .vs
REM +- About
REM | +- About.xml
REM | +- Preview.png
REM | +- PublishedFileId.txt
REM +- Assemblies <----- this is for RW1.0 + Harmony 1
REM | +- 0Harmony.dll
REM | +- 0Harmony.dll.mbd
REM | +- 0Harmony.pdb
REM | +- Modname.dll
REM | +- Modname.dll.mbd
REM | +- Modname.pdb
REM +- Languages
REM +- packages
REM | +- Lib.Harmony.2.x.x
REM +- Source
REM | +- .vs
REM | +- obj
REM | +- Debug
REM | +- Release
REM | +- Properties
REM | +- Modname.csproj
REM | +- Modname.csproj.user
REM | +- packages.config
REM | +- Install.bat <----- this script
REM +- Textures
REM +- v1.1
REM | +- Assemblies <----- this is for RW1.1 + Harmony 2
REM | +- 0Harmony.dll
REM | +- 0Harmony.dll.mbd
REM | +- 0Harmony.pdb
REM | +- Modname.dll
REM | +- Modname.dll.mbd
REM | +- Modname.pdb
REM +- .gitattributes
REM +- .gitignore
REM +- LICENSE
REM +- LoadFolders.xml
REM +- README.md
REM +- Modname.sln
REM
REM Also needed are the following environment variables in the system settings (example values):
REM
REM MONO_EXE = C:\Program Files\Mono\bin\mono.exe
REM PDB2MDB_PATH = C:\Program Files\Mono\lib\mono\4.5\pdb2mdb.exe
REM RIMWORLD_DIR_STEAM = C:\Program Files (x86)\Steam\steamapps\common\RimWorld\
REM RIMWORLD_DIR_STANDALONE = %USERPROFILE%\RimWorld1-0-2408Win64
REM RIMWORLD_MOD_DEBUG = --debugger-agent=transport=dt_socket,address=127.0.0.1:56000,server=y
REM
REM Finally, configure Visual Studio's Debug configuration with the rimworld exe as an external
REM program and set the working directory to the directory containing the exe.
REM
REM To debug, build the project (this script will install the mod), then run "Debug" (F5) which
REM will start RimWorld in paused state. Finally, choose "Debug -> Attach Unity Debugger" and
REM press "Input IP" and accept the default 127.0.0.1 : 56000
@ECHO ON
SETLOCAL ENABLEDELAYEDEXPANSION
SET RIMWORLD_DIR_STEAM=C:\Program Files (x86)\Steam\steamapps\common\RimWorld
SET SOLUTION_DIR=%~2
SET TARGET_DIR=%RIMWORLD_DIR_STEAM%\Mods\%~3
SET TARGET_DEBUG_DIR=%RIMWORLD_DIR_STANDALONE%\Mods\%~3
SET ZIP_EXE="C:\Program Files\7-Zip\7z.exe"
SET HARMONY_PATH=%SOLUTION_DIR%Assemblies\0Harmony.dll
SET MOD_DLL_PATH=%SOLUTION_DIR%Assemblies\%~3.dll
echo "%RIMWORLD_DIR_STEAM%"
IF %1==Debug (
IF EXIST "%HARMONY_PATH:~0,-4%.pdb" (
ECHO "Creating mdb at %HARMONY_PATH%"
"%MONO_EXE%" "%PDB2MDB_PATH%" "%HARMONY_PATH%" 1>NUL
)
IF EXIST "%MOD_DLL_PATH:~0,-4%.pdb" (
ECHO "Creating mdb at %MOD_DLL_PATH%"
"%MONO_EXE%" "%PDB2MDB_PATH%" "%MOD_DLL_PATH%" 1>NUL
)
)
IF %1==Release (
IF EXIST "%HARMONY_PATH%.mdb" (
ECHO "Deleting %HARMONY_PATH%.mdb"
DEL "%HARMONY_PATH%.mdb" 1>NUL
)
IF EXIST "%MOD_DLL_PATH%.mdb" (
ECHO "Deleting %MOD_DLL_PATH%.mdb"
DEL "%MOD_DLL_PATH%.mdb" 1>NUL
)
)
IF EXIST "%RIMWORLD_DIR_STANDALONE%" (
ECHO "Copying to %TARGET_DEBUG_DIR%"
IF NOT EXIST "%TARGET_DEBUG_DIR%" MKDIR "%TARGET_DEBUG_DIR%" 1>NUL
FOR %%D IN (%~4) DO (
XCOPY /I /Y /E "%SOLUTION_DIR%%%D" "%TARGET_DEBUG_DIR%\%%D" 1>NUL
)
FOR %%D IN (%~5) DO (
XCOPY /Y "%SOLUTION_DIR%%%D" "%TARGET_DEBUG_DIR%\*" 1>NUL
)
)
IF EXIST "%RIMWORLD_DIR_STEAM%" (
ECHO "Copying to %TARGET_DIR%"
IF NOT EXIST "%TARGET_DIR%" MKDIR "%TARGET_DIR%"
FOR %%D IN (%~4) DO (
XCOPY /I /Y /E "%SOLUTION_DIR%%%D" "%TARGET_DIR%\%%D" 1>NUL
)
FOR %%D IN (%~5) DO (
XCOPY /Y "%SOLUTION_DIR%%%D" "%TARGET_DIR%\*" 1>NUL
)
%ZIP_EXE% a "%TARGET_DIR%.zip" "%TARGET_DIR%" 1>NUL
)