forked from GoAniWebwrapper/GoAnimate-Offline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.bat
464 lines (445 loc) · 12.7 KB
/
settings.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
title GoAnimate Offline Settings Script
:: Interactive config.bat changer
:: Author: benson#0411
:: License: MIT
:: DON'T EDIT THIS FILE! If you need a text version of the settings like it used to be, edit utilities\config.bat. This file is now just an interface for changing that file.
:: Initialize (stop command spam, clean screen, make variables work, set to UTF-8)
@echo off && cls
SETLOCAL ENABLEDELAYEDEXPANSION
:: Move to base folder, and make sure it worked (otherwise things would go horribly wrong)
pushd "%~dp0"
if !errorlevel! NEQ 0 goto error_location
if not exist utilities\config.bat ( goto error_location )
if not exist start_goanimateoffline.bat ( goto error_location )
goto noerror_location
:error_location
echo Doesn't seem like this script is in the GoAnimate Offline folder.
goto end
:noerror_location
:: Prevents CTRL+C cancelling and keeps window open when crashing
if "!SUBSCRIPT!"=="" (
if "%~1" equ "point_insertion" goto point_insertion
start "" /wait /B "%~F0" point_insertion
exit
)
:point_insertion
:: patch detection
if exist "patch.jpg" echo MESSAGE GOES HERE && goto end
:: Preload variable
set CFG=utilities\config.bat
set TMPCFG=utilities\tempconfig.bat
set SHOWDEVOPTIONS=n
set BACKTODEFAULTTOGGLE=n
set BACKTOCUSTOMTOGGLE=n
set BACKTOCUSTOMTOGGLE2=n
:: Load current settings
if "%SUBSCRIPT%"=="" (
set SUBSCRIPT=y
call !cfg!
set "SUBSCRIPT="
) else (
call !cfg!
)
::::::::::
:: Menu ::
::::::::::
:: this code is a form of hell have fun going through it cause i dont :)
:optionscreen
cls
echo:
echo Enter 0 to leave settings
echo Enter the number next to the option to change it.
echo Enter a ? before the number for more info on the option.
echo:
:: Verbose
if !VERBOSEWRAPPER!==y (
echo ^(1^) Verbose mode is[92m ON [0m
) else (
echo ^(1^) Verbose mode is[91m OFF [0m
)
:: Browser options
if !INCLUDEDCHROMIUM!==y (
echo ^(2^) Browser set to[92m included Chromium [0m
if !APPCHROMIUM!==y (
echo ^(3^) Headless mode is[92m ON [0m
) else (
echo ^(3^) Headless mode is[91m OFF [0m
)
goto postbrowsershow
)
if not !CUSTOMBROWSER!==n (
echo ^(2^) Browser set to[91m custom browser [0m
echo ^(3^) Browser path: !CUSTOMBROWSER!
)
if !INCLUDEDCHROMIUM!==n (
if !CUSTOMBROWSER!==n (
echo ^(2^) Browser set to[91m default system browser [0m
)
)
:postbrowsershow
:: Skip checking dependenceis
if !SKIPCHECKDEPENDS!==n (
echo ^(4^) Checking dependencies is[92m ON [0m
) else (
echo ^(4^) Checking dependencies is[91m OFF [0m
)
:: Waveforms
if exist "wrapper\static\info-nowave.json" (
echo ^(5^) Waveforms are[92m ON [0m
) else (
echo ^(5^) Waveforms are[91m OFF [0m
)
:: Character solid archive
if exist "server\characters" (
echo ^(6^) Original LVM Character IDs are[91m OFF [0m
)
:: Dev options
:: These are really specific options that no casual user would ever really need
if !SHOWDEVOPTIONS!==y (
if !SKIPDEPENDINSTALL!==n (
echo ^(D1^) Installing dependencies is[92m ON [0m
) else (
echo ^(D1^) Installing dependencies is[91m OFF [0m
)
if !DRYRUN!==y (
echo ^(D2^) Dry run mode is[92m ON [0m
) else (
echo ^(D2^) Dry run mode is[91m OFF [0m
)
if !BROWSER_TYPE!==chrome (
echo ^(D3^) Browser type set to[92m Chrome [0m
)
if !BROWSER_TYPE!==firefox (
echo ^(D3^) Browser type set to[91m Firefox [0m
)
if !BROWSER_TYPE!==n (
echo ^(D3^) Browser type[91m not set [0m
)
)
:reaskoptionscreen
echo:
set /p CHOICE=Choice:
if "!choice!"=="0" goto end
:: Verbose
if "!choice!"=="1" (
set TOTOGGLE=VERBOSEWRAPPER
if !VERBOSEWRAPPER!==n (
set TOGGLETO=y
) else (
set TOGGLETO=n
)
set CFGLINE=11
goto toggleoption
)
if "!choice!"=="?1" (
echo When enabled, two extra windows with more info about what Offline is doing.
echo The launcher will also say more about what it's doing, and never clear itself.
echo Mostly meant for troubleshooting and development. Default setting is off.
goto reaskoptionscreen
)
:: Browser settings
if "!choice!"=="2" goto browsertype
if "!choice!"=="?2" (
echo When set to included Chromium, it opens a browser that comes with Offline.
echo This older browser will keep running Flash after new browsers block it completely.
echo If you don't want to use it, you can use your default browser, or a specific executable.
echo Default setting is included Chromium. Most should probably keep that default.
goto reaskoptionscreen
)
if "!choice!"=="3" (
if !INCLUDEDCHROMIUM!==y (
set TOTOGGLE=APPCHROMIUM
if !APPCHROMIUM!==n (
set TOGGLETO=y
) else (
set TOGGLETO=n
)
set CFGLINE=23
goto toggleoption
)
if !CUSTOMBROWSER!==y (
goto setcustombrowser
)
)
if "!choice!"=="?3" (
if !INCLUDEDCHROMIUM!==y (
echo This setting runs Chromium in headless mode, hiding everything except the title bar and webpage.
echo This gives more room to work with, and generally just looks nicer. Default is on.
goto reaskoptionscreen
)
if !CUSTOMBROWSER!==y (
echo This setting defines which browser Offline launches with when set to use a custom browser.
echo This needs to be a path to a browser executable. (exe file, such as chrome.exe)
goto reaskoptionscreen
)
)
:: Check depends
if "!choice!"=="4" (
set TOTOGGLE=SKIPCHECKDEPENDS
if !SKIPCHECKDEPENDS!==n (
set TOGGLETO=y
) else (
set TOGGLETO=n
)
set CFGLINE=14
goto toggleoption
)
if "!choice!"=="?4" (
echo Turning this off skips checking for Flash, Node.js, http-server, and if the HTTPS cert is installed.
echo This is automatically disabled when Offline launches and finds all dependencies.
echo If you're on a new computer, or having issues with security messages, you may wanna turn this back on.
goto reaskoptionscreen
)
:: Waveforms
if "!choice!"=="5" goto waveformchange
if "!choice!"=="?5" (
echo By default, waveforms for audio are generated in the video editor.
echo While useful, the editor freezes while it generates, which could be too annoying or slow for some.
echo Turning this off will simply add a repeating pre-made pattern in place of true waveforms.
goto reaskoptionscreen
)
:: Character solid archive
if exist "server\characters" (
if "!choice!"=="6" goto extractchars
if "!choice!"=="?6" (
echo When first getting GoAnimate Offline, all non-stock characters are put into a single zip file.
echo This is because if they're all separate, extracting takes forever and is incredibly annoying.
echo If you wish to import characters made on the LVM when it was still up and hosted by Vyond,
echo you can extract them here. They will still be compressed, just in separate files to be usable.
goto reaskoptionscreen
)
)
:: Dev options
if /i "!choice!"=="masterkey" (
set SHOWDEVOPTIONS=y
goto optionscreen
)
if !SHOWDEVOPTIONS!==y (
if /i "!choice!"=="D1" (
set TOTOGGLE=SKIPDEPENDINSTALL
if !SKIPDEPENDINSTALL!==n (
set TOGGLETO=y
) else (
set TOGGLETO=n
)
set CFGLINE=17
goto toggleoption
)
if /i "!choice!"=="?D1" (
echo Disabling this will still check for dependencies, but won't install them.
echo I'm not sure why I added this, but I don't have a reason to take it out.
goto reaskoptionscreen
)
if /i "!choice!"=="D2" (
set TOTOGGLE=DRYRUN
if !DRYRUN!==n (
set TOGGLETO=y
) else (
set TOGGLETO=n
)
set CFGLINE=32
goto toggleoption
)
if /i "!choice!"=="?D2" (
echo Turning this on will run through all of the launcher's code without affecting anything.
echo Useful for debugging the launcher without uninstalling things and all that.
goto reaskoptionscreen
)
if /i "!choice!"=="D3" goto manualbrowsertype
if /i "!choice!"=="?D3" (
echo Tells the launcher what kind of browser is in use. Should be autoset by CUSTOMBROWSER.
echo Mostly used by the Flash installer to tell what version to install.
goto reaskoptionscreen
)
)
if "!choice!"=="clr" goto optionscreen
if "!choice!"=="cls" goto optionscreen
if "!choice!"=="clear" goto optionscreen
echo Time to choose. && goto reaskoptionscreen
:::::::::::::::::::
:: Toggle option ::
:::::::::::::::::::
:toggleoption
echo Toggling setting...
:: Find line after setting to edit
set /a AFTERLINE=!cfgline!+1
:: Loop through every line until one to edit
if exist !tmpcfg! del !tmpcfg!
set /a count=1
for /f "tokens=1,* delims=0123456789" %%a in ('find /n /v "" ^< !cfg!') do (
set "line=%%b"
>>!tmpcfg! echo(!line:~1!
set /a count+=1
if !count! GEQ !cfgline! goto linereached
)
:linereached
:: Overwrite the original setting
echo set !totoggle!=!toggleto!>> !tmpcfg!
echo:>> !tmpcfg!
:: Print the last of the config to our temp file
more +!afterline! !cfg!>> !tmpcfg!
:: Make our temp file the normal file
copy /y !tmpcfg! !cfg! >nul
del !tmpcfg!
:: Set in here for displaying
set !totoggle!=!toggleto!
if !BACKTODEFAULTTOGGLE!==y goto backtodefault
if !BACKTOCUSTOMTOGGLE!==y goto backtocustom
if !BACKTOCUSTOMTOGGLE2!==y goto backtocustom2
goto optionscreen
::::::::::::::::::
:: Browser type ::
::::::::::::::::::
:browsertype
echo:
echo:
echo Press 1 to use Offline's included Chromium (recommended)
echo Press 2 to use your default browser set in Windows
echo Press 3 to use a specific browser of your choice
echo Press 0 to cancel changing
echo:
:browserreask
set /p BROWSERCHOICE= Response:
echo:
if /i "!browserchoice!"=="0" goto optionscreen
if /i "!browserchoice!"=="1" (
set TOTOGGLE=INCLUDEDCHROMIUM
set TOGGLETO=y
set CFGLINE=20
goto toggleoption
)
if /i "!browserchoice!"=="2" (
set BACKTODEFAULTTOGGLE=y
set TOTOGGLE=INCLUDEDCHROMIUM
set TOGGLETO=n
set CFGLINE=20
goto toggleoption
:backtodefault
set BACKTODEFAULTTOGGLE=n
set TOTOGGLE=CUSTOMBROWSER
set TOGGLETO=n
set CFGLINE=26
goto toggleoption
)
if /i "!browserchoice!"=="3" goto setcustombrowser
echo You must answer what browser. && goto browserreask
:::::::::::::::::::::::::
:: Custom Browser Path ::
:::::::::::::::::::::::::
:setcustombrowser
echo:
echo Drag a browser executable (such as chrome.exe) into this window and press enter.
echo Enter 0 to cancel changing the custom browser.
:browserpathreask
echo:
set /p TOGGLETO= File:
if /i "!TOGGLETO!"=="0" goto optionscreen
if not exist "!toggleto!" echo That doesn't seem to exist. & goto browserpathreask
:: Set custom browser
set TOTOGGLE=CUSTOMBROWSER
set CFGLINE=26
set BACKTOCUSTOMTOGGLE=y
goto toggleoption
:: Attempt to set browser type
:backtocustom
set BACKTOCUSTOMTOGGLE=n
set BACKTOCUSTOMTOGGLE2=y
for %%a in (!TOGGLETO!) do (
set CBNAME=%%~na
set "TOGGLETO="
:: Chrome-based
if !cbname!==chrome set TOGGLETO=chrome
if !cbname!==chrome64 set TOGGLETO=chrome
if !cbname!==opera set TOGGLETO=chrome
if !cbname!==brave set TOGGLETO=chrome
if !cbname!==microsoftedge set TOGGLETO=chrome
:: Firefox-based
if !cbname!==firefox set TOGGLETO=firefox
if !cbname!==palemoon set TOGGLETO=firefox
:: Stupid
if !cbname!==iexplore echo internet explorer users have no soul & set TOGGLETO=n
:: Unknown
if !toggleto!=="" set TOGGLETO=n
)
set TOTOGGLE=BROWSER_TYPE
set CFGLINE=29
goto toggleoption
:: Turn off included Chromium
:backtocustom2
set BACKTOCUSTOMTOGGLE2=n
set TOTOGGLE=INCLUDEDCHROMIUM
set TOGGLETO=n
set CFGLINE=20
goto toggleoption
:: Manually set browser type (dev option)
:manualbrowsertype
echo:
echo:
echo Press 1 for Chrome
echo Press 2 for Firefox
echo Press 3 for Unknown
echo Press 0 to cancel changing
echo:
:browsertypereask
set /p TYPECHOICE= Response:
echo:
if /i "!typechoice!"=="0" goto end
if /i "!typechoice!"=="1" set TOGGLETO=chrome
if /i "!typechoice!"=="2" set TOGGLETO=firefox
if /i "!typechoice!"=="3" set TOGGLETO=n
echo You must answer with a browser type. && goto browsertypereask
set TOTOGGLE=BROWSER_TYPE
set CFGLINE=29
goto toggleoption
:::::::::::::::
:: Waveforms ::
:::::::::::::::
:waveformchange
echo Toggling setting...
pushd wrapper\static
if exist "info-nowave.json" (
:: disable
ren info.json info-wave.json
ren info-nowave.json info.json
) else (
:: enable
ren info.json info-nowave.json
ren info-wave.json info.json
)
popd
goto optionscreen
::::::::::::::::::::::::
:: Extract Characters ::
::::::::::::::::::::::::
:extractchars
if exist "server\characters" (
echo Are you sure you wish to enable original LVM character IDs?
echo This will take a while, depending on your computer.
echo Characters will still be compressed, just put into separate usable files.
echo Press Y to do it, press N to not do it.
echo:
:replaceaskretry
set /p REPLACECHOICE= Response:
echo:
if not '!replacechoice!'=='' set replacechoice=%replacechoice:~0,1%
if /i "!replacechoice!"=="0" goto end
if /i "!replacechoice!"=="y" goto startextractchars
if /i "!replacechoice!"=="n" goto optionscreen
echo You must answer Yes or No. && goto replaceaskretry
:startextractchars
echo Extracting characters...
echo Please do not close this window!
echo It's likely not frozen, it just takes a while.
echo:
utilities\7za.exe e server\characters -y -o server\characters
del /q server\characters
)
goto optionscreen
:end
endlocal
if "%SUBSCRIPT%"=="" (
echo Closing...
pause & exit
) else (
exit /b
)