@@ -8,29 +8,59 @@ REM In the case of relative paths, they will be relative to the Game installatio
8
8
9
9
SETLOCAL EnableExtensions EnableDelayedExpansion
10
10
11
- SET CALLER = convert-all
11
+
12
+ REM Check if the PATH variable is set or the script is run from inside the directory
13
+ WHERE /q rgo-variables.bat
14
+
15
+ IF ERRORLEVEL 1 (
16
+ echo=
17
+ echo Couldn't find rgo-variables.bat^^!
18
+ echo Please make sure it's in the same directory as this file or is available within
19
+ echo one of the directories added to the PATH variable^^!
20
+ pause
21
+ GOTO :EOF
22
+ )
23
+
24
+
25
+ REM Check for the existance of the lua.exe
26
+ WHERE /q lua.exe
27
+
28
+ IF ERRORLEVEL 1 (
29
+ echo=
30
+ echo Couldn't find lua.exe^^!
31
+ echo Please make sure the lua.exe is available within one of the directories added
32
+ echo to the PATH variable^^!
33
+ pause
34
+ GOTO :EOF
35
+ )
36
+
37
+
38
+ SET " CALLER = convert-all"
12
39
CALL rgo-variables.bat
13
40
14
- REM Check if a paramter was passe or not
41
+
42
+ REM Check if a parameter was passed or not
43
+ REM The parameter will be the destination directory for the extracted files
44
+ REM If none was set, we're using DATA directory inside the original location
15
45
IF " %~1 " == " " (
16
- SET LOCATION = PAKS\DATA
46
+ SET " LOCATION = PAKS\DATA"
17
47
) ELSE (
18
- SET LOCATION = %~1
48
+ SET " LOCATION = %~1 "
19
49
)
20
50
21
51
REM Remove any trailing backslash
22
52
IF %LOCATION:~-1 % == \ (
23
- SET LOCATION = %LOCATION:~0 ,-1 %
53
+ SET " LOCATION = %LOCATION:~0 ,-1 % "
24
54
)
25
55
26
56
27
57
REM Check if the LOCATION contains ":\"
28
58
REM If it does, treat it as an absolute path
29
59
REM Otherwise it's relative to the game dir
30
60
IF NOT x" %LOCATION::\ =% " == x" %LOCATION% " (
31
- SET EXTRACT_DIR = %LOCATION%
61
+ SET " EXTRACT_DIR = %LOCATION% "
32
62
) ELSE (
33
- SET EXTRACT_DIR = %GAME_DIR% \%LOCATION%
63
+ SET " EXTRACT_DIR = %GAME_DIR% \%LOCATION% "
34
64
)
35
65
36
66
@@ -43,16 +73,33 @@ IF EXIST "%EXTRACT_DIR%\" (
43
73
)
44
74
45
75
46
- IF errorlevel 1 (
76
+ IF ERRORLEVEL 1 (
77
+ echo=
78
+ echo -------------------------------------------------------------------------------------
79
+ echo Couldn't create " %EXTRACT_DIR% " , aborting^^!
80
+ echo -------------------------------------------------------------------------------------
81
+ echo=
82
+ echo Maybe the directory is write protected or you do not have sufficient permissions to
83
+ echo access it.
84
+ echo The latter could be the case if you're trying to access a folder inside the
85
+ echo " C:\Program Files" directory, there only programs/scripts with administrator rights
86
+ echo can create folders.
87
+ echo This is very likely if you're running the Steam version of the game.
88
+ echo=
89
+ echo You could try to run the script in administrator mode ^ (not recommended^ ), or you
90
+ echo could could simply provide a destination folder for the extracted files like so:
91
+ echo=
92
+ echo rgo-convert-all.bat " D:\Modding\RGO\DATA"
93
+ echo=
94
+ echo The extracted files will then be copied into this directory.
47
95
echo=
48
- echo Couldn't create %EXTRACT_DIR% , aborting^^!
49
96
pause
50
97
GOTO :EOF
51
98
)
52
99
53
100
IF NOT EXIST " %EXTRACT_DIR% \" (
54
101
echo=
55
- echo Couldn't create %EXTRACT_DIR% , aborting^^!
102
+ echo Couldn't create " %EXTRACT_DIR% " , aborting^^!
56
103
pause
57
104
GOTO :EOF
58
105
)
@@ -61,14 +108,14 @@ IF NOT EXIST "%EXTRACT_DIR%\" (
61
108
62
109
REM Extract all files
63
110
echo Extracting all .PAK files...
64
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA.PAK" " %EXTRACT_DIR% "
65
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA0.PAK" " %EXTRACT_DIR% "
66
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA1.PAK" " %EXTRACT_DIR% "
67
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA2.PAK" " %EXTRACT_DIR% "
68
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA3.PAK" " %EXTRACT_DIR% "
69
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA4.PAK" " %EXTRACT_DIR% "
70
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA5.PAK" " %EXTRACT_DIR% "
71
- lua " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% \ DATA6.PAK" " %EXTRACT_DIR% "
111
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA.PAK" " %EXTRACT_DIR% "
112
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA0.PAK" " %EXTRACT_DIR% "
113
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA1.PAK" " %EXTRACT_DIR% "
114
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA2.PAK" " %EXTRACT_DIR% "
115
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA3.PAK" " %EXTRACT_DIR% "
116
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA4.PAK" " %EXTRACT_DIR% "
117
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA5.PAK" " %EXTRACT_DIR% "
118
+ lua.exe " %UTILS_DIR% \unpack.lua" " %GAME_PAK_DIR% DATA6.PAK" " %EXTRACT_DIR% "
72
119
73
120
74
121
REM Convert all the files to .lua
@@ -81,34 +128,34 @@ pushd "%EXTRACT_DIR%"
81
128
82
129
REM Convert the original files
83
130
FOR /R %%F IN (*.WDAT, *.IMAGESET, *.DAT) DO (
84
- SET LUA_FILE = %%F .lua
131
+ SET " LUA_FILE = %%F .lua"
85
132
86
133
rem echo File: %%F
87
- rem echo LUA_FILE: !LUA_FILE!
134
+ rem echo LUA_FILE: " !LUA_FILE!"
88
135
89
- lua " %UTILS_DIR% \dat2lua.lua" " %%F " " !LUA_FILE! "
136
+ lua.exe " %UTILS_DIR% \dat2lua.lua" " %%F " " !LUA_FILE! "
90
137
91
- IF NOT errorlevel 1 (
92
- rem echo Created !LUA_FILE!
138
+ IF NOT ERRORLEVEL 1 (
139
+ rem echo Created " !LUA_FILE!"
93
140
) ELSE (
94
- echo ERROR: Could not create !LUA_FILE!
141
+ echo ERROR: Could not create " !LUA_FILE! "
95
142
)
96
143
)
97
144
98
145
99
146
REM Convert the layout files
100
147
FOR /R %%F IN (*.LAYOUT) DO (
101
- set LUA_FILE = %%F .lua
148
+ SET " LUA_FILE = %%F .lua"
102
149
103
150
rem echo File: %%F
104
- rem echo LUA_FILE: !LUA_FILE!
151
+ rem echo LUA_FILE: " !LUA_FILE!"
105
152
106
- lua " %UTILS_DIR% \layout2lua.lua" " %%F " " !LUA_FILE! "
153
+ lua.exe " %UTILS_DIR% \layout2lua.lua" " %%F " " !LUA_FILE! "
107
154
108
- IF NOT errorlevel 1 (
109
- rem echo Created !LUA_FILE!
155
+ IF NOT ERRORLEVEL 1 (
156
+ rem echo Created " !LUA_FILE!"
110
157
) ELSE (
111
- echo ERROR: Could not create !LUA_FILE!
158
+ echo ERROR: Could not create " !LUA_FILE! "
112
159
)
113
160
)
114
161
0 commit comments