MakeQSP.bat 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. tools\Textmerge.exe locations glife.txt glife.qproj
  85. tools\cli-win.exe 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. tools\cli-win.exe 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. python tools\txtmerge.py locations glife.txt
  126. @ECHO ON
  127. "%QSPParser%" --level warn "%BATDir%glife.txt" > "%BATDir%validation.log"
  128. @ECHO off
  129. :: End timer
  130. set end=%time%
  131. call :elapsedtime
  132. pause
  133. goto menu
  134. :run
  135. echo.
  136. echo Running ...
  137. if defined CP_TO ( start "%BATDir%%QSPGUI%" %CP_TO%\%QSPFILE% ) else ( start "%BATDir%%QSPGUI%" %QSPFILE% )
  138. :exit
  139. :elapsedtime
  140. set options="tokens=1-4 delims=:.,"
  141. for /f %options% %%a in ("%start%") do (
  142. set start_h=%%a
  143. set /a start_m=100%%b %% 100
  144. set /a start_s=100%%c %% 100
  145. set /a start_ms=100%%d %% 100
  146. )
  147. for /f %options% %%a in ("%end%") do (
  148. set end_h=%%a
  149. set /a end_m=100%%b %% 100
  150. set /a end_s=100%%c %% 100
  151. set /a end_ms=100%%d %% 100
  152. )
  153. set /a ms=end_ms-start_ms
  154. if %ms% lss 0 (
  155. set /a ms+=100
  156. set /a end_s-=1
  157. )
  158. set /a secs=end_s-start_s
  159. if %secs% lss 0 (
  160. set /a secs+=60
  161. set /a end_m-=1
  162. )
  163. set /a mins=end_m-start_m
  164. if %mins% lss 0 (
  165. set /a mins+=60
  166. set /a end_h-=1
  167. )
  168. set /a hours=end_h-start_h
  169. if %hours% lss 0 (
  170. set /a hours+=24
  171. )
  172. if %ms% lss 10 set ms=0%ms%
  173. if %secs% lss 10 set secs=0%secs%
  174. if %mins% lss 10 set mins=0%mins%
  175. if %hours% lss 10 set hours=0%hours%
  176. if %hours% neq 0 (
  177. set elapsedtime=%hours%:%mins%:%secs%.%ms%
  178. ) else if %mins% neq 0 (
  179. set elapsedtime=%mins%:%secs%.%ms%
  180. ) else (
  181. set elapsedtime=%secs%.%ms%
  182. )
  183. echo Elapsed time: %elapsedtime%
  184. endlocal & set elapsedtime=%elapsedtime%
  185. :exit