2020-08-23 11:25:03 +08:00
@ rem
: : Alas Run Tool v3
: : Author: whoamikyo (https://kyo.ninja)
: : Version: 3.0
2020-09-27 16:02:49 +08:00
: : Last updated: 2020-09-08
2020-08-25 02:06:36 +08:00
: : https://github.com/LmeSzinc/AzurLaneAutoScript
2020-06-24 21:26:54 +08:00
@ echo off
2020-08-24 11:55:16 +08:00
chcp | find " 932 " > NUL && set " IME=true " || set " IME=false "
if " %IME% " == " true " (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-14 05:42:34 +08:00
echo == Incorrect encoding, visit this link to correct: https://bit.ly/34t8ubY
2020-09-27 16:02:49 +08:00
echo == You may not have classical backslashes, you may have problems to run ALAS
2020-08-24 23:29:42 +08:00
start https://bit.ly/34t8ubY
2020-09-27 16:02:49 +08:00
echo == To copy, select the link and CTRL+SHIFT+C
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-24 11:55:16 +08:00
pause
goto : eof
)
2020-08-23 13:25:44 +08:00
pushd " %~dp0 "
2020-08-23 11:25:03 +08:00
setlocal EnableDelayedExpansion
2020-08-26 08:17:59 +08:00
set " Version=3.0 "
2020-09-27 16:02:49 +08:00
set " lastUpdated=2020-08-27 "
2020-08-23 11:25:03 +08:00
: : Remote repo
2020-08-26 08:17:59 +08:00
set " Remoterepo=https://raw.githubusercontent.com/LmeSzinc/AzurLaneAutoScript/master/toolkit "
2021-02-12 05:04:17 +08:00
set " Requirements=https://raw.githubusercontent.com/LmeSzinc/AzurLaneAutoScript/master/requirements.txt "
2020-08-23 11:25:03 +08:00
rem ================= Preparation =================
: : Set the root directory
2020-08-26 08:17:59 +08:00
set " root= %~dp0 "
2020-08-23 11:25:03 +08:00
set " root= %root:~0,-1% "
cd " %root% "
2020-09-14 05:42:34 +08:00
rem call :ExitIfNotPython
2020-08-23 11:25:03 +08:00
2020-08-24 11:55:16 +08:00
rem ================= Variables =================
set " pyBin= %root% \toolkit\python.exe "
set " adbBin= %root% \toolkit\Lib\site-packages\adbutils\binaries\adb.exe "
set " gitBin= %root% \toolkit\Git\mingw64\bin\git.exe "
set " curlBin= %root% \toolkit\Git\mingw64\bin\curl.exe "
set " api_json= %root% \config\api_git.json "
set " AlasConfig= %root% \config\alas.ini "
set " template= %root% \config\template.ini "
set " gitFolder= %root% \.git "
2021-02-10 09:58:59 +08:00
set " logFolder= %root% \log\ "
2020-08-24 11:55:16 +08:00
2021-02-11 17:24:16 +08:00
set " _pyBin= %root% \toolkit "
set " _GitBin= %root% \toolkit\Git\mingw64\bin "
set " _adbBin= %root% \toolkit\Lib\site-packages\adbutils\binaries "
set " PATH= %root% \toolkit\alias; %root% \toolkit\command; %_pyBin% ; %_pyBin% \Scripts; %_GitBin% ; %_adbBin% ; %PATH% "
2020-08-25 02:06:36 +08:00
: : Import main settings (%Language%, %Region%, %SystemType%).
2020-08-23 11:25:03 +08:00
call command\Get.bat Main
: : Import the Proxy setting and apply. Then show more info in Option6.
2020-08-27 07:50:53 +08:00
call : Emulator_SetupFirstRun
2020-08-23 11:25:03 +08:00
call command\Get.bat Proxy
2020-08-26 09:13:01 +08:00
call command\Get.bat InfoOpt1
2020-08-23 11:25:03 +08:00
: : If already deployed, show more info in Option3.
2020-08-26 09:13:01 +08:00
call command\Get.bat InfoOpt2
2020-08-23 11:25:03 +08:00
rem call command\Get.bat InfoOpt4
call command\Get.bat DeployMode
: : Start of Deployment
2021-02-12 05:32:18 +08:00
set " pipLog= %root% \toolkit\log\pip_update_log_ %datetime% .log "
2021-02-13 11:53:19 +08:00
set " pipLogFolder= %root% \toolkit\log\ "
2020-08-23 11:25:03 +08:00
if " %IsUsingGit% " == " yes " if " %DeployMode% " == " unknown " ( xcopy /Y toolkit\config .git\ > NUL )
call : UpdateChecker_Alas
2020-09-27 18:13:30 +08:00
title ^| Alas Run Tool V3 ^| Branch: %BRANCH% ^| Git hash: %LAST_LOCAL_GIT% ^| commit date: %GIT_CTIME% ^|
2020-08-23 11:25:03 +08:00
rem ================= Menu =================
: MENU
cd " %root% "
cls
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
: : Uncomment to debug the configuration that imported from "config\deploy.ini"
2021-02-12 04:32:12 +08:00
echo == ^| Language: %Language% & echo == ^| Region: %Region% & echo == ^| SystemType: %SystemType%
2020-09-27 18:13:30 +08:00
rem echo == ^| http_proxy: %http_proxy% & echo https_proxy: %https_proxy%
2021-02-10 08:28:14 +08:00
echo == ^| DeployMode: %DeployMode%
echo == ^| KeepLocalChanges: %KeepLocalChanges%
echo == ^| RealtimeMode: %RealtimeMode%
echo == ^| AutoMode: %AutoMode%
2020-09-27 18:13:30 +08:00
rem echo == ^| FirstRun: %FirstRun%
2021-02-10 08:28:14 +08:00
echo == ^| IsUsingGit: %IsUsingGit%
echo == ^| Serial: %SerialDeploy%
2020-08-23 11:25:03 +08:00
setLocal EnableDelayedExpansion
2020-09-27 18:13:30 +08:00
set " STR= ^ | Alas Run Tool %Version% ^ | "
set " SIZE=119 "
2020-08-23 11:25:03 +08:00
set " LEN=0 "
: strLen_Loop
2020-09-27 18:13:30 +08:00
if not " !!STR:~ %LEN% !! " == " " set /A " LEN+=1 " & goto : strLen_Loop
set " equal======================================================================================================================== "
set " spaces======================================================================================================================== "
2020-08-23 11:25:03 +08:00
call echo %% equal:~0,%SIZE% %%
set /a " pref_len= %SIZE% - %LEN% -2 "
set /a " pref_len/=2 "
set /a " suf_len= %SIZE% - %LEN% -2- %pref_len% "
2020-09-27 18:13:30 +08:00
call echo %% spaces:~0,%pref_len% %% %% STR%% %% spaces:~0,%suf_len% %% =====
2020-08-23 11:25:03 +08:00
call echo %% equal:~0,%SIZE% %%
endLocal
echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2021-02-10 08:28:14 +08:00
if " %AutoMode% " == " enable " ( echo . && echo AutoMode is On, to disable go to config/deploy.ini and disable && goto %DefaultServer% )
2020-09-20 02:34:30 +08:00
echo . & echo [*] Select your Server/GUI Language
2020-08-23 11:25:03 +08:00
echo ^|
echo ^| -- [1] EN
echo ^|
echo ^| -- [2] CN
echo ^|
echo ^| -- [3] JP
2020-10-27 02:22:13 +08:00
echo ^|
echo ^| -- [4] TW
2020-08-23 11:25:03 +08:00
echo .
2020-10-29 04:45:57 +08:00
echo . & echo [5] Updater
echo . & echo [6] Settings
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
set choice = 0
set /p choice = Please input the option and press ENTER:
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
if " %choice% " == " 1 " goto en
if " %choice% " == " 2 " goto cn
if " %choice% " == " 3 " goto jp
2020-10-27 02:22:13 +08:00
if " %choice% " == " 4 " goto tw
if " %choice% " == " 5 " goto Updater_menu
if " %choice% " == " 6 " goto setting
2020-08-23 11:25:03 +08:00
echo . & echo Please input a valid option.
pause > NUL
goto MENU
rem ================= OPTION 1 =================
: en
2021-03-03 11:11:37 +08:00
set " GUI=EN "
2020-08-23 11:25:03 +08:00
call : CheckBsBeta
2020-08-27 07:50:53 +08:00
rem :continue_en
rem call :AdbConnect
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
echo Python Found in %pyBin% Proceeding..
echo Opening alas_en.pyw in %root%
%pyBin% alas_en.pyw
echo Press any key to back main menu
pause > NUL
goto : MENU
rem ================= OPTION 2 =================
: cn
2021-03-03 11:11:37 +08:00
set " GUI=CN "
2020-08-23 11:25:03 +08:00
call : CheckBsBeta
2020-08-27 07:50:53 +08:00
rem call :AdbConnect
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
echo Python Found in %pyBin% Proceeding..
2020-11-28 18:25:56 +08:00
echo Opening alas_cn.pyw in %root%
2020-08-23 11:25:03 +08:00
%pyBin% alas_cn.pyw
echo Press any key to back main menu
pause > NUL
goto : MENU
rem ================= OPTION 3 =================
: jp
2021-03-03 11:11:37 +08:00
set " GUI=JP "
2020-08-23 11:25:03 +08:00
call : CheckBsBeta
2020-08-27 07:50:53 +08:00
rem call :AdbConnect
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
echo Python Found in %pyBin% Proceeding..
2020-11-28 18:25:56 +08:00
echo Opening alas_jp.pyw in %root%
2020-08-23 11:25:03 +08:00
%pyBin% alas_jp.pyw
echo Press any key to back main menu
pause > NUL
goto : MENU
rem ================= OPTION 4 =================
2020-10-27 02:22:13 +08:00
: tw
2021-03-03 11:11:37 +08:00
set " GUI=TW "
2020-10-27 02:22:13 +08:00
call : CheckBsBeta
rem call :AdbConnect
echo =======================================================================================================================
echo Python Found in %pyBin% Proceeding..
echo Opening alas_tw.pyw in %root%
%pyBin% alas_tw.pyw
echo Press any key to back main menu
pause > NUL
goto : MENU
rem ================= OPTION 5 =================
2020-08-23 11:25:03 +08:00
: Updater_menu
: Run_UpdateAlas
set source = " origin "
if " %Region% " == " cn " set " source=gitee "
echo . & echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2021-02-11 17:24:16 +08:00
echo == ^| Branch in use: %Branch%
echo == ^| KeepLocalChanges is: %KeepLocalChanges%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2021-02-10 08:28:14 +08:00
if " %AutoMode% " == " enable " ( goto proceed_alas )
2020-08-23 11:25:03 +08:00
set opt6_opt4_choice = 0
2021-02-11 17:24:16 +08:00
echo . & echo == ^| Change default Branch (master/dev), please enter T;
echo == ^| To proceed update using Branch: %Branch% , please enter Y;
echo == ^| Back to Updater menu, please enter N;
2020-08-26 08:17:59 +08:00
set /p opt6_opt4_choice = Press ENTER to cancel:
2020-08-23 11:25:03 +08:00
echo .
if /i " %opt6_opt4_choice% " == " T " (
call command\Config.bat Branch
) else if /i "%opt6_opt4_choice%"=="Y" (
goto proceed_alas
) else if /i "%opt6_opt4_choice%"=="N" (
goto ReturnToMenu
2020-08-16 01:36:32 +08:00
) else (
2021-02-11 17:24:16 +08:00
echo == ^| Invalid input. Cancelled.
2020-08-23 11:25:03 +08:00
goto ReturnToMenu
2020-08-16 01:36:32 +08:00
)
2020-08-23 11:25:03 +08:00
: proceed_alas
if " %KeepLocalChanges% " == " disable " (
2021-02-11 17:24:16 +08:00
echo == ^| GIT Found in %gitBin% Proceeding
echo == ^| Updating from %source% repository..
2020-08-23 11:25:03 +08:00
%gitBin% fetch %source% %Branch%
%gitBin% reset --hard %source% /%Branch%
%gitBin% pull --ff-only %source% %Branch%
2021-02-17 05:54:06 +08:00
if " %Region% " == " cn " set " pip_option=--index-url=https://pypi.tuna.tsinghua.edu.cn/simple "
echo == ^| Updating requirements.txt
call pip install -r requirements.txt %pip_option% --no-warn-script-location > %pipLog%
echo == ^| requirements.txt updated!
2021-02-11 17:24:16 +08:00
echo == ^| DONE!
2021-02-13 11:53:19 +08:00
echo . & echo == ^| Please re-run this batch to make the settings take effect.
echo == ^| Please re-run the " alas.bat " to make the settings take effect.
goto PleaseRerun
2020-08-14 02:24:26 +08:00
) else (
2021-02-11 17:24:16 +08:00
echo == ^| GIT Found in %gitBin% Proceeding
echo == ^| Updating from %source% repository..
2020-08-23 11:25:03 +08:00
%gitBin% stash
%gitBin% pull %source% %Branch%
%gitBin% stash pop
2021-02-17 05:54:06 +08:00
if " %Region% " == " cn " set " pip_option=--index-url=https://pypi.tuna.tsinghua.edu.cn/simple "
2021-02-22 08:34:15 +08:00
echo == ^| Updating PIP
call pip install %pip_option% --upgrade pip
2021-02-17 05:54:06 +08:00
echo == ^| Updating requirements.txt
call pip install -r requirements.txt %pip_option% --no-warn-script-location > %pipLog%
echo == ^| requirements.txt updated!
2021-02-13 11:53:19 +08:00
echo == ^| DONE!
echo . & echo == ^| Please re-run this batch to make the settings take effect.
echo == ^| Please re-run the " alas.bat " to make the settings take effect.
goto PleaseRerun
2020-08-18 06:26:30 +08:00
)
2020-08-23 11:25:03 +08:00
2021-02-12 04:32:12 +08:00
2020-08-23 11:25:03 +08:00
: update_toolkit
2020-09-17 04:37:56 +08:00
echo == is not done yet
2020-08-23 11:25:03 +08:00
pause > NUL
goto ReturnToSetting
rem ================= OPTION 5 =================
: Setting
cls
setLocal EnableDelayedExpansion
2020-08-26 08:17:59 +08:00
set " STR2=Advanced Settings= "
2020-09-27 18:13:30 +08:00
set " SIZE=119 "
2020-08-23 11:25:03 +08:00
set " LEN=0 "
: strLen_Loop
2020-09-27 18:13:30 +08:00
if not " !!STR2:~ %LEN% !! " == " " set /A " LEN+=1 " & goto : strLen_Loop
set " equal======================================================================================================================== "
set " spaces======================================================================================================================== "
2020-08-23 11:25:03 +08:00
call echo %% equal:~0,%SIZE% %%
set /a " pref_len= %SIZE% - %LEN% -2 "
set /a " pref_len/=2 "
set /a " suf_len= %SIZE% - %LEN% -2- %pref_len% "
call echo =%% spaces:~0,%pref_len% %% %% STR2%% %% spaces:~0,%suf_len% %% =
call echo %% equal:~0,%SIZE% %%
endLocal
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-25 02:06:36 +08:00
echo == Please re-run this batch to make any settings take effect
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
echo .
echo . & echo [0] Return to the Main Menu
echo . & echo [1] Select Download Region
echo . & echo [2] Set Global Proxy
2020-08-27 07:50:53 +08:00
echo . & echo [3] Emulator Auto-ADB Settings
echo . & echo [4] (Disable/Enable) Keep local changes
echo . & echo [5] Change default Branch to update (master/dev)
echo . & echo [6] (Disable/Enable) Kill ADB server at each start
2020-09-20 02:34:30 +08:00
echo . & echo [7] (Disable/Enable) ADB connect at each start
echo . & echo [8] Replace ADB from chinese emulators
echo . & echo [9] Why can't I toggle certain settings above?
echo . & echo [10] Reset Settings
2021-02-10 08:28:14 +08:00
echo . & echo [11] (Disable/Enable) AutoMode
2020-08-23 11:25:03 +08:00
echo . & echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
set opt2_choice = -1
set /p opt2_choice = Please input the index number of option and press ENTER:
echo . & echo .
if " %opt2_choice% " == " 0 " goto MENU
if " %opt2_choice% " == " 1 " goto Region_setting
if " %opt2_choice% " == " 2 " goto Proxy_setting
2020-08-27 07:50:53 +08:00
if " %opt2_choice% " == " 3 " goto Emulator_Setup
if " %opt2_choice% " == " 4 " goto Keep_local_changes
if " %opt2_choice% " == " 5 " goto Branch_setting
if " %opt2_choice% " == " 6 " goto settings_KilADBserver
2020-09-20 02:34:30 +08:00
if " %opt2_choice% " == " 7 " goto settings_ADBconnect
if " %opt2_choice% " == " 8 " goto menu_ReplaceAdb
2020-08-24 23:29:42 +08:00
if " %opt2_choice% " == " 9 " goto Reset_setting
2020-09-20 02:34:30 +08:00
if " %opt2_choice% " == " 10 " goto Reset_setting
2021-02-10 08:28:14 +08:00
if " %opt2_choice% " == " 11 " goto AutoMode
2020-08-23 11:25:03 +08:00
echo Please input a valid option.
goto ReturnToSetting
2020-08-27 07:50:53 +08:00
: Region_setting
echo The current Download Region is: %Region%
echo Chinese users, it is recommended to switch to Gitee, Option [2]
echo [1] Origin (Github) ; [2] CN mirror (Gitee)
set opt3_choice = -1
set /p opt3_choice = Please input the option and press ENTER:
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
if " %opt3_choice% " == " 1 " ( call command\Config.bat Region origin && goto PleaseRerun )
if " %opt3_choice% " == " 2 " ( call command\Config.bat Region cn && goto PleaseRerun )
goto ReturnToSetting
: Realtime_mode
call command\Config.bat RealtimeMode
if " %FirstRun% " == " yes " ( set FirstRun = no && call command\Config.bat FirstRun %FirstRun% )
goto PleaseRerun
2021-02-10 08:28:14 +08:00
: AutoMode
echo . & echo [*] Select your DEFAULT Server/GUI Language
echo ^|
echo ^| -- [1] EN
echo ^|
echo ^| -- [2] CN
echo ^|
echo ^| -- [3] JP
echo ^|
echo ^| -- [4] TW
echo .
echo =======================================================================================================================
set choice = 0
set /p choice = Please input the option and press ENTER:
echo =======================================================================================================================
if " %choice% " == " 1 " set DefaultServer = en && call command\Config.bat DefaultServer %DefaultServer%
if " %choice% " == " 2 " set DefaultServer = cn && call command\Config.bat DefaultServer %DefaultServer%
if " %choice% " == " 3 " set DefaultServer = jp && call command\Config.bat DefaultServer %DefaultServer%
if " %choice% " == " 4 " set DefaultServer = tw && call command\Config.bat DefaultServer %DefaultServer%
call command\Config.bat AutoMode
goto PleaseRerun
2020-08-27 07:50:53 +08:00
: Keep_local_changes
call command\Config.bat KeepLocalChanges
goto ReturnToSetting
: settings_KilADBserver
call command\Config.bat AdbKillServer
goto ReturnToSetting
2020-09-20 02:34:30 +08:00
: settings_ADBconnect
call command\Config.bat Adbconnect
goto ReturnToSetting
2020-08-27 07:50:53 +08:00
: Proxy_setting
call command\Get.bat Proxy
if " %state_globalProxy% " == " enable " (
echo Global Proxy: enabled
) else ( echo Global Proxy: disabled ^(DEFAULT^) )
echo . & echo .
echo If Global Proxy is enabled, the Proxy Server of current CMD window will be:
echo HTTP_PROXY = %__proxyHost% :%__httpPort%
echo HTTPS_PROXY = %__proxyHost% :%__httpsPort%
set opt6_opt3_choice = 0
echo . & echo To (disable/enable) the Global Proxy, please enter T;
echo To reset to the default Proxy Server, please enter Y;
echo To customize the Proxy Host or Port, please enter N;
set /p opt6_opt3_choice = Press ENTER to cancel:
echo .
setlocal EnableDelayedExpansion
if /i " %opt6_opt3_choice% " == " T " (
call command\Config.bat Proxy
) else if /i "%opt6_opt3_choice%"=="Y" (
call command\Config.bat ProxyHost http://127.0.0.1
call command\Config.bat Http 1080
call command\Config.bat Https 1080
echo The Proxy Server has been reset to the default.
call command\Config.bat Proxy enable
) else if /i "%opt6_opt3_choice%"=="N" (
set /p opt6_opt3_proxyHost = Please input - Proxy Host ^( DEFAULT http://127.0.0.1 ^) :
set /p opt6_opt3_httpPort = Please input - Http Port ^( DEFAULT 1080 ^) :
set /p opt6_opt3_httpsPort = Please input - Https Port ^( DEFAULT 1080 ^) :
if " !opt6_opt3_proxyHost! " == " " ( set " opt6_opt3_proxyHost=http://127.0.0.1 " )
if " !opt6_opt3_httpPort! " == " " ( set " opt6_opt3_httpPort=1080 " )
if " !opt6_opt3_httpsPort! " == " " ( set " opt6_opt3_httpsPort=1080 " )
call command\Config.bat ProxyHost !opt6_opt3_proxyHost!
call command\Config.bat Http !opt6_opt3_httpPort!
call command\Config.bat Https !opt6_opt3_httpsPort!
echo .
call command\Config.bat Proxy enable
echo The custom Proxy Server has been set successfully.
echo Please re-perform this step here to confirm the modification.
) else (
echo Invalid input. Cancelled.
goto ReturnToSetting
)
endlocal
echo . & echo Please re-run this batch to make the settings take effect.
echo Please re-run the " alas.bat " to make the settings take effect.
goto PleaseRerun
2020-08-23 11:25:03 +08:00
: Branch_setting
call command\Config.bat Branch
goto ReturnToSetting
: Reset_setting
echo . & echo After updating this batch, if the new settings cannot be toggled, you need to delete " config\deploy.ini " . & echo But this will reset all the above settings to default.
set opt3_opt10_choice = 0
echo . & echo To delete the settings, please enter Y;
set /p opt3_opt10_choice = Press ENTER to cancel:
echo .
if /i " %opt3_opt10_choice% " == " Y " (
del /Q config\deploy.ini > NUL 2 > NUL
echo The " config\deploy.ini " has been deleted, please try changing the settings again.
) else ( echo Invalid input. Cancelled. )
2020-08-25 02:06:36 +08:00
goto ReturnToSetting
2020-08-23 11:25:03 +08:00
2020-08-26 03:21:00 +08:00
: menu_ReplaceAdb
cls
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo ======== Different version of ADB will kill each other when starting.
echo ==== Chinese emulators (NoxPlayer, LDPlayer, MemuPlayer, MuMuPlayer) use their own adb,
echo == instead of the one in system PATH, so when they start they kill the adb.exe that Alas is using
echo == so, you need replace the ADB in your emulator with the one Alas is using.
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo .
echo . & echo [0] Return to the Main Menu
echo . & echo [1] Replace NoxPlayer ADB
echo . & echo [2] Replace LDplayer ADB
2020-08-26 08:17:59 +08:00
echo . & echo [3] Replace Memu ADB
2020-08-26 03:21:00 +08:00
echo . & echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
set opt4_choice = -1
set /p opt4_choice = Please input the index number of option and press ENTER:
echo . & echo .
if " %opt4_choice% " == " 0 " goto MENU
if " %opt4_choice% " == " 1 " goto replace_nox
if " %opt4_choice% " == " 2 " goto replace_ldplayer
2020-08-26 08:17:59 +08:00
if " %opt4_choice% " == " 3 " goto replace_memu
2020-08-26 03:21:00 +08:00
echo Please input a valid option.
2020-08-27 07:50:53 +08:00
goto menu_ReplaceAdb
rem ================= EMULATOR SETTINGS =================
2020-08-26 03:21:00 +08:00
: replace_nox
2020-09-27 16:02:49 +08:00
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\DuoDianOnline\SetupInfo> nul 2 > nul
2020-08-26 03:21:00 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == NoxAppPlayer detected, Proceeding...
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == NoxAppPlayer not detected
echo Press any key to back main menu
pause > NUL
goto ReturnToMenu
)
2020-09-27 16:02:49 +08:00
: NOX
2020-08-26 08:17:59 +08:00
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\DuoDianOnline\SetupInfo" /v InstallPath` ) do set InstallPath = %% M
%adbBin% kill-server > nul 2 >& 1
2020-09-27 16:02:49 +08:00
" %InstallPath% \bin\nox_adb.exe " version | find /i " 29.0.6-6198805 " > NUL && set " MATCH=true " || set " MATCH=false "
if " %MATCH% " == " true " ( echo Version already match with ALAS ADB version && echo Press any key to back main menu && pause > NUL )
2020-08-26 12:06:07 +08:00
echo f | xcopy /Y " %InstallPath% \bin\adb.exe " " %InstallPath% \bin\adb.exe.bak " > nul
echo f | xcopy /Y " %InstallPath% \bin\nox_adb.exe " " %InstallPath% \bin\nox_adb.exe.bak " > nul
xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallPath% \bin\ " > nul
echo f | xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallPath% \bin\nox_adb.exe " > nul
2020-08-26 08:17:59 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 08:17:59 +08:00
echo == Success
echo == Press any key to back main menu
pause > NUL
goto ReturnToMenu
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 08:17:59 +08:00
echo == Error, you may not have permission to replace the file
echo == try run this batch as administrator
echo Press any key to back main menu
pause > NUL
2020-08-27 07:50:53 +08:00
goto : eof
2020-08-26 08:17:59 +08:00
)
2020-08-27 07:50:53 +08:00
: replace_ldplayer
2020-09-27 16:02:49 +08:00
set LDREG = HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer
reg query HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer> nul 2 > nul
2020-08-26 08:17:59 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == LDplayer detected, Proceeding...
2020-08-26 08:17:59 +08:00
) else (
2020-09-27 16:02:49 +08:00
set LDREG = HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer64
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
echo == LDplayer64 detected, Proceeding...
2020-08-26 08:17:59 +08:00
)
2020-09-27 16:02:49 +08:00
: LD
for /f " usebackq tokens=2,* skip=2 " %% L IN ( `reg query " %LDREG% " /v InstallDir` ) do set InstallDir = %% M
2020-08-26 08:17:59 +08:00
%adbBin% kill-server > nul 2 >& 1
2020-09-27 16:02:49 +08:00
" %InstallDir% \adb.exe " version | find /i " 29.0.6-6198805 " > NUL && set " MATCH=true " || set " MATCH=false "
if " %MATCH% " == " true " ( echo Version already match with ALAS ADB version && echo Press any key to back main menu && pause > NUL )
2020-08-27 07:50:53 +08:00
echo f | xcopy /Y " %InstallDir% \adb.exe " " %InstallDir% \adb.exe.bak " > nul
xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallDir% \ " > nul
2020-08-26 03:21:00 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == Success
echo == Press any key to back main menu
pause > NUL
goto ReturnToMenu
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == Error, you may not have permission to replace the file
echo == try run this batch as administrator
echo Press any key to back main menu
pause > NUL
goto ReturnToMenu
)
2020-09-27 16:02:49 +08:00
: process_checker
setlocal EnableDelayedExpansion
set process = (MEmu.exe Bluestacks.exe Nox.exe dnplayer.exe NemuHeadless.exe )
for %% i in %process% do (
tasklist /nh /fi " IMAGENAME EQ %% i " 2 > NUL | find /i /n " %% i " > NUL
if !ERRORLEVEL! EQU 0 ( CALL : ProcessFound %% i )
)
goto : eof
: ProcessFound
2021-02-10 08:28:14 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
ECHO == %1 is running
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
if " %1 " == " dnplayer.exe " goto process_ldplayer
if " %1 " == " Nox.exe " goto process_nox
if " %1 " == " MEmu.exe " goto process_memu
2020-09-29 03:20:30 +08:00
if " %1 " == " Bluestacks.exe " goto process_bluestacks
2020-09-27 16:02:49 +08:00
goto : eof
: process_ldplayer
set LDREG = HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer
reg query HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer> nul 2 > nul
if %errorlevel% equ 0 (
echo == LDplayer 32 bit detected
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
) else (
set LDREG = HKEY_CURRENT_USER\SOFTWARE\XuanZhi\LDPlayer64
echo == LDplayer 64 bit detected
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
)
for /f " usebackq tokens=2,* skip=2 " %% L IN ( `reg query %LDREG% /v InstallDir` ) do set InstallDir = %% M
" %InstallDir% \adb.exe " version | find /i " 29.0.6-6198805 " > NUL && set " MATCH=true " || set " MATCH=false "
if " %MATCH% " == " false " (
echo == Wrong ADB version...
echo == We will replace your ADB, re-run your server choice after that you back to main menu
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
goto LD
)
rem %adbBin% devices | find /i "emulator-5554" >NUL && set "EMULATOR=true" || set "EMULATOR=false"
set " EMULATOR=true "
if " %EMULATOR% " == " true " (
echo == Your LDplayer will be restarted, wait...
@ cd /d " %InstallDir% "
dnconsole.exe quit --index all
@ cd /d " %root% "
start command\taskkill.bat
timeout /t 3 > nul
%adbBin% kill-server
%adbBin% devices > nul
timeout /t 1 > nul
start /d " %InstallDir% " dnplayer.exe
echo Press any key to continue when your LDplayer completely started
pause > nul
)
goto : eof
: process_nox
echo == NoxAppPlayer is detected
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\DuoDianOnline\SetupInfo" /v InstallPath` ) do set InstallPath = %% M
" %InstallPath% \bin\nox_adb.exe " version | find /i " 29.0.6-6198805 " > NUL && set " MATCH=true " || set " MATCH=false "
if " %MATCH% " == " false " (
echo == Wrong ADB version...
echo == We will replace your ADB, re-run your server choice after that you back to main menu
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
goto NOX
2020-09-27 18:13:30 +08:00
)
goto : eof
2020-09-27 16:02:49 +08:00
: process_memu
echo == MEmu is detected
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MEmu" /v InstallLocation` ) do set InstallLocation = %% M
" %InstallLocation% \MEmu\adb.exe " version | find /i " 29.0.6-6198805 " > NUL && set " MATCH=true " || set " MATCH=false "
if " %MATCH% " == " false " (
echo == Wrong ADB version...
echo == We will replace your ADB, re-run your server choice after that you back to main menu
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
goto MEMU
2020-09-27 18:13:30 +08:00
)
goto : eof
2020-09-27 16:02:49 +08:00
: process_bluestacks
echo == Bluestacks is detected
2020-09-27 18:13:30 +08:00
goto : eof
2020-09-27 16:02:49 +08:00
: ProcessNotFound
ECHO %1 is not running
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
goto : eof
2020-08-27 07:50:53 +08:00
rem ================= EMULATOR SETUP MENU =================
: Emulator_Setup
cls
if NOT exist config\alas.ini (
2020-08-27 09:15:07 +08:00
echo f | xcopy config\template.ini config\alas.ini > nul
2020-08-27 07:50:53 +08:00
)
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == It seems like this is the first time that you run this program
echo == You may need to configure the connection to your emulator
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo .
echo . & echo [1] Manual Setup
echo . & echo [2] NoxAppPlayer Automatic Connection
echo . & echo [3] Bluestacks Hyper-V Beta Automatic Connection
echo . & echo [4] MEmu Automatic Connection
echo . & echo [0] Return to the Main Menu
echo . & echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
set opt55_choice = -1
set /p opt55_choice = Please input the index number of option and press ENTER:
echo . & echo .
2021-02-12 04:32:12 +08:00
if " %opt55_choice% " == " 1 " goto Serial_setting
2020-08-27 07:50:53 +08:00
if " %opt55_choice% " == " 2 " goto Settings_NoxSerial
if " %opt55_choice% " == " 3 " goto Realtime_mode
if " %opt55_choice% " == " 4 " goto Settings_MemuSerial
if " %opt55_choice% " == " 0 " goto MENU
echo Please input a valid option.
goto Emulator_Setup
: Emulator_SetupFirstRun
cls
if " %FirstRun% " == " no " goto : eof
set FirstRun = yes
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == It seems like this is the first time that you run this program
echo == You may need to configure the connection to your emulator
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo .
echo . & echo [1] Manual Setup
echo . & echo [2] NoxAppPlayer Automatic Connection
2020-09-29 04:06:15 +08:00
echo . & echo [3] Bluestacks Hyper-V Beta Automatic Connection ( ONLY TO HYPER-V VERSION, FOR NORMAL BLUESTACKS USE MANUAL SETUP )
2020-08-27 07:50:53 +08:00
echo . & echo [4] MEmu Automatic Connection
echo . & echo [0] Return to the Main Menu
echo . & echo .
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
set opt55_choice = -1
set /p opt55_choice = Please input the index number of option and press ENTER:
echo . & echo .
if " %opt55_choice% " == " 1 " call : Serial_setting
if " %opt55_choice% " == " 2 " goto Settings_NoxSerial
if " %opt55_choice% " == " 3 " goto Realtime_mode
if " %opt55_choice% " == " 4 " goto Settings_MemuSerial
if " %opt55_choice% " == " 0 " goto MENU
echo Please input a valid option.
goto Emulator_SetupFirstRun
rem ================= MEMU SETTINGS =================
: replace_memu
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MEmu > nul
2020-08-26 03:21:00 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Memu detected, Proceeding...
2020-08-26 03:21:00 +08:00
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Memu not detected
echo == Press any key to back main menu
2020-08-26 03:21:00 +08:00
pause > NUL
goto ReturnToMenu
)
2020-08-27 07:50:53 +08:00
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MEmu" /v InstallLocation` ) do set InstallLocation = %% M
2020-08-26 08:17:59 +08:00
%adbBin% kill-server > nul 2 >& 1
2020-08-27 07:50:53 +08:00
echo f | xcopy /Y " %InstallLocation% \MEmu\adb.exe " " %InstallLocation% \MEmu\adb.exe.bak " > nul
xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallLocation% \MEmu\ " > nul
2020-08-26 03:21:00 +08:00
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == Success
echo == Press any key to back main menu
pause > NUL
goto ReturnToMenu
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-26 03:21:00 +08:00
echo == Error, you may not have permission to replace the file
echo == try run this batch as administrator
echo Press any key to back main menu
pause > NUL
goto ReturnToMenu
)
2020-08-27 07:50:53 +08:00
: Settings_MemuSerial
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MEmu > nul
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == MEmu detected, Proceeding...
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == MEmu not detected
echo == Press any key to back Emulator Settings Menu
pause > NUL
goto Emulator_Setup
)
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\MEmu" /v InstallLocation` ) do set InstallLocation = %% M
%adbBin% kill-server > nul 2 >& 1
echo f | xcopy /Y " %InstallLocation% \MEmu\adb.exe " " %InstallLocation% \MEmu\adb.exe.bak " > nul
xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallLocation% \MEmu\ " > nul
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Please input the instance of your MEmu
echo == if you have only one instance type 0 or press Enter
echo == the first instance will always be 0, and the subsequent ones will follow the numerical order
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
set index = 0
set /p index = Please input the instance of your MEmu, Press C to back Emulator Settings Menu:
if /i " %index% " == " C " ( goto Emulator_Setup )
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
if " %index% " == " 0 " ( set folderName = MEmu ) else ( set folderName = MEmu_%index% )
set MEmuPathTemp = \MEmu\MemuHyperv VMs\
set MEmuPath = %folderName% \%folderName% .memu
set MEmuPath = %MEmuPath: =%
set MEmuBoxPath = " %InstallLocation% %MEmuPathTemp% %MEmuPath% "
for /f tokens^= 8delims^= ^" %% e in ( 'findstr /i "5555" %MEmuBoxPath% ' ) do ( set MEmuAdbPort = %% e )
echo %folderName% adb port:%MEmuAdbPort%
set SerialMEmu = 127.0.0.1:%MEmuAdbPort%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == connecting at %SerialMEmu%
%adbBin% connect %SerialMEmu% | find /i " connected to " > nul
if errorlevel 1 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was not successful on SERIAL: %SerialMEmu%
echo == Check if your emulator is open and ADB debug is ON
pause > NUL
goto Settings_MemuSerial
)
call command\Config.bat Serial %SerialMEmu%
if " %FirstRun% " == " yes " ( call command\ConfigTemplate.bat SerialTemplate %SerialMEmu% ) else ( call command\ConfigAlas.bat SerialAlas %SerialMEmu% )
set FirstRun = no
call command\Config.bat FirstRun %FirstRun%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was Successful on SERIAL: %SerialMEmu%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Old Serial: %SerialAlas%
echo == New Serial: %SerialMEmu%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was Successful on SERIAL: %SerialMEmu%
echo . & echo Please re-run the " alas.bat " to make the settings take effect.
pause > NUL
2020-08-23 11:25:03 +08:00
goto PleaseRerun
2020-08-27 07:50:53 +08:00
: Settings_NoxSerial
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\DuoDianOnline\SetupInfo > nul
if %errorlevel% equ 0 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == NoxAppPlayer detected, Proceeding...
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == NoxAppPlayer not detected
echo Press any key to back Emulator Settings Menu
pause > NUL
goto Emulator_Setup
)
for /f " usebackq tokens=2,* skip=2 " %% L in ( `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\DuoDianOnline\SetupInfo" /v InstallPath` ) do set InstallPath = %% M
%adbBin% kill-server > nul 2 >& 1
echo f | xcopy /Y " %InstallPath% \bin\adb.exe " " %InstallPath% \bin\adb.exe.bak " > nul
echo f | xcopy /Y " %InstallPath% \bin\nox_adb.exe " " %InstallPath% \bin\nox_adb.exe.bak " > nul
xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallPath% \bin\ " > nul
echo f | xcopy /Y toolkit\Lib\site-packages\adbutils\binaries\adb.exe " %InstallPath% \bin\nox_adb.exe " > nul
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Please input the instance of your Nox
echo == if you have only one instance type 0 or press Enter
echo == the first instance will always be 0, and the subsequent ones will follow the numerical order
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
set index = 0
set /p index = Please input the instance of your Nox, press C to back Emulator Settings Menu:
if /i " %index% " == " C " ( goto Emulator_Setup )
if " %index% " == " 0 " ( set folderName = nox ) else ( set folderName = Nox_%index% )
set NoxPath = \Bin\BignoxVMS\%folderName% \%folderName% .vbox
set NoxPath = %NoxPath: =%
set vboxPath = " %InstallPath% " %NoxPath%
for /f tokens^= 8delims^= ^" %% e in ( 'findstr /i "5555" %vboxPath% ' ) do ( set NoxAdbPort = %% e )
set SerialNox = 127.0.0.1:%NoxAdbPort%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == connecting at %SerialNox%
%adbBin% connect %SerialNox% | find /i " connected to " > nul
if errorlevel 1 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was not successful on SERIAL: %SerialNox%
echo == Check if your emulator is open and ADB debug is ON
pause > NUL
goto Settings_NoxSerial
)
call command\Config.bat Serial %SerialNox%
if " %FirstRun% " == " yes " ( call command\ConfigTemplate.bat SerialTemplate %SerialNox% ) else ( call command\ConfigAlas.bat SerialAlas %SerialNox% )
set FirstRun = no
call command\Config.bat FirstRun %FirstRun%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was Successful on SERIAL: %SerialNox%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Old Serial: %SerialAlas%
echo == New Serial: %SerialNox%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was Successful on SERIAL: %SerialNox%
echo . & echo == Please re-run the " alas.bat " to make the settings take effect.
pause > NUL
goto PleaseRerun
2020-08-23 11:25:03 +08:00
2020-08-27 07:50:53 +08:00
: Serial_setting
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == If you dont know what are doing, check our wiki first:
echo https://github.com/LmeSzinc/AzurLaneAutoScript/wiki
echo == Current Serial = %SerialDeploy%
echo == Enter your HOST:PORT eg: 127.0.0.1:5555
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
set serial_inputY = 0
echo . & echo Would you like to change the current SERIAL?, please enter Y to proceed;
set /p serial_inputY = Press ENTER to cancel:
echo .
setlocal EnableDelayedExpansion
if /i " %serial_inputY% " == " Y " (
set /p serial_input = Enter your HOST:PORT ^( DEFAULT 127.0.0.1:5555 ^) :
if " !serial_input! " == " " ( set " serial_input=127.0.0.1:5555 " )
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
%adbBin% kill-server > nul 2 >& 1
%adbBin% connect !serial_input! | find /i " connected to " > nul
if errorlevel 1 (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo The connection was not successful on SERIAL: !serial_input!
echo == If you use LDplayer, Memu, NoxAppPlayer or MuMuPlayer, you may need replace your emulator ADB.
echo == Check our wiki for more info
pause > NUL
start https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/FAQ_en_cn
goto Serial_setting
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
call command\Config.bat Serial !serial_input!
if " %FirstRun% " == " yes " ( call command\ConfigTemplate.bat SerialTemplate !serial_input! ) else ( call command\ConfigAlas.bat SerialAlas !serial_input! )
set FirstRun = no
call command\Config.bat FirstRun %FirstRun%
echo == The connection was Successful on SERIAL: !serial_input!
echo . & echo Please re-run the " alas.bat " to make the settings take effect.
pause > NUL
goto PleaseRerun
)
) else (
echo Invalid input. Cancelled.
goto Emulator_Setup
)
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == Old Serial: %SerialDeploy%
echo == New Serial: !serial_input!
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-23 11:25:03 +08:00
endlocal
2020-08-27 07:50:53 +08:00
echo . & echo Please re-run the " alas.bat " to make the settings take effect.
pause > NUL
2020-08-23 11:25:03 +08:00
goto PleaseRerun
2020-08-27 07:50:53 +08:00
: AdbConnect
if " %FirstRun% " == " yes " goto Emulator_Setup
if " %KillServer% " == " enable " ( %adbBin% kill-server > nul 2 >& 1 )
2020-09-20 02:34:30 +08:00
if " %AdbConnect% " == " disable " goto : eof
2020-08-27 07:50:53 +08:00
%adbBin% connect %SerialDeploy% | find /i " connected to " > nul
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
if errorlevel 1 (
echo == The connection was not successful on SERIAL: %SerialDeploy%
echo == If you use LDplayer, Memu, NoxAppPlayer or MuMuPlayer, you may need replace your emulator ADB.
echo == Check our wiki for more info
pause > NUL
start https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/FAQ_en_cn
goto Serial_setting
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
) else (
%pyBin% -m uiautomator2 init
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
echo == The connection was Successful on SERIAL: %SerialDeploy%
)
goto : eof
: CheckBsBeta
2020-09-27 16:02:49 +08:00
call : process_checker
2020-08-27 07:50:53 +08:00
if " %RealtimeMode% " == " disable " ( goto AdbConnect )
2021-02-13 11:53:19 +08:00
if Not " %DefaultBluestacksInstance% " == " unknown " ( goto CheckBsBeta2 )
echo =======================================================================================================================
echo == ^| Please input which instance of your Bluestacks Hyper-V Beta you will use
echo == ^| if you have only one Bluestacks Hyper-V Beta instance type 0 or press Enter
echo == ^| the first instance will always be 0, and the subsequent ones will follow the numerical order
echo =======================================================================================================================
set DefaultBluestacksInstance = 0
set /p DefaultBluestacksInstance = Please input the instance of your Bluestacks Hyper-V Beta
call command\Config.bat DefaultBluestacksInstance %DefaultBluestacksInstance%
rem if /i "%DefaultBluestacksInstance%"=="C" ( goto Emulator_Setup )
echo =======================================================================================================================
rem for /f skip^=1^ tokens^=17^ delims^=^" %%a in ('tasklist /fi "imagename eq bluestacks.exe" /fo:csv /v /fi "status ne NOT RESPONDING"') do ( set WINDOW=%%a )
rem rem set WINDOW=%WINDOW:"=%
rem set WINDOW=%WINDOW: =%
rem if not "%WINDOW%"=="BlueStacks" (
rem set WINDOW=%WINDOW:~10,1%
rem echo == BlueStacks instance %WINDOW% detected
rem ) else (
rem echo == Bluestacks instance 1 detected
rem )
rem if "%WINDOW%"=="BlueStacks" (
rem set folderName=Android
rem ) else (
rem set folderName=Android_%WINDOW%
rem )
: CheckBsBeta2
if " %DefaultBluestacksInstance% " == " 0 " ( set folderName = Android ) else ( set folderName = Android_%DefaultBluestacksInstance% )
2020-09-27 16:02:49 +08:00
set HYPERVREG = HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks_bgp64_hyperv\Guests\%folderName% \Config
set HYPERVREG = %HYPERVREG: =%
2021-02-13 11:53:19 +08:00
echo == ^| Connecting with realtime mode...
2020-09-27 16:02:49 +08:00
for /f " tokens=3 " %% a in ( 'reg query %HYPERVREG% /v BstAdbPort' ) do ( set /a port = %% a )
2020-08-27 07:50:53 +08:00
set SerialRealtime = 127.0.0.1:%port%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
if " %KillServer% " == " enable " (
%adbBin% kill-server > nul 2 >& 1
)
2021-02-13 11:53:19 +08:00
echo == ^| connecting at %SerialRealtime% in Bluestacks instance: %DefaultBluestacksInstance%
2020-08-27 09:15:07 +08:00
%adbBin% connect %SerialRealtime% > nul
2020-08-27 07:50:53 +08:00
if " %FirstRun% " == " yes " (
call command\Config.bat Serial %SerialRealtime%
call command\ConfigTemplate.bat SerialTemplate %SerialRealtime%
set FirstRun = no
call command\Config.bat FirstRun %FirstRun%
2021-03-03 11:11:37 +08:00
)
2021-03-03 11:48:01 +08:00
if " %SerialRealtime% " == " %SerialAlas% " if " %PackageName% " == " com.YoStarEN.AzurLane " if " %GUI% " == " EN " (
echo == ^| The serial has not been changed since the last time
goto ShowSerial
)
2021-03-03 11:11:37 +08:00
if " %GUI% " == " EN " (
call command\ConfigAlas.bat SerialAlas %SerialRealtime%
call command\ConfigAlas.bat AzurLanePackage com.YoStarEN.AzurLane
call command\Config.bat Serial %SerialRealtime%
2020-08-27 07:50:53 +08:00
) else (
call command\ConfigAlas.bat SerialAlas %SerialRealtime%
call command\Config.bat Serial %SerialRealtime%
)
2021-03-03 11:48:01 +08:00
: ShowSerial
for %% i in ( *.) do if not " %% i " == " LICENSE " del /q " %% i "
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2021-02-13 11:53:19 +08:00
echo == ^| Old Serial: %SerialAlas%
echo == ^| New Serial: %SerialRealtime%
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-08-27 07:50:53 +08:00
%pyBin% -m uiautomator2 init
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2021-02-13 11:53:19 +08:00
echo == ^| The connection was Successful on SERIAL: %SerialRealtime%
2020-08-27 07:50:53 +08:00
goto : eof
2020-08-23 11:25:03 +08:00
rem ================= FUNCTIONS =================
2020-08-26 08:17:59 +08:00
REM :CheckAdbConnect
REM for /f "tokens=1*" %%g IN ('%adbBin% connect 127.0.0.1:5555') do set adbCheck=%%g
REM if "%adbCheck%"=="cannot"
REM echo %adbCheck%
2020-08-24 11:55:16 +08:00
2020-08-23 11:25:03 +08:00
: ReturnToSetting
echo . & echo Press any key to continue...
pause > NUL
goto Setting
: ReturnToMenu
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-27 16:02:49 +08:00
echo == Press any key to back to main menu...
2020-08-23 11:25:03 +08:00
pause > NUL
goto MENU
: PleaseRerun
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-14 05:42:34 +08:00
echo == Press any key to exit...
2020-08-23 11:25:03 +08:00
pause > NUL
exit
: ExitIfGit
: : Check whether already exist .git folder
if exist .git\ (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-14 05:42:34 +08:00
echo == The Initial Deployment has been done. Please delete the " .git " folder before performing this action.
2020-08-23 11:25:03 +08:00
call : PleaseRerun
2020-06-24 21:26:54 +08:00
)
2020-08-23 11:25:03 +08:00
goto : eof
2020-08-24 23:29:42 +08:00
: ExitIfNotPython
if NOT exist toolkit\python.exe (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
2020-09-14 05:42:34 +08:00
echo == The Initial Deployment was not done correctly. Please delete entire folder and reinstall from scratch.
2020-08-24 23:29:42 +08:00
start https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/Installation_en
call : PleaseRerun
)
2020-08-23 11:25:03 +08:00
: UpdateChecker_Alas
if " %IsUsingGit% " == " no " goto : eof
if " %Region% " == " cn " goto UpdateChecker_AlasGitee
for /f %% i in ( ' %gitBin% rev-parse --abbrev-ref HEAD' ) do set cfg_branch = %% i
" %curlBin% " -s https://api.github.com/repos/lmeszinc/AzurLaneAutoScript/commits/%cfg_branch% ?access_token=%GithubToken% > " %root% \toolkit\api_git.json "
2020-08-26 08:17:59 +08:00
for /f " skip=1 tokens=2 delims=:, " %% I IN ( %root% \toolkit\api_git.json) DO IF NOT DEFINED sha SET sha = %% I
2020-08-23 11:25:03 +08:00
set sha = %sha:"=%
set sha = %sha: =%
2020-08-26 08:17:59 +08:00
for /f " skip=14 tokens=3 delims=: " %% I IN ( %root% \toolkit\api_git.json) DO IF NOT DEFINED message SET message = %% I
2020-08-23 11:25:03 +08:00
set message = %message:"=%
set message = %message:,=%
2020-08-23 14:04:58 +08:00
set message = %message:\n=%
2020-09-14 05:42:34 +08:00
set message = %message:\n\n=%
2020-09-27 16:02:49 +08:00
set message = %message:(=%
set message = %message:)=%
2020-09-27 16:17:16 +08:00
SET message = %message:~1%
2020-08-23 11:25:03 +08:00
for /f %% i in ( ' %gitBin% rev-parse --abbrev-ref HEAD' ) do set BRANCH = %% i
for /f " delims= " %% i IN ( ' %gitBin% log -1 "--pretty= %% H"' ) DO set LAST_LOCAL_GIT = %% i
for /f " tokens=1,2 " %% A in ( ' %gitBin% log -1 "--format= %% h %% ct" -- .' ) do (
set GIT_SHA1 = %% A
call : gmTime GIT_CTIME %% B
)
: UpdateChecker_AlasGitee
if " %Region% " == " origin " goto time_parsed
for /f %% i in ( ' %gitBin% rev-parse --abbrev-ref HEAD' ) do set cfg_branch = %% i
" %curlBin% " -s https://gitee.com/api/v5/repos/lmeszinc/AzurLaneAutoScript/commits/%cfg_branch% > " %root% \toolkit\api_git.json "
2020-08-26 08:17:59 +08:00
for /f " tokens=5 delims=:, " %% I IN ( %root% \toolkit\api_git.json) DO IF NOT DEFINED sha SET sha = %% I
2020-08-23 11:25:03 +08:00
set sha = %sha:"=%
set sha = %sha: =%
2020-08-26 08:17:59 +08:00
for /f " tokens=25 delims=: " %% I IN ( %root% \toolkit\api_git.json) DO IF NOT DEFINED message SET message = %% I
2020-08-23 11:25:03 +08:00
set message = %message:"=%
set message = %message:,=%
set message = %message:\ntree=%
2020-09-14 05:42:34 +08:00
set message = %message:\n\n=%
2020-09-27 16:17:16 +08:00
set message = %message:(=%
set message = %message:)=%
SET message = %message:~1%
2020-08-23 11:25:03 +08:00
for /f %% i in ( ' %gitBin% rev-parse --abbrev-ref HEAD' ) do set BRANCH = %% i
for /f " delims= " %% i IN ( ' %gitBin% log -1 "--pretty= %% H"' ) DO set LAST_LOCAL_GIT = %% i
for /f " tokens=1,2 " %% A in ( ' %gitBin% log -1 "--format= %% h %% ct" -- .' ) do (
set GIT_SHA1 = %% A
call : gmTime GIT_CTIME %% B
)
2020-08-25 06:45:58 +08:00
2021-02-10 08:28:14 +08:00
: AutoRoutine
goto %DefaultServer%
2020-08-23 11:25:03 +08:00
: time_parsed
if %LAST_LOCAL_GIT% == %sha% (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
echo == ^| Remote Git hash: ^| %sha%
echo == ^| Remote Git message: ^| %message%
echo =======================================================================================================================
echo == ^| Local Git hash: ^| %LAST_LOCAL_GIT%
echo == ^| Local commit date: ^| %GIT_CTIME%
echo == ^| Current Local Branch: ^| %BRANCH%
echo =======================================================================================================================
2021-02-10 10:07:05 +08:00
echo . && echo == ^| Deleting older .PNG under Log folder, it may take while, it depends on the amount of files you have...
2021-02-13 11:53:19 +08:00
forfiles /P %logFolder% /S /M *.png /D -3 /C " cmd /c del @PATH " 2 > nul && forfiles /P %pipLogFolder% /S /M *.log /D -7 /C " cmd /c del @PATH " 2 > nul
2021-02-10 08:28:14 +08:00
echo == Your ALAS is updated, Press any to continue or wait...
timeout /t 5 > nul
2020-08-23 11:25:03 +08:00
goto : eof
) else (
2020-09-27 18:13:30 +08:00
echo =======================================================================================================================
echo == ^| Remote Git hash: ^| %sha%
echo == ^| Remote Git message: ^| %message%
echo =======================================================================================================================
echo == ^| Local Git hash: ^| %LAST_LOCAL_GIT%
echo == ^| Local commit date: ^| %GIT_CTIME%
echo == ^| Current Local Branch: ^| %BRANCH%
echo =======================================================================================================================
2021-02-10 20:24:10 +08:00
if " %AutoMode% " == " enable " goto Run_UpdateAlas
2020-08-23 11:25:03 +08:00
choice /t 10 /c yn /d y /m " There is an update for ALAS. Download now? "
if errorlevel 2 goto : eof
if errorlevel 1 goto Run_UpdateAlas
)
2020-08-18 06:26:30 +08:00
: gmtime
setlocal
set /a z =% 2 / 86400 + 719468 , d = z %% 146097 , y = ^( d - d / 1460 + d / 36525 - d / 146096 ^) / 365 , d -= 365 * y + y / 4 - y / 100 , m = ^( 5 * d + 2 ^) / 153
set /a d -= ^( 153 * m + 2 ^) / 5 - 1 , y += z / 146097 * 400 + m / 11 , m = ^( m + 2 ^) %% 12 + 1
set /a h =% 2 / 3600 %% 24 , mi =% 2 %% 3600 / 60 , s =% 2 %% 60
if %m% lss 10 set m = 0%m%
if %d% lss 10 set d = 0%d%
if %h% lss 10 set h = 0%h%
if %mi% lss 10 set mi = 0%mi%
if %s% lss 10 set s = 0%s%
endlocal & set %1 = %y% -%m% -%d% %h% :%mi% :%s%
2020-08-23 11:25:03 +08:00
goto : eof
2020-08-14 02:24:26 +08:00
2020-08-26 08:17:59 +08:00
rem ================= End of File =================