MakeQSP.bat 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. @ECHO off
  2. setlocal
  3. :: Set batch file path
  4. set BATDir=%~dp0
  5. :: Set those lines to fit your setup.
  6. :: This is where glife.qsp will be copied. If you don't want to move it just comment (::) the line below.
  7. :: set CP_TO=..\GL_ECV
  8. :: This is the program used to open the QSPFILE. If you comment this line windows will launch the default app for the ".qsp" extension.
  9. set QSPGUI=tools\Player-video\qspgui.exe
  10. set QGEN=tools\QGen5\QGen.exe
  11. :: The file that will be generated or open
  12. set QSPFILE=glife.qsp
  13. :: Chimrod validation tool
  14. set QSPParser=tools\Parser\qsp_parser.exe
  15. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16. :menu
  17. cls
  18. echo.
  19. echo :: Girl Life - QSP Compiler and Launcher ::
  20. echo.
  21. if defined QGEN (
  22. if not exist "%BATDir%%QGEN%" (
  23. echo QGEN : [ERROR] - "%BATDir%%QGEN%" not found. Using DEFAULT application.
  24. set QGEN=
  25. ) else (
  26. echo QGEN : [OK] - "%BATDir%%QGEN%")
  27. ) else echo QGEN : [NOT DEFINED] - Using DEFAULT application.
  28. if defined QSPGUI (
  29. if not exist "%BATDir%%QSPGUI%" (
  30. echo QSP EXEC : [ERROR] -"%BATDir%%QSPGUI%" not found.
  31. set QSPGUI=
  32. ) else ( echo QSP EXEC : [OK] - "%BATDir%%QSPGUI%")
  33. ) else ( echo QSP EXEC : [NOT DEFINED] - Using Windows DEFAULT.)
  34. if defined QSPFILE (
  35. if not exist "%BATDir%%QSPFILE%" (
  36. echo QSP FILE : [WARNING] - "%BATDir%%QSPFILE%" not found.
  37. ) else ( echo QSP FILE : [OK] - "%BATDir%%QSPFILE%")
  38. ) else ( echo QSP FILE : [NOT DEFINED] - ERROR: CAN'T CONTINUE.)
  39. if defined CP_TO (
  40. if not exist "%CP_TO%" (
  41. echo COPY : [ERROR] - Destination "%CP_TO%" not found. Copy DISABLED.
  42. set CP_TO=
  43. ) else ( echo COPY : [OK] - "%CP_TO%")
  44. ) else ( echo COPY : [DISABLED] )
  45. if defined QSPParser (
  46. if not exist "%BATDir%%QSPParser%" (
  47. echo QSP Parser : [WARNING] - "%BATDir%%QSPParser%" not found.
  48. echo Please visit the Girl Life Discord to download the latest version.
  49. ) else ( echo QSP Parser : [OK] - "%BATDir%%QSPParser%")
  50. ) else ( echo QSP Parser : [NOT FOUND - DISABLED ] )
  51. echo.
  52. if defined NOT_FOUND (
  53. echo ERROR: Option '%action%' wasn't recognized. Is it lowercase?
  54. set NOT_FOUND=
  55. )
  56. echo.
  57. echo ACTIONS: (B)uild (D)ebug (R)un (F)ull (Q)Gen (V)alidate (E)xit
  58. echo.
  59. set /p action=Choose an action:
  60. if defined QSPFILE (
  61. if %action% == b goto build
  62. if %action% == B goto build
  63. if %action% == d goto build_debug
  64. if %action% == D goto build_debug
  65. if %action% == r goto run
  66. if %action% == R goto run
  67. if %action% == f goto build
  68. if %action% == F goto build
  69. if %action% == v goto parser
  70. if %action% == V goto parser
  71. if %action% == q goto qgen
  72. if %action% == Q goto qgen
  73. )
  74. if %action% == e goto exit
  75. if %action% == E goto exit
  76. set NOT_FOUND=1
  77. goto menu
  78. :build
  79. echo.
  80. echo Building ...
  81. :: Start timer
  82. set start=%time%
  83. @ECHO ON
  84. "%BATDir%tools\Textmerge.exe" "%BATDir%locations" "%BATDir%glife.txt" "%BATDir%glife.qproj"
  85. "%BATDir%tools\cli-win.exe" "%BATDir%glife.txt"
  86. @ECHO OFF
  87. echo.
  88. if defined CP_TO ( echo Copying %QSPFILE% to "%CP_TO%" ... & copy %QSPFILE% %CP_TO% > nul )
  89. :: End timer
  90. set end=%time%
  91. call :elapsedtime
  92. echo.
  93. echo Done.
  94. pause
  95. if %action% == f ( goto run ) else ( goto menu )
  96. :build_debug
  97. :: Start timer
  98. set start=%time%
  99. echo.
  100. echo Building DEBUG ...
  101. @ECHO ON
  102. python tools\build_debug.py locations glife.txt
  103. "%BATDir%tools\cli-win.exe" "%BATDir%glife.txt"
  104. @ECHO OFF
  105. echo.
  106. if defined CP_TO ( echo Copying %QSPFILE% to "%CP_TO%" ... & copy %QSPFILE% %CP_TO% > nul )
  107. :: End timer
  108. set end=%time%
  109. call :elapsedtime
  110. echo.
  111. echo Done.
  112. pause
  113. goto menu
  114. :qgen
  115. echo.
  116. echo Running ...
  117. if defined CP_TO ( start %QGEN% %CP_TO%\%QSPFILE% ) else ( start %QGEN% %QSPFILE% )
  118. pause
  119. goto menu
  120. :parser
  121. :: Start timer
  122. set start=%time%
  123. echo.
  124. echo validating...
  125. @ECHO ON
  126. "%BATDir%%QSPParser%" --level warn "%BATDir%glife.txt" > "%BATDir%validation.log"
  127. @ECHO off
  128. :: End timer
  129. set end=%time%
  130. call :elapsedtime
  131. pause
  132. goto menu
  133. :run
  134. echo.
  135. echo Running ...
  136. if defined CP_TO ( start "%BATDir%%QSPGUI%" %CP_TO%\%QSPFILE% ) else ( start "%BATDir%%QSPGUI%" %QSPFILE% )
  137. :exit
  138. :elapsedtime
  139. set options="tokens=1-4 delims=:.,"
  140. for /f %options% %%a in ("%start%") do (
  141. set start_h=%%a
  142. set /a start_m=100%%b %% 100
  143. set /a start_s=100%%c %% 100
  144. set /a start_ms=100%%d %% 100
  145. )
  146. for /f %options% %%a in ("%end%") do (
  147. set end_h=%%a
  148. set /a end_m=100%%b %% 100
  149. set /a end_s=100%%c %% 100
  150. set /a end_ms=100%%d %% 100
  151. )
  152. set /a ms=end_ms-start_ms
  153. if %ms% lss 0 (
  154. set /a ms+=100
  155. set /a end_s-=1
  156. )
  157. set /a secs=end_s-start_s
  158. if %secs% lss 0 (
  159. set /a secs+=60
  160. set /a end_m-=1
  161. )
  162. set /a mins=end_m-start_m
  163. if %mins% lss 0 (
  164. set /a mins+=60
  165. set /a end_h-=1
  166. )
  167. set /a hours=end_h-start_h
  168. if %hours% lss 0 (
  169. set /a hours+=24
  170. )
  171. if %ms% lss 10 set ms=0%ms%
  172. if %secs% lss 10 set secs=0%secs%
  173. if %mins% lss 10 set mins=0%mins%
  174. if %hours% lss 10 set hours=0%hours%
  175. if %hours% neq 0 (
  176. set elapsedtime=%hours%:%mins%:%secs%.%ms%
  177. ) else if %mins% neq 0 (
  178. set elapsedtime=%mins%:%secs%.%ms%
  179. ) else (
  180. set elapsedtime=%secs%.%ms%
  181. )
  182. echo Elapsed time: %elapsedtime%
  183. endlocal & set elapsedtime=%elapsedtime%
  184. :exit