|
@@ -4,6 +4,7 @@ Public Module ModLaunch
|
|
|
|
|
|
|
|
#Region "开始"
|
|
#Region "开始"
|
|
|
|
|
|
|
|
|
|
+ Public CurrentLaunchOptions As McLaunchOptions = Nothing
|
|
|
Public Class McLaunchOptions
|
|
Public Class McLaunchOptions
|
|
|
''' <summary>
|
|
''' <summary>
|
|
|
''' 强制指定在启动后进入的服务器 IP。
|
|
''' 强制指定在启动后进入的服务器 IP。
|
|
@@ -20,32 +21,34 @@ Public Module ModLaunch
|
|
|
''' 默认值:Nothing。使用 McVersionCurrent。
|
|
''' 默认值:Nothing。使用 McVersionCurrent。
|
|
|
''' </summary>
|
|
''' </summary>
|
|
|
Public Version As McVersion = Nothing
|
|
Public Version As McVersion = Nothing
|
|
|
|
|
+ ''' <summary>
|
|
|
|
|
+ ''' 额外的启动参数。
|
|
|
|
|
+ ''' </summary>
|
|
|
|
|
+ Public ExtraArgs As New List(Of String)
|
|
|
End Class
|
|
End Class
|
|
|
''' <summary>
|
|
''' <summary>
|
|
|
''' 尝试启动 Minecraft。必须在 UI 线程调用。
|
|
''' 尝试启动 Minecraft。必须在 UI 线程调用。
|
|
|
''' 返回是否实际开始了启动(如果没有,则一定弹出了错误提示)。
|
|
''' 返回是否实际开始了启动(如果没有,则一定弹出了错误提示)。
|
|
|
''' </summary>
|
|
''' </summary>
|
|
|
Public Function McLaunchStart(Optional Options As McLaunchOptions = Nothing) As Boolean
|
|
Public Function McLaunchStart(Optional Options As McLaunchOptions = Nothing) As Boolean
|
|
|
- Options = If(Options, New McLaunchOptions)
|
|
|
|
|
|
|
+ CurrentLaunchOptions = If(Options, New McLaunchOptions)
|
|
|
'预检查
|
|
'预检查
|
|
|
- If Not RunInUi() Then
|
|
|
|
|
- Throw New Exception("McLaunchStart 必须在 UI 线程调用!")
|
|
|
|
|
- End If
|
|
|
|
|
|
|
+ If Not RunInUi() Then Throw New Exception("McLaunchStart 必须在 UI 线程调用!")
|
|
|
If McLaunchLoader.State = LoadState.Loading Then
|
|
If McLaunchLoader.State = LoadState.Loading Then
|
|
|
Hint("已有游戏正在启动中!", HintType.Critical)
|
|
Hint("已有游戏正在启动中!", HintType.Critical)
|
|
|
Return False
|
|
Return False
|
|
|
End If
|
|
End If
|
|
|
'强制切换需要启动的版本
|
|
'强制切换需要启动的版本
|
|
|
- If Options.Version IsNot Nothing AndAlso McVersionCurrent <> Options.Version Then
|
|
|
|
|
- McLaunchLog("在启动前切换到版本 " & Options.Version.Name)
|
|
|
|
|
|
|
+ If CurrentLaunchOptions.Version IsNot Nothing AndAlso McVersionCurrent <> CurrentLaunchOptions.Version Then
|
|
|
|
|
+ McLaunchLog("在启动前切换到版本 " & CurrentLaunchOptions.Version.Name)
|
|
|
'检查版本
|
|
'检查版本
|
|
|
- Options.Version.Load()
|
|
|
|
|
- If Options.Version.State = McVersionState.Error Then
|
|
|
|
|
- Hint("无法启动 Minecraft:" & Options.Version.Info, HintType.Critical)
|
|
|
|
|
|
|
+ CurrentLaunchOptions.Version.Load()
|
|
|
|
|
+ If CurrentLaunchOptions.Version.State = McVersionState.Error Then
|
|
|
|
|
+ Hint("无法启动 Minecraft:" & CurrentLaunchOptions.Version.Info, HintType.Critical)
|
|
|
Return False
|
|
Return False
|
|
|
End If
|
|
End If
|
|
|
'切换版本
|
|
'切换版本
|
|
|
- McVersionCurrent = Options.Version
|
|
|
|
|
|
|
+ McVersionCurrent = CurrentLaunchOptions.Version
|
|
|
Setup.Set("LaunchVersionSelect", McVersionCurrent.Name)
|
|
Setup.Set("LaunchVersionSelect", McVersionCurrent.Name)
|
|
|
FrmLaunchLeft.RefreshButtonsUI()
|
|
FrmLaunchLeft.RefreshButtonsUI()
|
|
|
FrmLaunchLeft.RefreshPage(False, False)
|
|
FrmLaunchLeft.RefreshPage(False, False)
|
|
@@ -95,7 +98,7 @@ Public Module ModLaunch
|
|
|
McLaunchPrecheck()
|
|
McLaunchPrecheck()
|
|
|
McLaunchLog("预检测已通过")
|
|
McLaunchLog("预检测已通过")
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
|
- Hint(ex.Message, HintType.Critical)
|
|
|
|
|
|
|
+ If Not ex.Message.StartsWithF("$$") Then Hint(ex.Message, HintType.Critical)
|
|
|
Throw
|
|
Throw
|
|
|
End Try
|
|
End Try
|
|
|
'正式加载
|
|
'正式加载
|
|
@@ -103,8 +106,8 @@ Public Module ModLaunch
|
|
|
'构造主加载器
|
|
'构造主加载器
|
|
|
Dim Loaders As New List(Of LoaderBase) From {
|
|
Dim Loaders As New List(Of LoaderBase) From {
|
|
|
New LoaderTask(Of Integer, Integer)("获取 Java", AddressOf McLaunchJava) With {.ProgressWeight = 4, .Block = False},
|
|
New LoaderTask(Of Integer, Integer)("获取 Java", AddressOf McLaunchJava) With {.ProgressWeight = 4, .Block = False},
|
|
|
- McLoginLoader,
|
|
|
|
|
- New LoaderCombo(Of String)("补全文件", DlClientFix(McVersionCurrent, False, AssetsIndexExistsBehaviour.DownloadInBackground, True)) With {.ProgressWeight = 15, .Show = False},
|
|
|
|
|
|
|
+ McLoginLoader, '.ProgressWeight = 15, .Block = False
|
|
|
|
|
+ New LoaderCombo(Of String)("补全文件", DlClientFix(McVersionCurrent, False, AssetsIndexExistsBehaviour.DownloadInBackground)) With {.ProgressWeight = 15, .Show = False},
|
|
|
New LoaderTask(Of String, List(Of McLibToken))("获取启动参数", AddressOf McLaunchArgumentMain) With {.ProgressWeight = 2},
|
|
New LoaderTask(Of String, List(Of McLibToken))("获取启动参数", AddressOf McLaunchArgumentMain) With {.ProgressWeight = 2},
|
|
|
New LoaderTask(Of List(Of McLibToken), Integer)("解压文件", AddressOf McLaunchNatives) With {.ProgressWeight = 2},
|
|
New LoaderTask(Of List(Of McLibToken), Integer)("解压文件", AddressOf McLaunchNatives) With {.ProgressWeight = 2},
|
|
|
New LoaderTask(Of Integer, Integer)("预启动处理", AddressOf McLaunchPrerun) With {.ProgressWeight = 1},
|
|
New LoaderTask(Of Integer, Integer)("预启动处理", AddressOf McLaunchPrerun) With {.ProgressWeight = 1},
|
|
@@ -144,7 +147,7 @@ Public Module ModLaunch
|
|
|
Hint(McVersionCurrent.Name & " 启动成功!", HintType.Finish)
|
|
Hint(McVersionCurrent.Name & " 启动成功!", HintType.Finish)
|
|
|
Case LoadState.Aborted
|
|
Case LoadState.Aborted
|
|
|
If AbortHint Is Nothing Then
|
|
If AbortHint Is Nothing Then
|
|
|
- Hint(If(Loader.Input.SaveBatch Is Nothing, "已取消启动!", "已取消导出启动脚本!"), HintType.Info)
|
|
|
|
|
|
|
+ Hint(If(CurrentLaunchOptions?.SaveBatch Is Nothing, "已取消启动!", "已取消导出启动脚本!"), HintType.Info)
|
|
|
Else
|
|
Else
|
|
|
Hint(AbortHint, HintType.Finish)
|
|
Hint(AbortHint, HintType.Finish)
|
|
|
End If
|
|
End If
|
|
@@ -159,7 +162,7 @@ NextInner:
|
|
|
If CurrentEx.Message.StartsWithF("$") Then
|
|
If CurrentEx.Message.StartsWithF("$") Then
|
|
|
'若有以 $ 开头的错误信息,则以此为准显示提示
|
|
'若有以 $ 开头的错误信息,则以此为准显示提示
|
|
|
'若错误信息为 $$,则不提示
|
|
'若错误信息为 $$,则不提示
|
|
|
- If Not CurrentEx.Message = "$$" Then MyMsgBox(CurrentEx.Message.TrimStart("$"), If(Loader.Input.SaveBatch Is Nothing, "启动失败", "导出启动脚本失败"))
|
|
|
|
|
|
|
+ If Not CurrentEx.Message = "$$" Then MyMsgBox(CurrentEx.Message.TrimStart("$"), If(CurrentLaunchOptions?.SaveBatch Is Nothing, "启动失败", "导出启动脚本失败"))
|
|
|
Throw
|
|
Throw
|
|
|
ElseIf CurrentEx.InnerException IsNot Nothing Then
|
|
ElseIf CurrentEx.InnerException IsNot Nothing Then
|
|
|
'检查下一级错误
|
|
'检查下一级错误
|
|
@@ -168,7 +171,9 @@ NextInner:
|
|
|
Else
|
|
Else
|
|
|
'没有特殊处理过的错误信息
|
|
'没有特殊处理过的错误信息
|
|
|
McLaunchLog("错误:" & GetExceptionDetail(ex))
|
|
McLaunchLog("错误:" & GetExceptionDetail(ex))
|
|
|
- Log(ex, If(Loader.Input.SaveBatch Is Nothing, "Minecraft 启动失败", "导出启动脚本失败"), LogLevel.Msgbox, If(Loader.Input.SaveBatch Is Nothing, "启动失败", "导出启动脚本失败"))
|
|
|
|
|
|
|
+ Log(ex,
|
|
|
|
|
+ If(CurrentLaunchOptions?.SaveBatch Is Nothing, "Minecraft 启动失败", "导出启动脚本失败"), LogLevel.Msgbox,
|
|
|
|
|
+ If(CurrentLaunchOptions?.SaveBatch Is Nothing, "启动失败", "导出启动脚本失败"))
|
|
|
Throw
|
|
Throw
|
|
|
End If
|
|
End If
|
|
|
End Try
|
|
End Try
|
|
@@ -211,36 +216,48 @@ NextInner:
|
|
|
If McVersionCurrent.State = McVersionState.Error Then Throw New Exception("Minecraft 存在问题:" & McVersionCurrent.Info)
|
|
If McVersionCurrent.State = McVersionState.Error Then Throw New Exception("Minecraft 存在问题:" & McVersionCurrent.Info)
|
|
|
'检查输入信息
|
|
'检查输入信息
|
|
|
Dim CheckResult As String = ""
|
|
Dim CheckResult As String = ""
|
|
|
- RunInUiWait(Sub()
|
|
|
|
|
- Dim LoginInput As McLoginData = McLoginInput()
|
|
|
|
|
- CheckResult = McLoginAble(LoginInput)
|
|
|
|
|
- End Sub)
|
|
|
|
|
|
|
+ RunInUiWait(Sub() CheckResult = McLoginAble(McLoginInput()))
|
|
|
If CheckResult <> "" Then Throw New ArgumentException(CheckResult)
|
|
If CheckResult <> "" Then Throw New ArgumentException(CheckResult)
|
|
|
#If BETA Then
|
|
#If BETA Then
|
|
|
'求赞助
|
|
'求赞助
|
|
|
- RunInNewThread(Sub()
|
|
|
|
|
- Select Case Setup.Get("SystemLaunchCount")
|
|
|
|
|
- Case 20, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1700, 1900, 2100, 2300, 2500
|
|
|
|
|
- If MyMsgBox("PCL 已经为你启动了 " & Setup.Get("SystemLaunchCount") & " 次游戏啦!" & vbCrLf &
|
|
|
|
|
- "如果觉得 PCL 还算好用的话,也可以考虑赞助一下作者……一点心意也行……" & vbCrLf &
|
|
|
|
|
- "毕竟一个人开发也不容易(悲)……",
|
|
|
|
|
- "求赞助啦……", "这就赞助!", "但是我拒绝") = 1 Then
|
|
|
|
|
- OpenWebsite("https://afdian.net/a/LTCat")
|
|
|
|
|
- End If
|
|
|
|
|
- End Select
|
|
|
|
|
- End Sub, "Donate")
|
|
|
|
|
-#End If
|
|
|
|
|
- '正版购买提示
|
|
|
|
|
- If Not Setup.Get("HintBuy") AndAlso Setup.Get("LoginType") <> McLoginType.Ms Then
|
|
|
|
|
|
|
+ RunInNewThread(
|
|
|
|
|
+ Sub()
|
|
|
Select Case Setup.Get("SystemLaunchCount")
|
|
Select Case Setup.Get("SystemLaunchCount")
|
|
|
- Case 10, 35, 75, 125, 175, 225, 275, 325, 375, 425, 475, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1600, 1800, 2000, 2200, 2400
|
|
|
|
|
- If MyMsgBox("你已经启动了 " & Setup.Get("SystemLaunchCount") & " 次 Minecraft 啦!" & vbCrLf &
|
|
|
|
|
- "如果觉得 Minecraft 还不错,也可以考虑购买正版支持一下,毕竟开发游戏也很不容易……" & vbCrLf &
|
|
|
|
|
- "在你登录一次正版账号后,就不会再出现这个提示了。",
|
|
|
|
|
- "考虑一下正版?", "购买正版游戏", "下次一定") = 1 Then
|
|
|
|
|
- OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj")
|
|
|
|
|
|
|
+ Case 10, 20, 40, 60, 80, 100, 120, 150, 200, 250, 300, 350, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, 1600, 1800, 2000
|
|
|
|
|
+ If MyMsgBox("PCL 已经为你启动了 " & Setup.Get("SystemLaunchCount") & " 次游戏啦!" & vbCrLf &
|
|
|
|
|
+ "如果 PCL 还算好用的话,能不能考虑赞助一下 PCL……" & vbCrLf &
|
|
|
|
|
+ "如果没有大家的支持,PCL 很难在免费、无任何广告的情况下维持数年的更新(磕头)……!",
|
|
|
|
|
+ Setup.Get("SystemLaunchCount") & " 次启动!", "支持 PCL!", "但是我拒绝") = 1 Then
|
|
|
|
|
+ OpenWebsite("https://afdian.com/a/LTCat")
|
|
|
End If
|
|
End If
|
|
|
End Select
|
|
End Select
|
|
|
|
|
+ End Sub, "Donate")
|
|
|
|
|
+#End If
|
|
|
|
|
+ '正版购买提示
|
|
|
|
|
+ If Not Setup.Get("HintBuy") AndAlso Setup.Get("LoginType") <> McLoginType.Ms Then
|
|
|
|
|
+ If IsSystemLanguageChinese() Then
|
|
|
|
|
+ RunInNewThread(
|
|
|
|
|
+ Sub()
|
|
|
|
|
+ Select Case Setup.Get("SystemLaunchCount")
|
|
|
|
|
+ Case 3, 8, 15, 30, 50, 70, 90, 110, 130, 180, 220, 280, 330, 380, 450, 550, 660, 750, 880, 950, 1100, 1300, 1500, 1700, 1900
|
|
|
|
|
+ If MyMsgBox("你已经启动了 " & Setup.Get("SystemLaunchCount") & " 次 Minecraft 啦!" & vbCrLf &
|
|
|
|
|
+ "如果觉得 Minecraft 还不错,可以购买正版支持一下,毕竟开发游戏也真的很不容易……不要一直白嫖啦。" & vbCrLf & vbCrLf &
|
|
|
|
|
+ "在登录一次正版账号后,就不会再出现这个提示了!",
|
|
|
|
|
+ "考虑一下正版?", "支持正版游戏!", "下次一定") = 1 Then
|
|
|
|
|
+ OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj")
|
|
|
|
|
+ End If
|
|
|
|
|
+ End Select
|
|
|
|
|
+ End Sub, "Buy Minecraft")
|
|
|
|
|
+ ElseIf Setup.Get("LoginType") = McLoginType.Legacy Then
|
|
|
|
|
+ Select Case MyMsgBox("你必须先登录正版账号,才能进行离线登录!", "正版验证", "购买正版", "试玩", "返回",
|
|
|
|
|
+ Button1Action:=Sub() OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj"))
|
|
|
|
|
+ Case 2
|
|
|
|
|
+ Hint("游戏将以试玩模式启动!", HintType.Critical)
|
|
|
|
|
+ CurrentLaunchOptions.ExtraArgs.Add("--demo")
|
|
|
|
|
+ Case 3
|
|
|
|
|
+ Throw New Exception("$$")
|
|
|
|
|
+ End Select
|
|
|
|
|
+ End If
|
|
|
End If
|
|
End If
|
|
|
End Sub
|
|
End Sub
|
|
|
|
|
|
|
@@ -364,19 +381,19 @@ NextInner:
|
|
|
'根据当前登录方式优先返回
|
|
'根据当前登录方式优先返回
|
|
|
Select Case Setup.Get("LoginType")
|
|
Select Case Setup.Get("LoginType")
|
|
|
Case McLoginType.Ms
|
|
Case McLoginType.Ms
|
|
|
- If Setup.Get("CacheMsName") <> "" Then Return Setup.Get("CacheMsName")
|
|
|
|
|
|
|
+ If Setup.Get("CacheMsV2Name") <> "" Then Return Setup.Get("CacheMsV2Name")
|
|
|
Case McLoginType.Legacy
|
|
Case McLoginType.Legacy
|
|
|
- If Setup.Get("LoginLegacyName") <> "" Then Return Setup.Get("LoginLegacyName").ToString.Before("¨")
|
|
|
|
|
|
|
+ If Setup.Get("LoginLegacyName") <> "" Then Return Setup.Get("LoginLegacyName").ToString.BeforeFirst("¨")
|
|
|
Case McLoginType.Nide
|
|
Case McLoginType.Nide
|
|
|
If Setup.Get("CacheNideName") <> "" Then Return Setup.Get("CacheNideName")
|
|
If Setup.Get("CacheNideName") <> "" Then Return Setup.Get("CacheNideName")
|
|
|
Case McLoginType.Auth
|
|
Case McLoginType.Auth
|
|
|
If Setup.Get("CacheAuthName") <> "" Then Return Setup.Get("CacheAuthName")
|
|
If Setup.Get("CacheAuthName") <> "" Then Return Setup.Get("CacheAuthName")
|
|
|
End Select
|
|
End Select
|
|
|
'查找所有可能的项
|
|
'查找所有可能的项
|
|
|
- If Setup.Get("CacheMsName") <> "" Then Return Setup.Get("CacheMsName")
|
|
|
|
|
|
|
+ If Setup.Get("CacheMsV2Name") <> "" Then Return Setup.Get("CacheMsV2Name")
|
|
|
If Setup.Get("CacheNideName") <> "" Then Return Setup.Get("CacheNideName")
|
|
If Setup.Get("CacheNideName") <> "" Then Return Setup.Get("CacheNideName")
|
|
|
If Setup.Get("CacheAuthName") <> "" Then Return Setup.Get("CacheAuthName")
|
|
If Setup.Get("CacheAuthName") <> "" Then Return Setup.Get("CacheAuthName")
|
|
|
- If Setup.Get("LoginLegacyName") <> "" Then Return Setup.Get("LoginLegacyName").ToString.Before("¨")
|
|
|
|
|
|
|
+ If Setup.Get("LoginLegacyName") <> "" Then Return Setup.Get("LoginLegacyName").ToString.BeforeFirst("¨")
|
|
|
Return Nothing
|
|
Return Nothing
|
|
|
End Function
|
|
End Function
|
|
|
''' <summary>
|
|
''' <summary>
|
|
@@ -385,7 +402,7 @@ NextInner:
|
|
|
Public Function McLoginAble() As String
|
|
Public Function McLoginAble() As String
|
|
|
Select Case Setup.Get("LoginType")
|
|
Select Case Setup.Get("LoginType")
|
|
|
Case McLoginType.Ms
|
|
Case McLoginType.Ms
|
|
|
- If Setup.Get("CacheMsOAuthRefresh") = "" Then
|
|
|
|
|
|
|
+ If Setup.Get("CacheMsV2OAuthRefresh") = "" Then
|
|
|
Return FrmLoginMs.IsVaild()
|
|
Return FrmLoginMs.IsVaild()
|
|
|
Else
|
|
Else
|
|
|
Return ""
|
|
Return ""
|
|
@@ -436,7 +453,7 @@ NextInner:
|
|
|
Case McLoginType.Legacy
|
|
Case McLoginType.Legacy
|
|
|
LoginData = PageLoginLegacy.GetLoginData()
|
|
LoginData = PageLoginLegacy.GetLoginData()
|
|
|
Case McLoginType.Ms
|
|
Case McLoginType.Ms
|
|
|
- If Setup.Get("CacheMsOAuthRefresh") = "" Then
|
|
|
|
|
|
|
+ If Setup.Get("CacheMsV2OAuthRefresh") = "" Then
|
|
|
LoginData = PageLoginMs.GetLoginData()
|
|
LoginData = PageLoginMs.GetLoginData()
|
|
|
Else
|
|
Else
|
|
|
LoginData = PageLoginMsSkin.GetLoginData()
|
|
LoginData = PageLoginMsSkin.GetLoginData()
|
|
@@ -487,19 +504,22 @@ NextInner:
|
|
|
#Region "分方式登录模块"
|
|
#Region "分方式登录模块"
|
|
|
|
|
|
|
|
'各个登录方式的主对象与输入构造
|
|
'各个登录方式的主对象与输入构造
|
|
|
- Public McLoginMsLoader As New LoaderTask(Of McLoginMs, McLoginResult)("Loader Login Ms", AddressOf McLoginMsStart) With {.ReloadTimeout = 300000}
|
|
|
|
|
|
|
+ Public McLoginMsLoader As New LoaderTask(Of McLoginMs, McLoginResult)("Loader Login Ms", AddressOf McLoginMsStart) With {.ReloadTimeout = 1}
|
|
|
Public McLoginLegacyLoader As New LoaderTask(Of McLoginLegacy, McLoginResult)("Loader Login Legacy", AddressOf McLoginLegacyStart)
|
|
Public McLoginLegacyLoader As New LoaderTask(Of McLoginLegacy, McLoginResult)("Loader Login Legacy", AddressOf McLoginLegacyStart)
|
|
|
- Public McLoginNideLoader As New LoaderTask(Of McLoginServer, McLoginResult)("Loader Login Nide", AddressOf McLoginServerStart) With {.ReloadTimeout = 60000}
|
|
|
|
|
- Public McLoginAuthLoader As New LoaderTask(Of McLoginServer, McLoginResult)("Loader Login Auth", AddressOf McLoginServerStart) With {.ReloadTimeout = 60000}
|
|
|
|
|
|
|
+ Public McLoginNideLoader As New LoaderTask(Of McLoginServer, McLoginResult)("Loader Login Nide", AddressOf McLoginServerStart) With {.ReloadTimeout = 1000 * 60 * 10}
|
|
|
|
|
+ Public McLoginAuthLoader As New LoaderTask(Of McLoginServer, McLoginResult)("Loader Login Auth", AddressOf McLoginServerStart) With {.ReloadTimeout = 1000 * 60 * 10}
|
|
|
|
|
|
|
|
'主加载函数,返回所有需要的登录信息
|
|
'主加载函数,返回所有需要的登录信息
|
|
|
|
|
+ Private McLoginMsRefreshTime As Long = 0 '上次刷新登录的时间
|
|
|
Private Sub McLoginMsStart(Data As LoaderTask(Of McLoginMs, McLoginResult))
|
|
Private Sub McLoginMsStart(Data As LoaderTask(Of McLoginMs, McLoginResult))
|
|
|
Dim Input As McLoginMs = Data.Input
|
|
Dim Input As McLoginMs = Data.Input
|
|
|
Dim LogUsername As String = Input.UserName
|
|
Dim LogUsername As String = Input.UserName
|
|
|
McLaunchLog("登录方式:正版(" & If(LogUsername = "", "尚未登录", LogUsername) & ")")
|
|
McLaunchLog("登录方式:正版(" & If(LogUsername = "", "尚未登录", LogUsername) & ")")
|
|
|
Data.Progress = 0.05
|
|
Data.Progress = 0.05
|
|
|
'检查是否已经登录完成
|
|
'检查是否已经登录完成
|
|
|
- If Input.AccessToken <> "" AndAlso Not Data.IsForceRestarting Then
|
|
|
|
|
|
|
+ If Not Data.IsForceRestarting AndAlso '不要求强行重启
|
|
|
|
|
+ Input.AccessToken <> "" AndAlso '已经登录过了
|
|
|
|
|
+ (McLoginMsRefreshTime > 0 AndAlso GetTimeTick() - McLoginMsRefreshTime < 1000 * 60 * 10) Then '完成时间在 10 分钟内
|
|
|
Data.Output = New McLoginResult With
|
|
Data.Output = New McLoginResult With
|
|
|
{.AccessToken = Input.AccessToken, .Name = Input.UserName, .Uuid = Input.Uuid, .Type = "Microsoft", .ClientToken = Input.Uuid, .ProfileJson = Input.ProfileJson}
|
|
{.AccessToken = Input.AccessToken, .Name = Input.UserName, .Uuid = Input.Uuid, .Type = "Microsoft", .ClientToken = Input.Uuid, .ProfileJson = Input.ProfileJson}
|
|
|
GoTo SkipLogin
|
|
GoTo SkipLogin
|
|
@@ -509,49 +529,47 @@ NextInner:
|
|
|
If Input.OAuthRefreshToken = "" Then
|
|
If Input.OAuthRefreshToken = "" Then
|
|
|
'无 RefreshToken
|
|
'无 RefreshToken
|
|
|
Relogin:
|
|
Relogin:
|
|
|
- Dim OAuthCode As String = MsLoginStep1(Data)
|
|
|
|
|
- If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
|
|
- Data.Progress = 0.2
|
|
|
|
|
- OAuthTokens = MsLoginStep2(OAuthCode, False)
|
|
|
|
|
|
|
+ OAuthTokens = MsLoginStep1New(Data)
|
|
|
Else
|
|
Else
|
|
|
'有 RefreshToken
|
|
'有 RefreshToken
|
|
|
- OAuthTokens = MsLoginStep2(Input.OAuthRefreshToken, True)
|
|
|
|
|
|
|
+ OAuthTokens = MsLoginStep1Refresh(Input.OAuthRefreshToken)
|
|
|
|
|
+ If OAuthTokens(0) = "Relogin" Then GoTo Relogin '要求重新打开登录网页认证
|
|
|
End If
|
|
End If
|
|
|
- '要求重新打开登录网页认证
|
|
|
|
|
- If OAuthTokens(0) = "Relogin" Then GoTo Relogin
|
|
|
|
|
- Data.Progress = 0.35
|
|
|
|
|
|
|
+ If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
|
|
+ Data.Progress = 0.25
|
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
Dim OAuthAccessToken As String = OAuthTokens(0)
|
|
Dim OAuthAccessToken As String = OAuthTokens(0)
|
|
|
Dim OAuthRefreshToken As String = OAuthTokens(1)
|
|
Dim OAuthRefreshToken As String = OAuthTokens(1)
|
|
|
- Dim XBLToken As String = MsLoginStep3(OAuthAccessToken)
|
|
|
|
|
- Data.Progress = 0.5
|
|
|
|
|
|
|
+ Dim XBLToken As String = MsLoginStep2(OAuthAccessToken)
|
|
|
|
|
+ Data.Progress = 0.4
|
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
- Dim Tokens = MsLoginStep4(XBLToken)
|
|
|
|
|
- Data.Progress = 0.65
|
|
|
|
|
|
|
+ Dim Tokens = MsLoginStep3(XBLToken)
|
|
|
|
|
+ Data.Progress = 0.55
|
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
- Dim AccessToken As String = MsLoginStep5(Tokens)
|
|
|
|
|
- Data.Progress = 0.8
|
|
|
|
|
|
|
+ Dim AccessToken As String = MsLoginStep4(Tokens)
|
|
|
|
|
+ Data.Progress = 0.7
|
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
- MsLoginStep6(AccessToken)
|
|
|
|
|
- Data.Progress = 0.9
|
|
|
|
|
|
|
+ MsLoginStep5(AccessToken)
|
|
|
|
|
+ Data.Progress = 0.85
|
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
If Data.IsAborted Then Throw New ThreadInterruptedException
|
|
|
- Dim Result = MsLoginStep7(AccessToken)
|
|
|
|
|
|
|
+ Dim Result = MsLoginStep6(AccessToken)
|
|
|
|
|
+ Data.Progress = 0.98
|
|
|
'输出登录结果
|
|
'输出登录结果
|
|
|
- Setup.Set("CacheMsOAuthRefresh", OAuthRefreshToken)
|
|
|
|
|
- Setup.Set("CacheMsAccess", AccessToken)
|
|
|
|
|
- Setup.Set("CacheMsUuid", Result(0))
|
|
|
|
|
- Setup.Set("CacheMsName", Result(1))
|
|
|
|
|
- Setup.Set("CacheMsProfileJson", Result(2))
|
|
|
|
|
|
|
+ Setup.Set("CacheMsV2OAuthRefresh", OAuthRefreshToken)
|
|
|
|
|
+ Setup.Set("CacheMsV2Access", AccessToken)
|
|
|
|
|
+ Setup.Set("CacheMsV2Uuid", Result(0))
|
|
|
|
|
+ Setup.Set("CacheMsV2Name", Result(1))
|
|
|
|
|
+ Setup.Set("CacheMsV2ProfileJson", Result(2))
|
|
|
Dim MsJson As JObject = GetJson(Setup.Get("LoginMsJson"))
|
|
Dim MsJson As JObject = GetJson(Setup.Get("LoginMsJson"))
|
|
|
MsJson.Remove(Input.UserName) '如果更改了玩家名……
|
|
MsJson.Remove(Input.UserName) '如果更改了玩家名……
|
|
|
MsJson(Result(1)) = OAuthRefreshToken
|
|
MsJson(Result(1)) = OAuthRefreshToken
|
|
|
Setup.Set("LoginMsJson", MsJson.ToString(Newtonsoft.Json.Formatting.None))
|
|
Setup.Set("LoginMsJson", MsJson.ToString(Newtonsoft.Json.Formatting.None))
|
|
|
Data.Output = New McLoginResult With {.AccessToken = AccessToken, .Name = Result(1), .Uuid = Result(0), .Type = "Microsoft", .ClientToken = Result(0), .ProfileJson = Result(2)}
|
|
Data.Output = New McLoginResult With {.AccessToken = AccessToken, .Name = Result(1), .Uuid = Result(0), .Type = "Microsoft", .ClientToken = Result(0), .ProfileJson = Result(2)}
|
|
|
- '解锁主题
|
|
|
|
|
-SkipLogin:
|
|
|
|
|
|
|
+ '结束
|
|
|
|
|
+ McLoginMsRefreshTime = GetTimeTick()
|
|
|
McLaunchLog("微软登录完成")
|
|
McLaunchLog("微软登录完成")
|
|
|
|
|
+SkipLogin:
|
|
|
Setup.Set("HintBuy", True) '关闭正版购买提示
|
|
Setup.Set("HintBuy", True) '关闭正版购买提示
|
|
|
- Data.Progress = 0.98
|
|
|
|
|
If ThemeUnlock(10, False) Then MyMsgBox("感谢你对正版游戏的支持!" & vbCrLf & "隐藏主题 跳票红 已解锁!", "提示")
|
|
If ThemeUnlock(10, False) Then MyMsgBox("感谢你对正版游戏的支持!" & vbCrLf & "隐藏主题 跳票红 已解锁!", "提示")
|
|
|
End Sub
|
|
End Sub
|
|
|
Private Sub McLoginServerStart(Data As LoaderTask(Of McLoginServer, McLoginResult))
|
|
Private Sub McLoginServerStart(Data As LoaderTask(Of McLoginServer, McLoginResult))
|
|
@@ -668,6 +686,7 @@ LoginFinish:
|
|
|
Url:=Data.Input.BaseUrl & "/validate",
|
|
Url:=Data.Input.BaseUrl & "/validate",
|
|
|
Method:="POST",
|
|
Method:="POST",
|
|
|
Data:=RequestData.ToString(0),
|
|
Data:=RequestData.ToString(0),
|
|
|
|
|
+ Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
|
|
|
ContentType:="application/json; charset=utf-8") '没有返回值的
|
|
ContentType:="application/json; charset=utf-8") '没有返回值的
|
|
|
'将登录结果输出
|
|
'将登录结果输出
|
|
|
Data.Output.AccessToken = AccessToken
|
|
Data.Output.AccessToken = AccessToken
|
|
@@ -691,6 +710,7 @@ LoginFinish:
|
|
|
""name"":""" & Setup.Get("Cache" & Data.Input.Token & "Name") & """},", "") & "
|
|
""name"":""" & Setup.Get("Cache" & Data.Input.Token & "Name") & """},", "") & "
|
|
|
""accessToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Access") & """,
|
|
""accessToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Access") & """,
|
|
|
""clientToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Client") & """}",
|
|
""clientToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Client") & """}",
|
|
|
|
|
+ Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
|
|
|
ContentType:="application/json; charset=utf-8"))
|
|
ContentType:="application/json; charset=utf-8"))
|
|
|
'将登录结果输出
|
|
'将登录结果输出
|
|
|
If LoginJson("selectedProfile") Is Nothing Then Throw New Exception("选择的角色 " & Setup.Get("Cache" & Data.Input.Token & "Name") & " 无效!")
|
|
If LoginJson("selectedProfile") Is Nothing Then Throw New Exception("选择的角色 " & Setup.Get("Cache" & Data.Input.Token & "Name") & " 无效!")
|
|
@@ -721,6 +741,7 @@ LoginFinish:
|
|
|
Url:=Data.Input.BaseUrl & "/authenticate",
|
|
Url:=Data.Input.BaseUrl & "/authenticate",
|
|
|
Method:="POST",
|
|
Method:="POST",
|
|
|
Data:=RequestData.ToString(0),
|
|
Data:=RequestData.ToString(0),
|
|
|
|
|
+ Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
|
|
|
ContentType:="application/json; charset=utf-8"))
|
|
ContentType:="application/json; charset=utf-8"))
|
|
|
'检查登录结果
|
|
'检查登录结果
|
|
|
If LoginJson("availableProfiles").Count = 0 Then
|
|
If LoginJson("availableProfiles").Count = 0 Then
|
|
@@ -780,6 +801,28 @@ LoginFinish:
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
|
Dim AllMessage As String = GetExceptionSummary(ex)
|
|
Dim AllMessage As String = GetExceptionSummary(ex)
|
|
|
Log(ex, "登录失败原始错误信息", LogLevel.Normal)
|
|
Log(ex, "登录失败原始错误信息", LogLevel.Normal)
|
|
|
|
|
+ '读取服务器返回的错误
|
|
|
|
|
+ If TypeOf ex Is ResponsedWebException Then
|
|
|
|
|
+ Dim ErrorMessage As String = Nothing
|
|
|
|
|
+ Try
|
|
|
|
|
+ ErrorMessage = GetJson(DirectCast(ex, ResponsedWebException).Response)("errorMessage")
|
|
|
|
|
+ Catch
|
|
|
|
|
+ End Try
|
|
|
|
|
+ If Not String.IsNullOrWhiteSpace(ErrorMessage) Then
|
|
|
|
|
+ If ErrorMessage.Contains("密码错误") OrElse ErrorMessage.ContainsF("Incorrect username or password", True) Then
|
|
|
|
|
+ '密码错误,退出登录 (#5090)
|
|
|
|
|
+ McLaunchLog("密码错误,退出登录")
|
|
|
|
|
+ Select Case Data.Input.Type
|
|
|
|
|
+ Case McLoginType.Auth
|
|
|
|
|
+ RunInUi(AddressOf PageLoginAuthSkin.ExitLogin)
|
|
|
|
|
+ Case McLoginType.Nide
|
|
|
|
|
+ RunInUi(AddressOf PageLoginNideSkin.ExitLogin)
|
|
|
|
|
+ End Select
|
|
|
|
|
+ End If
|
|
|
|
|
+ Throw New Exception("$登录失败:" & ErrorMessage)
|
|
|
|
|
+ End If
|
|
|
|
|
+ End If
|
|
|
|
|
+ '通用关键字检测
|
|
|
If AllMessage.Contains("403") Then
|
|
If AllMessage.Contains("403") Then
|
|
|
Select Case Data.Input.Type
|
|
Select Case Data.Input.Type
|
|
|
Case McLoginType.Auth
|
|
Case McLoginType.Auth
|
|
@@ -805,90 +848,48 @@ LoginFinish:
|
|
|
End Try
|
|
End Try
|
|
|
End Function
|
|
End Function
|
|
|
|
|
|
|
|
- '微软登录步骤 1:打开网页认证,获取 OAuth Code
|
|
|
|
|
- Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult)) As String
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 1")
|
|
|
|
|
- If True OrElse OsVersion <= New Version(10, 0, 17763, 0) Then '由于 #3849,WebBrowser 已经无法正常加载微软登录网页了
|
|
|
|
|
-SystemBrowser:
|
|
|
|
|
- 'Windows 7 或老版 Windows 10 登录
|
|
|
|
|
- OpenWebsite(FormLoginOAuth.LoginUrl1)
|
|
|
|
|
- Dim Result As String =
|
|
|
|
|
- MyMsgBoxInput("等待网页登录",
|
|
|
|
|
- "登录完成后,网页会变得完全空白,把那个空白网页的网址复制到下面的框中就行了!" & vbCrLf &
|
|
|
|
|
- "如果网络环境不佳,它可能一直加载不出来,那就只能试试用 VPN 或加速器了。",
|
|
|
|
|
- ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateRegex("(?<=code\=)[^&]+", "返回网址应以 https://login.live.com/oauth20_desktop.srf?code= 开头")},
|
|
|
|
|
- HintText:="https://login.live.com/oauth20_desktop.srf?code=XXXXXX")
|
|
|
|
|
- If Result Is Nothing Then
|
|
|
|
|
- McLaunchLog("微软登录已在步骤 1 被取消")
|
|
|
|
|
- Throw New ThreadInterruptedException("$$")
|
|
|
|
|
|
|
+ '微软登录步骤 1,原始登录:获取 DeviceCode 并开启登录网页
|
|
|
|
|
+ Private Function MsLoginStep1New(Data As LoaderTask(Of McLoginMs, McLoginResult)) As String()
|
|
|
|
|
+ '参考:https://learn.microsoft.com/zh-cn/entra/identity-platform/v2-oauth2-device-code
|
|
|
|
|
+
|
|
|
|
|
+ '初始请求
|
|
|
|
|
+Retry:
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 1/6(原始登录)")
|
|
|
|
|
+ Dim PrepareJson As JObject = GetJson(NetRequestRetry("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST",
|
|
|
|
|
+ $"client_id={OAuthClientId}&tenant=/consumers&scope=XboxLive.signin%20offline_access", "application/x-www-form-urlencoded"))
|
|
|
|
|
+ McLaunchLog("网页登录地址:" & PrepareJson("verification_uri").ToString)
|
|
|
|
|
+
|
|
|
|
|
+ '弹窗
|
|
|
|
|
+ Dim Converter As New MyMsgBoxConverter With {.Content = PrepareJson, .ForceWait = True, .Type = MyMsgBoxType.Login}
|
|
|
|
|
+ WaitingMyMsgBox.Add(Converter)
|
|
|
|
|
+ While Converter.Result Is Nothing
|
|
|
|
|
+ Thread.Sleep(100)
|
|
|
|
|
+ End While
|
|
|
|
|
+ If TypeOf Converter.Result Is RestartException Then
|
|
|
|
|
+ If MyMsgBox($"请在登录时选择 {vbLQ}其他登录方法{vbRQ},然后选择 {vbLQ}使用我的密码{vbRQ}。{vbCrLf}如果没有该选项,请选择 {vbLQ}设置密码{vbRQ},设置完毕后再登录。",
|
|
|
|
|
+ "需要使用密码登录", "重新登录", "设置密码", "取消",
|
|
|
|
|
+ Button2Action:=Sub() OpenWebsite("https://account.live.com/password/Change")) = 1 Then
|
|
|
|
|
+ GoTo Retry
|
|
|
Else
|
|
Else
|
|
|
- Return RegexSeek(Result, "(?<=code\=)[^&]+")
|
|
|
|
|
|
|
+ Throw New Exception("$$")
|
|
|
End If
|
|
End If
|
|
|
- Hint("网页登录成功,你可以关闭浏览器啦!", HintType.Finish)
|
|
|
|
|
|
|
+ ElseIf TypeOf Converter.Result Is Exception Then
|
|
|
|
|
+ Throw CType(Converter.Result, Exception)
|
|
|
Else
|
|
Else
|
|
|
- 'Windows 10 登录
|
|
|
|
|
- Dim ReturnCode As String = Nothing
|
|
|
|
|
- Dim ReturnEx As Exception = Nothing
|
|
|
|
|
- Dim IsFinished As LoadState = LoadState.Loading
|
|
|
|
|
- Dim LoginForm As FormLoginOAuth = Nothing
|
|
|
|
|
- Dim IsSwitchToSystemBrowser As Boolean = False
|
|
|
|
|
- RunInUi(Sub()
|
|
|
|
|
- Try
|
|
|
|
|
- LoginForm = New FormLoginOAuth
|
|
|
|
|
- LoginForm.Show()
|
|
|
|
|
- AddHandler LoginForm.OnLoginSuccess, Sub(Code As String)
|
|
|
|
|
- ReturnCode = Code
|
|
|
|
|
- IsFinished = LoadState.Finished
|
|
|
|
|
- End Sub
|
|
|
|
|
- AddHandler LoginForm.OnLoginCanceled, Sub(IsSwitch As Boolean)
|
|
|
|
|
- IsFinished = LoadState.Aborted
|
|
|
|
|
- IsSwitchToSystemBrowser = IsSwitch
|
|
|
|
|
- End Sub
|
|
|
|
|
- Catch ex As Exception
|
|
|
|
|
- ReturnEx = ex
|
|
|
|
|
- IsFinished = LoadState.Failed
|
|
|
|
|
- End Try
|
|
|
|
|
- End Sub)
|
|
|
|
|
- Do While IsFinished = LoadState.Loading AndAlso Not Data.IsAborted
|
|
|
|
|
- Thread.Sleep(20)
|
|
|
|
|
- Loop
|
|
|
|
|
- RunInUi(Sub() If LoginForm IsNot Nothing Then LoginForm.Close())
|
|
|
|
|
- If IsFinished = LoadState.Finished Then
|
|
|
|
|
- Return ReturnCode
|
|
|
|
|
- ElseIf IsFinished = LoadState.Failed Then
|
|
|
|
|
- Throw ReturnEx
|
|
|
|
|
- ElseIf IsSwitchToSystemBrowser Then
|
|
|
|
|
- McLaunchLog("微软登录在步骤 1 要求切换到系统浏览器")
|
|
|
|
|
- GoTo SystemBrowser
|
|
|
|
|
- Else
|
|
|
|
|
- McLaunchLog("微软登录已在步骤 1 被取消")
|
|
|
|
|
- Throw New ThreadInterruptedException("$$")
|
|
|
|
|
- End If
|
|
|
|
|
|
|
+ Return Converter.Result
|
|
|
End If
|
|
End If
|
|
|
End Function
|
|
End Function
|
|
|
- '微软登录步骤 2:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken}
|
|
|
|
|
- Private Function MsLoginStep2(Code As String, IsRefresh As Boolean) As String()
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 2(" & If(IsRefresh, "", "非") & "刷新登录)")
|
|
|
|
|
-
|
|
|
|
|
- Dim Request As String
|
|
|
|
|
- If IsRefresh Then
|
|
|
|
|
- Request = "client_id=00000000402b5328" & "&" &
|
|
|
|
|
- "refresh_token=" & Uri.EscapeDataString(Code) & "&" &
|
|
|
|
|
- "grant_type=refresh_token" & "&" &
|
|
|
|
|
- "redirect_uri=" & Uri.EscapeDataString("https://login.live.com/oauth20_desktop.srf") & "&" &
|
|
|
|
|
- "scope=" & Uri.EscapeDataString("service::user.auth.xboxlive.com::MBI_SSL")
|
|
|
|
|
- Else
|
|
|
|
|
- Request = "client_id=00000000402b5328" & "&" &
|
|
|
|
|
- "code=" & Uri.EscapeDataString(Code) & "&" &
|
|
|
|
|
- "grant_type=authorization_code" & "&" &
|
|
|
|
|
- "redirect_uri=" & Uri.EscapeDataString("https://login.live.com/oauth20_desktop.srf") & "&" &
|
|
|
|
|
- "scope=" & Uri.EscapeDataString("service::user.auth.xboxlive.com::MBI_SSL")
|
|
|
|
|
- End If
|
|
|
|
|
|
|
+ '微软登录步骤 1,刷新登录:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken}
|
|
|
|
|
+ Private Function MsLoginStep1Refresh(Code As String) As String()
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 1/6(刷新登录)")
|
|
|
|
|
+
|
|
|
Dim Result As String
|
|
Dim Result As String
|
|
|
Try
|
|
Try
|
|
|
- Result = NetRequestMulty("https://login.live.com/oauth20_token.srf", "POST", Request, "application/x-www-form-urlencoded", 2)
|
|
|
|
|
|
|
+ Result = NetRequestMultiple("https://login.live.com/oauth20_token.srf", "POST",
|
|
|
|
|
+ $"client_id={OAuthClientId}&refresh_token={Uri.EscapeDataString(Code)}&grant_type=refresh_token&scope=XboxLive.signin%20offline_access",
|
|
|
|
|
+ "application/x-www-form-urlencoded", 2)
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
|
- If ex.Message.Contains("must sign in again") OrElse ex.Message.Contains("invalid_grant") Then '#269
|
|
|
|
|
|
|
+ If ex.Message.Contains("must sign in again") OrElse (ex.Message.Contains("refresh_token") AndAlso ex.Message.Contains("is not valid")) Then '#269
|
|
|
Return {"Relogin", ""}
|
|
Return {"Relogin", ""}
|
|
|
Else
|
|
Else
|
|
|
Throw
|
|
Throw
|
|
@@ -900,28 +901,28 @@ SystemBrowser:
|
|
|
Dim RefreshToken As String = ResultJson("refresh_token").ToString
|
|
Dim RefreshToken As String = ResultJson("refresh_token").ToString
|
|
|
Return {AccessToken, RefreshToken}
|
|
Return {AccessToken, RefreshToken}
|
|
|
End Function
|
|
End Function
|
|
|
- '微软登录步骤 3:从 OAuth AccessToken 获取 XBLToken
|
|
|
|
|
- Private Function MsLoginStep3(AccessToken As String) As String
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 3")
|
|
|
|
|
|
|
+ '微软登录步骤 2:从 OAuth AccessToken 获取 XBLToken
|
|
|
|
|
+ Private Function MsLoginStep2(AccessToken As String) As String
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 2/6")
|
|
|
|
|
|
|
|
Dim Request As String = "{
|
|
Dim Request As String = "{
|
|
|
- ""Properties"": {
|
|
|
|
|
- ""AuthMethod"": ""RPS"",
|
|
|
|
|
- ""SiteName"": ""user.auth.xboxlive.com"",
|
|
|
|
|
- ""RpsTicket"": """ & AccessToken & """
|
|
|
|
|
- },
|
|
|
|
|
- ""RelyingParty"": ""http://auth.xboxlive.com"",
|
|
|
|
|
- ""TokenType"": ""JWT""
|
|
|
|
|
- }"
|
|
|
|
|
- Dim Result As String = NetRequestMulty("https://user.auth.xboxlive.com/user/authenticate", "POST", Request, "application/json", 3)
|
|
|
|
|
|
|
+ ""Properties"": {
|
|
|
|
|
+ ""AuthMethod"": ""RPS"",
|
|
|
|
|
+ ""SiteName"": ""user.auth.xboxlive.com"",
|
|
|
|
|
+ ""RpsTicket"": """ & If(AccessToken.StartsWithF("d="), "", "d=") & AccessToken & """
|
|
|
|
|
+ },
|
|
|
|
|
+ ""RelyingParty"": ""http://auth.xboxlive.com"",
|
|
|
|
|
+ ""TokenType"": ""JWT""
|
|
|
|
|
+ }"
|
|
|
|
|
+ Dim Result As String = NetRequestMultiple("https://user.auth.xboxlive.com/user/authenticate", "POST", Request, "application/json", 3)
|
|
|
|
|
|
|
|
Dim ResultJson As JObject = GetJson(Result)
|
|
Dim ResultJson As JObject = GetJson(Result)
|
|
|
Dim XBLToken As String = ResultJson("Token").ToString
|
|
Dim XBLToken As String = ResultJson("Token").ToString
|
|
|
Return XBLToken
|
|
Return XBLToken
|
|
|
End Function
|
|
End Function
|
|
|
- '微软登录步骤 4:从 XBLToken 获取 {XSTSToken, UHS}
|
|
|
|
|
- Private Function MsLoginStep4(XBLToken As String) As String()
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 4")
|
|
|
|
|
|
|
+ '微软登录步骤 3:从 XBLToken 获取 {XSTSToken, UHS}
|
|
|
|
|
+ Private Function MsLoginStep3(XBLToken As String) As String()
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 3/6")
|
|
|
|
|
|
|
|
Dim Request As String = "{
|
|
Dim Request As String = "{
|
|
|
""Properties"": {
|
|
""Properties"": {
|
|
@@ -935,7 +936,7 @@ SystemBrowser:
|
|
|
}"
|
|
}"
|
|
|
Dim Result As String
|
|
Dim Result As String
|
|
|
Try
|
|
Try
|
|
|
- Result = NetRequestMulty("https://xsts.auth.xboxlive.com/xsts/authorize", "POST", Request, "application/json", 3)
|
|
|
|
|
|
|
+ Result = NetRequestMultiple("https://xsts.auth.xboxlive.com/xsts/authorize", "POST", Request, "application/json", 3)
|
|
|
Catch ex As Net.WebException
|
|
Catch ex As Net.WebException
|
|
|
'参考 https://github.com/PrismarineJS/prismarine-auth/blob/master/src/common/Constants.js
|
|
'参考 https://github.com/PrismarineJS/prismarine-auth/blob/master/src/common/Constants.js
|
|
|
If ex.Message.Contains("2148916227") Then
|
|
If ex.Message.Contains("2148916227") Then
|
|
@@ -971,14 +972,14 @@ SystemBrowser:
|
|
|
Dim UHS As String = ResultJson("DisplayClaims")("xui")(0)("uhs").ToString
|
|
Dim UHS As String = ResultJson("DisplayClaims")("xui")(0)("uhs").ToString
|
|
|
Return {XSTSToken, UHS}
|
|
Return {XSTSToken, UHS}
|
|
|
End Function
|
|
End Function
|
|
|
- '微软登录步骤 5:从 {XSTSToken, UHS} 获取 Minecraft AccessToken
|
|
|
|
|
- Private Function MsLoginStep5(Tokens As String()) As String
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 5")
|
|
|
|
|
|
|
+ '微软登录步骤 4:从 {XSTSToken, UHS} 获取 Minecraft AccessToken
|
|
|
|
|
+ Private Function MsLoginStep4(Tokens As String()) As String
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 4/6")
|
|
|
|
|
|
|
|
Dim Request As String = New JObject(New JProperty("identityToken", $"XBL3.0 x={Tokens(1)};{Tokens(0)}")).ToString(0)
|
|
Dim Request As String = New JObject(New JProperty("identityToken", $"XBL3.0 x={Tokens(1)};{Tokens(0)}")).ToString(0)
|
|
|
Dim Result As String
|
|
Dim Result As String
|
|
|
Try
|
|
Try
|
|
|
- Result = NetRequestMulty("https://api.minecraftservices.com/authentication/login_with_xbox", "POST", Request, "application/json", 2)
|
|
|
|
|
|
|
+ Result = NetRequestRetry("https://api.minecraftservices.com/authentication/login_with_xbox", "POST", Request, "application/json")
|
|
|
Catch ex As Net.WebException
|
|
Catch ex As Net.WebException
|
|
|
Dim Message As String = GetExceptionSummary(ex)
|
|
Dim Message As String = GetExceptionSummary(ex)
|
|
|
If Message.Contains("(429)") Then
|
|
If Message.Contains("(429)") Then
|
|
@@ -996,11 +997,11 @@ SystemBrowser:
|
|
|
Dim AccessToken As String = ResultJson("access_token").ToString
|
|
Dim AccessToken As String = ResultJson("access_token").ToString
|
|
|
Return AccessToken
|
|
Return AccessToken
|
|
|
End Function
|
|
End Function
|
|
|
- '微软登录步骤 6:验证微软账号是否持有 MC,这也会刷新 XGP
|
|
|
|
|
- Private Sub MsLoginStep6(AccessToken As String)
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 6")
|
|
|
|
|
|
|
+ '微软登录步骤 5:验证微软账号是否持有 MC,这也会刷新 XGP
|
|
|
|
|
+ Private Sub MsLoginStep5(AccessToken As String)
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 5/6")
|
|
|
|
|
|
|
|
- Dim Result As String = NetRequestMulty("https://api.minecraftservices.com/entitlements/mcstore", "GET", "", "application/json", 2, New Dictionary(Of String, String) From {{"Authorization", "Bearer " & AccessToken}})
|
|
|
|
|
|
|
+ Dim Result As String = NetRequestMultiple("https://api.minecraftservices.com/entitlements/mcstore", "GET", "", "application/json", 2, New Dictionary(Of String, String) From {{"Authorization", "Bearer " & AccessToken}})
|
|
|
Try
|
|
Try
|
|
|
Dim ResultJson As JObject = GetJson(Result)
|
|
Dim ResultJson As JObject = GetJson(Result)
|
|
|
If Not (ResultJson.ContainsKey("items") AndAlso ResultJson("items").Any) Then
|
|
If Not (ResultJson.ContainsKey("items") AndAlso ResultJson("items").Any) Then
|
|
@@ -1015,13 +1016,13 @@ SystemBrowser:
|
|
|
Throw
|
|
Throw
|
|
|
End Try
|
|
End Try
|
|
|
End Sub
|
|
End Sub
|
|
|
- '微软登录步骤 7:从 Minecraft AccessToken 获取 {UUID, UserName, ProfileJson}
|
|
|
|
|
- Private Function MsLoginStep7(AccessToken As String) As String()
|
|
|
|
|
- McLaunchLog("开始微软登录步骤 7")
|
|
|
|
|
|
|
+ '微软登录步骤 6:从 Minecraft AccessToken 获取 {UUID, UserName, ProfileJson}
|
|
|
|
|
+ Private Function MsLoginStep6(AccessToken As String) As String()
|
|
|
|
|
+ McLaunchLog("开始微软登录步骤 6/6")
|
|
|
|
|
|
|
|
Dim Result As String
|
|
Dim Result As String
|
|
|
Try
|
|
Try
|
|
|
- Result = NetRequestMulty("https://api.minecraftservices.com/minecraft/profile", "GET", "", "application/json", 2, New Dictionary(Of String, String) From {{"Authorization", "Bearer " & AccessToken}})
|
|
|
|
|
|
|
+ Result = NetRequestMultiple("https://api.minecraftservices.com/minecraft/profile", "GET", "", "application/json", 2, New Dictionary(Of String, String) From {{"Authorization", "Bearer " & AccessToken}})
|
|
|
Catch ex As Net.WebException
|
|
Catch ex As Net.WebException
|
|
|
Dim Message As String = GetExceptionSummary(ex)
|
|
Dim Message As String = GetExceptionSummary(ex)
|
|
|
If Message.Contains("(429)") Then
|
|
If Message.Contains("(429)") Then
|
|
@@ -1069,7 +1070,7 @@ SystemBrowser:
|
|
|
Case 3
|
|
Case 3
|
|
|
'使用正版用户名
|
|
'使用正版用户名
|
|
|
Try
|
|
Try
|
|
|
- If Not SkinName = "" Then
|
|
|
|
|
|
|
+ If SkinName <> "" AndAlso McVersionCurrent.Version.McCodeMain < 20 Then '1.20+ 或快照版不能使用该项(#3746)
|
|
|
Log("[Skin] 由于离线皮肤设置,使用正版 UUID:" & SkinName)
|
|
Log("[Skin] 由于离线皮肤设置,使用正版 UUID:" & SkinName)
|
|
|
Uuid = McLoginMojangUuid(SkinName, False)
|
|
Uuid = McLoginMojangUuid(SkinName, False)
|
|
|
End If
|
|
End If
|
|
@@ -1199,7 +1200,7 @@ SystemBrowser:
|
|
|
'统一通行证检测
|
|
'统一通行证检测
|
|
|
If Setup.Get("LoginType") = McLoginType.Nide Then
|
|
If Setup.Get("LoginType") = McLoginType.Nide Then
|
|
|
'至少 Java 8u101
|
|
'至少 Java 8u101
|
|
|
- MinVer = If(New Version(1, 8, 0, 101) > MinVer, New Version(1, 8, 0, 101), MinVer)
|
|
|
|
|
|
|
+ MinVer = If(New Version(1, 8, 0, 141) > MinVer, New Version(1, 8, 0, 141), MinVer)
|
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
SyncLock JavaLock
|
|
SyncLock JavaLock
|
|
@@ -1226,12 +1227,12 @@ SystemBrowser:
|
|
|
ElseIf MaxVer < New Version(1, 8, 0, 0) Then
|
|
ElseIf MaxVer < New Version(1, 8, 0, 0) Then
|
|
|
JavaCode = 7
|
|
JavaCode = 7
|
|
|
If Not JavaDownloadConfirm("Java 7", True) Then Throw New Exception("$$")
|
|
If Not JavaDownloadConfirm("Java 7", True) Then Throw New Exception("$$")
|
|
|
- ElseIf MinVer > New Version(1, 8, 0, 100) AndAlso MaxVer < New Version(1, 8, 0, 321) Then
|
|
|
|
|
- JavaCode = "8u101"
|
|
|
|
|
- If Not JavaDownloadConfirm("Java 8.0.101 ~ 8.0.320", True) Then Throw New Exception("$$")
|
|
|
|
|
- ElseIf MinVer > New Version(1, 8, 0, 100) Then
|
|
|
|
|
- JavaCode = "8u101"
|
|
|
|
|
- If Not JavaDownloadConfirm("Java 8.0.101 或更高版本的 Java 8", True) Then Throw New Exception("$$")
|
|
|
|
|
|
|
+ ElseIf MinVer > New Version(1, 8, 0, 140) AndAlso MaxVer < New Version(1, 8, 0, 321) Then
|
|
|
|
|
+ JavaCode = "8u141"
|
|
|
|
|
+ If Not JavaDownloadConfirm("Java 8.0.141 ~ 8.0.320", True) Then Throw New Exception("$$")
|
|
|
|
|
+ ElseIf MinVer > New Version(1, 8, 0, 140) Then
|
|
|
|
|
+ JavaCode = "8u141"
|
|
|
|
|
+ If Not JavaDownloadConfirm("Java 8.0.141 或更高版本的 Java 8", True) Then Throw New Exception("$$")
|
|
|
ElseIf MaxVer < New Version(1, 8, 0, 321) Then
|
|
ElseIf MaxVer < New Version(1, 8, 0, 321) Then
|
|
|
JavaCode = 8
|
|
JavaCode = 8
|
|
|
If Not JavaDownloadConfirm("Java 8.0.320 或更低版本的 Java 8") Then Throw New Exception("$$")
|
|
If Not JavaDownloadConfirm("Java 8.0.320 或更低版本的 Java 8") Then Throw New Exception("$$")
|
|
@@ -1276,44 +1277,36 @@ SystemBrowser:
|
|
|
''' 释放 Java Wrapper 并返回完整文件路径。
|
|
''' 释放 Java Wrapper 并返回完整文件路径。
|
|
|
''' </summary>
|
|
''' </summary>
|
|
|
Public Function ExtractJavaWrapper() As String
|
|
Public Function ExtractJavaWrapper() As String
|
|
|
- Dim BaseDir As String = GetJavaWrapperDir()
|
|
|
|
|
- Dim WrapperPath As String = BaseDir & "\JavaWrapper.jar"
|
|
|
|
|
|
|
+ Dim WrapperPath As String = PathPure & "JavaWrapper.jar"
|
|
|
Log("[Java] 选定的 Java Wrapper 路径:" & WrapperPath)
|
|
Log("[Java] 选定的 Java Wrapper 路径:" & WrapperPath)
|
|
|
SyncLock ExtractJavaWrapperLock '避免 OptiFine 和 Forge 安装时同时释放 Java Wrapper 导致冲突
|
|
SyncLock ExtractJavaWrapperLock '避免 OptiFine 和 Forge 安装时同时释放 Java Wrapper 导致冲突
|
|
|
- Dim IsWrapperWritten As Boolean = WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
- If Not IsWrapperWritten AndAlso File.Exists(WrapperPath) Then
|
|
|
|
|
- '以下为 #4243 的修复,因为未知原因 Java Wrapper 可能变为只读文件
|
|
|
|
|
- Log("[Java] Java Wrapper 文件释放失败,但文件已存在,将在删除后尝试重新生成", LogLevel.Debug)
|
|
|
|
|
- Try
|
|
|
|
|
- File.Delete(WrapperPath)
|
|
|
|
|
- IsWrapperWritten = WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
- Catch ex As Exception
|
|
|
|
|
- Log(ex, "Java Wrapper 文件重新释放失败,将尝试更换文件名重新生成")
|
|
|
|
|
- WrapperPath = BaseDir & "\JavaWrapper2.jar"
|
|
|
|
|
- IsWrapperWritten = WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
- End Try
|
|
|
|
|
- End If
|
|
|
|
|
- If Not IsWrapperWritten Then Throw New FileNotFoundException("释放 Java Wrapper 失败,请查看 PCL 日志查找详细信息")
|
|
|
|
|
|
|
+ Try
|
|
|
|
|
+ WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
+ Catch ex As Exception
|
|
|
|
|
+ If File.Exists(WrapperPath) Then
|
|
|
|
|
+ '因为未知原因 Java Wrapper 可能变为只读文件(#4243)
|
|
|
|
|
+ Log(ex, "Java Wrapper 文件释放失败,但文件已存在,将在删除后尝试重新生成", LogLevel.Developer)
|
|
|
|
|
+ Try
|
|
|
|
|
+ File.Delete(WrapperPath)
|
|
|
|
|
+ WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
+ Catch ex2 As Exception
|
|
|
|
|
+ Log(ex2, "Java Wrapper 文件重新释放失败,将尝试更换文件名重新生成", LogLevel.Developer)
|
|
|
|
|
+ WrapperPath = PathPure & "JavaWrapper2.jar"
|
|
|
|
|
+ Try
|
|
|
|
|
+ WriteFile(WrapperPath, GetResources("JavaWrapper"))
|
|
|
|
|
+ Catch ex3 As Exception
|
|
|
|
|
+ Throw New FileNotFoundException("释放 Java Wrapper 最终尝试失败", ex3)
|
|
|
|
|
+ End Try
|
|
|
|
|
+ End Try
|
|
|
|
|
+ Else
|
|
|
|
|
+ Throw New FileNotFoundException("释放 Java Wrapper 失败", ex)
|
|
|
|
|
+ End If
|
|
|
|
|
+ End Try
|
|
|
End SyncLock
|
|
End SyncLock
|
|
|
Return WrapperPath
|
|
Return WrapperPath
|
|
|
End Function
|
|
End Function
|
|
|
Private ExtractJavaWrapperLock As New Object
|
|
Private ExtractJavaWrapperLock As New Object
|
|
|
|
|
|
|
|
- ''' <summary>
|
|
|
|
|
- ''' 获取 Java Wrapper 所在的文件夹,不以 \ 结尾。
|
|
|
|
|
- ''' </summary>
|
|
|
|
|
- Public Function GetJavaWrapperDir() As String
|
|
|
|
|
- If (Path & "PCL").IsASCII() Then
|
|
|
|
|
- Return Path & "PCL"
|
|
|
|
|
- ElseIf PathAppdata.IsASCII() Then
|
|
|
|
|
- Return PathAppdata.TrimEnd("\")
|
|
|
|
|
- ElseIf PathTemp.IsASCII() Then
|
|
|
|
|
- Return PathTemp.TrimEnd("\")
|
|
|
|
|
- Else
|
|
|
|
|
- Return OsDrive & "ProgramData\PCL"
|
|
|
|
|
- End If
|
|
|
|
|
- End Function
|
|
|
|
|
-
|
|
|
|
|
'主方法,合并 Jvm、Game、Replace 三部分的参数数据
|
|
'主方法,合并 Jvm、Game、Replace 三部分的参数数据
|
|
|
Private Sub McLaunchArgumentMain(Loader As LoaderTask(Of String, List(Of McLibToken)))
|
|
Private Sub McLaunchArgumentMain(Loader As LoaderTask(Of String, List(Of McLibToken)))
|
|
|
McLaunchLog("开始获取 Minecraft 启动参数")
|
|
McLaunchLog("开始获取 Minecraft 启动参数")
|
|
@@ -1354,8 +1347,12 @@ SystemBrowser:
|
|
|
Arguments = Arguments.Replace(" -Dos.name=Windows 10", " -Dos.name=""Windows 10""")
|
|
Arguments = Arguments.Replace(" -Dos.name=Windows 10", " -Dos.name=""Windows 10""")
|
|
|
'全屏
|
|
'全屏
|
|
|
If Setup.Get("LaunchArgumentWindowType") = 0 Then Arguments += " --fullscreen"
|
|
If Setup.Get("LaunchArgumentWindowType") = 0 Then Arguments += " --fullscreen"
|
|
|
|
|
+ '由 Option 传入的额外参数
|
|
|
|
|
+ For Each Arg In CurrentLaunchOptions.ExtraArgs
|
|
|
|
|
+ Arguments += " " & Arg.Trim
|
|
|
|
|
+ Next
|
|
|
'进服
|
|
'进服
|
|
|
- Dim Server As String = If(String.IsNullOrEmpty(McLaunchLoader.Input.ServerIp), Setup.Get("VersionServerEnter", McVersionCurrent), McLaunchLoader.Input.ServerIp)
|
|
|
|
|
|
|
+ Dim Server As String = If(String.IsNullOrEmpty(CurrentLaunchOptions.ServerIp), Setup.Get("VersionServerEnter", McVersionCurrent), CurrentLaunchOptions.ServerIp)
|
|
|
If Server.Length > 0 Then
|
|
If Server.Length > 0 Then
|
|
|
If McVersionCurrent.ReleaseTime > New Date(2023, 4, 4) Then
|
|
If McVersionCurrent.ReleaseTime > New Date(2023, 4, 4) Then
|
|
|
'QuickPlay
|
|
'QuickPlay
|
|
@@ -1409,7 +1406,7 @@ SystemBrowser:
|
|
|
Setup.Get("VersionServerAuthServer", Version:=McVersionCurrent))
|
|
Setup.Get("VersionServerAuthServer", Version:=McVersionCurrent))
|
|
|
Try
|
|
Try
|
|
|
Dim Response As String = NetGetCodeByRequestRetry(Server, Encoding.UTF8)
|
|
Dim Response As String = NetGetCodeByRequestRetry(Server, Encoding.UTF8)
|
|
|
- DataList.Insert(0, "-javaagent:""" & PathAppdata & "authlib-injector.jar""=" & Server &
|
|
|
|
|
|
|
+ DataList.Insert(0, "-javaagent:""" & PathPure & "authlib-injector.jar""=" & Server &
|
|
|
" -Dauthlibinjector.side=client" &
|
|
" -Dauthlibinjector.side=client" &
|
|
|
" -Dauthlibinjector.yggdrasil.prefetched=" & Convert.ToBase64String(Encoding.UTF8.GetBytes(Response)))
|
|
" -Dauthlibinjector.yggdrasil.prefetched=" & Convert.ToBase64String(Encoding.UTF8.GetBytes(Response)))
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
@@ -1419,7 +1416,7 @@ SystemBrowser:
|
|
|
|
|
|
|
|
'添加 Java Wrapper 作为主 Jar
|
|
'添加 Java Wrapper 作为主 Jar
|
|
|
If McLaunchJavaSelected.VersionCode >= 9 Then DataList.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED")
|
|
If McLaunchJavaSelected.VersionCode >= 9 Then DataList.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED")
|
|
|
- DataList.Add("-Doolloo.jlw.tmpdir=""" & GetJavaWrapperDir() & """")
|
|
|
|
|
|
|
+ DataList.Add("-Doolloo.jlw.tmpdir=""" & PathPure.TrimEnd("\") & """")
|
|
|
DataList.Add("-jar """ & ExtractJavaWrapper() & """")
|
|
DataList.Add("-jar """ & ExtractJavaWrapper() & """")
|
|
|
|
|
|
|
|
'添加 MainClass
|
|
'添加 MainClass
|
|
@@ -1476,7 +1473,7 @@ NextVersion:
|
|
|
Setup.Get("VersionServerAuthServer", Version:=McVersionCurrent))
|
|
Setup.Get("VersionServerAuthServer", Version:=McVersionCurrent))
|
|
|
Try
|
|
Try
|
|
|
Dim Response As String = NetGetCodeByRequestRetry(Server, Encoding.UTF8)
|
|
Dim Response As String = NetGetCodeByRequestRetry(Server, Encoding.UTF8)
|
|
|
- DataList.Insert(0, "-javaagent:""" & PathAppdata & "authlib-injector.jar""=" & Server &
|
|
|
|
|
|
|
+ DataList.Insert(0, "-javaagent:""" & PathPure & "authlib-injector.jar""=" & Server &
|
|
|
" -Dauthlibinjector.side=client" &
|
|
" -Dauthlibinjector.side=client" &
|
|
|
" -Dauthlibinjector.yggdrasil.prefetched=" & Convert.ToBase64String(Encoding.UTF8.GetBytes(Response)))
|
|
" -Dauthlibinjector.yggdrasil.prefetched=" & Convert.ToBase64String(Encoding.UTF8.GetBytes(Response)))
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
@@ -1486,7 +1483,7 @@ NextVersion:
|
|
|
|
|
|
|
|
'添加 Java Wrapper 作为主 Jar
|
|
'添加 Java Wrapper 作为主 Jar
|
|
|
If McLaunchJavaSelected.VersionCode >= 9 Then DataList.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED")
|
|
If McLaunchJavaSelected.VersionCode >= 9 Then DataList.Add("--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED")
|
|
|
- DataList.Add("-Doolloo.jlw.tmpdir=""" & GetJavaWrapperDir() & """")
|
|
|
|
|
|
|
+ DataList.Add("-Doolloo.jlw.tmpdir=""" & PathPure.TrimEnd("\") & """")
|
|
|
DataList.Add("-jar """ & ExtractJavaWrapper() & """")
|
|
DataList.Add("-jar """ & ExtractJavaWrapper() & """")
|
|
|
|
|
|
|
|
'将 "-XXX" 与后面 "XXX" 合并到一起
|
|
'将 "-XXX" 与后面 "XXX" 合并到一起
|
|
@@ -1661,8 +1658,11 @@ NextVersion:
|
|
|
GameSize = New Size(875 - 2, 540 - 2)
|
|
GameSize = New Size(875 - 2, 540 - 2)
|
|
|
End Select
|
|
End Select
|
|
|
GameSize.Height -= 29.5 * DPI / 96 '标题栏高度
|
|
GameSize.Height -= 29.5 * DPI / 96 '标题栏高度
|
|
|
- If McVersionCurrent.Version.McCodeMain <= 12 AndAlso McLaunchJavaSelected.VersionCode <= 8 AndAlso
|
|
|
|
|
- Not McVersionCurrent.Version.HasOptiFine AndAlso Not McVersionCurrent.Version.HasForge Then '修复 #3463:1.12.2-,JRE 8 下窗口大小为设置大小的 DPI% 倍
|
|
|
|
|
|
|
+ If McVersionCurrent.Version.McCodeMain <= 12 AndAlso
|
|
|
|
|
+ McLaunchJavaSelected.VersionCode <= 8 AndAlso McLaunchJavaSelected.Version.Revision >= 200 AndAlso McLaunchJavaSelected.Version.Revision <= 321 AndAlso
|
|
|
|
|
+ Not McVersionCurrent.Version.HasOptiFine AndAlso Not McVersionCurrent.Version.HasForge Then
|
|
|
|
|
+ '修复 #3463:1.12.2-,JRE 8u200~321 下窗口大小为设置大小的 DPI% 倍
|
|
|
|
|
+ McLaunchLog($"已应用窗口大小过大修复({McLaunchJavaSelected.Version.Revision})")
|
|
|
GameSize.Width /= DPI / 96
|
|
GameSize.Width /= DPI / 96
|
|
|
GameSize.Height /= DPI / 96
|
|
GameSize.Height /= DPI / 96
|
|
|
End If
|
|
End If
|
|
@@ -1785,7 +1785,6 @@ NextVersion:
|
|
|
{
|
|
{
|
|
|
""authenticationDatabase"": {
|
|
""authenticationDatabase"": {
|
|
|
""00000111112222233333444445555566"": {
|
|
""00000111112222233333444445555566"": {
|
|
|
- ""accessToken"": """ & McLoginLoader.Output.AccessToken & """,
|
|
|
|
|
""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
|
|
""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
|
|
|
""profiles"": {
|
|
""profiles"": {
|
|
|
""66666555554444433333222221111100"": {
|
|
""66666555554444433333222221111100"": {
|
|
@@ -1816,7 +1815,6 @@ NextVersion:
|
|
|
{
|
|
{
|
|
|
""authenticationDatabase"": {
|
|
""authenticationDatabase"": {
|
|
|
""00000111112222233333444445555566"": {
|
|
""00000111112222233333444445555566"": {
|
|
|
- ""accessToken"": """ & McLoginLoader.Output.AccessToken & """,
|
|
|
|
|
""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
|
|
""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
|
|
|
""profiles"": {
|
|
""profiles"": {
|
|
|
""66666555554444433333222221111100"": {
|
|
""66666555554444433333222221111100"": {
|
|
@@ -1892,16 +1890,12 @@ NextVersion:
|
|
|
End Try
|
|
End Try
|
|
|
|
|
|
|
|
'离线皮肤 Alex 警告
|
|
'离线皮肤 Alex 警告
|
|
|
- Try
|
|
|
|
|
- If McVersionCurrent.Version.McCodeMain <= 7 AndAlso McVersionCurrent.Version.McCodeMain >= 2 AndAlso '1.7 ~ 1.2
|
|
|
|
|
|
|
+ If McVersionCurrent.Version.McCodeMain <= 7 AndAlso McVersionCurrent.Version.McCodeMain >= 2 AndAlso '1.2 ~ 1.7
|
|
|
McLoginLoader.Input.Type = McLoginType.Legacy AndAlso '离线登录
|
|
McLoginLoader.Input.Type = McLoginType.Legacy AndAlso '离线登录
|
|
|
(Setup.Get("LaunchSkinType") = 2 OrElse '强制 Alex
|
|
(Setup.Get("LaunchSkinType") = 2 OrElse '强制 Alex
|
|
|
(Setup.Get("LaunchSkinType") = 4 AndAlso Setup.Get("LaunchSkinSlim"))) Then '或选用 Alex 皮肤
|
|
(Setup.Get("LaunchSkinType") = 4 AndAlso Setup.Get("LaunchSkinSlim"))) Then '或选用 Alex 皮肤
|
|
|
- Hint("此 Minecraft 版本尚不支持 Alex 皮肤,你的皮肤可能会显示为 Steve!", HintType.Critical)
|
|
|
|
|
- End If
|
|
|
|
|
- Catch ex As Exception
|
|
|
|
|
- Log(ex, "检查离线皮肤失效失败")
|
|
|
|
|
- End Try
|
|
|
|
|
|
|
+ Hint("此 Minecraft 版本尚不支持 Alex 皮肤,你的皮肤可能会显示为 Steve!", HintType.Critical)
|
|
|
|
|
+ End If
|
|
|
|
|
|
|
|
'离线皮肤资源包
|
|
'离线皮肤资源包
|
|
|
Try
|
|
Try
|
|
@@ -2054,25 +2048,25 @@ IgnoreCustomSkin:
|
|
|
"@echo off" & vbCrLf &
|
|
"@echo off" & vbCrLf &
|
|
|
"title 启动 - " & McVersionCurrent.Name & vbCrLf &
|
|
"title 启动 - " & McVersionCurrent.Name & vbCrLf &
|
|
|
"echo 游戏正在启动,请稍候。" & vbCrLf &
|
|
"echo 游戏正在启动,请稍候。" & vbCrLf &
|
|
|
- "set APPDATA=""" & PathMcFolder & """" & vbCrLf &
|
|
|
|
|
- "cd /D """ & PathMcFolder & """" & vbCrLf &
|
|
|
|
|
|
|
+ "set APPDATA=""" & McVersionCurrent.PathIndie & """" & vbCrLf &
|
|
|
|
|
+ "cd /D """ & McVersionCurrent.PathIndie & """" & vbCrLf &
|
|
|
CustomCommandGlobal & vbCrLf &
|
|
CustomCommandGlobal & vbCrLf &
|
|
|
CustomCommandVersion & vbCrLf &
|
|
CustomCommandVersion & vbCrLf &
|
|
|
"""" & McLaunchJavaSelected.PathJava & """ " & McLaunchArgument & vbCrLf &
|
|
"""" & McLaunchJavaSelected.PathJava & """ " & McLaunchArgument & vbCrLf &
|
|
|
"echo 游戏已退出。" & vbCrLf &
|
|
"echo 游戏已退出。" & vbCrLf &
|
|
|
"pause"
|
|
"pause"
|
|
|
- WriteFile(If(McLaunchLoader.Input.SaveBatch, Path & "PCL\LatestLaunch.bat"), SecretFilter(CmdString, "F"),
|
|
|
|
|
|
|
+ WriteFile(If(CurrentLaunchOptions.SaveBatch, Path & "PCL\LatestLaunch.bat"), SecretFilter(CmdString, "F"),
|
|
|
Encoding:=If(Encoding.Default.Equals(Encoding.UTF8), Encoding.UTF8, Encoding.GetEncoding("GB18030")))
|
|
Encoding:=If(Encoding.Default.Equals(Encoding.UTF8), Encoding.UTF8, Encoding.GetEncoding("GB18030")))
|
|
|
- If McLaunchLoader.Input.SaveBatch IsNot Nothing Then
|
|
|
|
|
|
|
+ If CurrentLaunchOptions.SaveBatch IsNot Nothing Then
|
|
|
McLaunchLog("导出启动脚本完成,强制结束启动过程")
|
|
McLaunchLog("导出启动脚本完成,强制结束启动过程")
|
|
|
AbortHint = "导出启动脚本成功!"
|
|
AbortHint = "导出启动脚本成功!"
|
|
|
- OpenExplorer("/select,""" & McLaunchLoader.Input.SaveBatch & """")
|
|
|
|
|
|
|
+ OpenExplorer("/select,""" & CurrentLaunchOptions.SaveBatch & """")
|
|
|
Loader.Parent.Abort()
|
|
Loader.Parent.Abort()
|
|
|
Exit Sub '导出脚本完成
|
|
Exit Sub '导出脚本完成
|
|
|
End If
|
|
End If
|
|
|
Catch ex As Exception
|
|
Catch ex As Exception
|
|
|
Log(ex, "输出启动脚本失败")
|
|
Log(ex, "输出启动脚本失败")
|
|
|
- If McLaunchLoader.Input.SaveBatch IsNot Nothing Then Throw ex '直接触发启动失败
|
|
|
|
|
|
|
+ If CurrentLaunchOptions.SaveBatch IsNot Nothing Then Throw ex '直接触发启动失败
|
|
|
End Try
|
|
End Try
|
|
|
|
|
|
|
|
'执行自定义命令
|
|
'执行自定义命令
|
|
@@ -2143,6 +2137,8 @@ IgnoreCustomSkin:
|
|
|
StartInfo.EnvironmentVariables("Path") = Join(Paths.Distinct.ToList, ";")
|
|
StartInfo.EnvironmentVariables("Path") = Join(Paths.Distinct.ToList, ";")
|
|
|
|
|
|
|
|
'设置其他参数
|
|
'设置其他参数
|
|
|
|
|
+ StartInfo.StandardErrorEncoding = Encoding.UTF8
|
|
|
|
|
+ StartInfo.StandardOutputEncoding = Encoding.UTF8
|
|
|
StartInfo.WorkingDirectory = McVersionCurrent.PathIndie
|
|
StartInfo.WorkingDirectory = McVersionCurrent.PathIndie
|
|
|
StartInfo.UseShellExecute = False
|
|
StartInfo.UseShellExecute = False
|
|
|
StartInfo.RedirectStandardOutput = True
|
|
StartInfo.RedirectStandardOutput = True
|