Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
MSA Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetopia committed Sep 23, 2021
1 parent 3d1eb99 commit d9f5fe1
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions LCL.ahk
Expand Up @@ -5,10 +5,21 @@ SetBatchLines -1
ListLines Off
#SingleInstance, Force
#NoTrayIcon
EnvGet, vHomeDrive, HOMEDRIVE
EnvGet, vHomePath, HOMEPATH
UserProfile=% vHomeDrive vHomePath
;File Existence Checks
IfNotExist, %UserProfile%\AppData\Local\Programs\lunarclient\Lunar Client.exe
LCCheck()
IfNotExist, Config.ini
ConfigCreate()
Resources()
;Command Line Arguments
Arguments := ["1.7", "1.8", "1.12", "1.16", "1.17"]
for n, param in A_Args ; For each parameter:
{
LauncherMSA()
IniRead, LauncherVer, Config.ini, LC, Launcher_Version
If (param=1.7 or param=1.8 or param=1.12 or param=1.16 or param=1.17){
LCVer=%param%
If (param=1.7){
Expand Down Expand Up @@ -37,23 +48,13 @@ for n, param in A_Args ; For each parameter:
Textures=%UserProfile%\.lunarclient\textures
}
Try {
Run, %LaunchJRE% --add-modules jdk.naming.dns --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djna.boot.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" --add-opens java.base/java.io=ALL-UNNAMED %LCArgs% -Djava.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" -cp "%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-1-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-2-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-3-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-libs.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-prod-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\OptiFine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\vpatcher-prod.jar" com.moonsworth.lunar.patcher.LunarMain --version %LCVer% --accessToken 0 --assetIndex %MCAssetIndex% --userProperties {} --gameDir "%Path%" --texturesDir "%Textures%" --width 854 --height 480
ExitApp
Run, %LaunchJRE% --add-modules jdk.naming.dns --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djna.boot.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" --add-opens java.base/java.io=ALL-UNNAMED %LCArgs% -Djava.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" -cp "%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-1-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-2-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-3-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-libs.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-prod-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\OptiFine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\vpatcher-prod.jar" com.moonsworth.lunar.patcher.LunarMain --version %LCVer% --accessToken 0 --assetIndex %MCAssetIndex% --userProperties {} --gameDir "%Path%" --texturesDir "%Textures%" --launcherVersion %LauncherVer% --width 854 --height 480,, JavaProcess
}
Catch Error
MsgBox, 16, Launch Error, Lunar Client Lite couldn't launch Lunar Client.`nCheck your specified Java Executable.
ExitApp
ExitApp
}
Progress=0
EnvGet, vHomeDrive, HOMEDRIVE
EnvGet, vHomePath, HOMEPATH
UserProfile=% vHomeDrive vHomePath
;File Existence Checks
IfNotExist, %UserProfile%\AppData\Local\Programs\lunarclient\Lunar Client.exe
LCCheck()
IfNotExist, Config.ini
ConfigCreate()
Resources()
;GUI
IniRead, GUIArguments, Config.ini, LC, Arguments
Gui, Main:Default
Expand Down Expand Up @@ -141,6 +142,8 @@ Launch() {
GuiControl,, LaunchButton, Resources/Launch_Clicked.png
Sleep, 75
GuiControl,, LaunchButton, Resources/Launch.png
LauncherMSA()
IniRead, LauncherVer, Config.ini, LC, Launcher_Version
EnvGet, vHomeDrive, HOMEDRIVE
EnvGet, vHomePath, HOMEPATH
UserProfile=% vHomeDrive vHomePath
Expand All @@ -160,12 +163,12 @@ Launch() {
Textures=%UserProfile%\.lunarclient\textures
}
Try {
Run, %LaunchJRE% --add-modules jdk.naming.dns --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djna.boot.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" --add-opens java.base/java.io=ALL-UNNAMED %LCArgs% -Djava.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" -cp "%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-1-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-2-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-3-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-libs.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-prod-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\OptiFine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\vpatcher-prod.jar" com.moonsworth.lunar.patcher.LunarMain --version %LCVer% --accessToken 0 --assetIndex %MCAssetIndex% --userProperties {} --gameDir "%Path%" --texturesDir "%Textures%" --width 854 --height 480
Run, %LaunchJRE% --add-modules jdk.naming.dns --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djna.boot.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" --add-opens java.base/java.io=ALL-UNNAMED %LCArgs% -Djava.library.path="%USERPROFILE%\.lunarclient\offline\%LCVer%\natives" -cp "%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-1-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-2-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-assets-prod-3-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-libs.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\lunar-prod-optifine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\OptiFine.jar";"%USERPROFILE%\.lunarclient\offline\%LCVer%\vpatcher-prod.jar" com.moonsworth.lunar.patcher.LunarMain --version %LCVer% --accessToken 0 --assetIndex %MCAssetIndex% --userProperties {} --gameDir "%Path%" --texturesDir "%Textures%" --launcherVersion %LauncherVer% --width 854 --height 480,, JavaProcess
}
Catch Error
Catch Error {
MsgBox, 16, Launch Error, Lunar Client Lite couldn't launch Lunar Client.`nCheck your specified Java Executable.
}
ExitApp

}

ConfigCreate() {
Expand All @@ -180,8 +183,8 @@ ConfigCreate() {
Loop, Files, %UserProfile%\.lunarclient\jre\zulu*, D
IniWrite, %A_LoopFileLongPath%\bin\javaw.exe, Config.ini, Minecraft, JRE
PathConfig()
LauncherMSA()
}

Resources() {
IfNotExist, %A_WorkingDir%\Resources
FileCreateDir, %A_WorkingDir%\Resources
Expand Down Expand Up @@ -249,6 +252,14 @@ VersionRead() {
return
}

LauncherMSA(){
FileDelete, latest.yml
URLDownloadToFile, https://launcherupdates.lunarclientcdn.com/latest.yml, %A_Temp%\latest.yml
FileReadLine, LauncherYML, %A_Temp%\latest.yml, 1
StringTrimLeft, LauncherVer, LauncherYML, 9
IniWrite, %LauncherVer%, Config.ini, LC, Launcher_Version
}

LCCheck() {
MsgBox, 16, Error: Lunar Client Not Installed, No Lunar Client installation is present on this device.`nClick on OK to install the latest version of Lunar Client.
Gui, Install:New
Expand Down Expand Up @@ -340,7 +351,8 @@ NotExist(x) {
Logs() {
GuiControl, Focus, Button
IfExist, %A_WorkingDir%\logs
Run, %A_WorkingDir%\logs,, Max
Run, %A_WorkingDir%\logs,, Max

IfNotExist, %A_WorkingDir%\logs
MsgBox, 16, Error, Lunar Client Lite couldn't find any Logs folder.
}
Expand Down

0 comments on commit d9f5fe1

Please sign in to comment.