-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemvoy.bat
More file actions
6185 lines (5478 loc) · 215 KB
/
emvoy.bat
File metadata and controls
6185 lines (5478 loc) · 215 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
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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- : Begin Batch Script
:top
@echo off
setlocal enableextensions enabledelayedexpansion
:: -----------------------------------------------------------------------------------------------------------
:: Temp Echo on/off toggle
set _echo=off
set _subecho=
SET /P _echo="'Type 'o' for echo on> "
if %_echo% == [] do set _echo=off
echo input = %_echo%
if [%_echo%]==[o] (
set _echo=on
) else (
set _echo=off)
echo echo = %_echo%
@echo %_echo%
echo ====================================================
echo.
cls
:START_OF_FINAL
:: ===========================================================
:: SETUP VARIABLES
:: ============================================================
:: Pre-Var tests
::
:: ===========================================================
:GLOBAL_VARS
:: ============================================================
:: Paths to EMVOY files and folders:
:: ---------------------------------------------------------------------------
Echo Resetting Env Vars
Set _=""
Echo Setting Constants...
set EmvoyPath=%~dp0
set EmvoyPath=%EmvoyPath:~0,-1%
set _EmuDirPath=%EmvoyPath%\Emulators
set _GamesDirPath=%EmvoyPath%\Games
set _LogsDirPath=%EmvoyPath%\Logs
set _SupportDirPath=%EmvoyPath%\Support
echo.
:: ---------------------------------------------------------------------------
:: Script/Other apps globals- Do not change
:: ---------------------------------------------------------------------------
:: Wizzapp vars:
set waico=C:\GameEx\AHKS_BATS\Launchers\Emvoy\Emvoy\Assets\EmLogo.ico
set watitle=Emvoy System Menu
set wasig=Emvoy by stigzler
:: ---------------------------------------------------------------------------
:: ==========================================================
:: /END GLOBALS
:: ==========================================================
:: ----------------------------------------------------------
:: Start Logging
%EmvoyPath:~0,2%
cd %EmvoyPath%
break>Logs/emvoy.log
set _log1=^>^> Logs/emvoy.log
echo Start of Emvoy Log %_log1%
echo Last run: %date% %time% %_log1%
echo. %_log1%
set watext=Cmd parameters and Boot Profile Loaded....~~Checking any parameters....
set wabmp=Assets\page\Splash.bmp
start /w wizapp PB OPEN
:: Show Progress Bar
set watitle=EmVoy Startup
set watext=Starting Emvoy, please wait....~~Reading Command Line parameters....
::start /w wizapp PB OPEN
:: ----------------------------------------------------------
echo " ____ ____ _ _ ____ ____ __ "
echo "( _ \/ ___)( \/ )(_ _)( _ \ / _\ "
echo " ) __/\___ \ ) ( )( ) // \"
echo "(__) (____/(_/\_) (__) (__\_)\_/\_/"
echo .
echo # Starting EmVoy...%_log1%
echo. %_log1%
:PRETESTS
%EmvoyPath:~0,2%
cd %EmvoyPath%
REM set _tempBootSel=1
REM set _tmpBoot_dpsProfName=Get out more
REM copy emvoy.ini "%EmvoyPath%\Boots\{%_tempBootSel%} %_tmpBoot_dpsProfName%.txt"
::goto :FunctionTests
::exit /b
::goto :skip
::call :IniCmd /m listtxt /f emvoy.ini /k _dpsProfName /t testlist.txt
::exit /b
REM SET "missing="
REM FOR /L %%a IN (0,1,99) DO IF NOT DEFINED missing (
REM find "[%%a]" emvoy.ini>NUL
REM IF ERRORLEVEL 1 SET /a "missing=%%a"
REM )
:: echo Lowest: %missing%
REM call :LoadTempIni 30 emvoy.ini _tmpBoot
REM set _tmpBoot
REM exit /b
::call :CopyRecord Emulators\emulators.ini 4 _emuName replace "{Copy} "
::call ::DeleteRecord Emulators\Emulators.ini 5 Emulators\EmulatorList.ini _emuName
::call :IniCmd /m listxk /f emvoy.ini /k _dpsProfName
::exit /b
echo :: ==========================================================
:: exit /b
:skip
:: ==========================================================
:CMD_VARS
:: ==========================================================
:: Acquire command line switches
:: ==========================================================
echo =============================================================================
echo # Processing parameters passed from Command Line--%_log1%
echo =============================================================================
:: ======================================================
:: PASSED VARIABLES + Derivations
:: Command Line Format:
:: Emvoy -d [gamefile dir] -f [filename with extension] -p [boot Profile]
:: -e [boot emu for game] -g [alternative game name to auto generated one]
:: Above in any order. All optional.
::
:: If you do not send -f, it will automatically set the Profile to 0 (default) if the
:: default boot profile has SkipAdmin enabled. This is because you will have to select
:: a game
::
:: -e overrides general default setting in Emvoy but individual game config overrides
:: this. Thus emulator decided in this order (rightmost being final emulator used:
:: Emvoy default > Cmd line > Game setting.
:: Best route is set up default emulator in the admin menu, but good for initial testing.
::
:: -p specifies the boot profile. This allows you different Emvoy setups. E.g. testing,
:: setup and final run. You can set your own profiles in Emvoy.
::
:: -g You can pass a more user-friendly name if the file/folder name is ugly. If you're
:: using a Front-End, often the 'database' or friendly name can be put into your command line.
::
:: e.g.1 - Ugly name
:: Emvoy.bat -d "I:\roms"" -f "Wipeout 3 [NTSC-U] [SLUS-00865].7z" -p 2 -e 1 -g "Wipeout 3"
:: e.g.2 - Launch Game with profile that skips admin menus and doesn't keep separate quicklaunch
:: Emvoy.bat -d "I:\roms"" -f "Wipeout XL.7z" -p 3 (Profile 3 skips admin menu and Qlaunch folder)
:: ==============================================================
:: Obtain values from switches
Echo # Parsing command line for switches and values:%_log1%
echo ---------------------------------------------------------------------------------------------------
:: Backup original cmd line and passed values
set _cmdorig=%*
set _cmdorig1=%1
set _cmdorig2=%2
set _cmdorig3=%3
set _cmdorig4=%4
set _cmdorig5=%5
:PARSELOOP
IF [%1]==[] GOTO ENDPARSE
IF [%1]==[-d] SET _cmdRomDir=%2
IF [%1]==[-f] (
SET _cmdFilename=%2
Set _cmdGamename=%~n2
)
IF [%1]==[-p] SET _cmdProfile=%2
IF [%1]==[-e] SET _cmdDefEmu=%2
IF [%1]==[-g] SET _cmdSpecGameName=%2
SHIFT
GOTO PARSELOOP
:ENDPARSE
::echo Values from Command line:%_log1%
echo Original cmd line: [%_cmdorig%]%_log1%
echo Directory: [%_cmdRomDir%]%_log1%
echo File: [%_cmdFilename%]%_log1%
echo Profile: [%_cmdProfile%]%_log1%
echo Default Emulator: [%_cmdDefEmu%]%_log1%
echo Specified Gamename: [%_cmdSpecGameName%]%_log1%
echo Dequoted game name: [%_cmdGamename%]%_log1%
echo ---------------------------------------------------------------------------------------------------
:: END switch acquire
::pause
:: Load in relevant profile
:ChooseLoadProfile
echo -------- oooooOOOOOooooooo --------
echo ---------------------------------------------------------------------------------------------------
echo # Loading correct Boot Profile depending on circumstances....%_log1%
echo ---------------------------------------------------------------------------------------------------
:: Retrieve Defualt Profile dets in boot seciton of ini
echo Reading Default Profile number from emvoy.ini:%_log1%
call :IniCmd /m read /s "X-boot" /k _dpsDefProfile /f emvoy.ini
set _tempBootProfile=%IniCmd%
set _tempGameFile=""
echo Default Boot Profile in EmVoy.ini is [%IniCmd%]
echo.
Echo Testing command line switches and load subsequent relevant boot profile:
If not [%_cmdProfile%] == [] (
echo Profile is set in command line. Checking if a file passed too...%_log1%
If "%_cmdGamename%" == "" (
echo No gamefile is specified in command line. Checking whether profile has 'Skip admin' enabled....%_log1%
echo.%_log1%
call :IniCmd /m read /s %_cmdProfile% /k _dpsSkipAdmin /f emvoy.ini
set perc=%IniCmd%
set excl=!IniCmd!
if [!IniCmd!] == [true] (
echo Profile has 'Skip Admin' enabled. Thus, no game to boot nor menu to load. Setting to safe profile ^(0^) to enable menu.%_log1%
set _tempBootProfile=X-Safeboot
) else (
echo Profile has 'Skip admin' disabled. Using Profile from cmd line. %_log1%
set _tempBootProfile=%_cmdProfile%
)
) else (
echo There is a gamefile specified.%_log1%
set _tempBootProfile=%_cmdProfile%
echo Setting profile to that passed from command line.%_log1%
)
) else (
echo There is no boot profile specified in the command line.%_log1%
echo Retriving details of default profile. %_log1%
echo.
call :IniCmd /m read /s X-boot /k _dpsDefProfile /f emvoy.ini
set _tempBootProfile=!IniCmd!
echo Default profile: [!_tempBootProfile!]%_log1%
REM echo Checking staus of Skip Admin in this profile...%_log1%
REM echo.%_log1%
REM call :IniCmd /m read /s !_tempBootProfile! /k _dpsSkipAdmin /f emvoy.ini
REM echo Skip Admin in defualt profile: [!IniCmd!]%_log1%
echo Checking if gamefile specified:%_log1%
If "%_cmdGamename%" == "" (
echo No gamefile is specified in command line. Checking whether the default profile has 'Skip admin' enabled....%_log1%
echo.%_log1%
call :IniCmd /m read /s !_tempBootProfile! /k _dpsSkipAdmin /f emvoy.ini
echo Skip Admin in defualt profile: [!IniCmd!]%_log1%
if [!IniCmd!] == [true] (
echo Profile has 'Skip Admin' enabled. Thus, no game to boot nor menu to load. Setting to safe profile ^(0^) to enable menu.%_log1%
set _tempBootProfile=X-Safeboot
) else (
Echo Profile has Skip Admin disabled. Therefore, preserving Default Profile. %_log1%
)
) else (
Echo There is a Game specified. Therefore safe to set to Default Profile whether Skip Admin enabled or not. %_log1%
echo Profile maintained as default profile. %_log1%
)
)
set _dpsProfNo=%_tempBootProfile%
:: Load in all Profile variables
call :LoadIni %_dpsProfNo% emvoy.ini
echo Boot Profile Coice complete:
echo =====================================%_log1%
Echo Boot Profile being used is: [%_dpsProfNo%]%_log1%
Echo Boot Profile Name: [%_dpsProfName%]%_log1%
echo Boot Profile Description: %_dpsProfDesc%%_log1%
echo =====================================%_log1%
echo ---------------------------------------------------------------------------------------------------
echo.%_log1%
:: =================== /End Choose Profile
::pause
set watext=Cmd parameters and Boot Profile Loaded....~~Checking any parameters....
start /w wizapp PB UPDATE 20
echo ------------ oooooOOOOOOoooooo -------------
echo ---------------------------------------------------------------------------------------------------
echo File and Filepath operations if passed by command line:
echo ---------------------------------------------------------------------------------------------------
echo Check whether filename or path have been passed:
if [%_cmdFilename%] == [] (
echo No filename passed in cmd. Setting Game Profile to 'none' and booting to admin menu.
set _admGameProfile=X-NoGame
goto :Boot_admin_Menu
)
if [%_cmdRomDir%] == [] (
echo No filepath passed in cmd. Setting Game Profile to 'none' and booting to admin menu.
set _admGameProfile=X-NoGame
goto :Boot_admin_Menu
)
echo ** Game file and path passed, check they exist:
:Game_Filepath_Vars
:: Checks if the gamefile directory exists - if not either log entry or user message depending on settings.
:: At end of process, _cmdRomDir is dequoted.
echo Set ROM and check directory%_log1%
Echo Raw recieved Directory param: %_cmdRomDir% %_log1%
call :dequote _cmdRomDir
:: Check Dir exists!
echo Checking if [%_cmdRomDir%] exists:%_log1%
if Not exist "%_cmdRomDir%" (
echo Game Direcotry doesn't exist! %_log1%
if [%_dpsUserUpdate%] == [true] (
echo User prompt box - times out after 20s %_log1%
call :MsgBoxMsg "You have passed an invalid Games Directory path. Please check your command line or file structure." 20 "Emvoy Startup Error" 48
) else (
echo User promtps set to false in emvoy.ini. %_log1%
)
set _admGameProfile=X-NoGame
echo ****** goto start of admin menu *********
goto :WAHome
)
echo ** Game Directory exists **%_log1%
echo Game Direcotry finishes as: [%_cmdRomDir%]%_log1%
echo.%_log1%
:: ==================== / End Filepath AVrs
:Game_Filename_Vars
:: Process File Parameter from cmd
:: Produces _dpsAutoGameName= Auto generated from filename and cleaned for illegal chars
:: _dpsSpecGameName= Taken from cmd line and Cleaned for illegal chars
echo # Check file exists to process. Also produces an AutoGameName from this. %_log1%
echo Also 'cleans' the AutoGameName and Specified game name (in cmd) of illegar characters. %_log1%
echo Also produces a 'clean' filename - Used in field _gameKey
echo.
echo Raw recived File param: [%_cmdFilename%%_log1%]
call :dequote _cmdFilename
::echo Final Filename: [%_cmdFilename%]%_log1%
echo Checking [%_cmdFilename%] file exists:%_log1%
%_cmdRomDir:~0,2%
cd %_cmdRomDir%
if Not exist "%_cmdRomDir%/%_cmdFilename%" (
echo Game File doesn't exist! %_log1%
echo User prompt box - times out after 20s
if [%_dpsUserUpdate%] == [true] (
call :MsgBoxMsg "You have passed an invalid Game filename. Please check your command line or file structure." 20 "Emvoy Startup Error" 48
Echo Presnting USer prompt - times out after 20s. %_log1%
)
set _admGameProfile=X-NoGame
echo ****** goto start of admin menu *********
goto :WAHome
)
%EmvoyPath:~0,2%
cd %EmvoyPath%
echo ** Gamefile of that filename exists **%_log1%
::echo Producing 'clean' file name
call :CleanVar "%_cmdFilename%"
set _dpsCleanFilename=%CleanVar%
echo 'Clean' fielname: [%_dpsCleanFilename%]
echo.
echo # Producing Auto gamename from filename.%_log1%
set _dpsAutoGameName=%_cmdGamename%
::echo removing file extention: [%_dpsAutoGameName%]
::echo Sending RawAutoGameName. Removing invalid characters.%_log1%
call :CleanVar "%_dpsAutoGameName%"
::echo Setting GameName to cleaned string.%_log1%
set _dpsAutoGameName=%CleanVar%
Echo Resulting AutoGamename: [%_dpsAutoGameName%] %_log1%
echo.
echo # Producing Specified Gamnename from command line.%_log1%
call :dequote _cmdSpecGameName
::echo Dequoted: [%_cmdSpecGameName%]
::echo Cleaning variable. Removing invalid characters.%_log1%
call :CleanVar "%_cmdSpecGameName%"
::echo Setting specified game name to cleaned string.%_log1%
set _dpsSpecGameName=%CleanVar%
Echo Resulting Specified Gamename: [%_dpsSpecGameName%] %_log1%
echo.
echo ----------------------------------------------------------------------
echo SUMMARY:
echo Filename ^(cmdFilename^): [%_cmdFilename%]%_log1%
echo 'Clean' filename ^(dpsCleanFilename^): [%_dpsCleanFilename%]%_log1%
Echo AutoGamename ^(dpsAutoGameName^): [%_dpsAutoGameName%] %_log1%
Echo Specified Gamename ^(dpsSpecGameName^): [%_dpsSpecGameName%] %_log1%
echo ----------------------------------------------------------------------
::pause
echo.
set watext=Files checked, gamenames specified....~~Setting Emulator and Game Profile....
start /w wizapp PB UPDATE 40
echo -------------------END OF FILE OPERATIONS FROM CMD LINE----------------------------------
:: ================= /End Gamename Vars
echo.
:TESTS
:: ===========================================================
:: TEST SCRIPTS
:: ============================================================
::cd Games
::call :IniCmd /m list /f emvoy.ini
:: echo %IniCmd%
:: exit /b
:: ===========================================================
:: /TEST SCRIPTS
:: ============================================================
:Set_adm_vars_to_cmds
:: Process Command and any existing Game Profile vars and setup for admin.
echo =============================================================================
echo Pre-admin processing of any Cmd vars%_log1%
echo =============================================================================
echo.%_log1%
::echo Setting to home Emvoy directory.
%EmvoyPath:~0,2%
cd %EmvoyPath%
echo # Setting admin vars from boot:
::echo Dim all admin vars
set _adm=
:: stuff
echo ---------------------------------------------------------------------------------------------------
echo # Determine which emulator to use
echo ---------------------------------------------------------------------------------------------------
echo Emulator passed from cmd line: [%_cmdDefEmu%]
:: if cmd emu not null - cycle through list of emus and check it corresponds to one
echo Searching emulator record set for matching emu:
if not [%_cmdDefEmu%] == [] (
call :IniCmd /m list /f Emulators\emulators.ini
echo Cycling through array to find a match...
for /L %%S in (1,1,!IniCmd[0]!) do (
echo !IniCmd[%%S]!
if "!IniCmd[%%S]!" == "%_cmdDefEmu%" (
set _admEmuNo=%_cmdDefEmu%
echo There is an Emulator record matching the command switch. Set _admEmuNo to: [!_admEmuNo!]
if [!_admEmuNo!] == [design] (
echo You cannot use the 'design' record as an Emulator. Setting to Boot Profile default [%_dpsDefEmu%]
set _admEmuNo=%_dpsDefEmu%
)
) else (
echo The above Emultor key does not match the command line swith.
)
)
if [!_admEmuNo!] == [] (
echo There are no emulators that match the command line switch. Using default emulator specified in the boot profile.
set _admEmuNo=!_dpsDefEmu!
)
) else (
echo !_dpsDefEmu!
set _admEmuNo=!_dpsDefEmu!
echo There is no Emulator number passed by the command line. Using default emulator specified in the boot profile.
echo Setting _admEmuNo to: [!_admEmuNo!]
)
echo * Final Emu used: [%_admEmuNo%]
echo.
echo ---------------------------------------------------------------------------------------------------
echo # Set files and file paths
echo ---------------------------------------------------------------------------------------------------
echo Transfer full filename to admin variable _admFilename:
set _admFilename=%_cmdFilename%
echo Full Filename used is: [%_admFilename%]
echo Transfer full filepath to admin variable _admRomDir:
set _admRomDir=%_cmdRomDir%
echo Full Filepath used is: [%_cmdRomDir%]
echo Transfer Cleaned filename to admin var _adm_CleanFilename - used as key in games settings
set _admCleanFilename=%_dpsCleanFilename%
echo Clean Fielname used is: [%_admCleanFilename%]
echo Constructing Key GameProfile name - Clean Filename + Emulator
call :IniCmd /m read /s %_admEmuNo% /k _emuName /f Emulators\emulators.ini
set _admGameProfileKey=%_admCleanFilename% {%_admEmuNo%.%IniCmd%}
echo Final GameProfile Key: [%_admGameProfileKey%]
echo.
set watext=Set other profiles....~~Delaing with Game Name....
start /w wizapp PB UPDATE 60
echo ---------------------------------------------------------------------------------------------------
echo # Set Game name
echo ---------------------------------------------------------------------------------------------------
:: Retrieve Game Profile status
Echo Check to see if Game profile exists for Game Profile name
::call :IniCmd /m list /f Games\games.ini
call :IniCmd /m listxk /f Games\games.ini /k _gameKey
set _tempGameProfExist=
for /L %%S in (1,1,%IniCmd[0]%) do (
echo !IniCmd[%%S]!
if "!IniCmd[%%S]!" == "%_admGameProfileKey%" (
echo * Game Profile already exists for file passed by command line.
set _tempGameProfExist=true
set _admGameProfile=!IniCmd[%%S,1]!
echo GameProf = !_admGameProfile!
goto :Boot_admin_Menu
)
)
if not [%_tempGameProfExist%] == [true] (
echo * Game Profile does NOT exist for file passed by command line.
set _tempGameProfExist=false
)
echo * Game Profile exists: [%_tempGameProfExist%]
echo.
:: Next conditional on cmd line structure
echo Test whether user sent /g gamename and set the admin gamename accordingly:
if not "%_cmdFilename%" == "" if "%_dpsSpecGameName%" == "#null#" if [%_tempGameProfExist%] == [false] (
echo File passed form cmd, no Specified gamename and no profile exists. Setting _admGameName to AutoGameName
set _admGameName=%_dpsAutoGameName%
)
if not "%_cmdFilename%" == "" if not "%_dpsSpecGameName%" == "#null#" if [%_tempGameProfExist%] == [false] (
echo File passed from cmd, game name specified and no profile exists. Setting _admGameName to dpsSpecGameName
set _admGameName=%_dpsSpecGameName%
)
if not "%_cmdFilename%" == "" if not "%_dpsSpecGameName%" == "#null#" if [%_tempGameProfExist%] == [true] (
echo File passed from cmd, game name specified and profile already exists for this file.
echo Ignoring Specified gamename as also specified in profile. User message if enabled in Default Profile.
if [%_dpsUserPrompt%] == [true] (
if [%_dpsUserUpdate%] == [true] (
call :MsgBoxMsg "Conflict: Game Profile already exists for this file and a Game Name is specified in the command line. Booting with the Game Name in the Game Profile. Ignoring command line switch." 10 "Emvoy Startup Message" 48
)
)
)
echo *Resulting Game Name passed to admin or launch:_admGameName: [%_admGameName%]
echo.
::Pause
echo =============================================================================
echo Summary of _adm vars so far:
echo =============================================================================
set _adm
set _cmd
echo =============================================================================
echo.
set watext=GameName processed....~~Making new Game Profile....
start /w wizapp PB UPDATE 80
::pause
:Load_relevant_profiles
echo ---------------------------------------------------------------------------------------------------
echo Loading Emulator Profile:
call :LoadIni %_admEmuNo% Emulators\emulators.ini
echo ---------------------------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------------------------
echo Test whether existing profile. If not, write one.
echo tempgameprofexists: [%_tempGameProfExist%]
if [%_tempGameProfExist%] == [true] (
echo Profile exists - go stright to admin menu.
echo _admGameProfile: [%_admGameProfile%]
goto :Boot_admin_Menu
)
echo Game profile does not exist.
echo ---------------------------------------------------------------------------------------------------
echo Loading Emulator Profile:
call :LoadIni %_admEmuNo% Emulators\emulators.ini
:: If doesn't exist - make it
echo Create Game Profile.
:: have to set _admGameProfile to number generated
echo Finding lowest available record number...
call :_FreeRecordNo Games\games.ini
set _admGameProfile=%_FreeRecordNo%
pause
:: Remove dupes from Also Run concatenation
set _tmpstring=%_dpsAlsoLaunch%,%_emuAlsoLaunch%
echo Concat AlsoRun:%_tmpstring%:
SET "_admAlsoLaunch=,"
IF DEFINED _tmpstring FOR %%a IN (%_tmpstring%) DO (SET "_admAlsoLaunch=!_admAlsoLaunch:,%%a,=,!%%a,")
SET "_admAlsoLaunch=%_admAlsoLaunch:~1,-1%"
echo _admAlsoLaunch:%_admAlsoLaunch%:
pause
call :WriteIni X-write_frm_cmd_template "%_admGameProfile%" Games\games.ini
call :CreateSelectionList Games\games.ini _gameListName Games\GamePList.ini
echo.
:Boot_admin_Menu
echo Admin menu final boot loads
echo Loading Game Profile:
:: Load Inis
call :LoadIni %_admGameProfile% Games\games.ini
call :LoadIni %_gameEmu% Emulators\emulators.ini
call :CreateGPReportCmd
REM echo ---------------------------------------------------------------------------------------------------
REM set _game
REM echo ---------------------------------------------------------------------------------------------------
REM echo.
goto :WAHome
exit /b
echo /b Quit before Main process
::EXIT /b
:: ======================================================
:MAIN_PROCEEDURE
:: ======================================================
:: ------------- Create / Use Quicklaunch Folder------------------
:: Use or setup Quicklaunch folder
:: --- Check whether Quicklaunch folder already exists + forward if does
:: ------ Also Launch
:: Put routine in here to check for duplicates....
echo Checking whether quicklaunch folder already exists for this game....
If exist "%gamename%" (
cd %gamename%
if %adminmode% == admin (
call :MsgBox "Quickstart folder exists..lauching game..." "vbOKonly" "Admin Message" )
if %adminmode% == prompt (
call :MsgBoxMsg "Quicklaunch Folder Exists." 1 "Progress Message" 0 )
echo Quicklaunch exists.... going onto launch
goto mountstart
)
:: Make Quicklaunch folder as one doesn't exist:
echo Folder doesn't exist. Making Quicklaunch folder....
mkdir "%gamename%"
cd "%gamename%"
:: Copy setup files to Quicklaunch folder
echo Moving operational files to folder and unzipping game rom to folder...
:: Create msg box vb in game folder
if %adminmode% == admin (
call :MsgBox "No existing Quickstart folder, create one..." "vbOKonly" "Admin Message" )
if %adminmode% == prompt (
call :MsgBoxMsg "No Quicklaunch Folder. Creating one..." 1 "Progress Message" 0 )
:: Copy over relevant operating files:
copy "%zipdir%\7zG.exe"
copy "%PakkISOdir%\unecm.exe"
copy "%PakkISOdir%\pakkiso.exe"
copy "%PakkISOdir%\MAC.exe"
:: Unzip Game Zip to Quicklaunch folder:
7zG e "%directory%\%file%"
echo Deleting any empty folders...
:: Delete empty folders:
for /f "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"
:: -----------------ECM, APE operations + tidy up---------------
:ecmproc
if %adminmode% == admin (
call :MsgBox "Decompress ECM..." "vbOKonly" "Admin Message" )
if %adminmode% == prompt (
call :MsgBoxMsg "Decompressing ECM Files..." 1 "Progress Message" 0 )
set ecmfile=nullecm
for /F "delims=" %%a in ('dir /b *.ecm') do set ecmfile=%%~na
echo Identified ECM file: "%ecmfile%"
if "%ecmfile%" == "nullecm" (
echo No ECMs Found
goto apeproc )
echo ECMs found. Decompress then delete ecm files
unecm.exe *.ecm
del "*.ecm"
:apeproc
if %adminmode% == admin (
call :MsgBox "Decompress APE..." "vbOKonly" "Admin Message" )
if %adminmode% == prompt (
call :MsgBoxMsg "Decompressing APE files.." 1 "Progress Message" 0 )
echo Uncompress APE files
for %%i in ("*.ape") do mac "%%i" "%%~ni.wav" -d && sox.exe "%%~ni.wav" -t raw -s -c 2 -w -r 44100 "%%~ni.bin" && del "*.wav"
:: Get rid of all processing exes:
echo Remove process exes
del "*.exe"
:: --------------- Game Launch ------------------------------------
:mountstart
:: ----- Determine which file to use for launch --------
:: set launchfile as iso, mds, cue or ccd in reverse priority
echo Determining launchfiles:
set launchfile=Undetermined
echo ISO:
for /F "delims=" %%a in ('dir /b *.iso') do set launchfile=%%~na.iso
echo Launchfile is now %launchfile%
echo MDS:
for /F "delims=" %%a in ('dir /b *.mds') do set launchfile=%%~na.mds
echo Launchfile is now %launchfile%
echo CUE:
for /F "delims=" %%a in ('dir /b *.cue') do set launchfile=%%~na.cue
echo Launchfile is now %launchfile%
echo CCD:
for /F "delims=" %%a in ('dir /b *.ccd') do set launchfile=%%~na.ccd
echo Final launchfile is: %launchfile%
if %adminmode% == admin (
call :MsgBox "Mount Image and start emulation" "vbOKonly" "Admin Message" )
if %adminmode% == prompt (
call :MsgBoxMsg "Launching Game..." 1 "Progress Message" 0 )
echo Launching game...
"%DTexe%/DTLite.exe" -mount scsi, 0, "%launchfile%"
C:
cd C:\Emulators\PLaystation\ePSXe190
start/wait epsxe.exe -nogui -loadmemc0 "memcards\%gamename%"
::ping -n 3 localhost > nul
"%DTexe%" -unmount scsi, 0
:: ----------------------- Quicklaunch Folder administration ---------------
:: Rejoin Quickstart folder
%quicklaunchdir:~0,2%
cd %quicklaunchdir%
echo check for admin mode
Echo adminmode - %adminmode%
If %adminmode% == admin (
echo Choose whether to keep Quickstart folder or not...
call :MsgBox "Keep Quickstart folder?" "VBYesNo+VBQuestion" "Admin Message"
if errorlevel 7 (
echo NO - don't keep folder
rmdir /s /q "%gamename%"
call :MsgBox "Deleting Quicklaunch Folder..." "vbOKonly" "Admin Message" )
goto EndScript
) else if errorlevel 6 (
echo YES - keep folder
call :MsgBox "Keeping Quicklaunch Folder..." "vbOKonly" "Admin Message"
goto Tidy
)
) else (
If %qlaunch% == delete (
echo No admin mode. Default discard Quicklaunch game folder
If %adminmode% == prompt (
call :MsgBoxMsg "Using default - %qlaunch% Quicklaunch Folder" 1 "Progress Message" 0 )
rmdir /s /q "%gamename%"
goto EndScript
) else (
echo No admin mode. Default of keep Quicklaunch game folder used...
If %adminmode% == prompt (
call :MsgBoxMsg "Using default - %qlaunch% (keep) Quicklaunch Folder" 1 "Progress Message" 0 )
)
)
:: ----------------- Tidy + End ---------------------------------
:Tidy
cd "%gamename%"
echo Tidying Quicklaunch folder...
:EndMainProceedure
If %adminmode% == admin If %adminmode% == prompt (
call :MsgBoxMsg "Process Complete" 1 "Progress Message" 0 )
echo The End!
echo Phew....
exit /b
EXIT /b
:: ========================================================
:: END MAIN PROCEEDURE
:: ========================================================
:: ======================================================
:ADMIN_MENU
:: ======================================================
:: -----------------------------------------------------------
:: Main Menu
:: -----------------------------------------------------------
:: NOTES
:: in main menu, read values from boot to direct first run
:: e.g. firstrun=emultor needed , then profile needed
:: i.e. firstrun=trrue
:: then force walk through add emulator directly followed by add profile
::
:: in edit profile, disable selecting profile 0 (safe prof)
::
:: message on home page if safeboot detected
::
:: =========================================================================================
:WAHome
:: =========================================================================================
set watitle=EmVoy Admin Menu
start /w wizapp PB UPDATE 100
start /w wizapp PB CLOSE
:: Clear Vars
:: Check for run status (1st run limits options)
call :IniCmd /m read /f emvoy.ini /s X-boot /k _dpsSetupStatus
if [%IniCmd%] == [BootProfNeeded] (
set WAErrorText=This is the first time you have run EmVoy. Directing to boot settings to set your boot defaults.
set WAErrorRet=WAPxtrDefaults1
call :WAError
Echo place direction here
)
if [%IniCmd%] == [EmuNeeded] (
set WAErrorText=This is the first time you have run EmVoy. Directing to boot settings to set your boot defaults.
set WAErrorRet=WAPxtrDefaults1
call :WAError
echo place goto here
)
call :WAClearVarsPage
set watext=Boot: %_dpsProfNo%. %_dpsProfName% ~^
Game: %_admGameProfile%. ^%_gameListName%~^
(Updtd^): %_gameUpdate:~0,-13%~^
File: %_gameFile%~^
Emu: %_emuName%~^
(Updtd^): %_emuUpdate:~0,-13%~^
~What would you like to do now?
set wabmp=Assets\page\home.bmp
:: Construct Menu options depending on boot status:
set wainput= Change Default Settings; Select Different Game Profile
set waoutnum=0
if not "%_admGameProfile%" == "X-NoGame" (
set wainput=%wainput%; Edit Game Profiles; List Functions; Boot Game Profile
)
set wanum=0
set wabat=%TEMP%\wabat.bat
set wasig=Home
start /w wizapp NOBACK RB
if errorlevel 2 (
echo BOOTING GAME!!!!!
exit /b
)
if errorlevel 1 exit /b
call %wabat%
if %waoutnum%==0 goto :WAEmDefaultsHome
if %waoutnum%==1 goto :WAGamePSel
if %waoutnum%==2 goto :WAEmGamePSettsHome
if %waoutnum%==3 goto :WAEmRomList
if %waoutnum%==4 goto :eof
goto :WAHome
goto :WAHome
:: ====================================================================
:: GAME PROFILE SELECT
:: ====================================================================
:WAGamePSel
call :WAClearVarsPage
set wabmp=Assets\page\GameEdit.bmp
call :WAEmSel "Which Game Profile would you like to use?~~" Assets\page\Games.bmp Games\GamePList.ini _admGameProfile :WAHome :WAHome
echo New Game Profile Selected: %_admGameProfile%
call :LoadIni %_admGameProfile% Games\games.ini
call :LoadIni %_gameEmu% Emulators\emulators.ini
echo Loaded Game Profile and corresponding Emulator.
goto :WAHome
:: ====================================================================
:: LISTS HOME
:: ====================================================================
:WAEmListsHome
call :WAClearVarsPage
set wabmp=Assets\page\Setts.bmp
set watext=What?
Set wainput= Refresh ROM List for this Boot Profile; Emulator Settings; Support App Settings
set waoutnum=0
set wabat=%TEMP%\wabat.bat
set wasig=Home^>Settings
start /w wizapp RB
if errorlevel 2 goto :WAHome
if errorlevel 1 goto :WAHome
call %wabat%
if "%waoutnum%"=="0" (
echo Refreshing ROMList for boot profile.
goto :WAEmRomList
)
if "%waoutnum%"=="1" (
echo Going to Emulator Settings Menu
goto :WAEmEmuSettsHome
)
if "%waoutnum%"=="2" (
echo Going to Support App Settings
goto :WAEmSuppSettsHome
)
goto :WAEmListsHome
:WAEmRomList
call :WAClearVarsPage
echo on
call :CreateGameROMList "%_dpsRomDir%" "%_dpsProfName%.ini"
goto :WAEmListsHome
:: ====================================================================
:: SETTINGS HOME
:: ====================================================================
:WAEmDefaultsHome
:: Wizapp Set Emvoy Defaults process
:: Set temp default values:
:: Show Summary Boot, Emu and Support Dets
call :WAClearVarsPage
set wabmp=Assets\page\Setts.bmp
set watext=What settings would you like to change?
Set wainput= Boot Settings; Emulator Settings; Support App Settings
set waoutnum=0
set wabat=%TEMP%\wabat.bat
set wasig=Home^>Settings
start /w wizapp RB
if errorlevel 2 goto :WAHome
if errorlevel 1 goto :WAHome
call %wabat%
if "%waoutnum%"=="0" (
echo Going to Boot Settings Menu
goto :WAEmBootSettsHome
)
if "%waoutnum%"=="1" (
echo Going to Emulator Settings Menu
goto :WAEmEmuSettsHome
)
if "%waoutnum%"=="2" (
echo Going to Support App Settings
goto :WAEmSuppSettsHome
)
goto :WAEmDefaultsHome
:: ====================================================================
:: SETTINGS : BOOT
:: ====================================================================
:WAEmBootSettsHome
:: ====================================================================
call :WAClearVarsPage
set wafile=
set wabmp=Assets\page\BootSetts.bmp
set watext=Summary of current Default Boot Profile:~
set watext=%watext%Current Boot: %_dpsProfName% ^(%_dpsProfNo%^)~
set watext=%watext%Quicklaunch: %_dpsQLaunch%~
call :IniCmd /m read /f Emulators\emulators.ini /s %_dpsDefEmu% /k _emuName
set watext=%watext%Defualt Emu: %IniCmd%~
set watext=%watext%Skip Menu: %_dpsSkipAdmin%~
set watext=%watext%User Update: %_dpsUserUpdate%~
set watext=%watext%^(Edit the profile to review its full settings^)~~
Set wainput= Create a new Boot Profile; Edit an exisitng Boot Pofile; Copy a Boot Profile; Delete a Boot Profile; Set the default Boot Profile
set waoutnum=1
set wabat=%TEMP%\wabat.bat
set wasig=Home^>Settings^>Boot
start /w wizapp RB
if errorlevel 2 goto :WAHome
if errorlevel 1 goto :WAEmDefaultsHome
call %wabat%
if "%waoutnum%"=="0" (
echo Going to New Boot Profile Wizard
goto :WAEmBootNew
)
if "%waoutnum%"=="1" (
echo Going to Edit Boot Profile wizard
goto :WAEmBootEditSetup
)
if "%waoutnum%"=="2" (
echo Going to Copy Boot Profile wizard.
goto :WAEmBootCopy
)
if "%waoutnum%"=="3" (
echo Going to Delete Boot Profile wizard.
goto :WAEmBootDel
)
if "%waoutnum%"=="4" (
echo Going to Change default Boot Profile.
goto :WAEmBootDefSel
)
goto :WAEmBootSettsHome
:WAEmBootDefSel
:: ------------- SELECT DEFAULT PROFILE ---------------------------
call :WAClearVarsPage
echo Select Default Boot Profile
call :WAEmSel "Which Boot Pro file would you like to set as the Default Boot Profile?~~N.B. This will require you to manually re-boot EmVoy" Assets\page\BootEdit.bmp Boots\BootProfiles.ini _tempBootSel :WAEmBootSettsHome :WAEmBootSettsHome
call :IniCmd /m read /f emvoy.ini /s %_tempBootSel% /k _dpsProfName
set _tmpBoot_ProfFilename={%_tempBootSel%} %IniCmd%.txt
set wasig=Home^>Settings^>Boot^>Default Boot